@camstack/addon-provider-reolink 1.2.51 → 1.2.53

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