@metaphi-ai/hum 0.1.7 → 0.1.8
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.
- package/bin/hum.js +3 -2
- package/dist/cli.mjs +14 -7
- package/package.json +1 -1
package/bin/hum.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// `hum` from npm: the Ink front-end, which starts Hum's engine (Python, installed by postinstall
|
|
3
3
|
// via uv) and talks to it over localhost. Everything the person sees is here; everything the
|
|
4
4
|
// session records is in the engine.
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
|
|
8
|
+
// a URL, not a path: on Windows `C:\…` is not something the ESM loader will import
|
|
9
|
+
await import(pathToFileURL(path.join(here, '..', 'dist', 'cli.mjs')).href);
|
package/dist/cli.mjs
CHANGED
|
@@ -83738,7 +83738,7 @@ var COMMANDS = [
|
|
|
83738
83738
|
{ name: "/compact", desc: "summarise and restart the context now" },
|
|
83739
83739
|
{ name: "/model", desc: "switch the model for this session (/model <name>)" },
|
|
83740
83740
|
{ name: "/cost", desc: "tokens and cost so far" },
|
|
83741
|
-
{ name: "/approve", desc: "approvals on|off \u2014 whether
|
|
83741
|
+
{ name: "/approve", desc: "approvals on|off \u2014 whether every change and command waits for you first (leaving the sandbox always asks)" },
|
|
83742
83742
|
{ name: "/continue", desc: "after a pause: let the agent carry on" },
|
|
83743
83743
|
{ name: "/image", desc: "attach an image file to your next message (/image <path>); ctrl+v pastes a screenshot" },
|
|
83744
83744
|
{ name: "/tools", desc: "what is mounted" },
|
|
@@ -83747,7 +83747,7 @@ var COMMANDS = [
|
|
|
83747
83747
|
{ name: "/quit", desc: "leave; the session keeps running (hum brings you back)" },
|
|
83748
83748
|
{ name: "/stop", desc: "end this session's engine (the record is saved)" }
|
|
83749
83749
|
];
|
|
83750
|
-
var HELP = "!cmd runs a command as you \xB7 esc interrupts the model (what it had is kept) \xB7 type while it works to steer \xB7 edit files in your editor any time (recorded as your turn) \xB7 ctrl+o shows the full output of the last tool result \xB7 ctrl+v pastes a screenshot from the clipboard \xB7 @path.png or /image <path> attaches an image file \xB7
|
|
83750
|
+
var HELP = "!cmd runs a command as you \xB7 esc interrupts the model (what it had is kept) \xB7 type while it works to steer \xB7 edit files in your editor any time (recorded as your turn) \xB7 ctrl+o shows the full output of the last tool result \xB7 ctrl+v pastes a screenshot from the clipboard \xB7 @path.png or /image <path> attaches an image file \xB7 commands run in a sandbox (writes in the working directory, no network); leaving it asks you first (enter approves, a typed reason rejects) \xB7 /approve makes every change and command wait for you \xB7 /resume picks a past session (a running one attaches) \xB7 /compact restarts the context from a summary \xB7 ctrl+c twice leaves and the session keeps running (`hum` brings you back) \xB7 /stop ends it";
|
|
83751
83751
|
var DIFF_TAIL_LINES = 20;
|
|
83752
83752
|
var OUTPUT_MAX_LINES = 200;
|
|
83753
83753
|
var ERR_TAIL_LINES = 5;
|
|
@@ -83860,7 +83860,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
|
|
|
83860
83860
|
const state = ev.state && ev.state !== "new" && ev.state !== "idle" ? ` \xB7 ${ev.state}` : "";
|
|
83861
83861
|
append({
|
|
83862
83862
|
kind: "banner",
|
|
83863
|
-
text: `${ev.model}${ev.user ? ` \xB7 ${ev.user}` : ""} \xB7 ${homeRel(ev.cwd)} \xB7 tools: ${ev.tools.join(", ")}${state}`,
|
|
83863
|
+
text: `${ev.model}${ev.user ? ` \xB7 ${ev.user}` : ""} \xB7 ${homeRel(ev.cwd)} \xB7 tools: ${ev.tools.join(", ")}${ev.sandbox ? ` \xB7 sandbox: ${ev.sandbox}` : ""}${state}`,
|
|
83864
83864
|
instruction: ev.session ? ev.instruction : null
|
|
83865
83865
|
});
|
|
83866
83866
|
preHello.current.forEach((it) => append(it));
|
|
@@ -84429,7 +84429,9 @@ function App2({ engine: engine2, task, resume, images = [] }) {
|
|
|
84429
84429
|
proposal && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
|
|
84430
84430
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
84431
84431
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "? " }),
|
|
84432
|
-
"hum wants to
|
|
84432
|
+
"hum wants to",
|
|
84433
|
+
proposal.calls.some((c) => c.escape) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: " leave the sandbox" }) : null,
|
|
84434
|
+
" ",
|
|
84433
84435
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\xB7 enter approves \xB7 type a reason to reject \xB7 esc stops" })
|
|
84434
84436
|
] }),
|
|
84435
84437
|
proposal.content ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
|
|
@@ -84442,10 +84444,14 @@ function App2({ engine: engine2, task, resume, images = [] }) {
|
|
|
84442
84444
|
c.desc,
|
|
84443
84445
|
c.lines != null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` (${c.lines} lines)` }) : null
|
|
84444
84446
|
] }),
|
|
84445
|
-
c.name === "bash" || c.name === "powershell" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "cyan", children: [
|
|
84447
|
+
(c.name === "bash" || c.name === "powershell") && c.desc !== `$ ${String(c.args?.command || "")}` ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "cyan", children: [
|
|
84446
84448
|
" $ ",
|
|
84447
84449
|
String(c.args?.command || "").split("\n").join(" \u23CE ").slice(0, 300)
|
|
84448
84450
|
] }) : null,
|
|
84451
|
+
c.escape ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "yellow", children: [
|
|
84452
|
+
" outside the sandbox \u2014 ",
|
|
84453
|
+
String(c.reason || "").slice(0, Math.max(20, width - 32))
|
|
84454
|
+
] }) : null,
|
|
84449
84455
|
c.diff ? c.diff.split("\n").slice(0, DIFF_TAIL_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
84450
84456
|
Text,
|
|
84451
84457
|
{
|
|
@@ -84531,10 +84537,11 @@ var EngineError = class extends Error {
|
|
|
84531
84537
|
};
|
|
84532
84538
|
var ENGINE_CANDIDATES = [
|
|
84533
84539
|
process.env.HUM_ENGINE,
|
|
84534
|
-
// explicit: a command to run
|
|
84540
|
+
// explicit: a command to run (e.g. `python -m hum.cli engine`)
|
|
84535
84541
|
"hum-engine",
|
|
84536
84542
|
// uv tool install hum-cli
|
|
84537
|
-
|
|
84543
|
+
path2.join(os4.homedir(), ".local", "bin", process.platform === "win32" ? "hum-engine.exe" : "hum-engine")
|
|
84544
|
+
// uv's bin dir, off PATH
|
|
84538
84545
|
];
|
|
84539
84546
|
function spawnEngine(cwd2, { task = null, images = [], resume = null } = {}) {
|
|
84540
84547
|
return new Promise((resolve, reject) => {
|