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