@metaphi-ai/hum 0.2.11 → 0.2.13
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 +27 -12
- package/dist/install.mjs +20 -5
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -88509,7 +88509,7 @@ function installCore(version, { env: env3 = process.env, say = (m) => console.lo
|
|
|
88509
88509
|
}
|
|
88510
88510
|
const trusted = trustedPython(env3, runImpl);
|
|
88511
88511
|
const makeVenv = (clear) => (runImpl(u, ["venv", "--quiet", "--python", trusted || "3.12", ...clear ? ["--clear"] : [], dir], { stdio: "inherit" }) || {}).status === 0;
|
|
88512
|
-
const pipIn = () => (runImpl(u, ["pip", "install", "--quiet", "--python", python, spec], { stdio: "inherit" }) || {}).status === 0;
|
|
88512
|
+
const pipIn = () => (runImpl(u, ["pip", "install", "--quiet", "--refresh-package", "hum-cli", "--python", python, spec], { stdio: "inherit" }) || {}).status === 0;
|
|
88513
88513
|
if (!fs3.existsSync(python) && !makeVenv(fs3.existsSync(dir))) return outcome(false, "uv venv failed");
|
|
88514
88514
|
if (!pipIn()) return outcome(false, `uv pip install ${spec} failed`);
|
|
88515
88515
|
let got = importedVersion(env3, version, runImpl);
|
|
@@ -88596,7 +88596,7 @@ function prune(env3 = process.env, { keep = MINE, say = () => {
|
|
|
88596
88596
|
}
|
|
88597
88597
|
return gone.sort((a, b) => newer(a, b) ? -1 : newer(b, a) ? 1 : 0);
|
|
88598
88598
|
}
|
|
88599
|
-
function installVersion(version, { env: env3 = process.env, say = (m) => console.log(`hum: ${m}`), runImpl = run, now = Date.now() } = {}) {
|
|
88599
|
+
function installVersion(version, { env: env3 = process.env, say = (m) => console.log(`hum: ${m}`), runImpl = run, now = Date.now(), retries = 0, every = 90 * 1e3, wait = pause } = {}) {
|
|
88600
88600
|
if (!isVersion(version)) return { ok: false, error: `not a version: ${version}` };
|
|
88601
88601
|
try {
|
|
88602
88602
|
fs3.mkdirSync(versionDir(env3, version), { recursive: true });
|
|
@@ -88604,12 +88604,21 @@ function installVersion(version, { env: env3 = process.env, say = (m) => console
|
|
|
88604
88604
|
fs3.unlinkSync(readyFile(env3, version));
|
|
88605
88605
|
} catch {
|
|
88606
88606
|
}
|
|
88607
|
+
const attempt2 = (what, step) => {
|
|
88608
|
+
let r = step();
|
|
88609
|
+
for (let i = 0; !r.ok && i < retries; i += 1) {
|
|
88610
|
+
say(`${what} is not there yet (${r.error}); trying again in ${Math.round(every / 1e3)} s`);
|
|
88611
|
+
wait(every);
|
|
88612
|
+
r = step();
|
|
88613
|
+
}
|
|
88614
|
+
return r;
|
|
88615
|
+
};
|
|
88607
88616
|
if (!fs3.existsSync(entryFile(env3, version))) {
|
|
88608
|
-
const p = installPackage(version, { env: env3, say, runImpl });
|
|
88617
|
+
const p = attempt2("the package", () => installPackage(version, { env: env3, say, runImpl }));
|
|
88609
88618
|
if (!p.ok) return p;
|
|
88610
88619
|
}
|
|
88611
88620
|
if (installedVersion(env3, version, runImpl) !== version) {
|
|
88612
|
-
const c = installCore(version, { env: env3, say, runImpl, now });
|
|
88621
|
+
const c = attempt2("the part of hum that does the work", () => installCore(version, { env: env3, say, runImpl, now }));
|
|
88613
88622
|
if (!c.ok) return { ok: false, error: c.error };
|
|
88614
88623
|
}
|
|
88615
88624
|
fs3.writeFileSync(readyFile(env3, version), `${version}
|
|
@@ -88621,11 +88630,11 @@ function installVersion(version, { env: env3 = process.env, say = (m) => console
|
|
|
88621
88630
|
return { ok: false, error: e && e.message ? e.message : String(e) };
|
|
88622
88631
|
}
|
|
88623
88632
|
}
|
|
88624
|
-
var win, MINE, npmFix, NPM_FIX, humHome, versionsDir, versionDir, pkgDir, coreDir, corePython, readyFile, entryFile, stampPath, statePath, isVersion, newer, run, ASK_VERSION, ASK_SSL, sslAdvice, readInstallState, writeInstallState;
|
|
88633
|
+
var win, MINE, npmFix, NPM_FIX, humHome, versionsDir, versionDir, pkgDir, coreDir, corePython, readyFile, entryFile, stampPath, statePath, isVersion, newer, run, ASK_VERSION, ASK_SSL, sslAdvice, readInstallState, writeInstallState, pause;
|
|
88625
88634
|
var init_install = __esm({
|
|
88626
88635
|
"src/install.js"() {
|
|
88627
88636
|
win = process.platform === "win32";
|
|
88628
|
-
MINE = true ? "0.2.
|
|
88637
|
+
MINE = true ? "0.2.13" : "";
|
|
88629
88638
|
npmFix = (version = "") => `npm i -g @metaphi-ai/hum@${version || "latest"} --foreground-scripts`;
|
|
88630
88639
|
NPM_FIX = npmFix("latest");
|
|
88631
88640
|
humHome = (env3 = process.env) => env3.HUM_HOME || path.join(os3.homedir(), ".hum");
|
|
@@ -88664,6 +88673,12 @@ var init_install = __esm({
|
|
|
88664
88673
|
} catch {
|
|
88665
88674
|
}
|
|
88666
88675
|
};
|
|
88676
|
+
pause = (ms) => {
|
|
88677
|
+
try {
|
|
88678
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
88679
|
+
} catch {
|
|
88680
|
+
}
|
|
88681
|
+
};
|
|
88667
88682
|
if (process.argv[1] && /install\.mjs$/.test(process.argv[1]) && process.argv[2] === "install") {
|
|
88668
88683
|
const log = path.join(humHome(), "update.log");
|
|
88669
88684
|
const say = (m) => {
|
|
@@ -88678,7 +88693,7 @@ var init_install = __esm({
|
|
|
88678
88693
|
if (r2 && r2.status !== 0 && (r2.stderr || r2.stdout)) say(String(r2.stderr || r2.stdout).trim().split(/\r?\n/).slice(-5).join("\n"));
|
|
88679
88694
|
return r2;
|
|
88680
88695
|
};
|
|
88681
|
-
const r = installVersion(process.argv[3] || "", { say, runImpl: runLogged });
|
|
88696
|
+
const r = installVersion(process.argv[3] || "", { say, runImpl: runLogged, retries: 3 });
|
|
88682
88697
|
if (!r.ok) say(`hum ${process.argv[3]} did not install: ${r.error}`);
|
|
88683
88698
|
process.exit(r.ok ? 0 : 1);
|
|
88684
88699
|
}
|
|
@@ -88820,7 +88835,7 @@ var init_update = __esm({
|
|
|
88820
88835
|
"src/update.js"() {
|
|
88821
88836
|
init_install();
|
|
88822
88837
|
init_install();
|
|
88823
|
-
dist = (env3 = process.env) => (env3.HUM_DIST || "https://
|
|
88838
|
+
dist = (env3 = process.env) => (env3.HUM_DIST || "https://hum.metaphi.ai").replace(/\/+$/, "");
|
|
88824
88839
|
humHome2 = (env3 = process.env) => env3.HUM_HOME || path2.join(os4.homedir(), ".hum");
|
|
88825
88840
|
win2 = () => process.platform === "win32";
|
|
88826
88841
|
updateCommand = (layout2 = installLayout(), platform2 = process.platform) => {
|
|
@@ -88955,10 +88970,10 @@ function clientEnv() {
|
|
|
88955
88970
|
platform: process.platform,
|
|
88956
88971
|
arch: process.arch,
|
|
88957
88972
|
terminal: process.env.TERM_PROGRAM || (process.env.WT_SESSION ? "Windows Terminal" : process.env.TERM || ""),
|
|
88958
|
-
tui: true ? "0.2.
|
|
88973
|
+
tui: true ? "0.2.13" : ""
|
|
88959
88974
|
};
|
|
88960
88975
|
}
|
|
88961
|
-
function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.
|
|
88976
|
+
function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.13" : "" } = {}) {
|
|
88962
88977
|
const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
|
|
88963
88978
|
const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
|
|
88964
88979
|
if (!refused) {
|
|
@@ -90416,7 +90431,7 @@ var input_default = MultilineInput;
|
|
|
90416
90431
|
|
|
90417
90432
|
// src/app.jsx
|
|
90418
90433
|
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
90419
|
-
var MINE2 = true ? "0.2.
|
|
90434
|
+
var MINE2 = true ? "0.2.13" : "";
|
|
90420
90435
|
var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
|
|
90421
90436
|
var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
|
|
90422
90437
|
var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
|
|
@@ -92241,7 +92256,7 @@ init_update();
|
|
|
92241
92256
|
init_install();
|
|
92242
92257
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
92243
92258
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
92244
|
-
var MINE3 = true ? "0.2.
|
|
92259
|
+
var MINE3 = true ? "0.2.13" : "0.0.0";
|
|
92245
92260
|
var layout = installLayout();
|
|
92246
92261
|
function completeInstall() {
|
|
92247
92262
|
if (layout.kind !== "npm" || !needsInstall(MINE3)) return;
|
package/dist/install.mjs
CHANGED
|
@@ -127,7 +127,7 @@ function installCore(version, { env = process.env, say = (m) => console.log(`hum
|
|
|
127
127
|
}
|
|
128
128
|
const trusted = trustedPython(env, runImpl);
|
|
129
129
|
const makeVenv = (clear) => (runImpl(u, ["venv", "--quiet", "--python", trusted || "3.12", ...clear ? ["--clear"] : [], dir], { stdio: "inherit" }) || {}).status === 0;
|
|
130
|
-
const pipIn = () => (runImpl(u, ["pip", "install", "--quiet", "--python", python, spec], { stdio: "inherit" }) || {}).status === 0;
|
|
130
|
+
const pipIn = () => (runImpl(u, ["pip", "install", "--quiet", "--refresh-package", "hum-cli", "--python", python, spec], { stdio: "inherit" }) || {}).status === 0;
|
|
131
131
|
if (!fs.existsSync(python) && !makeVenv(fs.existsSync(dir))) return outcome(false, "uv venv failed");
|
|
132
132
|
if (!pipIn()) return outcome(false, `uv pip install ${spec} failed`);
|
|
133
133
|
let got = importedVersion(env, version, runImpl);
|
|
@@ -214,7 +214,13 @@ function prune(env = process.env, { keep = MINE, say = () => {
|
|
|
214
214
|
}
|
|
215
215
|
return gone.sort((a, b) => newer(a, b) ? -1 : newer(b, a) ? 1 : 0);
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
var pause = (ms) => {
|
|
218
|
+
try {
|
|
219
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
220
|
+
} catch {
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
function installVersion(version, { env = process.env, say = (m) => console.log(`hum: ${m}`), runImpl = run, now = Date.now(), retries = 0, every = 90 * 1e3, wait = pause } = {}) {
|
|
218
224
|
if (!isVersion(version)) return { ok: false, error: `not a version: ${version}` };
|
|
219
225
|
try {
|
|
220
226
|
fs.mkdirSync(versionDir(env, version), { recursive: true });
|
|
@@ -222,12 +228,21 @@ function installVersion(version, { env = process.env, say = (m) => console.log(`
|
|
|
222
228
|
fs.unlinkSync(readyFile(env, version));
|
|
223
229
|
} catch {
|
|
224
230
|
}
|
|
231
|
+
const attempt = (what, step) => {
|
|
232
|
+
let r = step();
|
|
233
|
+
for (let i = 0; !r.ok && i < retries; i += 1) {
|
|
234
|
+
say(`${what} is not there yet (${r.error}); trying again in ${Math.round(every / 1e3)} s`);
|
|
235
|
+
wait(every);
|
|
236
|
+
r = step();
|
|
237
|
+
}
|
|
238
|
+
return r;
|
|
239
|
+
};
|
|
225
240
|
if (!fs.existsSync(entryFile(env, version))) {
|
|
226
|
-
const p = installPackage(version, { env, say, runImpl });
|
|
241
|
+
const p = attempt("the package", () => installPackage(version, { env, say, runImpl }));
|
|
227
242
|
if (!p.ok) return p;
|
|
228
243
|
}
|
|
229
244
|
if (installedVersion(env, version, runImpl) !== version) {
|
|
230
|
-
const c = installCore(version, { env, say, runImpl, now });
|
|
245
|
+
const c = attempt("the part of hum that does the work", () => installCore(version, { env, say, runImpl, now }));
|
|
231
246
|
if (!c.ok) return { ok: false, error: c.error };
|
|
232
247
|
}
|
|
233
248
|
fs.writeFileSync(readyFile(env, version), `${version}
|
|
@@ -253,7 +268,7 @@ if (process.argv[1] && /install\.mjs$/.test(process.argv[1]) && process.argv[2]
|
|
|
253
268
|
if (r2 && r2.status !== 0 && (r2.stderr || r2.stdout)) say(String(r2.stderr || r2.stdout).trim().split(/\r?\n/).slice(-5).join("\n"));
|
|
254
269
|
return r2;
|
|
255
270
|
};
|
|
256
|
-
const r = installVersion(process.argv[3] || "", { say, runImpl: runLogged });
|
|
271
|
+
const r = installVersion(process.argv[3] || "", { say, runImpl: runLogged, retries: 3 });
|
|
257
272
|
if (!r.ok) say(`hum ${process.argv[3]} did not install: ${r.error}`);
|
|
258
273
|
process.exit(r.ok ? 0 : 1);
|
|
259
274
|
}
|