@metaphi-ai/hum 0.1.82 → 0.1.84

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 -4
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -83588,7 +83588,7 @@ function runningVersion(candidates = coreCandidates(), opts = {}) {
83588
83588
  }
83589
83589
  return null;
83590
83590
  }
83591
- function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.82" : "" } = {}) {
83591
+ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.84" : "" } = {}) {
83592
83592
  const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
83593
83593
  const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
83594
83594
  if (!refused) {
@@ -85612,7 +85612,7 @@ var input_default = MultilineInput;
85612
85612
 
85613
85613
  // src/app.jsx
85614
85614
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
85615
- var MINE = true ? "0.1.82" : "";
85615
+ var MINE = true ? "0.1.84" : "";
85616
85616
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
85617
85617
  var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
85618
85618
  var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
@@ -85659,6 +85659,23 @@ var goalLine = (g) => {
85659
85659
  return `goal ${g.status || "active"}: ${g.text}${n ? ` \xB7 ${plural(n, "exchange")}` : ""}`;
85660
85660
  };
85661
85661
  var fmtTokens = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k tokens` : `${t || 0} tokens`;
85662
+ var fmtN = (n) => n >= 1e6 ? `${(n / 1e6).toFixed(1)}M` : n >= 1e3 ? `${(n / 1e3).toFixed(1)}k` : `${n || 0}`;
85663
+ var contextLines = (ev) => {
85664
+ const rows = ev.rows || [];
85665
+ const width = Math.max(12, ...rows.map((r) => r.category.length));
85666
+ const lines = rows.map((r) => `${r.category.padEnd(width)} ${fmtN(r.tokens).padStart(7)} tokens${r.pct != null ? ` ${String(r.pct).padStart(5)}%` : ""}`);
85667
+ const head = ev.window ? `${fmtN(ev.total)} of ${fmtN(ev.window)} tokens \xB7 ${fmtN(ev.free)} free \xB7 compacts at ${fmtN(ev.threshold)}` : `${fmtN(ev.total)} tokens \xB7 compacts at ${fmtN(ev.threshold)}`;
85668
+ return [head, ...lines];
85669
+ };
85670
+ var costLines = (spend, meter, end, ctx = "") => {
85671
+ const lines = [`${fmtCost2(spend)} this session \xB7 ${(meter.input || 0).toLocaleString()}+${(meter.output || 0).toLocaleString()} tokens${ctx}`];
85672
+ if (!end) return lines;
85673
+ if (end.team_cost_usd != null) lines.push(`${fmtCost2(end.team_cost_usd)} with the team \xB7 ${plural(end.team_tasks || 0, "task")} completed by workers`);
85674
+ if (end.exchange_cost_usd != null) lines.push(`last exchange ${fmtCost2(end.exchange_cost_usd)} \xB7 ${fmtN(end.exchange_input_tokens)}+${fmtN(end.exchange_output_tokens)} tokens \xB7 ${fmtDur(end.elapsed_s || 0)} wall \xB7 ${fmtDur(end.model_s || 0)} in the model \xB7 ${fmtDur(end.tool_s || 0)} in tools`);
85675
+ if (end.cache_read_tokens != null) lines.push(`cache ${fmtN(end.cache_read_tokens)} read \xB7 ${fmtN(end.cache_write_tokens)} written \xB7 ${fmtN(end.reasoning_tokens)} reasoning`);
85676
+ for (const [m, u] of Object.entries(end.by_model || {})) lines.push(`${m} \xB7 ${plural(u.calls || 0, "call")} \xB7 ${fmtN(u.input_tokens)}+${fmtN(u.output_tokens)} tokens \xB7 ${fmtN(u.cache_read_tokens)} cached \xB7 ${fmtCost2(u.cost_usd || 0)}`);
85677
+ return lines;
85678
+ };
85662
85679
  var HISTORY_PATH = path5.join(os6.homedir(), ".hum", "history.json");
85663
85680
  var HISTORY_MAX = 300;
85664
85681
  var loadHistory = () => {
@@ -85693,12 +85710,14 @@ var COMMANDS = [
85693
85710
  { name: "/accept", desc: "the work as it stands is what you wanted (/accept <why>); recorded against the state it is in" },
85694
85711
  { name: "/reject", desc: "the work as it stands is not (/reject <why>)" },
85695
85712
  { name: "/cost", desc: "tokens and cost so far" },
85713
+ { name: "/context", desc: "what fills the context window: system prompt, tool schemas, messages, tool results" },
85696
85714
  { name: "/usage-credits", desc: "your credits on our models, and the page that adds more (a code from Metaphi, or a purchase)" },
85697
85715
  { name: "/approve", desc: "approvals on|off \u2014 whether every change and command waits for you first (leaving the sandbox always asks)" },
85698
85716
  { name: "/continue", desc: "after a pause: let the agent carry on" },
85699
85717
  { name: "/goal", desc: "the goal the session keeps working toward on its own, exchange after exchange, until the model marks it complete or blocked (/goal <objective>; /goal pause \xB7 resume \xB7 clear; /goal alone shows where it stands)" },
85700
85718
  { name: "/image", desc: "attach an image file to your next message (/image <path>); ctrl+v pastes a screenshot" },
85701
85719
  { name: "/mcp", desc: "the MCP servers in this session \u2014 what each mounted, and any that did not" },
85720
+ { name: "/memory", desc: "what this project taught Humboldt: where the memory files are and one line per entry; edit the files by hand" },
85702
85721
  { name: "/slack", desc: "this session's Slack thread \u2014 opened now in the declared channel when it has none \u2014 and whether you are paired" },
85703
85722
  { name: "/tools", desc: "the tools the model has, and the sandbox they run in" },
85704
85723
  { name: "/hooks", desc: "the lifecycle hooks in scope (~/.hum/hooks.json, <repo>/.hum/hooks.json; Claude Code and Codex hook files too)" },
@@ -85797,6 +85816,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
85797
85816
  const wroteRef = (0, import_react24.useRef)(false);
85798
85817
  const preHello = (0, import_react24.useRef)([]);
85799
85818
  const [meter, setMeter] = (0, import_react24.useState)({ tokens: 0, cap: 0, input: 0, output: 0 });
85819
+ const lastEnd = (0, import_react24.useRef)(null);
85800
85820
  const setPhaseBoth = (p) => {
85801
85821
  phaseRef.current = p;
85802
85822
  setPhase(p);
@@ -86050,6 +86070,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
86050
86070
  case "turn_end":
86051
86071
  append({ kind: "turn", text: `${fmtDur(it.elapsed_s || 0)} \xB7 ${plural(it.turns, "step")} \xB7 ${fmtCost2(it.cost_usd)} session${firstResp(it)}` });
86052
86072
  setSpend(it.cost_usd || 0);
86073
+ lastEnd.current = it;
86053
86074
  break;
86054
86075
  case "agent_start":
86055
86076
  append({ kind: "agent", text: `agent ${it.n} \xB7 ${it.kind} \xB7 ${it.desc}` });
@@ -86194,6 +86215,13 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
86194
86215
  case "mcp":
86195
86216
  append({ kind: "mcp", servers: ev.servers || [] });
86196
86217
  break;
86218
+ case "memory": {
86219
+ const items2 = ev.items || [];
86220
+ append({ kind: "info", text: `memory: ${ev.dir}${items2.some((i) => i.source === "repo") ? ` \xB7 shared: ${ev.repo_dir}` : ""}` });
86221
+ if (!items2.length) append({ kind: "info", text: "nothing remembered yet; the model writes here with remember, and you may edit the files by hand" });
86222
+ for (const it of items2) append({ kind: "info", text: ` ${it.name} (${it.type}${it.source === "repo" ? ", shared" : ""}): ${it.description}` });
86223
+ break;
86224
+ }
86197
86225
  case "reflection":
86198
86226
  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 || "" }]);
86199
86227
  break;
@@ -86220,6 +86248,9 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
86220
86248
  setProposal(null);
86221
86249
  append({ kind: "info", text: "approvals off: the waiting proposal ran" });
86222
86250
  break;
86251
+ case "context":
86252
+ append({ kind: "info", text: contextLines(ev).join("\n") });
86253
+ break;
86223
86254
  case "diff": {
86224
86255
  const text = String(ev.text || "");
86225
86256
  if (!text.trim()) {
@@ -86286,6 +86317,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
86286
86317
  if (ev.tally && Object.keys(ev.tally).length) append({ kind: "tally", text: tallyLine(ev.tally) });
86287
86318
  setMeter((m) => ({ ...m, tokens: ev.context_tokens ?? m.tokens, input: ev.input_tokens || 0, output: ev.output_tokens || 0 }));
86288
86319
  setSpend(ev.cost_usd);
86320
+ lastEnd.current = ev;
86289
86321
  const dur = turnT0.current ? fmtDur((Date.now() - turnT0.current) / 1e3) : fmtDur(ev.elapsed_s);
86290
86322
  turnT0.current = null;
86291
86323
  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}` : "") });
