@camstack/addon-notifiers 1.2.32 → 1.2.34

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 +2085 -1842
  2. package/dist/addon.mjs +2085 -1842
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -6633,7 +6633,7 @@ function method(input, output, options) {
6633
6633
  input,
6634
6634
  output,
6635
6635
  kind: options?.kind ?? "query",
6636
- auth: options?.auth ?? "protected",
6636
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6637
6637
  ...options?.access !== void 0 ? { access: options.access } : {},
6638
6638
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6639
6639
  timeoutMs: options?.timeoutMs
@@ -6653,7 +6653,7 @@ function systemMethod(input, output, options) {
6653
6653
  }
6654
6654
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
6655
6655
  var VersionOutputSchema$1 = object({ version: string() });
6656
- method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6656
+ method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
6657
6657
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
6658
6658
  DeviceType["Camera"] = "camera";
6659
6659
  DeviceType["Hub"] = "hub";
@@ -6974,7 +6974,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6974
6974
  }({});
6975
6975
  var StaticDirOutputSchema = object({ staticDir: string() });
6976
6976
  var VersionOutputSchema = object({ version: string() });
6977
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6977
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
6978
6978
  /**
6979
6979
  * device-ops — device-scoped cap that unifies the per-IDevice operations
6980
6980
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7707,24 +7707,6 @@ var RecordingRetentionSchema = object({
7707
7707
  maxSizeGb: number().min(0).optional()
7708
7708
  });
7709
7709
  /**
7710
- * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7711
- * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7712
- * previews at. Five graduated steps; absent on a config = `standard` (the
7713
- * shipped default, matching `sheet-geometry`/`sheet-composer`).
7714
- *
7715
- * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7716
- * Each window's index sidecar carries its own tile dims, so a camera whose
7717
- * preset changed over time renders every historical window at the dims it was
7718
- * written with.
7719
- */
7720
- var ScrubThumbnailPresetSchema = _enum([
7721
- "minimal",
7722
- "low",
7723
- "standard",
7724
- "high",
7725
- "max"
7726
- ]);
7727
- /**
7728
7710
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7729
7711
  *
7730
7712
  * `bands` is the ONLY authored recording intent: what to record, when, and on
@@ -7732,7 +7714,11 @@ var ScrubThumbnailPresetSchema = _enum([
7732
7714
  * other field is a storage knob (profiles, segment length, retention, scrub).
7733
7715
  *
7734
7716
  * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7735
- * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7717
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30,
7718
+ * and `scrubThumbnails` — a five-step fidelity knob for a sprite tier that was
7719
+ * deleted on 2026-07-24 and had ZERO consumers in the recorder — on 2026-08-25
7720
+ * (D62: a switch that writes a store nobody reads is worse than no switch).
7721
+ * Stored rows keep loading: the READ schema is `.strip()` (config-store.ts).
7736
7722
  * A stale caller must fail loudly — silently stripping its legacy intent would
7737
7723
  * persist a band-less config, i.e. silently stop recording the camera.
7738
7724
  */
@@ -7755,14 +7741,7 @@ var RecordingConfigSchema = object({
7755
7741
  * "off" is the absence of a covering band, never a band value.
7756
7742
  */
7757
7743
  bands: array(RecordingBandSchema).default([]),
7758
- retention: RecordingRetentionSchema.optional(),
7759
- /**
7760
- * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7761
- * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7762
- * windows only — existing sheets are immutable, and each window's index
7763
- * carries its own tile dims so mixed-preset history renders correctly.
7764
- */
7765
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7744
+ retention: RecordingRetentionSchema.optional()
7766
7745
  }).strict();
