@camstack/types 1.2.86 → 1.2.88
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/addon.js +2 -2
- package/dist/addon.mjs +2 -2
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/notification-rules.cap.d.ts +16 -0
- package/dist/capabilities/osd-manager.cap.d.ts +6 -0
- package/dist/capabilities/videoclips.cap.d.ts +4 -0
- package/dist/enums/event-category.d.ts +16 -0
- package/dist/enums.js +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/{event-category-DBHdQVIy.js → event-category-CRPORAAz.js} +16 -0
- package/dist/{event-category-C0lyLd5U.mjs → event-category-XfKNtfCc.mjs} +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +328 -3
- package/dist/index.mjs +318 -4
- package/dist/interfaces/event-bus.d.ts +17 -0
- package/dist/{sleep-DZAjGv1f.js → sleep-CMRLJj2e.js} +1 -1
- package/dist/{sleep-oYerbR6F.mjs → sleep-zMxKWD0M.mjs} +1 -1
- package/dist/utils/pool-memory-watchdog.d.ts +178 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_event_category = require("./event-category-
|
|
3
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_event_category = require("./event-category-CRPORAAz.js");
|
|
3
|
+
const require_sleep = require("./sleep-CMRLJj2e.js");
|
|
4
4
|
const require_canonical_hash = require("./canonical-hash-DNV8S5ET.js");
|
|
5
5
|
const require_enums = require("./enums.js");
|
|
6
6
|
const require_err_msg = require("./err-msg-COpsHMw2.js");
|
|
@@ -12252,6 +12252,7 @@ var NcSystemEventKindSchema = zod.z.enum([
|
|
|
12252
12252
|
"node-offline",
|
|
12253
12253
|
"node-inference-unavailable",
|
|
12254
12254
|
"detection-blind",
|
|
12255
|
+
"addon-crash-loop",
|
|
12255
12256
|
"addon-update-available",
|
|
12256
12257
|
"server-update-available",
|
|
12257
12258
|
"alarm-triggered",
|
|
@@ -13403,6 +13404,10 @@ var NC_CONDITION_CATALOG = [
|
|
|
13403
13404
|
value: "detection-blind",
|
|
13404
13405
|
label: "Camera detecting nothing"
|
|
13405
13406
|
},
|
|
13407
|
+
{
|
|
13408
|
+
value: "addon-crash-loop",
|
|
13409
|
+
label: "Addon stopped after repeated crashes"
|
|
13410
|
+
},
|
|
13406
13411
|
{
|
|
13407
13412
|
value: "addon-update-available",
|
|
13408
13413
|
label: "Addon update available"
|
|
@@ -20215,6 +20220,8 @@ var vectorStoreCapability = {
|
|
|
20215
20220
|
* while preserving `eventIds[0]` — the surface's thumbnail fallback.
|
|
20216
20221
|
*/
|
|
20217
20222
|
var MAX_CLIP_EVENT_IDS = 24;
|
|
20223
|
+
/** Cap on {@link ClipSchema.labels} — the ribbon row has space for ~3 words. */
|
|
20224
|
+
var MAX_CLIP_LABELS = 3;
|
|
20218
20225
|
var ClipSchema = zod.z.object({
|
|
20219
20226
|
/** Opaque, provider-namespaced id. The default provider encodes the time
|
|
20220
20227
|
* window so `getClipPlayback` is self-contained (no event re-query). */
|
|
@@ -20232,6 +20239,14 @@ var ClipSchema = zod.z.object({
|
|
|
20232
20239
|
endMs: zod.z.number()
|
|
20233
20240
|
}),
|
|
20234
20241
|
/**
|
|
20242
|
+
* Distinct object classes attached to this visit (`person`, `car`, …),
|
|
20243
|
+
* dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
|
|
20244
|
+
* instead of the bare kind — "Object" tells the operator nothing a colour bar
|
|
20245
|
+
* did not. Absent (never empty) when the visit attached no classified object
|
|
20246
|
+
* event, so a motion/audio-only visit keeps its kind label.
|
|
20247
|
+
*/
|
|
20248
|
+
labels: zod.z.array(zod.z.string()).max(3).optional(),
|
|
20249
|
+
/**
|
|
20235
20250
|
* Lazy thumbnail URL, never inlined.
|
|
20236
20251
|
*
|
|
20237
20252
|
* Recording-derived clips (events-mode keep-window, and the prepared
|
|
@@ -43625,7 +43640,7 @@ function systemEventFilterApplies(kind, filter) {
|
|
|
43625
43640
|
switch (filter) {
|
|
43626
43641
|
case "deviceIds": return kind.startsWith("device-") || kind.startsWith("stream-") || kind === "detection-blind" || kind === "alarm-triggered" || kind === "export-completed";
|
|
43627
43642
|
case "deviceTypes": return kind.startsWith("device-") || kind === "detection-blind";
|
|
43628
|
-
case "nodeIds": return kind.startsWith("node-") || kind === "addon-update-available" || kind === "addon-updated" || kind === "server-update-available" || kind === "server-updated";
|
|
43643
|
+
case "nodeIds": return kind.startsWith("node-") || kind === "addon-crash-loop" || kind === "addon-update-available" || kind === "addon-updated" || kind === "server-update-available" || kind === "server-updated";
|
|
43629
43644
|
case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "server-updated";
|
|
43630
43645
|
}
|
|
43631
43646
|
}
|
|
@@ -45286,6 +45301,305 @@ function maskUrlCredentials(rawUrl) {
|
|
|
45286
45301
|
}
|
|
45287
45302
|
}
|
|
45288
45303
|
//#endregion
|
|
45304
|
+
//#region src/utils/pool-memory-watchdog.ts
|
|
45305
|
+
var MB = 1024 * 1024;
|
|
45306
|
+
var DEFAULT_POOL_MEMORY_POLICY = {
|
|
45307
|
+
sampleIntervalMs: 6e4,
|
|
45308
|
+
baselineSettleSamples: 5,
|
|
45309
|
+
baselineSampleCount: 3,
|
|
45310
|
+
restartMultiple: 4,
|
|
45311
|
+
floorBytes: 1024 * MB,
|
|
45312
|
+
ceilingBytes: 3072 * MB,
|
|
45313
|
+
cooldownMs: 30 * 6e4,
|
|
45314
|
+
maxRestartsPerWindow: 6,
|
|
45315
|
+
restartWindowMs: 1440 * 6e4
|
|
45316
|
+
};
|
|
45317
|
+
/**
|
|
45318
|
+
* Resolve the policy from env overrides (`CAMSTACK_POOL_MEM_*`). Garbage or
|
|
45319
|
+
* absent values keep the default — an operator typo must never disable the
|
|
45320
|
+
* bound or set it to zero.
|
|
45321
|
+
*/
|
|
45322
|
+
function resolvePoolMemoryPolicy(env) {
|
|
45323
|
+
const num = (key, fallback, min) => {
|
|
45324
|
+
const raw = env[key];
|
|
45325
|
+
if (raw === void 0) return fallback;
|
|
45326
|
+
const parsed = Number(raw);
|
|
45327
|
+
return Number.isFinite(parsed) && parsed >= min ? parsed : fallback;
|
|
45328
|
+
};
|
|
45329
|
+
const d = DEFAULT_POOL_MEMORY_POLICY;
|
|
45330
|
+
return {
|
|
45331
|
+
sampleIntervalMs: num("CAMSTACK_POOL_MEM_INTERVAL_MS", d.sampleIntervalMs, 5e3),
|
|
45332
|
+
baselineSettleSamples: d.baselineSettleSamples,
|
|
45333
|
+
baselineSampleCount: d.baselineSampleCount,
|
|
45334
|
+
restartMultiple: num("CAMSTACK_POOL_MEM_MULTIPLE", d.restartMultiple, 1.5),
|
|
45335
|
+
floorBytes: num("CAMSTACK_POOL_MEM_FLOOR_MB", d.floorBytes / MB, 128) * MB,
|
|
45336
|
+
ceilingBytes: num("CAMSTACK_POOL_MEM_CEILING_MB", d.ceilingBytes / MB, 256) * MB,
|
|
45337
|
+
cooldownMs: num("CAMSTACK_POOL_MEM_COOLDOWN_MS", d.cooldownMs, 6e4),
|
|
45338
|
+
maxRestartsPerWindow: num("CAMSTACK_POOL_MEM_MAX_RESTARTS", d.maxRestartsPerWindow, 1),
|
|
45339
|
+
restartWindowMs: num("CAMSTACK_POOL_MEM_RESTART_WINDOW_MS", d.restartWindowMs, 6e4)
|
|
45340
|
+
};
|
|
45341
|
+
}
|
|
45342
|
+
/** Parse the fields this watchdog needs out of `/proc/<pid>/status` text.
|
|
45343
|
+
* Returns null when VmRSS is missing (dead pid, kernel thread, bad read). */
|
|
45344
|
+
function parseProcStatus(text) {
|
|
45345
|
+
const kb = (label) => {
|
|
45346
|
+
const match = text.match(new RegExp(`^${label}:\\s+(\\d+)\\s*kB`, "m"));
|
|
45347
|
+
return match ? Number(match[1]) * 1024 : null;
|
|
45348
|
+
};
|
|
45349
|
+
const rssBytes = kb("VmRSS");
|
|
45350
|
+
if (rssBytes === null) return null;
|
|
45351
|
+
const threadsMatch = text.match(/^Threads:\s+(\d+)/m);
|
|
45352
|
+
return {
|
|
45353
|
+
rssBytes,
|
|
45354
|
+
vmBytes: kb("VmSize") ?? 0,
|
|
45355
|
+
hwmBytes: kb("VmHWM") ?? 0,
|
|
45356
|
+
swapBytes: kb("VmSwap") ?? 0,
|
|
45357
|
+
threads: threadsMatch ? Number(threadsMatch[1]) : 0
|
|
45358
|
+
};
|
|
45359
|
+
}
|
|
45360
|
+
function initialPoolMemoryState() {
|
|
45361
|
+
return {
|
|
45362
|
+
settleSeen: 0,
|
|
45363
|
+
baselineWindow: [],
|
|
45364
|
+
baselineBytes: null,
|
|
45365
|
+
restartsAt: [],
|
|
45366
|
+
lastRestartAt: null
|
|
45367
|
+
};
|
|
45368
|
+
}
|
|
45369
|
+
function median(values) {
|
|
45370
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
45371
|
+
return sorted[Math.floor(sorted.length / 2)];
|
|
45372
|
+
}
|
|
45373
|
+
function advanceBaseline(state, rssBytes, policy) {
|
|
45374
|
+
if (state.baselineBytes !== null) return state;
|
|
45375
|
+
if (state.settleSeen < policy.baselineSettleSamples) return {
|
|
45376
|
+
...state,
|
|
45377
|
+
settleSeen: state.settleSeen + 1
|
|
45378
|
+
};
|
|
45379
|
+
const window = [...state.baselineWindow, rssBytes];
|
|
45380
|
+
if (window.length < policy.baselineSampleCount) return {
|
|
45381
|
+
...state,
|
|
45382
|
+
baselineWindow: window
|
|
45383
|
+
};
|
|
45384
|
+
return {
|
|
45385
|
+
...state,
|
|
45386
|
+
baselineWindow: window,
|
|
45387
|
+
baselineBytes: median(window)
|
|
45388
|
+
};
|
|
45389
|
+
}
|
|
45390
|
+
/** The one place a pool's restart threshold is computed. */
|
|
45391
|
+
function poolMemoryThreshold(baselineBytes, policy) {
|
|
45392
|
+
if (baselineBytes === null) return policy.ceilingBytes;
|
|
45393
|
+
return Math.min(policy.ceilingBytes, Math.max(policy.floorBytes, policy.restartMultiple * baselineBytes));
|
|
45394
|
+
}
|
|
45395
|
+
function pruneRestarts(restartsAt, nowMs, policy) {
|
|
45396
|
+
return restartsAt.filter((t) => nowMs - t < policy.restartWindowMs);
|
|
45397
|
+
}
|
|
45398
|
+
/**
|
|
45399
|
+
* Evaluate one RSS sample. Pure: returns the successor state plus the verdict.
|
|
45400
|
+
* The caller performs (and logs) the restart, then commits it via
|
|
45401
|
+
* {@link commitWatchdogRestart}.
|
|
45402
|
+
*/
|
|
45403
|
+
function evaluatePoolMemory(state, rssBytes, nowMs, policy) {
|
|
45404
|
+
const next = advanceBaseline(state, rssBytes, policy);
|
|
45405
|
+
const thresholdBytes = poolMemoryThreshold(next.baselineBytes, policy);
|
|
45406
|
+
if (rssBytes <= thresholdBytes) return {
|
|
45407
|
+
state: next,
|
|
45408
|
+
action: next.baselineBytes === null ? "baseline-pending" : "ok",
|
|
45409
|
+
baselineBytes: next.baselineBytes,
|
|
45410
|
+
thresholdBytes
|
|
45411
|
+
};
|
|
45412
|
+
const inWindow = pruneRestarts(next.restartsAt, nowMs, policy);
|
|
45413
|
+
const pruned = {
|
|
45414
|
+
...next,
|
|
45415
|
+
restartsAt: inWindow
|
|
45416
|
+
};
|
|
45417
|
+
if (inWindow.length >= policy.maxRestartsPerWindow) return {
|
|
45418
|
+
state: pruned,
|
|
45419
|
+
action: "exhausted",
|
|
45420
|
+
baselineBytes: next.baselineBytes,
|
|
45421
|
+
thresholdBytes
|
|
45422
|
+
};
|
|
45423
|
+
if (pruned.lastRestartAt !== null && nowMs - pruned.lastRestartAt < policy.cooldownMs) return {
|
|
45424
|
+
state: pruned,
|
|
45425
|
+
action: "cooldown",
|
|
45426
|
+
baselineBytes: next.baselineBytes,
|
|
45427
|
+
thresholdBytes
|
|
45428
|
+
};
|
|
45429
|
+
return {
|
|
45430
|
+
state: pruned,
|
|
45431
|
+
action: "restart",
|
|
45432
|
+
baselineBytes: next.baselineBytes,
|
|
45433
|
+
thresholdBytes
|
|
45434
|
+
};
|
|
45435
|
+
}
|
|
45436
|
+
/** Record a performed watchdog restart: budget consumed, baseline reset —
|
|
45437
|
+
* the recreated pool is a NEW process and gets a fresh settle window. */
|
|
45438
|
+
function commitWatchdogRestart(state, nowMs) {
|
|
45439
|
+
return {
|
|
45440
|
+
...initialPoolMemoryState(),
|
|
45441
|
+
restartsAt: [...state.restartsAt, nowMs],
|
|
45442
|
+
lastRestartAt: nowMs
|
|
45443
|
+
};
|
|
45444
|
+
}
|
|
45445
|
+
/** Reset baseline tracking (pool process replaced OUTSIDE the watchdog —
|
|
45446
|
+
* kernel OOM kill + respawn, idle-reaper eviction, tuning respawn). The
|
|
45447
|
+
* restart budget is kept: it bounds the WATCHDOG, not the pool. */
|
|
45448
|
+
function resetPoolBaseline(state) {
|
|
45449
|
+
return {
|
|
45450
|
+
...initialPoolMemoryState(),
|
|
45451
|
+
restartsAt: state.restartsAt,
|
|
45452
|
+
lastRestartAt: state.lastRestartAt
|
|
45453
|
+
};
|
|
45454
|
+
}
|
|
45455
|
+
/**
|
|
45456
|
+
* Pick ONE pool to restart this sweep — the worst overage ratio. Restarting
|
|
45457
|
+
* several pools at once (e.g. after a model rollout grew every baseline)
|
|
45458
|
+
* would take detection down on every camera simultaneously; one per sweep
|
|
45459
|
+
* means the survivors keep serving while the worst offender reloads, and the
|
|
45460
|
+
* next sweep (one interval later) takes the next one.
|
|
45461
|
+
*/
|
|
45462
|
+
function pickRestartCandidate(candidates) {
|
|
45463
|
+
if (candidates.length === 0) return null;
|
|
45464
|
+
let worst = candidates[0];
|
|
45465
|
+
for (const c of candidates) if (c.rssBytes / c.thresholdBytes > worst.rssBytes / worst.thresholdBytes) worst = c;
|
|
45466
|
+
return worst.key;
|
|
45467
|
+
}
|
|
45468
|
+
var PoolMemoryWatchdog = class {
|
|
45469
|
+
pools = /* @__PURE__ */ new Map();
|
|
45470
|
+
timer = null;
|
|
45471
|
+
sweeping = false;
|
|
45472
|
+
stopped = false;
|
|
45473
|
+
opts;
|
|
45474
|
+
now;
|
|
45475
|
+
setTimer;
|
|
45476
|
+
clearTimer;
|
|
45477
|
+
constructor(opts) {
|
|
45478
|
+
this.opts = opts;
|
|
45479
|
+
this.now = opts.now ?? (() => Date.now());
|
|
45480
|
+
this.setTimer = opts.setTimer ?? ((fn, ms) => setTimeout(fn, ms));
|
|
45481
|
+
this.clearTimer = opts.clearTimer ?? ((t) => clearTimeout(t));
|
|
45482
|
+
}
|
|
45483
|
+
start() {
|
|
45484
|
+
if (this.timer || this.stopped) return;
|
|
45485
|
+
this.arm();
|
|
45486
|
+
}
|
|
45487
|
+
stop() {
|
|
45488
|
+
this.stopped = true;
|
|
45489
|
+
if (this.timer) {
|
|
45490
|
+
this.clearTimer(this.timer);
|
|
45491
|
+
this.timer = null;
|
|
45492
|
+
}
|
|
45493
|
+
}
|
|
45494
|
+
arm() {
|
|
45495
|
+
const timer = this.setTimer(() => {
|
|
45496
|
+
this.sweep().finally(() => {
|
|
45497
|
+
if (!this.stopped) this.arm();
|
|
45498
|
+
});
|
|
45499
|
+
}, this.opts.policy.sampleIntervalMs);
|
|
45500
|
+
if (typeof timer.unref === "function") timer.unref();
|
|
45501
|
+
this.timer = timer;
|
|
45502
|
+
}
|
|
45503
|
+
/** One sweep: sample → log every pool → restart at most one. Public so the
|
|
45504
|
+
* loop is testable without fake global timers. */
|
|
45505
|
+
async sweep() {
|
|
45506
|
+
if (this.sweeping) return;
|
|
45507
|
+
this.sweeping = true;
|
|
45508
|
+
try {
|
|
45509
|
+
await this.doSweep();
|
|
45510
|
+
} catch (err) {
|
|
45511
|
+
this.opts.log.warn("pool memory sweep failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
45512
|
+
} finally {
|
|
45513
|
+
this.sweeping = false;
|
|
45514
|
+
}
|
|
45515
|
+
}
|
|
45516
|
+
async doSweep() {
|
|
45517
|
+
const nowMs = this.now();
|
|
45518
|
+
const samples = await this.opts.sample();
|
|
45519
|
+
const candidates = [];
|
|
45520
|
+
const verdictByKey = /* @__PURE__ */ new Map();
|
|
45521
|
+
for (const t of samples) {
|
|
45522
|
+
const tracked = this.pools.get(t.key);
|
|
45523
|
+
let state = tracked?.state ?? initialPoolMemoryState();
|
|
45524
|
+
if (tracked && tracked.pids.length > 0 && !samePids(tracked.pids, t.pids)) {
|
|
45525
|
+
this.opts.log.warn("pool process changed outside the watchdog — re-baselining", { meta: {
|
|
45526
|
+
poolKey: t.key,
|
|
45527
|
+
previousPids: tracked.pids,
|
|
45528
|
+
pids: t.pids
|
|
45529
|
+
} });
|
|
45530
|
+
state = resetPoolBaseline(state);
|
|
45531
|
+
}
|
|
45532
|
+
const verdict = evaluatePoolMemory(state, t.rssBytes, nowMs, this.opts.policy);
|
|
45533
|
+
this.pools.set(t.key, {
|
|
45534
|
+
state: verdict.state,
|
|
45535
|
+
pids: t.pids
|
|
45536
|
+
});
|
|
45537
|
+
verdictByKey.set(t.key, verdict);
|
|
45538
|
+
this.opts.log.info("pool memory", { meta: {
|
|
45539
|
+
poolKey: t.key,
|
|
45540
|
+
pids: t.pids,
|
|
45541
|
+
rssMb: Math.round(t.rssBytes / MB),
|
|
45542
|
+
baselineMb: verdict.baselineBytes === null ? null : Math.round(verdict.baselineBytes / MB),
|
|
45543
|
+
thresholdMb: Math.round(verdict.thresholdBytes / MB),
|
|
45544
|
+
action: verdict.action,
|
|
45545
|
+
...t.meta
|
|
45546
|
+
} });
|
|
45547
|
+
if (verdict.action === "restart") candidates.push({
|
|
45548
|
+
key: t.key,
|
|
45549
|
+
rssBytes: t.rssBytes,
|
|
45550
|
+
thresholdBytes: verdict.thresholdBytes
|
|
45551
|
+
});
|
|
45552
|
+
else if (verdict.action === "cooldown") this.opts.log.warn("pool over memory threshold but inside restart cooldown", { meta: {
|
|
45553
|
+
poolKey: t.key,
|
|
45554
|
+
rssMb: Math.round(t.rssBytes / MB),
|
|
45555
|
+
thresholdMb: Math.round(verdict.thresholdBytes / MB),
|
|
45556
|
+
cooldownMs: this.opts.policy.cooldownMs
|
|
45557
|
+
} });
|
|
45558
|
+
else if (verdict.action === "exhausted") this.opts.log.error("pool memory watchdog gave up — restart budget exhausted, pool leaks faster than restarts can pay for; needs a heap profile (py-spy / tracemalloc)", { meta: {
|
|
45559
|
+
poolKey: t.key,
|
|
45560
|
+
rssMb: Math.round(t.rssBytes / MB),
|
|
45561
|
+
thresholdMb: Math.round(verdict.thresholdBytes / MB),
|
|
45562
|
+
maxRestartsPerWindow: this.opts.policy.maxRestartsPerWindow,
|
|
45563
|
+
restartWindowMs: this.opts.policy.restartWindowMs
|
|
45564
|
+
} });
|
|
45565
|
+
}
|
|
45566
|
+
for (const key of [...this.pools.keys()]) if (!samples.some((t) => t.key === key)) this.pools.delete(key);
|
|
45567
|
+
const pickedKey = pickRestartCandidate(candidates);
|
|
45568
|
+
if (pickedKey === null) return;
|
|
45569
|
+
const picked = candidates.find((c) => c.key === pickedKey);
|
|
45570
|
+
const verdict = verdictByKey.get(pickedKey);
|
|
45571
|
+
const tracked = this.pools.get(pickedKey);
|
|
45572
|
+
const restartsInWindow = tracked.state.restartsAt.length + 1;
|
|
45573
|
+
this.opts.log.warn("pool memory watchdog restarting pool — RSS over threshold", { meta: {
|
|
45574
|
+
poolKey: pickedKey,
|
|
45575
|
+
pids: tracked.pids,
|
|
45576
|
+
rssMb: Math.round(picked.rssBytes / MB),
|
|
45577
|
+
thresholdMb: Math.round(picked.thresholdBytes / MB),
|
|
45578
|
+
baselineMb: verdict.baselineBytes === null ? null : Math.round(verdict.baselineBytes / MB),
|
|
45579
|
+
restartsInWindow,
|
|
45580
|
+
deferredCandidates: candidates.filter((c) => c.key !== pickedKey).map((c) => c.key)
|
|
45581
|
+
} });
|
|
45582
|
+
try {
|
|
45583
|
+
await this.opts.restart(pickedKey);
|
|
45584
|
+
this.pools.set(pickedKey, {
|
|
45585
|
+
state: commitWatchdogRestart(tracked.state, this.now()),
|
|
45586
|
+
pids: []
|
|
45587
|
+
});
|
|
45588
|
+
} catch (err) {
|
|
45589
|
+
this.opts.log.error("pool memory watchdog restart failed", { meta: {
|
|
45590
|
+
poolKey: pickedKey,
|
|
45591
|
+
error: err instanceof Error ? err.message : String(err)
|
|
45592
|
+
} });
|
|
45593
|
+
}
|
|
45594
|
+
}
|
|
45595
|
+
};
|
|
45596
|
+
function samePids(a, b) {
|
|
45597
|
+
if (a.length !== b.length) return false;
|
|
45598
|
+
const sortedA = [...a].sort((x, y) => x - y);
|
|
45599
|
+
const sortedB = [...b].sort((x, y) => x - y);
|
|
45600
|
+
return sortedA.every((v, i) => v === sortedB[i]);
|
|
45601
|
+
}
|
|
45602
|
+
//#endregion
|
|
45289
45603
|
//#region src/utils/privacy-grid-raster.ts
|
|
45290
45604
|
/**
|
|
45291
45605
|
* Rasterize a list of normalized rects into a row-major boolean cell grid.
|
|
@@ -46185,6 +46499,7 @@ exports.DEFAULT_EVENTS_BAND_BUFFER_SEC = DEFAULT_EVENTS_BAND_BUFFER_SEC;
|
|
|
46185
46499
|
exports.DEFAULT_EVENT_COLOR = DEFAULT_EVENT_COLOR;
|
|
46186
46500
|
exports.DEFAULT_FEATURES = DEFAULT_FEATURES;
|
|
46187
46501
|
exports.DEFAULT_NATIVE_LEASE_SETTINGS = DEFAULT_NATIVE_LEASE_SETTINGS;
|
|
46502
|
+
exports.DEFAULT_POOL_MEMORY_POLICY = DEFAULT_POOL_MEMORY_POLICY;
|
|
46188
46503
|
exports.DEFAULT_RECORDING_PROFILES = DEFAULT_RECORDING_PROFILES;
|
|
46189
46504
|
exports.DEFAULT_RETENTION = DEFAULT_RETENTION;
|
|
46190
46505
|
exports.DEFAULT_RUNTIME_STATE_DURABILITY = require_sleep.DEFAULT_RUNTIME_STATE_DURABILITY;
|
|
@@ -46377,6 +46692,7 @@ exports.LoginMethodContributionSchema = LoginMethodContributionSchema;
|
|
|
46377
46692
|
exports.LoginStageEnum = LoginStageEnum;
|
|
46378
46693
|
exports.MACRO_LABELS = MACRO_LABELS;
|
|
46379
46694
|
exports.MAX_CLIP_EVENT_IDS = MAX_CLIP_EVENT_IDS;
|
|
46695
|
+
exports.MAX_CLIP_LABELS = MAX_CLIP_LABELS;
|
|
46380
46696
|
exports.MAX_CONDITION_DEPTH = MAX_CONDITION_DEPTH;
|
|
46381
46697
|
exports.MAX_CONDITION_LEAVES = MAX_CONDITION_LEAVES;
|
|
46382
46698
|
exports.MAX_EXPRESSION_AST_NODES = MAX_EXPRESSION_AST_NODES;
|
|
@@ -46582,6 +46898,7 @@ exports.PipelineValidationIssueSchema = PipelineValidationIssueSchema;
|
|
|
46582
46898
|
exports.PipelineValidationResultSchema = PipelineValidationResultSchema;
|
|
46583
46899
|
exports.PlaceholderReasonSchema = PlaceholderReasonSchema;
|
|
46584
46900
|
exports.PolygonPointSchema = PolygonPointSchema;
|
|
46901
|
+
exports.PoolMemoryWatchdog = PoolMemoryWatchdog;
|
|
46585
46902
|
exports.PowerMeterStatusSchema = PowerMeterStatusSchema;
|
|
46586
46903
|
exports.PresenceStatusSchema = PresenceStatusSchema;
|
|
46587
46904
|
exports.PressureSensorStatusSchema = PressureSensorStatusSchema;
|
|
@@ -46949,6 +47266,7 @@ exports.collectHydratedFieldEntries = require_sleep.collectHydratedFieldEntries;
|
|
|
46949
47266
|
exports.collectHydratedFieldValues = require_sleep.collectHydratedFieldValues;
|
|
46950
47267
|
exports.colorCapability = colorCapability;
|
|
46951
47268
|
exports.colorForKind = colorForKind;
|
|
47269
|
+
exports.commitWatchdogRestart = commitWatchdogRestart;
|
|
46952
47270
|
exports.compileExpression = compileExpression;
|
|
46953
47271
|
exports.compileExpressionSafe = compileExpressionSafe;
|
|
46954
47272
|
exports.composeSwitchedOff = composeSwitchedOff;
|
|
@@ -47018,6 +47336,7 @@ exports.enumerateSchemaFields = enumerateSchemaFields;
|
|
|
47018
47336
|
exports.errMsg = require_err_msg.errMsg;
|
|
47019
47337
|
exports.evaluateAst = evaluateAst;
|
|
47020
47338
|
exports.evaluateExpressionSource = evaluateExpressionSource;
|
|
47339
|
+
exports.evaluatePoolMemory = evaluatePoolMemory;
|
|
47021
47340
|
exports.evaluateZoneRules = evaluateZoneRules;
|
|
47022
47341
|
exports.event = require_sleep.event;
|
|
47023
47342
|
exports.eventEmitterCapability = eventEmitterCapability;
|
|
@@ -47047,6 +47366,7 @@ exports.humiditySensorCapability = humiditySensorCapability;
|
|
|
47047
47366
|
exports.hydrateSchema = require_sleep.hydrateSchema;
|
|
47048
47367
|
exports.imageCapability = imageCapability;
|
|
47049
47368
|
exports.imageSettingsCapability = imageSettingsCapability;
|
|
47369
|
+
exports.initialPoolMemoryState = initialPoolMemoryState;
|
|
47050
47370
|
exports.integrationsCapability = integrationsCapability;
|
|
47051
47371
|
exports.intercomCapability = intercomCapability;
|
|
47052
47372
|
exports.invocationFromEncodeProfile = require_canonical_hash.invocationFromEncodeProfile;
|
|
@@ -47129,6 +47449,7 @@ exports.parseExpression = parseExpression;
|
|
|
47129
47449
|
exports.parseJsonArray = require_sleep.parseJsonArray;
|
|
47130
47450
|
exports.parseJsonObject = require_sleep.parseJsonObject;
|
|
47131
47451
|
exports.parseJsonUnknown = require_sleep.parseJsonUnknown;
|
|
47452
|
+
exports.parseProcStatus = parseProcStatus;
|
|
47132
47453
|
exports.parseProfileBrokerId = require_sleep.parseProfileBrokerId;
|
|
47133
47454
|
exports.parseStreamParamsFormPatch = parseStreamParamsFormPatch;
|
|
47134
47455
|
exports.patchAudio = patchAudio;
|
|
@@ -47137,6 +47458,7 @@ exports.pickAccessoryControl = pickAccessoryControl;
|
|
|
47137
47458
|
exports.pickDetailCropConvention = pickDetailCropConvention;
|
|
47138
47459
|
exports.pickNativeLeaseOverride = pickNativeLeaseOverride;
|
|
47139
47460
|
exports.pickPreferredRtspEntry = pickPreferredRtspEntry;
|
|
47461
|
+
exports.pickRestartCandidate = pickRestartCandidate;
|
|
47140
47462
|
exports.pickVideoEncoder = require_canonical_hash.pickVideoEncoder;
|
|
47141
47463
|
exports.pickerForCondition = pickerForCondition;
|
|
47142
47464
|
exports.pipelineAnalyticsCapability = pipelineAnalyticsCapability;
|
|
@@ -47145,6 +47467,7 @@ exports.pipelineOrchestratorCapability = pipelineOrchestratorCapability;
|
|
|
47145
47467
|
exports.pipelineRunnerCapability = pipelineRunnerCapability;
|
|
47146
47468
|
exports.plateGalleryCapability = plateGalleryCapability;
|
|
47147
47469
|
exports.platformProbeCapability = platformProbeCapability;
|
|
47470
|
+
exports.poolMemoryThreshold = poolMemoryThreshold;
|
|
47148
47471
|
exports.powerMeterCapability = powerMeterCapability;
|
|
47149
47472
|
exports.prepareNotification = prepareNotification;
|
|
47150
47473
|
exports.presenceCapability = presenceCapability;
|
|
@@ -47166,6 +47489,7 @@ exports.recordingCapability = recordingCapability;
|
|
|
47166
47489
|
exports.recordingExportCapability = recordingExportCapability;
|
|
47167
47490
|
exports.rectsToCells = rectsToCells;
|
|
47168
47491
|
exports.requiresPython = requiresPython;
|
|
47492
|
+
exports.resetPoolBaseline = resetPoolBaseline;
|
|
47169
47493
|
exports.resolveAddonExecution = resolveAddonExecution;
|
|
47170
47494
|
exports.resolveAddonGroup = resolveAddonGroup;
|
|
47171
47495
|
exports.resolveAddonPlacement = resolveAddonPlacement;
|
|
@@ -47179,6 +47503,7 @@ exports.resolveFormat = resolveFormat;
|
|
|
47179
47503
|
exports.resolveHydratedFieldValue = require_sleep.resolveHydratedFieldValue;
|
|
47180
47504
|
exports.resolveModelFormat = resolveModelFormat;
|
|
47181
47505
|
exports.resolveMutate = resolveMutate;
|
|
47506
|
+
exports.resolvePoolMemoryPolicy = resolvePoolMemoryPolicy;
|
|
47182
47507
|
exports.resolveRecordingProfiles = resolveRecordingProfiles;
|
|
47183
47508
|
exports.resolveRunnerId = resolveRunnerId;
|
|
47184
47509
|
exports.resolveScrubThumbnailGeometry = resolveScrubThumbnailGeometry;
|