@metaphi-ai/hum 0.1.32 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +63 -6
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -75838,7 +75838,7 @@ function runningVersion(candidates = engineCandidates(), opts = {}) {
75838
75838
  }
75839
75839
  return null;
75840
75840
  }
75841
- function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.32" : "" } = {}) {
75841
+ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.34" : "" } = {}) {
75842
75842
  const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
75843
75843
  const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
75844
75844
  if (!refused) {
@@ -84541,7 +84541,7 @@ var input_default = MultilineInput;
84541
84541
 
84542
84542
  // src/app.jsx
84543
84543
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
84544
- var MINE = true ? "0.1.32" : "";
84544
+ var MINE = true ? "0.1.34" : "";
84545
84545
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
84546
84546
  var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
84547
84547
  var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
@@ -84635,6 +84635,13 @@ var REWIND_CHOICES = [
84635
84635
  ];
84636
84636
  var OUTPUT_MAX_LINES = 200;
84637
84637
  var ERR_TAIL_LINES = 5;
84638
+ var THOUGHT_TAIL_LINES = 3;
84639
+ var diagLine = (d) => `${d.file ? `${d.file}${d.line != null ? `:${d.line}` : ""}: ` : ""}${d.severity || "error"}: ${d.message || ""}`;
84640
+ var tallyLine = (tally) => Object.entries(tally).map(([name, t]) => {
84641
+ const short = name.includes("__") ? name.split("__")[1] : name;
84642
+ const parts = [t.ok ? `${t.ok} ok` : null, t.failed ? `${t.failed} failed` : null, t.error ? `${t.error} error` : null].filter(Boolean);
84643
+ return `${short} ${parts.join(" \xB7 ")}`;
84644
+ }).join(" ");
84638
84645
  function App2({ engine: engine2, task, resume, images = [] }) {
84639
84646
  const { exit } = use_app_default();
84640
84647
  const { stdout } = use_stdout_default();
@@ -84662,6 +84669,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
84662
84669
  const [confirm, setConfirm] = (0, import_react24.useState)(null);
84663
84670
  const [gate, setGate] = (0, import_react24.useState)("off");
84664
84671
  const [paused, setPaused] = (0, import_react24.useState)(false);
84672
+ const [reflection, setReflection] = (0, import_react24.useState)(null);
84665
84673
  const attachRef = (0, import_react24.useRef)([]);
84666
84674
  const inputRef = (0, import_react24.useRef)(null);
84667
84675
  const nextId = (0, import_react24.useRef)(0);
@@ -84962,10 +84970,13 @@ function App2({ engine: engine2, task, resume, images = [] }) {
84962
84970
  lastOutRef.current = { name: ev.name, content: ev.content || "" };
84963
84971
  const more = (ev.lines || 0) > 1 ? ` (+${ev.lines - 1} lines \xB7 ctrl+o expands)` : "";
84964
84972
  append({ kind: "tool_result", text: `${ev.summary || "(no output)"}${more}`, isError: !ev.ok });
84965
- if (!ev.ok && ev.content) {
84973
+ if (!ev.ok && ev.diagnostics && ev.diagnostics.length) {
84974
+ append({ kind: "errtail", lines: ev.diagnostics.map(diagLine) });
84975
+ } else if (!ev.ok && ev.content) {
84966
84976
  const t = ev.content.split("\n").filter((l) => l.trim()).slice(-ERR_TAIL_LINES);
84967
84977
  if (t.length > 1) append({ kind: "errtail", lines: t });
84968
84978
  }
84979
+ if (ev.spool) append({ kind: "spool", text: `${ev.spool}/` });
84969
84980
  break;
84970
84981
  }
84971
84982
  case "plan": {
@@ -85004,6 +85015,13 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85004
85015
  setQCursor(0);
85005
85016
  append({ kind: "info", text: `answered: ${ev.answer}` });
85006
85017
  break;
85018
+ case "reflection":
85019
+ setReflection({ id: ev.id, well: ev.well || [], missed: ev.missed || [] });
85020
+ break;
85021
+ case "reflection_closed":
85022
+ setReflection((r) => r && r.id === ev.id ? null : r);
85023
+ if (ev.vote !== "dismiss") append({ kind: "info", text: ev.vote === "up" ? "upvoted" : "downvoted" });
85024
+ break;
85007
85025
  case "paused":
85008
85026
  foldThinking();
85009
85027
  flushDraft();
@@ -85082,6 +85100,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85082
85100
  case "turn_end": {
85083
85101
  foldThinking();
85084
85102
  flushDraft();
85103
+ if (ev.tally && Object.keys(ev.tally).length) append({ kind: "tally", text: tallyLine(ev.tally) });
85085
85104
  setMeter((m) => ({ ...m, tokens: ev.context_tokens ?? m.tokens, input: ev.input_tokens || 0, output: ev.output_tokens || 0 }));
85086
85105
  setSpend(ev.cost_usd);
85087
85106
  const dur = turnT0.current ? fmtDur((Date.now() - turnT0.current) / 1e3) : fmtDur(ev.elapsed_s);
@@ -85217,6 +85236,14 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85217
85236
  else if (/^[1-3]$/.test(input)) pick(REWIND_CHOICES[Number(input) - 1].key);
85218
85237
  return;
85219
85238
  }
85239
+ if (reflection && !proposal && !question && !picker && !value.trim()) {
85240
+ const vote = input === "1" ? "up" : input === "2" ? "down" : key.return || key.escape ? "dismiss" : null;
85241
+ if (vote) {
85242
+ engine2.send({ cmd: "reflect_vote", id: reflection.id, vote });
85243
+ setReflection(null);
85244
+ return;
85245
+ }
85246
+ }
85220
85247
  if (proposal && !picker) {
85221
85248
  if (key.return && !value.trim()) {
85222
85249
  decide("accept");
@@ -85469,6 +85496,10 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85469
85496
  answerStep(text);
85470
85497
  return;
85471
85498
  }
85499
+ if (reflection) {
85500
+ engine2.send({ cmd: "reflect_vote", id: reflection.id, vote: "dismiss" });
85501
+ setReflection(null);
85502
+ }
85472
85503
  if (text.startsWith("/")) {
85473
85504
  runCommand(text);
85474
85505
  return;
@@ -85599,6 +85630,14 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85599
85630
  item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2026 +${item.more} more lines \xB7 /diff <path> narrows it` }) : null,
85600
85631
  item.stat ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.stat.trim() }) : null
85601
85632
  ] }),
85633
+ item.kind === "spool" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
85634
+ " \u21B3 ",
85635
+ item.text
85636
+ ] }),
85637
+ item.kind === "tally" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
85638
+ " ",
85639
+ item.text
85640
+ ] }),
85602
85641
  item.kind === "errtail" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", paddingLeft: 6, children: item.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "red", dimColor: true, children: l }, i)) }),
85603
85642
  item.kind === "output" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 4, children: [
85604
85643
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `full output \xB7 ${item.name}` }),
@@ -85629,6 +85668,9 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85629
85668
  /* @__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" }) }),
85630
85669
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: tail(renderMarkdown(draft, width - 2), DRAFT_TAIL_LINES) })
85631
85670
  ] }),
85671
+ phase === "busy" && thinking && // the thought as it streams: its newest lines, dim, so a long think is never a blank screen.
85672
+ // It folds into one line under the reply the moment the reply starts
85673
+ /* @__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)) }),
85632
85674
  (phase === "busy" || phase === "connecting") && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { marginTop: 1, children: [
85633
85675
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(build_default, { type: "dots" }) }),
85634
85676
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: spinnerLabel })
@@ -85664,6 +85706,21 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85664
85706
  step.secret ? " \xB7 it is not shown and not recorded" : ""
85665
85707
  ] })
85666
85708
  ] }),
85709
+ reflection && !proposal && !question && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
85710
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", width: MASCOT_WIDTH + 1, flexShrink: 0, marginRight: 1, children: MASCOT.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: row }, i)) }),
85711
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", flexGrow: 1, children: [
85712
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: "looking back" }),
85713
+ reflection.well.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
85714
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "green", children: " \u2713 " }),
85715
+ l
85716
+ ] }, `w${i}`)),
85717
+ reflection.missed.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
85718
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: " \u2717 " }),
85719
+ l
85720
+ ] }, `m${i}`)),
85721
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " 1 upvote \xB7 2 downvote \xB7 enter dismiss" })
85722
+ ] })
85723
+ ] }),
85667
85724
  proposal && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
85668
85725
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
85669
85726
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "? " }),
@@ -85715,7 +85772,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85715
85772
  ] }),
85716
85773
  picker && picker.kind === "model" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
85717
85774
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "Select model" }),
85718
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `Switch between open source models. Served via Metaphi AI.${picker.byo.length ? ` Your own keys: ${picker.byo.join(", ")} \u2014 /model <provider>/<model> uses one.` : ""}` }),
85775
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `Switch models. Served via Metaphi AI.${picker.byo.length ? ` Your own keys: ${picker.byo.join(", ")} \u2014 /model <provider>/<model> uses one.` : ""}` }),
85719
85776
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
85720
85777
  (() => {
85721
85778
  const nameW = Math.max(...picker.items.map((m) => m.name.length + (m.current ? 2 : 0)));
@@ -85899,7 +85956,7 @@ init_update();
85899
85956
  init_install();
85900
85957
  var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
85901
85958
  import { spawnSync as spawnSync5 } from "node:child_process";
85902
- var MINE2 = true ? "0.1.32" : "0.0.0";
85959
+ var MINE2 = true ? "0.1.34" : "0.0.0";
85903
85960
  var layout = installLayout();
85904
85961
  function completeInstall() {
85905
85962
  if (layout.kind !== "npm" || !needsInstall(MINE2)) return;
@@ -85909,7 +85966,7 @@ function completeInstall() {
85909
85966
  const r = installEngine(MINE2, { say });
85910
85967
  if (!r.ok) say(`the update did not finish: ${r.error} \xB7 ${npmFix(MINE2)}`);
85911
85968
  }
85912
- var ENGINE_COMMANDS = /* @__PURE__ */ new Set(["run", "login", "logout", "whoami", "model", "key", "sessions", "show", "sync", "skill", "ps", "stop", "hooks", "engine"]);
85969
+ var ENGINE_COMMANDS = /* @__PURE__ */ new Set(["run", "login", "logout", "whoami", "model", "key", "sessions", "show", "sync", "skill", "persona", "ps", "stop", "hooks", "engine"]);
85913
85970
  var argv0 = process.argv.slice(2);
85914
85971
  if (argv0[0] === "--version" || argv0[0] === "-V") {
85915
85972
  process.stdout.write(`hum ${MINE2}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaphi-ai/hum",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "Hum (हम): a self-improving coding agent for your terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",