@camstack/addon-provider-hikvision 1.2.36 → 1.2.38

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.
Files changed (3) hide show
  1. package/dist/addon.js +1968 -1820
  2. package/dist/addon.mjs +1968 -1820
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -15964,7 +15964,23 @@ var NcHistoryEntrySchema = object({
15964
15964
  updatedAt: number(),
15965
15965
  /** Failure detail — present on a `dead` row. */
15966
15966
  error: string().optional(),
15967
- subject: NcHistorySubjectSchema
15967
+ subject: NcHistorySubjectSchema,
15968
+ /**
15969
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
15970
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
15971
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
15972
+ * every delivery attempt). Absent on a row still pending/dead, a row
15973
+ * delivered before this field shipped, or a wiring with no artefact index.
15974
+ *
15975
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
15976
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
15977
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
15978
+ * also answers `null` for an id whose artefact has since expired past the
15979
+ * retained shelf's own age bound — the degrade a caller (the Home
15980
+ * Assistant export) must render as "no image right now", never as a
15981
+ * broken link.
15982
+ */
15983
+ artifactIds: array(string().min(1)).optional()
15968
15984
  });
15969
15985
  /**
15970
15986
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16191,7 +16207,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
16191
16207
  }), method(object({}), object({
16192
16208
  catalog: array(NcConditionDescriptorSchema),
16193
16209
  taxonomy: NcTaxonomySchema.optional()
16194
- })), 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 }), {
16210
+ })), 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 }), {
16195
16211
  kind: "mutation",
16196
16212
  caller: "required"
16197
16213
  }), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
@@ -16531,1760 +16547,1996 @@ var OauthIntegrationDescriptorSchema = object({
16531
16547
  });
16532
16548
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
16533
16549
  /**
16534
- * pipeline-analytics device-scoped wrapper cap. Refines raw
16535
- * per-frame detections emitted by the pipeline runner into tracked
16536
- * objects, per-kind event collections (motion / object / audio), and
16537
- * persisted media. Owns the post-detection domain end-to-end:
16538
- *
16539
- * runner emits PipelineInferenceResult
16540
- * ↓ (event bus)
16541
- * pipeline-analytics subscriber
16542
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16543
- * → three DB collections (one per kind), one FS media tree, one
16544
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16545
- * DetectionEvent on bus)
16546
- *
16547
- * Pure subscriber model. No `processFrame` cap method — the runner
16548
- * already publishes the raw frame on the bus. The cap surface is
16549
- * only QUERIES + per-device settings, bound on/off via
16550
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16551
- * every camera with a detection pipeline wants its raw detections
16552
- * refined; operators opt out per-device via BindingsTab when needed.
16553
- *
16554
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16555
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16550
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16551
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16552
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16556
16553
  */
16557
- var TrackStateSchema = _enum([
16558
- "new",
16559
- "entered",
16560
- "left",
16561
- "moving",
16562
- "idle"
16563
- ]);
16564
- var EventKindSchema = _enum([
16565
- "motion",
16566
- "object",
16567
- "audio"
16568
- ]);
16554
+ var NativeCropRefSchema = object({
16555
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16556
+ handle: FrameHandleSchema,
16557
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16558
+ cropFrameSpace: object({
16559
+ x: number(),
16560
+ y: number(),
16561
+ w: number(),
16562
+ h: number()
16563
+ })
16564
+ });
16565
+ object({
16566
+ crop: object({
16567
+ left: number(),
16568
+ top: number(),
16569
+ width: number().positive(),
16570
+ height: number().positive()
16571
+ }).optional(),
16572
+ content: object({
16573
+ width: number().int().positive(),
16574
+ height: number().int().positive()
16575
+ }),
16576
+ fit: _enum(["stretch", "contain"]),
16577
+ format: _enum([
16578
+ "rgb",
16579
+ "gray",
16580
+ "jpeg"
16581
+ ])
16582
+ });
16569
16583
  /**
16570
- * Spatial filter for `listTracks` the rect + polygon variants of the shared
16571
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16572
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16584
+ * Process-local frame identity. It is serializable so it can ride an in-process
16585
+ * capability call, but `registryId` deliberately prevents resolution in any
16586
+ * other process or execution group.
16573
16587
  */
