@metaphi-ai/hum 0.2.53 → 0.2.54

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/cli.mjs +60 -9
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -89511,7 +89511,7 @@ var init_install = __esm({
89511
89511
  "src/install.js"() {
89512
89512
  init_define_HUM_CORE_SUBS();
89513
89513
  win = process.platform === "win32";
89514
- MINE = true ? "0.2.53" : "";
89514
+ MINE = true ? "0.2.54" : "";
89515
89515
  npmFix = (version = "") => `npm i -g @metaphi-ai/hum@${version || "latest"} --foreground-scripts`;
89516
89516
  NPM_FIX = npmFix("latest");
89517
89517
  humHome = (env3 = process.env) => env3.HUM_HOME || path.join(os3.homedir(), ".hum");
@@ -89866,10 +89866,10 @@ function clientEnv() {
89866
89866
  platform: process.platform,
89867
89867
  arch: process.arch,
89868
89868
  terminal: process.env.TERM_PROGRAM || (process.env.WT_SESSION ? "Windows Terminal" : process.env.TERM || ""),
89869
- tui: true ? "0.2.53" : ""
89869
+ tui: true ? "0.2.54" : ""
89870
89870
  };
89871
89871
  }
89872
- function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.53" : "" } = {}) {
89872
+ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.54" : "" } = {}) {
89873
89873
  const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
89874
89874
  const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
89875
89875
  if (!refused) {
@@ -91384,7 +91384,7 @@ var after = (ms, fn) => {
91384
91384
 
91385
91385
  // src/app.jsx
91386
91386
  var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
91387
- var MINE2 = true ? "0.2.53" : "";
91387
+ var MINE2 = true ? "0.2.54" : "";
91388
91388
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
91389
91389
  var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
91390
91390
  var shortSession = (name) => (name || "").replace(/\.jsonl$/, "");
@@ -91574,6 +91574,52 @@ function ToolList({ about, tools, indent = 4 }) {
91574
91574
  ] }) }, t.name);
91575
91575
  }) });
91576
91576
  }
91577
+ var INSTRUCTION_LINES = 8;
91578
+ var serverAbout = (s) => {
91579
+ const info = s.server || {};
91580
+ const lines = String(typeof s.instructions === "string" ? s.instructions : "").replace(/\r/g, "").split("\n").map((l) => l.trimEnd());
91581
+ while (lines.length && !lines[0].trim()) lines.shift();
91582
+ const subtitle = info.description || lines[0] || "";
91583
+ if (lines.length && lines[0].trim() === subtitle.trim()) lines.shift();
91584
+ while (lines.length && !lines[0].trim()) lines.shift();
91585
+ while (lines.length && !lines.at(-1).trim()) lines.pop();
91586
+ const body = lines.filter((l, i) => l.trim() || (lines[i - 1] || "").trim());
91587
+ const version = info.version ? /^v\d/.test(info.version) ? info.version : `v${info.version}` : "";
91588
+ return {
91589
+ title: info.title || s.name,
91590
+ name: info.title && info.title !== s.name ? s.name : "",
91591
+ version,
91592
+ website: info.website || "",
91593
+ subtitle,
91594
+ body
91595
+ };
91596
+ };
91597
+ function ServerDetail({ s, full = false }) {
91598
+ const { stdout } = use_stdout_default();
91599
+ const cols = Math.max(40, stdout && stdout.columns || 100);
91600
+ const a = serverAbout(s);
91601
+ const shown = full ? a.body : a.body.slice(0, INSTRUCTION_LINES);
91602
+ const more = a.body.length - shown.length;
91603
+ const meta = [a.name, a.version, a.website].filter(Boolean).join(" \xB7 ");
91604
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
91605
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 1, width: cols, children: [
91606
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { wrap: "truncate-end", children: [
91607
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, color: ACCENT, children: a.title }),
91608
+ meta ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` \xB7 ${meta}` }) : null
91609
+ ] }),
91610
+ a.subtitle ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { wrap: "wrap", children: a.subtitle }) : null,
91611
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { wrap: "truncate-end", children: [
91612
+ serverMark(s),
91613
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `${serverLine(s)} \xB7 ${s.at}` })
91614
+ ] })
91615
+ ] }),
91616
+ shown.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginTop: 1, paddingLeft: 3, width: cols, children: [
91617
+ shown.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { wrap: "wrap", dimColor: !full, children: l || " " }, i)),
91618
+ more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `\u2026 ${more} more line${more === 1 ? "" : "s"} \xB7 e shows all` }) : null
91619
+ ] }) : null,
91620
+ !full && (s.about?.length || s.tools?.length) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToolList, { about: s.about, tools: s.tools, indent: 3 }) }) : null
91621
+ ] });
91622
+ }
91577
91623
  var serverLine = (s) => s.state === "connected" ? `connected \xB7 ${s.tools.length} tool${s.tools.length === 1 ? "" : "s"}${s.signed_in ? " \xB7 signed in" : ""}` : s.state;
