@camstack/addon-provider-petkit 0.2.29 → 0.2.31

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
@@ -16901,7 +16901,23 @@ var NcHistoryEntrySchema = object({
16901
16901
  updatedAt: number(),
16902
16902
  /** Failure detail — present on a `dead` row. */
16903
16903
  error: string().optional(),
16904
- subject: NcHistorySubjectSchema
16904
+ subject: NcHistorySubjectSchema,
16905
+ /**
16906
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
16907
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
16908
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
16909
+ * every delivery attempt). Absent on a row still pending/dead, a row
16910
+ * delivered before this field shipped, or a wiring with no artefact index.
16911
+ *
16912
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
16913
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
16914
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
16915
+ * also answers `null` for an id whose artefact has since expired past the
16916
+ * retained shelf's own age bound — the degrade a caller (the Home
16917
+ * Assistant export) must render as "no image right now", never as a
16918
+ * broken link.
16919
+ */
16920
+ artifactIds: array(string().min(1)).optional()
16905
16921
  });
16906
16922
  /**
16907
16923
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -17128,7 +17144,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
17128
17144
  }), method(object({}), object({
17129
17145
  catalog: array(NcConditionDescriptorSchema),
17130
17146
  taxonomy: NcTaxonomySchema.optional()
17131
- })), 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 }), {
17147
+ })), 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 }), {
17132
17148
  kind: "mutation",
17133
17149
  caller: "required"
17134
17150
  }), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
@@ -17468,1760 +17484,1996 @@ var OauthIntegrationDescriptorSchema = object({
17468
17484
  });
17469
17485
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
17470
17486
  /**
17471
- * pipeline-analytics device-scoped wrapper cap. Refines raw
17472
- * per-frame detections emitted by the pipeline runner into tracked
17473
- * objects, per-kind event collections (motion / object / audio), and
17474
- * persisted media. Owns the post-detection domain end-to-end:
17475
- *
17476
- * runner emits PipelineInferenceResult
17477
- * ↓ (event bus)
17478
- * pipeline-analytics subscriber
17479
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
17480
- * → three DB collections (one per kind), one FS media tree, one
17481
- * unified event emitter (FrameTracked + TrackStarted/Ended +
17482
- * DetectionEvent on bus)
17483
- *
17484
- * Pure subscriber model. No `processFrame` cap method — the runner
17485
- * already publishes the raw frame on the bus. The cap surface is
17486
- * only QUERIES + per-device settings, bound on/off via
17487
- * `device-manager.setWrapperActive`. `defaultActive: true` because
17488
- * every camera with a detection pipeline wants its raw detections
17489
- * refined; operators opt out per-device via BindingsTab when needed.
17490
- *
17491
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
17492
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
17487
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
17488
+ * within the frame, so the executor can re-cut a leaf child ROI at native
17489
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17493
17490
  */
17494
- var TrackStateSchema = _enum([
17495
- "new",
17496
- "entered",
17497
- "left",
17498
- "moving",
17499
- "idle"
17500
- ]);
17501
- var EventKindSchema = _enum([
17502
- "motion",
17503
- "object",
17504
- "audio"
17505
- ]);
17491
+ var NativeCropRefSchema = object({
17492
+ /** Handle keying the retained native surface (node-pinned to its owner). */
17493
+ handle: FrameHandleSchema,
17494
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17495
+ cropFrameSpace: object({
17496
+ x: number(),
17497
+ y: number(),
17498
+ w: number(),
17499
+ h: number()
17500
+ })
17501
+ });
17502
+ object({
17503
+ crop: object({
17504
+ left: number(),
17505
+ top: number(),
17506
+ width: number().positive(),
17507
+ height: number().positive()
17508
+ }).optional(),
17509
+ content: object({
17510
+ width: number().int().positive(),
17511
+ height: number().int().positive()
17512
+ }),
17513
+ fit: _enum(["stretch", "contain"]),
17514
+ format: _enum([
17515
+ "rgb",
17516
+ "gray",
17517
+ "jpeg"
17518
+ ])
17519
+ });
17506
17520
  /**
17507
- * Spatial filter for `listTracks` the rect + polygon variants of the shared
17508
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
17509
- * of the camera frame (top-left origin), matching the drawing-plane editor.
17521
+ * Process-local frame identity. It is serializable so it can ride an in-process
17522
+ * capability call, but `registryId` deliberately prevents resolution in any
17523
+ * other process or execution group.
17510
17524
  */
