@camstack/addon-osd-manager 0.1.138 → 0.1.140
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/{MotionZonesSettings-DAj9BKEa.mjs → MotionZonesSettings-C80efbgF.mjs} +2 -2
- package/dist/{PrivacyMaskSettings-vXcp9vB2.mjs → PrivacyMaskSettings-CvVdYFwr.mjs} +4 -4
- package/dist/{SceneMonitorEditor-DT_0sAwx.mjs → SceneMonitorEditor-CkIz3-13.mjs} +3 -3
- package/dist/_stub.js +11 -11
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-CMdv28lH.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-DaUqGaKC.mjs} +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DG3UFggb.mjs +26 -0
- package/dist/{hostInit-VlmwYq1r.mjs → hostInit-Bkk-9STE.mjs} +2 -2
- package/dist/index.js +2047 -1364
- package/dist/index.mjs +2047 -1364
- package/dist/{player-overlays-C-UoK7-y.mjs → player-overlays-CbLYEs-S.mjs} +1 -1
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive--rRptNaI.mjs → responsive-BghmipTp.mjs} +1 -1
- package/dist/{scene-monitor-copy-CODV9mw1.mjs → scene-monitor-copy-Cpz17vjT.mjs} +1 -1
- package/dist/{square-BZnt2TOu.mjs → square-D-Qx_njd.mjs} +1 -1
- package/dist/{trash-2-C1vqC31x.mjs → trash-2-cC4gYobQ.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-D-_aQIjJ.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-Dao979S_.mjs} +1 -1
- package/package.json +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CsJH8KoP.mjs +0 -26
package/dist/index.js
CHANGED
|
@@ -5363,7 +5363,7 @@ var ZodIssueCode = {
|
|
|
5363
5363
|
var ZodFirstPartyTypeKind;
|
|
5364
5364
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5365
5365
|
//#endregion
|
|
5366
|
-
//#region ../types/dist/sleep-
|
|
5366
|
+
//#region ../types/dist/sleep-BaRu0bS5.mjs
|
|
5367
5367
|
/**
|
|
5368
5368
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5369
5369
|
* window to float samples (D455).
|
|
@@ -9530,7 +9530,7 @@ var ModelFormatEntrySchema = object({
|
|
|
9530
9530
|
/** Multi-file payload (directory members or sibling files). */
|
|
9531
9531
|
files: array(string()).readonly().optional(),
|
|
9532
9532
|
/** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
|
|
9533
|
-
runtimes: array(_enum(["
|
|
9533
|
+
runtimes: array(_enum(["python"])).readonly().optional()
|
|
9534
9534
|
});
|
|
9535
9535
|
/**
|
|
9536
9536
|
* Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
|
|
@@ -9611,10 +9611,17 @@ var ModelCatalogEntrySchema = object({
|
|
|
9611
9611
|
inputChannels: number().int().positive().optional(),
|
|
9612
9612
|
labels: array(LabelDefinitionSchema).readonly(),
|
|
9613
9613
|
inputLayout: _enum(["nchw", "nhwc"]).optional(),
|
|
9614
|
+
/**
|
|
9615
|
+
* `'scrfd'` applies InsightFace's SCRFD input contract, `(x - 127.5) / 128`
|
|
9616
|
+
* (upstream `insightface/model_zoo/scrfd.py`), instead of the historical
|
|
9617
|
+
* plain `/255`. Measured against COCO GT: 188 → 196 faces found on the
|
|
9618
|
+
* `scrfd-2.5g` catalog entry (2026-09-26 model-replacement spike, §2.4-2).
|
|
9619
|
+
*/
|
|
9614
9620
|
inputNormalization: _enum([
|
|
9615
9621
|
"zero-one",
|
|
9616
9622
|
"imagenet",
|
|
9617
|
-
"none"
|
|
9623
|
+
"none",
|
|
9624
|
+
"scrfd"
|
|
9618
9625
|
]).optional(),
|
|
9619
9626
|
/**
|
|
9620
9627
|
* The model already applies softmax IN-GRAPH — its raw output is a
|
|
@@ -9716,7 +9723,8 @@ var ModelConvertMetadataSchema = object({
|
|
|
9716
9723
|
inputNormalization: _enum([
|
|
9717
9724
|
"zero-one",
|
|
9718
9725
|
"imagenet",
|
|
9719
|
-
"none"
|
|
9726
|
+
"none",
|
|
9727
|
+
"scrfd"
|
|
9720
9728
|
]).optional(),
|
|
9721
9729
|
preprocessMode: _enum(["letterbox", "resize"]).optional(),
|
|
9722
9730
|
outputFormat: _enum([
|
|
@@ -19531,6 +19539,9 @@ var NcSystemEventKindSchema = _enum([
|
|
|
19531
19539
|
"device-battery-normal",
|
|
19532
19540
|
"device-consumable-low",
|
|
19533
19541
|
"device-consumable-normal",
|
|
19542
|
+
"device-tank-low",
|
|
19543
|
+
"device-tank-full",
|
|
19544
|
+
"device-tank-normal",
|
|
19534
19545
|
"stream-online",
|
|
19535
19546
|
"stream-offline",
|
|
19536
19547
|
"node-online",
|
|
@@ -19568,6 +19579,29 @@ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
|
|
|
19568
19579
|
]);
|
|
19569
19580
|
NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
|
|
19570
19581
|
/**
|
|
19582
|
+
* The panel's transitions, as ONE list.
|
|
19583
|
+
*
|
|
19584
|
+
* Named here rather than spelled out at each of the four sites that need them
|
|
19585
|
+
* (the emitter, the intake, the editor group, the combined-notification gate),
|
|
19586
|
+
* because a transition added to the enum and forgotten at one of them is an
|
|
19587
|
+
* alarm state nobody can be notified about. That is exactly what this list
|
|
19588
|
+
* failed to prevent while it held three: `alarm-arming` was the fourth.
|
|
19589
|
+
*
|
|
19590
|
+
* In LIFECYCLE order, which is the order an editor lists them in and the order
|
|
19591
|
+
* a person experiences them — not the order they were added.
|
|
19592
|
+
*/
|
|
19593
|
+
var NC_ALARM_SYSTEM_EVENT_KINDS = [
|
|
19594
|
+
"alarm-arm-refused",
|
|
19595
|
+
"alarm-check-failed",
|
|
19596
|
+
"alarm-arming",
|
|
19597
|
+
"alarm-armed",
|
|
19598
|
+
"alarm-pending",
|
|
19599
|
+
"alarm-triggered",
|
|
19600
|
+
"alarm-rearmed",
|
|
19601
|
+
"alarm-sensor-bypass",
|
|
19602
|
+
"alarm-disarmed"
|
|
19603
|
+
];
|
|
19604
|
+
/**
|
|
19571
19605
|
* One coherent system-event condition. `kinds` is the required opt-in safety
|
|
19572
19606
|
* gate; the remaining lists are optional narrowing filters relevant to the
|
|
19573
19607
|
* selected kinds.
|
|
@@ -19601,7 +19635,22 @@ var NcSystemEventConditionSchema = object({
|
|
|
19601
19635
|
*/
|
|
19602
19636
|
excludeDeviceIds: array(number().int()).min(1).optional(),
|
|
19603
19637
|
nodeIds: array(string().min(1)).min(1).optional(),
|
|
19604
|
-
packageNames: array(string().min(1)).min(1).optional()
|
|
19638
|
+
packageNames: array(string().min(1)).min(1).optional(),
|
|
19639
|
+
/**
|
|
19640
|
+
* At or below this remaining-life %, a consumable is LOW for THIS rule
|
|
19641
|
+
* (D642). Absent = {@link NC_CONSUMABLE_LOW_PERCENT_DEFAULT}; at most
|
|
19642
|
+
* {@link NC_CONSUMABLE_LOW_PERCENT_MAX}, so every episode can recover. Scoped to the
|
|
19643
|
+
* consumable kinds (`systemEventFilterApplies`) and to the device-events
|
|
19644
|
+
* family; ignored on every other kind.
|
|
19645
|
+
*
|
|
19646
|
+
* It is a property of the RULE because the operator decided so: a rule at
|
|
19647
|
+
* 25 must be told about a filter at 20 %, a rule at 10 must not. The hub
|
|
19648
|
+
* keeps one episode per (threshold, device, item) — its own hysteresis, its
|
|
19649
|
+
* own reminder — and a rule hears only the episode judged at ITS threshold,
|
|
19650
|
+
* exactly as an occupancy rule hears only the edge of its own count. A
|
|
19651
|
+
* provider's own `replace` verdict is low at every threshold.
|
|
19652
|
+
*/
|
|
19653
|
+
consumableLowPercent: number().int().min(1).max(95).optional()
|
|
19605
19654
|
});
|
|
19606
19655
|
/** Hard ceiling on a window (24h). A snooze that could not expire would be an
|
|
19607
19656
|
* outage the operator asked for once and forgot. */
|
|
@@ -19619,6 +19668,25 @@ var NcScheduleSchema = object({
|
|
|
19619
19668
|
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
19620
19669
|
invert: boolean().optional()
|
|
19621
19670
|
});
|
|
19671
|
+
/**
|
|
19672
|
+
* How a system-event rule of the `device-events` or `system` family speaks
|
|
19673
|
+
* (D647): at once, per event (`instant`, the only behaviour before D647), or
|
|
19674
|
+
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
19675
|
+
*/
|
|
19676
|
+
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
19677
|
+
/**
|
|
19678
|
+
* `summary`: the rule sends NOTHING per event. When a window of `schedule`
|
|
19679
|
+
* CLOSES, it sends one notification with the current state of its kinds
|
|
19680
|
+
* (low batteries, consumables to replace, devices offline, updates
|
|
19681
|
+
* available, ...), after its own filters. Nothing to report sends nothing.
|
|
19682
|
+
* The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
|
|
19683
|
+
* midnight crossing); the send time is each window's END. Refused on the
|
|
19684
|
+
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
19685
|
+
*/
|
|
19686
|
+
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
|
|
19687
|
+
mode: literal("summary"),
|
|
19688
|
+
schedule: NcScheduleSchema
|
|
19689
|
+
})]);
|
|
19622
19690
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
19623
19691
|
var NcPlateMatcherSchema = object({
|
|
19624
19692
|
/**
|
|
@@ -19744,6 +19812,16 @@ var NcCrossingSchema = _enum([
|
|
|
19744
19812
|
"exit",
|
|
19745
19813
|
"any"
|
|
19746
19814
|
]);
|
|
19815
|
+
/**
|
|
19816
|
+
* Which edge of a BOOLEAN sensor fires a device-event rule (D640).
|
|
19817
|
+
* - `raised` — the sensor went high: water detected, smoke, open, tampered.
|
|
19818
|
+
* - `cleared` — it went back: dry, clear, closed.
|
|
19819
|
+
* - absent — both edges, which is what every rule authored before this did.
|
|
19820
|
+
*
|
|
19821
|
+
* There is no third member for "both": absence already says it, and a value
|
|
19822
|
+
* that means the same as absence is a second way to write one rule.
|
|
19823
|
+
*/
|
|
19824
|
+
var NcSensorTransitionSchema = _enum(["raised", "cleared"]);
|
|
19747
19825
|
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
19748
19826
|
var NcZoneConditionSchema = object({
|
|
19749
19827
|
ids: array(string().min(1)).min(1),
|
|
@@ -19933,6 +20011,20 @@ var NcConditionsSchema = object({
|
|
|
19933
20011
|
scene: NcSceneConditionSchema.optional(),
|
|
19934
20012
|
/** Device scope — absent = all devices. */
|
|
19935
20013
|
devices: array(number()).optional(),
|
|
20014
|
+
/**
|
|
20015
|
+
* Device EXCLUSION (D641) — "every device except these". Judged on the SAME
|
|
20016
|
+
* subject ids {@link devices} is judged on (the camera, the sensor that
|
|
20017
|
+
* fired, a linked set's sensor and row cameras), so a sensor fanned out per
|
|
20018
|
+
* linked camera is excluded exactly where an include would have tested it.
|
|
20019
|
+
* `min(1)`: an empty exclusion excludes nothing and is written as absent.
|
|
20020
|
+
*
|
|
20021
|
+
* Not for `system-event` rules — those carry their own
|
|
20022
|
+
* `systemEvent.excludeDeviceIds` (D636), and the hub refuses this key there.
|
|
20023
|
+
* Editors present the two lists as ONE field (All | Only these | All except
|
|
20024
|
+
* these); the engine evaluates each independently, so a legacy rule
|
|
20025
|
+
* carrying both still means "these, minus those".
|
|
20026
|
+
*/
|
|
20027
|
+
devicesExclude: array(number()).min(1).optional(),
|
|
19936
20028
|
/** Detector class names (any overlap with the record's class set). */
|
|
19937
20029
|
classes: array(string().min(1)).optional(),
|
|
19938
20030
|
/** Veto classes — any overlap fails the rule. */
|
|
@@ -20066,6 +20158,16 @@ var NcConditionsSchema = object({
|
|
|
20066
20158
|
*/
|
|
20067
20159
|
sensorKinds: array(string().min(1)).optional(),
|
|
20068
20160
|
/**
|
|
20161
|
+
* DEVICE-EVENT only (D640). Fire on one edge of a boolean sensor —
|
|
20162
|
+
* {@link NcSensorTransitionSchema}. Which field of the slice means "raised"
|
|
20163
|
+
* is `@camstack/types` → `notification/sensor-raised.ts`. A reading the
|
|
20164
|
+
* engine cannot place (a kind with no raise, an unreadable slice) PASSES:
|
|
20165
|
+
* the condition fails open towards notifying, never towards silence. Editors
|
|
20166
|
+
* offer it only when every chosen {@link sensorKinds} member has a raise
|
|
20167
|
+
* (`sensorTransitionOffered`), and the hub refuses it on any other delivery.
|
|
20168
|
+
*/
|
|
20169
|
+
sensorTransition: NcSensorTransitionSchema.optional(),
|
|
20170
|
+
/**
|
|
20069
20171
|
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
20070
20172
|
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
20071
20173
|
* when the subject's phase does not match (a subject always carries a phase
|
|
@@ -20320,6 +20422,16 @@ var NcRuleInputSchema = object({
|
|
|
20320
20422
|
delivery: NcDeliverySchema,
|
|
20321
20423
|
conditions: NcConditionsSchema.default({}),
|
|
20322
20424
|
schedule: NcScheduleSchema.optional(),
|
|
20425
|
+
/**
|
|
20426
|
+
* A `device-events` / `system` rule's delivery (D647): absent or `instant`
|
|
20427
|
+
* is a notification per event; `summary` is one state summary per closed
|
|
20428
|
+
* window of its schedule. `.optional()` and never defaulted: absent must
|
|
20429
|
+
* keep meaning what every rule authored before D647 meant, with no
|
|
20430
|
+
* migration. Top-level rather than inside `conditions.systemEvent`, so a
|
|
20431
|
+
* client that does not know it (an older viewer re-sending `conditions`
|
|
20432
|
+
* whole) leaves it standing through the store's patch merge.
|
|
20433
|
+
*/
|
|
20434
|
+
systemEventDelivery: NcSystemEventDeliverySchema.optional(),
|
|
20323
20435
|
/** May be empty when `targetUsers` addresses at least one user — the
|
|
20324
20436
|
* "at least one addressee" invariant is enforced by the provider, because
|
|
20325
20437
|
* a cross-field refine here would break `NcRulePatchSchema.partial()`. */
|
|
@@ -20548,6 +20660,28 @@ var NcRuleSchema = NcRuleInputSchema.extend({
|
|
|
20548
20660
|
*/
|
|
20549
20661
|
disabledTargetIds: array(string()).default([])
|
|
20550
20662
|
});
|
|
20663
|
+
/** One section of a previewed state summary. `unavailable` = its state could not be read. */
|
|
20664
|
+
var NcStateSummaryPreviewSectionSchema = object({
|
|
20665
|
+
id: string(),
|
|
20666
|
+
status: _enum(["read", "unavailable"]),
|
|
20667
|
+
items: number().int().nonnegative(),
|
|
20668
|
+
reason: string().optional()
|
|
20669
|
+
});
|
|
20670
|
+
/**
|
|
20671
|
+
* The summary a rule would send now. `empty` = nothing to report and every
|
|
20672
|
+
* section read: such a summary is NOT sent. `dropped` counts the open states
|
|
20673
|
+
* the rule's own filters (or a camera mute) left out, by reason.
|
|
20674
|
+
* `excludedGroups` names the kind groups selected that have no state to report
|
|
20675
|
+
* (backups & exports).
|
|
20676
|
+
*/
|
|
20677
|
+
var NcStateSummaryPreviewSchema = object({
|
|
20678
|
+
empty: boolean(),
|
|
20679
|
+
count: number().int().nonnegative(),
|
|
20680
|
+
text: string(),
|
|
20681
|
+
sections: array(NcStateSummaryPreviewSectionSchema),
|
|
20682
|
+
dropped: record(string(), number().int().nonnegative()),
|
|
20683
|
+
excludedGroups: array(string())
|
|
20684
|
+
});
|
|
20551
20685
|
var NcTestResultSchema = object({
|
|
20552
20686
|
recordId: string(),
|
|
20553
20687
|
recordKind: _enum([
|
|
@@ -20639,6 +20773,13 @@ var NcTemplateVarDescriptorSchema = object({
|
|
|
20639
20773
|
kinds: array(NcTemplateVarKindSchema).optional(),
|
|
20640
20774
|
deliveries: array(NcDeliverySchema).optional(),
|
|
20641
20775
|
systemEventKinds: array(NcSystemEventKindSchema).optional(),
|
|
20776
|
+
/**
|
|
20777
|
+
* Which system-event DELIVERY has a value for it (D647). Absent = an
|
|
20778
|
+
* instant row only when the descriptor names `systemEventKinds` (a
|
|
20779
|
+
* per-event fact: a summary row has no single device), and both otherwise.
|
|
20780
|
+
* `['summary']` marks the state-summary vocabulary (`{{summaryText}}`, ...).
|
|
20781
|
+
*/
|
|
20782
|
+
systemEventDeliveries: array(NcSystemEventDeliveryModeSchema).optional(),
|
|
20642
20783
|
dynamic: object({
|
|
20643
20784
|
prefix: literal("count_"),
|
|
20644
20785
|
from: literal("classes")
|
|
@@ -20651,7 +20792,9 @@ var NcTemplatePreviewInputSchema = object({
|
|
|
20651
20792
|
field: NcTemplateFieldSchema,
|
|
20652
20793
|
kind: NcRuleKindSchema.optional(),
|
|
20653
20794
|
delivery: NcDeliverySchema.optional(),
|
|
20654
|
-
systemEventKinds: array(NcSystemEventKindSchema).optional()
|
|
20795
|
+
systemEventKinds: array(NcSystemEventKindSchema).optional(),
|
|
20796
|
+
/** The rule's system-event delivery (D647); absent = instant. */
|
|
20797
|
+
systemEventDelivery: NcSystemEventDeliveryModeSchema.optional()
|
|
20655
20798
|
}),
|
|
20656
20799
|
template: object({
|
|
20657
20800
|
title: string().max(500).optional(),
|
|
@@ -20684,6 +20827,7 @@ var NcConditionDescriptorSchema = object({
|
|
|
20684
20827
|
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
20685
20828
|
valueType: _enum([
|
|
20686
20829
|
"deviceIdList",
|
|
20830
|
+
"deviceIdExcludeList",
|
|
20687
20831
|
"stringList",
|
|
20688
20832
|
"number01",
|
|
20689
20833
|
"number",
|
|
@@ -20694,6 +20838,7 @@ var NcConditionDescriptorSchema = object({
|
|
|
20694
20838
|
"plateMatcher",
|
|
20695
20839
|
"packagePhase",
|
|
20696
20840
|
"crossingSelect",
|
|
20841
|
+
"sensorTransition",
|
|
20697
20842
|
"polygonDraw",
|
|
20698
20843
|
"occupancy",
|
|
20699
20844
|
"audio",
|
|
@@ -20827,6 +20972,18 @@ var NC_CONDITION_CATALOG = [
|
|
|
20827
20972
|
value: "device-consumable-normal",
|
|
20828
20973
|
label: "Consumable replaced"
|
|
20829
20974
|
},
|
|
20975
|
+
{
|
|
20976
|
+
value: "device-tank-low",
|
|
20977
|
+
label: "Tank low (water, detergent)"
|
|
20978
|
+
},
|
|
20979
|
+
{
|
|
20980
|
+
value: "device-tank-full",
|
|
20981
|
+
label: "Tank full (dirty water, dust)"
|
|
20982
|
+
},
|
|
20983
|
+
{
|
|
20984
|
+
value: "device-tank-normal",
|
|
20985
|
+
label: "Tank back to normal"
|
|
20986
|
+
},
|
|
20830
20987
|
{
|
|
20831
20988
|
value: "export-completed",
|
|
20832
20989
|
label: "Export completed"
|
|
@@ -20892,6 +21049,21 @@ var NC_CONDITION_CATALOG = [
|
|
|
20892
21049
|
phase: "P1",
|
|
20893
21050
|
description: "Restrict the rule to these devices; absent = all devices. A sensor event matches either the SENSOR that fired or the camera it is attributed to, so a rule may name either one."
|
|
20894
21051
|
},
|
|
21052
|
+
{
|
|
21053
|
+
id: "devicesExclude",
|
|
21054
|
+
group: "scope",
|
|
21055
|
+
label: "Excluded devices",
|
|
21056
|
+
valueType: "deviceIdExcludeList",
|
|
21057
|
+
operator: "notIn",
|
|
21058
|
+
appliesTo: [
|
|
21059
|
+
"immediate",
|
|
21060
|
+
"track-end",
|
|
21061
|
+
"device-event",
|
|
21062
|
+
"package-event"
|
|
21063
|
+
],
|
|
21064
|
+
phase: "P1",
|
|
21065
|
+
description: "Every device except these. Judged on the same device ids as Devices: a sensor event is excluded by the SENSOR that fired or by the camera it is attributed to."
|
|
21066
|
+
},
|
|
20895
21067
|
{
|
|
20896
21068
|
id: "classes",
|
|
20897
21069
|
group: "class",
|
|
@@ -21148,6 +21320,33 @@ var NC_CONDITION_CATALOG = [
|
|
|
21148
21320
|
phase: "P1",
|
|
21149
21321
|
description: "Raw device event-type tokens (e.g. doorbell press / press_long) from the event-emitter slice; absent on doorbell-pulse / passive sensors."
|
|
21150
21322
|
},
|
|
21323
|
+
{
|
|
21324
|
+
id: "sensorTransition",
|
|
21325
|
+
group: "device",
|
|
21326
|
+
label: "Notify when",
|
|
21327
|
+
valueType: "sensorTransition",
|
|
21328
|
+
options: [
|
|
21329
|
+
{
|
|
21330
|
+
value: "",
|
|
21331
|
+
label: "It triggers and when it clears",
|
|
21332
|
+
hint: "Every change: water detected, and back to dry."
|
|
21333
|
+
},
|
|
21334
|
+
{
|
|
21335
|
+
value: "raised",
|
|
21336
|
+
label: "Only when it triggers",
|
|
21337
|
+
hint: "Water detected, smoke, a contact opening — never the return to normal."
|
|
21338
|
+
},
|
|
21339
|
+
{
|
|
21340
|
+
value: "cleared",
|
|
21341
|
+
label: "Only when it clears",
|
|
21342
|
+
hint: "Back to dry, smoke gone, a contact closing — never the alert itself."
|
|
21343
|
+
}
|
|
21344
|
+
],
|
|
21345
|
+
operator: "in",
|
|
21346
|
+
appliesTo: ["device-event"],
|
|
21347
|
+
phase: "P2",
|
|
21348
|
+
description: "Fire on one edge of a boolean sensor. Offered only when every chosen sensor kind raises and clears; a reading that cannot be placed still notifies."
|
|
21349
|
+
},
|
|
21151
21350
|
{
|
|
21152
21351
|
id: "packagePhase",
|
|
21153
21352
|
group: "package",
|
|
@@ -21331,6 +21530,28 @@ var NcHistoryFilterSchema = object({
|
|
|
21331
21530
|
limit: number().int().min(1).max(500).default(100)
|
|
21332
21531
|
});
|
|
21333
21532
|
/**
|
|
21533
|
+
* Every rule's last run, in one answer.
|
|
21534
|
+
*
|
|
21535
|
+
* A rule ABSENT from `runs` produced no delivery inside `horizonMs` — how far
|
|
21536
|
+
* back this answer looked, in ms before the hub's now. It is the outbox prune
|
|
21537
|
+
* window (7 days by default, operator-configurable), NARROWED when the read hit
|
|
21538
|
+
* its row bound: the answer never claims a window it did not read. `null` means
|
|
21539
|
+
* the operator keeps the outbox forever AND the read reached its end, so absent
|
|
21540
|
+
* means "never on record". A UI derives its "not in the last N days" from this
|
|
21541
|
+
* value, never from a constant — and only when the call ANSWERED (D315).
|
|
21542
|
+
*/
|
|
21543
|
+
var NcRuleLastRunsSchema = object({
|
|
21544
|
+
runs: array(object({
|
|
21545
|
+
ruleId: string(),
|
|
21546
|
+
/** Fire time of the newest row (`createdAt`, epoch ms). */
|
|
21547
|
+
lastAt: number(),
|
|
21548
|
+
status: NcHistoryStatusSchema,
|
|
21549
|
+
/** The camera/device of that row (a digest row files under its first camera). */
|
|
21550
|
+
deviceId: number()
|
|
21551
|
+
})),
|
|
21552
|
+
horizonMs: number().nonnegative().nullable()
|
|
21553
|
+
});
|
|
21554
|
+
/**
|
|
21334
21555
|
* What a snooze covers. Broader scopes win when several overlap, so one window
|
|
21335
21556
|
* leaves ONE digest rather than a rule snooze and a whole-feed snooze both
|
|
21336
21557
|
* summarising the same silence.
|
|
@@ -21511,6 +21732,14 @@ var NcAlarmModeCoverageSchema = object({
|
|
|
21511
21732
|
/** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
|
|
21512
21733
|
deviceIds: array(number().int()),
|
|
21513
21734
|
/**
|
|
21735
|
+
* D641: the ids NOT covered although `allDevices` is true — every unscoped
|
|
21736
|
+
* covering rule EXCLUDES them (`conditions.devicesExclude`) and no named rule
|
|
21737
|
+
* covers them. Always `[]` when `allDevices` is false. Excluded by the rules,
|
|
21738
|
+
* which is not the same as skipped by a switch: never in `skippedDevices`.
|
|
21739
|
+
* Defaulted so an answer computed before this field parses as "none".
|
|
21740
|
+
*/
|
|
21741
|
+
allDevicesExcept: array(number().int()).default([]),
|
|
21742
|
+
/**
|
|
21514
21743
|
* Devices this mode NAMES but cannot actually arm, each with the switch that
|
|
21515
21744
|
* excludes it.
|
|
21516
21745
|
*
|
|
@@ -21698,6 +21927,17 @@ var notificationRulesCapability = {
|
|
|
21698
21927
|
auth: "admin"
|
|
21699
21928
|
}),
|
|
21700
21929
|
/**
|
|
21930
|
+
* The STATE SUMMARY a system rule would send now (D647) — for a saved rule
|
|
21931
|
+
* or an unsaved draft. Pure: sends nothing, stamps nothing. A MUTATION
|
|
21932
|
+
* only for transport (a whole rule does not belong in a GET URL). Admin,
|
|
21933
|
+
* like `testRule`: it names devices and nodes across the installation.
|
|
21934
|
+
*/
|
|
21935
|
+
previewStateSummary: method(object({ rule: NcRuleInputSchema }), NcStateSummaryPreviewSchema, {
|
|
21936
|
+
kind: "mutation",
|
|
21937
|
+
auth: "admin",
|
|
21938
|
+
access: "view"
|
|
21939
|
+
}),
|
|
21940
|
+
/**
|
|
21701
21941
|
* The machine-readable condition surface a rule editor renders from, plus
|
|
21702
21942
|
* the picker VOCABULARY those conditions draw on.
|
|
21703
21943
|
*
|
|
@@ -21734,6 +21974,15 @@ var notificationRulesCapability = {
|
|
|
21734
21974
|
*/
|
|
21735
21975
|
getHistory: method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }),
|
|
21736
21976
|
/**
|
|
21977
|
+
* The newest delivery of every rule, in ONE bounded read of the outbox —
|
|
21978
|
+
* the "Last run" column. Never a `getHistory` per rule. A rule with no
|
|
21979
|
+
* delivery inside `horizonMs` is absent from `runs`; see
|
|
21980
|
+
* {@link NcRuleLastRunsSchema} for what absent means. A store that cannot
|
|
21981
|
+
* answer FAILS the call rather than answering "nothing ran". Admin-only,
|
|
21982
|
+
* like `getHistory`, of which it is a projection.
|
|
21983
|
+
*/
|
|
21984
|
+
getRuleLastRuns: method(object({}), NcRuleLastRunsSchema, { auth: "admin" }),
|
|
21985
|
+
/**
|
|
21737
21986
|
* Mint a fresh, externally-reachable URL for one artefact a history row
|
|
21738
21987
|
* named in {@link NcHistoryEntrySchema.shape.artifactIds} — the SAME
|
|
21739
21988
|
* signed-link mechanism the dispatcher uses to attach media to an
|
|
@@ -22149,1019 +22398,195 @@ var oauthIntegrationCapability = {
|
|
|
22149
22398
|
getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
|
|
22150
22399
|
};
|
|
22151
22400
|
/**
|
|
22152
|
-
*
|
|
22153
|
-
*
|
|
22154
|
-
*
|
|
22401
|
+
* pipeline-analytics — device-scoped wrapper cap. Refines raw
|
|
22402
|
+
* per-frame detections emitted by the pipeline runner into tracked
|
|
22403
|
+
* objects, per-kind event collections (motion / object / audio), and
|
|
22404
|
+
* persisted media. Owns the post-detection domain end-to-end:
|
|
22405
|
+
*
|
|
22406
|
+
* runner emits PipelineInferenceResult
|
|
22407
|
+
* ↓ (event bus)
|
|
22408
|
+
* pipeline-analytics subscriber
|
|
22409
|
+
* ↓ SORT tracker + zone engine + state analyzer + event emitter
|
|
22410
|
+
* → three DB collections (one per kind), one FS media tree, one
|
|
22411
|
+
* unified event emitter (FrameTracked + TrackStarted/Ended +
|
|
22412
|
+
* DetectionEvent on bus)
|
|
22413
|
+
*
|
|
22414
|
+
* Pure subscriber model. No `processFrame` cap method — the runner
|
|
22415
|
+
* already publishes the raw frame on the bus. The cap surface is
|
|
22416
|
+
* only QUERIES + per-device settings, bound on/off via
|
|
22417
|
+
* `device-manager.setWrapperActive`. `defaultActive: true` because
|
|
22418
|
+
* every camera with a detection pipeline wants its raw detections
|
|
22419
|
+
* refined; operators opt out per-device via BindingsTab when needed.
|
|
22420
|
+
*
|
|
22421
|
+
* Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
|
|
22422
|
+
* (per-device surface) and `track-trail` caps — see P11 cleanup.
|
|
22155
22423
|
*/
|
|
22156
|
-
var
|
|
22157
|
-
|
|
22158
|
-
|
|
22159
|
-
|
|
22160
|
-
|
|
22161
|
-
|
|
22162
|
-
|
|
22163
|
-
|
|
22164
|
-
|
|
22165
|
-
|
|
22166
|
-
|
|
22167
|
-
|
|
22168
|
-
crop: object({
|
|
22169
|
-
left: number(),
|
|
22170
|
-
top: number(),
|
|
22171
|
-
width: number().positive(),
|
|
22172
|
-
height: number().positive()
|
|
22173
|
-
}).optional(),
|
|
22174
|
-
content: object({
|
|
22175
|
-
width: number().int().positive(),
|
|
22176
|
-
height: number().int().positive()
|
|
22177
|
-
}),
|
|
22178
|
-
fit: _enum(["stretch", "contain"]),
|
|
22179
|
-
format: _enum([
|
|
22180
|
-
"rgb",
|
|
22181
|
-
"gray",
|
|
22182
|
-
"jpeg"
|
|
22183
|
-
])
|
|
22184
|
-
});
|
|
22424
|
+
var TrackStateSchema = _enum([
|
|
22425
|
+
"new",
|
|
22426
|
+
"entered",
|
|
22427
|
+
"left",
|
|
22428
|
+
"moving",
|
|
22429
|
+
"idle"
|
|
22430
|
+
]);
|
|
22431
|
+
var EventKindSchema = _enum([
|
|
22432
|
+
"motion",
|
|
22433
|
+
"object",
|
|
22434
|
+
"audio"
|
|
22435
|
+
]);
|
|
22185
22436
|
/**
|
|
22186
|
-
*
|
|
22187
|
-
*
|
|
22188
|
-
*
|
|
22437
|
+
* Spatial filter for `listTracks` — the rect + polygon variants of the shared
|
|
22438
|
+
* MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
|
|
22439
|
+
* of the camera frame (top-left origin), matching the drawing-plane editor.
|
|
22189
22440
|
*/
|
|
22190
|
-
var
|
|
22191
|
-
|
|
22192
|
-
|
|
22193
|
-
|
|
22194
|
-
|
|
22195
|
-
|
|
22196
|
-
|
|
22197
|
-
|
|
22198
|
-
|
|
22199
|
-
|
|
22200
|
-
"
|
|
22201
|
-
"
|
|
22202
|
-
"
|
|
22203
|
-
"
|
|
22204
|
-
"
|
|
22205
|
-
"gguf"
|
|
22441
|
+
var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
|
|
22442
|
+
/** Closed icon vocabulary so clients render a known glyph per kind. */
|
|
22443
|
+
var EventKindIconSchema = _enum([
|
|
22444
|
+
"motion",
|
|
22445
|
+
"audio",
|
|
22446
|
+
"person",
|
|
22447
|
+
"vehicle",
|
|
22448
|
+
"animal",
|
|
22449
|
+
"door",
|
|
22450
|
+
"pir",
|
|
22451
|
+
"smoke",
|
|
22452
|
+
"water",
|
|
22453
|
+
"button",
|
|
22454
|
+
"package",
|
|
22455
|
+
"generic"
|
|
22206
22456
|
]);
|
|
22207
|
-
var
|
|
22208
|
-
"
|
|
22209
|
-
"
|
|
22210
|
-
"
|
|
22211
|
-
"
|
|
22212
|
-
"
|
|
22457
|
+
var EventKindCategorySchema = _enum([
|
|
22458
|
+
"motion",
|
|
22459
|
+
"audio",
|
|
22460
|
+
"detection",
|
|
22461
|
+
"sensor",
|
|
22462
|
+
"control",
|
|
22463
|
+
"custom",
|
|
22464
|
+
"package"
|
|
22213
22465
|
]);
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
|
|
22219
|
-
|
|
22220
|
-
|
|
22221
|
-
|
|
22222
|
-
devices: array(object({
|
|
22223
|
-
id: string(),
|
|
22224
|
-
label: string(),
|
|
22225
|
-
description: string().optional()
|
|
22226
|
-
})).readonly(),
|
|
22227
|
-
defaultDevice: string()
|
|
22228
|
-
});
|
|
22229
|
-
var PipelineDefaultStepSchema = lazy(() => object({
|
|
22230
|
-
addonId: string(),
|
|
22231
|
-
addonName: string(),
|
|
22232
|
-
slot: PipelineSlotSchema,
|
|
22233
|
-
inputClasses: array(string()).readonly(),
|
|
22234
|
-
outputClasses: array(string()).readonly(),
|
|
22235
|
-
enabled: boolean(),
|
|
22236
|
-
modelId: string(),
|
|
22237
|
-
children: array(PipelineDefaultStepSchema).readonly(),
|
|
22238
|
-
group: string().optional(),
|
|
22239
|
-
settings: record(string(), unknown()).optional()
|
|
22240
|
-
}));
|
|
22241
|
-
var PipelineTemplateStepSchema = lazy(() => object({
|
|
22242
|
-
addonId: string(),
|
|
22243
|
-
enabled: boolean(),
|
|
22244
|
-
modelId: string(),
|
|
22245
|
-
children: array(PipelineTemplateStepSchema).readonly(),
|
|
22246
|
-
settings: record(string(), unknown()).optional()
|
|
22247
|
-
}));
|
|
22248
|
-
var PipelineTemplateSchema$1 = object({
|
|
22249
|
-
id: string(),
|
|
22250
|
-
name: string(),
|
|
22251
|
-
createdAt: string(),
|
|
22252
|
-
updatedAt: string(),
|
|
22253
|
-
engine: PipelineEngineChoiceSchema,
|
|
22254
|
-
steps: array(PipelineTemplateStepSchema).readonly()
|
|
22255
|
-
});
|
|
22256
|
-
var PipelineModelOptionSchema = object({
|
|
22257
|
-
id: string(),
|
|
22258
|
-
name: string(),
|
|
22259
|
-
formats: record(string(), object({
|
|
22260
|
-
downloaded: boolean(),
|
|
22261
|
-
sizeMB: number()
|
|
22262
|
-
})),
|
|
22263
|
-
group: ModelVariantGroupSchema.optional(),
|
|
22264
|
-
legacy: boolean().optional(),
|
|
22265
|
-
provider: ModelProviderIdSchema.optional()
|
|
22266
|
-
});
|
|
22267
|
-
var ConfigFieldBridge = custom();
|
|
22268
|
-
var PipelineAddonSchemaSchema = object({
|
|
22269
|
-
id: string(),
|
|
22270
|
-
name: string(),
|
|
22271
|
-
slot: PipelineSlotSchema,
|
|
22272
|
-
inputClasses: array(string()).readonly(),
|
|
22273
|
-
outputClasses: array(string()).readonly(),
|
|
22274
|
-
childSlots: array(PipelineSlotSchema).readonly(),
|
|
22275
|
-
models: array(PipelineModelOptionSchema).readonly(),
|
|
22276
|
-
defaultModelId: string(),
|
|
22277
|
-
defaultModelIdByFormat: record(string(), string()).optional(),
|
|
22278
|
-
enabledByDefault: boolean().optional(),
|
|
22279
|
-
backfillIntoExistingOverrides: boolean().optional(),
|
|
22280
|
-
defaultConfidence: number(),
|
|
22281
|
-
group: string().optional(),
|
|
22282
|
-
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
22283
|
-
});
|
|
22284
|
-
var PipelineSlotSchemaSchema = object({
|
|
22285
|
-
id: PipelineSlotSchema,
|
|
22466
|
+
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
22467
|
+
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
22468
|
+
var EventKindDescriptorSchema = object({
|
|
22469
|
+
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
22470
|
+
kind: string(),
|
|
22471
|
+
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
22472
|
+
labelKey: string(),
|
|
22473
|
+
/** English fallback label (kept for clients that don't translate). */
|
|
22286
22474
|
label: string(),
|
|
22287
|
-
|
|
22288
|
-
|
|
22289
|
-
|
|
22290
|
-
|
|
22291
|
-
|
|
22292
|
-
|
|
22293
|
-
|
|
22294
|
-
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
|
|
22298
|
-
|
|
22299
|
-
|
|
22300
|
-
|
|
22301
|
-
|
|
22302
|
-
|
|
22303
|
-
|
|
22304
|
-
state: _enum([
|
|
22305
|
-
"idle",
|
|
22306
|
-
"installing",
|
|
22307
|
-
"verifying",
|
|
22308
|
-
"ready",
|
|
22309
|
-
"failed"
|
|
22310
|
-
]),
|
|
22311
|
-
progress: number().optional(),
|
|
22312
|
-
error: string().optional(),
|
|
22313
|
-
nextRetryAt: number().optional(),
|
|
22314
|
-
/**
|
|
22315
|
-
* Gate A (config-correctness gate at engine change): human-readable
|
|
22316
|
-
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
22317
|
-
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
22318
|
-
* has a <format> build"). Additive/optional: informational only, never
|
|
22319
|
-
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
22320
|
-
* Absent/empty when the node-default tree resolves cleanly.
|
|
22321
|
-
*/
|
|
22322
|
-
configIssues: array(string()).optional()
|
|
22323
|
-
});
|
|
22324
|
-
var PipelineStepInputSchema = lazy(() => object({
|
|
22325
|
-
addonId: string(),
|
|
22326
|
-
modelId: string().optional(),
|
|
22327
|
-
enabled: boolean().default(true),
|
|
22328
|
-
children: array(PipelineStepInputSchema).optional(),
|
|
22329
|
-
settings: record(string(), unknown()).optional(),
|
|
22330
|
-
jumpDeviceKey: string().optional()
|
|
22331
|
-
}));
|
|
22332
|
-
var ModelSubstitutionSchema = object({
|
|
22333
|
-
addonId: string(),
|
|
22334
|
-
chosen: string(),
|
|
22335
|
-
running: string(),
|
|
22336
|
-
format: string()
|
|
22337
|
-
});
|
|
22338
|
-
var PipelineValidationIssueSchema = object({
|
|
22339
|
-
addonId: string(),
|
|
22340
|
-
kind: _enum(["unknown-addon", "no-format-build"]),
|
|
22341
|
-
detail: string()
|
|
22342
|
-
});
|
|
22343
|
-
var PipelineValidationResultSchema = object({
|
|
22344
|
-
ok: boolean(),
|
|
22345
|
-
issues: array(PipelineValidationIssueSchema).readonly(),
|
|
22346
|
-
substitutions: array(ModelSubstitutionSchema).readonly(),
|
|
22347
|
-
/** The node's `currentEngine.format` this validation ran against. */
|
|
22348
|
-
format: string()
|
|
22349
|
-
});
|
|
22350
|
-
var ReferenceImageEntrySchema = object({
|
|
22351
|
-
filename: string(),
|
|
22352
|
-
stepIds: array(string()).readonly().optional()
|
|
22353
|
-
});
|
|
22354
|
-
var ReferenceImageBodySchema = object({
|
|
22355
|
-
base64: string(),
|
|
22356
|
-
filename: string()
|
|
22475
|
+
/** Hex color for timeline/legend rendering. */
|
|
22476
|
+
color: string(),
|
|
22477
|
+
/** Dictionary id → lucide component on the UI side. */
|
|
22478
|
+
iconId: string(),
|
|
22479
|
+
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
22480
|
+
icon: EventKindIconSchema,
|
|
22481
|
+
category: EventKindCategorySchema,
|
|
22482
|
+
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
22483
|
+
parentKind: string().nullable(),
|
|
22484
|
+
/** Derived from `parentKind`, explicit for the client tree. */
|
|
22485
|
+
level: EventKindLevelSchema,
|
|
22486
|
+
/** Which cap + device contributes this kind. For built-ins the camera
|
|
22487
|
+
* itself; for sensor kinds the LINKED source device. */
|
|
22488
|
+
source: object({
|
|
22489
|
+
capName: string(),
|
|
22490
|
+
deviceId: number()
|
|
22491
|
+
})
|
|
22357
22492
|
});
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22493
|
+
/** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
|
|
22494
|
+
var EventKindsForDeviceSchema = object({
|
|
22495
|
+
deviceId: number(),
|
|
22496
|
+
kinds: array(EventKindDescriptorSchema).readonly()
|
|
22361
22497
|
});
|
|
22362
|
-
var
|
|
22363
|
-
var AudioBackendSchema = object({
|
|
22498
|
+
var SensorEventSchema = object({
|
|
22364
22499
|
id: string(),
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22500
|
+
/** The CAMERA the event is attributed to (a sensor linked to N cameras
|
|
22501
|
+
* yields N rows, one per camera). */
|
|
22502
|
+
deviceId: number(),
|
|
22503
|
+
/** The linked sensor device whose state changed. */
|
|
22504
|
+
sourceDeviceId: number(),
|
|
22505
|
+
/** Event kind id — matches an `EventKindDescriptor.kind`. */
|
|
22506
|
+
kind: string(),
|
|
22507
|
+
/** Snapshot of the sensor cap's runtime-state slice at the change. */
|
|
22508
|
+
value: record(string(), unknown()).nullable(),
|
|
22509
|
+
timestamp: number()
|
|
22510
|
+
});
|
|
22511
|
+
/**
|
|
22512
|
+
* One stored sighting on a track's trajectory.
|
|
22513
|
+
*
|
|
22514
|
+
* The array these live in is returned in TIME order (D399) — it is APPENDED in
|
|
22515
|
+
* arrival order, and the two detector passes interleave, so a consumer must not
|
|
22516
|
+
* assume the two are the same on a row written by an older build.
|
|
22517
|
+
*/
|
|
22518
|
+
var TrackPositionSchema = object({
|
|
22519
|
+
x: number(),
|
|
22520
|
+
y: number(),
|
|
22521
|
+
timestamp: number(),
|
|
22522
|
+
bbox: BoundingBoxSchema,
|
|
22368
22523
|
/**
|
|
22369
|
-
*
|
|
22370
|
-
*
|
|
22371
|
-
*
|
|
22372
|
-
*
|
|
22524
|
+
* Which detector pass measured this box (D399): `frame` is the full-frame
|
|
22525
|
+
* pass on the analysis raster, `recovery` is the native-resolution
|
|
22526
|
+
* small-subject second pass (D377/D378). Both write into one array, and until
|
|
22527
|
+
* this field existed the only way to tell them apart was that full-frame boxes
|
|
22528
|
+
* are exact multiples of 1.2 while recovery boxes are full-precision floats.
|
|
22529
|
+
* Absent on rows written before D399.
|
|
22373
22530
|
*/
|
|
22374
|
-
|
|
22531
|
+
source: _enum(["frame", "recovery"]).optional(),
|
|
22532
|
+
/** Detection score of this box, so a position can be weighed and not only
|
|
22533
|
+
* plotted. Absent on rows written before D399. */
|
|
22534
|
+
score: number().optional()
|
|
22375
22535
|
});
|
|
22376
|
-
var
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22536
|
+
var TrackSnapshotSchema = object({
|
|
22537
|
+
timestamp: number(),
|
|
22538
|
+
position: TrackPositionSchema,
|
|
22539
|
+
/** The snapshot's media row id (D482); resolve via `listTrackMedia({ trackId })`. */
|
|
22540
|
+
mediaId: number().int()
|
|
22381
22541
|
});
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22542
|
+
/**
|
|
22543
|
+
* Normalized 0..1 trajectory envelope (min/max over every position bbox,
|
|
22544
|
+
* divided by the track's detection-frame dims), computed at persist time.
|
|
22545
|
+
* Absent when the frame dims were unknown when the track was persisted
|
|
22546
|
+
* (legacy rows / dims-less sources) and on active (in-RAM) tracks.
|
|
22547
|
+
*/
|
|
22548
|
+
var TrackEnvelopeSchema = object({
|
|
22549
|
+
minX: number(),
|
|
22550
|
+
minY: number(),
|
|
22551
|
+
maxX: number(),
|
|
22552
|
+
maxY: number()
|
|
22386
22553
|
});
|
|
22387
22554
|
/**
|
|
22388
|
-
*
|
|
22389
|
-
*
|
|
22390
|
-
*
|
|
22391
|
-
*
|
|
22392
|
-
*
|
|
22393
|
-
*
|
|
22394
|
-
*
|
|
22395
|
-
*
|
|
22555
|
+
* Row projection for track list queries. `full` (default) returns the
|
|
22556
|
+
* complete Track including the frame-rate `positions[]` history and the
|
|
22557
|
+
* `snapshots[]` references — megabytes across a page of tracks. `slim`
|
|
22558
|
+
* keeps every scalar the list surfaces actually render (ids, class(es),
|
|
22559
|
+
* label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
|
|
22560
|
+
* zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
|
|
22561
|
+
* `snapshots` as EMPTY arrays — detail views re-fetch the full row via
|
|
22562
|
+
* `getTrack`. Mirrors the event-store `projection` convention
|
|
22563
|
+
* (`getObjectEvents` et al.).
|
|
22396
22564
|
*/
|
|
22397
|
-
var
|
|
22398
|
-
|
|
22399
|
-
|
|
22400
|
-
|
|
22565
|
+
var TrackProjectionSchema = _enum(["full", "slim"]);
|
|
22566
|
+
/**
|
|
22567
|
+
* One audio-classification label heard on the track's camera while the
|
|
22568
|
+
* track was alive, aggregated per label. An "episode" is one persisted
|
|
22569
|
+
* audio event (the confident-classification path: score ≥ the device's
|
|
22570
|
+
* `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
|
|
22571
|
+
* one 32 ms inference chunk, so counts stay human-scaled.
|
|
22572
|
+
*/
|
|
22573
|
+
var TrackAudioLabelSchema = object({
|
|
22574
|
+
label: string(),
|
|
22575
|
+
/** Highest classification score observed across the label's episodes. */
|
|
22576
|
+
peakScore: number(),
|
|
22577
|
+
/** Number of coalesced audio-event episodes carrying this label. */
|
|
22578
|
+
count: number(),
|
|
22579
|
+
firstAt: number(),
|
|
22580
|
+
lastAt: number()
|
|
22401
22581
|
});
|
|
22402
|
-
var PipelineConfigBridge = custom();
|
|
22403
|
-
var ConfigUISchemaBridge = custom();
|
|
22404
|
-
var ConfigUISchemaNullableBridge = custom();
|
|
22405
|
-
var InferenceCapabilitiesBridge = custom();
|
|
22406
|
-
var ModelAvailabilityListBridge = custom();
|
|
22407
|
-
var PipelineRunResultBridge = custom();
|
|
22408
22582
|
/**
|
|
22409
|
-
*
|
|
22583
|
+
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
22584
|
+
* detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
|
|
22585
|
+
* no positions, a single snapshot, and no bbox trajectory at all:
|
|
22410
22586
|
*
|
|
22411
|
-
*
|
|
22412
|
-
*
|
|
22413
|
-
*
|
|
22414
|
-
* Per-device surface (DeviceSettingsContribution + the "is detection
|
|
22415
|
-
* enabled for this camera?" toggle) lives on the paired
|
|
22416
|
-
* `detection-pipeline` cap (device-scoped, singleton, wrapper
|
|
22417
|
-
* defaultActive) — same split pattern used by stream-broker /
|
|
22418
|
-
* camera-streams and audio-analyzer / audio-analysis.
|
|
22419
|
-
*/
|
|
22420
|
-
var pipelineExecutorCapability = {
|
|
22421
|
-
name: "pipeline-executor",
|
|
22422
|
-
scope: "system",
|
|
22423
|
-
mode: "singleton",
|
|
22424
|
-
methods: {
|
|
22425
|
-
getAvailableEngines: method(_void(), array(PipelineEngineChoiceSchema)),
|
|
22426
|
-
getSelectedEngine: method(_void(), PipelineEngineChoiceSchema),
|
|
22427
|
-
getDefaultSteps: method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)),
|
|
22428
|
-
/**
|
|
22429
|
-
* Per-node detection-engine provisioning snapshot. Returns the live
|
|
22430
|
-
* state of the lazy runtime-provisioning machine on `nodeId`
|
|
22431
|
-
* (idle / installing / verifying / ready / failed). The UI pairs this
|
|
22432
|
-
* one-shot query with the `pipeline.engine-provisioning` live event
|
|
22433
|
-
* (emitted on every transition) to drive a per-node "engine ready?"
|
|
22434
|
-
* indicator without polling. Phase 2.
|
|
22435
|
-
*/
|
|
22436
|
-
getEngineProvisioning: method(object({ nodeId: string() }), EngineProvisioningSchema),
|
|
22437
|
-
getVideoPipelineSteps: method(_void(), record(string(), object({
|
|
22438
|
-
modelId: string(),
|
|
22439
|
-
settings: record(string(), unknown()).readonly()
|
|
22440
|
-
}))),
|
|
22441
|
-
setVideoPipelineSteps: method(object({ steps: record(string(), object({
|
|
22442
|
-
modelId: string(),
|
|
22443
|
-
settings: record(string(), unknown()).readonly()
|
|
22444
|
-
})) }), object({ success: literal(true) }), {
|
|
22445
|
-
kind: "mutation",
|
|
22446
|
-
auth: "admin"
|
|
22447
|
-
}),
|
|
22448
|
-
/**
|
|
22449
|
-
* Clear THIS node's executor-side PER-DEVICE settings stores (the
|
|
22450
|
-
* per-camera step overrides the object-detection root reads via
|
|
22451
|
-
* `applyDeviceOverridesToTree`). `nodeId` is the ROUTING key — the
|
|
22452
|
-
* generated cap-router strips it (default `nodeIdMode: 'routing'`) and
|
|
22453
|
-
* dispatches to that node, so the provider method runs ON the target
|
|
22454
|
-
* node and receives no `nodeId`.
|
|
22455
|
-
*
|
|
22456
|
-
* This is the slimmed executor leg of the orchestrator's
|
|
22457
|
-
* `resetNodePipelineDefaults` flow (which owns the real reset: node
|
|
22458
|
-
* addonDefaults pins + per-camera orchestrator overrides). The legacy
|
|
22459
|
-
* `resetToDefault` — which reset a persisted global step-tree seed
|
|
22460
|
-
* nothing in the live per-camera path read — was removed together with
|
|
22461
|
-
* that seed.
|
|
22462
|
-
*/
|
|
22463
|
-
clearDeviceOverrides: method(object({ nodeId: string() }), object({
|
|
22464
|
-
success: literal(true),
|
|
22465
|
-
clearedDevices: number()
|
|
22466
|
-
}), {
|
|
22467
|
-
kind: "mutation",
|
|
22468
|
-
auth: "admin"
|
|
22469
|
-
}),
|
|
22470
|
-
/**
|
|
22471
|
-
* Which of THIS node's inference devices the executor currently refuses,
|
|
22472
|
-
* and why. `nodeId` is the ROUTING key (stripped by the generated router).
|
|
22473
|
-
*
|
|
22474
|
-
* The channel that did not exist. Pool health was known only inside the
|
|
22475
|
-
* detection addon and was an input to no routing decision anywhere: the
|
|
22476
|
-
* per-dispatch capability gate is keyed on model FORMAT and so can never
|
|
22477
|
-
* separate `openvino:gpu` from `openvino:npu`, and the orchestrator's live
|
|
22478
|
-
* eligibility probe (`platformProbe.getCapabilities`) answers about
|
|
22479
|
-
* HARDWARE — which was present throughout. So when the hub's `openvino:gpu`
|
|
22480
|
-
* Python worker was SIGABRT'd by the Intel GPU plugin on 2026-08-25, the
|
|
22481
|
-
* balancer went on handing that dead pool cameras by rotation for 31 hours:
|
|
22482
|
-
* ~370 000 `PoolWorker[w0]: not initialized` lines, every frame lost.
|
|
22483
|
-
*
|
|
22484
|
-
* Read semantics the caller depends on, and which the provider guarantees:
|
|
22485
|
-
* this is a synchronous read of in-memory state. It never probes hardware,
|
|
22486
|
-
* never spawns a pool and never throws — an EMPTY `unhealthy` means "asked,
|
|
22487
|
-
* nothing is refused", which is what re-admits a device. A read that FAILS
|
|
22488
|
-
* (node offline, version skew) must therefore be distinguishable from an
|
|
22489
|
-
* empty answer, and it is: it rejects.
|
|
22490
|
-
*/
|
|
22491
|
-
getInferenceDeviceHealth: method(object({ nodeId: string() }), object({ unhealthy: array(object({
|
|
22492
|
-
/** `<backend>:<device>`, e.g. `openvino:gpu`. */
|
|
22493
|
-
deviceKey: string(),
|
|
22494
|
-
/**
|
|
22495
|
-
* `failed` — the per-device restart budget is exhausted; no pool
|
|
22496
|
-
* will be spawned until an operator re-arms it or the runner
|
|
22497
|
-
* respawns. `backoff` — under budget, waiting out the backoff (or
|
|
22498
|
-
* a cached pool observed dead and not yet condemned).
|
|
22499
|
-
*/
|
|
22500
|
-
state: _enum(["failed", "backoff"]),
|
|
22501
|
-
/** Epoch ms of the death that produced this state. */
|
|
22502
|
-
since: number(),
|
|
22503
|
-
/** Pool deaths inside the current window. */
|
|
22504
|
-
deaths: number(),
|
|
22505
|
-
/** The last death's message. */
|
|
22506
|
-
lastError: string()
|
|
22507
|
-
})).readonly() })),
|
|
22508
|
-
/**
|
|
22509
|
-
* Re-arm a terminally `failed` inference device on `nodeId`: forget its
|
|
22510
|
-
* restart budget so the next dispatch builds a fresh pool.
|
|
22511
|
-
*
|
|
22512
|
-
* The terminal state is deliberate (the abort it bounds is deterministic —
|
|
22513
|
-
* an automatic probation would just respawn Python forever, more slowly),
|
|
22514
|
-
* and a terminal state an operator cannot leave is a silent fault. This is
|
|
22515
|
-
* the way out. `rearmed:false` means there was nothing to forget.
|
|
22516
|
-
*/
|
|
22517
|
-
rearmInferenceDevice: method(object({
|
|
22518
|
-
nodeId: string(),
|
|
22519
|
-
deviceKey: string()
|
|
22520
|
-
}), object({ rearmed: boolean() }), {
|
|
22521
|
-
kind: "mutation",
|
|
22522
|
-
auth: "admin"
|
|
22523
|
-
}),
|
|
22524
|
-
getSchema: method(_void(), PipelineSchemaSchema),
|
|
22525
|
-
getGlobalSteps: method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()),
|
|
22526
|
-
getGlobalPipelineConfig: method(_void(), PipelineConfigBridge),
|
|
22527
|
-
getOrchestratorConfigSchema: method(_void(), ConfigUISchemaBridge),
|
|
22528
|
-
/**
|
|
22529
|
-
* Gate B (pre-init config-correctness gate). PURE COMPUTE against this
|
|
22530
|
-
* node's `currentEngine.format` — resolves `steps` the same way the
|
|
22531
|
-
* runtime dispatch path would, and reports what WOULD happen without
|
|
22532
|
-
* touching any node-global state. Called by the orchestrator at attach
|
|
22533
|
-
* time (`attachOn`), node-pinned to the TARGET node, so config problems
|
|
22534
|
-
* surface BEFORE `pipelineRunner.attachCamera` rather than at the first
|
|
22535
|
-
* per-frame resolve. `ok` is false iff `issues` is non-empty (both
|
|
22536
|
-
* `unknown-addon` and `no-format-build` are HARD issues); `substitutions`
|
|
22537
|
-
* is informational (a degraded-but-loadable model swap) and never
|
|
22538
|
-
* affects `ok`. Never throws.
|
|
22539
|
-
*/
|
|
22540
|
-
validatePipeline: method(object({ steps: array(PipelineStepInputSchema) }), PipelineValidationResultSchema),
|
|
22541
|
-
listTemplates: method(_void(), array(PipelineTemplateSchema$1).readonly()),
|
|
22542
|
-
saveTemplate: method(object({
|
|
22543
|
-
name: string(),
|
|
22544
|
-
steps: array(PipelineTemplateStepSchema).readonly(),
|
|
22545
|
-
engine: PipelineEngineChoiceSchema
|
|
22546
|
-
}), PipelineTemplateSchema$1, { kind: "mutation" }),
|
|
22547
|
-
updateTemplate: method(object({
|
|
22548
|
-
id: string(),
|
|
22549
|
-
name: string().optional(),
|
|
22550
|
-
steps: array(PipelineTemplateStepSchema).readonly().optional()
|
|
22551
|
-
}), PipelineTemplateSchema$1, { kind: "mutation" }),
|
|
22552
|
-
deleteTemplate: method(object({ id: string() }), _void(), { kind: "mutation" }),
|
|
22553
|
-
getCapabilities: method(_void(), InferenceCapabilitiesBridge),
|
|
22554
|
-
getAddonModels: method(object({ addonId: string() }), ModelAvailabilityListBridge),
|
|
22555
|
-
downloadModel: method(object({
|
|
22556
|
-
addonId: string(),
|
|
22557
|
-
modelId: string(),
|
|
22558
|
-
format: ModelFormatSchema$1
|
|
22559
|
-
}), DownloadModelResultSchema, { kind: "mutation" }),
|
|
22560
|
-
deleteModel: method(object({
|
|
22561
|
-
addonId: string(),
|
|
22562
|
-
modelId: string(),
|
|
22563
|
-
format: ModelFormatSchema$1
|
|
22564
|
-
}), object({ success: literal(true) }), { kind: "mutation" }),
|
|
22565
|
-
/**
|
|
22566
|
-
* Stateless single-frame execution. Callers (runner, benchmark) pass
|
|
22567
|
-
* the complete `engine` + `steps` tree; the executor holds no state
|
|
22568
|
-
* about cameras or saved pipelines.
|
|
22569
|
-
*
|
|
22570
|
-
* `engine` is optional during the migration window to preserve the
|
|
22571
|
-
* legacy call shape used by existing benchmark code; once all
|
|
22572
|
-
* callers pass it explicitly we make it required.
|
|
22573
|
-
*
|
|
22574
|
-
* Exactly one of `frame`, `frameRef`, `frameHandle`, `imageBase64`,
|
|
22575
|
-
* `referenceImage` must be provided:
|
|
22576
|
-
* - `frame`: runtime dispatch path (runner → decoded broker frame).
|
|
22577
|
-
* Carries the raw buffer, dimensions, and format; the executor
|
|
22578
|
-
* uses it directly without base64 round-tripping.
|
|
22579
|
-
* - `frameHandle` (CB5): a zero-pixel shm `FrameHandle` for the SAME
|
|
22580
|
-
* decoded frame. Both runner and executor are hub-local processes
|
|
22581
|
-
* sharing `/dev/shm`, so the executor maps the named segment and
|
|
22582
|
-
* reads the pixels back zero-copy — eliminating the ~1.2MB
|
|
22583
|
-
* re-serialisation over UDS/MsgPack the `frame` path pays per call.
|
|
22584
|
-
* High-risk: the FrameRing is a latest-wins seqlock with no
|
|
22585
|
-
* refcount, so a recycled slot yields a null read; the executor
|
|
22586
|
-
* then degrades to an empty result and the runner ships pixels via
|
|
22587
|
-
* `frame` as the fallback (queue-depth gated on the runner side).
|
|
22588
|
-
* - `imageBase64`: one-shot test path (benchmark ImageTab).
|
|
22589
|
-
* - `referenceImage`: named file from the reference-image store.
|
|
22590
|
-
*/
|
|
22591
|
-
runPipeline: method(object({
|
|
22592
|
-
engine: PipelineEngineChoiceSchema.optional(),
|
|
22593
|
-
steps: array(PipelineStepInputSchema).min(1),
|
|
22594
|
-
frame: FrameInputSchema.optional(),
|
|
22595
|
-
/**
|
|
22596
|
-
* Process-local lazy frame. Valid only when caller and provider resolve
|
|
22597
|
-
* in the same execution-group process; split/cross-node callers use
|
|
22598
|
-
* `frame`/`image` inline compatibility instead.
|
|
22599
|
-
*/
|
|
22600
|
-
frameRef: FrameRefSchema.optional(),
|
|
22601
|
-
/**
|
|
22602
|
-
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
22603
|
-
* the decoded pixels live in. One more member of the one-of
|
|
22604
|
-
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
22605
|
-
*/
|
|
22606
|
-
frameHandle: FrameHandleSchema.optional(),
|
|
22607
|
-
imageBase64: string().optional(),
|
|
22608
|
-
/**
|
|
22609
|
-
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
22610
|
-
* hops (hub → forked worker via Moleculer MsgPack) because it
|
|
22611
|
-
* skips the 33% base64 overhead + the per-call base64 decode on
|
|
22612
|
-
* the detection-pipeline worker. Callers can pass either; exactly
|
|
22613
|
-
* one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
|
|
22614
|
-
*/
|
|
22615
|
-
image: _instanceof(Uint8Array).optional(),
|
|
22616
|
-
referenceImage: string().optional(),
|
|
22617
|
-
deviceId: number().optional(),
|
|
22618
|
-
sessionId: string().optional(),
|
|
22619
|
-
/**
|
|
22620
|
-
* Execution plane. 'full' (default) runs the whole tree — benchmark,
|
|
22621
|
-
* reference-image, and detail-subtree calls. 'frame' is the live
|
|
22622
|
-
* per-frame dispatch: ONLY root-plane steps run; crop children
|
|
22623
|
-
* (inputClasses ≠ null) are skipped and served per-track via
|
|
22624
|
-
* pipelineRunner.runDetailSubtree (two-plane design).
|
|
22625
|
-
*/
|
|
22626
|
-
plane: _enum(["full", "frame"]).optional(),
|
|
22627
|
-
/**
|
|
22628
|
-
* Inference-device selector (Phase 2 multi-device). Format
|
|
22629
|
-
* `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
|
|
22630
|
-
* Omitted ⇒ the runner's default device (current single-engine
|
|
22631
|
-
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
22632
|
-
*/
|
|
22633
|
-
deviceKey: string().optional(),
|
|
22634
|
-
/**
|
|
22635
|
-
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
22636
|
-
* when the parent crop was resolved from the frame's retained NATIVE
|
|
22637
|
-
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
22638
|
-
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
22639
|
-
* resolution from that surface — the SAME quality path faces already
|
|
22640
|
-
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
22641
|
-
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
22642
|
-
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
22643
|
-
* the executor's crop-normalized child ROI back into frame-normalized
|
|
22644
|
-
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
22645
|
-
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
22646
|
-
* (today's behaviour on the fallback path).
|
|
22647
|
-
*/
|
|
22648
|
-
nativeCropRef: NativeCropRefSchema.optional()
|
|
22649
|
-
}), PipelineRunResultBridge, { kind: "mutation" }),
|
|
22650
|
-
/**
|
|
22651
|
-
* Batched run — N raw frames packed into one cap call. The provider
|
|
22652
|
-
* routes the batch through `SharedInferencePool.inferBatch`
|
|
22653
|
-
* (`MSG_INFER_BATCH = 0x03`) so the IPC framing and JSON response
|
|
22654
|
-
* envelope cost is amortised N:1 vs N concurrent `runPipeline`
|
|
22655
|
-
* calls. Single root step + uniform model assumed; trees with crop
|
|
22656
|
-
* children fall back to sequential execution.
|
|
22657
|
-
*
|
|
22658
|
-
* Used by `scripts/bench-batch-style.mts` for batch benchmarking —
|
|
22659
|
-
* N frames in one call to amortise per-call IPC overhead.
|
|
22660
|
-
*/
|
|
22661
|
-
runPipelineBatch: method(object({
|
|
22662
|
-
engine: PipelineEngineChoiceSchema.optional(),
|
|
22663
|
-
steps: array(PipelineStepInputSchema).min(1),
|
|
22664
|
-
frames: array(FrameInputSchema).min(1).max(255),
|
|
22665
|
-
deviceId: number().optional(),
|
|
22666
|
-
sessionId: string().optional(),
|
|
22667
|
-
/**
|
|
22668
|
-
* Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
|
|
22669
|
-
* the batch to the Python pool's bench preprocess cache
|
|
22670
|
-
* (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
|
|
22671
|
-
* preprocessed ONCE and every later inference is a pure-inference cache
|
|
22672
|
-
* hit — the sustained-throughput run measures inference, not
|
|
22673
|
-
* decode+preprocess+infer. Omitted/0 for live frames (all different →
|
|
22674
|
-
* full preprocess every call, correct). Fresh per sustained run;
|
|
22675
|
-
* released via `uncacheFrame`.
|
|
22676
|
-
*/
|
|
22677
|
-
frameId: number().int().nonnegative().optional(),
|
|
22678
|
-
/** Inference-device selector (Phase 2 multi-device); see runPipeline. */
|
|
22679
|
-
deviceKey: string().optional()
|
|
22680
|
-
}), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }),
|
|
22681
|
-
/**
|
|
22682
|
-
* Cache a raw frame inside the Python inference pool's memory.
|
|
22683
|
-
* Returns a numeric `frameId` that `inferCached` references —
|
|
22684
|
-
* subsequent calls send only 5 bytes through the pipe instead of
|
|
22685
|
-
* 1.2MB raw data, eliminating the pipe transfer bottleneck.
|
|
22686
|
-
*/
|
|
22687
|
-
cacheFrameInPool: method(object({
|
|
22688
|
-
data: _instanceof(Uint8Array),
|
|
22689
|
-
width: number().int().positive(),
|
|
22690
|
-
height: number().int().positive(),
|
|
22691
|
-
format: _enum([
|
|
22692
|
-
"rgb",
|
|
22693
|
-
"bgr",
|
|
22694
|
-
"gray"
|
|
22695
|
-
])
|
|
22696
|
-
}), object({
|
|
22697
|
-
frameId: number(),
|
|
22698
|
-
width: number(),
|
|
22699
|
-
height: number()
|
|
22700
|
-
}), { kind: "mutation" }),
|
|
22701
|
-
/**
|
|
22702
|
-
* Run inference on a previously cached frame. Sends only 5 bytes
|
|
22703
|
-
* (model_idx + frameId) through the IPC pipe — eliminates the
|
|
22704
|
-
* ~35ms per-call overhead of transferring 1.2MB raw data.
|
|
22705
|
-
*/
|
|
22706
|
-
inferCached: method(object({
|
|
22707
|
-
stepId: string(),
|
|
22708
|
-
frameId: number().int()
|
|
22709
|
-
}), record(string(), unknown()), { kind: "mutation" }),
|
|
22710
|
-
/**
|
|
22711
|
-
* Release a cached frame from the Python pool's memory.
|
|
22712
|
-
*/
|
|
22713
|
-
uncacheFrame: method(object({ frameId: number().int() }), _void(), { kind: "mutation" }),
|
|
22714
|
-
/** Returns the effective pool tuning (resolved from user overrides + backend defaults). */
|
|
22715
|
-
getEffectiveTuning: method(_void(), object({
|
|
22716
|
-
batchMode: string(),
|
|
22717
|
-
windowMs: number(),
|
|
22718
|
-
maxBatchSize: number(),
|
|
22719
|
-
concurrency: number()
|
|
22720
|
-
})),
|
|
22721
|
-
/**
|
|
22722
|
-
* List every EngineFactory currently loaded in this executor's RAM,
|
|
22723
|
-
* with the models resident and a coarse "in use" marker derived from
|
|
22724
|
-
* ongoing inference activity. Used by the Pipeline page Engines tab.
|
|
22725
|
-
*/
|
|
22726
|
-
listLoadedEngines: method(_void(), array(object({
|
|
22727
|
-
engineKey: string(),
|
|
22728
|
-
engine: PipelineEngineChoiceSchema,
|
|
22729
|
-
modelsLoaded: array(string()).readonly(),
|
|
22730
|
-
inUseByCameras: array(number()).readonly(),
|
|
22731
|
-
/**
|
|
22732
|
-
* Origin of this resident factory.
|
|
22733
|
-
* - `runtime` — main camera-serving engine (no idle TTL).
|
|
22734
|
-
* - `warm-override` — benchmark/test override held in the warm
|
|
22735
|
-
* cache; auto-disposed after the idle TTL.
|
|
22736
|
-
* - `device-pool` — a concurrent per-device pool (Phase 2
|
|
22737
|
-
* multi-device, keyed by `deviceKey`) resolved
|
|
22738
|
-
* via `resolveDeviceFactory`. Runs alongside the
|
|
22739
|
-
* `runtime` engine on a DIFFERENT accelerator
|
|
22740
|
-
* (NPU / iGPU / Coral) — this is how the
|
|
22741
|
-
* Engines tab shows all pools running at once.
|
|
22742
|
-
*/
|
|
22743
|
-
kind: _enum([
|
|
22744
|
-
"runtime",
|
|
22745
|
-
"warm-override",
|
|
22746
|
-
"device-pool"
|
|
22747
|
-
]),
|
|
22748
|
-
/** Native pid of the underlying Python pool (null when no pool). */
|
|
22749
|
-
poolPid: number().nullable(),
|
|
22750
|
-
/** ms since this factory was last used (null when not warm-tracked). */
|
|
22751
|
-
idleMs: number().nullable(),
|
|
22752
|
-
/** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
|
|
22753
|
-
idleTtlMs: number().nullable()
|
|
22754
|
-
})).readonly()),
|
|
22755
|
-
/** Warm up an engine without running a frame. No-op if already loaded. */
|
|
22756
|
-
spinEngine: method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
|
|
22757
|
-
kind: "mutation",
|
|
22758
|
-
auth: "admin"
|
|
22759
|
-
}),
|
|
22760
|
-
/**
|
|
22761
|
-
* Unload an engine from RAM. `force:true` unloads even when cameras
|
|
22762
|
-
* are actively using it (they re-spin on next frame). Default is
|
|
22763
|
-
* gated — returns `{success:false, reason}` when in use.
|
|
22764
|
-
*/
|
|
22765
|
-
killEngine: method(object({
|
|
22766
|
-
engine: PipelineEngineChoiceSchema,
|
|
22767
|
-
force: boolean().optional()
|
|
22768
|
-
}), object({
|
|
22769
|
-
success: boolean(),
|
|
22770
|
-
reason: string().optional()
|
|
22771
|
-
}), {
|
|
22772
|
-
kind: "mutation",
|
|
22773
|
-
auth: "admin"
|
|
22774
|
-
}),
|
|
22775
|
-
listReferenceImages: method(_void(), array(ReferenceImageEntrySchema).readonly()),
|
|
22776
|
-
getReferenceImage: method(object({ filename: string() }), ReferenceImageBodySchema.nullable()),
|
|
22777
|
-
getReferenceAudioFiles: method(_void(), array(ReferenceAudioEntrySchema).readonly()),
|
|
22778
|
-
getReferenceAudio: method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()),
|
|
22779
|
-
getAudioCapabilities: method(_void(), AudioCapabilitiesSchema),
|
|
22780
|
-
runAudioTest: method(object({
|
|
22781
|
-
addonId: string(),
|
|
22782
|
-
modelId: string(),
|
|
22783
|
-
filename: string().optional(),
|
|
22784
|
-
settings: record(string(), unknown()).optional()
|
|
22785
|
-
}), AudioTestResultSchema, { kind: "mutation" }),
|
|
22786
|
-
getDetectionConfigSchema: method(_void(), ConfigUISchemaNullableBridge)
|
|
22787
|
-
}
|
|
22788
|
-
};
|
|
22789
|
-
/**
|
|
22790
|
-
* Per-stage gating mode applied to the zones a rule references.
|
|
22791
|
-
*
|
|
22792
|
-
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
22793
|
-
* When at least one `include` rule fires for a stage, only entities
|
|
22794
|
-
* inside one of those zones pass that stage.
|
|
22795
|
-
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
22796
|
-
* Entities inside one of those zones are dropped at that stage.
|
|
22797
|
-
*
|
|
22798
|
-
* `monitor`-style observation (count without filtering) is not a rule
|
|
22799
|
-
* mode — zones without any matching rule are observed naturally by
|
|
22800
|
-
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
22801
|
-
* count, not filter" use case needs no rule at all.
|
|
22802
|
-
*/
|
|
22803
|
-
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
22804
|
-
/**
|
|
22805
|
-
* Per-consumer rule that references existing zones (geometry) and
|
|
22806
|
-
* defines how a specific pipeline stage should treat them. Each
|
|
22807
|
-
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
22808
|
-
* settings:
|
|
22809
|
-
*
|
|
22810
|
-
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
22811
|
-
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
22812
|
-
* - future: notification rules, audio gating, etc.
|
|
22813
|
-
*
|
|
22814
|
-
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
22815
|
-
* express "ignore motion in ALL of {garden, street}" with a single
|
|
22816
|
-
* rule. `classFilter` narrows the rule to specific object classes —
|
|
22817
|
-
* "drop person detections in the street, but keep cars" is one
|
|
22818
|
-
* `exclude` rule with `classFilter: ['person']`.
|
|
22819
|
-
*
|
|
22820
|
-
* `enabled` is a soft toggle — the operator can keep the rule
|
|
22821
|
-
* configured but inert without deleting it.
|
|
22822
|
-
*/
|
|
22823
|
-
var ZoneRuleSchema = object({
|
|
22824
|
-
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
22825
|
-
id: string(),
|
|
22826
|
-
/** Optional human-readable label rendered in the rule editor. */
|
|
22827
|
-
name: string().optional(),
|
|
22828
|
-
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
22829
|
-
* listed zones (OR-set: a detection in any one of them counts).
|
|
22830
|
-
* At least one zone id required — a rule with no targets is a
|
|
22831
|
-
* configuration mistake and the form validator rejects it. */
|
|
22832
|
-
zoneIds: array(string()).min(1).readonly(),
|
|
22833
|
-
mode: ZoneRuleModeEnum,
|
|
22834
|
-
/**
|
|
22835
|
-
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
22836
|
-
* applies to every class. Class strings match the `macroClass`
|
|
22837
|
-
* field on detections (e.g. `person`, `car`, `dog`).
|
|
22838
|
-
*/
|
|
22839
|
-
classFilter: array(string()).readonly().optional(),
|
|
22840
|
-
/**
|
|
22841
|
-
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
22842
|
-
* required to consider an entity "in the zone". Defaults to the
|
|
22843
|
-
* consumer's stage default when omitted. Kept for back-compat with
|
|
22844
|
-
* existing per-rule overrides; new operators pick the value via
|
|
22845
|
-
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
22846
|
-
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
22847
|
-
*/
|
|
22848
|
-
overlapThreshold: number().min(0).max(1).optional(),
|
|
22849
|
-
/**
|
|
22850
|
-
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
22851
|
-
* of the detection's bbox that must lie inside the zone for the
|
|
22852
|
-
* rule to match. Documented default is 85%; the engine substitutes
|
|
22853
|
-
* that when the field is omitted (kept optional so existing rules
|
|
22854
|
-
* stored without it stay valid).
|
|
22855
|
-
*
|
|
22856
|
-
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
22857
|
-
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
22858
|
-
* field exposed in the UI. Internally both feed the same gate.
|
|
22859
|
-
*/
|
|
22860
|
-
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
22861
|
-
/**
|
|
22862
|
-
* When `true` and a detection has a segmentation mask, use the
|
|
22863
|
-
* mask for overlap instead of the bbox. Detection-stage only;
|
|
22864
|
-
* motion rules ignore this field.
|
|
22865
|
-
*/
|
|
22866
|
-
preferMask: boolean().optional(),
|
|
22867
|
-
/**
|
|
22868
|
-
* Soft-toggle: `false` disables the rule without deleting it.
|
|
22869
|
-
* Defaults to `true` so operators creating a rule via the UI
|
|
22870
|
-
* see it active immediately.
|
|
22871
|
-
*/
|
|
22872
|
-
enabled: boolean().default(true)
|
|
22873
|
-
});
|
|
22874
|
-
array(ZoneRuleSchema).readonly();
|
|
22875
|
-
/**
|
|
22876
|
-
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
22877
|
-
*
|
|
22878
|
-
* Zones describe **where** in the frame the operator wants to flag
|
|
22879
|
-
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
22880
|
-
* each pipeline stage uses them. Splitting the two means a single
|
|
22881
|
-
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
22882
|
-
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
22883
|
-
* — without three duplicated polygons.
|
|
22884
|
-
*
|
|
22885
|
-
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
22886
|
-
* `zones` device-state slice on every mutation. Consumers
|
|
22887
|
-
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
22888
|
-
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
22889
|
-
* mirror with `onChanged`).
|
|
22890
|
-
*
|
|
22891
|
-
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
22892
|
-
* survive resolution changes and stream profile switches.
|
|
22893
|
-
*
|
|
22894
|
-
* `kind` discriminates between full polygons (closed regions used
|
|
22895
|
-
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
22896
|
-
* line segments used for cross events). Onboard / firmware-reported
|
|
22897
|
-
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
22898
|
-
* task list.
|
|
22899
|
-
*/
|
|
22900
|
-
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
22901
|
-
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
22902
|
-
var PolygonPointSchema = object({
|
|
22903
|
-
x: number(),
|
|
22904
|
-
y: number()
|
|
22905
|
-
});
|
|
22906
|
-
/** A camera detection zone — pure geometry/identity. */
|
|
22907
|
-
var ZoneSchema = object({
|
|
22908
|
-
id: string(),
|
|
22909
|
-
name: string(),
|
|
22910
|
-
kind: ZoneKindEnum.default("polygon"),
|
|
22911
|
-
/** Polygon vertices, fraction of frame (0–1). */
|
|
22912
|
-
polygon: array(PolygonPointSchema).readonly(),
|
|
22913
|
-
/** Visual color for UI rendering. */
|
|
22914
|
-
color: string().default("#3b82f6")
|
|
22915
|
-
});
|
|
22916
|
-
/**
|
|
22917
|
-
* Zones capability — per-camera CRUD over polygon detection zones.
|
|
22918
|
-
*
|
|
22919
|
-
* Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
|
|
22920
|
-
* to per-device settings and mirrors into the `zones` device-state
|
|
22921
|
-
* slice on every mutation, so downstream consumers can subscribe via
|
|
22922
|
-
* `dev.state.zones.onChanged`.
|
|
22923
|
-
*
|
|
22924
|
-
* The cap surface only handles geometry + identity; filtering
|
|
22925
|
-
* behaviour (per-class, include/exclude, threshold) lives in the
|
|
22926
|
-
* consumer addons' rule arrays — see `ZoneRuleSchema` exported from
|
|
22927
|
-
* `capabilities/schemas/zone-rule.js`.
|
|
22928
|
-
*/
|
|
22929
|
-
var zonesCapability = {
|
|
22930
|
-
name: "zones",
|
|
22931
|
-
scope: "device",
|
|
22932
|
-
mode: "singleton",
|
|
22933
|
-
deviceTypes: [DeviceType.Camera],
|
|
22934
|
-
methods: {
|
|
22935
|
-
listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
|
|
22936
|
-
addZone: method(object({
|
|
22937
|
-
deviceId: number(),
|
|
22938
|
-
zone: ZoneSchema
|
|
22939
|
-
}), _void(), {
|
|
22940
|
-
kind: "mutation",
|
|
22941
|
-
auth: "admin"
|
|
22942
|
-
}),
|
|
22943
|
-
removeZone: method(object({
|
|
22944
|
-
deviceId: number(),
|
|
22945
|
-
zoneId: string()
|
|
22946
|
-
}), _void(), {
|
|
22947
|
-
kind: "mutation",
|
|
22948
|
-
auth: "admin"
|
|
22949
|
-
}),
|
|
22950
|
-
updateZone: method(object({
|
|
22951
|
-
deviceId: number(),
|
|
22952
|
-
zone: ZoneSchema
|
|
22953
|
-
}), _void(), {
|
|
22954
|
-
kind: "mutation",
|
|
22955
|
-
auth: "admin"
|
|
22956
|
-
})
|
|
22957
|
-
},
|
|
22958
|
-
/**
|
|
22959
|
-
* Runtime-state slice — the live zone catalogue mirrored by the
|
|
22960
|
-
* orchestrator on every CRUD mutation. Consumers read via
|
|
22961
|
-
* `device.state.zones.value` / `.watch(...)` without round-tripping
|
|
22962
|
-
* the cap, and the codegen DeviceProxy auto-wires the reactive
|
|
22963
|
-
* handle. Slice shape is `{ zones: Zone[] }` so future extensions
|
|
22964
|
-
* (e.g. zone groupings) can sit alongside the polygon list.
|
|
22965
|
-
*/
|
|
22966
|
-
runtimeState: object({ zones: array(ZoneSchema).readonly() }),
|
|
22967
|
-
/**
|
|
22968
|
-
* Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
|
|
22969
|
-
*
|
|
22970
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
22971
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
22972
|
-
*/
|
|
22973
|
-
durability: "restored"
|
|
22974
|
-
};
|
|
22975
|
-
/**
|
|
22976
|
-
* pipeline-analytics — device-scoped wrapper cap. Refines raw
|
|
22977
|
-
* per-frame detections emitted by the pipeline runner into tracked
|
|
22978
|
-
* objects, per-kind event collections (motion / object / audio), and
|
|
22979
|
-
* persisted media. Owns the post-detection domain end-to-end:
|
|
22980
|
-
*
|
|
22981
|
-
* runner emits PipelineInferenceResult
|
|
22982
|
-
* ↓ (event bus)
|
|
22983
|
-
* pipeline-analytics subscriber
|
|
22984
|
-
* ↓ SORT tracker + zone engine + state analyzer + event emitter
|
|
22985
|
-
* → three DB collections (one per kind), one FS media tree, one
|
|
22986
|
-
* unified event emitter (FrameTracked + TrackStarted/Ended +
|
|
22987
|
-
* DetectionEvent on bus)
|
|
22988
|
-
*
|
|
22989
|
-
* Pure subscriber model. No `processFrame` cap method — the runner
|
|
22990
|
-
* already publishes the raw frame on the bus. The cap surface is
|
|
22991
|
-
* only QUERIES + per-device settings, bound on/off via
|
|
22992
|
-
* `device-manager.setWrapperActive`. `defaultActive: true` because
|
|
22993
|
-
* every camera with a detection pipeline wants its raw detections
|
|
22994
|
-
* refined; operators opt out per-device via BindingsTab when needed.
|
|
22995
|
-
*
|
|
22996
|
-
* Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
|
|
22997
|
-
* (per-device surface) and `track-trail` caps — see P11 cleanup.
|
|
22998
|
-
*/
|
|
22999
|
-
var TrackStateSchema = _enum([
|
|
23000
|
-
"new",
|
|
23001
|
-
"entered",
|
|
23002
|
-
"left",
|
|
23003
|
-
"moving",
|
|
23004
|
-
"idle"
|
|
23005
|
-
]);
|
|
23006
|
-
var EventKindSchema = _enum([
|
|
23007
|
-
"motion",
|
|
23008
|
-
"object",
|
|
23009
|
-
"audio"
|
|
23010
|
-
]);
|
|
23011
|
-
/**
|
|
23012
|
-
* Spatial filter for `listTracks` — the rect + polygon variants of the shared
|
|
23013
|
-
* MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
|
|
23014
|
-
* of the camera frame (top-left origin), matching the drawing-plane editor.
|
|
23015
|
-
*/
|
|
23016
|
-
var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
|
|
23017
|
-
/** Closed icon vocabulary so clients render a known glyph per kind. */
|
|
23018
|
-
var EventKindIconSchema = _enum([
|
|
23019
|
-
"motion",
|
|
23020
|
-
"audio",
|
|
23021
|
-
"person",
|
|
23022
|
-
"vehicle",
|
|
23023
|
-
"animal",
|
|
23024
|
-
"door",
|
|
23025
|
-
"pir",
|
|
23026
|
-
"smoke",
|
|
23027
|
-
"water",
|
|
23028
|
-
"button",
|
|
23029
|
-
"package",
|
|
23030
|
-
"generic"
|
|
23031
|
-
]);
|
|
23032
|
-
var EventKindCategorySchema = _enum([
|
|
23033
|
-
"motion",
|
|
23034
|
-
"audio",
|
|
23035
|
-
"detection",
|
|
23036
|
-
"sensor",
|
|
23037
|
-
"control",
|
|
23038
|
-
"custom",
|
|
23039
|
-
"package"
|
|
23040
|
-
]);
|
|
23041
|
-
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
23042
|
-
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
23043
|
-
var EventKindDescriptorSchema = object({
|
|
23044
|
-
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
23045
|
-
kind: string(),
|
|
23046
|
-
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
23047
|
-
labelKey: string(),
|
|
23048
|
-
/** English fallback label (kept for clients that don't translate). */
|
|
23049
|
-
label: string(),
|
|
23050
|
-
/** Hex color for timeline/legend rendering. */
|
|
23051
|
-
color: string(),
|
|
23052
|
-
/** Dictionary id → lucide component on the UI side. */
|
|
23053
|
-
iconId: string(),
|
|
23054
|
-
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
23055
|
-
icon: EventKindIconSchema,
|
|
23056
|
-
category: EventKindCategorySchema,
|
|
23057
|
-
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
23058
|
-
parentKind: string().nullable(),
|
|
23059
|
-
/** Derived from `parentKind`, explicit for the client tree. */
|
|
23060
|
-
level: EventKindLevelSchema,
|
|
23061
|
-
/** Which cap + device contributes this kind. For built-ins the camera
|
|
23062
|
-
* itself; for sensor kinds the LINKED source device. */
|
|
23063
|
-
source: object({
|
|
23064
|
-
capName: string(),
|
|
23065
|
-
deviceId: number()
|
|
23066
|
-
})
|
|
23067
|
-
});
|
|
23068
|
-
/** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
|
|
23069
|
-
var EventKindsForDeviceSchema = object({
|
|
23070
|
-
deviceId: number(),
|
|
23071
|
-
kinds: array(EventKindDescriptorSchema).readonly()
|
|
23072
|
-
});
|
|
23073
|
-
var SensorEventSchema = object({
|
|
23074
|
-
id: string(),
|
|
23075
|
-
/** The CAMERA the event is attributed to (a sensor linked to N cameras
|
|
23076
|
-
* yields N rows, one per camera). */
|
|
23077
|
-
deviceId: number(),
|
|
23078
|
-
/** The linked sensor device whose state changed. */
|
|
23079
|
-
sourceDeviceId: number(),
|
|
23080
|
-
/** Event kind id — matches an `EventKindDescriptor.kind`. */
|
|
23081
|
-
kind: string(),
|
|
23082
|
-
/** Snapshot of the sensor cap's runtime-state slice at the change. */
|
|
23083
|
-
value: record(string(), unknown()).nullable(),
|
|
23084
|
-
timestamp: number()
|
|
23085
|
-
});
|
|
23086
|
-
/**
|
|
23087
|
-
* One stored sighting on a track's trajectory.
|
|
23088
|
-
*
|
|
23089
|
-
* The array these live in is returned in TIME order (D399) — it is APPENDED in
|
|
23090
|
-
* arrival order, and the two detector passes interleave, so a consumer must not
|
|
23091
|
-
* assume the two are the same on a row written by an older build.
|
|
23092
|
-
*/
|
|
23093
|
-
var TrackPositionSchema = object({
|
|
23094
|
-
x: number(),
|
|
23095
|
-
y: number(),
|
|
23096
|
-
timestamp: number(),
|
|
23097
|
-
bbox: BoundingBoxSchema,
|
|
23098
|
-
/**
|
|
23099
|
-
* Which detector pass measured this box (D399): `frame` is the full-frame
|
|
23100
|
-
* pass on the analysis raster, `recovery` is the native-resolution
|
|
23101
|
-
* small-subject second pass (D377/D378). Both write into one array, and until
|
|
23102
|
-
* this field existed the only way to tell them apart was that full-frame boxes
|
|
23103
|
-
* are exact multiples of 1.2 while recovery boxes are full-precision floats.
|
|
23104
|
-
* Absent on rows written before D399.
|
|
23105
|
-
*/
|
|
23106
|
-
source: _enum(["frame", "recovery"]).optional(),
|
|
23107
|
-
/** Detection score of this box, so a position can be weighed and not only
|
|
23108
|
-
* plotted. Absent on rows written before D399. */
|
|
23109
|
-
score: number().optional()
|
|
23110
|
-
});
|
|
23111
|
-
var TrackSnapshotSchema = object({
|
|
23112
|
-
timestamp: number(),
|
|
23113
|
-
position: TrackPositionSchema,
|
|
23114
|
-
/** The snapshot's media row id (D482); resolve via `listTrackMedia({ trackId })`. */
|
|
23115
|
-
mediaId: number().int()
|
|
23116
|
-
});
|
|
23117
|
-
/**
|
|
23118
|
-
* Normalized 0..1 trajectory envelope (min/max over every position bbox,
|
|
23119
|
-
* divided by the track's detection-frame dims), computed at persist time.
|
|
23120
|
-
* Absent when the frame dims were unknown when the track was persisted
|
|
23121
|
-
* (legacy rows / dims-less sources) and on active (in-RAM) tracks.
|
|
23122
|
-
*/
|
|
23123
|
-
var TrackEnvelopeSchema = object({
|
|
23124
|
-
minX: number(),
|
|
23125
|
-
minY: number(),
|
|
23126
|
-
maxX: number(),
|
|
23127
|
-
maxY: number()
|
|
23128
|
-
});
|
|
23129
|
-
/**
|
|
23130
|
-
* Row projection for track list queries. `full` (default) returns the
|
|
23131
|
-
* complete Track including the frame-rate `positions[]` history and the
|
|
23132
|
-
* `snapshots[]` references — megabytes across a page of tracks. `slim`
|
|
23133
|
-
* keeps every scalar the list surfaces actually render (ids, class(es),
|
|
23134
|
-
* label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
|
|
23135
|
-
* zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
|
|
23136
|
-
* `snapshots` as EMPTY arrays — detail views re-fetch the full row via
|
|
23137
|
-
* `getTrack`. Mirrors the event-store `projection` convention
|
|
23138
|
-
* (`getObjectEvents` et al.).
|
|
23139
|
-
*/
|
|
23140
|
-
var TrackProjectionSchema = _enum(["full", "slim"]);
|
|
23141
|
-
/**
|
|
23142
|
-
* One audio-classification label heard on the track's camera while the
|
|
23143
|
-
* track was alive, aggregated per label. An "episode" is one persisted
|
|
23144
|
-
* audio event (the confident-classification path: score ≥ the device's
|
|
23145
|
-
* `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
|
|
23146
|
-
* one 32 ms inference chunk, so counts stay human-scaled.
|
|
23147
|
-
*/
|
|
23148
|
-
var TrackAudioLabelSchema = object({
|
|
23149
|
-
label: string(),
|
|
23150
|
-
/** Highest classification score observed across the label's episodes. */
|
|
23151
|
-
peakScore: number(),
|
|
23152
|
-
/** Number of coalesced audio-event episodes carrying this label. */
|
|
23153
|
-
count: number(),
|
|
23154
|
-
firstAt: number(),
|
|
23155
|
-
lastAt: number()
|
|
23156
|
-
});
|
|
23157
|
-
/**
|
|
23158
|
-
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
23159
|
-
* detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
|
|
23160
|
-
* no positions, a single snapshot, and no bbox trajectory at all:
|
|
23161
|
-
*
|
|
23162
|
-
* - `sensor` — a linked sensor/control device state change.
|
|
23163
|
-
* - `audio` — an audio event on the camera itself that was anomalous for
|
|
23164
|
-
* THAT camera, loud, and heard while nothing visual was happening (D62).
|
|
22587
|
+
* - `sensor` — a linked sensor/control device state change.
|
|
22588
|
+
* - `audio` — an audio event on the camera itself that was anomalous for
|
|
22589
|
+
* THAT camera, loud, and heard while nothing visual was happening (D62).
|
|
23165
22590
|
*
|
|
23166
22591
|
* - `onboard` — the CAMERA's own firmware, paired with a decoded frame in
|
|
23167
22592
|
* that frame's pixel space. A real root detector and a SPATIAL one: its
|
|
@@ -23543,6 +22968,22 @@ var TrackSchema = object({
|
|
|
23543
22968
|
* omit it. Render nothing when absent.
|
|
23544
22969
|
*/
|
|
23545
22970
|
previewMissReason: string().optional(),
|
|
22971
|
+
/**
|
|
22972
|
+
* The ROOT model that produced this track — the `FrameResult.rootModelId` of
|
|
22973
|
+
* the frame it was BORN on (D646). What a later replay compares against, so
|
|
22974
|
+
* "the original model" is named rather than assumed. A birth fact: never
|
|
22975
|
+
* rewritten by a later frame. **Absent ≠ unknown-model**: a row from before
|
|
22976
|
+
* the column, and a track the camera's own detector produced, carry none.
|
|
22977
|
+
*/
|
|
22978
|
+
modelId: string().optional(),
|
|
22979
|
+
/**
|
|
22980
|
+
* Size (px) of the detection frame this track's `positions[].bbox` live in —
|
|
22981
|
+
* the frame it was born on, else the camera's latest analysis frame at
|
|
22982
|
+
* persist time. Divide a position by these to normalise it. Absent when the
|
|
22983
|
+
* size was never known.
|
|
22984
|
+
*/
|
|
22985
|
+
frameWidth: number().optional(),
|
|
22986
|
+
frameHeight: number().optional(),
|
|
23546
22987
|
...TrackFlagFields,
|
|
23547
22988
|
...TrackRetrainFields
|
|
23548
22989
|
});
|
|
@@ -24549,24 +23990,6 @@ var MediaReclaimStatusSchema = object({
|
|
|
24549
23990
|
finishedAtMs: number().nullable(),
|
|
24550
23991
|
error: string().nullable()
|
|
24551
23992
|
});
|
|
24552
|
-
var ReplayFrameInputSchema = object({
|
|
24553
|
-
timestamp: number(),
|
|
24554
|
-
frame: PipelineRunResultBridge
|
|
24555
|
-
});
|
|
24556
|
-
var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
|
|
24557
|
-
className: string(),
|
|
24558
|
-
firstSeenMs: number(),
|
|
24559
|
-
lastSeenMs: number(),
|
|
24560
|
-
/** Bbox of the track's FIRST matched detection, pixel-space in the clip's
|
|
24561
|
-
* frame — a representative box for the diff's `(className, window, IoU)`
|
|
24562
|
-
* pairing (`replay-diff.ts`). A replay does not need the full per-frame
|
|
24563
|
-
* trajectory production's `Track.positions` keeps. */
|
|
24564
|
-
bbox: BoundingBoxSchema,
|
|
24565
|
-
/** How many of the input frames this track matched a real detection on
|
|
24566
|
-
* (never a coasted/extrapolated frame) — the replay's own signal for "how
|
|
24567
|
-
* solid is this track", cheaper than re-deriving it from a trajectory. */
|
|
24568
|
-
framesMatched: number().int()
|
|
24569
|
-
})).readonly() });
|
|
24570
23993
|
/**
|
|
24571
23994
|
* The long-term series a camera produces. A closed union so a typo cannot
|
|
24572
23995
|
* invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
|
|
@@ -25155,392 +24578,1034 @@ var pipelineAnalyticsCapability = {
|
|
|
25155
24578
|
* VERBATIM under `tracks/<deviceId>/<trackId>/…`. No crop is derived and no
|
|
25156
24579
|
* model is run: a training set's pixels must be the pixels the pipeline saw.
|
|
25157
24580
|
*/
|
|
25158
|
-
getTrainingExportUrl: method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
24581
|
+
getTrainingExportUrl: method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
24582
|
+
kind: "query",
|
|
24583
|
+
auth: "admin"
|
|
24584
|
+
}),
|
|
24585
|
+
/**
|
|
24586
|
+
* The staging worklist for one camera, or for every camera that has one.
|
|
24587
|
+
*
|
|
24588
|
+
* Fetched ON DEMAND, over the staging set only — the page never scans
|
|
24589
|
+
* history, because making the working set small is the entire purpose of
|
|
24590
|
+
* the mark. Each row carries how many frames the dataset already holds from
|
|
24591
|
+
* the track and how many subjects were annotated on them, so
|
|
24592
|
+
* `frameCount: 0` reads as "still to work" without a second call per track.
|
|
24593
|
+
*
|
|
24594
|
+
* `auth: 'admin'`, unlike the viewer-level mark itself: marking a track is
|
|
24595
|
+
* curation you do while looking at it, but building the training set the
|
|
24596
|
+
* fleet's models are fine-tuned on is not.
|
|
24597
|
+
*/
|
|
24598
|
+
listRetrainStaging: method(object({
|
|
24599
|
+
/** Empty ⇒ every camera that has staging tracks. A LIST, not a single
|
|
24600
|
+
* `deviceId`, deliberately: `deviceId` would make this device-bound and
|
|
24601
|
+
* route it at one camera's owner, and "every camera" would stop being
|
|
24602
|
+
* expressible at all. */
|
|
24603
|
+
deviceIds: array(number()).optional(),
|
|
24604
|
+
limit: number().int().min(1).max(500).optional()
|
|
24605
|
+
}), array(RetrainTrackSchema).readonly(), {
|
|
24606
|
+
kind: "query",
|
|
24607
|
+
auth: "admin"
|
|
24608
|
+
}),
|
|
24609
|
+
/**
|
|
24610
|
+
* What a track can contribute, and what it already has.
|
|
24611
|
+
*
|
|
24612
|
+
* `candidates` are the track's whole, unannotated frames — index rows only,
|
|
24613
|
+
* so this is cheap. `copies` are the frames already inside the dataset, and
|
|
24614
|
+
* a candidate whose copy exists is marked `copied: true`: selecting it again
|
|
24615
|
+
* is free and CANNOT fail, whatever became of the original.
|
|
24616
|
+
*
|
|
24617
|
+
* A crop, a thumbnail and `fullFrameBoxed` are never candidates. The last
|
|
24618
|
+
* one matters most: it has the model's own rectangle burned into the pixels,
|
|
24619
|
+
* and a detector trained on it learns to find a green line.
|
|
24620
|
+
*/
|
|
24621
|
+
listRetrainFrames: method(object({ trackId: string() }), RetrainFrameListSchema, {
|
|
24622
|
+
kind: "query",
|
|
24623
|
+
auth: "admin"
|
|
24624
|
+
}),
|
|
24625
|
+
/**
|
|
24626
|
+
* COPY-ON-SELECT — the write that makes `trained` safe to evict.
|
|
24627
|
+
*
|
|
24628
|
+
* Selecting a frame copies its bytes into retrain storage immediately: not
|
|
24629
|
+
* a reference, not a lease. Once the copy exists the dataset no longer
|
|
24630
|
+
* depends on the track's media, which is exactly what lets D81 hand a
|
|
24631
|
+
* `trained` track back to retention.
|
|
24632
|
+
*
|
|
24633
|
+
* The order inside is load-bearing and is pinned by a test: an EXISTING
|
|
24634
|
+
* copy is returned without touching the source, so an original that
|
|
24635
|
+
* evaporated blocks the selection of THAT ORIGINAL and never the copy
|
|
24636
|
+
* already taken. Every refusal comes back named — a dropped selection is
|
|
24637
|
+
* never silent, on the wire or in the log.
|
|
24638
|
+
*/
|
|
24639
|
+
selectRetrainFrames: method(object({
|
|
24640
|
+
deviceId: number(),
|
|
24641
|
+
trackId: string(),
|
|
24642
|
+
mediaIds: array(number().int()).min(1)
|
|
24643
|
+
}), RetrainFrameSelectionSchema, {
|
|
24644
|
+
kind: "mutation",
|
|
24645
|
+
auth: "admin"
|
|
24646
|
+
}),
|
|
24647
|
+
/** Un-select a frame: its annotations go first, then the copy and its blob.
|
|
24648
|
+
* Deliberately destructive and deliberately explicit — it is the only way
|
|
24649
|
+
* a frame leaves the dataset before export. */
|
|
24650
|
+
deselectRetrainFrame: method(object({
|
|
24651
|
+
deviceId: number(),
|
|
24652
|
+
trackId: string(),
|
|
24653
|
+
frameId: string()
|
|
24654
|
+
}), object({
|
|
24655
|
+
removed: boolean(),
|
|
24656
|
+
removedAnnotations: number().int()
|
|
24657
|
+
}), {
|
|
24658
|
+
kind: "mutation",
|
|
24659
|
+
auth: "admin"
|
|
24660
|
+
}),
|
|
24661
|
+
/**
|
|
24662
|
+
* The pixels of ONE copied frame, base64.
|
|
24663
|
+
*
|
|
24664
|
+
* Through the cap rather than a data plane because it is genuinely one
|
|
24665
|
+
* frame at a time, on demand, at human speed — the shape D9/D18 permit
|
|
24666
|
+
* (what they forbid is frames crossing a boundary at frame RATE). The
|
|
24667
|
+
* annotation canvas needs the image and its exact dimensions in the same
|
|
24668
|
+
* answer: a canvas that places a normalised box against a size it guessed
|
|
24669
|
+
* draws every box in the wrong place.
|
|
24670
|
+
*/
|
|
24671
|
+
getRetrainFrameImage: method(object({ frameId: string() }), object({
|
|
24672
|
+
base64: string(),
|
|
24673
|
+
width: number().int(),
|
|
24674
|
+
height: number().int()
|
|
24675
|
+
}), {
|
|
24676
|
+
kind: "query",
|
|
24677
|
+
auth: "admin"
|
|
24678
|
+
}),
|
|
24679
|
+
/**
|
|
24680
|
+
* Ask the pipeline what it sees, as a PROPOSAL.
|
|
24681
|
+
*
|
|
24682
|
+
* Runs through `pipelineRunner.runStatelessStep` on the COPIED frame, and
|
|
24683
|
+
* every box comes back as a draft with `source: 'assist'` plus the model and
|
|
24684
|
+
* score that produced it. The operator confirms, edits, adds and deletes;
|
|
24685
|
+
* nothing is stored until `saveRetrainAnnotations`.
|
|
24686
|
+
*
|
|
24687
|
+
* For packages the request is `rfdetr-package` on the ZONE CROP at 0.35 —
|
|
24688
|
+
* never the whole frame, where a package detector at that threshold proposes
|
|
24689
|
+
* furniture. A package request with no zone is REFUSED rather than widened,
|
|
24690
|
+
* because the silent widening would look like a bad model for as long as
|
|
24691
|
+
* nobody checked which rectangle it ran on.
|
|
24692
|
+
*/
|
|
24693
|
+
proposeRetrainAnnotations: method(object({
|
|
24694
|
+
deviceId: number(),
|
|
24695
|
+
trackId: string(),
|
|
24696
|
+
frameId: string(),
|
|
24697
|
+
subject: RetrainAssistSubjectSchema,
|
|
24698
|
+
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
24699
|
+
nodeId: string().optional()
|
|
24700
|
+
}), RetrainAssistResultSchema, {
|
|
24701
|
+
kind: "mutation",
|
|
24702
|
+
auth: "admin"
|
|
24703
|
+
}),
|
|
24704
|
+
/** Every annotation on a track, oldest first. */
|
|
24705
|
+
listRetrainAnnotations: method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
24706
|
+
kind: "query",
|
|
24707
|
+
auth: "admin"
|
|
24708
|
+
}),
|
|
24709
|
+
/**
|
|
24710
|
+
* Replace EVERY annotation on one frame with the supplied set.
|
|
24711
|
+
*
|
|
24712
|
+
* Whole-frame replacement, not per-box upsert: the unit of ground truth is
|
|
24713
|
+
* the frame, and "the operator deleted a box" must be the same durable
|
|
24714
|
+
* outcome as "the operator never drew it". A per-box patch would let a frame
|
|
24715
|
+
* keep a box the operator removed on a surface that only knew about the
|
|
24716
|
+
* boxes it sent.
|
|
24717
|
+
*
|
|
24718
|
+
* Refuses a macro class typed into `label` or `subLabel` — the tiers are
|
|
24719
|
+
* separate and the guard is at the WRITE, because a mixed taxonomy cannot
|
|
24720
|
+
* be un-mixed by reading it.
|
|
24721
|
+
*/
|
|
24722
|
+
saveRetrainAnnotations: method(object({
|
|
24723
|
+
deviceId: number(),
|
|
24724
|
+
trackId: string(),
|
|
24725
|
+
frameId: string(),
|
|
24726
|
+
annotations: array(RetrainAnnotationDraftSchema)
|
|
24727
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
24728
|
+
kind: "mutation",
|
|
24729
|
+
auth: "admin"
|
|
24730
|
+
}),
|
|
24731
|
+
/**
|
|
24732
|
+
* Finish with a track: `staging → trained`. **The only writer of that
|
|
24733
|
+
* state** — D81 shipped the column with it deliberately unreachable.
|
|
24734
|
+
*
|
|
24735
|
+
* Refuses a track the dataset holds no copies from. `trained` un-pins the
|
|
24736
|
+
* track's media, so completing without a copy is a delete order for material
|
|
24737
|
+
* nothing ever extracted anything from; that refusal IS the safety argument
|
|
24738
|
+
* of D81, expressed as a precondition.
|
|
24739
|
+
*/
|
|
24740
|
+
completeRetrainTrack: method(object({
|
|
24741
|
+
deviceId: number(),
|
|
24742
|
+
trackId: string()
|
|
24743
|
+
}), RetrainTransitionResultSchema, {
|
|
24744
|
+
kind: "mutation",
|
|
24745
|
+
auth: "admin"
|
|
24746
|
+
}),
|
|
24747
|
+
/**
|
|
24748
|
+
* The deliberate return: `trained → staging`, for the rare case.
|
|
24749
|
+
*
|
|
24750
|
+
* The generic `setTrackFlags` toggle refuses this in both directions by
|
|
24751
|
+
* design (D81) — re-staging from a checkbox is how the same material gets
|
|
24752
|
+
* annotated twice under two ground truths. Doing it here means the operator
|
|
24753
|
+
* is looking at the annotations that already exist while they decide, and
|
|
24754
|
+
* those annotations are LEFT ALONE: "put this back" must not be a
|
|
24755
|
+
* destructive act wearing a navigational name.
|
|
24756
|
+
*/
|
|
24757
|
+
restageRetrainTrack: method(object({
|
|
24758
|
+
deviceId: number(),
|
|
24759
|
+
trackId: string()
|
|
24760
|
+
}), RetrainTransitionResultSchema, {
|
|
24761
|
+
kind: "mutation",
|
|
24762
|
+
auth: "admin"
|
|
24763
|
+
}),
|
|
24764
|
+
/**
|
|
24765
|
+
* Where to download the ANNOTATED dataset.
|
|
24766
|
+
*
|
|
24767
|
+
* The sibling of `getTrainingExportUrl` and deliberately not the same
|
|
24768
|
+
* archive: that one streams a marked track's stored media verbatim, this one
|
|
24769
|
+
* streams the retrain COPIES plus an `annotations.json` carrying, for every
|
|
24770
|
+
* subject, the canonical full-frame box AND the geometry derived for each
|
|
24771
|
+
* model shape (letterboxed root / zone-cropped package / subject-cropped
|
|
24772
|
+
* classifier). Derived at export, never stored — one box in, three shapes
|
|
24773
|
+
* out, so two crops of the same subject can never end up in one feature
|
|
24774
|
+
* space (D52).
|
|
24775
|
+
*/
|
|
24776
|
+
getRetrainExportUrl: method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
25159
24777
|
kind: "query",
|
|
25160
24778
|
auth: "admin"
|
|
25161
24779
|
}),
|
|
25162
24780
|
/**
|
|
25163
|
-
* The
|
|
24781
|
+
* The media an EVENT owns.
|
|
25164
24782
|
*
|
|
25165
|
-
*
|
|
25166
|
-
*
|
|
25167
|
-
*
|
|
25168
|
-
*
|
|
25169
|
-
*
|
|
24783
|
+
* `ownerType` is REQUIRED, and that is the whole correction (D482). An
|
|
24784
|
+
* event is a row in ONE of three tables, and since D474 each numbers from
|
|
24785
|
+
* 1 independently: `motion:101314` and `object:101314` both exist. This
|
|
24786
|
+
* method took a bare `eventId` and the provider probed motion → object →
|
|
24787
|
+
* audio, stopping at the first hit — so on the live hub, where object
|
|
24788
|
+
* events own no media of their own and 299 883 of 300 559 media rows are
|
|
24789
|
+
* motion-owned, EVERY object event resolved to its motion namesake. A
|
|
24790
|
+
* track from 17:34 on camera 615 was served a snapshot from 22:35 eleven
|
|
24791
|
+
* days earlier, silently.
|
|
25170
24792
|
*
|
|
25171
|
-
*
|
|
25172
|
-
*
|
|
25173
|
-
*
|
|
24793
|
+
* D476 had already disambiguated the KEY (`motion:` vs `object:`); this is
|
|
24794
|
+
* the API catching up to it. Naming the table is not a "qualification" of
|
|
24795
|
+
* the ambiguity — a listing BY OWNER has no address to make surrogate: the
|
|
24796
|
+
* owner IS (table, id), and half of it is not a question.
|
|
25174
24797
|
*/
|
|
25175
|
-
|
|
25176
|
-
/**
|
|
25177
|
-
|
|
25178
|
-
|
|
25179
|
-
|
|
25180
|
-
|
|
25181
|
-
|
|
25182
|
-
}), array(
|
|
25183
|
-
|
|
25184
|
-
|
|
25185
|
-
|
|
24798
|
+
getEventMedia: method(object({
|
|
24799
|
+
/** Which of the three event tables owns the row. */
|
|
24800
|
+
ownerType: EventOwnerTypeSchema,
|
|
24801
|
+
/** The event's rowid in that table (D474: an event id is a number). */
|
|
24802
|
+
eventId: number().int(),
|
|
24803
|
+
kind: MediaFileKindEnum.optional(),
|
|
24804
|
+
deviceId: number()
|
|
24805
|
+
}), array(MediaFileSchema).readonly()),
|
|
24806
|
+
/** All media rows owned by a track. `kinds` narrows to a kind subset so a
|
|
24807
|
+
* client can fetch the SMALL display variants on open and pull the
|
|
24808
|
+
* multi-MB native variants only on demand (mirrors `getEventMedia.kind`).
|
|
24809
|
+
* Absent ⇒ every kind (back-compat). */
|
|
24810
|
+
getTrackMedia: method(object({
|
|
24811
|
+
trackId: string(),
|
|
24812
|
+
kinds: array(MediaFileKindEnum).optional(),
|
|
24813
|
+
deviceId: number()
|
|
24814
|
+
}), array(MediaFileSchema).readonly()),
|
|
25186
24815
|
/**
|
|
25187
|
-
* What a track
|
|
24816
|
+
* What media a track HAS, without any of it.
|
|
25188
24817
|
*
|
|
25189
|
-
*
|
|
25190
|
-
*
|
|
25191
|
-
*
|
|
25192
|
-
* is
|
|
24818
|
+
* The detail view needs the shape of a track's media to build its strip —
|
|
24819
|
+
* which kinds exist, in what order, at what size — and then wants each tile
|
|
24820
|
+
* fetched as an image, not as base64 inside this response. Measured: the
|
|
24821
|
+
* full `getTrackMedia` is 5.3-7.7 MB and blocks the view; this manifest is
|
|
24822
|
+
* ~2 KB.
|
|
25193
24823
|
*
|
|
25194
|
-
*
|
|
25195
|
-
*
|
|
25196
|
-
*
|
|
24824
|
+
* It also restores a fact a `kinds` filter destroys: filtering
|
|
24825
|
+
* `getTrackMedia` drops whole ROWS, taking `kind` and `sizeBytes` with
|
|
24826
|
+
* them, so a client that fetched only the small variants could no longer
|
|
24827
|
+
* tell a full-resolution variant existed — and the affordance that opens it
|
|
24828
|
+
* would silently disappear.
|
|
25197
24829
|
*/
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
}),
|
|
24830
|
+
listTrackMedia: method(object({
|
|
24831
|
+
trackId: string(),
|
|
24832
|
+
deviceId: number()
|
|
24833
|
+
}), array(MediaFileInfoSchema).readonly()),
|
|
25202
24834
|
/**
|
|
25203
|
-
*
|
|
24835
|
+
* What media an EVENT has, without any of it — the twin `getEventMedia`
|
|
24836
|
+
* never had.
|
|
25204
24837
|
*
|
|
25205
|
-
*
|
|
25206
|
-
*
|
|
25207
|
-
*
|
|
25208
|
-
*
|
|
24838
|
+
* `listTrackMedia` above got this treatment because a track's media is
|
|
24839
|
+
* 5-8 MB. An event's is worse per row, not better: an old-style event owns
|
|
24840
|
+
* a `crop` AND a native-resolution `fullFrameBoxed`, and the track DETAIL
|
|
24841
|
+
* modal — the one surface that legitimately shows the big kinds — unions
|
|
24842
|
+
* both listings to build its filmstrip. It then renders every tile from
|
|
24843
|
+
* the `event-media` plane by key and throws the bytes away. Measured on
|
|
24844
|
+
* the live hub: one event's `fullFrameBoxed` is 2 824 077 B, base64'd to
|
|
24845
|
+
* ~3.8 MB, allocated whole in hub-main's heap, for a list of keys.
|
|
25209
24846
|
*
|
|
25210
|
-
*
|
|
25211
|
-
*
|
|
25212
|
-
*
|
|
25213
|
-
*
|
|
25214
|
-
* never silent, on the wire or in the log.
|
|
24847
|
+
* Same `deviceId` authorization subject as `getEventMedia`, the same
|
|
24848
|
+
* REQUIRED `ownerType` (read that method's docblock for the night-time
|
|
24849
|
+
* thumbnail this closes — D482), and the same rows: this is a projection
|
|
24850
|
+
* of that method, never a different question.
|
|
25215
24851
|
*/
|
|
25216
|
-
|
|
24852
|
+
listEventMedia: method(object({
|
|
24853
|
+
ownerType: EventOwnerTypeSchema,
|
|
24854
|
+
eventId: number().int(),
|
|
24855
|
+
deviceId: number()
|
|
24856
|
+
}), array(MediaFileInfoSchema).readonly()),
|
|
24857
|
+
/**
|
|
24858
|
+
* Which of `ownerIds` hold at least ONE media row — an INDEX read, never a
|
|
24859
|
+
* blob read, and the LICENCE `videoclips` needs to publish a `thumbnail`.
|
|
24860
|
+
*
|
|
24861
|
+
* The event-media URL is stamped from a template for every event in the
|
|
24862
|
+
* system, so "the plane is up" was being served as "there are bytes": 64 of
|
|
24863
|
+
* one camera's 179 clips pointed at a 404 (device 3836, 2026-08-17). This
|
|
24864
|
+
* is the question that turns the stamp into a claim.
|
|
24865
|
+
*
|
|
24866
|
+
* It is on the WIRE because the clip source is registered by the addon that
|
|
24867
|
+
* owns the FOOTAGE, not by this one (D560) — the probe used to be an
|
|
24868
|
+
* in-process `MediaStore` read. One call per OWNER KIND, never one per
|
|
24869
|
+
* owner: that N+1 is what `MediaStore.ownersWithMedia` was written to
|
|
24870
|
+
* prevent, and crossing a process boundary makes it worse, not better.
|
|
24871
|
+
* `ownerIds` is bounded at the same 5 000 the annotation fetch is bounded
|
|
24872
|
+
* at, so one pathological camera-day cannot mint an unbounded request.
|
|
24873
|
+
*
|
|
24874
|
+
* THROWS rather than answering partially. A probe that quietly
|
|
24875
|
+
* under-reports reads as "these owners have nothing" and the caller drops
|
|
24876
|
+
* thumbnails that exist — the opposite failure to the one above, and
|
|
24877
|
+
* equally invisible.
|
|
24878
|
+
*
|
|
24879
|
+
* `deviceId` is the authorization subject, exactly as on `getEventMedia`.
|
|
24880
|
+
*/
|
|
24881
|
+
ownersWithMedia: method(object({
|
|
25217
24882
|
deviceId: number(),
|
|
25218
|
-
|
|
25219
|
-
|
|
25220
|
-
}),
|
|
24883
|
+
ownerKind: MediaPresenceOwnerKindSchema,
|
|
24884
|
+
ownerIds: array(string()).max(5e3)
|
|
24885
|
+
}), array(string()).readonly()),
|
|
24886
|
+
/**
|
|
24887
|
+
* Search object events by text query using CLIP cosine similarity.
|
|
24888
|
+
* Encodes `text` via the `embedding-encoder` cap, queries the
|
|
24889
|
+
* `ObjectEmbeddingStore` with optional prefilters, ranks all matching
|
|
24890
|
+
* embeddings by cosine similarity, and joins winners to their
|
|
24891
|
+
* ObjectEvents by trackId. Returns up to `limit` events scored ≥
|
|
24892
|
+
* `minScore`, sorted descending by score.
|
|
24893
|
+
*/
|
|
24894
|
+
searchObjectEvents: method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()),
|
|
24895
|
+
wipeObjectEmbeddings: method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
25221
24896
|
kind: "mutation",
|
|
25222
24897
|
auth: "admin"
|
|
25223
24898
|
}),
|
|
25224
|
-
|
|
25225
|
-
* Deliberately destructive and deliberately explicit — it is the only way
|
|
25226
|
-
* a frame leaves the dataset before export. */
|
|
25227
|
-
deselectRetrainFrame: method(object({
|
|
25228
|
-
deviceId: number(),
|
|
25229
|
-
trackId: string(),
|
|
25230
|
-
frameId: string()
|
|
25231
|
-
}), object({
|
|
25232
|
-
removed: boolean(),
|
|
25233
|
-
removedAnnotations: number().int()
|
|
25234
|
-
}), {
|
|
24899
|
+
rebuildObjectEmbeddings: method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
25235
24900
|
kind: "mutation",
|
|
25236
24901
|
auth: "admin"
|
|
25237
24902
|
}),
|
|
24903
|
+
getObjectEmbeddingRebuildStatus: method(object({}), RebuildStatusSchema)
|
|
24904
|
+
},
|
|
24905
|
+
events: {
|
|
25238
24906
|
/**
|
|
25239
|
-
*
|
|
25240
|
-
*
|
|
25241
|
-
*
|
|
25242
|
-
*
|
|
25243
|
-
*
|
|
25244
|
-
*
|
|
25245
|
-
* answer: a canvas that places a normalised box against a size it guessed
|
|
25246
|
-
* draws every box in the wrong place.
|
|
24907
|
+
* Enriched frame emitted after refinement — the live-overlay source of
|
|
24908
|
+
* truth (two-plane re-injection). Carries the frame's detections in the
|
|
24909
|
+
* `ObjectDetection` wire shape: first-level roots (with track info +
|
|
24910
|
+
* enrichment labels) plus synthesized `kind:'detail'` face/plate entries
|
|
24911
|
+
* re-projected from per-track detail state, so stream overlays render
|
|
24912
|
+
* boxes + recognized names without querying full Track state.
|
|
25247
24913
|
*/
|
|
25248
|
-
|
|
25249
|
-
|
|
25250
|
-
|
|
25251
|
-
|
|
25252
|
-
|
|
25253
|
-
|
|
25254
|
-
|
|
25255
|
-
|
|
25256
|
-
|
|
25257
|
-
|
|
25258
|
-
|
|
25259
|
-
|
|
25260
|
-
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
|
|
25264
|
-
|
|
25265
|
-
|
|
25266
|
-
|
|
25267
|
-
|
|
25268
|
-
|
|
24914
|
+
onFrameTracked: { data: object({
|
|
24915
|
+
deviceId: number(),
|
|
24916
|
+
timestamp: number(),
|
|
24917
|
+
frameWidth: number(),
|
|
24918
|
+
frameHeight: number(),
|
|
24919
|
+
detections: array(OverlayDetectionSchema).readonly()
|
|
24920
|
+
}) },
|
|
24921
|
+
/** Track entered active state (first-seen). */
|
|
24922
|
+
onTrackStarted: { data: object({
|
|
24923
|
+
deviceId: number(),
|
|
24924
|
+
trackId: string(),
|
|
24925
|
+
className: string()
|
|
24926
|
+
}) },
|
|
24927
|
+
/** Track expired (TTL reached after last detection). */
|
|
24928
|
+
onTrackEnded: { data: object({
|
|
24929
|
+
deviceId: number(),
|
|
24930
|
+
trackId: string(),
|
|
24931
|
+
className: string(),
|
|
24932
|
+
durationMs: number()
|
|
24933
|
+
}) },
|
|
24934
|
+
/** Canonical "something happened at device X" event, per-kind. */
|
|
24935
|
+
onDetectionEvent: { data: object({
|
|
24936
|
+
deviceId: number(),
|
|
24937
|
+
kind: EventKindSchema,
|
|
24938
|
+
eventId: string(),
|
|
24939
|
+
timestamp: number()
|
|
24940
|
+
}) }
|
|
24941
|
+
}
|
|
24942
|
+
};
|
|
24943
|
+
/**
|
|
24944
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
24945
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
24946
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
24947
|
+
*/
|
|
24948
|
+
var NativeCropRefSchema = object({
|
|
24949
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
24950
|
+
handle: FrameHandleSchema,
|
|
24951
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
24952
|
+
cropFrameSpace: object({
|
|
24953
|
+
x: number(),
|
|
24954
|
+
y: number(),
|
|
24955
|
+
w: number(),
|
|
24956
|
+
h: number()
|
|
24957
|
+
})
|
|
24958
|
+
});
|
|
24959
|
+
object({
|
|
24960
|
+
crop: object({
|
|
24961
|
+
left: number(),
|
|
24962
|
+
top: number(),
|
|
24963
|
+
width: number().positive(),
|
|
24964
|
+
height: number().positive()
|
|
24965
|
+
}).optional(),
|
|
24966
|
+
content: object({
|
|
24967
|
+
width: number().int().positive(),
|
|
24968
|
+
height: number().int().positive()
|
|
24969
|
+
}),
|
|
24970
|
+
fit: _enum(["stretch", "contain"]),
|
|
24971
|
+
format: _enum([
|
|
24972
|
+
"rgb",
|
|
24973
|
+
"gray",
|
|
24974
|
+
"jpeg"
|
|
24975
|
+
])
|
|
24976
|
+
});
|
|
24977
|
+
/**
|
|
24978
|
+
* Process-local frame identity. It is serializable so it can ride an in-process
|
|
24979
|
+
* capability call, but `registryId` deliberately prevents resolution in any
|
|
24980
|
+
* other process or execution group.
|
|
24981
|
+
*/
|
|
24982
|
+
var FrameRefSchema = object({
|
|
24983
|
+
registryId: string().min(1),
|
|
24984
|
+
id: string().min(1),
|
|
24985
|
+
width: number().int().positive(),
|
|
24986
|
+
height: number().int().positive(),
|
|
24987
|
+
format: _enum(["rgb", "gray"]),
|
|
24988
|
+
timestamp: number(),
|
|
24989
|
+
capturedAt: number().optional()
|
|
24990
|
+
});
|
|
24991
|
+
var ModelFormatSchema$1 = _enum([
|
|
24992
|
+
"onnx",
|
|
24993
|
+
"coreml",
|
|
24994
|
+
"openvino",
|
|
24995
|
+
"tflite",
|
|
24996
|
+
"pt",
|
|
24997
|
+
"gguf"
|
|
24998
|
+
]);
|
|
24999
|
+
var PipelineSlotSchema = _enum([
|
|
25000
|
+
"detector",
|
|
25001
|
+
"cropper",
|
|
25002
|
+
"classifier",
|
|
25003
|
+
"refiner",
|
|
25004
|
+
"audio-classifier"
|
|
25005
|
+
]);
|
|
25006
|
+
var PipelineEngineChoiceSchema = object({
|
|
25007
|
+
runtime: literal("python"),
|
|
25008
|
+
backend: string(),
|
|
25009
|
+
format: ModelFormatSchema$1,
|
|
25010
|
+
device: string().optional()
|
|
25011
|
+
});
|
|
25012
|
+
/**
|
|
25013
|
+
* One pool's resolved provisioning (`getEffectiveTuning`). `numWorkers` is the
|
|
25014
|
+
* knob that lifts a saturated pool (`inference-devices.md`); `concurrency` is
|
|
25015
|
+
* per-worker in-flight requests. `deviceKey` echoes the pool asked about —
|
|
25016
|
+
* `null` for the node-default pool.
|
|
25017
|
+
*/
|
|
25018
|
+
var EffectiveTuningSchema = object({
|
|
25019
|
+
deviceKey: string().nullable(),
|
|
25020
|
+
runtime: string(),
|
|
25021
|
+
batchMode: string(),
|
|
25022
|
+
windowMs: number(),
|
|
25023
|
+
maxBatchSize: number(),
|
|
25024
|
+
concurrency: number(),
|
|
25025
|
+
numWorkers: number()
|
|
25026
|
+
});
|
|
25027
|
+
var AvailableEngineSchema = object({
|
|
25028
|
+
engine: PipelineEngineChoiceSchema,
|
|
25029
|
+
devices: array(object({
|
|
25030
|
+
id: string(),
|
|
25031
|
+
label: string(),
|
|
25032
|
+
description: string().optional()
|
|
25033
|
+
})).readonly(),
|
|
25034
|
+
defaultDevice: string()
|
|
25035
|
+
});
|
|
25036
|
+
var PipelineDefaultStepSchema = lazy(() => object({
|
|
25037
|
+
addonId: string(),
|
|
25038
|
+
addonName: string(),
|
|
25039
|
+
slot: PipelineSlotSchema,
|
|
25040
|
+
inputClasses: array(string()).readonly(),
|
|
25041
|
+
outputClasses: array(string()).readonly(),
|
|
25042
|
+
enabled: boolean(),
|
|
25043
|
+
modelId: string(),
|
|
25044
|
+
children: array(PipelineDefaultStepSchema).readonly(),
|
|
25045
|
+
group: string().optional(),
|
|
25046
|
+
settings: record(string(), unknown()).optional()
|
|
25047
|
+
}));
|
|
25048
|
+
var PipelineTemplateStepSchema = lazy(() => object({
|
|
25049
|
+
addonId: string(),
|
|
25050
|
+
enabled: boolean(),
|
|
25051
|
+
modelId: string(),
|
|
25052
|
+
children: array(PipelineTemplateStepSchema).readonly(),
|
|
25053
|
+
settings: record(string(), unknown()).optional()
|
|
25054
|
+
}));
|
|
25055
|
+
var PipelineTemplateSchema$1 = object({
|
|
25056
|
+
id: string(),
|
|
25057
|
+
name: string(),
|
|
25058
|
+
createdAt: string(),
|
|
25059
|
+
updatedAt: string(),
|
|
25060
|
+
engine: PipelineEngineChoiceSchema,
|
|
25061
|
+
steps: array(PipelineTemplateStepSchema).readonly()
|
|
25062
|
+
});
|
|
25063
|
+
var PipelineModelOptionSchema = object({
|
|
25064
|
+
id: string(),
|
|
25065
|
+
name: string(),
|
|
25066
|
+
formats: record(string(), object({
|
|
25067
|
+
downloaded: boolean(),
|
|
25068
|
+
sizeMB: number()
|
|
25069
|
+
})),
|
|
25070
|
+
group: ModelVariantGroupSchema.optional(),
|
|
25071
|
+
legacy: boolean().optional(),
|
|
25072
|
+
provider: ModelProviderIdSchema.optional()
|
|
25073
|
+
});
|
|
25074
|
+
var ConfigFieldBridge = custom();
|
|
25075
|
+
var PipelineAddonSchemaSchema = object({
|
|
25076
|
+
id: string(),
|
|
25077
|
+
name: string(),
|
|
25078
|
+
slot: PipelineSlotSchema,
|
|
25079
|
+
inputClasses: array(string()).readonly(),
|
|
25080
|
+
outputClasses: array(string()).readonly(),
|
|
25081
|
+
childSlots: array(PipelineSlotSchema).readonly(),
|
|
25082
|
+
models: array(PipelineModelOptionSchema).readonly(),
|
|
25083
|
+
defaultModelId: string(),
|
|
25084
|
+
defaultModelIdByFormat: record(string(), string()).optional(),
|
|
25085
|
+
enabledByDefault: boolean().optional(),
|
|
25086
|
+
backfillIntoExistingOverrides: boolean().optional(),
|
|
25087
|
+
defaultConfidence: number(),
|
|
25088
|
+
group: string().optional(),
|
|
25089
|
+
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
25090
|
+
});
|
|
25091
|
+
var PipelineSlotSchemaSchema = object({
|
|
25092
|
+
id: PipelineSlotSchema,
|
|
25093
|
+
label: string(),
|
|
25094
|
+
priority: number(),
|
|
25095
|
+
parentSlot: PipelineSlotSchema.nullable(),
|
|
25096
|
+
addons: array(PipelineAddonSchemaSchema).readonly()
|
|
25097
|
+
});
|
|
25098
|
+
var PipelineSchemaSchema = object({
|
|
25099
|
+
availableEngines: array(AvailableEngineSchema).readonly(),
|
|
25100
|
+
selectedEngine: PipelineEngineChoiceSchema,
|
|
25101
|
+
slots: array(PipelineSlotSchemaSchema).readonly()
|
|
25102
|
+
});
|
|
25103
|
+
var EngineProvisioningSchema = object({
|
|
25104
|
+
runtimeId: _enum([
|
|
25105
|
+
"onnx",
|
|
25106
|
+
"openvino",
|
|
25107
|
+
"coreml",
|
|
25108
|
+
"edgetpu"
|
|
25109
|
+
]).nullable(),
|
|
25110
|
+
device: string().nullable(),
|
|
25111
|
+
state: _enum([
|
|
25112
|
+
"idle",
|
|
25113
|
+
"installing",
|
|
25114
|
+
"verifying",
|
|
25115
|
+
"ready",
|
|
25116
|
+
"failed"
|
|
25117
|
+
]),
|
|
25118
|
+
progress: number().optional(),
|
|
25119
|
+
error: string().optional(),
|
|
25120
|
+
nextRetryAt: number().optional(),
|
|
25121
|
+
/**
|
|
25122
|
+
* Gate A (config-correctness gate at engine change): human-readable
|
|
25123
|
+
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
25124
|
+
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
25125
|
+
* has a <format> build"). Additive/optional: informational only, never
|
|
25126
|
+
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
25127
|
+
* Absent/empty when the node-default tree resolves cleanly.
|
|
25128
|
+
*/
|
|
25129
|
+
configIssues: array(string()).optional()
|
|
25130
|
+
});
|
|
25131
|
+
var PipelineStepInputSchema = lazy(() => object({
|
|
25132
|
+
addonId: string(),
|
|
25133
|
+
modelId: string().optional(),
|
|
25134
|
+
enabled: boolean().default(true),
|
|
25135
|
+
children: array(PipelineStepInputSchema).optional(),
|
|
25136
|
+
settings: record(string(), unknown()).optional(),
|
|
25137
|
+
jumpDeviceKey: string().optional()
|
|
25138
|
+
}));
|
|
25139
|
+
var ModelSubstitutionSchema = object({
|
|
25140
|
+
addonId: string(),
|
|
25141
|
+
chosen: string(),
|
|
25142
|
+
running: string(),
|
|
25143
|
+
format: string()
|
|
25144
|
+
});
|
|
25145
|
+
var PipelineValidationIssueSchema = object({
|
|
25146
|
+
addonId: string(),
|
|
25147
|
+
kind: _enum([
|
|
25148
|
+
"unknown-addon",
|
|
25149
|
+
"no-format-build",
|
|
25150
|
+
"unknown-device"
|
|
25151
|
+
]),
|
|
25152
|
+
detail: string()
|
|
25153
|
+
});
|
|
25154
|
+
var PipelineValidationResultSchema = object({
|
|
25155
|
+
ok: boolean(),
|
|
25156
|
+
issues: array(PipelineValidationIssueSchema).readonly(),
|
|
25157
|
+
substitutions: array(ModelSubstitutionSchema).readonly(),
|
|
25158
|
+
/** The node's `currentEngine.format` this validation ran against. */
|
|
25159
|
+
format: string()
|
|
25160
|
+
});
|
|
25161
|
+
var ReferenceImageEntrySchema = object({
|
|
25162
|
+
filename: string(),
|
|
25163
|
+
stepIds: array(string()).readonly().optional()
|
|
25164
|
+
});
|
|
25165
|
+
var ReferenceImageBodySchema = object({
|
|
25166
|
+
base64: string(),
|
|
25167
|
+
filename: string()
|
|
25168
|
+
});
|
|
25169
|
+
var ReferenceAudioEntrySchema = object({
|
|
25170
|
+
filename: string(),
|
|
25171
|
+
sizeKb: number()
|
|
25172
|
+
});
|
|
25173
|
+
var ReferenceAudioBodySchema = object({ base64: string() });
|
|
25174
|
+
var AudioBackendSchema = object({
|
|
25175
|
+
id: string(),
|
|
25176
|
+
name: string(),
|
|
25177
|
+
description: string(),
|
|
25178
|
+
available: boolean(),
|
|
25179
|
+
/**
|
|
25180
|
+
* Raw classifier labels this backend can emit (e.g. YAMNet's
|
|
25181
|
+
* 521-class set or Apple SoundAnalysis's 303-class set). Used by
|
|
25182
|
+
* the benchmark UI to populate the `enabledMicroClasses` filter
|
|
25183
|
+
* specific to the selected backend without a separate fetch.
|
|
25184
|
+
*/
|
|
25185
|
+
rawLabels: array(string()).readonly().optional()
|
|
25186
|
+
});
|
|
25187
|
+
var AudioCapabilitiesSchema = object({
|
|
25188
|
+
activeBackend: string(),
|
|
25189
|
+
availableBackends: array(AudioBackendSchema).readonly(),
|
|
25190
|
+
sampleRate: number(),
|
|
25191
|
+
chunkDurationMs: number()
|
|
25192
|
+
});
|
|
25193
|
+
var DownloadModelResultSchema = object({
|
|
25194
|
+
filePath: string(),
|
|
25195
|
+
sizeMB: number(),
|
|
25196
|
+
durationMs: number()
|
|
25197
|
+
});
|
|
25198
|
+
/**
|
|
25199
|
+
* Wrapper carrying a single test run's result. Replaces the legacy
|
|
25200
|
+
* ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
|
|
25201
|
+
* canonical `AudioResult` from the Phase 6 output rework: one
|
|
25202
|
+
* `AudioDetection` per class above `minScore`, top-N candidates in
|
|
25203
|
+
* `debug.alternateLabels['audio-classifier']`, per-source timings in
|
|
25204
|
+
* `debug.stepTimings`. The outer `success`/`error` fields stay so the
|
|
25205
|
+
* benchmark UI can still report a clean failure when the classifier
|
|
25206
|
+
* cap isn't available.
|
|
25207
|
+
*/
|
|
25208
|
+
var AudioTestResultSchema = object({
|
|
25209
|
+
success: boolean(),
|
|
25210
|
+
error: string().optional(),
|
|
25211
|
+
frame: custom().optional()
|
|
25212
|
+
});
|
|
25213
|
+
var PipelineConfigBridge = custom();
|
|
25214
|
+
var ConfigUISchemaBridge = custom();
|
|
25215
|
+
var ConfigUISchemaNullableBridge = custom();
|
|
25216
|
+
var InferenceCapabilitiesBridge = custom();
|
|
25217
|
+
var ModelAvailabilityListBridge = custom();
|
|
25218
|
+
var PipelineRunResultBridge = custom();
|
|
25219
|
+
/**
|
|
25220
|
+
* Pipeline executor — detection engine + configuration + inference API.
|
|
25221
|
+
*
|
|
25222
|
+
* Merged from: pipeline-executor, pipeline-config, inference, detection-config.
|
|
25223
|
+
* Implemented by the detection-pipeline addon.
|
|
25224
|
+
*
|
|
25225
|
+
* Per-device surface (DeviceSettingsContribution + the "is detection
|
|
25226
|
+
* enabled for this camera?" toggle) lives on the paired
|
|
25227
|
+
* `detection-pipeline` cap (device-scoped, singleton, wrapper
|
|
25228
|
+
* defaultActive) — same split pattern used by stream-broker /
|
|
25229
|
+
* camera-streams and audio-analyzer / audio-analysis.
|
|
25230
|
+
*/
|
|
25231
|
+
var pipelineExecutorCapability = {
|
|
25232
|
+
name: "pipeline-executor",
|
|
25233
|
+
scope: "system",
|
|
25234
|
+
mode: "singleton",
|
|
25235
|
+
methods: {
|
|
25236
|
+
getAvailableEngines: method(_void(), array(PipelineEngineChoiceSchema)),
|
|
25237
|
+
getSelectedEngine: method(_void(), PipelineEngineChoiceSchema),
|
|
25238
|
+
getDefaultSteps: method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)),
|
|
25239
|
+
/**
|
|
25240
|
+
* Per-node detection-engine provisioning snapshot. Returns the live
|
|
25241
|
+
* state of the lazy runtime-provisioning machine on `nodeId`
|
|
25242
|
+
* (idle / installing / verifying / ready / failed). The UI pairs this
|
|
25243
|
+
* one-shot query with the `pipeline.engine-provisioning` live event
|
|
25244
|
+
* (emitted on every transition) to drive a per-node "engine ready?"
|
|
25245
|
+
* indicator without polling. Phase 2.
|
|
25269
25246
|
*/
|
|
25270
|
-
|
|
25271
|
-
|
|
25272
|
-
|
|
25273
|
-
|
|
25274
|
-
|
|
25275
|
-
|
|
25276
|
-
|
|
25277
|
-
|
|
25247
|
+
getEngineProvisioning: method(object({ nodeId: string() }), EngineProvisioningSchema),
|
|
25248
|
+
getVideoPipelineSteps: method(_void(), record(string(), object({
|
|
25249
|
+
modelId: string(),
|
|
25250
|
+
settings: record(string(), unknown()).readonly()
|
|
25251
|
+
}))),
|
|
25252
|
+
setVideoPipelineSteps: method(object({ steps: record(string(), object({
|
|
25253
|
+
modelId: string(),
|
|
25254
|
+
settings: record(string(), unknown()).readonly()
|
|
25255
|
+
})) }), object({ success: literal(true) }), {
|
|
25278
25256
|
kind: "mutation",
|
|
25279
25257
|
auth: "admin"
|
|
25280
25258
|
}),
|
|
25281
25259
|
/**
|
|
25282
|
-
*
|
|
25283
|
-
*
|
|
25284
|
-
* `
|
|
25285
|
-
*
|
|
25260
|
+
* Clear THIS node's executor-side PER-DEVICE settings stores (the
|
|
25261
|
+
* per-camera step overrides the object-detection root reads via
|
|
25262
|
+
* `applyDeviceOverridesToTree`). `nodeId` is the ROUTING key — the
|
|
25263
|
+
* generated cap-router strips it (default `nodeIdMode: 'routing'`) and
|
|
25264
|
+
* dispatches to that node, so the provider method runs ON the target
|
|
25265
|
+
* node and receives no `nodeId`.
|
|
25286
25266
|
*
|
|
25287
|
-
*
|
|
25288
|
-
* `
|
|
25289
|
-
*
|
|
25290
|
-
*
|
|
25291
|
-
*
|
|
25292
|
-
*
|
|
25293
|
-
* (`addon-benchmark`'s `replay-plan.ts`), never read from or written to
|
|
25294
|
-
* the `zones` capability by this method itself.
|
|
25267
|
+
* This is the slimmed executor leg of the orchestrator's
|
|
25268
|
+
* `resetNodePipelineDefaults` flow (which owns the real reset: node
|
|
25269
|
+
* addonDefaults pins + per-camera orchestrator overrides). The legacy
|
|
25270
|
+
* `resetToDefault` — which reset a persisted global step-tree seed
|
|
25271
|
+
* nothing in the live per-camera path read — was removed together with
|
|
25272
|
+
* that seed.
|
|
25295
25273
|
*/
|
|
25296
|
-
|
|
25297
|
-
|
|
25298
|
-
|
|
25299
|
-
|
|
25300
|
-
detectionRules: array(ZoneRuleSchema).readonly().optional(),
|
|
25301
|
-
zoneMembershipMinOverlap: number().min(0).max(1).optional(),
|
|
25302
|
-
frames: array(ReplayFrameInputSchema).min(1)
|
|
25303
|
-
}), RunReplayFrameProcessorResultSchema, {
|
|
25274
|
+
clearDeviceOverrides: method(object({ nodeId: string() }), object({
|
|
25275
|
+
success: literal(true),
|
|
25276
|
+
clearedDevices: number()
|
|
25277
|
+
}), {
|
|
25304
25278
|
kind: "mutation",
|
|
25305
25279
|
auth: "admin"
|
|
25306
25280
|
}),
|
|
25307
|
-
/** Every annotation on a track, oldest first. */
|
|
25308
|
-
listRetrainAnnotations: method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
25309
|
-
kind: "query",
|
|
25310
|
-
auth: "admin"
|
|
25311
|
-
}),
|
|
25312
25281
|
/**
|
|
25313
|
-
*
|
|
25282
|
+
* Which of THIS node's inference devices the executor currently refuses,
|
|
25283
|
+
* and why. `nodeId` is the ROUTING key (stripped by the generated router).
|
|
25314
25284
|
*
|
|
25315
|
-
*
|
|
25316
|
-
*
|
|
25317
|
-
*
|
|
25318
|
-
*
|
|
25319
|
-
*
|
|
25285
|
+
* The channel that did not exist. Pool health was known only inside the
|
|
25286
|
+
* detection addon and was an input to no routing decision anywhere: the
|
|
25287
|
+
* per-dispatch capability gate is keyed on model FORMAT and so can never
|
|
25288
|
+
* separate `openvino:gpu` from `openvino:npu`, and the orchestrator's live
|
|
25289
|
+
* eligibility probe (`platformProbe.getCapabilities`) answers about
|
|
25290
|
+
* HARDWARE — which was present throughout. So when the hub's `openvino:gpu`
|
|
25291
|
+
* Python worker was SIGABRT'd by the Intel GPU plugin on 2026-08-25, the
|
|
25292
|
+
* balancer went on handing that dead pool cameras by rotation for 31 hours:
|
|
25293
|
+
* ~370 000 `PoolWorker[w0]: not initialized` lines, every frame lost.
|
|
25320
25294
|
*
|
|
25321
|
-
*
|
|
25322
|
-
*
|
|
25323
|
-
*
|
|
25295
|
+
* Read semantics the caller depends on, and which the provider guarantees:
|
|
25296
|
+
* this is a synchronous read of in-memory state. It never probes hardware,
|
|
25297
|
+
* never spawns a pool and never throws — an EMPTY `unhealthy` means "asked,
|
|
25298
|
+
* nothing is refused", which is what re-admits a device. A read that FAILS
|
|
25299
|
+
* (node offline, version skew) must therefore be distinguishable from an
|
|
25300
|
+
* empty answer, and it is: it rejects.
|
|
25324
25301
|
*/
|
|
25325
|
-
|
|
25326
|
-
|
|
25327
|
-
|
|
25328
|
-
|
|
25329
|
-
|
|
25330
|
-
|
|
25331
|
-
|
|
25332
|
-
|
|
25333
|
-
|
|
25302
|
+
getInferenceDeviceHealth: method(object({ nodeId: string() }), object({ unhealthy: array(object({
|
|
25303
|
+
/** `<backend>:<device>`, e.g. `openvino:gpu`. */
|
|
25304
|
+
deviceKey: string(),
|
|
25305
|
+
/**
|
|
25306
|
+
* `failed` — the per-device restart budget is exhausted; no pool
|
|
25307
|
+
* will be spawned until an operator re-arms it or the runner
|
|
25308
|
+
* respawns. `backoff` — under budget, waiting out the backoff (or
|
|
25309
|
+
* a cached pool observed dead and not yet condemned).
|
|
25310
|
+
*/
|
|
25311
|
+
state: _enum(["failed", "backoff"]),
|
|
25312
|
+
/** Epoch ms of the death that produced this state. */
|
|
25313
|
+
since: number(),
|
|
25314
|
+
/** Pool deaths inside the current window. */
|
|
25315
|
+
deaths: number(),
|
|
25316
|
+
/** The last death's message. */
|
|
25317
|
+
lastError: string()
|
|
25318
|
+
})).readonly() })),
|
|
25334
25319
|
/**
|
|
25335
|
-
*
|
|
25336
|
-
*
|
|
25320
|
+
* Re-arm a terminally `failed` inference device on `nodeId`: forget its
|
|
25321
|
+
* restart budget so the next dispatch builds a fresh pool.
|
|
25337
25322
|
*
|
|
25338
|
-
*
|
|
25339
|
-
*
|
|
25340
|
-
*
|
|
25341
|
-
*
|
|
25323
|
+
* The terminal state is deliberate (the abort it bounds is deterministic —
|
|
25324
|
+
* an automatic probation would just respawn Python forever, more slowly),
|
|
25325
|
+
* and a terminal state an operator cannot leave is a silent fault. This is
|
|
25326
|
+
* the way out. `rearmed:false` means there was nothing to forget.
|
|
25342
25327
|
*/
|
|
25343
|
-
|
|
25344
|
-
|
|
25345
|
-
|
|
25346
|
-
}),
|
|
25328
|
+
rearmInferenceDevice: method(object({
|
|
25329
|
+
nodeId: string(),
|
|
25330
|
+
deviceKey: string()
|
|
25331
|
+
}), object({ rearmed: boolean() }), {
|
|
25347
25332
|
kind: "mutation",
|
|
25348
25333
|
auth: "admin"
|
|
25349
25334
|
}),
|
|
25335
|
+
getSchema: method(_void(), PipelineSchemaSchema),
|
|
25336
|
+
getGlobalSteps: method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()),
|
|
25337
|
+
getGlobalPipelineConfig: method(_void(), PipelineConfigBridge),
|
|
25338
|
+
getOrchestratorConfigSchema: method(_void(), ConfigUISchemaBridge),
|
|
25350
25339
|
/**
|
|
25351
|
-
*
|
|
25340
|
+
* Gate B (pre-init config-correctness gate). PURE COMPUTE against this
|
|
25341
|
+
* node's `currentEngine.format` — resolves `steps` the same way the
|
|
25342
|
+
* runtime dispatch path would, and reports what WOULD happen without
|
|
25343
|
+
* touching any node-global state. Called by the orchestrator at attach
|
|
25344
|
+
* time (`attachOn`), node-pinned to the TARGET node, so config problems
|
|
25345
|
+
* surface BEFORE `pipelineRunner.attachCamera` rather than at the first
|
|
25346
|
+
* per-frame resolve. `ok` is false iff `issues` is non-empty (both
|
|
25347
|
+
* `unknown-addon` and `no-format-build` are HARD issues); `substitutions`
|
|
25348
|
+
* is informational (a degraded-but-loadable model swap) and never
|
|
25349
|
+
* affects `ok`. Never throws.
|
|
25352
25350
|
*
|
|
25353
|
-
*
|
|
25354
|
-
*
|
|
25355
|
-
*
|
|
25356
|
-
* is looking at the annotations that already exist while they decide, and
|
|
25357
|
-
* those annotations are LEFT ALONE: "put this back" must not be a
|
|
25358
|
-
* destructive act wearing a navigational name.
|
|
25351
|
+
* `deviceKey` validates against THAT device pool's format instead of the
|
|
25352
|
+
* node default (D646) — the cheap question a pinned replay asks before it
|
|
25353
|
+
* reads any media: can this (node, deviceKey) run exactly this model?
|
|
25359
25354
|
*/
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
}),
|
|
25364
|
-
|
|
25365
|
-
|
|
25366
|
-
|
|
25355
|
+
validatePipeline: method(object({
|
|
25356
|
+
steps: array(PipelineStepInputSchema),
|
|
25357
|
+
deviceKey: string().optional()
|
|
25358
|
+
}), PipelineValidationResultSchema),
|
|
25359
|
+
listTemplates: method(_void(), array(PipelineTemplateSchema$1).readonly()),
|
|
25360
|
+
saveTemplate: method(object({
|
|
25361
|
+
name: string(),
|
|
25362
|
+
steps: array(PipelineTemplateStepSchema).readonly(),
|
|
25363
|
+
engine: PipelineEngineChoiceSchema
|
|
25364
|
+
}), PipelineTemplateSchema$1, { kind: "mutation" }),
|
|
25365
|
+
updateTemplate: method(object({
|
|
25366
|
+
id: string(),
|
|
25367
|
+
name: string().optional(),
|
|
25368
|
+
steps: array(PipelineTemplateStepSchema).readonly().optional()
|
|
25369
|
+
}), PipelineTemplateSchema$1, { kind: "mutation" }),
|
|
25370
|
+
deleteTemplate: method(object({ id: string() }), _void(), { kind: "mutation" }),
|
|
25371
|
+
getCapabilities: method(_void(), InferenceCapabilitiesBridge),
|
|
25372
|
+
getAddonModels: method(object({ addonId: string() }), ModelAvailabilityListBridge),
|
|
25373
|
+
downloadModel: method(object({
|
|
25374
|
+
addonId: string(),
|
|
25375
|
+
modelId: string(),
|
|
25376
|
+
format: ModelFormatSchema$1
|
|
25377
|
+
}), DownloadModelResultSchema, { kind: "mutation" }),
|
|
25378
|
+
deleteModel: method(object({
|
|
25379
|
+
addonId: string(),
|
|
25380
|
+
modelId: string(),
|
|
25381
|
+
format: ModelFormatSchema$1
|
|
25382
|
+
}), object({ success: literal(true) }), { kind: "mutation" }),
|
|
25367
25383
|
/**
|
|
25368
|
-
*
|
|
25384
|
+
* Stateless single-frame execution. Callers (runner, benchmark) pass
|
|
25385
|
+
* the complete `steps` tree; the executor holds no state about cameras
|
|
25386
|
+
* or saved pipelines. WHICH pool answers is the node's own engine, or the
|
|
25387
|
+
* `deviceKey` pool when one is named.
|
|
25369
25388
|
*
|
|
25370
|
-
*
|
|
25371
|
-
*
|
|
25372
|
-
*
|
|
25373
|
-
*
|
|
25374
|
-
*
|
|
25375
|
-
*
|
|
25376
|
-
*
|
|
25377
|
-
*
|
|
25389
|
+
* There is no `engine` field (D646). It existed for the benchmark and was
|
|
25390
|
+
* honoured by swapping the SHARED provider's engine, factory and executor
|
|
25391
|
+
* for the duration of the call, on a node serving live cameras. A caller
|
|
25392
|
+
* that still sends the key has it stripped here and changes nothing.
|
|
25393
|
+
*
|
|
25394
|
+
* Exactly one of `frame`, `frameRef`, `frameHandle`, `imageBase64`,
|
|
25395
|
+
* `referenceImage` must be provided:
|
|
25396
|
+
* - `frame`: runtime dispatch path (runner → decoded broker frame).
|
|
25397
|
+
* Carries the raw buffer, dimensions, and format; the executor
|
|
25398
|
+
* uses it directly without base64 round-tripping.
|
|
25399
|
+
* - `frameHandle` (CB5): a zero-pixel shm `FrameHandle` for the SAME
|
|
25400
|
+
* decoded frame. Both runner and executor are hub-local processes
|
|
25401
|
+
* sharing `/dev/shm`, so the executor maps the named segment and
|
|
25402
|
+
* reads the pixels back zero-copy — eliminating the ~1.2MB
|
|
25403
|
+
* re-serialisation over UDS/MsgPack the `frame` path pays per call.
|
|
25404
|
+
* High-risk: the FrameRing is a latest-wins seqlock with no
|
|
25405
|
+
* refcount, so a recycled slot yields a null read; the executor
|
|
25406
|
+
* then degrades to an empty result and the runner ships pixels via
|
|
25407
|
+
* `frame` as the fallback (queue-depth gated on the runner side).
|
|
25408
|
+
* - `imageBase64`: one-shot test path (benchmark ImageTab).
|
|
25409
|
+
* - `referenceImage`: named file from the reference-image store.
|
|
25378
25410
|
*/
|
|
25379
|
-
|
|
25380
|
-
|
|
25381
|
-
|
|
25382
|
-
|
|
25411
|
+
runPipeline: method(object({
|
|
25412
|
+
steps: array(PipelineStepInputSchema).min(1),
|
|
25413
|
+
frame: FrameInputSchema.optional(),
|
|
25414
|
+
/**
|
|
25415
|
+
* Process-local lazy frame. Valid only when caller and provider resolve
|
|
25416
|
+
* in the same execution-group process; split/cross-node callers use
|
|
25417
|
+
* `frame`/`image` inline compatibility instead.
|
|
25418
|
+
*/
|
|
25419
|
+
frameRef: FrameRefSchema.optional(),
|
|
25420
|
+
/**
|
|
25421
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
25422
|
+
* the decoded pixels live in. One more member of the one-of
|
|
25423
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
25424
|
+
*/
|
|
25425
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
25426
|
+
imageBase64: string().optional(),
|
|
25427
|
+
/**
|
|
25428
|
+
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
25429
|
+
* hops (hub → forked worker via Moleculer MsgPack) because it
|
|
25430
|
+
* skips the 33% base64 overhead + the per-call base64 decode on
|
|
25431
|
+
* the detection-pipeline worker. Callers can pass either; exactly
|
|
25432
|
+
* one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
|
|
25433
|
+
*/
|
|
25434
|
+
image: _instanceof(Uint8Array).optional(),
|
|
25435
|
+
referenceImage: string().optional(),
|
|
25436
|
+
deviceId: number().optional(),
|
|
25437
|
+
sessionId: string().optional(),
|
|
25438
|
+
/**
|
|
25439
|
+
* Execution plane. 'full' (default) runs the whole tree — benchmark,
|
|
25440
|
+
* reference-image, and detail-subtree calls. 'frame' is the live
|
|
25441
|
+
* per-frame dispatch: ONLY root-plane steps run; crop children
|
|
25442
|
+
* (inputClasses ≠ null) are skipped and served per-track via
|
|
25443
|
+
* pipelineRunner.runDetailSubtree (two-plane design).
|
|
25444
|
+
*/
|
|
25445
|
+
plane: _enum(["full", "frame"]).optional(),
|
|
25446
|
+
/**
|
|
25447
|
+
* Inference-device selector (Phase 2 multi-device). Format
|
|
25448
|
+
* `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
|
|
25449
|
+
* Omitted ⇒ the runner's default device (current single-engine
|
|
25450
|
+
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
25451
|
+
*/
|
|
25452
|
+
deviceKey: string().optional(),
|
|
25453
|
+
/**
|
|
25454
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
25455
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
25456
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
25457
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
25458
|
+
* resolution from that surface — the SAME quality path faces already
|
|
25459
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
25460
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
25461
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
25462
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
25463
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
25464
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
25465
|
+
* (today's behaviour on the fallback path).
|
|
25466
|
+
*/
|
|
25467
|
+
nativeCropRef: NativeCropRefSchema.optional(),
|
|
25468
|
+
/**
|
|
25469
|
+
* Offline REPLAY of stored media for `deviceId` (D56, D646): the
|
|
25470
|
+
* camera's zone gate and overrides apply as live, every executing
|
|
25471
|
+
* step runs EXACTLY the model it names on the `deviceKey` pool it
|
|
25472
|
+
* names or the call refuses (`model-not-servable` /
|
|
25473
|
+
* `device-not-servable`), and nothing reaches the camera's live
|
|
25474
|
+
* trace stream. Absent ⇒ unchanged behaviour.
|
|
25475
|
+
*/
|
|
25476
|
+
replay: literal(true).optional()
|
|
25477
|
+
}), PipelineRunResultBridge, { kind: "mutation" }),
|
|
25383
25478
|
/**
|
|
25384
|
-
*
|
|
25385
|
-
*
|
|
25386
|
-
* `
|
|
25387
|
-
*
|
|
25388
|
-
*
|
|
25389
|
-
*
|
|
25390
|
-
* audio, stopping at the first hit — so on the live hub, where object
|
|
25391
|
-
* events own no media of their own and 299 883 of 300 559 media rows are
|
|
25392
|
-
* motion-owned, EVERY object event resolved to its motion namesake. A
|
|
25393
|
-
* track from 17:34 on camera 615 was served a snapshot from 22:35 eleven
|
|
25394
|
-
* days earlier, silently.
|
|
25479
|
+
* Batched run — N raw frames packed into one cap call. The provider
|
|
25480
|
+
* routes the batch through `SharedInferencePool.inferBatch`
|
|
25481
|
+
* (`MSG_INFER_BATCH = 0x03`) so the IPC framing and JSON response
|
|
25482
|
+
* envelope cost is amortised N:1 vs N concurrent `runPipeline`
|
|
25483
|
+
* calls. Single root step + uniform model assumed; trees with crop
|
|
25484
|
+
* children fall back to sequential execution.
|
|
25395
25485
|
*
|
|
25396
|
-
*
|
|
25397
|
-
*
|
|
25398
|
-
* the ambiguity — a listing BY OWNER has no address to make surrogate: the
|
|
25399
|
-
* owner IS (table, id), and half of it is not a question.
|
|
25486
|
+
* Used by `scripts/bench-batch-style.mts` for batch benchmarking —
|
|
25487
|
+
* N frames in one call to amortise per-call IPC overhead.
|
|
25400
25488
|
*/
|
|
25401
|
-
|
|
25402
|
-
|
|
25403
|
-
|
|
25404
|
-
|
|
25405
|
-
|
|
25406
|
-
|
|
25407
|
-
|
|
25408
|
-
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
|
|
25417
|
-
|
|
25489
|
+
runPipelineBatch: method(object({
|
|
25490
|
+
steps: array(PipelineStepInputSchema).min(1),
|
|
25491
|
+
frames: array(FrameInputSchema).min(1).max(255),
|
|
25492
|
+
deviceId: number().optional(),
|
|
25493
|
+
sessionId: string().optional(),
|
|
25494
|
+
/**
|
|
25495
|
+
* Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
|
|
25496
|
+
* the batch to the Python pool's bench preprocess cache
|
|
25497
|
+
* (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
|
|
25498
|
+
* preprocessed ONCE and every later inference is a pure-inference cache
|
|
25499
|
+
* hit — the sustained-throughput run measures inference, not
|
|
25500
|
+
* decode+preprocess+infer. Omitted/0 for live frames (all different →
|
|
25501
|
+
* full preprocess every call, correct). Fresh per sustained run;
|
|
25502
|
+
* released via `uncacheFrame`.
|
|
25503
|
+
*/
|
|
25504
|
+
frameId: number().int().nonnegative().optional(),
|
|
25505
|
+
/** Inference-device selector (Phase 2 multi-device); see runPipeline. */
|
|
25506
|
+
deviceKey: string().optional()
|
|
25507
|
+
}), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }),
|
|
25418
25508
|
/**
|
|
25419
|
-
*
|
|
25420
|
-
*
|
|
25421
|
-
*
|
|
25422
|
-
*
|
|
25423
|
-
* fetched as an image, not as base64 inside this response. Measured: the
|
|
25424
|
-
* full `getTrackMedia` is 5.3-7.7 MB and blocks the view; this manifest is
|
|
25425
|
-
* ~2 KB.
|
|
25426
|
-
*
|
|
25427
|
-
* It also restores a fact a `kinds` filter destroys: filtering
|
|
25428
|
-
* `getTrackMedia` drops whole ROWS, taking `kind` and `sizeBytes` with
|
|
25429
|
-
* them, so a client that fetched only the small variants could no longer
|
|
25430
|
-
* tell a full-resolution variant existed — and the affordance that opens it
|
|
25431
|
-
* would silently disappear.
|
|
25509
|
+
* Cache a raw frame inside the Python inference pool's memory.
|
|
25510
|
+
* Returns a numeric `frameId` that `inferCached` references —
|
|
25511
|
+
* subsequent calls send only 5 bytes through the pipe instead of
|
|
25512
|
+
* 1.2MB raw data, eliminating the pipe transfer bottleneck.
|
|
25432
25513
|
*/
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
|
|
25514
|
+
cacheFrameInPool: method(object({
|
|
25515
|
+
data: _instanceof(Uint8Array),
|
|
25516
|
+
width: number().int().positive(),
|
|
25517
|
+
height: number().int().positive(),
|
|
25518
|
+
format: _enum([
|
|
25519
|
+
"rgb",
|
|
25520
|
+
"bgr",
|
|
25521
|
+
"gray"
|
|
25522
|
+
])
|
|
25523
|
+
}), object({
|
|
25524
|
+
frameId: number(),
|
|
25525
|
+
width: number(),
|
|
25526
|
+
height: number()
|
|
25527
|
+
}), { kind: "mutation" }),
|
|
25437
25528
|
/**
|
|
25438
|
-
*
|
|
25439
|
-
*
|
|
25440
|
-
*
|
|
25441
|
-
* `listTrackMedia` above got this treatment because a track's media is
|
|
25442
|
-
* 5-8 MB. An event's is worse per row, not better: an old-style event owns
|
|
25443
|
-
* a `crop` AND a native-resolution `fullFrameBoxed`, and the track DETAIL
|
|
25444
|
-
* modal — the one surface that legitimately shows the big kinds — unions
|
|
25445
|
-
* both listings to build its filmstrip. It then renders every tile from
|
|
25446
|
-
* the `event-media` plane by key and throws the bytes away. Measured on
|
|
25447
|
-
* the live hub: one event's `fullFrameBoxed` is 2 824 077 B, base64'd to
|
|
25448
|
-
* ~3.8 MB, allocated whole in hub-main's heap, for a list of keys.
|
|
25449
|
-
*
|
|
25450
|
-
* Same `deviceId` authorization subject as `getEventMedia`, the same
|
|
25451
|
-
* REQUIRED `ownerType` (read that method's docblock for the night-time
|
|
25452
|
-
* thumbnail this closes — D482), and the same rows: this is a projection
|
|
25453
|
-
* of that method, never a different question.
|
|
25529
|
+
* Run inference on a previously cached frame. Sends only 5 bytes
|
|
25530
|
+
* (model_idx + frameId) through the IPC pipe — eliminates the
|
|
25531
|
+
* ~35ms per-call overhead of transferring 1.2MB raw data.
|
|
25454
25532
|
*/
|
|
25455
|
-
|
|
25456
|
-
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
}), array(MediaFileInfoSchema).readonly()),
|
|
25533
|
+
inferCached: method(object({
|
|
25534
|
+
stepId: string(),
|
|
25535
|
+
frameId: number().int()
|
|
25536
|
+
}), record(string(), unknown()), { kind: "mutation" }),
|
|
25460
25537
|
/**
|
|
25461
|
-
*
|
|
25462
|
-
* blob read, and the LICENCE `videoclips` needs to publish a `thumbnail`.
|
|
25463
|
-
*
|
|
25464
|
-
* The event-media URL is stamped from a template for every event in the
|
|
25465
|
-
* system, so "the plane is up" was being served as "there are bytes": 64 of
|
|
25466
|
-
* one camera's 179 clips pointed at a 404 (device 3836, 2026-08-17). This
|
|
25467
|
-
* is the question that turns the stamp into a claim.
|
|
25468
|
-
*
|
|
25469
|
-
* It is on the WIRE because the clip source is registered by the addon that
|
|
25470
|
-
* owns the FOOTAGE, not by this one (D560) — the probe used to be an
|
|
25471
|
-
* in-process `MediaStore` read. One call per OWNER KIND, never one per
|
|
25472
|
-
* owner: that N+1 is what `MediaStore.ownersWithMedia` was written to
|
|
25473
|
-
* prevent, and crossing a process boundary makes it worse, not better.
|
|
25474
|
-
* `ownerIds` is bounded at the same 5 000 the annotation fetch is bounded
|
|
25475
|
-
* at, so one pathological camera-day cannot mint an unbounded request.
|
|
25476
|
-
*
|
|
25477
|
-
* THROWS rather than answering partially. A probe that quietly
|
|
25478
|
-
* under-reports reads as "these owners have nothing" and the caller drops
|
|
25479
|
-
* thumbnails that exist — the opposite failure to the one above, and
|
|
25480
|
-
* equally invisible.
|
|
25481
|
-
*
|
|
25482
|
-
* `deviceId` is the authorization subject, exactly as on `getEventMedia`.
|
|
25538
|
+
* Release a cached frame from the Python pool's memory.
|
|
25483
25539
|
*/
|
|
25484
|
-
|
|
25485
|
-
deviceId: number(),
|
|
25486
|
-
ownerKind: MediaPresenceOwnerKindSchema,
|
|
25487
|
-
ownerIds: array(string()).max(5e3)
|
|
25488
|
-
}), array(string()).readonly()),
|
|
25540
|
+
uncacheFrame: method(object({ frameId: number().int() }), _void(), { kind: "mutation" }),
|
|
25489
25541
|
/**
|
|
25490
|
-
*
|
|
25491
|
-
*
|
|
25492
|
-
*
|
|
25493
|
-
*
|
|
25494
|
-
*
|
|
25495
|
-
* `minScore`, sorted descending by score.
|
|
25542
|
+
* The effective provisioning of ONE pool of this node (operator override →
|
|
25543
|
+
* the pool's own runtime row). `deviceKey` names the device pool; absent is
|
|
25544
|
+
* the node-default pool. It answered only for the node default until
|
|
25545
|
+
* D646, so a benchmark on `openvino:npu` recorded the onnx pool's tuning
|
|
25546
|
+
* beside an NPU measurement.
|
|
25496
25547
|
*/
|
|
25497
|
-
|
|
25498
|
-
|
|
25548
|
+
getEffectiveTuning: method(object({ deviceKey: string().optional() }), EffectiveTuningSchema),
|
|
25549
|
+
/**
|
|
25550
|
+
* List every EngineFactory currently loaded in this executor's RAM,
|
|
25551
|
+
* with the models resident and a coarse "in use" marker derived from
|
|
25552
|
+
* ongoing inference activity. Used by the Pipeline page Engines tab.
|
|
25553
|
+
*/
|
|
25554
|
+
listLoadedEngines: method(_void(), array(object({
|
|
25555
|
+
engineKey: string(),
|
|
25556
|
+
engine: PipelineEngineChoiceSchema,
|
|
25557
|
+
modelsLoaded: array(string()).readonly(),
|
|
25558
|
+
inUseByCameras: array(number()).readonly(),
|
|
25559
|
+
/**
|
|
25560
|
+
* Origin of this resident factory.
|
|
25561
|
+
* - `runtime` — main camera-serving engine (no idle TTL).
|
|
25562
|
+
* - `device-pool` — a concurrent per-device pool (Phase 2
|
|
25563
|
+
* multi-device, keyed by `deviceKey`) resolved
|
|
25564
|
+
* via `resolveDeviceFactory`. Runs alongside the
|
|
25565
|
+
* `runtime` engine on a DIFFERENT accelerator
|
|
25566
|
+
* (NPU / iGPU / Coral) — this is how the
|
|
25567
|
+
* Engines tab shows all pools running at once.
|
|
25568
|
+
*/
|
|
25569
|
+
kind: _enum(["runtime", "device-pool"]),
|
|
25570
|
+
/** Native pid of the underlying Python pool (null when no pool). */
|
|
25571
|
+
poolPid: number().nullable(),
|
|
25572
|
+
/** ms since this factory was last used (null when not warm-tracked). */
|
|
25573
|
+
idleMs: number().nullable(),
|
|
25574
|
+
/** Idle TTL after which the factory self-evicts (null when not applicable). */
|
|
25575
|
+
idleTtlMs: number().nullable()
|
|
25576
|
+
})).readonly()),
|
|
25577
|
+
/** Warm up an engine without running a frame. No-op if already loaded. */
|
|
25578
|
+
spinEngine: method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
|
|
25499
25579
|
kind: "mutation",
|
|
25500
25580
|
auth: "admin"
|
|
25501
25581
|
}),
|
|
25502
|
-
|
|
25582
|
+
/**
|
|
25583
|
+
* Unload an engine from RAM. `force:true` unloads even when cameras
|
|
25584
|
+
* are actively using it (they re-spin on next frame). Default is
|
|
25585
|
+
* gated — returns `{success:false, reason}` when in use.
|
|
25586
|
+
*/
|
|
25587
|
+
killEngine: method(object({
|
|
25588
|
+
engine: PipelineEngineChoiceSchema,
|
|
25589
|
+
force: boolean().optional()
|
|
25590
|
+
}), object({
|
|
25591
|
+
success: boolean(),
|
|
25592
|
+
reason: string().optional()
|
|
25593
|
+
}), {
|
|
25503
25594
|
kind: "mutation",
|
|
25504
25595
|
auth: "admin"
|
|
25505
25596
|
}),
|
|
25506
|
-
|
|
25507
|
-
|
|
25508
|
-
|
|
25509
|
-
|
|
25510
|
-
|
|
25511
|
-
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
|
|
25515
|
-
|
|
25516
|
-
|
|
25517
|
-
|
|
25518
|
-
deviceId: number(),
|
|
25519
|
-
timestamp: number(),
|
|
25520
|
-
frameWidth: number(),
|
|
25521
|
-
frameHeight: number(),
|
|
25522
|
-
detections: array(OverlayDetectionSchema).readonly()
|
|
25523
|
-
}) },
|
|
25524
|
-
/** Track entered active state (first-seen). */
|
|
25525
|
-
onTrackStarted: { data: object({
|
|
25526
|
-
deviceId: number(),
|
|
25527
|
-
trackId: string(),
|
|
25528
|
-
className: string()
|
|
25529
|
-
}) },
|
|
25530
|
-
/** Track expired (TTL reached after last detection). */
|
|
25531
|
-
onTrackEnded: { data: object({
|
|
25532
|
-
deviceId: number(),
|
|
25533
|
-
trackId: string(),
|
|
25534
|
-
className: string(),
|
|
25535
|
-
durationMs: number()
|
|
25536
|
-
}) },
|
|
25537
|
-
/** Canonical "something happened at device X" event, per-kind. */
|
|
25538
|
-
onDetectionEvent: { data: object({
|
|
25539
|
-
deviceId: number(),
|
|
25540
|
-
kind: EventKindSchema,
|
|
25541
|
-
eventId: string(),
|
|
25542
|
-
timestamp: number()
|
|
25543
|
-
}) }
|
|
25597
|
+
listReferenceImages: method(_void(), array(ReferenceImageEntrySchema).readonly()),
|
|
25598
|
+
getReferenceImage: method(object({ filename: string() }), ReferenceImageBodySchema.nullable()),
|
|
25599
|
+
getReferenceAudioFiles: method(_void(), array(ReferenceAudioEntrySchema).readonly()),
|
|
25600
|
+
getReferenceAudio: method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()),
|
|
25601
|
+
getAudioCapabilities: method(_void(), AudioCapabilitiesSchema),
|
|
25602
|
+
runAudioTest: method(object({
|
|
25603
|
+
addonId: string(),
|
|
25604
|
+
modelId: string(),
|
|
25605
|
+
filename: string().optional(),
|
|
25606
|
+
settings: record(string(), unknown()).optional()
|
|
25607
|
+
}), AudioTestResultSchema, { kind: "mutation" }),
|
|
25608
|
+
getDetectionConfigSchema: method(_void(), ConfigUISchemaNullableBridge)
|
|
25544
25609
|
}
|
|
25545
25610
|
};
|
|
25546
25611
|
object({
|
|
@@ -25568,6 +25633,106 @@ var CameraMetricsSchema = object({
|
|
|
25568
25633
|
});
|
|
25569
25634
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
25570
25635
|
/**
|
|
25636
|
+
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
25637
|
+
*
|
|
25638
|
+
* Zones describe **where** in the frame the operator wants to flag
|
|
25639
|
+
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
25640
|
+
* each pipeline stage uses them. Splitting the two means a single
|
|
25641
|
+
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
25642
|
+
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
25643
|
+
* — without three duplicated polygons.
|
|
25644
|
+
*
|
|
25645
|
+
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
25646
|
+
* `zones` device-state slice on every mutation. Consumers
|
|
25647
|
+
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
25648
|
+
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
25649
|
+
* mirror with `onChanged`).
|
|
25650
|
+
*
|
|
25651
|
+
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
25652
|
+
* survive resolution changes and stream profile switches.
|
|
25653
|
+
*
|
|
25654
|
+
* `kind` discriminates between full polygons (closed regions used
|
|
25655
|
+
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
25656
|
+
* line segments used for cross events). Onboard / firmware-reported
|
|
25657
|
+
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
25658
|
+
* task list.
|
|
25659
|
+
*/
|
|
25660
|
+
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
25661
|
+
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
25662
|
+
var PolygonPointSchema = object({
|
|
25663
|
+
x: number(),
|
|
25664
|
+
y: number()
|
|
25665
|
+
});
|
|
25666
|
+
/** A camera detection zone — pure geometry/identity. */
|
|
25667
|
+
var ZoneSchema = object({
|
|
25668
|
+
id: string(),
|
|
25669
|
+
name: string(),
|
|
25670
|
+
kind: ZoneKindEnum.default("polygon"),
|
|
25671
|
+
/** Polygon vertices, fraction of frame (0–1). */
|
|
25672
|
+
polygon: array(PolygonPointSchema).readonly(),
|
|
25673
|
+
/** Visual color for UI rendering. */
|
|
25674
|
+
color: string().default("#3b82f6")
|
|
25675
|
+
});
|
|
25676
|
+
/**
|
|
25677
|
+
* Zones capability — per-camera CRUD over polygon detection zones.
|
|
25678
|
+
*
|
|
25679
|
+
* Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
|
|
25680
|
+
* to per-device settings and mirrors into the `zones` device-state
|
|
25681
|
+
* slice on every mutation, so downstream consumers can subscribe via
|
|
25682
|
+
* `dev.state.zones.onChanged`.
|
|
25683
|
+
*
|
|
25684
|
+
* The cap surface only handles geometry + identity; filtering
|
|
25685
|
+
* behaviour (per-class, include/exclude, threshold) lives in the
|
|
25686
|
+
* consumer addons' rule arrays — see `ZoneRuleSchema` exported from
|
|
25687
|
+
* `capabilities/schemas/zone-rule.js`.
|
|
25688
|
+
*/
|
|
25689
|
+
var zonesCapability = {
|
|
25690
|
+
name: "zones",
|
|
25691
|
+
scope: "device",
|
|
25692
|
+
mode: "singleton",
|
|
25693
|
+
deviceTypes: [DeviceType.Camera],
|
|
25694
|
+
methods: {
|
|
25695
|
+
listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
|
|
25696
|
+
addZone: method(object({
|
|
25697
|
+
deviceId: number(),
|
|
25698
|
+
zone: ZoneSchema
|
|
25699
|
+
}), _void(), {
|
|
25700
|
+
kind: "mutation",
|
|
25701
|
+
auth: "admin"
|
|
25702
|
+
}),
|
|
25703
|
+
removeZone: method(object({
|
|
25704
|
+
deviceId: number(),
|
|
25705
|
+
zoneId: string()
|
|
25706
|
+
}), _void(), {
|
|
25707
|
+
kind: "mutation",
|
|
25708
|
+
auth: "admin"
|
|
25709
|
+
}),
|
|
25710
|
+
updateZone: method(object({
|
|
25711
|
+
deviceId: number(),
|
|
25712
|
+
zone: ZoneSchema
|
|
25713
|
+
}), _void(), {
|
|
25714
|
+
kind: "mutation",
|
|
25715
|
+
auth: "admin"
|
|
25716
|
+
})
|
|
25717
|
+
},
|
|
25718
|
+
/**
|
|
25719
|
+
* Runtime-state slice — the live zone catalogue mirrored by the
|
|
25720
|
+
* orchestrator on every CRUD mutation. Consumers read via
|
|
25721
|
+
* `device.state.zones.value` / `.watch(...)` without round-tripping
|
|
25722
|
+
* the cap, and the codegen DeviceProxy auto-wires the reactive
|
|
25723
|
+
* handle. Slice shape is `{ zones: Zone[] }` so future extensions
|
|
25724
|
+
* (e.g. zone groupings) can sit alongside the polygon list.
|
|
25725
|
+
*/
|
|
25726
|
+
runtimeState: object({ zones: array(ZoneSchema).readonly() }),
|
|
25727
|
+
/**
|
|
25728
|
+
* Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
|
|
25729
|
+
*
|
|
25730
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
25731
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
25732
|
+
*/
|
|
25733
|
+
durability: "restored"
|
|
25734
|
+
};
|
|
25735
|
+
/**
|
|
25571
25736
|
* A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
|
|
25572
25737
|
* decode worker resolves it against the RETAINED native frame's real pixel dims,
|
|
25573
25738
|
* so the caller supplies only the detection-res bbox divided by the detection
|
|
@@ -25754,7 +25919,17 @@ var DetailResultSchema = object({
|
|
|
25754
25919
|
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
25755
25920
|
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
25756
25921
|
* consumers MUST prefer this when present (2026-07-22 native-gate fix). */
|
|
25757
|
-
nativeFaceShortSidePx: number().optional()
|
|
25922
|
+
nativeFaceShortSidePx: number().optional(),
|
|
25923
|
+
/**
|
|
25924
|
+
* The five facial landmarks of a `face` detail, in the SAME frame space as
|
|
25925
|
+
* `bbox` (D644). Additive and optional: post-analysis stores them beside the
|
|
25926
|
+
* face's source frame so a future alignment can be re-derived exactly; a
|
|
25927
|
+
* runner that predates the field sends none and the face is stored without.
|
|
25928
|
+
*/
|
|
25929
|
+
landmarks: array(object({
|
|
25930
|
+
x: number(),
|
|
25931
|
+
y: number()
|
|
25932
|
+
})).optional()
|
|
25758
25933
|
});
|
|
25759
25934
|
/**
|
|
25760
25935
|
* Why an executing node REFUSED a stateless step run (`runStatelessStep`).
|
|
@@ -27662,7 +27837,11 @@ function buildDescriptor(capName, kind) {
|
|
|
27662
27837
|
icon: legacyIcon(t.iconId)
|
|
27663
27838
|
};
|
|
27664
27839
|
}
|
|
27665
|
-
|
|
27840
|
+
/**
|
|
27841
|
+
* Sensor / control cap name → static event-kind descriptor. A linked device
|
|
27842
|
+
* contributes one entry per bound cap present in this map.
|
|
27843
|
+
*/
|
|
27844
|
+
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
27666
27845
|
/**
|
|
27667
27846
|
* server-management — per-NODE singleton capability for a node's ROOT
|
|
27668
27847
|
* package lifecycle (runtime-updatable node packages).
|
|
@@ -32894,12 +33073,20 @@ reset: method(object({
|
|
|
32894
33073
|
},
|
|
32895
33074
|
runtimeState: ConsumablesStatusSchema.extend({ lastFetchedAt: number() }),
|
|
32896
33075
|
/**
|
|
32897
|
-
* Runtime-state durability: **
|
|
33076
|
+
* Runtime-state durability: **restored** — nothing else holds the value
|
|
33077
|
+
* (D642). A consumable can often be read only in a device's wake window (the
|
|
33078
|
+
* Dreame mower's CMS counters answer only while it charges), so a restart
|
|
33079
|
+
* that wiped the slice left the panel empty and the alerts blind until the
|
|
33080
|
+
* next wake — 2026-09-26, mower 503 idle with `items: []`. A restored item is
|
|
33081
|
+
* the previous observation, not a claim about now; the provider overwrites it
|
|
33082
|
+
* the moment it reads the device again.
|
|
32898
33083
|
*
|
|
32899
33084
|
* See `RuntimeStateDurability`. Enforced by
|
|
32900
33085
|
* `scripts/check-runtime-state-durability.ts`.
|
|
32901
33086
|
*/
|
|
32902
|
-
durability: "
|
|
33087
|
+
durability: "restored",
|
|
33088
|
+
/** Clocks, not content: a re-read that changed no item costs no commit. */
|
|
33089
|
+
volatileStateFields: ["lastChangedAt", "lastFetchedAt"]
|
|
32903
33090
|
};
|
|
32904
33091
|
/**
|
|
32905
33092
|
* Door / window / opening / garage / valve contact sensor. Boolean
|
|
@@ -37772,7 +37959,7 @@ var HardwareInfoSchema = object({
|
|
|
37772
37959
|
coral: CoralInfoSchema.nullable().optional()
|
|
37773
37960
|
});
|
|
37774
37961
|
var PlatformScoreSchema = object({
|
|
37775
|
-
runtime:
|
|
37962
|
+
runtime: literal("python"),
|
|
37776
37963
|
backend: string(),
|
|
37777
37964
|
format: _enum([
|
|
37778
37965
|
"onnx",
|
|
@@ -37809,7 +37996,7 @@ var ModelRequirementSchema = object({
|
|
|
37809
37996
|
});
|
|
37810
37997
|
var ResolvedInferenceConfigSchema = object({
|
|
37811
37998
|
modelId: string(),
|
|
37812
|
-
runtime:
|
|
37999
|
+
runtime: literal("python"),
|
|
37813
38000
|
backend: string(),
|
|
37814
38001
|
format: ModelFormatSchema,
|
|
37815
38002
|
reason: string()
|
|
@@ -40816,6 +41003,92 @@ var sceneMonitorCapability = {
|
|
|
40816
41003
|
durability: "session"
|
|
40817
41004
|
};
|
|
40818
41005
|
/**
|
|
41006
|
+
* Per-stage gating mode applied to the zones a rule references.
|
|
41007
|
+
*
|
|
41008
|
+
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
41009
|
+
* When at least one `include` rule fires for a stage, only entities
|
|
41010
|
+
* inside one of those zones pass that stage.
|
|
41011
|
+
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
41012
|
+
* Entities inside one of those zones are dropped at that stage.
|
|
41013
|
+
*
|
|
41014
|
+
* `monitor`-style observation (count without filtering) is not a rule
|
|
41015
|
+
* mode — zones without any matching rule are observed naturally by
|
|
41016
|
+
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
41017
|
+
* count, not filter" use case needs no rule at all.
|
|
41018
|
+
*/
|
|
41019
|
+
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
41020
|
+
/**
|
|
41021
|
+
* Per-consumer rule that references existing zones (geometry) and
|
|
41022
|
+
* defines how a specific pipeline stage should treat them. Each
|
|
41023
|
+
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
41024
|
+
* settings:
|
|
41025
|
+
*
|
|
41026
|
+
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
41027
|
+
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
41028
|
+
* - future: notification rules, audio gating, etc.
|
|
41029
|
+
*
|
|
41030
|
+
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
41031
|
+
* express "ignore motion in ALL of {garden, street}" with a single
|
|
41032
|
+
* rule. `classFilter` narrows the rule to specific object classes —
|
|
41033
|
+
* "drop person detections in the street, but keep cars" is one
|
|
41034
|
+
* `exclude` rule with `classFilter: ['person']`.
|
|
41035
|
+
*
|
|
41036
|
+
* `enabled` is a soft toggle — the operator can keep the rule
|
|
41037
|
+
* configured but inert without deleting it.
|
|
41038
|
+
*/
|
|
41039
|
+
var ZoneRuleSchema = object({
|
|
41040
|
+
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
41041
|
+
id: string(),
|
|
41042
|
+
/** Optional human-readable label rendered in the rule editor. */
|
|
41043
|
+
name: string().optional(),
|
|
41044
|
+
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
41045
|
+
* listed zones (OR-set: a detection in any one of them counts).
|
|
41046
|
+
* At least one zone id required — a rule with no targets is a
|
|
41047
|
+
* configuration mistake and the form validator rejects it. */
|
|
41048
|
+
zoneIds: array(string()).min(1).readonly(),
|
|
41049
|
+
mode: ZoneRuleModeEnum,
|
|
41050
|
+
/**
|
|
41051
|
+
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
41052
|
+
* applies to every class. Class strings match the `macroClass`
|
|
41053
|
+
* field on detections (e.g. `person`, `car`, `dog`).
|
|
41054
|
+
*/
|
|
41055
|
+
classFilter: array(string()).readonly().optional(),
|
|
41056
|
+
/**
|
|
41057
|
+
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
41058
|
+
* required to consider an entity "in the zone". Defaults to the
|
|
41059
|
+
* consumer's stage default when omitted. Kept for back-compat with
|
|
41060
|
+
* existing per-rule overrides; new operators pick the value via
|
|
41061
|
+
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
41062
|
+
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
41063
|
+
*/
|
|
41064
|
+
overlapThreshold: number().min(0).max(1).optional(),
|
|
41065
|
+
/**
|
|
41066
|
+
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
41067
|
+
* of the detection's bbox that must lie inside the zone for the
|
|
41068
|
+
* rule to match. Documented default is 85%; the engine substitutes
|
|
41069
|
+
* that when the field is omitted (kept optional so existing rules
|
|
41070
|
+
* stored without it stay valid).
|
|
41071
|
+
*
|
|
41072
|
+
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
41073
|
+
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
41074
|
+
* field exposed in the UI. Internally both feed the same gate.
|
|
41075
|
+
*/
|
|
41076
|
+
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
41077
|
+
/**
|
|
41078
|
+
* When `true` and a detection has a segmentation mask, use the
|
|
41079
|
+
* mask for overlap instead of the bbox. Detection-stage only;
|
|
41080
|
+
* motion rules ignore this field.
|
|
41081
|
+
*/
|
|
41082
|
+
preferMask: boolean().optional(),
|
|
41083
|
+
/**
|
|
41084
|
+
* Soft-toggle: `false` disables the rule without deleting it.
|
|
41085
|
+
* Defaults to `true` so operators creating a rule via the UI
|
|
41086
|
+
* see it active immediately.
|
|
41087
|
+
*/
|
|
41088
|
+
enabled: boolean().default(true)
|
|
41089
|
+
});
|
|
41090
|
+
array(ZoneRuleSchema).readonly();
|
|
41091
|
+
/**
|
|
40819
41092
|
* Script-runner cap. Models HA `script.*` entities on
|
|
40820
41093
|
* `DeviceType.Script`. A Script is a pre-recorded action sequence
|
|
40821
41094
|
* that can be invoked imperatively — optionally with a variables
|
|
@@ -43023,6 +43296,42 @@ function readDeviceStateFrom(runtimeState) {
|
|
|
43023
43296
|
}
|
|
43024
43297
|
}
|
|
43025
43298
|
/**
|
|
43299
|
+
* LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
|
|
43300
|
+
* valutatore puro del suo FRONTE.
|
|
43301
|
+
*
|
|
43302
|
+
* Viveva dentro il builtin virtual-doorbell
|
|
43303
|
+
* (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
|
|
43304
|
+
* predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
|
|
43305
|
+
* `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
|
|
43306
|
+
* tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
|
|
43307
|
+
* fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
|
|
43308
|
+
* SPOSTA qui e il doorbell la ri-esporta.
|
|
43309
|
+
*
|
|
43310
|
+
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
43311
|
+
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
43312
|
+
* regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
|
|
43313
|
+
* booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
|
|
43314
|
+
*/
|
|
43315
|
+
/**
|
|
43316
|
+
* Known binary / switch source caps → the boolean slice field whose
|
|
43317
|
+
* false→true rise counts as ACTIVE. Every entry is "fire on active".
|
|
43318
|
+
* Sensors whose "active" reading is not a plain boolean (presence's string
|
|
43319
|
+
* state, connectivity's connected flag) are deliberately excluded — a
|
|
43320
|
+
* reconnect is not a doorbell press, and it is not a recording either.
|
|
43321
|
+
*/
|
|
43322
|
+
var SOURCE_CAP_ACTIVE_FIELD = {
|
|
43323
|
+
contact: "entryOpen",
|
|
43324
|
+
binary: "on",
|
|
43325
|
+
switch: "on",
|
|
43326
|
+
motion: "detected",
|
|
43327
|
+
flood: "flooded",
|
|
43328
|
+
gas: "detected",
|
|
43329
|
+
smoke: "detected",
|
|
43330
|
+
"carbon-monoxide": "detected",
|
|
43331
|
+
vibration: "detected",
|
|
43332
|
+
tamper: "tampered"
|
|
43333
|
+
};
|
|
43334
|
+
/**
|
|
43026
43335
|
* Accessory device helpers — shared across drivers.
|
|
43027
43336
|
*
|
|
43028
43337
|
* Many vendor-specific drivers register accessory child devices on
|
|
@@ -48099,6 +48408,12 @@ Object.freeze({
|
|
|
48099
48408
|
addonId: null,
|
|
48100
48409
|
access: "view"
|
|
48101
48410
|
},
|
|
48411
|
+
"notificationRules.getRuleLastRuns": {
|
|
48412
|
+
capName: "notification-rules",
|
|
48413
|
+
capScope: "system",
|
|
48414
|
+
addonId: null,
|
|
48415
|
+
access: "view"
|
|
48416
|
+
},
|
|
48102
48417
|
"notificationRules.getTemplateCatalog": {
|
|
48103
48418
|
capName: "notification-rules",
|
|
48104
48419
|
capScope: "system",
|
|
@@ -48123,6 +48438,12 @@ Object.freeze({
|
|
|
48123
48438
|
addonId: null,
|
|
48124
48439
|
access: "view"
|
|
48125
48440
|
},
|
|
48441
|
+
"notificationRules.previewStateSummary": {
|
|
48442
|
+
capName: "notification-rules",
|
|
48443
|
+
capScope: "system",
|
|
48444
|
+
addonId: null,
|
|
48445
|
+
access: "view"
|
|
48446
|
+
},
|
|
48126
48447
|
"notificationRules.previewTemplate": {
|
|
48127
48448
|
capName: "notification-rules",
|
|
48128
48449
|
capScope: "system",
|
|
@@ -48699,12 +49020,6 @@ Object.freeze({
|
|
|
48699
49020
|
addonId: null,
|
|
48700
49021
|
access: "create"
|
|
48701
49022
|
},
|
|
48702
|
-
"pipelineAnalytics.runReplayFrameProcessor": {
|
|
48703
|
-
capName: "pipeline-analytics",
|
|
48704
|
-
capScope: "device",
|
|
48705
|
-
addonId: null,
|
|
48706
|
-
access: "create"
|
|
48707
|
-
},
|
|
48708
49023
|
"pipelineAnalytics.saveRetrainAnnotations": {
|
|
48709
49024
|
capName: "pipeline-analytics",
|
|
48710
49025
|
capScope: "device",
|
|
@@ -52802,11 +53117,6 @@ Object.freeze({
|
|
|
52802
53117
|
form: "single",
|
|
52803
53118
|
optional: false
|
|
52804
53119
|
}],
|
|
52805
|
-
"pipelineAnalytics.runReplayFrameProcessor": [{
|
|
52806
|
-
name: "deviceId",
|
|
52807
|
-
form: "single",
|
|
52808
|
-
optional: false
|
|
52809
|
-
}],
|
|
52810
53120
|
"pipelineAnalytics.saveRetrainAnnotations": [{
|
|
52811
53121
|
name: "deviceId",
|
|
52812
53122
|
form: "single",
|
|
@@ -53695,12 +54005,55 @@ var NC_AUDIO_DEFAULTS = {
|
|
|
53695
54005
|
samplingSeconds: 10
|
|
53696
54006
|
};
|
|
53697
54007
|
new Set(["devices", "classes"]);
|
|
53698
|
-
/**
|
|
54008
|
+
/**
|
|
54009
|
+
* WHICH narrowing filter speaks about WHICH system-event kind — one predicate,
|
|
54010
|
+
* consumed by the rule ENGINE and by every rule EDITOR.
|
|
54011
|
+
*
|
|
54012
|
+
* ── The failure this file exists for ───────────────────────────────────────
|
|
54013
|
+
* `NcSystemEventConditionSchema` carries four optional narrowing lists
|
|
54014
|
+
* (`deviceIds`, `deviceTypes`, `nodeIds`, `packageNames`) beside a required
|
|
54015
|
+
* `kinds` gate. They are not four filters over one vocabulary: each belongs to
|
|
54016
|
+
* a FAMILY of kinds and is meaningless outside it. A node going away has no
|
|
54017
|
+
* device type; a completed export has no package; `stream-offline` deliberately
|
|
54018
|
+
* carries no device type at all (a stream belongs to a camera by construction).
|
|
54019
|
+
*
|
|
54020
|
+
* The engine applied all four to every kind, so a filter from one family failed
|
|
54021
|
+
* a kind from another family CLOSED. The operator's live rule "Eventi di
|
|
54022
|
+
* sistema" selected eleven kinds and set `deviceTypes: ['camera']` — the only
|
|
54023
|
+
* way to say "only my cameras" about the two liveness kinds — and NINE of the
|
|
54024
|
+
* eleven silently stopped being deliverable. Four days of history contained
|
|
54025
|
+
* `device-online` and `device-offline` and nothing else, across a window in
|
|
54026
|
+
* which agents were restarted and addons were updated.
|
|
54027
|
+
*
|
|
54028
|
+
* Both editors already computed this scoping, to decide which filter boxes to
|
|
54029
|
+
* render; the cap's own docblock already promised it ("Narrow a `device-*` kind
|
|
54030
|
+
* to these device TYPES"). Only the engine disagreed, and it disagreed in the
|
|
54031
|
+
* destructive direction. So the rule is stated ONCE, here, and the engine and
|
|
54032
|
+
* the editors are readers of it rather than three independent authors.
|
|
54033
|
+
*
|
|
54034
|
+
* ── The direction ─────────────────────────────────────────────────────────
|
|
54035
|
+
* Out of family ⇒ the filter is IGNORED, never fail-closed. An editor that
|
|
54036
|
+
* hides a box has already told the operator this filter does not speak about
|
|
54037
|
+
* these kinds, so honouring it as an exclusion contradicts the only
|
|
54038
|
+
* explanation the operator was ever given. Inside its family the filter still
|
|
54039
|
+
* narrows, and still fails CLOSED on a subject that cannot produce the identity
|
|
54040
|
+
* it tests (a device the mirror cannot name is not evidence of a camera).
|
|
54041
|
+
*/
|
|
54042
|
+
/**
|
|
54043
|
+
* Every filter, for the callers that must cover all of them (guards, tests).
|
|
54044
|
+
*
|
|
54045
|
+
* `consumableLowPercent` (D642) is not a list but it is a filter in exactly
|
|
54046
|
+
* this sense: it belongs to a family of kinds (the consumable pair) and the
|
|
54047
|
+
* engine consults it only there. It differs in one way the readers must know —
|
|
54048
|
+
* its ABSENCE is not "no narrowing" but the default threshold, because a
|
|
54049
|
+
* consumable episode is always judged at SOME threshold.
|
|
54050
|
+
*/
|
|
53699
54051
|
var NC_SYSTEM_EVENT_FILTER_KEYS = [
|
|
53700
54052
|
"deviceIds",
|
|
53701
54053
|
"deviceTypes",
|
|
53702
54054
|
"nodeIds",
|
|
53703
|
-
"packageNames"
|
|
54055
|
+
"packageNames",
|
|
54056
|
+
"consumableLowPercent"
|
|
53704
54057
|
];
|
|
53705
54058
|
new Map(Object.entries({
|
|
53706
54059
|
"device-online": "device-events",
|
|
@@ -53711,6 +54064,9 @@ new Map(Object.entries({
|
|
|
53711
54064
|
"device-battery-normal": "device-events",
|
|
53712
54065
|
"device-consumable-low": "device-events",
|
|
53713
54066
|
"device-consumable-normal": "device-events",
|
|
54067
|
+
"device-tank-low": "device-events",
|
|
54068
|
+
"device-tank-full": "device-events",
|
|
54069
|
+
"device-tank-normal": "device-events",
|
|
53714
54070
|
"stream-online": "device-events",
|
|
53715
54071
|
"stream-offline": "device-events",
|
|
53716
54072
|
"detection-blind": "device-events",
|
|
@@ -53740,6 +54096,98 @@ new Map(Object.entries({
|
|
|
53740
54096
|
"camera-enabled": null
|
|
53741
54097
|
}));
|
|
53742
54098
|
[...NC_SYSTEM_EVENT_FILTER_KEYS];
|
|
54099
|
+
var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
|
|
54100
|
+
{
|
|
54101
|
+
id: "device-state",
|
|
54102
|
+
family: "device-events",
|
|
54103
|
+
label: "Device state",
|
|
54104
|
+
kinds: [
|
|
54105
|
+
"device-offline",
|
|
54106
|
+
"device-online",
|
|
54107
|
+
"device-disabled",
|
|
54108
|
+
"device-enabled"
|
|
54109
|
+
]
|
|
54110
|
+
},
|
|
54111
|
+
{
|
|
54112
|
+
id: "streams",
|
|
54113
|
+
family: "device-events",
|
|
54114
|
+
label: "Streams",
|
|
54115
|
+
kinds: ["stream-offline", "stream-online"]
|
|
54116
|
+
},
|
|
54117
|
+
{
|
|
54118
|
+
id: "battery",
|
|
54119
|
+
family: "device-events",
|
|
54120
|
+
label: "Battery",
|
|
54121
|
+
kinds: ["device-battery-low", "device-battery-normal"]
|
|
54122
|
+
},
|
|
54123
|
+
{
|
|
54124
|
+
id: "consumables",
|
|
54125
|
+
family: "device-events",
|
|
54126
|
+
label: "Consumables",
|
|
54127
|
+
kinds: ["device-consumable-low", "device-consumable-normal"]
|
|
54128
|
+
},
|
|
54129
|
+
{
|
|
54130
|
+
id: "tanks",
|
|
54131
|
+
family: "device-events",
|
|
54132
|
+
label: "Tanks",
|
|
54133
|
+
kinds: [
|
|
54134
|
+
"device-tank-low",
|
|
54135
|
+
"device-tank-full",
|
|
54136
|
+
"device-tank-normal"
|
|
54137
|
+
]
|
|
54138
|
+
},
|
|
54139
|
+
{
|
|
54140
|
+
id: "detection-blind",
|
|
54141
|
+
family: "device-events",
|
|
54142
|
+
label: "Detecting nothing",
|
|
54143
|
+
kinds: ["detection-blind"]
|
|
54144
|
+
},
|
|
54145
|
+
{
|
|
54146
|
+
id: "nodes",
|
|
54147
|
+
family: "system",
|
|
54148
|
+
label: "Nodes",
|
|
54149
|
+
kinds: [
|
|
54150
|
+
"node-offline",
|
|
54151
|
+
"node-online",
|
|
54152
|
+
"node-inference-unavailable"
|
|
54153
|
+
]
|
|
54154
|
+
},
|
|
54155
|
+
{
|
|
54156
|
+
id: "addons",
|
|
54157
|
+
family: "system",
|
|
54158
|
+
label: "Addons",
|
|
54159
|
+
kinds: [
|
|
54160
|
+
"addon-crash-loop",
|
|
54161
|
+
"addon-update-available",
|
|
54162
|
+
"addon-updated"
|
|
54163
|
+
]
|
|
54164
|
+
},
|
|
54165
|
+
{
|
|
54166
|
+
id: "updates",
|
|
54167
|
+
family: "system",
|
|
54168
|
+
label: "Server & container updates",
|
|
54169
|
+
kinds: [
|
|
54170
|
+
"server-update-available",
|
|
54171
|
+
"server-updated",
|
|
54172
|
+
"wrapper-update-available"
|
|
54173
|
+
]
|
|
54174
|
+
},
|
|
54175
|
+
{
|
|
54176
|
+
id: "backups-exports",
|
|
54177
|
+
family: "system",
|
|
54178
|
+
label: "Backups & exports",
|
|
54179
|
+
kinds: ["backup-completed", "export-completed"]
|
|
54180
|
+
},
|
|
54181
|
+
{
|
|
54182
|
+
id: "alarm",
|
|
54183
|
+
family: "alarm",
|
|
54184
|
+
label: "Alarm",
|
|
54185
|
+
kinds: NC_ALARM_SYSTEM_EVENT_KINDS
|
|
54186
|
+
}
|
|
54187
|
+
];
|
|
54188
|
+
function systemEventKindsOfFamily(family) {
|
|
54189
|
+
return NC_SYSTEM_EVENT_KIND_GROUP_SPECS.filter((g) => g.family === family).flatMap((g) => g.kinds);
|
|
54190
|
+
}
|
|
53743
54191
|
NC_AUDIO_DEFAULTS.hitPercent, NC_AUDIO_DEFAULTS.samplingSeconds;
|
|
53744
54192
|
var WEEKDAY_TO_DAY = {
|
|
53745
54193
|
Sun: 0,
|
|
@@ -53750,18 +54198,38 @@ var WEEKDAY_TO_DAY = {
|
|
|
53750
54198
|
Fri: 5,
|
|
53751
54199
|
Sat: 6
|
|
53752
54200
|
};
|
|
53753
|
-
/**
|
|
53754
|
-
*
|
|
53755
|
-
function
|
|
53756
|
-
|
|
53757
|
-
|
|
53758
|
-
|
|
54201
|
+
/**
|
|
54202
|
+
* One formatter per timezone, built once (D647 review I4). Constructing an
|
|
54203
|
+
* `Intl.DateTimeFormat` is the expensive part of this function, and a caller
|
|
54204
|
+
* that asks about many instants — a window scan — used to build one per
|
|
54205
|
+
* instant. `null` = an invalid IANA name (the host timezone is used).
|
|
54206
|
+
*/
|
|
54207
|
+
var FORMATTERS = /* @__PURE__ */ new Map();
|
|
54208
|
+
function formatterFor(timezone) {
|
|
54209
|
+
const held = FORMATTERS.get(timezone);
|
|
54210
|
+
if (held !== void 0) return held;
|
|
54211
|
+
let made;
|
|
54212
|
+
try {
|
|
54213
|
+
made = new Intl.DateTimeFormat("en-US", {
|
|
53759
54214
|
timeZone: timezone,
|
|
53760
54215
|
weekday: "short",
|
|
53761
54216
|
hour: "numeric",
|
|
53762
54217
|
minute: "numeric",
|
|
53763
54218
|
hourCycle: "h23"
|
|
53764
|
-
})
|
|
54219
|
+
});
|
|
54220
|
+
} catch {
|
|
54221
|
+
made = null;
|
|
54222
|
+
}
|
|
54223
|
+
FORMATTERS.set(timezone, made);
|
|
54224
|
+
return made;
|
|
54225
|
+
}
|
|
54226
|
+
/** Resolve (weekday, minute-of-day) of `atMs` in the schedule's timezone.
|
|
54227
|
+
* An invalid/unknown IANA name falls back to the host timezone. */
|
|
54228
|
+
function localDayMinute(atMs, timezone) {
|
|
54229
|
+
const d = new Date(atMs);
|
|
54230
|
+
const formatter = timezone !== void 0 ? formatterFor(timezone) : null;
|
|
54231
|
+
if (formatter !== null) try {
|
|
54232
|
+
const parts = formatter.formatToParts(d);
|
|
53765
54233
|
let weekday;
|
|
53766
54234
|
let hour;
|
|
53767
54235
|
let minute;
|
|
@@ -53801,10 +54269,48 @@ function isScheduleActive(schedule, atMs) {
|
|
|
53801
54269
|
}
|
|
53802
54270
|
return schedule.invert === true ? !inside : inside;
|
|
53803
54271
|
}
|
|
54272
|
+
/**
|
|
54273
|
+
* WHICH WAY A BOOLEAN SENSOR MOVED — read off the one slice a sensor event
|
|
54274
|
+
* persists (D640 "a sensor rule fires on the raise, the clear, or both").
|
|
54275
|
+
*
|
|
54276
|
+
* A device-event rule over a flood sensor notified on BOTH edges: water
|
|
54277
|
+
* detected, and back to dry. `NcConditions.sensorTransition` lets the rule
|
|
54278
|
+
* name one edge; this file answers, for one `SensorEvent`, which edge it is.
|
|
54279
|
+
*
|
|
54280
|
+
* NOT A SECOND TABLE. The "which boolean of this cap counts as HIGH" question
|
|
54281
|
+
* already has one answer, `SOURCE_CAP_ACTIVE_FIELD`
|
|
54282
|
+
* (`catalogs/sensor-active-state.ts`, the doorbell's and the recorder's edge
|
|
54283
|
+
* table), and a sensor event names its kind, not its cap. So the table here is
|
|
54284
|
+
* DERIVED: event kind → cap (`EVENT_KIND_BY_CAP`) → that cap's active field.
|
|
54285
|
+
* Only kinds whose taxonomy category is `sensor` take part — a switch has an
|
|
54286
|
+
* `on` boolean too, but "it triggers / it clears" is not a sentence about a
|
|
54287
|
+
* light, and offering it there would be a knob with a misleading label.
|
|
54288
|
+
* `presence` is a WORD (`home` / `not_home` / a zone), not a boolean, and is
|
|
54289
|
+
* absent from the source table, so it is absent here.
|
|
54290
|
+
*
|
|
54291
|
+
* `undefined` = never guessed: a kind with no raise (a doorbell press, a
|
|
54292
|
+
* button, a cover), or a slice whose field is missing or not a boolean. The
|
|
54293
|
+
* engine then does NOT filter — a flood alert must not go silent because one
|
|
54294
|
+
* read came back unreadable (the same stance as the alarm's `sensorEdgeOf`).
|
|
54295
|
+
*
|
|
54296
|
+
* Pure, RN-safe: the viewer imports the support rule from here.
|
|
54297
|
+
*/
|
|
54298
|
+
/** Event kind → the boolean field of its cap slice that means "raised". */
|
|
54299
|
+
var NC_SENSOR_RAISED_FIELD_BY_KIND = Object.freeze(Object.fromEntries(Object.entries(EVENT_KIND_BY_CAP).flatMap(([capName, descriptor]) => {
|
|
54300
|
+
const field = SOURCE_CAP_ACTIVE_FIELD[capName];
|
|
54301
|
+
if (field === void 0 || descriptor.category !== "sensor") return [];
|
|
54302
|
+
return [[descriptor.kind, field]];
|
|
54303
|
+
})));
|
|
54304
|
+
Object.freeze(Object.keys(NC_SENSOR_RAISED_FIELD_BY_KIND));
|
|
53804
54305
|
var RULE_BODY_ONLY = ["body"];
|
|
53805
54306
|
var RULE_TEXT = ["title", "body"];
|
|
53806
54307
|
var BATTERY = ["device-battery-low", "device-battery-normal"];
|
|
53807
54308
|
var CONSUMABLE = ["device-consumable-low", "device-consumable-normal"];
|
|
54309
|
+
var TANK = [
|
|
54310
|
+
"device-tank-low",
|
|
54311
|
+
"device-tank-full",
|
|
54312
|
+
"device-tank-normal"
|
|
54313
|
+
];
|
|
53808
54314
|
var UPDATES = [
|
|
53809
54315
|
"addon-update-available",
|
|
53810
54316
|
"server-update-available",
|
|
@@ -53830,12 +54336,189 @@ var DEVICE_EVENTS = [
|
|
|
53830
54336
|
"device-enabled",
|
|
53831
54337
|
...BATTERY,
|
|
53832
54338
|
...CONSUMABLE,
|
|
54339
|
+
...TANK,
|
|
53833
54340
|
"stream-online",
|
|
53834
54341
|
"stream-offline",
|
|
53835
54342
|
"detection-blind",
|
|
53836
54343
|
...ALARM
|
|
53837
54344
|
];
|
|
53838
|
-
|
|
54345
|
+
/** Every kind a summary may speak about — the two summarisable families. */
|
|
54346
|
+
var SUMMARISABLE = [...systemEventKindsOfFamily("device-events"), ...systemEventKindsOfFamily("system")];
|
|
54347
|
+
/** One per summary SECTION (`NC_STATE_SUMMARY_SECTIONS` in the notification
|
|
54348
|
+
* centre): the section's lines, offered when one of its kinds is selected. */
|
|
54349
|
+
var STATE_SUMMARY_SECTION_VARS = [
|
|
54350
|
+
{
|
|
54351
|
+
name: "summaryDevices",
|
|
54352
|
+
label: "Summary: devices offline / switched off",
|
|
54353
|
+
example: "Garage — offline since 07:12",
|
|
54354
|
+
kinds: [
|
|
54355
|
+
"device-offline",
|
|
54356
|
+
"device-online",
|
|
54357
|
+
"device-disabled",
|
|
54358
|
+
"device-enabled"
|
|
54359
|
+
]
|
|
54360
|
+
},
|
|
54361
|
+
{
|
|
54362
|
+
name: "summaryStreams",
|
|
54363
|
+
label: "Summary: streams offline",
|
|
54364
|
+
example: "Ingresso (high) — since 06:40",
|
|
54365
|
+
kinds: ["stream-offline", "stream-online"]
|
|
54366
|
+
},
|
|
54367
|
+
{
|
|
54368
|
+
name: "summaryBattery",
|
|
54369
|
+
label: "Summary: low batteries",
|
|
54370
|
+
example: "Sensore porta — 8 %",
|
|
54371
|
+
kinds: BATTERY
|
|
54372
|
+
},
|
|
54373
|
+
{
|
|
54374
|
+
name: "summaryConsumables",
|
|
54375
|
+
label: "Summary: consumables",
|
|
54376
|
+
example: "Robot — filter 10 %",
|
|
54377
|
+
kinds: CONSUMABLE
|
|
54378
|
+
},
|
|
54379
|
+
{
|
|
54380
|
+
name: "summaryTanks",
|
|
54381
|
+
label: "Summary: tanks",
|
|
54382
|
+
example: "Robot — clean water low",
|
|
54383
|
+
kinds: TANK
|
|
54384
|
+
},
|
|
54385
|
+
{
|
|
54386
|
+
name: "summaryDetection",
|
|
54387
|
+
label: "Summary: cameras detecting nothing",
|
|
54388
|
+
example: "Ingresso — since 05:10",
|
|
54389
|
+
kinds: ["detection-blind"]
|
|
54390
|
+
},
|
|
54391
|
+
{
|
|
54392
|
+
name: "summaryNodes",
|
|
54393
|
+
label: "Summary: nodes",
|
|
54394
|
+
example: "little-unraid — offline since 03:00",
|
|
54395
|
+
kinds: [
|
|
54396
|
+
"node-offline",
|
|
54397
|
+
"node-online",
|
|
54398
|
+
"node-inference-unavailable"
|
|
54399
|
+
]
|
|
54400
|
+
},
|
|
54401
|
+
{
|
|
54402
|
+
name: "summaryAddons",
|
|
54403
|
+
label: "Summary: addons",
|
|
54404
|
+
example: "@camstack/addon-recorder 1.2.3 → 1.2.4",
|
|
54405
|
+
kinds: [
|
|
54406
|
+
"addon-crash-loop",
|
|
54407
|
+
"addon-update-available",
|
|
54408
|
+
"addon-updated"
|
|
54409
|
+
]
|
|
54410
|
+
},
|
|
54411
|
+
{
|
|
54412
|
+
name: "summaryUpdates",
|
|
54413
|
+
label: "Summary: server & container updates",
|
|
54414
|
+
example: "server 1.2.377 → 1.2.378",
|
|
54415
|
+
kinds: [
|
|
54416
|
+
"server-update-available",
|
|
54417
|
+
"server-updated",
|
|
54418
|
+
"wrapper-update-available"
|
|
54419
|
+
]
|
|
54420
|
+
}
|
|
54421
|
+
];
|
|
54422
|
+
var STATE_SUMMARY_VARS = [
|
|
54423
|
+
{
|
|
54424
|
+
name: "summaryText",
|
|
54425
|
+
label: "Summary: every section",
|
|
54426
|
+
description: "One block per section with something to report, one line per item.",
|
|
54427
|
+
example: "Batterie scariche: Sensore porta — 8 %",
|
|
54428
|
+
group: "system",
|
|
54429
|
+
families: ["rule"],
|
|
54430
|
+
fields: [...RULE_TEXT],
|
|
54431
|
+
kinds: ["system"],
|
|
54432
|
+
systemEventKinds: [...SUMMARISABLE],
|
|
54433
|
+
systemEventDeliveries: ["summary"]
|
|
54434
|
+
},
|
|
54435
|
+
{
|
|
54436
|
+
name: "summaryCount",
|
|
54437
|
+
label: "Summary: items reported",
|
|
54438
|
+
example: "3",
|
|
54439
|
+
group: "system",
|
|
54440
|
+
families: ["rule"],
|
|
54441
|
+
fields: [...RULE_TEXT],
|
|
54442
|
+
kinds: ["system"],
|
|
54443
|
+
systemEventKinds: [...SUMMARISABLE],
|
|
54444
|
+
systemEventDeliveries: ["summary"]
|
|
54445
|
+
},
|
|
54446
|
+
...STATE_SUMMARY_SECTION_VARS.map((v) => ({
|
|
54447
|
+
name: v.name,
|
|
54448
|
+
label: v.label,
|
|
54449
|
+
example: v.example,
|
|
54450
|
+
group: "system",
|
|
54451
|
+
families: ["rule"],
|
|
54452
|
+
fields: [...RULE_TEXT],
|
|
54453
|
+
kinds: ["system"],
|
|
54454
|
+
systemEventKinds: [...v.kinds],
|
|
54455
|
+
systemEventDeliveries: ["summary"]
|
|
54456
|
+
}))
|
|
54457
|
+
];
|
|
54458
|
+
[
|
|
54459
|
+
[...DEVICE_EVENTS],
|
|
54460
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
54461
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
54462
|
+
[...RULE_TEXT],
|
|
54463
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
54464
|
+
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
54465
|
+
[...RULE_TEXT],
|
|
54466
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
54467
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
54468
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
54469
|
+
[...RULE_TEXT],
|
|
54470
|
+
[...RULE_TEXT],
|
|
54471
|
+
[...RULE_TEXT],
|
|
54472
|
+
[...RULE_TEXT],
|
|
54473
|
+
[...RULE_TEXT],
|
|
54474
|
+
[...RULE_TEXT],
|
|
54475
|
+
[...RULE_TEXT],
|
|
54476
|
+
[...RULE_TEXT],
|
|
54477
|
+
[...RULE_BODY_ONLY],
|
|
54478
|
+
[...RULE_TEXT],
|
|
54479
|
+
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
54480
|
+
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
54481
|
+
([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
|
|
54482
|
+
([...RULE_TEXT], [...CONSUMABLE]),
|
|
54483
|
+
([...RULE_TEXT], [...TANK]),
|
|
54484
|
+
[...RULE_TEXT],
|
|
54485
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
54486
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
54487
|
+
[...RULE_TEXT],
|
|
54488
|
+
[...RULE_TEXT],
|
|
54489
|
+
[...RULE_TEXT],
|
|
54490
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
54491
|
+
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
54492
|
+
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
54493
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
54494
|
+
([...RULE_TEXT], [...UPDATES]),
|
|
54495
|
+
([...RULE_TEXT], [...PACKAGE_UPDATES]),
|
|
54496
|
+
[...RULE_TEXT],
|
|
54497
|
+
[...RULE_TEXT],
|
|
54498
|
+
[...RULE_TEXT],
|
|
54499
|
+
[...RULE_TEXT],
|
|
54500
|
+
[...RULE_TEXT],
|
|
54501
|
+
[...RULE_TEXT],
|
|
54502
|
+
[...RULE_TEXT],
|
|
54503
|
+
[...RULE_TEXT],
|
|
54504
|
+
[...RULE_TEXT],
|
|
54505
|
+
[...RULE_TEXT],
|
|
54506
|
+
[...RULE_TEXT],
|
|
54507
|
+
[...RULE_TEXT],
|
|
54508
|
+
[...RULE_TEXT],
|
|
54509
|
+
[...RULE_TEXT],
|
|
54510
|
+
[...RULE_TEXT],
|
|
54511
|
+
[...RULE_TEXT],
|
|
54512
|
+
[...RULE_TEXT],
|
|
54513
|
+
[...RULE_TEXT],
|
|
54514
|
+
[...RULE_TEXT],
|
|
54515
|
+
[...RULE_TEXT],
|
|
54516
|
+
[...RULE_TEXT],
|
|
54517
|
+
[...RULE_TEXT],
|
|
54518
|
+
[...RULE_TEXT],
|
|
54519
|
+
[...RULE_TEXT],
|
|
54520
|
+
...STATE_SUMMARY_VARS
|
|
54521
|
+
];
|
|
53839
54522
|
/**
|
|
53840
54523
|
* TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
|
|
53841
54524
|
*
|