omnius 1.0.398 → 1.0.400
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/index.js +427 -326
- package/dist/memory-maintenance-worker.js +3636 -0
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23513,6 +23513,9 @@ function selectCapEvictionCandidates(db, options2, withText) {
|
|
|
23513
23513
|
}
|
|
23514
23514
|
if (deg >= hubDegreeGuard)
|
|
23515
23515
|
continue;
|
|
23516
|
+
const ageMs = Math.max(0, now2 - row.ls);
|
|
23517
|
+
const recency = Math.exp(-ageMs / (30 * DAY));
|
|
23518
|
+
const utility = Math.log1p(row.mc) * 0.5 + Math.min(deg, 8) / 8 * 0.3 + recency * 0.2;
|
|
23516
23519
|
scored.push({
|
|
23517
23520
|
id: row.id,
|
|
23518
23521
|
text: row.text,
|
|
@@ -23520,7 +23523,7 @@ function selectCapEvictionCandidates(db, options2, withText) {
|
|
|
23520
23523
|
mentionCount: row.mc,
|
|
23521
23524
|
degree: deg,
|
|
23522
23525
|
lastSeen: row.ls,
|
|
23523
|
-
score:
|
|
23526
|
+
score: utility
|
|
23524
23527
|
});
|
|
23525
23528
|
}
|
|
23526
23529
|
scored.sort((a2, b) => a2.score - b.score || a2.lastSeen - b.lastSeen);
|
|
@@ -42574,12 +42577,12 @@ function comb(n2, k) {
|
|
|
42574
42577
|
if (k > n2)
|
|
42575
42578
|
return 0n;
|
|
42576
42579
|
k = k > n2 - k ? n2 - k : k;
|
|
42577
|
-
let
|
|
42580
|
+
let num3 = 1n, den = 1n;
|
|
42578
42581
|
for (let i2 = 0n; i2 < k; i2++) {
|
|
42579
|
-
|
|
42582
|
+
num3 = guardBig(num3 * (n2 - i2));
|
|
42580
42583
|
den *= i2 + 1n;
|
|
42581
42584
|
}
|
|
42582
|
-
return
|
|
42585
|
+
return num3 / den;
|
|
42583
42586
|
}
|
|
42584
42587
|
function perm(n2, k) {
|
|
42585
42588
|
if (k < 0n || n2 < 0n)
|
|
@@ -44293,19 +44296,19 @@ var init_raw = __esm({
|
|
|
44293
44296
|
});
|
|
44294
44297
|
|
|
44295
44298
|
// ../node_modules/multiformats/dist/src/vendor/varint.js
|
|
44296
|
-
function encode5(
|
|
44299
|
+
function encode5(num3, out, offset) {
|
|
44297
44300
|
out = out || [];
|
|
44298
44301
|
offset = offset || 0;
|
|
44299
44302
|
var oldOffset = offset;
|
|
44300
|
-
while (
|
|
44301
|
-
out[offset++] =
|
|
44302
|
-
|
|
44303
|
+
while (num3 >= INT) {
|
|
44304
|
+
out[offset++] = num3 & 255 | MSB;
|
|
44305
|
+
num3 /= 128;
|
|
44303
44306
|
}
|
|
44304
|
-
while (
|
|
44305
|
-
out[offset++] =
|
|
44306
|
-
|
|
44307
|
+
while (num3 & MSBALL) {
|
|
44308
|
+
out[offset++] = num3 & 255 | MSB;
|
|
44309
|
+
num3 >>>= 7;
|
|
44307
44310
|
}
|
|
44308
|
-
out[offset] =
|
|
44311
|
+
out[offset] = num3 | 0;
|
|
44309
44312
|
encode5.bytes = offset - oldOffset + 1;
|
|
44310
44313
|
return out;
|
|
44311
44314
|
}
|
|
@@ -45950,19 +45953,19 @@ function readObjectIdentifier(buf, context2) {
|
|
|
45950
45953
|
val2 = byte2 - 80;
|
|
45951
45954
|
}
|
|
45952
45955
|
let oid = `${val1}.${val2}`;
|
|
45953
|
-
let
|
|
45956
|
+
let num3 = [];
|
|
45954
45957
|
while (context2.offset < finalOffset) {
|
|
45955
45958
|
const byte3 = buf[context2.offset];
|
|
45956
45959
|
context2.offset++;
|
|
45957
|
-
|
|
45960
|
+
num3.push(byte3 & 127);
|
|
45958
45961
|
if (byte3 < 128) {
|
|
45959
|
-
|
|
45962
|
+
num3.reverse();
|
|
45960
45963
|
let val = 0;
|
|
45961
|
-
for (let i2 = 0; i2 <
|
|
45962
|
-
val +=
|
|
45964
|
+
for (let i2 = 0; i2 < num3.length; i2++) {
|
|
45965
|
+
val += num3[i2] << i2 * 7;
|
|
45963
45966
|
}
|
|
45964
45967
|
oid += `.${val}`;
|
|
45965
|
-
|
|
45968
|
+
num3 = [];
|
|
45966
45969
|
}
|
|
45967
45970
|
}
|
|
45968
45971
|
return oid;
|
|
@@ -49141,8 +49144,8 @@ function abignumber(n2) {
|
|
|
49141
49144
|
anumber(n2);
|
|
49142
49145
|
return n2;
|
|
49143
49146
|
}
|
|
49144
|
-
function numberToHexUnpadded(
|
|
49145
|
-
const hex = abignumber(
|
|
49147
|
+
function numberToHexUnpadded(num3) {
|
|
49148
|
+
const hex = abignumber(num3).toString(16);
|
|
49146
49149
|
return hex.length & 1 ? "0" + hex : hex;
|
|
49147
49150
|
}
|
|
49148
49151
|
function hexToNumber(hex) {
|
|
@@ -49418,15 +49421,15 @@ function validateField(field) {
|
|
|
49418
49421
|
validateObject(field, opts);
|
|
49419
49422
|
return field;
|
|
49420
49423
|
}
|
|
49421
|
-
function FpPow(Fp,
|
|
49424
|
+
function FpPow(Fp, num3, power) {
|
|
49422
49425
|
if (power < _0n2)
|
|
49423
49426
|
throw new Error("invalid exponent, negatives unsupported");
|
|
49424
49427
|
if (power === _0n2)
|
|
49425
49428
|
return Fp.ONE;
|
|
49426
49429
|
if (power === _1n2)
|
|
49427
|
-
return
|
|
49430
|
+
return num3;
|
|
49428
49431
|
let p2 = Fp.ONE;
|
|
49429
|
-
let d2 =
|
|
49432
|
+
let d2 = num3;
|
|
49430
49433
|
while (power > _0n2) {
|
|
49431
49434
|
if (power & _1n2)
|
|
49432
49435
|
p2 = Fp.mul(p2, d2);
|
|
@@ -49437,18 +49440,18 @@ function FpPow(Fp, num2, power) {
|
|
|
49437
49440
|
}
|
|
49438
49441
|
function FpInvertBatch(Fp, nums, passZero = false) {
|
|
49439
49442
|
const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : void 0);
|
|
49440
|
-
const multipliedAcc = nums.reduce((acc,
|
|
49441
|
-
if (Fp.is0(
|
|
49443
|
+
const multipliedAcc = nums.reduce((acc, num3, i2) => {
|
|
49444
|
+
if (Fp.is0(num3))
|
|
49442
49445
|
return acc;
|
|
49443
49446
|
inverted[i2] = acc;
|
|
49444
|
-
return Fp.mul(acc,
|
|
49447
|
+
return Fp.mul(acc, num3);
|
|
49445
49448
|
}, Fp.ONE);
|
|
49446
49449
|
const invertedAcc = Fp.inv(multipliedAcc);
|
|
49447
|
-
nums.reduceRight((acc,
|
|
49448
|
-
if (Fp.is0(
|
|
49450
|
+
nums.reduceRight((acc, num3, i2) => {
|
|
49451
|
+
if (Fp.is0(num3))
|
|
49449
49452
|
return acc;
|
|
49450
49453
|
inverted[i2] = Fp.mul(acc, inverted[i2]);
|
|
49451
|
-
return Fp.mul(acc,
|
|
49454
|
+
return Fp.mul(acc, num3);
|
|
49452
49455
|
}, invertedAcc);
|
|
49453
49456
|
return inverted;
|
|
49454
49457
|
}
|
|
@@ -49489,8 +49492,8 @@ function mapHashToField(key, fieldOrder, isLE2 = false) {
|
|
|
49489
49492
|
const minLen = getMinHashLength(fieldOrder);
|
|
49490
49493
|
if (len < 16 || len < minLen || len > 1024)
|
|
49491
49494
|
throw new Error("expected " + minLen + "-1024 bytes of input, got " + len);
|
|
49492
|
-
const
|
|
49493
|
-
const reduced = mod2(
|
|
49495
|
+
const num3 = isLE2 ? bytesToNumberLE(key) : bytesToNumberBE(key);
|
|
49496
|
+
const reduced = mod2(num3, fieldOrder - _1n2) + _1n2;
|
|
49494
49497
|
return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
|
49495
49498
|
}
|
|
49496
49499
|
var _0n2, _1n2, _2n, _3n, _4n, _5n, _7n, _8n, _9n, _16n, FIELD_FIELDS, _Field;
|
|
@@ -49563,32 +49566,32 @@ var init_modular = __esm({
|
|
|
49563
49566
|
this._sqrt = void 0;
|
|
49564
49567
|
Object.preventExtensions(this);
|
|
49565
49568
|
}
|
|
49566
|
-
create(
|
|
49567
|
-
return mod2(
|
|
49569
|
+
create(num3) {
|
|
49570
|
+
return mod2(num3, this.ORDER);
|
|
49568
49571
|
}
|
|
49569
|
-
isValid(
|
|
49570
|
-
if (typeof
|
|
49571
|
-
throw new Error("invalid field element: expected bigint, got " + typeof
|
|
49572
|
-
return _0n2 <=
|
|
49572
|
+
isValid(num3) {
|
|
49573
|
+
if (typeof num3 !== "bigint")
|
|
49574
|
+
throw new Error("invalid field element: expected bigint, got " + typeof num3);
|
|
49575
|
+
return _0n2 <= num3 && num3 < this.ORDER;
|
|
49573
49576
|
}
|
|
49574
|
-
is0(
|
|
49575
|
-
return
|
|
49577
|
+
is0(num3) {
|
|
49578
|
+
return num3 === _0n2;
|
|
49576
49579
|
}
|
|
49577
49580
|
// is valid and invertible
|
|
49578
|
-
isValidNot0(
|
|
49579
|
-
return !this.is0(
|
|
49581
|
+
isValidNot0(num3) {
|
|
49582
|
+
return !this.is0(num3) && this.isValid(num3);
|
|
49580
49583
|
}
|
|
49581
|
-
isOdd(
|
|
49582
|
-
return (
|
|
49584
|
+
isOdd(num3) {
|
|
49585
|
+
return (num3 & _1n2) === _1n2;
|
|
49583
49586
|
}
|
|
49584
|
-
neg(
|
|
49585
|
-
return mod2(-
|
|
49587
|
+
neg(num3) {
|
|
49588
|
+
return mod2(-num3, this.ORDER);
|
|
49586
49589
|
}
|
|
49587
49590
|
eql(lhs, rhs) {
|
|
49588
49591
|
return lhs === rhs;
|
|
49589
49592
|
}
|
|
49590
|
-
sqr(
|
|
49591
|
-
return mod2(
|
|
49593
|
+
sqr(num3) {
|
|
49594
|
+
return mod2(num3 * num3, this.ORDER);
|
|
49592
49595
|
}
|
|
49593
49596
|
add(lhs, rhs) {
|
|
49594
49597
|
return mod2(lhs + rhs, this.ORDER);
|
|
@@ -49599,15 +49602,15 @@ var init_modular = __esm({
|
|
|
49599
49602
|
mul(lhs, rhs) {
|
|
49600
49603
|
return mod2(lhs * rhs, this.ORDER);
|
|
49601
49604
|
}
|
|
49602
|
-
pow(
|
|
49603
|
-
return FpPow(this,
|
|
49605
|
+
pow(num3, power) {
|
|
49606
|
+
return FpPow(this, num3, power);
|
|
49604
49607
|
}
|
|
49605
49608
|
div(lhs, rhs) {
|
|
49606
49609
|
return mod2(lhs * invert(rhs, this.ORDER), this.ORDER);
|
|
49607
49610
|
}
|
|
49608
49611
|
// Same as above, but doesn't normalize
|
|
49609
|
-
sqrN(
|
|
49610
|
-
return
|
|
49612
|
+
sqrN(num3) {
|
|
49613
|
+
return num3 * num3;
|
|
49611
49614
|
}
|
|
49612
49615
|
addN(lhs, rhs) {
|
|
49613
49616
|
return lhs + rhs;
|
|
@@ -49618,16 +49621,16 @@ var init_modular = __esm({
|
|
|
49618
49621
|
mulN(lhs, rhs) {
|
|
49619
49622
|
return lhs * rhs;
|
|
49620
49623
|
}
|
|
49621
|
-
inv(
|
|
49622
|
-
return invert(
|
|
49624
|
+
inv(num3) {
|
|
49625
|
+
return invert(num3, this.ORDER);
|
|
49623
49626
|
}
|
|
49624
|
-
sqrt(
|
|
49627
|
+
sqrt(num3) {
|
|
49625
49628
|
if (!this._sqrt)
|
|
49626
49629
|
this._sqrt = FpSqrt(this.ORDER);
|
|
49627
|
-
return this._sqrt(this,
|
|
49630
|
+
return this._sqrt(this, num3);
|
|
49628
49631
|
}
|
|
49629
|
-
toBytes(
|
|
49630
|
-
return this.isLE ? numberToBytesLE(
|
|
49632
|
+
toBytes(num3) {
|
|
49633
|
+
return this.isLE ? numberToBytesLE(num3, this.BYTES) : numberToBytesBE(num3, this.BYTES);
|
|
49631
49634
|
}
|
|
49632
49635
|
fromBytes(bytes, skipValidation = false) {
|
|
49633
49636
|
abytes(bytes);
|
|
@@ -50458,8 +50461,8 @@ function ecdh(Point, ecdhOpts = {}) {
|
|
|
50458
50461
|
const lengths = Object.assign(getWLengths(Point.Fp, Fn), { seed: getMinHashLength(Fn.ORDER) });
|
|
50459
50462
|
function isValidSecretKey(secretKey) {
|
|
50460
50463
|
try {
|
|
50461
|
-
const
|
|
50462
|
-
return Fn.isValidNot0(
|
|
50464
|
+
const num3 = Fn.fromBytes(secretKey);
|
|
50465
|
+
return Fn.isValidNot0(num3);
|
|
50463
50466
|
} catch (error) {
|
|
50464
50467
|
return false;
|
|
50465
50468
|
}
|
|
@@ -50535,10 +50538,10 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
50535
50538
|
const HALF = CURVE_ORDER >> _1n4;
|
|
50536
50539
|
return number > HALF;
|
|
50537
50540
|
}
|
|
50538
|
-
function validateRS(title,
|
|
50539
|
-
if (!Fn.isValidNot0(
|
|
50541
|
+
function validateRS(title, num3) {
|
|
50542
|
+
if (!Fn.isValidNot0(num3))
|
|
50540
50543
|
throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`);
|
|
50541
|
-
return
|
|
50544
|
+
return num3;
|
|
50542
50545
|
}
|
|
50543
50546
|
function assertSmallCofactor() {
|
|
50544
50547
|
if (hasLargeCofactor)
|
|
@@ -50636,17 +50639,17 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
50636
50639
|
const bits2int = ecdsaOpts.bits2int || function bits2int_def(bytes) {
|
|
50637
50640
|
if (bytes.length > 8192)
|
|
50638
50641
|
throw new Error("input is too large");
|
|
50639
|
-
const
|
|
50642
|
+
const num3 = bytesToNumberBE(bytes);
|
|
50640
50643
|
const delta = bytes.length * 8 - fnBits;
|
|
50641
|
-
return delta > 0 ?
|
|
50644
|
+
return delta > 0 ? num3 >> BigInt(delta) : num3;
|
|
50642
50645
|
};
|
|
50643
50646
|
const bits2int_modN = ecdsaOpts.bits2int_modN || function bits2int_modN_def(bytes) {
|
|
50644
50647
|
return Fn.create(bits2int(bytes));
|
|
50645
50648
|
};
|
|
50646
50649
|
const ORDER_MASK = bitMask(fnBits);
|
|
50647
|
-
function int2octets(
|
|
50648
|
-
aInRange("num < 2^" + fnBits,
|
|
50649
|
-
return Fn.toBytes(
|
|
50650
|
+
function int2octets(num3) {
|
|
50651
|
+
aInRange("num < 2^" + fnBits, num3, _0n4, ORDER_MASK);
|
|
50652
|
+
return Fn.toBytes(num3);
|
|
50650
50653
|
}
|
|
50651
50654
|
function validateMsgAndHash(message2, prehash) {
|
|
50652
50655
|
abytes(message2, void 0, "message");
|
|
@@ -50749,7 +50752,7 @@ var init_weierstrass = __esm({
|
|
|
50749
50752
|
init_utils5();
|
|
50750
50753
|
init_curve();
|
|
50751
50754
|
init_modular();
|
|
50752
|
-
divNearest = (
|
|
50755
|
+
divNearest = (num3, den) => (num3 + (num3 >= 0 ? den : -den) / _2n2) / den;
|
|
50753
50756
|
DERErr = class extends Error {
|
|
50754
50757
|
constructor(m2 = "") {
|
|
50755
50758
|
super(m2);
|
|
@@ -50815,11 +50818,11 @@ var init_weierstrass = __esm({
|
|
|
50815
50818
|
// - add zero byte if exists
|
|
50816
50819
|
// - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
|
|
50817
50820
|
_int: {
|
|
50818
|
-
encode(
|
|
50821
|
+
encode(num3) {
|
|
50819
50822
|
const { Err: E } = DER;
|
|
50820
|
-
if (
|
|
50823
|
+
if (num3 < _0n4)
|
|
50821
50824
|
throw new E("integer: negative integers are not allowed");
|
|
50822
|
-
let hex = numberToHexUnpadded(
|
|
50825
|
+
let hex = numberToHexUnpadded(num3);
|
|
50823
50826
|
if (Number.parseInt(hex[0], 16) & 8)
|
|
50824
50827
|
hex = "00" + hex;
|
|
50825
50828
|
if (hex.length & 1)
|
|
@@ -51496,8 +51499,8 @@ var init_fnv1a = __esm({
|
|
|
51496
51499
|
});
|
|
51497
51500
|
|
|
51498
51501
|
// ../node_modules/@libp2p/utils/dist/src/filters/hashes.js
|
|
51499
|
-
function numberToBuffer(
|
|
51500
|
-
let hex =
|
|
51502
|
+
function numberToBuffer(num3) {
|
|
51503
|
+
let hex = num3.toString(16);
|
|
51501
51504
|
if (hex.length % 2 === 1) {
|
|
51502
51505
|
hex = `0${hex}`;
|
|
51503
51506
|
}
|
|
@@ -51999,11 +52002,11 @@ var init_parser = __esm({
|
|
|
51999
52002
|
if (char === void 0) {
|
|
52000
52003
|
return void 0;
|
|
52001
52004
|
}
|
|
52002
|
-
const
|
|
52003
|
-
if (Number.isNaN(
|
|
52005
|
+
const num3 = Number.parseInt(char, radix);
|
|
52006
|
+
if (Number.isNaN(num3)) {
|
|
52004
52007
|
return void 0;
|
|
52005
52008
|
}
|
|
52006
|
-
return
|
|
52009
|
+
return num3;
|
|
52007
52010
|
});
|
|
52008
52011
|
if (digit === void 0) {
|
|
52009
52012
|
break;
|
|
@@ -61824,11 +61827,11 @@ function cidEncoder(obj) {
|
|
|
61824
61827
|
function undefinedEncoder() {
|
|
61825
61828
|
throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded");
|
|
61826
61829
|
}
|
|
61827
|
-
function numberEncoder(
|
|
61828
|
-
if (Number.isNaN(
|
|
61830
|
+
function numberEncoder(num3) {
|
|
61831
|
+
if (Number.isNaN(num3)) {
|
|
61829
61832
|
throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");
|
|
61830
61833
|
}
|
|
61831
|
-
if (
|
|
61834
|
+
if (num3 === Infinity || num3 === -Infinity) {
|
|
61832
61835
|
throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");
|
|
61833
61836
|
}
|
|
61834
61837
|
return null;
|
|
@@ -62177,14 +62180,14 @@ var init_decode4 = __esm({
|
|
|
62177
62180
|
swallow([48, 49, 50, 51, 52, 53, 54, 55, 56, 57]);
|
|
62178
62181
|
}
|
|
62179
62182
|
const numStr = String.fromCharCode.apply(null, this.data.subarray(startPos, this._pos));
|
|
62180
|
-
const
|
|
62183
|
+
const num3 = parseFloat(numStr);
|
|
62181
62184
|
if (float) {
|
|
62182
|
-
return new Token(Type.float,
|
|
62185
|
+
return new Token(Type.float, num3, this._pos - startPos);
|
|
62183
62186
|
}
|
|
62184
|
-
if (this.options.allowBigInt !== true || Number.isSafeInteger(
|
|
62185
|
-
return new Token(
|
|
62187
|
+
if (this.options.allowBigInt !== true || Number.isSafeInteger(num3)) {
|
|
62188
|
+
return new Token(num3 >= 0 ? Type.uint : Type.negint, num3, this._pos - startPos);
|
|
62186
62189
|
}
|
|
62187
|
-
return new Token(
|
|
62190
|
+
return new Token(num3 >= 0 ? Type.uint : Type.negint, BigInt(numStr), this._pos - startPos);
|
|
62188
62191
|
}
|
|
62189
62192
|
/**
|
|
62190
62193
|
* @returns {Token}
|
|
@@ -62542,11 +62545,11 @@ function abBytesEncoder(ab) {
|
|
|
62542
62545
|
function undefinedEncoder2() {
|
|
62543
62546
|
throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded");
|
|
62544
62547
|
}
|
|
62545
|
-
function numberEncoder2(
|
|
62546
|
-
if (Number.isNaN(
|
|
62548
|
+
function numberEncoder2(num3) {
|
|
62549
|
+
if (Number.isNaN(num3)) {
|
|
62547
62550
|
throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");
|
|
62548
62551
|
}
|
|
62549
|
-
if (
|
|
62552
|
+
if (num3 === Infinity || num3 === -Infinity) {
|
|
62550
62553
|
throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");
|
|
62551
62554
|
}
|
|
62552
62555
|
return null;
|
|
@@ -66039,9 +66042,9 @@ function varintEncoder(buf) {
|
|
|
66039
66042
|
return acc + encodingLength2(curr);
|
|
66040
66043
|
}, 0));
|
|
66041
66044
|
let offset = 0;
|
|
66042
|
-
for (const
|
|
66043
|
-
out = encode7(
|
|
66044
|
-
offset += encodingLength2(
|
|
66045
|
+
for (const num3 of buf) {
|
|
66046
|
+
out = encode7(num3, out, offset);
|
|
66047
|
+
offset += encodingLength2(num3);
|
|
66045
66048
|
}
|
|
66046
66049
|
return out;
|
|
66047
66050
|
}
|
|
@@ -66531,9 +66534,9 @@ function varintDecoder(buf) {
|
|
|
66531
66534
|
}
|
|
66532
66535
|
const result = [];
|
|
66533
66536
|
while (buf.length > 0) {
|
|
66534
|
-
const
|
|
66535
|
-
result.push(
|
|
66536
|
-
buf = buf.slice(encodingLength2(
|
|
66537
|
+
const num3 = decode8(buf);
|
|
66538
|
+
result.push(num3);
|
|
66539
|
+
buf = buf.slice(encodingLength2(num3));
|
|
66537
66540
|
}
|
|
66538
66541
|
return result;
|
|
66539
66542
|
}
|
|
@@ -82543,11 +82546,11 @@ function getOutput(expectedLength, out, onlyAligned = true) {
|
|
|
82543
82546
|
}
|
|
82544
82547
|
function u64Lengths(dataLength, aadLength, isLE2) {
|
|
82545
82548
|
abool2(isLE2);
|
|
82546
|
-
const
|
|
82547
|
-
const view = createView2(
|
|
82549
|
+
const num3 = new Uint8Array(16);
|
|
82550
|
+
const view = createView2(num3);
|
|
82548
82551
|
view.setBigUint64(0, BigInt(aadLength), isLE2);
|
|
82549
82552
|
view.setBigUint64(8, BigInt(dataLength), isLE2);
|
|
82550
|
-
return
|
|
82553
|
+
return num3;
|
|
82551
82554
|
}
|
|
82552
82555
|
function isAligned32(bytes) {
|
|
82553
82556
|
return bytes.byteOffset % 4 === 0;
|
|
@@ -90258,11 +90261,11 @@ var require_ip_converter = __commonJS({
|
|
|
90258
90261
|
throw new Error("Invalid IPv4 address");
|
|
90259
90262
|
}
|
|
90260
90263
|
return parts.map((part) => {
|
|
90261
|
-
const
|
|
90262
|
-
if (isNaN(
|
|
90264
|
+
const num3 = parseInt(part, 10);
|
|
90265
|
+
if (isNaN(num3) || num3 < 0 || num3 > 255) {
|
|
90263
90266
|
throw new Error("Invalid IPv4 address part");
|
|
90264
90267
|
}
|
|
90265
|
-
return
|
|
90268
|
+
return num3;
|
|
90266
90269
|
});
|
|
90267
90270
|
}
|
|
90268
90271
|
static parseIPv6(ip) {
|
|
@@ -90272,12 +90275,12 @@ var require_ip_converter = __commonJS({
|
|
|
90272
90275
|
throw new Error("Invalid IPv6 address");
|
|
90273
90276
|
}
|
|
90274
90277
|
return parts.reduce((bytes, part) => {
|
|
90275
|
-
const
|
|
90276
|
-
if (isNaN(
|
|
90278
|
+
const num3 = parseInt(part, 16);
|
|
90279
|
+
if (isNaN(num3) || num3 < 0 || num3 > 65535) {
|
|
90277
90280
|
throw new Error("Invalid IPv6 address part");
|
|
90278
90281
|
}
|
|
90279
|
-
bytes.push(
|
|
90280
|
-
bytes.push(
|
|
90282
|
+
bytes.push(num3 >> 8 & 255);
|
|
90283
|
+
bytes.push(num3 & 255);
|
|
90281
90284
|
return bytes;
|
|
90282
90285
|
}, []);
|
|
90283
90286
|
}
|
|
@@ -118237,11 +118240,11 @@ var require_util2 = __commonJS({
|
|
|
118237
118240
|
}
|
|
118238
118241
|
var b = util2.createBuffer();
|
|
118239
118242
|
for (var i2 = 0; i2 < ip.length; ++i2) {
|
|
118240
|
-
var
|
|
118241
|
-
if (isNaN(
|
|
118243
|
+
var num3 = parseInt(ip[i2], 10);
|
|
118244
|
+
if (isNaN(num3)) {
|
|
118242
118245
|
return null;
|
|
118243
118246
|
}
|
|
118244
|
-
b.putByte(
|
|
118247
|
+
b.putByte(num3);
|
|
118245
118248
|
}
|
|
118246
118249
|
return b.getBytes();
|
|
118247
118250
|
};
|
|
@@ -119178,8 +119181,8 @@ var require_cipherModes = __commonJS({
|
|
|
119178
119181
|
function inc32(block) {
|
|
119179
119182
|
block[block.length - 1] = block[block.length - 1] + 1 & 4294967295;
|
|
119180
119183
|
}
|
|
119181
|
-
function from64To32(
|
|
119182
|
-
return [
|
|
119184
|
+
function from64To32(num3) {
|
|
119185
|
+
return [num3 / 4294967296 | 0, num3 & 4294967295];
|
|
119183
119186
|
}
|
|
119184
119187
|
}
|
|
119185
119188
|
});
|
|
@@ -123941,9 +123944,9 @@ var require_prime = __commonJS({
|
|
|
123941
123944
|
return primeincFindPrimeWithoutWorkers(bits, rng, options2, callback);
|
|
123942
123945
|
}
|
|
123943
123946
|
function primeincFindPrimeWithoutWorkers(bits, rng, options2, callback) {
|
|
123944
|
-
var
|
|
123947
|
+
var num3 = generateRandom(bits, rng);
|
|
123945
123948
|
var deltaIdx = 0;
|
|
123946
|
-
var mrTests = getMillerRabinTests(
|
|
123949
|
+
var mrTests = getMillerRabinTests(num3.bitLength());
|
|
123947
123950
|
if ("millerRabinTests" in options2) {
|
|
123948
123951
|
mrTests = options2.millerRabinTests;
|
|
123949
123952
|
}
|
|
@@ -123951,28 +123954,28 @@ var require_prime = __commonJS({
|
|
|
123951
123954
|
if ("maxBlockTime" in options2) {
|
|
123952
123955
|
maxBlockTime = options2.maxBlockTime;
|
|
123953
123956
|
}
|
|
123954
|
-
_primeinc(
|
|
123957
|
+
_primeinc(num3, bits, rng, deltaIdx, mrTests, maxBlockTime, callback);
|
|
123955
123958
|
}
|
|
123956
|
-
function _primeinc(
|
|
123959
|
+
function _primeinc(num3, bits, rng, deltaIdx, mrTests, maxBlockTime, callback) {
|
|
123957
123960
|
var start2 = +/* @__PURE__ */ new Date();
|
|
123958
123961
|
do {
|
|
123959
|
-
if (
|
|
123960
|
-
|
|
123962
|
+
if (num3.bitLength() > bits) {
|
|
123963
|
+
num3 = generateRandom(bits, rng);
|
|
123961
123964
|
}
|
|
123962
|
-
if (
|
|
123963
|
-
return callback(null,
|
|
123965
|
+
if (num3.isProbablePrime(mrTests)) {
|
|
123966
|
+
return callback(null, num3);
|
|
123964
123967
|
}
|
|
123965
|
-
|
|
123968
|
+
num3.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0);
|
|
123966
123969
|
} while (maxBlockTime < 0 || +/* @__PURE__ */ new Date() - start2 < maxBlockTime);
|
|
123967
123970
|
forge.util.setImmediate(function() {
|
|
123968
|
-
_primeinc(
|
|
123971
|
+
_primeinc(num3, bits, rng, deltaIdx, mrTests, maxBlockTime, callback);
|
|
123969
123972
|
});
|
|
123970
123973
|
}
|
|
123971
123974
|
function primeincFindPrimeWithWorkers(bits, rng, options2, callback) {
|
|
123972
123975
|
if (typeof Worker === "undefined") {
|
|
123973
123976
|
return primeincFindPrimeWithoutWorkers(bits, rng, options2, callback);
|
|
123974
123977
|
}
|
|
123975
|
-
var
|
|
123978
|
+
var num3 = generateRandom(bits, rng);
|
|
123976
123979
|
var numWorkers = options2.workers;
|
|
123977
123980
|
var workLoad = options2.workLoad || 100;
|
|
123978
123981
|
var range = workLoad * 30 / 8;
|
|
@@ -124011,26 +124014,26 @@ var require_prime = __commonJS({
|
|
|
124011
124014
|
found = true;
|
|
124012
124015
|
return callback(null, new BigInteger(data.prime, 16));
|
|
124013
124016
|
}
|
|
124014
|
-
if (
|
|
124015
|
-
|
|
124017
|
+
if (num3.bitLength() > bits) {
|
|
124018
|
+
num3 = generateRandom(bits, rng);
|
|
124016
124019
|
}
|
|
124017
|
-
var hex =
|
|
124020
|
+
var hex = num3.toString(16);
|
|
124018
124021
|
e2.target.postMessage({
|
|
124019
124022
|
hex,
|
|
124020
124023
|
workLoad
|
|
124021
124024
|
});
|
|
124022
|
-
|
|
124025
|
+
num3.dAddOffset(range, 0);
|
|
124023
124026
|
}
|
|
124024
124027
|
}
|
|
124025
124028
|
}
|
|
124026
124029
|
function generateRandom(bits, rng) {
|
|
124027
|
-
var
|
|
124030
|
+
var num3 = new BigInteger(bits, rng);
|
|
124028
124031
|
var bits1 = bits - 1;
|
|
124029
|
-
if (!
|
|
124030
|
-
|
|
124032
|
+
if (!num3.testBit(bits1)) {
|
|
124033
|
+
num3.bitwiseTo(BigInteger.ONE.shiftLeft(bits1), op_or, num3);
|
|
124031
124034
|
}
|
|
124032
|
-
|
|
124033
|
-
return
|
|
124035
|
+
num3.dAddOffset(31 - num3.mod(THIRTY).byteValue(), 0);
|
|
124036
|
+
return num3;
|
|
124034
124037
|
}
|
|
124035
124038
|
function getMillerRabinTests(bits) {
|
|
124036
124039
|
if (bits <= 100) return 27;
|
|
@@ -125139,11 +125142,11 @@ var require_rsa = __commonJS({
|
|
|
125139
125142
|
}
|
|
125140
125143
|
generate();
|
|
125141
125144
|
function generate() {
|
|
125142
|
-
getPrime(state.pBits, function(err,
|
|
125145
|
+
getPrime(state.pBits, function(err, num3) {
|
|
125143
125146
|
if (err) {
|
|
125144
125147
|
return callback(err);
|
|
125145
125148
|
}
|
|
125146
|
-
state.p =
|
|
125149
|
+
state.p = num3;
|
|
125147
125150
|
if (state.q !== null) {
|
|
125148
125151
|
return finish(err, state.q);
|
|
125149
125152
|
}
|
|
@@ -125153,11 +125156,11 @@ var require_rsa = __commonJS({
|
|
|
125153
125156
|
function getPrime(bits, callback2) {
|
|
125154
125157
|
forge.prime.generateProbablePrime(bits, opts, callback2);
|
|
125155
125158
|
}
|
|
125156
|
-
function finish(err,
|
|
125159
|
+
function finish(err, num3) {
|
|
125157
125160
|
if (err) {
|
|
125158
125161
|
return callback(err);
|
|
125159
125162
|
}
|
|
125160
|
-
state.q =
|
|
125163
|
+
state.q = num3;
|
|
125161
125164
|
if (state.p.compareTo(state.q) < 0) {
|
|
125162
125165
|
var tmp = state.p;
|
|
125163
125166
|
state.p = state.q;
|
|
@@ -132759,31 +132762,31 @@ var require_ed25519 = __commonJS({
|
|
|
132759
132762
|
}
|
|
132760
132763
|
}
|
|
132761
132764
|
function unpackneg(r2, p2) {
|
|
132762
|
-
var t2 = gf(), chk = gf(),
|
|
132765
|
+
var t2 = gf(), chk = gf(), num3 = gf(), den = gf(), den2 = gf(), den4 = gf(), den6 = gf();
|
|
132763
132766
|
set25519(r2[2], gf1);
|
|
132764
132767
|
unpack25519(r2[1], p2);
|
|
132765
|
-
S(
|
|
132766
|
-
M(den,
|
|
132767
|
-
Z(
|
|
132768
|
+
S(num3, r2[1]);
|
|
132769
|
+
M(den, num3, D);
|
|
132770
|
+
Z(num3, num3, r2[2]);
|
|
132768
132771
|
A(den, r2[2], den);
|
|
132769
132772
|
S(den2, den);
|
|
132770
132773
|
S(den4, den2);
|
|
132771
132774
|
M(den6, den4, den2);
|
|
132772
|
-
M(t2, den6,
|
|
132775
|
+
M(t2, den6, num3);
|
|
132773
132776
|
M(t2, t2, den);
|
|
132774
132777
|
pow2523(t2, t2);
|
|
132775
|
-
M(t2, t2,
|
|
132778
|
+
M(t2, t2, num3);
|
|
132776
132779
|
M(t2, t2, den);
|
|
132777
132780
|
M(t2, t2, den);
|
|
132778
132781
|
M(r2[0], t2, den);
|
|
132779
132782
|
S(chk, r2[0]);
|
|
132780
132783
|
M(chk, chk, den);
|
|
132781
|
-
if (neq25519(chk,
|
|
132784
|
+
if (neq25519(chk, num3)) {
|
|
132782
132785
|
M(r2[0], r2[0], I);
|
|
132783
132786
|
}
|
|
132784
132787
|
S(chk, r2[0]);
|
|
132785
132788
|
M(chk, chk, den);
|
|
132786
|
-
if (neq25519(chk,
|
|
132789
|
+
if (neq25519(chk, num3)) {
|
|
132787
132790
|
return -1;
|
|
132788
132791
|
}
|
|
132789
132792
|
if (par25519(r2[0]) === p2[31] >> 7) {
|
|
@@ -134694,8 +134697,8 @@ var require_ssh = __commonJS({
|
|
|
134694
134697
|
}
|
|
134695
134698
|
function _sha1() {
|
|
134696
134699
|
var sha = forge.md.sha1.create();
|
|
134697
|
-
var
|
|
134698
|
-
for (var i2 = 0; i2 <
|
|
134700
|
+
var num3 = arguments.length;
|
|
134701
|
+
for (var i2 = 0; i2 < num3; ++i2) {
|
|
134699
134702
|
sha.update(arguments[i2]);
|
|
134700
134703
|
}
|
|
134701
134704
|
return sha.digest();
|
|
@@ -161421,8 +161424,8 @@ var require_util7 = __commonJS({
|
|
|
161421
161424
|
return false;
|
|
161422
161425
|
}
|
|
161423
161426
|
}
|
|
161424
|
-
const
|
|
161425
|
-
return
|
|
161427
|
+
const num3 = Number.parseInt(value2, 10);
|
|
161428
|
+
return num3 >= 8 && num3 <= 15;
|
|
161426
161429
|
}
|
|
161427
161430
|
function getURLRecord(url, baseURL) {
|
|
161428
161431
|
let urlRecord;
|
|
@@ -250027,7 +250030,7 @@ var require_sax = __commonJS({
|
|
|
250027
250030
|
function parseEntity(parser2) {
|
|
250028
250031
|
var entity = parser2.entity;
|
|
250029
250032
|
var entityLC = entity.toLowerCase();
|
|
250030
|
-
var
|
|
250033
|
+
var num3;
|
|
250031
250034
|
var numStr = "";
|
|
250032
250035
|
if (parser2.ENTITIES[entity]) {
|
|
250033
250036
|
return parser2.ENTITIES[entity];
|
|
@@ -250039,20 +250042,20 @@ var require_sax = __commonJS({
|
|
|
250039
250042
|
if (entity.charAt(0) === "#") {
|
|
250040
250043
|
if (entity.charAt(1) === "x") {
|
|
250041
250044
|
entity = entity.slice(2);
|
|
250042
|
-
|
|
250043
|
-
numStr =
|
|
250045
|
+
num3 = parseInt(entity, 16);
|
|
250046
|
+
numStr = num3.toString(16);
|
|
250044
250047
|
} else {
|
|
250045
250048
|
entity = entity.slice(1);
|
|
250046
|
-
|
|
250047
|
-
numStr =
|
|
250049
|
+
num3 = parseInt(entity, 10);
|
|
250050
|
+
numStr = num3.toString(10);
|
|
250048
250051
|
}
|
|
250049
250052
|
}
|
|
250050
250053
|
entity = entity.replace(/^0+/, "");
|
|
250051
|
-
if (isNaN(
|
|
250054
|
+
if (isNaN(num3) || numStr.toLowerCase() !== entity || num3 < 0 || num3 > 1114111) {
|
|
250052
250055
|
strictFail(parser2, "Invalid character entity");
|
|
250053
250056
|
return "&" + parser2.entity + ";";
|
|
250054
250057
|
}
|
|
250055
|
-
return String.fromCodePoint(
|
|
250058
|
+
return String.fromCodePoint(num3);
|
|
250056
250059
|
}
|
|
250057
250060
|
function beginWhiteSpace(parser2, c9) {
|
|
250058
250061
|
if (c9 === "<") {
|
|
@@ -257507,26 +257510,26 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
257507
257510
|
value2 = value2[0];
|
|
257508
257511
|
if (key === "client_max_window_bits") {
|
|
257509
257512
|
if (value2 !== true) {
|
|
257510
|
-
const
|
|
257511
|
-
if (!Number.isInteger(
|
|
257513
|
+
const num3 = +value2;
|
|
257514
|
+
if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
|
|
257512
257515
|
throw new TypeError(
|
|
257513
257516
|
`Invalid value for parameter "${key}": ${value2}`
|
|
257514
257517
|
);
|
|
257515
257518
|
}
|
|
257516
|
-
value2 =
|
|
257519
|
+
value2 = num3;
|
|
257517
257520
|
} else if (!this._isServer) {
|
|
257518
257521
|
throw new TypeError(
|
|
257519
257522
|
`Invalid value for parameter "${key}": ${value2}`
|
|
257520
257523
|
);
|
|
257521
257524
|
}
|
|
257522
257525
|
} else if (key === "server_max_window_bits") {
|
|
257523
|
-
const
|
|
257524
|
-
if (!Number.isInteger(
|
|
257526
|
+
const num3 = +value2;
|
|
257527
|
+
if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
|
|
257525
257528
|
throw new TypeError(
|
|
257526
257529
|
`Invalid value for parameter "${key}": ${value2}`
|
|
257527
257530
|
);
|
|
257528
257531
|
}
|
|
257529
|
-
value2 =
|
|
257532
|
+
value2 = num3;
|
|
257530
257533
|
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
257531
257534
|
if (value2 !== true) {
|
|
257532
257535
|
throw new TypeError(
|
|
@@ -258221,8 +258224,8 @@ var require_receiver2 = __commonJS({
|
|
|
258221
258224
|
return;
|
|
258222
258225
|
}
|
|
258223
258226
|
const buf = this.consume(8);
|
|
258224
|
-
const
|
|
258225
|
-
if (
|
|
258227
|
+
const num3 = buf.readUInt32BE(0);
|
|
258228
|
+
if (num3 > Math.pow(2, 53 - 32) - 1) {
|
|
258226
258229
|
const error = this.createError(
|
|
258227
258230
|
RangeError,
|
|
258228
258231
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
@@ -258233,7 +258236,7 @@ var require_receiver2 = __commonJS({
|
|
|
258233
258236
|
cb(error);
|
|
258234
258237
|
return;
|
|
258235
258238
|
}
|
|
258236
|
-
this._payloadLength =
|
|
258239
|
+
this._payloadLength = num3 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
258237
258240
|
this.haveLength(cb);
|
|
258238
258241
|
}
|
|
258239
258242
|
/**
|
|
@@ -267334,12 +267337,12 @@ var require_glob_parent = __commonJS({
|
|
|
267334
267337
|
var require_utils3 = __commonJS({
|
|
267335
267338
|
"../node_modules/braces/lib/utils.js"(exports) {
|
|
267336
267339
|
"use strict";
|
|
267337
|
-
exports.isInteger = (
|
|
267338
|
-
if (typeof
|
|
267339
|
-
return Number.isInteger(
|
|
267340
|
+
exports.isInteger = (num3) => {
|
|
267341
|
+
if (typeof num3 === "number") {
|
|
267342
|
+
return Number.isInteger(num3);
|
|
267340
267343
|
}
|
|
267341
|
-
if (typeof
|
|
267342
|
-
return Number.isInteger(Number(
|
|
267344
|
+
if (typeof num3 === "string" && num3.trim() !== "") {
|
|
267345
|
+
return Number.isInteger(Number(num3));
|
|
267343
267346
|
}
|
|
267344
267347
|
return false;
|
|
267345
267348
|
};
|
|
@@ -267447,12 +267450,12 @@ var require_stringify = __commonJS({
|
|
|
267447
267450
|
var require_is_number = __commonJS({
|
|
267448
267451
|
"../node_modules/is-number/index.js"(exports, module) {
|
|
267449
267452
|
"use strict";
|
|
267450
|
-
module.exports = function(
|
|
267451
|
-
if (typeof
|
|
267452
|
-
return
|
|
267453
|
+
module.exports = function(num3) {
|
|
267454
|
+
if (typeof num3 === "number") {
|
|
267455
|
+
return num3 - num3 === 0;
|
|
267453
267456
|
}
|
|
267454
|
-
if (typeof
|
|
267455
|
-
return Number.isFinite ? Number.isFinite(+
|
|
267457
|
+
if (typeof num3 === "string" && num3.trim() !== "") {
|
|
267458
|
+
return Number.isFinite ? Number.isFinite(+num3) : isFinite(+num3);
|
|
267456
267459
|
}
|
|
267457
267460
|
return false;
|
|
267458
267461
|
};
|
|
@@ -267683,7 +267686,7 @@ var require_fill_range = __commonJS({
|
|
|
267683
267686
|
var isValidValue = (value2) => {
|
|
267684
267687
|
return typeof value2 === "number" || typeof value2 === "string" && value2 !== "";
|
|
267685
267688
|
};
|
|
267686
|
-
var isNumber2 = (
|
|
267689
|
+
var isNumber2 = (num3) => Number.isInteger(+num3);
|
|
267687
267690
|
var zeros = (input) => {
|
|
267688
267691
|
let value2 = `${input}`;
|
|
267689
267692
|
let index = -1;
|
|
@@ -267793,7 +267796,7 @@ var require_fill_range = __commonJS({
|
|
|
267793
267796
|
return toRange(toMaxLen(start2, maxLen), toMaxLen(end, maxLen), true, options2);
|
|
267794
267797
|
}
|
|
267795
267798
|
let parts = { negatives: [], positives: [] };
|
|
267796
|
-
let push = (
|
|
267799
|
+
let push = (num3) => parts[num3 < 0 ? "negatives" : "positives"].push(Math.abs(num3));
|
|
267797
267800
|
let range = [];
|
|
267798
267801
|
let index = 0;
|
|
267799
267802
|
while (descending ? a2 >= b : a2 <= b) {
|
|
@@ -269311,9 +269314,9 @@ var require_parse3 = __commonJS({
|
|
|
269311
269314
|
const peek = state.peek = (n2 = 1) => input[state.index + n2];
|
|
269312
269315
|
const advance = state.advance = () => input[++state.index] || "";
|
|
269313
269316
|
const remaining = () => input.slice(state.index + 1);
|
|
269314
|
-
const consume = (value3 = "",
|
|
269317
|
+
const consume = (value3 = "", num3 = 0) => {
|
|
269315
269318
|
state.consumed += value3;
|
|
269316
|
-
state.index +=
|
|
269319
|
+
state.index += num3;
|
|
269317
269320
|
};
|
|
269318
269321
|
const append = (token) => {
|
|
269319
269322
|
state.output += token.output != null ? token.output : token.value;
|
|
@@ -442938,7 +442941,7 @@ ${lanes.join("\n")}
|
|
|
442938
442941
|
function createTabularErrorsDisplay(filesInError, host) {
|
|
442939
442942
|
const distinctFiles = filesInError.filter((value2, index, self2) => index === self2.findIndex((file) => (file == null ? void 0 : file.fileName) === (value2 == null ? void 0 : value2.fileName)));
|
|
442940
442943
|
if (distinctFiles.length === 0) return "";
|
|
442941
|
-
const numberLength = (
|
|
442944
|
+
const numberLength = (num3) => Math.log(num3) * Math.LOG10E + 1;
|
|
442942
442945
|
const fileToErrorCount = distinctFiles.map((file) => [file, countWhere(filesInError, (fileInError) => fileInError.fileName === file.fileName)]);
|
|
442943
442946
|
const maxErrors = maxBy(fileToErrorCount, 0, (value2) => value2[1]);
|
|
442944
442947
|
const headerRow = Diagnostics.Errors_Files.message;
|
|
@@ -514322,9 +514325,9 @@ var require_parse4 = __commonJS({
|
|
|
514322
514325
|
const peek = state.peek = (n2 = 1) => input[state.index + n2];
|
|
514323
514326
|
const advance = state.advance = () => input[++state.index] || "";
|
|
514324
514327
|
const remaining = () => input.slice(state.index + 1);
|
|
514325
|
-
const consume = (value3 = "",
|
|
514328
|
+
const consume = (value3 = "", num3 = 0) => {
|
|
514326
514329
|
state.consumed += value3;
|
|
514327
|
-
state.index +=
|
|
514330
|
+
state.index += num3;
|
|
514328
514331
|
};
|
|
514329
514332
|
const append = (token) => {
|
|
514330
514333
|
state.output += token.output != null ? token.output : token.value;
|
|
@@ -515439,14 +515442,14 @@ var require_dist2 = __commonJS({
|
|
|
515439
515442
|
var Counter = class {
|
|
515440
515443
|
_files = 0;
|
|
515441
515444
|
_directories = 0;
|
|
515442
|
-
set files(
|
|
515443
|
-
this._files =
|
|
515445
|
+
set files(num3) {
|
|
515446
|
+
this._files = num3;
|
|
515444
515447
|
}
|
|
515445
515448
|
get files() {
|
|
515446
515449
|
return this._files;
|
|
515447
515450
|
}
|
|
515448
|
-
set directories(
|
|
515449
|
-
this._directories =
|
|
515451
|
+
set directories(num3) {
|
|
515452
|
+
this._directories = num3;
|
|
515450
515453
|
}
|
|
515451
515454
|
get directories() {
|
|
515452
515455
|
return this._directories;
|
|
@@ -571561,14 +571564,14 @@ function parseExtraction(raw) {
|
|
|
571561
571564
|
} catch {
|
|
571562
571565
|
return null;
|
|
571563
571566
|
}
|
|
571564
|
-
const
|
|
571567
|
+
const num3 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
571565
571568
|
let conf = Number(o2["confidence"]);
|
|
571566
571569
|
if (!Number.isFinite(conf))
|
|
571567
571570
|
conf = 0.5;
|
|
571568
571571
|
return {
|
|
571569
571572
|
claim: String(o2["claim"] ?? "").slice(0, 800),
|
|
571570
|
-
sourceStart:
|
|
571571
|
-
sourceEnd:
|
|
571573
|
+
sourceStart: num3(o2["source_start"]),
|
|
571574
|
+
sourceEnd: num3(o2["source_end"]),
|
|
571572
571575
|
confidence: Math.min(1, Math.max(0, conf)),
|
|
571573
571576
|
found: o2["found"] !== false
|
|
571574
571577
|
};
|
|
@@ -594794,9 +594797,9 @@ function parseScalar(value2) {
|
|
|
594794
594797
|
return true;
|
|
594795
594798
|
if (value2 === "false")
|
|
594796
594799
|
return false;
|
|
594797
|
-
const
|
|
594798
|
-
if (Number.isFinite(
|
|
594799
|
-
return
|
|
594800
|
+
const num3 = Number(value2);
|
|
594801
|
+
if (Number.isFinite(num3))
|
|
594802
|
+
return num3;
|
|
594800
594803
|
return value2.replace(/^["']|["']$/g, "");
|
|
594801
594804
|
}
|
|
594802
594805
|
function objectAt(value2, key) {
|
|
@@ -594822,9 +594825,9 @@ function memoryKindNumbers(value2) {
|
|
|
594822
594825
|
if (!value2 || typeof value2 !== "object" || Array.isArray(value2))
|
|
594823
594826
|
return out;
|
|
594824
594827
|
for (const kind of ["chat", "facts", "axioms", "reference", "episodic", "card"]) {
|
|
594825
|
-
const
|
|
594826
|
-
if (typeof
|
|
594827
|
-
out[kind] =
|
|
594828
|
+
const num3 = value2[kind];
|
|
594829
|
+
if (typeof num3 === "number" && Number.isFinite(num3))
|
|
594830
|
+
out[kind] = num3;
|
|
594828
594831
|
}
|
|
594829
594832
|
return out;
|
|
594830
594833
|
}
|
|
@@ -599443,6 +599446,11 @@ var init_spinner = __esm({
|
|
|
599443
599446
|
});
|
|
599444
599447
|
|
|
599445
599448
|
// packages/cli/src/tui/memory-maintenance.ts
|
|
599449
|
+
var memory_maintenance_exports = {};
|
|
599450
|
+
__export(memory_maintenance_exports, {
|
|
599451
|
+
runPruneWorkerOnce: () => runPruneWorkerOnce,
|
|
599452
|
+
startIdleMemoryMaintenance: () => startIdleMemoryMaintenance
|
|
599453
|
+
});
|
|
599446
599454
|
import { spawn as spawn27 } from "node:child_process";
|
|
599447
599455
|
import { createWriteStream, existsSync as existsSync106, mkdirSync as mkdirSync64, readFileSync as readFileSync85, statSync as statSync42, writeFileSync as writeFileSync54 } from "node:fs";
|
|
599448
599456
|
import { fileURLToPath as fileURLToPath15 } from "node:url";
|
|
@@ -599464,6 +599472,26 @@ function startIdleMemoryMaintenance(options2) {
|
|
|
599464
599472
|
6e4,
|
|
599465
599473
|
Number(process.env["OMNIUS_MEMORY_MAINTENANCE_INTERVAL_MS"] ?? 30 * 6e4)
|
|
599466
599474
|
);
|
|
599475
|
+
const afterTaskIntervalMs = Math.max(
|
|
599476
|
+
3e4,
|
|
599477
|
+
Number(
|
|
599478
|
+
process.env["OMNIUS_KG_PRUNE_AFTER_TASK_INTERVAL_MS"] ?? 3 * 6e4
|
|
599479
|
+
)
|
|
599480
|
+
);
|
|
599481
|
+
const launchWorker = (now2) => {
|
|
599482
|
+
worker2 = spawnWorker(options2);
|
|
599483
|
+
if (!worker2) {
|
|
599484
|
+
lastRunAt = now2;
|
|
599485
|
+
return;
|
|
599486
|
+
}
|
|
599487
|
+
worker2.once("exit", () => {
|
|
599488
|
+
worker2 = null;
|
|
599489
|
+
lastRunAt = Date.now();
|
|
599490
|
+
writeLastRunAt(options2.repoRoot, lastRunAt);
|
|
599491
|
+
const latest = readLatestSummary(options2.repoRoot);
|
|
599492
|
+
if (latest) options2.onSummary?.(latest);
|
|
599493
|
+
});
|
|
599494
|
+
};
|
|
599467
599495
|
const stopWorker = () => {
|
|
599468
599496
|
const current = worker2;
|
|
599469
599497
|
if (!current) return;
|
|
@@ -599487,18 +599515,7 @@ function startIdleMemoryMaintenance(options2) {
|
|
|
599487
599515
|
const now2 = Date.now();
|
|
599488
599516
|
if (now2 - lastActivity < idleMs) return;
|
|
599489
599517
|
if (now2 - lastRunAt < minIntervalMs) return;
|
|
599490
|
-
|
|
599491
|
-
if (!worker2) {
|
|
599492
|
-
lastRunAt = now2;
|
|
599493
|
-
return;
|
|
599494
|
-
}
|
|
599495
|
-
worker2.once("exit", () => {
|
|
599496
|
-
worker2 = null;
|
|
599497
|
-
lastRunAt = Date.now();
|
|
599498
|
-
writeLastRunAt(options2.repoRoot, lastRunAt);
|
|
599499
|
-
const latest = readLatestSummary(options2.repoRoot);
|
|
599500
|
-
if (latest) options2.onSummary?.(latest);
|
|
599501
|
-
});
|
|
599518
|
+
launchWorker(now2);
|
|
599502
599519
|
};
|
|
599503
599520
|
const timer = setInterval(maybeStart, pollMs);
|
|
599504
599521
|
timer.unref?.();
|
|
@@ -599507,6 +599524,13 @@ function startIdleMemoryMaintenance(options2) {
|
|
|
599507
599524
|
lastActivity = Date.now();
|
|
599508
599525
|
if (options2.isBusy()) stopWorker();
|
|
599509
599526
|
},
|
|
599527
|
+
triggerAfterTask() {
|
|
599528
|
+
if (disabled || worker2) return;
|
|
599529
|
+
if (options2.isBusy()) return;
|
|
599530
|
+
const now2 = Date.now();
|
|
599531
|
+
if (now2 - lastRunAt < afterTaskIntervalMs) return;
|
|
599532
|
+
launchWorker(now2);
|
|
599533
|
+
},
|
|
599510
599534
|
stop() {
|
|
599511
599535
|
clearInterval(timer);
|
|
599512
599536
|
stopWorker();
|
|
@@ -599548,6 +599572,98 @@ function spawnWorker(options2) {
|
|
|
599548
599572
|
child.unref?.();
|
|
599549
599573
|
return child;
|
|
599550
599574
|
}
|
|
599575
|
+
function runPruneWorkerOnce(opts) {
|
|
599576
|
+
const stateDir = join120(opts.repoRoot, ".omnius");
|
|
599577
|
+
try {
|
|
599578
|
+
mkdirSync64(join120(stateDir, "memory-maintenance"), { recursive: true });
|
|
599579
|
+
} catch {
|
|
599580
|
+
}
|
|
599581
|
+
const workerPath = fileURLToPath15(
|
|
599582
|
+
new URL("./memory-maintenance-worker.js", import.meta.url)
|
|
599583
|
+
);
|
|
599584
|
+
const env2 = {
|
|
599585
|
+
...process.env,
|
|
599586
|
+
OMNIUS_MEMORY_MAINTENANCE_STATE_DIR: stateDir,
|
|
599587
|
+
OMNIUS_MEMORY_MAINTENANCE_DRY_RUN: opts.dryRun ? "1" : "0",
|
|
599588
|
+
OMNIUS_MEMORY_MAINTENANCE_MAX_GRAPH_DELETES: String(
|
|
599589
|
+
opts.aggressive ? 2e5 : 5e3
|
|
599590
|
+
),
|
|
599591
|
+
OMNIUS_MEMORY_MAINTENANCE_MAX_MS: String(
|
|
599592
|
+
opts.aggressive ? 30 * 6e4 : 10 * 6e4
|
|
599593
|
+
),
|
|
599594
|
+
OMNIUS_KG_PRUNE_INFERENCE: opts.inference ? "1" : "0"
|
|
599595
|
+
};
|
|
599596
|
+
if (opts.targetNodes != null)
|
|
599597
|
+
env2["OMNIUS_KG_TARGET_NODES"] = String(opts.targetNodes);
|
|
599598
|
+
if (opts.model) env2["OMNIUS_KG_PRUNE_MODEL"] = opts.model;
|
|
599599
|
+
if (opts.backendUrl) env2["OMNIUS_KG_PRUNE_BACKEND_URL"] = opts.backendUrl;
|
|
599600
|
+
let stdoutBuf = "";
|
|
599601
|
+
let stderrBuf = "";
|
|
599602
|
+
let child;
|
|
599603
|
+
try {
|
|
599604
|
+
child = spawn27(process.execPath, [workerPath], {
|
|
599605
|
+
cwd: opts.repoRoot,
|
|
599606
|
+
env: env2,
|
|
599607
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
599608
|
+
});
|
|
599609
|
+
} catch (e2) {
|
|
599610
|
+
opts.onError?.(e2 instanceof Error ? e2.message : String(e2));
|
|
599611
|
+
return;
|
|
599612
|
+
}
|
|
599613
|
+
child.stdout?.on("data", (d2) => {
|
|
599614
|
+
stdoutBuf += d2.toString();
|
|
599615
|
+
});
|
|
599616
|
+
child.stderr?.on("data", (d2) => {
|
|
599617
|
+
stderrBuf += d2.toString();
|
|
599618
|
+
});
|
|
599619
|
+
child.once("exit", (code8) => {
|
|
599620
|
+
const line = stdoutBuf.trim().split(/\r?\n/).filter(Boolean).pop() ?? "";
|
|
599621
|
+
if (line) {
|
|
599622
|
+
try {
|
|
599623
|
+
opts.onDone(formatPruneResult(JSON.parse(line)));
|
|
599624
|
+
return;
|
|
599625
|
+
} catch {
|
|
599626
|
+
}
|
|
599627
|
+
}
|
|
599628
|
+
opts.onError?.(
|
|
599629
|
+
stderrBuf.trim() || `prune worker exited with code ${code8 ?? "?"}`
|
|
599630
|
+
);
|
|
599631
|
+
});
|
|
599632
|
+
child.unref?.();
|
|
599633
|
+
}
|
|
599634
|
+
function fmtBytes(bytes) {
|
|
599635
|
+
if (!Number.isFinite(bytes) || bytes < 1024) return `${Math.max(0, bytes | 0)} B`;
|
|
599636
|
+
const units = ["KB", "MB", "GB", "TB"];
|
|
599637
|
+
let value2 = bytes / 1024;
|
|
599638
|
+
let idx = 0;
|
|
599639
|
+
while (value2 >= 1024 && idx < units.length - 1) {
|
|
599640
|
+
value2 /= 1024;
|
|
599641
|
+
idx++;
|
|
599642
|
+
}
|
|
599643
|
+
return `${value2.toFixed(value2 >= 10 ? 1 : 2)} ${units[idx]}`;
|
|
599644
|
+
}
|
|
599645
|
+
function num2(n2) {
|
|
599646
|
+
return typeof n2 === "number" && Number.isFinite(n2) ? n2 : 0;
|
|
599647
|
+
}
|
|
599648
|
+
function formatPruneResult(r2) {
|
|
599649
|
+
const g = r2?.graph ?? {};
|
|
599650
|
+
const kb = r2?.stores?.knowledge ?? {};
|
|
599651
|
+
const before = num2(kb.sizeBeforeBytes);
|
|
599652
|
+
const after = num2(kb.sizeAfterBytes);
|
|
599653
|
+
const reclaimed = Math.max(0, before - after);
|
|
599654
|
+
const inf = r2?.inference;
|
|
599655
|
+
const merged = num2(g.nodesMerged) + num2(g.edgesDeduped) + num2(g.inactiveEdgesDeleted) + num2(g.orphanNodesDeleted);
|
|
599656
|
+
return [
|
|
599657
|
+
r2?.dryRun ? "── Prune (dry run) ──" : "── Prune complete ──",
|
|
599658
|
+
` Nodes: ${num2(g.nodesTotalBefore).toLocaleString()} → ${num2(g.nodesTotalAfter).toLocaleString()}`,
|
|
599659
|
+
` Low-signal evicted: ${num2(g.lowSignalNodesPruned).toLocaleString()} nodes · archived ${num2(g.nodesArchived).toLocaleString()}`,
|
|
599660
|
+
` Merged/deduped/orphan: ${merged.toLocaleString()}`,
|
|
599661
|
+
inf ? ` Inference: kept ${num2(inf.protectedSignal)} as signal (reinforced ${num2(inf.reinforced)})` : "",
|
|
599662
|
+
` knowledge.db: ${fmtBytes(before)} → ${fmtBytes(after)} (reclaimed ${fmtBytes(reclaimed)})`,
|
|
599663
|
+
r2?.stoppedEarly ? " Note: hit the time budget — run /prune again to continue." : "",
|
|
599664
|
+
` Duration: ${(num2(r2?.durationMs) / 1e3).toFixed(1)}s`
|
|
599665
|
+
].filter(Boolean).join("\n");
|
|
599666
|
+
}
|
|
599551
599667
|
function readLastRunAt(repoRoot) {
|
|
599552
599668
|
try {
|
|
599553
599669
|
const p2 = join120(repoRoot, ".omnius", "memory-maintenance", "last-run");
|
|
@@ -601571,26 +601687,26 @@ var require_permessage_deflate3 = __commonJS({
|
|
|
601571
601687
|
value2 = value2[0];
|
|
601572
601688
|
if (key === "client_max_window_bits") {
|
|
601573
601689
|
if (value2 !== true) {
|
|
601574
|
-
const
|
|
601575
|
-
if (!Number.isInteger(
|
|
601690
|
+
const num3 = +value2;
|
|
601691
|
+
if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
|
|
601576
601692
|
throw new TypeError(
|
|
601577
601693
|
`Invalid value for parameter "${key}": ${value2}`
|
|
601578
601694
|
);
|
|
601579
601695
|
}
|
|
601580
|
-
value2 =
|
|
601696
|
+
value2 = num3;
|
|
601581
601697
|
} else if (!this._isServer) {
|
|
601582
601698
|
throw new TypeError(
|
|
601583
601699
|
`Invalid value for parameter "${key}": ${value2}`
|
|
601584
601700
|
);
|
|
601585
601701
|
}
|
|
601586
601702
|
} else if (key === "server_max_window_bits") {
|
|
601587
|
-
const
|
|
601588
|
-
if (!Number.isInteger(
|
|
601703
|
+
const num3 = +value2;
|
|
601704
|
+
if (!Number.isInteger(num3) || num3 < 8 || num3 > 15) {
|
|
601589
601705
|
throw new TypeError(
|
|
601590
601706
|
`Invalid value for parameter "${key}": ${value2}`
|
|
601591
601707
|
);
|
|
601592
601708
|
}
|
|
601593
|
-
value2 =
|
|
601709
|
+
value2 = num3;
|
|
601594
601710
|
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
601595
601711
|
if (value2 !== true) {
|
|
601596
601712
|
throw new TypeError(
|
|
@@ -602285,8 +602401,8 @@ var require_receiver3 = __commonJS({
|
|
|
602285
602401
|
return;
|
|
602286
602402
|
}
|
|
602287
602403
|
const buf = this.consume(8);
|
|
602288
|
-
const
|
|
602289
|
-
if (
|
|
602404
|
+
const num3 = buf.readUInt32BE(0);
|
|
602405
|
+
if (num3 > Math.pow(2, 53 - 32) - 1) {
|
|
602290
602406
|
const error = this.createError(
|
|
602291
602407
|
RangeError,
|
|
602292
602408
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
@@ -602297,7 +602413,7 @@ var require_receiver3 = __commonJS({
|
|
|
602297
602413
|
cb(error);
|
|
602298
602414
|
return;
|
|
602299
602415
|
}
|
|
602300
|
-
this._payloadLength =
|
|
602416
|
+
this._payloadLength = num3 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
602301
602417
|
this.haveLength(cb);
|
|
602302
602418
|
}
|
|
602303
602419
|
/**
|
|
@@ -605956,7 +606072,7 @@ var init_command_registry = __esm({
|
|
|
605956
606072
|
],
|
|
605957
606073
|
[
|
|
605958
606074
|
"/prune [now|dry|infer|aggressive|stats] [--target <n>]",
|
|
605959
|
-
"Shrink knowledge.db: evict low-signal graph nodes (archived), then VACUUM. 'infer' = model-guided sleep consolidation. No arg
|
|
606075
|
+
"Shrink knowledge.db in the background: evict low-signal graph nodes (archived), then VACUUM. 'infer' = model-guided sleep consolidation. No arg shows stats + usage"
|
|
605960
606076
|
],
|
|
605961
606077
|
["/verbose", "Toggle verbose mode"],
|
|
605962
606078
|
["/clear", "Clear the screen"],
|
|
@@ -606110,7 +606226,6 @@ var init_command_registry = __esm({
|
|
|
606110
606226
|
stats: ["dashboard"],
|
|
606111
606227
|
memory: ["mem"],
|
|
606112
606228
|
metabolize: ["metab"],
|
|
606113
|
-
prune: ["gc"],
|
|
606114
606229
|
files: ["workspace"],
|
|
606115
606230
|
skills: ["skill"],
|
|
606116
606231
|
commands: ["cmds"],
|
|
@@ -609613,7 +609728,7 @@ function renderInfo(message2) {
|
|
|
609613
609728
|
breakTelegramCoalesce();
|
|
609614
609729
|
const redir = _contentWriteHook?.redirect?.();
|
|
609615
609730
|
const dim = dimFg();
|
|
609616
|
-
const icon = `${dim}
|
|
609731
|
+
const icon = `${dim}·\x1B[0m`;
|
|
609617
609732
|
const prefix = `${icon} ${dim}`;
|
|
609618
609733
|
const lines = wrapLinesWithPrefix(message2, prefix, getTermWidth());
|
|
609619
609734
|
const text2 = `${lines.map((l2) => l2 + "\x1B[0m").join("\n")}
|
|
@@ -623767,6 +623882,10 @@ ${CONTENT_BG_SEQ}`);
|
|
|
623767
623882
|
return;
|
|
623768
623883
|
const rows = termRows();
|
|
623769
623884
|
const w = getTermWidth();
|
|
623885
|
+
if (this.writeDepth === 0 && this.footerHeightChanged(w)) {
|
|
623886
|
+
this.renderFooterAndPositionInput(force);
|
|
623887
|
+
return;
|
|
623888
|
+
}
|
|
623770
623889
|
const oldFooterHeight = this._currentFooterHeight;
|
|
623771
623890
|
const oldFooterTop = Math.max(1, rows - oldFooterHeight + 1);
|
|
623772
623891
|
const heightChanged = this.updateFooterHeight(w);
|
|
@@ -624279,9 +624398,9 @@ function renderNonInteractiveSelect(opts, currentTitle, skipSet) {
|
|
|
624279
624398
|
idx++;
|
|
624280
624399
|
continue;
|
|
624281
624400
|
}
|
|
624282
|
-
const
|
|
624401
|
+
const num3 = String(idx).padStart(2, " ");
|
|
624283
624402
|
const detail = detailPlain ? ` - ${detailPlain}` : "";
|
|
624284
|
-
lines.push(` ${
|
|
624403
|
+
lines.push(` ${num3}. ${labelPlain}${detail}`);
|
|
624285
624404
|
shown++;
|
|
624286
624405
|
idx++;
|
|
624287
624406
|
}
|
|
@@ -633881,7 +634000,8 @@ function knowledgeGraphStats(workingDir) {
|
|
|
633881
634000
|
} catch {
|
|
633882
634001
|
}
|
|
633883
634002
|
}
|
|
633884
|
-
|
|
634003
|
+
const COUNT_SIZE_LIMIT = 500 * 1024 * 1024;
|
|
634004
|
+
if (stats.exists && stats.sizeBytes <= COUNT_SIZE_LIMIT) {
|
|
633885
634005
|
try {
|
|
633886
634006
|
const kg = new TemporalGraph(dbPath);
|
|
633887
634007
|
try {
|
|
@@ -633893,6 +634013,10 @@ function knowledgeGraphStats(workingDir) {
|
|
|
633893
634013
|
}
|
|
633894
634014
|
} catch {
|
|
633895
634015
|
}
|
|
634016
|
+
} else if (stats.exists) {
|
|
634017
|
+
stats.nodes = -1;
|
|
634018
|
+
stats.edges = -1;
|
|
634019
|
+
stats.activeEdges = -1;
|
|
633896
634020
|
}
|
|
633897
634021
|
return stats;
|
|
633898
634022
|
}
|
|
@@ -633989,7 +634113,8 @@ function formatBytes10(bytes) {
|
|
|
633989
634113
|
function formatKgStatsLine(stats) {
|
|
633990
634114
|
if (!stats.exists) return "knowledge.db not present";
|
|
633991
634115
|
const archive = stats.archiveSizeBytes > 0 ? ` · archive ${formatBytes10(stats.archiveSizeBytes)}` : "";
|
|
633992
|
-
|
|
634116
|
+
const counts = stats.nodes < 0 ? "counts skipped (large DB)" : `${stats.nodes.toLocaleString()} nodes · ${stats.activeEdges.toLocaleString()}/${stats.edges.toLocaleString()} edges`;
|
|
634117
|
+
return `${counts} · ${formatBytes10(stats.sizeBytes)}${archive}`;
|
|
633993
634118
|
}
|
|
633994
634119
|
var DEFAULT_KG_TARGET_NODES;
|
|
633995
634120
|
var init_kg_prune = __esm({
|
|
@@ -634009,7 +634134,7 @@ __export(prune_menu_exports, {
|
|
|
634009
634134
|
showPruneMenu: () => showPruneMenu
|
|
634010
634135
|
});
|
|
634011
634136
|
async function showPruneMenu(options2) {
|
|
634012
|
-
const { rl, workingDir, availableRows
|
|
634137
|
+
const { rl, workingDir, availableRows } = options2;
|
|
634013
634138
|
const stats = knowledgeGraphStats(workingDir);
|
|
634014
634139
|
if (!stats.exists) {
|
|
634015
634140
|
renderWarning(
|
|
@@ -634017,89 +634142,66 @@ async function showPruneMenu(options2) {
|
|
|
634017
634142
|
);
|
|
634018
634143
|
return;
|
|
634019
634144
|
}
|
|
634020
|
-
const overTarget = stats.nodes > DEFAULT_KG_TARGET_NODES;
|
|
634021
634145
|
const items = [
|
|
634022
634146
|
{
|
|
634023
|
-
key: "
|
|
634024
|
-
label: import_chalk2.default.magenta("Prune to target")
|
|
634025
|
-
detail:
|
|
634147
|
+
key: "now",
|
|
634148
|
+
label: import_chalk2.default.magenta("Prune to target"),
|
|
634149
|
+
detail: `evict low-signal nodes → ${DEFAULT_KG_TARGET_NODES.toLocaleString()} (background)`
|
|
634026
634150
|
},
|
|
634027
634151
|
{
|
|
634028
634152
|
key: "dry",
|
|
634029
634153
|
label: import_chalk2.default.cyan("Preview (dry run)"),
|
|
634030
|
-
detail: "
|
|
634031
|
-
},
|
|
634032
|
-
{
|
|
634033
|
-
key: "aggressive",
|
|
634034
|
-
label: import_chalk2.default.yellow("Aggressive full prune"),
|
|
634035
|
-
detail: "Larger delete budget + longer time budget — for a first cleanup of a large DB."
|
|
634154
|
+
detail: "show what would be pruned — deletes nothing"
|
|
634036
634155
|
},
|
|
634037
634156
|
...options2.model ? [
|
|
634038
634157
|
{
|
|
634039
634158
|
key: "infer",
|
|
634040
634159
|
label: import_chalk2.default.blueBright("Sleep consolidation (inference)"),
|
|
634041
|
-
detail: "
|
|
634160
|
+
detail: "model decides signal vs noise, reinforce keeps, prune rest"
|
|
634042
634161
|
}
|
|
634043
634162
|
] : [],
|
|
634044
|
-
{ key: "sep1", label: import_chalk2.default.gray("─".repeat(34)) },
|
|
634045
634163
|
{
|
|
634046
|
-
key: "
|
|
634047
|
-
label: import_chalk2.default.
|
|
634048
|
-
detail:
|
|
634164
|
+
key: "aggressive",
|
|
634165
|
+
label: import_chalk2.default.yellow("Aggressive full prune"),
|
|
634166
|
+
detail: "large one-shot cleanup for a big DB (background)"
|
|
634049
634167
|
},
|
|
634050
|
-
{ key: "
|
|
634168
|
+
{ key: "sep", label: import_chalk2.default.gray("─".repeat(34)) },
|
|
634051
634169
|
{ key: "back", label: import_chalk2.default.red("← Back") }
|
|
634052
634170
|
];
|
|
634053
|
-
renderInfo(
|
|
634054
|
-
`Knowledge Graph — ${formatKgStatsLine(stats)}${overTarget ? import_chalk2.default.yellow(" (over target)") : ""}`
|
|
634055
|
-
);
|
|
634056
634171
|
const result = await tuiSelect({
|
|
634057
634172
|
items,
|
|
634173
|
+
title: `Prune knowledge graph — ${formatKgStatsLine(stats)}`,
|
|
634058
634174
|
rl,
|
|
634059
|
-
skipKeys: ["
|
|
634175
|
+
skipKeys: ["sep"],
|
|
634060
634176
|
availableRows
|
|
634061
634177
|
});
|
|
634062
|
-
if (!result.confirmed || result.key === "back") return;
|
|
634178
|
+
if (!result.confirmed || !result.key || result.key === "back") return;
|
|
634179
|
+
const start2 = (label, o2) => {
|
|
634180
|
+
renderInfo(`${label} (running in background — summary will follow)…`);
|
|
634181
|
+
runPruneWorkerOnce({
|
|
634182
|
+
repoRoot: workingDir,
|
|
634183
|
+
dryRun: o2.dryRun,
|
|
634184
|
+
aggressive: o2.aggressive,
|
|
634185
|
+
inference: o2.inference,
|
|
634186
|
+
model: o2.inference ? options2.model : void 0,
|
|
634187
|
+
backendUrl: o2.inference ? options2.backendUrl : void 0,
|
|
634188
|
+
onDone: (summary) => renderInfo(summary),
|
|
634189
|
+
onError: (msg) => renderInfo(`Prune failed: ${msg}`)
|
|
634190
|
+
});
|
|
634191
|
+
};
|
|
634063
634192
|
switch (result.key) {
|
|
634064
|
-
case "
|
|
634065
|
-
|
|
634066
|
-
renderInfo(report2);
|
|
634193
|
+
case "now":
|
|
634194
|
+
start2("Pruning knowledge graph", {});
|
|
634067
634195
|
break;
|
|
634068
|
-
|
|
634069
|
-
|
|
634070
|
-
renderInfo("Pruning knowledge graph…");
|
|
634071
|
-
const { report: report2 } = pruneKnowledgeGraph({ workingDir });
|
|
634072
|
-
renderInfo(report2);
|
|
634196
|
+
case "dry":
|
|
634197
|
+
start2("Prune preview", { dryRun: true });
|
|
634073
634198
|
break;
|
|
634074
|
-
|
|
634075
|
-
|
|
634076
|
-
renderInfo("Aggressive prune — this may take a while on a large DB…");
|
|
634077
|
-
const { report: report2 } = pruneKnowledgeGraph({
|
|
634078
|
-
workingDir,
|
|
634079
|
-
maxDeletes: 2e5,
|
|
634080
|
-
maxRuntimeMs: 30 * 6e4
|
|
634081
|
-
});
|
|
634082
|
-
renderInfo(report2);
|
|
634199
|
+
case "infer":
|
|
634200
|
+
start2("Sleep consolidation", { inference: true });
|
|
634083
634201
|
break;
|
|
634084
|
-
|
|
634085
|
-
|
|
634086
|
-
if (!options2.model) break;
|
|
634087
|
-
renderInfo(
|
|
634088
|
-
"Sleep consolidation — reviewing low-signal nodes with the model…"
|
|
634089
|
-
);
|
|
634090
|
-
const { report: report2 } = await pruneKnowledgeGraphWithInference({
|
|
634091
|
-
workingDir,
|
|
634092
|
-
model: options2.model,
|
|
634093
|
-
backendUrl: options2.backendUrl ?? "http://127.0.0.1:11434"
|
|
634094
|
-
});
|
|
634095
|
-
renderInfo(report2);
|
|
634202
|
+
case "aggressive":
|
|
634203
|
+
start2("Aggressive prune", { aggressive: true });
|
|
634096
634204
|
break;
|
|
634097
|
-
}
|
|
634098
|
-
case "stats": {
|
|
634099
|
-
renderInfo(formatKgStatsLine(knowledgeGraphStats(workingDir)));
|
|
634100
|
-
await showPruneMenu(options2);
|
|
634101
|
-
return;
|
|
634102
|
-
}
|
|
634103
634205
|
}
|
|
634104
634206
|
}
|
|
634105
634207
|
var import_chalk2;
|
|
@@ -634109,6 +634211,7 @@ var init_prune_menu = __esm({
|
|
|
634109
634211
|
init_tui_select();
|
|
634110
634212
|
init_render();
|
|
634111
634213
|
init_kg_prune();
|
|
634214
|
+
init_memory_maintenance();
|
|
634112
634215
|
import_chalk2 = __toESM(require_source(), 1);
|
|
634113
634216
|
}
|
|
634114
634217
|
});
|
|
@@ -641654,7 +641757,7 @@ function parseTelegramMessageIdList(value2) {
|
|
|
641654
641757
|
if (!value2) return [];
|
|
641655
641758
|
return [
|
|
641656
641759
|
...new Set(
|
|
641657
|
-
value2.split(",").map((part) => Number(part.trim())).filter((
|
|
641760
|
+
value2.split(",").map((part) => Number(part.trim())).filter((num3) => Number.isFinite(num3))
|
|
641658
641761
|
)
|
|
641659
641762
|
];
|
|
641660
641763
|
}
|
|
@@ -643477,63 +643580,60 @@ async function handleSlashCommand(input, ctx3) {
|
|
|
643477
643580
|
renderInfo(result);
|
|
643478
643581
|
return "handled";
|
|
643479
643582
|
}
|
|
643480
|
-
case "prune":
|
|
643481
|
-
case "gc": {
|
|
643583
|
+
case "prune": {
|
|
643482
643584
|
const sub2 = (arg?.trim().split(/\s+/)[0] ?? "").toLowerCase();
|
|
643483
643585
|
const workingDir = ctx3.repoRoot || process.cwd();
|
|
643484
643586
|
const targetMatch = arg?.match(/--target\s+(\d+)/);
|
|
643485
643587
|
const targetNodes = targetMatch ? parseInt(targetMatch[1], 10) : void 0;
|
|
643486
|
-
const {
|
|
643487
|
-
|
|
643488
|
-
|
|
643489
|
-
|
|
643490
|
-
}
|
|
643588
|
+
const { knowledgeGraphStats: knowledgeGraphStats2, formatKgStatsLine: formatKgStatsLine2 } = await Promise.resolve().then(() => (init_kg_prune(), kg_prune_exports));
|
|
643589
|
+
const { runPruneWorkerOnce: runPruneWorkerOnce2 } = await Promise.resolve().then(() => (init_memory_maintenance(), memory_maintenance_exports));
|
|
643590
|
+
const report2 = (summary) => {
|
|
643591
|
+
renderInfo(summary);
|
|
643592
|
+
};
|
|
643593
|
+
const startBackground = (label, o2) => {
|
|
643594
|
+
renderInfo(`${label} (running in background — summary will follow)…`);
|
|
643595
|
+
runPruneWorkerOnce2({
|
|
643596
|
+
repoRoot: workingDir,
|
|
643597
|
+
targetNodes,
|
|
643598
|
+
dryRun: o2.dryRun,
|
|
643599
|
+
aggressive: o2.aggressive,
|
|
643600
|
+
inference: o2.inference,
|
|
643601
|
+
model: o2.inference ? ctx3.config.model : void 0,
|
|
643602
|
+
backendUrl: o2.inference ? ctx3.config.backendUrl : void 0,
|
|
643603
|
+
onDone: (summary) => report2(summary),
|
|
643604
|
+
onError: (msg) => report2(`Prune failed: ${msg}`)
|
|
643605
|
+
});
|
|
643606
|
+
};
|
|
643491
643607
|
if (!sub2 || sub2 === "menu") {
|
|
643492
643608
|
const { showPruneMenu: showPruneMenu2 } = await Promise.resolve().then(() => (init_prune_menu(), prune_menu_exports));
|
|
643493
643609
|
await showPruneMenu2({
|
|
643494
643610
|
rl: ctx3.rl,
|
|
643495
643611
|
workingDir,
|
|
643612
|
+
availableRows: ctx3.availableContentRows?.(),
|
|
643496
643613
|
model: ctx3.config.model,
|
|
643497
643614
|
backendUrl: ctx3.config.backendUrl
|
|
643498
643615
|
});
|
|
643499
643616
|
return "handled";
|
|
643500
643617
|
}
|
|
643501
643618
|
if (sub2 === "stats") {
|
|
643502
|
-
renderInfo(
|
|
643619
|
+
renderInfo(
|
|
643620
|
+
`Knowledge graph — ${formatKgStatsLine2(knowledgeGraphStats2(workingDir))}`
|
|
643621
|
+
);
|
|
643503
643622
|
return "handled";
|
|
643504
643623
|
}
|
|
643505
643624
|
if (sub2 === "dry" || sub2 === "dry-run" || sub2 === "preview") {
|
|
643506
|
-
|
|
643507
|
-
pruneKnowledgeGraph2({ workingDir, dryRun: true, targetNodes }).report
|
|
643508
|
-
);
|
|
643625
|
+
startBackground("Prune preview", { dryRun: true });
|
|
643509
643626
|
return "handled";
|
|
643510
643627
|
}
|
|
643511
643628
|
if (sub2 === "aggressive" || sub2 === "full") {
|
|
643512
|
-
|
|
643513
|
-
renderInfo(
|
|
643514
|
-
pruneKnowledgeGraph2({
|
|
643515
|
-
workingDir,
|
|
643516
|
-
targetNodes,
|
|
643517
|
-
maxDeletes: 2e5,
|
|
643518
|
-
maxRuntimeMs: 30 * 6e4
|
|
643519
|
-
}).report
|
|
643520
|
-
);
|
|
643629
|
+
startBackground("Aggressive prune", { aggressive: true });
|
|
643521
643630
|
return "handled";
|
|
643522
643631
|
}
|
|
643523
643632
|
if (sub2 === "infer" || sub2 === "inference" || sub2 === "sleep") {
|
|
643524
|
-
|
|
643525
|
-
renderInfo("Sleep consolidation — reviewing low-signal nodes with the model…");
|
|
643526
|
-
const { report: report2 } = await pruneKnowledgeGraphWithInference2({
|
|
643527
|
-
workingDir,
|
|
643528
|
-
targetNodes,
|
|
643529
|
-
model: ctx3.config.model,
|
|
643530
|
-
backendUrl: ctx3.config.backendUrl
|
|
643531
|
-
});
|
|
643532
|
-
renderInfo(report2);
|
|
643633
|
+
startBackground("Sleep consolidation", { inference: true });
|
|
643533
643634
|
return "handled";
|
|
643534
643635
|
}
|
|
643535
|
-
|
|
643536
|
-
renderInfo(pruneKnowledgeGraph2({ workingDir, targetNodes }).report);
|
|
643636
|
+
startBackground("Pruning knowledge graph", {});
|
|
643537
643637
|
return "handled";
|
|
643538
643638
|
}
|
|
643539
643639
|
case "nexus": {
|
|
@@ -657524,7 +657624,7 @@ function parseMemoryReferenceCount(value2) {
|
|
|
657524
657624
|
function parseMemoryImportance(value2) {
|
|
657525
657625
|
const matches = [...value2.matchAll(/\b(?:importance|utility|confidence|weight|salience|score|relevance)\s*[=:]\s*(\d*\.?\d+)/gi)];
|
|
657526
657626
|
if (matches.length === 0) return void 0;
|
|
657527
|
-
const values = matches.map((match) => Number(match[1])).filter((
|
|
657627
|
+
const values = matches.map((match) => Number(match[1])).filter((num3) => Number.isFinite(num3));
|
|
657528
657628
|
if (values.length === 0) return void 0;
|
|
657529
657629
|
return Math.max(...values);
|
|
657530
657630
|
}
|
|
@@ -660199,8 +660299,8 @@ function generateMnemonic(seed) {
|
|
|
660199
660299
|
h = h >>> 0;
|
|
660200
660300
|
const adj = MNEMONIC_ADJECTIVES[h % MNEMONIC_ADJECTIVES.length];
|
|
660201
660301
|
const noun = MNEMONIC_NOUNS[(h >>> 8) % MNEMONIC_NOUNS.length];
|
|
660202
|
-
const
|
|
660203
|
-
return `${adj}-${noun}-${
|
|
660302
|
+
const num3 = ((h >>> 16) % 100).toString().padStart(2, "0");
|
|
660303
|
+
return `${adj}-${noun}-${num3}`;
|
|
660204
660304
|
}
|
|
660205
660305
|
function getNodeMnemonic() {
|
|
660206
660306
|
try {
|
|
@@ -661545,7 +661645,7 @@ var init_stream_renderer = __esm({
|
|
|
661545
661645
|
);
|
|
661546
661646
|
result = result.replace(
|
|
661547
661647
|
/(:\s*)(\d+\.?\d*)/g,
|
|
661548
|
-
(_m, prefix,
|
|
661648
|
+
(_m, prefix, num3) => fg2564(PASTEL.colon, prefix) + fg2564(PASTEL.number, num3)
|
|
661549
661649
|
);
|
|
661550
661650
|
result = result.replace(
|
|
661551
661651
|
/(:\s*)(true|false)/g,
|
|
@@ -661622,10 +661722,10 @@ var init_stream_renderer = __esm({
|
|
|
661622
661722
|
if (/^\s*\d+\s*[+-]\s/.test(line)) {
|
|
661623
661723
|
const match = line.match(/^(\s*\d+\s*)([+-])(\s.*)$/);
|
|
661624
661724
|
if (match) {
|
|
661625
|
-
const
|
|
661725
|
+
const num3 = fg2564(PASTEL.diffContext, match[1]);
|
|
661626
661726
|
const sign2 = match[2] === "+" ? fg2564(PASTEL.diffAdded, "+") : fg2564(PASTEL.diffRemoved, "-");
|
|
661627
661727
|
const rest = match[2] === "+" ? fg2564(PASTEL.diffAdded, match[3]) : fg2564(PASTEL.diffRemoved, match[3]);
|
|
661628
|
-
return
|
|
661728
|
+
return num3 + sign2 + rest;
|
|
661629
661729
|
}
|
|
661630
661730
|
}
|
|
661631
661731
|
return fg2564(PASTEL.diffContext, line);
|
|
@@ -679035,27 +679135,27 @@ ${lines.join("\n")}`;
|
|
|
679035
679135
|
return false;
|
|
679036
679136
|
}
|
|
679037
679137
|
telegramSqliteRowToHistoryEntry(row) {
|
|
679038
|
-
const
|
|
679138
|
+
const num3 = (value2) => {
|
|
679039
679139
|
const n2 = Number(value2);
|
|
679040
679140
|
return Number.isFinite(n2) ? n2 : void 0;
|
|
679041
679141
|
};
|
|
679042
679142
|
const role = row.role === "assistant" ? "assistant" : "user";
|
|
679043
679143
|
const username = row.username ? String(row.username) : void 0;
|
|
679044
|
-
const fromUserId =
|
|
679144
|
+
const fromUserId = num3(row.from_user_id);
|
|
679045
679145
|
const isBot = this.telegramSqliteRowIsBot(row);
|
|
679046
679146
|
return {
|
|
679047
679147
|
role,
|
|
679048
679148
|
text: String(row.text || ""),
|
|
679049
|
-
ts:
|
|
679149
|
+
ts: num3(row.received_at),
|
|
679050
679150
|
chatId: row.chat_id,
|
|
679051
679151
|
speaker: role === "assistant" ? `@${this.state.botUsername || username || "omnius"}` : username ? `@${username}` : fromUserId !== void 0 ? isBot ? `bot:${fromUserId}` : `user:${fromUserId}` : "unknown",
|
|
679052
679152
|
username,
|
|
679053
679153
|
firstName: row.first_name ? String(row.first_name) : void 0,
|
|
679054
679154
|
fromUserId,
|
|
679055
679155
|
isBot,
|
|
679056
|
-
messageId:
|
|
679057
|
-
messageThreadId:
|
|
679058
|
-
replyToMessageId:
|
|
679156
|
+
messageId: num3(row.message_id),
|
|
679157
|
+
messageThreadId: num3(row.message_thread_id),
|
|
679158
|
+
replyToMessageId: num3(row.reply_to_message_id),
|
|
679059
679159
|
chatType: row.chat_type,
|
|
679060
679160
|
chatTitle: row.chat_title || void 0,
|
|
679061
679161
|
mediaSummary: row.media_json ? "media attached in raw Telegram SQLite mirror" : void 0
|
|
@@ -692728,16 +692828,16 @@ function handleGallery(ctx3) {
|
|
|
692728
692828
|
const kindParam = q.get("kind");
|
|
692729
692829
|
const kinds = kindParam ? kindParam.split(",").filter(Boolean) : void 0;
|
|
692730
692830
|
let items = listGlobalMedia({ kinds });
|
|
692731
|
-
const
|
|
692831
|
+
const num3 = (key) => {
|
|
692732
692832
|
const v = q.get(key);
|
|
692733
692833
|
if (v == null || v.trim() === "") return null;
|
|
692734
692834
|
const n2 = Number(v);
|
|
692735
692835
|
return Number.isFinite(n2) ? n2 : null;
|
|
692736
692836
|
};
|
|
692737
|
-
const from3 =
|
|
692738
|
-
const to =
|
|
692739
|
-
const minSize =
|
|
692740
|
-
const maxSize =
|
|
692837
|
+
const from3 = num3("from");
|
|
692838
|
+
const to = num3("to");
|
|
692839
|
+
const minSize = num3("minSize");
|
|
692840
|
+
const maxSize = num3("maxSize");
|
|
692741
692841
|
const model = (q.get("model") || "").trim().toLowerCase();
|
|
692742
692842
|
const search2 = (q.get("q") || "").trim().toLowerCase();
|
|
692743
692843
|
if (from3 != null) items = items.filter((i2) => i2.modifiedMs >= from3);
|
|
@@ -692747,8 +692847,8 @@ function handleGallery(ctx3) {
|
|
|
692747
692847
|
if (model) items = items.filter((i2) => (i2.model || "").toLowerCase().includes(model));
|
|
692748
692848
|
if (search2) items = items.filter((i2) => (i2.prompt || "").toLowerCase().includes(search2) || i2.name.toLowerCase().includes(search2));
|
|
692749
692849
|
const total = items.length;
|
|
692750
|
-
const offset = Math.max(0,
|
|
692751
|
-
const limit = Math.max(1, Math.min(1e3,
|
|
692850
|
+
const offset = Math.max(0, num3("offset") ?? 0);
|
|
692851
|
+
const limit = Math.max(1, Math.min(1e3, num3("limit") ?? 60));
|
|
692752
692852
|
const page2 = items.slice(offset, offset + limit);
|
|
692753
692853
|
sendJson2(ctx3.res, 200, {
|
|
692754
692854
|
data: page2.map((i2) => ({
|
|
@@ -730440,6 +730540,7 @@ ${taskInput}`;
|
|
|
730440
730540
|
}
|
|
730441
730541
|
activeTask = null;
|
|
730442
730542
|
setTerminalTitle(void 0, version5);
|
|
730543
|
+
idleMemoryMaintenance?.triggerAfterTask();
|
|
730443
730544
|
}
|
|
730444
730545
|
const updateMode = savedSettings.updateMode ?? "auto";
|
|
730445
730546
|
if (updateMode !== "manual" && !_autoUpdatedThisSession) {
|