@metaphi-ai/hum 0.1.52 → 0.1.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 +41 -39
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -18663,7 +18663,7 @@ var require_react_reconciler_development = __commonJS({
18663
18663
  }
18664
18664
  }
18665
18665
  }
18666
- function initSuspenseListRenderState(workInProgress2, isBackwards, tail3, lastContentRow, tailMode) {
18666
+ function initSuspenseListRenderState(workInProgress2, isBackwards, tail2, lastContentRow, tailMode) {
18667
18667
  var renderState = workInProgress2.memoizedState;
18668
18668
  if (renderState === null) {
18669
18669
  workInProgress2.memoizedState = {
@@ -18671,7 +18671,7 @@ var require_react_reconciler_development = __commonJS({
18671
18671
  rendering: null,
18672
18672
  renderingStartTime: 0,
18673
18673
  last: lastContentRow,
18674
- tail: tail3,
18674
+ tail: tail2,
18675
18675
  tailMode
18676
18676
  };
18677
18677
  } else {
@@ -18679,7 +18679,7 @@ var require_react_reconciler_development = __commonJS({
18679
18679
  renderState.rendering = null;
18680
18680
  renderState.renderingStartTime = 0;
18681
18681
  renderState.last = lastContentRow;
18682
- renderState.tail = tail3;
18682
+ renderState.tail = tail2;
18683
18683
  renderState.tailMode = tailMode;
18684
18684
  }
18685
18685
  }
@@ -18711,19 +18711,19 @@ var require_react_reconciler_development = __commonJS({
18711
18711
  switch (revealOrder) {
18712
18712
  case "forwards": {
18713
18713
  var lastContentRow = findLastContentRow(workInProgress2.child);
18714
- var tail3;
18714
+ var tail2;
18715
18715
  if (lastContentRow === null) {
18716
- tail3 = workInProgress2.child;
18716
+ tail2 = workInProgress2.child;
18717
18717
  workInProgress2.child = null;
18718
18718
  } else {
18719
- tail3 = lastContentRow.sibling;
18719
+ tail2 = lastContentRow.sibling;
18720
18720
  lastContentRow.sibling = null;
18721
18721
  }
18722
18722
  initSuspenseListRenderState(
18723
18723
  workInProgress2,
18724
18724
  false,
18725
18725
  // isBackwards
18726
- tail3,
18726
+ tail2,
18727
18727
  lastContentRow,
18728
18728
  tailMode
18729
18729
  );
@@ -83545,7 +83545,7 @@ function runningVersion(candidates = engineCandidates(), opts = {}) {
83545
83545
  }
83546
83546
  return null;
83547
83547
  }
83548
- function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.52" : "" } = {}) {
83548
+ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.54" : "" } = {}) {
83549
83549
  const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
83550
83550
  const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
83551
83551
  if (!refused) {
@@ -83627,13 +83627,13 @@ function failureMessage(error) {
83627
83627
  ${error.hint}` : "");
83628
83628
  }
83629
83629
  function diedMessage(logPath, text = null) {
83630
- let tail3 = "";
83630
+ let tail2 = "";
83631
83631
  try {
83632
- tail3 = (text ?? fs4.readFileSync(logPath, "utf8")).trim().split("\n").slice(-3).join("\n").trim();
83632
+ tail2 = (text ?? fs4.readFileSync(logPath, "utf8")).trim().split("\n").slice(-3).join("\n").trim();
83633
83633
  } catch {
83634
83634
  }
83635
- return `the session did not start${tail3 ? `:
83636
- ${tail3}` : ""}
83635
+ return `the session did not start${tail2 ? `:
83636
+ ${tail2}` : ""}
83637
83637
  (its log: ${logPath})`;
83638
83638
  }
83639
83639
  async function spawnEngine(cwd2, { task = null, images = [], resume = null, candidates = engineCandidates() } = {}) {
@@ -84960,7 +84960,7 @@ async function diagnose({
84960
84960
  if (st && st.version) {
84961
84961
  const ready = readyVersion(layout2, st.version);
84962
84962
  checks.push(check("ok", `last background update: ${st.version}, started ${st.started ? new Date(st.started).toISOString() : "?"}${ready ? " \xB7 ready, takes effect on restart" : ""}`));
84963
- const last = tail2(path6.join(home, "update.log"));
84963
+ const last = tail(path6.join(home, "update.log"));
84964
84964
  if (last) checks.push(check("ok", `update.log: ${last}`));
84965
84965
  } else checks.push(check("ok", "no background update recorded"));
84966
84966
  if (env3.HUM_NO_UPDATE_CHECK) checks.push(check("warn", "HUM_NO_UPDATE_CHECK is set: hum does not look for releases", "unset HUM_NO_UPDATE_CHECK"));
@@ -85073,7 +85073,7 @@ async function doctor({ json = false, mine, write = (t) => process.stdout.write(
85073
85073
  write(json ? JSON.stringify(report, null, 2) + "\n" : render2(report));
85074
85074
  return report.summary.fail ? 1 : 0;
85075
85075
  }
85076
- var isWin, npmFix2, exists2, realpath, tail2, check, PARSE_CONFIG, MARK;
85076
+ var isWin, npmFix2, exists2, realpath, tail, check, PARSE_CONFIG, MARK;
85077
85077
  var init_doctor = __esm({
85078
85078
  "src/doctor.js"() {
85079
85079
  init_engine();
@@ -85096,7 +85096,7 @@ var init_doctor = __esm({
85096
85096
  return p;
85097
85097
  }
85098
85098
  };
85099
- tail2 = (p) => {
85099
+ tail = (p) => {
85100
85100
  try {
85101
85101
  const lines = fs7.readFileSync(p, "utf8").trim().split("\n");
85102
85102
  return lines[lines.length - 1] || "";
@@ -85348,6 +85348,7 @@ function Spinner({ type = "dots" }) {
85348
85348
  var build_default = Spinner;
85349
85349
 
85350
85350
  // src/app.jsx
85351
+ init_wrap_ansi();
85351
85352
  init_markdown();
85352
85353
 
85353
85354
  // src/wordmark.js
@@ -85523,7 +85524,7 @@ var input_default = MultilineInput;
85523
85524
 
85524
85525
  // src/app.jsx
85525
85526
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
85526
- var MINE = true ? "0.1.52" : "";
85527
+ var MINE = true ? "0.1.54" : "";
85527
85528
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
85528
85529
  var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
85529
85530
  var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
@@ -85583,9 +85584,11 @@ var saveHistory = (arr) => {
85583
85584
  }
85584
85585
  };
85585
85586
  var DRAFT_TAIL_LINES = 14;
85586
- var tail = (s, n) => {
85587
- const l = s.split("\n");
85588
- return l.length <= n ? s : "\u2026\n" + l.slice(-n).join("\n");
85587
+ var LIVE_MIN_ROWS = 3;
85588
+ var DEFAULT_ROWS = 24;
85589
+ var liveTail = (text, width, rows) => {
85590
+ const l = wrapAnsi(text, Math.max(20, width), { hard: true, trim: false }).split("\n");
85591
+ return l.length <= rows ? l.join("\n") : "\u2026\n" + l.slice(-(rows - 1)).join("\n");
85589
85592
  };
85590
85593
  var COMMANDS = [
85591
85594
  { name: "/resume", desc: "pick a past session to continue (this machine or any other)" },
@@ -86375,9 +86378,9 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86375
86378
  return;
86376
86379
  }
86377
86380
  if (picker && picker.kind === "session") {
86378
- const { rows } = sessionRows(picker, hello?.cwd);
86381
+ const { rows: rows2 } = sessionRows(picker, hello?.cwd);
86379
86382
  const move = (d) => setPicker((p) => {
86380
- const n = rows.length;
86383
+ const n = rows2.length;
86381
86384
  if (!n) return p;
86382
86385
  const index = (p.index + d + n) % n;
86383
86386
  const top = index < p.top ? index : index >= p.top + PICKER_ROWS ? index - PICKER_ROWS + 1 : p.top;
@@ -86387,7 +86390,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86387
86390
  else if (key.downArrow || key.tab) move(1);
86388
86391
  else if (key.escape) setPicker(null);
86389
86392
  else if (key.return) {
86390
- const it = rows[picker.index];
86393
+ const it = rows2[picker.index];
86391
86394
  if (!it) return;
86392
86395
  setPicker(null);
86393
86396
  if (it.live && it.live.here) {
@@ -86618,6 +86621,9 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86618
86621
  };
86619
86622
  const statusLine = phase === "connecting" ? "starting \u2026" : `${modelRef.current || ""} \xB7 ${fmtCost2(spend)}` + (ctxPct >= 10 ? ` \xB7 ctx ${ctxPct}%` : "") + (gate === "approve" ? " \xB7 approvals on" : "") + (needYou ? ` \xB7 ${needYou} need you` : "") + (offer ? " \xB7 /accept \xB7 /reject" : "") + (ctrlc ? " \xB7 ctrl+c again to quit" : " \xB7 / for commands");
86620
86623
  const spinnerLabel = phase === "connecting" ? " starting \u2026" : ` ${status || "working"}${elapsed >= 2 ? ` \xB7 ${fmtDur(elapsed)}` : ""}` + (thinkChars.current > 4e3 ? ` \xB7 ${(thinkChars.current / 1e3).toFixed(0)}k thinking` : "");
86624
+ const rows = stdout?.rows || DEFAULT_ROWS;
86625
+ const chrome = 1 + 2 + 4 + (value.split("\n").length - 1) + 1 + (menu.length ? menu.length : 0) + (!menu.length && agents.length ? agents.length + 1 : 0) + (question && step ? 6 + stepOptions.length + (question.summary ? question.summary.split("\n").length : 0) + (question.evidence || []).length : 0) + (proposal ? 4 + proposal.calls.length * (1 + Math.min(DIFF_TAIL_LINES, 8)) : 0) + (reflection ? 8 + reflection.details.split("\n").length : 0) + (confirm ? 4 + Math.min(8, String(confirm.stat || "").split("\n").length) : 0) + (picker ? 14 : 0);
86626
+ const liveBudget = Math.max(LIVE_MIN_ROWS, Math.min(DRAFT_TAIL_LINES, rows - 1 - chrome));
86621
86627
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
86622
86628
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Static, { items, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", marginBottom: ["hum", "you", "banner", "turn"].includes(item.kind) ? 1 : 0, children: [
86623
86629
  item.kind === "wordmark" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", paddingLeft: 1, children: WORDMARK.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: row }, i)) }),
@@ -86751,11 +86757,11 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86751
86757
  ] }),
86752
86758
  item.servers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " none \xB7 add [[mcp]] with a name and a url or a command to ~/.hum/config.toml; the ones your deployment provides arrive when you sign in" }) : null,
86753
86759
  [["deployment", "from your deployment"], ["config", "from your config (~/.hum/config.toml or the project's .hum/config.toml)"]].map(([src, label]) => {
86754
- const rows = item.servers.filter((s) => (s.source || "config") === src);
86755
- if (!rows.length) return null;
86760
+ const rows2 = item.servers.filter((s) => (s.source || "config") === src);
86761
+ if (!rows2.length) return null;
86756
86762
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
86757
86763
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` ${label}` }),
86758
- rows.map((s) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
86764
+ rows2.map((s) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
86759
86765
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
86760
86766
  s.error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "red", children: "\u2717 " }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "green", children: "\u2714 " }),
86761
86767
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: s.name }),
@@ -86770,17 +86776,13 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86770
86776
  item.kind === "warn" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: item.text }),
86771
86777
  item.kind === "error" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "red", children: item.text })
86772
86778
  ] }, item.id) }),
86773
- thinking.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { marginTop: 1, children: [
86774
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\xB7" }) }),
86775
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, italic: true, children: tail(thinking, 6) })
86776
- ] }),
86777
86779
  draft.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { marginTop: 1, children: [
86778
86780
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, dimColor: true, children: "\u25CF" }) }),
86779
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: tail(renderMarkdown(draft, width - 2), DRAFT_TAIL_LINES) })
86781
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: liveTail(renderMarkdown(draft, width - 2), width - 2, liveBudget) })
86780
86782
  ] }),