7767
7746
  /**
7768
7747
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
@@ -7838,10 +7817,11 @@ var RelocateFootageInputSchema = object({
7838
7817
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7839
7818
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7840
7819
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7841
- var StorageMigrationMediaMoveInputSchema = object({
7820
+ var RelocateMediaInputSchema = object({
7842
7821
  toLocationId: string(),
7843
7822
  throttleMbps: number().min(1).max(1e3).optional()
7844
- }).extend({ leaseId: string().min(1) });
7823
+ });
7824
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7845
7825
  /** The independently selectable logical storage classes. `recordings`
7846
7826
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7847
7827
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8136,7 +8116,26 @@ var LabelDefinitionSchema = object({
8136
8116
  description: string().optional(),
8137
8117
  icon: string().optional()
8138
8118
  });
8139
- var ClassMapDefinitionSchema = object({
8119
+ /**
8120
+ * Wire schema for a per-model CATALOG classMap override
8121
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8122
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8123
+ * detection pipeline executor actually routes.
8124
+ *
8125
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8126
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8127
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8128
+ * enum) — the two used to share the name `ClassMapDefinition`/
8129
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8130
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8131
+ * are not: it is two different concepts colliding on a name. Keep this type
8132
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8133
+ * would either narrow every `ClassMapDefinition` consumer to the four
8134
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8135
+ * schema exists for (see the "rejects a classMap whose target is not a
8136
+ * detection macro" test in `model-catalog-schema.test.ts`).
8137
+ */
8138
+ var DetectionCatalogClassMapSchema = object({
8140
8139
  mapping: record(string(), _enum([
8141
8140
  "person",
8142
8141
  "vehicle",
@@ -8341,7 +8340,7 @@ var ModelCatalogEntrySchema = object({
8341
8340
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8342
8341
  * labels already ARE the CamStack macros (Scrypted identity map).
8343
8342
  */
8344
- classMap: ClassMapDefinitionSchema.optional()
8343
+ classMap: DetectionCatalogClassMapSchema.optional()
8345
8344
  });
8346
8345
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8347
8346
  format: literal("openvino"),
@@ -8371,7 +8370,7 @@ var ModelConvertMetadataSchema = object({
8371
8370
  "segmentation"
8372
8371
  ]),
8373
8372
  faceAlignment: boolean().optional(),
8374
- classMap: ClassMapDefinitionSchema.optional()
8373
+ classMap: DetectionCatalogClassMapSchema.optional()
8375
8374
  });
8376
8375
  var ConvertResultSchema = object({
8377
8376
  entry: ModelCatalogEntrySchema,
@@ -9234,7 +9233,7 @@ var AddonPageDeclarationSchema = object({
9234
9233
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9235
9234
  sectionLabel: string().optional()
9236
9235
  });
9237
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9236
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9238
9237
  var AddonHttpRouteSchema = object({
9239
9238
  method: _enum([
9240
9239
  "GET",
@@ -9488,7 +9487,7 @@ var WidgetMetadataSchema = object({
9488
9487
  defaultColumns: number().int().min(1).max(12).default(6),
9489
9488
  defaultRows: number().int().min(1).max(12).default(1)
9490
9489
  });
9491
- method(_void(), array(WidgetMetadataSchema).readonly());
9490
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9492
9491
  /**
9493
9492
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9494
9493
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -11032,7 +11031,7 @@ var CustomModelDescriptorSchema = object({
11032
11031
  stepId: string(),
11033
11032
  entry: ModelCatalogEntrySchema
11034
11033
  });
11035
- method(_void(), array(CustomModelDescriptorSchema).readonly());
11034
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
11036
11035
  /**
11037
11036
  * Query filter for settings-store collections.
11038
11037
  */
@@ -11119,7 +11118,8 @@ method(object({
11119
11118
  }), _void(), { kind: "mutation" }), method(object({
11120
11119
  namespace: string().optional(),
11121
11120
  collection: string(),
11122
- filter: QueryFilterSchema.optional()
11121
+ filter: QueryFilterSchema.optional(),
11122
+ columns: array(string()).readonly().optional()
11123
11123
  }), array(SettingsRecordSchema).readonly()), method(object({
11124
11124
  namespace: string().optional(),
11125
11125
  collection: string(),
@@ -11182,46 +11182,87 @@ var EngineInfoSchema = object({
11182
11182
  kind: _enum(["relational", "vector"]),
11183
11183
  displayName: string()
11184
11184
  });
11185
- method(_void(), EngineInfoSchema), method(object({
11185
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11186
11186
  namespace: string().optional(),
11187
11187
  collection: string(),
11188
11188
  key: string()
11189
- }), unknown()), method(object({
11189
+ }), unknown(), { auth: "admin" }), method(object({
11190
11190
  namespace: string().optional(),
11191
11191
  collection: string(),
11192
11192
  key: string(),
11193
11193
  value: unknown()
11194
- }), _void(), { kind: "mutation" }), method(object({
11194
+ }), _void(), {
11195
+ kind: "mutation",
11196
+ auth: "admin"
11197
+ }), method(object({
11195
11198
  namespace: string().optional(),
11196
11199
  collection: string(),
11197
- filter: QueryFilterSchema.optional()
11198
- }), array(SettingsRecordSchema).readonly()), method(object({
11200
+ filter: QueryFilterSchema.optional(),
11201
+ /**
11202
+ * SQL-level column projection — MUST mirror `settings-store.query`.
11203
+ *
11204
+ * ⚠ An earlier version of this comment blamed Zod stripping, and that
11205
+ * was wrong — corrected 2026-08-26 after the hop map
11206
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11207
+ * There is **no Zod parse at all** between the door and the engine: the
11208
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11209
+ * field declared here reaches `SqliteSettingsBackend` either way.
11210
+ *
11211
+ * What actually lost `columns` was the THIRD declaration of this shape:
11212
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11213
+ * interface the engine destructures from. The field existed on both
11214
+ * schemas and the engine still never read it, because nothing checks a
11215
+ * registered provider against `InferProvider<cap>` —
11216
+ * `ProviderRegistration.provider` is typed `object`.
11217
+ *
11218
+ * It is declared here anyway, and must stay in step with
11219
+ * `settings-store.query`: a caller reading only the cap definitions has
11220
+ * to be able to see that this call carries a projection.
11221
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11222
+ */
11223
+ columns: array(string()).readonly().optional()
11224
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11199
11225
  namespace: string().optional(),
11200
11226
  collection: string(),
11201
11227
  record: SettingsRecordSchema
11202
- }), _void(), { kind: "mutation" }), method(object({
11228
+ }), _void(), {
11229
+ kind: "mutation",
11230
+ auth: "admin"
11231
+ }), method(object({
11203
11232
  namespace: string().optional(),
11204
11233
  collection: string(),
11205
11234
  id: string(),
11206
11235
  data: record(string(), unknown())
11207
- }), _void(), { kind: "mutation" }), method(object({
11236
+ }), _void(), {
11237
+ kind: "mutation",
11238
+ auth: "admin"
11239
+ }), method(object({
11208
11240
  namespace: string().optional(),
11209
11241
  collection: string(),
11210
11242
  key: string()
11211
- }), _void(), { kind: "mutation" }), method(object({
11243
+ }), _void(), {
11244
+ kind: "mutation",
11245
+ auth: "admin"
11246
+ }), method(object({
11212
11247
  namespace: string().optional(),
11213
11248
  collection: string(),
11214
11249
  filter: MutationFilterSchema
11215
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11250
+ }), object({ deleted: number().int() }), {
11251
+ kind: "mutation",
11252
+ auth: "admin"
11253
+ }), method(object({
11216
11254
  namespace: string().optional(),
11217
11255
  collection: string(),
11218
11256
  filter: MutationFilterSchema,
11219
11257
  data: record(string(), unknown())
11220
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11258
+ }), object({ updated: number().int() }), {
11259
+ kind: "mutation",
11260
+ auth: "admin"
11261
+ }), method(object({
11221
11262
  namespace: string().optional(),
11222
11263
  collection: string(),
11223
11264
  filter: QueryFilterSchema.optional()
11224
- }), number()), method(object({
11265
+ }), number(), { auth: "admin" }), method(object({
11225
11266
  namespace: string().optional(),
11226
11267
  collection: string(),
11227
11268
  field: string(),
@@ -11231,15 +11272,18 @@ method(_void(), EngineInfoSchema), method(object({
11231
11272
  }), array(object({
11232
11273
  bucket: number().int(),
11233
11274
  count: number().int()
11234
- })).readonly()), method(object({
11275
+ })).readonly(), { auth: "admin" }), method(object({
11235
11276
  namespace: string().optional(),
11236
11277
  collection: string()
11237
- }), boolean()), method(object({
11278
+ }), boolean(), { auth: "admin" }), method(object({
11238
11279
  namespace: string().optional(),
11239
11280
  collection: string(),
11240
11281
  columns: array(CollectionColumnSchema).readonly(),
11241
11282
  indexes: array(CollectionIndexSchema).readonly().optional()
11242
- }), _void(), { kind: "mutation" });
11283
+ }), _void(), {
11284
+ kind: "mutation",
11285
+ auth: "admin"
11286
+ });
11243
11287
  /**
11244
11288
  * shm ring usage stats for a `frameSink: 'shm'` decoder session —
11245
11289
  * exposed via `decoder.getShmStats` so downstream consumers can
@@ -12367,7 +12411,7 @@ method(object({
12367
12411
  crop: _instanceof(Uint8Array),
12368
12412
  width: number(),
12369
12413
  height: number()
12370
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12414
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12371
12415
  /**
12372
12416
  * filesystem-browse — per-node capability for browsing the node's local
12373
12417
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12660,19 +12704,22 @@ method(LlmGenerateBaseInputSchema.extend({
12660
12704
  runtime: ManagedRuntimeConfigSchema,
12661
12705
  /** The managed profile's timeout, threaded by the hub provider. */
12662
12706
  timeoutMs: number().int().positive().optional()
12663
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12707
+ }), LlmGenerateResultSchema, {
12708
+ kind: "mutation",
12709
+ auth: "admin"
12710
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12664
12711
  kind: "mutation",
12665
12712
  auth: "admin"
12666
12713
  }), method(object({}), _void(), {
12667
12714
  kind: "mutation",
12668
12715
  auth: "admin"
12669
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12716
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12670
12717
  kind: "mutation",
12671
12718
  auth: "admin"
12672
12719
  }), method(object({ file: string() }), _void(), {
12673
12720
  kind: "mutation",
12674
12721
  auth: "admin"
12675
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12722
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12676
12723
  /**
12677
12724
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12678
12725
  * methods concat-fan across providers; single-row methods route to ONE
@@ -16159,1748 +16206,1958 @@ var OauthIntegrationDescriptorSchema = object({
16159
16206
  */
16160
16207
  refreshTokenTtlSec: union([number().int().positive(), literal("never")]).optional()
16161
16208
  });
16162
- method(_void(), OauthIntegrationDescriptorSchema);
16209
+ method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
16163
16210
  /**
16164
- * pipeline-analytics — device-scoped wrapper cap. Refines raw
16165
- * per-frame detections emitted by the pipeline runner into tracked
16166
- * objects, per-kind event collections (motion / object / audio), and
16167
- * persisted media. Owns the post-detection domain end-to-end:
16168
- *
16169
- * runner emits PipelineInferenceResult
16170
- * ↓ (event bus)
16171
- * pipeline-analytics subscriber
16172
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16173
- * → three DB collections (one per kind), one FS media tree, one
16174
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16175
- * DetectionEvent on bus)
16176
- *
16177
- * Pure subscriber model. No `processFrame` cap method — the runner
16178
- * already publishes the raw frame on the bus. The cap surface is
16179
- * only QUERIES + per-device settings, bound on/off via
16180
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16181
- * every camera with a detection pipeline wants its raw detections
16182
- * refined; operators opt out per-device via BindingsTab when needed.
16183
- *
16184
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16185
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16211
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16212
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16213
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16186
16214
  */
16187
- var TrackStateSchema = _enum([
16188
- "new",
16189
- "entered",
16190
- "left",
16191
- "moving",
16192
- "idle"
16193
- ]);
16194
- var EventKindSchema = _enum([
16195
- "motion",
16196
- "object",
16197
- "audio"
16198
- ]);
16215
+ var NativeCropRefSchema = object({
16216
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16217
+ handle: FrameHandleSchema,
16218
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16219
+ cropFrameSpace: object({
16220
+ x: number(),
16221
+ y: number(),
16222
+ w: number(),
16223
+ h: number()
16224
+ })
16225
+ });
16226
+ object({
16227
+ crop: object({
16228
+ left: number(),
16229
+ top: number(),
16230
+ width: number().positive(),
16231
+ height: number().positive()
16232
+ }).optional(),
16233
+ content: object({
16234
+ width: number().int().positive(),
16235
+ height: number().int().positive()
16236
+ }),
16237
+ fit: _enum(["stretch", "contain"]),
16238
+ format: _enum([
16239
+ "rgb",
16240
+ "gray",
16241
+ "jpeg"
16242
+ ])
16243
+ });
16199
16244
  /**
16200
- * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16201
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16202
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16245
+ * Process-local frame identity. It is serializable so it can ride an in-process
16246
+ * capability call, but `registryId` deliberately prevents resolution in any
16247
+ * other process or execution group.
16203
16248
  */
16204
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16205
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16206
- var EventKindIconSchema = _enum([
16207
- "motion",
16208
- "audio",
16209
- "person",
16210
- "vehicle",
16211
- "animal",
16212
- "door",
16213
- "pir",
16214
- "smoke",
16215
- "water",
16216
- "button",
16217
- "package",
16218
- "generic"
16249
+ var FrameRefSchema = object({
16250
+ registryId: string().min(1),
16251
+ id: string().min(1),
16252
+ width: number().int().positive(),
16253
+ height: number().int().positive(),
16254
+ format: _enum(["rgb", "gray"]),
16255
+ timestamp: number(),
16256
+ capturedAt: number().optional()
16257
+ });
16258
+ var ModelFormatSchema$1 = _enum([
16259
+ "onnx",
16260
+ "coreml",
16261
+ "openvino",
16262
+ "tflite",
16263
+ "pt",
16264
+ "gguf"
16219
16265
  ]);
16220
- var EventKindCategorySchema = _enum([
16221
- "motion",
16222
- "audio",
16223
- "detection",
16224
- "sensor",
16225
- "control",
16226
- "custom",
16227
- "package"
16266
+ var PipelineSlotSchema = _enum([
16267
+ "detector",
16268
+ "cropper",
16269
+ "classifier",
16270
+ "refiner",
16271
+ "audio-classifier"
16228
16272
  ]);
16229
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16230
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16231
- var EventKindDescriptorSchema = object({
16232
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16233
- kind: string(),
16234
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16235
- labelKey: string(),
16236
- /** English fallback label (kept for clients that don't translate). */
16237
- label: string(),
16238
- /** Hex color for timeline/legend rendering. */
16239
- color: string(),
16240
- /** Dictionary id → lucide component on the UI side. */
16241
- iconId: string(),
16242
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16243
- icon: EventKindIconSchema,
16244
- category: EventKindCategorySchema,
16245
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16246
- parentKind: string().nullable(),
16247
- /** Derived from `parentKind`, explicit for the client tree. */
16248
- level: EventKindLevelSchema,
16249
- /** Which cap + device contributes this kind. For built-ins the camera
16250
- * itself; for sensor kinds the LINKED source device. */
16251
- source: object({
16252
- capName: string(),
16253
- deviceId: number()
16254
- })
16273
+ var PipelineEngineChoiceSchema = object({
16274
+ runtime: _enum(["node", "python"]),
16275
+ backend: string(),
16276
+ format: ModelFormatSchema$1,
16277
+ device: string().optional()
16255
16278
  });
16256
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16257
- var EventKindsForDeviceSchema = object({
16258
- deviceId: number(),
16259
- kinds: array(EventKindDescriptorSchema).readonly()
16279
+ var AvailableEngineSchema = object({
16280
+ engine: PipelineEngineChoiceSchema,
16281
+ devices: array(object({
16282
+ id: string(),
16283
+ label: string(),
16284
+ description: string().optional()
16285
+ })).readonly(),
16286
+ defaultDevice: string()
16260
16287
  });
16261
- var SensorEventSchema = object({
16288
+ var PipelineDefaultStepSchema = lazy(() => object({
16289
+ addonId: string(),
16290
+ addonName: string(),
16291
+ slot: PipelineSlotSchema,
16292
+ inputClasses: array(string()).readonly(),
16293
+ outputClasses: array(string()).readonly(),
16294
+ enabled: boolean(),
16295
+ modelId: string(),
16296
+ children: array(PipelineDefaultStepSchema).readonly(),
16297
+ group: string().optional(),
16298
+ settings: record(string(), unknown()).optional()
16299
+ }));
16300
+ var PipelineTemplateStepSchema = lazy(() => object({
16301
+ addonId: string(),
16302
+ enabled: boolean(),
16303
+ modelId: string(),
16304
+ children: array(PipelineTemplateStepSchema).readonly(),
16305
+ settings: record(string(), unknown()).optional()
16306
+ }));
16307
+ var PipelineTemplateSchema$1 = object({
16262
16308
  id: string(),
16263
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16264
- * yields N rows, one per camera). */
16265
- deviceId: number(),
16266
- /** The linked sensor device whose state changed. */
16267
- sourceDeviceId: number(),
16268
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16269
- kind: string(),
16270
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16271
- value: record(string(), unknown()).nullable(),
16272
- timestamp: number()
16309
+ name: string(),
16310
+ createdAt: string(),
16311
+ updatedAt: string(),
16312
+ engine: PipelineEngineChoiceSchema,
16313
+ steps: array(PipelineTemplateStepSchema).readonly()
16273
16314
  });
16274
- var TrackPositionSchema = object({
16275
- x: number(),
16276
- y: number(),
16277
- timestamp: number(),
16278
- bbox: BoundingBoxSchema
16279
- });
16280
- var TrackSnapshotSchema = object({
16281
- timestamp: number(),
16282
- position: TrackPositionSchema,
16283
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16284
- mediaKey: string()
16315
+ var PipelineModelOptionSchema = object({
16316
+ id: string(),
16317
+ name: string(),
16318
+ formats: record(string(), object({
16319
+ downloaded: boolean(),
16320
+ sizeMB: number()
16321
+ })),
16322
+ group: ModelVariantGroupSchema.optional(),
16323
+ legacy: boolean().optional(),
16324
+ provider: ModelProviderIdSchema.optional()
16285
16325
  });
16286
- /**
16287
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16288
- * divided by the track's detection-frame dims), computed at persist time.
16289
- * Absent when the frame dims were unknown when the track was persisted
16290
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16291
- */
16292
- var TrackEnvelopeSchema = object({
16293
- minX: number(),
16294
- minY: number(),
16295
- maxX: number(),
16296
- maxY: number()
16326
+ var ConfigFieldBridge = custom();
16327
+ var PipelineAddonSchemaSchema = object({
16328
+ id: string(),
16329
+ name: string(),
16330
+ slot: PipelineSlotSchema,
16331
+ inputClasses: array(string()).readonly(),
16332
+ outputClasses: array(string()).readonly(),
16333
+ childSlots: array(PipelineSlotSchema).readonly(),
16334
+ models: array(PipelineModelOptionSchema).readonly(),
16335
+ defaultModelId: string(),
16336
+ defaultModelIdByFormat: record(string(), string()).optional(),
16337
+ enabledByDefault: boolean().optional(),
16338
+ backfillIntoExistingOverrides: boolean().optional(),
16339
+ defaultConfidence: number(),
16340
+ group: string().optional(),
16341
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16297
16342
  });
16298
- /**
16299
- * Row projection for track list queries. `full` (default) returns the
16300
- * complete Track including the frame-rate `positions[]` history and the
16301
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16302
- * keeps every scalar the list surfaces actually render (ids, class(es),
16303
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16304
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16305
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16306
- * `getTrack`. Mirrors the event-store `projection` convention
16307
- * (`getObjectEvents` et al.).
16308
- */
16309
- var TrackProjectionSchema = _enum(["full", "slim"]);
16310
- /**
16311
- * One audio-classification label heard on the track's camera while the
16312
- * track was alive, aggregated per label. An "episode" is one persisted
16313
- * audio event (the confident-classification path: score ≥ the device's
16314
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16315
- * one 32 ms inference chunk, so counts stay human-scaled.
16316
- */
16317
- var TrackAudioLabelSchema = object({
16343
+ var PipelineSlotSchemaSchema = object({
16344
+ id: PipelineSlotSchema,
16318
16345
  label: string(),
16319
- /** Highest classification score observed across the label's episodes. */
16320
- peakScore: number(),
16321
- /** Number of coalesced audio-event episodes carrying this label. */
16322
- count: number(),
16323
- firstAt: number(),
16324
- lastAt: number()
16346
+ priority: number(),
16347
+ parentSlot: PipelineSlotSchema.nullable(),
16348
+ addons: array(PipelineAddonSchemaSchema).readonly()
16325
16349
  });
16326
- /**
16327
- * How a track was produced. `pipeline` (default / absent) = the spatial
16328
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16329
- * no positions, a single snapshot, and no bbox trajectory at all:
16330
- *
16331
- * - `sensor` — a linked sensor/control device state change.
16332
- * - `audio` — an audio event on the camera itself that was anomalous for
16333
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16334
- *
16335
- * The spatial subsystems (tracker association, occupancy count, re-id /
16336
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16337
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16338
- * check silently readmits every source added after it was written.
16339
- */
16340
- var TrackSourceSchema = _enum([
16341
- "pipeline",
16342
- "sensor",
16343
- "audio"
16344
- ]);
16345
- /**
16346
- * Where a track sits in the RETRAIN lifecycle (D81).
16347
- *
16348
- * - `none` — never marked, or un-marked. Evictable.
16349
- * - `staging` — the operator wants this track as training material and has not
16350
- * finished with it. **This is the only state retention holds**: the track and
16351
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16352
- * the device's age window.
16353
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16354
- * were COPIED into the retrain dataset at selection time, so the dataset no
16355
- * longer depends on the track's media and the track becomes EVICTABLE again.
16356
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16357
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16358
- *
16359
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16360
- * the store's filter language has only positive equality and `whereIn` — no
16361
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16362
- * would make the entire pre-column history immortal in one deploy.
16363
- */
16364
- var RetrainStatusSchema = _enum([
16365
- "none",
16366
- "staging",
16367
- "trained"
16368
- ]);
16369
- /**
16370
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16371
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16372
- * so the two surfaces cannot drift.
16373
- *
16374
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16375
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16376
- * columns existed read as absent, and a consumer that needs a boolean should say
16377
- * `flag === true`, not `flag !== false`.
16378
- *
16379
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16380
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16381
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16382
- * `trained` track reports `false` while refusing both writes. The boolean is
16383
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16384
- * "never marked" from "already trained" must read `retrainStatus`.
16385
- *
16386
- * `debug` does NOT pin; it is attention, not durability.
16387
- *
16388
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16389
- * A favourited track is skipped by retention the same way `staging` is, but
16390
- * it does not enter `none|staging|trained` and has no staging budget.
16391
- */
16392
- var TrackFlagFields = {
16393
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16394
- * `'staging'`. */
16395
- markForTrain: boolean().optional(),
16396
- /** Operator marked this track for diagnostic attention. */
16397
- debug: boolean().optional(),
16398
- /** Operator favourited this track. Pins it against pruning. */
16399
- favourited: boolean().optional()
16400
- };
16401
- /**
16402
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16403
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16404
- * write patch, and the status is not something the toggle sets — it is what the
16405
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16406
- * always present on a persisted row (the column default materialises `'none'`).
16407
- */
16408
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16409
- /**
16410
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16411
- * one flag can never clear the other — the toggles are independent and are
16412
- * driven from three surfaces that do not know about each other.
16413
- */
16414
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16415
- /**
16416
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16417
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16418
- * mutation result without a re-fetch.
16419
- */
16420
- var TrackFlagsSchema = object({
16421
- trackId: string(),
16422
- markForTrain: boolean(),
16423
- debug: boolean(),
16424
- favourited: boolean(),
16425
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16426
- * a track row) because this shape is only ever produced by the write body,
16427
- * which always knows it — and a surface that has just written needs to render
16428
- * `trained` without a re-fetch. */
16429
- retrainStatus: RetrainStatusSchema
16350
+ var PipelineSchemaSchema = object({
16351
+ availableEngines: array(AvailableEngineSchema).readonly(),
16352
+ selectedEngine: PipelineEngineChoiceSchema,
16353
+ slots: array(PipelineSlotSchemaSchema).readonly()
16430
16354
  });
16431
- union([literal(1), literal(2)]);
16432
- /**
16433
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16434
- * the step and model that produced it — which is what makes the write rule
16435
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16436
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16437
- *
16438
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16439
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16440
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16441
- * that value has no provenance, and the write rule lets ANY properly-attributed
16442
- * write of the same tier replace it regardless of score.
16443
- */
16444
- var LabelAttributionSchema = object({
16445
- stepId: string(),
16446
- modelId: string().optional(),
16447
- decidedAt: number(),
16355
+ var EngineProvisioningSchema = object({
16356
+ runtimeId: _enum([
16357
+ "onnx",
16358
+ "openvino",
16359
+ "coreml",
16360
+ "edgetpu"
16361
+ ]).nullable(),
16362
+ device: string().nullable(),
16363
+ state: _enum([
16364
+ "idle",
16365
+ "installing",
16366
+ "verifying",
16367
+ "ready",
16368
+ "failed"
16369
+ ]),
16370
+ progress: number().optional(),
16371
+ error: string().optional(),
16372
+ nextRetryAt: number().optional(),
16448
16373
  /**
16449
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16450
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16451
- *
16452
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16453
- * notification rule authored on "Gianluca" stopped matching the moment the
16454
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16455
- * the thing that does not move, so it is what a rule matches on
16456
- * (`NcConditions.identities`) and the text is what a human is shown.
16457
- *
16458
- * Absent when the label names no gallery row — a plate the OCR read but no
16459
- * vehicle claims, a sub-class, a species, any tier-1 value.
16374
+ * Gate A (config-correctness gate at engine change): human-readable
16375
+ * config issues surfaced EAGERLY when the node's engine changes — model
16376
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16377
+ * has a <format> build"). Additive/optional: informational only, never
16378
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
16379
+ * Absent/empty when the node-default tree resolves cleanly.
16460
16380
  */
16461
- identityId: string().optional()
16381
+ configIssues: array(string()).optional()
16462
16382
  });
16463
- /**
16464
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16465
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16466
- * track and its events always answer the same question the same way.
16467
- *
16468
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16469
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16470
- * is tier 2, and each carries its own score + attribution.
16471
- *
16472
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16473
- * finest thing known. Before 4g the single `label` column held the finest
16474
- * value, so a consumer that has not been updated reads the tier-1 slot and
16475
- * shows nothing on a species-only row; that is why the migration puts every
16476
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16477
- * and why the read surfaces were changed in the same train.
16478
- *
16479
- * **Writing it.** The slots are independent, which is the whole point: a
16480
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16481
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16482
- * higher score wins. One rule, one implementation — see
16483
- * `pipeline/label-tier.ts` in addon-post-analysis.
16484
- */
16485
- var TieredLabelFields = {
16486
- /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
16487
- label: string().optional(),
16488
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16489
- labelScore: number().optional(),
16490
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16491
- labelMeta: LabelAttributionSchema.optional(),
16492
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16493
- subLabel: string().optional(),
16494
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16495
- subLabelScore: number().optional(),
16496
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16497
- subLabelMeta: LabelAttributionSchema.optional()
16498
- };
16499
- /** Per-camera slice of a training-export estimate. */
16500
- var TrainingExportDeviceTotalsSchema = object({
16501
- deviceId: number(),
16502
- tracks: number().int(),
16503
- files: number().int(),
16504
- bytes: number().int()
16383
+ var PipelineStepInputSchema = lazy(() => object({
16384
+ addonId: string(),
16385
+ modelId: string().optional(),
16386
+ enabled: boolean().default(true),
16387
+ children: array(PipelineStepInputSchema).optional(),
16388
+ settings: record(string(), unknown()).optional(),
16389
+ jumpDeviceKey: string().optional()
16390
+ }));
16391
+ var ModelSubstitutionSchema = object({
16392
+ addonId: string(),
16393
+ chosen: string(),
16394
+ running: string(),
16395
+ format: string()
16396
+ });
16397
+ var PipelineValidationIssueSchema = object({
16398
+ addonId: string(),
16399
+ kind: _enum(["unknown-addon", "no-format-build"]),
16400
+ detail: string()
16401
+ });
16402
+ var PipelineValidationResultSchema = object({
16403
+ ok: boolean(),
16404
+ issues: array(PipelineValidationIssueSchema).readonly(),
16405
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16406
+ /** The node's `currentEngine.format` this validation ran against. */
16407
+ format: string()
16408
+ });
16409
+ var ReferenceImageEntrySchema = object({
16410
+ filename: string(),
16411
+ stepIds: array(string()).readonly().optional()
16412
+ });
16413
+ var ReferenceImageBodySchema = object({
16414
+ base64: string(),
16415
+ filename: string()
16416
+ });
16417
+ var ReferenceAudioEntrySchema = object({
16418
+ filename: string(),
16419
+ sizeKb: number()
16420
+ });
16421
+ var ReferenceAudioBodySchema = object({ base64: string() });
16422
+ var AudioBackendSchema = object({
16423
+ id: string(),
16424
+ name: string(),
16425
+ description: string(),
16426
+ available: boolean(),
16427
+ /**
16428
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16429
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16430
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16431
+ * specific to the selected backend without a separate fetch.
16432
+ */
16433
+ rawLabels: array(string()).readonly().optional()
16434
+ });
16435
+ var AudioCapabilitiesSchema = object({
16436
+ activeBackend: string(),
16437
+ availableBackends: array(AudioBackendSchema).readonly(),
16438
+ sampleRate: number(),
16439
+ chunkDurationMs: number()
16440
+ });
16441
+ var DownloadModelResultSchema = object({
16442
+ filePath: string(),
16443
+ sizeMB: number(),
16444
+ durationMs: number()
16505
16445
  });
16506
16446
  /**
16507
- * What a training export WOULD contain. Computed from media index rows only —
16508
- * no blob is read to produce this.
16447
+ * Wrapper carrying a single test run's result. Replaces the legacy
16448
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16449
+ * canonical `AudioResult` from the Phase 6 output rework: one
16450
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16451
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16452
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16453
+ * benchmark UI can still report a clean failure when the classifier
16454
+ * cap isn't available.
16509
16455
  */
16510
- var TrainingExportSummarySchema = object({
16511
- generatedAt: number(),
16512
- trackCount: number().int(),
16513
- fileCount: number().int(),
16514
- byteCount: number().int(),
16515
- /** More marked tracks exist than a single pass carries. */
16516
- truncated: boolean(),
16517
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16456
+ var AudioTestResultSchema = object({
16457
+ success: boolean(),
16458
+ error: string().optional(),
16459
+ frame: custom().optional()
16518
16460
  });
16519
- var TrackSchema = object({
16520
- trackId: string(),
16521
- deviceId: number(),
16522
- className: string(),
16523
- ...TieredLabelFields,
16524
- producingDeviceName: string().optional(),
16525
- /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16526
- source: TrackSourceSchema.optional(),
16527
- firstSeen: number(),
16528
- lastSeen: number(),
16529
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16530
- positions: array(TrackPositionSchema).readonly(),
16531
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16532
- * saveThumbnails policy). */
16533
- snapshots: array(TrackSnapshotSchema).readonly(),
16534
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16535
- zonesVisited: array(string()).readonly(),
16461
+ var PipelineConfigBridge = custom();
16462
+ var ConfigUISchemaBridge = custom();
16463
+ var ConfigUISchemaNullableBridge = custom();
16464
+ var InferenceCapabilitiesBridge = custom();
16465
+ var ModelAvailabilityListBridge = custom();
16466
+ var PipelineRunResultBridge = custom();
16467
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16468
+ modelId: string(),
16469
+ settings: record(string(), unknown()).readonly()
16470
+ }))), method(object({ steps: record(string(), object({
16471
+ modelId: string(),
16472
+ settings: record(string(), unknown()).readonly()
16473
+ })) }), object({ success: literal(true) }), {
16474
+ kind: "mutation",
16475
+ auth: "admin"
16476
+ }), method(object({ nodeId: string() }), object({
16477
+ success: literal(true),
16478
+ clearedDevices: number()
16479
+ }), {
16480
+ kind: "mutation",
16481
+ auth: "admin"
16482
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16483
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16484
+ deviceKey: string(),
16536
16485
  /**
16537
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16538
- * `zones` capability.
16539
- *
16540
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16541
- * and no card can render — so every free-text search surface was structurally
16542
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16543
- * just returned nothing. Resolving here rather than in each client keeps ONE
16544
- * derivation and costs the clients no extra call (the `zones` cap is
16545
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16546
- * surface built to avoid exactly that).
16547
- *
16548
- * Resolved, never invented: a zone deleted since the track was written has no
16549
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16550
- * two are not positionally aligned. Absent when the track visited no zone, or
16551
- * when the zone catalogue could not be read.
16486
+ * `failed` — the per-device restart budget is exhausted; no pool
16487
+ * will be spawned until an operator re-arms it or the runner
16488
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16489
+ * a cached pool observed dead and not yet condemned).
16552
16490
  */
16553
- zoneNames: array(string()).readonly().optional(),
16554
- /** Deduplicated set of detector classes observed for this track over its
16555
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16556
- * legacy rows written before class accumulation shipped. */
16557
- classes: array(string()).readonly().optional(),
16558
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16559
- totalDistance: number(),
16560
- state: TrackStateSchema,
16561
- active: boolean(),
16562
- /** Deterministic key-event importance score in [0,1] (server-computed at
16563
- * track expiry, recomputed on late label). Absent on legacy rows written
16564
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16565
- importance: number().optional(),
16566
- /** Id of the track's highest-confidence ObjectEvent (its representative
16567
- * "best" frame). Absent when the track produced no object events. */
16568
- bestEventId: string().optional(),
16569
- /** Tag of the importance sub-signal that dominated the score
16570
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16571
- importanceReason: string().optional(),
16572
- /** Audio-classification labels heard on the camera during the track's
16573
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16574
- * Absent on legacy rows / tracks with no confident audio. */
16575
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16576
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16577
- * Populated from the persisted envelope columns on historical reads;
16578
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16579
- envelope: TrackEnvelopeSchema.optional(),
16491
+ state: _enum(["failed", "backoff"]),
16492
+ /** Epoch ms of the death that produced this state. */
16493
+ since: number(),
16494
+ /** Pool deaths inside the current window. */
16495
+ deaths: number(),
16496
+ /** The last death's message. */
16497
+ lastError: string()
16498
+ })).readonly() })), method(object({
16499
+ nodeId: string(),
16500
+ deviceKey: string()
16501
+ }), object({ rearmed: boolean() }), {
16502
+ kind: "mutation",
16503
+ auth: "admin"
16504
+ }), 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({
16505
+ name: string(),
16506
+ steps: array(PipelineTemplateStepSchema).readonly(),
16507
+ engine: PipelineEngineChoiceSchema
16508
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16509
+ id: string(),
16510
+ name: string().optional(),
16511
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16512
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16513
+ addonId: string(),
16514
+ modelId: string(),
16515
+ format: ModelFormatSchema$1
16516
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16517
+ addonId: string(),
16518
+ modelId: string(),
16519
+ format: ModelFormatSchema$1
16520
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16521
+ engine: PipelineEngineChoiceSchema.optional(),
16522
+ steps: array(PipelineStepInputSchema).min(1),
16523
+ frame: FrameInputSchema.optional(),
16580
16524
  /**
16581
- * A face DETECTOR found a face on this track — nothing more. It says the
16582
- * detail plane produced a `face` detail; it does NOT say the face was
16583
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16584
- * enabled. Set once and never cleared.
16585
- *
16586
- * **This exists so "face present but not recognised" is expressible.** A
16587
- * recognised identity lands in `subLabel` (attributed to the face chain via
16588
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16589
- * and a track with no face at all were byte-identical on the wire and no
16590
- * surface could tell them apart. The read is `hasFace === true && subLabel
16591
- * === undefined`.
16592
- *
16593
- * **Absent ≠ false.** Every row written before the column existed omits it,
16594
- * and so does every server that predates the field — a consumer must test
16595
- * `=== true` and render nothing otherwise, never infer "no face".
16525
+ * Process-local lazy frame. Valid only when caller and provider resolve
16526
+ * in the same execution-group process; split/cross-node callers use
16527
+ * `frame`/`image` inline compatibility instead.
16596
16528
  */
16597
- hasFace: boolean().optional(),
16529
+ frameRef: FrameRefSchema.optional(),
16598
16530
  /**
16599
- * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
16600
- * face an operator could ASSIGN to an identity.
16601
- *
16602
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16603
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16604
- * branch, before every gate, and means no more than "a face detector produced
16605
- * a face detail". This one is stamped at the single moment the gallery row
16606
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16607
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16608
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16609
- * the crop-store drop. Everything between the detector and that insert can
16610
- * legitimately refuse the face, so a flag written any earlier promises the
16611
- * operator something to assign and delivers nothing.
16612
- *
16613
- * **Independent of recognition.** A face collected but never auto-matched is
16614
- * still assignable — it is in fact the face an operator most wants to reach —
16615
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16616
- * `subLabel`; this says only that the raw material exists.
16617
- *
16618
- * **Set once, never cleared.** A track that produced a gallery row produced
16619
- * one; deleting the row later is the gallery's business, not this flag's.
16620
- *
16621
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16622
- * before the column omits it, and so does every server that predates the
16623
- * field. A consumer must test `=== true` and render nothing otherwise —
16624
- * never infer "no assignable face".
16531
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
16532
+ * the decoded pixels live in. One more member of the one-of
16533
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16625
16534
  */
16626
- hasEmbeddedFace: boolean().optional(),
16535
+ frameHandle: FrameHandleSchema.optional(),
16536
+ imageBase64: string().optional(),
16627
16537
  /**
16628
- * This subject CONTAINS a folded rider — a person the rider-pairing step
16629
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16630
- * so the passage is tracked once and as a VEHICLE.
16631
- *
16632
- * It exists because the fold's record was dishonest. D34 and the code both
16633
- * said "the person is not lost — it is reported so both entities stay on the
16634
- * record"; in fact the pair went into a per-processor RAM field behind an
16635
- * accessor nobody called, and every durable surface said `vehicle`, full
16636
- * stop. This is the composition note that makes the row true.
16637
- *
16638
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16639
- * person" is not an answer to "what is this" — both label tiers would refuse
16640
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16641
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16642
- * and a `person` rule still does not fire for someone cycling past.
16643
- *
16644
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16645
- * the column, and every hub that predates the field, omits it. Test
16646
- * `=== true` and render nothing otherwise — never infer "no rider".
16538
+ * Binary JPEG bytes — preferred over `imageBase64` on internal
16539
+ * hops (hub → forked worker via Moleculer MsgPack) because it
16540
+ * skips the 33% base64 overhead + the per-call base64 decode on
16541
+ * the detection-pipeline worker. Callers can pass either; exactly
16542
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16647
16543
  */
16648
- hasRider: boolean().optional(),
16649
- ...TrackFlagFields,
16650
- ...TrackRetrainFields
16651
- });
16652
- var BaseEventFields = {
16653
- id: string(),
16654
- deviceId: number(),
16655
- timestamp: number()
16656
- };
16657
- var MotionEventSchema = object({
16658
- ...BaseEventFields,
16659
- kind: literal("motion"),
16660
- regionCount: number(),
16661
- /** Heavy JSON array — omitted in slim projection. */
16662
- regions: array(object({
16663
- bbox: BoundingBoxSchema,
16664
- pixelCount: number(),
16665
- intensity: number()
16666
- })).readonly().optional(),
16667
- /** Omitted in slim projection. */
16668
- frameWidth: number().optional(),
16669
- /** Omitted in slim projection. */
16670
- frameHeight: number().optional(),
16671
- /** Populated by B5 (recording playback URL for this event). */
16672
- mediaUrl: string().optional()
16673
- });
16544
+ image: _instanceof(Uint8Array).optional(),
16545
+ referenceImage: string().optional(),
16546
+ deviceId: number().optional(),
16547
+ sessionId: string().optional(),
16548
+ /**
16549
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16550
+ * reference-image, and detail-subtree calls. 'frame' is the live
16551
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16552
+ * (inputClasses ≠ null) are skipped and served per-track via
16553
+ * pipelineRunner.runDetailSubtree (two-plane design).
16554
+ */
16555
+ plane: _enum(["full", "frame"]).optional(),
16556
+ /**
16557
+ * Inference-device selector (Phase 2 multi-device). Format
16558
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16559
+ * Omitted ⇒ the runner's default device (current single-engine
16560
+ * behaviour). Selects WHICH device pool of the node runs the call.
16561
+ */
16562
+ deviceKey: string().optional(),
16563
+ /**
16564
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16565
+ * when the parent crop was resolved from the frame's retained NATIVE
16566
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16567
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16568
+ * resolution from that surface — the SAME quality path faces already
16569
+ * had — instead of the downscaled parent tile. `handle` keys the native
16570
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16571
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16572
+ * the executor's crop-normalized child ROI back into frame-normalized
16573
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16574
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16575
+ * (today's behaviour on the fallback path).
16576
+ */
16577
+ nativeCropRef: NativeCropRefSchema.optional()
16578
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16579
+ engine: PipelineEngineChoiceSchema.optional(),
16580
+ steps: array(PipelineStepInputSchema).min(1),
16581
+ frames: array(FrameInputSchema).min(1).max(255),
16582
+ deviceId: number().optional(),
16583
+ sessionId: string().optional(),
16584
+ /**
16585
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16586
+ * the batch to the Python pool's bench preprocess cache
16587
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16588
+ * preprocessed ONCE and every later inference is a pure-inference cache
16589
+ * hit — the sustained-throughput run measures inference, not
16590
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16591
+ * full preprocess every call, correct). Fresh per sustained run;
16592
+ * released via `uncacheFrame`.
16593
+ */
16594
+ frameId: number().int().nonnegative().optional(),
16595
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16596
+ deviceKey: string().optional()
16597
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16598
+ data: _instanceof(Uint8Array),
16599
+ width: number().int().positive(),
16600
+ height: number().int().positive(),
16601
+ format: _enum([
16602
+ "rgb",
16603
+ "bgr",
16604
+ "gray"
16605
+ ])
16606
+ }), object({
16607
+ frameId: number(),
16608
+ width: number(),
16609
+ height: number()
16610
+ }), { kind: "mutation" }), method(object({
16611
+ stepId: string(),
16612
+ frameId: number().int()
16613
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16614
+ batchMode: string(),
16615
+ windowMs: number(),
16616
+ maxBatchSize: number(),
16617
+ concurrency: number()
16618
+ })), method(_void(), array(object({
16619
+ engineKey: string(),
16620
+ engine: PipelineEngineChoiceSchema,
16621
+ modelsLoaded: array(string()).readonly(),
16622
+ inUseByCameras: array(number()).readonly(),
16623
+ /**
16624
+ * Origin of this resident factory.
16625
+ * - `runtime` — main camera-serving engine (no idle TTL).
16626
+ * - `warm-override` — benchmark/test override held in the warm
16627
+ * cache; auto-disposed after the idle TTL.
16628
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16629
+ * multi-device, keyed by `deviceKey`) resolved
16630
+ * via `resolveDeviceFactory`. Runs alongside the
16631
+ * `runtime` engine on a DIFFERENT accelerator
16632
+ * (NPU / iGPU / Coral) — this is how the
16633
+ * Engines tab shows all pools running at once.
16634
+ */
16635
+ kind: _enum([
16636
+ "runtime",
16637
+ "warm-override",
16638
+ "device-pool"
16639
+ ]),
16640
+ /** Native pid of the underlying Python pool (null when no pool). */
16641
+ poolPid: number().nullable(),
16642
+ /** ms since this factory was last used (null when not warm-tracked). */
16643
+ idleMs: number().nullable(),
16644
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16645
+ idleTtlMs: number().nullable()
16646
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16647
+ kind: "mutation",
16648
+ auth: "admin"
16649
+ }), method(object({
16650
+ engine: PipelineEngineChoiceSchema,
16651
+ force: boolean().optional()
16652
+ }), object({
16653
+ success: boolean(),
16654
+ reason: string().optional()
16655
+ }), {
16656
+ kind: "mutation",
16657
+ auth: "admin"
16658
+ }), 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({
16659
+ addonId: string(),
16660
+ modelId: string(),
16661
+ filename: string().optional(),
16662
+ settings: record(string(), unknown()).optional()
16663
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16674
16664
  /**
16675
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16676
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16677
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16678
- * tracking, per-kind persistence) but stay distinguishable so consumers
16679
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16680
- * Absent on legacy rows ⇒ treat as `pipeline`.
16665
+ * Per-stage gating mode applied to the zones a rule references.
16666
+ *
16667
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16668
+ * When at least one `include` rule fires for a stage, only entities
16669
+ * inside one of those zones pass that stage.
16670
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16671
+ * Entities inside one of those zones are dropped at that stage.
16672
+ *
16673
+ * `monitor`-style observation (count without filtering) is not a rule
16674
+ * mode — zones without any matching rule are observed naturally by
16675
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16676
+ * count, not filter" use case needs no rule at all.
16681
16677
  */
16682
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16678
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16683
16679
  /**
16684
- * The confirmed zone crossing that produced an object event. Present ONLY on
16685
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16686
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16687
- * appearance event carry none, so a rule asking for a direction fails closed
16688
- * on them.
16680
+ * Per-consumer rule that references existing zones (geometry) and
16681
+ * defines how a specific pipeline stage should treat them. Each
16682
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16683
+ * settings:
16689
16684
  *
16690
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16691
- * into its own event, so a frame in which a track enters A while leaving B
16692
- * produces two events with two directions — never one ambiguous row.
16685
+ * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
16686
+ * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
16687
+ * - future: notification rules, audio gating, etc.
16693
16688
  *
16694
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16695
- * membership the box has NOW, and by definition it no longer contains the zone
16696
- * that was just left. Without the id here, a zone-scoped rule could never match
16697
- * the exit it asked for.
16689
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16690
+ * express "ignore motion in ALL of {garden, street}" with a single
16691
+ * rule. `classFilter` narrows the rule to specific object classes —
16692
+ * "drop person detections in the street, but keep cars" is one
16693
+ * `exclude` rule with `classFilter: ['person']`.
16694
+ *
16695
+ * `enabled` is a soft toggle — the operator can keep the rule
16696
+ * configured but inert without deleting it.
16698
16697
  */
16699
- var ZoneCrossingSchema = object({
16700
- direction: _enum(["enter", "exit"]),
16701
- /** Admin zone id crossed. */
16702
- zoneId: string(),
16703
- /** Zone display name at crossing time (falls back to the id). */
16704
- zoneName: string().optional()
16705
- });
16706
- var ObjectEventSchema = object({
16707
- ...BaseEventFields,
16708
- kind: literal("object"),
16709
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16710
- source: DetectionSourceSchema.optional(),
16698
+ var ZoneRuleSchema = object({
16699
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16700
+ id: string(),
16701
+ /** Optional human-readable label rendered in the rule editor. */
16702
+ name: string().optional(),
16703
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16704
+ * listed zones (OR-set: a detection in any one of them counts).
16705
+ * At least one zone id required — a rule with no targets is a
16706
+ * configuration mistake and the form validator rejects it. */
16707
+ zoneIds: array(string()).min(1).readonly(),
16708
+ mode: ZoneRuleModeEnum,
16711
16709
  /**
16712
- * Inference-frame id shared by every object event emitted from the SAME frame
16713
- * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16714
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16715
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16716
- * Optional for backward-compat with pre-existing rows / the slim projection
16717
- * includes it (it is light). Absent on rows written before this field.
16718
- */
16719
- frameId: string().optional(),
16720
- /** Omitted in slim projection. */
16721
- trackId: string().optional(),
16722
- className: string(),
16723
- ...TieredLabelFields,
16724
- /** Omitted in slim projection. */
16725
- confidence: number().optional(),
16726
- /** Heavy JSON — omitted in slim projection. */
16727
- bbox: BoundingBoxSchema.optional(),
16728
- /** Heavy JSON — omitted in slim projection. */
16729
- zones: array(string()).readonly().optional(),
16730
- /** Omitted in slim projection. */
16731
- state: TrackStateSchema.optional(),
16710
+ * Class names this rule applies to. Empty / undefined ⇒ rule
16711
+ * applies to every class. Class strings match the `macroClass`
16712
+ * field on detections (e.g. `person`, `car`, `dog`).
16713
+ */
16714
+ classFilter: array(string()).readonly().optional(),
16732
16715
  /**
16733
- * The zone crossing this event IS, when it is one. Absent on every other
16734
- * event kind (movement state, appearance, package) — see
16735
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16716
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16717
+ * required to consider an entity "in the zone". Defaults to the
16718
+ * consumer's stage default when omitted. Kept for back-compat with
16719
+ * existing per-rule overrides; new operators pick the value via
16720
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16721
+ * set, the lower-level engine reads it as a 0–1 fraction.
16736
16722
  */
16737
- zoneCrossing: ZoneCrossingSchema.optional(),
16738
- /** Detection-frame dimensions in pixels — let consumers normalize the
16739
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
16740
- frameWidth: number().optional(),
16741
- frameHeight: number().optional(),
16742
- /** MediaStore key for the crop attached to this event (if any). */
16743
- mediaKey: string().optional(),
16744
- /** Design B: MediaStore key of the track's native-resolution key frame (the
16745
- * best-detection full frame). Resolve via the event-media data-plane
16746
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
16747
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
16748
- * sources — consumers fall back to `mediaKey` (the tight crop). */
16749
- keyFrameMediaKey: string().optional(),
16750
- /** Populated by B5 (recording playback URL for this event). */
16751
- mediaUrl: string().optional(),
16752
- /** The parent track's key-event importance [0,1], propagated to every object
16753
- * event of the track (so an event row can be sorted by importance without a
16754
- * track join). Absent on legacy rows / before the track was scored. */
16755
- importance: number().optional()
16756
- });
16757
- var AudioEventSchema = object({
16758
- ...BaseEventFields,
16759
- kind: literal("audio"),
16760
- rms: number(),
16761
- dbfs: number(),
16762
- classification: object({
16763
- className: string(),
16764
- originalClass: string().optional(),
16765
- score: number()
16766
- }).optional(),
16767
- /** Populated by B5 (recording playback URL for this event). */
16768
- mediaUrl: string().optional()
16769
- });
16770
- var MediaFileKindEnum = _enum([
16771
- "crop",
16772
- "thumbnail",
16773
- "snapshot",
16774
- "firstFrame",
16775
- "lastFrame",
16776
- "fullFrame",
16777
- "fullFrameBoxed",
16778
- "faceCrop",
16779
- "plateCrop",
16780
- "keyFrame",
16781
- "keyFrameSmall",
16782
- "thumbnailSmall"
16783
- ]);
16784
- var MediaFileSchema = object({
16785
- key: string(),
16786
- kind: MediaFileKindEnum,
16787
- base64: string(),
16788
- sizeBytes: number(),
16789
- timestamp: number()
16723
+ overlapThreshold: number().min(0).max(1).optional(),
16724
+ /**
16725
+ * Operator-friendly version of `overlapThreshold` — the percentage
16726
+ * of the detection's bbox that must lie inside the zone for the
16727
+ * rule to match. Documented default is 85%; the engine substitutes
16728
+ * that when the field is omitted (kept optional so existing rules
16729
+ * stored without it stay valid).
16730
+ *
16731
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16732
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16733
+ * field exposed in the UI. Internally both feed the same gate.
16734
+ */
16735
+ bboxInclusionPct: number().min(0).max(100).optional(),
16736
+ /**
16737
+ * When `true` and a detection has a segmentation mask, use the
16738
+ * mask for overlap instead of the bbox. Detection-stage only;
16739
+ * motion rules ignore this field.
16740
+ */
16741
+ preferMask: boolean().optional(),
16742
+ /**
16743
+ * Soft-toggle: `false` disables the rule without deleting it.
16744
+ * Defaults to `true` so operators creating a rule via the UI
16745
+ * see it active immediately.
16746
+ */
16747
+ enabled: boolean().default(true)
16790
16748
  });
16749
+ array(ZoneRuleSchema).readonly();
16791
16750
  /**
16792
- * One media row WITHOUT its bytes.
16751
+ * Zone — pure geometry + identity. NO filtering behaviour.
16793
16752
  *
16794
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
16795
- * 140 s track), and a client that renders tiles from the media data plane needs
16796
- * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
16797
- * with an immutable cache, instead of all at once inside a tRPC response that
16798
- * blocks the whole view.
16753
+ * Zones describe **where** in the frame the operator wants to flag
16754
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16755
+ * each pipeline stage uses them. Splitting the two means a single
16756
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16757
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16758
+ * — without three duplicated polygons.
16799
16759
  *
16800
- * `sizeBytes` is carried because it is what lets a client decide between the
16801
- * stored blob and a `?variant=thumb` rendering without fetching either.
16760
+ * Owned by the orchestrator addon (provider) and mirrored into the
16761
+ * `zones` device-state slice on every mutation. Consumers
16762
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16763
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16764
+ * mirror with `onChanged`).
16765
+ *
16766
+ * Coordinates are normalised fractions of the frame (0–1) so zones
16767
+ * survive resolution changes and stream profile switches.
16768
+ *
16769
+ * `kind` discriminates between full polygons (closed regions used
16770
+ * for intrusion / occupancy filters) and tripwires (open 2-point
16771
+ * line segments used for cross events). Onboard / firmware-reported
16772
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
16773
+ * task list.
16802
16774
  */
16803
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
16775
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
16776
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
16777
+ var PolygonPointSchema = object({
16778
+ x: number(),
16779
+ y: number()
16780
+ });
16781
+ /** A camera detection zone — pure geometry/identity. */
16782
+ var ZoneSchema = object({
16783
+ id: string(),
16784
+ name: string(),
16785
+ kind: ZoneKindEnum.default("polygon"),
16786
+ /** Polygon vertices, fraction of frame (0–1). */
16787
+ polygon: array(PolygonPointSchema).readonly(),
16788
+ /** Visual color for UI rendering. */
16789
+ color: string().default("#3b82f6")
16790
+ });
16791
+ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
16792
+ deviceId: number(),
16793
+ zone: ZoneSchema
16794
+ }), _void(), {
16795
+ kind: "mutation",
16796
+ auth: "admin"
16797
+ }), method(object({
16798
+ deviceId: number(),
16799
+ zoneId: string()
16800
+ }), _void(), {
16801
+ kind: "mutation",
16802
+ auth: "admin"
16803
+ }), method(object({
16804
+ deviceId: number(),
16805
+ zone: ZoneSchema
16806
+ }), _void(), {
16807
+ kind: "mutation",
16808
+ auth: "admin"
16809
+ }), object({ zones: array(ZoneSchema).readonly() });
16804
16810
  /**
16805
- * The MACRO tier of an annotation — a CLOSED set.
16811
+ * pipeline-analytics — device-scoped wrapper cap. Refines raw
16812
+ * per-frame detections emitted by the pipeline runner into tracked
16813
+ * objects, per-kind event collections (motion / object / audio), and
16814
+ * persisted media. Owns the post-detection domain end-to-end:
16806
16815
  *
16807
- * This is what the exported detector predicts, so a typo here is a new class
16808
- * with one example in it. `label` and `subLabel` are open strings by contrast:
16809
- * the whole point of the page is teaching the model things it does not know
16810
- * yet, and constraining that vocabulary would make it useless.
16816
+ * runner emits PipelineInferenceResult
16817
+ * ↓ (event bus)
16818
+ * pipeline-analytics subscriber
16819
+ * ↓ SORT tracker + zone engine + state analyzer + event emitter
16820
+ * → three DB collections (one per kind), one FS media tree, one
16821
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
16822
+ * DetectionEvent on bus)
16811
16823
  *
16812
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
16813
- * `subLabel` is one of these values, in any casing, because once `person`
16814
- * exists in both tiers "every person box" stops being answerable without
16815
- * knowing every string anyone ever typed — and the damage is retroactive.
16824
+ * Pure subscriber model. No `processFrame` cap method — the runner
16825
+ * already publishes the raw frame on the bus. The cap surface is
16826
+ * only QUERIES + per-device settings, bound on/off via
16827
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
16828
+ * every camera with a detection pipeline wants its raw detections
16829
+ * refined; operators opt out per-device via BindingsTab when needed.
16830
+ *
16831
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16832
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
16816
16833
  */
16817
- var RetrainMacroClassSchema = _enum([
16834
+ var TrackStateSchema = _enum([
16835
+ "new",
16836
+ "entered",
16837
+ "left",
16838
+ "moving",
16839
+ "idle"
16840
+ ]);
16841
+ var EventKindSchema = _enum([
16842
+ "motion",
16843
+ "object",
16844
+ "audio"
16845
+ ]);
16846
+ /**
16847
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16848
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16849
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
16850
+ */
16851
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16852
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
16853
+ var EventKindIconSchema = _enum([
16854
+ "motion",
16855
+ "audio",
16818
16856
  "person",
16819
16857
  "vehicle",
16820
16858
  "animal",
16859
+ "door",
16860
+ "pir",
16861
+ "smoke",
16862
+ "water",
16863
+ "button",
16821
16864
  "package",
16822
- "face",
16823
- "plate"
16865
+ "generic"
16824
16866
  ]);
16825
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
16826
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
16827
- /** Did a human draw this box, or did the assist propose it? */
16828
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
16829
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
16830
- var RetrainBboxSchema = object({
16831
- x: number(),
16832
- y: number(),
16833
- w: number(),
16834
- h: number()
16835
- });
16836
- /**
16837
- * One annotated subject.
16838
- *
16839
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
16840
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
16841
- * derived from it at export and never stored — storing them is how one feature
16842
- * space ends up holding two crops of the same subject (D52).
16843
- */
16844
- var RetrainAnnotationSchema = object({
16845
- id: string(),
16846
- trackId: string(),
16847
- deviceId: number(),
16848
- /** The COPY in retrain storage — never the source track's media key. */
16849
- mediaKey: string(),
16850
- bbox: RetrainBboxSchema,
16851
- macroClass: RetrainMacroClassSchema,
16852
- label: string().optional(),
16853
- subLabel: string().optional(),
16854
- kind: RetrainAnnotationKindSchema,
16855
- source: RetrainAnnotationSourceSchema,
16856
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
16857
- assistModelId: string().optional(),
16858
- assistScore: number().optional(),
16859
- exportedInBatch: string().optional(),
16860
- createdAt: number()
16861
- });
16862
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
16863
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
16864
- id: true,
16865
- trackId: true,
16866
- deviceId: true,
16867
- mediaKey: true,
16868
- createdAt: true,
16869
- exportedInBatch: true
16867
+ var EventKindCategorySchema = _enum([
16868
+ "motion",
16869
+ "audio",
16870
+ "detection",
16871
+ "sensor",
16872
+ "control",
16873
+ "custom",
16874
+ "package"
16875
+ ]);
16876
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16877
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16878
+ var EventKindDescriptorSchema = object({
16879
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16880
+ kind: string(),
16881
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16882
+ labelKey: string(),
16883
+ /** English fallback label (kept for clients that don't translate). */
16884
+ label: string(),
16885
+ /** Hex color for timeline/legend rendering. */
16886
+ color: string(),
16887
+ /** Dictionary id → lucide component on the UI side. */
16888
+ iconId: string(),
16889
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16890
+ icon: EventKindIconSchema,
16891
+ category: EventKindCategorySchema,
16892
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16893
+ parentKind: string().nullable(),
16894
+ /** Derived from `parentKind`, explicit for the client tree. */
16895
+ level: EventKindLevelSchema,
16896
+ /** Which cap + device contributes this kind. For built-ins the camera
16897
+ * itself; for sensor kinds the LINKED source device. */
16898
+ source: object({
16899
+ capName: string(),
16900
+ deviceId: number()
16901
+ })
16870
16902
  });
16871
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
16872
- var RetrainTrackSchema = object({
16873
- trackId: string(),
16903
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16904
+ var EventKindsForDeviceSchema = object({
16874
16905
  deviceId: number(),
16875
- className: string(),
16876
- label: string().optional(),
16877
- firstSeen: number(),
16878
- lastSeen: number(),
16879
- /** How many frames the dataset already holds from this track. */
16880
- frameCount: number().int(),
16881
- /** How many subjects have been annotated on those frames. `0` with
16882
- * `frameCount: 0` is exactly "staging, still to work". */
16883
- annotationCount: number().int()
16884
- });
16885
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
16886
- var RetrainFrameCandidateSchema = object({
16887
- mediaKey: string(),
16888
- kind: MediaFileKindEnum,
16889
- timestamp: number(),
16890
- sizeBytes: number().int(),
16891
- /** A copy of this original already exists — selecting it is free and cannot
16892
- * fail, whatever became of the original. */
16893
- copied: boolean()
16906
+ kinds: array(EventKindDescriptorSchema).readonly()
16894
16907
  });
16895
- /** A frame the dataset OWNS: bytes copied at selection time. */
16896
- var RetrainFrameSchema = object({
16897
- frameId: string(),
16908
+ var SensorEventSchema = object({
16909
+ id: string(),
16910
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
16911
+ * yields N rows, one per camera). */
16898
16912
  deviceId: number(),
16899
- trackId: string(),
16900
- /** Provenance only. It may already point at nothing — that is expected. */
16901
- sourceMediaKey: string(),
16902
- sourceKind: MediaFileKindEnum,
16903
- sizeBytes: number().int(),
16904
- width: number().int(),
16905
- height: number().int(),
16906
- copiedAt: number()
16913
+ /** The linked sensor device whose state changed. */
16914
+ sourceDeviceId: number(),
16915
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
16916
+ kind: string(),
16917
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
16918
+ value: record(string(), unknown()).nullable(),
16919
+ timestamp: number()
16907
16920
  });
16908
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
16909
- var RetrainCopyRefusalSchema = _enum([
16910
- "source-missing",
16911
- "unreadable-image",
16912
- "write-failed"
16913
- ]);
16914
- var RetrainFrameSelectionSchema = object({
16915
- copied: array(RetrainFrameSchema).readonly(),
16916
- refused: array(object({
16917
- sourceMediaKey: string(),
16918
- reason: RetrainCopyRefusalSchema
16919
- })).readonly()
16921
+ var TrackPositionSchema = object({
16922
+ x: number(),
16923
+ y: number(),
16924
+ timestamp: number(),
16925
+ bbox: BoundingBoxSchema
16920
16926
  });
16921
- var RetrainFrameListSchema = object({
16922
- candidates: array(RetrainFrameCandidateSchema).readonly(),
16923
- copies: array(RetrainFrameSchema).readonly(),
16924
- /** What the page pre-selects — the native key frame when one survives. */
16925
- autoPickMediaKey: string().optional()
16927
+ var TrackSnapshotSchema = object({
16928
+ timestamp: number(),
16929
+ position: TrackPositionSchema,
16930
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16931
+ mediaKey: string()
16926
16932
  });
16927
- /** What the operator asked the assist to look for. */
16928
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
16929
- kind: literal("package"),
16930
- zone: RetrainBboxSchema.optional()
16931
- }), object({
16932
- kind: literal("objects"),
16933
- modelId: string(),
16934
- minScore: number().optional()
16935
- })]);
16936
16933
  /**
16937
- * The assist's answer — a discriminated union, because "the model saw nothing"
16938
- * and "this node cannot run that model" lead to different next moves and a
16939
- * nullable result cannot tell them apart.
16934
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16935
+ * divided by the track's detection-frame dims), computed at persist time.
16936
+ * Absent when the frame dims were unknown when the track was persisted
16937
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16940
16938
  */
16941
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
16942
- kind: literal("proposed"),
16943
- modelId: string(),
16944
- stepId: string(),
16945
- minScore: number(),
16946
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
16947
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
16948
- /** Returned by the runner but removed by the threshold. */
16949
- belowThreshold: number().int()
16950
- }), object({
16951
- kind: literal("refused"),
16952
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
16953
- reason: string(),
16954
- detail: string().optional()
16955
- })]);
16956
- /** The outcome of a lifecycle move owned by the retrain page. */
16957
- var RetrainTransitionResultSchema = object({
16958
- trackId: string(),
16959
- /** Where the track ended up, whatever happened. */
16960
- retrainStatus: RetrainStatusSchema,
16961
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
16962
- changed: boolean(),
16963
- reason: _enum([
16964
- "unknown-track",
16965
- "no-frames-copied",
16966
- "not-staging",
16967
- "not-trained",
16968
- "unchanged"
16969
- ]).optional()
16970
- });
16971
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
16972
- var MAX_EVENT_QUERY_LIMIT = 5e3;
16973
- var DeviceEventQueryInput = object({
16974
- deviceId: number(),
16975
- since: number().optional(),
16976
- until: number().optional(),
16977
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
16978
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
16979
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
16980
- * exact behaviour. Callers may omit this field — the store defaults to
16981
- * `full` when not provided. */
16982
- projection: _enum(["full", "slim"]).optional()
16983
- });
16984
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
16985
- var RecentTracksQueryInput = object({
16986
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
16987
- deviceIds: array(number()),
16988
- /** Window lower bound on `lastSeen` (inclusive). */
16989
- since: number().optional(),
16990
- /** Window upper bound on `lastSeen` (inclusive). */
16991
- until: number().optional(),
16992
- /** Page size. Default 200, max 1000. */
16993
- limit: number().int().min(1).max(1e3).default(200),
16994
- /** Opaque continuation cursor from a previous page's `nextCursor`.
16995
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16996
- cursor: string().optional(),
16997
- /** See {@link TrackProjectionSchema}. Default `full`. */
16998
- projection: TrackProjectionSchema.optional(),
16999
- /** Include stationary-promoted rows (parked objects). Default false: the
17000
- * feed lists passages; parking records live on the stationary registry. */
17001
- includeStationary: boolean().optional()
16939
+ var TrackEnvelopeSchema = object({
16940
+ minX: number(),
16941
+ minY: number(),
16942
+ maxX: number(),
16943
+ maxY: number()
17002
16944
  });
17003
- var RecentTracksPageSchema = object({
17004
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17005
- tracks: array(TrackSchema).readonly(),
17006
- /** Cursor for the next page, or null when this page is the last. */
17007
- nextCursor: string().nullable()
17008
- });
17009
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
17010
- var LIST_GROUPS_MAX_LIMIT = 100;
17011
- var AnalyticsGroupRecordSchema = object({
17012
- id: string(),
17013
- deviceId: number().int(),
17014
- openedAt: number().int(),
17015
- closedAt: number().int(),
17016
- timestamp: number().int(),
17017
- memberCount: number().int(),
17018
- memberTrackIds: array(string()).readonly(),
17019
- className: string(),
17020
- classes: array(string()).readonly(),
17021
- /** Relative event-media path, or null when the group has no picture yet. */
17022
- mediaUrl: string().nullable(),
17023
- singleton: boolean()
17024
- });
17025
- var AnalyticsGroupMemberSchema = object({
17026
- trackId: string(),
17027
- deviceId: number().int(),
17028
- className: string(),
17029
- firstSeen: number().int(),
17030
- lastSeen: number().int(),
17031
- mediaUrl: string().nullable()
17032
- });
17033
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17034
- var ListGroupsQueryInput = object({
17035
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17036
- deviceIds: array(number()),
17037
- /** Window lower bound on `closedAt` (inclusive). */
17038
- since: number().optional(),
17039
- /** Window upper bound on `openedAt` (inclusive). */
17040
- until: number().optional(),
17041
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17042
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
17043
- cursor: string().optional()
17044
- });
17045
- var ListGroupsPageSchema = object({
17046
- groups: array(AnalyticsGroupRecordSchema).readonly(),
17047
- nextCursor: string().nullable()
17048
- });
17049
- var KeyEventQueryInput = object({
17050
- deviceId: number(),
17051
- /** Window lower bound (track firstSeen ≥ since). */
17052
- since: number(),
17053
- /** Window upper bound (track firstSeen ≤ until). */
17054
- until: number(),
17055
- limit: number().int().min(1).max(200).default(50),
17056
- /** Drop tracks scoring below this importance. */
17057
- minImportance: number().min(0).max(1).optional(),
17058
- /** Restrict to a single class (e.g. 'person'). */
17059
- classFilter: string().optional()
17060
- });
17061
- var KeyEventSchema = object({
17062
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
17063
- id: string(),
17064
- trackId: string(),
17065
- /** Track start time (firstSeen). */
17066
- timestamp: number(),
17067
- className: string(),
17068
- ...TieredLabelFields,
17069
- importance: number(),
17070
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
17071
- bestEventId: string(),
17072
- /** Track lifetime in ms (lastSeen - firstSeen). */
17073
- windowMs: number().optional(),
17074
- ...TrackFlagFields,
17075
- ...TrackRetrainFields
17076
- });
17077
- object({
17078
- trackId: string(),
17079
- className: string(),
17080
- confidence: number(),
17081
- bbox: BoundingBoxSchema,
17082
- zones: array(string()).readonly(),
17083
- state: TrackStateSchema
17084
- });
17085
- var OverlayDetectionSchema = looseObject({
17086
- id: string(),
17087
- kind: _enum(["first-level", "detail"]),
17088
- macroClass: string(),
17089
- score: number(),
17090
- bbox: object({
17091
- x: number(),
17092
- y: number(),
17093
- width: number(),
17094
- height: number()
17095
- }),
17096
- labels: array(looseObject({
17097
- label: string(),
17098
- score: number()
17099
- })).readonly(),
17100
- parentId: string().optional()
17101
- });
17102
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17103
- var SearchObjectEventsInput = object({
17104
- text: string(),
17105
- deviceId: number().optional(),
17106
- since: number().optional(),
17107
- until: number().optional(),
17108
- classFilter: string().optional(),
17109
- limit: number().default(50),
17110
- minScore: number().min(0).max(1).default(.2)
17111
- });
17112
- var TrackCascadeCountsSchema = object({
17113
- /** Persisted track roots deleted (authoritative). */
17114
- tracks: number().int(),
17115
- /** Object events removed with their tracks (best-effort; see note above). */
17116
- events: number().int(),
17117
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17118
- media: number().int(),
17119
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17120
- faces: number().int(),
17121
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17122
- plates: number().int(),
17123
- /** Per-track CLIP search vectors removed (best-effort). */
17124
- embeddings: number().int(),
17125
- /** Group membership + group rows removed with their last member (best-effort). */
17126
- groups: number().int()
17127
- });
17128
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17129
- var DiskReconcileCountsSchema = object({
17130
- mediaDropped: number().int(),
17131
- tracks: number().int(),
17132
- events: number().int()
17133
- });
17134
- /** Event-store footprint for one camera. */
17135
- var EventStoreDeviceFootprintSchema = object({
17136
- deviceId: number(),
17137
- /** Persisted event rows (motion + object + audio) for the camera. */
17138
- rows: number().int(),
17139
- /** Event-owned media bytes on disk for the camera. */
17140
- bytes: number().int()
17141
- });
17142
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17143
- var EventStoreFootprintSchema = object({
17144
- totalRows: number().int(),
17145
- totalBytes: number().int(),
17146
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17147
- });
17148
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17149
- var EventPruneCountsSchema = object({
17150
- motion: number().int(),
17151
- object: number().int(),
17152
- audio: number().int()
16945
+ /**
16946
+ * Row projection for track list queries. `full` (default) returns the
16947
+ * complete Track including the frame-rate `positions[]` history and the
16948
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
16949
+ * keeps every scalar the list surfaces actually render (ids, class(es),
16950
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16951
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16952
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16953
+ * `getTrack`. Mirrors the event-store `projection` convention
16954
+ * (`getObjectEvents` et al.).
16955
+ */
16956
+ var TrackProjectionSchema = _enum(["full", "slim"]);
16957
+ /**
16958
+ * One audio-classification label heard on the track's camera while the
16959
+ * track was alive, aggregated per label. An "episode" is one persisted
16960
+ * audio event (the confident-classification path: score ≥ the device's
16961
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16962
+ * one 32 ms inference chunk, so counts stay human-scaled.
16963
+ */
16964
+ var TrackAudioLabelSchema = object({
16965
+ label: string(),
16966
+ /** Highest classification score observed across the label's episodes. */
16967
+ peakScore: number(),
16968
+ /** Number of coalesced audio-event episodes carrying this label. */
16969
+ count: number(),
16970
+ firstAt: number(),
16971
+ lastAt: number()
17153
16972
  });
17154
16973
  /**
17155
- * Re-embed stored tracks from their key frames.
16974
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16975
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16976
+ * no positions, a single snapshot, and no bbox trajectory at all:
17156
16977
  *
17157
- * The reason this is an operator-callable method and not a migration script:
17158
- * every knob that decides what a vector MEANS — encoder model, crop margin,
17159
- * squaring — is only changeable if the existing vectors can be regenerated.
17160
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17161
- * symptom is a quality regression with no visible cause.
16978
+ * - `sensor` — a linked sensor/control device state change.
16979
+ * - `audio` — an audio event on the camera itself that was anomalous for
16980
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
16981
+ *
16982
+ * The spatial subsystems (tracker association, occupancy count, re-id /
16983
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
16984
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16985
+ * check silently readmits every source added after it was written.
17162
16986
  */
17163
- var RebuildObjectEmbeddingsInput = object({
17164
- /** Restrict to one camera. Omit for the whole fleet. */
17165
- deviceId: number().optional(),
17166
- since: number().optional(),
17167
- until: number().optional(),
17168
- /** Stop after this many tracks; the result reports whether more remain. */
17169
- maxTracks: number().int().positive().optional(),
17170
- /**
17171
- * Run every embedding on THIS node instead of round-robining the fleet.
17172
- *
17173
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17174
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17175
- * calling it that would pin the rebuild REQUEST itself to that node — the
17176
- * rebuild orchestration lives on the hub, and only the per-track step runs
17177
- * remotely. This field is data; the per-track pin is applied inside.
17178
- *
17179
- * Absent ⇒ round-robin over every online node whose runner can serve the
17180
- * pinned model.
17181
- */
17182
- executeOnNodeId: string().optional(),
17183
- /**
17184
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17185
- * run flat out.
17186
- *
17187
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17188
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17189
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17190
- * force is logged at start and finish so a deliberately slow pass reads
17191
- * differently from a stalled one.
17192
- */
17193
- pacingMs: number().int().nonnegative().optional()
17194
- });
16987
+ var TrackSourceSchema = _enum([
16988
+ "pipeline",
16989
+ "sensor",
16990
+ "audio"
16991
+ ]);
17195
16992
  /**
17196
- * Result of emptying the CLIP index.
16993
+ * Where a track sits in the RETRAIN lifecycle (D81).
17197
16994
  *
17198
- * The clean slate before a policy change: a new crop margin or encoder model
17199
- * leaves two feature spaces in one index whose cosine scores are not
17200
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17201
- * means the same thing.
16995
+ * - `none` — never marked, or un-marked. Evictable.
16996
+ * - `staging` — the operator wants this track as training material and has not
16997
+ * finished with it. **This is the only state retention holds**: the track and
16998
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
16999
+ * the device's age window.
17000
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
17001
+ * were COPIED into the retrain dataset at selection time, so the dataset no
17002
+ * longer depends on the track's media and the track becomes EVICTABLE again.
17003
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
17004
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
17005
+ *
17006
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
17007
+ * the store's filter language has only positive equality and `whereIn` — no
17008
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
17009
+ * would make the entire pre-column history immortal in one deploy.
17202
17010
  */
17203
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17011
+ var RetrainStatusSchema = _enum([
17012
+ "none",
17013
+ "staging",
17014
+ "trained"
17015
+ ]);
17204
17016
  /**
17205
- * Acknowledgement that a rebuild STARTED.
17017
+ * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
17018
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
17019
+ * so the two surfaces cannot drift.
17206
17020
  *
17207
- * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17208
- * runs detached and this returns immediately. Waiting for it made the client
17209
- * time out while the work carried on server-side, which is the worst of both:
17210
- * no result and no way to know it was still going. Poll
17211
- * `getObjectEmbeddingRebuildStatus` for progress.
17021
+ * **Absent ≠ false.** A track that has never been touched omits the field; an
17022
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
17023
+ * columns existed read as absent, and a consumer that needs a boolean should say
17024
+ * `flag === true`, not `flag !== false`.
17025
+ *
17026
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
17027
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
17028
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
17029
+ * `trained` track reports `false` while refusing both writes. The boolean is
17030
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
17031
+ * "never marked" from "already trained" must read `retrainStatus`.
17032
+ *
17033
+ * `debug` does NOT pin; it is attention, not durability.
17034
+ *
17035
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17036
+ * A favourited track is skipped by retention the same way `staging` is, but
17037
+ * it does not enter `none|staging|trained` and has no staging budget.
17212
17038
  */
17213
- var RebuildObjectEmbeddingsResultSchema = object({
17214
- started: boolean(),
17215
- /** True when a pass was already running; the new request is ignored. */
17216
- alreadyRunning: boolean()
17217
- });
17218
- var RebuildStatusSchema = object({
17219
- running: boolean(),
17220
- scanned: number(),
17221
- rebuilt: number(),
17222
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17223
- missingKeyFrame: number(),
17224
- /** Tracks with no usable detection box. */
17225
- missingBbox: number(),
17226
- /**
17227
- * Tracks an executing node REFUSED rather than broke on — an unreadable key
17228
- * frame, a step that threw. Separate from `failed` because the remedy is
17229
- * different, and because a whole camera silently contributing zero vectors
17230
- * is the shape of failure a rebuild must never hide.
17231
- */
17232
- notRunnable: number(),
17039
+ var TrackFlagFields = {
17040
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
17041
+ * `'staging'`. */
17042
+ markForTrain: boolean().optional(),
17043
+ /** Operator marked this track for diagnostic attention. */
17044
+ debug: boolean().optional(),
17045
+ /** Operator favourited this track. Pins it against pruning. */
17046
+ favourited: boolean().optional()
17047
+ };
17048
+ /**
17049
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
17050
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
17051
+ * write patch, and the status is not something the toggle sets — it is what the
17052
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
17053
+ * always present on a persisted row (the column default materialises `'none'`).
17054
+ */
17055
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
17056
+ /**
17057
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
17058
+ * one flag can never clear the other — the toggles are independent and are
17059
+ * driven from three surfaces that do not know about each other.
17060
+ */
17061
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
17062
+ /**
17063
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
17064
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
17065
+ * mutation result without a re-fetch.
17066
+ */
17067
+ var TrackFlagsSchema = object({
17068
+ trackId: string(),
17069
+ markForTrain: boolean(),
17070
+ debug: boolean(),
17071
+ favourited: boolean(),
17072
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
17073
+ * a track row) because this shape is only ever produced by the write body,
17074
+ * which always knows it — and a surface that has just written needs to render
17075
+ * `trained` without a re-fetch. */
17076
+ retrainStatus: RetrainStatusSchema
17077
+ });
17078
+ union([literal(1), literal(2)]);
17079
+ /**
17080
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
17081
+ * the step and model that produced it — which is what makes the write rule
17082
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17083
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17084
+ *
17085
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17086
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17087
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
17088
+ * that value has no provenance, and the write rule lets ANY properly-attributed
17089
+ * write of the same tier replace it regardless of score.
17090
+ */
17091
+ var LabelAttributionSchema = object({
17092
+ stepId: string(),
17093
+ modelId: string().optional(),
17094
+ decidedAt: number(),
17233
17095
  /**
17234
- * The pass stopped because NO node could serve the pinned model.
17096
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
17097
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17235
17098
  *
17236
- * Distinct from `notRunnable` on purpose: that one says "this track was
17237
- * refused", this one says "the cluster cannot do this work at all" — every
17238
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17239
- * pinned model for its engine format, or dropped out. The remedy is a model /
17240
- * engine change, not a per-camera one. Non-zero here always comes with
17241
- * `complete: false`.
17099
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
17100
+ * notification rule authored on "Gianluca" stopped matching the moment the
17101
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
17102
+ * the thing that does not move, so it is what a rule matches on
17103
+ * (`NcConditions.identities`) and the text is what a human is shown.
17104
+ *
17105
+ * Absent when the label names no gallery row — a plate the OCR read but no
17106
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17242
17107
  */
17243
- noCapableNode: number(),
17244
- failed: number(),
17245
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17246
- complete: boolean().nullable(),
17247
- startedAtMs: number().nullable(),
17248
- finishedAtMs: number().nullable(),
17249
- /** Present when the pass ended by throwing. */
17250
- error: string().nullable()
17108
+ identityId: string().optional()
17251
17109
  });
17252
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17253
- deviceId: number(),
17254
- trackId: string()
17255
- }), TrackSchema.nullable()), method(object({
17256
- deviceId: number(),
17257
- since: number().optional(),
17258
- until: number().optional(),
17259
- limit: number().optional(),
17260
- /** Spatial filter — only tracks whose trajectory intersects the zone
17261
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17262
- * envelope columns, then precisely tested per position. Tracks with
17263
- * an unknown envelope (no frame dims at persist time) always match. */
17264
- zone: TrackZoneFilterSchema.optional(),
17265
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17266
- * compatible — omitting the field keeps today's exact behaviour). */
17267
- projection: TrackProjectionSchema.optional(),
17268
- /** Include stationary-promoted rows (parked objects handed to the
17269
- * stationary registry). Default false: the timeline lists passages,
17270
- * not parking records (operator decision, 2026-08-15). */
17271
- includeStationary: boolean().optional()
17272
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17273
- deviceId: number(),
17274
- groupId: string().min(1)
17275
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17276
- kind: "mutation",
17277
- auth: "admin"
17278
- }), 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({
17279
- deviceId: number(),
17280
- since: number().optional(),
17281
- until: number().optional(),
17282
- kinds: array(string()).optional(),
17283
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17284
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17285
- deviceId: number(),
17286
- since: number(),
17287
- until: number(),
17288
- bucketMs: number().int().positive()
17289
- }), array(object({
17290
- bucketStart: number(),
17291
- motion: number().int(),
17292
- object: number().int(),
17293
- audio: number().int()
17294
- })).readonly()), method(object({
17295
- deviceId: number(),
17296
- cutoffMs: number()
17297
- }), object({
17298
- motion: number().int(),
17299
- object: number().int(),
17300
- audio: number().int()
17301
- }), {
17302
- kind: "mutation",
17303
- auth: "admin"
17304
- }), method(object({
17305
- deviceId: number(),
17306
- cutoffMs: number()
17307
- }), TrackCascadeCountsSchema, {
17308
- kind: "mutation",
17309
- auth: "admin"
17310
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17311
- kind: "mutation",
17312
- auth: "admin"
17313
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17314
- kind: "mutation",
17315
- auth: "admin"
17316
- }), method(object({
17317
- deviceId: number(),
17318
- trackIds: array(string()).min(1)
17319
- }), object({
17320
- deleted: number().int(),
17321
- failed: array(string()).readonly()
17322
- }), {
17323
- kind: "mutation",
17324
- auth: "admin"
17325
- }), method(object({
17326
- /** Log/audit scope only — the trackId is globally unique on its own. */
17110
+ /**
17111
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17112
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17113
+ * track and its events always answer the same question the same way.
17114
+ *
17115
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17116
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17117
+ * is tier 2, and each carries its own score + attribution.
17118
+ *
17119
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17120
+ * finest thing known. Before 4g the single `label` column held the finest
17121
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17122
+ * shows nothing on a species-only row; that is why the migration puts every
17123
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17124
+ * and why the read surfaces were changed in the same train.
17125
+ *
17126
+ * **Writing it.** The slots are independent, which is the whole point: a
17127
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17128
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17129
+ * higher score wins. One rule, one implementation — see
17130
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17131
+ */
17132
+ var TieredLabelFields = {
17133
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
17134
+ label: string().optional(),
17135
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17136
+ labelScore: number().optional(),
17137
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17138
+ labelMeta: LabelAttributionSchema.optional(),
17139
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
17140
+ subLabel: string().optional(),
17141
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17142
+ subLabelScore: number().optional(),
17143
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17144
+ subLabelMeta: LabelAttributionSchema.optional()
17145
+ };
17146
+ /** Per-camera slice of a training-export estimate. */
17147
+ var TrainingExportDeviceTotalsSchema = object({
17327
17148
  deviceId: number(),
17149
+ tracks: number().int(),
17150
+ files: number().int(),
17151
+ bytes: number().int()
17152
+ });
17153
+ /**
17154
+ * What a training export WOULD contain. Computed from media index rows only —
17155
+ * no blob is read to produce this.
17156
+ */
17157
+ var TrainingExportSummarySchema = object({
17158
+ generatedAt: number(),
17159
+ trackCount: number().int(),
17160
+ fileCount: number().int(),
17161
+ byteCount: number().int(),
17162
+ /** More marked tracks exist than a single pass carries. */
17163
+ truncated: boolean(),
17164
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17165
+ });
17166
+ var TrackSchema = object({
17328
17167
  trackId: string(),
17329
- flags: TrackFlagsPatchSchema
17330
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17331
- kind: "query",
17332
- auth: "admin"
17333
- }), method(object({
17334
- olderThanMs: number(),
17335
- reason: OpsLogReasonSchema.optional()
17336
- }), EventPruneCountsSchema, {
17337
- kind: "mutation",
17338
- auth: "admin"
17339
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17340
- kind: "mutation",
17341
- auth: "admin"
17342
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17343
- kind: "mutation",
17344
- auth: "admin"
17345
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17346
- kind: "mutation",
17347
- auth: "admin"
17348
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17349
- kind: "mutation",
17350
- auth: "admin"
17351
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17352
- kind: "mutation",
17353
- auth: "admin"
17354
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17355
- kind: "mutation",
17356
- auth: "admin"
17357
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17358
- kind: "query",
17359
- auth: "admin"
17360
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17361
- kind: "query",
17362
- auth: "admin"
17363
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17364
- kind: "query",
17365
- auth: "admin"
17366
- }), method(object({
17367
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17368
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17369
- * route it at one camera's owner, and "every camera" would stop being
17370
- * expressible at all. */
17371
- deviceIds: array(number()).optional(),
17372
- limit: number().int().min(1).max(500).optional()
17373
- }), array(RetrainTrackSchema).readonly(), {
17374
- kind: "query",
17375
- auth: "admin"
17376
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17377
- kind: "query",
17378
- auth: "admin"
17379
- }), method(object({
17380
17168
  deviceId: number(),
17381
- trackId: string(),
17382
- mediaKeys: array(string()).min(1)
17383
- }), RetrainFrameSelectionSchema, {
17384
- kind: "mutation",
17385
- auth: "admin"
17386
- }), method(object({
17169
+ className: string(),
17170
+ ...TieredLabelFields,
17171
+ producingDeviceName: string().optional(),
17172
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17173
+ source: TrackSourceSchema.optional(),
17174
+ firstSeen: number(),
17175
+ lastSeen: number(),
17176
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17177
+ positions: array(TrackPositionSchema).readonly(),
17178
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17179
+ * saveThumbnails policy). */
17180
+ snapshots: array(TrackSnapshotSchema).readonly(),
17181
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17182
+ zonesVisited: array(string()).readonly(),
17183
+ /**
17184
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17185
+ * `zones` capability.
17186
+ *
17187
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17188
+ * and no card can render — so every free-text search surface was structurally
17189
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17190
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17191
+ * derivation and costs the clients no extra call (the `zones` cap is
17192
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17193
+ * surface built to avoid exactly that).
17194
+ *
17195
+ * Resolved, never invented: a zone deleted since the track was written has no
17196
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17197
+ * two are not positionally aligned. Absent when the track visited no zone, or
17198
+ * when the zone catalogue could not be read.
17199
+ */
17200
+ zoneNames: array(string()).readonly().optional(),
17201
+ /** Deduplicated set of detector classes observed for this track over its
17202
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17203
+ * legacy rows written before class accumulation shipped. */
17204
+ classes: array(string()).readonly().optional(),
17205
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17206
+ totalDistance: number(),
17207
+ state: TrackStateSchema,
17208
+ active: boolean(),
17209
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17210
+ * track expiry, recomputed on late label). Absent on legacy rows written
17211
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17212
+ importance: number().optional(),
17213
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17214
+ * "best" frame). Absent when the track produced no object events. */
17215
+ bestEventId: string().optional(),
17216
+ /** Tag of the importance sub-signal that dominated the score
17217
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17218
+ importanceReason: string().optional(),
17219
+ /** Audio-classification labels heard on the camera during the track's
17220
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17221
+ * Absent on legacy rows / tracks with no confident audio. */
17222
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17223
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17224
+ * Populated from the persisted envelope columns on historical reads;
17225
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17226
+ envelope: TrackEnvelopeSchema.optional(),
17227
+ /**
17228
+ * A face DETECTOR found a face on this track — nothing more. It says the
17229
+ * detail plane produced a `face` detail; it does NOT say the face was
17230
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17231
+ * enabled. Set once and never cleared.
17232
+ *
17233
+ * **This exists so "face present but not recognised" is expressible.** A
17234
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17235
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17236
+ * and a track with no face at all were byte-identical on the wire and no
17237
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17238
+ * === undefined`.
17239
+ *
17240
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17241
+ * and so does every server that predates the field — a consumer must test
17242
+ * `=== true` and render nothing otherwise, never infer "no face".
17243
+ */
17244
+ hasFace: boolean().optional(),
17245
+ /**
17246
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17247
+ * face an operator could ASSIGN to an identity.
17248
+ *
17249
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17250
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17251
+ * branch, before every gate, and means no more than "a face detector produced
17252
+ * a face detail". This one is stamped at the single moment the gallery row
17253
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17254
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17255
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17256
+ * the crop-store drop. Everything between the detector and that insert can
17257
+ * legitimately refuse the face, so a flag written any earlier promises the
17258
+ * operator something to assign and delivers nothing.
17259
+ *
17260
+ * **Independent of recognition.** A face collected but never auto-matched is
17261
+ * still assignable — it is in fact the face an operator most wants to reach —
17262
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17263
+ * `subLabel`; this says only that the raw material exists.
17264
+ *
17265
+ * **Set once, never cleared.** A track that produced a gallery row produced
17266
+ * one; deleting the row later is the gallery's business, not this flag's.
17267
+ *
17268
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17269
+ * before the column omits it, and so does every server that predates the
17270
+ * field. A consumer must test `=== true` and render nothing otherwise —
17271
+ * never infer "no assignable face".
17272
+ */
17273
+ hasEmbeddedFace: boolean().optional(),
17274
+ /**
17275
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17276
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17277
+ * so the passage is tracked once and as a VEHICLE.
17278
+ *
17279
+ * It exists because the fold's record was dishonest. D34 and the code both
17280
+ * said "the person is not lost — it is reported so both entities stay on the
17281
+ * record"; in fact the pair went into a per-processor RAM field behind an
17282
+ * accessor nobody called, and every durable surface said `vehicle`, full
17283
+ * stop. This is the composition note that makes the row true.
17284
+ *
17285
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17286
+ * person" is not an answer to "what is this" — both label tiers would refuse
17287
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17288
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17289
+ * and a `person` rule still does not fire for someone cycling past.
17290
+ *
17291
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17292
+ * the column, and every hub that predates the field, omits it. Test
17293
+ * `=== true` and render nothing otherwise — never infer "no rider".
17294
+ */
17295
+ hasRider: boolean().optional(),
17296
+ ...TrackFlagFields,
17297
+ ...TrackRetrainFields
17298
+ });
17299
+ var BaseEventFields = {
17300
+ id: string(),
17387
17301
  deviceId: number(),
17388
- trackId: string(),
17389
- frameId: string()
17390
- }), object({
17391
- removed: boolean(),
17392
- removedAnnotations: number().int()
17393
- }), {
17394
- kind: "mutation",
17395
- auth: "admin"
17396
- }), method(object({ frameId: string() }), object({
17302
+ timestamp: number()
17303
+ };
17304
+ var MotionEventSchema = object({
17305
+ ...BaseEventFields,
17306
+ kind: literal("motion"),
17307
+ regionCount: number(),
17308
+ /** Heavy JSON array — omitted in slim projection. */
17309
+ regions: array(object({
17310
+ bbox: BoundingBoxSchema,
17311
+ pixelCount: number(),
17312
+ intensity: number()
17313
+ })).readonly().optional(),
17314
+ /** Omitted in slim projection. */
17315
+ frameWidth: number().optional(),
17316
+ /** Omitted in slim projection. */
17317
+ frameHeight: number().optional(),
17318
+ /** Populated by B5 (recording playback URL for this event). */
17319
+ mediaUrl: string().optional()
17320
+ });
17321
+ /**
17322
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17323
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17324
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17325
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17326
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17327
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17328
+ */
17329
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17330
+ /**
17331
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17332
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17333
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17334
+ * appearance event carry none, so a rule asking for a direction fails closed
17335
+ * on them.
17336
+ *
17337
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17338
+ * into its own event, so a frame in which a track enters A while leaving B
17339
+ * produces two events with two directions — never one ambiguous row.
17340
+ *
17341
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17342
+ * membership the box has NOW, and by definition it no longer contains the zone
17343
+ * that was just left. Without the id here, a zone-scoped rule could never match
17344
+ * the exit it asked for.
17345
+ */
17346
+ var ZoneCrossingSchema = object({
17347
+ direction: _enum(["enter", "exit"]),
17348
+ /** Admin zone id crossed. */
17349
+ zoneId: string(),
17350
+ /** Zone display name at crossing time (falls back to the id). */
17351
+ zoneName: string().optional()
17352
+ });
17353
+ var ObjectEventSchema = object({
17354
+ ...BaseEventFields,
17355
+ kind: literal("object"),
17356
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17357
+ source: DetectionSourceSchema.optional(),
17358
+ /**
17359
+ * Inference-frame id shared by every object event emitted from the SAME frame
17360
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17361
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17362
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17363
+ * Optional for backward-compat with pre-existing rows / the slim projection
17364
+ * includes it (it is light). Absent on rows written before this field.
17365
+ */
17366
+ frameId: string().optional(),
17367
+ /** Omitted in slim projection. */
17368
+ trackId: string().optional(),
17369
+ className: string(),
17370
+ ...TieredLabelFields,
17371
+ /** Omitted in slim projection. */
17372
+ confidence: number().optional(),
17373
+ /** Heavy JSON — omitted in slim projection. */
17374
+ bbox: BoundingBoxSchema.optional(),
17375
+ /** Heavy JSON — omitted in slim projection. */
17376
+ zones: array(string()).readonly().optional(),
17377
+ /** Omitted in slim projection. */
17378
+ state: TrackStateSchema.optional(),
17379
+ /**
17380
+ * The zone crossing this event IS, when it is one. Absent on every other
17381
+ * event kind (movement state, appearance, package) — see
17382
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17383
+ */
17384
+ zoneCrossing: ZoneCrossingSchema.optional(),
17385
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17386
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17387
+ frameWidth: number().optional(),
17388
+ frameHeight: number().optional(),
17389
+ /** MediaStore key for the crop attached to this event (if any). */
17390
+ mediaKey: string().optional(),
17391
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17392
+ * best-detection full frame). Resolve via the event-media data-plane
17393
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17394
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17395
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17396
+ keyFrameMediaKey: string().optional(),
17397
+ /** Populated by B5 (recording playback URL for this event). */
17398
+ mediaUrl: string().optional(),
17399
+ /** The parent track's key-event importance [0,1], propagated to every object
17400
+ * event of the track (so an event row can be sorted by importance without a
17401
+ * track join). Absent on legacy rows / before the track was scored. */
17402
+ importance: number().optional()
17403
+ });
17404
+ var AudioEventSchema = object({
17405
+ ...BaseEventFields,
17406
+ kind: literal("audio"),
17407
+ rms: number(),
17408
+ dbfs: number(),
17409
+ classification: object({
17410
+ className: string(),
17411
+ originalClass: string().optional(),
17412
+ score: number()
17413
+ }).optional(),
17414
+ /** Populated by B5 (recording playback URL for this event). */
17415
+ mediaUrl: string().optional()
17416
+ });
17417
+ var MediaFileKindEnum = _enum([
17418
+ "crop",
17419
+ "thumbnail",
17420
+ "snapshot",
17421
+ "firstFrame",
17422
+ "lastFrame",
17423
+ "fullFrame",
17424
+ "fullFrameBoxed",
17425
+ "faceCrop",
17426
+ "plateCrop",
17427
+ "keyFrame",
17428
+ "keyFrameSmall",
17429
+ "thumbnailSmall"
17430
+ ]);
17431
+ var MediaFileSchema = object({
17432
+ key: string(),
17433
+ kind: MediaFileKindEnum,
17397
17434
  base64: string(),
17398
- width: number().int(),
17399
- height: number().int()
17400
- }), {
17401
- kind: "query",
17402
- auth: "admin"
17403
- }), method(object({
17404
- deviceId: number(),
17405
- trackId: string(),
17406
- frameId: string(),
17407
- subject: RetrainAssistSubjectSchema,
17408
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17409
- nodeId: string().optional()
17410
- }), RetrainAssistResultSchema, {
17411
- kind: "mutation",
17412
- auth: "admin"
17413
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17414
- kind: "query",
17415
- auth: "admin"
17416
- }), method(object({
17417
- deviceId: number(),
17418
- trackId: string(),
17419
- frameId: string(),
17420
- annotations: array(RetrainAnnotationDraftSchema)
17421
- }), array(RetrainAnnotationSchema).readonly(), {
17422
- kind: "mutation",
17423
- auth: "admin"
17424
- }), method(object({
17425
- deviceId: number(),
17426
- trackId: string()
17427
- }), RetrainTransitionResultSchema, {
17428
- kind: "mutation",
17429
- auth: "admin"
17430
- }), method(object({
17431
- deviceId: number(),
17432
- trackId: string()
17433
- }), RetrainTransitionResultSchema, {
17434
- kind: "mutation",
17435
- auth: "admin"
17436
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17437
- kind: "query",
17438
- auth: "admin"
17439
- }), method(object({
17440
- eventId: string(),
17441
- kind: MediaFileKindEnum.optional(),
17442
- deviceId: number()
17443
- }), array(MediaFileSchema).readonly()), method(object({
17444
- trackId: string(),
17445
- kinds: array(MediaFileKindEnum).optional(),
17446
- deviceId: number()
17447
- }), array(MediaFileSchema).readonly()), method(object({
17435
+ sizeBytes: number(),
17436
+ timestamp: number()
17437
+ });
17438
+ /**
17439
+ * One media row WITHOUT its bytes.
17440
+ *
17441
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17442
+ * 140 s track), and a client that renders tiles from the media data plane needs
17443
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17444
+ * with an immutable cache, instead of all at once inside a tRPC response that
17445
+ * blocks the whole view.
17446
+ *
17447
+ * `sizeBytes` is carried because it is what lets a client decide between the
17448
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17449
+ */
17450
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17451
+ /**
17452
+ * The MACRO tier of an annotation — a CLOSED set.
17453
+ *
17454
+ * This is what the exported detector predicts, so a typo here is a new class
17455
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17456
+ * the whole point of the page is teaching the model things it does not know
17457
+ * yet, and constraining that vocabulary would make it useless.
17458
+ *
17459
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17460
+ * `subLabel` is one of these values, in any casing, because once `person`
17461
+ * exists in both tiers "every person box" stops being answerable without
17462
+ * knowing every string anyone ever typed — and the damage is retroactive.
17463
+ */
17464
+ var RetrainMacroClassSchema = _enum([
17465
+ "person",
17466
+ "vehicle",
17467
+ "animal",
17468
+ "package",
17469
+ "face",
17470
+ "plate"
17471
+ ]);
17472
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17473
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17474
+ /** Did a human draw this box, or did the assist propose it? */
17475
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17476
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17477
+ var RetrainBboxSchema = object({
17478
+ x: number(),
17479
+ y: number(),
17480
+ w: number(),
17481
+ h: number()
17482
+ });
17483
+ /**
17484
+ * One annotated subject.
17485
+ *
17486
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17487
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17488
+ * derived from it at export and never stored — storing them is how one feature
17489
+ * space ends up holding two crops of the same subject (D52).
17490
+ */
17491
+ var RetrainAnnotationSchema = object({
17492
+ id: string(),
17448
17493
  trackId: string(),
17449
- deviceId: number()
17450
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17451
- kind: "mutation",
17452
- auth: "admin"
17453
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17454
- kind: "mutation",
17455
- auth: "admin"
17456
- }), method(object({}), RebuildStatusSchema), object({
17457
- deviceId: number(),
17458
- timestamp: number(),
17459
- frameWidth: number(),
17460
- frameHeight: number(),
17461
- detections: array(OverlayDetectionSchema).readonly()
17462
- }), object({
17463
17494
  deviceId: number(),
17495
+ /** The COPY in retrain storage — never the source track's media key. */
17496
+ mediaKey: string(),
17497
+ bbox: RetrainBboxSchema,
17498
+ macroClass: RetrainMacroClassSchema,
17499
+ label: string().optional(),
17500
+ subLabel: string().optional(),
17501
+ kind: RetrainAnnotationKindSchema,
17502
+ source: RetrainAnnotationSourceSchema,
17503
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17504
+ assistModelId: string().optional(),
17505
+ assistScore: number().optional(),
17506
+ exportedInBatch: string().optional(),
17507
+ createdAt: number()
17508
+ });
17509
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17510
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17511
+ id: true,
17512
+ trackId: true,
17513
+ deviceId: true,
17514
+ mediaKey: true,
17515
+ createdAt: true,
17516
+ exportedInBatch: true
17517
+ });
17518
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17519
+ var RetrainTrackSchema = object({
17464
17520
  trackId: string(),
17465
- className: string()
17466
- }), object({
17467
17521
  deviceId: number(),
17468
- trackId: string(),
17469
17522
  className: string(),
17470
- durationMs: number()
17471
- }), object({
17523
+ label: string().optional(),
17524
+ firstSeen: number(),
17525
+ lastSeen: number(),
17526
+ /** How many frames the dataset already holds from this track. */
17527
+ frameCount: number().int(),
17528
+ /** How many subjects have been annotated on those frames. `0` with
17529
+ * `frameCount: 0` is exactly "staging, still to work". */
17530
+ annotationCount: number().int()
17531
+ });
17532
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17533
+ var RetrainFrameCandidateSchema = object({
17534
+ mediaKey: string(),
17535
+ kind: MediaFileKindEnum,
17536
+ timestamp: number(),
17537
+ sizeBytes: number().int(),
17538
+ /** A copy of this original already exists — selecting it is free and cannot
17539
+ * fail, whatever became of the original. */
17540
+ copied: boolean()
17541
+ });
17542
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17543
+ var RetrainFrameSchema = object({
17544
+ frameId: string(),
17472
17545
  deviceId: number(),
17473
- kind: EventKindSchema,
17474
- eventId: string(),
17475
- timestamp: number()
17546
+ trackId: string(),
17547
+ /** Provenance only. It may already point at nothing — that is expected. */
17548
+ sourceMediaKey: string(),
17549
+ sourceKind: MediaFileKindEnum,
17550
+ sizeBytes: number().int(),
17551
+ width: number().int(),
17552
+ height: number().int(),
17553
+ copiedAt: number()
17554
+ });
17555
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17556
+ var RetrainCopyRefusalSchema = _enum([
17557
+ "source-missing",
17558
+ "unreadable-image",
17559
+ "write-failed"
17560
+ ]);
17561
+ var RetrainFrameSelectionSchema = object({
17562
+ copied: array(RetrainFrameSchema).readonly(),
17563
+ refused: array(object({
17564
+ sourceMediaKey: string(),
17565
+ reason: RetrainCopyRefusalSchema
17566
+ })).readonly()
17476
17567
  });
17568
+ var RetrainFrameListSchema = object({
17569
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17570
+ copies: array(RetrainFrameSchema).readonly(),
17571
+ /** What the page pre-selects — the native key frame when one survives. */
17572
+ autoPickMediaKey: string().optional()
17573
+ });
17574
+ /** What the operator asked the assist to look for. */
17575
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17576
+ kind: literal("package"),
17577
+ zone: RetrainBboxSchema.optional()
17578
+ }), object({
17579
+ kind: literal("objects"),
17580
+ modelId: string(),
17581
+ minScore: number().optional()
17582
+ })]);
17477
17583
  /**
17478
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17479
- * within the frame, so the executor can re-cut a leaf child ROI at native
17480
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17584
+ * The assist's answer — a discriminated union, because "the model saw nothing"
17585
+ * and "this node cannot run that model" lead to different next moves and a
17586
+ * nullable result cannot tell them apart.
17481
17587
  */
17482
- var NativeCropRefSchema = object({
17483
- /** Handle keying the retained native surface (node-pinned to its owner). */
17484
- handle: FrameHandleSchema,
17485
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17486
- cropFrameSpace: object({
17487
- x: number(),
17488
- y: number(),
17489
- w: number(),
17490
- h: number()
17491
- })
17588
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17589
+ kind: literal("proposed"),
17590
+ modelId: string(),
17591
+ stepId: string(),
17592
+ minScore: number(),
17593
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17594
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17595
+ /** Returned by the runner but removed by the threshold. */
17596
+ belowThreshold: number().int()
17597
+ }), object({
17598
+ kind: literal("refused"),
17599
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17600
+ reason: string(),
17601
+ detail: string().optional()
17602
+ })]);
17603
+ /** The outcome of a lifecycle move owned by the retrain page. */
17604
+ var RetrainTransitionResultSchema = object({
17605
+ trackId: string(),
17606
+ /** Where the track ended up, whatever happened. */
17607
+ retrainStatus: RetrainStatusSchema,
17608
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17609
+ changed: boolean(),
17610
+ reason: _enum([
17611
+ "unknown-track",
17612
+ "no-frames-copied",
17613
+ "not-staging",
17614
+ "not-trained",
17615
+ "unchanged"
17616
+ ]).optional()
17492
17617
  });
17493
- object({
17494
- crop: object({
17495
- left: number(),
17496
- top: number(),
17497
- width: number().positive(),
17498
- height: number().positive()
17499
- }).optional(),
17500
- content: object({
17501
- width: number().int().positive(),
17502
- height: number().int().positive()
17503
- }),
17504
- fit: _enum(["stretch", "contain"]),
17505
- format: _enum([
17506
- "rgb",
17507
- "gray",
17508
- "jpeg"
17509
- ])
17618
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17619
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17620
+ var DeviceEventQueryInput = object({
17621
+ deviceId: number(),
17622
+ since: number().optional(),
17623
+ until: number().optional(),
17624
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17625
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17626
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17627
+ * exact behaviour. Callers may omit this field — the store defaults to
17628
+ * `full` when not provided. */
17629
+ projection: _enum(["full", "slim"]).optional()
17510
17630
  });
17511
- var FrameRefSchema = object({
17512
- registryId: string().min(1),
17513
- id: string().min(1),
17514
- width: number().int().positive(),
17515
- height: number().int().positive(),
17516
- format: _enum(["rgb", "gray"]),
17517
- timestamp: number(),
17518
- capturedAt: number().optional()
17631
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17632
+ var RecentTracksQueryInput = object({
17633
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17634
+ deviceIds: array(number()),
17635
+ /** Window lower bound on `lastSeen` (inclusive). */
17636
+ since: number().optional(),
17637
+ /** Window upper bound on `lastSeen` (inclusive). */
17638
+ until: number().optional(),
17639
+ /** Page size. Default 200, max 1000. */
17640
+ limit: number().int().min(1).max(1e3).default(200),
17641
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17642
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17643
+ cursor: string().optional(),
17644
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17645
+ projection: TrackProjectionSchema.optional(),
17646
+ /** Include stationary-promoted rows (parked objects). Default false: the
17647
+ * feed lists passages; parking records live on the stationary registry. */
17648
+ includeStationary: boolean().optional()
17519
17649
  });
17520
- var ModelFormatSchema$1 = _enum([
17521
- "onnx",
17522
- "coreml",
17523
- "openvino",
17524
- "tflite",
17525
- "pt",
17526
- "gguf"
17527
- ]);
17528
- var PipelineSlotSchema = _enum([
17529
- "detector",
17530
- "cropper",
17531
- "classifier",
17532
- "refiner",
17533
- "audio-classifier"
17534
- ]);
17535
- var PipelineEngineChoiceSchema = object({
17536
- runtime: _enum(["node", "python"]),
17537
- backend: string(),
17538
- format: ModelFormatSchema$1,
17539
- device: string().optional()
17650
+ var RecentTracksPageSchema = object({
17651
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17652
+ tracks: array(TrackSchema).readonly(),
17653
+ /** Cursor for the next page, or null when this page is the last. */
17654
+ nextCursor: string().nullable()
17655
+ });
17656
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17657
+ var LIST_GROUPS_MAX_LIMIT = 100;
17658
+ var AnalyticsGroupRecordSchema = object({
17659
+ id: string(),
17660
+ deviceId: number().int(),
17661
+ openedAt: number().int(),
17662
+ closedAt: number().int(),
17663
+ timestamp: number().int(),
17664
+ memberCount: number().int(),
17665
+ memberTrackIds: array(string()).readonly(),
17666
+ className: string(),
17667
+ classes: array(string()).readonly(),
17668
+ /** Relative event-media path, or null when the group has no picture yet. */
17669
+ mediaUrl: string().nullable(),
17670
+ singleton: boolean()
17540
17671
  });
17541
- var AvailableEngineSchema = object({
17542
- engine: PipelineEngineChoiceSchema,
17543
- devices: array(object({
17544
- id: string(),
17545
- label: string(),
17546
- description: string().optional()
17547
- })).readonly(),
17548
- defaultDevice: string()
17672
+ var AnalyticsGroupMemberSchema = object({
17673
+ trackId: string(),
17674
+ deviceId: number().int(),
17675
+ className: string(),
17676
+ firstSeen: number().int(),
17677
+ lastSeen: number().int(),
17678
+ mediaUrl: string().nullable()
17549
17679
  });
17550
- var PipelineDefaultStepSchema = lazy(() => object({
17551
- addonId: string(),
17552
- addonName: string(),
17553
- slot: PipelineSlotSchema,
17554
- inputClasses: array(string()).readonly(),
17555
- outputClasses: array(string()).readonly(),
17556
- enabled: boolean(),
17557
- modelId: string(),
17558
- children: array(PipelineDefaultStepSchema).readonly(),
17559
- group: string().optional(),
17560
- settings: record(string(), unknown()).optional()
17561
- }));
17562
- var PipelineTemplateStepSchema = lazy(() => object({
17563
- addonId: string(),
17564
- enabled: boolean(),
17565
- modelId: string(),
17566
- children: array(PipelineTemplateStepSchema).readonly(),
17567
- settings: record(string(), unknown()).optional()
17568
- }));
17569
- var PipelineTemplateSchema$1 = object({
17570
- id: string(),
17571
- name: string(),
17572
- createdAt: string(),
17573
- updatedAt: string(),
17574
- engine: PipelineEngineChoiceSchema,
17575
- steps: array(PipelineTemplateStepSchema).readonly()
17680
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17681
+ var ListGroupsQueryInput = object({
17682
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17683
+ deviceIds: array(number()),
17684
+ /** Window lower bound on `closedAt` (inclusive). */
17685
+ since: number().optional(),
17686
+ /** Window upper bound on `openedAt` (inclusive). */
17687
+ until: number().optional(),
17688
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17689
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17690
+ cursor: string().optional()
17576
17691
  });
17577
- var PipelineModelOptionSchema = object({
17578
- id: string(),
17579
- name: string(),
17580
- formats: record(string(), object({
17581
- downloaded: boolean(),
17582
- sizeMB: number()
17583
- })),
17584
- group: ModelVariantGroupSchema.optional(),
17585
- legacy: boolean().optional(),
17586
- provider: ModelProviderIdSchema.optional()
17692
+ var ListGroupsPageSchema = object({
17693
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17694
+ nextCursor: string().nullable()
17587
17695
  });
17588
- var ConfigFieldBridge = custom();
17589
- var PipelineAddonSchemaSchema = object({
17590
- id: string(),
17591
- name: string(),
17592
- slot: PipelineSlotSchema,
17593
- inputClasses: array(string()).readonly(),
17594
- outputClasses: array(string()).readonly(),
17595
- childSlots: array(PipelineSlotSchema).readonly(),
17596
- models: array(PipelineModelOptionSchema).readonly(),
17597
- defaultModelId: string(),
17598
- defaultModelIdByFormat: record(string(), string()).optional(),
17599
- enabledByDefault: boolean().optional(),
17600
- backfillIntoExistingOverrides: boolean().optional(),
17601
- defaultConfidence: number(),
17602
- group: string().optional(),
17603
- configSchema: array(ConfigFieldBridge).readonly().optional()
17696
+ var KeyEventQueryInput = object({
17697
+ deviceId: number(),
17698
+ /** Window lower bound (track firstSeen ≥ since). */
17699
+ since: number(),
17700
+ /** Window upper bound (track firstSeen ≤ until). */
17701
+ until: number(),
17702
+ limit: number().int().min(1).max(200).default(50),
17703
+ /** Drop tracks scoring below this importance. */
17704
+ minImportance: number().min(0).max(1).optional(),
17705
+ /** Restrict to a single class (e.g. 'person'). */
17706
+ classFilter: string().optional()
17604
17707
  });
17605
- var PipelineSlotSchemaSchema = object({
17606
- id: PipelineSlotSchema,
17607
- label: string(),
17608
- priority: number(),
17609
- parentSlot: PipelineSlotSchema.nullable(),
17610
- addons: array(PipelineAddonSchemaSchema).readonly()
17708
+ var KeyEventSchema = object({
17709
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17710
+ id: string(),
17711
+ trackId: string(),
17712
+ /** Track start time (firstSeen). */
17713
+ timestamp: number(),
17714
+ className: string(),
17715
+ ...TieredLabelFields,
17716
+ importance: number(),
17717
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17718
+ bestEventId: string(),
17719
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17720
+ windowMs: number().optional(),
17721
+ ...TrackFlagFields,
17722
+ ...TrackRetrainFields
17611
17723
  });
17612
- var PipelineSchemaSchema = object({
17613
- availableEngines: array(AvailableEngineSchema).readonly(),
17614
- selectedEngine: PipelineEngineChoiceSchema,
17615
- slots: array(PipelineSlotSchemaSchema).readonly()
17724
+ object({
17725
+ trackId: string(),
17726
+ className: string(),
17727
+ confidence: number(),
17728
+ bbox: BoundingBoxSchema,
17729
+ zones: array(string()).readonly(),
17730
+ state: TrackStateSchema
17616
17731
  });
17617
- var EngineProvisioningSchema = object({
17618
- runtimeId: _enum([
17619
- "onnx",
17620
- "openvino",
17621
- "coreml",
17622
- "edgetpu"
17623
- ]).nullable(),
17624
- device: string().nullable(),
17625
- state: _enum([
17626
- "idle",
17627
- "installing",
17628
- "verifying",
17629
- "ready",
17630
- "failed"
17631
- ]),
17632
- progress: number().optional(),
17633
- error: string().optional(),
17634
- nextRetryAt: number().optional(),
17635
- /**
17636
- * Gate A (config-correctness gate at engine change): human-readable
17637
- * config issues surfaced EAGERLY when the node's engine changes — model
17638
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17639
- * has a <format> build"). Additive/optional: informational only, never
17640
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17641
- * Absent/empty when the node-default tree resolves cleanly.
17642
- */
17643
- configIssues: array(string()).optional()
17732
+ var OverlayDetectionSchema = looseObject({
17733
+ id: string(),
17734
+ kind: _enum(["first-level", "detail"]),
17735
+ macroClass: string(),
17736
+ score: number(),
17737
+ bbox: object({
17738
+ x: number(),
17739
+ y: number(),
17740
+ width: number(),
17741
+ height: number()
17742
+ }),
17743
+ labels: array(looseObject({
17744
+ label: string(),
17745
+ score: number()
17746
+ })).readonly(),
17747
+ parentId: string().optional()
17644
17748
  });
17645
- var PipelineStepInputSchema = lazy(() => object({
17646
- addonId: string(),
17647
- modelId: string().optional(),
17648
- enabled: boolean().default(true),
17649
- children: array(PipelineStepInputSchema).optional(),
17650
- settings: record(string(), unknown()).optional(),
17651
- jumpDeviceKey: string().optional()
17652
- }));
17653
- var ModelSubstitutionSchema = object({
17654
- addonId: string(),
17655
- chosen: string(),
17656
- running: string(),
17657
- format: string()
17749
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17750
+ var SearchObjectEventsInput = object({
17751
+ text: string(),
17752
+ deviceId: number().optional(),
17753
+ since: number().optional(),
17754
+ until: number().optional(),
17755
+ classFilter: string().optional(),
17756
+ limit: number().default(50),
17757
+ minScore: number().min(0).max(1).default(.2)
17658
17758
  });
17659
- var PipelineValidationIssueSchema = object({
17660
- addonId: string(),
17661
- kind: _enum(["unknown-addon", "no-format-build"]),
17662
- detail: string()
17759
+ var TrackCascadeCountsSchema = object({
17760
+ /** Persisted track roots deleted (authoritative). */
17761
+ tracks: number().int(),
17762
+ /** Object events removed with their tracks (best-effort; see note above). */
17763
+ events: number().int(),
17764
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17765
+ media: number().int(),
17766
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
17767
+ faces: number().int(),
17768
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17769
+ plates: number().int(),
17770
+ /** Per-track CLIP search vectors removed (best-effort). */
17771
+ embeddings: number().int(),
17772
+ /** Group membership + group rows removed with their last member (best-effort). */
17773
+ groups: number().int()
17663
17774
  });
17664
- var PipelineValidationResultSchema = object({
17665
- ok: boolean(),
17666
- issues: array(PipelineValidationIssueSchema).readonly(),
17667
- substitutions: array(ModelSubstitutionSchema).readonly(),
17668
- /** The node's `currentEngine.format` this validation ran against. */
17669
- format: string()
17775
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17776
+ var DiskReconcileCountsSchema = object({
17777
+ mediaDropped: number().int(),
17778
+ tracks: number().int(),
17779
+ events: number().int()
17670
17780
  });
17671
- var ReferenceImageEntrySchema = object({
17672
- filename: string(),
17673
- stepIds: array(string()).readonly().optional()
17781
+ /** Event-store footprint for one camera. */
17782
+ var EventStoreDeviceFootprintSchema = object({
17783
+ deviceId: number(),
17784
+ /** Persisted event rows (motion + object + audio) for the camera. */
17785
+ rows: number().int(),
17786
+ /** Event-owned media bytes on disk for the camera. */
17787
+ bytes: number().int()
17674
17788
  });
17675
- var ReferenceImageBodySchema = object({
17676
- base64: string(),
17677
- filename: string()
17789
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17790
+ var EventStoreFootprintSchema = object({
17791
+ totalRows: number().int(),
17792
+ totalBytes: number().int(),
17793
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
17678
17794
  });
17679
- var ReferenceAudioEntrySchema = object({
17680
- filename: string(),
17681
- sizeKb: number()
17795
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
17796
+ var EventPruneCountsSchema = object({
17797
+ motion: number().int(),
17798
+ object: number().int(),
17799
+ audio: number().int()
17682
17800
  });
17683
- var ReferenceAudioBodySchema = object({ base64: string() });
17684
- var AudioBackendSchema = object({
17685
- id: string(),
17686
- name: string(),
17687
- description: string(),
17688
- available: boolean(),
17801
+ /**
17802
+ * Re-embed stored tracks from their key frames.
17803
+ *
17804
+ * The reason this is an operator-callable method and not a migration script:
17805
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
17806
+ * squaring — is only changeable if the existing vectors can be regenerated.
17807
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
17808
+ * symptom is a quality regression with no visible cause.
17809
+ */
17810
+ var RebuildObjectEmbeddingsInput = object({
17811
+ /** Restrict to one camera. Omit for the whole fleet. */
17812
+ deviceId: number().optional(),
17813
+ since: number().optional(),
17814
+ until: number().optional(),
17815
+ /** Stop after this many tracks; the result reports whether more remain. */
17816
+ maxTracks: number().int().positive().optional(),
17689
17817
  /**
17690
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17691
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17692
- * the benchmark UI to populate the `enabledMicroClasses` filter
17693
- * specific to the selected backend without a separate fetch.
17818
+ * Run every embedding on THIS node instead of round-robining the fleet.
17819
+ *
17820
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17821
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17822
+ * calling it that would pin the rebuild REQUEST itself to that node — the
17823
+ * rebuild orchestration lives on the hub, and only the per-track step runs
17824
+ * remotely. This field is data; the per-track pin is applied inside.
17825
+ *
17826
+ * Absent ⇒ round-robin over every online node whose runner can serve the
17827
+ * pinned model.
17694
17828
  */
17695
- rawLabels: array(string()).readonly().optional()
17696
- });
17697
- var AudioCapabilitiesSchema = object({
17698
- activeBackend: string(),
17699
- availableBackends: array(AudioBackendSchema).readonly(),
17700
- sampleRate: number(),
17701
- chunkDurationMs: number()
17702
- });
17703
- var DownloadModelResultSchema = object({
17704
- filePath: string(),
17705
- sizeMB: number(),
17706
- durationMs: number()
17829
+ executeOnNodeId: string().optional(),
17830
+ /**
17831
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17832
+ * run flat out.
17833
+ *
17834
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
17835
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17836
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17837
+ * force is logged at start and finish so a deliberately slow pass reads
17838
+ * differently from a stalled one.
17839
+ */
17840
+ pacingMs: number().int().nonnegative().optional()
17707
17841
  });
17708
17842
  /**
17709
- * Wrapper carrying a single test run's result. Replaces the legacy
17710
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17711
- * canonical `AudioResult` from the Phase 6 output rework: one
17712
- * `AudioDetection` per class above `minScore`, top-N candidates in
17713
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17714
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17715
- * benchmark UI can still report a clean failure when the classifier
17716
- * cap isn't available.
17843
+ * Result of emptying the CLIP index.
17844
+ *
17845
+ * The clean slate before a policy change: a new crop margin or encoder model
17846
+ * leaves two feature spaces in one index whose cosine scores are not
17847
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
17848
+ * means the same thing.
17717
17849
  */
17718
- var AudioTestResultSchema = object({
17719
- success: boolean(),
17720
- error: string().optional(),
17721
- frame: custom().optional()
17850
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17851
+ /**
17852
+ * Acknowledgement that a rebuild STARTED.
17853
+ *
17854
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17855
+ * runs detached and this returns immediately. Waiting for it made the client
17856
+ * time out while the work carried on server-side, which is the worst of both:
17857
+ * no result and no way to know it was still going. Poll
17858
+ * `getObjectEmbeddingRebuildStatus` for progress.
17859
+ */
17860
+ var RebuildObjectEmbeddingsResultSchema = object({
17861
+ started: boolean(),
17862
+ /** True when a pass was already running; the new request is ignored. */
17863
+ alreadyRunning: boolean()
17722
17864
  });
17723
- var PipelineConfigBridge = custom();
17724
- var ConfigUISchemaBridge = custom();
17725
- var ConfigUISchemaNullableBridge = custom();
17726
- var InferenceCapabilitiesBridge = custom();
17727
- var ModelAvailabilityListBridge = custom();
17728
- var PipelineRunResultBridge = custom();
17729
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17730
- modelId: string(),
17731
- settings: record(string(), unknown()).readonly()
17732
- }))), method(object({ steps: record(string(), object({
17733
- modelId: string(),
17734
- settings: record(string(), unknown()).readonly()
17735
- })) }), object({ success: literal(true) }), {
17865
+ var RebuildStatusSchema = object({
17866
+ running: boolean(),
17867
+ scanned: number(),
17868
+ rebuilt: number(),
17869
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
17870
+ missingKeyFrame: number(),
17871
+ /** Tracks with no usable detection box. */
17872
+ missingBbox: number(),
17873
+ /**
17874
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
17875
+ * frame, a step that threw. Separate from `failed` because the remedy is
17876
+ * different, and because a whole camera silently contributing zero vectors
17877
+ * is the shape of failure a rebuild must never hide.
17878
+ */
17879
+ notRunnable: number(),
17880
+ /**
17881
+ * The pass stopped because NO node could serve the pinned model.
17882
+ *
17883
+ * Distinct from `notRunnable` on purpose: that one says "this track was
17884
+ * refused", this one says "the cluster cannot do this work at all" — every
17885
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
17886
+ * pinned model for its engine format, or dropped out. The remedy is a model /
17887
+ * engine change, not a per-camera one. Non-zero here always comes with
17888
+ * `complete: false`.
17889
+ */
17890
+ noCapableNode: number(),
17891
+ failed: number(),
17892
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
17893
+ complete: boolean().nullable(),
17894
+ startedAtMs: number().nullable(),
17895
+ finishedAtMs: number().nullable(),
17896
+ /** Present when the pass ended by throwing. */
17897
+ error: string().nullable()
17898
+ });
17899
+ var ReplayFrameInputSchema = object({
17900
+ timestamp: number(),
17901
+ frame: PipelineRunResultBridge
17902
+ });
17903
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
17904
+ className: string(),
17905
+ firstSeenMs: number(),
17906
+ lastSeenMs: number(),
17907
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
17908
+ * frame — a representative box for the diff's `(className, window, IoU)`
17909
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
17910
+ * trajectory production's `Track.positions` keeps. */
17911
+ bbox: BoundingBoxSchema,
17912
+ /** How many of the input frames this track matched a real detection on
17913
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
17914
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
17915
+ framesMatched: number().int()
17916
+ })).readonly() });
17917
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17918
+ deviceId: number(),
17919
+ trackId: string()
17920
+ }), TrackSchema.nullable()), method(object({
17921
+ deviceId: number(),
17922
+ since: number().optional(),
17923
+ until: number().optional(),
17924
+ limit: number().optional(),
17925
+ /** Spatial filter — only tracks whose trajectory intersects the zone
17926
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17927
+ * envelope columns, then precisely tested per position. Tracks with
17928
+ * an unknown envelope (no frame dims at persist time) always match. */
17929
+ zone: TrackZoneFilterSchema.optional(),
17930
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
17931
+ * compatible — omitting the field keeps today's exact behaviour). */
17932
+ projection: TrackProjectionSchema.optional(),
17933
+ /** Include stationary-promoted rows (parked objects handed to the
17934
+ * stationary registry). Default false: the timeline lists passages,
17935
+ * not parking records (operator decision, 2026-08-15). */
17936
+ includeStationary: boolean().optional()
17937
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17938
+ deviceId: number(),
17939
+ groupId: string().min(1)
17940
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17941
+ kind: "mutation",
17942
+ auth: "admin"
17943
+ }), 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({
17944
+ deviceId: number(),
17945
+ since: number().optional(),
17946
+ until: number().optional(),
17947
+ kinds: array(string()).optional(),
17948
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17949
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17950
+ deviceId: number(),
17951
+ since: number(),
17952
+ until: number(),
17953
+ bucketMs: number().int().positive()
17954
+ }), array(object({
17955
+ bucketStart: number(),
17956
+ motion: number().int(),
17957
+ object: number().int(),
17958
+ audio: number().int()
17959
+ })).readonly()), method(object({
17960
+ deviceId: number(),
17961
+ cutoffMs: number()
17962
+ }), object({
17963
+ motion: number().int(),
17964
+ object: number().int(),
17965
+ audio: number().int()
17966
+ }), {
17967
+ kind: "mutation",
17968
+ auth: "admin"
17969
+ }), method(object({
17970
+ deviceId: number(),
17971
+ cutoffMs: number()
17972
+ }), TrackCascadeCountsSchema, {
17973
+ kind: "mutation",
17974
+ auth: "admin"
17975
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17976
+ kind: "mutation",
17977
+ auth: "admin"
17978
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17979
+ kind: "mutation",
17980
+ auth: "admin"
17981
+ }), method(object({
17982
+ deviceId: number(),
17983
+ trackIds: array(string()).min(1)
17984
+ }), object({
17985
+ deleted: number().int(),
17986
+ failed: array(string()).readonly()
17987
+ }), {
17988
+ kind: "mutation",
17989
+ auth: "admin"
17990
+ }), method(object({
17991
+ /** Log/audit scope only — the trackId is globally unique on its own. */
17992
+ deviceId: number(),
17993
+ trackId: string(),
17994
+ flags: TrackFlagsPatchSchema
17995
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17996
+ kind: "query",
17997
+ auth: "admin"
17998
+ }), method(object({
17999
+ olderThanMs: number(),
18000
+ reason: OpsLogReasonSchema.optional()
18001
+ }), EventPruneCountsSchema, {
18002
+ kind: "mutation",
18003
+ auth: "admin"
18004
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
18005
+ kind: "mutation",
18006
+ auth: "admin"
18007
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18008
+ kind: "mutation",
18009
+ auth: "admin"
18010
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18011
+ kind: "mutation",
18012
+ auth: "admin"
18013
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
18014
+ kind: "mutation",
18015
+ auth: "admin"
18016
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
18017
+ kind: "mutation",
18018
+ auth: "admin"
18019
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18020
+ kind: "mutation",
18021
+ auth: "admin"
18022
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18023
+ kind: "mutation",
18024
+ auth: "admin"
18025
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18026
+ kind: "query",
18027
+ auth: "admin"
18028
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18029
+ kind: "mutation",
18030
+ auth: "admin"
18031
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
18032
+ kind: "query",
18033
+ auth: "admin"
18034
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
18035
+ kind: "query",
18036
+ auth: "admin"
18037
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18038
+ kind: "query",
18039
+ auth: "admin"
18040
+ }), method(object({
18041
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
18042
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
18043
+ * route it at one camera's owner, and "every camera" would stop being
18044
+ * expressible at all. */
18045
+ deviceIds: array(number()).optional(),
18046
+ limit: number().int().min(1).max(500).optional()
18047
+ }), array(RetrainTrackSchema).readonly(), {
18048
+ kind: "query",
18049
+ auth: "admin"
18050
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
18051
+ kind: "query",
18052
+ auth: "admin"
18053
+ }), method(object({
18054
+ deviceId: number(),
18055
+ trackId: string(),
18056
+ mediaKeys: array(string()).min(1)
18057
+ }), RetrainFrameSelectionSchema, {
17736
18058
  kind: "mutation",
17737
18059
  auth: "admin"
17738
- }), method(object({ nodeId: string() }), object({
17739
- success: literal(true),
17740
- clearedDevices: number()
18060
+ }), method(object({
18061
+ deviceId: number(),
18062
+ trackId: string(),
18063
+ frameId: string()
18064
+ }), object({
18065
+ removed: boolean(),
18066
+ removedAnnotations: number().int()
17741
18067
  }), {
17742
18068
  kind: "mutation",
17743
18069
  auth: "admin"
17744
- }), 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({
17745
- name: string(),
17746
- steps: array(PipelineTemplateStepSchema).readonly(),
17747
- engine: PipelineEngineChoiceSchema
17748
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17749
- id: string(),
17750
- name: string().optional(),
17751
- steps: array(PipelineTemplateStepSchema).readonly().optional()
17752
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17753
- addonId: string(),
17754
- modelId: string(),
17755
- format: ModelFormatSchema$1
17756
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17757
- addonId: string(),
17758
- modelId: string(),
17759
- format: ModelFormatSchema$1
17760
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17761
- engine: PipelineEngineChoiceSchema.optional(),
17762
- steps: array(PipelineStepInputSchema).min(1),
17763
- frame: FrameInputSchema.optional(),
17764
- /**
17765
- * Process-local lazy frame. Valid only when caller and provider resolve
17766
- * in the same execution-group process; split/cross-node callers use
17767
- * `frame`/`image` inline compatibility instead.
17768
- */
17769
- frameRef: FrameRefSchema.optional(),
17770
- /**
17771
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
17772
- * the decoded pixels live in. One more member of the one-of
17773
- * frame/frameHandle/image/imageBase64/referenceImage group.
17774
- */
17775
- frameHandle: FrameHandleSchema.optional(),
17776
- imageBase64: string().optional(),
17777
- /**
17778
- * Binary JPEG bytes — preferred over `imageBase64` on internal
17779
- * hops (hub → forked worker via Moleculer MsgPack) because it
17780
- * skips the 33% base64 overhead + the per-call base64 decode on
17781
- * the detection-pipeline worker. Callers can pass either; exactly
17782
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17783
- */
17784
- image: _instanceof(Uint8Array).optional(),
17785
- referenceImage: string().optional(),
17786
- deviceId: number().optional(),
17787
- sessionId: string().optional(),
17788
- /**
17789
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
17790
- * reference-image, and detail-subtree calls. 'frame' is the live
17791
- * per-frame dispatch: ONLY root-plane steps run; crop children
17792
- * (inputClasses ≠ null) are skipped and served per-track via
17793
- * pipelineRunner.runDetailSubtree (two-plane design).
17794
- */
17795
- plane: _enum(["full", "frame"]).optional(),
17796
- /**
17797
- * Inference-device selector (Phase 2 multi-device). Format
17798
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17799
- * Omitted ⇒ the runner's default device (current single-engine
17800
- * behaviour). Selects WHICH device pool of the node runs the call.
17801
- */
17802
- deviceKey: string().optional(),
17803
- /**
17804
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17805
- * when the parent crop was resolved from the frame's retained NATIVE
17806
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17807
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17808
- * resolution from that surface — the SAME quality path faces already
17809
- * had — instead of the downscaled parent tile. `handle` keys the native
17810
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17811
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17812
- * the executor's crop-normalized child ROI back into frame-normalized
17813
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17814
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17815
- * (today's behaviour on the fallback path).
17816
- */
17817
- nativeCropRef: NativeCropRefSchema.optional()
17818
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17819
- engine: PipelineEngineChoiceSchema.optional(),
17820
- steps: array(PipelineStepInputSchema).min(1),
17821
- frames: array(FrameInputSchema).min(1).max(255),
17822
- deviceId: number().optional(),
17823
- sessionId: string().optional(),
17824
- /**
17825
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17826
- * the batch to the Python pool's bench preprocess cache
17827
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17828
- * preprocessed ONCE and every later inference is a pure-inference cache
17829
- * hit — the sustained-throughput run measures inference, not
17830
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
17831
- * full preprocess every call, correct). Fresh per sustained run;
17832
- * released via `uncacheFrame`.
17833
- */
17834
- frameId: number().int().nonnegative().optional(),
17835
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17836
- deviceKey: string().optional()
17837
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17838
- data: _instanceof(Uint8Array),
17839
- width: number().int().positive(),
17840
- height: number().int().positive(),
17841
- format: _enum([
17842
- "rgb",
17843
- "bgr",
17844
- "gray"
17845
- ])
17846
- }), object({
17847
- frameId: number(),
17848
- width: number(),
17849
- height: number()
17850
- }), { kind: "mutation" }), method(object({
17851
- stepId: string(),
17852
- frameId: number().int()
17853
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17854
- batchMode: string(),
17855
- windowMs: number(),
17856
- maxBatchSize: number(),
17857
- concurrency: number()
17858
- })), method(_void(), array(object({
17859
- engineKey: string(),
17860
- engine: PipelineEngineChoiceSchema,
17861
- modelsLoaded: array(string()).readonly(),
17862
- inUseByCameras: array(number()).readonly(),
17863
- /**
17864
- * Origin of this resident factory.
17865
- * - `runtime` — main camera-serving engine (no idle TTL).
17866
- * - `warm-override` — benchmark/test override held in the warm
17867
- * cache; auto-disposed after the idle TTL.
17868
- * - `device-pool` — a concurrent per-device pool (Phase 2
17869
- * multi-device, keyed by `deviceKey`) resolved
17870
- * via `resolveDeviceFactory`. Runs alongside the
17871
- * `runtime` engine on a DIFFERENT accelerator
17872
- * (NPU / iGPU / Coral) — this is how the
17873
- * Engines tab shows all pools running at once.
17874
- */
17875
- kind: _enum([
17876
- "runtime",
17877
- "warm-override",
17878
- "device-pool"
17879
- ]),
17880
- /** Native pid of the underlying Python pool (null when no pool). */
17881
- poolPid: number().nullable(),
17882
- /** ms since this factory was last used (null when not warm-tracked). */
17883
- idleMs: number().nullable(),
17884
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17885
- idleTtlMs: number().nullable()
17886
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
18070
+ }), method(object({ frameId: string() }), object({
18071
+ base64: string(),
18072
+ width: number().int(),
18073
+ height: number().int()
18074
+ }), {
18075
+ kind: "query",
18076
+ auth: "admin"
18077
+ }), method(object({
18078
+ deviceId: number(),
18079
+ trackId: string(),
18080
+ frameId: string(),
18081
+ subject: RetrainAssistSubjectSchema,
18082
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18083
+ nodeId: string().optional()
18084
+ }), RetrainAssistResultSchema, {
17887
18085
  kind: "mutation",
17888
18086
  auth: "admin"
17889
18087
  }), method(object({
17890
- engine: PipelineEngineChoiceSchema,
17891
- force: boolean().optional()
17892
- }), object({
17893
- success: boolean(),
17894
- reason: string().optional()
17895
- }), {
18088
+ deviceId: number(),
18089
+ source: DetectionSourceSchema,
18090
+ zones: array(ZoneSchema).readonly().optional(),
18091
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
18092
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
18093
+ frames: array(ReplayFrameInputSchema).min(1)
18094
+ }), RunReplayFrameProcessorResultSchema, {
17896
18095
  kind: "mutation",
17897
18096
  auth: "admin"
17898
- }), 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({
17899
- addonId: string(),
17900
- modelId: string(),
17901
- filename: string().optional(),
17902
- settings: record(string(), unknown()).optional()
17903
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
18097
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
18098
+ kind: "query",
18099
+ auth: "admin"
18100
+ }), method(object({
18101
+ deviceId: number(),
18102
+ trackId: string(),
18103
+ frameId: string(),
18104
+ annotations: array(RetrainAnnotationDraftSchema)
18105
+ }), array(RetrainAnnotationSchema).readonly(), {
18106
+ kind: "mutation",
18107
+ auth: "admin"
18108
+ }), method(object({
18109
+ deviceId: number(),
18110
+ trackId: string()
18111
+ }), RetrainTransitionResultSchema, {
18112
+ kind: "mutation",
18113
+ auth: "admin"
18114
+ }), method(object({
18115
+ deviceId: number(),
18116
+ trackId: string()
18117
+ }), RetrainTransitionResultSchema, {
18118
+ kind: "mutation",
18119
+ auth: "admin"
18120
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18121
+ kind: "query",
18122
+ auth: "admin"
18123
+ }), method(object({
18124
+ eventId: string(),
18125
+ kind: MediaFileKindEnum.optional(),
18126
+ deviceId: number()
18127
+ }), array(MediaFileSchema).readonly()), method(object({
18128
+ trackId: string(),
18129
+ kinds: array(MediaFileKindEnum).optional(),
18130
+ deviceId: number()
18131
+ }), array(MediaFileSchema).readonly()), method(object({
18132
+ trackId: string(),
18133
+ deviceId: number()
18134
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18135
+ kind: "mutation",
18136
+ auth: "admin"
18137
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18138
+ kind: "mutation",
18139
+ auth: "admin"
18140
+ }), method(object({}), RebuildStatusSchema), object({
18141
+ deviceId: number(),
18142
+ timestamp: number(),
18143
+ frameWidth: number(),
18144
+ frameHeight: number(),
18145
+ detections: array(OverlayDetectionSchema).readonly()
18146
+ }), object({
18147
+ deviceId: number(),
18148
+ trackId: string(),
18149
+ className: string()
18150
+ }), object({
18151
+ deviceId: number(),
18152
+ trackId: string(),
18153
+ className: string(),
18154
+ durationMs: number()
18155
+ }), object({
18156
+ deviceId: number(),
18157
+ kind: EventKindSchema,
18158
+ eventId: string(),
18159
+ timestamp: number()
18160
+ });
17904
18161
  object({
17905
18162
  activeCameras: number(),
17906
18163
  throttledCameras: number(),
@@ -17926,66 +18183,6 @@ var CameraMetricsSchema = object({
17926
18183
  });
17927
18184
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
17928
18185
  /**
17929
- * Zone — pure geometry + identity. NO filtering behaviour.
17930
- *
17931
- * Zones describe **where** in the frame the operator wants to flag
17932
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
17933
- * each pipeline stage uses them. Splitting the two means a single
17934
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
17935
- * a detection-include rule on `['car']`, and an occupancy aggregate
17936
- * — without three duplicated polygons.
17937
- *
17938
- * Owned by the orchestrator addon (provider) and mirrored into the
17939
- * `zones` device-state slice on every mutation. Consumers
17940
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
17941
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
17942
- * mirror with `onChanged`).
17943
- *
17944
- * Coordinates are normalised fractions of the frame (0–1) so zones
17945
- * survive resolution changes and stream profile switches.
17946
- *
17947
- * `kind` discriminates between full polygons (closed regions used
17948
- * for intrusion / occupancy filters) and tripwires (open 2-point
17949
- * line segments used for cross events). Onboard / firmware-reported
17950
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17951
- * task list.
17952
- */
17953
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
17954
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17955
- var PolygonPointSchema = object({
17956
- x: number(),
17957
- y: number()
17958
- });
17959
- /** A camera detection zone — pure geometry/identity. */
17960
- var ZoneSchema = object({
17961
- id: string(),
17962
- name: string(),
17963
- kind: ZoneKindEnum.default("polygon"),
17964
- /** Polygon vertices, fraction of frame (0–1). */
17965
- polygon: array(PolygonPointSchema).readonly(),
17966
- /** Visual color for UI rendering. */
17967
- color: string().default("#3b82f6")
17968
- });
17969
- DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
17970
- deviceId: number(),
17971
- zone: ZoneSchema
17972
- }), _void(), {
17973
- kind: "mutation",
17974
- auth: "admin"
17975
- }), method(object({
17976
- deviceId: number(),
17977
- zoneId: string()
17978
- }), _void(), {
17979
- kind: "mutation",
17980
- auth: "admin"
17981
- }), method(object({
17982
- deviceId: number(),
17983
- zone: ZoneSchema
17984
- }), _void(), {
17985
- kind: "mutation",
17986
- auth: "admin"
17987
- }), object({ zones: array(ZoneSchema).readonly() });
17988
- /**
17989
18186
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
17990
18187
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
17991
18188
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -19673,7 +19870,7 @@ method(object({
19673
19870
  * linking rather than produce an eternal token.
19674
19871
  */
19675
19872
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19676
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
19873
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19677
19874
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19678
19875
  providerId: string().min(1),
19679
19876
  displayName: string().min(1),
@@ -19768,10 +19965,13 @@ var EvictResultSchema = object({
19768
19965
  /** True when the provider has nothing left it is willing to drop on this location. */
19769
19966
  exhausted: boolean()
19770
19967
  });
19771
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
19968
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19772
19969
  locationId: string(),
19773
19970
  targetBytes: number().int().positive()
19774
- }), EvictResultSchema, { kind: "mutation" });
19971
+ }), EvictResultSchema, {
19972
+ kind: "mutation",
19973
+ auth: "admin"
19974
+ });
19775
19975
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19776
19976
  kind: "mutation",
19777
19977
  auth: "admin"
@@ -19831,26 +20031,50 @@ var ReadChunkInputSchema = object({
19831
20031
  length: number()
19832
20032
  });
19833
20033
  var EndDownloadInputSchema = object({ downloadId: string() });
19834
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
20034
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19835
20035
  location: StorageLocationSchema,
19836
20036
  relativePath: string()
19837
- }), string()), method(object({
20037
+ }), string(), { auth: "admin" }), method(object({
19838
20038
  location: StorageLocationSchema,
19839
20039
  relativePath: string(),
19840
20040
  data: _instanceof(Uint8Array)
19841
- }), _void(), { kind: "mutation" }), method(object({
20041
+ }), _void(), {
20042
+ kind: "mutation",
20043
+ auth: "admin"
20044
+ }), method(object({
19842
20045
  location: StorageLocationSchema,
19843
20046
  relativePath: string()
19844
- }), _instanceof(Uint8Array)), method(object({
20047
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19845
20048
  location: StorageLocationSchema,
19846
20049
  relativePath: string()
19847
- }), boolean()), method(object({
20050
+ }), boolean(), { auth: "admin" }), method(object({
19848
20051
  location: StorageLocationSchema,
19849
20052
  prefix: string().optional()
19850
- }), array(string()).readonly()), method(object({
20053
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19851
20054
  location: StorageLocationSchema,
19852
20055
  relativePath: string()
19853
- }), _void(), { kind: "mutation" }), method(object({ location: StorageLocationSchema }), number().nullable()), method(BeginUploadInputSchema, BeginUploadResultSchema, { kind: "mutation" }), method(WriteChunkInputSchema, _void(), { kind: "mutation" }), method(FinalizeUploadInputSchema, _void(), { kind: "mutation" }), method(AbortUploadInputSchema, _void(), { kind: "mutation" }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, { kind: "mutation" }), method(ReadChunkInputSchema, _instanceof(Uint8Array)), method(EndDownloadInputSchema, _void(), { kind: "mutation" });
20056
+ }), _void(), {
20057
+ kind: "mutation",
20058
+ auth: "admin"
20059
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
20060
+ kind: "mutation",
20061
+ auth: "admin"
20062
+ }), method(WriteChunkInputSchema, _void(), {
20063
+ kind: "mutation",
20064
+ auth: "admin"
20065
+ }), method(FinalizeUploadInputSchema, _void(), {
20066
+ kind: "mutation",
20067
+ auth: "admin"
20068
+ }), method(AbortUploadInputSchema, _void(), {
20069
+ kind: "mutation",
20070
+ auth: "admin"
20071
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
20072
+ kind: "mutation",
20073
+ auth: "admin"
20074
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
20075
+ kind: "mutation",
20076
+ auth: "admin"
20077
+ });
19854
20078
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19855
20079
  var ProfileSettingsSchemaBridge = unknown().nullable();
19856
20080
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -20108,7 +20332,8 @@ method(object({
20108
20332
  access: "create"
20109
20333
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
20110
20334
  kind: "mutation",
20111
- access: "view"
20335
+ access: "view",
20336
+ auth: "admin"
20112
20337
  }), method(object({
20113
20338
  /** Required — the user the assertion belongs to (verified). */
20114
20339
  userId: string(),
@@ -20116,10 +20341,12 @@ method(object({
20116
20341
  response: record(string(), unknown())
20117
20342
  }), object({ verified: boolean() }), {
20118
20343
  kind: "mutation",
20119
- access: "view"
20344
+ access: "view",
20345
+ auth: "admin"
20120
20346
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
20121
20347
  kind: "mutation",
20122
- access: "view"
20348
+ access: "view",
20349
+ auth: "admin"
20123
20350
  }), method(object({
20124
20351
  /** AuthenticationResponseJSON from the browser. */
20125
20352
  response: record(string(), unknown()) }), object({
@@ -20127,7 +20354,8 @@ response: record(string(), unknown()) }), object({
20127
20354
  userId: string().nullable()
20128
20355
  }), {
20129
20356
  kind: "mutation",
20130
- access: "view"
20357
+ access: "view",
20358
+ auth: "admin"
20131
20359
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
20132
20360
  userId: string(),
20133
20361
  credentialId: string()
@@ -20299,7 +20527,19 @@ var VectorStatsResultSchema = object({
20299
20527
  /** False when the backend ranks approximately. */
20300
20528
  exact: boolean()
20301
20529
  });
20302
- method(VectorDeclareIndexInputSchema, _void(), { kind: "mutation" }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, { kind: "mutation" }), method(VectorQueryInputSchema, VectorQueryResultSchema), method(VectorGetInputSchema, VectorGetResultSchema), method(VectorDeleteInputSchema, VectorDeleteResultSchema, { kind: "mutation" }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, { kind: "mutation" }), method(VectorStatsInputSchema, VectorStatsResultSchema);
20530
+ method(VectorDeclareIndexInputSchema, _void(), {
20531
+ kind: "mutation",
20532
+ auth: "admin"
20533
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20534
+ kind: "mutation",
20535
+ auth: "admin"
20536
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20537
+ kind: "mutation",
20538
+ auth: "admin"
20539
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20540
+ kind: "mutation",
20541
+ auth: "admin"
20542
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20303
20543
  var ClipSchema = object({
20304
20544
  /** Opaque, provider-namespaced id. The default provider encodes the time
20305
20545
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -22022,7 +22262,27 @@ var MediaFileLiteSchema$1 = object({
22022
22262
  sizeBytes: number(),
22023
22263
  timestamp: number()
22024
22264
  });
22025
- method(_void(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22265
+ method(object({
22266
+ /**
22267
+ * Inline {@link IdentitySchema.coverBase64} on every row.
22268
+ *
22269
+ * Default `false`, the same inversion `listRecentFaces` and
22270
+ * `listPlates` took on 2026-08-25 (see `include-crops-default.ts` for
22271
+ * why the burden belongs on the caller that WANTS the bytes). Measured
22272
+ * on the live hub the same day: four identities cost 40,979 B with the
22273
+ * covers inline, ~10 KB of base64 per row, on a query this UI mounts
22274
+ * four times and the viewer holds at `staleTime: 30_000`.
22275
+ *
22276
+ * Nothing loses its avatar: `coverMediaKey` is already on every row and
22277
+ * the `event-media` plane serves that key `immutable` with an ETag.
22278
+ *
22279
+ * **This is an INPUT field, so it does not reach the addon until the
22280
+ * next train** — the hub router validates cap inputs against its own
22281
+ * compiled Zod and strips a key it does not know. Until then the
22282
+ * provider sees `undefined`, which resolves to `false`: the cheap shape
22283
+ * is what ships, and the opt-in becomes reachable when the train lands.
22284
+ */
22285
+ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22026
22286
  kind: "mutation",
22027
22287
  auth: "admin"
22028
22288
  }), method(object({
@@ -24169,8 +24429,10 @@ var PlateInfoSchema = object({
24169
24429
  keyFrameMediaKey: string().optional(),
24170
24430
  base64: string().optional(),
24171
24431
  /**
24172
- * Same crop as a data-plane URL. `getPlateByTrack` returns this and
24173
- * never inlines JPEG; `listPlates` still inlines for the admin-ui.
24432
+ * Same crop as a data-plane URL, always present when the plate has a stored
24433
+ * crop. `getPlateByTrack` returns this and never inlines JPEG; `listPlates`
24434
+ * and `searchPlates` inline the crop only when their `includeCrops` input is
24435
+ * left at its `true` default.
24174
24436
  */
24175
24437
  cropUrl: string().optional()
24176
24438
  });
@@ -24190,14 +24452,34 @@ var PlateClusterSchema = object({
24190
24452
  });
24191
24453
  method(object({
24192
24454
  deviceId: number().int().optional(),
24193
- limit: number().int().positive().optional()
24455
+ limit: number().int().positive().optional(),
24456
+ /**
24457
+ * Inline the base64 crop on every row. Default `true` — the existing
24458
+ * behaviour, kept so no caller breaks.
24459
+ *
24460
+ * Set `false` once the caller renders {@link PlateInfo.cropUrl}.
24461
+ * Measured on the live hub at the 500 rows the Plates view asks for:
24462
+ * 879,403 B and 27.7 s with the crops inline, against a few KiB of
24463
+ * metadata without them — and the browser then caches the images.
24464
+ *
24465
+ * This is the plate twin of `faceGallery.listRecentFaces`'s option;
24466
+ * plates were the one gallery list left without it.
24467
+ *
24468
+ * **This is an INPUT field, so it does not reach the addon until the
24469
+ * next train.** The hub router validates cap inputs against its own
24470
+ * compiled Zod and strips a key it does not know. Until the train
24471
+ * ships, sending `false` is harmless and keeps the crops inline.
24472
+ */
24473
+ includeCrops: boolean().optional()
24194
24474
  }).optional(), array(PlateInfoSchema).readonly()), method(object({
24195
24475
  deviceId: number().int(),
24196
24476
  trackId: string()
24197
24477
  }), PlateInfoSchema.nullable()), method(object({ plateId: string() }), array(MediaFileLiteSchema).readonly()), method(object({
24198
24478
  text: string().min(1),
24199
24479
  maxDistance: number().int().min(0).optional(),
24200
- limit: number().int().positive().optional()
24480
+ limit: number().int().positive().optional(),
24481
+ /** See `listPlates.includeCrops`. Default `true`. */
24482
+ includeCrops: boolean().optional()
24201
24483
  }), array(PlateInfoSchema).readonly()), method(object({
24202
24484
  maxDistance: number().int().min(0).optional(),
24203
24485
  minClusterSize: number().int().min(2).optional(),
@@ -24211,7 +24493,13 @@ method(object({
24211
24493
  }), method(object({ plateId: string() }), _void(), {
24212
24494
  kind: "mutation",
24213
24495
  auth: "admin"
24214
- }), method(_void(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24496
+ }), method(object({
24497
+ /** Inline {@link VehicleSchema.coverBase64} on every row. Default
24498
+ * `false` — the vehicle twin of `faceGallery.listIdentities`'s
24499
+ * option; `coverMediaKey` + the `event-media` plane carry the picture.
24500
+ * INPUT field: stripped by the hub router until the train ships, which
24501
+ * resolves to `false` and is exactly the intended default. */
24502
+ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24215
24503
  kind: "mutation",
24216
24504
  auth: "admin"
24217
24505
  }), method(object({
@@ -25476,92 +25764,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
25476
25764
  kind: "mutation",
25477
25765
  auth: "admin"
25478
25766
  });
25479
- /**
25480
- * Per-stage gating mode applied to the zones a rule references.
25481
- *
25482
- * - `include`: the rule contributes to a **whitelist** for its stage.
25483
- * When at least one `include` rule fires for a stage, only entities
25484
- * inside one of those zones pass that stage.
25485
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
25486
- * Entities inside one of those zones are dropped at that stage.
25487
- *
25488
- * `monitor`-style observation (count without filtering) is not a rule
25489
- * mode — zones without any matching rule are observed naturally by
25490
- * `zone-analytics` (live snapshot + history), so an "I just want to
25491
- * count, not filter" use case needs no rule at all.
25492
- */
25493
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
25494
- /**
25495
- * Per-consumer rule that references existing zones (geometry) and
25496
- * defines how a specific pipeline stage should treat them. Each
25497
- * consumer addon owns its own `ZoneRule[]` array in its per-device
25498
- * settings:
25499
- *
25500
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
25501
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
25502
- * - future: notification rules, audio gating, etc.
25503
- *
25504
- * One rule applies to N zones (`zoneIds[]`) so the operator can
25505
- * express "ignore motion in ALL of {garden, street}" with a single
25506
- * rule. `classFilter` narrows the rule to specific object classes —
25507
- * "drop person detections in the street, but keep cars" is one
25508
- * `exclude` rule with `classFilter: ['person']`.
25509
- *
25510
- * `enabled` is a soft toggle — the operator can keep the rule
25511
- * configured but inert without deleting it.
25512
- */
25513
- var ZoneRuleSchema = object({
25514
- /** Stable rule id — survives edits, used by the UI for diffing. */
25515
- id: string(),
25516
- /** Optional human-readable label rendered in the rule editor. */
25517
- name: string().optional(),
25518
- /** Zones this rule targets. The rule's `mode` applies to ALL
25519
- * listed zones (OR-set: a detection in any one of them counts).
25520
- * At least one zone id required — a rule with no targets is a
25521
- * configuration mistake and the form validator rejects it. */
25522
- zoneIds: array(string()).min(1).readonly(),
25523
- mode: ZoneRuleModeEnum,
25524
- /**
25525
- * Class names this rule applies to. Empty / undefined ⇒ rule
25526
- * applies to every class. Class strings match the `macroClass`
25527
- * field on detections (e.g. `person`, `car`, `dog`).
25528
- */
25529
- classFilter: array(string()).readonly().optional(),
25530
- /**
25531
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
25532
- * required to consider an entity "in the zone". Defaults to the
25533
- * consumer's stage default when omitted. Kept for back-compat with
25534
- * existing per-rule overrides; new operators pick the value via
25535
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
25536
- * set, the lower-level engine reads it as a 0–1 fraction.
25537
- */
25538
- overlapThreshold: number().min(0).max(1).optional(),
25539
- /**
25540
- * Operator-friendly version of `overlapThreshold` — the percentage
25541
- * of the detection's bbox that must lie inside the zone for the
25542
- * rule to match. Documented default is 85%; the engine substitutes
25543
- * that when the field is omitted (kept optional so existing rules
25544
- * stored without it stay valid).
25545
- *
25546
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
25547
- * rule, the engine prefers `bboxInclusionPct` because it's the
25548
- * field exposed in the UI. Internally both feed the same gate.
25549
- */
25550
- bboxInclusionPct: number().min(0).max(100).optional(),
25551
- /**
25552
- * When `true` and a detection has a segmentation mask, use the
25553
- * mask for overlap instead of the bbox. Detection-stage only;
25554
- * motion rules ignore this field.
25555
- */
25556
- preferMask: boolean().optional(),
25557
- /**
25558
- * Soft-toggle: `false` disables the rule without deleting it.
25559
- * Defaults to `true` so operators creating a rule via the UI
25560
- * see it active immediately.
25561
- */
25562
- enabled: boolean().default(true)
25563
- });
25564
- array(ZoneRuleSchema).readonly();
25565
25767
  object({
25566
25768
  /** Whether the script is currently executing. */
25567
25769
  isRunning: boolean(),
@@ -29588,6 +29790,12 @@ Object.freeze({
29588
29790
  addonId: null,
29589
29791
  access: "create"
29590
29792
  },
29793
+ "pipelineAnalytics.cancelRelocateMedia": {
29794
+ capName: "pipeline-analytics",
29795
+ capScope: "device",
29796
+ addonId: null,
29797
+ access: "create"
29798
+ },
29591
29799
  "pipelineAnalytics.cancelStorageMigrationMove": {
29592
29800
  capName: "pipeline-analytics",
29593
29801
  capScope: "device",
@@ -29762,6 +29970,12 @@ Object.freeze({
29762
29970
  addonId: null,
29763
29971
  access: "view"
29764
29972
  },
29973
+ "pipelineAnalytics.listRelocateMediaJobs": {
29974
+ capName: "pipeline-analytics",
29975
+ capScope: "device",
29976
+ addonId: null,
29977
+ access: "view"
29978
+ },
29765
29979
  "pipelineAnalytics.listRetrainAnnotations": {
29766
29980
  capName: "pipeline-analytics",
29767
29981
  capScope: "device",
@@ -29840,6 +30054,12 @@ Object.freeze({
29840
30054
  addonId: null,
29841
30055
  access: "create"
29842
30056
  },
30057
+ "pipelineAnalytics.relocateMedia": {
30058
+ capName: "pipeline-analytics",
30059
+ capScope: "device",
30060
+ addonId: null,
30061
+ access: "create"
30062
+ },
29843
30063
  "pipelineAnalytics.restageRetrainTrack": {
29844
30064
  capName: "pipeline-analytics",
29845
30065
  capScope: "device",
@@ -29852,6 +30072,12 @@ Object.freeze({
29852
30072
  addonId: null,
29853
30073
  access: "create"
29854
30074
  },
30075
+ "pipelineAnalytics.runReplayFrameProcessor": {
30076
+ capName: "pipeline-analytics",
30077
+ capScope: "device",
30078
+ addonId: null,
30079
+ access: "create"
30080
+ },
29855
30081
  "pipelineAnalytics.saveRetrainAnnotations": {
29856
30082
  capName: "pipeline-analytics",
29857
30083
  capScope: "device",
@@ -29984,6 +30210,12 @@ Object.freeze({
29984
30210
  addonId: null,
29985
30211
  access: "view"
29986
30212
  },
30213
+ "pipelineExecutor.getInferenceDeviceHealth": {
30214
+ capName: "pipeline-executor",
30215
+ capScope: "system",
30216
+ addonId: null,
30217
+ access: "view"
30218
+ },
29987
30219
  "pipelineExecutor.getOrchestratorConfigSchema": {
29988
30220
  capName: "pipeline-executor",
29989
30221
  capScope: "system",
@@ -30056,6 +30288,12 @@ Object.freeze({
30056
30288
  addonId: null,
30057
30289
  access: "view"
30058
30290
  },
30291
+ "pipelineExecutor.rearmInferenceDevice": {
30292
+ capName: "pipeline-executor",
30293
+ capScope: "system",
30294
+ addonId: null,
30295
+ access: "create"
30296
+ },
30059
30297
  "pipelineExecutor.runAudioTest": {
30060
30298
  capName: "pipeline-executor",
30061
30299
  capScope: "system",
@@ -33304,6 +33542,11 @@ Object.freeze({
33304
33542
  form: "single",
33305
33543
  optional: false
33306
33544
  }],
33545
+ "pipelineAnalytics.runReplayFrameProcessor": [{
33546
+ name: "deviceId",
33547
+ form: "single",
33548
+ optional: false
33549
+ }],
33307
33550
  "pipelineAnalytics.saveRetrainAnnotations": [{
33308
33551
  name: "deviceId",
33309
33552
  form: "single",