@camstack/addon-terminal 0.1.34 → 0.1.36

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