86781
- phase === "busy" && thinking && // the thought as it streams: its newest lines, dim, so a long think is never a blank screen.
86783
+ thinking.length > 0 && // the thought as it streams: its newest lines, dim, so a long think is never a blank screen.
86782
86784
  // It folds into one line under the reply the moment the reply starts
86783
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", marginTop: 1, paddingLeft: 2, width, children: thinking.slice(-600).split("\n").filter((l) => l.trim()).slice(-THOUGHT_TAIL_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, wrap: "truncate-start", children: l }, i)) }),
86785
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", marginTop: 1, paddingLeft: 2, width, children: thinking.slice(-600).split("\n").filter((l) => l.trim()).slice(-Math.min(THOUGHT_TAIL_LINES, liveBudget)).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, wrap: "truncate-start", children: l }, i)) }),
86784
86786
  (phase === "busy" || phase === "connecting") && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { marginTop: 1, children: [
86785
86787
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(build_default, { type: "dots" }) }),
86786
86788
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: spinnerLabel })
@@ -87006,9 +87008,9 @@ function App2({ engine: engine2, task, resume, images = [] }) {
87006
87008
  ] });
87007
87009
  })(),
87008
87010
  picker && picker.kind === "session" && (() => {
87009
- const { rows, scope } = sessionRows(picker, hello?.cwd);
87010
- const top = Math.min(picker.top, Math.max(0, rows.length - PICKER_ROWS));
87011
- const shown = rows.slice(top, top + PICKER_ROWS);
87011
+ const { rows: rows2, scope } = sessionRows(picker, hello?.cwd);
87012
+ const top = Math.min(picker.top, Math.max(0, rows2.length - PICKER_ROWS));
87013
+ const shown = rows2.slice(top, top + PICKER_ROWS);
87012
87014
  const out = [];
87013
87015
  let lastDir = null;
87014
87016
  shown.forEach((it, j) => {
@@ -87045,14 +87047,14 @@ function App2({ engine: engine2, task, resume, images = [] }) {
87045
87047
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
87046
87048
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: ACCENT, bold: true, children: [
87047
87049
  "Resume session ",
87048
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `(${rows.length ? picker.index + 1 : 0} of ${rows.length})` })
87050
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `(${rows2.length ? picker.index + 1 : 0} of ${rows2.length})` })
87049
87051
  ] }),
