@camstack/addon-provider-amcrest 0.2.30 → 0.2.32

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