@metaphi-ai/hum 0.1.49 → 0.1.51

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 +43 -20
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -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.49" : "" } = {}) {
83548
+ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.51" : "" } = {}) {
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) {
@@ -85523,7 +85523,7 @@ var input_default = MultilineInput;
85523
85523
 
85524
85524
  // src/app.jsx
85525
85525
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
85526
- var MINE = true ? "0.1.49" : "";
85526
+ var MINE = true ? "0.1.51" : "";
85527
85527
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
85528
85528
  var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
85529
85529
  var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
@@ -85591,9 +85591,11 @@ var COMMANDS = [
85591
85591
  { name: "/resume", desc: "pick a past session to continue (this machine or any other)" },
85592
85592
  { name: "/compact", desc: "summarise and restart the context now (/compact <what the note should attend to>)" },
85593
85593
  { name: "/model", desc: "switch between the models you can use; /model <name> switches straight away" },
85594
- { name: "/effort", desc: "how hard the model thinks, whatever the model: low, medium or high; /effort <level> sets it straight away" },
85594
+ { name: "/reasoning", desc: "how hard the model thinks, whatever the model: low, medium or high; /reasoning <level> sets it straight away" },
85595
85595
  { name: "/diff", desc: "what has changed since this session began (/diff last: the last exchange; /diff <path>: one file)" },
85596
85596
  { name: "/rewind", desc: "go back to something you said: the files, the conversation, or both (esc esc opens it too)" },
85597
+ { name: "/accept", desc: "the work as it stands is what you wanted (/accept <why>); recorded against the state it is in" },
85598
+ { name: "/reject", desc: "the work as it stands is not (/reject <why>)" },
85597
85599
  { name: "/cost", desc: "tokens and cost so far" },
85598
85600
  { name: "/usage-credits", desc: "your credits on our models, and the page that adds more (a code from Metaphi, or a purchase)" },
85599
85601
  { name: "/approve", desc: "approvals on|off \u2014 whether every change and command waits for you first (leaving the sandbox always asks)" },
@@ -85658,6 +85660,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85658
85660
  const [paused, setPaused] = (0, import_react24.useState)(false);
85659
85661
  const [reflections, setReflections] = (0, import_react24.useState)([]);
85660
85662
  const [why, setWhy] = (0, import_react24.useState)(null);
85663
+ const [offer, setOffer] = (0, import_react24.useState)(false);
85661
85664
  const reflection = phase === "idle" && !proposal && !question ? reflections[0] || null : null;
85662
85665
  const attachRef = (0, import_react24.useRef)([]);
85663
85666
  const inputRef = (0, import_react24.useRef)(null);
@@ -85677,6 +85680,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85677
85680
  const escRef = (0, import_react24.useRef)(0);
85678
85681
  const rewindRef = (0, import_react24.useRef)({ files: true, conversation: true });
85679
85682
  const wantRow = (0, import_react24.useRef)(null);
85683
+ const wroteRef = (0, import_react24.useRef)(false);
85680
85684
  const preHello = (0, import_react24.useRef)([]);
85681
85685
  const [meter, setMeter] = (0, import_react24.useState)({ tokens: 0, cap: 0, input: 0, output: 0 });
85682
85686
  const setPhaseBoth = (p) => {
@@ -85731,6 +85735,8 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85731
85735
  toolsRef.current = {};
85732
85736
  lastOutRef.current = null;
85733
85737
  attachRef.current = [];
85738
+ setOffer(false);
85739
+ wroteRef.current = false;
85734
85740
  setMeter((m) => ({ ...m, tokens: 0, input: 0, output: 0 }));
85735
85741
  };
85736
85742
  const flushDraft = () => {
@@ -85916,10 +85922,10 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85916
85922
  setPicker({ kind: "model", items: ev.items, index: cur, via: ev.via, byo: ev.byo || [] });
85917
85923
  break;
85918
85924
  }
85919
- case "efforts": {
85925
+ case "reasoning": {
85920
85926
  if (!ev.items || ev.items.length === 0) break;
85921
85927
  const cur = Math.max(0, ev.items.findIndex((e) => e.current));
85922
- setPicker({ kind: "effort", items: ev.items, index: cur });
85928
+ setPicker({ kind: "reasoning", items: ev.items, index: cur });
85923
85929
  break;
85924
85930
  }
85925
85931
  case "session":
@@ -85968,6 +85974,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
85968
85974
  }
85969
85975
  case "tool_result": {
85970
85976
  lastOutRef.current = { name: ev.name, content: ev.content || "" };
85977
+ if (ev.ok && (ev.name === "write_file" || ev.name === "edit_file")) wroteRef.current = true;
85971
85978
  const more = (ev.lines || 0) > 1 ? ` (+${ev.lines - 1} lines \xB7 ctrl+o expands)` : "";
85972
85979
  append({ kind: "tool_result", text: `${ev.summary || "(no output)"}${more}`, isError: !ev.ok });
85973
85980
  if (!ev.ok && ev.diagnostics && ev.diagnostics.length) {
@@ -86027,6 +86034,10 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86027
86034
  case "reflection":
86028
86035
  setReflections((rs) => rs.some((r) => r.id === ev.id) ? rs : [...rs, { id: ev.id, category: ev.category || "other", title: ev.title || "", details: ev.details || "", area: ev.area || "" }]);
86029
86036
  break;
86037
+ case "acceptance":
86038
+ setOffer(false);
86039
+ append({ kind: "info", text: ev.polarity > 0 ? "accepted" : "rejected" });
86040
+ break;
86030
86041
  case "reflection_closed":
86031
86042
  setReflections((rs) => rs.filter((r) => r.id !== ev.id));
86032
86043
  if (ev.vote !== "dismiss") append({ kind: "info", text: ev.vote === "up" ? "marked true" : "marked false" });
@@ -86115,6 +86126,8 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86115
86126
  const dur = turnT0.current ? fmtDur((Date.now() - turnT0.current) / 1e3) : fmtDur(ev.elapsed_s);
86116
86127
  turnT0.current = null;
86117
86128
  append({ kind: "turn", text: `${dur} \xB7 ${plural(ev.turns, "step")} \xB7 ${fmtCost2(ev.cost_usd)} session${firstResp(ev)}` + (ev.stop_reason !== "done" && !String(ev.stop_reason).startsWith("paused") ? ` \xB7 stopped: ${ev.stop_reason}` : "") });
86129
+ if (wroteRef.current) setOffer(true);
86130
+ wroteRef.current = false;
86118
86131
  setPhaseBoth("idle");
86119
86132
  setStatus("");
86120
86133
  break;
@@ -86258,13 +86271,13 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86258
86271
  }
86259
86272
  return;
86260
86273
  }
86261
- const vote = input === "1" ? "up" : input === "2" ? "down" : key.return || key.escape ? "dismiss" : null;
86262
- if (vote === "down") {
86274
+ const vote2 = input === "1" ? "up" : input === "2" ? "down" : key.return || key.escape ? "dismiss" : null;
86275
+ if (vote2 === "down") {
86263
86276
  setWhy(reflection.id);
86264
86277
  return;
86265
86278
  }
86266
- if (vote) {
86267
- closeReflection(reflection.id, vote);
86279
+ if (vote2) {
86280
+ closeReflection(reflection.id, vote2);
86268
86281
  return;
86269
86282
  }
86270
86283
  }
@@ -86319,12 +86332,12 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86319
86332
  return;
86320
86333
  }
86321
86334
  }
86322
- if (picker && picker.kind === "effort") {
86335
+ if (picker && picker.kind === "reasoning") {
86323
86336
  const it = picker.items[picker.index];
86324
86337
  const pick = (keep) => {
86325
86338
  setPicker(null);
86326
86339
  if (it.current && !(keep && !it.default)) return;
86327
- engine2.send(keep ? { cmd: "effort", level: it.level, default: true } : { cmd: "effort", level: it.level });
86340
+ engine2.send(keep ? { cmd: "reasoning", level: it.level, default: true } : { cmd: "reasoning", level: it.level });
86328
86341
  };
86329
86342
  if (key.leftArrow || key.upArrow) setPicker((p) => ({ ...p, index: (p.index + p.items.length - 1) % p.items.length }));
86330
86343
  else if (key.rightArrow || key.downArrow || key.tab) setPicker((p) => ({ ...p, index: (p.index + 1) % p.items.length }));
@@ -86438,6 +86451,10 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86438
86451
  setQCursor(0);
86439
86452
  engine2.send({ cmd: "answer", id: question.id, answers });
86440
86453
  };
86454
+ const vote = (polarity, why2 = "") => {
86455
+ engine2.send({ cmd: polarity > 0 ? "accept" : "reject", ...why2 ? { why: why2 } : {} });
86456
+ setOffer(false);
86457
+ };
86441
86458
  const runCommand = (line) => {
86442
86459
  const [name, ...rest] = line.split(/\s+/);
86443
86460
  const arg = rest.join(" ").trim();
@@ -86468,9 +86485,9 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86468
86485
  engine2.send({ cmd: "model", name: arg });
86469
86486
  } else engine2.send({ cmd: "model" });
86470
86487
  break;
86471
- case "/effort":
86472
- if (arg) engine2.send({ cmd: "effort", level: arg });
86473
- else engine2.send({ cmd: "effort" });
86488
+ case "/reasoning":
86489
+ if (arg) engine2.send({ cmd: "reasoning", level: arg });
86490
+ else engine2.send({ cmd: "reasoning" });
86474
86491
  break;
86475
86492
  case "/diff":
86476
86493
  engine2.send({ cmd: "diff", scope: arg });
@@ -86496,6 +86513,12 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86496
86513
  if (hello?.mcp === void 0) append({ kind: "warn", text: "this version of hum does not say what is mounted; update hum (/stop, then hum)" });
86497
86514
  else engine2.send({ cmd: "mcp" });
86498
86515
  break;
86516
+ case "/accept":
86517
+ vote(1, arg);
86518
+ break;
86519
+ case "/reject":
86520
+ vote(-1, arg);
86521
+ break;
86499
86522
  case "/hooks":
86500
86523
  engine2.send({ cmd: "hooks" });
86501
86524
  break;
@@ -86521,8 +86544,8 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86521
86544
  break;
86522
86545
  }
86523
86546
  };