87050
87052
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
87051
87053
  "\u2315 ",
87052
87054
  picker.query ? picker.query : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Search\u2026" })
87053
87055
  ] }) }),
87054
- rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " nothing matches" }) : out,
87055
- top + PICKER_ROWS < rows.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2193 ${rows.length - top - PICKER_ROWS} more` }) : null,
87056
+ rows2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " nothing matches" }) : out,
87057
+ top + PICKER_ROWS < rows2.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2193 ${rows2.length - top - PICKER_ROWS} more` }) : null,
87056
87058
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `Enter to continue \xB7 Ctrl+A to show ${scope === "here" ? "all directories" : "only this directory"} \xB7 Type to search \xB7 Esc to cancel` })
87057
87059
  ] });
87058
87060
  })(),
@@ -87123,7 +87125,7 @@ init_update();
87123
87125
  init_install();
87124
87126
  var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
87125
87127
  import { spawnSync as spawnSync5 } from "node:child_process";
87126
- var MINE2 = true ? "0.1.52" : "0.0.0";
87128
+ var MINE2 = true ? "0.1.54" : "0.0.0";
87127
87129
  var layout = installLayout();
87128
87130
  function completeInstall() {
87129
87131
  if (layout.kind !== "npm" || !needsInstall(MINE2)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaphi-ai/hum",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "description": "Hum: a self-improving coding agent for your terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",