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