@pab-iprg/huohuo 1.0.0-preview.5 → 1.0.0-preview.6
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/cli.js +12 -6
- package/package.json +3 -3
- package/release.json +14 -14
package/cli.js
CHANGED
|
@@ -425,6 +425,17 @@ function linuxAvailableMemory(processAvailable, meminfo) {
|
|
|
425
425
|
const hostAvailable = Number(match[1]) * 1024;
|
|
426
426
|
return Number.isSafeInteger(hostAvailable) && hostAvailable >= 0 ? Math.min(processAvailable, hostAvailable) : null;
|
|
427
427
|
}
|
|
428
|
+
function darwinAvailableMemory(processAvailable, effective, pressure, vmstat, constrained = false) {
|
|
429
|
+
if (processAvailable === null || !Number.isSafeInteger(processAvailable) || processAvailable <= 0) return null;
|
|
430
|
+
if (pressure !== "normal" || constrained || effective === null || !Number.isSafeInteger(effective) || effective <= 0) return processAvailable;
|
|
431
|
+
const pageSize = Number(/page size of (\d+) bytes/.exec(vmstat)?.[1]);
|
|
432
|
+
const counts = ["Pages free", "Pages purgeable", "Pages speculative", "File-backed pages"].map((label) => Number(new RegExp(`^${label}:\\s+(\\d+)\\.\\s*$`, "m").exec(vmstat)?.[1]));
|
|
433
|
+
if (![pageSize, ...counts].every(Number.isSafeInteger) || pageSize <= 0 || counts.some((n) => n < 0)) return processAvailable;
|
|
434
|
+
const [free, purgeable, speculative, fileBacked] = counts;
|
|
435
|
+
const estimate = pageSize * (free + Math.max(purgeable, Math.max(0, fileBacked - speculative)));
|
|
436
|
+
if (!Number.isSafeInteger(estimate) || estimate < 0 || estimate > effective) return processAvailable;
|
|
437
|
+
return Math.min(effective, Math.max(processAvailable, estimate));
|
|
438
|
+
}
|
|
428
439
|
async function sampleResources(paths) {
|
|
429
440
|
const limit = constrainedMemory();
|
|
430
441
|
let effectiveMemoryBytes = Math.min(totalmem(), limit || Infinity);
|
|
@@ -445,12 +456,7 @@ async function sampleResources(paths) {
|
|
|
445
456
|
if (pressure === "normal" && availableMemoryBytes !== null && effectiveMemoryBytes !== null) {
|
|
446
457
|
try {
|
|
447
458
|
const { stdout } = await execute2("/usr/bin/vm_stat", [], { timeout: 2e3 });
|
|
448
|
-
|
|
449
|
-
const pageCounts = ["free", "purgeable"].map((kind) => Number(new RegExp(`^Pages ${kind}:\\s+(\\d+)\\.`, "m").exec(stdout)?.[1]));
|
|
450
|
-
const reclaimable = pageBytes * pageCounts.reduce((sum, pages) => sum + pages, 0);
|
|
451
|
-
if (Number.isSafeInteger(reclaimable) && reclaimable > 0) {
|
|
452
|
-
availableMemoryBytes = Math.min(effectiveMemoryBytes, Math.max(availableMemoryBytes, reclaimable));
|
|
453
|
-
}
|
|
459
|
+
availableMemoryBytes = darwinAvailableMemory(availableMemoryBytes, effectiveMemoryBytes, pressure, stdout, limit > 0);
|
|
454
460
|
} catch {
|
|
455
461
|
}
|
|
456
462
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pab-iprg/huohuo",
|
|
3
|
-
"version": "1.0.0-preview.
|
|
3
|
+
"version": "1.0.0-preview.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "火火双平台安装入口(实验预览)",
|
|
6
6
|
"bin": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@pab-iprg/huohuo-assets-darwin-arm64": "1.0.0-preview.
|
|
19
|
-
"@pab-iprg/huohuo-assets-linux-x64": "1.0.0-preview.
|
|
18
|
+
"@pab-iprg/huohuo-assets-darwin-arm64": "1.0.0-preview.6",
|
|
19
|
+
"@pab-iprg/huohuo-assets-linux-x64": "1.0.0-preview.6"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public",
|
package/release.json
CHANGED
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"runtime": {
|
|
19
19
|
"name": "@huohuo/research-agent",
|
|
20
20
|
"version": "1.0.0",
|
|
21
|
-
"url": "https://bundled.invalid/
|
|
21
|
+
"url": "https://bundled.invalid/3d87538021deec2fa15adb57558f3abf453a405879b947adecf4253dd0ec5f28.tgz",
|
|
22
22
|
"bundled": true,
|
|
23
|
-
"sha256": "
|
|
24
|
-
"integrity": "sha512-
|
|
25
|
-
"downloadBytes":
|
|
26
|
-
"expandedBytes":
|
|
23
|
+
"sha256": "3d87538021deec2fa15adb57558f3abf453a405879b947adecf4253dd0ec5f28",
|
|
24
|
+
"integrity": "sha512-czI1E1L+ILNCh+tf/CdX1NXIBwETHnJDqXixNppcdzbdrsKXRJ6XkUKJbZK/AX1q4m6gdfETgqb8XXuVK9oKnQ==",
|
|
25
|
+
"downloadBytes": 2610631,
|
|
26
|
+
"expandedBytes": 8328828
|
|
27
27
|
},
|
|
28
28
|
"python": {
|
|
29
29
|
"url": "https://github.com/astral-sh/python-build-standalone/releases/download/20261026/cpython-3.13.18%2B20261026-aarch64-apple-darwin-install_only_stripped.tar.gz",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"assemblySha256": "08cf11de70e49981b4891c0aaa2a5e7b872a95b6aa07557bb629713fa8f9e249"
|
|
51
51
|
},
|
|
52
52
|
"requirementsSha256": "57042fff45cee66fe33712472e2e5b88f03a084068ca20242588b2e18b3e167b",
|
|
53
|
-
"profilesSha256": "
|
|
53
|
+
"profilesSha256": "fb3540e0d604f26280128a21f97313575848f6348733a221f7e230233fdb8e2d",
|
|
54
54
|
"budget": {
|
|
55
55
|
"minimumEffectiveMemoryBytes": 34359738368,
|
|
56
56
|
"startupHeadroomBytes": 134217728,
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
},
|
|
100
100
|
"assetPackage": {
|
|
101
101
|
"name": "@pab-iprg/huohuo-assets-darwin-arm64",
|
|
102
|
-
"version": "1.0.0-preview.
|
|
102
|
+
"version": "1.0.0-preview.6"
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
{
|
|
@@ -118,12 +118,12 @@
|
|
|
118
118
|
"runtime": {
|
|
119
119
|
"name": "@huohuo/research-agent",
|
|
120
120
|
"version": "1.0.0",
|
|
121
|
-
"url": "https://bundled.invalid/
|
|
121
|
+
"url": "https://bundled.invalid/2c2e63ab7a4890ef198f2f0e3b3152788a158fabeb1828a20e9820416eb6d01a.tgz",
|
|
122
122
|
"bundled": true,
|
|
123
|
-
"sha256": "
|
|
124
|
-
"integrity": "sha512-
|
|
125
|
-
"downloadBytes":
|
|
126
|
-
"expandedBytes":
|
|
123
|
+
"sha256": "2c2e63ab7a4890ef198f2f0e3b3152788a158fabeb1828a20e9820416eb6d01a",
|
|
124
|
+
"integrity": "sha512-JkcJGHcTpa2Db/YkeUuAzzyx0B118eP5CKBEhf7oQiGBm7uY5bbndj4q1IaeNJMhJlJRYD1YAm/qxPk1tI/5aw==",
|
|
125
|
+
"downloadBytes": 2610643,
|
|
126
|
+
"expandedBytes": 8328846
|
|
127
127
|
},
|
|
128
128
|
"python": {
|
|
129
129
|
"url": "https://github.com/astral-sh/python-build-standalone/releases/download/20261026/cpython-3.13.18%2B20261026-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"assemblySha256": "08cf11de70e49981b4891c0aaa2a5e7b872a95b6aa07557bb629713fa8f9e249"
|
|
151
151
|
},
|
|
152
152
|
"requirementsSha256": "d4ff8161886fc286e6f8ddfcd070ac5812528971affe7b87baa03662dd242d45",
|
|
153
|
-
"profilesSha256": "
|
|
153
|
+
"profilesSha256": "fb3540e0d604f26280128a21f97313575848f6348733a221f7e230233fdb8e2d",
|
|
154
154
|
"budget": {
|
|
155
155
|
"minimumEffectiveMemoryBytes": 8589934592,
|
|
156
156
|
"startupHeadroomBytes": 1073741824,
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
},
|
|
199
199
|
"assetPackage": {
|
|
200
200
|
"name": "@pab-iprg/huohuo-assets-linux-x64",
|
|
201
|
-
"version": "1.0.0-preview.
|
|
201
|
+
"version": "1.0.0-preview.6"
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
]
|