@mtreeai/msapling-cli 2.3.6-beta.25 → 2.3.6-beta.27

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 +50 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -59,6 +59,28 @@ __export(src_exports, {
59
59
  MSaplingClient: () => MSaplingClient,
60
60
  MSaplingError: () => MSaplingError
61
61
  });
62
+ function normalizeDetail(detail) {
63
+ if (detail == null) return "";
64
+ if (typeof detail === "string") return detail;
65
+ if (Array.isArray(detail)) {
66
+ return detail.map((d) => {
67
+ if (!d || typeof d !== "object") return String(d);
68
+ const o = d;
69
+ const loc = Array.isArray(o.loc) ? o.loc.join(".") : "";
70
+ return [o.msg, loc && `(${loc})`].filter(Boolean).join(" ");
71
+ }).filter(Boolean).join("; ");
72
+ }
73
+ if (typeof detail === "object") {
74
+ const o = detail;
75
+ if (typeof o.msg === "string") return o.msg;
76
+ try {
77
+ return JSON.stringify(detail);
78
+ } catch {
79
+ return String(detail);
80
+ }
81
+ }
82
+ return String(detail);
83
+ }
62
84
  var MSaplingError, MSaplingClient;
63
85
  var init_src = __esm({
64
86
  "../api-client/src/index.ts"() {
@@ -143,7 +165,7 @@ var init_src = __esm({
143
165
  let code = "unknown";
144
166
  try {
145
167
  const err = await response.json();
146
- detail = err.detail || detail;
168
+ detail = normalizeDetail(err.detail) || detail;
147
169
  code = err.code || code;
148
170
  } catch (e) {
149
171
  }
@@ -771,7 +793,10 @@ var init_src = __esm({
771
793
  }
772
794
  if (!response.ok) {
773
795
  const err = await response.json().catch(() => ({ detail: response.statusText }));
774
- throw new MSaplingError(err.detail || "Stream request failed", response.status);
796
+ throw new MSaplingError(
797
+ normalizeDetail(err.detail) || "Stream request failed",
798
+ response.status
799
+ );
775
800
  }
776
801
  if (!response.body) throw new Error("No response body");
777
802
  const reader = response.body.getReader();
@@ -9088,15 +9113,18 @@ var init_keys = __esm({
9088
9113
  try {
9089
9114
  if (sub === "list" || sub === "status") {
9090
9115
  const s = await context.client.getProviderKeys();
9091
- const providers = s.providers ?? [];
9092
- context.addMessage("system", `Provider Keys (${providers.length}):`);
9093
- for (const p of providers) {
9094
- const tag = p.configured ? "\u2713" : " ";
9095
- const prefix = p.key_prefix ? ` (${p.key_prefix}\u2026)` : "";
9096
- context.addMessage("system", ` [${tag}] ${p.provider}${prefix}`);
9116
+ const entries = Object.entries(s).filter(
9117
+ ([k]) => !["providers", "status"].includes(k)
9118
+ );
9119
+ const configured = entries.filter(([, v]) => v?.has_key).length;
9120
+ context.addMessage("system", `Provider Keys (${configured}/${entries.length} configured):`);
9121
+ for (const [provider, info] of entries) {
9122
+ const tag = info?.has_key ? "\u2713" : " ";
9123
+ const masked = info?.masked ? ` (${info.masked})` : "";
9124
+ context.addMessage("system", ` [${tag}] ${provider}${masked}`);
9097
9125
  }
9098
- if (providers.length === 0) {
9099
- context.addMessage("system", " (none \u2014 add via /keys add <provider> <key>)");
9126
+ if (entries.length === 0) {
9127
+ context.addMessage("system", " (no providers returned by backend)");
9100
9128
  }
9101
9129
  return;
9102
9130
  }
@@ -9301,7 +9329,15 @@ var init_mdrive = __esm({
9301
9329
  }
9302
9330
  context.addMessage("error", `Unknown /mdrive subcommand '${sub}'. Try: ls, cat, put, get, rm, mv, mkdir.`);
9303
9331
  } catch (e) {
9304
- context.addMessage("error", `MDrive: ${e.message}`);
9332
+ const msg = String(e?.message ?? e);
9333
+ if (msg.includes("Invalid or revoked API key") || msg.includes("401")) {
9334
+ context.addMessage(
9335
+ "error",
9336
+ 'MDrive requires a paid account + MDrive API key. Generate one at https://msapling.com/settings \u2192 API Keys \u2192 "Create MDrive Key", then run /keys add mdrive <key>.'
9337
+ );
9338
+ } else {
9339
+ context.addMessage("error", `MDrive: ${msg}`);
9340
+ }
9305
9341
  }
9306
9342
  }
9307
9343
  };
@@ -10596,7 +10632,7 @@ var init_version = __esm({
10596
10632
  description: "Show version information for CLI and core packages",
10597
10633
  category: "debug",
10598
10634
  handler: async (_args, context) => {
10599
- const cliVersion = true ? "2.3.6-beta.25" : "(dev)";
10635
+ const cliVersion = true ? "2.3.6-beta.27" : "(dev)";
10600
10636
  const coreVersion = true ? "2.3.2" : "(dev)";
10601
10637
  const runtime = process.version;
10602
10638
  context.addMessage("system", "MSapling Version Info");
@@ -10605,7 +10641,7 @@ var init_version = __esm({
10605
10641
  context.addMessage("system", row2("Core (@msapling/core)", coreVersion));
10606
10642
  context.addMessage("system", row2("Runtime (Node/Bun)", runtime));
10607
10643
  try {
10608
- const ts = "2026-05-28T19:45:02.204Z";
10644
+ const ts = "2026-05-29T00:38:48.242Z";
10609
10645
  if (ts && ts !== "__BUILD_TIMESTAMP__") {
10610
10646
  context.addMessage("system", row2("Build Timestamp", ts));
10611
10647
  }
@@ -15018,7 +15054,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
15018
15054
  var Header = () => /* @__PURE__ */ jsxs(Box, { borderStyle: "single", borderColor: "cyan", paddingX: 1, marginBottom: 1, children: [
15019
15055
  /* @__PURE__ */ jsxs(Text, { bold: true, color: "cyan", children: [
15020
15056
  "\u25CF MSapling CLI v",
15021
- "2.3.6-beta.25"
15057
+ "2.3.6-beta.27"
15022
15058
  ] }),
15023
15059
  /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Platinum Tier Architecture" }) })
15024
15060
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtreeai/msapling-cli",
3
- "version": "2.3.6-beta.25",
3
+ "version": "2.3.6-beta.27",
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",