91578
91624
  var serverActions = (s) => [
91579
91625
  { do: "tools", label: "show tools" },
@@ -92372,6 +92418,7 @@ ${r.content}`).join("\n\n") };
92372
92418
  append({ kind: "warn", text: `no server named ${want} here` });
92373
92419
  break;
92374
92420
  }
92421
+ if (want) append({ kind: "server", server: servers[at] });
92375
92422
  setPicker({ kind: "mcp", servers, index: at, step: want ? "action" : "server", action: 0 });
92376
92423
  break;
92377
92424
  }
@@ -92811,13 +92858,16 @@ ${r.content}`).join("\n\n") };
92811
92858
  if (key.upArrow) move("index", picker.servers.length, -1);
92812
92859
  else if (key.downArrow || key.tab) move("index", picker.servers.length, 1);
92813
92860
  else if (key.escape) setPicker(null);
92814
- else if (key.return) setPicker((p) => ({ ...p, step: "action", action: 0 }));
92815
- else if (/^[1-9]$/.test(input) && Number(input) <= picker.servers.length) setPicker((p) => ({ ...p, index: Number(input) - 1 }));
92861
+ else if (key.return) {
92862
+ append({ kind: "server", server: s });
92863
+ setPicker((p) => ({ ...p, step: "action", action: 0 }));
92864
+ } else if (/^[1-9]$/.test(input) && Number(input) <= picker.servers.length) setPicker((p) => ({ ...p, index: Number(input) - 1 }));
92816
92865
  return;
92817
92866
  }
92818
92867
  if (key.upArrow) move("action", acts.length, -1);
92819
92868
  else if (key.downArrow || key.tab) move("action", acts.length, 1);
92820
92869
  else if (key.escape) setPicker((p) => ({ ...p, step: "server" }));
92870
+ else if (input === "e" && serverAbout(s).body.length > INSTRUCTION_LINES) append({ kind: "server", server: s, full: true });
92821
92871
  else if (key.return) {
92822
92872
  setPicker(null);
92823
92873
  const act = acts[picker.action];
@@ -93421,6 +93471,7 @@ ${r.content}`).join("\n\n") };
93421
93471
  ] }, src);
93422
93472
  })
93423
93473
  ] }),
93474
+ item.kind === "server" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ServerDetail, { s: item.server, full: item.full }),
93424
93475
  item.kind === "tools" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
93425
93476
  item.own && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
93426
93477
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
@@ -93589,7 +93640,7 @@ ${r.content}`).join("\n\n") };
93589
93640
  if (picker.step === "action") {
93590
93641
  const acts = serverActions(s);
93591
93642
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
93592
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
93643
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, wrap: "truncate-end", children: [
93593
93644
  s.name,
93594
93645
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` \xB7 ${serverLine(s)} \xB7 ${s.at}` })
93595
93646
  ] }),
@@ -93599,7 +93650,7 @@ ${r.content}`).join("\n\n") };
93599
93650
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: i === picker.action, dimColor: i !== picker.action, children: `${i + 1}. ${a.label}` })
93600
93651
  ] }, a.do)),
93601
93652
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93602
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Enter to choose \xB7 Esc to go back" })
93653
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `Enter to choose${serverAbout(s).body.length > INSTRUCTION_LINES ? " \xB7 e for all its instructions" : ""} \xB7 Esc to go back` })
93603
93654
  ] });
93604
93655
  }
93605
93656
  const nameW = Math.max(...picker.servers.map((m) => m.name.length));
@@ -93999,7 +94050,7 @@ async function sendPending({
93999
94050
  await init_theme();
94000
94051
  var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
94001
94052
  import { spawnSync as spawnSync6 } from "node:child_process";
94002
- var MINE3 = true ? "0.2.53" : "0.0.0";
94053
+ var MINE3 = true ? "0.2.54" : "0.0.0";
94003
94054
  var layout = installLayout();
94004
94055
  function completeInstall() {
94005
94056
  if (layout.kind !== "npm" || !needsInstall(MINE3)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaphi-ai/hum",
3
- "version": "0.2.53",
3
+ "version": "0.2.54",
4
4
  "description": "Hum: a self-improving coding agent for your terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",