@metaphi-ai/hum 0.1.50 → 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 +33 -10
  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.50" : "" } = {}) {
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.50" : "";
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` : "";
@@ -85594,6 +85594,8 @@ var COMMANDS = [
85594
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 = () => {
@@ -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
  }
@@ -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();
@@ -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: [
@@ -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.50" : "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.50",
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",