86524
- const closeReflection = (id, vote, reason = "") => {
86525
- engine2.send({ cmd: "reflect_vote", id, vote, ...reason ? { why: reason } : {} });
86547
+ const closeReflection = (id, vote2, reason = "") => {
86548
+ engine2.send({ cmd: "reflect_vote", id, vote: vote2, ...reason ? { why: reason } : {} });
86526
86549
  setReflections((rs) => rs.filter((r) => r.id !== id));
86527
86550
  setWhy((w) => w === id ? null : w);
86528
86551
  setValue("");
@@ -86573,7 +86596,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86573
86596
  setPhaseBoth("busy");
86574
86597
  }
86575
86598
  };
86576
- 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` : "") + (ctrlc ? " \xB7 ctrl+c again to quit" : " \xB7 / for commands");
86599
+ 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");
86577
86600
  const spinnerLabel = phase === "connecting" ? " starting \u2026" : ` ${status || "working"}${elapsed >= 2 ? ` \xB7 ${fmtDur(elapsed)}` : ""}` + (thinkChars.current > 4e3 ? ` \xB7 ${(thinkChars.current / 1e3).toFixed(0)}k thinking` : "");
86578
86601
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
86579
86602
  /* @__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: [
@@ -86879,8 +86902,8 @@ function App2({ engine: engine2, task, resume, images = [] }) {
86879
86902
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
86880
86903
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Enter to switch \xB7 Esc to cancel" })
86881
86904
  ] }),
86882
- picker && picker.kind === "effort" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
86883
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "Effort" }),
86905
+ picker && picker.kind === "reasoning" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
86906
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "Reasoning" }),
86884
86907
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
86885
86908
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
86886
86909
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " Faster" }),
@@ -87079,7 +87102,7 @@ init_update();
87079
87102
  init_install();
87080
87103
  var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
87081
87104
  import { spawnSync as spawnSync5 } from "node:child_process";
87082
- var MINE2 = true ? "0.1.49" : "0.0.0";
87105
+ var MINE2 = true ? "0.1.51" : "0.0.0";
87083
87106
  var layout = installLayout();
87084
87107
  function completeInstall() {
87085
87108
  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.49",
3
+ "version": "0.1.51",
4
4
  "description": "Hum: a self-improving coding agent for your terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",