@mtreeai/msapling-cli 2.3.6-beta.11 → 2.3.6-beta.13

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 +35 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8045,18 +8045,24 @@ async function promptPassword(prompt) {
8045
8045
  stdin.on("data", onData);
8046
8046
  });
8047
8047
  }
8048
- async function loginWithEmailPassword(email, context) {
8048
+ async function loginWithEmailPassword(email, context, preSuppliedPassword) {
8049
8049
  context.addMessage("system", `Logging in as ${email}...`);
8050
- let password = "";
8051
- try {
8052
- password = await promptPassword("Password: ");
8053
- if (!password) {
8054
- context.addMessage("system", "Login cancelled.");
8050
+ let password = preSuppliedPassword || process.env.MSAPLING_PASSWORD || "";
8051
+ if (!password) {
8052
+ context.addMessage(
8053
+ "system",
8054
+ "NOTE: the interactive password prompt is known to leak keystrokes into the REPL input. Safer alternatives: /login <email> <password> OR set MSAPLING_PASSWORD env var OR use /login <token>."
8055
+ );
8056
+ try {
8057
+ password = await promptPassword("Password: ");
8058
+ if (!password) {
8059
+ context.addMessage("system", "Login cancelled.");
8060
+ return;
8061
+ }
8062
+ } catch (err) {
8063
+ context.addMessage("error", `Password prompt failed: ${err}`);
8055
8064
  return;
8056
8065
  }
8057
- } catch (err) {
8058
- context.addMessage("error", `Password prompt failed: ${err}`);
8059
- return;
8060
8066
  }
8061
8067
  try {
8062
8068
  const result = await context.client.loginEmailPassword(email, password);
@@ -8184,10 +8190,10 @@ var init_login = __esm({
8184
8190
  context.addMessage(
8185
8191
  "system",
8186
8192
  `Usage:
8187
- /login your@email.com Sign in with email + password
8188
- /login github GitHub device flow
8189
- /login guest Anonymous guest session (limited tier)
8190
- /login <token> Paste an API token from msapling.com \u2192 Settings \u2192 API Keys`
8193
+ /login your@email.com [pwd] Sign in with email + password (pwd may also come from MSAPLING_PASSWORD env var)
8194
+ /login github GitHub device flow
8195
+ /login guest Anonymous guest session (limited tier)
8196
+ /login <token> Paste an API token from msapling.com \u2192 Settings \u2192 API Keys`
8191
8197
  );
8192
8198
  return;
8193
8199
  }
@@ -8196,7 +8202,8 @@ var init_login = __esm({
8196
8202
  } else if (arg === "guest") {
8197
8203
  await loginAsGuest(context);
8198
8204
  } else if (isEmailAddress(arg)) {
8199
- await loginWithEmailPassword(arg, context);
8205
+ const inlinePassword = args2[1];
8206
+ await loginWithEmailPassword(arg, context, inlinePassword);
8200
8207
  } else if (isTokenLike(arg)) {
8201
8208
  await context.storage.saveToken(arg);
8202
8209
  context.client.setToken(arg);
@@ -13288,7 +13295,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
13288
13295
  var Header = () => /* @__PURE__ */ jsxs(Box, { borderStyle: "single", borderColor: "cyan", paddingX: 1, marginBottom: 1, children: [
13289
13296
  /* @__PURE__ */ jsxs(Text, { bold: true, color: "cyan", children: [
13290
13297
  "\u25CF MSapling CLI v",
13291
- "2.3.6-beta.11"
13298
+ "2.3.6-beta.13"
13292
13299
  ] }),
13293
13300
  /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Platinum Tier Architecture" }) })
13294
13301
  ] });
@@ -13310,6 +13317,13 @@ function shouldShowCapMeter(user) {
13310
13317
  }
13311
13318
  var Footer = ({ user }) => {
13312
13319
  if (!user) return null;
13320
+ const num = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
13321
+ const fuel = num(user.fuel_credits);
13322
+ const tokensByok = num(user.tokens_byok);
13323
+ const costByok = num(user.cost_byok);
13324
+ const tokensOllama = num(user.tokens_ollama);
13325
+ const costOllama = num(user.cost_ollama);
13326
+ const tokensPurchased = num(user.tokens_purchased);
13313
13327
  const showCapMeter = shouldShowCapMeter(user);
13314
13328
  const dailyUsed = user.daily_tokens_used;
13315
13329
  const dailyLimit = user.daily_tokens_limit;
@@ -13320,26 +13334,26 @@ var Footer = ({ user }) => {
13320
13334
  /* @__PURE__ */ jsx2(Text2, { bold: true, children: "Usage Dashboard (6-Track)" }),
13321
13335
  /* @__PURE__ */ jsxs2(Text2, { color: "yellow", children: [
13322
13336
  "$",
13323
- user.fuel_credits.toFixed(4),
13337
+ fuel.toFixed(4),
13324
13338
  " Fuel"
13325
13339
  ] })
13326
13340
  ] }),
13327
13341
  /* @__PURE__ */ jsxs2(Box2, { flexDirection: "row", gap: 2, marginTop: 0, children: [
13328
13342
  /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
13329
13343
  "BYOK: ",
13330
- user.tokens_byok.toLocaleString(),
13344
+ tokensByok.toLocaleString(),
13331
13345
  " t / $",
13332
- user.cost_byok.toFixed(2)
13346
+ costByok.toFixed(2)
13333
13347
  ] }),
13334
13348
  /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
13335
13349
  "Ollama: ",
13336
- user.tokens_ollama.toLocaleString(),
13350
+ tokensOllama.toLocaleString(),
13337
13351
  " t / $",
13338
- user.cost_ollama.toFixed(2)
13352
+ costOllama.toFixed(2)
13339
13353
  ] }),
13340
13354
  /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
13341
13355
  "Purchased: ",
13342
- user.tokens_purchased.toLocaleString(),
13356
+ tokensPurchased.toLocaleString(),
13343
13357
  " t"
13344
13358
  ] })
13345
13359
  ] }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtreeai/msapling-cli",
3
- "version": "2.3.6-beta.11",
3
+ "version": "2.3.6-beta.13",
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",