@camstack/addon-pipeline-orchestrator 1.2.692 → 1.2.693
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/CHANGELOG.md +6 -0
- package/dist/_stub.js +2 -2
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-C1gW2gP1.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-lxOEYPRA.mjs} +2 -2
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CsV7-z-O.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BWVvTD9U.mjs +26 -0
- package/dist/{hostInit-CUQhVDcd.mjs → hostInit-Bq6o7us4.mjs} +2 -2
- package/dist/index.js +535 -1
- package/dist/index.mjs +535 -1
- package/dist/remoteEntry.js +1 -1
- package/package.json +2 -2
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Xo5GGc3m.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BYW8iMof.mjs +0 -26
package/dist/index.mjs
CHANGED
|
@@ -6078,7 +6078,7 @@ var ZodIssueCode = {
|
|
|
6078
6078
|
var ZodFirstPartyTypeKind;
|
|
6079
6079
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6080
6080
|
//#endregion
|
|
6081
|
-
//#region ../types/dist/sleep-
|
|
6081
|
+
//#region ../types/dist/sleep-DnhxKL99.mjs
|
|
6082
6082
|
/**
|
|
6083
6083
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6084
6084
|
* window to float samples (D455).
|
|
@@ -60776,6 +60776,34 @@ var OrphanListSchema = object({
|
|
|
60776
60776
|
/** More orphans exist than {@link DEVICE_HISTORY_ORPHAN_LIST_MAX}. */
|
|
60777
60777
|
truncated: boolean()
|
|
60778
60778
|
});
|
|
60779
|
+
var DeviceHistoryRangeDeleteRefusalSchema = _enum([
|
|
60780
|
+
"invalid-range",
|
|
60781
|
+
"range-too-large",
|
|
60782
|
+
"series-not-found",
|
|
60783
|
+
"not-a-point-series"
|
|
60784
|
+
]);
|
|
60785
|
+
var RollupRowsSchema = object({
|
|
60786
|
+
"5m": number$1().int(),
|
|
60787
|
+
"1h": number$1().int(),
|
|
60788
|
+
"1d": number$1().int()
|
|
60789
|
+
});
|
|
60790
|
+
/**
|
|
60791
|
+
* What a time-range delete did, or WOULD do (`dryRun`). `rows` is what was
|
|
60792
|
+
* removed: raw points inside the range, and the rollup rows covering it (those
|
|
60793
|
+
* are removed and rebuilt from what remains, so a gap leaves no stale value).
|
|
60794
|
+
* `rewritten` is how many rollup rows were rebuilt from the remaining points;
|
|
60795
|
+
* `null` on a dry run, which cannot know before it has deleted.
|
|
60796
|
+
*/
|
|
60797
|
+
var RangeDeleteResultSchema = discriminatedUnion("ok", [object({
|
|
60798
|
+
ok: literal(true),
|
|
60799
|
+
dryRun: boolean(),
|
|
60800
|
+
seriesId: number$1().int(),
|
|
60801
|
+
rows: TierRowsSchema,
|
|
60802
|
+
rewritten: RollupRowsSchema.nullable()
|
|
60803
|
+
}), object({
|
|
60804
|
+
ok: literal(false),
|
|
60805
|
+
reason: DeviceHistoryRangeDeleteRefusalSchema
|
|
60806
|
+
})]);
|
|
60779
60807
|
var DeviceHistoryStatusSchema = object({
|
|
60780
60808
|
startedAt: number$1(),
|
|
60781
60809
|
/** The store is declared, series loaded and the first reconcile has answered. */
|
|
@@ -60876,6 +60904,16 @@ method(object({ deviceId: number$1().int() }), array(SeriesInfoSchema).readonly(
|
|
|
60876
60904
|
}), method(object({}), DeviceHistoryStatusSchema, { auth: "admin" }), method(object({}), OrphanListSchema, { auth: "admin" }), method(object({ seriesIds: array(number$1().int()).min(1).max(50) }), object({ results: array(OrphanDeleteEntrySchema).readonly() }), {
|
|
60877
60905
|
kind: "mutation",
|
|
60878
60906
|
auth: "admin"
|
|
60907
|
+
}), method(object({
|
|
60908
|
+
deviceId: number$1().int(),
|
|
60909
|
+
key: string().min(1),
|
|
60910
|
+
scope: string(),
|
|
60911
|
+
fromMs: number$1().int().nonnegative(),
|
|
60912
|
+
toMs: number$1().int().nonnegative(),
|
|
60913
|
+
dryRun: boolean()
|
|
60914
|
+
}), RangeDeleteResultSchema, {
|
|
60915
|
+
kind: "mutation",
|
|
60916
|
+
auth: "admin"
|
|
60879
60917
|
});
|
|
60880
60918
|
/**
|
|
60881
60919
|
* `device-removal-hook` — the reliable way an addon learns a device was DELETED,
|
|
@@ -79331,6 +79369,82 @@ var EffectiveSharesSchema = object({
|
|
|
79331
79369
|
nodeWeights: record(string(), number$1()),
|
|
79332
79370
|
deviceWeights: record(string(), record(string(), number$1()))
|
|
79333
79371
|
});
|
|
79372
|
+
var HealthFindingKindSchema = _enum([
|
|
79373
|
+
"motion-without-detections",
|
|
79374
|
+
"detections-under-floor",
|
|
79375
|
+
"inference-too-slow",
|
|
79376
|
+
"frames-shed",
|
|
79377
|
+
"inference-device-unusable"
|
|
79378
|
+
]);
|
|
79379
|
+
var HealthSeveritySchema = _enum([
|
|
79380
|
+
"info",
|
|
79381
|
+
"warning",
|
|
79382
|
+
"critical"
|
|
79383
|
+
]);
|
|
79384
|
+
var HealthSubjectSchema = discriminatedUnion("type", [
|
|
79385
|
+
object({
|
|
79386
|
+
type: literal("camera"),
|
|
79387
|
+
deviceId: number$1()
|
|
79388
|
+
}),
|
|
79389
|
+
object({
|
|
79390
|
+
type: literal("node"),
|
|
79391
|
+
nodeId: string()
|
|
79392
|
+
}),
|
|
79393
|
+
object({
|
|
79394
|
+
type: literal("inference-device"),
|
|
79395
|
+
nodeId: string(),
|
|
79396
|
+
deviceKey: string()
|
|
79397
|
+
})
|
|
79398
|
+
]);
|
|
79399
|
+
var HealthFindingSchema = object({
|
|
79400
|
+
/** Stable across ticks for the same condition on the same subject. */
|
|
79401
|
+
id: string(),
|
|
79402
|
+
kind: HealthFindingKindSchema,
|
|
79403
|
+
severity: HealthSeveritySchema,
|
|
79404
|
+
subject: HealthSubjectSchema,
|
|
79405
|
+
what: string(),
|
|
79406
|
+
/** The numbers behind the sentence; `null` = the value could not be read. */
|
|
79407
|
+
evidence: record(string(), number$1().nullable()),
|
|
79408
|
+
action: string()
|
|
79409
|
+
});
|
|
79410
|
+
/** One in-memory source the tick read, and whether it answered. */
|
|
79411
|
+
var HealthSourceStatusSchema = object({
|
|
79412
|
+
source: string(),
|
|
79413
|
+
/** Entries read; `null` = the read failed. */
|
|
79414
|
+
entries: number$1().nullable()
|
|
79415
|
+
});
|
|
79416
|
+
var HealthNodeSummarySchema = object({
|
|
79417
|
+
nodeId: string(),
|
|
79418
|
+
sessionsNow: number$1(),
|
|
79419
|
+
/** `deviceKey` of every inference device the balancer excludes on this node. */
|
|
79420
|
+
unusableDevices: array(string()).readonly(),
|
|
79421
|
+
devices: array(object({
|
|
79422
|
+
deviceKey: string(),
|
|
79423
|
+
sessionsNow: number$1(),
|
|
79424
|
+
usable: boolean()
|
|
79425
|
+
})).readonly()
|
|
79426
|
+
});
|
|
79427
|
+
var HealthDigestSchema = object({
|
|
79428
|
+
generatedAt: number$1(),
|
|
79429
|
+
/** Wall time the tick took to build this digest. */
|
|
79430
|
+
tickMs: number$1(),
|
|
79431
|
+
/** Cameras known to the digest; `null` when a camera source failed to read (the union would be incomplete). */
|
|
79432
|
+
camerasSeen: number$1().nullable(),
|
|
79433
|
+
findings: array(HealthFindingSchema).readonly(),
|
|
79434
|
+
nodes: array(HealthNodeSummarySchema).readonly(),
|
|
79435
|
+
sources: array(HealthSourceStatusSchema).readonly(),
|
|
79436
|
+
/** Signals the digest does not cover yet, and why — never computed by scanning. */
|
|
79437
|
+
notCovered: array(string()).readonly()
|
|
79438
|
+
});
|
|
79439
|
+
var HealthDigestInputSchema = object({
|
|
79440
|
+
/** Newest first; 1 = the latest digest. */
|
|
79441
|
+
history: number$1().int().min(1).max(24).default(1) });
|
|
79442
|
+
var HealthDigestAnswerSchema = object({
|
|
79443
|
+
/** Null until the first tick has run. */
|
|
79444
|
+
latest: HealthDigestSchema.nullable(),
|
|
79445
|
+
/** Older digests, newest first, when `history` > 1. */
|
|
79446
|
+
previous: array(HealthDigestSchema).readonly()
|
|
79447
|
+
});
|
|
79334
79448
|
var CameraPipelineConfigSchema = object({
|
|
79335
79449
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
79336
79450
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -80267,6 +80381,16 @@ var pipelineOrchestratorCapability = {
|
|
|
80267
80381
|
*/
|
|
80268
80382
|
getPlacementStats: method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }),
|
|
80269
80383
|
/**
|
|
80384
|
+
* Health digest (planning#572) — findings an operator can act on, built
|
|
80385
|
+
* every 5 minutes from state the orchestrator already holds in memory
|
|
80386
|
+
* (no log scan, no database read): motion that never becomes a detection,
|
|
80387
|
+
* candidates all under the class floor, inference slower than the fps it
|
|
80388
|
+
* must allow, shed frames, unusable inference devices. `latest` is null
|
|
80389
|
+
* until the first tick; `previous` holds older digests when `history` > 1.
|
|
80390
|
+
* In memory on the hub — a restart starts empty.
|
|
80391
|
+
*/
|
|
80392
|
+
getHealthDigest: method(HealthDigestInputSchema, HealthDigestAnswerSchema, { auth: "admin" }),
|
|
80393
|
+
/**
|
|
80270
80394
|
* Load balancing (D748, D755) — shares proportional to each node's
|
|
80271
80395
|
* capacity in parallel sessions: from the latency table at the models
|
|
80272
80396
|
* Auto tune picks (`hardware`), or from node benchmark results
|
|
@@ -95522,6 +95646,13 @@ Object.freeze({
|
|
|
95522
95646
|
access: "delete",
|
|
95523
95647
|
role: "admin"
|
|
95524
95648
|
},
|
|
95649
|
+
"deviceHistory.deleteSeriesRange": {
|
|
95650
|
+
capName: "device-history",
|
|
95651
|
+
capScope: "system",
|
|
95652
|
+
addonId: null,
|
|
95653
|
+
access: "delete",
|
|
95654
|
+
role: "admin"
|
|
95655
|
+
},
|
|
95525
95656
|
"deviceHistory.getDeviceEnabled": {
|
|
95526
95657
|
capName: "device-history",
|
|
95527
95658
|
capScope: "system",
|
|
@@ -100338,6 +100469,13 @@ Object.freeze({
|
|
|
100338
100469
|
access: "view",
|
|
100339
100470
|
role: "admin"
|
|
100340
100471
|
},
|
|
100472
|
+
"pipelineOrchestrator.getHealthDigest": {
|
|
100473
|
+
capName: "pipeline-orchestrator",
|
|
100474
|
+
capScope: "system",
|
|
100475
|
+
addonId: null,
|
|
100476
|
+
access: "view",
|
|
100477
|
+
role: "admin"
|
|
100478
|
+
},
|
|
100341
100479
|
"pipelineOrchestrator.getIngestOwner": {
|
|
100342
100480
|
capName: "pipeline-orchestrator",
|
|
100343
100481
|
capScope: "system",
|
|
@@ -104589,6 +104727,11 @@ Object.freeze({
|
|
|
104589
104727
|
form: "single",
|
|
104590
104728
|
optional: false
|
|
104591
104729
|
}],
|
|
104730
|
+
"deviceHistory.deleteSeriesRange": [{
|
|
104731
|
+
name: "deviceId",
|
|
104732
|
+
form: "single",
|
|
104733
|
+
optional: false
|
|
104734
|
+
}],
|
|
104592
104735
|
"deviceHistory.getDeviceEnabled": [{
|
|
104593
104736
|
name: "deviceId",
|
|
104594
104737
|
form: "single",
|
|
@@ -117375,6 +117518,36 @@ var DetectionBlindMonitor = class {
|
|
|
117375
117518
|
}
|
|
117376
117519
|
return out;
|
|
117377
117520
|
}
|
|
117521
|
+
/**
|
|
117522
|
+
* A read-only view of every tracked camera: no transition fires, no state
|
|
117523
|
+
* changes. Costs one pass over the map; used by the health digest tick.
|
|
117524
|
+
*/
|
|
117525
|
+
snapshot(now) {
|
|
117526
|
+
const window = this.config.noisyWindowMs;
|
|
117527
|
+
const from = now - window;
|
|
117528
|
+
const out = [];
|
|
117529
|
+
for (const [deviceId, s] of this.state) {
|
|
117530
|
+
let motionMs = 0;
|
|
117531
|
+
let opened = 0;
|
|
117532
|
+
for (const span of s.spans) {
|
|
117533
|
+
if ((span.end ?? now) <= from) continue;
|
|
117534
|
+
motionMs += Math.min(span.end ?? now, now) - Math.max(span.start, from);
|
|
117535
|
+
if (span.start >= from) opened += 1;
|
|
117536
|
+
}
|
|
117537
|
+
out.push({
|
|
117538
|
+
deviceId,
|
|
117539
|
+
motionKnown: s.motionKnown,
|
|
117540
|
+
sessionsInWindow: opened,
|
|
117541
|
+
dutyInWindow: s.motionKnown ? motionMs / window : null,
|
|
117542
|
+
lastDetectionAt: s.lastDetectionAt,
|
|
117543
|
+
lastFrameAt: s.lastFrameAt,
|
|
117544
|
+
belowFloorFrames: s.belowFloor,
|
|
117545
|
+
framesSinceOutput: s.frames,
|
|
117546
|
+
trackedSince: s.trackedSince
|
|
117547
|
+
});
|
|
117548
|
+
}
|
|
117549
|
+
return out;
|
|
117550
|
+
}
|
|
117378
117551
|
/** Drop a device (detach / unbind), so a re-attach starts a fresh clock. */
|
|
117379
117552
|
forget(deviceId) {
|
|
117380
117553
|
this.state.delete(deviceId);
|
|
@@ -117384,6 +117557,314 @@ var DetectionBlindMonitor = class {
|
|
|
117384
117557
|
}
|
|
117385
117558
|
};
|
|
117386
117559
|
//#endregion
|
|
117560
|
+
//#region src/health-digest.ts
|
|
117561
|
+
/** The digest runs this often. */
|
|
117562
|
+
var HEALTH_DIGEST_INTERVAL_MS = 5 * 6e4;
|
|
117563
|
+
var NOT_COVERED = [
|
|
117564
|
+
"decode hwaccel fallback on every session start: the counter lives in the stream-broker/decoder process, no orchestrator-side source",
|
|
117565
|
+
"births tossed before a track and crop misses (worker-lease-gone): runner-side counters, not mirrored in the orchestrator",
|
|
117566
|
+
"stationary registry absorbing most detections: runner-side registry, not mirrored in the orchestrator",
|
|
117567
|
+
"which model runs on which inference device: only a cross-node cap call answers it, not allowed on a light tick"
|
|
117568
|
+
];
|
|
117569
|
+
function motionFindings(c, now) {
|
|
117570
|
+
const m = c.motion;
|
|
117571
|
+
if (m === null || !m.motionKnown) return [];
|
|
117572
|
+
const subject = {
|
|
117573
|
+
type: "camera",
|
|
117574
|
+
deviceId: c.deviceId
|
|
117575
|
+
};
|
|
117576
|
+
const out = [];
|
|
117577
|
+
const detectedRecently = m.lastDetectionAt !== null && now - m.lastDetectionAt < 60 * 6e4;
|
|
117578
|
+
if (m.belowFloorFrames >= 10 && !detectedRecently) out.push({
|
|
117579
|
+
id: `detections-under-floor:${c.deviceId}`,
|
|
117580
|
+
kind: "detections-under-floor",
|
|
117581
|
+
severity: "warning",
|
|
117582
|
+
subject,
|
|
117583
|
+
what: "The detector sees candidates on this camera but every one is below its class floor.",
|
|
117584
|
+
evidence: {
|
|
117585
|
+
belowFloorFrames: m.belowFloorFrames,
|
|
117586
|
+
sessionsInWindow: m.sessionsInWindow
|
|
117587
|
+
},
|
|
117588
|
+
action: "Check the class floors for this camera (a lower floor, or a better model); open a track in debug to see the discarded scores."
|
|
117589
|
+
});
|
|
117590
|
+
else if (m.sessionsInWindow >= 20 && !detectedRecently) out.push({
|
|
117591
|
+
id: `motion-without-detections:${c.deviceId}`,
|
|
117592
|
+
kind: "motion-without-detections",
|
|
117593
|
+
severity: "warning",
|
|
117594
|
+
subject,
|
|
117595
|
+
what: "Motion keeps starting detection sessions on this camera and none produced a detection.",
|
|
117596
|
+
evidence: {
|
|
117597
|
+
sessionsInWindow: m.sessionsInWindow,
|
|
117598
|
+
dutyInWindow: m.dutyInWindow,
|
|
117599
|
+
framesSinceOutput: m.framesSinceOutput
|
|
117600
|
+
},
|
|
117601
|
+
action: "Tighten the motion source or its zones (wind, trees, lights), or confirm the camera view is not blocked."
|
|
117602
|
+
});
|
|
117603
|
+
return out;
|
|
117604
|
+
}
|
|
117605
|
+
function metricsFindings(c, now) {
|
|
117606
|
+
const m = c.metrics;
|
|
117607
|
+
if (m === null || m.phase !== "active" || now - m.lastSeen > 6e5) return [];
|
|
117608
|
+
const subject = {
|
|
117609
|
+
type: "camera",
|
|
117610
|
+
deviceId: c.deviceId
|
|
117611
|
+
};
|
|
117612
|
+
const out = [];
|
|
117613
|
+
if (m.avgInferenceTimeMs > 0 && m.configuredFps > 0) {
|
|
117614
|
+
const allowedFps = 1e3 / m.avgInferenceTimeMs;
|
|
117615
|
+
if (allowedFps < m.configuredFps) out.push({
|
|
117616
|
+
id: `inference-too-slow:${c.deviceId}`,
|
|
117617
|
+
kind: "inference-too-slow",
|
|
117618
|
+
severity: allowedFps < m.configuredFps * .5 ? "critical" : "warning",
|
|
117619
|
+
subject,
|
|
117620
|
+
what: "Inference takes longer than the frame rate this camera is configured for allows.",
|
|
117621
|
+
evidence: {
|
|
117622
|
+
allowedFps,
|
|
117623
|
+
configuredFps: m.configuredFps,
|
|
117624
|
+
actualFps: m.actualFps,
|
|
117625
|
+
avgInferenceTimeMs: m.avgInferenceTimeMs
|
|
117626
|
+
},
|
|
117627
|
+
action: "Lower the camera detection fps, pick a faster model, or move the camera to a faster inference device."
|
|
117628
|
+
});
|
|
117629
|
+
}
|
|
117630
|
+
if (m.droppedSincePreviousTick !== null && m.droppedSincePreviousTick > 0 && m.queueDepth > 0) out.push({
|
|
117631
|
+
id: `frames-shed:${c.deviceId}`,
|
|
117632
|
+
kind: "frames-shed",
|
|
117633
|
+
severity: "warning",
|
|
117634
|
+
subject,
|
|
117635
|
+
what: "The worker is saturated: frames are being shed while a backlog waits.",
|
|
117636
|
+
evidence: {
|
|
117637
|
+
droppedSincePreviousTick: m.droppedSincePreviousTick,
|
|
117638
|
+
droppedFramesTotal: m.droppedFrames,
|
|
117639
|
+
queueDepth: m.queueDepth,
|
|
117640
|
+
actualFps: m.actualFps
|
|
117641
|
+
},
|
|
117642
|
+
action: "Move cameras off this device, add an inference device, or lower detection fps."
|
|
117643
|
+
});
|
|
117644
|
+
return out;
|
|
117645
|
+
}
|
|
117646
|
+
function deviceFindings(unusable) {
|
|
117647
|
+
return unusable.map((d) => ({
|
|
117648
|
+
id: `inference-device-unusable:${d.nodeId}:${d.deviceKey}`,
|
|
117649
|
+
kind: "inference-device-unusable",
|
|
117650
|
+
severity: "critical",
|
|
117651
|
+
subject: {
|
|
117652
|
+
type: "inference-device",
|
|
117653
|
+
nodeId: d.nodeId,
|
|
117654
|
+
deviceKey: d.deviceKey
|
|
117655
|
+
},
|
|
117656
|
+
what: "The balancer excludes this inference device: it stopped answering usably.",
|
|
117657
|
+
evidence: {},
|
|
117658
|
+
action: "Check the device and driver on the node; sessions run on its other devices meanwhile."
|
|
117659
|
+
}));
|
|
117660
|
+
}
|
|
117661
|
+
function nodeSummaries(placement, unusable) {
|
|
117662
|
+
const bad = unusable ?? [];
|
|
117663
|
+
return placement.map((n) => ({
|
|
117664
|
+
nodeId: n.nodeId,
|
|
117665
|
+
sessionsNow: n.sessionsNow,
|
|
117666
|
+
unusableDevices: bad.filter((d) => d.nodeId === n.nodeId).map((d) => d.deviceKey),
|
|
117667
|
+
devices: n.devices.map((d) => ({
|
|
117668
|
+
deviceKey: d.deviceKey,
|
|
117669
|
+
sessionsNow: d.sessionsNow,
|
|
117670
|
+
usable: !bad.some((b) => b.nodeId === n.nodeId && b.deviceKey === d.deviceKey)
|
|
117671
|
+
}))
|
|
117672
|
+
}));
|
|
117673
|
+
}
|
|
117674
|
+
var SEVERITY_ORDER = {
|
|
117675
|
+
critical: 0,
|
|
117676
|
+
warning: 1,
|
|
117677
|
+
info: 2
|
|
117678
|
+
};
|
|
117679
|
+
function buildHealthDigest(state, tickMs) {
|
|
117680
|
+
const findings = [];
|
|
117681
|
+
for (const c of state.cameras) findings.push(...motionFindings(c, state.now), ...metricsFindings(c, state.now));
|
|
117682
|
+
if (state.unusableDevices !== null) findings.push(...deviceFindings(state.unusableDevices));
|
|
117683
|
+
findings.sort((a, b) => SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity]);
|
|
117684
|
+
const sources = [
|
|
117685
|
+
{
|
|
117686
|
+
source: "motion",
|
|
117687
|
+
entries: state.motionEntries
|
|
117688
|
+
},
|
|
117689
|
+
{
|
|
117690
|
+
source: "metrics",
|
|
117691
|
+
entries: state.metricsEntries
|
|
117692
|
+
},
|
|
117693
|
+
{
|
|
117694
|
+
source: "placement",
|
|
117695
|
+
entries: state.placement === null ? null : state.placement.length
|
|
117696
|
+
},
|
|
117697
|
+
{
|
|
117698
|
+
source: "inference-device-usability",
|
|
117699
|
+
entries: state.unusableDevices === null ? null : state.unusableDevices.length
|
|
117700
|
+
}
|
|
117701
|
+
];
|
|
117702
|
+
return {
|
|
117703
|
+
generatedAt: state.now,
|
|
117704
|
+
tickMs,
|
|
117705
|
+
camerasSeen: state.motionEntries === null || state.metricsEntries === null ? null : state.cameras.length,
|
|
117706
|
+
findings,
|
|
117707
|
+
nodes: state.placement === null ? [] : nodeSummaries(state.placement, state.unusableDevices),
|
|
117708
|
+
sources,
|
|
117709
|
+
notCovered: NOT_COVERED
|
|
117710
|
+
};
|
|
117711
|
+
}
|
|
117712
|
+
/** Bounded in-memory history of digests, newest first. */
|
|
117713
|
+
var HealthDigestKeeper = class {
|
|
117714
|
+
keep;
|
|
117715
|
+
digests = [];
|
|
117716
|
+
constructor(keep = 24) {
|
|
117717
|
+
this.keep = keep;
|
|
117718
|
+
}
|
|
117719
|
+
push(digest) {
|
|
117720
|
+
this.digests = [digest, ...this.digests].slice(0, this.keep);
|
|
117721
|
+
}
|
|
117722
|
+
latest() {
|
|
117723
|
+
return this.digests[0] ?? null;
|
|
117724
|
+
}
|
|
117725
|
+
recent(count) {
|
|
117726
|
+
return this.digests.slice(0, count);
|
|
117727
|
+
}
|
|
117728
|
+
};
|
|
117729
|
+
//#endregion
|
|
117730
|
+
//#region src/health-digest-tick.ts
|
|
117731
|
+
/** Latest metrics per camera, stamped on arrival. One entry per camera: bounded. */
|
|
117732
|
+
var CameraMetricsMirror = class {
|
|
117733
|
+
samples = /* @__PURE__ */ new Map();
|
|
117734
|
+
note(deviceId, metrics, at) {
|
|
117735
|
+
this.samples.set(deviceId, {
|
|
117736
|
+
phase: metrics.phase,
|
|
117737
|
+
configuredFps: metrics.configuredFps,
|
|
117738
|
+
actualFps: metrics.actualFps,
|
|
117739
|
+
avgInferenceTimeMs: metrics.avgInferenceTimeMs,
|
|
117740
|
+
queueDepth: metrics.queueDepth,
|
|
117741
|
+
droppedFrames: metrics.droppedFrames,
|
|
117742
|
+
lastSeen: at
|
|
117743
|
+
});
|
|
117744
|
+
}
|
|
117745
|
+
view() {
|
|
117746
|
+
return this.samples;
|
|
117747
|
+
}
|
|
117748
|
+
forget(deviceId) {
|
|
117749
|
+
this.samples.delete(deviceId);
|
|
117750
|
+
}
|
|
117751
|
+
reset() {
|
|
117752
|
+
this.samples.clear();
|
|
117753
|
+
}
|
|
117754
|
+
};
|
|
117755
|
+
/** Run one read; a throw is a `null` read (D393), logged, never a zero. */
|
|
117756
|
+
function attempt(deps, source, read) {
|
|
117757
|
+
try {
|
|
117758
|
+
return { value: read() };
|
|
117759
|
+
} catch (err) {
|
|
117760
|
+
deps.logger.warn("health digest: source unreadable", { meta: {
|
|
117761
|
+
source,
|
|
117762
|
+
error: err instanceof Error ? err.message : String(err)
|
|
117763
|
+
} });
|
|
117764
|
+
return { value: null };
|
|
117765
|
+
}
|
|
117766
|
+
}
|
|
117767
|
+
var HealthDigestTick = class {
|
|
117768
|
+
deps;
|
|
117769
|
+
keeper;
|
|
117770
|
+
previousIds = /* @__PURE__ */ new Map();
|
|
117771
|
+
/** Last `droppedFrames` counter per camera (a monotonic counter since attach). */
|
|
117772
|
+
previousDropped = /* @__PURE__ */ new Map();
|
|
117773
|
+
constructor(deps, keeper = new HealthDigestKeeper()) {
|
|
117774
|
+
this.deps = deps;
|
|
117775
|
+
this.keeper = keeper;
|
|
117776
|
+
}
|
|
117777
|
+
latest() {
|
|
117778
|
+
return this.keeper.latest();
|
|
117779
|
+
}
|
|
117780
|
+
recent(count) {
|
|
117781
|
+
return this.keeper.recent(count);
|
|
117782
|
+
}
|
|
117783
|
+
run() {
|
|
117784
|
+
const started = this.deps.now();
|
|
117785
|
+
const motion = attempt(this.deps, "motion", () => this.deps.readMotion(started));
|
|
117786
|
+
const metrics = attempt(this.deps, "metrics", () => this.deps.readMetrics());
|
|
117787
|
+
const placement = attempt(this.deps, "placement", () => this.deps.readPlacement());
|
|
117788
|
+
const unusable = attempt(this.deps, "inference-device-usability", () => this.deps.readUnusableDevices());
|
|
117789
|
+
const withDelta = this.withDropDeltas(metrics.value);
|
|
117790
|
+
const digest = buildHealthDigest({
|
|
117791
|
+
now: started,
|
|
117792
|
+
cameras: joinCameras(motion.value ?? [], withDelta),
|
|
117793
|
+
motionEntries: motion.value === null ? null : motion.value.length,
|
|
117794
|
+
metricsEntries: metrics.value === null ? null : metrics.value.size,
|
|
117795
|
+
placement: placement.value,
|
|
117796
|
+
unusableDevices: unusable.value
|
|
117797
|
+
}, this.deps.now() - started);
|
|
117798
|
+
this.keeper.push(digest);
|
|
117799
|
+
this.logChanges(digest);
|
|
117800
|
+
this.deps.logger.info("health digest: tick", { meta: {
|
|
117801
|
+
tickMs: digest.tickMs,
|
|
117802
|
+
calls: 4,
|
|
117803
|
+
findings: digest.findings.length,
|
|
117804
|
+
camerasSeen: digest.camerasSeen,
|
|
117805
|
+
unreadableSources: digest.sources.filter((s) => s.entries === null).length
|
|
117806
|
+
} });
|
|
117807
|
+
return digest;
|
|
117808
|
+
}
|
|
117809
|
+
/** Forget a camera's drop baseline (it was unregistered). */
|
|
117810
|
+
forget(deviceId) {
|
|
117811
|
+
this.previousDropped.delete(deviceId);
|
|
117812
|
+
}
|
|
117813
|
+
/** Turn the cumulative `droppedFrames` counters into per-tick deltas; prune departed cameras. */
|
|
117814
|
+
withDropDeltas(metrics) {
|
|
117815
|
+
const out = /* @__PURE__ */ new Map();
|
|
117816
|
+
if (metrics === null) return out;
|
|
117817
|
+
for (const [deviceId, m] of metrics) {
|
|
117818
|
+
const prev = this.previousDropped.get(deviceId);
|
|
117819
|
+
out.set(deviceId, {
|
|
117820
|
+
...m,
|
|
117821
|
+
droppedSincePreviousTick: prev === void 0 || m.droppedFrames < prev ? null : m.droppedFrames - prev
|
|
117822
|
+
});
|
|
117823
|
+
this.previousDropped.set(deviceId, m.droppedFrames);
|
|
117824
|
+
}
|
|
117825
|
+
for (const id of [...this.previousDropped.keys()]) if (!metrics.has(id)) this.previousDropped.delete(id);
|
|
117826
|
+
return out;
|
|
117827
|
+
}
|
|
117828
|
+
/** A finding is logged when it appears and when it clears, not on every tick. */
|
|
117829
|
+
logChanges(digest) {
|
|
117830
|
+
const current = /* @__PURE__ */ new Map();
|
|
117831
|
+
for (const f of digest.findings) {
|
|
117832
|
+
const deviceId = f.subject.type === "camera" ? f.subject.deviceId : null;
|
|
117833
|
+
current.set(f.id, deviceId);
|
|
117834
|
+
if (this.previousIds.has(f.id)) continue;
|
|
117835
|
+
this.deps.logger.warn("health digest: finding raised", {
|
|
117836
|
+
...deviceId !== null ? { tags: { deviceId } } : {},
|
|
117837
|
+
meta: {
|
|
117838
|
+
id: f.id,
|
|
117839
|
+
kind: f.kind,
|
|
117840
|
+
severity: f.severity,
|
|
117841
|
+
evidence: f.evidence
|
|
117842
|
+
}
|
|
117843
|
+
});
|
|
117844
|
+
}
|
|
117845
|
+
for (const [id, deviceId] of this.previousIds) {
|
|
117846
|
+
if (current.has(id)) continue;
|
|
117847
|
+
this.deps.logger.info("health digest: finding cleared", {
|
|
117848
|
+
...deviceId !== null ? { tags: { deviceId } } : {},
|
|
117849
|
+
meta: { id }
|
|
117850
|
+
});
|
|
117851
|
+
}
|
|
117852
|
+
this.previousIds = current;
|
|
117853
|
+
}
|
|
117854
|
+
};
|
|
117855
|
+
function joinCameras(motion, metrics) {
|
|
117856
|
+
const ids = new Set([...motion.map((m) => m.deviceId), ...metrics.keys()]);
|
|
117857
|
+
const byId = new Map(motion.map((m) => [m.deviceId, m]));
|
|
117858
|
+
return [...ids].map((deviceId) => {
|
|
117859
|
+
const snap = byId.get(deviceId);
|
|
117860
|
+
return {
|
|
117861
|
+
deviceId,
|
|
117862
|
+
motion: snap === void 0 ? null : snap,
|
|
117863
|
+
metrics: metrics.get(deviceId) ?? null
|
|
117864
|
+
};
|
|
117865
|
+
});
|
|
117866
|
+
}
|
|
117867
|
+
//#endregion
|
|
117387
117868
|
//#region src/device-activity-source.ts
|
|
117388
117869
|
/**
|
|
117389
117870
|
* How often a sustained LEVEL is re-emitted: half the camera's cooldown, the
|
|
@@ -127567,6 +128048,7 @@ async function buildOrchestratorControllers(deps) {
|
|
|
127567
128048
|
maintenancePaused: () => deps.maintenancePaused()
|
|
127568
128049
|
});
|
|
127569
128050
|
const blindMonitor = new DetectionBlindMonitor();
|
|
128051
|
+
const cameraMetrics = new CameraMetricsMirror();
|
|
127570
128052
|
const session = new SessionDispatchController({
|
|
127571
128053
|
onSessionEdge: (edge) => edge.edge === "open" ? blindMonitor.noteSessionOpen(edge.deviceId, edge.at) : blindMonitor.noteSessionClose(edge.deviceId, edge.at),
|
|
127572
128054
|
ledger,
|
|
@@ -128071,6 +128553,7 @@ async function buildOrchestratorControllers(deps) {
|
|
|
128071
128553
|
},
|
|
128072
128554
|
noteMetrics: (deviceId, nodeId, metrics) => {
|
|
128073
128555
|
loadShed.noteMetrics(deviceId, nodeId, metrics);
|
|
128556
|
+
cameraMetrics.note(deviceId, metrics, Date.now());
|
|
128074
128557
|
nodeStress.noteMetrics(deviceId, nodeId, metrics);
|
|
128075
128558
|
},
|
|
128076
128559
|
handleLazyAudioMotion: (deviceId, detected, config) => audio.handleLazyAudioMotion(deviceId, detected, config),
|
|
@@ -128130,6 +128613,8 @@ async function buildOrchestratorControllers(deps) {
|
|
|
128130
128613
|
audio,
|
|
128131
128614
|
settingsStore,
|
|
128132
128615
|
loadShed,
|
|
128616
|
+
blindMonitor,
|
|
128617
|
+
cameraMetrics,
|
|
128133
128618
|
nodeStress,
|
|
128134
128619
|
placement,
|
|
128135
128620
|
session,
|
|
@@ -130112,6 +130597,11 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
130112
130597
|
nodeBenchmark = null;
|
|
130113
130598
|
nodeBenchmarkStore = null;
|
|
130114
130599
|
nodeBenchmarkTimer = null;
|
|
130600
|
+
/** Health digest (planning#572): the 5-minute tick over in-memory state, and its timer. */
|
|
130601
|
+
healthDigest = null;
|
|
130602
|
+
healthDigestTimer = null;
|
|
130603
|
+
blindMonitor = null;
|
|
130604
|
+
cameraMetrics = null;
|
|
130115
130605
|
/** Measures an enabled device that has no result yet (GAP 2 of the balancing work). */
|
|
130116
130606
|
autoBenchmark = null;
|
|
130117
130607
|
/** How often the active run's runner is polled (a test seam). */
|
|
@@ -130443,6 +130933,9 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
130443
130933
|
this.audio = controllers.audio;
|
|
130444
130934
|
this.settingsStore = controllers.settingsStore;
|
|
130445
130935
|
this.loadShed = controllers.loadShed;
|
|
130936
|
+
this.blindMonitor = controllers.blindMonitor;
|
|
130937
|
+
this.cameraMetrics = controllers.cameraMetrics;
|
|
130938
|
+
this.startHealthDigest();
|
|
130446
130939
|
this.nodeStress = controllers.nodeStress;
|
|
130447
130940
|
this.placement = controllers.placement;
|
|
130448
130941
|
this.session = controllers.session;
|
|
@@ -130570,6 +131063,13 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
130570
131063
|
clearInterval(this.nodeBenchmarkTimer);
|
|
130571
131064
|
this.nodeBenchmarkTimer = null;
|
|
130572
131065
|
}
|
|
131066
|
+
if (this.healthDigestTimer !== null) {
|
|
131067
|
+
clearInterval(this.healthDigestTimer);
|
|
131068
|
+
this.healthDigestTimer = null;
|
|
131069
|
+
}
|
|
131070
|
+
this.healthDigest = null;
|
|
131071
|
+
this.blindMonitor = null;
|
|
131072
|
+
this.cameraMetrics = null;
|
|
130573
131073
|
this.autoBenchmark?.stop();
|
|
130574
131074
|
this.autoBenchmark = null;
|
|
130575
131075
|
this.nodeStressLts = null;
|
|
@@ -131794,6 +132294,37 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
131794
132294
|
});
|
|
131795
132295
|
return { success: true };
|
|
131796
132296
|
}
|
|
132297
|
+
/** Start the 5-minute health digest tick (planning#572): in-memory reads only. */
|
|
132298
|
+
startHealthDigest() {
|
|
132299
|
+
const tick = new HealthDigestTick({
|
|
132300
|
+
now: () => Date.now(),
|
|
132301
|
+
readMotion: (now) => this.blindMonitor?.snapshot(now) ?? [],
|
|
132302
|
+
readMetrics: () => {
|
|
132303
|
+
if (this.cameraMetrics === null) throw new Error("metrics mirror not ready");
|
|
132304
|
+
return this.cameraMetrics.view();
|
|
132305
|
+
},
|
|
132306
|
+
readPlacement: () => this.placementStats.snapshot(60 * 6e4).nodes,
|
|
132307
|
+
readUnusableDevices: () => this.inferenceDeviceUsability.unusableDevices(),
|
|
132308
|
+
logger: this.ctx.logger
|
|
132309
|
+
});
|
|
132310
|
+
this.healthDigest = tick;
|
|
132311
|
+
if (this.healthDigestTimer !== null) clearInterval(this.healthDigestTimer);
|
|
132312
|
+
this.healthDigestTimer = setInterval(() => {
|
|
132313
|
+
try {
|
|
132314
|
+
tick.run();
|
|
132315
|
+
} catch (err) {
|
|
132316
|
+
this.ctx.logger.warn("health digest: tick failed", { meta: { error: errMsg$2(err) } });
|
|
132317
|
+
}
|
|
132318
|
+
}, HEALTH_DIGEST_INTERVAL_MS);
|
|
132319
|
+
this.healthDigestTimer.unref?.();
|
|
132320
|
+
}
|
|
132321
|
+
async getHealthDigest(input) {
|
|
132322
|
+
const digests = this.healthDigest?.recent(input.history) ?? [];
|
|
132323
|
+
return {
|
|
132324
|
+
latest: digests[0] ?? null,
|
|
132325
|
+
previous: digests.slice(1)
|
|
132326
|
+
};
|
|
132327
|
+
}
|
|
131797
132328
|
async getPlacementStats(input) {
|
|
131798
132329
|
const snap = this.placementStats.snapshot(input.windowMs);
|
|
131799
132330
|
return {
|
|
@@ -132570,6 +133101,9 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
|
|
|
132570
133101
|
}
|
|
132571
133102
|
/** Stop detection and purge all persisted config for a removed device — thin delegate (S11 Task 3, C14). */
|
|
132572
133103
|
async handleDeviceUnregistered(deviceId) {
|
|
133104
|
+
this.blindMonitor?.forget(deviceId);
|
|
133105
|
+
this.cameraMetrics?.forget(deviceId);
|
|
133106
|
+
this.healthDigest?.forget(deviceId);
|
|
132573
133107
|
return this.detectionWiring.handleDeviceUnregistered(deviceId);
|
|
132574
133108
|
}
|
|
132575
133109
|
/** Handle a profile-slot change — thin delegate onto `DetectionWiringController` (S11 Task 3, C14). */
|
package/dist/remoteEntry.js
CHANGED
|
@@ -30,7 +30,7 @@ async function d(e) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
async function f() {
|
|
33
|
-
return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-
|
|
33
|
+
return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-lxOEYPRA.mjs")).catch((e) => {
|
|
34
34
|
throw l = void 0, e;
|
|
35
35
|
}), l;
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-pipeline-orchestrator",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.693",
|
|
4
4
|
"description": "Hub-side camera-to-agent load balancer — tracks runner capacity and dispatches attachCamera calls to the optimal pipeline-runner instance",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
}
|
|
77
77
|
],
|
|
78
78
|
"requires": {
|
|
79
|
-
"server": ">=1.2.
|
|
79
|
+
"server": ">=1.2.886"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"files": [
|