@@ -86691,13 +86723,16 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
86691
86723
  case "/diff":
86692
86724
  core2.send({ cmd: "diff", scope: arg });
86693
86725
  break;
86726
+ case "/context":
86727
+ core2.send({ cmd: "context" });
86728
+ break;
86694
86729
  case "/rewind":
86695
86730
  wantRow.current = /^\d+$/.test(arg) ? Number(arg) : null;
86696
86731
  core2.send({ cmd: "rewind_list" });
86697
86732
  break;
86698
86733
  case "/cost": {
86699
86734
  const ctx = ctxPct > 0 ? ` \xB7 context ${ctxPct}% of the compaction threshold` : "";
86700
- append({ kind: "info", text: `${fmtCost2(spend)} this session \xB7 ${meter.input.toLocaleString()}+${meter.output.toLocaleString()} tokens${ctx}` });
86735
+ append({ kind: "info", text: costLines(spend, meter, lastEnd.current, ctx).join("\n") });
86701
86736
  break;
86702
86737
  }
86703
86738
  case "/image":
@@ -86722,6 +86757,10 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
86722
86757
  core2.send({ cmd: "slack" });
86723
86758
  break;
86724
86759
  // the core's words: the session's Slack surface
86760
+ case "/memory":
86761
+ core2.send({ cmd: "memory" });
86762
+ break;
86763
+ // the core's data: the project's memory
86725
86764
  case "/hooks":
86726
86765
  core2.send({ cmd: "hooks" });
86727
86766
  break;
@@ -87369,7 +87408,7 @@ init_update();
87369
87408
  init_install();
87370
87409
  var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
87371
87410
  import { spawnSync as spawnSync5 } from "node:child_process";
87372
- var MINE2 = true ? "0.1.82" : "0.0.0";
87411
+ var MINE2 = true ? "0.1.84" : "0.0.0";
87373
87412
  var layout = installLayout();
87374
87413
  function completeInstall() {
87375
87414
  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.82",
3
+ "version": "0.1.84",
4
4
  "description": "Hum: a self-improving coding agent for your terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",