@metaphi-ai/hum 0.1.81 → 0.1.82

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 +30 -17
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -83358,33 +83358,41 @@ function packageVersion(entry = process.argv[1]) {
83358
83358
  return "";
83359
83359
  }
83360
83360
  }
83361
- function installerArgv(version, platform2 = process.platform, layout2 = { kind: "native" }) {
83361
+ function installerArgv(version, platform2 = process.platform, layout2 = { kind: "native" }, log = "") {
83362
83362
  const base = dist();
83363
83363
  if (layout2.kind === "npm") {
83364
- return platform2 === "win32" ? ["cmd.exe", ["/d", "/s", "/c", `npm i -g --ignore-scripts @metaphi-ai/hum@${version || "latest"}`]] : ["/bin/sh", ["-c", `npm i -g --ignore-scripts @metaphi-ai/hum@${version || "latest"}`]];
83364
+ const cmd = `npm i -g --ignore-scripts @metaphi-ai/hum@${version || "latest"}`;
83365
+ return platform2 === "win32" ? ["cmd.exe", ["/d", "/s", "/c", `"${cmd}${log ? ` >> "${log}" 2>&1` : ""}"`], { windowsVerbatimArguments: true }] : ["/bin/sh", ["-c", cmd], {}];
83365
83366
  }
83366
- if (platform2 === "win32") return ["powershell", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", `irm ${base}/install.ps1 | iex`]];
83367
- return ["/bin/sh", ["-c", `curl -fsSL "${base}/install.sh" | sh`]];
83367
+ if (platform2 === "win32") {
83368
+ const cmd = `irm ${base}/install.ps1 | iex`;
83369
+ return ["powershell", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", log ? `& { ${cmd} } *>> '${log}'` : cmd], {}];
83370
+ }
83371
+ return ["/bin/sh", ["-c", `curl -fsSL "${base}/install.sh" | sh`], {}];
83368
83372
  }
83369
83373
  function startBackgroundUpdate(version, { env: env3 = process.env, now = Date.now(), spawnImpl = spawn, layout: layout2 = installLayout(process.execPath, env3), platform: platform2 = process.platform } = {}) {
83370
83374
  if (env3.HUM_NO_AUTO_UPDATE || layout2.kind === "python") return false;
83371
83375
  const s = readState(env3);
83372
83376
  if (s.version === version && now - (s.started || 0) < 30 * 60 * 1e3) return false;
83377
+ const hidden = platform2 === "win32";
83373
83378
  const log = path2.join(humHome2(env3), "update.log");
83374
83379
  let out = "ignore";
83380
+ let logged = false;
83375
83381
  try {
83376
83382
  fs3.mkdirSync(humHome2(env3), { recursive: true });
83377
83383
  out = fs3.openSync(log, "w");
83384
+ logged = true;
83385
+ if (hidden) {
83386
+ fs3.closeSync(out);
83387
+ out = "ignore";
83388
+ }
83378
83389
  } catch {
83390
+ out = "ignore";
83379
83391
  }
83380
- const [bin, args2] = installerArgv(version, platform2, layout2);
83392
+ const [bin, args2, extra] = installerArgv(version, platform2, layout2, hidden && logged ? log : "");
83393
+ const io = hidden ? { stdio: "ignore", windowsHide: true } : { detached: true, stdio: ["ignore", out, out], windowsHide: true };
83381
83394
  try {
83382
- const child = spawnImpl(bin, args2, {
83383
- detached: true,
83384
- stdio: ["ignore", out, out],
83385
- windowsHide: true,
83386
- env: { ...env3, HUM_VERSION: version, HUM_DIST: dist(env3) }
83387
- });
83395
+ const child = spawnImpl(bin, args2, { ...io, ...extra, env: { ...env3, HUM_VERSION: version, HUM_DIST: dist(env3) } });
83388
83396
  child.unref();
83389
83397
  writeState({ ...s, version, started: now }, env3);
83390
83398
  return true;
@@ -83400,13 +83408,13 @@ function mismatchLine(mine, running, { env: env3 = process.env, layout: layout2
83400
83408
  if (state && !state.ok && state.wanted === mine && state.error) return `${head}: the update did not finish (${state.error}) \xB7 ${fix}`;
83401
83409
  return `${head} \xB7 ${fix}`;
83402
83410
  }
83403
- function updateNotice(mine, { running = "", latest = "", env: env3 = process.env, layout: layout2 = installLayout(process.execPath, env3), spawnImpl = spawn, now = Date.now() } = {}) {
83411
+ function updateNotice(mine, { running = "", latest = "", env: env3 = process.env, layout: layout2 = installLayout(process.execPath, env3), spawnImpl = spawn, now = Date.now(), platform: platform2 = process.platform } = {}) {
83404
83412
  const drift = mismatchLine(mine, running, { env: env3, layout: layout2 });
83405
83413
  if (drift) return drift;
83406
83414
  if (env3.HUM_NO_UPDATE_CHECK || !mine || !latest || !newer(latest, mine)) return "";
83407
83415
  if (env3.HUM_NO_AUTO_UPDATE || layout2.kind === "python") return `hum ${latest} is out \xB7 ${updateCommand(layout2)}`;
83408
83416
  if (readyVersion(layout2, latest)) return `hum ${latest} is ready \xB7 restart hum to use it`;
83409
- if (startBackgroundUpdate(latest, { env: env3, spawnImpl, layout: layout2, now })) return `hum ${latest} is installing in the background \xB7 it takes effect the next time you start hum`;
83417
+ if (startBackgroundUpdate(latest, { env: env3, spawnImpl, layout: layout2, now, platform: platform2 })) return `hum ${latest} is installing in the background \xB7 it takes effect the next time you start hum`;
83410
83418
  if (readState(env3).version === latest) return `hum ${latest} is still installing in the background (${path2.join(humHome2(env3), "update.log")} has the details)`;
83411
83419
  return "";
83412
83420
  }
@@ -83580,7 +83588,7 @@ function runningVersion(candidates = coreCandidates(), opts = {}) {
83580
83588
  }
83581
83589
  return null;
83582
83590
  }
83583
- function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.81" : "" } = {}) {
83591
+ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.82" : "" } = {}) {
83584
83592
  const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
83585
83593
  const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
83586
83594
  if (!refused) {
@@ -83600,6 +83608,10 @@ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(proc
83600
83608
  }
83601
83609
  return lines.join("\n");
83602
83610
  }
83611
+ function coreSpawn(argv, logPath, log, platform2 = process.platform) {
83612
+ if (platform2 === "win32") return { argv: [...argv, "--log", logPath], opts: { stdio: "ignore", windowsHide: true } };
83613
+ return { argv, opts: { stdio: ["ignore", log, log], detached: true, windowsHide: true } };
83614
+ }
83603
83615
  function attempt({ bin, args: args2 }, cwd2, { task, images, resume }) {
83604
83616
  return new Promise((resolve, reject) => {
83605
83617
  const runId = crypto.randomBytes(6).toString("hex");
@@ -83619,7 +83631,8 @@ function attempt({ bin, args: args2 }, cwd2, { task, images, resume }) {
83619
83631
  };
83620
83632
  let child;
83621
83633
  try {
83622
- child = spawn2(bin, argv, { stdio: ["ignore", log, log], detached: true, windowsHide: true });
83634
+ const start = coreSpawn(argv, logPath, log);
83635
+ child = spawn2(bin, start.argv, start.opts);
83623
83636
  } catch (e) {
83624
83637
  fs4.closeSync(log);
83625
83638
  reject({ spawn: e });
@@ -85599,7 +85612,7 @@ var input_default = MultilineInput;
85599
85612
 
85600
85613
  // src/app.jsx
85601
85614
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
85602
- var MINE = true ? "0.1.81" : "";
85615
+ var MINE = true ? "0.1.82" : "";
85603
85616
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
85604
85617
  var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
85605
85618
  var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
@@ -87356,7 +87369,7 @@ init_update();
87356
87369
  init_install();
87357
87370
  var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
87358
87371
  import { spawnSync as spawnSync5 } from "node:child_process";
87359
- var MINE2 = true ? "0.1.81" : "0.0.0";
87372
+ var MINE2 = true ? "0.1.82" : "0.0.0";
87360
87373
  var layout = installLayout();
87361
87374
  function completeInstall() {
87362
87375
  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.81",
3
+ "version": "0.1.82",
4
4
  "description": "Hum: a self-improving coding agent for your terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",