@camstack/system 1.1.14 → 1.1.15
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 +40 -24
- package/dist/index.mjs +40 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -92344,32 +92344,48 @@ async function getPidStats$1(pids) {
|
|
|
92344
92344
|
});
|
|
92345
92345
|
}
|
|
92346
92346
|
/**
|
|
92347
|
-
*
|
|
92348
|
-
*
|
|
92349
|
-
*
|
|
92350
|
-
*
|
|
92351
|
-
*
|
|
92352
|
-
|
|
92353
|
-
|
|
92354
|
-
|
|
92347
|
+
* Resolve the declared heap profile for one addon by reading its package.json manifest
|
|
92348
|
+
* (`camstack.addons[].execution.heapProfile`). `addonDir` points at the addon's built `dist`, so the
|
|
92349
|
+
* manifest is one level up; we also try `addonDir` itself for layouts where it IS the package root.
|
|
92350
|
+
* Result is cached per (dir,id) — spawns are infrequent but a runner may re-spawn on crash/restart.
|
|
92351
|
+
* Returns `undefined` when the manifest is unreadable or declares no profile → treated as light.
|
|
92352
|
+
*/
|
|
92353
|
+
var heapProfileCache = /* @__PURE__ */ new Map();
|
|
92354
|
+
function readAddonHeapProfile(spec) {
|
|
92355
|
+
const cacheKey = `${spec.addonDir}::${spec.addonId}`;
|
|
92356
|
+
const cached = heapProfileCache.get(cacheKey);
|
|
92357
|
+
if (cached !== void 0 || heapProfileCache.has(cacheKey)) return cached;
|
|
92358
|
+
let profile;
|
|
92359
|
+
for (const manifestPath of [node_path.join(spec.addonDir, "package.json"), node_path.join(node_path.dirname(spec.addonDir), "package.json")]) try {
|
|
92360
|
+
const raw = node_fs.readFileSync(manifestPath, "utf8");
|
|
92361
|
+
const parsed = JSON.parse(raw);
|
|
92362
|
+
profile = extractHeapProfile(parsed, spec.addonId);
|
|
92363
|
+
if (profile !== void 0) break;
|
|
92364
|
+
if (manifestHasAddon(parsed, spec.addonId)) break;
|
|
92365
|
+
} catch {}
|
|
92366
|
+
heapProfileCache.set(cacheKey, profile);
|
|
92367
|
+
return profile;
|
|
92368
|
+
}
|
|
92369
|
+
function manifestHasAddon(parsed, addonId) {
|
|
92370
|
+
return readManifestAddons(parsed).some((a) => a.id === addonId);
|
|
92371
|
+
}
|
|
92372
|
+
function extractHeapProfile(parsed, addonId) {
|
|
92373
|
+
const value = readManifestAddons(parsed).find((a) => a.id === addonId)?.execution?.heapProfile;
|
|
92374
|
+
return value === "heavy" || value === "light" ? value : void 0;
|
|
92375
|
+
}
|
|
92376
|
+
function readManifestAddons(parsed) {
|
|
92377
|
+
if (typeof parsed !== "object" || parsed === null) return [];
|
|
92378
|
+
const camstack = parsed.camstack;
|
|
92379
|
+
if (typeof camstack !== "object" || camstack === null) return [];
|
|
92380
|
+
const addons = camstack.addons;
|
|
92381
|
+
return Array.isArray(addons) ? addons : [];
|
|
92382
|
+
}
|
|
92383
|
+
/**
|
|
92384
|
+
* A runner is heavy if ANY co-located addon declares `heapProfile: 'heavy'` in its manifest.
|
|
92385
|
+
* Everything else (the un-annotated default) is a light control-plane runner. No hard-coded names.
|
|
92355
92386
|
*/
|
|
92356
|
-
var HEAVY_RUNNER_DIR_MARKERS = [
|
|
92357
|
-
"addon-pipeline",
|
|
92358
|
-
"addon-detection-pipeline",
|
|
92359
|
-
"addon-pipeline-runner",
|
|
92360
|
-
"addon-pipeline-orchestrator",
|
|
92361
|
-
"addon-decoder",
|
|
92362
|
-
"addon-benchmark",
|
|
92363
|
-
"addon-audio-codec",
|
|
92364
|
-
"addon-motion",
|
|
92365
|
-
"addon-embedding",
|
|
92366
|
-
"addon-model-studio",
|
|
92367
|
-
"addon-analytics-suite",
|
|
92368
|
-
"addon-provider-reolink",
|
|
92369
|
-
"addon-provider-matter"
|
|
92370
|
-
];
|
|
92371
92387
|
function isHeavyRunner(addons) {
|
|
92372
|
-
return addons.some((a) =>
|
|
92388
|
+
return addons.some((a) => readAddonHeapProfile(a) === "heavy");
|
|
92373
92389
|
}
|
|
92374
92390
|
/**
|
|
92375
92391
|
* Per-placement V8 heap flags (Block D). LIGHT runners cap their young generation
|
package/dist/index.mjs
CHANGED
|
@@ -92336,32 +92336,48 @@ async function getPidStats$1(pids) {
|
|
|
92336
92336
|
});
|
|
92337
92337
|
}
|
|
92338
92338
|
/**
|
|
92339
|
-
*
|
|
92340
|
-
*
|
|
92341
|
-
*
|
|
92342
|
-
*
|
|
92343
|
-
*
|
|
92344
|
-
|
|
92345
|
-
|
|
92346
|
-
|
|
92339
|
+
* Resolve the declared heap profile for one addon by reading its package.json manifest
|
|
92340
|
+
* (`camstack.addons[].execution.heapProfile`). `addonDir` points at the addon's built `dist`, so the
|
|
92341
|
+
* manifest is one level up; we also try `addonDir` itself for layouts where it IS the package root.
|
|
92342
|
+
* Result is cached per (dir,id) — spawns are infrequent but a runner may re-spawn on crash/restart.
|
|
92343
|
+
* Returns `undefined` when the manifest is unreadable or declares no profile → treated as light.
|
|
92344
|
+
*/
|
|
92345
|
+
var heapProfileCache = /* @__PURE__ */ new Map();
|
|
92346
|
+
function readAddonHeapProfile(spec) {
|
|
92347
|
+
const cacheKey = `${spec.addonDir}::${spec.addonId}`;
|
|
92348
|
+
const cached = heapProfileCache.get(cacheKey);
|
|
92349
|
+
if (cached !== void 0 || heapProfileCache.has(cacheKey)) return cached;
|
|
92350
|
+
let profile;
|
|
92351
|
+
for (const manifestPath of [path$39.join(spec.addonDir, "package.json"), path$39.join(path$39.dirname(spec.addonDir), "package.json")]) try {
|
|
92352
|
+
const raw = fs$17.readFileSync(manifestPath, "utf8");
|
|
92353
|
+
const parsed = JSON.parse(raw);
|
|
92354
|
+
profile = extractHeapProfile(parsed, spec.addonId);
|
|
92355
|
+
if (profile !== void 0) break;
|
|
92356
|
+
if (manifestHasAddon(parsed, spec.addonId)) break;
|
|
92357
|
+
} catch {}
|
|
92358
|
+
heapProfileCache.set(cacheKey, profile);
|
|
92359
|
+
return profile;
|
|
92360
|
+
}
|
|
92361
|
+
function manifestHasAddon(parsed, addonId) {
|
|
92362
|
+
return readManifestAddons(parsed).some((a) => a.id === addonId);
|
|
92363
|
+
}
|
|
92364
|
+
function extractHeapProfile(parsed, addonId) {
|
|
92365
|
+
const value = readManifestAddons(parsed).find((a) => a.id === addonId)?.execution?.heapProfile;
|
|
92366
|
+
return value === "heavy" || value === "light" ? value : void 0;
|
|
92367
|
+
}
|
|
92368
|
+
function readManifestAddons(parsed) {
|
|
92369
|
+
if (typeof parsed !== "object" || parsed === null) return [];
|
|
92370
|
+
const camstack = parsed.camstack;
|
|
92371
|
+
if (typeof camstack !== "object" || camstack === null) return [];
|
|
92372
|
+
const addons = camstack.addons;
|
|
92373
|
+
return Array.isArray(addons) ? addons : [];
|
|
92374
|
+
}
|
|
92375
|
+
/**
|
|
92376
|
+
* A runner is heavy if ANY co-located addon declares `heapProfile: 'heavy'` in its manifest.
|
|
92377
|
+
* Everything else (the un-annotated default) is a light control-plane runner. No hard-coded names.
|
|
92347
92378
|
*/
|
|
92348
|
-
var HEAVY_RUNNER_DIR_MARKERS = [
|
|
92349
|
-
"addon-pipeline",
|
|
92350
|
-
"addon-detection-pipeline",
|
|
92351
|
-
"addon-pipeline-runner",
|
|
92352
|
-
"addon-pipeline-orchestrator",
|
|
92353
|
-
"addon-decoder",
|
|
92354
|
-
"addon-benchmark",
|
|
92355
|
-
"addon-audio-codec",
|
|
92356
|
-
"addon-motion",
|
|
92357
|
-
"addon-embedding",
|
|
92358
|
-
"addon-model-studio",
|
|
92359
|
-
"addon-analytics-suite",
|
|
92360
|
-
"addon-provider-reolink",
|
|
92361
|
-
"addon-provider-matter"
|
|
92362
|
-
];
|
|
92363
92379
|
function isHeavyRunner(addons) {
|
|
92364
|
-
return addons.some((a) =>
|
|
92380
|
+
return addons.some((a) => readAddonHeapProfile(a) === "heavy");
|
|
92365
92381
|
}
|
|
92366
92382
|
/**
|
|
92367
92383
|
* Per-placement V8 heap flags (Block D). LIGHT runners cap their young generation
|