16574
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16575
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16576
- var EventKindIconSchema = _enum([
16577
- "motion",
16578
- "audio",
16579
- "person",
16580
- "vehicle",
16581
- "animal",
16582
- "door",
16583
- "pir",
16584
- "smoke",
16585
- "water",
16586
- "button",
16587
- "package",
16588
- "generic"
16588
+ var FrameRefSchema = object({
16589
+ registryId: string().min(1),
16590
+ id: string().min(1),
16591
+ width: number().int().positive(),
16592
+ height: number().int().positive(),
16593
+ format: _enum(["rgb", "gray"]),
16594
+ timestamp: number(),
16595
+ capturedAt: number().optional()
16596
+ });
16597
+ var ModelFormatSchema$1 = _enum([
16598
+ "onnx",
16599
+ "coreml",
16600
+ "openvino",
16601
+ "tflite",
16602
+ "pt",
16603
+ "gguf"
16589
16604
  ]);
16590
- var EventKindCategorySchema = _enum([
16591
- "motion",
16592
- "audio",
16593
- "detection",
16594
- "sensor",
16595
- "control",
16596
- "custom",
16597
- "package"
16605
+ var PipelineSlotSchema = _enum([
16606
+ "detector",
16607
+ "cropper",
16608
+ "classifier",
16609
+ "refiner",
16610
+ "audio-classifier"
16598
16611
  ]);
16599
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16600
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16601
- var EventKindDescriptorSchema = object({
16602
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16603
- kind: string(),
16604
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16605
- labelKey: string(),
16606
- /** English fallback label (kept for clients that don't translate). */
16607
- label: string(),
16608
- /** Hex color for timeline/legend rendering. */
16609
- color: string(),
16610
- /** Dictionary id → lucide component on the UI side. */
16611
- iconId: string(),
16612
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16613
- icon: EventKindIconSchema,
16614
- category: EventKindCategorySchema,
16615
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16616
- parentKind: string().nullable(),
16617
- /** Derived from `parentKind`, explicit for the client tree. */
16618
- level: EventKindLevelSchema,
16619
- /** Which cap + device contributes this kind. For built-ins the camera
16620
- * itself; for sensor kinds the LINKED source device. */
16621
- source: object({
16622
- capName: string(),
16623
- deviceId: number()
16624
- })
16612
+ var PipelineEngineChoiceSchema = object({
16613
+ runtime: _enum(["node", "python"]),
16614
+ backend: string(),
16615
+ format: ModelFormatSchema$1,
16616
+ device: string().optional()
16625
16617
  });
16626
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16627
- var EventKindsForDeviceSchema = object({
16628
- deviceId: number(),
16629
- kinds: array(EventKindDescriptorSchema).readonly()
16618
+ var AvailableEngineSchema = object({
16619
+ engine: PipelineEngineChoiceSchema,
16620
+ devices: array(object({
16621
+ id: string(),
16622
+ label: string(),
16623
+ description: string().optional()
16624
+ })).readonly(),
16625
+ defaultDevice: string()
16630
16626
  });
16631
- var SensorEventSchema = object({
16627
+ var PipelineDefaultStepSchema = lazy(() => object({
16628
+ addonId: string(),
16629
+ addonName: string(),
16630
+ slot: PipelineSlotSchema,
16631
+ inputClasses: array(string()).readonly(),
16632
+ outputClasses: array(string()).readonly(),
16633
+ enabled: boolean(),
16634
+ modelId: string(),
16635
+ children: array(PipelineDefaultStepSchema).readonly(),
16636
+ group: string().optional(),
16637
+ settings: record(string(), unknown()).optional()
16638
+ }));
16639
+ var PipelineTemplateStepSchema = lazy(() => object({
16640
+ addonId: string(),
16641
+ enabled: boolean(),
16642
+ modelId: string(),
16643
+ children: array(PipelineTemplateStepSchema).readonly(),
16644
+ settings: record(string(), unknown()).optional()
16645
+ }));
16646
+ var PipelineTemplateSchema$1 = object({
16632
16647
  id: string(),
16633
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16634
- * yields N rows, one per camera). */
16635
- deviceId: number(),
16636
- /** The linked sensor device whose state changed. */
16637
- sourceDeviceId: number(),
16638
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16639
- kind: string(),
16640
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16641
- value: record(string(), unknown()).nullable(),
16642
- timestamp: number()
16648
+ name: string(),
16649
+ createdAt: string(),
16650
+ updatedAt: string(),
16651
+ engine: PipelineEngineChoiceSchema,
16652
+ steps: array(PipelineTemplateStepSchema).readonly()
16643
16653
  });
16644
- var TrackPositionSchema = object({
16645
- x: number(),
16646
- y: number(),
16647
- timestamp: number(),
16648
- bbox: BoundingBoxSchema
16654
+ var PipelineModelOptionSchema = object({
16655
+ id: string(),
16656
+ name: string(),
16657
+ formats: record(string(), object({
16658
+ downloaded: boolean(),
16659
+ sizeMB: number()
16660
+ })),
16661
+ group: ModelVariantGroupSchema.optional(),
16662
+ legacy: boolean().optional(),
16663
+ provider: ModelProviderIdSchema.optional()
16649
16664
  });
16650
- var TrackSnapshotSchema = object({
16651
- timestamp: number(),
16652
- position: TrackPositionSchema,
16653
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16654
- mediaKey: string()
16665
+ var ConfigFieldBridge = custom();
16666
+ var PipelineAddonSchemaSchema = object({
16667
+ id: string(),
16668
+ name: string(),
16669
+ slot: PipelineSlotSchema,
16670
+ inputClasses: array(string()).readonly(),
16671
+ outputClasses: array(string()).readonly(),
16672
+ childSlots: array(PipelineSlotSchema).readonly(),
16673
+ models: array(PipelineModelOptionSchema).readonly(),
16674
+ defaultModelId: string(),
16675
+ defaultModelIdByFormat: record(string(), string()).optional(),
16676
+ enabledByDefault: boolean().optional(),
16677
+ backfillIntoExistingOverrides: boolean().optional(),
16678
+ defaultConfidence: number(),
16679
+ group: string().optional(),
16680
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16655
16681
  });
16656
- /**
16657
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16658
- * divided by the track's detection-frame dims), computed at persist time.
16659
- * Absent when the frame dims were unknown when the track was persisted
16660
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16661
- */
16662
- var TrackEnvelopeSchema = object({
16663
- minX: number(),
16664
- minY: number(),
16665
- maxX: number(),
16666
- maxY: number()
16682
+ var PipelineSlotSchemaSchema = object({
16683
+ id: PipelineSlotSchema,
16684
+ label: string(),
16685
+ priority: number(),
16686
+ parentSlot: PipelineSlotSchema.nullable(),
16687
+ addons: array(PipelineAddonSchemaSchema).readonly()
16667
16688
  });
16668
- /**
16669
- * Row projection for track list queries. `full` (default) returns the
16670
- * complete Track including the frame-rate `positions[]` history and the
16671
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16672
- * keeps every scalar the list surfaces actually render (ids, class(es),
16673
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16674
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16675
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16676
- * `getTrack`. Mirrors the event-store `projection` convention
16677
- * (`getObjectEvents` et al.).
16678
- */
16679
- var TrackProjectionSchema = _enum(["full", "slim"]);
16680
- /**
16681
- * One audio-classification label heard on the track's camera while the
16682
- * track was alive, aggregated per label. An "episode" is one persisted
16683
- * audio event (the confident-classification path: score ≥ the device's
16684
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16685
- * one 32 ms inference chunk, so counts stay human-scaled.
16686
- */
16687
- var TrackAudioLabelSchema = object({
16688
- label: string(),
16689
- /** Highest classification score observed across the label's episodes. */
16690
- peakScore: number(),
16691
- /** Number of coalesced audio-event episodes carrying this label. */
16692
- count: number(),
16693
- firstAt: number(),
16694
- lastAt: number()
16689
+ var PipelineSchemaSchema = object({
16690
+ availableEngines: array(AvailableEngineSchema).readonly(),
16691
+ selectedEngine: PipelineEngineChoiceSchema,
16692
+ slots: array(PipelineSlotSchemaSchema).readonly()
16695
16693
  });
16696
- /**
16697
- * How a track was produced. `pipeline` (default / absent) = the spatial
16698
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16699
- * no positions, a single snapshot, and no bbox trajectory at all:
16700
- *
16701
- * - `sensor` — a linked sensor/control device state change.
16702
- * - `audio` — an audio event on the camera itself that was anomalous for
16703
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16704
- *
16705
- * The spatial subsystems (tracker association, occupancy count, re-id /
16706
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16707
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16708
- * check silently readmits every source added after it was written.
16709
- */
16710
- var TrackSourceSchema = _enum([
16711
- "pipeline",
16712
- "sensor",
16713
- "audio"
16714
- ]);
16715
- /**
16716
- * Where a track sits in the RETRAIN lifecycle (D81).
16717
- *
16718
- * - `none` never marked, or un-marked. Evictable.
16719
- * - `staging`the operator wants this track as training material and has not
16720
- * finished with it. **This is the only state retention holds**: the track and
16721
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16722
- * the device's age window.
16723
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16724
- * were COPIED into the retrain dataset at selection time, so the dataset no
16725
- * longer depends on the track's media and the track becomes EVICTABLE again.
16726
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16727
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16728
- *
16729
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16730
- * the store's filter language has only positive equality and `whereIn` — no
16731
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16732
- * would make the entire pre-column history immortal in one deploy.
16733
- */
16734
- var RetrainStatusSchema = _enum([
16735
- "none",
16736
- "staging",
16737
- "trained"
16738
- ]);
16739
- /**
16740
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16741
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16742
- * so the two surfaces cannot drift.
16743
- *
16744
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16745
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16746
- * columns existed read as absent, and a consumer that needs a boolean should say
16747
- * `flag === true`, not `flag !== false`.
16748
- *
16749
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16750
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16751
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16752
- * `trained` track reports `false` while refusing both writes. The boolean is
16753
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16754
- * "never marked" from "already trained" must read `retrainStatus`.
16755
- *
16756
- * `debug` does NOT pin; it is attention, not durability.
16757
- *
16758
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16759
- * A favourited track is skipped by retention the same way `staging` is, but
16760
- * it does not enter `none|staging|trained` and has no staging budget.
16761
- */
16762
- var TrackFlagFields = {
16763
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16764
- * `'staging'`. */
16765
- markForTrain: boolean().optional(),
16766
- /** Operator marked this track for diagnostic attention. */
16767
- debug: boolean().optional(),
16768
- /** Operator favourited this track. Pins it against pruning. */
16769
- favourited: boolean().optional()
16770
- };
16771
- /**
16772
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16773
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16774
- * write patch, and the status is not something the toggle sets — it is what the
16775
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16776
- * always present on a persisted row (the column default materialises `'none'`).
16777
- */
16778
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16779
- /**
16780
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16781
- * one flag can never clear the other — the toggles are independent and are
16782
- * driven from three surfaces that do not know about each other.
16783
- */
16784
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16785
- /**
16786
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16787
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16788
- * mutation result without a re-fetch.
16789
- */
16790
- var TrackFlagsSchema = object({
16791
- trackId: string(),
16792
- markForTrain: boolean(),
16793
- debug: boolean(),
16794
- favourited: boolean(),
16795
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16796
- * a track row) because this shape is only ever produced by the write body,
16797
- * which always knows it — and a surface that has just written needs to render
16798
- * `trained` without a re-fetch. */
16799
- retrainStatus: RetrainStatusSchema
16694
+ var EngineProvisioningSchema = object({
16695
+ runtimeId: _enum([
16696
+ "onnx",
16697
+ "openvino",
16698
+ "coreml",
16699
+ "edgetpu"
16700
+ ]).nullable(),
16701
+ device: string().nullable(),
16702
+ state: _enum([
16703
+ "idle",
16704
+ "installing",
16705
+ "verifying",
16706
+ "ready",
16707
+ "failed"
16708
+ ]),
16709
+ progress: number().optional(),
16710
+ error: string().optional(),
16711
+ nextRetryAt: number().optional(),
16712
+ /**
16713
+ * Gate A (config-correctness gate at engine change): human-readable
16714
+ * config issues surfaced EAGERLY when the node's engine changes — model
16715
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16716
+ * has a <format> build"). Additive/optional: informational only, never
16717
+ * enforced here `assertEngineReady` (readiness) still gates inference.
16718
+ * Absent/empty when the node-default tree resolves cleanly.
16719
+ */
16720
+ configIssues: array(string()).optional()
16800
16721
  });
16801
- union([literal(1), literal(2)]);
16802
- /**
16803
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16804
- * the step and model that produced it — which is what makes the write rule
16805
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16806
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16807
- *
16808
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16809
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16810
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16811
- * that value has no provenance, and the write rule lets ANY properly-attributed
16812
- * write of the same tier replace it regardless of score.
16813
- */
16814
- var LabelAttributionSchema = object({
16815
- stepId: string(),
16722
+ var PipelineStepInputSchema = lazy(() => object({
16723
+ addonId: string(),
16816
16724
  modelId: string().optional(),
16817
- decidedAt: number(),
16725
+ enabled: boolean().default(true),
16726
+ children: array(PipelineStepInputSchema).optional(),
16727
+ settings: record(string(), unknown()).optional(),
16728
+ jumpDeviceKey: string().optional()
16729
+ }));
16730
+ var ModelSubstitutionSchema = object({
16731
+ addonId: string(),
16732
+ chosen: string(),
16733
+ running: string(),
16734
+ format: string()
16735
+ });
16736
+ var PipelineValidationIssueSchema = object({
16737
+ addonId: string(),
16738
+ kind: _enum(["unknown-addon", "no-format-build"]),
16739
+ detail: string()
16740
+ });
16741
+ var PipelineValidationResultSchema = object({
16742
+ ok: boolean(),
16743
+ issues: array(PipelineValidationIssueSchema).readonly(),
16744
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16745
+ /** The node's `currentEngine.format` this validation ran against. */
16746
+ format: string()
16747
+ });
16748
+ var ReferenceImageEntrySchema = object({
16749
+ filename: string(),
16750
+ stepIds: array(string()).readonly().optional()
16751
+ });
16752
+ var ReferenceImageBodySchema = object({
16753
+ base64: string(),
16754
+ filename: string()
16755
+ });
16756
+ var ReferenceAudioEntrySchema = object({
16757
+ filename: string(),
16758
+ sizeKb: number()
16759
+ });
16760
+ var ReferenceAudioBodySchema = object({ base64: string() });
16761
+ var AudioBackendSchema = object({
16762
+ id: string(),
16763
+ name: string(),
16764
+ description: string(),
16765
+ available: boolean(),
16818
16766
  /**
16819
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16820
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16821
- *
16822
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16823
- * notification rule authored on "Gianluca" stopped matching the moment the
16824
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16825
- * the thing that does not move, so it is what a rule matches on
16826
- * (`NcConditions.identities`) and the text is what a human is shown.
16827
- *
16828
- * Absent when the label names no gallery row — a plate the OCR read but no
16829
- * vehicle claims, a sub-class, a species, any tier-1 value.
16767
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16768
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16769
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16770
+ * specific to the selected backend without a separate fetch.
16830
16771
  */
16831
- identityId: string().optional()
16772
+ rawLabels: array(string()).readonly().optional()
16773
+ });
16774
+ var AudioCapabilitiesSchema = object({
16775
+ activeBackend: string(),
16776
+ availableBackends: array(AudioBackendSchema).readonly(),
16777
+ sampleRate: number(),
16778
+ chunkDurationMs: number()
16779
+ });
16780
+ var DownloadModelResultSchema = object({
16781
+ filePath: string(),
16782
+ sizeMB: number(),
16783
+ durationMs: number()
16832
16784
  });
16833
16785
  /**
16834
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16835
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16836
- * track and its events always answer the same question the same way.
16837
- *
16838
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16839
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16840
- * is tier 2, and each carries its own score + attribution.
16841
- *
16842
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16843
- * finest thing known. Before 4g the single `label` column held the finest
16844
- * value, so a consumer that has not been updated reads the tier-1 slot and
16845
- * shows nothing on a species-only row; that is why the migration puts every
16846
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16847
- * and why the read surfaces were changed in the same train.
16848
- *
16849
- * **Writing it.** The slots are independent, which is the whole point: a
16850
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16851
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16852
- * higher score wins. One rule, one implementation — see
16853
- * `pipeline/label-tier.ts` in addon-post-analysis.
16854
- */
16855
- var TieredLabelFields = {
16856
- /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
16857
- label: string().optional(),
16858
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16859
- labelScore: number().optional(),
16860
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16861
- labelMeta: LabelAttributionSchema.optional(),
16862
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16863
- subLabel: string().optional(),
16864
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16865
- subLabelScore: number().optional(),
16866
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16867
- subLabelMeta: LabelAttributionSchema.optional()
16868
- };
16869
- /** Per-camera slice of a training-export estimate. */
16870
- var TrainingExportDeviceTotalsSchema = object({
16871
- deviceId: number(),
16872
- tracks: number().int(),
16873
- files: number().int(),
16874
- bytes: number().int()
16875
- });
16876
- /**
16877
- * What a training export WOULD contain. Computed from media index rows only —
16878
- * no blob is read to produce this.
16786
+ * Wrapper carrying a single test run's result. Replaces the legacy
16787
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16788
+ * canonical `AudioResult` from the Phase 6 output rework: one
16789
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16790
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16791
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16792
+ * benchmark UI can still report a clean failure when the classifier
16793
+ * cap isn't available.
16879
16794
  */
16880
- var TrainingExportSummarySchema = object({
16881
- generatedAt: number(),
16882
- trackCount: number().int(),
16883
- fileCount: number().int(),
16884
- byteCount: number().int(),
16885
- /** More marked tracks exist than a single pass carries. */
16886
- truncated: boolean(),
16887
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16795
+ var AudioTestResultSchema = object({
16796
+ success: boolean(),
16797
+ error: string().optional(),
16798
+ frame: custom().optional()
16888
16799
  });
16889
- var TrackSchema = object({
16890
- trackId: string(),
16891
- deviceId: number(),
16892
- className: string(),
16893
- ...TieredLabelFields,
16894
- producingDeviceName: string().optional(),
16895
- /** Track provenance. Absent `pipeline` (legacy rows). */
16896
- source: TrackSourceSchema.optional(),
16897
- firstSeen: number(),
16898
- lastSeen: number(),
16899
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16900
- positions: array(TrackPositionSchema).readonly(),
16901
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16902
- * saveThumbnails policy). */
16903
- snapshots: array(TrackSnapshotSchema).readonly(),
16904
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16905
- zonesVisited: array(string()).readonly(),
16800
+ var PipelineConfigBridge = custom();
16801
+ var ConfigUISchemaBridge = custom();
16802
+ var ConfigUISchemaNullableBridge = custom();
16803
+ var InferenceCapabilitiesBridge = custom();
16804
+ var ModelAvailabilityListBridge = custom();
16805
+ var PipelineRunResultBridge = custom();
16806
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16807
+ modelId: string(),
16808
+ settings: record(string(), unknown()).readonly()
16809
+ }))), method(object({ steps: record(string(), object({
16810
+ modelId: string(),
16811
+ settings: record(string(), unknown()).readonly()
16812
+ })) }), object({ success: literal(true) }), {
16813
+ kind: "mutation",
16814
+ auth: "admin"
16815
+ }), method(object({ nodeId: string() }), object({
16816
+ success: literal(true),
16817
+ clearedDevices: number()
16818
+ }), {
16819
+ kind: "mutation",
16820
+ auth: "admin"
16821
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16822
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16823
+ deviceKey: string(),
16906
16824
  /**
16907
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16908
- * `zones` capability.
16909
- *
16910
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16911
- * and no card can render — so every free-text search surface was structurally
16912
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16913
- * just returned nothing. Resolving here rather than in each client keeps ONE
16914
- * derivation and costs the clients no extra call (the `zones` cap is
16915
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16916
- * surface built to avoid exactly that).
16917
- *
16918
- * Resolved, never invented: a zone deleted since the track was written has no
16919
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16920
- * two are not positionally aligned. Absent when the track visited no zone, or
16921
- * when the zone catalogue could not be read.
16825
+ * `failed` the per-device restart budget is exhausted; no pool
16826
+ * will be spawned until an operator re-arms it or the runner
16827
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16828
+ * a cached pool observed dead and not yet condemned).
16922
16829
  */
16923
- zoneNames: array(string()).readonly().optional(),
16924
- /** Deduplicated set of detector classes observed for this track over its
16925
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16926
- * legacy rows written before class accumulation shipped. */
16927
- classes: array(string()).readonly().optional(),
16928
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16929
- totalDistance: number(),
16930
- state: TrackStateSchema,
16931
- active: boolean(),
16932
- /** Deterministic key-event importance score in [0,1] (server-computed at
16933
- * track expiry, recomputed on late label). Absent on legacy rows written
16934
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16935
- importance: number().optional(),
16936
- /** Id of the track's highest-confidence ObjectEvent (its representative
16937
- * "best" frame). Absent when the track produced no object events. */
16938
- bestEventId: string().optional(),
16939
- /** Tag of the importance sub-signal that dominated the score
16940
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16941
- importanceReason: string().optional(),
16942
- /** Audio-classification labels heard on the camera during the track's
16943
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16944
- * Absent on legacy rows / tracks with no confident audio. */
16945
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16946
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16947
- * Populated from the persisted envelope columns on historical reads;
16948
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16949
- envelope: TrackEnvelopeSchema.optional(),
16830
+ state: _enum(["failed", "backoff"]),
16831
+ /** Epoch ms of the death that produced this state. */
16832
+ since: number(),
16833
+ /** Pool deaths inside the current window. */
16834
+ deaths: number(),
16835
+ /** The last death's message. */
16836
+ lastError: string()
16837
+ })).readonly() })), method(object({
16838
+ nodeId: string(),
16839
+ deviceKey: string()
16840
+ }), object({ rearmed: boolean() }), {
16841
+ kind: "mutation",
16842
+ auth: "admin"
16843
+ }), 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({
16844
+ name: string(),
16845
+ steps: array(PipelineTemplateStepSchema).readonly(),
16846
+ engine: PipelineEngineChoiceSchema
16847
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16848
+ id: string(),
16849
+ name: string().optional(),
16850
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16851
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16852
+ addonId: string(),
16853
+ modelId: string(),
16854
+ format: ModelFormatSchema$1
16855
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16856
+ addonId: string(),
16857
+ modelId: string(),
16858
+ format: ModelFormatSchema$1
16859
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16860
+ engine: PipelineEngineChoiceSchema.optional(),
16861
+ steps: array(PipelineStepInputSchema).min(1),
16862
+ frame: FrameInputSchema.optional(),
16950
16863
  /**
16951
- * A face DETECTOR found a face on this track — nothing more. It says the
16952
- * detail plane produced a `face` detail; it does NOT say the face was
16953
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16954
- * enabled. Set once and never cleared.
16955
- *
16956
- * **This exists so "face present but not recognised" is expressible.** A
16957
- * recognised identity lands in `subLabel` (attributed to the face chain via
16958
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16959
- * and a track with no face at all were byte-identical on the wire and no
16960
- * surface could tell them apart. The read is `hasFace === true && subLabel
16961
- * === undefined`.
16962
- *
16963
- * **Absent ≠ false.** Every row written before the column existed omits it,
16964
- * and so does every server that predates the field — a consumer must test
16965
- * `=== true` and render nothing otherwise, never infer "no face".
16864
+ * Process-local lazy frame. Valid only when caller and provider resolve
16865
+ * in the same execution-group process; split/cross-node callers use
16866
+ * `frame`/`image` inline compatibility instead.
16966
16867
  */
16967
- hasFace: boolean().optional(),
16868
+ frameRef: FrameRefSchema.optional(),
16968
16869
  /**
16969
- * This track has a face row IN THE GALLERY: a crop **and** an embedding a
16970
- * face an operator could ASSIGN to an identity.
16971
- *
16972
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16973
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16974
- * branch, before every gate, and means no more than "a face detector produced
16975
- * a face detail". This one is stamped at the single moment the gallery row
16976
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16977
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16978
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16979
- * the crop-store drop. Everything between the detector and that insert can
16980
- * legitimately refuse the face, so a flag written any earlier promises the
16981
- * operator something to assign and delivers nothing.
16982
- *
16983
- * **Independent of recognition.** A face collected but never auto-matched is
16984
- * still assignable — it is in fact the face an operator most wants to reach —
16985
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16986
- * `subLabel`; this says only that the raw material exists.
16987
- *
16988
- * **Set once, never cleared.** A track that produced a gallery row produced
16989
- * one; deleting the row later is the gallery's business, not this flag's.
16990
- *
16991
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16992
- * before the column omits it, and so does every server that predates the
16993
- * field. A consumer must test `=== true` and render nothing otherwise —
16994
- * never infer "no assignable face".
16870
+ * CB5 shm passthrough a `FrameHandle` naming the same ring slot
16871
+ * the decoded pixels live in. One more member of the one-of
16872
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16995
16873
  */
16996
- hasEmbeddedFace: boolean().optional(),
16874
+ frameHandle: FrameHandleSchema.optional(),
16875
+ imageBase64: string().optional(),
16997
16876
  /**
16998
- * This subject CONTAINS a folded rider a person the rider-pairing step
16999
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17000
- * so the passage is tracked once and as a VEHICLE.
17001
- *
17002
- * It exists because the fold's record was dishonest. D34 and the code both
17003
- * said "the person is not lost — it is reported so both entities stay on the
17004
- * record"; in fact the pair went into a per-processor RAM field behind an
17005
- * accessor nobody called, and every durable surface said `vehicle`, full
17006
- * stop. This is the composition note that makes the row true.
17007
- *
17008
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
17009
- * person" is not an answer to "what is this" — both label tiers would refuse
17010
- * a macro token anyway (D89), and correctly. Nothing here changes what the
17011
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17012
- * and a `person` rule still does not fire for someone cycling past.
17013
- *
17014
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17015
- * the column, and every hub that predates the field, omits it. Test
17016
- * `=== true` and render nothing otherwise — never infer "no rider".
16877
+ * Binary JPEG bytespreferred over `imageBase64` on internal
16878
+ * hops (hub forked worker via Moleculer MsgPack) because it
16879
+ * skips the 33% base64 overhead + the per-call base64 decode on
16880
+ * the detection-pipeline worker. Callers can pass either; exactly
16881
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17017
16882
  */
17018
- hasRider: boolean().optional(),
17019
- ...TrackFlagFields,
17020
- ...TrackRetrainFields
17021
- });
17022
- var BaseEventFields = {
17023
- id: string(),
17024
- deviceId: number(),
17025
- timestamp: number()
17026
- };
17027
- var MotionEventSchema = object({
17028
- ...BaseEventFields,
17029
- kind: literal("motion"),
17030
- regionCount: number(),
17031
- /** Heavy JSON array omitted in slim projection. */
17032
- regions: array(object({
17033
- bbox: BoundingBoxSchema,
17034
- pixelCount: number(),
17035
- intensity: number()
17036
- })).readonly().optional(),
17037
- /** Omitted in slim projection. */
17038
- frameWidth: number().optional(),
17039
- /** Omitted in slim projection. */
17040
- frameHeight: number().optional(),
17041
- /** Populated by B5 (recording playback URL for this event). */
17042
- mediaUrl: string().optional()
17043
- });
16883
+ image: _instanceof(Uint8Array).optional(),
16884
+ referenceImage: string().optional(),
16885
+ deviceId: number().optional(),
16886
+ sessionId: string().optional(),
16887
+ /**
16888
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16889
+ * reference-image, and detail-subtree calls. 'frame' is the live
16890
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16891
+ * (inputClasses ≠ null) are skipped and served per-track via
16892
+ * pipelineRunner.runDetailSubtree (two-plane design).
16893
+ */
16894
+ plane: _enum(["full", "frame"]).optional(),
16895
+ /**
16896
+ * Inference-device selector (Phase 2 multi-device). Format
16897
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16898
+ * Omitted ⇒ the runner's default device (current single-engine
16899
+ * behaviour). Selects WHICH device pool of the node runs the call.
16900
+ */
16901
+ deviceKey: string().optional(),
16902
+ /**
16903
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16904
+ * when the parent crop was resolved from the frame's retained NATIVE
16905
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16906
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16907
+ * resolution from that surface — the SAME quality path faces already
16908
+ * had — instead of the downscaled parent tile. `handle` keys the native
16909
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16910
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16911
+ * the executor's crop-normalized child ROI back into frame-normalized
16912
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16913
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16914
+ * (today's behaviour on the fallback path).
16915
+ */
16916
+ nativeCropRef: NativeCropRefSchema.optional()
16917
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16918
+ engine: PipelineEngineChoiceSchema.optional(),
16919
+ steps: array(PipelineStepInputSchema).min(1),
16920
+ frames: array(FrameInputSchema).min(1).max(255),
16921
+ deviceId: number().optional(),
16922
+ sessionId: string().optional(),
16923
+ /**
16924
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16925
+ * the batch to the Python pool's bench preprocess cache
16926
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16927
+ * preprocessed ONCE and every later inference is a pure-inference cache
16928
+ * hit — the sustained-throughput run measures inference, not
16929
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16930
+ * full preprocess every call, correct). Fresh per sustained run;
16931
+ * released via `uncacheFrame`.
16932
+ */
16933
+ frameId: number().int().nonnegative().optional(),
16934
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16935
+ deviceKey: string().optional()
16936
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16937
+ data: _instanceof(Uint8Array),
16938
+ width: number().int().positive(),
16939
+ height: number().int().positive(),
16940
+ format: _enum([
16941
+ "rgb",
16942
+ "bgr",
16943
+ "gray"
16944
+ ])
16945
+ }), object({
16946
+ frameId: number(),
16947
+ width: number(),
16948
+ height: number()
16949
+ }), { kind: "mutation" }), method(object({
16950
+ stepId: string(),
16951
+ frameId: number().int()
16952
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16953
+ batchMode: string(),
16954
+ windowMs: number(),
16955
+ maxBatchSize: number(),
16956
+ concurrency: number()
16957
+ })), method(_void(), array(object({
16958
+ engineKey: string(),
16959
+ engine: PipelineEngineChoiceSchema,
16960
+ modelsLoaded: array(string()).readonly(),
16961
+ inUseByCameras: array(number()).readonly(),
16962
+ /**
16963
+ * Origin of this resident factory.
16964
+ * - `runtime` — main camera-serving engine (no idle TTL).
16965
+ * - `warm-override` — benchmark/test override held in the warm
16966
+ * cache; auto-disposed after the idle TTL.
16967
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16968
+ * multi-device, keyed by `deviceKey`) resolved
16969
+ * via `resolveDeviceFactory`. Runs alongside the
16970
+ * `runtime` engine on a DIFFERENT accelerator
16971
+ * (NPU / iGPU / Coral) — this is how the
16972
+ * Engines tab shows all pools running at once.
16973
+ */
16974
+ kind: _enum([
16975
+ "runtime",
16976
+ "warm-override",
16977
+ "device-pool"
16978
+ ]),
16979
+ /** Native pid of the underlying Python pool (null when no pool). */
16980
+ poolPid: number().nullable(),
16981
+ /** ms since this factory was last used (null when not warm-tracked). */
16982
+ idleMs: number().nullable(),
16983
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16984
+ idleTtlMs: number().nullable()
16985
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16986
+ kind: "mutation",
16987
+ auth: "admin"
16988
+ }), method(object({
16989
+ engine: PipelineEngineChoiceSchema,
16990
+ force: boolean().optional()
16991
+ }), object({
16992
+ success: boolean(),
16993
+ reason: string().optional()
16994
+ }), {
16995
+ kind: "mutation",
16996
+ auth: "admin"
16997
+ }), 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({
16998
+ addonId: string(),
16999
+ modelId: string(),
17000
+ filename: string().optional(),
17001
+ settings: record(string(), unknown()).optional()
17002
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
17044
17003
  /**
17045
- * Which detection SOURCE produced an object event. `pipeline` = the ML
17046
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
17047
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
17048
- * tracking, per-kind persistence) but stay distinguishable so consumers
17049
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17050
- * Absent on legacy rows treat as `pipeline`.
17004
+ * Per-stage gating mode applied to the zones a rule references.
17005
+ *
17006
+ * - `include`: the rule contributes to a **whitelist** for its stage.
17007
+ * When at least one `include` rule fires for a stage, only entities
17008
+ * inside one of those zones pass that stage.
17009
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
17010
+ * Entities inside one of those zones are dropped at that stage.
17011
+ *
17012
+ * `monitor`-style observation (count without filtering) is not a rule
17013
+ * mode — zones without any matching rule are observed naturally by
17014
+ * `zone-analytics` (live snapshot + history), so an "I just want to
17015
+ * count, not filter" use case needs no rule at all.
17051
17016
  */
17052
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17017
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
17053
17018
  /**
17054
- * The confirmed zone crossing that produced an object event. Present ONLY on
17055
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17056
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17057
- * appearance event carry none, so a rule asking for a direction fails closed
17058
- * on them.
17019
+ * Per-consumer rule that references existing zones (geometry) and
17020
+ * defines how a specific pipeline stage should treat them. Each
17021
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
17022
+ * settings:
17059
17023
  *
17060
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17061
- * into its own event, so a frame in which a track enters A while leaving B
17062
- * produces two events with two directions — never one ambiguous row.
17024
+ * - `addon-motion-wasm` `motionZoneRules: ZoneRule[]` (motion stage)
17025
+ * - `addon-detection-pipeline` `detectionZoneRules: ZoneRule[]` (detection stage)
17026
+ * - future: notification rules, audio gating, etc.
17063
17027
  *
17064
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17065
- * membership the box has NOW, and by definition it no longer contains the zone
17066
- * that was just left. Without the id here, a zone-scoped rule could never match
17067
- * the exit it asked for.
17028
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
17029
+ * express "ignore motion in ALL of {garden, street}" with a single
17030
+ * rule. `classFilter` narrows the rule to specific object classes
17031
+ * "drop person detections in the street, but keep cars" is one
17032
+ * `exclude` rule with `classFilter: ['person']`.
17033
+ *
17034
+ * `enabled` is a soft toggle — the operator can keep the rule
17035
+ * configured but inert without deleting it.
17068
17036
  */
17069
- var ZoneCrossingSchema = object({
17070
- direction: _enum(["enter", "exit"]),
17071
- /** Admin zone id crossed. */
17072
- zoneId: string(),
17073
- /** Zone display name at crossing time (falls back to the id). */
17074
- zoneName: string().optional()
17075
- });
17076
- var ObjectEventSchema = object({
17077
- ...BaseEventFields,
17078
- kind: literal("object"),
17079
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17080
- source: DetectionSourceSchema.optional(),
17037
+ var ZoneRuleSchema = object({
17038
+ /** Stable rule id — survives edits, used by the UI for diffing. */
17039
+ id: string(),
17040
+ /** Optional human-readable label rendered in the rule editor. */
17041
+ name: string().optional(),
17042
+ /** Zones this rule targets. The rule's `mode` applies to ALL
17043
+ * listed zones (OR-set: a detection in any one of them counts).
17044
+ * At least one zone id required — a rule with no targets is a
17045
+ * configuration mistake and the form validator rejects it. */
17046
+ zoneIds: array(string()).min(1).readonly(),
17047
+ mode: ZoneRuleModeEnum,
17081
17048
  /**
17082
- * Inference-frame id shared by every object event emitted from the SAME frame
17083
- * the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17084
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
17085
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
17086
- * Optional for backward-compat with pre-existing rows / the slim projection
17087
- * includes it (it is light). Absent on rows written before this field.
17049
+ * Class names this rule applies to. Empty / undefined rule
17050
+ * applies to every class. Class strings match the `macroClass`
17051
+ * field on detections (e.g. `person`, `car`, `dog`).
17088
17052
  */
17089
- frameId: string().optional(),
17090
- /** Omitted in slim projection. */
17091
- trackId: string().optional(),
17092
- className: string(),
17093
- ...TieredLabelFields,
17094
- /** Omitted in slim projection. */
17095
- confidence: number().optional(),
17096
- /** Heavy JSON — omitted in slim projection. */
17097
- bbox: BoundingBoxSchema.optional(),
17098
- /** Heavy JSON — omitted in slim projection. */
17099
- zones: array(string()).readonly().optional(),
17100
- /** Omitted in slim projection. */
17101
- state: TrackStateSchema.optional(),
17053
+ classFilter: array(string()).readonly().optional(),
17102
17054
  /**
17103
- * The zone crossing this event IS, when it is one. Absent on every other
17104
- * event kind (movement state, appearance, package) see
17105
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
17055
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
17056
+ * required to consider an entity "in the zone". Defaults to the
17057
+ * consumer's stage default when omitted. Kept for back-compat with
17058
+ * existing per-rule overrides; new operators pick the value via
17059
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
17060
+ * set, the lower-level engine reads it as a 0–1 fraction.
17106
17061
  */
17107
- zoneCrossing: ZoneCrossingSchema.optional(),
17108
- /** Detection-frame dimensions in pixels — let consumers normalize the
17109
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17110
- frameWidth: number().optional(),
17111
- frameHeight: number().optional(),
17112
- /** MediaStore key for the crop attached to this event (if any). */
17113
- mediaKey: string().optional(),
17114
- /** Design B: MediaStore key of the track's native-resolution key frame (the
17115
- * best-detection full frame). Resolve via the event-media data-plane
17116
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17117
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17118
- * sources — consumers fall back to `mediaKey` (the tight crop). */
17119
- keyFrameMediaKey: string().optional(),
17120
- /** Populated by B5 (recording playback URL for this event). */
17121
- mediaUrl: string().optional(),
17122
- /** The parent track's key-event importance [0,1], propagated to every object
17123
- * event of the track (so an event row can be sorted by importance without a
17124
- * track join). Absent on legacy rows / before the track was scored. */
17125
- importance: number().optional()
17126
- });
17127
- var AudioEventSchema = object({
17128
- ...BaseEventFields,
17129
- kind: literal("audio"),
17130
- rms: number(),
17131
- dbfs: number(),
17132
- classification: object({
17133
- className: string(),
17134
- originalClass: string().optional(),
17135
- score: number()
17136
- }).optional(),
17137
- /** Populated by B5 (recording playback URL for this event). */
17138
- mediaUrl: string().optional()
17062
+ overlapThreshold: number().min(0).max(1).optional(),
17063
+ /**
17064
+ * Operator-friendly version of `overlapThreshold` the percentage
17065
+ * of the detection's bbox that must lie inside the zone for the
17066
+ * rule to match. Documented default is 85%; the engine substitutes
17067
+ * that when the field is omitted (kept optional so existing rules
17068
+ * stored without it stay valid).
17069
+ *
17070
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
17071
+ * rule, the engine prefers `bboxInclusionPct` because it's the
17072
+ * field exposed in the UI. Internally both feed the same gate.
17073
+ */
17074
+ bboxInclusionPct: number().min(0).max(100).optional(),
17075
+ /**
17076
+ * When `true` and a detection has a segmentation mask, use the
17077
+ * mask for overlap instead of the bbox. Detection-stage only;
17078
+ * motion rules ignore this field.
17079
+ */
17080
+ preferMask: boolean().optional(),
17081
+ /**
17082
+ * Soft-toggle: `false` disables the rule without deleting it.
17083
+ * Defaults to `true` so operators creating a rule via the UI
17084
+ * see it active immediately.
17085
+ */
17086
+ enabled: boolean().default(true)
17139
17087
  });
17140
- var MediaFileKindEnum = _enum([
17141
- "crop",
17142
- "thumbnail",
17143
- "snapshot",
17144
- "firstFrame",
17145
- "lastFrame",
17146
- "fullFrame",
17147
- "fullFrameBoxed",
17148
- "faceCrop",
17149
- "plateCrop",
17150
- "keyFrame",
17151
- "keyFrameSmall",
17152
- "thumbnailSmall"
17153
- ]);
17154
- var MediaFileSchema = object({
17155
- key: string(),
17156
- kind: MediaFileKindEnum,
17157
- base64: string(),
17158
- sizeBytes: number(),
17159
- timestamp: number()
17088
+ array(ZoneRuleSchema).readonly();
17089
+ /**
17090
+ * Zone — pure geometry + identity. NO filtering behaviour.
17091
+ *
17092
+ * Zones describe **where** in the frame the operator wants to flag
17093
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
17094
+ * each pipeline stage uses them. Splitting the two means a single
17095
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
17096
+ * a detection-include rule on `['car']`, and an occupancy aggregate
17097
+ * — without three duplicated polygons.
17098
+ *
17099
+ * Owned by the orchestrator addon (provider) and mirrored into the
17100
+ * `zones` device-state slice on every mutation. Consumers
17101
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
17102
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
17103
+ * mirror with `onChanged`).
17104
+ *
17105
+ * Coordinates are normalised fractions of the frame (0–1) so zones
17106
+ * survive resolution changes and stream profile switches.
17107
+ *
17108
+ * `kind` discriminates between full polygons (closed regions used
17109
+ * for intrusion / occupancy filters) and tripwires (open 2-point
17110
+ * line segments used for cross events). Onboard / firmware-reported
17111
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17112
+ * task list.
17113
+ */
17114
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
17115
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17116
+ var PolygonPointSchema = object({
17117
+ x: number(),
17118
+ y: number()
17119
+ });
17120
+ /** A camera detection zone — pure geometry/identity. */
17121
+ var ZoneSchema = object({
17122
+ id: string(),
17123
+ name: string(),
17124
+ kind: ZoneKindEnum.default("polygon"),
17125
+ /** Polygon vertices, fraction of frame (0–1). */
17126
+ polygon: array(PolygonPointSchema).readonly(),
17127
+ /** Visual color for UI rendering. */
17128
+ color: string().default("#3b82f6")
17160
17129
  });
17161
17130
  /**
17162
- * One media row WITHOUT its bytes.
17131
+ * Zones capability per-camera CRUD over polygon detection zones.
17163
17132
  *
17164
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17165
- * 140 s track), and a client that renders tiles from the media data plane needs
17166
- * to know only WHAT EXISTS the bytes then arrive per tile, lazily, over HTTP
17167
- * with an immutable cache, instead of all at once inside a tRPC response that
17168
- * blocks the whole view.
17133
+ * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
17134
+ * to per-device settings and mirrors into the `zones` device-state
17135
+ * slice on every mutation, so downstream consumers can subscribe via
17136
+ * `dev.state.zones.onChanged`.
17169
17137
  *
17170
- * `sizeBytes` is carried because it is what lets a client decide between the
17171
- * stored blob and a `?variant=thumb` rendering without fetching either.
17138
+ * The cap surface only handles geometry + identity; filtering
17139
+ * behaviour (per-class, include/exclude, threshold) lives in the
17140
+ * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
17141
+ * `capabilities/schemas/zone-rule.js`.
17172
17142
  */
17173
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17143
+ var zonesCapability = {
17144
+ name: "zones",
17145
+ scope: "device",
17146
+ mode: "singleton",
17147
+ deviceTypes: [DeviceType.Camera],
17148
+ methods: {
17149
+ listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
17150
+ addZone: method(object({
17151
+ deviceId: number(),
17152
+ zone: ZoneSchema
17153
+ }), _void(), {
17154
+ kind: "mutation",
17155
+ auth: "admin"
17156
+ }),
17157
+ removeZone: method(object({
17158
+ deviceId: number(),
17159
+ zoneId: string()
17160
+ }), _void(), {
17161
+ kind: "mutation",
17162
+ auth: "admin"
17163
+ }),
17164
+ updateZone: method(object({
17165
+ deviceId: number(),
17166
+ zone: ZoneSchema
17167
+ }), _void(), {
17168
+ kind: "mutation",
17169
+ auth: "admin"
17170
+ })
17171
+ },
17172
+ /**
17173
+ * Runtime-state slice — the live zone catalogue mirrored by the
17174
+ * orchestrator on every CRUD mutation. Consumers read via
17175
+ * `device.state.zones.value` / `.watch(...)` without round-tripping
17176
+ * the cap, and the codegen DeviceProxy auto-wires the reactive
17177
+ * handle. Slice shape is `{ zones: Zone[] }` so future extensions
17178
+ * (e.g. zone groupings) can sit alongside the polygon list.
17179
+ */
17180
+ runtimeState: object({ zones: array(ZoneSchema).readonly() }),
17181
+ /**
17182
+ * 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.
17183
+ *
17184
+ * See `RuntimeStateDurability`. Enforced by
17185
+ * `scripts/check-runtime-state-durability.ts`.
17186
+ */
17187
+ durability: "restored"
17188
+ };
17174
17189
  /**
17175
- * The MACRO tier of an annotation — a CLOSED set.
17190
+ * pipeline-analytics device-scoped wrapper cap. Refines raw
17191
+ * per-frame detections emitted by the pipeline runner into tracked
17192
+ * objects, per-kind event collections (motion / object / audio), and
17193
+ * persisted media. Owns the post-detection domain end-to-end:
17176
17194
  *
17177
- * This is what the exported detector predicts, so a typo here is a new class
17178
- * with one example in it. `label` and `subLabel` are open strings by contrast:
17179
- * the whole point of the page is teaching the model things it does not know
17180
- * yet, and constraining that vocabulary would make it useless.
17195
+ * runner emits PipelineInferenceResult
17196
+ * (event bus)
17197
+ * pipeline-analytics subscriber
17198
+ * SORT tracker + zone engine + state analyzer + event emitter
17199
+ * → three DB collections (one per kind), one FS media tree, one
17200
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
17201
+ * DetectionEvent on bus)
17181
17202
  *
17182
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
17183
- * `subLabel` is one of these values, in any casing, because once `person`
17184
- * exists in both tiers "every person box" stops being answerable without
17185
- * knowing every string anyone ever typed — and the damage is retroactive.
17203
+ * Pure subscriber model. No `processFrame` cap method the runner
17204
+ * already publishes the raw frame on the bus. The cap surface is
17205
+ * only QUERIES + per-device settings, bound on/off via
17206
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
17207
+ * every camera with a detection pipeline wants its raw detections
17208
+ * refined; operators opt out per-device via BindingsTab when needed.
17209
+ *
17210
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
17211
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
17186
17212
  */
17187
- var RetrainMacroClassSchema = _enum([
17213
+ var TrackStateSchema = _enum([
17214
+ "new",
17215
+ "entered",
17216
+ "left",
17217
+ "moving",
17218
+ "idle"
17219
+ ]);
17220
+ var EventKindSchema = _enum([
17221
+ "motion",
17222
+ "object",
17223
+ "audio"
17224
+ ]);
17225
+ /**
17226
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
17227
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
17228
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
17229
+ */
17230
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
17231
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
17232
+ var EventKindIconSchema = _enum([
17233
+ "motion",
17234
+ "audio",
17188
17235
  "person",
17189
17236
  "vehicle",
17190
17237
  "animal",
17238
+ "door",
17239
+ "pir",
17240
+ "smoke",
17241
+ "water",
17242
+ "button",
17191
17243
  "package",
17192
- "face",
17193
- "plate"
17244
+ "generic"
17194
17245
  ]);
17195
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17196
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17197
- /** Did a human draw this box, or did the assist propose it? */
17198
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17199
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17200
- var RetrainBboxSchema = object({
17201
- x: number(),
17202
- y: number(),
17203
- w: number(),
17204
- h: number()
17205
- });
17206
- /**
17207
- * One annotated subject.
17208
- *
17209
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17210
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17211
- * derived from it at export and never stored storing them is how one feature
17212
- * space ends up holding two crops of the same subject (D52).
17213
- */
17214
- var RetrainAnnotationSchema = object({
17215
- id: string(),
17216
- trackId: string(),
17217
- deviceId: number(),
17218
- /** The COPY in retrain storage — never the source track's media key. */
17219
- mediaKey: string(),
17220
- bbox: RetrainBboxSchema,
17221
- macroClass: RetrainMacroClassSchema,
17222
- label: string().optional(),
17223
- subLabel: string().optional(),
17224
- kind: RetrainAnnotationKindSchema,
17225
- source: RetrainAnnotationSourceSchema,
17226
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17227
- assistModelId: string().optional(),
17228
- assistScore: number().optional(),
17229
- exportedInBatch: string().optional(),
17230
- createdAt: number()
17231
- });
17232
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17233
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17234
- id: true,
17235
- trackId: true,
17236
- deviceId: true,
17237
- mediaKey: true,
17238
- createdAt: true,
17239
- exportedInBatch: true
17246
+ var EventKindCategorySchema = _enum([
17247
+ "motion",
17248
+ "audio",
17249
+ "detection",
17250
+ "sensor",
17251
+ "control",
17252
+ "custom",
17253
+ "package"
17254
+ ]);
17255
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
17256
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
17257
+ var EventKindDescriptorSchema = object({
17258
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
17259
+ kind: string(),
17260
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
17261
+ labelKey: string(),
17262
+ /** English fallback label (kept for clients that don't translate). */
17263
+ label: string(),
17264
+ /** Hex color for timeline/legend rendering. */
17265
+ color: string(),
17266
+ /** Dictionary id → lucide component on the UI side. */
17267
+ iconId: string(),
17268
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
17269
+ icon: EventKindIconSchema,
17270
+ category: EventKindCategorySchema,
17271
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
17272
+ parentKind: string().nullable(),
17273
+ /** Derived from `parentKind`, explicit for the client tree. */
17274
+ level: EventKindLevelSchema,
17275
+ /** Which cap + device contributes this kind. For built-ins the camera
17276
+ * itself; for sensor kinds the LINKED source device. */
17277
+ source: object({
17278
+ capName: string(),
17279
+ deviceId: number()
17280
+ })
17240
17281
  });
17241
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17242
- var RetrainTrackSchema = object({
17243
- trackId: string(),
17282
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
17283
+ var EventKindsForDeviceSchema = object({
17244
17284
  deviceId: number(),
17245
- className: string(),
17246
- label: string().optional(),
17247
- firstSeen: number(),
17248
- lastSeen: number(),
17249
- /** How many frames the dataset already holds from this track. */
17250
- frameCount: number().int(),
17251
- /** How many subjects have been annotated on those frames. `0` with
17252
- * `frameCount: 0` is exactly "staging, still to work". */
17253
- annotationCount: number().int()
17254
- });
17255
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
17256
- var RetrainFrameCandidateSchema = object({
17257
- mediaKey: string(),
17258
- kind: MediaFileKindEnum,
17259
- timestamp: number(),
17260
- sizeBytes: number().int(),
17261
- /** A copy of this original already exists — selecting it is free and cannot
17262
- * fail, whatever became of the original. */
17263
- copied: boolean()
17285
+ kinds: array(EventKindDescriptorSchema).readonly()
17264
17286
  });
17265
- /** A frame the dataset OWNS: bytes copied at selection time. */
17266
- var RetrainFrameSchema = object({
17267
- frameId: string(),
17287
+ var SensorEventSchema = object({
17288
+ id: string(),
17289
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
17290
+ * yields N rows, one per camera). */
17268
17291
  deviceId: number(),
17269
- trackId: string(),
17270
- /** Provenance only. It may already point at nothing — that is expected. */
17271
- sourceMediaKey: string(),
17272
- sourceKind: MediaFileKindEnum,
17273
- sizeBytes: number().int(),
17274
- width: number().int(),
17275
- height: number().int(),
17276
- copiedAt: number()
17292
+ /** The linked sensor device whose state changed. */
17293
+ sourceDeviceId: number(),
17294
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
17295
+ kind: string(),
17296
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
17297
+ value: record(string(), unknown()).nullable(),
17298
+ timestamp: number()
17277
17299
  });
17278
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17279
- var RetrainCopyRefusalSchema = _enum([
17280
- "source-missing",
17281
- "unreadable-image",
17282
- "write-failed"
17283
- ]);
17284
- var RetrainFrameSelectionSchema = object({
17285
- copied: array(RetrainFrameSchema).readonly(),
17286
- refused: array(object({
17287
- sourceMediaKey: string(),
17288
- reason: RetrainCopyRefusalSchema
17289
- })).readonly()
17300
+ var TrackPositionSchema = object({
17301
+ x: number(),
17302
+ y: number(),
17303
+ timestamp: number(),
17304
+ bbox: BoundingBoxSchema
17290
17305
  });
17291
- var RetrainFrameListSchema = object({
17292
- candidates: array(RetrainFrameCandidateSchema).readonly(),
17293
- copies: array(RetrainFrameSchema).readonly(),
17294
- /** What the page pre-selects the native key frame when one survives. */
17295
- autoPickMediaKey: string().optional()
17306
+ var TrackSnapshotSchema = object({
17307
+ timestamp: number(),
17308
+ position: TrackPositionSchema,
17309
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
17310
+ mediaKey: string()
17296
17311
  });
17297
- /** What the operator asked the assist to look for. */
17298
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17299
- kind: literal("package"),
17300
- zone: RetrainBboxSchema.optional()
17301
- }), object({
17302
- kind: literal("objects"),
17303
- modelId: string(),
17304
- minScore: number().optional()
17305
- })]);
17306
17312
  /**
17307
- * The assist's answer a discriminated union, because "the model saw nothing"
17308
- * and "this node cannot run that model" lead to different next moves and a
17309
- * nullable result cannot tell them apart.
17313
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
17314
+ * divided by the track's detection-frame dims), computed at persist time.
17315
+ * Absent when the frame dims were unknown when the track was persisted
17316
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
17310
17317
  */
17311
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17312
- kind: literal("proposed"),
17313
- modelId: string(),
17314
- stepId: string(),
17315
- minScore: number(),
17316
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17317
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
17318
- /** Returned by the runner but removed by the threshold. */
17319
- belowThreshold: number().int()
17320
- }), object({
17321
- kind: literal("refused"),
17322
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17323
- reason: string(),
17324
- detail: string().optional()
17325
- })]);
17326
- /** The outcome of a lifecycle move owned by the retrain page. */
17327
- var RetrainTransitionResultSchema = object({
17328
- trackId: string(),
17329
- /** Where the track ended up, whatever happened. */
17330
- retrainStatus: RetrainStatusSchema,
17331
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17332
- changed: boolean(),
17333
- reason: _enum([
17334
- "unknown-track",
17335
- "no-frames-copied",
17336
- "not-staging",
17337
- "not-trained",
17338
- "unchanged"
17339
- ]).optional()
17340
- });
17341
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17342
- var MAX_EVENT_QUERY_LIMIT = 5e3;
17343
- var DeviceEventQueryInput = object({
17344
- deviceId: number(),
17345
- since: number().optional(),
17346
- until: number().optional(),
17347
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17348
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17349
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17350
- * exact behaviour. Callers may omit this field — the store defaults to
17351
- * `full` when not provided. */
17352
- projection: _enum(["full", "slim"]).optional()
17353
- });
17354
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17355
- var RecentTracksQueryInput = object({
17356
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17357
- deviceIds: array(number()),
17358
- /** Window lower bound on `lastSeen` (inclusive). */
17359
- since: number().optional(),
17360
- /** Window upper bound on `lastSeen` (inclusive). */
17361
- until: number().optional(),
17362
- /** Page size. Default 200, max 1000. */
17363
- limit: number().int().min(1).max(1e3).default(200),
17364
- /** Opaque continuation cursor from a previous page's `nextCursor`.
17365
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17366
- cursor: string().optional(),
17367
- /** See {@link TrackProjectionSchema}. Default `full`. */
17368
- projection: TrackProjectionSchema.optional(),
17369
- /** Include stationary-promoted rows (parked objects). Default false: the
17370
- * feed lists passages; parking records live on the stationary registry. */
17371
- includeStationary: boolean().optional()
17372
- });
17373
- var RecentTracksPageSchema = object({
17374
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17375
- tracks: array(TrackSchema).readonly(),
17376
- /** Cursor for the next page, or null when this page is the last. */
17377
- nextCursor: string().nullable()
17378
- });
17379
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
17380
- var LIST_GROUPS_MAX_LIMIT = 100;
17381
- var AnalyticsGroupRecordSchema = object({
17382
- id: string(),
17383
- deviceId: number().int(),
17384
- openedAt: number().int(),
17385
- closedAt: number().int(),
17386
- timestamp: number().int(),
17387
- memberCount: number().int(),
17388
- memberTrackIds: array(string()).readonly(),
17389
- className: string(),
17390
- classes: array(string()).readonly(),
17391
- /** Relative event-media path, or null when the group has no picture yet. */
17392
- mediaUrl: string().nullable(),
17393
- singleton: boolean()
17318
+ var TrackEnvelopeSchema = object({
17319
+ minX: number(),
17320
+ minY: number(),
17321
+ maxX: number(),
17322
+ maxY: number()
17394
17323
  });
17395
- var AnalyticsGroupMemberSchema = object({
17396
- trackId: string(),
17397
- deviceId: number().int(),
17398
- className: string(),
17399
- firstSeen: number().int(),
17400
- lastSeen: number().int(),
17401
- mediaUrl: string().nullable()
17402
- });
17403
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17404
- var ListGroupsQueryInput = object({
17405
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17406
- deviceIds: array(number()),
17407
- /** Window lower bound on `closedAt` (inclusive). */
17408
- since: number().optional(),
17409
- /** Window upper bound on `openedAt` (inclusive). */
17410
- until: number().optional(),
17411
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17412
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
17413
- cursor: string().optional()
17414
- });
17415
- var ListGroupsPageSchema = object({
17416
- groups: array(AnalyticsGroupRecordSchema).readonly(),
17417
- nextCursor: string().nullable()
17418
- });
17419
- var KeyEventQueryInput = object({
17420
- deviceId: number(),
17421
- /** Window lower bound (track firstSeen ≥ since). */
17422
- since: number(),
17423
- /** Window upper bound (track firstSeen ≤ until). */
17424
- until: number(),
17425
- limit: number().int().min(1).max(200).default(50),
17426
- /** Drop tracks scoring below this importance. */
17427
- minImportance: number().min(0).max(1).optional(),
17428
- /** Restrict to a single class (e.g. 'person'). */
17429
- classFilter: string().optional()
17430
- });
17431
- var KeyEventSchema = object({
17432
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
17433
- id: string(),
17434
- trackId: string(),
17435
- /** Track start time (firstSeen). */
17436
- timestamp: number(),
17437
- className: string(),
17438
- ...TieredLabelFields,
17439
- importance: number(),
17440
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
17441
- bestEventId: string(),
17442
- /** Track lifetime in ms (lastSeen - firstSeen). */
17443
- windowMs: number().optional(),
17444
- ...TrackFlagFields,
17445
- ...TrackRetrainFields
17446
- });
17447
- object({
17448
- trackId: string(),
17449
- className: string(),
17450
- confidence: number(),
17451
- bbox: BoundingBoxSchema,
17452
- zones: array(string()).readonly(),
17453
- state: TrackStateSchema
17454
- });
17455
- var OverlayDetectionSchema = looseObject({
17456
- id: string(),
17457
- kind: _enum(["first-level", "detail"]),
17458
- macroClass: string(),
17459
- score: number(),
17460
- bbox: object({
17461
- x: number(),
17462
- y: number(),
17463
- width: number(),
17464
- height: number()
17465
- }),
17466
- labels: array(looseObject({
17467
- label: string(),
17468
- score: number()
17469
- })).readonly(),
17470
- parentId: string().optional()
17471
- });
17472
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17473
- var SearchObjectEventsInput = object({
17474
- text: string(),
17475
- deviceId: number().optional(),
17476
- since: number().optional(),
17477
- until: number().optional(),
17478
- classFilter: string().optional(),
17479
- limit: number().default(50),
17480
- minScore: number().min(0).max(1).default(.2)
17481
- });
17482
- var TrackCascadeCountsSchema = object({
17483
- /** Persisted track roots deleted (authoritative). */
17484
- tracks: number().int(),
17485
- /** Object events removed with their tracks (best-effort; see note above). */
17486
- events: number().int(),
17487
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17488
- media: number().int(),
17489
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17490
- faces: number().int(),
17491
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17492
- plates: number().int(),
17493
- /** Per-track CLIP search vectors removed (best-effort). */
17494
- embeddings: number().int(),
17495
- /** Group membership + group rows removed with their last member (best-effort). */
17496
- groups: number().int()
17497
- });
17498
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17499
- var DiskReconcileCountsSchema = object({
17500
- mediaDropped: number().int(),
17501
- tracks: number().int(),
17502
- events: number().int()
17503
- });
17504
- /** Event-store footprint for one camera. */
17505
- var EventStoreDeviceFootprintSchema = object({
17506
- deviceId: number(),
17507
- /** Persisted event rows (motion + object + audio) for the camera. */
17508
- rows: number().int(),
17509
- /** Event-owned media bytes on disk for the camera. */
17510
- bytes: number().int()
17511
- });
17512
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17513
- var EventStoreFootprintSchema = object({
17514
- totalRows: number().int(),
17515
- totalBytes: number().int(),
17516
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17517
- });
17518
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17519
- var EventPruneCountsSchema = object({
17520
- motion: number().int(),
17521
- object: number().int(),
17522
- audio: number().int()
17324
+ /**
17325
+ * Row projection for track list queries. `full` (default) returns the
17326
+ * complete Track including the frame-rate `positions[]` history and the
17327
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
17328
+ * keeps every scalar the list surfaces actually render (ids, class(es),
17329
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
17330
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
17331
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
17332
+ * `getTrack`. Mirrors the event-store `projection` convention
17333
+ * (`getObjectEvents` et al.).
17334
+ */
17335
+ var TrackProjectionSchema = _enum(["full", "slim"]);
17336
+ /**
17337
+ * One audio-classification label heard on the track's camera while the
17338
+ * track was alive, aggregated per label. An "episode" is one persisted
17339
+ * audio event (the confident-classification path: score ≥ the device's
17340
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
17341
+ * one 32 ms inference chunk, so counts stay human-scaled.
17342
+ */
17343
+ var TrackAudioLabelSchema = object({
17344
+ label: string(),
17345
+ /** Highest classification score observed across the label's episodes. */
17346
+ peakScore: number(),
17347
+ /** Number of coalesced audio-event episodes carrying this label. */
17348
+ count: number(),
17349
+ firstAt: number(),
17350
+ lastAt: number()
17523
17351
  });
17524
17352
  /**
17525
- * Re-embed stored tracks from their key frames.
17353
+ * How a track was produced. `pipeline` (default / absent) = the spatial
17354
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
17355
+ * no positions, a single snapshot, and no bbox trajectory at all:
17526
17356
  *
17527
- * The reason this is an operator-callable method and not a migration script:
17528
- * every knob that decides what a vector MEANS encoder model, crop margin,
17529
- * squaring is only changeable if the existing vectors can be regenerated.
17530
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17531
- * symptom is a quality regression with no visible cause.
17357
+ * - `sensor` a linked sensor/control device state change.
17358
+ * - `audio` an audio event on the camera itself that was anomalous for
17359
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
17360
+ *
17361
+ * The spatial subsystems (tracker association, occupancy count, re-id /
17362
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
17363
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
17364
+ * check silently readmits every source added after it was written.
17532
17365
  */
17533
- var RebuildObjectEmbeddingsInput = object({
17534
- /** Restrict to one camera. Omit for the whole fleet. */
17535
- deviceId: number().optional(),
17536
- since: number().optional(),
17537
- until: number().optional(),
17538
- /** Stop after this many tracks; the result reports whether more remain. */
17539
- maxTracks: number().int().positive().optional(),
17540
- /**
17541
- * Run every embedding on THIS node instead of round-robining the fleet.
17542
- *
17543
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17544
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17545
- * calling it that would pin the rebuild REQUEST itself to that node — the
17546
- * rebuild orchestration lives on the hub, and only the per-track step runs
17547
- * remotely. This field is data; the per-track pin is applied inside.
17548
- *
17549
- * Absent ⇒ round-robin over every online node whose runner can serve the
17550
- * pinned model.
17551
- */
17552
- executeOnNodeId: string().optional(),
17553
- /**
17554
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17555
- * run flat out.
17556
- *
17557
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17558
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17559
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17560
- * force is logged at start and finish so a deliberately slow pass reads
17561
- * differently from a stalled one.
17562
- */
17563
- pacingMs: number().int().nonnegative().optional()
17564
- });
17366
+ var TrackSourceSchema = _enum([
17367
+ "pipeline",
17368
+ "sensor",
17369
+ "audio"
17370
+ ]);
17565
17371
  /**
17566
- * Result of emptying the CLIP index.
17372
+ * Where a track sits in the RETRAIN lifecycle (D81).
17567
17373
  *
17568
- * The clean slate before a policy change: a new crop margin or encoder model
17569
- * leaves two feature spaces in one index whose cosine scores are not
17570
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17571
- * means the same thing.
17374
+ * - `none` never marked, or un-marked. Evictable.
17375
+ * - `staging` the operator wants this track as training material and has not
17376
+ * finished with it. **This is the only state retention holds**: the track and
17377
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
17378
+ * the device's age window.
17379
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
17380
+ * were COPIED into the retrain dataset at selection time, so the dataset no
17381
+ * longer depends on the track's media and the track becomes EVICTABLE again.
17382
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
17383
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
17384
+ *
17385
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
17386
+ * the store's filter language has only positive equality and `whereIn` — no
17387
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
17388
+ * would make the entire pre-column history immortal in one deploy.
17572
17389
  */
17573
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17390
+ var RetrainStatusSchema = _enum([
17391
+ "none",
17392
+ "staging",
17393
+ "trained"
17394
+ ]);
17574
17395
  /**
17575
- * Acknowledgement that a rebuild STARTED.
17396
+ * Per-track OPERATOR flags set by hand from the admin UI or the viewer, never
17397
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
17398
+ * so the two surfaces cannot drift.
17576
17399
  *
17577
- * The pass costs ~1s per track 45 minutes for a 2,600-track fleet so it
17578
- * runs detached and this returns immediately. Waiting for it made the client
17579
- * time out while the work carried on server-side, which is the worst of both:
17580
- * no result and no way to know it was still going. Poll
17581
- * `getObjectEmbeddingRebuildStatus` for progress.
17400
+ * **Absent false.** A track that has never been touched omits the field; an
17401
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
17402
+ * columns existed read as absent, and a consumer that needs a boolean should say
17403
+ * `flag === true`, not `flag !== false`.
17404
+ *
17405
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
17406
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
17407
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
17408
+ * `trained` track reports `false` while refusing both writes. The boolean is
17409
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
17410
+ * "never marked" from "already trained" must read `retrainStatus`.
17411
+ *
17412
+ * `debug` does NOT pin; it is attention, not durability.
17413
+ *
17414
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17415
+ * A favourited track is skipped by retention the same way `staging` is, but
17416
+ * it does not enter `none|staging|trained` and has no staging budget.
17582
17417
  */
17583
- var RebuildObjectEmbeddingsResultSchema = object({
17584
- started: boolean(),
17585
- /** True when a pass was already running; the new request is ignored. */
17586
- alreadyRunning: boolean()
17587
- });
17588
- var RebuildStatusSchema = object({
17589
- running: boolean(),
17590
- scanned: number(),
17591
- rebuilt: number(),
17592
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17593
- missingKeyFrame: number(),
17594
- /** Tracks with no usable detection box. */
17595
- missingBbox: number(),
17596
- /**
17597
- * Tracks an executing node REFUSED rather than broke on an unreadable key
17598
- * frame, a step that threw. Separate from `failed` because the remedy is
17599
- * different, and because a whole camera silently contributing zero vectors
17600
- * is the shape of failure a rebuild must never hide.
17601
- */
17602
- notRunnable: number(),
17603
- /**
17604
- * The pass stopped because NO node could serve the pinned model.
17605
- *
17606
- * Distinct from `notRunnable` on purpose: that one says "this track was
17607
- * refused", this one says "the cluster cannot do this work at all" — every
17608
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17609
- * pinned model for its engine format, or dropped out. The remedy is a model /
17610
- * engine change, not a per-camera one. Non-zero here always comes with
17611
- * `complete: false`.
17612
- */
17613
- noCapableNode: number(),
17614
- failed: number(),
17615
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17616
- complete: boolean().nullable(),
17617
- startedAtMs: number().nullable(),
17618
- finishedAtMs: number().nullable(),
17619
- /** Present when the pass ended by throwing. */
17620
- error: string().nullable()
17418
+ var TrackFlagFields = {
17419
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
17420
+ * `'staging'`. */
17421
+ markForTrain: boolean().optional(),
17422
+ /** Operator marked this track for diagnostic attention. */
17423
+ debug: boolean().optional(),
17424
+ /** Operator favourited this track. Pins it against pruning. */
17425
+ favourited: boolean().optional()
17426
+ };
17427
+ /**
17428
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
17429
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
17430
+ * write patch, and the status is not something the toggle sets — it is what the
17431
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
17432
+ * always present on a persisted row (the column default materialises `'none'`).
17433
+ */
17434
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
17435
+ /**
17436
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
17437
+ * one flag can never clear the other — the toggles are independent and are
17438
+ * driven from three surfaces that do not know about each other.
17439
+ */
17440
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
17441
+ /**
17442
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
17443
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
17444
+ * mutation result without a re-fetch.
17445
+ */
17446
+ var TrackFlagsSchema = object({
17447
+ trackId: string(),
17448
+ markForTrain: boolean(),
17449
+ debug: boolean(),
17450
+ favourited: boolean(),
17451
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
17452
+ * a track row) because this shape is only ever produced by the write body,
17453
+ * which always knows it — and a surface that has just written needs to render
17454
+ * `trained` without a re-fetch. */
17455
+ retrainStatus: RetrainStatusSchema
17621
17456
  });
17622
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17623
- deviceId: number(),
17624
- trackId: string()
17625
- }), TrackSchema.nullable()), method(object({
17626
- deviceId: number(),
17627
- since: number().optional(),
17628
- until: number().optional(),
17629
- limit: number().optional(),
17630
- /** Spatial filter only tracks whose trajectory intersects the zone
17631
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17632
- * envelope columns, then precisely tested per position. Tracks with
17633
- * an unknown envelope (no frame dims at persist time) always match. */
17634
- zone: TrackZoneFilterSchema.optional(),
17635
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17636
- * compatible — omitting the field keeps today's exact behaviour). */
17637
- projection: TrackProjectionSchema.optional(),
17638
- /** Include stationary-promoted rows (parked objects handed to the
17639
- * stationary registry). Default false: the timeline lists passages,
17640
- * not parking records (operator decision, 2026-08-15). */
17641
- includeStationary: boolean().optional()
17642
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17643
- deviceId: number(),
17644
- groupId: string().min(1)
17645
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17646
- kind: "mutation",
17647
- auth: "admin"
17648
- }), 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({
17649
- deviceId: number(),
17650
- since: number().optional(),
17651
- until: number().optional(),
17652
- kinds: array(string()).optional(),
17653
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17654
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17655
- deviceId: number(),
17656
- since: number(),
17657
- until: number(),
17658
- bucketMs: number().int().positive()
17659
- }), array(object({
17660
- bucketStart: number(),
17661
- motion: number().int(),
17662
- object: number().int(),
17663
- audio: number().int()
17664
- })).readonly()), method(object({
17665
- deviceId: number(),
17666
- cutoffMs: number()
17667
- }), object({
17668
- motion: number().int(),
17669
- object: number().int(),
17670
- audio: number().int()
17671
- }), {
17672
- kind: "mutation",
17673
- auth: "admin"
17674
- }), method(object({
17675
- deviceId: number(),
17676
- cutoffMs: number()
17677
- }), TrackCascadeCountsSchema, {
17678
- kind: "mutation",
17679
- auth: "admin"
17680
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17681
- kind: "mutation",
17682
- auth: "admin"
17683
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17684
- kind: "mutation",
17685
- auth: "admin"
17686
- }), method(object({
17687
- deviceId: number(),
17688
- trackIds: array(string()).min(1)
17689
- }), object({
17690
- deleted: number().int(),
17691
- failed: array(string()).readonly()
17692
- }), {
17693
- kind: "mutation",
17694
- auth: "admin"
17695
- }), method(object({
17696
- /** Log/audit scope only — the trackId is globally unique on its own. */
17457
+ union([literal(1), literal(2)]);
17458
+ /**
17459
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
17460
+ * the step and model that produced it — which is what makes the write rule
17461
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17462
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17463
+ *
17464
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17465
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17466
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
17467
+ * that value has no provenance, and the write rule lets ANY properly-attributed
17468
+ * write of the same tier replace it regardless of score.
17469
+ */
17470
+ var LabelAttributionSchema = object({
17471
+ stepId: string(),
17472
+ modelId: string().optional(),
17473
+ decidedAt: number(),
17474
+ /**
17475
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
17476
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17477
+ *
17478
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
17479
+ * notification rule authored on "Gianluca" stopped matching the moment the
17480
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
17481
+ * the thing that does not move, so it is what a rule matches on
17482
+ * (`NcConditions.identities`) and the text is what a human is shown.
17483
+ *
17484
+ * Absent when the label names no gallery row — a plate the OCR read but no
17485
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17486
+ */
17487
+ identityId: string().optional()
17488
+ });
17489
+ /**
17490
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17491
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17492
+ * track and its events always answer the same question the same way.
17493
+ *
17494
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17495
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17496
+ * is tier 2, and each carries its own score + attribution.
17497
+ *
17498
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17499
+ * finest thing known. Before 4g the single `label` column held the finest
17500
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17501
+ * shows nothing on a species-only row; that is why the migration puts every
17502
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17503
+ * and why the read surfaces were changed in the same train.
17504
+ *
17505
+ * **Writing it.** The slots are independent, which is the whole point: a
17506
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17507
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17508
+ * higher score wins. One rule, one implementation — see
17509
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17510
+ */
17511
+ var TieredLabelFields = {
17512
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
17513
+ label: string().optional(),
17514
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17515
+ labelScore: number().optional(),
17516
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17517
+ labelMeta: LabelAttributionSchema.optional(),
17518
+ /** Tier 2 the instance. See {@link LabelTierSchema}. */
17519
+ subLabel: string().optional(),
17520
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17521
+ subLabelScore: number().optional(),
17522
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17523
+ subLabelMeta: LabelAttributionSchema.optional()
17524
+ };
17525
+ /** Per-camera slice of a training-export estimate. */
17526
+ var TrainingExportDeviceTotalsSchema = object({
17697
17527
  deviceId: number(),
17528
+ tracks: number().int(),
17529
+ files: number().int(),
17530
+ bytes: number().int()
17531
+ });
17532
+ /**
17533
+ * What a training export WOULD contain. Computed from media index rows only —
17534
+ * no blob is read to produce this.
17535
+ */
17536
+ var TrainingExportSummarySchema = object({
17537
+ generatedAt: number(),
17538
+ trackCount: number().int(),
17539
+ fileCount: number().int(),
17540
+ byteCount: number().int(),
17541
+ /** More marked tracks exist than a single pass carries. */
17542
+ truncated: boolean(),
17543
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17544
+ });
17545
+ var TrackSchema = object({
17698
17546
  trackId: string(),
17699
- flags: TrackFlagsPatchSchema
17700
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17701
- kind: "query",
17702
- auth: "admin"
17703
- }), method(object({
17704
- olderThanMs: number(),
17705
- reason: OpsLogReasonSchema.optional()
17706
- }), EventPruneCountsSchema, {
17707
- kind: "mutation",
17708
- auth: "admin"
17709
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17710
- kind: "mutation",
17711
- auth: "admin"
17712
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17713
- kind: "mutation",
17714
- auth: "admin"
17715
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17716
- kind: "mutation",
17717
- auth: "admin"
17718
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17719
- kind: "mutation",
17720
- auth: "admin"
17721
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17722
- kind: "mutation",
17723
- auth: "admin"
17724
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17725
- kind: "mutation",
17726
- auth: "admin"
17727
- }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
17728
- kind: "mutation",
17729
- auth: "admin"
17730
- }), method(object({}), array(RelocateJobSchema).readonly(), {
17731
- kind: "query",
17732
- auth: "admin"
17733
- }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17734
- kind: "mutation",
17735
- auth: "admin"
17736
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17737
- kind: "query",
17738
- auth: "admin"
17739
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17740
- kind: "query",
17741
- auth: "admin"
17742
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17743
- kind: "query",
17744
- auth: "admin"
17745
- }), method(object({
17746
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17747
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17748
- * route it at one camera's owner, and "every camera" would stop being
17749
- * expressible at all. */
17750
- deviceIds: array(number()).optional(),
17751
- limit: number().int().min(1).max(500).optional()
17752
- }), array(RetrainTrackSchema).readonly(), {
17753
- kind: "query",
17754
- auth: "admin"
17755
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17756
- kind: "query",
17757
- auth: "admin"
17758
- }), method(object({
17759
17547
  deviceId: number(),
17760
- trackId: string(),
17761
- mediaKeys: array(string()).min(1)
17762
- }), RetrainFrameSelectionSchema, {
17763
- kind: "mutation",
17764
- auth: "admin"
17765
- }), method(object({
17548
+ className: string(),
17549
+ ...TieredLabelFields,
17550
+ producingDeviceName: string().optional(),
17551
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17552
+ source: TrackSourceSchema.optional(),
17553
+ firstSeen: number(),
17554
+ lastSeen: number(),
17555
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17556
+ positions: array(TrackPositionSchema).readonly(),
17557
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17558
+ * saveThumbnails policy). */
17559
+ snapshots: array(TrackSnapshotSchema).readonly(),
17560
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17561
+ zonesVisited: array(string()).readonly(),
17562
+ /**
17563
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17564
+ * `zones` capability.
17565
+ *
17566
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17567
+ * and no card can render — so every free-text search surface was structurally
17568
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17569
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17570
+ * derivation and costs the clients no extra call (the `zones` cap is
17571
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17572
+ * surface built to avoid exactly that).
17573
+ *
17574
+ * Resolved, never invented: a zone deleted since the track was written has no
17575
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17576
+ * two are not positionally aligned. Absent when the track visited no zone, or
17577
+ * when the zone catalogue could not be read.
17578
+ */
17579
+ zoneNames: array(string()).readonly().optional(),
17580
+ /** Deduplicated set of detector classes observed for this track over its
17581
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17582
+ * legacy rows written before class accumulation shipped. */
17583
+ classes: array(string()).readonly().optional(),
17584
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17585
+ totalDistance: number(),
17586
+ state: TrackStateSchema,
17587
+ active: boolean(),
17588
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17589
+ * track expiry, recomputed on late label). Absent on legacy rows written
17590
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17591
+ importance: number().optional(),
17592
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17593
+ * "best" frame). Absent when the track produced no object events. */
17594
+ bestEventId: string().optional(),
17595
+ /** Tag of the importance sub-signal that dominated the score
17596
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17597
+ importanceReason: string().optional(),
17598
+ /** Audio-classification labels heard on the camera during the track's
17599
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17600
+ * Absent on legacy rows / tracks with no confident audio. */
17601
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17602
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17603
+ * Populated from the persisted envelope columns on historical reads;
17604
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17605
+ envelope: TrackEnvelopeSchema.optional(),
17606
+ /**
17607
+ * A face DETECTOR found a face on this track — nothing more. It says the
17608
+ * detail plane produced a `face` detail; it does NOT say the face was
17609
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17610
+ * enabled. Set once and never cleared.
17611
+ *
17612
+ * **This exists so "face present but not recognised" is expressible.** A
17613
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17614
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17615
+ * and a track with no face at all were byte-identical on the wire and no
17616
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17617
+ * === undefined`.
17618
+ *
17619
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17620
+ * and so does every server that predates the field — a consumer must test
17621
+ * `=== true` and render nothing otherwise, never infer "no face".
17622
+ */
17623
+ hasFace: boolean().optional(),
17624
+ /**
17625
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17626
+ * face an operator could ASSIGN to an identity.
17627
+ *
17628
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17629
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17630
+ * branch, before every gate, and means no more than "a face detector produced
17631
+ * a face detail". This one is stamped at the single moment the gallery row
17632
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17633
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17634
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17635
+ * the crop-store drop. Everything between the detector and that insert can
17636
+ * legitimately refuse the face, so a flag written any earlier promises the
17637
+ * operator something to assign and delivers nothing.
17638
+ *
17639
+ * **Independent of recognition.** A face collected but never auto-matched is
17640
+ * still assignable — it is in fact the face an operator most wants to reach —
17641
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17642
+ * `subLabel`; this says only that the raw material exists.
17643
+ *
17644
+ * **Set once, never cleared.** A track that produced a gallery row produced
17645
+ * one; deleting the row later is the gallery's business, not this flag's.
17646
+ *
17647
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17648
+ * before the column omits it, and so does every server that predates the
17649
+ * field. A consumer must test `=== true` and render nothing otherwise —
17650
+ * never infer "no assignable face".
17651
+ */
17652
+ hasEmbeddedFace: boolean().optional(),
17653
+ /**
17654
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17655
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17656
+ * so the passage is tracked once and as a VEHICLE.
17657
+ *
17658
+ * It exists because the fold's record was dishonest. D34 and the code both
17659
+ * said "the person is not lost — it is reported so both entities stay on the
17660
+ * record"; in fact the pair went into a per-processor RAM field behind an
17661
+ * accessor nobody called, and every durable surface said `vehicle`, full
17662
+ * stop. This is the composition note that makes the row true.
17663
+ *
17664
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17665
+ * person" is not an answer to "what is this" — both label tiers would refuse
17666
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17667
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17668
+ * and a `person` rule still does not fire for someone cycling past.
17669
+ *
17670
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17671
+ * the column, and every hub that predates the field, omits it. Test
17672
+ * `=== true` and render nothing otherwise — never infer "no rider".
17673
+ */
17674
+ hasRider: boolean().optional(),
17675
+ ...TrackFlagFields,
17676
+ ...TrackRetrainFields
17677
+ });
17678
+ var BaseEventFields = {
17679
+ id: string(),
17766
17680
  deviceId: number(),
17767
- trackId: string(),
17768
- frameId: string()
17769
- }), object({
17770
- removed: boolean(),
17771
- removedAnnotations: number().int()
17772
- }), {
17773
- kind: "mutation",
17774
- auth: "admin"
17775
- }), method(object({ frameId: string() }), object({
17681
+ timestamp: number()
17682
+ };
17683
+ var MotionEventSchema = object({
17684
+ ...BaseEventFields,
17685
+ kind: literal("motion"),
17686
+ regionCount: number(),
17687
+ /** Heavy JSON array — omitted in slim projection. */
17688
+ regions: array(object({
17689
+ bbox: BoundingBoxSchema,
17690
+ pixelCount: number(),
17691
+ intensity: number()
17692
+ })).readonly().optional(),
17693
+ /** Omitted in slim projection. */
17694
+ frameWidth: number().optional(),
17695
+ /** Omitted in slim projection. */
17696
+ frameHeight: number().optional(),
17697
+ /** Populated by B5 (recording playback URL for this event). */
17698
+ mediaUrl: string().optional()
17699
+ });
17700
+ /**
17701
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17702
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17703
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17704
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17705
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17706
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17707
+ */
17708
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17709
+ /**
17710
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17711
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17712
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17713
+ * appearance event carry none, so a rule asking for a direction fails closed
17714
+ * on them.
17715
+ *
17716
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17717
+ * into its own event, so a frame in which a track enters A while leaving B
17718
+ * produces two events with two directions — never one ambiguous row.
17719
+ *
17720
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17721
+ * membership the box has NOW, and by definition it no longer contains the zone
17722
+ * that was just left. Without the id here, a zone-scoped rule could never match
17723
+ * the exit it asked for.
17724
+ */
17725
+ var ZoneCrossingSchema = object({
17726
+ direction: _enum(["enter", "exit"]),
17727
+ /** Admin zone id crossed. */
17728
+ zoneId: string(),
17729
+ /** Zone display name at crossing time (falls back to the id). */
17730
+ zoneName: string().optional()
17731
+ });
17732
+ var ObjectEventSchema = object({
17733
+ ...BaseEventFields,
17734
+ kind: literal("object"),
17735
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17736
+ source: DetectionSourceSchema.optional(),
17737
+ /**
17738
+ * Inference-frame id shared by every object event emitted from the SAME frame
17739
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17740
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17741
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17742
+ * Optional for backward-compat with pre-existing rows / the slim projection
17743
+ * includes it (it is light). Absent on rows written before this field.
17744
+ */
17745
+ frameId: string().optional(),
17746
+ /** Omitted in slim projection. */
17747
+ trackId: string().optional(),
17748
+ className: string(),
17749
+ ...TieredLabelFields,
17750
+ /** Omitted in slim projection. */
17751
+ confidence: number().optional(),
17752
+ /** Heavy JSON — omitted in slim projection. */
17753
+ bbox: BoundingBoxSchema.optional(),
17754
+ /** Heavy JSON — omitted in slim projection. */
17755
+ zones: array(string()).readonly().optional(),
17756
+ /** Omitted in slim projection. */
17757
+ state: TrackStateSchema.optional(),
17758
+ /**
17759
+ * The zone crossing this event IS, when it is one. Absent on every other
17760
+ * event kind (movement state, appearance, package) — see
17761
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17762
+ */
17763
+ zoneCrossing: ZoneCrossingSchema.optional(),
17764
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17765
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17766
+ frameWidth: number().optional(),
17767
+ frameHeight: number().optional(),
17768
+ /** MediaStore key for the crop attached to this event (if any). */
17769
+ mediaKey: string().optional(),
17770
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17771
+ * best-detection full frame). Resolve via the event-media data-plane
17772
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17773
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17774
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17775
+ keyFrameMediaKey: string().optional(),
17776
+ /** Populated by B5 (recording playback URL for this event). */
17777
+ mediaUrl: string().optional(),
17778
+ /** The parent track's key-event importance [0,1], propagated to every object
17779
+ * event of the track (so an event row can be sorted by importance without a
17780
+ * track join). Absent on legacy rows / before the track was scored. */
17781
+ importance: number().optional()
17782
+ });
17783
+ var AudioEventSchema = object({
17784
+ ...BaseEventFields,
17785
+ kind: literal("audio"),
17786
+ rms: number(),
17787
+ dbfs: number(),
17788
+ classification: object({
17789
+ className: string(),
17790
+ originalClass: string().optional(),
17791
+ score: number()
17792
+ }).optional(),
17793
+ /** Populated by B5 (recording playback URL for this event). */
17794
+ mediaUrl: string().optional()
17795
+ });
17796
+ var MediaFileKindEnum = _enum([
17797
+ "crop",
17798
+ "thumbnail",
17799
+ "snapshot",
17800
+ "firstFrame",
17801
+ "lastFrame",
17802
+ "fullFrame",
17803
+ "fullFrameBoxed",
17804
+ "faceCrop",
17805
+ "plateCrop",
17806
+ "keyFrame",
17807
+ "keyFrameSmall",
17808
+ "thumbnailSmall"
17809
+ ]);
17810
+ var MediaFileSchema = object({
17811
+ key: string(),
17812
+ kind: MediaFileKindEnum,
17776
17813
  base64: string(),
17777
- width: number().int(),
17778
- height: number().int()
17779
- }), {
17780
- kind: "query",
17781
- auth: "admin"
17782
- }), method(object({
17783
- deviceId: number(),
17784
- trackId: string(),
17785
- frameId: string(),
17786
- subject: RetrainAssistSubjectSchema,
17787
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17788
- nodeId: string().optional()
17789
- }), RetrainAssistResultSchema, {
17790
- kind: "mutation",
17791
- auth: "admin"
17792
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17793
- kind: "query",
17794
- auth: "admin"
17795
- }), method(object({
17796
- deviceId: number(),
17797
- trackId: string(),
17798
- frameId: string(),
17799
- annotations: array(RetrainAnnotationDraftSchema)
17800
- }), array(RetrainAnnotationSchema).readonly(), {
17801
- kind: "mutation",
17802
- auth: "admin"
17803
- }), method(object({
17804
- deviceId: number(),
17805
- trackId: string()
17806
- }), RetrainTransitionResultSchema, {
17807
- kind: "mutation",
17808
- auth: "admin"
17809
- }), method(object({
17810
- deviceId: number(),
17811
- trackId: string()
17812
- }), RetrainTransitionResultSchema, {
17813
- kind: "mutation",
17814
- auth: "admin"
17815
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17816
- kind: "query",
17817
- auth: "admin"
17818
- }), method(object({
17819
- eventId: string(),
17820
- kind: MediaFileKindEnum.optional(),
17821
- deviceId: number()
17822
- }), array(MediaFileSchema).readonly()), method(object({
17823
- trackId: string(),
17824
- kinds: array(MediaFileKindEnum).optional(),
17825
- deviceId: number()
17826
- }), array(MediaFileSchema).readonly()), method(object({
17814
+ sizeBytes: number(),
17815
+ timestamp: number()
17816
+ });
17817
+ /**
17818
+ * One media row WITHOUT its bytes.
17819
+ *
17820
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17821
+ * 140 s track), and a client that renders tiles from the media data plane needs
17822
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17823
+ * with an immutable cache, instead of all at once inside a tRPC response that
17824
+ * blocks the whole view.
17825
+ *
17826
+ * `sizeBytes` is carried because it is what lets a client decide between the
17827
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17828
+ */
17829
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17830
+ /**
17831
+ * The MACRO tier of an annotation — a CLOSED set.
17832
+ *
17833
+ * This is what the exported detector predicts, so a typo here is a new class
17834
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17835
+ * the whole point of the page is teaching the model things it does not know
17836
+ * yet, and constraining that vocabulary would make it useless.
17837
+ *
17838
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17839
+ * `subLabel` is one of these values, in any casing, because once `person`
17840
+ * exists in both tiers "every person box" stops being answerable without
17841
+ * knowing every string anyone ever typed — and the damage is retroactive.
17842
+ */
17843
+ var RetrainMacroClassSchema = _enum([
17844
+ "person",
17845
+ "vehicle",
17846
+ "animal",
17847
+ "package",
17848
+ "face",
17849
+ "plate"
17850
+ ]);
17851
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17852
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17853
+ /** Did a human draw this box, or did the assist propose it? */
17854
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17855
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17856
+ var RetrainBboxSchema = object({
17857
+ x: number(),
17858
+ y: number(),
17859
+ w: number(),
17860
+ h: number()
17861
+ });
17862
+ /**
17863
+ * One annotated subject.
17864
+ *
17865
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17866
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17867
+ * derived from it at export and never stored — storing them is how one feature
17868
+ * space ends up holding two crops of the same subject (D52).
17869
+ */
17870
+ var RetrainAnnotationSchema = object({
17871
+ id: string(),
17827
17872
  trackId: string(),
17828
- deviceId: number()
17829
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17830
- kind: "mutation",
17831
- auth: "admin"
17832
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17833
- kind: "mutation",
17834
- auth: "admin"
17835
- }), method(object({}), RebuildStatusSchema), object({
17836
- deviceId: number(),
17837
- timestamp: number(),
17838
- frameWidth: number(),
17839
- frameHeight: number(),
17840
- detections: array(OverlayDetectionSchema).readonly()
17841
- }), object({
17842
17873
  deviceId: number(),
17874
+ /** The COPY in retrain storage — never the source track's media key. */
17875
+ mediaKey: string(),
17876
+ bbox: RetrainBboxSchema,
17877
+ macroClass: RetrainMacroClassSchema,
17878
+ label: string().optional(),
17879
+ subLabel: string().optional(),
17880
+ kind: RetrainAnnotationKindSchema,
17881
+ source: RetrainAnnotationSourceSchema,
17882
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17883
+ assistModelId: string().optional(),
17884
+ assistScore: number().optional(),
17885
+ exportedInBatch: string().optional(),
17886
+ createdAt: number()
17887
+ });
17888
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17889
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17890
+ id: true,
17891
+ trackId: true,
17892
+ deviceId: true,
17893
+ mediaKey: true,
17894
+ createdAt: true,
17895
+ exportedInBatch: true
17896
+ });
17897
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17898
+ var RetrainTrackSchema = object({
17843
17899
  trackId: string(),
17844
- className: string()
17845
- }), object({
17846
17900
  deviceId: number(),
17847
- trackId: string(),
17848
17901
  className: string(),
17849
- durationMs: number()
17850
- }), object({
17902
+ label: string().optional(),
17903
+ firstSeen: number(),
17904
+ lastSeen: number(),
17905
+ /** How many frames the dataset already holds from this track. */
17906
+ frameCount: number().int(),
17907
+ /** How many subjects have been annotated on those frames. `0` with
17908
+ * `frameCount: 0` is exactly "staging, still to work". */
17909
+ annotationCount: number().int()
17910
+ });
17911
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17912
+ var RetrainFrameCandidateSchema = object({
17913
+ mediaKey: string(),
17914
+ kind: MediaFileKindEnum,
17915
+ timestamp: number(),
17916
+ sizeBytes: number().int(),
17917
+ /** A copy of this original already exists — selecting it is free and cannot
17918
+ * fail, whatever became of the original. */
17919
+ copied: boolean()
17920
+ });
17921
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17922
+ var RetrainFrameSchema = object({
17923
+ frameId: string(),
17851
17924
  deviceId: number(),
17852
- kind: EventKindSchema,
17853
- eventId: string(),
17854
- timestamp: number()
17925
+ trackId: string(),
17926
+ /** Provenance only. It may already point at nothing — that is expected. */
17927
+ sourceMediaKey: string(),
17928
+ sourceKind: MediaFileKindEnum,
17929
+ sizeBytes: number().int(),
17930
+ width: number().int(),
17931
+ height: number().int(),
17932
+ copiedAt: number()
17855
17933
  });
17856
- /**
17857
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17858
- * within the frame, so the executor can re-cut a leaf child ROI at native
17859
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17860
- */
17861
- var NativeCropRefSchema = object({
17862
- /** Handle keying the retained native surface (node-pinned to its owner). */
17863
- handle: FrameHandleSchema,
17864
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17865
- cropFrameSpace: object({
17866
- x: number(),
17867
- y: number(),
17868
- w: number(),
17869
- h: number()
17870
- })
17934
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17935
+ var RetrainCopyRefusalSchema = _enum([
17936
+ "source-missing",
17937
+ "unreadable-image",
17938
+ "write-failed"
17939
+ ]);
17940
+ var RetrainFrameSelectionSchema = object({
17941
+ copied: array(RetrainFrameSchema).readonly(),
17942
+ refused: array(object({
17943
+ sourceMediaKey: string(),
17944
+ reason: RetrainCopyRefusalSchema
17945
+ })).readonly()
17871
17946
  });
17872
- object({
17873
- crop: object({
17874
- left: number(),
17875
- top: number(),
17876
- width: number().positive(),
17877
- height: number().positive()
17878
- }).optional(),
17879
- content: object({
17880
- width: number().int().positive(),
17881
- height: number().int().positive()
17882
- }),
17883
- fit: _enum(["stretch", "contain"]),
17884
- format: _enum([
17885
- "rgb",
17886
- "gray",
17887
- "jpeg"
17888
- ])
17947
+ var RetrainFrameListSchema = object({
17948
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17949
+ copies: array(RetrainFrameSchema).readonly(),
17950
+ /** What the page pre-selects — the native key frame when one survives. */
17951
+ autoPickMediaKey: string().optional()
17889
17952
  });
17953
+ /** What the operator asked the assist to look for. */
17954
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17955
+ kind: literal("package"),
17956
+ zone: RetrainBboxSchema.optional()
17957
+ }), object({
17958
+ kind: literal("objects"),
17959
+ modelId: string(),
17960
+ minScore: number().optional()
17961
+ })]);
17890
17962
  /**
17891
- * Process-local frame identity. It is serializable so it can ride an in-process
17892
- * capability call, but `registryId` deliberately prevents resolution in any
17893
- * other process or execution group.
17963
+ * The assist's answer a discriminated union, because "the model saw nothing"
17964
+ * and "this node cannot run that model" lead to different next moves and a
17965
+ * nullable result cannot tell them apart.
17894
17966
  */
17895
- var FrameRefSchema = object({
17896
- registryId: string().min(1),
17897
- id: string().min(1),
17898
- width: number().int().positive(),
17899
- height: number().int().positive(),
17900
- format: _enum(["rgb", "gray"]),
17901
- timestamp: number(),
17902
- capturedAt: number().optional()
17967
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17968
+ kind: literal("proposed"),
17969
+ modelId: string(),
17970
+ stepId: string(),
17971
+ minScore: number(),
17972
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17973
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17974
+ /** Returned by the runner but removed by the threshold. */
17975
+ belowThreshold: number().int()
17976
+ }), object({
17977
+ kind: literal("refused"),
17978
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17979
+ reason: string(),
17980
+ detail: string().optional()
17981
+ })]);
17982
+ /** The outcome of a lifecycle move owned by the retrain page. */
17983
+ var RetrainTransitionResultSchema = object({
17984
+ trackId: string(),
17985
+ /** Where the track ended up, whatever happened. */
17986
+ retrainStatus: RetrainStatusSchema,
17987
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17988
+ changed: boolean(),
17989
+ reason: _enum([
17990
+ "unknown-track",
17991
+ "no-frames-copied",
17992
+ "not-staging",
17993
+ "not-trained",
17994
+ "unchanged"
17995
+ ]).optional()
17903
17996
  });
17904
- var ModelFormatSchema$1 = _enum([
17905
- "onnx",
17906
- "coreml",
17907
- "openvino",
17908
- "tflite",
17909
- "pt",
17910
- "gguf"
17911
- ]);
17912
- var PipelineSlotSchema = _enum([
17913
- "detector",
17914
- "cropper",
17915
- "classifier",
17916
- "refiner",
17917
- "audio-classifier"
17918
- ]);
17919
- var PipelineEngineChoiceSchema = object({
17920
- runtime: _enum(["node", "python"]),
17921
- backend: string(),
17922
- format: ModelFormatSchema$1,
17923
- device: string().optional()
17997
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17998
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17999
+ var DeviceEventQueryInput = object({
18000
+ deviceId: number(),
18001
+ since: number().optional(),
18002
+ until: number().optional(),
18003
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18004
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18005
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18006
+ * exact behaviour. Callers may omit this field — the store defaults to
18007
+ * `full` when not provided. */
18008
+ projection: _enum(["full", "slim"]).optional()
17924
18009
  });
17925
- var AvailableEngineSchema = object({
17926
- engine: PipelineEngineChoiceSchema,
17927
- devices: array(object({
17928
- id: string(),
17929
- label: string(),
17930
- description: string().optional()
17931
- })).readonly(),
17932
- defaultDevice: string()
18010
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
18011
+ var RecentTracksQueryInput = object({
18012
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
18013
+ deviceIds: array(number()),
18014
+ /** Window lower bound on `lastSeen` (inclusive). */
18015
+ since: number().optional(),
18016
+ /** Window upper bound on `lastSeen` (inclusive). */
18017
+ until: number().optional(),
18018
+ /** Page size. Default 200, max 1000. */
18019
+ limit: number().int().min(1).max(1e3).default(200),
18020
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
18021
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
18022
+ cursor: string().optional(),
18023
+ /** See {@link TrackProjectionSchema}. Default `full`. */
18024
+ projection: TrackProjectionSchema.optional(),
18025
+ /** Include stationary-promoted rows (parked objects). Default false: the
18026
+ * feed lists passages; parking records live on the stationary registry. */
18027
+ includeStationary: boolean().optional()
18028
+ });
18029
+ var RecentTracksPageSchema = object({
18030
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
18031
+ tracks: array(TrackSchema).readonly(),
18032
+ /** Cursor for the next page, or null when this page is the last. */
18033
+ nextCursor: string().nullable()
17933
18034
  });
17934
- var PipelineDefaultStepSchema = lazy(() => object({
17935
- addonId: string(),
17936
- addonName: string(),
17937
- slot: PipelineSlotSchema,
17938
- inputClasses: array(string()).readonly(),
17939
- outputClasses: array(string()).readonly(),
17940
- enabled: boolean(),
17941
- modelId: string(),
17942
- children: array(PipelineDefaultStepSchema).readonly(),
17943
- group: string().optional(),
17944
- settings: record(string(), unknown()).optional()
17945
- }));
17946
- var PipelineTemplateStepSchema = lazy(() => object({
17947
- addonId: string(),
17948
- enabled: boolean(),
17949
- modelId: string(),
17950
- children: array(PipelineTemplateStepSchema).readonly(),
17951
- settings: record(string(), unknown()).optional()
17952
- }));
17953
- var PipelineTemplateSchema$1 = object({
18035
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
18036
+ var LIST_GROUPS_MAX_LIMIT = 100;
18037
+ var AnalyticsGroupRecordSchema = object({
17954
18038
  id: string(),
17955
- name: string(),
17956
- createdAt: string(),
17957
- updatedAt: string(),
17958
- engine: PipelineEngineChoiceSchema,
17959
- steps: array(PipelineTemplateStepSchema).readonly()
18039
+ deviceId: number().int(),
18040
+ openedAt: number().int(),
18041
+ closedAt: number().int(),
18042
+ timestamp: number().int(),
18043
+ memberCount: number().int(),
18044
+ memberTrackIds: array(string()).readonly(),
18045
+ className: string(),
18046
+ classes: array(string()).readonly(),
18047
+ /** Relative event-media path, or null when the group has no picture yet. */
18048
+ mediaUrl: string().nullable(),
18049
+ singleton: boolean()
17960
18050
  });
17961
- var PipelineModelOptionSchema = object({
17962
- id: string(),
17963
- name: string(),
17964
- formats: record(string(), object({
17965
- downloaded: boolean(),
17966
- sizeMB: number()
17967
- })),
17968
- group: ModelVariantGroupSchema.optional(),
17969
- legacy: boolean().optional(),
17970
- provider: ModelProviderIdSchema.optional()
18051
+ var AnalyticsGroupMemberSchema = object({
18052
+ trackId: string(),
18053
+ deviceId: number().int(),
18054
+ className: string(),
18055
+ firstSeen: number().int(),
18056
+ lastSeen: number().int(),
18057
+ mediaUrl: string().nullable()
17971
18058
  });
17972
- var ConfigFieldBridge = custom();
17973
- var PipelineAddonSchemaSchema = object({
17974
- id: string(),
17975
- name: string(),
17976
- slot: PipelineSlotSchema,
17977
- inputClasses: array(string()).readonly(),
17978
- outputClasses: array(string()).readonly(),
17979
- childSlots: array(PipelineSlotSchema).readonly(),
17980
- models: array(PipelineModelOptionSchema).readonly(),
17981
- defaultModelId: string(),
17982
- defaultModelIdByFormat: record(string(), string()).optional(),
17983
- enabledByDefault: boolean().optional(),
17984
- backfillIntoExistingOverrides: boolean().optional(),
17985
- defaultConfidence: number(),
17986
- group: string().optional(),
17987
- configSchema: array(ConfigFieldBridge).readonly().optional()
18059
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
18060
+ var ListGroupsQueryInput = object({
18061
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
18062
+ deviceIds: array(number()),
18063
+ /** Window lower bound on `closedAt` (inclusive). */
18064
+ since: number().optional(),
18065
+ /** Window upper bound on `openedAt` (inclusive). */
18066
+ until: number().optional(),
18067
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
18068
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
18069
+ cursor: string().optional()
17988
18070
  });
17989
- var PipelineSlotSchemaSchema = object({
17990
- id: PipelineSlotSchema,
17991
- label: string(),
17992
- priority: number(),
17993
- parentSlot: PipelineSlotSchema.nullable(),
17994
- addons: array(PipelineAddonSchemaSchema).readonly()
18071
+ var ListGroupsPageSchema = object({
18072
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
18073
+ nextCursor: string().nullable()
17995
18074
  });
17996
- var PipelineSchemaSchema = object({
17997
- availableEngines: array(AvailableEngineSchema).readonly(),
17998
- selectedEngine: PipelineEngineChoiceSchema,
17999
- slots: array(PipelineSlotSchemaSchema).readonly()
18075
+ var KeyEventQueryInput = object({
18076
+ deviceId: number(),
18077
+ /** Window lower bound (track firstSeen ≥ since). */
18078
+ since: number(),
18079
+ /** Window upper bound (track firstSeen ≤ until). */
18080
+ until: number(),
18081
+ limit: number().int().min(1).max(200).default(50),
18082
+ /** Drop tracks scoring below this importance. */
18083
+ minImportance: number().min(0).max(1).optional(),
18084
+ /** Restrict to a single class (e.g. 'person'). */
18085
+ classFilter: string().optional()
18000
18086
  });
18001
- var EngineProvisioningSchema = object({
18002
- runtimeId: _enum([
18003
- "onnx",
18004
- "openvino",
18005
- "coreml",
18006
- "edgetpu"
18007
- ]).nullable(),
18008
- device: string().nullable(),
18009
- state: _enum([
18010
- "idle",
18011
- "installing",
18012
- "verifying",
18013
- "ready",
18014
- "failed"
18015
- ]),
18016
- progress: number().optional(),
18017
- error: string().optional(),
18018
- nextRetryAt: number().optional(),
18019
- /**
18020
- * Gate A (config-correctness gate at engine change): human-readable
18021
- * config issues surfaced EAGERLY when the node's engine changes — model
18022
- * substitutions ("chose X, running Y") and zero-build steps ("no model
18023
- * has a <format> build"). Additive/optional: informational only, never
18024
- * enforced here — `assertEngineReady` (readiness) still gates inference.
18025
- * Absent/empty when the node-default tree resolves cleanly.
18026
- */
18027
- configIssues: array(string()).optional()
18087
+ var KeyEventSchema = object({
18088
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
18089
+ id: string(),
18090
+ trackId: string(),
18091
+ /** Track start time (firstSeen). */
18092
+ timestamp: number(),
18093
+ className: string(),
18094
+ ...TieredLabelFields,
18095
+ importance: number(),
18096
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
18097
+ bestEventId: string(),
18098
+ /** Track lifetime in ms (lastSeen - firstSeen). */
18099
+ windowMs: number().optional(),
18100
+ ...TrackFlagFields,
18101
+ ...TrackRetrainFields
18028
18102
  });
18029
- var PipelineStepInputSchema = lazy(() => object({
18030
- addonId: string(),
18031
- modelId: string().optional(),
18032
- enabled: boolean().default(true),
18033
- children: array(PipelineStepInputSchema).optional(),
18034
- settings: record(string(), unknown()).optional(),
18035
- jumpDeviceKey: string().optional()
18036
- }));
18037
- var ModelSubstitutionSchema = object({
18038
- addonId: string(),
18039
- chosen: string(),
18040
- running: string(),
18041
- format: string()
18103
+ object({
18104
+ trackId: string(),
18105
+ className: string(),
18106
+ confidence: number(),
18107
+ bbox: BoundingBoxSchema,
18108
+ zones: array(string()).readonly(),
18109
+ state: TrackStateSchema
18042
18110
  });
18043
- var PipelineValidationIssueSchema = object({
18044
- addonId: string(),
18045
- kind: _enum(["unknown-addon", "no-format-build"]),
18046
- detail: string()
18111
+ var OverlayDetectionSchema = looseObject({
18112
+ id: string(),
18113
+ kind: _enum(["first-level", "detail"]),
18114
+ macroClass: string(),
18115
+ score: number(),
18116
+ bbox: object({
18117
+ x: number(),
18118
+ y: number(),
18119
+ width: number(),
18120
+ height: number()
18121
+ }),
18122
+ labels: array(looseObject({
18123
+ label: string(),
18124
+ score: number()
18125
+ })).readonly(),
18126
+ parentId: string().optional()
18047
18127
  });
18048
- var PipelineValidationResultSchema = object({
18049
- ok: boolean(),
18050
- issues: array(PipelineValidationIssueSchema).readonly(),
18051
- substitutions: array(ModelSubstitutionSchema).readonly(),
18052
- /** The node's `currentEngine.format` this validation ran against. */
18053
- format: string()
18128
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
18129
+ var SearchObjectEventsInput = object({
18130
+ text: string(),
18131
+ deviceId: number().optional(),
18132
+ since: number().optional(),
18133
+ until: number().optional(),
18134
+ classFilter: string().optional(),
18135
+ limit: number().default(50),
18136
+ minScore: number().min(0).max(1).default(.2)
18054
18137
  });
18055
- var ReferenceImageEntrySchema = object({
18056
- filename: string(),
18057
- stepIds: array(string()).readonly().optional()
18138
+ var TrackCascadeCountsSchema = object({
18139
+ /** Persisted track roots deleted (authoritative). */
18140
+ tracks: number().int(),
18141
+ /** Object events removed with their tracks (best-effort; see note above). */
18142
+ events: number().int(),
18143
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
18144
+ media: number().int(),
18145
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
18146
+ faces: number().int(),
18147
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
18148
+ plates: number().int(),
18149
+ /** Per-track CLIP search vectors removed (best-effort). */
18150
+ embeddings: number().int(),
18151
+ /** Group membership + group rows removed with their last member (best-effort). */
18152
+ groups: number().int()
18058
18153
  });
18059
- var ReferenceImageBodySchema = object({
18060
- base64: string(),
18061
- filename: string()
18154
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
18155
+ var DiskReconcileCountsSchema = object({
18156
+ mediaDropped: number().int(),
18157
+ tracks: number().int(),
18158
+ events: number().int()
18062
18159
  });
18063
- var ReferenceAudioEntrySchema = object({
18064
- filename: string(),
18065
- sizeKb: number()
18160
+ /** Event-store footprint for one camera. */
18161
+ var EventStoreDeviceFootprintSchema = object({
18162
+ deviceId: number(),
18163
+ /** Persisted event rows (motion + object + audio) for the camera. */
18164
+ rows: number().int(),
18165
+ /** Event-owned media bytes on disk for the camera. */
18166
+ bytes: number().int()
18167
+ });
18168
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
18169
+ var EventStoreFootprintSchema = object({
18170
+ totalRows: number().int(),
18171
+ totalBytes: number().int(),
18172
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
18173
+ });
18174
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
18175
+ var EventPruneCountsSchema = object({
18176
+ motion: number().int(),
18177
+ object: number().int(),
18178
+ audio: number().int()
18066
18179
  });
18067
- var ReferenceAudioBodySchema = object({ base64: string() });
18068
- var AudioBackendSchema = object({
18069
- id: string(),
18070
- name: string(),
18071
- description: string(),
18072
- available: boolean(),
18180
+ /**
18181
+ * Re-embed stored tracks from their key frames.
18182
+ *
18183
+ * The reason this is an operator-callable method and not a migration script:
18184
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
18185
+ * squaring — is only changeable if the existing vectors can be regenerated.
18186
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
18187
+ * symptom is a quality regression with no visible cause.
18188
+ */
18189
+ var RebuildObjectEmbeddingsInput = object({
18190
+ /** Restrict to one camera. Omit for the whole fleet. */
18191
+ deviceId: number().optional(),
18192
+ since: number().optional(),
18193
+ until: number().optional(),
18194
+ /** Stop after this many tracks; the result reports whether more remain. */
18195
+ maxTracks: number().int().positive().optional(),
18073
18196
  /**
18074
- * Raw classifier labels this backend can emit (e.g. YAMNet's
18075
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
18076
- * the benchmark UI to populate the `enabledMicroClasses` filter
18077
- * specific to the selected backend without a separate fetch.
18197
+ * Run every embedding on THIS node instead of round-robining the fleet.
18198
+ *
18199
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
18200
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
18201
+ * calling it that would pin the rebuild REQUEST itself to that node — the
18202
+ * rebuild orchestration lives on the hub, and only the per-track step runs
18203
+ * remotely. This field is data; the per-track pin is applied inside.
18204
+ *
18205
+ * Absent ⇒ round-robin over every online node whose runner can serve the
18206
+ * pinned model.
18078
18207
  */
18079
- rawLabels: array(string()).readonly().optional()
18080
- });
18081
- var AudioCapabilitiesSchema = object({
18082
- activeBackend: string(),
18083
- availableBackends: array(AudioBackendSchema).readonly(),
18084
- sampleRate: number(),
18085
- chunkDurationMs: number()
18086
- });
18087
- var DownloadModelResultSchema = object({
18088
- filePath: string(),
18089
- sizeMB: number(),
18090
- durationMs: number()
18208
+ executeOnNodeId: string().optional(),
18209
+ /**
18210
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
18211
+ * run flat out.
18212
+ *
18213
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
18214
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
18215
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
18216
+ * force is logged at start and finish so a deliberately slow pass reads
18217
+ * differently from a stalled one.
18218
+ */
18219
+ pacingMs: number().int().nonnegative().optional()
18091
18220
  });
18092
18221
  /**
18093
- * Wrapper carrying a single test run's result. Replaces the legacy
18094
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
18095
- * canonical `AudioResult` from the Phase 6 output rework: one
18096
- * `AudioDetection` per class above `minScore`, top-N candidates in
18097
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
18098
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
18099
- * benchmark UI can still report a clean failure when the classifier
18100
- * cap isn't available.
18222
+ * Result of emptying the CLIP index.
18223
+ *
18224
+ * The clean slate before a policy change: a new crop margin or encoder model
18225
+ * leaves two feature spaces in one index whose cosine scores are not
18226
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
18227
+ * means the same thing.
18101
18228
  */
18102
- var AudioTestResultSchema = object({
18103
- success: boolean(),
18104
- error: string().optional(),
18105
- frame: custom().optional()
18229
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
18230
+ /**
18231
+ * Acknowledgement that a rebuild STARTED.
18232
+ *
18233
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
18234
+ * runs detached and this returns immediately. Waiting for it made the client
18235
+ * time out while the work carried on server-side, which is the worst of both:
18236
+ * no result and no way to know it was still going. Poll
18237
+ * `getObjectEmbeddingRebuildStatus` for progress.
18238
+ */
18239
+ var RebuildObjectEmbeddingsResultSchema = object({
18240
+ started: boolean(),
18241
+ /** True when a pass was already running; the new request is ignored. */
18242
+ alreadyRunning: boolean()
18106
18243
  });
18107
- var PipelineConfigBridge = custom();
18108
- var ConfigUISchemaBridge = custom();
18109
- var ConfigUISchemaNullableBridge = custom();
18110
- var InferenceCapabilitiesBridge = custom();
18111
- var ModelAvailabilityListBridge = custom();
18112
- var PipelineRunResultBridge = custom();
18113
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
18114
- modelId: string(),
18115
- settings: record(string(), unknown()).readonly()
18116
- }))), method(object({ steps: record(string(), object({
18117
- modelId: string(),
18118
- settings: record(string(), unknown()).readonly()
18119
- })) }), object({ success: literal(true) }), {
18244
+ var RebuildStatusSchema = object({
18245
+ running: boolean(),
18246
+ scanned: number(),
18247
+ rebuilt: number(),
18248
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
18249
+ missingKeyFrame: number(),
18250
+ /** Tracks with no usable detection box. */
18251
+ missingBbox: number(),
18252
+ /**
18253
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
18254
+ * frame, a step that threw. Separate from `failed` because the remedy is
18255
+ * different, and because a whole camera silently contributing zero vectors
18256
+ * is the shape of failure a rebuild must never hide.
18257
+ */
18258
+ notRunnable: number(),
18259
+ /**
18260
+ * The pass stopped because NO node could serve the pinned model.
18261
+ *
18262
+ * Distinct from `notRunnable` on purpose: that one says "this track was
18263
+ * refused", this one says "the cluster cannot do this work at all" — every
18264
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
18265
+ * pinned model for its engine format, or dropped out. The remedy is a model /
18266
+ * engine change, not a per-camera one. Non-zero here always comes with
18267
+ * `complete: false`.
18268
+ */
18269
+ noCapableNode: number(),
18270
+ failed: number(),
18271
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
18272
+ complete: boolean().nullable(),
18273
+ startedAtMs: number().nullable(),
18274
+ finishedAtMs: number().nullable(),
18275
+ /** Present when the pass ended by throwing. */
18276
+ error: string().nullable()
18277
+ });
18278
+ var ReplayFrameInputSchema = object({
18279
+ timestamp: number(),
18280
+ frame: PipelineRunResultBridge
18281
+ });
18282
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
18283
+ className: string(),
18284
+ firstSeenMs: number(),
18285
+ lastSeenMs: number(),
18286
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
18287
+ * frame — a representative box for the diff's `(className, window, IoU)`
18288
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
18289
+ * trajectory production's `Track.positions` keeps. */
18290
+ bbox: BoundingBoxSchema,
18291
+ /** How many of the input frames this track matched a real detection on
18292
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
18293
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
18294
+ framesMatched: number().int()
18295
+ })).readonly() });
18296
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
18297
+ deviceId: number(),
18298
+ trackId: string()
18299
+ }), TrackSchema.nullable()), method(object({
18300
+ deviceId: number(),
18301
+ since: number().optional(),
18302
+ until: number().optional(),
18303
+ limit: number().optional(),
18304
+ /** Spatial filter — only tracks whose trajectory intersects the zone
18305
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
18306
+ * envelope columns, then precisely tested per position. Tracks with
18307
+ * an unknown envelope (no frame dims at persist time) always match. */
18308
+ zone: TrackZoneFilterSchema.optional(),
18309
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
18310
+ * compatible — omitting the field keeps today's exact behaviour). */
18311
+ projection: TrackProjectionSchema.optional(),
18312
+ /** Include stationary-promoted rows (parked objects handed to the
18313
+ * stationary registry). Default false: the timeline lists passages,
18314
+ * not parking records (operator decision, 2026-08-15). */
18315
+ includeStationary: boolean().optional()
18316
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
18317
+ deviceId: number(),
18318
+ groupId: string().min(1)
18319
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
18320
+ kind: "mutation",
18321
+ auth: "admin"
18322
+ }), 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({
18323
+ deviceId: number(),
18324
+ since: number().optional(),
18325
+ until: number().optional(),
18326
+ kinds: array(string()).optional(),
18327
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
18328
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18329
+ deviceId: number(),
18330
+ since: number(),
18331
+ until: number(),
18332
+ bucketMs: number().int().positive()
18333
+ }), array(object({
18334
+ bucketStart: number(),
18335
+ motion: number().int(),
18336
+ object: number().int(),
18337
+ audio: number().int()
18338
+ })).readonly()), method(object({
18339
+ deviceId: number(),
18340
+ cutoffMs: number()
18341
+ }), object({
18342
+ motion: number().int(),
18343
+ object: number().int(),
18344
+ audio: number().int()
18345
+ }), {
18346
+ kind: "mutation",
18347
+ auth: "admin"
18348
+ }), method(object({
18349
+ deviceId: number(),
18350
+ cutoffMs: number()
18351
+ }), TrackCascadeCountsSchema, {
18352
+ kind: "mutation",
18353
+ auth: "admin"
18354
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18355
+ kind: "mutation",
18356
+ auth: "admin"
18357
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18358
+ kind: "mutation",
18359
+ auth: "admin"
18360
+ }), method(object({
18361
+ deviceId: number(),
18362
+ trackIds: array(string()).min(1)
18363
+ }), object({
18364
+ deleted: number().int(),
18365
+ failed: array(string()).readonly()
18366
+ }), {
18367
+ kind: "mutation",
18368
+ auth: "admin"
18369
+ }), method(object({
18370
+ /** Log/audit scope only — the trackId is globally unique on its own. */
18371
+ deviceId: number(),
18372
+ trackId: string(),
18373
+ flags: TrackFlagsPatchSchema
18374
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18375
+ kind: "query",
18376
+ auth: "admin"
18377
+ }), method(object({
18378
+ olderThanMs: number(),
18379
+ reason: OpsLogReasonSchema.optional()
18380
+ }), EventPruneCountsSchema, {
18381
+ kind: "mutation",
18382
+ auth: "admin"
18383
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
18384
+ kind: "mutation",
18385
+ auth: "admin"
18386
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18387
+ kind: "mutation",
18388
+ auth: "admin"
18389
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18390
+ kind: "mutation",
18391
+ auth: "admin"
18392
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
18393
+ kind: "mutation",
18394
+ auth: "admin"
18395
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
18396
+ kind: "mutation",
18397
+ auth: "admin"
18398
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18399
+ kind: "mutation",
18400
+ auth: "admin"
18401
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18402
+ kind: "mutation",
18403
+ auth: "admin"
18404
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18405
+ kind: "query",
18406
+ auth: "admin"
18407
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18120
18408
  kind: "mutation",
18121
18409
  auth: "admin"
18122
- }), method(object({ nodeId: string() }), object({
18123
- success: literal(true),
18124
- clearedDevices: number()
18125
- }), {
18410
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
18411
+ kind: "query",
18412
+ auth: "admin"
18413
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
18414
+ kind: "query",
18415
+ auth: "admin"
18416
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18417
+ kind: "query",
18418
+ auth: "admin"
18419
+ }), method(object({
18420
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
18421
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
18422
+ * route it at one camera's owner, and "every camera" would stop being
18423
+ * expressible at all. */
18424
+ deviceIds: array(number()).optional(),
18425
+ limit: number().int().min(1).max(500).optional()
18426
+ }), array(RetrainTrackSchema).readonly(), {
18427
+ kind: "query",
18428
+ auth: "admin"
18429
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
18430
+ kind: "query",
18431
+ auth: "admin"
18432
+ }), method(object({
18433
+ deviceId: number(),
18434
+ trackId: string(),
18435
+ mediaKeys: array(string()).min(1)
18436
+ }), RetrainFrameSelectionSchema, {
18126
18437
  kind: "mutation",
18127
18438
  auth: "admin"
18128
- }), 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({
18129
- name: string(),
18130
- steps: array(PipelineTemplateStepSchema).readonly(),
18131
- engine: PipelineEngineChoiceSchema
18132
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
18133
- id: string(),
18134
- name: string().optional(),
18135
- steps: array(PipelineTemplateStepSchema).readonly().optional()
18136
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
18137
- addonId: string(),
18138
- modelId: string(),
18139
- format: ModelFormatSchema$1
18140
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
18141
- addonId: string(),
18142
- modelId: string(),
18143
- format: ModelFormatSchema$1
18144
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
18145
- engine: PipelineEngineChoiceSchema.optional(),
18146
- steps: array(PipelineStepInputSchema).min(1),
18147
- frame: FrameInputSchema.optional(),
18148
- /**
18149
- * Process-local lazy frame. Valid only when caller and provider resolve
18150
- * in the same execution-group process; split/cross-node callers use
18151
- * `frame`/`image` inline compatibility instead.
18152
- */
18153
- frameRef: FrameRefSchema.optional(),
18154
- /**
18155
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
18156
- * the decoded pixels live in. One more member of the one-of
18157
- * frame/frameHandle/image/imageBase64/referenceImage group.
18158
- */
18159
- frameHandle: FrameHandleSchema.optional(),
18160
- imageBase64: string().optional(),
18161
- /**
18162
- * Binary JPEG bytes — preferred over `imageBase64` on internal
18163
- * hops (hub → forked worker via Moleculer MsgPack) because it
18164
- * skips the 33% base64 overhead + the per-call base64 decode on
18165
- * the detection-pipeline worker. Callers can pass either; exactly
18166
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
18167
- */
18168
- image: _instanceof(Uint8Array).optional(),
18169
- referenceImage: string().optional(),
18170
- deviceId: number().optional(),
18171
- sessionId: string().optional(),
18172
- /**
18173
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
18174
- * reference-image, and detail-subtree calls. 'frame' is the live
18175
- * per-frame dispatch: ONLY root-plane steps run; crop children
18176
- * (inputClasses ≠ null) are skipped and served per-track via
18177
- * pipelineRunner.runDetailSubtree (two-plane design).
18178
- */
18179
- plane: _enum(["full", "frame"]).optional(),
18180
- /**
18181
- * Inference-device selector (Phase 2 multi-device). Format
18182
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
18183
- * Omitted ⇒ the runner's default device (current single-engine
18184
- * behaviour). Selects WHICH device pool of the node runs the call.
18185
- */
18186
- deviceKey: string().optional(),
18187
- /**
18188
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
18189
- * when the parent crop was resolved from the frame's retained NATIVE
18190
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
18191
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
18192
- * resolution from that surface — the SAME quality path faces already
18193
- * had — instead of the downscaled parent tile. `handle` keys the native
18194
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
18195
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
18196
- * the executor's crop-normalized child ROI back into frame-normalized
18197
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
18198
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
18199
- * (today's behaviour on the fallback path).
18200
- */
18201
- nativeCropRef: NativeCropRefSchema.optional()
18202
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
18203
- engine: PipelineEngineChoiceSchema.optional(),
18204
- steps: array(PipelineStepInputSchema).min(1),
18205
- frames: array(FrameInputSchema).min(1).max(255),
18206
- deviceId: number().optional(),
18207
- sessionId: string().optional(),
18208
- /**
18209
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
18210
- * the batch to the Python pool's bench preprocess cache
18211
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
18212
- * preprocessed ONCE and every later inference is a pure-inference cache
18213
- * hit — the sustained-throughput run measures inference, not
18214
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
18215
- * full preprocess every call, correct). Fresh per sustained run;
18216
- * released via `uncacheFrame`.
18217
- */
18218
- frameId: number().int().nonnegative().optional(),
18219
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
18220
- deviceKey: string().optional()
18221
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
18222
- data: _instanceof(Uint8Array),
18223
- width: number().int().positive(),
18224
- height: number().int().positive(),
18225
- format: _enum([
18226
- "rgb",
18227
- "bgr",
18228
- "gray"
18229
- ])
18439
+ }), method(object({
18440
+ deviceId: number(),
18441
+ trackId: string(),
18442
+ frameId: string()
18230
18443
  }), object({
18231
- frameId: number(),
18232
- width: number(),
18233
- height: number()
18234
- }), { kind: "mutation" }), method(object({
18235
- stepId: string(),
18236
- frameId: number().int()
18237
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
18238
- batchMode: string(),
18239
- windowMs: number(),
18240
- maxBatchSize: number(),
18241
- concurrency: number()
18242
- })), method(_void(), array(object({
18243
- engineKey: string(),
18244
- engine: PipelineEngineChoiceSchema,
18245
- modelsLoaded: array(string()).readonly(),
18246
- inUseByCameras: array(number()).readonly(),
18247
- /**
18248
- * Origin of this resident factory.
18249
- * - `runtime` — main camera-serving engine (no idle TTL).
18250
- * - `warm-override` — benchmark/test override held in the warm
18251
- * cache; auto-disposed after the idle TTL.
18252
- * - `device-pool` — a concurrent per-device pool (Phase 2
18253
- * multi-device, keyed by `deviceKey`) resolved
18254
- * via `resolveDeviceFactory`. Runs alongside the
18255
- * `runtime` engine on a DIFFERENT accelerator
18256
- * (NPU / iGPU / Coral) — this is how the
18257
- * Engines tab shows all pools running at once.
18258
- */
18259
- kind: _enum([
18260
- "runtime",
18261
- "warm-override",
18262
- "device-pool"
18263
- ]),
18264
- /** Native pid of the underlying Python pool (null when no pool). */
18265
- poolPid: number().nullable(),
18266
- /** ms since this factory was last used (null when not warm-tracked). */
18267
- idleMs: number().nullable(),
18268
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
18269
- idleTtlMs: number().nullable()
18270
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
18444
+ removed: boolean(),
18445
+ removedAnnotations: number().int()
18446
+ }), {
18271
18447
  kind: "mutation",
18272
18448
  auth: "admin"
18449
+ }), method(object({ frameId: string() }), object({
18450
+ base64: string(),
18451
+ width: number().int(),
18452
+ height: number().int()
18453
+ }), {
18454
+ kind: "query",
18455
+ auth: "admin"
18273
18456
  }), method(object({
18274
- engine: PipelineEngineChoiceSchema,
18275
- force: boolean().optional()
18457
+ deviceId: number(),
18458
+ trackId: string(),
18459
+ frameId: string(),
18460
+ subject: RetrainAssistSubjectSchema,
18461
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18462
+ nodeId: string().optional()
18463
+ }), RetrainAssistResultSchema, {
18464
+ kind: "mutation",
18465
+ auth: "admin"
18466
+ }), method(object({
18467
+ deviceId: number(),
18468
+ source: DetectionSourceSchema,
18469
+ zones: array(ZoneSchema).readonly().optional(),
18470
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
18471
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
18472
+ frames: array(ReplayFrameInputSchema).min(1)
18473
+ }), RunReplayFrameProcessorResultSchema, {
18474
+ kind: "mutation",
18475
+ auth: "admin"
18476
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
18477
+ kind: "query",
18478
+ auth: "admin"
18479
+ }), method(object({
18480
+ deviceId: number(),
18481
+ trackId: string(),
18482
+ frameId: string(),
18483
+ annotations: array(RetrainAnnotationDraftSchema)
18484
+ }), array(RetrainAnnotationSchema).readonly(), {
18485
+ kind: "mutation",
18486
+ auth: "admin"
18487
+ }), method(object({
18488
+ deviceId: number(),
18489
+ trackId: string()
18490
+ }), RetrainTransitionResultSchema, {
18491
+ kind: "mutation",
18492
+ auth: "admin"
18493
+ }), method(object({
18494
+ deviceId: number(),
18495
+ trackId: string()
18496
+ }), RetrainTransitionResultSchema, {
18497
+ kind: "mutation",
18498
+ auth: "admin"
18499
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18500
+ kind: "query",
18501
+ auth: "admin"
18502
+ }), method(object({
18503
+ eventId: string(),
18504
+ kind: MediaFileKindEnum.optional(),
18505
+ deviceId: number()
18506
+ }), array(MediaFileSchema).readonly()), method(object({
18507
+ trackId: string(),
18508
+ kinds: array(MediaFileKindEnum).optional(),
18509
+ deviceId: number()
18510
+ }), array(MediaFileSchema).readonly()), method(object({
18511
+ trackId: string(),
18512
+ deviceId: number()
18513
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18514
+ kind: "mutation",
18515
+ auth: "admin"
18516
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18517
+ kind: "mutation",
18518
+ auth: "admin"
18519
+ }), method(object({}), RebuildStatusSchema), object({
18520
+ deviceId: number(),
18521
+ timestamp: number(),
18522
+ frameWidth: number(),
18523
+ frameHeight: number(),
18524
+ detections: array(OverlayDetectionSchema).readonly()
18525
+ }), object({
18526
+ deviceId: number(),
18527
+ trackId: string(),
18528
+ className: string()
18276
18529
  }), object({
18277
- success: boolean(),
18278
- reason: string().optional()
18279
- }), {
18280
- kind: "mutation",
18281
- auth: "admin"
18282
- }), 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({
18283
- addonId: string(),
18284
- modelId: string(),
18285
- filename: string().optional(),
18286
- settings: record(string(), unknown()).optional()
18287
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
18530
+ deviceId: number(),
18531
+ trackId: string(),
18532
+ className: string(),
18533
+ durationMs: number()
18534
+ }), object({
18535
+ deviceId: number(),
18536
+ kind: EventKindSchema,
18537
+ eventId: string(),
18538
+ timestamp: number()
18539
+ });
18288
18540
  object({
18289
18541
  activeCameras: number(),
18290
18542
  throttledCameras: number(),
@@ -18310,106 +18562,6 @@ var CameraMetricsSchema = object({
18310
18562
  });
18311
18563
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
18312
18564
  /**
18313
- * Zone — pure geometry + identity. NO filtering behaviour.
18314
- *
18315
- * Zones describe **where** in the frame the operator wants to flag
18316
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
18317
- * each pipeline stage uses them. Splitting the two means a single
18318
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
18319
- * a detection-include rule on `['car']`, and an occupancy aggregate
18320
- * — without three duplicated polygons.
18321
- *
18322
- * Owned by the orchestrator addon (provider) and mirrored into the
18323
- * `zones` device-state slice on every mutation. Consumers
18324
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
18325
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
18326
- * mirror with `onChanged`).
18327
- *
18328
- * Coordinates are normalised fractions of the frame (0–1) so zones
18329
- * survive resolution changes and stream profile switches.
18330
- *
18331
- * `kind` discriminates between full polygons (closed regions used
18332
- * for intrusion / occupancy filters) and tripwires (open 2-point
18333
- * line segments used for cross events). Onboard / firmware-reported
18334
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
18335
- * task list.
18336
- */
18337
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
18338
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
18339
- var PolygonPointSchema = object({
18340
- x: number(),
18341
- y: number()
18342
- });
18343
- /** A camera detection zone — pure geometry/identity. */
18344
- var ZoneSchema = object({
18345
- id: string(),
18346
- name: string(),
18347
- kind: ZoneKindEnum.default("polygon"),
18348
- /** Polygon vertices, fraction of frame (0–1). */
18349
- polygon: array(PolygonPointSchema).readonly(),
18350
- /** Visual color for UI rendering. */
18351
- color: string().default("#3b82f6")
18352
- });
18353
- /**
18354
- * Zones capability — per-camera CRUD over polygon detection zones.
18355
- *
18356
- * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
18357
- * to per-device settings and mirrors into the `zones` device-state
18358
- * slice on every mutation, so downstream consumers can subscribe via
18359
- * `dev.state.zones.onChanged`.
18360
- *
18361
- * The cap surface only handles geometry + identity; filtering
18362
- * behaviour (per-class, include/exclude, threshold) lives in the
18363
- * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
18364
- * `capabilities/schemas/zone-rule.js`.
18365
- */
18366
- var zonesCapability = {
18367
- name: "zones",
18368
- scope: "device",
18369
- mode: "singleton",
18370
- deviceTypes: [DeviceType.Camera],
18371
- methods: {
18372
- listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
18373
- addZone: method(object({
18374
- deviceId: number(),
18375
- zone: ZoneSchema
18376
- }), _void(), {
18377
- kind: "mutation",
18378
- auth: "admin"
18379
- }),
18380
- removeZone: method(object({
18381
- deviceId: number(),
18382
- zoneId: string()
18383
- }), _void(), {
18384
- kind: "mutation",
18385
- auth: "admin"
18386
- }),
18387
- updateZone: method(object({
18388
- deviceId: number(),
18389
- zone: ZoneSchema
18390
- }), _void(), {
18391
- kind: "mutation",
18392
- auth: "admin"
18393
- })
18394
- },
18395
- /**
18396
- * Runtime-state slice — the live zone catalogue mirrored by the
18397
- * orchestrator on every CRUD mutation. Consumers read via
18398
- * `device.state.zones.value` / `.watch(...)` without round-tripping
18399
- * the cap, and the codegen DeviceProxy auto-wires the reactive
18400
- * handle. Slice shape is `{ zones: Zone[] }` so future extensions
18401
- * (e.g. zone groupings) can sit alongside the polygon list.
18402
- */
18403
- runtimeState: object({ zones: array(ZoneSchema).readonly() }),
18404
- /**
18405
- * 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.
18406
- *
18407
- * See `RuntimeStateDurability`. Enforced by
18408
- * `scripts/check-runtime-state-durability.ts`.
18409
- */
18410
- durability: "restored"
18411
- };
18412
- /**
18413
18565
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
18414
18566
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
18415
18567
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -27312,6 +27464,39 @@ var ReadGopBytesResultSchema = object({
27312
27464
  /** Media ms the returned fragment covers. */
27313
27465
  gopDurMs: number()
27314
27466
  });
27467
+ /**
27468
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
27469
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
27470
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
27471
+ * a replay needs several seconds of native pixels, not one frame.
27472
+ *
27473
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
27474
+ * is `false` when the returned bytes were cut short by the read's own safety
27475
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
27476
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
27477
+ * degradation: a window whose end falls past the covering segment would need
27478
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
27479
+ * not one standalone-demuxable stream — the caller's answer is to request a
27480
+ * shorter window or one aligned to a single segment, not to receive spliced
27481
+ * bytes nothing has proven decodable.
27482
+ */
27483
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
27484
+ kind: literal("ok"),
27485
+ data: _instanceof(Uint8Array),
27486
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
27487
+ * the requested `fromMs` (anchored on the nearest keyframe). */
27488
+ gopStartMs: number(),
27489
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
27490
+ gopDurMs: number(),
27491
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
27492
+ * the requested `toMs`; the caller got fewer frames than asked for. */
27493
+ reachesRequestedEnd: boolean()
27494
+ }), object({
27495
+ kind: literal("spans-multiple-segments"),
27496
+ /** Where the covering segment's own footage runs out — informational,
27497
+ * not a retry hint (retrying the same window would refuse again). */
27498
+ segmentEndMs: number()
27499
+ })]);
27315
27500
  method(object({
27316
27501
  deviceId: number(),
27317
27502
  fromMs: number(),
@@ -27362,6 +27547,15 @@ method(object({
27362
27547
  }), ReadGopBytesResultSchema, {
27363
27548
  kind: "query",
27364
27549
  auth: "admin"
27550
+ }), method(object({
27551
+ deviceId: number(),
27552
+ profile: string(),
27553
+ startMs: number(),
27554
+ fromMs: number(),
27555
+ toMs: number()
27556
+ }), ReadWindowBytesResultSchema, {
27557
+ kind: "query",
27558
+ auth: "admin"
27365
27559
  }), method(object({
27366
27560
  deviceId: number(),
27367
27561
  config: RecordingConfigSchema
@@ -27957,92 +28151,6 @@ var sceneMonitorCapability = {
27957
28151
  durability: "session"
27958
28152
  };
27959
28153
  /**
27960
- * Per-stage gating mode applied to the zones a rule references.
27961
- *
27962
- * - `include`: the rule contributes to a **whitelist** for its stage.
27963
- * When at least one `include` rule fires for a stage, only entities
27964
- * inside one of those zones pass that stage.
27965
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
27966
- * Entities inside one of those zones are dropped at that stage.
27967
- *
27968
- * `monitor`-style observation (count without filtering) is not a rule
27969
- * mode — zones without any matching rule are observed naturally by
27970
- * `zone-analytics` (live snapshot + history), so an "I just want to
27971
- * count, not filter" use case needs no rule at all.
27972
- */
27973
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
27974
- /**
27975
- * Per-consumer rule that references existing zones (geometry) and
27976
- * defines how a specific pipeline stage should treat them. Each
27977
- * consumer addon owns its own `ZoneRule[]` array in its per-device
27978
- * settings:
27979
- *
27980
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
27981
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
27982
- * - future: notification rules, audio gating, etc.
27983
- *
27984
- * One rule applies to N zones (`zoneIds[]`) so the operator can
27985
- * express "ignore motion in ALL of {garden, street}" with a single
27986
- * rule. `classFilter` narrows the rule to specific object classes —
27987
- * "drop person detections in the street, but keep cars" is one
27988
- * `exclude` rule with `classFilter: ['person']`.
27989
- *
27990
- * `enabled` is a soft toggle — the operator can keep the rule
27991
- * configured but inert without deleting it.
27992
- */
27993
- var ZoneRuleSchema = object({
27994
- /** Stable rule id — survives edits, used by the UI for diffing. */
27995
- id: string(),
27996
- /** Optional human-readable label rendered in the rule editor. */
27997
- name: string().optional(),
27998
- /** Zones this rule targets. The rule's `mode` applies to ALL
27999
- * listed zones (OR-set: a detection in any one of them counts).
28000
- * At least one zone id required — a rule with no targets is a
28001
- * configuration mistake and the form validator rejects it. */
28002
- zoneIds: array(string()).min(1).readonly(),
28003
- mode: ZoneRuleModeEnum,
28004
- /**
28005
- * Class names this rule applies to. Empty / undefined ⇒ rule
28006
- * applies to every class. Class strings match the `macroClass`
28007
- * field on detections (e.g. `person`, `car`, `dog`).
28008
- */
28009
- classFilter: array(string()).readonly().optional(),
28010
- /**
28011
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
28012
- * required to consider an entity "in the zone". Defaults to the
28013
- * consumer's stage default when omitted. Kept for back-compat with
28014
- * existing per-rule overrides; new operators pick the value via
28015
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
28016
- * set, the lower-level engine reads it as a 0–1 fraction.
28017
- */
28018
- overlapThreshold: number().min(0).max(1).optional(),
28019
- /**
28020
- * Operator-friendly version of `overlapThreshold` — the percentage
28021
- * of the detection's bbox that must lie inside the zone for the
28022
- * rule to match. Documented default is 85%; the engine substitutes
28023
- * that when the field is omitted (kept optional so existing rules
28024
- * stored without it stay valid).
28025
- *
28026
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
28027
- * rule, the engine prefers `bboxInclusionPct` because it's the
28028
- * field exposed in the UI. Internally both feed the same gate.
28029
- */
28030
- bboxInclusionPct: number().min(0).max(100).optional(),
28031
- /**
28032
- * When `true` and a detection has a segmentation mask, use the
28033
- * mask for overlap instead of the bbox. Detection-stage only;
28034
- * motion rules ignore this field.
28035
- */
28036
- preferMask: boolean().optional(),
28037
- /**
28038
- * Soft-toggle: `false` disables the rule without deleting it.
28039
- * Defaults to `true` so operators creating a rule via the UI
28040
- * see it active immediately.
28041
- */
28042
- enabled: boolean().default(true)
28043
- });
28044
- array(ZoneRuleSchema).readonly();
28045
- /**
28046
28154
  * Script-runner cap. Models HA `script.*` entities on
28047
28155
  * `DeviceType.Script`. A Script is a pre-recorded action sequence
28048
28156
  * that can be invoked imperatively — optionally with a variables
@@ -33966,6 +34074,12 @@ Object.freeze({
33966
34074
  addonId: null,
33967
34075
  access: "view"
33968
34076
  },
34077
+ "notificationRules.resolveArtifactUrl": {
34078
+ capName: "notification-rules",
34079
+ capScope: "system",
34080
+ addonId: null,
34081
+ access: "view"
34082
+ },
33969
34083
  "notificationRules.setAlarmConfig": {
33970
34084
  capName: "notification-rules",
33971
34085
  capScope: "system",
@@ -34410,6 +34524,12 @@ Object.freeze({
34410
34524
  addonId: null,
34411
34525
  access: "create"
34412
34526
  },
34527
+ "pipelineAnalytics.runReplayFrameProcessor": {
34528
+ capName: "pipeline-analytics",
34529
+ capScope: "device",
34530
+ addonId: null,
34531
+ access: "create"
34532
+ },
34413
34533
  "pipelineAnalytics.saveRetrainAnnotations": {
34414
34534
  capName: "pipeline-analytics",
34415
34535
  capScope: "device",
@@ -34542,6 +34662,12 @@ Object.freeze({
34542
34662
  addonId: null,
34543
34663
  access: "view"
34544
34664
  },
34665
+ "pipelineExecutor.getInferenceDeviceHealth": {
34666
+ capName: "pipeline-executor",
34667
+ capScope: "system",
34668
+ addonId: null,
34669
+ access: "view"
34670
+ },
34545
34671
  "pipelineExecutor.getOrchestratorConfigSchema": {
34546
34672
  capName: "pipeline-executor",
34547
34673
  capScope: "system",
@@ -34614,6 +34740,12 @@ Object.freeze({
34614
34740
  addonId: null,
34615
34741
  access: "view"
34616
34742
  },
34743
+ "pipelineExecutor.rearmInferenceDevice": {
34744
+ capName: "pipeline-executor",
34745
+ capScope: "system",
34746
+ addonId: null,
34747
+ access: "create"
34748
+ },
34617
34749
  "pipelineExecutor.runAudioTest": {
34618
34750
  capName: "pipeline-executor",
34619
34751
  capScope: "system",
@@ -35352,6 +35484,12 @@ Object.freeze({
35352
35484
  addonId: null,
35353
35485
  access: "view"
35354
35486
  },
35487
+ "recording.readWindowBytes": {
35488
+ capName: "recording",
35489
+ capScope: "system",
35490
+ addonId: null,
35491
+ access: "view"
35492
+ },
35355
35493
  "recording.refreshStorageLocationsForMigration": {
35356
35494
  capName: "recording",
35357
35495
  capScope: "system",
@@ -37862,6 +38000,11 @@ Object.freeze({
37862
38000
  form: "single",
37863
38001
  optional: false
37864
38002
  }],
38003
+ "pipelineAnalytics.runReplayFrameProcessor": [{
38004
+ name: "deviceId",
38005
+ form: "single",
38006
+ optional: false
38007
+ }],
37865
38008
  "pipelineAnalytics.saveRetrainAnnotations": [{
37866
38009
  name: "deviceId",
37867
38010
  form: "single",
@@ -38177,6 +38320,11 @@ Object.freeze({
38177
38320
  form: "single",
38178
38321
  optional: false
38179
38322
  }],
38323
+ "recording.readWindowBytes": [{
38324
+ name: "deviceId",
38325
+ form: "single",
38326
+ optional: false
38327
+ }],
38180
38328
  "recording.relocateFootage": [{
38181
38329
  name: "deviceId",
38182
38330
  form: "single",