@camstack/addon-provider-homeassistant 1.2.42 → 1.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/{dist-Cef7D9kq.js → dist-B1grYZFh.js} +2060 -1815
- package/dist/{dist-DolpU5X1.mjs → dist-BjB1J9mO.mjs} +2049 -1816
- package/dist/ha-export/ha-export.addon.js +1054 -88
- package/dist/ha-export/ha-export.addon.mjs +1054 -88
- package/package.json +1 -1
|
@@ -6581,6 +6581,65 @@ var ProfileRtspEntrySchema = object({
|
|
|
6581
6581
|
resolution: CamStreamResolutionSchema.optional()
|
|
6582
6582
|
});
|
|
6583
6583
|
/**
|
|
6584
|
+
* Per-call node pinning for `ctx.api` capability calls.
|
|
6585
|
+
*
|
|
6586
|
+
* A capability call normally resolves to its DEFAULT provider — a `singleton`
|
|
6587
|
+
* cap resolves to the hub, a device-scoped cap to the device's owning node. To
|
|
6588
|
+
* query a SPECIFIC node's provider instead (e.g. a remote agent's own
|
|
6589
|
+
* in-process `platform-probe` hardware, which the hub cannot probe), pin the
|
|
6590
|
+
* call to that node.
|
|
6591
|
+
*
|
|
6592
|
+
* The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
|
|
6593
|
+
* method args), so capability method signatures stay `nodeId`-free — node
|
|
6594
|
+
* targeting is a property of the CALL, not of the method. The transport lifts
|
|
6595
|
+
* it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
|
|
6596
|
+
* and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
|
|
6597
|
+
* which classifies a pinned agent node as `agent-child-forward`
|
|
6598
|
+
* (`$agent-cap-fwd.forward` → the agent's in-process provider).
|
|
6599
|
+
*
|
|
6600
|
+
* Usage at a call site:
|
|
6601
|
+
*
|
|
6602
|
+
* await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
|
|
6603
|
+
*/
|
|
6604
|
+
/** tRPC `op.context` key carrying a per-call node pin. */
|
|
6605
|
+
var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
|
|
6606
|
+
/**
|
|
6607
|
+
* Build the tRPC request options that pin a single capability call to `nodeId`.
|
|
6608
|
+
* Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
|
|
6609
|
+
*
|
|
6610
|
+
* ## The id is normalised here, and it has to be
|
|
6611
|
+
*
|
|
6612
|
+
* A forked addon reads its own node from `ctx.kernel.localNodeId`, and inside a
|
|
6613
|
+
* worker that value is a RUNNER id — `hub/export-hap`, not `hub`. Routing
|
|
6614
|
+
* compares a pin against real node ids, so such a pin matches nothing and the
|
|
6615
|
+
* call fails with `no provider registered for cap "…"`. The local-first
|
|
6616
|
+
* resolver already guarded against this (`localNodeId.split('/')[0]`), which
|
|
6617
|
+
* made the hazard invisible: unpinned calls worked, and only an explicit pin —
|
|
6618
|
+
* the thing you reach for when you specifically need THIS node — silently
|
|
6619
|
+
* addressed a node that does not exist.
|
|
6620
|
+
*
|
|
6621
|
+
* Cost of it being missing: `addon-export-hap` pinned `decoder.getInfo` to its
|
|
6622
|
+
* own node to read the host's hardware-decode backend. It never once answered,
|
|
6623
|
+
* so every HomeKit egress transcode decoded in SOFTWARE — including 4K H.265 —
|
|
6624
|
+
* while D67's whole premise was that the decoder addon is the authority on
|
|
6625
|
+
* hardware. The warn said `decoding in SOFTWARE` and read as "this node has no
|
|
6626
|
+
* hardware", which was false.
|
|
6627
|
+
*
|
|
6628
|
+
* Normalising in the ONE constructor fixes every caller at once, which is why
|
|
6629
|
+
* it is here and not at the call sites.
|
|
6630
|
+
*/
|
|
6631
|
+
function nodePin(nodeId) {
|
|
6632
|
+
return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: toNodeId(nodeId) } };
|
|
6633
|
+
}
|
|
6634
|
+
/**
|
|
6635
|
+
* A runner id is `<nodeId>/<addonId>`; a node id has no slash. Taking the head
|
|
6636
|
+
* is idempotent, so passing an already-clean id costs nothing.
|
|
6637
|
+
*/
|
|
6638
|
+
function toNodeId(idOrRunnerId) {
|
|
6639
|
+
const head = idOrRunnerId.split("/")[0];
|
|
6640
|
+
return head === void 0 || head.length === 0 ? idOrRunnerId : head;
|
|
6641
|
+
}
|
|
6642
|
+
/**
|
|
6584
6643
|
* Output schema shared by the contribution + live methods.
|
|
6585
6644
|
*
|
|
6586
6645
|
* Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
|
|
@@ -7522,6 +7581,32 @@ var CameraSwitchIdSchema = _enum([
|
|
|
7522
7581
|
"notifications"
|
|
7523
7582
|
]);
|
|
7524
7583
|
/**
|
|
7584
|
+
* Stable render order — broadest blast radius first, and a source before the
|
|
7585
|
+
* thing that consumes it. `device-audio` sits ABOVE `audio-analysis` because
|
|
7586
|
+
* turning the microphone off leaves the analyzer with nothing to analyse; the
|
|
7587
|
+
* reverse is not true.
|
|
7588
|
+
*
|
|
7589
|
+
* `privacy-mask` sits directly ABOVE `device-audio` because they are literal
|
|
7590
|
+
* siblings — one cap, one device plane, video then audio — and NOT above
|
|
7591
|
+
* `object-detection` despite feeding it: a mask blanks REGIONS, so its blast
|
|
7592
|
+
* radius is partial, and the "broadest first" rule does not rank a partial
|
|
7593
|
+
* control above a whole-function one.
|
|
7594
|
+
*
|
|
7595
|
+
* `broker-audio` sits directly BELOW `device-audio` by the same source-first
|
|
7596
|
+
* rule: the camera's microphone feeds the broker, so silencing the camera
|
|
7597
|
+
* leaves the broker's mute with nothing to suppress; the reverse is not true.
|
|
7598
|
+
*/
|
|
7599
|
+
var CAMERA_SWITCH_ORDER = [
|
|
7600
|
+
"stream-broker",
|
|
7601
|
+
"object-detection",
|
|
7602
|
+
"privacy-mask",
|
|
7603
|
+
"device-audio",
|
|
7604
|
+
"broker-audio",
|
|
7605
|
+
"audio-analysis",
|
|
7606
|
+
"recording",
|
|
7607
|
+
"notifications"
|
|
7608
|
+
];
|
|
7609
|
+
/**
|
|
7525
7610
|
* WHERE the switch's state actually lives. A discriminated union rather than a
|
|
7526
7611
|
* string so both the writer (the orchestrator's `setCameraSwitch`) and any
|
|
7527
7612
|
* reader can exhaustively narrow — and so "the group added a parallel map" is
|
|
@@ -16069,7 +16154,23 @@ var NcHistoryEntrySchema = object({
|
|
|
16069
16154
|
updatedAt: number(),
|
|
16070
16155
|
/** Failure detail — present on a `dead` row. */
|
|
16071
16156
|
error: string().optional(),
|
|
16072
|
-
subject: NcHistorySubjectSchema
|
|
16157
|
+
subject: NcHistorySubjectSchema,
|
|
16158
|
+
/**
|
|
16159
|
+
* Ids of the artefacts (still, then gif, then clip) this row's successful
|
|
16160
|
+
* delivery indexed in the artefact library — a REFERENCE, never the bytes
|
|
16161
|
+
* (an artefact is often megabytes; this row is durable JSON rewritten on
|
|
16162
|
+
* every delivery attempt). Absent on a row still pending/dead, a row
|
|
16163
|
+
* delivered before this field shipped, or a wiring with no artefact index.
|
|
16164
|
+
*
|
|
16165
|
+
* Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
|
|
16166
|
+
* outlives any one URL's TTL, so a caller mints a fresh link on demand
|
|
16167
|
+
* rather than trusting one frozen at delivery time. `resolveArtifactUrl`
|
|
16168
|
+
* also answers `null` for an id whose artefact has since expired past the
|
|
16169
|
+
* retained shelf's own age bound — the degrade a caller (the Home
|
|
16170
|
+
* Assistant export) must render as "no image right now", never as a
|
|
16171
|
+
* broken link.
|
|
16172
|
+
*/
|
|
16173
|
+
artifactIds: array(string().min(1)).optional()
|
|
16073
16174
|
});
|
|
16074
16175
|
/**
|
|
16075
16176
|
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
@@ -16296,7 +16397,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
16296
16397
|
}), method(object({}), object({
|
|
16297
16398
|
catalog: array(NcConditionDescriptorSchema),
|
|
16298
16399
|
taxonomy: NcTaxonomySchema.optional()
|
|
16299
|
-
})), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
16400
|
+
})), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
16300
16401
|
kind: "mutation",
|
|
16301
16402
|
caller: "required"
|
|
16302
16403
|
}), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
|
|
@@ -16652,1760 +16753,1996 @@ var oauthIntegrationCapability = {
|
|
|
16652
16753
|
getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
|
|
16653
16754
|
};
|
|
16654
16755
|
/**
|
|
16655
|
-
*
|
|
16656
|
-
*
|
|
16657
|
-
*
|
|
16658
|
-
* persisted media. Owns the post-detection domain end-to-end:
|
|
16659
|
-
*
|
|
16660
|
-
* runner emits PipelineInferenceResult
|
|
16661
|
-
* ↓ (event bus)
|
|
16662
|
-
* pipeline-analytics subscriber
|
|
16663
|
-
* ↓ SORT tracker + zone engine + state analyzer + event emitter
|
|
16664
|
-
* → three DB collections (one per kind), one FS media tree, one
|
|
16665
|
-
* unified event emitter (FrameTracked + TrackStarted/Ended +
|
|
16666
|
-
* DetectionEvent on bus)
|
|
16667
|
-
*
|
|
16668
|
-
* Pure subscriber model. No `processFrame` cap method — the runner
|
|
16669
|
-
* already publishes the raw frame on the bus. The cap surface is
|
|
16670
|
-
* only QUERIES + per-device settings, bound on/off via
|
|
16671
|
-
* `device-manager.setWrapperActive`. `defaultActive: true` because
|
|
16672
|
-
* every camera with a detection pipeline wants its raw detections
|
|
16673
|
-
* refined; operators opt out per-device via BindingsTab when needed.
|
|
16674
|
-
*
|
|
16675
|
-
* Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
|
|
16676
|
-
* (per-device surface) and `track-trail` caps — see P11 cleanup.
|
|
16756
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
16757
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
16758
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
16677
16759
|
*/
|
|
16678
|
-
var
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16760
|
+
var NativeCropRefSchema = object({
|
|
16761
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
16762
|
+
handle: FrameHandleSchema,
|
|
16763
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
16764
|
+
cropFrameSpace: object({
|
|
16765
|
+
x: number(),
|
|
16766
|
+
y: number(),
|
|
16767
|
+
w: number(),
|
|
16768
|
+
h: number()
|
|
16769
|
+
})
|
|
16770
|
+
});
|
|
16771
|
+
object({
|
|
16772
|
+
crop: object({
|
|
16773
|
+
left: number(),
|
|
16774
|
+
top: number(),
|
|
16775
|
+
width: number().positive(),
|
|
16776
|
+
height: number().positive()
|
|
16777
|
+
}).optional(),
|
|
16778
|
+
content: object({
|
|
16779
|
+
width: number().int().positive(),
|
|
16780
|
+
height: number().int().positive()
|
|
16781
|
+
}),
|
|
16782
|
+
fit: _enum(["stretch", "contain"]),
|
|
16783
|
+
format: _enum([
|
|
16784
|
+
"rgb",
|
|
16785
|
+
"gray",
|
|
16786
|
+
"jpeg"
|
|
16787
|
+
])
|
|
16788
|
+
});
|
|
16690
16789
|
/**
|
|
16691
|
-
*
|
|
16692
|
-
*
|
|
16693
|
-
*
|
|
16790
|
+
* Process-local frame identity. It is serializable so it can ride an in-process
|
|
16791
|
+
* capability call, but `registryId` deliberately prevents resolution in any
|
|
16792
|
+
* other process or execution group.
|
|
16694
16793
|
*/
|
|
16695
|
-
var
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
"
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
"
|
|
16706
|
-
"
|
|
16707
|
-
"
|
|
16708
|
-
"
|
|
16709
|
-
"
|
|
16794
|
+
var FrameRefSchema = object({
|
|
16795
|
+
registryId: string().min(1),
|
|
16796
|
+
id: string().min(1),
|
|
16797
|
+
width: number().int().positive(),
|
|
16798
|
+
height: number().int().positive(),
|
|
16799
|
+
format: _enum(["rgb", "gray"]),
|
|
16800
|
+
timestamp: number(),
|
|
16801
|
+
capturedAt: number().optional()
|
|
16802
|
+
});
|
|
16803
|
+
var ModelFormatSchema$1 = _enum([
|
|
16804
|
+
"onnx",
|
|
16805
|
+
"coreml",
|
|
16806
|
+
"openvino",
|
|
16807
|
+
"tflite",
|
|
16808
|
+
"pt",
|
|
16809
|
+
"gguf"
|
|
16710
16810
|
]);
|
|
16711
|
-
var
|
|
16712
|
-
"
|
|
16713
|
-
"
|
|
16714
|
-
"
|
|
16715
|
-
"
|
|
16716
|
-
"
|
|
16717
|
-
"custom",
|
|
16718
|
-
"package"
|
|
16811
|
+
var PipelineSlotSchema = _enum([
|
|
16812
|
+
"detector",
|
|
16813
|
+
"cropper",
|
|
16814
|
+
"classifier",
|
|
16815
|
+
"refiner",
|
|
16816
|
+
"audio-classifier"
|
|
16719
16817
|
]);
|
|
16720
|
-
|
|
16721
|
-
|
|
16722
|
-
|
|
16723
|
-
|
|
16724
|
-
|
|
16725
|
-
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
16726
|
-
labelKey: string(),
|
|
16727
|
-
/** English fallback label (kept for clients that don't translate). */
|
|
16728
|
-
label: string(),
|
|
16729
|
-
/** Hex color for timeline/legend rendering. */
|
|
16730
|
-
color: string(),
|
|
16731
|
-
/** Dictionary id → lucide component on the UI side. */
|
|
16732
|
-
iconId: string(),
|
|
16733
|
-
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
16734
|
-
icon: EventKindIconSchema,
|
|
16735
|
-
category: EventKindCategorySchema,
|
|
16736
|
-
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
16737
|
-
parentKind: string().nullable(),
|
|
16738
|
-
/** Derived from `parentKind`, explicit for the client tree. */
|
|
16739
|
-
level: EventKindLevelSchema,
|
|
16740
|
-
/** Which cap + device contributes this kind. For built-ins the camera
|
|
16741
|
-
* itself; for sensor kinds the LINKED source device. */
|
|
16742
|
-
source: object({
|
|
16743
|
-
capName: string(),
|
|
16744
|
-
deviceId: number()
|
|
16745
|
-
})
|
|
16818
|
+
var PipelineEngineChoiceSchema = object({
|
|
16819
|
+
runtime: _enum(["node", "python"]),
|
|
16820
|
+
backend: string(),
|
|
16821
|
+
format: ModelFormatSchema$1,
|
|
16822
|
+
device: string().optional()
|
|
16746
16823
|
});
|
|
16747
|
-
|
|
16748
|
-
|
|
16749
|
-
|
|
16750
|
-
|
|
16824
|
+
var AvailableEngineSchema = object({
|
|
16825
|
+
engine: PipelineEngineChoiceSchema,
|
|
16826
|
+
devices: array(object({
|
|
16827
|
+
id: string(),
|
|
16828
|
+
label: string(),
|
|
16829
|
+
description: string().optional()
|
|
16830
|
+
})).readonly(),
|
|
16831
|
+
defaultDevice: string()
|
|
16751
16832
|
});
|
|
16752
|
-
var
|
|
16833
|
+
var PipelineDefaultStepSchema = lazy(() => object({
|
|
16834
|
+
addonId: string(),
|
|
16835
|
+
addonName: string(),
|
|
16836
|
+
slot: PipelineSlotSchema,
|
|
16837
|
+
inputClasses: array(string()).readonly(),
|
|
16838
|
+
outputClasses: array(string()).readonly(),
|
|
16839
|
+
enabled: boolean(),
|
|
16840
|
+
modelId: string(),
|
|
16841
|
+
children: array(PipelineDefaultStepSchema).readonly(),
|
|
16842
|
+
group: string().optional(),
|
|
16843
|
+
settings: record(string(), unknown()).optional()
|
|
16844
|
+
}));
|
|
16845
|
+
var PipelineTemplateStepSchema = lazy(() => object({
|
|
16846
|
+
addonId: string(),
|
|
16847
|
+
enabled: boolean(),
|
|
16848
|
+
modelId: string(),
|
|
16849
|
+
children: array(PipelineTemplateStepSchema).readonly(),
|
|
16850
|
+
settings: record(string(), unknown()).optional()
|
|
16851
|
+
}));
|
|
16852
|
+
var PipelineTemplateSchema$1 = object({
|
|
16753
16853
|
id: string(),
|
|
16754
|
-
|
|
16755
|
-
|
|
16756
|
-
|
|
16757
|
-
|
|
16758
|
-
|
|
16759
|
-
/** Event kind id — matches an `EventKindDescriptor.kind`. */
|
|
16760
|
-
kind: string(),
|
|
16761
|
-
/** Snapshot of the sensor cap's runtime-state slice at the change. */
|
|
16762
|
-
value: record(string(), unknown()).nullable(),
|
|
16763
|
-
timestamp: number()
|
|
16854
|
+
name: string(),
|
|
16855
|
+
createdAt: string(),
|
|
16856
|
+
updatedAt: string(),
|
|
16857
|
+
engine: PipelineEngineChoiceSchema,
|
|
16858
|
+
steps: array(PipelineTemplateStepSchema).readonly()
|
|
16764
16859
|
});
|
|
16765
|
-
var
|
|
16766
|
-
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
|
|
16860
|
+
var PipelineModelOptionSchema = object({
|
|
16861
|
+
id: string(),
|
|
16862
|
+
name: string(),
|
|
16863
|
+
formats: record(string(), object({
|
|
16864
|
+
downloaded: boolean(),
|
|
16865
|
+
sizeMB: number()
|
|
16866
|
+
})),
|
|
16867
|
+
group: ModelVariantGroupSchema.optional(),
|
|
16868
|
+
legacy: boolean().optional(),
|
|
16869
|
+
provider: ModelProviderIdSchema.optional()
|
|
16770
16870
|
});
|
|
16771
|
-
var
|
|
16772
|
-
|
|
16773
|
-
|
|
16774
|
-
|
|
16775
|
-
|
|
16871
|
+
var ConfigFieldBridge = custom();
|
|
16872
|
+
var PipelineAddonSchemaSchema = object({
|
|
16873
|
+
id: string(),
|
|
16874
|
+
name: string(),
|
|
16875
|
+
slot: PipelineSlotSchema,
|
|
16876
|
+
inputClasses: array(string()).readonly(),
|
|
16877
|
+
outputClasses: array(string()).readonly(),
|
|
16878
|
+
childSlots: array(PipelineSlotSchema).readonly(),
|
|
16879
|
+
models: array(PipelineModelOptionSchema).readonly(),
|
|
16880
|
+
defaultModelId: string(),
|
|
16881
|
+
defaultModelIdByFormat: record(string(), string()).optional(),
|
|
16882
|
+
enabledByDefault: boolean().optional(),
|
|
16883
|
+
backfillIntoExistingOverrides: boolean().optional(),
|
|
16884
|
+
defaultConfidence: number(),
|
|
16885
|
+
group: string().optional(),
|
|
16886
|
+
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
16776
16887
|
});
|
|
16777
|
-
|
|
16778
|
-
|
|
16779
|
-
* divided by the track's detection-frame dims), computed at persist time.
|
|
16780
|
-
* Absent when the frame dims were unknown when the track was persisted
|
|
16781
|
-
* (legacy rows / dims-less sources) and on active (in-RAM) tracks.
|
|
16782
|
-
*/
|
|
16783
|
-
var TrackEnvelopeSchema = object({
|
|
16784
|
-
minX: number(),
|
|
16785
|
-
minY: number(),
|
|
16786
|
-
maxX: number(),
|
|
16787
|
-
maxY: number()
|
|
16788
|
-
});
|
|
16789
|
-
/**
|
|
16790
|
-
* Row projection for track list queries. `full` (default) returns the
|
|
16791
|
-
* complete Track including the frame-rate `positions[]` history and the
|
|
16792
|
-
* `snapshots[]` references — megabytes across a page of tracks. `slim`
|
|
16793
|
-
* keeps every scalar the list surfaces actually render (ids, class(es),
|
|
16794
|
-
* label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
|
|
16795
|
-
* zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
|
|
16796
|
-
* `snapshots` as EMPTY arrays — detail views re-fetch the full row via
|
|
16797
|
-
* `getTrack`. Mirrors the event-store `projection` convention
|
|
16798
|
-
* (`getObjectEvents` et al.).
|
|
16799
|
-
*/
|
|
16800
|
-
var TrackProjectionSchema = _enum(["full", "slim"]);
|
|
16801
|
-
/**
|
|
16802
|
-
* One audio-classification label heard on the track's camera while the
|
|
16803
|
-
* track was alive, aggregated per label. An "episode" is one persisted
|
|
16804
|
-
* audio event (the confident-classification path: score ≥ the device's
|
|
16805
|
-
* `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
|
|
16806
|
-
* one 32 ms inference chunk, so counts stay human-scaled.
|
|
16807
|
-
*/
|
|
16808
|
-
var TrackAudioLabelSchema = object({
|
|
16888
|
+
var PipelineSlotSchemaSchema = object({
|
|
16889
|
+
id: PipelineSlotSchema,
|
|
16809
16890
|
label: string(),
|
|
16810
|
-
|
|
16811
|
-
|
|
16812
|
-
|
|
16813
|
-
count: number(),
|
|
16814
|
-
firstAt: number(),
|
|
16815
|
-
lastAt: number()
|
|
16891
|
+
priority: number(),
|
|
16892
|
+
parentSlot: PipelineSlotSchema.nullable(),
|
|
16893
|
+
addons: array(PipelineAddonSchemaSchema).readonly()
|
|
16816
16894
|
});
|
|
16817
|
-
|
|
16818
|
-
|
|
16819
|
-
|
|
16820
|
-
|
|
16821
|
-
*
|
|
16822
|
-
* - `sensor` — a linked sensor/control device state change.
|
|
16823
|
-
* - `audio` — an audio event on the camera itself that was anomalous for
|
|
16824
|
-
* THAT camera, loud, and heard while nothing visual was happening (D62).
|
|
16825
|
-
*
|
|
16826
|
-
* The spatial subsystems (tracker association, occupancy count, re-id /
|
|
16827
|
-
* embedding, resurrection) MUST skip every synthetic source. Test for that
|
|
16828
|
-
* with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
|
|
16829
|
-
* check silently readmits every source added after it was written.
|
|
16830
|
-
*/
|
|
16831
|
-
var TrackSourceSchema = _enum([
|
|
16832
|
-
"pipeline",
|
|
16833
|
-
"sensor",
|
|
16834
|
-
"audio"
|
|
16835
|
-
]);
|
|
16836
|
-
/**
|
|
16837
|
-
* Where a track sits in the RETRAIN lifecycle (D81).
|
|
16838
|
-
*
|
|
16839
|
-
* - `none` — never marked, or un-marked. Evictable.
|
|
16840
|
-
* - `staging` — the operator wants this track as training material and has not
|
|
16841
|
-
* finished with it. **This is the only state retention holds**: the track and
|
|
16842
|
-
* everything it owns (object events, crops, keyframes, CLIP vector) survive
|
|
16843
|
-
* the device's age window.
|
|
16844
|
-
* - `trained` — the retrain page has taken what it needed. The frames it chose
|
|
16845
|
-
* were COPIED into the retrain dataset at selection time, so the dataset no
|
|
16846
|
-
* longer depends on the track's media and the track becomes EVICTABLE again.
|
|
16847
|
-
* Terminal for the plain `markForTrain` toggle: returning it to `staging` is
|
|
16848
|
-
* a deliberate action of the retrain page, not a side effect of a checkbox.
|
|
16849
|
-
*
|
|
16850
|
-
* There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
|
|
16851
|
-
* the store's filter language has only positive equality and `whereIn` — no
|
|
16852
|
-
* negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
|
|
16853
|
-
* would make the entire pre-column history immortal in one deploy.
|
|
16854
|
-
*/
|
|
16855
|
-
var RetrainStatusSchema = _enum([
|
|
16856
|
-
"none",
|
|
16857
|
-
"staging",
|
|
16858
|
-
"trained"
|
|
16859
|
-
]);
|
|
16860
|
-
/**
|
|
16861
|
-
* Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
|
|
16862
|
-
* by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
|
|
16863
|
-
* so the two surfaces cannot drift.
|
|
16864
|
-
*
|
|
16865
|
-
* **Absent ≠ false.** A track that has never been touched omits the field; an
|
|
16866
|
-
* explicitly un-flagged track carries `false`. Legacy rows written before the
|
|
16867
|
-
* columns existed read as absent, and a consumer that needs a boolean should say
|
|
16868
|
-
* `flag === true`, not `flag !== false`.
|
|
16869
|
-
*
|
|
16870
|
-
* `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
|
|
16871
|
-
* it is exactly `retrainStatus === 'staging'`, in both directions. Writing
|
|
16872
|
-
* `true` moves `none → staging`, writing `false` moves `staging → none`, and a
|
|
16873
|
-
* `trained` track reports `false` while refusing both writes. The boolean is
|
|
16874
|
-
* kept because three surfaces drive a toggle off it; anything that needs to tell
|
|
16875
|
-
* "never marked" from "already trained" must read `retrainStatus`.
|
|
16876
|
-
*
|
|
16877
|
-
* `debug` does NOT pin; it is attention, not durability.
|
|
16878
|
-
*
|
|
16879
|
-
* `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
|
|
16880
|
-
* A favourited track is skipped by retention the same way `staging` is, but
|
|
16881
|
-
* it does not enter `none|staging|trained` and has no staging budget.
|
|
16882
|
-
*/
|
|
16883
|
-
var TrackFlagFields = {
|
|
16884
|
-
/** Operator marked this track as training material — i.e. `retrainStatus` is
|
|
16885
|
-
* `'staging'`. */
|
|
16886
|
-
markForTrain: boolean().optional(),
|
|
16887
|
-
/** Operator marked this track for diagnostic attention. */
|
|
16888
|
-
debug: boolean().optional(),
|
|
16889
|
-
/** Operator favourited this track. Pins it against pruning. */
|
|
16890
|
-
favourited: boolean().optional()
|
|
16891
|
-
};
|
|
16892
|
-
/**
|
|
16893
|
-
* The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
|
|
16894
|
-
* Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
|
|
16895
|
-
* write patch, and the status is not something the toggle sets — it is what the
|
|
16896
|
-
* toggle's boolean is derived from. Absent on an in-RAM track never touched;
|
|
16897
|
-
* always present on a persisted row (the column default materialises `'none'`).
|
|
16898
|
-
*/
|
|
16899
|
-
var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
|
|
16900
|
-
/**
|
|
16901
|
-
* The write half: a PARTIAL patch. An omitted key is left untouched, so setting
|
|
16902
|
-
* one flag can never clear the other — the toggles are independent and are
|
|
16903
|
-
* driven from three surfaces that do not know about each other.
|
|
16904
|
-
*/
|
|
16905
|
-
var TrackFlagsPatchSchema = object(TrackFlagFields);
|
|
16906
|
-
/**
|
|
16907
|
-
* The resolved flag state after a write. Both fields are REQUIRED here (absent
|
|
16908
|
-
* collapses to `false`) so a caller can drive a toggle's checked state off the
|
|
16909
|
-
* mutation result without a re-fetch.
|
|
16910
|
-
*/
|
|
16911
|
-
var TrackFlagsSchema = object({
|
|
16912
|
-
trackId: string(),
|
|
16913
|
-
markForTrain: boolean(),
|
|
16914
|
-
debug: boolean(),
|
|
16915
|
-
favourited: boolean(),
|
|
16916
|
-
/** The lifecycle state the boolean was derived from. Required here (unlike on
|
|
16917
|
-
* a track row) because this shape is only ever produced by the write body,
|
|
16918
|
-
* which always knows it — and a surface that has just written needs to render
|
|
16919
|
-
* `trained` without a re-fetch. */
|
|
16920
|
-
retrainStatus: RetrainStatusSchema
|
|
16895
|
+
var PipelineSchemaSchema = object({
|
|
16896
|
+
availableEngines: array(AvailableEngineSchema).readonly(),
|
|
16897
|
+
selectedEngine: PipelineEngineChoiceSchema,
|
|
16898
|
+
slots: array(PipelineSlotSchemaSchema).readonly()
|
|
16921
16899
|
});
|
|
16922
|
-
|
|
16923
|
-
|
|
16924
|
-
|
|
16925
|
-
|
|
16926
|
-
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
16930
|
-
|
|
16931
|
-
|
|
16932
|
-
|
|
16933
|
-
|
|
16934
|
-
|
|
16935
|
-
|
|
16936
|
-
|
|
16900
|
+
var EngineProvisioningSchema = object({
|
|
16901
|
+
runtimeId: _enum([
|
|
16902
|
+
"onnx",
|
|
16903
|
+
"openvino",
|
|
16904
|
+
"coreml",
|
|
16905
|
+
"edgetpu"
|
|
16906
|
+
]).nullable(),
|
|
16907
|
+
device: string().nullable(),
|
|
16908
|
+
state: _enum([
|
|
16909
|
+
"idle",
|
|
16910
|
+
"installing",
|
|
16911
|
+
"verifying",
|
|
16912
|
+
"ready",
|
|
16913
|
+
"failed"
|
|
16914
|
+
]),
|
|
16915
|
+
progress: number().optional(),
|
|
16916
|
+
error: string().optional(),
|
|
16917
|
+
nextRetryAt: number().optional(),
|
|
16918
|
+
/**
|
|
16919
|
+
* Gate A (config-correctness gate at engine change): human-readable
|
|
16920
|
+
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
16921
|
+
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
16922
|
+
* has a <format> build"). Additive/optional: informational only, never
|
|
16923
|
+
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
16924
|
+
* Absent/empty when the node-default tree resolves cleanly.
|
|
16925
|
+
*/
|
|
16926
|
+
configIssues: array(string()).optional()
|
|
16927
|
+
});
|
|
16928
|
+
var PipelineStepInputSchema = lazy(() => object({
|
|
16929
|
+
addonId: string(),
|
|
16937
16930
|
modelId: string().optional(),
|
|
16938
|
-
|
|
16931
|
+
enabled: boolean().default(true),
|
|
16932
|
+
children: array(PipelineStepInputSchema).optional(),
|
|
16933
|
+
settings: record(string(), unknown()).optional(),
|
|
16934
|
+
jumpDeviceKey: string().optional()
|
|
16935
|
+
}));
|
|
16936
|
+
var ModelSubstitutionSchema = object({
|
|
16937
|
+
addonId: string(),
|
|
16938
|
+
chosen: string(),
|
|
16939
|
+
running: string(),
|
|
16940
|
+
format: string()
|
|
16941
|
+
});
|
|
16942
|
+
var PipelineValidationIssueSchema = object({
|
|
16943
|
+
addonId: string(),
|
|
16944
|
+
kind: _enum(["unknown-addon", "no-format-build"]),
|
|
16945
|
+
detail: string()
|
|
16946
|
+
});
|
|
16947
|
+
var PipelineValidationResultSchema = object({
|
|
16948
|
+
ok: boolean(),
|
|
16949
|
+
issues: array(PipelineValidationIssueSchema).readonly(),
|
|
16950
|
+
substitutions: array(ModelSubstitutionSchema).readonly(),
|
|
16951
|
+
/** The node's `currentEngine.format` this validation ran against. */
|
|
16952
|
+
format: string()
|
|
16953
|
+
});
|
|
16954
|
+
var ReferenceImageEntrySchema = object({
|
|
16955
|
+
filename: string(),
|
|
16956
|
+
stepIds: array(string()).readonly().optional()
|
|
16957
|
+
});
|
|
16958
|
+
var ReferenceImageBodySchema = object({
|
|
16959
|
+
base64: string(),
|
|
16960
|
+
filename: string()
|
|
16961
|
+
});
|
|
16962
|
+
var ReferenceAudioEntrySchema = object({
|
|
16963
|
+
filename: string(),
|
|
16964
|
+
sizeKb: number()
|
|
16965
|
+
});
|
|
16966
|
+
var ReferenceAudioBodySchema = object({ base64: string() });
|
|
16967
|
+
var AudioBackendSchema = object({
|
|
16968
|
+
id: string(),
|
|
16969
|
+
name: string(),
|
|
16970
|
+
description: string(),
|
|
16971
|
+
available: boolean(),
|
|
16939
16972
|
/**
|
|
16940
|
-
*
|
|
16941
|
-
*
|
|
16942
|
-
*
|
|
16943
|
-
*
|
|
16944
|
-
* notification rule authored on "Gianluca" stopped matching the moment the
|
|
16945
|
-
* operator fixed the spelling in the gallery, and nothing said so. The id is
|
|
16946
|
-
* the thing that does not move, so it is what a rule matches on
|
|
16947
|
-
* (`NcConditions.identities`) and the text is what a human is shown.
|
|
16948
|
-
*
|
|
16949
|
-
* Absent when the label names no gallery row — a plate the OCR read but no
|
|
16950
|
-
* vehicle claims, a sub-class, a species, any tier-1 value.
|
|
16973
|
+
* Raw classifier labels this backend can emit (e.g. YAMNet's
|
|
16974
|
+
* 521-class set or Apple SoundAnalysis's 303-class set). Used by
|
|
16975
|
+
* the benchmark UI to populate the `enabledMicroClasses` filter
|
|
16976
|
+
* specific to the selected backend without a separate fetch.
|
|
16951
16977
|
*/
|
|
16952
|
-
|
|
16978
|
+
rawLabels: array(string()).readonly().optional()
|
|
16953
16979
|
});
|
|
16954
|
-
|
|
16955
|
-
|
|
16956
|
-
|
|
16957
|
-
|
|
16958
|
-
|
|
16959
|
-
|
|
16960
|
-
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
|
|
16964
|
-
* finest thing known. Before 4g the single `label` column held the finest
|
|
16965
|
-
* value, so a consumer that has not been updated reads the tier-1 slot and
|
|
16966
|
-
* shows nothing on a species-only row; that is why the migration puts every
|
|
16967
|
-
* pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
|
|
16968
|
-
* and why the read surfaces were changed in the same train.
|
|
16969
|
-
*
|
|
16970
|
-
* **Writing it.** The slots are independent, which is the whole point: a
|
|
16971
|
-
* tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
|
|
16972
|
-
* migratorius`), so fineness cannot regress by construction. Within a tier the
|
|
16973
|
-
* higher score wins. One rule, one implementation — see
|
|
16974
|
-
* `pipeline/label-tier.ts` in addon-post-analysis.
|
|
16975
|
-
*/
|
|
16976
|
-
var TieredLabelFields = {
|
|
16977
|
-
/** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
|
|
16978
|
-
label: string().optional(),
|
|
16979
|
-
/** Confidence of the tier-1 value, as reported by the deciding step. */
|
|
16980
|
-
labelScore: number().optional(),
|
|
16981
|
-
/** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
|
|
16982
|
-
labelMeta: LabelAttributionSchema.optional(),
|
|
16983
|
-
/** Tier 2 — the instance. See {@link LabelTierSchema}. */
|
|
16984
|
-
subLabel: string().optional(),
|
|
16985
|
-
/** Confidence of the tier-2 value, as reported by the deciding step. */
|
|
16986
|
-
subLabelScore: number().optional(),
|
|
16987
|
-
/** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
|
|
16988
|
-
subLabelMeta: LabelAttributionSchema.optional()
|
|
16989
|
-
};
|
|
16990
|
-
/** Per-camera slice of a training-export estimate. */
|
|
16991
|
-
var TrainingExportDeviceTotalsSchema = object({
|
|
16992
|
-
deviceId: number(),
|
|
16993
|
-
tracks: number().int(),
|
|
16994
|
-
files: number().int(),
|
|
16995
|
-
bytes: number().int()
|
|
16980
|
+
var AudioCapabilitiesSchema = object({
|
|
16981
|
+
activeBackend: string(),
|
|
16982
|
+
availableBackends: array(AudioBackendSchema).readonly(),
|
|
16983
|
+
sampleRate: number(),
|
|
16984
|
+
chunkDurationMs: number()
|
|
16985
|
+
});
|
|
16986
|
+
var DownloadModelResultSchema = object({
|
|
16987
|
+
filePath: string(),
|
|
16988
|
+
sizeMB: number(),
|
|
16989
|
+
durationMs: number()
|
|
16996
16990
|
});
|
|
16997
16991
|
/**
|
|
16998
|
-
*
|
|
16999
|
-
*
|
|
16992
|
+
* Wrapper carrying a single test run's result. Replaces the legacy
|
|
16993
|
+
* ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
|
|
16994
|
+
* canonical `AudioResult` from the Phase 6 output rework: one
|
|
16995
|
+
* `AudioDetection` per class above `minScore`, top-N candidates in
|
|
16996
|
+
* `debug.alternateLabels['audio-classifier']`, per-source timings in
|
|
16997
|
+
* `debug.stepTimings`. The outer `success`/`error` fields stay so the
|
|
16998
|
+
* benchmark UI can still report a clean failure when the classifier
|
|
16999
|
+
* cap isn't available.
|
|
17000
17000
|
*/
|
|
17001
|
-
var
|
|
17002
|
-
|
|
17003
|
-
|
|
17004
|
-
|
|
17005
|
-
byteCount: number().int(),
|
|
17006
|
-
/** More marked tracks exist than a single pass carries. */
|
|
17007
|
-
truncated: boolean(),
|
|
17008
|
-
devices: array(TrainingExportDeviceTotalsSchema).readonly()
|
|
17001
|
+
var AudioTestResultSchema = object({
|
|
17002
|
+
success: boolean(),
|
|
17003
|
+
error: string().optional(),
|
|
17004
|
+
frame: custom().optional()
|
|
17009
17005
|
});
|
|
17010
|
-
var
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
|
|
17017
|
-
|
|
17018
|
-
|
|
17019
|
-
|
|
17020
|
-
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
|
|
17006
|
+
var PipelineConfigBridge = custom();
|
|
17007
|
+
var ConfigUISchemaBridge = custom();
|
|
17008
|
+
var ConfigUISchemaNullableBridge = custom();
|
|
17009
|
+
var InferenceCapabilitiesBridge = custom();
|
|
17010
|
+
var ModelAvailabilityListBridge = custom();
|
|
17011
|
+
var PipelineRunResultBridge = custom();
|
|
17012
|
+
method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
|
|
17013
|
+
modelId: string(),
|
|
17014
|
+
settings: record(string(), unknown()).readonly()
|
|
17015
|
+
}))), method(object({ steps: record(string(), object({
|
|
17016
|
+
modelId: string(),
|
|
17017
|
+
settings: record(string(), unknown()).readonly()
|
|
17018
|
+
})) }), object({ success: literal(true) }), {
|
|
17019
|
+
kind: "mutation",
|
|
17020
|
+
auth: "admin"
|
|
17021
|
+
}), method(object({ nodeId: string() }), object({
|
|
17022
|
+
success: literal(true),
|
|
17023
|
+
clearedDevices: number()
|
|
17024
|
+
}), {
|
|
17025
|
+
kind: "mutation",
|
|
17026
|
+
auth: "admin"
|
|
17027
|
+
}), method(object({ nodeId: string() }), object({ unhealthy: array(object({
|
|
17028
|
+
/** `<backend>:<device>`, e.g. `openvino:gpu`. */
|
|
17029
|
+
deviceKey: string(),
|
|
17027
17030
|
/**
|
|
17028
|
-
*
|
|
17029
|
-
*
|
|
17030
|
-
*
|
|
17031
|
-
*
|
|
17032
|
-
* and no card can render — so every free-text search surface was structurally
|
|
17033
|
-
* unable to answer "show me the tracks in Uscio", and did not fail loudly, it
|
|
17034
|
-
* just returned nothing. Resolving here rather than in each client keeps ONE
|
|
17035
|
-
* derivation and costs the clients no extra call (the `zones` cap is
|
|
17036
|
-
* per-device, so a client-side resolve would be a per-camera fan-out on a
|
|
17037
|
-
* surface built to avoid exactly that).
|
|
17038
|
-
*
|
|
17039
|
-
* Resolved, never invented: a zone deleted since the track was written has no
|
|
17040
|
-
* name and is DROPPED, so this array can be shorter than `zonesVisited` — the
|
|
17041
|
-
* two are not positionally aligned. Absent when the track visited no zone, or
|
|
17042
|
-
* when the zone catalogue could not be read.
|
|
17031
|
+
* `failed` — the per-device restart budget is exhausted; no pool
|
|
17032
|
+
* will be spawned until an operator re-arms it or the runner
|
|
17033
|
+
* respawns. `backoff` — under budget, waiting out the backoff (or
|
|
17034
|
+
* a cached pool observed dead and not yet condemned).
|
|
17043
17035
|
*/
|
|
17044
|
-
|
|
17045
|
-
/**
|
|
17046
|
-
|
|
17047
|
-
|
|
17048
|
-
|
|
17049
|
-
/**
|
|
17050
|
-
|
|
17051
|
-
|
|
17052
|
-
|
|
17053
|
-
|
|
17054
|
-
|
|
17055
|
-
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17036
|
+
state: _enum(["failed", "backoff"]),
|
|
17037
|
+
/** Epoch ms of the death that produced this state. */
|
|
17038
|
+
since: number(),
|
|
17039
|
+
/** Pool deaths inside the current window. */
|
|
17040
|
+
deaths: number(),
|
|
17041
|
+
/** The last death's message. */
|
|
17042
|
+
lastError: string()
|
|
17043
|
+
})).readonly() })), method(object({
|
|
17044
|
+
nodeId: string(),
|
|
17045
|
+
deviceKey: string()
|
|
17046
|
+
}), object({ rearmed: boolean() }), {
|
|
17047
|
+
kind: "mutation",
|
|
17048
|
+
auth: "admin"
|
|
17049
|
+
}), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({ steps: array(PipelineStepInputSchema) }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
|
|
17050
|
+
name: string(),
|
|
17051
|
+
steps: array(PipelineTemplateStepSchema).readonly(),
|
|
17052
|
+
engine: PipelineEngineChoiceSchema
|
|
17053
|
+
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
|
|
17054
|
+
id: string(),
|
|
17055
|
+
name: string().optional(),
|
|
17056
|
+
steps: array(PipelineTemplateStepSchema).readonly().optional()
|
|
17057
|
+
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
|
|
17058
|
+
addonId: string(),
|
|
17059
|
+
modelId: string(),
|
|
17060
|
+
format: ModelFormatSchema$1
|
|
17061
|
+
}), DownloadModelResultSchema, { kind: "mutation" }), method(object({
|
|
17062
|
+
addonId: string(),
|
|
17063
|
+
modelId: string(),
|
|
17064
|
+
format: ModelFormatSchema$1
|
|
17065
|
+
}), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
17066
|
+
engine: PipelineEngineChoiceSchema.optional(),
|
|
17067
|
+
steps: array(PipelineStepInputSchema).min(1),
|
|
17068
|
+
frame: FrameInputSchema.optional(),
|
|
17071
17069
|
/**
|
|
17072
|
-
*
|
|
17073
|
-
*
|
|
17074
|
-
*
|
|
17075
|
-
* enabled. Set once and never cleared.
|
|
17076
|
-
*
|
|
17077
|
-
* **This exists so "face present but not recognised" is expressible.** A
|
|
17078
|
-
* recognised identity lands in `subLabel` (attributed to the face chain via
|
|
17079
|
-
* `subLabelMeta.stepId`), so before this field a track with an unmatched face
|
|
17080
|
-
* and a track with no face at all were byte-identical on the wire and no
|
|
17081
|
-
* surface could tell them apart. The read is `hasFace === true && subLabel
|
|
17082
|
-
* === undefined`.
|
|
17083
|
-
*
|
|
17084
|
-
* **Absent ≠ false.** Every row written before the column existed omits it,
|
|
17085
|
-
* and so does every server that predates the field — a consumer must test
|
|
17086
|
-
* `=== true` and render nothing otherwise, never infer "no face".
|
|
17070
|
+
* Process-local lazy frame. Valid only when caller and provider resolve
|
|
17071
|
+
* in the same execution-group process; split/cross-node callers use
|
|
17072
|
+
* `frame`/`image` inline compatibility instead.
|
|
17087
17073
|
*/
|
|
17088
|
-
|
|
17074
|
+
frameRef: FrameRefSchema.optional(),
|
|
17089
17075
|
/**
|
|
17090
|
-
*
|
|
17091
|
-
*
|
|
17092
|
-
*
|
|
17093
|
-
* The STRICT twin of {@link hasFace}, and the pair only earns its keep
|
|
17094
|
-
* because the two disagree. `hasFace` is stamped at the TOP of the face
|
|
17095
|
-
* branch, before every gate, and means no more than "a face detector produced
|
|
17096
|
-
* a face detail". This one is stamped at the single moment the gallery row
|
|
17097
|
-
* LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
|
|
17098
|
-
* past the embedding-magnitude verdict, the `minFacePx` detection gate, the
|
|
17099
|
-
* candidate gate, the imageless-track drop (no crop was ever captured) and
|
|
17100
|
-
* the crop-store drop. Everything between the detector and that insert can
|
|
17101
|
-
* legitimately refuse the face, so a flag written any earlier promises the
|
|
17102
|
-
* operator something to assign and delivers nothing.
|
|
17103
|
-
*
|
|
17104
|
-
* **Independent of recognition.** A face collected but never auto-matched is
|
|
17105
|
-
* still assignable — it is in fact the face an operator most wants to reach —
|
|
17106
|
-
* so this is NOT gated on `recognizedIdentityId`. Recognition lands in
|
|
17107
|
-
* `subLabel`; this says only that the raw material exists.
|
|
17108
|
-
*
|
|
17109
|
-
* **Set once, never cleared.** A track that produced a gallery row produced
|
|
17110
|
-
* one; deleting the row later is the gallery's business, not this flag's.
|
|
17111
|
-
*
|
|
17112
|
-
* **Absent ≠ false**, the same rule as {@link hasFace}: every row written
|
|
17113
|
-
* before the column omits it, and so does every server that predates the
|
|
17114
|
-
* field. A consumer must test `=== true` and render nothing otherwise —
|
|
17115
|
-
* never infer "no assignable face".
|
|
17076
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
17077
|
+
* the decoded pixels live in. One more member of the one-of
|
|
17078
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
17116
17079
|
*/
|
|
17117
|
-
|
|
17080
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
17081
|
+
imageBase64: string().optional(),
|
|
17118
17082
|
/**
|
|
17119
|
-
*
|
|
17120
|
-
* (
|
|
17121
|
-
*
|
|
17122
|
-
*
|
|
17123
|
-
*
|
|
17124
|
-
* said "the person is not lost — it is reported so both entities stay on the
|
|
17125
|
-
* record"; in fact the pair went into a per-processor RAM field behind an
|
|
17126
|
-
* accessor nobody called, and every durable surface said `vehicle`, full
|
|
17127
|
-
* stop. This is the composition note that makes the row true.
|
|
17128
|
-
*
|
|
17129
|
-
* A COMPOSITION, never a class and never a label. "This vehicle contains a
|
|
17130
|
-
* person" is not an answer to "what is this" — both label tiers would refuse
|
|
17131
|
-
* a macro token anyway (D89), and correctly. Nothing here changes what the
|
|
17132
|
-
* subject IS: a cyclist stays one vehicle track, occupancy still counts one,
|
|
17133
|
-
* and a `person` rule still does not fire for someone cycling past.
|
|
17134
|
-
*
|
|
17135
|
-
* **Absent ≠ false**, exactly like {@link hasFace}: every row written before
|
|
17136
|
-
* the column, and every hub that predates the field, omits it. Test
|
|
17137
|
-
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17083
|
+
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
17084
|
+
* hops (hub → forked worker via Moleculer MsgPack) because it
|
|
17085
|
+
* skips the 33% base64 overhead + the per-call base64 decode on
|
|
17086
|
+
* the detection-pipeline worker. Callers can pass either; exactly
|
|
17087
|
+
* one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
|
|
17138
17088
|
*/
|
|
17139
|
-
|
|
17140
|
-
|
|
17141
|
-
|
|
17142
|
-
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
|
|
17146
|
-
|
|
17147
|
-
|
|
17148
|
-
|
|
17149
|
-
|
|
17150
|
-
|
|
17151
|
-
|
|
17152
|
-
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
/**
|
|
17159
|
-
|
|
17160
|
-
|
|
17161
|
-
|
|
17162
|
-
|
|
17163
|
-
|
|
17164
|
-
|
|
17089
|
+
image: _instanceof(Uint8Array).optional(),
|
|
17090
|
+
referenceImage: string().optional(),
|
|
17091
|
+
deviceId: number().optional(),
|
|
17092
|
+
sessionId: string().optional(),
|
|
17093
|
+
/**
|
|
17094
|
+
* Execution plane. 'full' (default) runs the whole tree — benchmark,
|
|
17095
|
+
* reference-image, and detail-subtree calls. 'frame' is the live
|
|
17096
|
+
* per-frame dispatch: ONLY root-plane steps run; crop children
|
|
17097
|
+
* (inputClasses ≠ null) are skipped and served per-track via
|
|
17098
|
+
* pipelineRunner.runDetailSubtree (two-plane design).
|
|
17099
|
+
*/
|
|
17100
|
+
plane: _enum(["full", "frame"]).optional(),
|
|
17101
|
+
/**
|
|
17102
|
+
* Inference-device selector (Phase 2 multi-device). Format
|
|
17103
|
+
* `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
|
|
17104
|
+
* Omitted ⇒ the runner's default device (current single-engine
|
|
17105
|
+
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
17106
|
+
*/
|
|
17107
|
+
deviceKey: string().optional(),
|
|
17108
|
+
/**
|
|
17109
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
17110
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
17111
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
17112
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
17113
|
+
* resolution from that surface — the SAME quality path faces already
|
|
17114
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
17115
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
17116
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
17117
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
17118
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
17119
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
17120
|
+
* (today's behaviour on the fallback path).
|
|
17121
|
+
*/
|
|
17122
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
17123
|
+
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
17124
|
+
engine: PipelineEngineChoiceSchema.optional(),
|
|
17125
|
+
steps: array(PipelineStepInputSchema).min(1),
|
|
17126
|
+
frames: array(FrameInputSchema).min(1).max(255),
|
|
17127
|
+
deviceId: number().optional(),
|
|
17128
|
+
sessionId: string().optional(),
|
|
17129
|
+
/**
|
|
17130
|
+
* Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
|
|
17131
|
+
* the batch to the Python pool's bench preprocess cache
|
|
17132
|
+
* (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
|
|
17133
|
+
* preprocessed ONCE and every later inference is a pure-inference cache
|
|
17134
|
+
* hit — the sustained-throughput run measures inference, not
|
|
17135
|
+
* decode+preprocess+infer. Omitted/0 for live frames (all different →
|
|
17136
|
+
* full preprocess every call, correct). Fresh per sustained run;
|
|
17137
|
+
* released via `uncacheFrame`.
|
|
17138
|
+
*/
|
|
17139
|
+
frameId: number().int().nonnegative().optional(),
|
|
17140
|
+
/** Inference-device selector (Phase 2 multi-device); see runPipeline. */
|
|
17141
|
+
deviceKey: string().optional()
|
|
17142
|
+
}), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
|
|
17143
|
+
data: _instanceof(Uint8Array),
|
|
17144
|
+
width: number().int().positive(),
|
|
17145
|
+
height: number().int().positive(),
|
|
17146
|
+
format: _enum([
|
|
17147
|
+
"rgb",
|
|
17148
|
+
"bgr",
|
|
17149
|
+
"gray"
|
|
17150
|
+
])
|
|
17151
|
+
}), object({
|
|
17152
|
+
frameId: number(),
|
|
17153
|
+
width: number(),
|
|
17154
|
+
height: number()
|
|
17155
|
+
}), { kind: "mutation" }), method(object({
|
|
17156
|
+
stepId: string(),
|
|
17157
|
+
frameId: number().int()
|
|
17158
|
+
}), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
|
|
17159
|
+
batchMode: string(),
|
|
17160
|
+
windowMs: number(),
|
|
17161
|
+
maxBatchSize: number(),
|
|
17162
|
+
concurrency: number()
|
|
17163
|
+
})), method(_void(), array(object({
|
|
17164
|
+
engineKey: string(),
|
|
17165
|
+
engine: PipelineEngineChoiceSchema,
|
|
17166
|
+
modelsLoaded: array(string()).readonly(),
|
|
17167
|
+
inUseByCameras: array(number()).readonly(),
|
|
17168
|
+
/**
|
|
17169
|
+
* Origin of this resident factory.
|
|
17170
|
+
* - `runtime` — main camera-serving engine (no idle TTL).
|
|
17171
|
+
* - `warm-override` — benchmark/test override held in the warm
|
|
17172
|
+
* cache; auto-disposed after the idle TTL.
|
|
17173
|
+
* - `device-pool` — a concurrent per-device pool (Phase 2
|
|
17174
|
+
* multi-device, keyed by `deviceKey`) resolved
|
|
17175
|
+
* via `resolveDeviceFactory`. Runs alongside the
|
|
17176
|
+
* `runtime` engine on a DIFFERENT accelerator
|
|
17177
|
+
* (NPU / iGPU / Coral) — this is how the
|
|
17178
|
+
* Engines tab shows all pools running at once.
|
|
17179
|
+
*/
|
|
17180
|
+
kind: _enum([
|
|
17181
|
+
"runtime",
|
|
17182
|
+
"warm-override",
|
|
17183
|
+
"device-pool"
|
|
17184
|
+
]),
|
|
17185
|
+
/** Native pid of the underlying Python pool (null when no pool). */
|
|
17186
|
+
poolPid: number().nullable(),
|
|
17187
|
+
/** ms since this factory was last used (null when not warm-tracked). */
|
|
17188
|
+
idleMs: number().nullable(),
|
|
17189
|
+
/** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
|
|
17190
|
+
idleTtlMs: number().nullable()
|
|
17191
|
+
})).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
|
|
17192
|
+
kind: "mutation",
|
|
17193
|
+
auth: "admin"
|
|
17194
|
+
}), method(object({
|
|
17195
|
+
engine: PipelineEngineChoiceSchema,
|
|
17196
|
+
force: boolean().optional()
|
|
17197
|
+
}), object({
|
|
17198
|
+
success: boolean(),
|
|
17199
|
+
reason: string().optional()
|
|
17200
|
+
}), {
|
|
17201
|
+
kind: "mutation",
|
|
17202
|
+
auth: "admin"
|
|
17203
|
+
}), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
|
|
17204
|
+
addonId: string(),
|
|
17205
|
+
modelId: string(),
|
|
17206
|
+
filename: string().optional(),
|
|
17207
|
+
settings: record(string(), unknown()).optional()
|
|
17208
|
+
}), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
|
|
17165
17209
|
/**
|
|
17166
|
-
*
|
|
17167
|
-
*
|
|
17168
|
-
*
|
|
17169
|
-
*
|
|
17170
|
-
*
|
|
17171
|
-
*
|
|
17210
|
+
* Per-stage gating mode applied to the zones a rule references.
|
|
17211
|
+
*
|
|
17212
|
+
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
17213
|
+
* When at least one `include` rule fires for a stage, only entities
|
|
17214
|
+
* inside one of those zones pass that stage.
|
|
17215
|
+
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
17216
|
+
* Entities inside one of those zones are dropped at that stage.
|
|
17217
|
+
*
|
|
17218
|
+
* `monitor`-style observation (count without filtering) is not a rule
|
|
17219
|
+
* mode — zones without any matching rule are observed naturally by
|
|
17220
|
+
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
17221
|
+
* count, not filter" use case needs no rule at all.
|
|
17172
17222
|
*/
|
|
17173
|
-
var
|
|
17223
|
+
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
17174
17224
|
/**
|
|
17175
|
-
*
|
|
17176
|
-
*
|
|
17177
|
-
*
|
|
17178
|
-
*
|
|
17179
|
-
* on them.
|
|
17225
|
+
* Per-consumer rule that references existing zones (geometry) and
|
|
17226
|
+
* defines how a specific pipeline stage should treat them. Each
|
|
17227
|
+
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
17228
|
+
* settings:
|
|
17180
17229
|
*
|
|
17181
|
-
*
|
|
17182
|
-
*
|
|
17183
|
-
*
|
|
17230
|
+
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
17231
|
+
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
17232
|
+
* - future: notification rules, audio gating, etc.
|
|
17184
17233
|
*
|
|
17185
|
-
*
|
|
17186
|
-
*
|
|
17187
|
-
*
|
|
17188
|
-
* the
|
|
17234
|
+
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
17235
|
+
* express "ignore motion in ALL of {garden, street}" with a single
|
|
17236
|
+
* rule. `classFilter` narrows the rule to specific object classes —
|
|
17237
|
+
* "drop person detections in the street, but keep cars" is one
|
|
17238
|
+
* `exclude` rule with `classFilter: ['person']`.
|
|
17239
|
+
*
|
|
17240
|
+
* `enabled` is a soft toggle — the operator can keep the rule
|
|
17241
|
+
* configured but inert without deleting it.
|
|
17189
17242
|
*/
|
|
17190
|
-
var
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
|
|
17194
|
-
|
|
17195
|
-
|
|
17196
|
-
|
|
17197
|
-
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
|
|
17201
|
-
source: DetectionSourceSchema.optional(),
|
|
17243
|
+
var ZoneRuleSchema = object({
|
|
17244
|
+
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
17245
|
+
id: string(),
|
|
17246
|
+
/** Optional human-readable label rendered in the rule editor. */
|
|
17247
|
+
name: string().optional(),
|
|
17248
|
+
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
17249
|
+
* listed zones (OR-set: a detection in any one of them counts).
|
|
17250
|
+
* At least one zone id required — a rule with no targets is a
|
|
17251
|
+
* configuration mistake and the form validator rejects it. */
|
|
17252
|
+
zoneIds: array(string()).min(1).readonly(),
|
|
17253
|
+
mode: ZoneRuleModeEnum,
|
|
17202
17254
|
/**
|
|
17203
|
-
*
|
|
17204
|
-
*
|
|
17205
|
-
*
|
|
17206
|
-
* (group by `trackId`, pick a representative `frameId` as the parent frame).
|
|
17207
|
-
* Optional for backward-compat with pre-existing rows / the slim projection
|
|
17208
|
-
* includes it (it is light). Absent on rows written before this field.
|
|
17255
|
+
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
17256
|
+
* applies to every class. Class strings match the `macroClass`
|
|
17257
|
+
* field on detections (e.g. `person`, `car`, `dog`).
|
|
17209
17258
|
*/
|
|
17210
|
-
|
|
17211
|
-
/** Omitted in slim projection. */
|
|
17212
|
-
trackId: string().optional(),
|
|
17213
|
-
className: string(),
|
|
17214
|
-
...TieredLabelFields,
|
|
17215
|
-
/** Omitted in slim projection. */
|
|
17216
|
-
confidence: number().optional(),
|
|
17217
|
-
/** Heavy JSON — omitted in slim projection. */
|
|
17218
|
-
bbox: BoundingBoxSchema.optional(),
|
|
17219
|
-
/** Heavy JSON — omitted in slim projection. */
|
|
17220
|
-
zones: array(string()).readonly().optional(),
|
|
17221
|
-
/** Omitted in slim projection. */
|
|
17222
|
-
state: TrackStateSchema.optional(),
|
|
17259
|
+
classFilter: array(string()).readonly().optional(),
|
|
17223
17260
|
/**
|
|
17224
|
-
*
|
|
17225
|
-
*
|
|
17226
|
-
*
|
|
17261
|
+
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
17262
|
+
* required to consider an entity "in the zone". Defaults to the
|
|
17263
|
+
* consumer's stage default when omitted. Kept for back-compat with
|
|
17264
|
+
* existing per-rule overrides; new operators pick the value via
|
|
17265
|
+
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
17266
|
+
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
17227
17267
|
*/
|
|
17228
|
-
|
|
17229
|
-
/**
|
|
17230
|
-
*
|
|
17231
|
-
|
|
17232
|
-
|
|
17233
|
-
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
*
|
|
17237
|
-
*
|
|
17238
|
-
*
|
|
17239
|
-
|
|
17240
|
-
|
|
17241
|
-
/**
|
|
17242
|
-
|
|
17243
|
-
|
|
17244
|
-
*
|
|
17245
|
-
|
|
17246
|
-
|
|
17268
|
+
overlapThreshold: number().min(0).max(1).optional(),
|
|
17269
|
+
/**
|
|
17270
|
+
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
17271
|
+
* of the detection's bbox that must lie inside the zone for the
|
|
17272
|
+
* rule to match. Documented default is 85%; the engine substitutes
|
|
17273
|
+
* that when the field is omitted (kept optional so existing rules
|
|
17274
|
+
* stored without it stay valid).
|
|
17275
|
+
*
|
|
17276
|
+
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
17277
|
+
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
17278
|
+
* field exposed in the UI. Internally both feed the same gate.
|
|
17279
|
+
*/
|
|
17280
|
+
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
17281
|
+
/**
|
|
17282
|
+
* When `true` and a detection has a segmentation mask, use the
|
|
17283
|
+
* mask for overlap instead of the bbox. Detection-stage only;
|
|
17284
|
+
* motion rules ignore this field.
|
|
17285
|
+
*/
|
|
17286
|
+
preferMask: boolean().optional(),
|
|
17287
|
+
/**
|
|
17288
|
+
* Soft-toggle: `false` disables the rule without deleting it.
|
|
17289
|
+
* Defaults to `true` so operators creating a rule via the UI
|
|
17290
|
+
* see it active immediately.
|
|
17291
|
+
*/
|
|
17292
|
+
enabled: boolean().default(true)
|
|
17247
17293
|
});
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17251
|
-
|
|
17252
|
-
|
|
17253
|
-
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17258
|
-
|
|
17259
|
-
|
|
17294
|
+
array(ZoneRuleSchema).readonly();
|
|
17295
|
+
/**
|
|
17296
|
+
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
17297
|
+
*
|
|
17298
|
+
* Zones describe **where** in the frame the operator wants to flag
|
|
17299
|
+
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
17300
|
+
* each pipeline stage uses them. Splitting the two means a single
|
|
17301
|
+
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
17302
|
+
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
17303
|
+
* — without three duplicated polygons.
|
|
17304
|
+
*
|
|
17305
|
+
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
17306
|
+
* `zones` device-state slice on every mutation. Consumers
|
|
17307
|
+
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
17308
|
+
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
17309
|
+
* mirror with `onChanged`).
|
|
17310
|
+
*
|
|
17311
|
+
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
17312
|
+
* survive resolution changes and stream profile switches.
|
|
17313
|
+
*
|
|
17314
|
+
* `kind` discriminates between full polygons (closed regions used
|
|
17315
|
+
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
17316
|
+
* line segments used for cross events). Onboard / firmware-reported
|
|
17317
|
+
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
17318
|
+
* task list.
|
|
17319
|
+
*/
|
|
17320
|
+
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
17321
|
+
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
17322
|
+
var PolygonPointSchema = object({
|
|
17323
|
+
x: number(),
|
|
17324
|
+
y: number()
|
|
17260
17325
|
});
|
|
17261
|
-
|
|
17262
|
-
|
|
17263
|
-
|
|
17264
|
-
|
|
17265
|
-
"
|
|
17266
|
-
|
|
17267
|
-
|
|
17268
|
-
|
|
17269
|
-
"
|
|
17270
|
-
"plateCrop",
|
|
17271
|
-
"keyFrame",
|
|
17272
|
-
"keyFrameSmall",
|
|
17273
|
-
"thumbnailSmall"
|
|
17274
|
-
]);
|
|
17275
|
-
var MediaFileSchema = object({
|
|
17276
|
-
key: string(),
|
|
17277
|
-
kind: MediaFileKindEnum,
|
|
17278
|
-
base64: string(),
|
|
17279
|
-
sizeBytes: number(),
|
|
17280
|
-
timestamp: number()
|
|
17326
|
+
/** A camera detection zone — pure geometry/identity. */
|
|
17327
|
+
var ZoneSchema = object({
|
|
17328
|
+
id: string(),
|
|
17329
|
+
name: string(),
|
|
17330
|
+
kind: ZoneKindEnum.default("polygon"),
|
|
17331
|
+
/** Polygon vertices, fraction of frame (0–1). */
|
|
17332
|
+
polygon: array(PolygonPointSchema).readonly(),
|
|
17333
|
+
/** Visual color for UI rendering. */
|
|
17334
|
+
color: string().default("#3b82f6")
|
|
17281
17335
|
});
|
|
17282
17336
|
/**
|
|
17283
|
-
*
|
|
17337
|
+
* Zones capability — per-camera CRUD over polygon detection zones.
|
|
17284
17338
|
*
|
|
17285
|
-
*
|
|
17286
|
-
*
|
|
17287
|
-
*
|
|
17288
|
-
*
|
|
17289
|
-
* blocks the whole view.
|
|
17339
|
+
* Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
|
|
17340
|
+
* to per-device settings and mirrors into the `zones` device-state
|
|
17341
|
+
* slice on every mutation, so downstream consumers can subscribe via
|
|
17342
|
+
* `dev.state.zones.onChanged`.
|
|
17290
17343
|
*
|
|
17291
|
-
*
|
|
17292
|
-
*
|
|
17344
|
+
* The cap surface only handles geometry + identity; filtering
|
|
17345
|
+
* behaviour (per-class, include/exclude, threshold) lives in the
|
|
17346
|
+
* consumer addons' rule arrays — see `ZoneRuleSchema` exported from
|
|
17347
|
+
* `capabilities/schemas/zone-rule.js`.
|
|
17293
17348
|
*/
|
|
17294
|
-
var
|
|
17349
|
+
var zonesCapability = {
|
|
17350
|
+
name: "zones",
|
|
17351
|
+
scope: "device",
|
|
17352
|
+
mode: "singleton",
|
|
17353
|
+
deviceTypes: [DeviceType.Camera],
|
|
17354
|
+
methods: {
|
|
17355
|
+
listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
|
|
17356
|
+
addZone: method(object({
|
|
17357
|
+
deviceId: number(),
|
|
17358
|
+
zone: ZoneSchema
|
|
17359
|
+
}), _void(), {
|
|
17360
|
+
kind: "mutation",
|
|
17361
|
+
auth: "admin"
|
|
17362
|
+
}),
|
|
17363
|
+
removeZone: method(object({
|
|
17364
|
+
deviceId: number(),
|
|
17365
|
+
zoneId: string()
|
|
17366
|
+
}), _void(), {
|
|
17367
|
+
kind: "mutation",
|
|
17368
|
+
auth: "admin"
|
|
17369
|
+
}),
|
|
17370
|
+
updateZone: method(object({
|
|
17371
|
+
deviceId: number(),
|
|
17372
|
+
zone: ZoneSchema
|
|
17373
|
+
}), _void(), {
|
|
17374
|
+
kind: "mutation",
|
|
17375
|
+
auth: "admin"
|
|
17376
|
+
})
|
|
17377
|
+
},
|
|
17378
|
+
/**
|
|
17379
|
+
* Runtime-state slice — the live zone catalogue mirrored by the
|
|
17380
|
+
* orchestrator on every CRUD mutation. Consumers read via
|
|
17381
|
+
* `device.state.zones.value` / `.watch(...)` without round-tripping
|
|
17382
|
+
* the cap, and the codegen DeviceProxy auto-wires the reactive
|
|
17383
|
+
* handle. Slice shape is `{ zones: Zone[] }` so future extensions
|
|
17384
|
+
* (e.g. zone groupings) can sit alongside the polygon list.
|
|
17385
|
+
*/
|
|
17386
|
+
runtimeState: object({ zones: array(ZoneSchema).readonly() }),
|
|
17387
|
+
/**
|
|
17388
|
+
* 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.
|
|
17389
|
+
*
|
|
17390
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
17391
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
17392
|
+
*/
|
|
17393
|
+
durability: "restored"
|
|
17394
|
+
};
|
|
17295
17395
|
/**
|
|
17296
|
-
*
|
|
17396
|
+
* pipeline-analytics — device-scoped wrapper cap. Refines raw
|
|
17397
|
+
* per-frame detections emitted by the pipeline runner into tracked
|
|
17398
|
+
* objects, per-kind event collections (motion / object / audio), and
|
|
17399
|
+
* persisted media. Owns the post-detection domain end-to-end:
|
|
17297
17400
|
*
|
|
17298
|
-
*
|
|
17299
|
-
*
|
|
17300
|
-
*
|
|
17301
|
-
*
|
|
17401
|
+
* runner emits PipelineInferenceResult
|
|
17402
|
+
* ↓ (event bus)
|
|
17403
|
+
* pipeline-analytics subscriber
|
|
17404
|
+
* ↓ SORT tracker + zone engine + state analyzer + event emitter
|
|
17405
|
+
* → three DB collections (one per kind), one FS media tree, one
|
|
17406
|
+
* unified event emitter (FrameTracked + TrackStarted/Ended +
|
|
17407
|
+
* DetectionEvent on bus)
|
|
17302
17408
|
*
|
|
17303
|
-
*
|
|
17304
|
-
*
|
|
17305
|
-
*
|
|
17306
|
-
*
|
|
17409
|
+
* Pure subscriber model. No `processFrame` cap method — the runner
|
|
17410
|
+
* already publishes the raw frame on the bus. The cap surface is
|
|
17411
|
+
* only QUERIES + per-device settings, bound on/off via
|
|
17412
|
+
* `device-manager.setWrapperActive`. `defaultActive: true` because
|
|
17413
|
+
* every camera with a detection pipeline wants its raw detections
|
|
17414
|
+
* refined; operators opt out per-device via BindingsTab when needed.
|
|
17415
|
+
*
|
|
17416
|
+
* Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
|
|
17417
|
+
* (per-device surface) and `track-trail` caps — see P11 cleanup.
|
|
17307
17418
|
*/
|
|
17308
|
-
var
|
|
17419
|
+
var TrackStateSchema = _enum([
|
|
17420
|
+
"new",
|
|
17421
|
+
"entered",
|
|
17422
|
+
"left",
|
|
17423
|
+
"moving",
|
|
17424
|
+
"idle"
|
|
17425
|
+
]);
|
|
17426
|
+
var EventKindSchema = _enum([
|
|
17427
|
+
"motion",
|
|
17428
|
+
"object",
|
|
17429
|
+
"audio"
|
|
17430
|
+
]);
|
|
17431
|
+
/**
|
|
17432
|
+
* Spatial filter for `listTracks` — the rect + polygon variants of the shared
|
|
17433
|
+
* MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
|
|
17434
|
+
* of the camera frame (top-left origin), matching the drawing-plane editor.
|
|
17435
|
+
*/
|
|
17436
|
+
var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
|
|
17437
|
+
/** Closed icon vocabulary so clients render a known glyph per kind. */
|
|
17438
|
+
var EventKindIconSchema = _enum([
|
|
17439
|
+
"motion",
|
|
17440
|
+
"audio",
|
|
17309
17441
|
"person",
|
|
17310
17442
|
"vehicle",
|
|
17311
17443
|
"animal",
|
|
17444
|
+
"door",
|
|
17445
|
+
"pir",
|
|
17446
|
+
"smoke",
|
|
17447
|
+
"water",
|
|
17448
|
+
"button",
|
|
17312
17449
|
"package",
|
|
17313
|
-
"
|
|
17314
|
-
"plate"
|
|
17450
|
+
"generic"
|
|
17315
17451
|
]);
|
|
17316
|
-
|
|
17317
|
-
|
|
17318
|
-
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
|
|
17324
|
-
|
|
17325
|
-
|
|
17326
|
-
|
|
17327
|
-
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17333
|
-
|
|
17334
|
-
*/
|
|
17335
|
-
|
|
17336
|
-
id
|
|
17337
|
-
|
|
17338
|
-
|
|
17339
|
-
|
|
17340
|
-
|
|
17341
|
-
|
|
17342
|
-
|
|
17343
|
-
|
|
17344
|
-
|
|
17345
|
-
kind
|
|
17346
|
-
source
|
|
17347
|
-
|
|
17348
|
-
|
|
17349
|
-
|
|
17350
|
-
|
|
17351
|
-
createdAt: number()
|
|
17352
|
-
});
|
|
17353
|
-
/** The write form — the server owns `id`, `createdAt` and the frame binding. */
|
|
17354
|
-
var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
|
|
17355
|
-
id: true,
|
|
17356
|
-
trackId: true,
|
|
17357
|
-
deviceId: true,
|
|
17358
|
-
mediaKey: true,
|
|
17359
|
-
createdAt: true,
|
|
17360
|
-
exportedInBatch: true
|
|
17452
|
+
var EventKindCategorySchema = _enum([
|
|
17453
|
+
"motion",
|
|
17454
|
+
"audio",
|
|
17455
|
+
"detection",
|
|
17456
|
+
"sensor",
|
|
17457
|
+
"control",
|
|
17458
|
+
"custom",
|
|
17459
|
+
"package"
|
|
17460
|
+
]);
|
|
17461
|
+
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
17462
|
+
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
17463
|
+
var EventKindDescriptorSchema = object({
|
|
17464
|
+
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
17465
|
+
kind: string(),
|
|
17466
|
+
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
17467
|
+
labelKey: string(),
|
|
17468
|
+
/** English fallback label (kept for clients that don't translate). */
|
|
17469
|
+
label: string(),
|
|
17470
|
+
/** Hex color for timeline/legend rendering. */
|
|
17471
|
+
color: string(),
|
|
17472
|
+
/** Dictionary id → lucide component on the UI side. */
|
|
17473
|
+
iconId: string(),
|
|
17474
|
+
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
17475
|
+
icon: EventKindIconSchema,
|
|
17476
|
+
category: EventKindCategorySchema,
|
|
17477
|
+
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
17478
|
+
parentKind: string().nullable(),
|
|
17479
|
+
/** Derived from `parentKind`, explicit for the client tree. */
|
|
17480
|
+
level: EventKindLevelSchema,
|
|
17481
|
+
/** Which cap + device contributes this kind. For built-ins the camera
|
|
17482
|
+
* itself; for sensor kinds the LINKED source device. */
|
|
17483
|
+
source: object({
|
|
17484
|
+
capName: string(),
|
|
17485
|
+
deviceId: number()
|
|
17486
|
+
})
|
|
17361
17487
|
});
|
|
17362
|
-
/**
|
|
17363
|
-
var
|
|
17364
|
-
trackId: string(),
|
|
17488
|
+
/** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
|
|
17489
|
+
var EventKindsForDeviceSchema = object({
|
|
17365
17490
|
deviceId: number(),
|
|
17366
|
-
|
|
17367
|
-
label: string().optional(),
|
|
17368
|
-
firstSeen: number(),
|
|
17369
|
-
lastSeen: number(),
|
|
17370
|
-
/** How many frames the dataset already holds from this track. */
|
|
17371
|
-
frameCount: number().int(),
|
|
17372
|
-
/** How many subjects have been annotated on those frames. `0` with
|
|
17373
|
-
* `frameCount: 0` is exactly "staging, still to work". */
|
|
17374
|
-
annotationCount: number().int()
|
|
17375
|
-
});
|
|
17376
|
-
/** A frame the picker may offer — an index row, no blob was read to produce it. */
|
|
17377
|
-
var RetrainFrameCandidateSchema = object({
|
|
17378
|
-
mediaKey: string(),
|
|
17379
|
-
kind: MediaFileKindEnum,
|
|
17380
|
-
timestamp: number(),
|
|
17381
|
-
sizeBytes: number().int(),
|
|
17382
|
-
/** A copy of this original already exists — selecting it is free and cannot
|
|
17383
|
-
* fail, whatever became of the original. */
|
|
17384
|
-
copied: boolean()
|
|
17491
|
+
kinds: array(EventKindDescriptorSchema).readonly()
|
|
17385
17492
|
});
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17493
|
+
var SensorEventSchema = object({
|
|
17494
|
+
id: string(),
|
|
17495
|
+
/** The CAMERA the event is attributed to (a sensor linked to N cameras
|
|
17496
|
+
* yields N rows, one per camera). */
|
|
17389
17497
|
deviceId: number(),
|
|
17390
|
-
|
|
17391
|
-
|
|
17392
|
-
|
|
17393
|
-
|
|
17394
|
-
|
|
17395
|
-
|
|
17396
|
-
|
|
17397
|
-
copiedAt: number()
|
|
17498
|
+
/** The linked sensor device whose state changed. */
|
|
17499
|
+
sourceDeviceId: number(),
|
|
17500
|
+
/** Event kind id — matches an `EventKindDescriptor.kind`. */
|
|
17501
|
+
kind: string(),
|
|
17502
|
+
/** Snapshot of the sensor cap's runtime-state slice at the change. */
|
|
17503
|
+
value: record(string(), unknown()).nullable(),
|
|
17504
|
+
timestamp: number()
|
|
17398
17505
|
});
|
|
17399
|
-
|
|
17400
|
-
|
|
17401
|
-
|
|
17402
|
-
|
|
17403
|
-
|
|
17404
|
-
]);
|
|
17405
|
-
var RetrainFrameSelectionSchema = object({
|
|
17406
|
-
copied: array(RetrainFrameSchema).readonly(),
|
|
17407
|
-
refused: array(object({
|
|
17408
|
-
sourceMediaKey: string(),
|
|
17409
|
-
reason: RetrainCopyRefusalSchema
|
|
17410
|
-
})).readonly()
|
|
17506
|
+
var TrackPositionSchema = object({
|
|
17507
|
+
x: number(),
|
|
17508
|
+
y: number(),
|
|
17509
|
+
timestamp: number(),
|
|
17510
|
+
bbox: BoundingBoxSchema
|
|
17411
17511
|
});
|
|
17412
|
-
var
|
|
17413
|
-
|
|
17414
|
-
|
|
17415
|
-
/**
|
|
17416
|
-
|
|
17512
|
+
var TrackSnapshotSchema = object({
|
|
17513
|
+
timestamp: number(),
|
|
17514
|
+
position: TrackPositionSchema,
|
|
17515
|
+
/** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
|
|
17516
|
+
mediaKey: string()
|
|
17417
17517
|
});
|
|
17418
|
-
/** What the operator asked the assist to look for. */
|
|
17419
|
-
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
17420
|
-
kind: literal("package"),
|
|
17421
|
-
zone: RetrainBboxSchema.optional()
|
|
17422
|
-
}), object({
|
|
17423
|
-
kind: literal("objects"),
|
|
17424
|
-
modelId: string(),
|
|
17425
|
-
minScore: number().optional()
|
|
17426
|
-
})]);
|
|
17427
17518
|
/**
|
|
17428
|
-
*
|
|
17429
|
-
*
|
|
17430
|
-
*
|
|
17519
|
+
* Normalized 0..1 trajectory envelope (min/max over every position bbox,
|
|
17520
|
+
* divided by the track's detection-frame dims), computed at persist time.
|
|
17521
|
+
* Absent when the frame dims were unknown when the track was persisted
|
|
17522
|
+
* (legacy rows / dims-less sources) and on active (in-RAM) tracks.
|
|
17431
17523
|
*/
|
|
17432
|
-
var
|
|
17433
|
-
|
|
17434
|
-
|
|
17435
|
-
|
|
17436
|
-
|
|
17437
|
-
/** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
|
|
17438
|
-
proposals: array(RetrainAnnotationDraftSchema).readonly(),
|
|
17439
|
-
/** Returned by the runner but removed by the threshold. */
|
|
17440
|
-
belowThreshold: number().int()
|
|
17441
|
-
}), object({
|
|
17442
|
-
kind: literal("refused"),
|
|
17443
|
-
/** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
|
|
17444
|
-
reason: string(),
|
|
17445
|
-
detail: string().optional()
|
|
17446
|
-
})]);
|
|
17447
|
-
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
17448
|
-
var RetrainTransitionResultSchema = object({
|
|
17449
|
-
trackId: string(),
|
|
17450
|
-
/** Where the track ended up, whatever happened. */
|
|
17451
|
-
retrainStatus: RetrainStatusSchema,
|
|
17452
|
-
/** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
|
|
17453
|
-
changed: boolean(),
|
|
17454
|
-
reason: _enum([
|
|
17455
|
-
"unknown-track",
|
|
17456
|
-
"no-frames-copied",
|
|
17457
|
-
"not-staging",
|
|
17458
|
-
"not-trained",
|
|
17459
|
-
"unchanged"
|
|
17460
|
-
]).optional()
|
|
17461
|
-
});
|
|
17462
|
-
var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
|
|
17463
|
-
var MAX_EVENT_QUERY_LIMIT = 5e3;
|
|
17464
|
-
var DeviceEventQueryInput = object({
|
|
17465
|
-
deviceId: number(),
|
|
17466
|
-
since: number().optional(),
|
|
17467
|
-
until: number().optional(),
|
|
17468
|
-
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
|
|
17469
|
-
/** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
|
|
17470
|
-
* optional `mediaUrl` (populated by B5). `full` (default) keeps today's
|
|
17471
|
-
* exact behaviour. Callers may omit this field — the store defaults to
|
|
17472
|
-
* `full` when not provided. */
|
|
17473
|
-
projection: _enum(["full", "slim"]).optional()
|
|
17474
|
-
});
|
|
17475
|
-
var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
|
|
17476
|
-
var RecentTracksQueryInput = object({
|
|
17477
|
-
/** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
|
|
17478
|
-
deviceIds: array(number()),
|
|
17479
|
-
/** Window lower bound on `lastSeen` (inclusive). */
|
|
17480
|
-
since: number().optional(),
|
|
17481
|
-
/** Window upper bound on `lastSeen` (inclusive). */
|
|
17482
|
-
until: number().optional(),
|
|
17483
|
-
/** Page size. Default 200, max 1000. */
|
|
17484
|
-
limit: number().int().min(1).max(1e3).default(200),
|
|
17485
|
-
/** Opaque continuation cursor from a previous page's `nextCursor`.
|
|
17486
|
-
* Encodes the (lastSeen, trackId) sort position — treat as opaque. */
|
|
17487
|
-
cursor: string().optional(),
|
|
17488
|
-
/** See {@link TrackProjectionSchema}. Default `full`. */
|
|
17489
|
-
projection: TrackProjectionSchema.optional(),
|
|
17490
|
-
/** Include stationary-promoted rows (parked objects). Default false: the
|
|
17491
|
-
* feed lists passages; parking records live on the stationary registry. */
|
|
17492
|
-
includeStationary: boolean().optional()
|
|
17493
|
-
});
|
|
17494
|
-
var RecentTracksPageSchema = object({
|
|
17495
|
-
/** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
|
|
17496
|
-
tracks: array(TrackSchema).readonly(),
|
|
17497
|
-
/** Cursor for the next page, or null when this page is the last. */
|
|
17498
|
-
nextCursor: string().nullable()
|
|
17524
|
+
var TrackEnvelopeSchema = object({
|
|
17525
|
+
minX: number(),
|
|
17526
|
+
minY: number(),
|
|
17527
|
+
maxX: number(),
|
|
17528
|
+
maxY: number()
|
|
17499
17529
|
});
|
|
17500
|
-
|
|
17501
|
-
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
|
|
17510
|
-
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
17522
|
-
|
|
17523
|
-
|
|
17524
|
-
|
|
17525
|
-
|
|
17526
|
-
|
|
17527
|
-
deviceIds: array(number()),
|
|
17528
|
-
/** Window lower bound on `closedAt` (inclusive). */
|
|
17529
|
-
since: number().optional(),
|
|
17530
|
-
/** Window upper bound on `openedAt` (inclusive). */
|
|
17531
|
-
until: number().optional(),
|
|
17532
|
-
limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
|
|
17533
|
-
/** Opaque continuation cursor from a previous page's `nextCursor`. */
|
|
17534
|
-
cursor: string().optional()
|
|
17535
|
-
});
|
|
17536
|
-
var ListGroupsPageSchema = object({
|
|
17537
|
-
groups: array(AnalyticsGroupRecordSchema).readonly(),
|
|
17538
|
-
nextCursor: string().nullable()
|
|
17539
|
-
});
|
|
17540
|
-
var KeyEventQueryInput = object({
|
|
17541
|
-
deviceId: number(),
|
|
17542
|
-
/** Window lower bound (track firstSeen ≥ since). */
|
|
17543
|
-
since: number(),
|
|
17544
|
-
/** Window upper bound (track firstSeen ≤ until). */
|
|
17545
|
-
until: number(),
|
|
17546
|
-
limit: number().int().min(1).max(200).default(50),
|
|
17547
|
-
/** Drop tracks scoring below this importance. */
|
|
17548
|
-
minImportance: number().min(0).max(1).optional(),
|
|
17549
|
-
/** Restrict to a single class (e.g. 'person'). */
|
|
17550
|
-
classFilter: string().optional()
|
|
17551
|
-
});
|
|
17552
|
-
var KeyEventSchema = object({
|
|
17553
|
-
/** The representative event id (the track's best ObjectEvent, else its trackId). */
|
|
17554
|
-
id: string(),
|
|
17555
|
-
trackId: string(),
|
|
17556
|
-
/** Track start time (firstSeen). */
|
|
17557
|
-
timestamp: number(),
|
|
17558
|
-
className: string(),
|
|
17559
|
-
...TieredLabelFields,
|
|
17560
|
-
importance: number(),
|
|
17561
|
-
/** Highest-confidence ObjectEvent id for the track (empty when none). */
|
|
17562
|
-
bestEventId: string(),
|
|
17563
|
-
/** Track lifetime in ms (lastSeen - firstSeen). */
|
|
17564
|
-
windowMs: number().optional(),
|
|
17565
|
-
...TrackFlagFields,
|
|
17566
|
-
...TrackRetrainFields
|
|
17567
|
-
});
|
|
17568
|
-
object({
|
|
17569
|
-
trackId: string(),
|
|
17570
|
-
className: string(),
|
|
17571
|
-
confidence: number(),
|
|
17572
|
-
bbox: BoundingBoxSchema,
|
|
17573
|
-
zones: array(string()).readonly(),
|
|
17574
|
-
state: TrackStateSchema
|
|
17575
|
-
});
|
|
17576
|
-
var OverlayDetectionSchema = looseObject({
|
|
17577
|
-
id: string(),
|
|
17578
|
-
kind: _enum(["first-level", "detail"]),
|
|
17579
|
-
macroClass: string(),
|
|
17580
|
-
score: number(),
|
|
17581
|
-
bbox: object({
|
|
17582
|
-
x: number(),
|
|
17583
|
-
y: number(),
|
|
17584
|
-
width: number(),
|
|
17585
|
-
height: number()
|
|
17586
|
-
}),
|
|
17587
|
-
labels: array(looseObject({
|
|
17588
|
-
label: string(),
|
|
17589
|
-
score: number()
|
|
17590
|
-
})).readonly(),
|
|
17591
|
-
parentId: string().optional()
|
|
17592
|
-
});
|
|
17593
|
-
var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
|
|
17594
|
-
var SearchObjectEventsInput = object({
|
|
17595
|
-
text: string(),
|
|
17596
|
-
deviceId: number().optional(),
|
|
17597
|
-
since: number().optional(),
|
|
17598
|
-
until: number().optional(),
|
|
17599
|
-
classFilter: string().optional(),
|
|
17600
|
-
limit: number().default(50),
|
|
17601
|
-
minScore: number().min(0).max(1).default(.2)
|
|
17602
|
-
});
|
|
17603
|
-
var TrackCascadeCountsSchema = object({
|
|
17604
|
-
/** Persisted track roots deleted (authoritative). */
|
|
17605
|
-
tracks: number().int(),
|
|
17606
|
-
/** Object events removed with their tracks (best-effort; see note above). */
|
|
17607
|
-
events: number().int(),
|
|
17608
|
-
/** Track/face/plate-owned media removed (best-effort). Never identity media. */
|
|
17609
|
-
media: number().int(),
|
|
17610
|
-
/** Unassigned (non-enrolled) face reads removed (best-effort). */
|
|
17611
|
-
faces: number().int(),
|
|
17612
|
-
/** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
|
|
17613
|
-
plates: number().int(),
|
|
17614
|
-
/** Per-track CLIP search vectors removed (best-effort). */
|
|
17615
|
-
embeddings: number().int(),
|
|
17616
|
-
/** Group membership + group rows removed with their last member (best-effort). */
|
|
17617
|
-
groups: number().int()
|
|
17618
|
-
});
|
|
17619
|
-
/** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
|
|
17620
|
-
var DiskReconcileCountsSchema = object({
|
|
17621
|
-
mediaDropped: number().int(),
|
|
17622
|
-
tracks: number().int(),
|
|
17623
|
-
events: number().int()
|
|
17624
|
-
});
|
|
17625
|
-
/** Event-store footprint for one camera. */
|
|
17626
|
-
var EventStoreDeviceFootprintSchema = object({
|
|
17627
|
-
deviceId: number(),
|
|
17628
|
-
/** Persisted event rows (motion + object + audio) for the camera. */
|
|
17629
|
-
rows: number().int(),
|
|
17630
|
-
/** Event-owned media bytes on disk for the camera. */
|
|
17631
|
-
bytes: number().int()
|
|
17632
|
-
});
|
|
17633
|
-
/** Aggregate event-store footprint: global totals + per-camera breakdown. */
|
|
17634
|
-
var EventStoreFootprintSchema = object({
|
|
17635
|
-
totalRows: number().int(),
|
|
17636
|
-
totalBytes: number().int(),
|
|
17637
|
-
devices: array(EventStoreDeviceFootprintSchema).readonly()
|
|
17638
|
-
});
|
|
17639
|
-
/** Per-kind counts returned by the event-prune / device-delete mutations. */
|
|
17640
|
-
var EventPruneCountsSchema = object({
|
|
17641
|
-
motion: number().int(),
|
|
17642
|
-
object: number().int(),
|
|
17643
|
-
audio: number().int()
|
|
17530
|
+
/**
|
|
17531
|
+
* Row projection for track list queries. `full` (default) returns the
|
|
17532
|
+
* complete Track including the frame-rate `positions[]` history and the
|
|
17533
|
+
* `snapshots[]` references — megabytes across a page of tracks. `slim`
|
|
17534
|
+
* keeps every scalar the list surfaces actually render (ids, class(es),
|
|
17535
|
+
* label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
|
|
17536
|
+
* zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
|
|
17537
|
+
* `snapshots` as EMPTY arrays — detail views re-fetch the full row via
|
|
17538
|
+
* `getTrack`. Mirrors the event-store `projection` convention
|
|
17539
|
+
* (`getObjectEvents` et al.).
|
|
17540
|
+
*/
|
|
17541
|
+
var TrackProjectionSchema = _enum(["full", "slim"]);
|
|
17542
|
+
/**
|
|
17543
|
+
* One audio-classification label heard on the track's camera while the
|
|
17544
|
+
* track was alive, aggregated per label. An "episode" is one persisted
|
|
17545
|
+
* audio event (the confident-classification path: score ≥ the device's
|
|
17546
|
+
* `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
|
|
17547
|
+
* one 32 ms inference chunk, so counts stay human-scaled.
|
|
17548
|
+
*/
|
|
17549
|
+
var TrackAudioLabelSchema = object({
|
|
17550
|
+
label: string(),
|
|
17551
|
+
/** Highest classification score observed across the label's episodes. */
|
|
17552
|
+
peakScore: number(),
|
|
17553
|
+
/** Number of coalesced audio-event episodes carrying this label. */
|
|
17554
|
+
count: number(),
|
|
17555
|
+
firstAt: number(),
|
|
17556
|
+
lastAt: number()
|
|
17644
17557
|
});
|
|
17645
17558
|
/**
|
|
17646
|
-
*
|
|
17559
|
+
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
17560
|
+
* detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
|
|
17561
|
+
* no positions, a single snapshot, and no bbox trajectory at all:
|
|
17647
17562
|
*
|
|
17648
|
-
*
|
|
17649
|
-
*
|
|
17650
|
-
*
|
|
17651
|
-
*
|
|
17652
|
-
*
|
|
17563
|
+
* - `sensor` — a linked sensor/control device state change.
|
|
17564
|
+
* - `audio` — an audio event on the camera itself that was anomalous for
|
|
17565
|
+
* THAT camera, loud, and heard while nothing visual was happening (D62).
|
|
17566
|
+
*
|
|
17567
|
+
* The spatial subsystems (tracker association, occupancy count, re-id /
|
|
17568
|
+
* embedding, resurrection) MUST skip every synthetic source. Test for that
|
|
17569
|
+
* with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
|
|
17570
|
+
* check silently readmits every source added after it was written.
|
|
17653
17571
|
*/
|
|
17654
|
-
var
|
|
17655
|
-
|
|
17656
|
-
|
|
17657
|
-
|
|
17658
|
-
|
|
17659
|
-
/** Stop after this many tracks; the result reports whether more remain. */
|
|
17660
|
-
maxTracks: number().int().positive().optional(),
|
|
17661
|
-
/**
|
|
17662
|
-
* Run every embedding on THIS node instead of round-robining the fleet.
|
|
17663
|
-
*
|
|
17664
|
-
* Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
|
|
17665
|
-
* field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
|
|
17666
|
-
* calling it that would pin the rebuild REQUEST itself to that node — the
|
|
17667
|
-
* rebuild orchestration lives on the hub, and only the per-track step runs
|
|
17668
|
-
* remotely. This field is data; the per-track pin is applied inside.
|
|
17669
|
-
*
|
|
17670
|
-
* Absent ⇒ round-robin over every online node whose runner can serve the
|
|
17671
|
-
* pinned model.
|
|
17672
|
-
*/
|
|
17673
|
-
executeOnNodeId: string().optional(),
|
|
17674
|
-
/**
|
|
17675
|
-
* Milliseconds to wait between tracks; omit for the built-in default, `0` to
|
|
17676
|
-
* run flat out.
|
|
17677
|
-
*
|
|
17678
|
-
* A rebuild is bulk maintenance on hub-main's single thread. Measured
|
|
17679
|
-
* 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
|
|
17680
|
-
* pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
|
|
17681
|
-
* force is logged at start and finish so a deliberately slow pass reads
|
|
17682
|
-
* differently from a stalled one.
|
|
17683
|
-
*/
|
|
17684
|
-
pacingMs: number().int().nonnegative().optional()
|
|
17685
|
-
});
|
|
17572
|
+
var TrackSourceSchema = _enum([
|
|
17573
|
+
"pipeline",
|
|
17574
|
+
"sensor",
|
|
17575
|
+
"audio"
|
|
17576
|
+
]);
|
|
17686
17577
|
/**
|
|
17687
|
-
*
|
|
17578
|
+
* Where a track sits in the RETRAIN lifecycle (D81).
|
|
17688
17579
|
*
|
|
17689
|
-
*
|
|
17690
|
-
*
|
|
17691
|
-
*
|
|
17692
|
-
*
|
|
17580
|
+
* - `none` — never marked, or un-marked. Evictable.
|
|
17581
|
+
* - `staging` — the operator wants this track as training material and has not
|
|
17582
|
+
* finished with it. **This is the only state retention holds**: the track and
|
|
17583
|
+
* everything it owns (object events, crops, keyframes, CLIP vector) survive
|
|
17584
|
+
* the device's age window.
|
|
17585
|
+
* - `trained` — the retrain page has taken what it needed. The frames it chose
|
|
17586
|
+
* were COPIED into the retrain dataset at selection time, so the dataset no
|
|
17587
|
+
* longer depends on the track's media and the track becomes EVICTABLE again.
|
|
17588
|
+
* Terminal for the plain `markForTrain` toggle: returning it to `staging` is
|
|
17589
|
+
* a deliberate action of the retrain page, not a side effect of a checkbox.
|
|
17590
|
+
*
|
|
17591
|
+
* There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
|
|
17592
|
+
* the store's filter language has only positive equality and `whereIn` — no
|
|
17593
|
+
* negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
|
|
17594
|
+
* would make the entire pre-column history immortal in one deploy.
|
|
17693
17595
|
*/
|
|
17694
|
-
var
|
|
17596
|
+
var RetrainStatusSchema = _enum([
|
|
17597
|
+
"none",
|
|
17598
|
+
"staging",
|
|
17599
|
+
"trained"
|
|
17600
|
+
]);
|
|
17695
17601
|
/**
|
|
17696
|
-
*
|
|
17602
|
+
* Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
|
|
17603
|
+
* by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
|
|
17604
|
+
* so the two surfaces cannot drift.
|
|
17697
17605
|
*
|
|
17698
|
-
*
|
|
17699
|
-
*
|
|
17700
|
-
*
|
|
17701
|
-
*
|
|
17702
|
-
*
|
|
17606
|
+
* **Absent ≠ false.** A track that has never been touched omits the field; an
|
|
17607
|
+
* explicitly un-flagged track carries `false`. Legacy rows written before the
|
|
17608
|
+
* columns existed read as absent, and a consumer that needs a boolean should say
|
|
17609
|
+
* `flag === true`, not `flag !== false`.
|
|
17610
|
+
*
|
|
17611
|
+
* `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
|
|
17612
|
+
* it is exactly `retrainStatus === 'staging'`, in both directions. Writing
|
|
17613
|
+
* `true` moves `none → staging`, writing `false` moves `staging → none`, and a
|
|
17614
|
+
* `trained` track reports `false` while refusing both writes. The boolean is
|
|
17615
|
+
* kept because three surfaces drive a toggle off it; anything that needs to tell
|
|
17616
|
+
* "never marked" from "already trained" must read `retrainStatus`.
|
|
17617
|
+
*
|
|
17618
|
+
* `debug` does NOT pin; it is attention, not durability.
|
|
17619
|
+
*
|
|
17620
|
+
* `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
|
|
17621
|
+
* A favourited track is skipped by retention the same way `staging` is, but
|
|
17622
|
+
* it does not enter `none|staging|trained` and has no staging budget.
|
|
17703
17623
|
*/
|
|
17704
|
-
var
|
|
17705
|
-
|
|
17706
|
-
|
|
17707
|
-
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
|
|
17717
|
-
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17624
|
+
var TrackFlagFields = {
|
|
17625
|
+
/** Operator marked this track as training material — i.e. `retrainStatus` is
|
|
17626
|
+
* `'staging'`. */
|
|
17627
|
+
markForTrain: boolean().optional(),
|
|
17628
|
+
/** Operator marked this track for diagnostic attention. */
|
|
17629
|
+
debug: boolean().optional(),
|
|
17630
|
+
/** Operator favourited this track. Pins it against pruning. */
|
|
17631
|
+
favourited: boolean().optional()
|
|
17632
|
+
};
|
|
17633
|
+
/**
|
|
17634
|
+
* The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
|
|
17635
|
+
* Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
|
|
17636
|
+
* write patch, and the status is not something the toggle sets — it is what the
|
|
17637
|
+
* toggle's boolean is derived from. Absent on an in-RAM track never touched;
|
|
17638
|
+
* always present on a persisted row (the column default materialises `'none'`).
|
|
17639
|
+
*/
|
|
17640
|
+
var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
|
|
17641
|
+
/**
|
|
17642
|
+
* The write half: a PARTIAL patch. An omitted key is left untouched, so setting
|
|
17643
|
+
* one flag can never clear the other — the toggles are independent and are
|
|
17644
|
+
* driven from three surfaces that do not know about each other.
|
|
17645
|
+
*/
|
|
17646
|
+
var TrackFlagsPatchSchema = object(TrackFlagFields);
|
|
17647
|
+
/**
|
|
17648
|
+
* The resolved flag state after a write. Both fields are REQUIRED here (absent
|
|
17649
|
+
* collapses to `false`) so a caller can drive a toggle's checked state off the
|
|
17650
|
+
* mutation result without a re-fetch.
|
|
17651
|
+
*/
|
|
17652
|
+
var TrackFlagsSchema = object({
|
|
17653
|
+
trackId: string(),
|
|
17654
|
+
markForTrain: boolean(),
|
|
17655
|
+
debug: boolean(),
|
|
17656
|
+
favourited: boolean(),
|
|
17657
|
+
/** The lifecycle state the boolean was derived from. Required here (unlike on
|
|
17658
|
+
* a track row) because this shape is only ever produced by the write body,
|
|
17659
|
+
* which always knows it — and a surface that has just written needs to render
|
|
17660
|
+
* `trained` without a re-fetch. */
|
|
17661
|
+
retrainStatus: RetrainStatusSchema
|
|
17662
|
+
});
|
|
17663
|
+
union([literal(1), literal(2)]);
|
|
17664
|
+
/**
|
|
17665
|
+
* WHO decided a label, and when. Carried per tier so a value can be traced to
|
|
17666
|
+
* the step and model that produced it — which is what makes the write rule
|
|
17667
|
+
* arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
|
|
17668
|
+
* and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
|
|
17669
|
+
*
|
|
17670
|
+
* `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
|
|
17671
|
+
* `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
|
|
17672
|
+
* `migration:4g` for a value the 4g migration moved from the single-slot era —
|
|
17673
|
+
* that value has no provenance, and the write rule lets ANY properly-attributed
|
|
17674
|
+
* write of the same tier replace it regardless of score.
|
|
17675
|
+
*/
|
|
17676
|
+
var LabelAttributionSchema = object({
|
|
17677
|
+
stepId: string(),
|
|
17678
|
+
modelId: string().optional(),
|
|
17679
|
+
decidedAt: number(),
|
|
17724
17680
|
/**
|
|
17725
|
-
* The
|
|
17681
|
+
* The GALLERY id behind a recognised tier-2 label — a face-gallery
|
|
17682
|
+
* `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
|
|
17726
17683
|
*
|
|
17727
|
-
*
|
|
17728
|
-
*
|
|
17729
|
-
*
|
|
17730
|
-
*
|
|
17731
|
-
*
|
|
17732
|
-
*
|
|
17684
|
+
* The text alone is a DISPLAY NAME, and a display name is renameable: a
|
|
17685
|
+
* notification rule authored on "Gianluca" stopped matching the moment the
|
|
17686
|
+
* operator fixed the spelling in the gallery, and nothing said so. The id is
|
|
17687
|
+
* the thing that does not move, so it is what a rule matches on
|
|
17688
|
+
* (`NcConditions.identities`) and the text is what a human is shown.
|
|
17689
|
+
*
|
|
17690
|
+
* Absent when the label names no gallery row — a plate the OCR read but no
|
|
17691
|
+
* vehicle claims, a sub-class, a species, any tier-1 value.
|
|
17733
17692
|
*/
|
|
17734
|
-
|
|
17735
|
-
failed: number(),
|
|
17736
|
-
/** Set once a pass ends: true only when EVERYTHING was covered. */
|
|
17737
|
-
complete: boolean().nullable(),
|
|
17738
|
-
startedAtMs: number().nullable(),
|
|
17739
|
-
finishedAtMs: number().nullable(),
|
|
17740
|
-
/** Present when the pass ended by throwing. */
|
|
17741
|
-
error: string().nullable()
|
|
17693
|
+
identityId: string().optional()
|
|
17742
17694
|
});
|
|
17743
|
-
|
|
17744
|
-
|
|
17745
|
-
|
|
17746
|
-
|
|
17747
|
-
|
|
17748
|
-
|
|
17749
|
-
|
|
17750
|
-
|
|
17751
|
-
|
|
17752
|
-
|
|
17753
|
-
|
|
17754
|
-
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
|
|
17765
|
-
|
|
17766
|
-
|
|
17767
|
-
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
|
|
17771
|
-
|
|
17772
|
-
|
|
17773
|
-
|
|
17774
|
-
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17778
|
-
|
|
17779
|
-
|
|
17780
|
-
|
|
17781
|
-
bucketStart: number(),
|
|
17782
|
-
motion: number().int(),
|
|
17783
|
-
object: number().int(),
|
|
17784
|
-
audio: number().int()
|
|
17785
|
-
})).readonly()), method(object({
|
|
17786
|
-
deviceId: number(),
|
|
17787
|
-
cutoffMs: number()
|
|
17788
|
-
}), object({
|
|
17789
|
-
motion: number().int(),
|
|
17790
|
-
object: number().int(),
|
|
17791
|
-
audio: number().int()
|
|
17792
|
-
}), {
|
|
17793
|
-
kind: "mutation",
|
|
17794
|
-
auth: "admin"
|
|
17795
|
-
}), method(object({
|
|
17796
|
-
deviceId: number(),
|
|
17797
|
-
cutoffMs: number()
|
|
17798
|
-
}), TrackCascadeCountsSchema, {
|
|
17799
|
-
kind: "mutation",
|
|
17800
|
-
auth: "admin"
|
|
17801
|
-
}), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
|
|
17802
|
-
kind: "mutation",
|
|
17803
|
-
auth: "admin"
|
|
17804
|
-
}), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
|
|
17805
|
-
kind: "mutation",
|
|
17806
|
-
auth: "admin"
|
|
17807
|
-
}), method(object({
|
|
17808
|
-
deviceId: number(),
|
|
17809
|
-
trackIds: array(string()).min(1)
|
|
17810
|
-
}), object({
|
|
17811
|
-
deleted: number().int(),
|
|
17812
|
-
failed: array(string()).readonly()
|
|
17813
|
-
}), {
|
|
17814
|
-
kind: "mutation",
|
|
17815
|
-
auth: "admin"
|
|
17816
|
-
}), method(object({
|
|
17817
|
-
/** Log/audit scope only — the trackId is globally unique on its own. */
|
|
17695
|
+
/**
|
|
17696
|
+
* The TIERED label model (roadmap 4g), spread into `TrackSchema` and
|
|
17697
|
+
* `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
|
|
17698
|
+
* track and its events always answer the same question the same way.
|
|
17699
|
+
*
|
|
17700
|
+
* Two scalar columns, not an array: every consumer wants "the coarse one" or
|
|
17701
|
+
* "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
|
|
17702
|
+
* is tier 2, and each carries its own score + attribution.
|
|
17703
|
+
*
|
|
17704
|
+
* **Reading it.** What a human should be shown is `subLabel ?? label` — the
|
|
17705
|
+
* finest thing known. Before 4g the single `label` column held the finest
|
|
17706
|
+
* value, so a consumer that has not been updated reads the tier-1 slot and
|
|
17707
|
+
* shows nothing on a species-only row; that is why the migration puts every
|
|
17708
|
+
* pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
|
|
17709
|
+
* and why the read surfaces were changed in the same train.
|
|
17710
|
+
*
|
|
17711
|
+
* **Writing it.** The slots are independent, which is the whole point: a
|
|
17712
|
+
* tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
|
|
17713
|
+
* migratorius`), so fineness cannot regress by construction. Within a tier the
|
|
17714
|
+
* higher score wins. One rule, one implementation — see
|
|
17715
|
+
* `pipeline/label-tier.ts` in addon-post-analysis.
|
|
17716
|
+
*/
|
|
17717
|
+
var TieredLabelFields = {
|
|
17718
|
+
/** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
|
|
17719
|
+
label: string().optional(),
|
|
17720
|
+
/** Confidence of the tier-1 value, as reported by the deciding step. */
|
|
17721
|
+
labelScore: number().optional(),
|
|
17722
|
+
/** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
|
|
17723
|
+
labelMeta: LabelAttributionSchema.optional(),
|
|
17724
|
+
/** Tier 2 — the instance. See {@link LabelTierSchema}. */
|
|
17725
|
+
subLabel: string().optional(),
|
|
17726
|
+
/** Confidence of the tier-2 value, as reported by the deciding step. */
|
|
17727
|
+
subLabelScore: number().optional(),
|
|
17728
|
+
/** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
|
|
17729
|
+
subLabelMeta: LabelAttributionSchema.optional()
|
|
17730
|
+
};
|
|
17731
|
+
/** Per-camera slice of a training-export estimate. */
|
|
17732
|
+
var TrainingExportDeviceTotalsSchema = object({
|
|
17818
17733
|
deviceId: number(),
|
|
17734
|
+
tracks: number().int(),
|
|
17735
|
+
files: number().int(),
|
|
17736
|
+
bytes: number().int()
|
|
17737
|
+
});
|
|
17738
|
+
/**
|
|
17739
|
+
* What a training export WOULD contain. Computed from media index rows only —
|
|
17740
|
+
* no blob is read to produce this.
|
|
17741
|
+
*/
|
|
17742
|
+
var TrainingExportSummarySchema = object({
|
|
17743
|
+
generatedAt: number(),
|
|
17744
|
+
trackCount: number().int(),
|
|
17745
|
+
fileCount: number().int(),
|
|
17746
|
+
byteCount: number().int(),
|
|
17747
|
+
/** More marked tracks exist than a single pass carries. */
|
|
17748
|
+
truncated: boolean(),
|
|
17749
|
+
devices: array(TrainingExportDeviceTotalsSchema).readonly()
|
|
17750
|
+
});
|
|
17751
|
+
var TrackSchema = object({
|
|
17819
17752
|
trackId: string(),
|
|
17820
|
-
flags: TrackFlagsPatchSchema
|
|
17821
|
-
}), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
|
|
17822
|
-
kind: "query",
|
|
17823
|
-
auth: "admin"
|
|
17824
|
-
}), method(object({
|
|
17825
|
-
olderThanMs: number(),
|
|
17826
|
-
reason: OpsLogReasonSchema.optional()
|
|
17827
|
-
}), EventPruneCountsSchema, {
|
|
17828
|
-
kind: "mutation",
|
|
17829
|
-
auth: "admin"
|
|
17830
|
-
}), method(object({ deviceId: number() }), EventPruneCountsSchema, {
|
|
17831
|
-
kind: "mutation",
|
|
17832
|
-
auth: "admin"
|
|
17833
|
-
}), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
|
|
17834
|
-
kind: "mutation",
|
|
17835
|
-
auth: "admin"
|
|
17836
|
-
}), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
|
|
17837
|
-
kind: "mutation",
|
|
17838
|
-
auth: "admin"
|
|
17839
|
-
}), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
|
|
17840
|
-
kind: "mutation",
|
|
17841
|
-
auth: "admin"
|
|
17842
|
-
}), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
|
|
17843
|
-
kind: "mutation",
|
|
17844
|
-
auth: "admin"
|
|
17845
|
-
}), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
17846
|
-
kind: "mutation",
|
|
17847
|
-
auth: "admin"
|
|
17848
|
-
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
17849
|
-
kind: "mutation",
|
|
17850
|
-
auth: "admin"
|
|
17851
|
-
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
17852
|
-
kind: "query",
|
|
17853
|
-
auth: "admin"
|
|
17854
|
-
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
17855
|
-
kind: "mutation",
|
|
17856
|
-
auth: "admin"
|
|
17857
|
-
}), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
17858
|
-
kind: "query",
|
|
17859
|
-
auth: "admin"
|
|
17860
|
-
}), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
|
|
17861
|
-
kind: "query",
|
|
17862
|
-
auth: "admin"
|
|
17863
|
-
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
17864
|
-
kind: "query",
|
|
17865
|
-
auth: "admin"
|
|
17866
|
-
}), method(object({
|
|
17867
|
-
/** Empty ⇒ every camera that has staging tracks. A LIST, not a single
|
|
17868
|
-
* `deviceId`, deliberately: `deviceId` would make this device-bound and
|
|
17869
|
-
* route it at one camera's owner, and "every camera" would stop being
|
|
17870
|
-
* expressible at all. */
|
|
17871
|
-
deviceIds: array(number()).optional(),
|
|
17872
|
-
limit: number().int().min(1).max(500).optional()
|
|
17873
|
-
}), array(RetrainTrackSchema).readonly(), {
|
|
17874
|
-
kind: "query",
|
|
17875
|
-
auth: "admin"
|
|
17876
|
-
}), method(object({ trackId: string() }), RetrainFrameListSchema, {
|
|
17877
|
-
kind: "query",
|
|
17878
|
-
auth: "admin"
|
|
17879
|
-
}), method(object({
|
|
17880
17753
|
deviceId: number(),
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17754
|
+
className: string(),
|
|
17755
|
+
...TieredLabelFields,
|
|
17756
|
+
producingDeviceName: string().optional(),
|
|
17757
|
+
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
17758
|
+
source: TrackSourceSchema.optional(),
|
|
17759
|
+
firstSeen: number(),
|
|
17760
|
+
lastSeen: number(),
|
|
17761
|
+
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
17762
|
+
positions: array(TrackPositionSchema).readonly(),
|
|
17763
|
+
/** Periodic snapshots at snapshotIntervalMs cadence (subject to
|
|
17764
|
+
* saveThumbnails policy). */
|
|
17765
|
+
snapshots: array(TrackSnapshotSchema).readonly(),
|
|
17766
|
+
/** Deduplicated zones the track has entered at least once. Zone IDS. */
|
|
17767
|
+
zonesVisited: array(string()).readonly(),
|
|
17768
|
+
/**
|
|
17769
|
+
* Human NAMES for {@link zonesVisited}, resolved at READ time against the
|
|
17770
|
+
* `zones` capability.
|
|
17771
|
+
*
|
|
17772
|
+
* `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
|
|
17773
|
+
* and no card can render — so every free-text search surface was structurally
|
|
17774
|
+
* unable to answer "show me the tracks in Uscio", and did not fail loudly, it
|
|
17775
|
+
* just returned nothing. Resolving here rather than in each client keeps ONE
|
|
17776
|
+
* derivation and costs the clients no extra call (the `zones` cap is
|
|
17777
|
+
* per-device, so a client-side resolve would be a per-camera fan-out on a
|
|
17778
|
+
* surface built to avoid exactly that).
|
|
17779
|
+
*
|
|
17780
|
+
* Resolved, never invented: a zone deleted since the track was written has no
|
|
17781
|
+
* name and is DROPPED, so this array can be shorter than `zonesVisited` — the
|
|
17782
|
+
* two are not positionally aligned. Absent when the track visited no zone, or
|
|
17783
|
+
* when the zone catalogue could not be read.
|
|
17784
|
+
*/
|
|
17785
|
+
zoneNames: array(string()).readonly().optional(),
|
|
17786
|
+
/** Deduplicated set of detector classes observed for this track over its
|
|
17787
|
+
* life (a track may be reclassified, e.g. person→vehicle). Absent on
|
|
17788
|
+
* legacy rows written before class accumulation shipped. */
|
|
17789
|
+
classes: array(string()).readonly().optional(),
|
|
17790
|
+
/** Cumulative normalized distance travelled (0..1 units = full frame width). */
|
|
17791
|
+
totalDistance: number(),
|
|
17792
|
+
state: TrackStateSchema,
|
|
17793
|
+
active: boolean(),
|
|
17794
|
+
/** Deterministic key-event importance score in [0,1] (server-computed at
|
|
17795
|
+
* track expiry, recomputed on late label). Absent on legacy rows written
|
|
17796
|
+
* before scoring shipped — consumers degrade to absence / compute-on-read. */
|
|
17797
|
+
importance: number().optional(),
|
|
17798
|
+
/** Id of the track's highest-confidence ObjectEvent (its representative
|
|
17799
|
+
* "best" frame). Absent when the track produced no object events. */
|
|
17800
|
+
bestEventId: string().optional(),
|
|
17801
|
+
/** Tag of the importance sub-signal that dominated the score
|
|
17802
|
+
* (identity|dwell|proximity|class|confidence|travel|zone). */
|
|
17803
|
+
importanceReason: string().optional(),
|
|
17804
|
+
/** Audio-classification labels heard on the camera during the track's
|
|
17805
|
+
* life (score ≥ device `classificationMinScore`), aggregated per label.
|
|
17806
|
+
* Absent on legacy rows / tracks with no confident audio. */
|
|
17807
|
+
audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
|
|
17808
|
+
/** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
|
|
17809
|
+
* Populated from the persisted envelope columns on historical reads;
|
|
17810
|
+
* absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
|
|
17811
|
+
envelope: TrackEnvelopeSchema.optional(),
|
|
17812
|
+
/**
|
|
17813
|
+
* A face DETECTOR found a face on this track — nothing more. It says the
|
|
17814
|
+
* detail plane produced a `face` detail; it does NOT say the face was
|
|
17815
|
+
* embedded, matched, above `minFacePx`, or that the recognizer was even
|
|
17816
|
+
* enabled. Set once and never cleared.
|
|
17817
|
+
*
|
|
17818
|
+
* **This exists so "face present but not recognised" is expressible.** A
|
|
17819
|
+
* recognised identity lands in `subLabel` (attributed to the face chain via
|
|
17820
|
+
* `subLabelMeta.stepId`), so before this field a track with an unmatched face
|
|
17821
|
+
* and a track with no face at all were byte-identical on the wire and no
|
|
17822
|
+
* surface could tell them apart. The read is `hasFace === true && subLabel
|
|
17823
|
+
* === undefined`.
|
|
17824
|
+
*
|
|
17825
|
+
* **Absent ≠ false.** Every row written before the column existed omits it,
|
|
17826
|
+
* and so does every server that predates the field — a consumer must test
|
|
17827
|
+
* `=== true` and render nothing otherwise, never infer "no face".
|
|
17828
|
+
*/
|
|
17829
|
+
hasFace: boolean().optional(),
|
|
17830
|
+
/**
|
|
17831
|
+
* This track has a face row IN THE GALLERY: a crop **and** an embedding — a
|
|
17832
|
+
* face an operator could ASSIGN to an identity.
|
|
17833
|
+
*
|
|
17834
|
+
* The STRICT twin of {@link hasFace}, and the pair only earns its keep
|
|
17835
|
+
* because the two disagree. `hasFace` is stamped at the TOP of the face
|
|
17836
|
+
* branch, before every gate, and means no more than "a face detector produced
|
|
17837
|
+
* a face detail". This one is stamped at the single moment the gallery row
|
|
17838
|
+
* LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
|
|
17839
|
+
* past the embedding-magnitude verdict, the `minFacePx` detection gate, the
|
|
17840
|
+
* candidate gate, the imageless-track drop (no crop was ever captured) and
|
|
17841
|
+
* the crop-store drop. Everything between the detector and that insert can
|
|
17842
|
+
* legitimately refuse the face, so a flag written any earlier promises the
|
|
17843
|
+
* operator something to assign and delivers nothing.
|
|
17844
|
+
*
|
|
17845
|
+
* **Independent of recognition.** A face collected but never auto-matched is
|
|
17846
|
+
* still assignable — it is in fact the face an operator most wants to reach —
|
|
17847
|
+
* so this is NOT gated on `recognizedIdentityId`. Recognition lands in
|
|
17848
|
+
* `subLabel`; this says only that the raw material exists.
|
|
17849
|
+
*
|
|
17850
|
+
* **Set once, never cleared.** A track that produced a gallery row produced
|
|
17851
|
+
* one; deleting the row later is the gallery's business, not this flag's.
|
|
17852
|
+
*
|
|
17853
|
+
* **Absent ≠ false**, the same rule as {@link hasFace}: every row written
|
|
17854
|
+
* before the column omits it, and so does every server that predates the
|
|
17855
|
+
* field. A consumer must test `=== true` and render nothing otherwise —
|
|
17856
|
+
* never infer "no assignable face".
|
|
17857
|
+
*/
|
|
17858
|
+
hasEmbeddedFace: boolean().optional(),
|
|
17859
|
+
/**
|
|
17860
|
+
* This subject CONTAINS a folded rider — a person the rider-pairing step
|
|
17861
|
+
* ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
|
|
17862
|
+
* so the passage is tracked once and as a VEHICLE.
|
|
17863
|
+
*
|
|
17864
|
+
* It exists because the fold's record was dishonest. D34 and the code both
|
|
17865
|
+
* said "the person is not lost — it is reported so both entities stay on the
|
|
17866
|
+
* record"; in fact the pair went into a per-processor RAM field behind an
|
|
17867
|
+
* accessor nobody called, and every durable surface said `vehicle`, full
|
|
17868
|
+
* stop. This is the composition note that makes the row true.
|
|
17869
|
+
*
|
|
17870
|
+
* A COMPOSITION, never a class and never a label. "This vehicle contains a
|
|
17871
|
+
* person" is not an answer to "what is this" — both label tiers would refuse
|
|
17872
|
+
* a macro token anyway (D89), and correctly. Nothing here changes what the
|
|
17873
|
+
* subject IS: a cyclist stays one vehicle track, occupancy still counts one,
|
|
17874
|
+
* and a `person` rule still does not fire for someone cycling past.
|
|
17875
|
+
*
|
|
17876
|
+
* **Absent ≠ false**, exactly like {@link hasFace}: every row written before
|
|
17877
|
+
* the column, and every hub that predates the field, omits it. Test
|
|
17878
|
+
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17879
|
+
*/
|
|
17880
|
+
hasRider: boolean().optional(),
|
|
17881
|
+
...TrackFlagFields,
|
|
17882
|
+
...TrackRetrainFields
|
|
17883
|
+
});
|
|
17884
|
+
var BaseEventFields = {
|
|
17885
|
+
id: string(),
|
|
17887
17886
|
deviceId: number(),
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
|
|
17896
|
-
|
|
17887
|
+
timestamp: number()
|
|
17888
|
+
};
|
|
17889
|
+
var MotionEventSchema = object({
|
|
17890
|
+
...BaseEventFields,
|
|
17891
|
+
kind: literal("motion"),
|
|
17892
|
+
regionCount: number(),
|
|
17893
|
+
/** Heavy JSON array — omitted in slim projection. */
|
|
17894
|
+
regions: array(object({
|
|
17895
|
+
bbox: BoundingBoxSchema,
|
|
17896
|
+
pixelCount: number(),
|
|
17897
|
+
intensity: number()
|
|
17898
|
+
})).readonly().optional(),
|
|
17899
|
+
/** Omitted in slim projection. */
|
|
17900
|
+
frameWidth: number().optional(),
|
|
17901
|
+
/** Omitted in slim projection. */
|
|
17902
|
+
frameHeight: number().optional(),
|
|
17903
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
17904
|
+
mediaUrl: string().optional()
|
|
17905
|
+
});
|
|
17906
|
+
/**
|
|
17907
|
+
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
17908
|
+
* detection pipeline (decoded-frame inference); `onboard` = the camera's
|
|
17909
|
+
* native on-device AI. Both flow through the SAME analysis layers (zoning,
|
|
17910
|
+
* tracking, per-kind persistence) but stay distinguishable so consumers
|
|
17911
|
+
* (advanced-notifier, occupancy, …) can select which source(s) to act on.
|
|
17912
|
+
* Absent on legacy rows ⇒ treat as `pipeline`.
|
|
17913
|
+
*/
|
|
17914
|
+
var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
|
|
17915
|
+
/**
|
|
17916
|
+
* The confirmed zone crossing that produced an object event. Present ONLY on
|
|
17917
|
+
* an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
|
|
17918
|
+
* event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
|
|
17919
|
+
* appearance event carry none, so a rule asking for a direction fails closed
|
|
17920
|
+
* on them.
|
|
17921
|
+
*
|
|
17922
|
+
* Exactly ONE crossing per event: the emitter turns each confirmed crossing
|
|
17923
|
+
* into its own event, so a frame in which a track enters A while leaving B
|
|
17924
|
+
* produces two events with two directions — never one ambiguous row.
|
|
17925
|
+
*
|
|
17926
|
+
* `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
|
|
17927
|
+
* membership the box has NOW, and by definition it no longer contains the zone
|
|
17928
|
+
* that was just left. Without the id here, a zone-scoped rule could never match
|
|
17929
|
+
* the exit it asked for.
|
|
17930
|
+
*/
|
|
17931
|
+
var ZoneCrossingSchema = object({
|
|
17932
|
+
direction: _enum(["enter", "exit"]),
|
|
17933
|
+
/** Admin zone id crossed. */
|
|
17934
|
+
zoneId: string(),
|
|
17935
|
+
/** Zone display name at crossing time (falls back to the id). */
|
|
17936
|
+
zoneName: string().optional()
|
|
17937
|
+
});
|
|
17938
|
+
var ObjectEventSchema = object({
|
|
17939
|
+
...BaseEventFields,
|
|
17940
|
+
kind: literal("object"),
|
|
17941
|
+
/** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
|
|
17942
|
+
source: DetectionSourceSchema.optional(),
|
|
17943
|
+
/**
|
|
17944
|
+
* Inference-frame id shared by every object event emitted from the SAME frame
|
|
17945
|
+
* — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
|
|
17946
|
+
* 2 people + 1 dog) under one full frame, and link a track's frames over time
|
|
17947
|
+
* (group by `trackId`, pick a representative `frameId` as the parent frame).
|
|
17948
|
+
* Optional for backward-compat with pre-existing rows / the slim projection
|
|
17949
|
+
* includes it (it is light). Absent on rows written before this field.
|
|
17950
|
+
*/
|
|
17951
|
+
frameId: string().optional(),
|
|
17952
|
+
/** Omitted in slim projection. */
|
|
17953
|
+
trackId: string().optional(),
|
|
17954
|
+
className: string(),
|
|
17955
|
+
...TieredLabelFields,
|
|
17956
|
+
/** Omitted in slim projection. */
|
|
17957
|
+
confidence: number().optional(),
|
|
17958
|
+
/** Heavy JSON — omitted in slim projection. */
|
|
17959
|
+
bbox: BoundingBoxSchema.optional(),
|
|
17960
|
+
/** Heavy JSON — omitted in slim projection. */
|
|
17961
|
+
zones: array(string()).readonly().optional(),
|
|
17962
|
+
/** Omitted in slim projection. */
|
|
17963
|
+
state: TrackStateSchema.optional(),
|
|
17964
|
+
/**
|
|
17965
|
+
* The zone crossing this event IS, when it is one. Absent on every other
|
|
17966
|
+
* event kind (movement state, appearance, package) — see
|
|
17967
|
+
* {@link ZoneCrossingSchema}. Omitted in slim projection.
|
|
17968
|
+
*/
|
|
17969
|
+
zoneCrossing: ZoneCrossingSchema.optional(),
|
|
17970
|
+
/** Detection-frame dimensions in pixels — let consumers normalize the
|
|
17971
|
+
* pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
|
|
17972
|
+
frameWidth: number().optional(),
|
|
17973
|
+
frameHeight: number().optional(),
|
|
17974
|
+
/** MediaStore key for the crop attached to this event (if any). */
|
|
17975
|
+
mediaKey: string().optional(),
|
|
17976
|
+
/** Design B: MediaStore key of the track's native-resolution key frame (the
|
|
17977
|
+
* best-detection full frame). Resolve via the event-media data-plane
|
|
17978
|
+
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
|
|
17979
|
+
* draws `bbox` over the native frame. Absent on legacy rows / non-decoded
|
|
17980
|
+
* sources — consumers fall back to `mediaKey` (the tight crop). */
|
|
17981
|
+
keyFrameMediaKey: string().optional(),
|
|
17982
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
17983
|
+
mediaUrl: string().optional(),
|
|
17984
|
+
/** The parent track's key-event importance [0,1], propagated to every object
|
|
17985
|
+
* event of the track (so an event row can be sorted by importance without a
|
|
17986
|
+
* track join). Absent on legacy rows / before the track was scored. */
|
|
17987
|
+
importance: number().optional()
|
|
17988
|
+
});
|
|
17989
|
+
var AudioEventSchema = object({
|
|
17990
|
+
...BaseEventFields,
|
|
17991
|
+
kind: literal("audio"),
|
|
17992
|
+
rms: number(),
|
|
17993
|
+
dbfs: number(),
|
|
17994
|
+
classification: object({
|
|
17995
|
+
className: string(),
|
|
17996
|
+
originalClass: string().optional(),
|
|
17997
|
+
score: number()
|
|
17998
|
+
}).optional(),
|
|
17999
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
18000
|
+
mediaUrl: string().optional()
|
|
18001
|
+
});
|
|
18002
|
+
var MediaFileKindEnum = _enum([
|
|
18003
|
+
"crop",
|
|
18004
|
+
"thumbnail",
|
|
18005
|
+
"snapshot",
|
|
18006
|
+
"firstFrame",
|
|
18007
|
+
"lastFrame",
|
|
18008
|
+
"fullFrame",
|
|
18009
|
+
"fullFrameBoxed",
|
|
18010
|
+
"faceCrop",
|
|
18011
|
+
"plateCrop",
|
|
18012
|
+
"keyFrame",
|
|
18013
|
+
"keyFrameSmall",
|
|
18014
|
+
"thumbnailSmall"
|
|
18015
|
+
]);
|
|
18016
|
+
var MediaFileSchema = object({
|
|
18017
|
+
key: string(),
|
|
18018
|
+
kind: MediaFileKindEnum,
|
|
17897
18019
|
base64: string(),
|
|
17898
|
-
|
|
17899
|
-
|
|
17900
|
-
})
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
|
|
17911
|
-
|
|
17912
|
-
|
|
17913
|
-
|
|
17914
|
-
|
|
17915
|
-
|
|
17916
|
-
|
|
17917
|
-
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
17923
|
-
|
|
17924
|
-
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
|
|
17929
|
-
|
|
17930
|
-
|
|
17931
|
-
|
|
17932
|
-
|
|
17933
|
-
|
|
17934
|
-
|
|
17935
|
-
|
|
17936
|
-
|
|
17937
|
-
|
|
17938
|
-
|
|
17939
|
-
|
|
17940
|
-
|
|
17941
|
-
|
|
17942
|
-
|
|
17943
|
-
|
|
17944
|
-
|
|
17945
|
-
|
|
17946
|
-
|
|
17947
|
-
|
|
18020
|
+
sizeBytes: number(),
|
|
18021
|
+
timestamp: number()
|
|
18022
|
+
});
|
|
18023
|
+
/**
|
|
18024
|
+
* One media row WITHOUT its bytes.
|
|
18025
|
+
*
|
|
18026
|
+
* A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
|
|
18027
|
+
* 140 s track), and a client that renders tiles from the media data plane needs
|
|
18028
|
+
* to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
|
|
18029
|
+
* with an immutable cache, instead of all at once inside a tRPC response that
|
|
18030
|
+
* blocks the whole view.
|
|
18031
|
+
*
|
|
18032
|
+
* `sizeBytes` is carried because it is what lets a client decide between the
|
|
18033
|
+
* stored blob and a `?variant=thumb` rendering without fetching either.
|
|
18034
|
+
*/
|
|
18035
|
+
var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
|
|
18036
|
+
/**
|
|
18037
|
+
* The MACRO tier of an annotation — a CLOSED set.
|
|
18038
|
+
*
|
|
18039
|
+
* This is what the exported detector predicts, so a typo here is a new class
|
|
18040
|
+
* with one example in it. `label` and `subLabel` are open strings by contrast:
|
|
18041
|
+
* the whole point of the page is teaching the model things it does not know
|
|
18042
|
+
* yet, and constraining that vocabulary would make it useless.
|
|
18043
|
+
*
|
|
18044
|
+
* A macro class is NEVER a label. The provider refuses a write whose `label` or
|
|
18045
|
+
* `subLabel` is one of these values, in any casing, because once `person`
|
|
18046
|
+
* exists in both tiers "every person box" stops being answerable without
|
|
18047
|
+
* knowing every string anyone ever typed — and the damage is retroactive.
|
|
18048
|
+
*/
|
|
18049
|
+
var RetrainMacroClassSchema = _enum([
|
|
18050
|
+
"person",
|
|
18051
|
+
"vehicle",
|
|
18052
|
+
"animal",
|
|
18053
|
+
"package",
|
|
18054
|
+
"face",
|
|
18055
|
+
"plate"
|
|
18056
|
+
]);
|
|
18057
|
+
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
18058
|
+
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
18059
|
+
/** Did a human draw this box, or did the assist propose it? */
|
|
18060
|
+
var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
|
|
18061
|
+
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
18062
|
+
var RetrainBboxSchema = object({
|
|
18063
|
+
x: number(),
|
|
18064
|
+
y: number(),
|
|
18065
|
+
w: number(),
|
|
18066
|
+
h: number()
|
|
18067
|
+
});
|
|
18068
|
+
/**
|
|
18069
|
+
* One annotated subject.
|
|
18070
|
+
*
|
|
18071
|
+
* `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
|
|
18072
|
+
* (letterboxed root / zone-cropped package / subject-cropped classifier) are
|
|
18073
|
+
* derived from it at export and never stored — storing them is how one feature
|
|
18074
|
+
* space ends up holding two crops of the same subject (D52).
|
|
18075
|
+
*/
|
|
18076
|
+
var RetrainAnnotationSchema = object({
|
|
18077
|
+
id: string(),
|
|
17948
18078
|
trackId: string(),
|
|
17949
|
-
deviceId: number()
|
|
17950
|
-
}), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
17951
|
-
kind: "mutation",
|
|
17952
|
-
auth: "admin"
|
|
17953
|
-
}), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
17954
|
-
kind: "mutation",
|
|
17955
|
-
auth: "admin"
|
|
17956
|
-
}), method(object({}), RebuildStatusSchema), object({
|
|
17957
|
-
deviceId: number(),
|
|
17958
|
-
timestamp: number(),
|
|
17959
|
-
frameWidth: number(),
|
|
17960
|
-
frameHeight: number(),
|
|
17961
|
-
detections: array(OverlayDetectionSchema).readonly()
|
|
17962
|
-
}), object({
|
|
17963
18079
|
deviceId: number(),
|
|
18080
|
+
/** The COPY in retrain storage — never the source track's media key. */
|
|
18081
|
+
mediaKey: string(),
|
|
18082
|
+
bbox: RetrainBboxSchema,
|
|
18083
|
+
macroClass: RetrainMacroClassSchema,
|
|
18084
|
+
label: string().optional(),
|
|
18085
|
+
subLabel: string().optional(),
|
|
18086
|
+
kind: RetrainAnnotationKindSchema,
|
|
18087
|
+
source: RetrainAnnotationSourceSchema,
|
|
18088
|
+
/** Which model proposed this box — or, on a `model_error`, drew the phantom. */
|
|
18089
|
+
assistModelId: string().optional(),
|
|
18090
|
+
assistScore: number().optional(),
|
|
18091
|
+
exportedInBatch: string().optional(),
|
|
18092
|
+
createdAt: number()
|
|
18093
|
+
});
|
|
18094
|
+
/** The write form — the server owns `id`, `createdAt` and the frame binding. */
|
|
18095
|
+
var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
|
|
18096
|
+
id: true,
|
|
18097
|
+
trackId: true,
|
|
18098
|
+
deviceId: true,
|
|
18099
|
+
mediaKey: true,
|
|
18100
|
+
createdAt: true,
|
|
18101
|
+
exportedInBatch: true
|
|
18102
|
+
});
|
|
18103
|
+
/** A track sitting in `staging`, with everything the worklist needs to rank it. */
|
|
18104
|
+
var RetrainTrackSchema = object({
|
|
17964
18105
|
trackId: string(),
|
|
17965
|
-
className: string()
|
|
17966
|
-
}), object({
|
|
17967
18106
|
deviceId: number(),
|
|
17968
|
-
trackId: string(),
|
|
17969
18107
|
className: string(),
|
|
17970
|
-
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
17977
|
-
|
|
17978
|
-
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
17979
|
-
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
17980
|
-
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
17981
|
-
*/
|
|
17982
|
-
var NativeCropRefSchema = object({
|
|
17983
|
-
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
17984
|
-
handle: FrameHandleSchema,
|
|
17985
|
-
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
17986
|
-
cropFrameSpace: object({
|
|
17987
|
-
x: number(),
|
|
17988
|
-
y: number(),
|
|
17989
|
-
w: number(),
|
|
17990
|
-
h: number()
|
|
17991
|
-
})
|
|
17992
|
-
});
|
|
17993
|
-
object({
|
|
17994
|
-
crop: object({
|
|
17995
|
-
left: number(),
|
|
17996
|
-
top: number(),
|
|
17997
|
-
width: number().positive(),
|
|
17998
|
-
height: number().positive()
|
|
17999
|
-
}).optional(),
|
|
18000
|
-
content: object({
|
|
18001
|
-
width: number().int().positive(),
|
|
18002
|
-
height: number().int().positive()
|
|
18003
|
-
}),
|
|
18004
|
-
fit: _enum(["stretch", "contain"]),
|
|
18005
|
-
format: _enum([
|
|
18006
|
-
"rgb",
|
|
18007
|
-
"gray",
|
|
18008
|
-
"jpeg"
|
|
18009
|
-
])
|
|
18108
|
+
label: string().optional(),
|
|
18109
|
+
firstSeen: number(),
|
|
18110
|
+
lastSeen: number(),
|
|
18111
|
+
/** How many frames the dataset already holds from this track. */
|
|
18112
|
+
frameCount: number().int(),
|
|
18113
|
+
/** How many subjects have been annotated on those frames. `0` with
|
|
18114
|
+
* `frameCount: 0` is exactly "staging, still to work". */
|
|
18115
|
+
annotationCount: number().int()
|
|
18010
18116
|
});
|
|
18011
|
-
/**
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
*/
|
|
18016
|
-
var FrameRefSchema = object({
|
|
18017
|
-
registryId: string().min(1),
|
|
18018
|
-
id: string().min(1),
|
|
18019
|
-
width: number().int().positive(),
|
|
18020
|
-
height: number().int().positive(),
|
|
18021
|
-
format: _enum(["rgb", "gray"]),
|
|
18117
|
+
/** A frame the picker may offer — an index row, no blob was read to produce it. */
|
|
18118
|
+
var RetrainFrameCandidateSchema = object({
|
|
18119
|
+
mediaKey: string(),
|
|
18120
|
+
kind: MediaFileKindEnum,
|
|
18022
18121
|
timestamp: number(),
|
|
18023
|
-
|
|
18122
|
+
sizeBytes: number().int(),
|
|
18123
|
+
/** A copy of this original already exists — selecting it is free and cannot
|
|
18124
|
+
* fail, whatever became of the original. */
|
|
18125
|
+
copied: boolean()
|
|
18024
18126
|
});
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
18038
|
-
|
|
18127
|
+
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
18128
|
+
var RetrainFrameSchema = object({
|
|
18129
|
+
frameId: string(),
|
|
18130
|
+
deviceId: number(),
|
|
18131
|
+
trackId: string(),
|
|
18132
|
+
/** Provenance only. It may already point at nothing — that is expected. */
|
|
18133
|
+
sourceMediaKey: string(),
|
|
18134
|
+
sourceKind: MediaFileKindEnum,
|
|
18135
|
+
sizeBytes: number().int(),
|
|
18136
|
+
width: number().int(),
|
|
18137
|
+
height: number().int(),
|
|
18138
|
+
copiedAt: number()
|
|
18139
|
+
});
|
|
18140
|
+
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
18141
|
+
var RetrainCopyRefusalSchema = _enum([
|
|
18142
|
+
"source-missing",
|
|
18143
|
+
"unreadable-image",
|
|
18144
|
+
"write-failed"
|
|
18039
18145
|
]);
|
|
18040
|
-
var
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18146
|
+
var RetrainFrameSelectionSchema = object({
|
|
18147
|
+
copied: array(RetrainFrameSchema).readonly(),
|
|
18148
|
+
refused: array(object({
|
|
18149
|
+
sourceMediaKey: string(),
|
|
18150
|
+
reason: RetrainCopyRefusalSchema
|
|
18151
|
+
})).readonly()
|
|
18045
18152
|
});
|
|
18046
|
-
var
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
|
|
18051
|
-
description: string().optional()
|
|
18052
|
-
})).readonly(),
|
|
18053
|
-
defaultDevice: string()
|
|
18153
|
+
var RetrainFrameListSchema = object({
|
|
18154
|
+
candidates: array(RetrainFrameCandidateSchema).readonly(),
|
|
18155
|
+
copies: array(RetrainFrameSchema).readonly(),
|
|
18156
|
+
/** What the page pre-selects — the native key frame when one survives. */
|
|
18157
|
+
autoPickMediaKey: string().optional()
|
|
18054
18158
|
});
|
|
18055
|
-
|
|
18056
|
-
|
|
18057
|
-
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
enabled: boolean(),
|
|
18159
|
+
/** What the operator asked the assist to look for. */
|
|
18160
|
+
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
18161
|
+
kind: literal("package"),
|
|
18162
|
+
zone: RetrainBboxSchema.optional()
|
|
18163
|
+
}), object({
|
|
18164
|
+
kind: literal("objects"),
|
|
18062
18165
|
modelId: string(),
|
|
18063
|
-
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
|
|
18166
|
+
minScore: number().optional()
|
|
18167
|
+
})]);
|
|
18168
|
+
/**
|
|
18169
|
+
* The assist's answer — a discriminated union, because "the model saw nothing"
|
|
18170
|
+
* and "this node cannot run that model" lead to different next moves and a
|
|
18171
|
+
* nullable result cannot tell them apart.
|
|
18172
|
+
*/
|
|
18173
|
+
var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
18174
|
+
kind: literal("proposed"),
|
|
18070
18175
|
modelId: string(),
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
|
|
18080
|
-
|
|
18176
|
+
stepId: string(),
|
|
18177
|
+
minScore: number(),
|
|
18178
|
+
/** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
|
|
18179
|
+
proposals: array(RetrainAnnotationDraftSchema).readonly(),
|
|
18180
|
+
/** Returned by the runner but removed by the threshold. */
|
|
18181
|
+
belowThreshold: number().int()
|
|
18182
|
+
}), object({
|
|
18183
|
+
kind: literal("refused"),
|
|
18184
|
+
/** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
|
|
18185
|
+
reason: string(),
|
|
18186
|
+
detail: string().optional()
|
|
18187
|
+
})]);
|
|
18188
|
+
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
18189
|
+
var RetrainTransitionResultSchema = object({
|
|
18190
|
+
trackId: string(),
|
|
18191
|
+
/** Where the track ended up, whatever happened. */
|
|
18192
|
+
retrainStatus: RetrainStatusSchema,
|
|
18193
|
+
/** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
|
|
18194
|
+
changed: boolean(),
|
|
18195
|
+
reason: _enum([
|
|
18196
|
+
"unknown-track",
|
|
18197
|
+
"no-frames-copied",
|
|
18198
|
+
"not-staging",
|
|
18199
|
+
"not-trained",
|
|
18200
|
+
"unchanged"
|
|
18201
|
+
]).optional()
|
|
18202
|
+
});
|
|
18203
|
+
var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
|
|
18204
|
+
var MAX_EVENT_QUERY_LIMIT = 5e3;
|
|
18205
|
+
var DeviceEventQueryInput = object({
|
|
18206
|
+
deviceId: number(),
|
|
18207
|
+
since: number().optional(),
|
|
18208
|
+
until: number().optional(),
|
|
18209
|
+
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
|
|
18210
|
+
/** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
|
|
18211
|
+
* optional `mediaUrl` (populated by B5). `full` (default) keeps today's
|
|
18212
|
+
* exact behaviour. Callers may omit this field — the store defaults to
|
|
18213
|
+
* `full` when not provided. */
|
|
18214
|
+
projection: _enum(["full", "slim"]).optional()
|
|
18215
|
+
});
|
|
18216
|
+
var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
|
|
18217
|
+
var RecentTracksQueryInput = object({
|
|
18218
|
+
/** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
|
|
18219
|
+
deviceIds: array(number()),
|
|
18220
|
+
/** Window lower bound on `lastSeen` (inclusive). */
|
|
18221
|
+
since: number().optional(),
|
|
18222
|
+
/** Window upper bound on `lastSeen` (inclusive). */
|
|
18223
|
+
until: number().optional(),
|
|
18224
|
+
/** Page size. Default 200, max 1000. */
|
|
18225
|
+
limit: number().int().min(1).max(1e3).default(200),
|
|
18226
|
+
/** Opaque continuation cursor from a previous page's `nextCursor`.
|
|
18227
|
+
* Encodes the (lastSeen, trackId) sort position — treat as opaque. */
|
|
18228
|
+
cursor: string().optional(),
|
|
18229
|
+
/** See {@link TrackProjectionSchema}. Default `full`. */
|
|
18230
|
+
projection: TrackProjectionSchema.optional(),
|
|
18231
|
+
/** Include stationary-promoted rows (parked objects). Default false: the
|
|
18232
|
+
* feed lists passages; parking records live on the stationary registry. */
|
|
18233
|
+
includeStationary: boolean().optional()
|
|
18081
18234
|
});
|
|
18082
|
-
var
|
|
18083
|
-
|
|
18084
|
-
|
|
18085
|
-
|
|
18086
|
-
|
|
18087
|
-
sizeMB: number()
|
|
18088
|
-
})),
|
|
18089
|
-
group: ModelVariantGroupSchema.optional(),
|
|
18090
|
-
legacy: boolean().optional(),
|
|
18091
|
-
provider: ModelProviderIdSchema.optional()
|
|
18235
|
+
var RecentTracksPageSchema = object({
|
|
18236
|
+
/** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
|
|
18237
|
+
tracks: array(TrackSchema).readonly(),
|
|
18238
|
+
/** Cursor for the next page, or null when this page is the last. */
|
|
18239
|
+
nextCursor: string().nullable()
|
|
18092
18240
|
});
|
|
18093
|
-
var
|
|
18094
|
-
var
|
|
18241
|
+
var LIST_GROUPS_DEFAULT_LIMIT = 40;
|
|
18242
|
+
var LIST_GROUPS_MAX_LIMIT = 100;
|
|
18243
|
+
var AnalyticsGroupRecordSchema = object({
|
|
18095
18244
|
id: string(),
|
|
18096
|
-
|
|
18097
|
-
|
|
18098
|
-
|
|
18099
|
-
|
|
18100
|
-
|
|
18101
|
-
|
|
18102
|
-
|
|
18103
|
-
|
|
18104
|
-
|
|
18105
|
-
|
|
18106
|
-
|
|
18107
|
-
group: string().optional(),
|
|
18108
|
-
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
18245
|
+
deviceId: number().int(),
|
|
18246
|
+
openedAt: number().int(),
|
|
18247
|
+
closedAt: number().int(),
|
|
18248
|
+
timestamp: number().int(),
|
|
18249
|
+
memberCount: number().int(),
|
|
18250
|
+
memberTrackIds: array(string()).readonly(),
|
|
18251
|
+
className: string(),
|
|
18252
|
+
classes: array(string()).readonly(),
|
|
18253
|
+
/** Relative event-media path, or null when the group has no picture yet. */
|
|
18254
|
+
mediaUrl: string().nullable(),
|
|
18255
|
+
singleton: boolean()
|
|
18109
18256
|
});
|
|
18110
|
-
var
|
|
18111
|
-
|
|
18112
|
-
|
|
18113
|
-
|
|
18114
|
-
|
|
18115
|
-
|
|
18257
|
+
var AnalyticsGroupMemberSchema = object({
|
|
18258
|
+
trackId: string(),
|
|
18259
|
+
deviceId: number().int(),
|
|
18260
|
+
className: string(),
|
|
18261
|
+
firstSeen: number().int(),
|
|
18262
|
+
lastSeen: number().int(),
|
|
18263
|
+
mediaUrl: string().nullable()
|
|
18116
18264
|
});
|
|
18117
|
-
var
|
|
18118
|
-
|
|
18119
|
-
|
|
18120
|
-
|
|
18265
|
+
var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
|
|
18266
|
+
var ListGroupsQueryInput = object({
|
|
18267
|
+
/** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
|
|
18268
|
+
deviceIds: array(number()),
|
|
18269
|
+
/** Window lower bound on `closedAt` (inclusive). */
|
|
18270
|
+
since: number().optional(),
|
|
18271
|
+
/** Window upper bound on `openedAt` (inclusive). */
|
|
18272
|
+
until: number().optional(),
|
|
18273
|
+
limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
|
|
18274
|
+
/** Opaque continuation cursor from a previous page's `nextCursor`. */
|
|
18275
|
+
cursor: string().optional()
|
|
18121
18276
|
});
|
|
18122
|
-
var
|
|
18123
|
-
|
|
18124
|
-
|
|
18125
|
-
"openvino",
|
|
18126
|
-
"coreml",
|
|
18127
|
-
"edgetpu"
|
|
18128
|
-
]).nullable(),
|
|
18129
|
-
device: string().nullable(),
|
|
18130
|
-
state: _enum([
|
|
18131
|
-
"idle",
|
|
18132
|
-
"installing",
|
|
18133
|
-
"verifying",
|
|
18134
|
-
"ready",
|
|
18135
|
-
"failed"
|
|
18136
|
-
]),
|
|
18137
|
-
progress: number().optional(),
|
|
18138
|
-
error: string().optional(),
|
|
18139
|
-
nextRetryAt: number().optional(),
|
|
18140
|
-
/**
|
|
18141
|
-
* Gate A (config-correctness gate at engine change): human-readable
|
|
18142
|
-
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
18143
|
-
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
18144
|
-
* has a <format> build"). Additive/optional: informational only, never
|
|
18145
|
-
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
18146
|
-
* Absent/empty when the node-default tree resolves cleanly.
|
|
18147
|
-
*/
|
|
18148
|
-
configIssues: array(string()).optional()
|
|
18277
|
+
var ListGroupsPageSchema = object({
|
|
18278
|
+
groups: array(AnalyticsGroupRecordSchema).readonly(),
|
|
18279
|
+
nextCursor: string().nullable()
|
|
18149
18280
|
});
|
|
18150
|
-
var
|
|
18151
|
-
|
|
18152
|
-
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18157
|
-
|
|
18158
|
-
|
|
18159
|
-
|
|
18160
|
-
|
|
18161
|
-
running: string(),
|
|
18162
|
-
format: string()
|
|
18281
|
+
var KeyEventQueryInput = object({
|
|
18282
|
+
deviceId: number(),
|
|
18283
|
+
/** Window lower bound (track firstSeen ≥ since). */
|
|
18284
|
+
since: number(),
|
|
18285
|
+
/** Window upper bound (track firstSeen ≤ until). */
|
|
18286
|
+
until: number(),
|
|
18287
|
+
limit: number().int().min(1).max(200).default(50),
|
|
18288
|
+
/** Drop tracks scoring below this importance. */
|
|
18289
|
+
minImportance: number().min(0).max(1).optional(),
|
|
18290
|
+
/** Restrict to a single class (e.g. 'person'). */
|
|
18291
|
+
classFilter: string().optional()
|
|
18163
18292
|
});
|
|
18164
|
-
var
|
|
18165
|
-
|
|
18166
|
-
|
|
18167
|
-
|
|
18293
|
+
var KeyEventSchema = object({
|
|
18294
|
+
/** The representative event id (the track's best ObjectEvent, else its trackId). */
|
|
18295
|
+
id: string(),
|
|
18296
|
+
trackId: string(),
|
|
18297
|
+
/** Track start time (firstSeen). */
|
|
18298
|
+
timestamp: number(),
|
|
18299
|
+
className: string(),
|
|
18300
|
+
...TieredLabelFields,
|
|
18301
|
+
importance: number(),
|
|
18302
|
+
/** Highest-confidence ObjectEvent id for the track (empty when none). */
|
|
18303
|
+
bestEventId: string(),
|
|
18304
|
+
/** Track lifetime in ms (lastSeen - firstSeen). */
|
|
18305
|
+
windowMs: number().optional(),
|
|
18306
|
+
...TrackFlagFields,
|
|
18307
|
+
...TrackRetrainFields
|
|
18168
18308
|
});
|
|
18169
|
-
|
|
18170
|
-
|
|
18171
|
-
|
|
18172
|
-
|
|
18173
|
-
|
|
18174
|
-
|
|
18309
|
+
object({
|
|
18310
|
+
trackId: string(),
|
|
18311
|
+
className: string(),
|
|
18312
|
+
confidence: number(),
|
|
18313
|
+
bbox: BoundingBoxSchema,
|
|
18314
|
+
zones: array(string()).readonly(),
|
|
18315
|
+
state: TrackStateSchema
|
|
18175
18316
|
});
|
|
18176
|
-
var
|
|
18177
|
-
|
|
18178
|
-
|
|
18317
|
+
var OverlayDetectionSchema = looseObject({
|
|
18318
|
+
id: string(),
|
|
18319
|
+
kind: _enum(["first-level", "detail"]),
|
|
18320
|
+
macroClass: string(),
|
|
18321
|
+
score: number(),
|
|
18322
|
+
bbox: object({
|
|
18323
|
+
x: number(),
|
|
18324
|
+
y: number(),
|
|
18325
|
+
width: number(),
|
|
18326
|
+
height: number()
|
|
18327
|
+
}),
|
|
18328
|
+
labels: array(looseObject({
|
|
18329
|
+
label: string(),
|
|
18330
|
+
score: number()
|
|
18331
|
+
})).readonly(),
|
|
18332
|
+
parentId: string().optional()
|
|
18179
18333
|
});
|
|
18180
|
-
var
|
|
18181
|
-
|
|
18182
|
-
|
|
18334
|
+
var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
|
|
18335
|
+
var SearchObjectEventsInput = object({
|
|
18336
|
+
text: string(),
|
|
18337
|
+
deviceId: number().optional(),
|
|
18338
|
+
since: number().optional(),
|
|
18339
|
+
until: number().optional(),
|
|
18340
|
+
classFilter: string().optional(),
|
|
18341
|
+
limit: number().default(50),
|
|
18342
|
+
minScore: number().min(0).max(1).default(.2)
|
|
18183
18343
|
});
|
|
18184
|
-
var
|
|
18185
|
-
|
|
18186
|
-
|
|
18344
|
+
var TrackCascadeCountsSchema = object({
|
|
18345
|
+
/** Persisted track roots deleted (authoritative). */
|
|
18346
|
+
tracks: number().int(),
|
|
18347
|
+
/** Object events removed with their tracks (best-effort; see note above). */
|
|
18348
|
+
events: number().int(),
|
|
18349
|
+
/** Track/face/plate-owned media removed (best-effort). Never identity media. */
|
|
18350
|
+
media: number().int(),
|
|
18351
|
+
/** Unassigned (non-enrolled) face reads removed (best-effort). */
|
|
18352
|
+
faces: number().int(),
|
|
18353
|
+
/** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
|
|
18354
|
+
plates: number().int(),
|
|
18355
|
+
/** Per-track CLIP search vectors removed (best-effort). */
|
|
18356
|
+
embeddings: number().int(),
|
|
18357
|
+
/** Group membership + group rows removed with their last member (best-effort). */
|
|
18358
|
+
groups: number().int()
|
|
18187
18359
|
});
|
|
18188
|
-
|
|
18189
|
-
var
|
|
18190
|
-
|
|
18191
|
-
|
|
18192
|
-
|
|
18193
|
-
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
*/
|
|
18200
|
-
|
|
18360
|
+
/** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
|
|
18361
|
+
var DiskReconcileCountsSchema = object({
|
|
18362
|
+
mediaDropped: number().int(),
|
|
18363
|
+
tracks: number().int(),
|
|
18364
|
+
events: number().int()
|
|
18365
|
+
});
|
|
18366
|
+
/** Event-store footprint for one camera. */
|
|
18367
|
+
var EventStoreDeviceFootprintSchema = object({
|
|
18368
|
+
deviceId: number(),
|
|
18369
|
+
/** Persisted event rows (motion + object + audio) for the camera. */
|
|
18370
|
+
rows: number().int(),
|
|
18371
|
+
/** Event-owned media bytes on disk for the camera. */
|
|
18372
|
+
bytes: number().int()
|
|
18373
|
+
});
|
|
18374
|
+
/** Aggregate event-store footprint: global totals + per-camera breakdown. */
|
|
18375
|
+
var EventStoreFootprintSchema = object({
|
|
18376
|
+
totalRows: number().int(),
|
|
18377
|
+
totalBytes: number().int(),
|
|
18378
|
+
devices: array(EventStoreDeviceFootprintSchema).readonly()
|
|
18201
18379
|
});
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18205
|
-
|
|
18206
|
-
|
|
18380
|
+
/** Per-kind counts returned by the event-prune / device-delete mutations. */
|
|
18381
|
+
var EventPruneCountsSchema = object({
|
|
18382
|
+
motion: number().int(),
|
|
18383
|
+
object: number().int(),
|
|
18384
|
+
audio: number().int()
|
|
18207
18385
|
});
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
|
|
18211
|
-
|
|
18386
|
+
/**
|
|
18387
|
+
* Re-embed stored tracks from their key frames.
|
|
18388
|
+
*
|
|
18389
|
+
* The reason this is an operator-callable method and not a migration script:
|
|
18390
|
+
* every knob that decides what a vector MEANS — encoder model, crop margin,
|
|
18391
|
+
* squaring — is only changeable if the existing vectors can be regenerated.
|
|
18392
|
+
* Mixing feature spaces in one index makes cosine scores incomparable, and the
|
|
18393
|
+
* symptom is a quality regression with no visible cause.
|
|
18394
|
+
*/
|
|
18395
|
+
var RebuildObjectEmbeddingsInput = object({
|
|
18396
|
+
/** Restrict to one camera. Omit for the whole fleet. */
|
|
18397
|
+
deviceId: number().optional(),
|
|
18398
|
+
since: number().optional(),
|
|
18399
|
+
until: number().optional(),
|
|
18400
|
+
/** Stop after this many tracks; the result reports whether more remain. */
|
|
18401
|
+
maxTracks: number().int().positive().optional(),
|
|
18402
|
+
/**
|
|
18403
|
+
* Run every embedding on THIS node instead of round-robining the fleet.
|
|
18404
|
+
*
|
|
18405
|
+
* Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
|
|
18406
|
+
* field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
|
|
18407
|
+
* calling it that would pin the rebuild REQUEST itself to that node — the
|
|
18408
|
+
* rebuild orchestration lives on the hub, and only the per-track step runs
|
|
18409
|
+
* remotely. This field is data; the per-track pin is applied inside.
|
|
18410
|
+
*
|
|
18411
|
+
* Absent ⇒ round-robin over every online node whose runner can serve the
|
|
18412
|
+
* pinned model.
|
|
18413
|
+
*/
|
|
18414
|
+
executeOnNodeId: string().optional(),
|
|
18415
|
+
/**
|
|
18416
|
+
* Milliseconds to wait between tracks; omit for the built-in default, `0` to
|
|
18417
|
+
* run flat out.
|
|
18418
|
+
*
|
|
18419
|
+
* A rebuild is bulk maintenance on hub-main's single thread. Measured
|
|
18420
|
+
* 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
|
|
18421
|
+
* pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
|
|
18422
|
+
* force is logged at start and finish so a deliberately slow pass reads
|
|
18423
|
+
* differently from a stalled one.
|
|
18424
|
+
*/
|
|
18425
|
+
pacingMs: number().int().nonnegative().optional()
|
|
18212
18426
|
});
|
|
18213
18427
|
/**
|
|
18214
|
-
*
|
|
18215
|
-
*
|
|
18216
|
-
*
|
|
18217
|
-
*
|
|
18218
|
-
*
|
|
18219
|
-
*
|
|
18220
|
-
* benchmark UI can still report a clean failure when the classifier
|
|
18221
|
-
* cap isn't available.
|
|
18428
|
+
* Result of emptying the CLIP index.
|
|
18429
|
+
*
|
|
18430
|
+
* The clean slate before a policy change: a new crop margin or encoder model
|
|
18431
|
+
* leaves two feature spaces in one index whose cosine scores are not
|
|
18432
|
+
* comparable, so wiping and rebuilding is the only way to be sure every vector
|
|
18433
|
+
* means the same thing.
|
|
18222
18434
|
*/
|
|
18223
|
-
var
|
|
18224
|
-
|
|
18225
|
-
|
|
18226
|
-
|
|
18435
|
+
var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
|
|
18436
|
+
/**
|
|
18437
|
+
* Acknowledgement that a rebuild STARTED.
|
|
18438
|
+
*
|
|
18439
|
+
* The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
|
|
18440
|
+
* runs detached and this returns immediately. Waiting for it made the client
|
|
18441
|
+
* time out while the work carried on server-side, which is the worst of both:
|
|
18442
|
+
* no result and no way to know it was still going. Poll
|
|
18443
|
+
* `getObjectEmbeddingRebuildStatus` for progress.
|
|
18444
|
+
*/
|
|
18445
|
+
var RebuildObjectEmbeddingsResultSchema = object({
|
|
18446
|
+
started: boolean(),
|
|
18447
|
+
/** True when a pass was already running; the new request is ignored. */
|
|
18448
|
+
alreadyRunning: boolean()
|
|
18227
18449
|
});
|
|
18228
|
-
var
|
|
18229
|
-
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
|
|
18233
|
-
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18450
|
+
var RebuildStatusSchema = object({
|
|
18451
|
+
running: boolean(),
|
|
18452
|
+
scanned: number(),
|
|
18453
|
+
rebuilt: number(),
|
|
18454
|
+
/** Tracks whose key frame is gone — nothing to re-embed from. */
|
|
18455
|
+
missingKeyFrame: number(),
|
|
18456
|
+
/** Tracks with no usable detection box. */
|
|
18457
|
+
missingBbox: number(),
|
|
18458
|
+
/**
|
|
18459
|
+
* Tracks an executing node REFUSED rather than broke on — an unreadable key
|
|
18460
|
+
* frame, a step that threw. Separate from `failed` because the remedy is
|
|
18461
|
+
* different, and because a whole camera silently contributing zero vectors
|
|
18462
|
+
* is the shape of failure a rebuild must never hide.
|
|
18463
|
+
*/
|
|
18464
|
+
notRunnable: number(),
|
|
18465
|
+
/**
|
|
18466
|
+
* The pass stopped because NO node could serve the pinned model.
|
|
18467
|
+
*
|
|
18468
|
+
* Distinct from `notRunnable` on purpose: that one says "this track was
|
|
18469
|
+
* refused", this one says "the cluster cannot do this work at all" — every
|
|
18470
|
+
* candidate node either lacks the `clip-embedding` step, lacks a build of the
|
|
18471
|
+
* pinned model for its engine format, or dropped out. The remedy is a model /
|
|
18472
|
+
* engine change, not a per-camera one. Non-zero here always comes with
|
|
18473
|
+
* `complete: false`.
|
|
18474
|
+
*/
|
|
18475
|
+
noCapableNode: number(),
|
|
18476
|
+
failed: number(),
|
|
18477
|
+
/** Set once a pass ends: true only when EVERYTHING was covered. */
|
|
18478
|
+
complete: boolean().nullable(),
|
|
18479
|
+
startedAtMs: number().nullable(),
|
|
18480
|
+
finishedAtMs: number().nullable(),
|
|
18481
|
+
/** Present when the pass ended by throwing. */
|
|
18482
|
+
error: string().nullable()
|
|
18483
|
+
});
|
|
18484
|
+
var ReplayFrameInputSchema = object({
|
|
18485
|
+
timestamp: number(),
|
|
18486
|
+
frame: PipelineRunResultBridge
|
|
18487
|
+
});
|
|
18488
|
+
var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
|
|
18489
|
+
className: string(),
|
|
18490
|
+
firstSeenMs: number(),
|
|
18491
|
+
lastSeenMs: number(),
|
|
18492
|
+
/** Bbox of the track's FIRST matched detection, pixel-space in the clip's
|
|
18493
|
+
* frame — a representative box for the diff's `(className, window, IoU)`
|
|
18494
|
+
* pairing (`replay-diff.ts`). A replay does not need the full per-frame
|
|
18495
|
+
* trajectory production's `Track.positions` keeps. */
|
|
18496
|
+
bbox: BoundingBoxSchema,
|
|
18497
|
+
/** How many of the input frames this track matched a real detection on
|
|
18498
|
+
* (never a coasted/extrapolated frame) — the replay's own signal for "how
|
|
18499
|
+
* solid is this track", cheaper than re-deriving it from a trajectory. */
|
|
18500
|
+
framesMatched: number().int()
|
|
18501
|
+
})).readonly() });
|
|
18502
|
+
DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
|
|
18503
|
+
deviceId: number(),
|
|
18504
|
+
trackId: string()
|
|
18505
|
+
}), TrackSchema.nullable()), method(object({
|
|
18506
|
+
deviceId: number(),
|
|
18507
|
+
since: number().optional(),
|
|
18508
|
+
until: number().optional(),
|
|
18509
|
+
limit: number().optional(),
|
|
18510
|
+
/** Spatial filter — only tracks whose trajectory intersects the zone
|
|
18511
|
+
* (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
|
|
18512
|
+
* envelope columns, then precisely tested per position. Tracks with
|
|
18513
|
+
* an unknown envelope (no frame dims at persist time) always match. */
|
|
18514
|
+
zone: TrackZoneFilterSchema.optional(),
|
|
18515
|
+
/** See {@link TrackProjectionSchema}. Default `full` (backward
|
|
18516
|
+
* compatible — omitting the field keeps today's exact behaviour). */
|
|
18517
|
+
projection: TrackProjectionSchema.optional(),
|
|
18518
|
+
/** Include stationary-promoted rows (parked objects handed to the
|
|
18519
|
+
* stationary registry). Default false: the timeline lists passages,
|
|
18520
|
+
* not parking records (operator decision, 2026-08-15). */
|
|
18521
|
+
includeStationary: boolean().optional()
|
|
18522
|
+
}), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
|
|
18523
|
+
deviceId: number(),
|
|
18524
|
+
groupId: string().min(1)
|
|
18525
|
+
}), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
|
|
18526
|
+
kind: "mutation",
|
|
18527
|
+
auth: "admin"
|
|
18528
|
+
}), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()), method(object({
|
|
18529
|
+
deviceId: number(),
|
|
18530
|
+
since: number().optional(),
|
|
18531
|
+
until: number().optional(),
|
|
18532
|
+
kinds: array(string()).optional(),
|
|
18533
|
+
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
|
|
18534
|
+
}), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
|
|
18535
|
+
deviceId: number(),
|
|
18536
|
+
since: number(),
|
|
18537
|
+
until: number(),
|
|
18538
|
+
bucketMs: number().int().positive()
|
|
18539
|
+
}), array(object({
|
|
18540
|
+
bucketStart: number(),
|
|
18541
|
+
motion: number().int(),
|
|
18542
|
+
object: number().int(),
|
|
18543
|
+
audio: number().int()
|
|
18544
|
+
})).readonly()), method(object({
|
|
18545
|
+
deviceId: number(),
|
|
18546
|
+
cutoffMs: number()
|
|
18547
|
+
}), object({
|
|
18548
|
+
motion: number().int(),
|
|
18549
|
+
object: number().int(),
|
|
18550
|
+
audio: number().int()
|
|
18551
|
+
}), {
|
|
18552
|
+
kind: "mutation",
|
|
18553
|
+
auth: "admin"
|
|
18554
|
+
}), method(object({
|
|
18555
|
+
deviceId: number(),
|
|
18556
|
+
cutoffMs: number()
|
|
18557
|
+
}), TrackCascadeCountsSchema, {
|
|
18558
|
+
kind: "mutation",
|
|
18559
|
+
auth: "admin"
|
|
18560
|
+
}), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
|
|
18561
|
+
kind: "mutation",
|
|
18562
|
+
auth: "admin"
|
|
18563
|
+
}), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
|
|
18564
|
+
kind: "mutation",
|
|
18565
|
+
auth: "admin"
|
|
18566
|
+
}), method(object({
|
|
18567
|
+
deviceId: number(),
|
|
18568
|
+
trackIds: array(string()).min(1)
|
|
18569
|
+
}), object({
|
|
18570
|
+
deleted: number().int(),
|
|
18571
|
+
failed: array(string()).readonly()
|
|
18572
|
+
}), {
|
|
18573
|
+
kind: "mutation",
|
|
18574
|
+
auth: "admin"
|
|
18575
|
+
}), method(object({
|
|
18576
|
+
/** Log/audit scope only — the trackId is globally unique on its own. */
|
|
18577
|
+
deviceId: number(),
|
|
18578
|
+
trackId: string(),
|
|
18579
|
+
flags: TrackFlagsPatchSchema
|
|
18580
|
+
}), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
|
|
18581
|
+
kind: "query",
|
|
18582
|
+
auth: "admin"
|
|
18583
|
+
}), method(object({
|
|
18584
|
+
olderThanMs: number(),
|
|
18585
|
+
reason: OpsLogReasonSchema.optional()
|
|
18586
|
+
}), EventPruneCountsSchema, {
|
|
18587
|
+
kind: "mutation",
|
|
18588
|
+
auth: "admin"
|
|
18589
|
+
}), method(object({ deviceId: number() }), EventPruneCountsSchema, {
|
|
18590
|
+
kind: "mutation",
|
|
18591
|
+
auth: "admin"
|
|
18592
|
+
}), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
|
|
18593
|
+
kind: "mutation",
|
|
18594
|
+
auth: "admin"
|
|
18595
|
+
}), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
|
|
18596
|
+
kind: "mutation",
|
|
18597
|
+
auth: "admin"
|
|
18598
|
+
}), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
|
|
18599
|
+
kind: "mutation",
|
|
18600
|
+
auth: "admin"
|
|
18601
|
+
}), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
|
|
18602
|
+
kind: "mutation",
|
|
18603
|
+
auth: "admin"
|
|
18604
|
+
}), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
18605
|
+
kind: "mutation",
|
|
18606
|
+
auth: "admin"
|
|
18607
|
+
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
18608
|
+
kind: "mutation",
|
|
18609
|
+
auth: "admin"
|
|
18610
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
18611
|
+
kind: "query",
|
|
18612
|
+
auth: "admin"
|
|
18613
|
+
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
18614
|
+
kind: "mutation",
|
|
18615
|
+
auth: "admin"
|
|
18616
|
+
}), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
18617
|
+
kind: "query",
|
|
18618
|
+
auth: "admin"
|
|
18619
|
+
}), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
|
|
18620
|
+
kind: "query",
|
|
18621
|
+
auth: "admin"
|
|
18622
|
+
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
18623
|
+
kind: "query",
|
|
18624
|
+
auth: "admin"
|
|
18625
|
+
}), method(object({
|
|
18626
|
+
/** Empty ⇒ every camera that has staging tracks. A LIST, not a single
|
|
18627
|
+
* `deviceId`, deliberately: `deviceId` would make this device-bound and
|
|
18628
|
+
* route it at one camera's owner, and "every camera" would stop being
|
|
18629
|
+
* expressible at all. */
|
|
18630
|
+
deviceIds: array(number()).optional(),
|
|
18631
|
+
limit: number().int().min(1).max(500).optional()
|
|
18632
|
+
}), array(RetrainTrackSchema).readonly(), {
|
|
18633
|
+
kind: "query",
|
|
18634
|
+
auth: "admin"
|
|
18635
|
+
}), method(object({ trackId: string() }), RetrainFrameListSchema, {
|
|
18636
|
+
kind: "query",
|
|
18637
|
+
auth: "admin"
|
|
18638
|
+
}), method(object({
|
|
18639
|
+
deviceId: number(),
|
|
18640
|
+
trackId: string(),
|
|
18641
|
+
mediaKeys: array(string()).min(1)
|
|
18642
|
+
}), RetrainFrameSelectionSchema, {
|
|
18241
18643
|
kind: "mutation",
|
|
18242
18644
|
auth: "admin"
|
|
18243
|
-
}), method(object({
|
|
18244
|
-
|
|
18245
|
-
|
|
18645
|
+
}), method(object({
|
|
18646
|
+
deviceId: number(),
|
|
18647
|
+
trackId: string(),
|
|
18648
|
+
frameId: string()
|
|
18649
|
+
}), object({
|
|
18650
|
+
removed: boolean(),
|
|
18651
|
+
removedAnnotations: number().int()
|
|
18246
18652
|
}), {
|
|
18247
18653
|
kind: "mutation",
|
|
18248
18654
|
auth: "admin"
|
|
18249
|
-
}), method(
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
}),
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
format: ModelFormatSchema$1
|
|
18265
|
-
}), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
18266
|
-
engine: PipelineEngineChoiceSchema.optional(),
|
|
18267
|
-
steps: array(PipelineStepInputSchema).min(1),
|
|
18268
|
-
frame: FrameInputSchema.optional(),
|
|
18269
|
-
/**
|
|
18270
|
-
* Process-local lazy frame. Valid only when caller and provider resolve
|
|
18271
|
-
* in the same execution-group process; split/cross-node callers use
|
|
18272
|
-
* `frame`/`image` inline compatibility instead.
|
|
18273
|
-
*/
|
|
18274
|
-
frameRef: FrameRefSchema.optional(),
|
|
18275
|
-
/**
|
|
18276
|
-
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
18277
|
-
* the decoded pixels live in. One more member of the one-of
|
|
18278
|
-
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
18279
|
-
*/
|
|
18280
|
-
frameHandle: FrameHandleSchema.optional(),
|
|
18281
|
-
imageBase64: string().optional(),
|
|
18282
|
-
/**
|
|
18283
|
-
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
18284
|
-
* hops (hub → forked worker via Moleculer MsgPack) because it
|
|
18285
|
-
* skips the 33% base64 overhead + the per-call base64 decode on
|
|
18286
|
-
* the detection-pipeline worker. Callers can pass either; exactly
|
|
18287
|
-
* one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
|
|
18288
|
-
*/
|
|
18289
|
-
image: _instanceof(Uint8Array).optional(),
|
|
18290
|
-
referenceImage: string().optional(),
|
|
18291
|
-
deviceId: number().optional(),
|
|
18292
|
-
sessionId: string().optional(),
|
|
18293
|
-
/**
|
|
18294
|
-
* Execution plane. 'full' (default) runs the whole tree — benchmark,
|
|
18295
|
-
* reference-image, and detail-subtree calls. 'frame' is the live
|
|
18296
|
-
* per-frame dispatch: ONLY root-plane steps run; crop children
|
|
18297
|
-
* (inputClasses ≠ null) are skipped and served per-track via
|
|
18298
|
-
* pipelineRunner.runDetailSubtree (two-plane design).
|
|
18299
|
-
*/
|
|
18300
|
-
plane: _enum(["full", "frame"]).optional(),
|
|
18301
|
-
/**
|
|
18302
|
-
* Inference-device selector (Phase 2 multi-device). Format
|
|
18303
|
-
* `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
|
|
18304
|
-
* Omitted ⇒ the runner's default device (current single-engine
|
|
18305
|
-
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
18306
|
-
*/
|
|
18307
|
-
deviceKey: string().optional(),
|
|
18308
|
-
/**
|
|
18309
|
-
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
18310
|
-
* when the parent crop was resolved from the frame's retained NATIVE
|
|
18311
|
-
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
18312
|
-
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
18313
|
-
* resolution from that surface — the SAME quality path faces already
|
|
18314
|
-
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
18315
|
-
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
18316
|
-
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
18317
|
-
* the executor's crop-normalized child ROI back into frame-normalized
|
|
18318
|
-
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
18319
|
-
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
18320
|
-
* (today's behaviour on the fallback path).
|
|
18321
|
-
*/
|
|
18322
|
-
nativeCropRef: NativeCropRefSchema.optional()
|
|
18323
|
-
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
18324
|
-
engine: PipelineEngineChoiceSchema.optional(),
|
|
18325
|
-
steps: array(PipelineStepInputSchema).min(1),
|
|
18326
|
-
frames: array(FrameInputSchema).min(1).max(255),
|
|
18327
|
-
deviceId: number().optional(),
|
|
18328
|
-
sessionId: string().optional(),
|
|
18329
|
-
/**
|
|
18330
|
-
* Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
|
|
18331
|
-
* the batch to the Python pool's bench preprocess cache
|
|
18332
|
-
* (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
|
|
18333
|
-
* preprocessed ONCE and every later inference is a pure-inference cache
|
|
18334
|
-
* hit — the sustained-throughput run measures inference, not
|
|
18335
|
-
* decode+preprocess+infer. Omitted/0 for live frames (all different →
|
|
18336
|
-
* full preprocess every call, correct). Fresh per sustained run;
|
|
18337
|
-
* released via `uncacheFrame`.
|
|
18338
|
-
*/
|
|
18339
|
-
frameId: number().int().nonnegative().optional(),
|
|
18340
|
-
/** Inference-device selector (Phase 2 multi-device); see runPipeline. */
|
|
18341
|
-
deviceKey: string().optional()
|
|
18342
|
-
}), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
|
|
18343
|
-
data: _instanceof(Uint8Array),
|
|
18344
|
-
width: number().int().positive(),
|
|
18345
|
-
height: number().int().positive(),
|
|
18346
|
-
format: _enum([
|
|
18347
|
-
"rgb",
|
|
18348
|
-
"bgr",
|
|
18349
|
-
"gray"
|
|
18350
|
-
])
|
|
18351
|
-
}), object({
|
|
18352
|
-
frameId: number(),
|
|
18353
|
-
width: number(),
|
|
18354
|
-
height: number()
|
|
18355
|
-
}), { kind: "mutation" }), method(object({
|
|
18356
|
-
stepId: string(),
|
|
18357
|
-
frameId: number().int()
|
|
18358
|
-
}), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
|
|
18359
|
-
batchMode: string(),
|
|
18360
|
-
windowMs: number(),
|
|
18361
|
-
maxBatchSize: number(),
|
|
18362
|
-
concurrency: number()
|
|
18363
|
-
})), method(_void(), array(object({
|
|
18364
|
-
engineKey: string(),
|
|
18365
|
-
engine: PipelineEngineChoiceSchema,
|
|
18366
|
-
modelsLoaded: array(string()).readonly(),
|
|
18367
|
-
inUseByCameras: array(number()).readonly(),
|
|
18368
|
-
/**
|
|
18369
|
-
* Origin of this resident factory.
|
|
18370
|
-
* - `runtime` — main camera-serving engine (no idle TTL).
|
|
18371
|
-
* - `warm-override` — benchmark/test override held in the warm
|
|
18372
|
-
* cache; auto-disposed after the idle TTL.
|
|
18373
|
-
* - `device-pool` — a concurrent per-device pool (Phase 2
|
|
18374
|
-
* multi-device, keyed by `deviceKey`) resolved
|
|
18375
|
-
* via `resolveDeviceFactory`. Runs alongside the
|
|
18376
|
-
* `runtime` engine on a DIFFERENT accelerator
|
|
18377
|
-
* (NPU / iGPU / Coral) — this is how the
|
|
18378
|
-
* Engines tab shows all pools running at once.
|
|
18379
|
-
*/
|
|
18380
|
-
kind: _enum([
|
|
18381
|
-
"runtime",
|
|
18382
|
-
"warm-override",
|
|
18383
|
-
"device-pool"
|
|
18384
|
-
]),
|
|
18385
|
-
/** Native pid of the underlying Python pool (null when no pool). */
|
|
18386
|
-
poolPid: number().nullable(),
|
|
18387
|
-
/** ms since this factory was last used (null when not warm-tracked). */
|
|
18388
|
-
idleMs: number().nullable(),
|
|
18389
|
-
/** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
|
|
18390
|
-
idleTtlMs: number().nullable()
|
|
18391
|
-
})).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
|
|
18655
|
+
}), method(object({ frameId: string() }), object({
|
|
18656
|
+
base64: string(),
|
|
18657
|
+
width: number().int(),
|
|
18658
|
+
height: number().int()
|
|
18659
|
+
}), {
|
|
18660
|
+
kind: "query",
|
|
18661
|
+
auth: "admin"
|
|
18662
|
+
}), method(object({
|
|
18663
|
+
deviceId: number(),
|
|
18664
|
+
trackId: string(),
|
|
18665
|
+
frameId: string(),
|
|
18666
|
+
subject: RetrainAssistSubjectSchema,
|
|
18667
|
+
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
18668
|
+
nodeId: string().optional()
|
|
18669
|
+
}), RetrainAssistResultSchema, {
|
|
18392
18670
|
kind: "mutation",
|
|
18393
18671
|
auth: "admin"
|
|
18394
18672
|
}), method(object({
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18673
|
+
deviceId: number(),
|
|
18674
|
+
source: DetectionSourceSchema,
|
|
18675
|
+
zones: array(ZoneSchema).readonly().optional(),
|
|
18676
|
+
detectionRules: array(ZoneRuleSchema).readonly().optional(),
|
|
18677
|
+
zoneMembershipMinOverlap: number().min(0).max(1).optional(),
|
|
18678
|
+
frames: array(ReplayFrameInputSchema).min(1)
|
|
18679
|
+
}), RunReplayFrameProcessorResultSchema, {
|
|
18401
18680
|
kind: "mutation",
|
|
18402
18681
|
auth: "admin"
|
|
18403
|
-
}), method(
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18682
|
+
}), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
18683
|
+
kind: "query",
|
|
18684
|
+
auth: "admin"
|
|
18685
|
+
}), method(object({
|
|
18686
|
+
deviceId: number(),
|
|
18687
|
+
trackId: string(),
|
|
18688
|
+
frameId: string(),
|
|
18689
|
+
annotations: array(RetrainAnnotationDraftSchema)
|
|
18690
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
18691
|
+
kind: "mutation",
|
|
18692
|
+
auth: "admin"
|
|
18693
|
+
}), method(object({
|
|
18694
|
+
deviceId: number(),
|
|
18695
|
+
trackId: string()
|
|
18696
|
+
}), RetrainTransitionResultSchema, {
|
|
18697
|
+
kind: "mutation",
|
|
18698
|
+
auth: "admin"
|
|
18699
|
+
}), method(object({
|
|
18700
|
+
deviceId: number(),
|
|
18701
|
+
trackId: string()
|
|
18702
|
+
}), RetrainTransitionResultSchema, {
|
|
18703
|
+
kind: "mutation",
|
|
18704
|
+
auth: "admin"
|
|
18705
|
+
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
18706
|
+
kind: "query",
|
|
18707
|
+
auth: "admin"
|
|
18708
|
+
}), method(object({
|
|
18709
|
+
eventId: string(),
|
|
18710
|
+
kind: MediaFileKindEnum.optional(),
|
|
18711
|
+
deviceId: number()
|
|
18712
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
18713
|
+
trackId: string(),
|
|
18714
|
+
kinds: array(MediaFileKindEnum).optional(),
|
|
18715
|
+
deviceId: number()
|
|
18716
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
18717
|
+
trackId: string(),
|
|
18718
|
+
deviceId: number()
|
|
18719
|
+
}), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
18720
|
+
kind: "mutation",
|
|
18721
|
+
auth: "admin"
|
|
18722
|
+
}), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
18723
|
+
kind: "mutation",
|
|
18724
|
+
auth: "admin"
|
|
18725
|
+
}), method(object({}), RebuildStatusSchema), object({
|
|
18726
|
+
deviceId: number(),
|
|
18727
|
+
timestamp: number(),
|
|
18728
|
+
frameWidth: number(),
|
|
18729
|
+
frameHeight: number(),
|
|
18730
|
+
detections: array(OverlayDetectionSchema).readonly()
|
|
18731
|
+
}), object({
|
|
18732
|
+
deviceId: number(),
|
|
18733
|
+
trackId: string(),
|
|
18734
|
+
className: string()
|
|
18735
|
+
}), object({
|
|
18736
|
+
deviceId: number(),
|
|
18737
|
+
trackId: string(),
|
|
18738
|
+
className: string(),
|
|
18739
|
+
durationMs: number()
|
|
18740
|
+
}), object({
|
|
18741
|
+
deviceId: number(),
|
|
18742
|
+
kind: EventKindSchema,
|
|
18743
|
+
eventId: string(),
|
|
18744
|
+
timestamp: number()
|
|
18745
|
+
});
|
|
18409
18746
|
object({
|
|
18410
18747
|
activeCameras: number(),
|
|
18411
18748
|
throttledCameras: number(),
|
|
@@ -18431,106 +18768,6 @@ var CameraMetricsSchema = object({
|
|
|
18431
18768
|
});
|
|
18432
18769
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
18433
18770
|
/**
|
|
18434
|
-
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
18435
|
-
*
|
|
18436
|
-
* Zones describe **where** in the frame the operator wants to flag
|
|
18437
|
-
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
18438
|
-
* each pipeline stage uses them. Splitting the two means a single
|
|
18439
|
-
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
18440
|
-
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
18441
|
-
* — without three duplicated polygons.
|
|
18442
|
-
*
|
|
18443
|
-
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
18444
|
-
* `zones` device-state slice on every mutation. Consumers
|
|
18445
|
-
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
18446
|
-
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
18447
|
-
* mirror with `onChanged`).
|
|
18448
|
-
*
|
|
18449
|
-
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
18450
|
-
* survive resolution changes and stream profile switches.
|
|
18451
|
-
*
|
|
18452
|
-
* `kind` discriminates between full polygons (closed regions used
|
|
18453
|
-
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
18454
|
-
* line segments used for cross events). Onboard / firmware-reported
|
|
18455
|
-
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
18456
|
-
* task list.
|
|
18457
|
-
*/
|
|
18458
|
-
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
18459
|
-
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
18460
|
-
var PolygonPointSchema = object({
|
|
18461
|
-
x: number(),
|
|
18462
|
-
y: number()
|
|
18463
|
-
});
|
|
18464
|
-
/** A camera detection zone — pure geometry/identity. */
|
|
18465
|
-
var ZoneSchema = object({
|
|
18466
|
-
id: string(),
|
|
18467
|
-
name: string(),
|
|
18468
|
-
kind: ZoneKindEnum.default("polygon"),
|
|
18469
|
-
/** Polygon vertices, fraction of frame (0–1). */
|
|
18470
|
-
polygon: array(PolygonPointSchema).readonly(),
|
|
18471
|
-
/** Visual color for UI rendering. */
|
|
18472
|
-
color: string().default("#3b82f6")
|
|
18473
|
-
});
|
|
18474
|
-
/**
|
|
18475
|
-
* Zones capability — per-camera CRUD over polygon detection zones.
|
|
18476
|
-
*
|
|
18477
|
-
* Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
|
|
18478
|
-
* to per-device settings and mirrors into the `zones` device-state
|
|
18479
|
-
* slice on every mutation, so downstream consumers can subscribe via
|
|
18480
|
-
* `dev.state.zones.onChanged`.
|
|
18481
|
-
*
|
|
18482
|
-
* The cap surface only handles geometry + identity; filtering
|
|
18483
|
-
* behaviour (per-class, include/exclude, threshold) lives in the
|
|
18484
|
-
* consumer addons' rule arrays — see `ZoneRuleSchema` exported from
|
|
18485
|
-
* `capabilities/schemas/zone-rule.js`.
|
|
18486
|
-
*/
|
|
18487
|
-
var zonesCapability = {
|
|
18488
|
-
name: "zones",
|
|
18489
|
-
scope: "device",
|
|
18490
|
-
mode: "singleton",
|
|
18491
|
-
deviceTypes: [DeviceType.Camera],
|
|
18492
|
-
methods: {
|
|
18493
|
-
listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
|
|
18494
|
-
addZone: method(object({
|
|
18495
|
-
deviceId: number(),
|
|
18496
|
-
zone: ZoneSchema
|
|
18497
|
-
}), _void(), {
|
|
18498
|
-
kind: "mutation",
|
|
18499
|
-
auth: "admin"
|
|
18500
|
-
}),
|
|
18501
|
-
removeZone: method(object({
|
|
18502
|
-
deviceId: number(),
|
|
18503
|
-
zoneId: string()
|
|
18504
|
-
}), _void(), {
|
|
18505
|
-
kind: "mutation",
|
|
18506
|
-
auth: "admin"
|
|
18507
|
-
}),
|
|
18508
|
-
updateZone: method(object({
|
|
18509
|
-
deviceId: number(),
|
|
18510
|
-
zone: ZoneSchema
|
|
18511
|
-
}), _void(), {
|
|
18512
|
-
kind: "mutation",
|
|
18513
|
-
auth: "admin"
|
|
18514
|
-
})
|
|
18515
|
-
},
|
|
18516
|
-
/**
|
|
18517
|
-
* Runtime-state slice — the live zone catalogue mirrored by the
|
|
18518
|
-
* orchestrator on every CRUD mutation. Consumers read via
|
|
18519
|
-
* `device.state.zones.value` / `.watch(...)` without round-tripping
|
|
18520
|
-
* the cap, and the codegen DeviceProxy auto-wires the reactive
|
|
18521
|
-
* handle. Slice shape is `{ zones: Zone[] }` so future extensions
|
|
18522
|
-
* (e.g. zone groupings) can sit alongside the polygon list.
|
|
18523
|
-
*/
|
|
18524
|
-
runtimeState: object({ zones: array(ZoneSchema).readonly() }),
|
|
18525
|
-
/**
|
|
18526
|
-
* 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.
|
|
18527
|
-
*
|
|
18528
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
18529
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
18530
|
-
*/
|
|
18531
|
-
durability: "restored"
|
|
18532
|
-
};
|
|
18533
|
-
/**
|
|
18534
18771
|
* A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
|
|
18535
18772
|
* decode worker resolves it against the RETAINED native frame's real pixel dims,
|
|
18536
18773
|
* so the caller supplies only the detection-res bbox divided by the detection
|
|
@@ -27285,6 +27522,39 @@ var ReadGopBytesResultSchema = object({
|
|
|
27285
27522
|
/** Media ms the returned fragment covers. */
|
|
27286
27523
|
gopDurMs: number()
|
|
27287
27524
|
});
|
|
27525
|
+
/**
|
|
27526
|
+
* A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
|
|
27527
|
+
* twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
|
|
27528
|
+
* replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
|
|
27529
|
+
* a replay needs several seconds of native pixels, not one frame.
|
|
27530
|
+
*
|
|
27531
|
+
* `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
|
|
27532
|
+
* is `false` when the returned bytes were cut short by the read's own safety
|
|
27533
|
+
* byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
|
|
27534
|
+
* silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
|
|
27535
|
+
* degradation: a window whose end falls past the covering segment would need
|
|
27536
|
+
* bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
|
|
27537
|
+
* not one standalone-demuxable stream — the caller's answer is to request a
|
|
27538
|
+
* shorter window or one aligned to a single segment, not to receive spliced
|
|
27539
|
+
* bytes nothing has proven decodable.
|
|
27540
|
+
*/
|
|
27541
|
+
var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
|
|
27542
|
+
kind: literal("ok"),
|
|
27543
|
+
data: _instanceof(Uint8Array),
|
|
27544
|
+
/** Absolute epoch ms of the returned bytes' first sample — at or before
|
|
27545
|
+
* the requested `fromMs` (anchored on the nearest keyframe). */
|
|
27546
|
+
gopStartMs: number(),
|
|
27547
|
+
/** Media ms the returned bytes cover, from `gopStartMs`. */
|
|
27548
|
+
gopDurMs: number(),
|
|
27549
|
+
/** `false` ⇒ the safety byte cap cut the read short before it reached
|
|
27550
|
+
* the requested `toMs`; the caller got fewer frames than asked for. */
|
|
27551
|
+
reachesRequestedEnd: boolean()
|
|
27552
|
+
}), object({
|
|
27553
|
+
kind: literal("spans-multiple-segments"),
|
|
27554
|
+
/** Where the covering segment's own footage runs out — informational,
|
|
27555
|
+
* not a retry hint (retrying the same window would refuse again). */
|
|
27556
|
+
segmentEndMs: number()
|
|
27557
|
+
})]);
|
|
27288
27558
|
method(object({
|
|
27289
27559
|
deviceId: number(),
|
|
27290
27560
|
fromMs: number(),
|
|
@@ -27335,6 +27605,15 @@ method(object({
|
|
|
27335
27605
|
}), ReadGopBytesResultSchema, {
|
|
27336
27606
|
kind: "query",
|
|
27337
27607
|
auth: "admin"
|
|
27608
|
+
}), method(object({
|
|
27609
|
+
deviceId: number(),
|
|
27610
|
+
profile: string(),
|
|
27611
|
+
startMs: number(),
|
|
27612
|
+
fromMs: number(),
|
|
27613
|
+
toMs: number()
|
|
27614
|
+
}), ReadWindowBytesResultSchema, {
|
|
27615
|
+
kind: "query",
|
|
27616
|
+
auth: "admin"
|
|
27338
27617
|
}), method(object({
|
|
27339
27618
|
deviceId: number(),
|
|
27340
27619
|
config: RecordingConfigSchema
|
|
@@ -27930,92 +28209,6 @@ var sceneMonitorCapability = {
|
|
|
27930
28209
|
durability: "session"
|
|
27931
28210
|
};
|
|
27932
28211
|
/**
|
|
27933
|
-
* Per-stage gating mode applied to the zones a rule references.
|
|
27934
|
-
*
|
|
27935
|
-
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
27936
|
-
* When at least one `include` rule fires for a stage, only entities
|
|
27937
|
-
* inside one of those zones pass that stage.
|
|
27938
|
-
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
27939
|
-
* Entities inside one of those zones are dropped at that stage.
|
|
27940
|
-
*
|
|
27941
|
-
* `monitor`-style observation (count without filtering) is not a rule
|
|
27942
|
-
* mode — zones without any matching rule are observed naturally by
|
|
27943
|
-
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
27944
|
-
* count, not filter" use case needs no rule at all.
|
|
27945
|
-
*/
|
|
27946
|
-
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
27947
|
-
/**
|
|
27948
|
-
* Per-consumer rule that references existing zones (geometry) and
|
|
27949
|
-
* defines how a specific pipeline stage should treat them. Each
|
|
27950
|
-
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
27951
|
-
* settings:
|
|
27952
|
-
*
|
|
27953
|
-
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
27954
|
-
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
27955
|
-
* - future: notification rules, audio gating, etc.
|
|
27956
|
-
*
|
|
27957
|
-
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
27958
|
-
* express "ignore motion in ALL of {garden, street}" with a single
|
|
27959
|
-
* rule. `classFilter` narrows the rule to specific object classes —
|
|
27960
|
-
* "drop person detections in the street, but keep cars" is one
|
|
27961
|
-
* `exclude` rule with `classFilter: ['person']`.
|
|
27962
|
-
*
|
|
27963
|
-
* `enabled` is a soft toggle — the operator can keep the rule
|
|
27964
|
-
* configured but inert without deleting it.
|
|
27965
|
-
*/
|
|
27966
|
-
var ZoneRuleSchema = object({
|
|
27967
|
-
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
27968
|
-
id: string(),
|
|
27969
|
-
/** Optional human-readable label rendered in the rule editor. */
|
|
27970
|
-
name: string().optional(),
|
|
27971
|
-
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
27972
|
-
* listed zones (OR-set: a detection in any one of them counts).
|
|
27973
|
-
* At least one zone id required — a rule with no targets is a
|
|
27974
|
-
* configuration mistake and the form validator rejects it. */
|
|
27975
|
-
zoneIds: array(string()).min(1).readonly(),
|
|
27976
|
-
mode: ZoneRuleModeEnum,
|
|
27977
|
-
/**
|
|
27978
|
-
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
27979
|
-
* applies to every class. Class strings match the `macroClass`
|
|
27980
|
-
* field on detections (e.g. `person`, `car`, `dog`).
|
|
27981
|
-
*/
|
|
27982
|
-
classFilter: array(string()).readonly().optional(),
|
|
27983
|
-
/**
|
|
27984
|
-
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
27985
|
-
* required to consider an entity "in the zone". Defaults to the
|
|
27986
|
-
* consumer's stage default when omitted. Kept for back-compat with
|
|
27987
|
-
* existing per-rule overrides; new operators pick the value via
|
|
27988
|
-
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
27989
|
-
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
27990
|
-
*/
|
|
27991
|
-
overlapThreshold: number().min(0).max(1).optional(),
|
|
27992
|
-
/**
|
|
27993
|
-
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
27994
|
-
* of the detection's bbox that must lie inside the zone for the
|
|
27995
|
-
* rule to match. Documented default is 85%; the engine substitutes
|
|
27996
|
-
* that when the field is omitted (kept optional so existing rules
|
|
27997
|
-
* stored without it stay valid).
|
|
27998
|
-
*
|
|
27999
|
-
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
28000
|
-
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
28001
|
-
* field exposed in the UI. Internally both feed the same gate.
|
|
28002
|
-
*/
|
|
28003
|
-
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
28004
|
-
/**
|
|
28005
|
-
* When `true` and a detection has a segmentation mask, use the
|
|
28006
|
-
* mask for overlap instead of the bbox. Detection-stage only;
|
|
28007
|
-
* motion rules ignore this field.
|
|
28008
|
-
*/
|
|
28009
|
-
preferMask: boolean().optional(),
|
|
28010
|
-
/**
|
|
28011
|
-
* Soft-toggle: `false` disables the rule without deleting it.
|
|
28012
|
-
* Defaults to `true` so operators creating a rule via the UI
|
|
28013
|
-
* see it active immediately.
|
|
28014
|
-
*/
|
|
28015
|
-
enabled: boolean().default(true)
|
|
28016
|
-
});
|
|
28017
|
-
array(ZoneRuleSchema).readonly();
|
|
28018
|
-
/**
|
|
28019
28212
|
* Script-runner cap. Models HA `script.*` entities on
|
|
28020
28213
|
* `DeviceType.Script`. A Script is a pre-recorded action sequence
|
|
28021
28214
|
* that can be invoked imperatively — optionally with a variables
|
|
@@ -33508,6 +33701,12 @@ Object.freeze({
|
|
|
33508
33701
|
addonId: null,
|
|
33509
33702
|
access: "view"
|
|
33510
33703
|
},
|
|
33704
|
+
"notificationRules.resolveArtifactUrl": {
|
|
33705
|
+
capName: "notification-rules",
|
|
33706
|
+
capScope: "system",
|
|
33707
|
+
addonId: null,
|
|
33708
|
+
access: "view"
|
|
33709
|
+
},
|
|
33511
33710
|
"notificationRules.setAlarmConfig": {
|
|
33512
33711
|
capName: "notification-rules",
|
|
33513
33712
|
capScope: "system",
|
|
@@ -33952,6 +34151,12 @@ Object.freeze({
|
|
|
33952
34151
|
addonId: null,
|
|
33953
34152
|
access: "create"
|
|
33954
34153
|
},
|
|
34154
|
+
"pipelineAnalytics.runReplayFrameProcessor": {
|
|
34155
|
+
capName: "pipeline-analytics",
|
|
34156
|
+
capScope: "device",
|
|
34157
|
+
addonId: null,
|
|
34158
|
+
access: "create"
|
|
34159
|
+
},
|
|
33955
34160
|
"pipelineAnalytics.saveRetrainAnnotations": {
|
|
33956
34161
|
capName: "pipeline-analytics",
|
|
33957
34162
|
capScope: "device",
|
|
@@ -34084,6 +34289,12 @@ Object.freeze({
|
|
|
34084
34289
|
addonId: null,
|
|
34085
34290
|
access: "view"
|
|
34086
34291
|
},
|
|
34292
|
+
"pipelineExecutor.getInferenceDeviceHealth": {
|
|
34293
|
+
capName: "pipeline-executor",
|
|
34294
|
+
capScope: "system",
|
|
34295
|
+
addonId: null,
|
|
34296
|
+
access: "view"
|
|
34297
|
+
},
|
|
34087
34298
|
"pipelineExecutor.getOrchestratorConfigSchema": {
|
|
34088
34299
|
capName: "pipeline-executor",
|
|
34089
34300
|
capScope: "system",
|
|
@@ -34156,6 +34367,12 @@ Object.freeze({
|
|
|
34156
34367
|
addonId: null,
|
|
34157
34368
|
access: "view"
|
|
34158
34369
|
},
|
|
34370
|
+
"pipelineExecutor.rearmInferenceDevice": {
|
|
34371
|
+
capName: "pipeline-executor",
|
|
34372
|
+
capScope: "system",
|
|
34373
|
+
addonId: null,
|
|
34374
|
+
access: "create"
|
|
34375
|
+
},
|
|
34159
34376
|
"pipelineExecutor.runAudioTest": {
|
|
34160
34377
|
capName: "pipeline-executor",
|
|
34161
34378
|
capScope: "system",
|
|
@@ -34894,6 +35111,12 @@ Object.freeze({
|
|
|
34894
35111
|
addonId: null,
|
|
34895
35112
|
access: "view"
|
|
34896
35113
|
},
|
|
35114
|
+
"recording.readWindowBytes": {
|
|
35115
|
+
capName: "recording",
|
|
35116
|
+
capScope: "system",
|
|
35117
|
+
addonId: null,
|
|
35118
|
+
access: "view"
|
|
35119
|
+
},
|
|
34897
35120
|
"recording.refreshStorageLocationsForMigration": {
|
|
34898
35121
|
capName: "recording",
|
|
34899
35122
|
capScope: "system",
|
|
@@ -37404,6 +37627,11 @@ Object.freeze({
|
|
|
37404
37627
|
form: "single",
|
|
37405
37628
|
optional: false
|
|
37406
37629
|
}],
|
|
37630
|
+
"pipelineAnalytics.runReplayFrameProcessor": [{
|
|
37631
|
+
name: "deviceId",
|
|
37632
|
+
form: "single",
|
|
37633
|
+
optional: false
|
|
37634
|
+
}],
|
|
37407
37635
|
"pipelineAnalytics.saveRetrainAnnotations": [{
|
|
37408
37636
|
name: "deviceId",
|
|
37409
37637
|
form: "single",
|
|
@@ -37719,6 +37947,11 @@ Object.freeze({
|
|
|
37719
37947
|
form: "single",
|
|
37720
37948
|
optional: false
|
|
37721
37949
|
}],
|
|
37950
|
+
"recording.readWindowBytes": [{
|
|
37951
|
+
name: "deviceId",
|
|
37952
|
+
form: "single",
|
|
37953
|
+
optional: false
|
|
37954
|
+
}],
|
|
37722
37955
|
"recording.relocateFootage": [{
|
|
37723
37956
|
name: "deviceId",
|
|
37724
37957
|
form: "single",
|
|
@@ -38828,6 +39061,12 @@ Object.defineProperty(exports, "BaseDeviceProvider", {
|
|
|
38828
39061
|
return BaseDeviceProvider;
|
|
38829
39062
|
}
|
|
38830
39063
|
});
|
|
39064
|
+
Object.defineProperty(exports, "CAMERA_SWITCH_ORDER", {
|
|
39065
|
+
enumerable: true,
|
|
39066
|
+
get: function() {
|
|
39067
|
+
return CAMERA_SWITCH_ORDER;
|
|
39068
|
+
}
|
|
39069
|
+
});
|
|
38831
39070
|
Object.defineProperty(exports, "COCO_TO_MACRO", {
|
|
38832
39071
|
enumerable: true,
|
|
38833
39072
|
get: function() {
|
|
@@ -39134,6 +39373,12 @@ Object.defineProperty(exports, "motionCapability", {
|
|
|
39134
39373
|
return motionCapability;
|
|
39135
39374
|
}
|
|
39136
39375
|
});
|
|
39376
|
+
Object.defineProperty(exports, "nodePin", {
|
|
39377
|
+
enumerable: true,
|
|
39378
|
+
get: function() {
|
|
39379
|
+
return nodePin;
|
|
39380
|
+
}
|
|
39381
|
+
});
|
|
39137
39382
|
Object.defineProperty(exports, "normalizeUnit", {
|
|
39138
39383
|
enumerable: true,
|
|
39139
39384
|
get: function() {
|