@metaphi-ai/hum 0.2.40 → 0.2.42
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 +270 -100
- package/dist/install.mjs +65 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -17,9 +17,9 @@ var __esm = (fn, res) => function __init() {
|
|
|
17
17
|
var __commonJS = (cb, mod) => function __require2() {
|
|
18
18
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
19
|
};
|
|
20
|
-
var __export = (
|
|
20
|
+
var __export = (target2, all) => {
|
|
21
21
|
for (var name in all)
|
|
22
|
-
__defProp(
|
|
22
|
+
__defProp(target2, name, { get: all[name], enumerable: true });
|
|
23
23
|
};
|
|
24
24
|
var __copyProps = (to, from, except, desc) => {
|
|
25
25
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -29,12 +29,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
29
29
|
}
|
|
30
30
|
return to;
|
|
31
31
|
};
|
|
32
|
-
var __toESM = (mod, isNodeMode,
|
|
32
|
+
var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
33
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
34
|
// file that has been converted to a CommonJS file using a Babel-
|
|
35
35
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
36
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target2, "default", { value: mod, enumerable: true }) : target2,
|
|
38
38
|
mod
|
|
39
39
|
));
|
|
40
40
|
|
|
@@ -6986,8 +6986,8 @@ var require_react_reconciler_production = __commonJS({
|
|
|
6986
6986
|
var lane = concurrentQueues[i];
|
|
6987
6987
|
concurrentQueues[i++] = null;
|
|
6988
6988
|
if (null !== queue && null !== update) {
|
|
6989
|
-
var
|
|
6990
|
-
null ===
|
|
6989
|
+
var pending2 = queue.pending;
|
|
6990
|
+
null === pending2 ? update.next = update : (update.next = pending2.next, pending2.next = update);
|
|
6991
6991
|
queue.pending = update;
|
|
6992
6992
|
}
|
|
6993
6993
|
0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane);
|
|
@@ -7053,8 +7053,8 @@ var require_react_reconciler_production = __commonJS({
|
|
|
7053
7053
|
if (null === updateQueue) return null;
|
|
7054
7054
|
updateQueue = updateQueue.shared;
|
|
7055
7055
|
if (0 !== (executionContext & 2)) {
|
|
7056
|
-
var
|
|
7057
|
-
null ===
|
|
7056
|
+
var pending2 = updateQueue.pending;
|
|
7057
|
+
null === pending2 ? update.next = update : (update.next = pending2.next, pending2.next = update);
|
|
7058
7058
|
updateQueue.pending = update;
|
|
7059
7059
|
update = getRootForUpdatedFiber(fiber);
|
|
7060
7060
|
markUpdateLaneFromFiberToRoot(fiber, null, lane);
|
|
@@ -8133,8 +8133,8 @@ var require_react_reconciler_production = __commonJS({
|
|
|
8133
8133
|
}
|
|
8134
8134
|
function enqueueRenderPhaseUpdate(queue, update) {
|
|
8135
8135
|
didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true;
|
|
8136
|
-
var
|
|
8137
|
-
null ===
|
|
8136
|
+
var pending2 = queue.pending;
|
|
8137
|
+
null === pending2 ? update.next = update : (update.next = pending2.next, pending2.next = update);
|
|
8138
8138
|
queue.pending = update;
|
|
8139
8139
|
}
|
|
8140
8140
|
function entangleTransitionUpdate(root, queue, lane) {
|
|
@@ -13553,10 +13553,10 @@ var require_react_reconciler_development = __commonJS({
|
|
|
13553
13553
|
fiber = fiber.next, id--;
|
|
13554
13554
|
return fiber;
|
|
13555
13555
|
}
|
|
13556
|
-
function copyWithSetImpl(obj,
|
|
13557
|
-
if (index >=
|
|
13558
|
-
var key =
|
|
13559
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
13556
|
+
function copyWithSetImpl(obj, path10, index, value) {
|
|
13557
|
+
if (index >= path10.length) return value;
|
|
13558
|
+
var key = path10[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
|
|
13559
|
+
updated[key] = copyWithSetImpl(obj[key], path10, index + 1, value);
|
|
13560
13560
|
return updated;
|
|
13561
13561
|
}
|
|
13562
13562
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -13583,11 +13583,11 @@ var require_react_reconciler_development = __commonJS({
|
|
|
13583
13583
|
);
|
|
13584
13584
|
return updated;
|
|
13585
13585
|
}
|
|
13586
|
-
function copyWithDeleteImpl(obj,
|
|
13587
|
-
var key =
|
|
13588
|
-
if (index + 1 ===
|
|
13586
|
+
function copyWithDeleteImpl(obj, path10, index) {
|
|
13587
|
+
var key = path10[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
|
|
13588
|
+
if (index + 1 === path10.length)
|
|
13589
13589
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
13590
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
13590
|
+
updated[key] = copyWithDeleteImpl(obj[key], path10, index + 1);
|
|
13591
13591
|
return updated;
|
|
13592
13592
|
}
|
|
13593
13593
|
function shouldSuspendImpl() {
|
|
@@ -16899,8 +16899,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
16899
16899
|
var lane = concurrentQueues[i];
|
|
16900
16900
|
concurrentQueues[i++] = null;
|
|
16901
16901
|
if (null !== queue && null !== update) {
|
|
16902
|
-
var
|
|
16903
|
-
null ===
|
|
16902
|
+
var pending2 = queue.pending;
|
|
16903
|
+
null === pending2 ? update.next = update : (update.next = pending2.next, pending2.next = update);
|
|
16904
16904
|
queue.pending = update;
|
|
16905
16905
|
}
|
|
16906
16906
|
0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane);
|
|
@@ -18492,8 +18492,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
18492
18492
|
}
|
|
18493
18493
|
function enqueueRenderPhaseUpdate(queue, update) {
|
|
18494
18494
|
didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true;
|
|
18495
|
-
var
|
|
18496
|
-
null ===
|
|
18495
|
+
var pending2 = queue.pending;
|
|
18496
|
+
null === pending2 ? update.next = update : (update.next = pending2.next, pending2.next = update);
|
|
18497
18497
|
queue.pending = update;
|
|
18498
18498
|
}
|
|
18499
18499
|
function entangleTransitionUpdate(root, queue, lane) {
|
|
@@ -26864,29 +26864,29 @@ var require_react_reconciler_development = __commonJS({
|
|
|
26864
26864
|
var didWarnAboutNestedUpdates = false;
|
|
26865
26865
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
26866
26866
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, scheduleRetry = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
26867
|
-
overrideHookState = function(fiber, id,
|
|
26867
|
+
overrideHookState = function(fiber, id, path10, value) {
|
|
26868
26868
|
id = findHook(fiber, id);
|
|
26869
|
-
null !== id && (
|
|
26869
|
+
null !== id && (path10 = copyWithSetImpl(id.memoizedState, path10, 0, value), id.memoizedState = path10, id.baseState = path10, fiber.memoizedProps = assign({}, fiber.memoizedProps), path10 = enqueueConcurrentRenderForLane(fiber, 2), null !== path10 && scheduleUpdateOnFiber(path10, fiber, 2));
|
|
26870
26870
|
};
|
|
26871
|
-
overrideHookStateDeletePath = function(fiber, id,
|
|
26871
|
+
overrideHookStateDeletePath = function(fiber, id, path10) {
|
|
26872
26872
|
id = findHook(fiber, id);
|
|
26873
|
-
null !== id && (
|
|
26873
|
+
null !== id && (path10 = copyWithDeleteImpl(id.memoizedState, path10, 0), id.memoizedState = path10, id.baseState = path10, fiber.memoizedProps = assign({}, fiber.memoizedProps), path10 = enqueueConcurrentRenderForLane(fiber, 2), null !== path10 && scheduleUpdateOnFiber(path10, fiber, 2));
|
|
26874
26874
|
};
|
|
26875
26875
|
overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
|
|
26876
26876
|
id = findHook(fiber, id);
|
|
26877
26877
|
null !== id && (oldPath = copyWithRename(id.memoizedState, oldPath, newPath), id.memoizedState = oldPath, id.baseState = oldPath, fiber.memoizedProps = assign({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), null !== oldPath && scheduleUpdateOnFiber(oldPath, fiber, 2));
|
|
26878
26878
|
};
|
|
26879
|
-
overrideProps = function(fiber,
|
|
26880
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
26879
|
+
overrideProps = function(fiber, path10, value) {
|
|
26880
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path10, 0, value);
|
|
26881
26881
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
26882
|
-
|
|
26883
|
-
null !==
|
|
26882
|
+
path10 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
26883
|
+
null !== path10 && scheduleUpdateOnFiber(path10, fiber, 2);
|
|
26884
26884
|
};
|
|
26885
|
-
overridePropsDeletePath = function(fiber,
|
|
26886
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
26885
|
+
overridePropsDeletePath = function(fiber, path10) {
|
|
26886
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path10, 0);
|
|
26887
26887
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
26888
|
-
|
|
26889
|
-
null !==
|
|
26888
|
+
path10 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
26889
|
+
null !== path10 && scheduleUpdateOnFiber(path10, fiber, 2);
|
|
26890
26890
|
};
|
|
26891
26891
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
26892
26892
|
fiber.pendingProps = copyWithRename(
|
|
@@ -27243,11 +27243,11 @@ var require_react_reconciler_development = __commonJS({
|
|
|
27243
27243
|
exports2.observeVisibleRects = function(hostRoot, selectors, callback, options2) {
|
|
27244
27244
|
function commitHook() {
|
|
27245
27245
|
var nextInstanceRoots = findAllNodes(hostRoot, selectors);
|
|
27246
|
-
instanceRoots.forEach(function(
|
|
27247
|
-
0 > nextInstanceRoots.indexOf(
|
|
27246
|
+
instanceRoots.forEach(function(target2) {
|
|
27247
|
+
0 > nextInstanceRoots.indexOf(target2) && unobserve(target2);
|
|
27248
27248
|
});
|
|
27249
|
-
nextInstanceRoots.forEach(function(
|
|
27250
|
-
0 > instanceRoots.indexOf(
|
|
27249
|
+
nextInstanceRoots.forEach(function(target2) {
|
|
27250
|
+
0 > instanceRoots.indexOf(target2) && observe(target2);
|
|
27251
27251
|
});
|
|
27252
27252
|
}
|
|
27253
27253
|
if (!supportsTestSelectors)
|
|
@@ -29600,17 +29600,17 @@ var require_buffer_util = __commonJS({
|
|
|
29600
29600
|
function concat(list2, totalLength) {
|
|
29601
29601
|
if (list2.length === 0) return EMPTY_BUFFER;
|
|
29602
29602
|
if (list2.length === 1) return list2[0];
|
|
29603
|
-
const
|
|
29603
|
+
const target2 = Buffer.allocUnsafe(totalLength);
|
|
29604
29604
|
let offset = 0;
|
|
29605
29605
|
for (let i = 0; i < list2.length; i++) {
|
|
29606
29606
|
const buf = list2[i];
|
|
29607
|
-
|
|
29607
|
+
target2.set(buf, offset);
|
|
29608
29608
|
offset += buf.length;
|
|
29609
29609
|
}
|
|
29610
29610
|
if (offset < totalLength) {
|
|
29611
|
-
return new FastBuffer(
|
|
29611
|
+
return new FastBuffer(target2.buffer, target2.byteOffset, offset);
|
|
29612
29612
|
}
|
|
29613
|
-
return
|
|
29613
|
+
return target2;
|
|
29614
29614
|
}
|
|
29615
29615
|
function _mask(source, mask, output, offset, length) {
|
|
29616
29616
|
for (let i = 0; i < length; i++) {
|
|
@@ -31039,29 +31039,29 @@ var require_sender = __commonJS({
|
|
|
31039
31039
|
offset += 2;
|
|
31040
31040
|
payloadLength = 126;
|
|
31041
31041
|
}
|
|
31042
|
-
const
|
|
31043
|
-
|
|
31044
|
-
if (options2.rsv1)
|
|
31045
|
-
|
|
31042
|
+
const target2 = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
|
|
31043
|
+
target2[0] = options2.fin ? options2.opcode | 128 : options2.opcode;
|
|
31044
|
+
if (options2.rsv1) target2[0] |= 64;
|
|
31045
|
+
target2[1] = payloadLength;
|
|
31046
31046
|
if (payloadLength === 126) {
|
|
31047
|
-
|
|
31047
|
+
target2.writeUInt16BE(dataLength, 2);
|
|
31048
31048
|
} else if (payloadLength === 127) {
|
|
31049
|
-
|
|
31050
|
-
|
|
31051
|
-
}
|
|
31052
|
-
if (!options2.mask) return [
|
|
31053
|
-
|
|
31054
|
-
|
|
31055
|
-
|
|
31056
|
-
|
|
31057
|
-
|
|
31058
|
-
if (skipMasking) return [
|
|
31049
|
+
target2[2] = target2[3] = 0;
|
|
31050
|
+
target2.writeUIntBE(dataLength, 4, 6);
|
|
31051
|
+
}
|
|
31052
|
+
if (!options2.mask) return [target2, data];
|
|
31053
|
+
target2[1] |= 128;
|
|
31054
|
+
target2[offset - 4] = mask[0];
|
|
31055
|
+
target2[offset - 3] = mask[1];
|
|
31056
|
+
target2[offset - 2] = mask[2];
|
|
31057
|
+
target2[offset - 1] = mask[3];
|
|
31058
|
+
if (skipMasking) return [target2, data];
|
|
31059
31059
|
if (merge) {
|
|
31060
|
-
applyMask(data, mask,
|
|
31061
|
-
return [
|
|
31060
|
+
applyMask(data, mask, target2, offset, dataLength);
|
|
31061
|
+
return [target2];
|
|
31062
31062
|
}
|
|
31063
31063
|
applyMask(data, mask, data, 0, dataLength);
|
|
31064
|
-
return [
|
|
31064
|
+
return [target2, data];
|
|
31065
31065
|
}
|
|
31066
31066
|
/**
|
|
31067
31067
|
* Sends a close message to the other peer.
|
|
@@ -33379,8 +33379,8 @@ var init_devtools = __esm({
|
|
|
33379
33379
|
// node_modules/ink/build/reconciler.js
|
|
33380
33380
|
import process4 from "node:process";
|
|
33381
33381
|
async function loadPackageJson() {
|
|
33382
|
-
const
|
|
33383
|
-
const content =
|
|
33382
|
+
const fs11 = await import("node:fs");
|
|
33383
|
+
const content = fs11.readFileSync(new URL("../package.json", import.meta.url), "utf8");
|
|
33384
33384
|
const parsedContent = JSON.parse(content);
|
|
33385
33385
|
return {
|
|
33386
33386
|
name: parsedContent?.name,
|
|
@@ -35826,26 +35826,26 @@ var init_input_parser = __esm({
|
|
|
35826
35826
|
};
|
|
35827
35827
|
};
|
|
35828
35828
|
createInputParser = () => {
|
|
35829
|
-
let
|
|
35829
|
+
let pending2 = "";
|
|
35830
35830
|
return {
|
|
35831
35831
|
push(chunk) {
|
|
35832
|
-
const parsedInput = parseKeypresses(
|
|
35833
|
-
|
|
35832
|
+
const parsedInput = parseKeypresses(pending2 + chunk);
|
|
35833
|
+
pending2 = parsedInput.pending;
|
|
35834
35834
|
return parsedInput.events;
|
|
35835
35835
|
},
|
|
35836
35836
|
hasPendingEscape() {
|
|
35837
|
-
return
|
|
35837
|
+
return pending2.startsWith(escape) && !pending2.startsWith(pasteStart) && pending2 !== "\x1B[200";
|
|
35838
35838
|
},
|
|
35839
35839
|
flushPendingEscape() {
|
|
35840
|
-
if (!
|
|
35840
|
+
if (!pending2.startsWith(escape)) {
|
|
35841
35841
|
return void 0;
|
|
35842
35842
|
}
|
|
35843
|
-
const pendingEscape =
|
|
35844
|
-
|
|
35843
|
+
const pendingEscape = pending2;
|
|
35844
|
+
pending2 = "";
|
|
35845
35845
|
return pendingEscape;
|
|
35846
35846
|
},
|
|
35847
35847
|
reset() {
|
|
35848
|
-
|
|
35848
|
+
pending2 = "";
|
|
35849
35849
|
}
|
|
35850
35850
|
};
|
|
35851
35851
|
};
|
|
@@ -36552,8 +36552,8 @@ var init_ErrorOverview = __esm({
|
|
|
36552
36552
|
init_dist3();
|
|
36553
36553
|
init_Box();
|
|
36554
36554
|
init_Text();
|
|
36555
|
-
cleanupPath = (
|
|
36556
|
-
return
|
|
36555
|
+
cleanupPath = (path10) => {
|
|
36556
|
+
return path10?.replace(`file://${cwd()}/`, "");
|
|
36557
36557
|
};
|
|
36558
36558
|
stackUtils = new import_stack_utils.default({
|
|
36559
36559
|
cwd: cwd(),
|
|
@@ -43370,7 +43370,7 @@ var require_supports_colors = __commonJS({
|
|
|
43370
43370
|
"node_modules/@colors/colors/lib/system/supports-colors.js"(exports, module) {
|
|
43371
43371
|
"use strict";
|
|
43372
43372
|
init_define_HUM_CORE_SUBS();
|
|
43373
|
-
var
|
|
43373
|
+
var os10 = __require("os");
|
|
43374
43374
|
var hasFlag2 = require_has_flag();
|
|
43375
43375
|
var env3 = process.env;
|
|
43376
43376
|
var forceColor = void 0;
|
|
@@ -43408,7 +43408,7 @@ var require_supports_colors = __commonJS({
|
|
|
43408
43408
|
}
|
|
43409
43409
|
var min = forceColor ? 1 : 0;
|
|
43410
43410
|
if (process.platform === "win32") {
|
|
43411
|
-
var osRelease =
|
|
43411
|
+
var osRelease = os10.release().split(".");
|
|
43412
43412
|
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
43413
43413
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
43414
43414
|
}
|
|
@@ -87728,15 +87728,15 @@ var require_route = __commonJS({
|
|
|
87728
87728
|
};
|
|
87729
87729
|
}
|
|
87730
87730
|
function wrapConversion(toModel, graph) {
|
|
87731
|
-
const
|
|
87731
|
+
const path10 = [graph[toModel].parent, toModel];
|
|
87732
87732
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
87733
87733
|
let cur = graph[toModel].parent;
|
|
87734
87734
|
while (graph[cur].parent) {
|
|
87735
|
-
|
|
87735
|
+
path10.unshift(graph[cur].parent);
|
|
87736
87736
|
fn = link3(conversions[graph[cur].parent][cur], fn);
|
|
87737
87737
|
cur = graph[cur].parent;
|
|
87738
87738
|
}
|
|
87739
|
-
fn.conversion =
|
|
87739
|
+
fn.conversion = path10;
|
|
87740
87740
|
return fn;
|
|
87741
87741
|
}
|
|
87742
87742
|
module.exports = function(fromModel) {
|
|
@@ -87980,7 +87980,7 @@ var require_supports_color = __commonJS({
|
|
|
87980
87980
|
"node_modules/supports-color/index.js"(exports, module) {
|
|
87981
87981
|
"use strict";
|
|
87982
87982
|
init_define_HUM_CORE_SUBS();
|
|
87983
|
-
var
|
|
87983
|
+
var os10 = __require("os");
|
|
87984
87984
|
var tty3 = __require("tty");
|
|
87985
87985
|
var hasFlag2 = require_has_flag2();
|
|
87986
87986
|
var { env: env3 } = process;
|
|
@@ -88028,7 +88028,7 @@ var require_supports_color = __commonJS({
|
|
|
88028
88028
|
return min;
|
|
88029
88029
|
}
|
|
88030
88030
|
if (process.platform === "win32") {
|
|
88031
|
-
const osRelease =
|
|
88031
|
+
const osRelease = os10.release().split(".");
|
|
88032
88032
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
88033
88033
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
88034
88034
|
}
|
|
@@ -89291,6 +89291,38 @@ function trustedPython(env3 = process.env, runImpl = run) {
|
|
|
89291
89291
|
const p = r && r.status === 0 ? String(r.stdout).trim().split(/\r?\n/).pop() : "";
|
|
89292
89292
|
return /^[a-z]:\\.+\\python(w)?\.exe$/i.test(p) ? p : null;
|
|
89293
89293
|
}
|
|
89294
|
+
function signedPython(env3 = process.env, { say = () => {
|
|
89295
|
+
}, runImpl = run, platform: platform2 = process.platform } = {}) {
|
|
89296
|
+
if (platform2 !== "win32") return null;
|
|
89297
|
+
const dir = path.join(humHome(env3), "python", SIGNED_PYTHON.version);
|
|
89298
|
+
const python = path.join(dir, "tools", "python.exe");
|
|
89299
|
+
if (fs3.existsSync(python)) return python;
|
|
89300
|
+
say(`fetching Python ${SIGNED_PYTHON.version} from python.org (signed; your machine's policy trusts it) \u2026`);
|
|
89301
|
+
const part = `${dir}.part`, zip = `${dir}.zip`;
|
|
89302
|
+
const q = (s) => `'${s.replace(/'/g, "''")}'`;
|
|
89303
|
+
const script = [
|
|
89304
|
+
"$ErrorActionPreference = 'Stop'",
|
|
89305
|
+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12",
|
|
89306
|
+
`(New-Object Net.WebClient).DownloadFile(${q(SIGNED_PYTHON.url)}, ${q(zip)})`,
|
|
89307
|
+
`$f = [IO.File]::OpenRead(${q(zip)}); try { $h = ([BitConverter]::ToString([Security.Cryptography.SHA256]::Create().ComputeHash($f)) -replace '-', '').ToLower() } finally { $f.Dispose() }`,
|
|
89308
|
+
`if ($h -ne ${q(SIGNED_PYTHON.sha256)}) { throw 'checksum mismatch' }`,
|
|
89309
|
+
`if ([IO.Directory]::Exists(${q(part)})) { [IO.Directory]::Delete(${q(part)}, $true) }`,
|
|
89310
|
+
"[void][Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem')",
|
|
89311
|
+
`[IO.Compression.ZipFile]::ExtractToDirectory(${q(zip)}, ${q(part)})`,
|
|
89312
|
+
`[IO.Directory]::Move(${q(part)}, ${q(dir)})`
|
|
89313
|
+
].join("; ");
|
|
89314
|
+
fs3.mkdirSync(path.dirname(dir), { recursive: true });
|
|
89315
|
+
const r = runImpl("powershell", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", script]);
|
|
89316
|
+
try {
|
|
89317
|
+
fs3.unlinkSync(zip);
|
|
89318
|
+
} catch {
|
|
89319
|
+
}
|
|
89320
|
+
if (!(r && r.status === 0) || !fs3.existsSync(python)) {
|
|
89321
|
+
say(`could not fetch it (${String(r && (r.stderr || r.stdout) || "powershell failed").trim().split(/\r?\n/)[0]})`);
|
|
89322
|
+
return null;
|
|
89323
|
+
}
|
|
89324
|
+
return python;
|
|
89325
|
+
}
|
|
89294
89326
|
function sslBlocked(env3 = process.env, version = MINE, runImpl = run) {
|
|
89295
89327
|
const r = runImpl(corePython(env3, version), ASK_SSL);
|
|
89296
89328
|
if (r && r.status === 0) return null;
|
|
@@ -89331,7 +89363,7 @@ function installCore(version, { env: env3 = process.env, say = (m) => console.lo
|
|
|
89331
89363
|
fs3.unlinkSync(stampPath(env3, version));
|
|
89332
89364
|
} catch {
|
|
89333
89365
|
}
|
|
89334
|
-
const trusted = trustedPython(env3, runImpl);
|
|
89366
|
+
const trusted = trustedPython(env3, runImpl) || signedPython(env3, { say, runImpl });
|
|
89335
89367
|
const makeVenv = (clear) => (runImpl(u, ["venv", "--quiet", "--python", trusted || "3.12", ...clear ? ["--clear"] : [], dir], { stdio: "inherit" }) || {}).status === 0;
|
|
89336
89368
|
const pipIn = () => (runImpl(u, ["pip", "install", "--quiet", "--refresh-package", "hum-cli", "--python", python, spec], { stdio: "inherit" }) || {}).status === 0;
|
|
89337
89369
|
if (!fs3.existsSync(python) && !makeVenv(fs3.existsSync(dir))) return outcome(false, "uv venv failed");
|
|
@@ -89420,6 +89452,23 @@ function prune(env3 = process.env, { keep = MINE, say = () => {
|
|
|
89420
89452
|
}
|
|
89421
89453
|
return gone.sort((a, b) => newer(a, b) ? -1 : newer(b, a) ? 1 : 0);
|
|
89422
89454
|
}
|
|
89455
|
+
function ownInstaller(env3 = process.env, version = MINE, execPath = process.execPath) {
|
|
89456
|
+
if (version === MINE || !/^node(\.exe)?$/i.test(path.basename(execPath))) return null;
|
|
89457
|
+
const p = path.join(pkgDir(env3, version), "dist", "install.mjs");
|
|
89458
|
+
return fs3.existsSync(p) ? p : null;
|
|
89459
|
+
}
|
|
89460
|
+
function buildCore(version, { env: env3 = process.env, say = (m) => console.log(`hum: ${m}`), runImpl = run, now = Date.now(), execPath = process.execPath } = {}) {
|
|
89461
|
+
const theirs = ownInstaller(env3, version, execPath);
|
|
89462
|
+
if (theirs) {
|
|
89463
|
+
const r = runImpl(execPath, [theirs, "core", version], { stdio: "inherit", env: env3 }) || {};
|
|
89464
|
+
if (r.status !== 0) {
|
|
89465
|
+
const s = readInstallState(env3);
|
|
89466
|
+
return { ok: false, version, error: s && s.wanted === version && s.error || `hum ${version}'s installer did not finish` };
|
|
89467
|
+
}
|
|
89468
|
+
if (installedVersion(env3, version, runImpl) === version) return { ok: true, version, error: null };
|
|
89469
|
+
}
|
|
89470
|
+
return installCore(version, { env: env3, say, runImpl, now });
|
|
89471
|
+
}
|
|
89423
89472
|
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 } = {}) {
|
|
89424
89473
|
if (!isVersion(version)) return { ok: false, error: `not a version: ${version}` };
|
|
89425
89474
|
try {
|
|
@@ -89442,7 +89491,7 @@ function installVersion(version, { env: env3 = process.env, say = (m) => console
|
|
|
89442
89491
|
if (!p.ok) return p;
|
|
89443
89492
|
}
|
|
89444
89493
|
if (installedVersion(env3, version, runImpl) !== version) {
|
|
89445
|
-
const c = attempt2("the part of hum that does the work", () =>
|
|
89494
|
+
const c = attempt2("the part of hum that does the work", () => buildCore(version, { env: env3, say, runImpl, now }));
|
|
89446
89495
|
if (!c.ok) return { ok: false, error: c.error };
|
|
89447
89496
|
}
|
|
89448
89497
|
fs3.writeFileSync(readyFile(env3, version), `${version}
|
|
@@ -89454,12 +89503,12 @@ function installVersion(version, { env: env3 = process.env, say = (m) => console
|
|
|
89454
89503
|
return { ok: false, error: e && e.message ? e.message : String(e) };
|
|
89455
89504
|
}
|
|
89456
89505
|
}
|
|
89457
|
-
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;
|
|
89506
|
+
var win, MINE, npmFix, NPM_FIX, humHome, versionsDir, versionDir, pkgDir, coreDir, corePython, readyFile, entryFile, stampPath, statePath, isVersion, newer, run, ASK_VERSION, SIGNED_PYTHON, ASK_SSL, sslAdvice, readInstallState, writeInstallState, pause;
|
|
89458
89507
|
var init_install = __esm({
|
|
89459
89508
|
"src/install.js"() {
|
|
89460
89509
|
init_define_HUM_CORE_SUBS();
|
|
89461
89510
|
win = process.platform === "win32";
|
|
89462
|
-
MINE = true ? "0.2.
|
|
89511
|
+
MINE = true ? "0.2.42" : "";
|
|
89463
89512
|
npmFix = (version = "") => `npm i -g @metaphi-ai/hum@${version || "latest"} --foreground-scripts`;
|
|
89464
89513
|
NPM_FIX = npmFix("latest");
|
|
89465
89514
|
humHome = (env3 = process.env) => env3.HUM_HOME || path.join(os3.homedir(), ".hum");
|
|
@@ -89482,8 +89531,13 @@ var init_install = __esm({
|
|
|
89482
89531
|
};
|
|
89483
89532
|
run = (cmd, args2, opts = {}) => spawnSync(cmd, args2, { encoding: "utf8", windowsHide: true, ...opts });
|
|
89484
89533
|
ASK_VERSION = ["-I", "-c", "import hum; print(hum.__version__)"];
|
|
89534
|
+
SIGNED_PYTHON = {
|
|
89535
|
+
version: "3.12.10",
|
|
89536
|
+
url: "https://api.nuget.org/v3-flatcontainer/python/3.12.10/python.3.12.10.nupkg",
|
|
89537
|
+
sha256: "0eb85c2dfccccf1b17352de4c397f69194035b7d37149eacc16f1147d93de3b8"
|
|
89538
|
+
};
|
|
89485
89539
|
ASK_SSL = ["-I", "-c", "import ssl"];
|
|
89486
|
-
sslAdvice = (env3, version) => `the machine's application control blocked Python's OpenSSL DLL in ${coreDir(env3, version)}; install Python 3.12 from python.org (
|
|
89540
|
+
sslAdvice = (env3, version) => `the machine's application control blocked Python's OpenSSL DLL in ${coreDir(env3, version)}; install Python 3.12 from python.org (signed by the Python Software Foundation), then run ${npmFix(version)}`;
|
|
89487
89541
|
readInstallState = (env3 = process.env) => {
|
|
89488
89542
|
try {
|
|
89489
89543
|
return JSON.parse(fs3.readFileSync(statePath(env3), "utf8"));
|
|
@@ -89504,6 +89558,10 @@ var init_install = __esm({
|
|
|
89504
89558
|
} catch {
|
|
89505
89559
|
}
|
|
89506
89560
|
};
|
|
89561
|
+
if (process.argv[1] && /install\.mjs$/.test(process.argv[1]) && process.argv[2] === "core") {
|
|
89562
|
+
const r = installCore(process.argv[3] || "");
|
|
89563
|
+
process.exit(r.ok ? 0 : 1);
|
|
89564
|
+
}
|
|
89507
89565
|
if (process.argv[1] && /install\.mjs$/.test(process.argv[1]) && process.argv[2] === "install") {
|
|
89508
89566
|
const log = path.join(humHome(), "update.log");
|
|
89509
89567
|
const say = (m) => {
|
|
@@ -89805,10 +89863,10 @@ function clientEnv() {
|
|
|
89805
89863
|
platform: process.platform,
|
|
89806
89864
|
arch: process.arch,
|
|
89807
89865
|
terminal: process.env.TERM_PROGRAM || (process.env.WT_SESSION ? "Windows Terminal" : process.env.TERM || ""),
|
|
89808
|
-
tui: true ? "0.2.
|
|
89866
|
+
tui: true ? "0.2.42" : ""
|
|
89809
89867
|
};
|
|
89810
89868
|
}
|
|
89811
|
-
function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.
|
|
89869
|
+
function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.42" : "" } = {}) {
|
|
89812
89870
|
const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
|
|
89813
89871
|
const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
|
|
89814
89872
|
if (!refused) {
|
|
@@ -90356,9 +90414,9 @@ async function diagnose({
|
|
|
90356
90414
|
const launcher = isWin(platform2) ? path8.join(env3.LOCALAPPDATA || path8.join(homedir, "AppData", "Local"), "hum", "bin", "hum.cmd") : path8.join(homedir, ".local", "bin", "hum");
|
|
90357
90415
|
if (!exists2(launcher)) checks.push(check2("warn", `no launcher at ${launcher}`, updateCommand(layout2, platform2)));
|
|
90358
90416
|
else {
|
|
90359
|
-
const
|
|
90360
|
-
const insideVersions =
|
|
90361
|
-
checks.push(insideVersions ? check2("ok", `launcher ${launcher} \u2192 ${
|
|
90417
|
+
const target2 = isWin(platform2) ? (fs9.readFileSync(launcher, "utf8").match(new RegExp('"([^"]+)"')) || [])[1] || "" : realpath(launcher);
|
|
90418
|
+
const insideVersions = target2 && realpath(target2).startsWith(realpath(layout2.base));
|
|
90419
|
+
checks.push(insideVersions ? check2("ok", `launcher ${launcher} \u2192 ${target2}`) : check2("warn", `launcher ${launcher} is not the installer's (it points at ${target2 || "?"})`, updateCommand(layout2, platform2)));
|
|
90362
90420
|
}
|
|
90363
90421
|
}
|
|
90364
90422
|
const hits = onPath(env3, { platform: platform2 });
|
|
@@ -90394,7 +90452,7 @@ async function diagnose({
|
|
|
90394
90452
|
checks.push(check2(
|
|
90395
90453
|
"fail",
|
|
90396
90454
|
`${running.bin} cannot load OpenSSL (${why}); on a managed Windows machine that is the application control policy refusing the DLL`,
|
|
90397
|
-
isWin(platform2) ? `install Python 3.12 from python.org (
|
|
90455
|
+
isWin(platform2) ? `install Python 3.12 from python.org (signed by the Python Software Foundation), then run ${npmFix2(mine)}` : npmFix2(mine)
|
|
90398
90456
|
));
|
|
90399
90457
|
}
|
|
90400
90458
|
}
|
|
@@ -90517,21 +90575,21 @@ function sandboxCheck(platform2, env3) {
|
|
|
90517
90575
|
if (restricted) return check2("warn", "bubblewrap is installed but unprivileged user namespaces are restricted", "sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0");
|
|
90518
90576
|
return check2("ok", `sandbox: bubblewrap (${bwrap})`);
|
|
90519
90577
|
}
|
|
90520
|
-
function render2(
|
|
90578
|
+
function render2(report2) {
|
|
90521
90579
|
const out = [];
|
|
90522
|
-
for (const s of
|
|
90580
|
+
for (const s of report2.sections) {
|
|
90523
90581
|
out.push(s.title);
|
|
90524
90582
|
for (const c of s.checks) out.push(` ${MARK[c.status]} ${c.text}${c.fix ? `
|
|
90525
90583
|
\u2192 ${c.fix}` : ""}`);
|
|
90526
90584
|
out.push("");
|
|
90527
90585
|
}
|
|
90528
|
-
out.push(`${
|
|
90586
|
+
out.push(`${report2.summary.ok} ok \xB7 ${report2.summary.warn} warn \xB7 ${report2.summary.fail} fail`);
|
|
90529
90587
|
return out.join("\n") + "\n";
|
|
90530
90588
|
}
|
|
90531
90589
|
async function doctor({ json = false, mine, write = (t) => process.stdout.write(t), ...opts } = {}) {
|
|
90532
|
-
const
|
|
90533
|
-
write(json ? JSON.stringify(
|
|
90534
|
-
return
|
|
90590
|
+
const report2 = await diagnose({ mine, ...opts });
|
|
90591
|
+
write(json ? JSON.stringify(report2, null, 2) + "\n" : render2(report2));
|
|
90592
|
+
return report2.summary.fail ? 1 : 0;
|
|
90535
90593
|
}
|
|
90536
90594
|
var isWin, npmFix2, exists2, realpath, tail, check2, PARSE_CONFIG, MARK;
|
|
90537
90595
|
var init_doctor = __esm({
|
|
@@ -91323,7 +91381,7 @@ var after = (ms, fn) => {
|
|
|
91323
91381
|
|
|
91324
91382
|
// src/app.jsx
|
|
91325
91383
|
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
91326
|
-
var MINE2 = true ? "0.2.
|
|
91384
|
+
var MINE2 = true ? "0.2.42" : "";
|
|
91327
91385
|
var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
|
|
91328
91386
|
var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
|
|
91329
91387
|
var shortSession = (name) => (name || "").replace(/\.jsonl$/, "");
|
|
@@ -93793,10 +93851,114 @@ ${r.content}`).join("\n\n") };
|
|
|
93793
93851
|
init_core();
|
|
93794
93852
|
init_update();
|
|
93795
93853
|
init_install();
|
|
93854
|
+
|
|
93855
|
+
// src/health.js
|
|
93856
|
+
init_define_HUM_CORE_SUBS();
|
|
93857
|
+
init_install();
|
|
93858
|
+
import crypto2 from "node:crypto";
|
|
93859
|
+
import fs10 from "node:fs";
|
|
93860
|
+
import os9 from "node:os";
|
|
93861
|
+
import path9 from "node:path";
|
|
93862
|
+
var RETRY_MS2 = 60 * 60 * 1e3;
|
|
93863
|
+
var SEND_TIMEOUT_MS = 5e3;
|
|
93864
|
+
var DOCTOR_TIMEOUT_MS = 3e4;
|
|
93865
|
+
var readJson = (p) => {
|
|
93866
|
+
try {
|
|
93867
|
+
return JSON.parse(fs10.readFileSync(p, "utf8"));
|
|
93868
|
+
} catch {
|
|
93869
|
+
return null;
|
|
93870
|
+
}
|
|
93871
|
+
};
|
|
93872
|
+
var writeJson = (p, v) => {
|
|
93873
|
+
try {
|
|
93874
|
+
fs10.mkdirSync(path9.dirname(p), { recursive: true });
|
|
93875
|
+
fs10.writeFileSync(p, JSON.stringify(v));
|
|
93876
|
+
} catch {
|
|
93877
|
+
}
|
|
93878
|
+
};
|
|
93879
|
+
function installId(env3 = process.env) {
|
|
93880
|
+
const p = path9.join(humHome(env3), "install-id");
|
|
93881
|
+
try {
|
|
93882
|
+
const id2 = fs10.readFileSync(p, "utf8").trim();
|
|
93883
|
+
if (id2) return id2;
|
|
93884
|
+
} catch {
|
|
93885
|
+
}
|
|
93886
|
+
const id = crypto2.randomUUID();
|
|
93887
|
+
try {
|
|
93888
|
+
fs10.mkdirSync(path9.dirname(p), { recursive: true });
|
|
93889
|
+
fs10.writeFileSync(p, `${id}
|
|
93890
|
+
`);
|
|
93891
|
+
} catch {
|
|
93892
|
+
}
|
|
93893
|
+
return id;
|
|
93894
|
+
}
|
|
93895
|
+
function pending(env3 = process.env, { now = Date.now(), start = null } = {}) {
|
|
93896
|
+
const home = humHome(env3);
|
|
93897
|
+
const sent = readJson(path9.join(home, "health.json")) || {};
|
|
93898
|
+
const found = [];
|
|
93899
|
+
const install = readJson(path9.join(home, "core-install.json"));
|
|
93900
|
+
if (install && install.ok === false && install.at) found.push({ kind: "install", at: install.at, error: install.error || "", wanted: install.wanted || install.version || "" });
|
|
93901
|
+
const core2 = readJson(path9.join(home, "failure.json"));
|
|
93902
|
+
if (core2 && core2.at) found.push({ kind: "core", at: core2.at, error: `${core2.code}: ${core2.message}`, command: core2.command || "", core: core2.version || "" });
|
|
93903
|
+
if (start) found.push({ kind: "start", at: now, error: start });
|
|
93904
|
+
return found.filter((f) => {
|
|
93905
|
+
const s = sent[f.kind] || {};
|
|
93906
|
+
return f.at > (s.at || 0) && (!s.tried || now - s.tried >= RETRY_MS2);
|
|
93907
|
+
}).sort((a, b) => a.at - b.at);
|
|
93908
|
+
}
|
|
93909
|
+
function target(env3) {
|
|
93910
|
+
const cred = readJson(path9.join(humHome(env3), "credentials.json")) || {};
|
|
93911
|
+
const url = (env3.HUM_AUTH_URL || cred.auth_url || "https://hum.metaphi.ai").replace(/\/+$/, "");
|
|
93912
|
+
return { url, token: cred.access_token || "" };
|
|
93913
|
+
}
|
|
93914
|
+
async function sendPending({
|
|
93915
|
+
env: env3 = process.env,
|
|
93916
|
+
mine = "",
|
|
93917
|
+
start = null,
|
|
93918
|
+
now = Date.now(),
|
|
93919
|
+
fetchImpl = globalThis.fetch,
|
|
93920
|
+
diagnoseImpl = null
|
|
93921
|
+
} = {}) {
|
|
93922
|
+
try {
|
|
93923
|
+
const due = pending(env3, { now, start });
|
|
93924
|
+
if (!due.length || typeof fetchImpl !== "function") return 0;
|
|
93925
|
+
const diag = diagnoseImpl || (async (o) => (await Promise.resolve().then(() => (init_doctor(), doctor_exports))).diagnose(o));
|
|
93926
|
+
const doctor2 = await Promise.race([
|
|
93927
|
+
diag({ env: env3, mine }).catch((e) => ({ error: String(e && e.message ? e.message : e) })),
|
|
93928
|
+
new Promise((resolve) => setTimeout(() => resolve({ error: "doctor did not finish in time" }), DOCTOR_TIMEOUT_MS).unref())
|
|
93929
|
+
]);
|
|
93930
|
+
const { url, token: token2 } = target(env3);
|
|
93931
|
+
const statePath2 = path9.join(humHome(env3), "health.json");
|
|
93932
|
+
const state = readJson(statePath2) || {};
|
|
93933
|
+
let sent = 0;
|
|
93934
|
+
for (const f of due) {
|
|
93935
|
+
const body = { ...f, version: mine, platform: `${process.platform}-${process.arch}`, os: os9.release(), install: installId(env3), doctor: doctor2 };
|
|
93936
|
+
let ok = false;
|
|
93937
|
+
try {
|
|
93938
|
+
const r = await fetchImpl(`${url}/health`, {
|
|
93939
|
+
method: "POST",
|
|
93940
|
+
body: JSON.stringify(body),
|
|
93941
|
+
signal: AbortSignal.timeout(SEND_TIMEOUT_MS),
|
|
93942
|
+
headers: { "Content-Type": "application/json", "X-Hum-Client": `hum-cli/${mine}`, ...token2 ? { Authorization: `Bearer ${token2}` } : {} }
|
|
93943
|
+
});
|
|
93944
|
+
ok = !!(r && r.ok);
|
|
93945
|
+
} catch {
|
|
93946
|
+
}
|
|
93947
|
+
state[f.kind] = ok ? { at: f.at, tried: now } : { ...state[f.kind] || {}, tried: now };
|
|
93948
|
+
if (ok) sent += 1;
|
|
93949
|
+
}
|
|
93950
|
+
writeJson(statePath2, state);
|
|
93951
|
+
return sent;
|
|
93952
|
+
} catch {
|
|
93953
|
+
return 0;
|
|
93954
|
+
}
|
|
93955
|
+
}
|
|
93956
|
+
|
|
93957
|
+
// src/cli.jsx
|
|
93796
93958
|
await init_theme();
|
|
93797
93959
|
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
|
93798
93960
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
93799
|
-
var MINE3 = true ? "0.2.
|
|
93961
|
+
var MINE3 = true ? "0.2.42" : "0.0.0";
|
|
93800
93962
|
var layout = installLayout();
|
|
93801
93963
|
function completeInstall() {
|
|
93802
93964
|
if (layout.kind !== "npm" || !needsInstall(MINE3)) return;
|
|
@@ -93806,6 +93968,7 @@ function completeInstall() {
|
|
|
93806
93968
|
const r = installCore(MINE3, { say });
|
|
93807
93969
|
if (!r.ok) say(`the update did not finish: ${r.error} \xB7 ${npmFix(MINE3)}`);
|
|
93808
93970
|
}
|
|
93971
|
+
var report = (start = null) => sendPending({ mine: MINE3, start });
|
|
93809
93972
|
var CORE_COMMANDS = new Set(typeof define_HUM_CORE_SUBS_default === "undefined" ? [] : define_HUM_CORE_SUBS_default);
|
|
93810
93973
|
var argv0 = process.argv.slice(2);
|
|
93811
93974
|
if (argv0[0] === "--version" || argv0[0] === "-V") {
|
|
@@ -93828,14 +93991,19 @@ if (CORE_COMMANDS.has(argv0[0]) || argv0[0] === "agents" && argv0.includes("--js
|
|
|
93828
93991
|
completeInstall();
|
|
93829
93992
|
const cmd = coreCommand(argv0);
|
|
93830
93993
|
if (!cmd) {
|
|
93831
|
-
|
|
93994
|
+
const why = startFailure([]);
|
|
93995
|
+
process.stderr.write(why + "\n");
|
|
93996
|
+
await report(why);
|
|
93832
93997
|
process.exit(1);
|
|
93833
93998
|
}
|
|
93834
93999
|
const r = spawnSync6(cmd.bin, cmd.args, { stdio: "inherit", windowsHide: true });
|
|
93835
94000
|
if (r.error) {
|
|
93836
|
-
|
|
94001
|
+
const why = startFailure([{ bin: cmd.bin, error: r.error }]);
|
|
94002
|
+
process.stderr.write(why + "\n");
|
|
94003
|
+
await report(why);
|
|
93837
94004
|
process.exit(1);
|
|
93838
94005
|
}
|
|
94006
|
+
await report();
|
|
93839
94007
|
process.exit(r.status === null ? 1 : r.status);
|
|
93840
94008
|
}
|
|
93841
94009
|
setTheme(await detectTheme());
|
|
@@ -93904,6 +94072,7 @@ var startedHere = false;
|
|
|
93904
94072
|
try {
|
|
93905
94073
|
if (!port) {
|
|
93906
94074
|
completeInstall();
|
|
94075
|
+
await report();
|
|
93907
94076
|
const rec = await startSession(args.cwd, { task: args.task, images: args.images, resume: args.resume && args.resume !== "pick" ? args.resume : null });
|
|
93908
94077
|
startedHere = true;
|
|
93909
94078
|
port = rec.port;
|
|
@@ -93912,6 +94081,7 @@ try {
|
|
|
93912
94081
|
} catch (exc) {
|
|
93913
94082
|
if (exc instanceof EngineError) {
|
|
93914
94083
|
if (exc.message) process.stderr.write(exc.message + "\n");
|
|
94084
|
+
if (exc.exit === 1 || exc.exit === 3) await report(exc.message || "the session did not start");
|
|
93915
94085
|
process.exit(exc.exit);
|
|
93916
94086
|
}
|
|
93917
94087
|
throw exc;
|
package/dist/install.mjs
CHANGED
|
@@ -69,6 +69,43 @@ function trustedPython(env = process.env, runImpl = run) {
|
|
|
69
69
|
const p = r && r.status === 0 ? String(r.stdout).trim().split(/\r?\n/).pop() : "";
|
|
70
70
|
return /^[a-z]:\\.+\\python(w)?\.exe$/i.test(p) ? p : null;
|
|
71
71
|
}
|
|
72
|
+
var SIGNED_PYTHON = {
|
|
73
|
+
version: "3.12.10",
|
|
74
|
+
url: "https://api.nuget.org/v3-flatcontainer/python/3.12.10/python.3.12.10.nupkg",
|
|
75
|
+
sha256: "0eb85c2dfccccf1b17352de4c397f69194035b7d37149eacc16f1147d93de3b8"
|
|
76
|
+
};
|
|
77
|
+
function signedPython(env = process.env, { say = () => {
|
|
78
|
+
}, runImpl = run, platform = process.platform } = {}) {
|
|
79
|
+
if (platform !== "win32") return null;
|
|
80
|
+
const dir = path.join(humHome(env), "python", SIGNED_PYTHON.version);
|
|
81
|
+
const python = path.join(dir, "tools", "python.exe");
|
|
82
|
+
if (fs.existsSync(python)) return python;
|
|
83
|
+
say(`fetching Python ${SIGNED_PYTHON.version} from python.org (signed; your machine's policy trusts it) \u2026`);
|
|
84
|
+
const part = `${dir}.part`, zip = `${dir}.zip`;
|
|
85
|
+
const q = (s) => `'${s.replace(/'/g, "''")}'`;
|
|
86
|
+
const script = [
|
|
87
|
+
"$ErrorActionPreference = 'Stop'",
|
|
88
|
+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12",
|
|
89
|
+
`(New-Object Net.WebClient).DownloadFile(${q(SIGNED_PYTHON.url)}, ${q(zip)})`,
|
|
90
|
+
`$f = [IO.File]::OpenRead(${q(zip)}); try { $h = ([BitConverter]::ToString([Security.Cryptography.SHA256]::Create().ComputeHash($f)) -replace '-', '').ToLower() } finally { $f.Dispose() }`,
|
|
91
|
+
`if ($h -ne ${q(SIGNED_PYTHON.sha256)}) { throw 'checksum mismatch' }`,
|
|
92
|
+
`if ([IO.Directory]::Exists(${q(part)})) { [IO.Directory]::Delete(${q(part)}, $true) }`,
|
|
93
|
+
"[void][Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem')",
|
|
94
|
+
`[IO.Compression.ZipFile]::ExtractToDirectory(${q(zip)}, ${q(part)})`,
|
|
95
|
+
`[IO.Directory]::Move(${q(part)}, ${q(dir)})`
|
|
96
|
+
].join("; ");
|
|
97
|
+
fs.mkdirSync(path.dirname(dir), { recursive: true });
|
|
98
|
+
const r = runImpl("powershell", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", script]);
|
|
99
|
+
try {
|
|
100
|
+
fs.unlinkSync(zip);
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
if (!(r && r.status === 0) || !fs.existsSync(python)) {
|
|
104
|
+
say(`could not fetch it (${String(r && (r.stderr || r.stdout) || "powershell failed").trim().split(/\r?\n/)[0]})`);
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return python;
|
|
108
|
+
}
|
|
72
109
|
var ASK_SSL = ["-I", "-c", "import ssl"];
|
|
73
110
|
function sslBlocked(env = process.env, version = MINE, runImpl = run) {
|
|
74
111
|
const r = runImpl(corePython(env, version), ASK_SSL);
|
|
@@ -76,7 +113,7 @@ function sslBlocked(env = process.env, version = MINE, runImpl = run) {
|
|
|
76
113
|
const text = String(r && (r.stderr || r.stdout) || "ssl did not import").trim().split(/\r?\n/).filter(Boolean).pop() || "ssl did not import";
|
|
77
114
|
return text;
|
|
78
115
|
}
|
|
79
|
-
var sslAdvice = (env, version) => `the machine's application control blocked Python's OpenSSL DLL in ${coreDir(env, version)}; install Python 3.12 from python.org (
|
|
116
|
+
var sslAdvice = (env, version) => `the machine's application control blocked Python's OpenSSL DLL in ${coreDir(env, version)}; install Python 3.12 from python.org (signed by the Python Software Foundation), then run ${npmFix(version)}`;
|
|
80
117
|
var readInstallState = (env = process.env) => {
|
|
81
118
|
try {
|
|
82
119
|
return JSON.parse(fs.readFileSync(statePath(env), "utf8"));
|
|
@@ -125,7 +162,7 @@ function installCore(version, { env = process.env, say = (m) => console.log(`hum
|
|
|
125
162
|
fs.unlinkSync(stampPath(env, version));
|
|
126
163
|
} catch {
|
|
127
164
|
}
|
|
128
|
-
const trusted = trustedPython(env, runImpl);
|
|
165
|
+
const trusted = trustedPython(env, runImpl) || signedPython(env, { say, runImpl });
|
|
129
166
|
const makeVenv = (clear) => (runImpl(u, ["venv", "--quiet", "--python", trusted || "3.12", ...clear ? ["--clear"] : [], dir], { stdio: "inherit" }) || {}).status === 0;
|
|
130
167
|
const pipIn = () => (runImpl(u, ["pip", "install", "--quiet", "--refresh-package", "hum-cli", "--python", python, spec], { stdio: "inherit" }) || {}).status === 0;
|
|
131
168
|
if (!fs.existsSync(python) && !makeVenv(fs.existsSync(dir))) return outcome(false, "uv venv failed");
|
|
@@ -220,6 +257,23 @@ var pause = (ms) => {
|
|
|
220
257
|
} catch {
|
|
221
258
|
}
|
|
222
259
|
};
|
|
260
|
+
function ownInstaller(env = process.env, version = MINE, execPath = process.execPath) {
|
|
261
|
+
if (version === MINE || !/^node(\.exe)?$/i.test(path.basename(execPath))) return null;
|
|
262
|
+
const p = path.join(pkgDir(env, version), "dist", "install.mjs");
|
|
263
|
+
return fs.existsSync(p) ? p : null;
|
|
264
|
+
}
|
|
265
|
+
function buildCore(version, { env = process.env, say = (m) => console.log(`hum: ${m}`), runImpl = run, now = Date.now(), execPath = process.execPath } = {}) {
|
|
266
|
+
const theirs = ownInstaller(env, version, execPath);
|
|
267
|
+
if (theirs) {
|
|
268
|
+
const r = runImpl(execPath, [theirs, "core", version], { stdio: "inherit", env }) || {};
|
|
269
|
+
if (r.status !== 0) {
|
|
270
|
+
const s = readInstallState(env);
|
|
271
|
+
return { ok: false, version, error: s && s.wanted === version && s.error || `hum ${version}'s installer did not finish` };
|
|
272
|
+
}
|
|
273
|
+
if (installedVersion(env, version, runImpl) === version) return { ok: true, version, error: null };
|
|
274
|
+
}
|
|
275
|
+
return installCore(version, { env, say, runImpl, now });
|
|
276
|
+
}
|
|
223
277
|
function installVersion(version, { env = process.env, say = (m) => console.log(`hum: ${m}`), runImpl = run, now = Date.now(), retries = 0, every = 90 * 1e3, wait = pause } = {}) {
|
|
224
278
|
if (!isVersion(version)) return { ok: false, error: `not a version: ${version}` };
|
|
225
279
|
try {
|
|
@@ -242,7 +296,7 @@ function installVersion(version, { env = process.env, say = (m) => console.log(`
|
|
|
242
296
|
if (!p.ok) return p;
|
|
243
297
|
}
|
|
244
298
|
if (installedVersion(env, version, runImpl) !== version) {
|
|
245
|
-
const c = attempt("the part of hum that does the work", () =>
|
|
299
|
+
const c = attempt("the part of hum that does the work", () => buildCore(version, { env, say, runImpl, now }));
|
|
246
300
|
if (!c.ok) return { ok: false, error: c.error };
|
|
247
301
|
}
|
|
248
302
|
fs.writeFileSync(readyFile(env, version), `${version}
|
|
@@ -254,6 +308,10 @@ function installVersion(version, { env = process.env, say = (m) => console.log(`
|
|
|
254
308
|
return { ok: false, error: e && e.message ? e.message : String(e) };
|
|
255
309
|
}
|
|
256
310
|
}
|
|
311
|
+
if (process.argv[1] && /install\.mjs$/.test(process.argv[1]) && process.argv[2] === "core") {
|
|
312
|
+
const r = installCore(process.argv[3] || "");
|
|
313
|
+
process.exit(r.ok ? 0 : 1);
|
|
314
|
+
}
|
|
257
315
|
if (process.argv[1] && /install\.mjs$/.test(process.argv[1]) && process.argv[2] === "install") {
|
|
258
316
|
const log = path.join(humHome(), "update.log");
|
|
259
317
|
const say = (m) => {
|
|
@@ -277,6 +335,8 @@ export {
|
|
|
277
335
|
ASK_VERSION,
|
|
278
336
|
MINE,
|
|
279
337
|
NPM_FIX,
|
|
338
|
+
SIGNED_PYTHON,
|
|
339
|
+
buildCore,
|
|
280
340
|
chosenEntry,
|
|
281
341
|
coreDir,
|
|
282
342
|
corePython,
|
|
@@ -290,11 +350,13 @@ export {
|
|
|
290
350
|
needsInstall,
|
|
291
351
|
newer,
|
|
292
352
|
npmFix,
|
|
353
|
+
ownInstaller,
|
|
293
354
|
pkgDir,
|
|
294
355
|
prune,
|
|
295
356
|
readInstallState,
|
|
296
357
|
readyFile,
|
|
297
358
|
readyVersions,
|
|
359
|
+
signedPython,
|
|
298
360
|
sslAdvice,
|
|
299
361
|
sslBlocked,
|
|
300
362
|
trustedPython,
|