17511
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
17512
- /** Closed icon vocabulary so clients render a known glyph per kind. */
17513
- var EventKindIconSchema = _enum([
17514
- "motion",
17515
- "audio",
17516
- "person",
17517
- "vehicle",
17518
- "animal",
17519
- "door",
17520
- "pir",
17521
- "smoke",
17522
- "water",
17523
- "button",
17524
- "package",
17525
- "generic"
17525
+ var FrameRefSchema = object({
17526
+ registryId: string().min(1),
17527
+ id: string().min(1),
17528
+ width: number().int().positive(),
17529
+ height: number().int().positive(),
17530
+ format: _enum(["rgb", "gray"]),
17531
+ timestamp: number(),
17532
+ capturedAt: number().optional()
17533
+ });
17534
+ var ModelFormatSchema$1 = _enum([
17535
+ "onnx",
17536
+ "coreml",
17537
+ "openvino",
17538
+ "tflite",
17539
+ "pt",
17540
+ "gguf"
17526
17541
  ]);
17527
- var EventKindCategorySchema = _enum([
17528
- "motion",
17529
- "audio",
17530
- "detection",
17531
- "sensor",
17532
- "control",
17533
- "custom",
17534
- "package"
17542
+ var PipelineSlotSchema = _enum([
17543
+ "detector",
17544
+ "cropper",
17545
+ "classifier",
17546
+ "refiner",
17547
+ "audio-classifier"
17535
17548
  ]);
17536
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
17537
- var EventKindLevelSchema = _enum(["macro", "sub"]);
17538
- var EventKindDescriptorSchema = object({
17539
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
17540
- kind: string(),
17541
- /** i18n key resolved on the UI side; `label` is the English fallback. */
17542
- labelKey: string(),
17543
- /** English fallback label (kept for clients that don't translate). */
17544
- label: string(),
17545
- /** Hex color for timeline/legend rendering. */
17546
- color: string(),
17547
- /** Dictionary id → lucide component on the UI side. */
17548
- iconId: string(),
17549
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
17550
- icon: EventKindIconSchema,
17551
- category: EventKindCategorySchema,
17552
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
17553
- parentKind: string().nullable(),
17554
- /** Derived from `parentKind`, explicit for the client tree. */
17555
- level: EventKindLevelSchema,
17556
- /** Which cap + device contributes this kind. For built-ins the camera
17557
- * itself; for sensor kinds the LINKED source device. */
17558
- source: object({
17559
- capName: string(),
17560
- deviceId: number()
17561
- })
17549
+ var PipelineEngineChoiceSchema = object({
17550
+ runtime: _enum(["node", "python"]),
17551
+ backend: string(),
17552
+ format: ModelFormatSchema$1,
17553
+ device: string().optional()
17562
17554
  });
17563
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
17564
- var EventKindsForDeviceSchema = object({
17565
- deviceId: number(),
17566
- kinds: array(EventKindDescriptorSchema).readonly()
17555
+ var AvailableEngineSchema = object({
17556
+ engine: PipelineEngineChoiceSchema,
17557
+ devices: array(object({
17558
+ id: string(),
17559
+ label: string(),
17560
+ description: string().optional()
17561
+ })).readonly(),
17562
+ defaultDevice: string()
17567
17563
  });
17568
- var SensorEventSchema = object({
17564
+ var PipelineDefaultStepSchema = lazy(() => object({
17565
+ addonId: string(),
17566
+ addonName: string(),
17567
+ slot: PipelineSlotSchema,
17568
+ inputClasses: array(string()).readonly(),
17569
+ outputClasses: array(string()).readonly(),
17570
+ enabled: boolean(),
17571
+ modelId: string(),
17572
+ children: array(PipelineDefaultStepSchema).readonly(),
17573
+ group: string().optional(),
17574
+ settings: record(string(), unknown()).optional()
17575
+ }));
17576
+ var PipelineTemplateStepSchema = lazy(() => object({
17577
+ addonId: string(),
17578
+ enabled: boolean(),
17579
+ modelId: string(),
17580
+ children: array(PipelineTemplateStepSchema).readonly(),
17581
+ settings: record(string(), unknown()).optional()
17582
+ }));
17583
+ var PipelineTemplateSchema$1 = object({
17569
17584
  id: string(),
17570
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
17571
- * yields N rows, one per camera). */
17572
- deviceId: number(),
17573
- /** The linked sensor device whose state changed. */
17574
- sourceDeviceId: number(),
17575
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
17576
- kind: string(),
17577
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
17578
- value: record(string(), unknown()).nullable(),
17579
- timestamp: number()
17585
+ name: string(),
17586
+ createdAt: string(),
17587
+ updatedAt: string(),
17588
+ engine: PipelineEngineChoiceSchema,
17589
+ steps: array(PipelineTemplateStepSchema).readonly()
17580
17590
  });
17581
- var TrackPositionSchema = object({
17582
- x: number(),
17583
- y: number(),
17584
- timestamp: number(),
17585
- bbox: BoundingBoxSchema
17591
+ var PipelineModelOptionSchema = object({
17592
+ id: string(),
17593
+ name: string(),
17594
+ formats: record(string(), object({
17595
+ downloaded: boolean(),
17596
+ sizeMB: number()
17597
+ })),
17598
+ group: ModelVariantGroupSchema.optional(),
17599
+ legacy: boolean().optional(),
17600
+ provider: ModelProviderIdSchema.optional()
17586
17601
  });
17587
- var TrackSnapshotSchema = object({
17588
- timestamp: number(),
17589
- position: TrackPositionSchema,
17590
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
17591
- mediaKey: string()
17602
+ var ConfigFieldBridge = custom();
17603
+ var PipelineAddonSchemaSchema = object({
17604
+ id: string(),
17605
+ name: string(),
17606
+ slot: PipelineSlotSchema,
17607
+ inputClasses: array(string()).readonly(),
17608
+ outputClasses: array(string()).readonly(),
17609
+ childSlots: array(PipelineSlotSchema).readonly(),
17610
+ models: array(PipelineModelOptionSchema).readonly(),
17611
+ defaultModelId: string(),
17612
+ defaultModelIdByFormat: record(string(), string()).optional(),
17613
+ enabledByDefault: boolean().optional(),
17614
+ backfillIntoExistingOverrides: boolean().optional(),
17615
+ defaultConfidence: number(),
17616
+ group: string().optional(),
17617
+ configSchema: array(ConfigFieldBridge).readonly().optional()
17592
17618
  });
17593
- /**
17594
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
17595
- * divided by the track's detection-frame dims), computed at persist time.
17596
- * Absent when the frame dims were unknown when the track was persisted
17597
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
17598
- */
17599
- var TrackEnvelopeSchema = object({
17600
- minX: number(),
17601
- minY: number(),
17602
- maxX: number(),
17603
- maxY: number()
17619
+ var PipelineSlotSchemaSchema = object({
17620
+ id: PipelineSlotSchema,
17621
+ label: string(),
17622
+ priority: number(),
17623
+ parentSlot: PipelineSlotSchema.nullable(),
17624
+ addons: array(PipelineAddonSchemaSchema).readonly()
17604
17625
  });
17605
- /**
17606
- * Row projection for track list queries. `full` (default) returns the
17607
- * complete Track including the frame-rate `positions[]` history and the
17608
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
17609
- * keeps every scalar the list surfaces actually render (ids, class(es),
17610
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
17611
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
17612
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
17613
- * `getTrack`. Mirrors the event-store `projection` convention
17614
- * (`getObjectEvents` et al.).
17615
- */
17616
- var TrackProjectionSchema = _enum(["full", "slim"]);
17617
- /**
17618
- * One audio-classification label heard on the track's camera while the
17619
- * track was alive, aggregated per label. An "episode" is one persisted
17620
- * audio event (the confident-classification path: score ≥ the device's
17621
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
17622
- * one 32 ms inference chunk, so counts stay human-scaled.
17623
- */
17624
- var TrackAudioLabelSchema = object({
17625
- label: string(),
17626
- /** Highest classification score observed across the label's episodes. */
17627
- peakScore: number(),
17628
- /** Number of coalesced audio-event episodes carrying this label. */
17629
- count: number(),
17630
- firstAt: number(),
17631
- lastAt: number()
17626
+ var PipelineSchemaSchema = object({
17627
+ availableEngines: array(AvailableEngineSchema).readonly(),
17628
+ selectedEngine: PipelineEngineChoiceSchema,
17629
+ slots: array(PipelineSlotSchemaSchema).readonly()
17632
17630
  });
17633
- /**
17634
- * How a track was produced. `pipeline` (default / absent) = the spatial
17635
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
17636
- * no positions, a single snapshot, and no bbox trajectory at all:
17637
- *
17638
- * - `sensor` — a linked sensor/control device state change.
17639
- * - `audio` — an audio event on the camera itself that was anomalous for
17640
- * THAT camera, loud, and heard while nothing visual was happening (D62).
17641
- *
17642
- * The spatial subsystems (tracker association, occupancy count, re-id /
17643
- * embedding, resurrection) MUST skip every synthetic source. Test for that
17644
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
17645
- * check silently readmits every source added after it was written.
17646
- */
17647
- var TrackSourceSchema = _enum([
17648
- "pipeline",
17649
- "sensor",
17650
- "audio"
17651
- ]);
17652
- /**
17653
- * Where a track sits in the RETRAIN lifecycle (D81).
17654
- *
17655
- * - `none` never marked, or un-marked. Evictable.
17656
- * - `staging`the operator wants this track as training material and has not
17657
- * finished with it. **This is the only state retention holds**: the track and
17658
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
17659
- * the device's age window.
17660
- * - `trained` — the retrain page has taken what it needed. The frames it chose
17661
- * were COPIED into the retrain dataset at selection time, so the dataset no
17662
- * longer depends on the track's media and the track becomes EVICTABLE again.
17663
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
17664
- * a deliberate action of the retrain page, not a side effect of a checkbox.
17665
- *
17666
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
17667
- * the store's filter language has only positive equality and `whereIn` — no
17668
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
17669
- * would make the entire pre-column history immortal in one deploy.
17670
- */
17671
- var RetrainStatusSchema = _enum([
17672
- "none",
17673
- "staging",
17674
- "trained"
17675
- ]);
17676
- /**
17677
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
17678
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
17679
- * so the two surfaces cannot drift.
17680
- *
17681
- * **Absent ≠ false.** A track that has never been touched omits the field; an
17682
- * explicitly un-flagged track carries `false`. Legacy rows written before the
17683
- * columns existed read as absent, and a consumer that needs a boolean should say
17684
- * `flag === true`, not `flag !== false`.
17685
- *
17686
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
17687
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
17688
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
17689
- * `trained` track reports `false` while refusing both writes. The boolean is
17690
- * kept because three surfaces drive a toggle off it; anything that needs to tell
17691
- * "never marked" from "already trained" must read `retrainStatus`.
17692
- *
17693
- * `debug` does NOT pin; it is attention, not durability.
17694
- *
17695
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17696
- * A favourited track is skipped by retention the same way `staging` is, but
17697
- * it does not enter `none|staging|trained` and has no staging budget.
17698
- */
17699
- var TrackFlagFields = {
17700
- /** Operator marked this track as training material — i.e. `retrainStatus` is
17701
- * `'staging'`. */
17702
- markForTrain: boolean().optional(),
17703
- /** Operator marked this track for diagnostic attention. */
17704
- debug: boolean().optional(),
17705
- /** Operator favourited this track. Pins it against pruning. */
17706
- favourited: boolean().optional()
17707
- };
17708
- /**
17709
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
17710
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
17711
- * write patch, and the status is not something the toggle sets — it is what the
17712
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
17713
- * always present on a persisted row (the column default materialises `'none'`).
17714
- */
17715
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
17716
- /**
17717
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
17718
- * one flag can never clear the other — the toggles are independent and are
17719
- * driven from three surfaces that do not know about each other.
17720
- */
17721
- var TrackFlagsPatchSchema = object(TrackFlagFields);
17722
- /**
17723
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
17724
- * collapses to `false`) so a caller can drive a toggle's checked state off the
17725
- * mutation result without a re-fetch.
17726
- */
17727
- var TrackFlagsSchema = object({
17728
- trackId: string(),
17729
- markForTrain: boolean(),
17730
- debug: boolean(),
17731
- favourited: boolean(),
17732
- /** The lifecycle state the boolean was derived from. Required here (unlike on
17733
- * a track row) because this shape is only ever produced by the write body,
17734
- * which always knows it — and a surface that has just written needs to render
17735
- * `trained` without a re-fetch. */
17736
- retrainStatus: RetrainStatusSchema
17631
+ var EngineProvisioningSchema = object({
17632
+ runtimeId: _enum([
17633
+ "onnx",
17634
+ "openvino",
17635
+ "coreml",
17636
+ "edgetpu"
17637
+ ]).nullable(),
17638
+ device: string().nullable(),
17639
+ state: _enum([
17640
+ "idle",
17641
+ "installing",
17642
+ "verifying",
17643
+ "ready",
17644
+ "failed"
17645
+ ]),
17646
+ progress: number().optional(),
17647
+ error: string().optional(),
17648
+ nextRetryAt: number().optional(),
17649
+ /**
17650
+ * Gate A (config-correctness gate at engine change): human-readable
17651
+ * config issues surfaced EAGERLY when the node's engine changes — model
17652
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
17653
+ * has a <format> build"). Additive/optional: informational only, never
17654
+ * enforced here `assertEngineReady` (readiness) still gates inference.
17655
+ * Absent/empty when the node-default tree resolves cleanly.
17656
+ */
17657
+ configIssues: array(string()).optional()
17737
17658
  });
17738
- union([literal(1), literal(2)]);
17739
- /**
17740
- * WHO decided a label, and when. Carried per tier so a value can be traced to
17741
- * the step and model that produced it — which is what makes the write rule
17742
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17743
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17744
- *
17745
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17746
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17747
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
17748
- * that value has no provenance, and the write rule lets ANY properly-attributed
17749
- * write of the same tier replace it regardless of score.
17750
- */
17751
- var LabelAttributionSchema = object({
17752
- stepId: string(),
17659
+ var PipelineStepInputSchema = lazy(() => object({
17660
+ addonId: string(),
17753
17661
  modelId: string().optional(),
17754
- decidedAt: number(),
17662
+ enabled: boolean().default(true),
17663
+ children: array(PipelineStepInputSchema).optional(),
17664
+ settings: record(string(), unknown()).optional(),
17665
+ jumpDeviceKey: string().optional()
17666
+ }));
17667
+ var ModelSubstitutionSchema = object({
17668
+ addonId: string(),
17669
+ chosen: string(),
17670
+ running: string(),
17671
+ format: string()
17672
+ });
17673
+ var PipelineValidationIssueSchema = object({
17674
+ addonId: string(),
17675
+ kind: _enum(["unknown-addon", "no-format-build"]),
17676
+ detail: string()
17677
+ });
17678
+ var PipelineValidationResultSchema = object({
17679
+ ok: boolean(),
17680
+ issues: array(PipelineValidationIssueSchema).readonly(),
17681
+ substitutions: array(ModelSubstitutionSchema).readonly(),
17682
+ /** The node's `currentEngine.format` this validation ran against. */
17683
+ format: string()
17684
+ });
17685
+ var ReferenceImageEntrySchema = object({
17686
+ filename: string(),
17687
+ stepIds: array(string()).readonly().optional()
17688
+ });
17689
+ var ReferenceImageBodySchema = object({
17690
+ base64: string(),
17691
+ filename: string()
17692
+ });
17693
+ var ReferenceAudioEntrySchema = object({
17694
+ filename: string(),
17695
+ sizeKb: number()
17696
+ });
17697
+ var ReferenceAudioBodySchema = object({ base64: string() });
17698
+ var AudioBackendSchema = object({
17699
+ id: string(),
17700
+ name: string(),
17701
+ description: string(),
17702
+ available: boolean(),
17755
17703
  /**
17756
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
17757
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17758
- *
17759
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
17760
- * notification rule authored on "Gianluca" stopped matching the moment the
17761
- * operator fixed the spelling in the gallery, and nothing said so. The id is
17762
- * the thing that does not move, so it is what a rule matches on
17763
- * (`NcConditions.identities`) and the text is what a human is shown.
17764
- *
17765
- * Absent when the label names no gallery row — a plate the OCR read but no
17766
- * vehicle claims, a sub-class, a species, any tier-1 value.
17704
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
17705
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17706
+ * the benchmark UI to populate the `enabledMicroClasses` filter
17707
+ * specific to the selected backend without a separate fetch.
17767
17708
  */
17768
- identityId: string().optional()
17709
+ rawLabels: array(string()).readonly().optional()
17710
+ });
17711
+ var AudioCapabilitiesSchema = object({
17712
+ activeBackend: string(),
17713
+ availableBackends: array(AudioBackendSchema).readonly(),
17714
+ sampleRate: number(),
17715
+ chunkDurationMs: number()
17716
+ });
17717
+ var DownloadModelResultSchema = object({
17718
+ filePath: string(),
17719
+ sizeMB: number(),
17720
+ durationMs: number()
17769
17721
  });
17770
17722
  /**
17771
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17772
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17773
- * track and its events always answer the same question the same way.
17774
- *
17775
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
17776
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17777
- * is tier 2, and each carries its own score + attribution.
17778
- *
17779
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17780
- * finest thing known. Before 4g the single `label` column held the finest
17781
- * value, so a consumer that has not been updated reads the tier-1 slot and
17782
- * shows nothing on a species-only row; that is why the migration puts every
17783
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17784
- * and why the read surfaces were changed in the same train.
17785
- *
17786
- * **Writing it.** The slots are independent, which is the whole point: a
17787
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17788
- * migratorius`), so fineness cannot regress by construction. Within a tier the
17789
- * higher score wins. One rule, one implementation — see
17790
- * `pipeline/label-tier.ts` in addon-post-analysis.
17791
- */
17792
- var TieredLabelFields = {
17793
- /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
17794
- label: string().optional(),
17795
- /** Confidence of the tier-1 value, as reported by the deciding step. */
17796
- labelScore: number().optional(),
17797
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17798
- labelMeta: LabelAttributionSchema.optional(),
17799
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
17800
- subLabel: string().optional(),
17801
- /** Confidence of the tier-2 value, as reported by the deciding step. */
17802
- subLabelScore: number().optional(),
17803
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17804
- subLabelMeta: LabelAttributionSchema.optional()
17805
- };
17806
- /** Per-camera slice of a training-export estimate. */
17807
- var TrainingExportDeviceTotalsSchema = object({
17808
- deviceId: number(),
17809
- tracks: number().int(),
17810
- files: number().int(),
17811
- bytes: number().int()
17812
- });
17813
- /**
17814
- * What a training export WOULD contain. Computed from media index rows only —
17815
- * no blob is read to produce this.
17723
+ * Wrapper carrying a single test run's result. Replaces the legacy
17724
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17725
+ * canonical `AudioResult` from the Phase 6 output rework: one
17726
+ * `AudioDetection` per class above `minScore`, top-N candidates in
17727
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
17728
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17729
+ * benchmark UI can still report a clean failure when the classifier
17730
+ * cap isn't available.
17816
17731
  */
17817
- var TrainingExportSummarySchema = object({
17818
- generatedAt: number(),
17819
- trackCount: number().int(),
17820
- fileCount: number().int(),
17821
- byteCount: number().int(),
17822
- /** More marked tracks exist than a single pass carries. */
17823
- truncated: boolean(),
17824
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
17732
+ var AudioTestResultSchema = object({
17733
+ success: boolean(),
17734
+ error: string().optional(),
17735
+ frame: custom().optional()
17825
17736
  });
17826
- var TrackSchema = object({
17827
- trackId: string(),
17828
- deviceId: number(),
17829
- className: string(),
17830
- ...TieredLabelFields,
17831
- producingDeviceName: string().optional(),
17832
- /** Track provenance. Absent `pipeline` (legacy rows). */
17833
- source: TrackSourceSchema.optional(),
17834
- firstSeen: number(),
17835
- lastSeen: number(),
17836
- /** Frame-rate position history (subject to maxPositionHistory cap). */
17837
- positions: array(TrackPositionSchema).readonly(),
17838
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17839
- * saveThumbnails policy). */
17840
- snapshots: array(TrackSnapshotSchema).readonly(),
17841
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
17842
- zonesVisited: array(string()).readonly(),
17737
+ var PipelineConfigBridge = custom();
17738
+ var ConfigUISchemaBridge = custom();
17739
+ var ConfigUISchemaNullableBridge = custom();
17740
+ var InferenceCapabilitiesBridge = custom();
17741
+ var ModelAvailabilityListBridge = custom();
17742
+ var PipelineRunResultBridge = custom();
17743
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17744
+ modelId: string(),
17745
+ settings: record(string(), unknown()).readonly()
17746
+ }))), method(object({ steps: record(string(), object({
17747
+ modelId: string(),
17748
+ settings: record(string(), unknown()).readonly()
17749
+ })) }), object({ success: literal(true) }), {
17750
+ kind: "mutation",
17751
+ auth: "admin"
17752
+ }), method(object({ nodeId: string() }), object({
17753
+ success: literal(true),
17754
+ clearedDevices: number()
17755
+ }), {
17756
+ kind: "mutation",
17757
+ auth: "admin"
17758
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
17759
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
17760
+ deviceKey: string(),
17843
17761
  /**
17844
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17845
- * `zones` capability.
17846
- *
17847
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17848
- * and no card can render — so every free-text search surface was structurally
17849
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17850
- * just returned nothing. Resolving here rather than in each client keeps ONE
17851
- * derivation and costs the clients no extra call (the `zones` cap is
17852
- * per-device, so a client-side resolve would be a per-camera fan-out on a
17853
- * surface built to avoid exactly that).
17854
- *
17855
- * Resolved, never invented: a zone deleted since the track was written has no
17856
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17857
- * two are not positionally aligned. Absent when the track visited no zone, or
17858
- * when the zone catalogue could not be read.
17762
+ * `failed` the per-device restart budget is exhausted; no pool
17763
+ * will be spawned until an operator re-arms it or the runner
17764
+ * respawns. `backoff` — under budget, waiting out the backoff (or
17765
+ * a cached pool observed dead and not yet condemned).
17859
17766
  */
17860
- zoneNames: array(string()).readonly().optional(),
17861
- /** Deduplicated set of detector classes observed for this track over its
17862
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
17863
- * legacy rows written before class accumulation shipped. */
17864
- classes: array(string()).readonly().optional(),
17865
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17866
- totalDistance: number(),
17867
- state: TrackStateSchema,
17868
- active: boolean(),
17869
- /** Deterministic key-event importance score in [0,1] (server-computed at
17870
- * track expiry, recomputed on late label). Absent on legacy rows written
17871
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
17872
- importance: number().optional(),
17873
- /** Id of the track's highest-confidence ObjectEvent (its representative
17874
- * "best" frame). Absent when the track produced no object events. */
17875
- bestEventId: string().optional(),
17876
- /** Tag of the importance sub-signal that dominated the score
17877
- * (identity|dwell|proximity|class|confidence|travel|zone). */
17878
- importanceReason: string().optional(),
17879
- /** Audio-classification labels heard on the camera during the track's
17880
- * life (score ≥ device `classificationMinScore`), aggregated per label.
17881
- * Absent on legacy rows / tracks with no confident audio. */
17882
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17883
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17884
- * Populated from the persisted envelope columns on historical reads;
17885
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17886
- envelope: TrackEnvelopeSchema.optional(),
17767
+ state: _enum(["failed", "backoff"]),
17768
+ /** Epoch ms of the death that produced this state. */
17769
+ since: number(),
17770
+ /** Pool deaths inside the current window. */
17771
+ deaths: number(),
17772
+ /** The last death's message. */
17773
+ lastError: string()
17774
+ })).readonly() })), method(object({
17775
+ nodeId: string(),
17776
+ deviceKey: string()
17777
+ }), object({ rearmed: boolean() }), {
17778
+ kind: "mutation",
17779
+ auth: "admin"
17780
+ }), 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({
17781
+ name: string(),
17782
+ steps: array(PipelineTemplateStepSchema).readonly(),
17783
+ engine: PipelineEngineChoiceSchema
17784
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17785
+ id: string(),
17786
+ name: string().optional(),
17787
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
17788
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17789
+ addonId: string(),
17790
+ modelId: string(),
17791
+ format: ModelFormatSchema$1
17792
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17793
+ addonId: string(),
17794
+ modelId: string(),
17795
+ format: ModelFormatSchema$1
17796
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17797
+ engine: PipelineEngineChoiceSchema.optional(),
17798
+ steps: array(PipelineStepInputSchema).min(1),
17799
+ frame: FrameInputSchema.optional(),
17887
17800
  /**
17888
- * A face DETECTOR found a face on this track — nothing more. It says the
17889
- * detail plane produced a `face` detail; it does NOT say the face was
17890
- * embedded, matched, above `minFacePx`, or that the recognizer was even
17891
- * enabled. Set once and never cleared.
17892
- *
17893
- * **This exists so "face present but not recognised" is expressible.** A
17894
- * recognised identity lands in `subLabel` (attributed to the face chain via
17895
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17896
- * and a track with no face at all were byte-identical on the wire and no
17897
- * surface could tell them apart. The read is `hasFace === true && subLabel
17898
- * === undefined`.
17899
- *
17900
- * **Absent ≠ false.** Every row written before the column existed omits it,
17901
- * and so does every server that predates the field — a consumer must test
17902
- * `=== true` and render nothing otherwise, never infer "no face".
17801
+ * Process-local lazy frame. Valid only when caller and provider resolve
17802
+ * in the same execution-group process; split/cross-node callers use
17803
+ * `frame`/`image` inline compatibility instead.
17903
17804
  */
17904
- hasFace: boolean().optional(),
17805
+ frameRef: FrameRefSchema.optional(),
17905
17806
  /**
17906
- * This track has a face row IN THE GALLERY: a crop **and** an embedding a
17907
- * face an operator could ASSIGN to an identity.
17908
- *
17909
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17910
- * because the two disagree. `hasFace` is stamped at the TOP of the face
17911
- * branch, before every gate, and means no more than "a face detector produced
17912
- * a face detail". This one is stamped at the single moment the gallery row
17913
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17914
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17915
- * candidate gate, the imageless-track drop (no crop was ever captured) and
17916
- * the crop-store drop. Everything between the detector and that insert can
17917
- * legitimately refuse the face, so a flag written any earlier promises the
17918
- * operator something to assign and delivers nothing.
17919
- *
17920
- * **Independent of recognition.** A face collected but never auto-matched is
17921
- * still assignable — it is in fact the face an operator most wants to reach —
17922
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17923
- * `subLabel`; this says only that the raw material exists.
17924
- *
17925
- * **Set once, never cleared.** A track that produced a gallery row produced
17926
- * one; deleting the row later is the gallery's business, not this flag's.
17927
- *
17928
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17929
- * before the column omits it, and so does every server that predates the
17930
- * field. A consumer must test `=== true` and render nothing otherwise —
17931
- * never infer "no assignable face".
17807
+ * CB5 shm passthrough a `FrameHandle` naming the same ring slot
17808
+ * the decoded pixels live in. One more member of the one-of
17809
+ * frame/frameHandle/image/imageBase64/referenceImage group.
17932
17810
  */
17933
- hasEmbeddedFace: boolean().optional(),
17811
+ frameHandle: FrameHandleSchema.optional(),
17812
+ imageBase64: string().optional(),
17934
17813
  /**
17935
- * This subject CONTAINS a folded rider a person the rider-pairing step
17936
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17937
- * so the passage is tracked once and as a VEHICLE.
17938
- *
17939
- * It exists because the fold's record was dishonest. D34 and the code both
17940
- * said "the person is not lost — it is reported so both entities stay on the
17941
- * record"; in fact the pair went into a per-processor RAM field behind an
17942
- * accessor nobody called, and every durable surface said `vehicle`, full
17943
- * stop. This is the composition note that makes the row true.
17944
- *
17945
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
17946
- * person" is not an answer to "what is this" — both label tiers would refuse
17947
- * a macro token anyway (D89), and correctly. Nothing here changes what the
17948
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17949
- * and a `person` rule still does not fire for someone cycling past.
17950
- *
17951
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17952
- * the column, and every hub that predates the field, omits it. Test
17953
- * `=== true` and render nothing otherwise — never infer "no rider".
17814
+ * Binary JPEG bytespreferred over `imageBase64` on internal
17815
+ * hops (hub forked worker via Moleculer MsgPack) because it
17816
+ * skips the 33% base64 overhead + the per-call base64 decode on
17817
+ * the detection-pipeline worker. Callers can pass either; exactly
17818
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17954
17819
  */
17955
- hasRider: boolean().optional(),
17956
- ...TrackFlagFields,
17957
- ...TrackRetrainFields
17958
- });
17959
- var BaseEventFields = {
17960
- id: string(),
17961
- deviceId: number(),
17962
- timestamp: number()
17963
- };
17964
- var MotionEventSchema = object({
17965
- ...BaseEventFields,
17966
- kind: literal("motion"),
17967
- regionCount: number(),
17968
- /** Heavy JSON array omitted in slim projection. */
17969
- regions: array(object({
17970
- bbox: BoundingBoxSchema,
17971
- pixelCount: number(),
17972
- intensity: number()
17973
- })).readonly().optional(),
17974
- /** Omitted in slim projection. */
17975
- frameWidth: number().optional(),
17976
- /** Omitted in slim projection. */
17977
- frameHeight: number().optional(),
17978
- /** Populated by B5 (recording playback URL for this event). */
17979
- mediaUrl: string().optional()
17980
- });
17820
+ image: _instanceof(Uint8Array).optional(),
17821
+ referenceImage: string().optional(),
17822
+ deviceId: number().optional(),
17823
+ sessionId: string().optional(),
17824
+ /**
17825
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
17826
+ * reference-image, and detail-subtree calls. 'frame' is the live
17827
+ * per-frame dispatch: ONLY root-plane steps run; crop children
17828
+ * (inputClasses ≠ null) are skipped and served per-track via
17829
+ * pipelineRunner.runDetailSubtree (two-plane design).
17830
+ */
17831
+ plane: _enum(["full", "frame"]).optional(),
17832
+ /**
17833
+ * Inference-device selector (Phase 2 multi-device). Format
17834
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17835
+ * Omitted ⇒ the runner's default device (current single-engine
17836
+ * behaviour). Selects WHICH device pool of the node runs the call.
17837
+ */
17838
+ deviceKey: string().optional(),
17839
+ /**
17840
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17841
+ * when the parent crop was resolved from the frame's retained NATIVE
17842
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17843
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17844
+ * resolution from that surface — the SAME quality path faces already
17845
+ * had — instead of the downscaled parent tile. `handle` keys the native
17846
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17847
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17848
+ * the executor's crop-normalized child ROI back into frame-normalized
17849
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17850
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17851
+ * (today's behaviour on the fallback path).
17852
+ */
17853
+ nativeCropRef: NativeCropRefSchema.optional()
17854
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17855
+ engine: PipelineEngineChoiceSchema.optional(),
17856
+ steps: array(PipelineStepInputSchema).min(1),
17857
+ frames: array(FrameInputSchema).min(1).max(255),
17858
+ deviceId: number().optional(),
17859
+ sessionId: string().optional(),
17860
+ /**
17861
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17862
+ * the batch to the Python pool's bench preprocess cache
17863
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17864
+ * preprocessed ONCE and every later inference is a pure-inference cache
17865
+ * hit — the sustained-throughput run measures inference, not
17866
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
17867
+ * full preprocess every call, correct). Fresh per sustained run;
17868
+ * released via `uncacheFrame`.
17869
+ */
17870
+ frameId: number().int().nonnegative().optional(),
17871
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17872
+ deviceKey: string().optional()
17873
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17874
+ data: _instanceof(Uint8Array),
17875
+ width: number().int().positive(),
17876
+ height: number().int().positive(),
17877
+ format: _enum([
17878
+ "rgb",
17879
+ "bgr",
17880
+ "gray"
17881
+ ])
17882
+ }), object({
17883
+ frameId: number(),
17884
+ width: number(),
17885
+ height: number()
17886
+ }), { kind: "mutation" }), method(object({
17887
+ stepId: string(),
17888
+ frameId: number().int()
17889
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17890
+ batchMode: string(),
17891
+ windowMs: number(),
17892
+ maxBatchSize: number(),
17893
+ concurrency: number()
17894
+ })), method(_void(), array(object({
17895
+ engineKey: string(),
17896
+ engine: PipelineEngineChoiceSchema,
17897
+ modelsLoaded: array(string()).readonly(),
17898
+ inUseByCameras: array(number()).readonly(),
17899
+ /**
17900
+ * Origin of this resident factory.
17901
+ * - `runtime` — main camera-serving engine (no idle TTL).
17902
+ * - `warm-override` — benchmark/test override held in the warm
17903
+ * cache; auto-disposed after the idle TTL.
17904
+ * - `device-pool` — a concurrent per-device pool (Phase 2
17905
+ * multi-device, keyed by `deviceKey`) resolved
17906
+ * via `resolveDeviceFactory`. Runs alongside the
17907
+ * `runtime` engine on a DIFFERENT accelerator
17908
+ * (NPU / iGPU / Coral) — this is how the
17909
+ * Engines tab shows all pools running at once.
17910
+ */
17911
+ kind: _enum([
17912
+ "runtime",
17913
+ "warm-override",
17914
+ "device-pool"
17915
+ ]),
17916
+ /** Native pid of the underlying Python pool (null when no pool). */
17917
+ poolPid: number().nullable(),
17918
+ /** ms since this factory was last used (null when not warm-tracked). */
17919
+ idleMs: number().nullable(),
17920
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17921
+ idleTtlMs: number().nullable()
17922
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
17923
+ kind: "mutation",
17924
+ auth: "admin"
17925
+ }), method(object({
17926
+ engine: PipelineEngineChoiceSchema,
17927
+ force: boolean().optional()
17928
+ }), object({
17929
+ success: boolean(),
17930
+ reason: string().optional()
17931
+ }), {
17932
+ kind: "mutation",
17933
+ auth: "admin"
17934
+ }), 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({
17935
+ addonId: string(),
17936
+ modelId: string(),
17937
+ filename: string().optional(),
17938
+ settings: record(string(), unknown()).optional()
17939
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
17981
17940
  /**
17982
- * Which detection SOURCE produced an object event. `pipeline` = the ML
17983
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
17984
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
17985
- * tracking, per-kind persistence) but stay distinguishable so consumers
17986
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17987
- * Absent on legacy rows treat as `pipeline`.
17941
+ * Per-stage gating mode applied to the zones a rule references.
17942
+ *
17943
+ * - `include`: the rule contributes to a **whitelist** for its stage.
17944
+ * When at least one `include` rule fires for a stage, only entities
17945
+ * inside one of those zones pass that stage.
17946
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
17947
+ * Entities inside one of those zones are dropped at that stage.
17948
+ *
17949
+ * `monitor`-style observation (count without filtering) is not a rule
17950
+ * mode — zones without any matching rule are observed naturally by
17951
+ * `zone-analytics` (live snapshot + history), so an "I just want to
17952
+ * count, not filter" use case needs no rule at all.
17988
17953
  */
17989
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17954
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
17990
17955
  /**
17991
- * The confirmed zone crossing that produced an object event. Present ONLY on
17992
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17993
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17994
- * appearance event carry none, so a rule asking for a direction fails closed
17995
- * on them.
17956
+ * Per-consumer rule that references existing zones (geometry) and
17957
+ * defines how a specific pipeline stage should treat them. Each
17958
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
17959
+ * settings:
17996
17960
  *
17997
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17998
- * into its own event, so a frame in which a track enters A while leaving B
17999
- * produces two events with two directions — never one ambiguous row.
17961
+ * - `addon-motion-wasm` `motionZoneRules: ZoneRule[]` (motion stage)
17962
+ * - `addon-detection-pipeline` `detectionZoneRules: ZoneRule[]` (detection stage)
17963
+ * - future: notification rules, audio gating, etc.
18000
17964
  *
18001
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
18002
- * membership the box has NOW, and by definition it no longer contains the zone
18003
- * that was just left. Without the id here, a zone-scoped rule could never match
18004
- * the exit it asked for.
17965
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
17966
+ * express "ignore motion in ALL of {garden, street}" with a single
17967
+ * rule. `classFilter` narrows the rule to specific object classes
17968
+ * "drop person detections in the street, but keep cars" is one
17969
+ * `exclude` rule with `classFilter: ['person']`.
17970
+ *
17971
+ * `enabled` is a soft toggle — the operator can keep the rule
17972
+ * configured but inert without deleting it.
18005
17973
  */
18006
- var ZoneCrossingSchema = object({
18007
- direction: _enum(["enter", "exit"]),
18008
- /** Admin zone id crossed. */
18009
- zoneId: string(),
18010
- /** Zone display name at crossing time (falls back to the id). */
18011
- zoneName: string().optional()
18012
- });
18013
- var ObjectEventSchema = object({
18014
- ...BaseEventFields,
18015
- kind: literal("object"),
18016
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
18017
- source: DetectionSourceSchema.optional(),
17974
+ var ZoneRuleSchema = object({
17975
+ /** Stable rule id — survives edits, used by the UI for diffing. */
17976
+ id: string(),
17977
+ /** Optional human-readable label rendered in the rule editor. */
17978
+ name: string().optional(),
17979
+ /** Zones this rule targets. The rule's `mode` applies to ALL
17980
+ * listed zones (OR-set: a detection in any one of them counts).
17981
+ * At least one zone id required — a rule with no targets is a
17982
+ * configuration mistake and the form validator rejects it. */
17983
+ zoneIds: array(string()).min(1).readonly(),
17984
+ mode: ZoneRuleModeEnum,
18018
17985
  /**
18019
- * Inference-frame id shared by every object event emitted from the SAME frame
18020
- * the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
18021
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
18022
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
18023
- * Optional for backward-compat with pre-existing rows / the slim projection
18024
- * includes it (it is light). Absent on rows written before this field.
17986
+ * Class names this rule applies to. Empty / undefined rule
17987
+ * applies to every class. Class strings match the `macroClass`
17988
+ * field on detections (e.g. `person`, `car`, `dog`).
18025
17989
  */
18026
- frameId: string().optional(),
18027
- /** Omitted in slim projection. */
18028
- trackId: string().optional(),
18029
- className: string(),
18030
- ...TieredLabelFields,
18031
- /** Omitted in slim projection. */
18032
- confidence: number().optional(),
18033
- /** Heavy JSON — omitted in slim projection. */
18034
- bbox: BoundingBoxSchema.optional(),
18035
- /** Heavy JSON — omitted in slim projection. */
18036
- zones: array(string()).readonly().optional(),
18037
- /** Omitted in slim projection. */
18038
- state: TrackStateSchema.optional(),
17990
+ classFilter: array(string()).readonly().optional(),
18039
17991
  /**
18040
- * The zone crossing this event IS, when it is one. Absent on every other
18041
- * event kind (movement state, appearance, package) see
18042
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
17992
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
17993
+ * required to consider an entity "in the zone". Defaults to the
17994
+ * consumer's stage default when omitted. Kept for back-compat with
17995
+ * existing per-rule overrides; new operators pick the value via
17996
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
17997
+ * set, the lower-level engine reads it as a 0–1 fraction.
18043
17998
  */
18044
- zoneCrossing: ZoneCrossingSchema.optional(),
18045
- /** Detection-frame dimensions in pixels — let consumers normalize the
18046
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
18047
- frameWidth: number().optional(),
18048
- frameHeight: number().optional(),
18049
- /** MediaStore key for the crop attached to this event (if any). */
18050
- mediaKey: string().optional(),
18051
- /** Design B: MediaStore key of the track's native-resolution key frame (the
18052
- * best-detection full frame). Resolve via the event-media data-plane
18053
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
18054
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
18055
- * sources — consumers fall back to `mediaKey` (the tight crop). */
18056
- keyFrameMediaKey: string().optional(),
18057
- /** Populated by B5 (recording playback URL for this event). */
18058
- mediaUrl: string().optional(),
18059
- /** The parent track's key-event importance [0,1], propagated to every object
18060
- * event of the track (so an event row can be sorted by importance without a
18061
- * track join). Absent on legacy rows / before the track was scored. */
18062
- importance: number().optional()
18063
- });
18064
- var AudioEventSchema = object({
18065
- ...BaseEventFields,
18066
- kind: literal("audio"),
18067
- rms: number(),
18068
- dbfs: number(),
18069
- classification: object({
18070
- className: string(),
18071
- originalClass: string().optional(),
18072
- score: number()
18073
- }).optional(),
18074
- /** Populated by B5 (recording playback URL for this event). */
18075
- mediaUrl: string().optional()
17999
+ overlapThreshold: number().min(0).max(1).optional(),
18000
+ /**
18001
+ * Operator-friendly version of `overlapThreshold` the percentage
18002
+ * of the detection's bbox that must lie inside the zone for the
18003
+ * rule to match. Documented default is 85%; the engine substitutes
18004
+ * that when the field is omitted (kept optional so existing rules
18005
+ * stored without it stay valid).
18006
+ *
18007
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
18008
+ * rule, the engine prefers `bboxInclusionPct` because it's the
18009
+ * field exposed in the UI. Internally both feed the same gate.
18010
+ */
18011
+ bboxInclusionPct: number().min(0).max(100).optional(),
18012
+ /**
18013
+ * When `true` and a detection has a segmentation mask, use the
18014
+ * mask for overlap instead of the bbox. Detection-stage only;
18015
+ * motion rules ignore this field.
18016
+ */
18017
+ preferMask: boolean().optional(),
18018
+ /**
18019
+ * Soft-toggle: `false` disables the rule without deleting it.
18020
+ * Defaults to `true` so operators creating a rule via the UI
18021
+ * see it active immediately.
18022
+ */
18023
+ enabled: boolean().default(true)
18076
18024
  });
18077
- var MediaFileKindEnum = _enum([
18078
- "crop",
18079
- "thumbnail",
18080
- "snapshot",
18081
- "firstFrame",
18082
- "lastFrame",
18083
- "fullFrame",
18084
- "fullFrameBoxed",
18085
- "faceCrop",
18086
- "plateCrop",
18087
- "keyFrame",
18088
- "keyFrameSmall",
18089
- "thumbnailSmall"
18090
- ]);
18091
- var MediaFileSchema = object({
18092
- key: string(),
18093
- kind: MediaFileKindEnum,
18094
- base64: string(),
18095
- sizeBytes: number(),
18096
- timestamp: number()
18025
+ array(ZoneRuleSchema).readonly();
18026
+ /**
18027
+ * Zone — pure geometry + identity. NO filtering behaviour.
18028
+ *
18029
+ * Zones describe **where** in the frame the operator wants to flag
18030
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
18031
+ * each pipeline stage uses them. Splitting the two means a single
18032
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
18033
+ * a detection-include rule on `['car']`, and an occupancy aggregate
18034
+ * — without three duplicated polygons.
18035
+ *
18036
+ * Owned by the orchestrator addon (provider) and mirrored into the
18037
+ * `zones` device-state slice on every mutation. Consumers
18038
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
18039
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
18040
+ * mirror with `onChanged`).
18041
+ *
18042
+ * Coordinates are normalised fractions of the frame (0–1) so zones
18043
+ * survive resolution changes and stream profile switches.
18044
+ *
18045
+ * `kind` discriminates between full polygons (closed regions used
18046
+ * for intrusion / occupancy filters) and tripwires (open 2-point
18047
+ * line segments used for cross events). Onboard / firmware-reported
18048
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
18049
+ * task list.
18050
+ */
18051
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
18052
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
18053
+ var PolygonPointSchema = object({
18054
+ x: number(),
18055
+ y: number()
18056
+ });
18057
+ /** A camera detection zone — pure geometry/identity. */
18058
+ var ZoneSchema = object({
18059
+ id: string(),
18060
+ name: string(),
18061
+ kind: ZoneKindEnum.default("polygon"),
18062
+ /** Polygon vertices, fraction of frame (0–1). */
18063
+ polygon: array(PolygonPointSchema).readonly(),
18064
+ /** Visual color for UI rendering. */
18065
+ color: string().default("#3b82f6")
18097
18066
  });
18098
18067
  /**
18099
- * One media row WITHOUT its bytes.
18068
+ * Zones capability per-camera CRUD over polygon detection zones.
18100
18069
  *
18101
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
18102
- * 140 s track), and a client that renders tiles from the media data plane needs
18103
- * to know only WHAT EXISTS the bytes then arrive per tile, lazily, over HTTP
18104
- * with an immutable cache, instead of all at once inside a tRPC response that
18105
- * blocks the whole view.
18070
+ * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
18071
+ * to per-device settings and mirrors into the `zones` device-state
18072
+ * slice on every mutation, so downstream consumers can subscribe via
18073
+ * `dev.state.zones.onChanged`.
18106
18074
  *
18107
- * `sizeBytes` is carried because it is what lets a client decide between the
18108
- * stored blob and a `?variant=thumb` rendering without fetching either.
18075
+ * The cap surface only handles geometry + identity; filtering
18076
+ * behaviour (per-class, include/exclude, threshold) lives in the
18077
+ * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
18078
+ * `capabilities/schemas/zone-rule.js`.
18109
18079
  */
18110
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18080
+ var zonesCapability = {
18081
+ name: "zones",
18082
+ scope: "device",
18083
+ mode: "singleton",
18084
+ deviceTypes: [DeviceType.Camera],
18085
+ methods: {
18086
+ listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
18087
+ addZone: method(object({
18088
+ deviceId: number(),
18089
+ zone: ZoneSchema
18090
+ }), _void(), {
18091
+ kind: "mutation",
18092
+ auth: "admin"
18093
+ }),
18094
+ removeZone: method(object({
18095
+ deviceId: number(),
18096
+ zoneId: string()
18097
+ }), _void(), {
18098
+ kind: "mutation",
18099
+ auth: "admin"
18100
+ }),
18101
+ updateZone: method(object({
18102
+ deviceId: number(),
18103
+ zone: ZoneSchema
18104
+ }), _void(), {
18105
+ kind: "mutation",
18106
+ auth: "admin"
18107
+ })
18108
+ },
18109
+ /**
18110
+ * Runtime-state slice — the live zone catalogue mirrored by the
18111
+ * orchestrator on every CRUD mutation. Consumers read via
18112
+ * `device.state.zones.value` / `.watch(...)` without round-tripping
18113
+ * the cap, and the codegen DeviceProxy auto-wires the reactive
18114
+ * handle. Slice shape is `{ zones: Zone[] }` so future extensions
18115
+ * (e.g. zone groupings) can sit alongside the polygon list.
18116
+ */
18117
+ runtimeState: object({ zones: array(ZoneSchema).readonly() }),
18118
+ /**
18119
+ * 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.
18120
+ *
18121
+ * See `RuntimeStateDurability`. Enforced by
18122
+ * `scripts/check-runtime-state-durability.ts`.
18123
+ */
18124
+ durability: "restored"
18125
+ };
18111
18126
  /**
18112
- * The MACRO tier of an annotation — a CLOSED set.
18127
+ * pipeline-analytics device-scoped wrapper cap. Refines raw
18128
+ * per-frame detections emitted by the pipeline runner into tracked
18129
+ * objects, per-kind event collections (motion / object / audio), and
18130
+ * persisted media. Owns the post-detection domain end-to-end:
18113
18131
  *
18114
- * This is what the exported detector predicts, so a typo here is a new class
18115
- * with one example in it. `label` and `subLabel` are open strings by contrast:
18116
- * the whole point of the page is teaching the model things it does not know
18117
- * yet, and constraining that vocabulary would make it useless.
18132
+ * runner emits PipelineInferenceResult
18133
+ * (event bus)
18134
+ * pipeline-analytics subscriber
18135
+ * SORT tracker + zone engine + state analyzer + event emitter
18136
+ * → three DB collections (one per kind), one FS media tree, one
18137
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
18138
+ * DetectionEvent on bus)
18118
18139
  *
18119
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
18120
- * `subLabel` is one of these values, in any casing, because once `person`
18121
- * exists in both tiers "every person box" stops being answerable without
18122
- * knowing every string anyone ever typed — and the damage is retroactive.
18140
+ * Pure subscriber model. No `processFrame` cap method the runner
18141
+ * already publishes the raw frame on the bus. The cap surface is
18142
+ * only QUERIES + per-device settings, bound on/off via
18143
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
18144
+ * every camera with a detection pipeline wants its raw detections
18145
+ * refined; operators opt out per-device via BindingsTab when needed.
18146
+ *
18147
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
18148
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
18123
18149
  */
18124
- var RetrainMacroClassSchema = _enum([
18150
+ var TrackStateSchema = _enum([
18151
+ "new",
18152
+ "entered",
18153
+ "left",
18154
+ "moving",
18155
+ "idle"
18156
+ ]);
18157
+ var EventKindSchema = _enum([
18158
+ "motion",
18159
+ "object",
18160
+ "audio"
18161
+ ]);
18162
+ /**
18163
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
18164
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
18165
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
18166
+ */
18167
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
18168
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
18169
+ var EventKindIconSchema = _enum([
18170
+ "motion",
18171
+ "audio",
18125
18172
  "person",
18126
18173
  "vehicle",
18127
18174
  "animal",
18175
+ "door",
18176
+ "pir",
18177
+ "smoke",
18178
+ "water",
18179
+ "button",
18128
18180
  "package",
18129
- "face",
18130
- "plate"
18181
+ "generic"
18131
18182
  ]);
18132
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
18133
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
18134
- /** Did a human draw this box, or did the assist propose it? */
18135
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
18136
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
18137
- var RetrainBboxSchema = object({
18138
- x: number(),
18139
- y: number(),
18140
- w: number(),
18141
- h: number()
18142
- });
18143
- /**
18144
- * One annotated subject.
18145
- *
18146
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
18147
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
18148
- * derived from it at export and never stored storing them is how one feature
18149
- * space ends up holding two crops of the same subject (D52).
18150
- */
18151
- var RetrainAnnotationSchema = object({
18152
- id: string(),
18153
- trackId: string(),
18154
- deviceId: number(),
18155
- /** The COPY in retrain storage — never the source track's media key. */
18156
- mediaKey: string(),
18157
- bbox: RetrainBboxSchema,
18158
- macroClass: RetrainMacroClassSchema,
18159
- label: string().optional(),
18160
- subLabel: string().optional(),
18161
- kind: RetrainAnnotationKindSchema,
18162
- source: RetrainAnnotationSourceSchema,
18163
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
18164
- assistModelId: string().optional(),
18165
- assistScore: number().optional(),
18166
- exportedInBatch: string().optional(),
18167
- createdAt: number()
18168
- });
18169
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
18170
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
18171
- id: true,
18172
- trackId: true,
18173
- deviceId: true,
18174
- mediaKey: true,
18175
- createdAt: true,
18176
- exportedInBatch: true
18183
+ var EventKindCategorySchema = _enum([
18184
+ "motion",
18185
+ "audio",
18186
+ "detection",
18187
+ "sensor",
18188
+ "control",
18189
+ "custom",
18190
+ "package"
18191
+ ]);
18192
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
18193
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18194
+ var EventKindDescriptorSchema = object({
18195
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18196
+ kind: string(),
18197
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
18198
+ labelKey: string(),
18199
+ /** English fallback label (kept for clients that don't translate). */
18200
+ label: string(),
18201
+ /** Hex color for timeline/legend rendering. */
18202
+ color: string(),
18203
+ /** Dictionary id → lucide component on the UI side. */
18204
+ iconId: string(),
18205
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18206
+ icon: EventKindIconSchema,
18207
+ category: EventKindCategorySchema,
18208
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
18209
+ parentKind: string().nullable(),
18210
+ /** Derived from `parentKind`, explicit for the client tree. */
18211
+ level: EventKindLevelSchema,
18212
+ /** Which cap + device contributes this kind. For built-ins the camera
18213
+ * itself; for sensor kinds the LINKED source device. */
18214
+ source: object({
18215
+ capName: string(),
18216
+ deviceId: number()
18217
+ })
18177
18218
  });
18178
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
18179
- var RetrainTrackSchema = object({
18180
- trackId: string(),
18219
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
18220
+ var EventKindsForDeviceSchema = object({
18181
18221
  deviceId: number(),
18182
- className: string(),
18183
- label: string().optional(),
18184
- firstSeen: number(),
18185
- lastSeen: number(),
18186
- /** How many frames the dataset already holds from this track. */
18187
- frameCount: number().int(),
18188
- /** How many subjects have been annotated on those frames. `0` with
18189
- * `frameCount: 0` is exactly "staging, still to work". */
18190
- annotationCount: number().int()
18191
- });
18192
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
18193
- var RetrainFrameCandidateSchema = object({
18194
- mediaKey: string(),
18195
- kind: MediaFileKindEnum,
18196
- timestamp: number(),
18197
- sizeBytes: number().int(),
18198
- /** A copy of this original already exists — selecting it is free and cannot
18199
- * fail, whatever became of the original. */
18200
- copied: boolean()
18222
+ kinds: array(EventKindDescriptorSchema).readonly()
18201
18223
  });
18202
- /** A frame the dataset OWNS: bytes copied at selection time. */
18203
- var RetrainFrameSchema = object({
18204
- frameId: string(),
18224
+ var SensorEventSchema = object({
18225
+ id: string(),
18226
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
18227
+ * yields N rows, one per camera). */
18205
18228
  deviceId: number(),
18206
- trackId: string(),
18207
- /** Provenance only. It may already point at nothing — that is expected. */
18208
- sourceMediaKey: string(),
18209
- sourceKind: MediaFileKindEnum,
18210
- sizeBytes: number().int(),
18211
- width: number().int(),
18212
- height: number().int(),
18213
- copiedAt: number()
18229
+ /** The linked sensor device whose state changed. */
18230
+ sourceDeviceId: number(),
18231
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
18232
+ kind: string(),
18233
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
18234
+ value: record(string(), unknown()).nullable(),
18235
+ timestamp: number()
18214
18236
  });
18215
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
18216
- var RetrainCopyRefusalSchema = _enum([
18217
- "source-missing",
18218
- "unreadable-image",
18219
- "write-failed"
18220
- ]);
18221
- var RetrainFrameSelectionSchema = object({
18222
- copied: array(RetrainFrameSchema).readonly(),
18223
- refused: array(object({
18224
- sourceMediaKey: string(),
18225
- reason: RetrainCopyRefusalSchema
18226
- })).readonly()
18237
+ var TrackPositionSchema = object({
18238
+ x: number(),
18239
+ y: number(),
18240
+ timestamp: number(),
18241
+ bbox: BoundingBoxSchema
18227
18242
  });
18228
- var RetrainFrameListSchema = object({
18229
- candidates: array(RetrainFrameCandidateSchema).readonly(),
18230
- copies: array(RetrainFrameSchema).readonly(),
18231
- /** What the page pre-selects the native key frame when one survives. */
18232
- autoPickMediaKey: string().optional()
18243
+ var TrackSnapshotSchema = object({
18244
+ timestamp: number(),
18245
+ position: TrackPositionSchema,
18246
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
18247
+ mediaKey: string()
18233
18248
  });
18234
- /** What the operator asked the assist to look for. */
18235
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
18236
- kind: literal("package"),
18237
- zone: RetrainBboxSchema.optional()
18238
- }), object({
18239
- kind: literal("objects"),
18240
- modelId: string(),
18241
- minScore: number().optional()
18242
- })]);
18243
18249
  /**
18244
- * The assist's answer a discriminated union, because "the model saw nothing"
18245
- * and "this node cannot run that model" lead to different next moves and a
18246
- * nullable result cannot tell them apart.
18250
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
18251
+ * divided by the track's detection-frame dims), computed at persist time.
18252
+ * Absent when the frame dims were unknown when the track was persisted
18253
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
18247
18254
  */
18248
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
18249
- kind: literal("proposed"),
18250
- modelId: string(),
18251
- stepId: string(),
18252
- minScore: number(),
18253
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
18254
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
18255
- /** Returned by the runner but removed by the threshold. */
18256
- belowThreshold: number().int()
18257
- }), object({
18258
- kind: literal("refused"),
18259
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
18260
- reason: string(),
18261
- detail: string().optional()
18262
- })]);
18263
- /** The outcome of a lifecycle move owned by the retrain page. */
18264
- var RetrainTransitionResultSchema = object({
18265
- trackId: string(),
18266
- /** Where the track ended up, whatever happened. */
18267
- retrainStatus: RetrainStatusSchema,
18268
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
18269
- changed: boolean(),
18270
- reason: _enum([
18271
- "unknown-track",
18272
- "no-frames-copied",
18273
- "not-staging",
18274
- "not-trained",
18275
- "unchanged"
18276
- ]).optional()
18277
- });
18278
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
18279
- var MAX_EVENT_QUERY_LIMIT = 5e3;
18280
- var DeviceEventQueryInput = object({
18281
- deviceId: number(),
18282
- since: number().optional(),
18283
- until: number().optional(),
18284
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18285
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18286
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18287
- * exact behaviour. Callers may omit this field — the store defaults to
18288
- * `full` when not provided. */
18289
- projection: _enum(["full", "slim"]).optional()
18290
- });
18291
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
18292
- var RecentTracksQueryInput = object({
18293
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
18294
- deviceIds: array(number()),
18295
- /** Window lower bound on `lastSeen` (inclusive). */
18296
- since: number().optional(),
18297
- /** Window upper bound on `lastSeen` (inclusive). */
18298
- until: number().optional(),
18299
- /** Page size. Default 200, max 1000. */
18300
- limit: number().int().min(1).max(1e3).default(200),
18301
- /** Opaque continuation cursor from a previous page's `nextCursor`.
18302
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
18303
- cursor: string().optional(),
18304
- /** See {@link TrackProjectionSchema}. Default `full`. */
18305
- projection: TrackProjectionSchema.optional(),
18306
- /** Include stationary-promoted rows (parked objects). Default false: the
18307
- * feed lists passages; parking records live on the stationary registry. */
18308
- includeStationary: boolean().optional()
18309
- });
18310
- var RecentTracksPageSchema = object({
18311
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
18312
- tracks: array(TrackSchema).readonly(),
18313
- /** Cursor for the next page, or null when this page is the last. */
18314
- nextCursor: string().nullable()
18315
- });
18316
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
18317
- var LIST_GROUPS_MAX_LIMIT = 100;
18318
- var AnalyticsGroupRecordSchema = object({
18319
- id: string(),
18320
- deviceId: number().int(),
18321
- openedAt: number().int(),
18322
- closedAt: number().int(),
18323
- timestamp: number().int(),
18324
- memberCount: number().int(),
18325
- memberTrackIds: array(string()).readonly(),
18326
- className: string(),
18327
- classes: array(string()).readonly(),
18328
- /** Relative event-media path, or null when the group has no picture yet. */
18329
- mediaUrl: string().nullable(),
18330
- singleton: boolean()
18255
+ var TrackEnvelopeSchema = object({
18256
+ minX: number(),
18257
+ minY: number(),
18258
+ maxX: number(),
18259
+ maxY: number()
18331
18260
  });
18332
- var AnalyticsGroupMemberSchema = object({
18333
- trackId: string(),
18334
- deviceId: number().int(),
18335
- className: string(),
18336
- firstSeen: number().int(),
18337
- lastSeen: number().int(),
18338
- mediaUrl: string().nullable()
18339
- });
18340
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
18341
- var ListGroupsQueryInput = object({
18342
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
18343
- deviceIds: array(number()),
18344
- /** Window lower bound on `closedAt` (inclusive). */
18345
- since: number().optional(),
18346
- /** Window upper bound on `openedAt` (inclusive). */
18347
- until: number().optional(),
18348
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
18349
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
18350
- cursor: string().optional()
18351
- });
18352
- var ListGroupsPageSchema = object({
18353
- groups: array(AnalyticsGroupRecordSchema).readonly(),
18354
- nextCursor: string().nullable()
18355
- });
18356
- var KeyEventQueryInput = object({
18357
- deviceId: number(),
18358
- /** Window lower bound (track firstSeen ≥ since). */
18359
- since: number(),
18360
- /** Window upper bound (track firstSeen ≤ until). */
18361
- until: number(),
18362
- limit: number().int().min(1).max(200).default(50),
18363
- /** Drop tracks scoring below this importance. */
18364
- minImportance: number().min(0).max(1).optional(),
18365
- /** Restrict to a single class (e.g. 'person'). */
18366
- classFilter: string().optional()
18367
- });
18368
- var KeyEventSchema = object({
18369
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
18370
- id: string(),
18371
- trackId: string(),
18372
- /** Track start time (firstSeen). */
18373
- timestamp: number(),
18374
- className: string(),
18375
- ...TieredLabelFields,
18376
- importance: number(),
18377
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
18378
- bestEventId: string(),
18379
- /** Track lifetime in ms (lastSeen - firstSeen). */
18380
- windowMs: number().optional(),
18381
- ...TrackFlagFields,
18382
- ...TrackRetrainFields
18383
- });
18384
- object({
18385
- trackId: string(),
18386
- className: string(),
18387
- confidence: number(),
18388
- bbox: BoundingBoxSchema,
18389
- zones: array(string()).readonly(),
18390
- state: TrackStateSchema
18391
- });
18392
- var OverlayDetectionSchema = looseObject({
18393
- id: string(),
18394
- kind: _enum(["first-level", "detail"]),
18395
- macroClass: string(),
18396
- score: number(),
18397
- bbox: object({
18398
- x: number(),
18399
- y: number(),
18400
- width: number(),
18401
- height: number()
18402
- }),
18403
- labels: array(looseObject({
18404
- label: string(),
18405
- score: number()
18406
- })).readonly(),
18407
- parentId: string().optional()
18408
- });
18409
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
18410
- var SearchObjectEventsInput = object({
18411
- text: string(),
18412
- deviceId: number().optional(),
18413
- since: number().optional(),
18414
- until: number().optional(),
18415
- classFilter: string().optional(),
18416
- limit: number().default(50),
18417
- minScore: number().min(0).max(1).default(.2)
18418
- });
18419
- var TrackCascadeCountsSchema = object({
18420
- /** Persisted track roots deleted (authoritative). */
18421
- tracks: number().int(),
18422
- /** Object events removed with their tracks (best-effort; see note above). */
18423
- events: number().int(),
18424
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
18425
- media: number().int(),
18426
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
18427
- faces: number().int(),
18428
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
18429
- plates: number().int(),
18430
- /** Per-track CLIP search vectors removed (best-effort). */
18431
- embeddings: number().int(),
18432
- /** Group membership + group rows removed with their last member (best-effort). */
18433
- groups: number().int()
18434
- });
18435
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
18436
- var DiskReconcileCountsSchema = object({
18437
- mediaDropped: number().int(),
18438
- tracks: number().int(),
18439
- events: number().int()
18440
- });
18441
- /** Event-store footprint for one camera. */
18442
- var EventStoreDeviceFootprintSchema = object({
18443
- deviceId: number(),
18444
- /** Persisted event rows (motion + object + audio) for the camera. */
18445
- rows: number().int(),
18446
- /** Event-owned media bytes on disk for the camera. */
18447
- bytes: number().int()
18448
- });
18449
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
18450
- var EventStoreFootprintSchema = object({
18451
- totalRows: number().int(),
18452
- totalBytes: number().int(),
18453
- devices: array(EventStoreDeviceFootprintSchema).readonly()
18454
- });
18455
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
18456
- var EventPruneCountsSchema = object({
18457
- motion: number().int(),
18458
- object: number().int(),
18459
- audio: number().int()
18261
+ /**
18262
+ * Row projection for track list queries. `full` (default) returns the
18263
+ * complete Track including the frame-rate `positions[]` history and the
18264
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
18265
+ * keeps every scalar the list surfaces actually render (ids, class(es),
18266
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
18267
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
18268
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
18269
+ * `getTrack`. Mirrors the event-store `projection` convention
18270
+ * (`getObjectEvents` et al.).
18271
+ */
18272
+ var TrackProjectionSchema = _enum(["full", "slim"]);
18273
+ /**
18274
+ * One audio-classification label heard on the track's camera while the
18275
+ * track was alive, aggregated per label. An "episode" is one persisted
18276
+ * audio event (the confident-classification path: score ≥ the device's
18277
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
18278
+ * one 32 ms inference chunk, so counts stay human-scaled.
18279
+ */
18280
+ var TrackAudioLabelSchema = object({
18281
+ label: string(),
18282
+ /** Highest classification score observed across the label's episodes. */
18283
+ peakScore: number(),
18284
+ /** Number of coalesced audio-event episodes carrying this label. */
18285
+ count: number(),
18286
+ firstAt: number(),
18287
+ lastAt: number()
18460
18288
  });
18461
18289
  /**
18462
- * Re-embed stored tracks from their key frames.
18290
+ * How a track was produced. `pipeline` (default / absent) = the spatial
18291
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
18292
+ * no positions, a single snapshot, and no bbox trajectory at all:
18463
18293
  *
18464
- * The reason this is an operator-callable method and not a migration script:
18465
- * every knob that decides what a vector MEANS encoder model, crop margin,
18466
- * squaring is only changeable if the existing vectors can be regenerated.
18467
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
18468
- * symptom is a quality regression with no visible cause.
18294
+ * - `sensor` a linked sensor/control device state change.
18295
+ * - `audio` an audio event on the camera itself that was anomalous for
18296
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
18297
+ *
18298
+ * The spatial subsystems (tracker association, occupancy count, re-id /
18299
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
18300
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
18301
+ * check silently readmits every source added after it was written.
18469
18302
  */
18470
- var RebuildObjectEmbeddingsInput = object({
18471
- /** Restrict to one camera. Omit for the whole fleet. */
18472
- deviceId: number().optional(),
18473
- since: number().optional(),
18474
- until: number().optional(),
18475
- /** Stop after this many tracks; the result reports whether more remain. */
18476
- maxTracks: number().int().positive().optional(),
18477
- /**
18478
- * Run every embedding on THIS node instead of round-robining the fleet.
18479
- *
18480
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
18481
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
18482
- * calling it that would pin the rebuild REQUEST itself to that node — the
18483
- * rebuild orchestration lives on the hub, and only the per-track step runs
18484
- * remotely. This field is data; the per-track pin is applied inside.
18485
- *
18486
- * Absent ⇒ round-robin over every online node whose runner can serve the
18487
- * pinned model.
18488
- */
18489
- executeOnNodeId: string().optional(),
18490
- /**
18491
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
18492
- * run flat out.
18493
- *
18494
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
18495
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
18496
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
18497
- * force is logged at start and finish so a deliberately slow pass reads
18498
- * differently from a stalled one.
18499
- */
18500
- pacingMs: number().int().nonnegative().optional()
18501
- });
18303
+ var TrackSourceSchema = _enum([
18304
+ "pipeline",
18305
+ "sensor",
18306
+ "audio"
18307
+ ]);
18502
18308
  /**
18503
- * Result of emptying the CLIP index.
18309
+ * Where a track sits in the RETRAIN lifecycle (D81).
18504
18310
  *
18505
- * The clean slate before a policy change: a new crop margin or encoder model
18506
- * leaves two feature spaces in one index whose cosine scores are not
18507
- * comparable, so wiping and rebuilding is the only way to be sure every vector
18508
- * means the same thing.
18311
+ * - `none` never marked, or un-marked. Evictable.
18312
+ * - `staging` the operator wants this track as training material and has not
18313
+ * finished with it. **This is the only state retention holds**: the track and
18314
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
18315
+ * the device's age window.
18316
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
18317
+ * were COPIED into the retrain dataset at selection time, so the dataset no
18318
+ * longer depends on the track's media and the track becomes EVICTABLE again.
18319
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
18320
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
18321
+ *
18322
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
18323
+ * the store's filter language has only positive equality and `whereIn` — no
18324
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
18325
+ * would make the entire pre-column history immortal in one deploy.
18509
18326
  */
18510
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
18327
+ var RetrainStatusSchema = _enum([
18328
+ "none",
18329
+ "staging",
18330
+ "trained"
18331
+ ]);
18511
18332
  /**
18512
- * Acknowledgement that a rebuild STARTED.
18333
+ * Per-track OPERATOR flags set by hand from the admin UI or the viewer, never
18334
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
18335
+ * so the two surfaces cannot drift.
18513
18336
  *
18514
- * The pass costs ~1s per track 45 minutes for a 2,600-track fleet so it
18515
- * runs detached and this returns immediately. Waiting for it made the client
18516
- * time out while the work carried on server-side, which is the worst of both:
18517
- * no result and no way to know it was still going. Poll
18518
- * `getObjectEmbeddingRebuildStatus` for progress.
18337
+ * **Absent false.** A track that has never been touched omits the field; an
18338
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
18339
+ * columns existed read as absent, and a consumer that needs a boolean should say
18340
+ * `flag === true`, not `flag !== false`.
18341
+ *
18342
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
18343
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
18344
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
18345
+ * `trained` track reports `false` while refusing both writes. The boolean is
18346
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
18347
+ * "never marked" from "already trained" must read `retrainStatus`.
18348
+ *
18349
+ * `debug` does NOT pin; it is attention, not durability.
18350
+ *
18351
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
18352
+ * A favourited track is skipped by retention the same way `staging` is, but
18353
+ * it does not enter `none|staging|trained` and has no staging budget.
18519
18354
  */
18520
- var RebuildObjectEmbeddingsResultSchema = object({
18521
- started: boolean(),
18522
- /** True when a pass was already running; the new request is ignored. */
18523
- alreadyRunning: boolean()
18524
- });
18525
- var RebuildStatusSchema = object({
18526
- running: boolean(),
18527
- scanned: number(),
18528
- rebuilt: number(),
18529
- /** Tracks whose key frame is gone — nothing to re-embed from. */
18530
- missingKeyFrame: number(),
18531
- /** Tracks with no usable detection box. */
18532
- missingBbox: number(),
18533
- /**
18534
- * Tracks an executing node REFUSED rather than broke on an unreadable key
18535
- * frame, a step that threw. Separate from `failed` because the remedy is
18536
- * different, and because a whole camera silently contributing zero vectors
18537
- * is the shape of failure a rebuild must never hide.
18538
- */
18539
- notRunnable: number(),
18540
- /**
18541
- * The pass stopped because NO node could serve the pinned model.
18542
- *
18543
- * Distinct from `notRunnable` on purpose: that one says "this track was
18544
- * refused", this one says "the cluster cannot do this work at all" — every
18545
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
18546
- * pinned model for its engine format, or dropped out. The remedy is a model /
18547
- * engine change, not a per-camera one. Non-zero here always comes with
18548
- * `complete: false`.
18549
- */
18550
- noCapableNode: number(),
18551
- failed: number(),
18552
- /** Set once a pass ends: true only when EVERYTHING was covered. */
18553
- complete: boolean().nullable(),
18554
- startedAtMs: number().nullable(),
18555
- finishedAtMs: number().nullable(),
18556
- /** Present when the pass ended by throwing. */
18557
- error: string().nullable()
18355
+ var TrackFlagFields = {
18356
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
18357
+ * `'staging'`. */
18358
+ markForTrain: boolean().optional(),
18359
+ /** Operator marked this track for diagnostic attention. */
18360
+ debug: boolean().optional(),
18361
+ /** Operator favourited this track. Pins it against pruning. */
18362
+ favourited: boolean().optional()
18363
+ };
18364
+ /**
18365
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
18366
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
18367
+ * write patch, and the status is not something the toggle sets — it is what the
18368
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
18369
+ * always present on a persisted row (the column default materialises `'none'`).
18370
+ */
18371
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
18372
+ /**
18373
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
18374
+ * one flag can never clear the other — the toggles are independent and are
18375
+ * driven from three surfaces that do not know about each other.
18376
+ */
18377
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
18378
+ /**
18379
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
18380
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
18381
+ * mutation result without a re-fetch.
18382
+ */
18383
+ var TrackFlagsSchema = object({
18384
+ trackId: string(),
18385
+ markForTrain: boolean(),
18386
+ debug: boolean(),
18387
+ favourited: boolean(),
18388
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
18389
+ * a track row) because this shape is only ever produced by the write body,
18390
+ * which always knows it — and a surface that has just written needs to render
18391
+ * `trained` without a re-fetch. */
18392
+ retrainStatus: RetrainStatusSchema
18558
18393
  });
18559
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
18560
- deviceId: number(),
18561
- trackId: string()
18562
- }), TrackSchema.nullable()), method(object({
18563
- deviceId: number(),
18564
- since: number().optional(),
18565
- until: number().optional(),
18566
- limit: number().optional(),
18567
- /** Spatial filter only tracks whose trajectory intersects the zone
18568
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
18569
- * envelope columns, then precisely tested per position. Tracks with
18570
- * an unknown envelope (no frame dims at persist time) always match. */
18571
- zone: TrackZoneFilterSchema.optional(),
18572
- /** See {@link TrackProjectionSchema}. Default `full` (backward
18573
- * compatible — omitting the field keeps today's exact behaviour). */
18574
- projection: TrackProjectionSchema.optional(),
18575
- /** Include stationary-promoted rows (parked objects handed to the
18576
- * stationary registry). Default false: the timeline lists passages,
18577
- * not parking records (operator decision, 2026-08-15). */
18578
- includeStationary: boolean().optional()
18579
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
18580
- deviceId: number(),
18581
- groupId: string().min(1)
18582
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
18583
- kind: "mutation",
18584
- auth: "admin"
18585
- }), 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({
18586
- deviceId: number(),
18587
- since: number().optional(),
18588
- until: number().optional(),
18589
- kinds: array(string()).optional(),
18590
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
18591
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18592
- deviceId: number(),
18593
- since: number(),
18594
- until: number(),
18595
- bucketMs: number().int().positive()
18596
- }), array(object({
18597
- bucketStart: number(),
18598
- motion: number().int(),
18599
- object: number().int(),
18600
- audio: number().int()
18601
- })).readonly()), method(object({
18602
- deviceId: number(),
18603
- cutoffMs: number()
18604
- }), object({
18605
- motion: number().int(),
18606
- object: number().int(),
18607
- audio: number().int()
18608
- }), {
18609
- kind: "mutation",
18610
- auth: "admin"
18611
- }), method(object({
18612
- deviceId: number(),
18613
- cutoffMs: number()
18614
- }), TrackCascadeCountsSchema, {
18615
- kind: "mutation",
18616
- auth: "admin"
18617
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18618
- kind: "mutation",
18619
- auth: "admin"
18620
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18621
- kind: "mutation",
18622
- auth: "admin"
18623
- }), method(object({
18624
- deviceId: number(),
18625
- trackIds: array(string()).min(1)
18626
- }), object({
18627
- deleted: number().int(),
18628
- failed: array(string()).readonly()
18629
- }), {
18630
- kind: "mutation",
18631
- auth: "admin"
18632
- }), method(object({
18633
- /** Log/audit scope only — the trackId is globally unique on its own. */
18394
+ union([literal(1), literal(2)]);
18395
+ /**
18396
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
18397
+ * the step and model that produced it — which is what makes the write rule
18398
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
18399
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
18400
+ *
18401
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
18402
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
18403
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
18404
+ * that value has no provenance, and the write rule lets ANY properly-attributed
18405
+ * write of the same tier replace it regardless of score.
18406
+ */
18407
+ var LabelAttributionSchema = object({
18408
+ stepId: string(),
18409
+ modelId: string().optional(),
18410
+ decidedAt: number(),
18411
+ /**
18412
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
18413
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
18414
+ *
18415
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
18416
+ * notification rule authored on "Gianluca" stopped matching the moment the
18417
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
18418
+ * the thing that does not move, so it is what a rule matches on
18419
+ * (`NcConditions.identities`) and the text is what a human is shown.
18420
+ *
18421
+ * Absent when the label names no gallery row — a plate the OCR read but no
18422
+ * vehicle claims, a sub-class, a species, any tier-1 value.
18423
+ */
18424
+ identityId: string().optional()
18425
+ });
18426
+ /**
18427
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
18428
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
18429
+ * track and its events always answer the same question the same way.
18430
+ *
18431
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
18432
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
18433
+ * is tier 2, and each carries its own score + attribution.
18434
+ *
18435
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
18436
+ * finest thing known. Before 4g the single `label` column held the finest
18437
+ * value, so a consumer that has not been updated reads the tier-1 slot and
18438
+ * shows nothing on a species-only row; that is why the migration puts every
18439
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
18440
+ * and why the read surfaces were changed in the same train.
18441
+ *
18442
+ * **Writing it.** The slots are independent, which is the whole point: a
18443
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
18444
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
18445
+ * higher score wins. One rule, one implementation — see
18446
+ * `pipeline/label-tier.ts` in addon-post-analysis.
18447
+ */
18448
+ var TieredLabelFields = {
18449
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
18450
+ label: string().optional(),
18451
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
18452
+ labelScore: number().optional(),
18453
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
18454
+ labelMeta: LabelAttributionSchema.optional(),
18455
+ /** Tier 2 the instance. See {@link LabelTierSchema}. */
18456
+ subLabel: string().optional(),
18457
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
18458
+ subLabelScore: number().optional(),
18459
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
18460
+ subLabelMeta: LabelAttributionSchema.optional()
18461
+ };
18462
+ /** Per-camera slice of a training-export estimate. */
18463
+ var TrainingExportDeviceTotalsSchema = object({
18634
18464
  deviceId: number(),
18465
+ tracks: number().int(),
18466
+ files: number().int(),
18467
+ bytes: number().int()
18468
+ });
18469
+ /**
18470
+ * What a training export WOULD contain. Computed from media index rows only —
18471
+ * no blob is read to produce this.
18472
+ */
18473
+ var TrainingExportSummarySchema = object({
18474
+ generatedAt: number(),
18475
+ trackCount: number().int(),
18476
+ fileCount: number().int(),
18477
+ byteCount: number().int(),
18478
+ /** More marked tracks exist than a single pass carries. */
18479
+ truncated: boolean(),
18480
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
18481
+ });
18482
+ var TrackSchema = object({
18635
18483
  trackId: string(),
18636
- flags: TrackFlagsPatchSchema
18637
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18638
- kind: "query",
18639
- auth: "admin"
18640
- }), method(object({
18641
- olderThanMs: number(),
18642
- reason: OpsLogReasonSchema.optional()
18643
- }), EventPruneCountsSchema, {
18644
- kind: "mutation",
18645
- auth: "admin"
18646
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
18647
- kind: "mutation",
18648
- auth: "admin"
18649
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18650
- kind: "mutation",
18651
- auth: "admin"
18652
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18653
- kind: "mutation",
18654
- auth: "admin"
18655
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
18656
- kind: "mutation",
18657
- auth: "admin"
18658
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
18659
- kind: "mutation",
18660
- auth: "admin"
18661
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18662
- kind: "mutation",
18663
- auth: "admin"
18664
- }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18665
- kind: "mutation",
18666
- auth: "admin"
18667
- }), method(object({}), array(RelocateJobSchema).readonly(), {
18668
- kind: "query",
18669
- auth: "admin"
18670
- }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18671
- kind: "mutation",
18672
- auth: "admin"
18673
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
18674
- kind: "query",
18675
- auth: "admin"
18676
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
18677
- kind: "query",
18678
- auth: "admin"
18679
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18680
- kind: "query",
18681
- auth: "admin"
18682
- }), method(object({
18683
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
18684
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
18685
- * route it at one camera's owner, and "every camera" would stop being
18686
- * expressible at all. */
18687
- deviceIds: array(number()).optional(),
18688
- limit: number().int().min(1).max(500).optional()
18689
- }), array(RetrainTrackSchema).readonly(), {
18690
- kind: "query",
18691
- auth: "admin"
18692
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
18693
- kind: "query",
18694
- auth: "admin"
18695
- }), method(object({
18696
18484
  deviceId: number(),
18697
- trackId: string(),
18698
- mediaKeys: array(string()).min(1)
18699
- }), RetrainFrameSelectionSchema, {
18700
- kind: "mutation",
18701
- auth: "admin"
18702
- }), method(object({
18485
+ className: string(),
18486
+ ...TieredLabelFields,
18487
+ producingDeviceName: string().optional(),
18488
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
18489
+ source: TrackSourceSchema.optional(),
18490
+ firstSeen: number(),
18491
+ lastSeen: number(),
18492
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
18493
+ positions: array(TrackPositionSchema).readonly(),
18494
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18495
+ * saveThumbnails policy). */
18496
+ snapshots: array(TrackSnapshotSchema).readonly(),
18497
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
18498
+ zonesVisited: array(string()).readonly(),
18499
+ /**
18500
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
18501
+ * `zones` capability.
18502
+ *
18503
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
18504
+ * and no card can render — so every free-text search surface was structurally
18505
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
18506
+ * just returned nothing. Resolving here rather than in each client keeps ONE
18507
+ * derivation and costs the clients no extra call (the `zones` cap is
18508
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
18509
+ * surface built to avoid exactly that).
18510
+ *
18511
+ * Resolved, never invented: a zone deleted since the track was written has no
18512
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
18513
+ * two are not positionally aligned. Absent when the track visited no zone, or
18514
+ * when the zone catalogue could not be read.
18515
+ */
18516
+ zoneNames: array(string()).readonly().optional(),
18517
+ /** Deduplicated set of detector classes observed for this track over its
18518
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
18519
+ * legacy rows written before class accumulation shipped. */
18520
+ classes: array(string()).readonly().optional(),
18521
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
18522
+ totalDistance: number(),
18523
+ state: TrackStateSchema,
18524
+ active: boolean(),
18525
+ /** Deterministic key-event importance score in [0,1] (server-computed at
18526
+ * track expiry, recomputed on late label). Absent on legacy rows written
18527
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
18528
+ importance: number().optional(),
18529
+ /** Id of the track's highest-confidence ObjectEvent (its representative
18530
+ * "best" frame). Absent when the track produced no object events. */
18531
+ bestEventId: string().optional(),
18532
+ /** Tag of the importance sub-signal that dominated the score
18533
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
18534
+ importanceReason: string().optional(),
18535
+ /** Audio-classification labels heard on the camera during the track's
18536
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
18537
+ * Absent on legacy rows / tracks with no confident audio. */
18538
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
18539
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
18540
+ * Populated from the persisted envelope columns on historical reads;
18541
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
18542
+ envelope: TrackEnvelopeSchema.optional(),
18543
+ /**
18544
+ * A face DETECTOR found a face on this track — nothing more. It says the
18545
+ * detail plane produced a `face` detail; it does NOT say the face was
18546
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
18547
+ * enabled. Set once and never cleared.
18548
+ *
18549
+ * **This exists so "face present but not recognised" is expressible.** A
18550
+ * recognised identity lands in `subLabel` (attributed to the face chain via
18551
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
18552
+ * and a track with no face at all were byte-identical on the wire and no
18553
+ * surface could tell them apart. The read is `hasFace === true && subLabel
18554
+ * === undefined`.
18555
+ *
18556
+ * **Absent ≠ false.** Every row written before the column existed omits it,
18557
+ * and so does every server that predates the field — a consumer must test
18558
+ * `=== true` and render nothing otherwise, never infer "no face".
18559
+ */
18560
+ hasFace: boolean().optional(),
18561
+ /**
18562
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
18563
+ * face an operator could ASSIGN to an identity.
18564
+ *
18565
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
18566
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
18567
+ * branch, before every gate, and means no more than "a face detector produced
18568
+ * a face detail". This one is stamped at the single moment the gallery row
18569
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
18570
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
18571
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
18572
+ * the crop-store drop. Everything between the detector and that insert can
18573
+ * legitimately refuse the face, so a flag written any earlier promises the
18574
+ * operator something to assign and delivers nothing.
18575
+ *
18576
+ * **Independent of recognition.** A face collected but never auto-matched is
18577
+ * still assignable — it is in fact the face an operator most wants to reach —
18578
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
18579
+ * `subLabel`; this says only that the raw material exists.
18580
+ *
18581
+ * **Set once, never cleared.** A track that produced a gallery row produced
18582
+ * one; deleting the row later is the gallery's business, not this flag's.
18583
+ *
18584
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
18585
+ * before the column omits it, and so does every server that predates the
18586
+ * field. A consumer must test `=== true` and render nothing otherwise —
18587
+ * never infer "no assignable face".
18588
+ */
18589
+ hasEmbeddedFace: boolean().optional(),
18590
+ /**
18591
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
18592
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
18593
+ * so the passage is tracked once and as a VEHICLE.
18594
+ *
18595
+ * It exists because the fold's record was dishonest. D34 and the code both
18596
+ * said "the person is not lost — it is reported so both entities stay on the
18597
+ * record"; in fact the pair went into a per-processor RAM field behind an
18598
+ * accessor nobody called, and every durable surface said `vehicle`, full
18599
+ * stop. This is the composition note that makes the row true.
18600
+ *
18601
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
18602
+ * person" is not an answer to "what is this" — both label tiers would refuse
18603
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
18604
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
18605
+ * and a `person` rule still does not fire for someone cycling past.
18606
+ *
18607
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
18608
+ * the column, and every hub that predates the field, omits it. Test
18609
+ * `=== true` and render nothing otherwise — never infer "no rider".
18610
+ */
18611
+ hasRider: boolean().optional(),
18612
+ ...TrackFlagFields,
18613
+ ...TrackRetrainFields
18614
+ });
18615
+ var BaseEventFields = {
18616
+ id: string(),
18703
18617
  deviceId: number(),
18704
- trackId: string(),
18705
- frameId: string()
18706
- }), object({
18707
- removed: boolean(),
18708
- removedAnnotations: number().int()
18709
- }), {
18710
- kind: "mutation",
18711
- auth: "admin"
18712
- }), method(object({ frameId: string() }), object({
18618
+ timestamp: number()
18619
+ };
18620
+ var MotionEventSchema = object({
18621
+ ...BaseEventFields,
18622
+ kind: literal("motion"),
18623
+ regionCount: number(),
18624
+ /** Heavy JSON array — omitted in slim projection. */
18625
+ regions: array(object({
18626
+ bbox: BoundingBoxSchema,
18627
+ pixelCount: number(),
18628
+ intensity: number()
18629
+ })).readonly().optional(),
18630
+ /** Omitted in slim projection. */
18631
+ frameWidth: number().optional(),
18632
+ /** Omitted in slim projection. */
18633
+ frameHeight: number().optional(),
18634
+ /** Populated by B5 (recording playback URL for this event). */
18635
+ mediaUrl: string().optional()
18636
+ });
18637
+ /**
18638
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
18639
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
18640
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
18641
+ * tracking, per-kind persistence) but stay distinguishable so consumers
18642
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
18643
+ * Absent on legacy rows ⇒ treat as `pipeline`.
18644
+ */
18645
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
18646
+ /**
18647
+ * The confirmed zone crossing that produced an object event. Present ONLY on
18648
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
18649
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
18650
+ * appearance event carry none, so a rule asking for a direction fails closed
18651
+ * on them.
18652
+ *
18653
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
18654
+ * into its own event, so a frame in which a track enters A while leaving B
18655
+ * produces two events with two directions — never one ambiguous row.
18656
+ *
18657
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
18658
+ * membership the box has NOW, and by definition it no longer contains the zone
18659
+ * that was just left. Without the id here, a zone-scoped rule could never match
18660
+ * the exit it asked for.
18661
+ */
18662
+ var ZoneCrossingSchema = object({
18663
+ direction: _enum(["enter", "exit"]),
18664
+ /** Admin zone id crossed. */
18665
+ zoneId: string(),
18666
+ /** Zone display name at crossing time (falls back to the id). */
18667
+ zoneName: string().optional()
18668
+ });
18669
+ var ObjectEventSchema = object({
18670
+ ...BaseEventFields,
18671
+ kind: literal("object"),
18672
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
18673
+ source: DetectionSourceSchema.optional(),
18674
+ /**
18675
+ * Inference-frame id shared by every object event emitted from the SAME frame
18676
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
18677
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
18678
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
18679
+ * Optional for backward-compat with pre-existing rows / the slim projection
18680
+ * includes it (it is light). Absent on rows written before this field.
18681
+ */
18682
+ frameId: string().optional(),
18683
+ /** Omitted in slim projection. */
18684
+ trackId: string().optional(),
18685
+ className: string(),
18686
+ ...TieredLabelFields,
18687
+ /** Omitted in slim projection. */
18688
+ confidence: number().optional(),
18689
+ /** Heavy JSON — omitted in slim projection. */
18690
+ bbox: BoundingBoxSchema.optional(),
18691
+ /** Heavy JSON — omitted in slim projection. */
18692
+ zones: array(string()).readonly().optional(),
18693
+ /** Omitted in slim projection. */
18694
+ state: TrackStateSchema.optional(),
18695
+ /**
18696
+ * The zone crossing this event IS, when it is one. Absent on every other
18697
+ * event kind (movement state, appearance, package) — see
18698
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
18699
+ */
18700
+ zoneCrossing: ZoneCrossingSchema.optional(),
18701
+ /** Detection-frame dimensions in pixels — let consumers normalize the
18702
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
18703
+ frameWidth: number().optional(),
18704
+ frameHeight: number().optional(),
18705
+ /** MediaStore key for the crop attached to this event (if any). */
18706
+ mediaKey: string().optional(),
18707
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
18708
+ * best-detection full frame). Resolve via the event-media data-plane
18709
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
18710
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
18711
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
18712
+ keyFrameMediaKey: string().optional(),
18713
+ /** Populated by B5 (recording playback URL for this event). */
18714
+ mediaUrl: string().optional(),
18715
+ /** The parent track's key-event importance [0,1], propagated to every object
18716
+ * event of the track (so an event row can be sorted by importance without a
18717
+ * track join). Absent on legacy rows / before the track was scored. */
18718
+ importance: number().optional()
18719
+ });
18720
+ var AudioEventSchema = object({
18721
+ ...BaseEventFields,
18722
+ kind: literal("audio"),
18723
+ rms: number(),
18724
+ dbfs: number(),
18725
+ classification: object({
18726
+ className: string(),
18727
+ originalClass: string().optional(),
18728
+ score: number()
18729
+ }).optional(),
18730
+ /** Populated by B5 (recording playback URL for this event). */
18731
+ mediaUrl: string().optional()
18732
+ });
18733
+ var MediaFileKindEnum = _enum([
18734
+ "crop",
18735
+ "thumbnail",
18736
+ "snapshot",
18737
+ "firstFrame",
18738
+ "lastFrame",
18739
+ "fullFrame",
18740
+ "fullFrameBoxed",
18741
+ "faceCrop",
18742
+ "plateCrop",
18743
+ "keyFrame",
18744
+ "keyFrameSmall",
18745
+ "thumbnailSmall"
18746
+ ]);
18747
+ var MediaFileSchema = object({
18748
+ key: string(),
18749
+ kind: MediaFileKindEnum,
18713
18750
  base64: string(),
18714
- width: number().int(),
18715
- height: number().int()
18716
- }), {
18717
- kind: "query",
18718
- auth: "admin"
18719
- }), method(object({
18720
- deviceId: number(),
18721
- trackId: string(),
18722
- frameId: string(),
18723
- subject: RetrainAssistSubjectSchema,
18724
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18725
- nodeId: string().optional()
18726
- }), RetrainAssistResultSchema, {
18727
- kind: "mutation",
18728
- auth: "admin"
18729
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
18730
- kind: "query",
18731
- auth: "admin"
18732
- }), method(object({
18733
- deviceId: number(),
18734
- trackId: string(),
18735
- frameId: string(),
18736
- annotations: array(RetrainAnnotationDraftSchema)
18737
- }), array(RetrainAnnotationSchema).readonly(), {
18738
- kind: "mutation",
18739
- auth: "admin"
18740
- }), method(object({
18741
- deviceId: number(),
18742
- trackId: string()
18743
- }), RetrainTransitionResultSchema, {
18744
- kind: "mutation",
18745
- auth: "admin"
18746
- }), method(object({
18747
- deviceId: number(),
18748
- trackId: string()
18749
- }), RetrainTransitionResultSchema, {
18750
- kind: "mutation",
18751
- auth: "admin"
18752
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18753
- kind: "query",
18754
- auth: "admin"
18755
- }), method(object({
18756
- eventId: string(),
18757
- kind: MediaFileKindEnum.optional(),
18758
- deviceId: number()
18759
- }), array(MediaFileSchema).readonly()), method(object({
18760
- trackId: string(),
18761
- kinds: array(MediaFileKindEnum).optional(),
18762
- deviceId: number()
18763
- }), array(MediaFileSchema).readonly()), method(object({
18751
+ sizeBytes: number(),
18752
+ timestamp: number()
18753
+ });
18754
+ /**
18755
+ * One media row WITHOUT its bytes.
18756
+ *
18757
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
18758
+ * 140 s track), and a client that renders tiles from the media data plane needs
18759
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
18760
+ * with an immutable cache, instead of all at once inside a tRPC response that
18761
+ * blocks the whole view.
18762
+ *
18763
+ * `sizeBytes` is carried because it is what lets a client decide between the
18764
+ * stored blob and a `?variant=thumb` rendering without fetching either.
18765
+ */
18766
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18767
+ /**
18768
+ * The MACRO tier of an annotation — a CLOSED set.
18769
+ *
18770
+ * This is what the exported detector predicts, so a typo here is a new class
18771
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
18772
+ * the whole point of the page is teaching the model things it does not know
18773
+ * yet, and constraining that vocabulary would make it useless.
18774
+ *
18775
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
18776
+ * `subLabel` is one of these values, in any casing, because once `person`
18777
+ * exists in both tiers "every person box" stops being answerable without
18778
+ * knowing every string anyone ever typed — and the damage is retroactive.
18779
+ */
18780
+ var RetrainMacroClassSchema = _enum([
18781
+ "person",
18782
+ "vehicle",
18783
+ "animal",
18784
+ "package",
18785
+ "face",
18786
+ "plate"
18787
+ ]);
18788
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
18789
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
18790
+ /** Did a human draw this box, or did the assist propose it? */
18791
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
18792
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
18793
+ var RetrainBboxSchema = object({
18794
+ x: number(),
18795
+ y: number(),
18796
+ w: number(),
18797
+ h: number()
18798
+ });
18799
+ /**
18800
+ * One annotated subject.
18801
+ *
18802
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
18803
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
18804
+ * derived from it at export and never stored — storing them is how one feature
18805
+ * space ends up holding two crops of the same subject (D52).
18806
+ */
18807
+ var RetrainAnnotationSchema = object({
18808
+ id: string(),
18764
18809
  trackId: string(),
18765
- deviceId: number()
18766
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18767
- kind: "mutation",
18768
- auth: "admin"
18769
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18770
- kind: "mutation",
18771
- auth: "admin"
18772
- }), method(object({}), RebuildStatusSchema), object({
18773
- deviceId: number(),
18774
- timestamp: number(),
18775
- frameWidth: number(),
18776
- frameHeight: number(),
18777
- detections: array(OverlayDetectionSchema).readonly()
18778
- }), object({
18779
18810
  deviceId: number(),
18811
+ /** The COPY in retrain storage — never the source track's media key. */
18812
+ mediaKey: string(),
18813
+ bbox: RetrainBboxSchema,
18814
+ macroClass: RetrainMacroClassSchema,
18815
+ label: string().optional(),
18816
+ subLabel: string().optional(),
18817
+ kind: RetrainAnnotationKindSchema,
18818
+ source: RetrainAnnotationSourceSchema,
18819
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
18820
+ assistModelId: string().optional(),
18821
+ assistScore: number().optional(),
18822
+ exportedInBatch: string().optional(),
18823
+ createdAt: number()
18824
+ });
18825
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
18826
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
18827
+ id: true,
18828
+ trackId: true,
18829
+ deviceId: true,
18830
+ mediaKey: true,
18831
+ createdAt: true,
18832
+ exportedInBatch: true
18833
+ });
18834
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
18835
+ var RetrainTrackSchema = object({
18780
18836
  trackId: string(),
18781
- className: string()
18782
- }), object({
18783
18837
  deviceId: number(),
18784
- trackId: string(),
18785
18838
  className: string(),
18786
- durationMs: number()
18787
- }), object({
18839
+ label: string().optional(),
18840
+ firstSeen: number(),
18841
+ lastSeen: number(),
18842
+ /** How many frames the dataset already holds from this track. */
18843
+ frameCount: number().int(),
18844
+ /** How many subjects have been annotated on those frames. `0` with
18845
+ * `frameCount: 0` is exactly "staging, still to work". */
18846
+ annotationCount: number().int()
18847
+ });
18848
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
18849
+ var RetrainFrameCandidateSchema = object({
18850
+ mediaKey: string(),
18851
+ kind: MediaFileKindEnum,
18852
+ timestamp: number(),
18853
+ sizeBytes: number().int(),
18854
+ /** A copy of this original already exists — selecting it is free and cannot
18855
+ * fail, whatever became of the original. */
18856
+ copied: boolean()
18857
+ });
18858
+ /** A frame the dataset OWNS: bytes copied at selection time. */
18859
+ var RetrainFrameSchema = object({
18860
+ frameId: string(),
18788
18861
  deviceId: number(),
18789
- kind: EventKindSchema,
18790
- eventId: string(),
18791
- timestamp: number()
18862
+ trackId: string(),
18863
+ /** Provenance only. It may already point at nothing — that is expected. */
18864
+ sourceMediaKey: string(),
18865
+ sourceKind: MediaFileKindEnum,
18866
+ sizeBytes: number().int(),
18867
+ width: number().int(),
18868
+ height: number().int(),
18869
+ copiedAt: number()
18792
18870
  });
18793
- /**
18794
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
18795
- * within the frame, so the executor can re-cut a leaf child ROI at native
18796
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
18797
- */
18798
- var NativeCropRefSchema = object({
18799
- /** Handle keying the retained native surface (node-pinned to its owner). */
18800
- handle: FrameHandleSchema,
18801
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
18802
- cropFrameSpace: object({
18803
- x: number(),
18804
- y: number(),
18805
- w: number(),
18806
- h: number()
18807
- })
18871
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
18872
+ var RetrainCopyRefusalSchema = _enum([
18873
+ "source-missing",
18874
+ "unreadable-image",
18875
+ "write-failed"
18876
+ ]);
18877
+ var RetrainFrameSelectionSchema = object({
18878
+ copied: array(RetrainFrameSchema).readonly(),
18879
+ refused: array(object({
18880
+ sourceMediaKey: string(),
18881
+ reason: RetrainCopyRefusalSchema
18882
+ })).readonly()
18808
18883
  });
18809
- object({
18810
- crop: object({
18811
- left: number(),
18812
- top: number(),
18813
- width: number().positive(),
18814
- height: number().positive()
18815
- }).optional(),
18816
- content: object({
18817
- width: number().int().positive(),
18818
- height: number().int().positive()
18819
- }),
18820
- fit: _enum(["stretch", "contain"]),
18821
- format: _enum([
18822
- "rgb",
18823
- "gray",
18824
- "jpeg"
18825
- ])
18884
+ var RetrainFrameListSchema = object({
18885
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
18886
+ copies: array(RetrainFrameSchema).readonly(),
18887
+ /** What the page pre-selects — the native key frame when one survives. */
18888
+ autoPickMediaKey: string().optional()
18826
18889
  });
18890
+ /** What the operator asked the assist to look for. */
18891
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
18892
+ kind: literal("package"),
18893
+ zone: RetrainBboxSchema.optional()
18894
+ }), object({
18895
+ kind: literal("objects"),
18896
+ modelId: string(),
18897
+ minScore: number().optional()
18898
+ })]);
18827
18899
  /**
18828
- * Process-local frame identity. It is serializable so it can ride an in-process
18829
- * capability call, but `registryId` deliberately prevents resolution in any
18830
- * other process or execution group.
18900
+ * The assist's answer a discriminated union, because "the model saw nothing"
18901
+ * and "this node cannot run that model" lead to different next moves and a
18902
+ * nullable result cannot tell them apart.
18831
18903
  */
18832
- var FrameRefSchema = object({
18833
- registryId: string().min(1),
18834
- id: string().min(1),
18835
- width: number().int().positive(),
18836
- height: number().int().positive(),
18837
- format: _enum(["rgb", "gray"]),
18838
- timestamp: number(),
18839
- capturedAt: number().optional()
18904
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
18905
+ kind: literal("proposed"),
18906
+ modelId: string(),
18907
+ stepId: string(),
18908
+ minScore: number(),
18909
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
18910
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
18911
+ /** Returned by the runner but removed by the threshold. */
18912
+ belowThreshold: number().int()
18913
+ }), object({
18914
+ kind: literal("refused"),
18915
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
18916
+ reason: string(),
18917
+ detail: string().optional()
18918
+ })]);
18919
+ /** The outcome of a lifecycle move owned by the retrain page. */
18920
+ var RetrainTransitionResultSchema = object({
18921
+ trackId: string(),
18922
+ /** Where the track ended up, whatever happened. */
18923
+ retrainStatus: RetrainStatusSchema,
18924
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
18925
+ changed: boolean(),
18926
+ reason: _enum([
18927
+ "unknown-track",
18928
+ "no-frames-copied",
18929
+ "not-staging",
18930
+ "not-trained",
18931
+ "unchanged"
18932
+ ]).optional()
18840
18933
  });
18841
- var ModelFormatSchema$1 = _enum([
18842
- "onnx",
18843
- "coreml",
18844
- "openvino",
18845
- "tflite",
18846
- "pt",
18847
- "gguf"
18848
- ]);
18849
- var PipelineSlotSchema = _enum([
18850
- "detector",
18851
- "cropper",
18852
- "classifier",
18853
- "refiner",
18854
- "audio-classifier"
18855
- ]);
18856
- var PipelineEngineChoiceSchema = object({
18857
- runtime: _enum(["node", "python"]),
18858
- backend: string(),
18859
- format: ModelFormatSchema$1,
18860
- device: string().optional()
18934
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
18935
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
18936
+ var DeviceEventQueryInput = object({
18937
+ deviceId: number(),
18938
+ since: number().optional(),
18939
+ until: number().optional(),
18940
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
18941
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
18942
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
18943
+ * exact behaviour. Callers may omit this field — the store defaults to
18944
+ * `full` when not provided. */
18945
+ projection: _enum(["full", "slim"]).optional()
18861
18946
  });
18862
- var AvailableEngineSchema = object({
18863
- engine: PipelineEngineChoiceSchema,
18864
- devices: array(object({
18865
- id: string(),
18866
- label: string(),
18867
- description: string().optional()
18868
- })).readonly(),
18869
- defaultDevice: string()
18947
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
18948
+ var RecentTracksQueryInput = object({
18949
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
18950
+ deviceIds: array(number()),
18951
+ /** Window lower bound on `lastSeen` (inclusive). */
18952
+ since: number().optional(),
18953
+ /** Window upper bound on `lastSeen` (inclusive). */
18954
+ until: number().optional(),
18955
+ /** Page size. Default 200, max 1000. */
18956
+ limit: number().int().min(1).max(1e3).default(200),
18957
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
18958
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
18959
+ cursor: string().optional(),
18960
+ /** See {@link TrackProjectionSchema}. Default `full`. */
18961
+ projection: TrackProjectionSchema.optional(),
18962
+ /** Include stationary-promoted rows (parked objects). Default false: the
18963
+ * feed lists passages; parking records live on the stationary registry. */
18964
+ includeStationary: boolean().optional()
18965
+ });
18966
+ var RecentTracksPageSchema = object({
18967
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
18968
+ tracks: array(TrackSchema).readonly(),
18969
+ /** Cursor for the next page, or null when this page is the last. */
18970
+ nextCursor: string().nullable()
18870
18971
  });
18871
- var PipelineDefaultStepSchema = lazy(() => object({
18872
- addonId: string(),
18873
- addonName: string(),
18874
- slot: PipelineSlotSchema,
18875
- inputClasses: array(string()).readonly(),
18876
- outputClasses: array(string()).readonly(),
18877
- enabled: boolean(),
18878
- modelId: string(),
18879
- children: array(PipelineDefaultStepSchema).readonly(),
18880
- group: string().optional(),
18881
- settings: record(string(), unknown()).optional()
18882
- }));
18883
- var PipelineTemplateStepSchema = lazy(() => object({
18884
- addonId: string(),
18885
- enabled: boolean(),
18886
- modelId: string(),
18887
- children: array(PipelineTemplateStepSchema).readonly(),
18888
- settings: record(string(), unknown()).optional()
18889
- }));
18890
- var PipelineTemplateSchema$1 = object({
18972
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
18973
+ var LIST_GROUPS_MAX_LIMIT = 100;
18974
+ var AnalyticsGroupRecordSchema = object({
18891
18975
  id: string(),
18892
- name: string(),
18893
- createdAt: string(),
18894
- updatedAt: string(),
18895
- engine: PipelineEngineChoiceSchema,
18896
- steps: array(PipelineTemplateStepSchema).readonly()
18976
+ deviceId: number().int(),
18977
+ openedAt: number().int(),
18978
+ closedAt: number().int(),
18979
+ timestamp: number().int(),
18980
+ memberCount: number().int(),
18981
+ memberTrackIds: array(string()).readonly(),
18982
+ className: string(),
18983
+ classes: array(string()).readonly(),
18984
+ /** Relative event-media path, or null when the group has no picture yet. */
18985
+ mediaUrl: string().nullable(),
18986
+ singleton: boolean()
18897
18987
  });
18898
- var PipelineModelOptionSchema = object({
18899
- id: string(),
18900
- name: string(),
18901
- formats: record(string(), object({
18902
- downloaded: boolean(),
18903
- sizeMB: number()
18904
- })),
18905
- group: ModelVariantGroupSchema.optional(),
18906
- legacy: boolean().optional(),
18907
- provider: ModelProviderIdSchema.optional()
18988
+ var AnalyticsGroupMemberSchema = object({
18989
+ trackId: string(),
18990
+ deviceId: number().int(),
18991
+ className: string(),
18992
+ firstSeen: number().int(),
18993
+ lastSeen: number().int(),
18994
+ mediaUrl: string().nullable()
18908
18995
  });
18909
- var ConfigFieldBridge = custom();
18910
- var PipelineAddonSchemaSchema = object({
18911
- id: string(),
18912
- name: string(),
18913
- slot: PipelineSlotSchema,
18914
- inputClasses: array(string()).readonly(),
18915
- outputClasses: array(string()).readonly(),
18916
- childSlots: array(PipelineSlotSchema).readonly(),
18917
- models: array(PipelineModelOptionSchema).readonly(),
18918
- defaultModelId: string(),
18919
- defaultModelIdByFormat: record(string(), string()).optional(),
18920
- enabledByDefault: boolean().optional(),
18921
- backfillIntoExistingOverrides: boolean().optional(),
18922
- defaultConfidence: number(),
18923
- group: string().optional(),
18924
- configSchema: array(ConfigFieldBridge).readonly().optional()
18996
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
18997
+ var ListGroupsQueryInput = object({
18998
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
18999
+ deviceIds: array(number()),
19000
+ /** Window lower bound on `closedAt` (inclusive). */
19001
+ since: number().optional(),
19002
+ /** Window upper bound on `openedAt` (inclusive). */
19003
+ until: number().optional(),
19004
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
19005
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
19006
+ cursor: string().optional()
18925
19007
  });
18926
- var PipelineSlotSchemaSchema = object({
18927
- id: PipelineSlotSchema,
18928
- label: string(),
18929
- priority: number(),
18930
- parentSlot: PipelineSlotSchema.nullable(),
18931
- addons: array(PipelineAddonSchemaSchema).readonly()
19008
+ var ListGroupsPageSchema = object({
19009
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
19010
+ nextCursor: string().nullable()
18932
19011
  });
18933
- var PipelineSchemaSchema = object({
18934
- availableEngines: array(AvailableEngineSchema).readonly(),
18935
- selectedEngine: PipelineEngineChoiceSchema,
18936
- slots: array(PipelineSlotSchemaSchema).readonly()
19012
+ var KeyEventQueryInput = object({
19013
+ deviceId: number(),
19014
+ /** Window lower bound (track firstSeen ≥ since). */
19015
+ since: number(),
19016
+ /** Window upper bound (track firstSeen ≤ until). */
19017
+ until: number(),
19018
+ limit: number().int().min(1).max(200).default(50),
19019
+ /** Drop tracks scoring below this importance. */
19020
+ minImportance: number().min(0).max(1).optional(),
19021
+ /** Restrict to a single class (e.g. 'person'). */
19022
+ classFilter: string().optional()
18937
19023
  });
18938
- var EngineProvisioningSchema = object({
18939
- runtimeId: _enum([
18940
- "onnx",
18941
- "openvino",
18942
- "coreml",
18943
- "edgetpu"
18944
- ]).nullable(),
18945
- device: string().nullable(),
18946
- state: _enum([
18947
- "idle",
18948
- "installing",
18949
- "verifying",
18950
- "ready",
18951
- "failed"
18952
- ]),
18953
- progress: number().optional(),
18954
- error: string().optional(),
18955
- nextRetryAt: number().optional(),
18956
- /**
18957
- * Gate A (config-correctness gate at engine change): human-readable
18958
- * config issues surfaced EAGERLY when the node's engine changes — model
18959
- * substitutions ("chose X, running Y") and zero-build steps ("no model
18960
- * has a <format> build"). Additive/optional: informational only, never
18961
- * enforced here — `assertEngineReady` (readiness) still gates inference.
18962
- * Absent/empty when the node-default tree resolves cleanly.
18963
- */
18964
- configIssues: array(string()).optional()
19024
+ var KeyEventSchema = object({
19025
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
19026
+ id: string(),
19027
+ trackId: string(),
19028
+ /** Track start time (firstSeen). */
19029
+ timestamp: number(),
19030
+ className: string(),
19031
+ ...TieredLabelFields,
19032
+ importance: number(),
19033
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
19034
+ bestEventId: string(),
19035
+ /** Track lifetime in ms (lastSeen - firstSeen). */
19036
+ windowMs: number().optional(),
19037
+ ...TrackFlagFields,
19038
+ ...TrackRetrainFields
18965
19039
  });
18966
- var PipelineStepInputSchema = lazy(() => object({
18967
- addonId: string(),
18968
- modelId: string().optional(),
18969
- enabled: boolean().default(true),
18970
- children: array(PipelineStepInputSchema).optional(),
18971
- settings: record(string(), unknown()).optional(),
18972
- jumpDeviceKey: string().optional()
18973
- }));
18974
- var ModelSubstitutionSchema = object({
18975
- addonId: string(),
18976
- chosen: string(),
18977
- running: string(),
18978
- format: string()
19040
+ object({
19041
+ trackId: string(),
19042
+ className: string(),
19043
+ confidence: number(),
19044
+ bbox: BoundingBoxSchema,
19045
+ zones: array(string()).readonly(),
19046
+ state: TrackStateSchema
18979
19047
  });
18980
- var PipelineValidationIssueSchema = object({
18981
- addonId: string(),
18982
- kind: _enum(["unknown-addon", "no-format-build"]),
18983
- detail: string()
19048
+ var OverlayDetectionSchema = looseObject({
19049
+ id: string(),
19050
+ kind: _enum(["first-level", "detail"]),
19051
+ macroClass: string(),
19052
+ score: number(),
19053
+ bbox: object({
19054
+ x: number(),
19055
+ y: number(),
19056
+ width: number(),
19057
+ height: number()
19058
+ }),
19059
+ labels: array(looseObject({
19060
+ label: string(),
19061
+ score: number()
19062
+ })).readonly(),
19063
+ parentId: string().optional()
18984
19064
  });
18985
- var PipelineValidationResultSchema = object({
18986
- ok: boolean(),
18987
- issues: array(PipelineValidationIssueSchema).readonly(),
18988
- substitutions: array(ModelSubstitutionSchema).readonly(),
18989
- /** The node's `currentEngine.format` this validation ran against. */
18990
- format: string()
19065
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
19066
+ var SearchObjectEventsInput = object({
19067
+ text: string(),
19068
+ deviceId: number().optional(),
19069
+ since: number().optional(),
19070
+ until: number().optional(),
19071
+ classFilter: string().optional(),
19072
+ limit: number().default(50),
19073
+ minScore: number().min(0).max(1).default(.2)
18991
19074
  });
18992
- var ReferenceImageEntrySchema = object({
18993
- filename: string(),
18994
- stepIds: array(string()).readonly().optional()
19075
+ var TrackCascadeCountsSchema = object({
19076
+ /** Persisted track roots deleted (authoritative). */
19077
+ tracks: number().int(),
19078
+ /** Object events removed with their tracks (best-effort; see note above). */
19079
+ events: number().int(),
19080
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
19081
+ media: number().int(),
19082
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
19083
+ faces: number().int(),
19084
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
19085
+ plates: number().int(),
19086
+ /** Per-track CLIP search vectors removed (best-effort). */
19087
+ embeddings: number().int(),
19088
+ /** Group membership + group rows removed with their last member (best-effort). */
19089
+ groups: number().int()
18995
19090
  });
18996
- var ReferenceImageBodySchema = object({
18997
- base64: string(),
18998
- filename: string()
19091
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
19092
+ var DiskReconcileCountsSchema = object({
19093
+ mediaDropped: number().int(),
19094
+ tracks: number().int(),
19095
+ events: number().int()
18999
19096
  });
19000
- var ReferenceAudioEntrySchema = object({
19001
- filename: string(),
19002
- sizeKb: number()
19097
+ /** Event-store footprint for one camera. */
19098
+ var EventStoreDeviceFootprintSchema = object({
19099
+ deviceId: number(),
19100
+ /** Persisted event rows (motion + object + audio) for the camera. */
19101
+ rows: number().int(),
19102
+ /** Event-owned media bytes on disk for the camera. */
19103
+ bytes: number().int()
19104
+ });
19105
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
19106
+ var EventStoreFootprintSchema = object({
19107
+ totalRows: number().int(),
19108
+ totalBytes: number().int(),
19109
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
19110
+ });
19111
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
19112
+ var EventPruneCountsSchema = object({
19113
+ motion: number().int(),
19114
+ object: number().int(),
19115
+ audio: number().int()
19003
19116
  });
19004
- var ReferenceAudioBodySchema = object({ base64: string() });
19005
- var AudioBackendSchema = object({
19006
- id: string(),
19007
- name: string(),
19008
- description: string(),
19009
- available: boolean(),
19117
+ /**
19118
+ * Re-embed stored tracks from their key frames.
19119
+ *
19120
+ * The reason this is an operator-callable method and not a migration script:
19121
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
19122
+ * squaring — is only changeable if the existing vectors can be regenerated.
19123
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
19124
+ * symptom is a quality regression with no visible cause.
19125
+ */
19126
+ var RebuildObjectEmbeddingsInput = object({
19127
+ /** Restrict to one camera. Omit for the whole fleet. */
19128
+ deviceId: number().optional(),
19129
+ since: number().optional(),
19130
+ until: number().optional(),
19131
+ /** Stop after this many tracks; the result reports whether more remain. */
19132
+ maxTracks: number().int().positive().optional(),
19010
19133
  /**
19011
- * Raw classifier labels this backend can emit (e.g. YAMNet's
19012
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
19013
- * the benchmark UI to populate the `enabledMicroClasses` filter
19014
- * specific to the selected backend without a separate fetch.
19134
+ * Run every embedding on THIS node instead of round-robining the fleet.
19135
+ *
19136
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
19137
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
19138
+ * calling it that would pin the rebuild REQUEST itself to that node — the
19139
+ * rebuild orchestration lives on the hub, and only the per-track step runs
19140
+ * remotely. This field is data; the per-track pin is applied inside.
19141
+ *
19142
+ * Absent ⇒ round-robin over every online node whose runner can serve the
19143
+ * pinned model.
19015
19144
  */
19016
- rawLabels: array(string()).readonly().optional()
19017
- });
19018
- var AudioCapabilitiesSchema = object({
19019
- activeBackend: string(),
19020
- availableBackends: array(AudioBackendSchema).readonly(),
19021
- sampleRate: number(),
19022
- chunkDurationMs: number()
19023
- });
19024
- var DownloadModelResultSchema = object({
19025
- filePath: string(),
19026
- sizeMB: number(),
19027
- durationMs: number()
19145
+ executeOnNodeId: string().optional(),
19146
+ /**
19147
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
19148
+ * run flat out.
19149
+ *
19150
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
19151
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
19152
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
19153
+ * force is logged at start and finish so a deliberately slow pass reads
19154
+ * differently from a stalled one.
19155
+ */
19156
+ pacingMs: number().int().nonnegative().optional()
19028
19157
  });
19029
19158
  /**
19030
- * Wrapper carrying a single test run's result. Replaces the legacy
19031
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
19032
- * canonical `AudioResult` from the Phase 6 output rework: one
19033
- * `AudioDetection` per class above `minScore`, top-N candidates in
19034
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
19035
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
19036
- * benchmark UI can still report a clean failure when the classifier
19037
- * cap isn't available.
19159
+ * Result of emptying the CLIP index.
19160
+ *
19161
+ * The clean slate before a policy change: a new crop margin or encoder model
19162
+ * leaves two feature spaces in one index whose cosine scores are not
19163
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
19164
+ * means the same thing.
19038
19165
  */
19039
- var AudioTestResultSchema = object({
19040
- success: boolean(),
19041
- error: string().optional(),
19042
- frame: custom().optional()
19166
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
19167
+ /**
19168
+ * Acknowledgement that a rebuild STARTED.
19169
+ *
19170
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
19171
+ * runs detached and this returns immediately. Waiting for it made the client
19172
+ * time out while the work carried on server-side, which is the worst of both:
19173
+ * no result and no way to know it was still going. Poll
19174
+ * `getObjectEmbeddingRebuildStatus` for progress.
19175
+ */
19176
+ var RebuildObjectEmbeddingsResultSchema = object({
19177
+ started: boolean(),
19178
+ /** True when a pass was already running; the new request is ignored. */
19179
+ alreadyRunning: boolean()
19043
19180
  });
19044
- var PipelineConfigBridge = custom();
19045
- var ConfigUISchemaBridge = custom();
19046
- var ConfigUISchemaNullableBridge = custom();
19047
- var InferenceCapabilitiesBridge = custom();
19048
- var ModelAvailabilityListBridge = custom();
19049
- var PipelineRunResultBridge = custom();
19050
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
19051
- modelId: string(),
19052
- settings: record(string(), unknown()).readonly()
19053
- }))), method(object({ steps: record(string(), object({
19054
- modelId: string(),
19055
- settings: record(string(), unknown()).readonly()
19056
- })) }), object({ success: literal(true) }), {
19181
+ var RebuildStatusSchema = object({
19182
+ running: boolean(),
19183
+ scanned: number(),
19184
+ rebuilt: number(),
19185
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
19186
+ missingKeyFrame: number(),
19187
+ /** Tracks with no usable detection box. */
19188
+ missingBbox: number(),
19189
+ /**
19190
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
19191
+ * frame, a step that threw. Separate from `failed` because the remedy is
19192
+ * different, and because a whole camera silently contributing zero vectors
19193
+ * is the shape of failure a rebuild must never hide.
19194
+ */
19195
+ notRunnable: number(),
19196
+ /**
19197
+ * The pass stopped because NO node could serve the pinned model.
19198
+ *
19199
+ * Distinct from `notRunnable` on purpose: that one says "this track was
19200
+ * refused", this one says "the cluster cannot do this work at all" — every
19201
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
19202
+ * pinned model for its engine format, or dropped out. The remedy is a model /
19203
+ * engine change, not a per-camera one. Non-zero here always comes with
19204
+ * `complete: false`.
19205
+ */
19206
+ noCapableNode: number(),
19207
+ failed: number(),
19208
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
19209
+ complete: boolean().nullable(),
19210
+ startedAtMs: number().nullable(),
19211
+ finishedAtMs: number().nullable(),
19212
+ /** Present when the pass ended by throwing. */
19213
+ error: string().nullable()
19214
+ });
19215
+ var ReplayFrameInputSchema = object({
19216
+ timestamp: number(),
19217
+ frame: PipelineRunResultBridge
19218
+ });
19219
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
19220
+ className: string(),
19221
+ firstSeenMs: number(),
19222
+ lastSeenMs: number(),
19223
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
19224
+ * frame — a representative box for the diff's `(className, window, IoU)`
19225
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
19226
+ * trajectory production's `Track.positions` keeps. */
19227
+ bbox: BoundingBoxSchema,
19228
+ /** How many of the input frames this track matched a real detection on
19229
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
19230
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
19231
+ framesMatched: number().int()
19232
+ })).readonly() });
19233
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
19234
+ deviceId: number(),
19235
+ trackId: string()
19236
+ }), TrackSchema.nullable()), method(object({
19237
+ deviceId: number(),
19238
+ since: number().optional(),
19239
+ until: number().optional(),
19240
+ limit: number().optional(),
19241
+ /** Spatial filter — only tracks whose trajectory intersects the zone
19242
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
19243
+ * envelope columns, then precisely tested per position. Tracks with
19244
+ * an unknown envelope (no frame dims at persist time) always match. */
19245
+ zone: TrackZoneFilterSchema.optional(),
19246
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
19247
+ * compatible — omitting the field keeps today's exact behaviour). */
19248
+ projection: TrackProjectionSchema.optional(),
19249
+ /** Include stationary-promoted rows (parked objects handed to the
19250
+ * stationary registry). Default false: the timeline lists passages,
19251
+ * not parking records (operator decision, 2026-08-15). */
19252
+ includeStationary: boolean().optional()
19253
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
19254
+ deviceId: number(),
19255
+ groupId: string().min(1)
19256
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
19257
+ kind: "mutation",
19258
+ auth: "admin"
19259
+ }), 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({
19260
+ deviceId: number(),
19261
+ since: number().optional(),
19262
+ until: number().optional(),
19263
+ kinds: array(string()).optional(),
19264
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19265
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19266
+ deviceId: number(),
19267
+ since: number(),
19268
+ until: number(),
19269
+ bucketMs: number().int().positive()
19270
+ }), array(object({
19271
+ bucketStart: number(),
19272
+ motion: number().int(),
19273
+ object: number().int(),
19274
+ audio: number().int()
19275
+ })).readonly()), method(object({
19276
+ deviceId: number(),
19277
+ cutoffMs: number()
19278
+ }), object({
19279
+ motion: number().int(),
19280
+ object: number().int(),
19281
+ audio: number().int()
19282
+ }), {
19283
+ kind: "mutation",
19284
+ auth: "admin"
19285
+ }), method(object({
19286
+ deviceId: number(),
19287
+ cutoffMs: number()
19288
+ }), TrackCascadeCountsSchema, {
19289
+ kind: "mutation",
19290
+ auth: "admin"
19291
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
19292
+ kind: "mutation",
19293
+ auth: "admin"
19294
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
19295
+ kind: "mutation",
19296
+ auth: "admin"
19297
+ }), method(object({
19298
+ deviceId: number(),
19299
+ trackIds: array(string()).min(1)
19300
+ }), object({
19301
+ deleted: number().int(),
19302
+ failed: array(string()).readonly()
19303
+ }), {
19304
+ kind: "mutation",
19305
+ auth: "admin"
19306
+ }), method(object({
19307
+ /** Log/audit scope only — the trackId is globally unique on its own. */
19308
+ deviceId: number(),
19309
+ trackId: string(),
19310
+ flags: TrackFlagsPatchSchema
19311
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19312
+ kind: "query",
19313
+ auth: "admin"
19314
+ }), method(object({
19315
+ olderThanMs: number(),
19316
+ reason: OpsLogReasonSchema.optional()
19317
+ }), EventPruneCountsSchema, {
19318
+ kind: "mutation",
19319
+ auth: "admin"
19320
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
19321
+ kind: "mutation",
19322
+ auth: "admin"
19323
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19324
+ kind: "mutation",
19325
+ auth: "admin"
19326
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
19327
+ kind: "mutation",
19328
+ auth: "admin"
19329
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
19330
+ kind: "mutation",
19331
+ auth: "admin"
19332
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
19333
+ kind: "mutation",
19334
+ auth: "admin"
19335
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
19336
+ kind: "mutation",
19337
+ auth: "admin"
19338
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19339
+ kind: "mutation",
19340
+ auth: "admin"
19341
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19342
+ kind: "query",
19343
+ auth: "admin"
19344
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
19057
19345
  kind: "mutation",
19058
19346
  auth: "admin"
19059
- }), method(object({ nodeId: string() }), object({
19060
- success: literal(true),
19061
- clearedDevices: number()
19062
- }), {
19347
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
19348
+ kind: "query",
19349
+ auth: "admin"
19350
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
19351
+ kind: "query",
19352
+ auth: "admin"
19353
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
19354
+ kind: "query",
19355
+ auth: "admin"
19356
+ }), method(object({
19357
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
19358
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
19359
+ * route it at one camera's owner, and "every camera" would stop being
19360
+ * expressible at all. */
19361
+ deviceIds: array(number()).optional(),
19362
+ limit: number().int().min(1).max(500).optional()
19363
+ }), array(RetrainTrackSchema).readonly(), {
19364
+ kind: "query",
19365
+ auth: "admin"
19366
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
19367
+ kind: "query",
19368
+ auth: "admin"
19369
+ }), method(object({
19370
+ deviceId: number(),
19371
+ trackId: string(),
19372
+ mediaKeys: array(string()).min(1)
19373
+ }), RetrainFrameSelectionSchema, {
19063
19374
  kind: "mutation",
19064
19375
  auth: "admin"
19065
- }), 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({
19066
- name: string(),
19067
- steps: array(PipelineTemplateStepSchema).readonly(),
19068
- engine: PipelineEngineChoiceSchema
19069
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
19070
- id: string(),
19071
- name: string().optional(),
19072
- steps: array(PipelineTemplateStepSchema).readonly().optional()
19073
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
19074
- addonId: string(),
19075
- modelId: string(),
19076
- format: ModelFormatSchema$1
19077
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
19078
- addonId: string(),
19079
- modelId: string(),
19080
- format: ModelFormatSchema$1
19081
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
19082
- engine: PipelineEngineChoiceSchema.optional(),
19083
- steps: array(PipelineStepInputSchema).min(1),
19084
- frame: FrameInputSchema.optional(),
19085
- /**
19086
- * Process-local lazy frame. Valid only when caller and provider resolve
19087
- * in the same execution-group process; split/cross-node callers use
19088
- * `frame`/`image` inline compatibility instead.
19089
- */
19090
- frameRef: FrameRefSchema.optional(),
19091
- /**
19092
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
19093
- * the decoded pixels live in. One more member of the one-of
19094
- * frame/frameHandle/image/imageBase64/referenceImage group.
19095
- */
19096
- frameHandle: FrameHandleSchema.optional(),
19097
- imageBase64: string().optional(),
19098
- /**
19099
- * Binary JPEG bytes — preferred over `imageBase64` on internal
19100
- * hops (hub → forked worker via Moleculer MsgPack) because it
19101
- * skips the 33% base64 overhead + the per-call base64 decode on
19102
- * the detection-pipeline worker. Callers can pass either; exactly
19103
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
19104
- */
19105
- image: _instanceof(Uint8Array).optional(),
19106
- referenceImage: string().optional(),
19107
- deviceId: number().optional(),
19108
- sessionId: string().optional(),
19109
- /**
19110
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
19111
- * reference-image, and detail-subtree calls. 'frame' is the live
19112
- * per-frame dispatch: ONLY root-plane steps run; crop children
19113
- * (inputClasses ≠ null) are skipped and served per-track via
19114
- * pipelineRunner.runDetailSubtree (two-plane design).
19115
- */
19116
- plane: _enum(["full", "frame"]).optional(),
19117
- /**
19118
- * Inference-device selector (Phase 2 multi-device). Format
19119
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
19120
- * Omitted ⇒ the runner's default device (current single-engine
19121
- * behaviour). Selects WHICH device pool of the node runs the call.
19122
- */
19123
- deviceKey: string().optional(),
19124
- /**
19125
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
19126
- * when the parent crop was resolved from the frame's retained NATIVE
19127
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
19128
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
19129
- * resolution from that surface — the SAME quality path faces already
19130
- * had — instead of the downscaled parent tile. `handle` keys the native
19131
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
19132
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
19133
- * the executor's crop-normalized child ROI back into frame-normalized
19134
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
19135
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
19136
- * (today's behaviour on the fallback path).
19137
- */
19138
- nativeCropRef: NativeCropRefSchema.optional()
19139
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
19140
- engine: PipelineEngineChoiceSchema.optional(),
19141
- steps: array(PipelineStepInputSchema).min(1),
19142
- frames: array(FrameInputSchema).min(1).max(255),
19143
- deviceId: number().optional(),
19144
- sessionId: string().optional(),
19145
- /**
19146
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
19147
- * the batch to the Python pool's bench preprocess cache
19148
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
19149
- * preprocessed ONCE and every later inference is a pure-inference cache
19150
- * hit — the sustained-throughput run measures inference, not
19151
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
19152
- * full preprocess every call, correct). Fresh per sustained run;
19153
- * released via `uncacheFrame`.
19154
- */
19155
- frameId: number().int().nonnegative().optional(),
19156
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
19157
- deviceKey: string().optional()
19158
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
19159
- data: _instanceof(Uint8Array),
19160
- width: number().int().positive(),
19161
- height: number().int().positive(),
19162
- format: _enum([
19163
- "rgb",
19164
- "bgr",
19165
- "gray"
19166
- ])
19376
+ }), method(object({
19377
+ deviceId: number(),
19378
+ trackId: string(),
19379
+ frameId: string()
19167
19380
  }), object({
19168
- frameId: number(),
19169
- width: number(),
19170
- height: number()
19171
- }), { kind: "mutation" }), method(object({
19172
- stepId: string(),
19173
- frameId: number().int()
19174
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
19175
- batchMode: string(),
19176
- windowMs: number(),
19177
- maxBatchSize: number(),
19178
- concurrency: number()
19179
- })), method(_void(), array(object({
19180
- engineKey: string(),
19181
- engine: PipelineEngineChoiceSchema,
19182
- modelsLoaded: array(string()).readonly(),
19183
- inUseByCameras: array(number()).readonly(),
19184
- /**
19185
- * Origin of this resident factory.
19186
- * - `runtime` — main camera-serving engine (no idle TTL).
19187
- * - `warm-override` — benchmark/test override held in the warm
19188
- * cache; auto-disposed after the idle TTL.
19189
- * - `device-pool` — a concurrent per-device pool (Phase 2
19190
- * multi-device, keyed by `deviceKey`) resolved
19191
- * via `resolveDeviceFactory`. Runs alongside the
19192
- * `runtime` engine on a DIFFERENT accelerator
19193
- * (NPU / iGPU / Coral) — this is how the
19194
- * Engines tab shows all pools running at once.
19195
- */
19196
- kind: _enum([
19197
- "runtime",
19198
- "warm-override",
19199
- "device-pool"
19200
- ]),
19201
- /** Native pid of the underlying Python pool (null when no pool). */
19202
- poolPid: number().nullable(),
19203
- /** ms since this factory was last used (null when not warm-tracked). */
19204
- idleMs: number().nullable(),
19205
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
19206
- idleTtlMs: number().nullable()
19207
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
19381
+ removed: boolean(),
19382
+ removedAnnotations: number().int()
19383
+ }), {
19208
19384
  kind: "mutation",
19209
19385
  auth: "admin"
19386
+ }), method(object({ frameId: string() }), object({
19387
+ base64: string(),
19388
+ width: number().int(),
19389
+ height: number().int()
19390
+ }), {
19391
+ kind: "query",
19392
+ auth: "admin"
19210
19393
  }), method(object({
19211
- engine: PipelineEngineChoiceSchema,
19212
- force: boolean().optional()
19394
+ deviceId: number(),
19395
+ trackId: string(),
19396
+ frameId: string(),
19397
+ subject: RetrainAssistSubjectSchema,
19398
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
19399
+ nodeId: string().optional()
19400
+ }), RetrainAssistResultSchema, {
19401
+ kind: "mutation",
19402
+ auth: "admin"
19403
+ }), method(object({
19404
+ deviceId: number(),
19405
+ source: DetectionSourceSchema,
19406
+ zones: array(ZoneSchema).readonly().optional(),
19407
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
19408
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
19409
+ frames: array(ReplayFrameInputSchema).min(1)
19410
+ }), RunReplayFrameProcessorResultSchema, {
19411
+ kind: "mutation",
19412
+ auth: "admin"
19413
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
19414
+ kind: "query",
19415
+ auth: "admin"
19416
+ }), method(object({
19417
+ deviceId: number(),
19418
+ trackId: string(),
19419
+ frameId: string(),
19420
+ annotations: array(RetrainAnnotationDraftSchema)
19421
+ }), array(RetrainAnnotationSchema).readonly(), {
19422
+ kind: "mutation",
19423
+ auth: "admin"
19424
+ }), method(object({
19425
+ deviceId: number(),
19426
+ trackId: string()
19427
+ }), RetrainTransitionResultSchema, {
19428
+ kind: "mutation",
19429
+ auth: "admin"
19430
+ }), method(object({
19431
+ deviceId: number(),
19432
+ trackId: string()
19433
+ }), RetrainTransitionResultSchema, {
19434
+ kind: "mutation",
19435
+ auth: "admin"
19436
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
19437
+ kind: "query",
19438
+ auth: "admin"
19439
+ }), method(object({
19440
+ eventId: string(),
19441
+ kind: MediaFileKindEnum.optional(),
19442
+ deviceId: number()
19443
+ }), array(MediaFileSchema).readonly()), method(object({
19444
+ trackId: string(),
19445
+ kinds: array(MediaFileKindEnum).optional(),
19446
+ deviceId: number()
19447
+ }), array(MediaFileSchema).readonly()), method(object({
19448
+ trackId: string(),
19449
+ deviceId: number()
19450
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19451
+ kind: "mutation",
19452
+ auth: "admin"
19453
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
19454
+ kind: "mutation",
19455
+ auth: "admin"
19456
+ }), method(object({}), RebuildStatusSchema), object({
19457
+ deviceId: number(),
19458
+ timestamp: number(),
19459
+ frameWidth: number(),
19460
+ frameHeight: number(),
19461
+ detections: array(OverlayDetectionSchema).readonly()
19462
+ }), object({
19463
+ deviceId: number(),
19464
+ trackId: string(),
19465
+ className: string()
19213
19466
  }), object({
19214
- success: boolean(),
19215
- reason: string().optional()
19216
- }), {
19217
- kind: "mutation",
19218
- auth: "admin"
19219
- }), 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({
19220
- addonId: string(),
19221
- modelId: string(),
19222
- filename: string().optional(),
19223
- settings: record(string(), unknown()).optional()
19224
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
19467
+ deviceId: number(),
19468
+ trackId: string(),
19469
+ className: string(),
19470
+ durationMs: number()
19471
+ }), object({
19472
+ deviceId: number(),
19473
+ kind: EventKindSchema,
19474
+ eventId: string(),
19475
+ timestamp: number()
19476
+ });
19225
19477
  object({
19226
19478
  activeCameras: number(),
19227
19479
  throttledCameras: number(),
@@ -19247,106 +19499,6 @@ var CameraMetricsSchema = object({
19247
19499
  });
19248
19500
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
19249
19501
  /**
19250
- * Zone — pure geometry + identity. NO filtering behaviour.
19251
- *
19252
- * Zones describe **where** in the frame the operator wants to flag
19253
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
19254
- * each pipeline stage uses them. Splitting the two means a single
19255
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
19256
- * a detection-include rule on `['car']`, and an occupancy aggregate
19257
- * — without three duplicated polygons.
19258
- *
19259
- * Owned by the orchestrator addon (provider) and mirrored into the
19260
- * `zones` device-state slice on every mutation. Consumers
19261
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
19262
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
19263
- * mirror with `onChanged`).
19264
- *
19265
- * Coordinates are normalised fractions of the frame (0–1) so zones
19266
- * survive resolution changes and stream profile switches.
19267
- *
19268
- * `kind` discriminates between full polygons (closed regions used
19269
- * for intrusion / occupancy filters) and tripwires (open 2-point
19270
- * line segments used for cross events). Onboard / firmware-reported
19271
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
19272
- * task list.
19273
- */
19274
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
19275
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
19276
- var PolygonPointSchema = object({
19277
- x: number(),
19278
- y: number()
19279
- });
19280
- /** A camera detection zone — pure geometry/identity. */
19281
- var ZoneSchema = object({
19282
- id: string(),
19283
- name: string(),
19284
- kind: ZoneKindEnum.default("polygon"),
19285
- /** Polygon vertices, fraction of frame (0–1). */
19286
- polygon: array(PolygonPointSchema).readonly(),
19287
- /** Visual color for UI rendering. */
19288
- color: string().default("#3b82f6")
19289
- });
19290
- /**
19291
- * Zones capability — per-camera CRUD over polygon detection zones.
19292
- *
19293
- * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
19294
- * to per-device settings and mirrors into the `zones` device-state
19295
- * slice on every mutation, so downstream consumers can subscribe via
19296
- * `dev.state.zones.onChanged`.
19297
- *
19298
- * The cap surface only handles geometry + identity; filtering
19299
- * behaviour (per-class, include/exclude, threshold) lives in the
19300
- * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
19301
- * `capabilities/schemas/zone-rule.js`.
19302
- */
19303
- var zonesCapability = {
19304
- name: "zones",
19305
- scope: "device",
19306
- mode: "singleton",
19307
- deviceTypes: [DeviceType.Camera],
19308
- methods: {
19309
- listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
19310
- addZone: method(object({
19311
- deviceId: number(),
19312
- zone: ZoneSchema
19313
- }), _void(), {
19314
- kind: "mutation",
19315
- auth: "admin"
19316
- }),
19317
- removeZone: method(object({
19318
- deviceId: number(),
19319
- zoneId: string()
19320
- }), _void(), {
19321
- kind: "mutation",
19322
- auth: "admin"
19323
- }),
19324
- updateZone: method(object({
19325
- deviceId: number(),
19326
- zone: ZoneSchema
19327
- }), _void(), {
19328
- kind: "mutation",
19329
- auth: "admin"
19330
- })
19331
- },
19332
- /**
19333
- * Runtime-state slice — the live zone catalogue mirrored by the
19334
- * orchestrator on every CRUD mutation. Consumers read via
19335
- * `device.state.zones.value` / `.watch(...)` without round-tripping
19336
- * the cap, and the codegen DeviceProxy auto-wires the reactive
19337
- * handle. Slice shape is `{ zones: Zone[] }` so future extensions
19338
- * (e.g. zone groupings) can sit alongside the polygon list.
19339
- */
19340
- runtimeState: object({ zones: array(ZoneSchema).readonly() }),
19341
- /**
19342
- * 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.
19343
- *
19344
- * See `RuntimeStateDurability`. Enforced by
19345
- * `scripts/check-runtime-state-durability.ts`.
19346
- */
19347
- durability: "restored"
19348
- };
19349
- /**
19350
19502
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
19351
19503
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
19352
19504
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -28020,6 +28172,39 @@ var ReadGopBytesResultSchema = object({
28020
28172
  /** Media ms the returned fragment covers. */
28021
28173
  gopDurMs: number()
28022
28174
  });
28175
+ /**
28176
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
28177
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
28178
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
28179
+ * a replay needs several seconds of native pixels, not one frame.
28180
+ *
28181
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
28182
+ * is `false` when the returned bytes were cut short by the read's own safety
28183
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
28184
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
28185
+ * degradation: a window whose end falls past the covering segment would need
28186
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
28187
+ * not one standalone-demuxable stream — the caller's answer is to request a
28188
+ * shorter window or one aligned to a single segment, not to receive spliced
28189
+ * bytes nothing has proven decodable.
28190
+ */
28191
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
28192
+ kind: literal("ok"),
28193
+ data: _instanceof(Uint8Array),
28194
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
28195
+ * the requested `fromMs` (anchored on the nearest keyframe). */
28196
+ gopStartMs: number(),
28197
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
28198
+ gopDurMs: number(),
28199
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
28200
+ * the requested `toMs`; the caller got fewer frames than asked for. */
28201
+ reachesRequestedEnd: boolean()
28202
+ }), object({
28203
+ kind: literal("spans-multiple-segments"),
28204
+ /** Where the covering segment's own footage runs out — informational,
28205
+ * not a retry hint (retrying the same window would refuse again). */
28206
+ segmentEndMs: number()
28207
+ })]);
28023
28208
  method(object({
28024
28209
  deviceId: number(),
28025
28210
  fromMs: number(),
@@ -28070,6 +28255,15 @@ method(object({
28070
28255
  }), ReadGopBytesResultSchema, {
28071
28256
  kind: "query",
28072
28257
  auth: "admin"
28258
+ }), method(object({
28259
+ deviceId: number(),
28260
+ profile: string(),
28261
+ startMs: number(),
28262
+ fromMs: number(),
28263
+ toMs: number()
28264
+ }), ReadWindowBytesResultSchema, {
28265
+ kind: "query",
28266
+ auth: "admin"
28073
28267
  }), method(object({
28074
28268
  deviceId: number(),
28075
28269
  config: RecordingConfigSchema
@@ -28665,92 +28859,6 @@ var sceneMonitorCapability = {
28665
28859
  durability: "session"
28666
28860
  };
28667
28861
  /**
28668
- * Per-stage gating mode applied to the zones a rule references.
28669
- *
28670
- * - `include`: the rule contributes to a **whitelist** for its stage.
28671
- * When at least one `include` rule fires for a stage, only entities
28672
- * inside one of those zones pass that stage.
28673
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
28674
- * Entities inside one of those zones are dropped at that stage.
28675
- *
28676
- * `monitor`-style observation (count without filtering) is not a rule
28677
- * mode — zones without any matching rule are observed naturally by
28678
- * `zone-analytics` (live snapshot + history), so an "I just want to
28679
- * count, not filter" use case needs no rule at all.
28680
- */
28681
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
28682
- /**
28683
- * Per-consumer rule that references existing zones (geometry) and
28684
- * defines how a specific pipeline stage should treat them. Each
28685
- * consumer addon owns its own `ZoneRule[]` array in its per-device
28686
- * settings:
28687
- *
28688
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
28689
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
28690
- * - future: notification rules, audio gating, etc.
28691
- *
28692
- * One rule applies to N zones (`zoneIds[]`) so the operator can
28693
- * express "ignore motion in ALL of {garden, street}" with a single
28694
- * rule. `classFilter` narrows the rule to specific object classes —
28695
- * "drop person detections in the street, but keep cars" is one
28696
- * `exclude` rule with `classFilter: ['person']`.
28697
- *
28698
- * `enabled` is a soft toggle — the operator can keep the rule
28699
- * configured but inert without deleting it.
28700
- */
28701
- var ZoneRuleSchema = object({
28702
- /** Stable rule id — survives edits, used by the UI for diffing. */
28703
- id: string(),
28704
- /** Optional human-readable label rendered in the rule editor. */
28705
- name: string().optional(),
28706
- /** Zones this rule targets. The rule's `mode` applies to ALL
28707
- * listed zones (OR-set: a detection in any one of them counts).
28708
- * At least one zone id required — a rule with no targets is a
28709
- * configuration mistake and the form validator rejects it. */
28710
- zoneIds: array(string()).min(1).readonly(),
28711
- mode: ZoneRuleModeEnum,
28712
- /**
28713
- * Class names this rule applies to. Empty / undefined ⇒ rule
28714
- * applies to every class. Class strings match the `macroClass`
28715
- * field on detections (e.g. `person`, `car`, `dog`).
28716
- */
28717
- classFilter: array(string()).readonly().optional(),
28718
- /**
28719
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
28720
- * required to consider an entity "in the zone". Defaults to the
28721
- * consumer's stage default when omitted. Kept for back-compat with
28722
- * existing per-rule overrides; new operators pick the value via
28723
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
28724
- * set, the lower-level engine reads it as a 0–1 fraction.
28725
- */
28726
- overlapThreshold: number().min(0).max(1).optional(),
28727
- /**
28728
- * Operator-friendly version of `overlapThreshold` — the percentage
28729
- * of the detection's bbox that must lie inside the zone for the
28730
- * rule to match. Documented default is 85%; the engine substitutes
28731
- * that when the field is omitted (kept optional so existing rules
28732
- * stored without it stay valid).
28733
- *
28734
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
28735
- * rule, the engine prefers `bboxInclusionPct` because it's the
28736
- * field exposed in the UI. Internally both feed the same gate.
28737
- */
28738
- bboxInclusionPct: number().min(0).max(100).optional(),
28739
- /**
28740
- * When `true` and a detection has a segmentation mask, use the
28741
- * mask for overlap instead of the bbox. Detection-stage only;
28742
- * motion rules ignore this field.
28743
- */
28744
- preferMask: boolean().optional(),
28745
- /**
28746
- * Soft-toggle: `false` disables the rule without deleting it.
28747
- * Defaults to `true` so operators creating a rule via the UI
28748
- * see it active immediately.
28749
- */
28750
- enabled: boolean().default(true)
28751
- });
28752
- array(ZoneRuleSchema).readonly();
28753
- /**
28754
28862
  * Script-runner cap. Models HA `script.*` entities on
28755
28863
  * `DeviceType.Script`. A Script is a pre-recorded action sequence
28756
28864
  * that can be invoked imperatively — optionally with a variables
@@ -34243,6 +34351,12 @@ Object.freeze({
34243
34351
  addonId: null,
34244
34352
  access: "view"
34245
34353
  },
34354
+ "notificationRules.resolveArtifactUrl": {
34355
+ capName: "notification-rules",
34356
+ capScope: "system",
34357
+ addonId: null,
34358
+ access: "view"
34359
+ },
34246
34360
  "notificationRules.setAlarmConfig": {
34247
34361
  capName: "notification-rules",
34248
34362
  capScope: "system",
@@ -34687,6 +34801,12 @@ Object.freeze({
34687
34801
  addonId: null,
34688
34802
  access: "create"
34689
34803
  },
34804
+ "pipelineAnalytics.runReplayFrameProcessor": {
34805
+ capName: "pipeline-analytics",
34806
+ capScope: "device",
34807
+ addonId: null,
34808
+ access: "create"
34809
+ },
34690
34810
  "pipelineAnalytics.saveRetrainAnnotations": {
34691
34811
  capName: "pipeline-analytics",
34692
34812
  capScope: "device",
@@ -34819,6 +34939,12 @@ Object.freeze({
34819
34939
  addonId: null,
34820
34940
  access: "view"
34821
34941
  },
34942
+ "pipelineExecutor.getInferenceDeviceHealth": {
34943
+ capName: "pipeline-executor",
34944
+ capScope: "system",
34945
+ addonId: null,
34946
+ access: "view"
34947
+ },
34822
34948
  "pipelineExecutor.getOrchestratorConfigSchema": {
34823
34949
  capName: "pipeline-executor",
34824
34950
  capScope: "system",
@@ -34891,6 +35017,12 @@ Object.freeze({
34891
35017
  addonId: null,
34892
35018
  access: "view"
34893
35019
  },
35020
+ "pipelineExecutor.rearmInferenceDevice": {
35021
+ capName: "pipeline-executor",
35022
+ capScope: "system",
35023
+ addonId: null,
35024
+ access: "create"
35025
+ },
34894
35026
  "pipelineExecutor.runAudioTest": {
34895
35027
  capName: "pipeline-executor",
34896
35028
  capScope: "system",
@@ -35629,6 +35761,12 @@ Object.freeze({
35629
35761
  addonId: null,
35630
35762
  access: "view"
35631
35763
  },
35764
+ "recording.readWindowBytes": {
35765
+ capName: "recording",
35766
+ capScope: "system",
35767
+ addonId: null,
35768
+ access: "view"
35769
+ },
35632
35770
  "recording.refreshStorageLocationsForMigration": {
35633
35771
  capName: "recording",
35634
35772
  capScope: "system",
@@ -38139,6 +38277,11 @@ Object.freeze({
38139
38277
  form: "single",
38140
38278
  optional: false
38141
38279
  }],
38280
+ "pipelineAnalytics.runReplayFrameProcessor": [{
38281
+ name: "deviceId",
38282
+ form: "single",
38283
+ optional: false
38284
+ }],
38142
38285
  "pipelineAnalytics.saveRetrainAnnotations": [{
38143
38286
  name: "deviceId",
38144
38287
  form: "single",
@@ -38454,6 +38597,11 @@ Object.freeze({
38454
38597
  form: "single",
38455
38598
  optional: false
38456
38599
  }],
38600
+ "recording.readWindowBytes": [{
38601
+ name: "deviceId",
38602
+ form: "single",
38603
+ optional: false
38604
+ }],
38457
38605
  "recording.relocateFootage": [{
38458
38606
  name: "deviceId",
38459
38607
  form: "single",