@metaphi-ai/hum 0.1.37 → 0.1.39
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/dist/cli.mjs +57 -12
- package/dist/install.mjs +34 -7
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -74600,6 +74600,18 @@ function installedVersion(env3 = process.env, runImpl = run) {
|
|
|
74600
74600
|
}
|
|
74601
74601
|
return v;
|
|
74602
74602
|
}
|
|
74603
|
+
function trustedPython(env3 = process.env, runImpl = run) {
|
|
74604
|
+
if (!win) return null;
|
|
74605
|
+
const r = runImpl("py", ["-3.12", "-I", "-c", "import ssl, sys; print(sys.executable)"]);
|
|
74606
|
+
const p = r && r.status === 0 ? String(r.stdout).trim().split(/\r?\n/).pop() : "";
|
|
74607
|
+
return /^[a-z]:\\.+\\python(w)?\.exe$/i.test(p) ? p : null;
|
|
74608
|
+
}
|
|
74609
|
+
function sslBlocked(env3 = process.env, runImpl = run) {
|
|
74610
|
+
const r = runImpl(enginePython(env3), ASK_SSL);
|
|
74611
|
+
if (r && r.status === 0) return null;
|
|
74612
|
+
const text = String(r && (r.stderr || r.stdout) || "ssl did not import").trim().split(/\r?\n/).filter(Boolean).pop() || "ssl did not import";
|
|
74613
|
+
return text;
|
|
74614
|
+
}
|
|
74603
74615
|
function needsInstall(version, { env: env3 = process.env, installed = () => installedVersion(env3), now = Date.now(), state = readInstallState(env3) } = {}) {
|
|
74604
74616
|
if (!version || env3.HUM_ENGINE || env3.HUM_ENGINE_PORT) return false;
|
|
74605
74617
|
if (installed() === version) return false;
|
|
@@ -74635,14 +74647,23 @@ function installEngine(version, { env: env3 = process.env, say = (m) => console.
|
|
|
74635
74647
|
fs2.unlinkSync(stampPath(env3));
|
|
74636
74648
|
} catch {
|
|
74637
74649
|
}
|
|
74638
|
-
|
|
74639
|
-
|
|
74640
|
-
|
|
74641
|
-
|
|
74642
|
-
if ((
|
|
74643
|
-
|
|
74650
|
+
const trusted = trustedPython(env3, runImpl);
|
|
74651
|
+
const makeVenv = (clear) => (runImpl(u, ["venv", "--quiet", "--python", trusted || "3.12", ...clear ? ["--clear"] : [], dir], { stdio: "inherit" }) || {}).status === 0;
|
|
74652
|
+
const pipIn = () => (runImpl(u, ["pip", "install", "--quiet", "--python", python, spec], { stdio: "inherit" }) || {}).status === 0;
|
|
74653
|
+
if (!fs2.existsSync(python) && !makeVenv(fs2.existsSync(dir))) return outcome(false, "uv venv failed");
|
|
74654
|
+
if (!pipIn()) return outcome(false, `uv pip install ${spec} failed`);
|
|
74655
|
+
let got = importedVersion(env3, runImpl);
|
|
74644
74656
|
if (!got) return outcome(false, "hum did not import after the install");
|
|
74645
74657
|
if (got !== version && !env3.HUM_ENGINE_SPEC) return outcome(false, `installed ${got}, wanted ${version}`, got);
|
|
74658
|
+
let blocked = sslBlocked(env3, runImpl);
|
|
74659
|
+
if (blocked && trusted) {
|
|
74660
|
+
say(`the policy here refuses the environment's OpenSSL (${blocked}); rebuilding it on ${trusted} \u2026`);
|
|
74661
|
+
if (makeVenv(true) && pipIn()) {
|
|
74662
|
+
got = importedVersion(env3, runImpl) || got;
|
|
74663
|
+
blocked = sslBlocked(env3, runImpl);
|
|
74664
|
+
}
|
|
74665
|
+
}
|
|
74666
|
+
if (blocked) return outcome(false, sslAdvice(env3, version));
|
|
74646
74667
|
fs2.mkdirSync(dir, { recursive: true });
|
|
74647
74668
|
fs2.writeFileSync(stampPath(env3), `${got}
|
|
74648
74669
|
`);
|
|
@@ -74657,7 +74678,7 @@ function installEngine(version, { env: env3 = process.env, say = (m) => console.
|
|
|
74657
74678
|
return outcome(false, e && e.message ? e.message : String(e));
|
|
74658
74679
|
}
|
|
74659
74680
|
}
|
|
74660
|
-
var win, npmFix, NPM_FIX, humHome, engineDir, enginePython, stampPath, statePath, run, ASK_VERSION, readInstallState, writeInstallState;
|
|
74681
|
+
var win, npmFix, NPM_FIX, humHome, engineDir, enginePython, stampPath, statePath, run, ASK_VERSION, ASK_SSL, sslAdvice, readInstallState, writeInstallState;
|
|
74661
74682
|
var init_install = __esm({
|
|
74662
74683
|
"src/install.js"() {
|
|
74663
74684
|
win = process.platform === "win32";
|
|
@@ -74670,6 +74691,8 @@ var init_install = __esm({
|
|
|
74670
74691
|
statePath = (env3) => path.join(humHome(env3), "engine-install.json");
|
|
74671
74692
|
run = (cmd, args2, opts = {}) => spawnSync(cmd, args2, { encoding: "utf8", windowsHide: true, ...opts });
|
|
74672
74693
|
ASK_VERSION = ["-I", "-c", "import hum; print(hum.__version__)"];
|
|
74694
|
+
ASK_SSL = ["-I", "-c", "import ssl"];
|
|
74695
|
+
sslAdvice = (env3, version) => `the machine's application control blocked Python's OpenSSL DLL in ${engineDir(env3)}; install Python 3.12 from python.org (Microsoft signs it), then run ${npmFix(version)}`;
|
|
74673
74696
|
readInstallState = (env3 = process.env) => {
|
|
74674
74697
|
try {
|
|
74675
74698
|
return JSON.parse(fs2.readFileSync(statePath(env3), "utf8"));
|
|
@@ -75838,7 +75861,7 @@ function runningVersion(candidates = engineCandidates(), opts = {}) {
|
|
|
75838
75861
|
}
|
|
75839
75862
|
return null;
|
|
75840
75863
|
}
|
|
75841
|
-
function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.
|
|
75864
|
+
function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.39" : "" } = {}) {
|
|
75842
75865
|
const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
|
|
75843
75866
|
const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
|
|
75844
75867
|
if (!refused) {
|
|
@@ -76131,6 +76154,18 @@ async function diagnose({
|
|
|
76131
76154
|
else if (running.version === mine) checks.push(check("ok", `${running.version} runs from ${running.where} (${running.bin})`));
|
|
76132
76155
|
else if (env3.HUM_ENGINE) checks.push(check("fail", `${running.version} is what runs: HUM_ENGINE points at it (${env3.HUM_ENGINE}); you installed ${mine}`, "unset HUM_ENGINE"));
|
|
76133
76156
|
else checks.push(check("fail", `${running.version} is what runs (${running.where}: ${running.bin}); you installed ${mine}`, layout2.kind === "npm" ? npmFix2(mine) : updateCommand(layout2, platform2)));
|
|
76157
|
+
if (running && running.args.includes("-m")) {
|
|
76158
|
+
const r = runImpl(running.bin, ["-I", "-c", "import ssl"], { encoding: "utf8", windowsHide: true, timeout: 2e4 });
|
|
76159
|
+
const said = String(r && (r.stderr || r.stdout) || "");
|
|
76160
|
+
if (!(r && r.status === 0) && /ssl|DLL/i.test(said)) {
|
|
76161
|
+
const why = said.trim().split(/\r?\n/).filter(Boolean).pop() || "ssl did not import";
|
|
76162
|
+
checks.push(check(
|
|
76163
|
+
"fail",
|
|
76164
|
+
`${running.bin} cannot load OpenSSL (${why}); on a managed Windows machine that is the application control policy refusing the DLL`,
|
|
76165
|
+
isWin(platform2) ? `install Python 3.12 from python.org (Microsoft signs it), then run ${npmFix2(mine)}` : npmFix2(mine)
|
|
76166
|
+
));
|
|
76167
|
+
}
|
|
76168
|
+
}
|
|
76134
76169
|
if (env3.HUM_ENGINE && running && running.version === mine) checks.push(check("warn", `HUM_ENGINE is set (${env3.HUM_ENGINE}): it decides what runs, ahead of any install`, "unset HUM_ENGINE"));
|
|
76135
76170
|
if (layout2.kind === "npm") {
|
|
76136
76171
|
const st = readInstallState(env3);
|
|
@@ -84541,7 +84576,7 @@ var input_default = MultilineInput;
|
|
|
84541
84576
|
|
|
84542
84577
|
// src/app.jsx
|
|
84543
84578
|
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
84544
|
-
var MINE = true ? "0.1.
|
|
84579
|
+
var MINE = true ? "0.1.39" : "";
|
|
84545
84580
|
var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
|
|
84546
84581
|
var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
|
|
84547
84582
|
var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
|
|
@@ -85761,14 +85796,24 @@ function App2({ engine: engine2, task, resume, images = [] }) {
|
|
|
85761
85796
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` \xB7 ${reflection.category.replace(/_/g, " ")}${reflection.area ? ` \xB7 ${reflection.area}` : ""}` })
|
|
85762
85797
|
] }),
|
|
85763
85798
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: reflection.title }),
|
|
85764
|
-
|
|
85799
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
|
|
85800
|
+
reflection.details.split("\n").map((l, i) => {
|
|
85801
|
+
const m = l.match(/^\s*(What happened|What the person said|Evidence|Cause|Repro)\s*:\s*(.*)$/i);
|
|
85802
|
+
if (m) {
|
|
85803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", marginTop: i === 0 ? 0 : 1, children: [
|
|
85804
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` ${m[1]}` }),
|
|
85805
|
+
m[2] ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: ` ${m[2]}` }) : null
|
|
85806
|
+
] }, `d${i}`);
|
|
85807
|
+
}
|
|
85808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: ` ${l}` }, `d${i}`);
|
|
85809
|
+
}),
|
|
85765
85810
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
|
|
85766
85811
|
why === reflection.id ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
85767
85812
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: "What did it get wrong? " }),
|
|
85768
85813
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "type a line and press enter \xB7 enter alone records the no without a reason" })
|
|
85769
85814
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
|
|
85770
85815
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: "Is this true? " }),
|
|
85771
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `
|
|
85816
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `1 yes \xB7 2 no \xB7 enter skips \xB7 or just keep typing${reflections.length > 1 ? ` \xB7 ${reflections.length - 1} more` : ""}` })
|
|
85772
85817
|
] })
|
|
85773
85818
|
] })
|
|
85774
85819
|
] }),
|
|
@@ -86008,7 +86053,7 @@ init_update();
|
|
|
86008
86053
|
init_install();
|
|
86009
86054
|
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
86010
86055
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
86011
|
-
var MINE2 = true ? "0.1.
|
|
86056
|
+
var MINE2 = true ? "0.1.39" : "0.0.0";
|
|
86012
86057
|
var layout = installLayout();
|
|
86013
86058
|
function completeInstall() {
|
|
86014
86059
|
if (layout.kind !== "npm" || !needsInstall(MINE2)) return;
|
package/dist/install.mjs
CHANGED
|
@@ -33,6 +33,20 @@ function installedVersion(env = process.env, runImpl = run) {
|
|
|
33
33
|
}
|
|
34
34
|
return v;
|
|
35
35
|
}
|
|
36
|
+
function trustedPython(env = process.env, runImpl = run) {
|
|
37
|
+
if (!win) return null;
|
|
38
|
+
const r = runImpl("py", ["-3.12", "-I", "-c", "import ssl, sys; print(sys.executable)"]);
|
|
39
|
+
const p = r && r.status === 0 ? String(r.stdout).trim().split(/\r?\n/).pop() : "";
|
|
40
|
+
return /^[a-z]:\\.+\\python(w)?\.exe$/i.test(p) ? p : null;
|
|
41
|
+
}
|
|
42
|
+
var ASK_SSL = ["-I", "-c", "import ssl"];
|
|
43
|
+
function sslBlocked(env = process.env, runImpl = run) {
|
|
44
|
+
const r = runImpl(enginePython(env), ASK_SSL);
|
|
45
|
+
if (r && r.status === 0) return null;
|
|
46
|
+
const text = String(r && (r.stderr || r.stdout) || "ssl did not import").trim().split(/\r?\n/).filter(Boolean).pop() || "ssl did not import";
|
|
47
|
+
return text;
|
|
48
|
+
}
|
|
49
|
+
var sslAdvice = (env, version) => `the machine's application control blocked Python's OpenSSL DLL in ${engineDir(env)}; install Python 3.12 from python.org (Microsoft signs it), then run ${npmFix(version)}`;
|
|
36
50
|
var readInstallState = (env = process.env) => {
|
|
37
51
|
try {
|
|
38
52
|
return JSON.parse(fs.readFileSync(statePath(env), "utf8"));
|
|
@@ -82,14 +96,23 @@ function installEngine(version, { env = process.env, say = (m) => console.log(`h
|
|
|
82
96
|
fs.unlinkSync(stampPath(env));
|
|
83
97
|
} catch {
|
|
84
98
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if ((
|
|
90
|
-
|
|
99
|
+
const trusted = trustedPython(env, runImpl);
|
|
100
|
+
const makeVenv = (clear) => (runImpl(u, ["venv", "--quiet", "--python", trusted || "3.12", ...clear ? ["--clear"] : [], dir], { stdio: "inherit" }) || {}).status === 0;
|
|
101
|
+
const pipIn = () => (runImpl(u, ["pip", "install", "--quiet", "--python", python, spec], { stdio: "inherit" }) || {}).status === 0;
|
|
102
|
+
if (!fs.existsSync(python) && !makeVenv(fs.existsSync(dir))) return outcome(false, "uv venv failed");
|
|
103
|
+
if (!pipIn()) return outcome(false, `uv pip install ${spec} failed`);
|
|
104
|
+
let got = importedVersion(env, runImpl);
|
|
91
105
|
if (!got) return outcome(false, "hum did not import after the install");
|
|
92
106
|
if (got !== version && !env.HUM_ENGINE_SPEC) return outcome(false, `installed ${got}, wanted ${version}`, got);
|
|
107
|
+
let blocked = sslBlocked(env, runImpl);
|
|
108
|
+
if (blocked && trusted) {
|
|
109
|
+
say(`the policy here refuses the environment's OpenSSL (${blocked}); rebuilding it on ${trusted} \u2026`);
|
|
110
|
+
if (makeVenv(true) && pipIn()) {
|
|
111
|
+
got = importedVersion(env, runImpl) || got;
|
|
112
|
+
blocked = sslBlocked(env, runImpl);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (blocked) return outcome(false, sslAdvice(env, version));
|
|
93
116
|
fs.mkdirSync(dir, { recursive: true });
|
|
94
117
|
fs.writeFileSync(stampPath(env), `${got}
|
|
95
118
|
`);
|
|
@@ -105,6 +128,7 @@ function installEngine(version, { env = process.env, say = (m) => console.log(`h
|
|
|
105
128
|
}
|
|
106
129
|
}
|
|
107
130
|
export {
|
|
131
|
+
ASK_SSL,
|
|
108
132
|
ASK_VERSION,
|
|
109
133
|
NPM_FIX,
|
|
110
134
|
engineDir,
|
|
@@ -115,5 +139,8 @@ export {
|
|
|
115
139
|
installedVersion,
|
|
116
140
|
needsInstall,
|
|
117
141
|
npmFix,
|
|
118
|
-
readInstallState
|
|
142
|
+
readInstallState,
|
|
143
|
+
sslAdvice,
|
|
144
|
+
sslBlocked,
|
|
145
|
+
trustedPython
|
|
119
146
|
};
|