@camstack/addon-export-alexa 1.2.34 → 1.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6630,7 +6630,7 @@ function method(input, output, options) {
6630
6630
  input,
6631
6631
  output,
6632
6632
  kind: options?.kind ?? "query",
6633
- auth: options?.auth ?? "protected",
6633
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6634
6634
  ...options?.access !== void 0 ? { access: options.access } : {},
6635
6635
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6636
6636
  timeoutMs: options?.timeoutMs
@@ -6650,7 +6650,7 @@ function systemMethod(input, output, options) {
6650
6650
  }
6651
6651
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
6652
6652
  var VersionOutputSchema$1 = object({ version: string() });
6653
- method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6653
+ method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
6654
6654
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
6655
6655
  DeviceType["Camera"] = "camera";
6656
6656
  DeviceType["Hub"] = "hub";
@@ -6971,7 +6971,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6971
6971
  }({});
6972
6972
  var StaticDirOutputSchema = object({ staticDir: string() });
6973
6973
  var VersionOutputSchema = object({ version: string() });
6974
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6974
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
6975
6975
  /**
6976
6976
  * device-ops — device-scoped cap that unifies the per-IDevice operations
6977
6977
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7742,24 +7742,6 @@ var RecordingRetentionSchema = object({
7742
7742
  maxSizeGb: number().min(0).optional()
7743
7743
  });
7744
7744
  /**
7745
- * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7746
- * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7747
- * previews at. Five graduated steps; absent on a config = `standard` (the
7748
- * shipped default, matching `sheet-geometry`/`sheet-composer`).
7749
- *
7750
- * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7751
- * Each window's index sidecar carries its own tile dims, so a camera whose
7752
- * preset changed over time renders every historical window at the dims it was
7753
- * written with.
7754
- */
7755
- var ScrubThumbnailPresetSchema = _enum([
7756
- "minimal",
7757
- "low",
7758
- "standard",
7759
- "high",
7760
- "max"
7761
- ]);
7762
- /**
7763
7745
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7764
7746
  *
7765
7747
  * `bands` is the ONLY authored recording intent: what to record, when, and on
@@ -7767,7 +7749,11 @@ var ScrubThumbnailPresetSchema = _enum([
7767
7749
  * other field is a storage knob (profiles, segment length, retention, scrub).
7768
7750
  *
7769
7751
  * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7770
- * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7752
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30,
7753
+ * and `scrubThumbnails` — a five-step fidelity knob for a sprite tier that was
7754
+ * deleted on 2026-07-24 and had ZERO consumers in the recorder — on 2026-08-25
7755
+ * (D62: a switch that writes a store nobody reads is worse than no switch).
7756
+ * Stored rows keep loading: the READ schema is `.strip()` (config-store.ts).
7771
7757
  * A stale caller must fail loudly — silently stripping its legacy intent would
7772
7758
  * persist a band-less config, i.e. silently stop recording the camera.
7773
7759
  */
@@ -7790,14 +7776,7 @@ var RecordingConfigSchema = object({
7790
7776
  * "off" is the absence of a covering band, never a band value.
7791
7777
  */
7792
7778
  bands: array(RecordingBandSchema).default([]),
7793
- retention: RecordingRetentionSchema.optional(),
7794
- /**
7795
- * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7796
- * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7797
- * windows only — existing sheets are immutable, and each window's index
7798
- * carries its own tile dims so mixed-preset history renders correctly.
7799
- */
7800
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7779
+ retention: RecordingRetentionSchema.optional()
7801
7780
  }).strict();
7802
7781
  /**
7803
7782
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
@@ -7873,10 +7852,11 @@ var RelocateFootageInputSchema = object({
7873
7852
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7874
7853
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7875
7854
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7876
- var StorageMigrationMediaMoveInputSchema = object({
7855
+ var RelocateMediaInputSchema = object({
7877
7856
  toLocationId: string(),
7878
7857
  throttleMbps: number().min(1).max(1e3).optional()
7879
- }).extend({ leaseId: string().min(1) });
7858
+ });
7859
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7880
7860
  /** The independently selectable logical storage classes. `recordings`
7881
7861
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7882
7862
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8225,7 +8205,26 @@ var LabelDefinitionSchema = object({
8225
8205
  description: string().optional(),
8226
8206
  icon: string().optional()
8227
8207
  });
8228
- var ClassMapDefinitionSchema = object({
8208
+ /**
8209
+ * Wire schema for a per-model CATALOG classMap override
8210
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8211
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8212
+ * detection pipeline executor actually routes.
8213
+ *
8214
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8215
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8216
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8217
+ * enum) — the two used to share the name `ClassMapDefinition`/
8218
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8219
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8220
+ * are not: it is two different concepts colliding on a name. Keep this type
8221
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8222
+ * would either narrow every `ClassMapDefinition` consumer to the four
8223
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8224
+ * schema exists for (see the "rejects a classMap whose target is not a
8225
+ * detection macro" test in `model-catalog-schema.test.ts`).
8226
+ */
8227
+ var DetectionCatalogClassMapSchema = object({
8229
8228
  mapping: record(string(), _enum([
8230
8229
  "person",
8231
8230
  "vehicle",
@@ -8430,7 +8429,7 @@ var ModelCatalogEntrySchema = object({
8430
8429
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8431
8430
  * labels already ARE the CamStack macros (Scrypted identity map).
8432
8431
  */
8433
- classMap: ClassMapDefinitionSchema.optional()
8432
+ classMap: DetectionCatalogClassMapSchema.optional()
8434
8433
  });
8435
8434
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8436
8435
  format: literal("openvino"),
@@ -8460,7 +8459,7 @@ var ModelConvertMetadataSchema = object({
8460
8459
  "segmentation"
8461
8460
  ]),
8462
8461
  faceAlignment: boolean().optional(),
8463
- classMap: ClassMapDefinitionSchema.optional()
8462
+ classMap: DetectionCatalogClassMapSchema.optional()
8464
8463
  });
8465
8464
  var ConvertResultSchema = object({
8466
8465
  entry: ModelCatalogEntrySchema,
@@ -9330,7 +9329,7 @@ var AddonPageDeclarationSchema = object({
9330
9329
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9331
9330
  sectionLabel: string().optional()
9332
9331
  });
9333
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9332
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9334
9333
  var AddonHttpRouteSchema = object({
9335
9334
  method: _enum([
9336
9335
  "GET",
@@ -9584,7 +9583,7 @@ var WidgetMetadataSchema = object({
9584
9583
  defaultColumns: number().int().min(1).max(12).default(6),
9585
9584
  defaultRows: number().int().min(1).max(12).default(1)
9586
9585
  });
9587
- method(_void(), array(WidgetMetadataSchema).readonly());
9586
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9588
9587
  /**
9589
9588
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9590
9589
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -11128,7 +11127,7 @@ var CustomModelDescriptorSchema = object({
11128
11127
  stepId: string(),
11129
11128
  entry: ModelCatalogEntrySchema
11130
11129
  });
11131
- method(_void(), array(CustomModelDescriptorSchema).readonly());
11130
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
11132
11131
  /**
11133
11132
  * Query filter for settings-store collections.
11134
11133
  */
@@ -11215,7 +11214,8 @@ method(object({
11215
11214
  }), _void(), { kind: "mutation" }), method(object({
11216
11215
  namespace: string().optional(),
11217
11216
  collection: string(),
11218
- filter: QueryFilterSchema.optional()
11217
+ filter: QueryFilterSchema.optional(),
11218
+ columns: array(string()).readonly().optional()
11219
11219
  }), array(SettingsRecordSchema).readonly()), method(object({
11220
11220
  namespace: string().optional(),
11221
11221
  collection: string(),
@@ -11278,46 +11278,87 @@ var EngineInfoSchema = object({
11278
11278
  kind: _enum(["relational", "vector"]),
11279
11279
  displayName: string()
11280
11280
  });
11281
- method(_void(), EngineInfoSchema), method(object({
11281
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11282
11282
  namespace: string().optional(),
11283
11283
  collection: string(),
11284
11284
  key: string()
11285
- }), unknown()), method(object({
11285
+ }), unknown(), { auth: "admin" }), method(object({
11286
11286
  namespace: string().optional(),
11287
11287
  collection: string(),
11288
11288
  key: string(),
11289
11289
  value: unknown()
11290
- }), _void(), { kind: "mutation" }), method(object({
11290
+ }), _void(), {
11291
+ kind: "mutation",
11292
+ auth: "admin"
11293
+ }), method(object({
11291
11294
  namespace: string().optional(),
11292
11295
  collection: string(),
11293
- filter: QueryFilterSchema.optional()
11294
- }), array(SettingsRecordSchema).readonly()), method(object({
11296
+ filter: QueryFilterSchema.optional(),
11297
+ /**
11298
+ * SQL-level column projection — MUST mirror `settings-store.query`.
11299
+ *
11300
+ * ⚠ An earlier version of this comment blamed Zod stripping, and that
11301
+ * was wrong — corrected 2026-08-26 after the hop map
11302
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11303
+ * There is **no Zod parse at all** between the door and the engine: the
11304
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11305
+ * field declared here reaches `SqliteSettingsBackend` either way.
11306
+ *
11307
+ * What actually lost `columns` was the THIRD declaration of this shape:
11308
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11309
+ * interface the engine destructures from. The field existed on both
11310
+ * schemas and the engine still never read it, because nothing checks a
11311
+ * registered provider against `InferProvider<cap>` —
11312
+ * `ProviderRegistration.provider` is typed `object`.
11313
+ *
11314
+ * It is declared here anyway, and must stay in step with
11315
+ * `settings-store.query`: a caller reading only the cap definitions has
11316
+ * to be able to see that this call carries a projection.
11317
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11318
+ */
11319
+ columns: array(string()).readonly().optional()
11320
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11295
11321
  namespace: string().optional(),
11296
11322
  collection: string(),
11297
11323
  record: SettingsRecordSchema
11298
- }), _void(), { kind: "mutation" }), method(object({
11324
+ }), _void(), {
11325
+ kind: "mutation",
11326
+ auth: "admin"
11327
+ }), method(object({
11299
11328
  namespace: string().optional(),
11300
11329
  collection: string(),
11301
11330
  id: string(),
11302
11331
  data: record(string(), unknown())
11303
- }), _void(), { kind: "mutation" }), method(object({
11332
+ }), _void(), {
11333
+ kind: "mutation",
11334
+ auth: "admin"
11335
+ }), method(object({
11304
11336
  namespace: string().optional(),
11305
11337
  collection: string(),
11306
11338
  key: string()
11307
- }), _void(), { kind: "mutation" }), method(object({
11339
+ }), _void(), {
11340
+ kind: "mutation",
11341
+ auth: "admin"
11342
+ }), method(object({
11308
11343
  namespace: string().optional(),
11309
11344
  collection: string(),
11310
11345
  filter: MutationFilterSchema
11311
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11346
+ }), object({ deleted: number().int() }), {
11347
+ kind: "mutation",
11348
+ auth: "admin"
11349
+ }), method(object({
11312
11350
  namespace: string().optional(),
11313
11351
  collection: string(),
11314
11352
  filter: MutationFilterSchema,
11315
11353
  data: record(string(), unknown())
11316
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11354
+ }), object({ updated: number().int() }), {
11355
+ kind: "mutation",
11356
+ auth: "admin"
11357
+ }), method(object({
11317
11358
  namespace: string().optional(),
11318
11359
  collection: string(),
11319
11360
  filter: QueryFilterSchema.optional()
11320
- }), number()), method(object({
11361
+ }), number(), { auth: "admin" }), method(object({
11321
11362
  namespace: string().optional(),
11322
11363
  collection: string(),
11323
11364
  field: string(),
@@ -11327,15 +11368,18 @@ method(_void(), EngineInfoSchema), method(object({
11327
11368
  }), array(object({
11328
11369
  bucket: number().int(),
11329
11370
  count: number().int()
11330
- })).readonly()), method(object({
11371
+ })).readonly(), { auth: "admin" }), method(object({
11331
11372
  namespace: string().optional(),
11332
11373
  collection: string()
11333
- }), boolean()), method(object({
11374
+ }), boolean(), { auth: "admin" }), method(object({
11334
11375
  namespace: string().optional(),
11335
11376
  collection: string(),
11336
11377
  columns: array(CollectionColumnSchema).readonly(),
11337
11378
  indexes: array(CollectionIndexSchema).readonly().optional()
11338
- }), _void(), { kind: "mutation" });
11379
+ }), _void(), {
11380
+ kind: "mutation",
11381
+ auth: "admin"
11382
+ });
11339
11383
  /**
11340
11384
  * shm ring usage stats for a `frameSink: 'shm'` decoder session —
11341
11385
  * exposed via `decoder.getShmStats` so downstream consumers can
@@ -12488,7 +12532,7 @@ method(object({
12488
12532
  crop: _instanceof(Uint8Array),
12489
12533
  width: number(),
12490
12534
  height: number()
12491
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12535
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12492
12536
  /**
12493
12537
  * filesystem-browse — per-node capability for browsing the node's local
12494
12538
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12781,19 +12825,22 @@ method(LlmGenerateBaseInputSchema.extend({
12781
12825
  runtime: ManagedRuntimeConfigSchema,
12782
12826
  /** The managed profile's timeout, threaded by the hub provider. */
12783
12827
  timeoutMs: number().int().positive().optional()
12784
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12828
+ }), LlmGenerateResultSchema, {
12829
+ kind: "mutation",
12830
+ auth: "admin"
12831
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12785
12832
  kind: "mutation",
12786
12833
  auth: "admin"
12787
12834
  }), method(object({}), _void(), {
12788
12835
  kind: "mutation",
12789
12836
  auth: "admin"
12790
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12837
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12791
12838
  kind: "mutation",
12792
12839
  auth: "admin"
12793
12840
  }), method(object({ file: string() }), _void(), {
12794
12841
  kind: "mutation",
12795
12842
  auth: "admin"
12796
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12843
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12797
12844
  /**
12798
12845
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12799
12846
  * methods concat-fan across providers; single-row methods route to ONE
@@ -16271,1749 +16318,1969 @@ var oauthIntegrationCapability = {
16271
16318
  scope: "system",
16272
16319
  mode: "collection",
16273
16320
  internal: true,
16274
- methods: { getDescriptor: method(_void(), OauthIntegrationDescriptorSchema) }
16321
+ methods: {
16322
+ /**
16323
+ * `internal: true` did not gate the mount (see the 2026-08-26 note on
16324
+ * `data-store-provider`) — `getDescriptor` was reachable on the AppRouter
16325
+ * by ANY authenticated session at the default `auth: 'protected'`. The
16326
+ * real caller is `/api/oauth2/authorize` and `/api/oauth2/integrations`
16327
+ * (`oauth2-routes.ts`), which resolve the provider directly off the
16328
+ * capability registry — never through tRPC. `auth: 'admin'` closes the
16329
+ * tRPC surface without touching that path.
16330
+ */
16331
+ getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
16275
16332
  };
16276
16333
  /**
16277
- * pipeline-analytics — device-scoped wrapper cap. Refines raw
16278
- * per-frame detections emitted by the pipeline runner into tracked
16279
- * objects, per-kind event collections (motion / object / audio), and
16280
- * persisted media. Owns the post-detection domain end-to-end:
16281
- *
16282
- * runner emits PipelineInferenceResult
16283
- * ↓ (event bus)
16284
- * pipeline-analytics subscriber
16285
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16286
- * → three DB collections (one per kind), one FS media tree, one
16287
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16288
- * DetectionEvent on bus)
16289
- *
16290
- * Pure subscriber model. No `processFrame` cap method — the runner
16291
- * already publishes the raw frame on the bus. The cap surface is
16292
- * only QUERIES + per-device settings, bound on/off via
16293
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16294
- * every camera with a detection pipeline wants its raw detections
16295
- * refined; operators opt out per-device via BindingsTab when needed.
16296
- *
16297
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16298
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16334
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16335
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16336
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16299
16337
  */
16300
- var TrackStateSchema = _enum([
16301
- "new",
16302
- "entered",
16303
- "left",
16304
- "moving",
16305
- "idle"
16306
- ]);
16307
- var EventKindSchema = _enum([
16308
- "motion",
16309
- "object",
16310
- "audio"
16311
- ]);
16338
+ var NativeCropRefSchema = object({
16339
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16340
+ handle: FrameHandleSchema,
16341
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16342
+ cropFrameSpace: object({
16343
+ x: number(),
16344
+ y: number(),
16345
+ w: number(),
16346
+ h: number()
16347
+ })
16348
+ });
16349
+ object({
16350
+ crop: object({
16351
+ left: number(),
16352
+ top: number(),
16353
+ width: number().positive(),
16354
+ height: number().positive()
16355
+ }).optional(),
16356
+ content: object({
16357
+ width: number().int().positive(),
16358
+ height: number().int().positive()
16359
+ }),
16360
+ fit: _enum(["stretch", "contain"]),
16361
+ format: _enum([
16362
+ "rgb",
16363
+ "gray",
16364
+ "jpeg"
16365
+ ])
16366
+ });
16312
16367
  /**
16313
- * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16314
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16315
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16368
+ * Process-local frame identity. It is serializable so it can ride an in-process
16369
+ * capability call, but `registryId` deliberately prevents resolution in any
16370
+ * other process or execution group.
16316
16371
  */
16317
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16318
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16319
- var EventKindIconSchema = _enum([
16320
- "motion",
16321
- "audio",
16322
- "person",
16323
- "vehicle",
16324
- "animal",
16325
- "door",
16326
- "pir",
16327
- "smoke",
16328
- "water",
16329
- "button",
16330
- "package",
16331
- "generic"
16372
+ var FrameRefSchema = object({
16373
+ registryId: string().min(1),
16374
+ id: string().min(1),
16375
+ width: number().int().positive(),
16376
+ height: number().int().positive(),
16377
+ format: _enum(["rgb", "gray"]),
16378
+ timestamp: number(),
16379
+ capturedAt: number().optional()
16380
+ });
16381
+ var ModelFormatSchema$1 = _enum([
16382
+ "onnx",
16383
+ "coreml",
16384
+ "openvino",
16385
+ "tflite",
16386
+ "pt",
16387
+ "gguf"
16332
16388
  ]);
16333
- var EventKindCategorySchema = _enum([
16334
- "motion",
16335
- "audio",
16336
- "detection",
16337
- "sensor",
16338
- "control",
16339
- "custom",
16340
- "package"
16389
+ var PipelineSlotSchema = _enum([
16390
+ "detector",
16391
+ "cropper",
16392
+ "classifier",
16393
+ "refiner",
16394
+ "audio-classifier"
16341
16395
  ]);
16342
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16343
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16344
- var EventKindDescriptorSchema = object({
16345
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16346
- kind: string(),
16347
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16348
- labelKey: string(),
16349
- /** English fallback label (kept for clients that don't translate). */
16350
- label: string(),
16351
- /** Hex color for timeline/legend rendering. */
16352
- color: string(),
16353
- /** Dictionary id → lucide component on the UI side. */
16354
- iconId: string(),
16355
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16356
- icon: EventKindIconSchema,
16357
- category: EventKindCategorySchema,
16358
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16359
- parentKind: string().nullable(),
16360
- /** Derived from `parentKind`, explicit for the client tree. */
16361
- level: EventKindLevelSchema,
16362
- /** Which cap + device contributes this kind. For built-ins the camera
16363
- * itself; for sensor kinds the LINKED source device. */
16364
- source: object({
16365
- capName: string(),
16366
- deviceId: number()
16367
- })
16396
+ var PipelineEngineChoiceSchema = object({
16397
+ runtime: _enum(["node", "python"]),
16398
+ backend: string(),
16399
+ format: ModelFormatSchema$1,
16400
+ device: string().optional()
16368
16401
  });
16369
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16370
- var EventKindsForDeviceSchema = object({
16371
- deviceId: number(),
16372
- kinds: array(EventKindDescriptorSchema).readonly()
16402
+ var AvailableEngineSchema = object({
16403
+ engine: PipelineEngineChoiceSchema,
16404
+ devices: array(object({
16405
+ id: string(),
16406
+ label: string(),
16407
+ description: string().optional()
16408
+ })).readonly(),
16409
+ defaultDevice: string()
16373
16410
  });
16374
- var SensorEventSchema = object({
16411
+ var PipelineDefaultStepSchema = lazy(() => object({
16412
+ addonId: string(),
16413
+ addonName: string(),
16414
+ slot: PipelineSlotSchema,
16415
+ inputClasses: array(string()).readonly(),
16416
+ outputClasses: array(string()).readonly(),
16417
+ enabled: boolean(),
16418
+ modelId: string(),
16419
+ children: array(PipelineDefaultStepSchema).readonly(),
16420
+ group: string().optional(),
16421
+ settings: record(string(), unknown()).optional()
16422
+ }));
16423
+ var PipelineTemplateStepSchema = lazy(() => object({
16424
+ addonId: string(),
16425
+ enabled: boolean(),
16426
+ modelId: string(),
16427
+ children: array(PipelineTemplateStepSchema).readonly(),
16428
+ settings: record(string(), unknown()).optional()
16429
+ }));
16430
+ var PipelineTemplateSchema$1 = object({
16375
16431
  id: string(),
16376
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16377
- * yields N rows, one per camera). */
16378
- deviceId: number(),
16379
- /** The linked sensor device whose state changed. */
16380
- sourceDeviceId: number(),
16381
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16382
- kind: string(),
16383
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16384
- value: record(string(), unknown()).nullable(),
16385
- timestamp: number()
16432
+ name: string(),
16433
+ createdAt: string(),
16434
+ updatedAt: string(),
16435
+ engine: PipelineEngineChoiceSchema,
16436
+ steps: array(PipelineTemplateStepSchema).readonly()
16386
16437
  });
16387
- var TrackPositionSchema = object({
16388
- x: number(),
16389
- y: number(),
16390
- timestamp: number(),
16391
- bbox: BoundingBoxSchema
16392
- });
16393
- var TrackSnapshotSchema = object({
16394
- timestamp: number(),
16395
- position: TrackPositionSchema,
16396
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16397
- mediaKey: string()
16438
+ var PipelineModelOptionSchema = object({
16439
+ id: string(),
16440
+ name: string(),
16441
+ formats: record(string(), object({
16442
+ downloaded: boolean(),
16443
+ sizeMB: number()
16444
+ })),
16445
+ group: ModelVariantGroupSchema.optional(),
16446
+ legacy: boolean().optional(),
16447
+ provider: ModelProviderIdSchema.optional()
16398
16448
  });
16399
- /**
16400
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16401
- * divided by the track's detection-frame dims), computed at persist time.
16402
- * Absent when the frame dims were unknown when the track was persisted
16403
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16404
- */
16405
- var TrackEnvelopeSchema = object({
16406
- minX: number(),
16407
- minY: number(),
16408
- maxX: number(),
16409
- maxY: number()
16449
+ var ConfigFieldBridge = custom();
16450
+ var PipelineAddonSchemaSchema = object({
16451
+ id: string(),
16452
+ name: string(),
16453
+ slot: PipelineSlotSchema,
16454
+ inputClasses: array(string()).readonly(),
16455
+ outputClasses: array(string()).readonly(),
16456
+ childSlots: array(PipelineSlotSchema).readonly(),
16457
+ models: array(PipelineModelOptionSchema).readonly(),
16458
+ defaultModelId: string(),
16459
+ defaultModelIdByFormat: record(string(), string()).optional(),
16460
+ enabledByDefault: boolean().optional(),
16461
+ backfillIntoExistingOverrides: boolean().optional(),
16462
+ defaultConfidence: number(),
16463
+ group: string().optional(),
16464
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16410
16465
  });
16411
- /**
16412
- * Row projection for track list queries. `full` (default) returns the
16413
- * complete Track including the frame-rate `positions[]` history and the
16414
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16415
- * keeps every scalar the list surfaces actually render (ids, class(es),
16416
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16417
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16418
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16419
- * `getTrack`. Mirrors the event-store `projection` convention
16420
- * (`getObjectEvents` et al.).
16421
- */
16422
- var TrackProjectionSchema = _enum(["full", "slim"]);
16423
- /**
16424
- * One audio-classification label heard on the track's camera while the
16425
- * track was alive, aggregated per label. An "episode" is one persisted
16426
- * audio event (the confident-classification path: score ≥ the device's
16427
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16428
- * one 32 ms inference chunk, so counts stay human-scaled.
16429
- */
16430
- var TrackAudioLabelSchema = object({
16466
+ var PipelineSlotSchemaSchema = object({
16467
+ id: PipelineSlotSchema,
16431
16468
  label: string(),
16432
- /** Highest classification score observed across the label's episodes. */
16433
- peakScore: number(),
16434
- /** Number of coalesced audio-event episodes carrying this label. */
16435
- count: number(),
16436
- firstAt: number(),
16437
- lastAt: number()
16469
+ priority: number(),
16470
+ parentSlot: PipelineSlotSchema.nullable(),
16471
+ addons: array(PipelineAddonSchemaSchema).readonly()
16438
16472
  });
16439
- /**
16440
- * How a track was produced. `pipeline` (default / absent) = the spatial
16441
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16442
- * no positions, a single snapshot, and no bbox trajectory at all:
16443
- *
16444
- * - `sensor` — a linked sensor/control device state change.
16445
- * - `audio` — an audio event on the camera itself that was anomalous for
16446
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16447
- *
16448
- * The spatial subsystems (tracker association, occupancy count, re-id /
16449
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16450
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16451
- * check silently readmits every source added after it was written.
16452
- */
16453
- var TrackSourceSchema = _enum([
16454
- "pipeline",
16455
- "sensor",
16456
- "audio"
16457
- ]);
16458
- /**
16459
- * Where a track sits in the RETRAIN lifecycle (D81).
16460
- *
16461
- * - `none` — never marked, or un-marked. Evictable.
16462
- * - `staging` — the operator wants this track as training material and has not
16463
- * finished with it. **This is the only state retention holds**: the track and
16464
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16465
- * the device's age window.
16466
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16467
- * were COPIED into the retrain dataset at selection time, so the dataset no
16468
- * longer depends on the track's media and the track becomes EVICTABLE again.
16469
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16470
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16471
- *
16472
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16473
- * the store's filter language has only positive equality and `whereIn` — no
16474
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16475
- * would make the entire pre-column history immortal in one deploy.
16476
- */
16477
- var RetrainStatusSchema = _enum([
16478
- "none",
16479
- "staging",
16480
- "trained"
16481
- ]);
16482
- /**
16483
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16484
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16485
- * so the two surfaces cannot drift.
16486
- *
16487
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16488
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16489
- * columns existed read as absent, and a consumer that needs a boolean should say
16490
- * `flag === true`, not `flag !== false`.
16491
- *
16492
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16493
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16494
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16495
- * `trained` track reports `false` while refusing both writes. The boolean is
16496
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16497
- * "never marked" from "already trained" must read `retrainStatus`.
16498
- *
16499
- * `debug` does NOT pin; it is attention, not durability.
16500
- *
16501
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16502
- * A favourited track is skipped by retention the same way `staging` is, but
16503
- * it does not enter `none|staging|trained` and has no staging budget.
16504
- */
16505
- var TrackFlagFields = {
16506
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16507
- * `'staging'`. */
16508
- markForTrain: boolean().optional(),
16509
- /** Operator marked this track for diagnostic attention. */
16510
- debug: boolean().optional(),
16511
- /** Operator favourited this track. Pins it against pruning. */
16512
- favourited: boolean().optional()
16513
- };
16514
- /**
16515
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16516
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16517
- * write patch, and the status is not something the toggle sets — it is what the
16518
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16519
- * always present on a persisted row (the column default materialises `'none'`).
16520
- */
16521
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16522
- /**
16523
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16524
- * one flag can never clear the other — the toggles are independent and are
16525
- * driven from three surfaces that do not know about each other.
16526
- */
16527
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16528
- /**
16529
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16530
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16531
- * mutation result without a re-fetch.
16532
- */
16533
- var TrackFlagsSchema = object({
16534
- trackId: string(),
16535
- markForTrain: boolean(),
16536
- debug: boolean(),
16537
- favourited: boolean(),
16538
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16539
- * a track row) because this shape is only ever produced by the write body,
16540
- * which always knows it — and a surface that has just written needs to render
16541
- * `trained` without a re-fetch. */
16542
- retrainStatus: RetrainStatusSchema
16473
+ var PipelineSchemaSchema = object({
16474
+ availableEngines: array(AvailableEngineSchema).readonly(),
16475
+ selectedEngine: PipelineEngineChoiceSchema,
16476
+ slots: array(PipelineSlotSchemaSchema).readonly()
16543
16477
  });
16544
- union([literal(1), literal(2)]);
16545
- /**
16546
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16547
- * the step and model that produced it — which is what makes the write rule
16548
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16549
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16550
- *
16551
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16552
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16553
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16554
- * that value has no provenance, and the write rule lets ANY properly-attributed
16555
- * write of the same tier replace it regardless of score.
16556
- */
16557
- var LabelAttributionSchema = object({
16558
- stepId: string(),
16559
- modelId: string().optional(),
16560
- decidedAt: number(),
16478
+ var EngineProvisioningSchema = object({
16479
+ runtimeId: _enum([
16480
+ "onnx",
16481
+ "openvino",
16482
+ "coreml",
16483
+ "edgetpu"
16484
+ ]).nullable(),
16485
+ device: string().nullable(),
16486
+ state: _enum([
16487
+ "idle",
16488
+ "installing",
16489
+ "verifying",
16490
+ "ready",
16491
+ "failed"
16492
+ ]),
16493
+ progress: number().optional(),
16494
+ error: string().optional(),
16495
+ nextRetryAt: number().optional(),
16561
16496
  /**
16562
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16563
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16564
- *
16565
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16566
- * notification rule authored on "Gianluca" stopped matching the moment the
16567
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16568
- * the thing that does not move, so it is what a rule matches on
16569
- * (`NcConditions.identities`) and the text is what a human is shown.
16570
- *
16571
- * Absent when the label names no gallery row — a plate the OCR read but no
16572
- * vehicle claims, a sub-class, a species, any tier-1 value.
16497
+ * Gate A (config-correctness gate at engine change): human-readable
16498
+ * config issues surfaced EAGERLY when the node's engine changes — model
16499
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16500
+ * has a <format> build"). Additive/optional: informational only, never
16501
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
16502
+ * Absent/empty when the node-default tree resolves cleanly.
16573
16503
  */
16574
- identityId: string().optional()
16504
+ configIssues: array(string()).optional()
16575
16505
  });
16576
- /**
16577
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16578
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16579
- * track and its events always answer the same question the same way.
16580
- *
16581
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16582
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16583
- * is tier 2, and each carries its own score + attribution.
16584
- *
16585
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16586
- * finest thing known. Before 4g the single `label` column held the finest
16587
- * value, so a consumer that has not been updated reads the tier-1 slot and
16588
- * shows nothing on a species-only row; that is why the migration puts every
16589
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16590
- * and why the read surfaces were changed in the same train.
16591
- *
16592
- * **Writing it.** The slots are independent, which is the whole point: a
16593
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16594
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16595
- * higher score wins. One rule, one implementation — see
16596
- * `pipeline/label-tier.ts` in addon-post-analysis.
16597
- */
16598
- var TieredLabelFields = {
16599
- /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
16600
- label: string().optional(),
16601
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16602
- labelScore: number().optional(),
16603
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16604
- labelMeta: LabelAttributionSchema.optional(),
16605
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16606
- subLabel: string().optional(),
16607
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16608
- subLabelScore: number().optional(),
16609
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16610
- subLabelMeta: LabelAttributionSchema.optional()
16611
- };
16612
- /** Per-camera slice of a training-export estimate. */
16613
- var TrainingExportDeviceTotalsSchema = object({
16614
- deviceId: number(),
16615
- tracks: number().int(),
16616
- files: number().int(),
16617
- bytes: number().int()
16506
+ var PipelineStepInputSchema = lazy(() => object({
16507
+ addonId: string(),
16508
+ modelId: string().optional(),
16509
+ enabled: boolean().default(true),
16510
+ children: array(PipelineStepInputSchema).optional(),
16511
+ settings: record(string(), unknown()).optional(),
16512
+ jumpDeviceKey: string().optional()
16513
+ }));
16514
+ var ModelSubstitutionSchema = object({
16515
+ addonId: string(),
16516
+ chosen: string(),
16517
+ running: string(),
16518
+ format: string()
16519
+ });
16520
+ var PipelineValidationIssueSchema = object({
16521
+ addonId: string(),
16522
+ kind: _enum(["unknown-addon", "no-format-build"]),
16523
+ detail: string()
16524
+ });
16525
+ var PipelineValidationResultSchema = object({
16526
+ ok: boolean(),
16527
+ issues: array(PipelineValidationIssueSchema).readonly(),
16528
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16529
+ /** The node's `currentEngine.format` this validation ran against. */
16530
+ format: string()
16531
+ });
16532
+ var ReferenceImageEntrySchema = object({
16533
+ filename: string(),
16534
+ stepIds: array(string()).readonly().optional()
16535
+ });
16536
+ var ReferenceImageBodySchema = object({
16537
+ base64: string(),
16538
+ filename: string()
16539
+ });
16540
+ var ReferenceAudioEntrySchema = object({
16541
+ filename: string(),
16542
+ sizeKb: number()
16543
+ });
16544
+ var ReferenceAudioBodySchema = object({ base64: string() });
16545
+ var AudioBackendSchema = object({
16546
+ id: string(),
16547
+ name: string(),
16548
+ description: string(),
16549
+ available: boolean(),
16550
+ /**
16551
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16552
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16553
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16554
+ * specific to the selected backend without a separate fetch.
16555
+ */
16556
+ rawLabels: array(string()).readonly().optional()
16557
+ });
16558
+ var AudioCapabilitiesSchema = object({
16559
+ activeBackend: string(),
16560
+ availableBackends: array(AudioBackendSchema).readonly(),
16561
+ sampleRate: number(),
16562
+ chunkDurationMs: number()
16563
+ });
16564
+ var DownloadModelResultSchema = object({
16565
+ filePath: string(),
16566
+ sizeMB: number(),
16567
+ durationMs: number()
16618
16568
  });
16619
16569
  /**
16620
- * What a training export WOULD contain. Computed from media index rows only —
16621
- * no blob is read to produce this.
16570
+ * Wrapper carrying a single test run's result. Replaces the legacy
16571
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16572
+ * canonical `AudioResult` from the Phase 6 output rework: one
16573
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16574
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16575
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16576
+ * benchmark UI can still report a clean failure when the classifier
16577
+ * cap isn't available.
16622
16578
  */
16623
- var TrainingExportSummarySchema = object({
16624
- generatedAt: number(),
16625
- trackCount: number().int(),
16626
- fileCount: number().int(),
16627
- byteCount: number().int(),
16628
- /** More marked tracks exist than a single pass carries. */
16629
- truncated: boolean(),
16630
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16579
+ var AudioTestResultSchema = object({
16580
+ success: boolean(),
16581
+ error: string().optional(),
16582
+ frame: custom().optional()
16631
16583
  });
16632
- var TrackSchema = object({
16633
- trackId: string(),
16634
- deviceId: number(),
16635
- className: string(),
16636
- ...TieredLabelFields,
16637
- producingDeviceName: string().optional(),
16638
- /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16639
- source: TrackSourceSchema.optional(),
16640
- firstSeen: number(),
16641
- lastSeen: number(),
16642
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16643
- positions: array(TrackPositionSchema).readonly(),
16644
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16645
- * saveThumbnails policy). */
16646
- snapshots: array(TrackSnapshotSchema).readonly(),
16647
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16648
- zonesVisited: array(string()).readonly(),
16584
+ var PipelineConfigBridge = custom();
16585
+ var ConfigUISchemaBridge = custom();
16586
+ var ConfigUISchemaNullableBridge = custom();
16587
+ var InferenceCapabilitiesBridge = custom();
16588
+ var ModelAvailabilityListBridge = custom();
16589
+ var PipelineRunResultBridge = custom();
16590
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16591
+ modelId: string(),
16592
+ settings: record(string(), unknown()).readonly()
16593
+ }))), method(object({ steps: record(string(), object({
16594
+ modelId: string(),
16595
+ settings: record(string(), unknown()).readonly()
16596
+ })) }), object({ success: literal(true) }), {
16597
+ kind: "mutation",
16598
+ auth: "admin"
16599
+ }), method(object({ nodeId: string() }), object({
16600
+ success: literal(true),
16601
+ clearedDevices: number()
16602
+ }), {
16603
+ kind: "mutation",
16604
+ auth: "admin"
16605
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16606
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16607
+ deviceKey: string(),
16649
16608
  /**
16650
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16651
- * `zones` capability.
16652
- *
16653
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16654
- * and no card can render — so every free-text search surface was structurally
16655
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16656
- * just returned nothing. Resolving here rather than in each client keeps ONE
16657
- * derivation and costs the clients no extra call (the `zones` cap is
16658
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16659
- * surface built to avoid exactly that).
16660
- *
16661
- * Resolved, never invented: a zone deleted since the track was written has no
16662
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16663
- * two are not positionally aligned. Absent when the track visited no zone, or
16664
- * when the zone catalogue could not be read.
16609
+ * `failed` — the per-device restart budget is exhausted; no pool
16610
+ * will be spawned until an operator re-arms it or the runner
16611
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16612
+ * a cached pool observed dead and not yet condemned).
16665
16613
  */
16666
- zoneNames: array(string()).readonly().optional(),
16667
- /** Deduplicated set of detector classes observed for this track over its
16668
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16669
- * legacy rows written before class accumulation shipped. */
16670
- classes: array(string()).readonly().optional(),
16671
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16672
- totalDistance: number(),
16673
- state: TrackStateSchema,
16674
- active: boolean(),
16675
- /** Deterministic key-event importance score in [0,1] (server-computed at
16676
- * track expiry, recomputed on late label). Absent on legacy rows written
16677
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16678
- importance: number().optional(),
16679
- /** Id of the track's highest-confidence ObjectEvent (its representative
16680
- * "best" frame). Absent when the track produced no object events. */
16681
- bestEventId: string().optional(),
16682
- /** Tag of the importance sub-signal that dominated the score
16683
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16684
- importanceReason: string().optional(),
16685
- /** Audio-classification labels heard on the camera during the track's
16686
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16687
- * Absent on legacy rows / tracks with no confident audio. */
16688
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16689
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16690
- * Populated from the persisted envelope columns on historical reads;
16691
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16692
- envelope: TrackEnvelopeSchema.optional(),
16614
+ state: _enum(["failed", "backoff"]),
16615
+ /** Epoch ms of the death that produced this state. */
16616
+ since: number(),
16617
+ /** Pool deaths inside the current window. */
16618
+ deaths: number(),
16619
+ /** The last death's message. */
16620
+ lastError: string()
16621
+ })).readonly() })), method(object({
16622
+ nodeId: string(),
16623
+ deviceKey: string()
16624
+ }), object({ rearmed: boolean() }), {
16625
+ kind: "mutation",
16626
+ auth: "admin"
16627
+ }), 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({
16628
+ name: string(),
16629
+ steps: array(PipelineTemplateStepSchema).readonly(),
16630
+ engine: PipelineEngineChoiceSchema
16631
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16632
+ id: string(),
16633
+ name: string().optional(),
16634
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16635
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16636
+ addonId: string(),
16637
+ modelId: string(),
16638
+ format: ModelFormatSchema$1
16639
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16640
+ addonId: string(),
16641
+ modelId: string(),
16642
+ format: ModelFormatSchema$1
16643
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16644
+ engine: PipelineEngineChoiceSchema.optional(),
16645
+ steps: array(PipelineStepInputSchema).min(1),
16646
+ frame: FrameInputSchema.optional(),
16693
16647
  /**
16694
- * A face DETECTOR found a face on this track — nothing more. It says the
16695
- * detail plane produced a `face` detail; it does NOT say the face was
16696
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16697
- * enabled. Set once and never cleared.
16698
- *
16699
- * **This exists so "face present but not recognised" is expressible.** A
16700
- * recognised identity lands in `subLabel` (attributed to the face chain via
16701
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16702
- * and a track with no face at all were byte-identical on the wire and no
16703
- * surface could tell them apart. The read is `hasFace === true && subLabel
16704
- * === undefined`.
16705
- *
16706
- * **Absent ≠ false.** Every row written before the column existed omits it,
16707
- * and so does every server that predates the field — a consumer must test
16708
- * `=== true` and render nothing otherwise, never infer "no face".
16648
+ * Process-local lazy frame. Valid only when caller and provider resolve
16649
+ * in the same execution-group process; split/cross-node callers use
16650
+ * `frame`/`image` inline compatibility instead.
16709
16651
  */
16710
- hasFace: boolean().optional(),
16652
+ frameRef: FrameRefSchema.optional(),
16711
16653
  /**
16712
- * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
16713
- * face an operator could ASSIGN to an identity.
16714
- *
16715
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16716
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16717
- * branch, before every gate, and means no more than "a face detector produced
16718
- * a face detail". This one is stamped at the single moment the gallery row
16719
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16720
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16721
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16722
- * the crop-store drop. Everything between the detector and that insert can
16723
- * legitimately refuse the face, so a flag written any earlier promises the
16724
- * operator something to assign and delivers nothing.
16725
- *
16726
- * **Independent of recognition.** A face collected but never auto-matched is
16727
- * still assignable — it is in fact the face an operator most wants to reach —
16728
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16729
- * `subLabel`; this says only that the raw material exists.
16730
- *
16731
- * **Set once, never cleared.** A track that produced a gallery row produced
16732
- * one; deleting the row later is the gallery's business, not this flag's.
16733
- *
16734
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16735
- * before the column omits it, and so does every server that predates the
16736
- * field. A consumer must test `=== true` and render nothing otherwise —
16737
- * never infer "no assignable face".
16654
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
16655
+ * the decoded pixels live in. One more member of the one-of
16656
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16738
16657
  */
16739
- hasEmbeddedFace: boolean().optional(),
16658
+ frameHandle: FrameHandleSchema.optional(),
16659
+ imageBase64: string().optional(),
16740
16660
  /**
16741
- * This subject CONTAINS a folded rider — a person the rider-pairing step
16742
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16743
- * so the passage is tracked once and as a VEHICLE.
16744
- *
16745
- * It exists because the fold's record was dishonest. D34 and the code both
16746
- * said "the person is not lost — it is reported so both entities stay on the
16747
- * record"; in fact the pair went into a per-processor RAM field behind an
16748
- * accessor nobody called, and every durable surface said `vehicle`, full
16749
- * stop. This is the composition note that makes the row true.
16750
- *
16751
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16752
- * person" is not an answer to "what is this" — both label tiers would refuse
16753
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16754
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16755
- * and a `person` rule still does not fire for someone cycling past.
16756
- *
16757
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16758
- * the column, and every hub that predates the field, omits it. Test
16759
- * `=== true` and render nothing otherwise — never infer "no rider".
16661
+ * Binary JPEG bytes — preferred over `imageBase64` on internal
16662
+ * hops (hub → forked worker via Moleculer MsgPack) because it
16663
+ * skips the 33% base64 overhead + the per-call base64 decode on
16664
+ * the detection-pipeline worker. Callers can pass either; exactly
16665
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16760
16666
  */
16761
- hasRider: boolean().optional(),
16762
- ...TrackFlagFields,
16763
- ...TrackRetrainFields
16764
- });
16765
- var BaseEventFields = {
16766
- id: string(),
16767
- deviceId: number(),
16768
- timestamp: number()
16769
- };
16770
- var MotionEventSchema = object({
16771
- ...BaseEventFields,
16772
- kind: literal("motion"),
16773
- regionCount: number(),
16774
- /** Heavy JSON array — omitted in slim projection. */
16775
- regions: array(object({
16776
- bbox: BoundingBoxSchema,
16777
- pixelCount: number(),
16778
- intensity: number()
16779
- })).readonly().optional(),
16780
- /** Omitted in slim projection. */
16781
- frameWidth: number().optional(),
16782
- /** Omitted in slim projection. */
16783
- frameHeight: number().optional(),
16784
- /** Populated by B5 (recording playback URL for this event). */
16785
- mediaUrl: string().optional()
16786
- });
16667
+ image: _instanceof(Uint8Array).optional(),
16668
+ referenceImage: string().optional(),
16669
+ deviceId: number().optional(),
16670
+ sessionId: string().optional(),
16671
+ /**
16672
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16673
+ * reference-image, and detail-subtree calls. 'frame' is the live
16674
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16675
+ * (inputClasses ≠ null) are skipped and served per-track via
16676
+ * pipelineRunner.runDetailSubtree (two-plane design).
16677
+ */
16678
+ plane: _enum(["full", "frame"]).optional(),
16679
+ /**
16680
+ * Inference-device selector (Phase 2 multi-device). Format
16681
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16682
+ * Omitted ⇒ the runner's default device (current single-engine
16683
+ * behaviour). Selects WHICH device pool of the node runs the call.
16684
+ */
16685
+ deviceKey: string().optional(),
16686
+ /**
16687
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16688
+ * when the parent crop was resolved from the frame's retained NATIVE
16689
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16690
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16691
+ * resolution from that surface — the SAME quality path faces already
16692
+ * had — instead of the downscaled parent tile. `handle` keys the native
16693
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16694
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16695
+ * the executor's crop-normalized child ROI back into frame-normalized
16696
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16697
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16698
+ * (today's behaviour on the fallback path).
16699
+ */
16700
+ nativeCropRef: NativeCropRefSchema.optional()
16701
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16702
+ engine: PipelineEngineChoiceSchema.optional(),
16703
+ steps: array(PipelineStepInputSchema).min(1),
16704
+ frames: array(FrameInputSchema).min(1).max(255),
16705
+ deviceId: number().optional(),
16706
+ sessionId: string().optional(),
16707
+ /**
16708
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16709
+ * the batch to the Python pool's bench preprocess cache
16710
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16711
+ * preprocessed ONCE and every later inference is a pure-inference cache
16712
+ * hit — the sustained-throughput run measures inference, not
16713
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16714
+ * full preprocess every call, correct). Fresh per sustained run;
16715
+ * released via `uncacheFrame`.
16716
+ */
16717
+ frameId: number().int().nonnegative().optional(),
16718
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16719
+ deviceKey: string().optional()
16720
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16721
+ data: _instanceof(Uint8Array),
16722
+ width: number().int().positive(),
16723
+ height: number().int().positive(),
16724
+ format: _enum([
16725
+ "rgb",
16726
+ "bgr",
16727
+ "gray"
16728
+ ])
16729
+ }), object({
16730
+ frameId: number(),
16731
+ width: number(),
16732
+ height: number()
16733
+ }), { kind: "mutation" }), method(object({
16734
+ stepId: string(),
16735
+ frameId: number().int()
16736
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16737
+ batchMode: string(),
16738
+ windowMs: number(),
16739
+ maxBatchSize: number(),
16740
+ concurrency: number()
16741
+ })), method(_void(), array(object({
16742
+ engineKey: string(),
16743
+ engine: PipelineEngineChoiceSchema,
16744
+ modelsLoaded: array(string()).readonly(),
16745
+ inUseByCameras: array(number()).readonly(),
16746
+ /**
16747
+ * Origin of this resident factory.
16748
+ * - `runtime` — main camera-serving engine (no idle TTL).
16749
+ * - `warm-override` — benchmark/test override held in the warm
16750
+ * cache; auto-disposed after the idle TTL.
16751
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16752
+ * multi-device, keyed by `deviceKey`) resolved
16753
+ * via `resolveDeviceFactory`. Runs alongside the
16754
+ * `runtime` engine on a DIFFERENT accelerator
16755
+ * (NPU / iGPU / Coral) — this is how the
16756
+ * Engines tab shows all pools running at once.
16757
+ */
16758
+ kind: _enum([
16759
+ "runtime",
16760
+ "warm-override",
16761
+ "device-pool"
16762
+ ]),
16763
+ /** Native pid of the underlying Python pool (null when no pool). */
16764
+ poolPid: number().nullable(),
16765
+ /** ms since this factory was last used (null when not warm-tracked). */
16766
+ idleMs: number().nullable(),
16767
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16768
+ idleTtlMs: number().nullable()
16769
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16770
+ kind: "mutation",
16771
+ auth: "admin"
16772
+ }), method(object({
16773
+ engine: PipelineEngineChoiceSchema,
16774
+ force: boolean().optional()
16775
+ }), object({
16776
+ success: boolean(),
16777
+ reason: string().optional()
16778
+ }), {
16779
+ kind: "mutation",
16780
+ auth: "admin"
16781
+ }), 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({
16782
+ addonId: string(),
16783
+ modelId: string(),
16784
+ filename: string().optional(),
16785
+ settings: record(string(), unknown()).optional()
16786
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16787
16787
  /**
16788
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16789
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16790
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16791
- * tracking, per-kind persistence) but stay distinguishable so consumers
16792
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16793
- * Absent on legacy rows ⇒ treat as `pipeline`.
16788
+ * Per-stage gating mode applied to the zones a rule references.
16789
+ *
16790
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16791
+ * When at least one `include` rule fires for a stage, only entities
16792
+ * inside one of those zones pass that stage.
16793
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16794
+ * Entities inside one of those zones are dropped at that stage.
16795
+ *
16796
+ * `monitor`-style observation (count without filtering) is not a rule
16797
+ * mode — zones without any matching rule are observed naturally by
16798
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16799
+ * count, not filter" use case needs no rule at all.
16794
16800
  */
16795
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16801
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16796
16802
  /**
16797
- * The confirmed zone crossing that produced an object event. Present ONLY on
16798
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16799
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16800
- * appearance event carry none, so a rule asking for a direction fails closed
16801
- * on them.
16803
+ * Per-consumer rule that references existing zones (geometry) and
16804
+ * defines how a specific pipeline stage should treat them. Each
16805
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16806
+ * settings:
16802
16807
  *
16803
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16804
- * into its own event, so a frame in which a track enters A while leaving B
16805
- * produces two events with two directions — never one ambiguous row.
16808
+ * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
16809
+ * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
16810
+ * - future: notification rules, audio gating, etc.
16806
16811
  *
16807
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16808
- * membership the box has NOW, and by definition it no longer contains the zone
16809
- * that was just left. Without the id here, a zone-scoped rule could never match
16810
- * the exit it asked for.
16812
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16813
+ * express "ignore motion in ALL of {garden, street}" with a single
16814
+ * rule. `classFilter` narrows the rule to specific object classes —
16815
+ * "drop person detections in the street, but keep cars" is one
16816
+ * `exclude` rule with `classFilter: ['person']`.
16817
+ *
16818
+ * `enabled` is a soft toggle — the operator can keep the rule
16819
+ * configured but inert without deleting it.
16811
16820
  */
16812
- var ZoneCrossingSchema = object({
16813
- direction: _enum(["enter", "exit"]),
16814
- /** Admin zone id crossed. */
16815
- zoneId: string(),
16816
- /** Zone display name at crossing time (falls back to the id). */
16817
- zoneName: string().optional()
16818
- });
16819
- var ObjectEventSchema = object({
16820
- ...BaseEventFields,
16821
- kind: literal("object"),
16822
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16823
- source: DetectionSourceSchema.optional(),
16821
+ var ZoneRuleSchema = object({
16822
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16823
+ id: string(),
16824
+ /** Optional human-readable label rendered in the rule editor. */
16825
+ name: string().optional(),
16826
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16827
+ * listed zones (OR-set: a detection in any one of them counts).
16828
+ * At least one zone id required — a rule with no targets is a
16829
+ * configuration mistake and the form validator rejects it. */
16830
+ zoneIds: array(string()).min(1).readonly(),
16831
+ mode: ZoneRuleModeEnum,
16824
16832
  /**
16825
- * Inference-frame id shared by every object event emitted from the SAME frame
16826
- * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16827
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16828
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16829
- * Optional for backward-compat with pre-existing rows / the slim projection
16830
- * includes it (it is light). Absent on rows written before this field.
16833
+ * Class names this rule applies to. Empty / undefined ⇒ rule
16834
+ * applies to every class. Class strings match the `macroClass`
16835
+ * field on detections (e.g. `person`, `car`, `dog`).
16831
16836
  */
16832
- frameId: string().optional(),
16833
- /** Omitted in slim projection. */
16834
- trackId: string().optional(),
16835
- className: string(),
16836
- ...TieredLabelFields,
16837
- /** Omitted in slim projection. */
16838
- confidence: number().optional(),
16839
- /** Heavy JSON — omitted in slim projection. */
16840
- bbox: BoundingBoxSchema.optional(),
16841
- /** Heavy JSON — omitted in slim projection. */
16842
- zones: array(string()).readonly().optional(),
16843
- /** Omitted in slim projection. */
16844
- state: TrackStateSchema.optional(),
16837
+ classFilter: array(string()).readonly().optional(),
16845
16838
  /**
16846
- * The zone crossing this event IS, when it is one. Absent on every other
16847
- * event kind (movement state, appearance, package) — see
16848
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16839
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16840
+ * required to consider an entity "in the zone". Defaults to the
16841
+ * consumer's stage default when omitted. Kept for back-compat with
16842
+ * existing per-rule overrides; new operators pick the value via
16843
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16844
+ * set, the lower-level engine reads it as a 0–1 fraction.
16849
16845
  */
16850
- zoneCrossing: ZoneCrossingSchema.optional(),
16851
- /** Detection-frame dimensions in pixels — let consumers normalize the
16852
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
16853
- frameWidth: number().optional(),
16854
- frameHeight: number().optional(),
16855
- /** MediaStore key for the crop attached to this event (if any). */
16856
- mediaKey: string().optional(),
16857
- /** Design B: MediaStore key of the track's native-resolution key frame (the
16858
- * best-detection full frame). Resolve via the event-media data-plane
16859
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
16860
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
16861
- * sources — consumers fall back to `mediaKey` (the tight crop). */
16862
- keyFrameMediaKey: string().optional(),
16863
- /** Populated by B5 (recording playback URL for this event). */
16864
- mediaUrl: string().optional(),
16865
- /** The parent track's key-event importance [0,1], propagated to every object
16866
- * event of the track (so an event row can be sorted by importance without a
16867
- * track join). Absent on legacy rows / before the track was scored. */
16868
- importance: number().optional()
16869
- });
16870
- var AudioEventSchema = object({
16871
- ...BaseEventFields,
16872
- kind: literal("audio"),
16873
- rms: number(),
16874
- dbfs: number(),
16875
- classification: object({
16876
- className: string(),
16877
- originalClass: string().optional(),
16878
- score: number()
16879
- }).optional(),
16880
- /** Populated by B5 (recording playback URL for this event). */
16881
- mediaUrl: string().optional()
16882
- });
16883
- var MediaFileKindEnum = _enum([
16884
- "crop",
16885
- "thumbnail",
16886
- "snapshot",
16887
- "firstFrame",
16888
- "lastFrame",
16889
- "fullFrame",
16890
- "fullFrameBoxed",
16891
- "faceCrop",
16892
- "plateCrop",
16893
- "keyFrame",
16894
- "keyFrameSmall",
16895
- "thumbnailSmall"
16896
- ]);
16897
- var MediaFileSchema = object({
16898
- key: string(),
16899
- kind: MediaFileKindEnum,
16900
- base64: string(),
16901
- sizeBytes: number(),
16902
- timestamp: number()
16846
+ overlapThreshold: number().min(0).max(1).optional(),
16847
+ /**
16848
+ * Operator-friendly version of `overlapThreshold` — the percentage
16849
+ * of the detection's bbox that must lie inside the zone for the
16850
+ * rule to match. Documented default is 85%; the engine substitutes
16851
+ * that when the field is omitted (kept optional so existing rules
16852
+ * stored without it stay valid).
16853
+ *
16854
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16855
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16856
+ * field exposed in the UI. Internally both feed the same gate.
16857
+ */
16858
+ bboxInclusionPct: number().min(0).max(100).optional(),
16859
+ /**
16860
+ * When `true` and a detection has a segmentation mask, use the
16861
+ * mask for overlap instead of the bbox. Detection-stage only;
16862
+ * motion rules ignore this field.
16863
+ */
16864
+ preferMask: boolean().optional(),
16865
+ /**
16866
+ * Soft-toggle: `false` disables the rule without deleting it.
16867
+ * Defaults to `true` so operators creating a rule via the UI
16868
+ * see it active immediately.
16869
+ */
16870
+ enabled: boolean().default(true)
16903
16871
  });
16872
+ array(ZoneRuleSchema).readonly();
16904
16873
  /**
16905
- * One media row WITHOUT its bytes.
16874
+ * Zone — pure geometry + identity. NO filtering behaviour.
16906
16875
  *
16907
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
16908
- * 140 s track), and a client that renders tiles from the media data plane needs
16909
- * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
16910
- * with an immutable cache, instead of all at once inside a tRPC response that
16911
- * blocks the whole view.
16876
+ * Zones describe **where** in the frame the operator wants to flag
16877
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16878
+ * each pipeline stage uses them. Splitting the two means a single
16879
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16880
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16881
+ * — without three duplicated polygons.
16912
16882
  *
16913
- * `sizeBytes` is carried because it is what lets a client decide between the
16914
- * stored blob and a `?variant=thumb` rendering without fetching either.
16883
+ * Owned by the orchestrator addon (provider) and mirrored into the
16884
+ * `zones` device-state slice on every mutation. Consumers
16885
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16886
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16887
+ * mirror with `onChanged`).
16888
+ *
16889
+ * Coordinates are normalised fractions of the frame (0–1) so zones
16890
+ * survive resolution changes and stream profile switches.
16891
+ *
16892
+ * `kind` discriminates between full polygons (closed regions used
16893
+ * for intrusion / occupancy filters) and tripwires (open 2-point
16894
+ * line segments used for cross events). Onboard / firmware-reported
16895
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
16896
+ * task list.
16915
16897
  */
16916
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
16898
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
16899
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
16900
+ var PolygonPointSchema = object({
16901
+ x: number(),
16902
+ y: number()
16903
+ });
16904
+ /** A camera detection zone — pure geometry/identity. */
16905
+ var ZoneSchema = object({
16906
+ id: string(),
16907
+ name: string(),
16908
+ kind: ZoneKindEnum.default("polygon"),
16909
+ /** Polygon vertices, fraction of frame (0–1). */
16910
+ polygon: array(PolygonPointSchema).readonly(),
16911
+ /** Visual color for UI rendering. */
16912
+ color: string().default("#3b82f6")
16913
+ });
16914
+ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
16915
+ deviceId: number(),
16916
+ zone: ZoneSchema
16917
+ }), _void(), {
16918
+ kind: "mutation",
16919
+ auth: "admin"
16920
+ }), method(object({
16921
+ deviceId: number(),
16922
+ zoneId: string()
16923
+ }), _void(), {
16924
+ kind: "mutation",
16925
+ auth: "admin"
16926
+ }), method(object({
16927
+ deviceId: number(),
16928
+ zone: ZoneSchema
16929
+ }), _void(), {
16930
+ kind: "mutation",
16931
+ auth: "admin"
16932
+ }), object({ zones: array(ZoneSchema).readonly() });
16917
16933
  /**
16918
- * The MACRO tier of an annotation — a CLOSED set.
16934
+ * pipeline-analytics — device-scoped wrapper cap. Refines raw
16935
+ * per-frame detections emitted by the pipeline runner into tracked
16936
+ * objects, per-kind event collections (motion / object / audio), and
16937
+ * persisted media. Owns the post-detection domain end-to-end:
16919
16938
  *
16920
- * This is what the exported detector predicts, so a typo here is a new class
16921
- * with one example in it. `label` and `subLabel` are open strings by contrast:
16922
- * the whole point of the page is teaching the model things it does not know
16923
- * yet, and constraining that vocabulary would make it useless.
16939
+ * runner emits PipelineInferenceResult
16940
+ * ↓ (event bus)
16941
+ * pipeline-analytics subscriber
16942
+ * ↓ SORT tracker + zone engine + state analyzer + event emitter
16943
+ * → three DB collections (one per kind), one FS media tree, one
16944
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
16945
+ * DetectionEvent on bus)
16924
16946
  *
16925
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
16926
- * `subLabel` is one of these values, in any casing, because once `person`
16927
- * exists in both tiers "every person box" stops being answerable without
16928
- * knowing every string anyone ever typed — and the damage is retroactive.
16947
+ * Pure subscriber model. No `processFrame` cap method — the runner
16948
+ * already publishes the raw frame on the bus. The cap surface is
16949
+ * only QUERIES + per-device settings, bound on/off via
16950
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
16951
+ * every camera with a detection pipeline wants its raw detections
16952
+ * refined; operators opt out per-device via BindingsTab when needed.
16953
+ *
16954
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16955
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
16929
16956
  */
16930
- var RetrainMacroClassSchema = _enum([
16957
+ var TrackStateSchema = _enum([
16958
+ "new",
16959
+ "entered",
16960
+ "left",
16961
+ "moving",
16962
+ "idle"
16963
+ ]);
16964
+ var EventKindSchema = _enum([
16965
+ "motion",
16966
+ "object",
16967
+ "audio"
16968
+ ]);
16969
+ /**
16970
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16971
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16972
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
16973
+ */
16974
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16975
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
16976
+ var EventKindIconSchema = _enum([
16977
+ "motion",
16978
+ "audio",
16931
16979
  "person",
16932
16980
  "vehicle",
16933
16981
  "animal",
16982
+ "door",
16983
+ "pir",
16984
+ "smoke",
16985
+ "water",
16986
+ "button",
16934
16987
  "package",
16935
- "face",
16936
- "plate"
16988
+ "generic"
16937
16989
  ]);
16938
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
16939
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
16940
- /** Did a human draw this box, or did the assist propose it? */
16941
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
16942
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
16943
- var RetrainBboxSchema = object({
16944
- x: number(),
16945
- y: number(),
16946
- w: number(),
16947
- h: number()
16948
- });
16949
- /**
16950
- * One annotated subject.
16951
- *
16952
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
16953
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
16954
- * derived from it at export and never stored — storing them is how one feature
16955
- * space ends up holding two crops of the same subject (D52).
16956
- */
16957
- var RetrainAnnotationSchema = object({
16958
- id: string(),
16959
- trackId: string(),
16960
- deviceId: number(),
16961
- /** The COPY in retrain storage — never the source track's media key. */
16962
- mediaKey: string(),
16963
- bbox: RetrainBboxSchema,
16964
- macroClass: RetrainMacroClassSchema,
16965
- label: string().optional(),
16966
- subLabel: string().optional(),
16967
- kind: RetrainAnnotationKindSchema,
16968
- source: RetrainAnnotationSourceSchema,
16969
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
16970
- assistModelId: string().optional(),
16971
- assistScore: number().optional(),
16972
- exportedInBatch: string().optional(),
16973
- createdAt: number()
16974
- });
16975
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
16976
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
16977
- id: true,
16978
- trackId: true,
16979
- deviceId: true,
16980
- mediaKey: true,
16981
- createdAt: true,
16982
- exportedInBatch: true
16990
+ var EventKindCategorySchema = _enum([
16991
+ "motion",
16992
+ "audio",
16993
+ "detection",
16994
+ "sensor",
16995
+ "control",
16996
+ "custom",
16997
+ "package"
16998
+ ]);
16999
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
17000
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
17001
+ var EventKindDescriptorSchema = object({
17002
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
17003
+ kind: string(),
17004
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
17005
+ labelKey: string(),
17006
+ /** English fallback label (kept for clients that don't translate). */
17007
+ label: string(),
17008
+ /** Hex color for timeline/legend rendering. */
17009
+ color: string(),
17010
+ /** Dictionary id → lucide component on the UI side. */
17011
+ iconId: string(),
17012
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
17013
+ icon: EventKindIconSchema,
17014
+ category: EventKindCategorySchema,
17015
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
17016
+ parentKind: string().nullable(),
17017
+ /** Derived from `parentKind`, explicit for the client tree. */
17018
+ level: EventKindLevelSchema,
17019
+ /** Which cap + device contributes this kind. For built-ins the camera
17020
+ * itself; for sensor kinds the LINKED source device. */
17021
+ source: object({
17022
+ capName: string(),
17023
+ deviceId: number()
17024
+ })
16983
17025
  });
16984
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
16985
- var RetrainTrackSchema = object({
16986
- trackId: string(),
17026
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
17027
+ var EventKindsForDeviceSchema = object({
16987
17028
  deviceId: number(),
16988
- className: string(),
16989
- label: string().optional(),
16990
- firstSeen: number(),
16991
- lastSeen: number(),
16992
- /** How many frames the dataset already holds from this track. */
16993
- frameCount: number().int(),
16994
- /** How many subjects have been annotated on those frames. `0` with
16995
- * `frameCount: 0` is exactly "staging, still to work". */
16996
- annotationCount: number().int()
16997
- });
16998
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
16999
- var RetrainFrameCandidateSchema = object({
17000
- mediaKey: string(),
17001
- kind: MediaFileKindEnum,
17002
- timestamp: number(),
17003
- sizeBytes: number().int(),
17004
- /** A copy of this original already exists — selecting it is free and cannot
17005
- * fail, whatever became of the original. */
17006
- copied: boolean()
17029
+ kinds: array(EventKindDescriptorSchema).readonly()
17007
17030
  });
17008
- /** A frame the dataset OWNS: bytes copied at selection time. */
17009
- var RetrainFrameSchema = object({
17010
- frameId: string(),
17031
+ var SensorEventSchema = object({
17032
+ id: string(),
17033
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
17034
+ * yields N rows, one per camera). */
17011
17035
  deviceId: number(),
17012
- trackId: string(),
17013
- /** Provenance only. It may already point at nothing — that is expected. */
17014
- sourceMediaKey: string(),
17015
- sourceKind: MediaFileKindEnum,
17016
- sizeBytes: number().int(),
17017
- width: number().int(),
17018
- height: number().int(),
17019
- copiedAt: number()
17036
+ /** The linked sensor device whose state changed. */
17037
+ sourceDeviceId: number(),
17038
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
17039
+ kind: string(),
17040
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
17041
+ value: record(string(), unknown()).nullable(),
17042
+ timestamp: number()
17020
17043
  });
17021
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17022
- var RetrainCopyRefusalSchema = _enum([
17023
- "source-missing",
17024
- "unreadable-image",
17025
- "write-failed"
17026
- ]);
17027
- var RetrainFrameSelectionSchema = object({
17028
- copied: array(RetrainFrameSchema).readonly(),
17029
- refused: array(object({
17030
- sourceMediaKey: string(),
17031
- reason: RetrainCopyRefusalSchema
17032
- })).readonly()
17044
+ var TrackPositionSchema = object({
17045
+ x: number(),
17046
+ y: number(),
17047
+ timestamp: number(),
17048
+ bbox: BoundingBoxSchema
17033
17049
  });
17034
- var RetrainFrameListSchema = object({
17035
- candidates: array(RetrainFrameCandidateSchema).readonly(),
17036
- copies: array(RetrainFrameSchema).readonly(),
17037
- /** What the page pre-selects — the native key frame when one survives. */
17038
- autoPickMediaKey: string().optional()
17050
+ var TrackSnapshotSchema = object({
17051
+ timestamp: number(),
17052
+ position: TrackPositionSchema,
17053
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
17054
+ mediaKey: string()
17039
17055
  });
17040
- /** What the operator asked the assist to look for. */
17041
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17042
- kind: literal("package"),
17043
- zone: RetrainBboxSchema.optional()
17044
- }), object({
17045
- kind: literal("objects"),
17046
- modelId: string(),
17047
- minScore: number().optional()
17048
- })]);
17049
17056
  /**
17050
- * The assist's answer — a discriminated union, because "the model saw nothing"
17051
- * and "this node cannot run that model" lead to different next moves and a
17052
- * nullable result cannot tell them apart.
17057
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
17058
+ * divided by the track's detection-frame dims), computed at persist time.
17059
+ * Absent when the frame dims were unknown when the track was persisted
17060
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
17053
17061
  */
17054
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17055
- kind: literal("proposed"),
17056
- modelId: string(),
17057
- stepId: string(),
17058
- minScore: number(),
17059
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17060
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
17061
- /** Returned by the runner but removed by the threshold. */
17062
- belowThreshold: number().int()
17063
- }), object({
17064
- kind: literal("refused"),
17065
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17066
- reason: string(),
17067
- detail: string().optional()
17068
- })]);
17069
- /** The outcome of a lifecycle move owned by the retrain page. */
17070
- var RetrainTransitionResultSchema = object({
17071
- trackId: string(),
17072
- /** Where the track ended up, whatever happened. */
17073
- retrainStatus: RetrainStatusSchema,
17074
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17075
- changed: boolean(),
17076
- reason: _enum([
17077
- "unknown-track",
17078
- "no-frames-copied",
17079
- "not-staging",
17080
- "not-trained",
17081
- "unchanged"
17082
- ]).optional()
17083
- });
17084
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17085
- var MAX_EVENT_QUERY_LIMIT = 5e3;
17086
- var DeviceEventQueryInput = object({
17087
- deviceId: number(),
17088
- since: number().optional(),
17089
- until: number().optional(),
17090
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17091
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17092
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17093
- * exact behaviour. Callers may omit this field — the store defaults to
17094
- * `full` when not provided. */
17095
- projection: _enum(["full", "slim"]).optional()
17096
- });
17097
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17098
- var RecentTracksQueryInput = object({
17099
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17100
- deviceIds: array(number()),
17101
- /** Window lower bound on `lastSeen` (inclusive). */
17102
- since: number().optional(),
17103
- /** Window upper bound on `lastSeen` (inclusive). */
17104
- until: number().optional(),
17105
- /** Page size. Default 200, max 1000. */
17106
- limit: number().int().min(1).max(1e3).default(200),
17107
- /** Opaque continuation cursor from a previous page's `nextCursor`.
17108
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17109
- cursor: string().optional(),
17110
- /** See {@link TrackProjectionSchema}. Default `full`. */
17111
- projection: TrackProjectionSchema.optional(),
17112
- /** Include stationary-promoted rows (parked objects). Default false: the
17113
- * feed lists passages; parking records live on the stationary registry. */
17114
- includeStationary: boolean().optional()
17062
+ var TrackEnvelopeSchema = object({
17063
+ minX: number(),
17064
+ minY: number(),
17065
+ maxX: number(),
17066
+ maxY: number()
17115
17067
  });
17116
- var RecentTracksPageSchema = object({
17117
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17118
- tracks: array(TrackSchema).readonly(),
17119
- /** Cursor for the next page, or null when this page is the last. */
17120
- nextCursor: string().nullable()
17121
- });
17122
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
17123
- var LIST_GROUPS_MAX_LIMIT = 100;
17124
- var AnalyticsGroupRecordSchema = object({
17125
- id: string(),
17126
- deviceId: number().int(),
17127
- openedAt: number().int(),
17128
- closedAt: number().int(),
17129
- timestamp: number().int(),
17130
- memberCount: number().int(),
17131
- memberTrackIds: array(string()).readonly(),
17132
- className: string(),
17133
- classes: array(string()).readonly(),
17134
- /** Relative event-media path, or null when the group has no picture yet. */
17135
- mediaUrl: string().nullable(),
17136
- singleton: boolean()
17137
- });
17138
- var AnalyticsGroupMemberSchema = object({
17139
- trackId: string(),
17140
- deviceId: number().int(),
17141
- className: string(),
17142
- firstSeen: number().int(),
17143
- lastSeen: number().int(),
17144
- mediaUrl: string().nullable()
17145
- });
17146
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17147
- var ListGroupsQueryInput = object({
17148
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17149
- deviceIds: array(number()),
17150
- /** Window lower bound on `closedAt` (inclusive). */
17151
- since: number().optional(),
17152
- /** Window upper bound on `openedAt` (inclusive). */
17153
- until: number().optional(),
17154
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17155
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
17156
- cursor: string().optional()
17157
- });
17158
- var ListGroupsPageSchema = object({
17159
- groups: array(AnalyticsGroupRecordSchema).readonly(),
17160
- nextCursor: string().nullable()
17161
- });
17162
- var KeyEventQueryInput = object({
17163
- deviceId: number(),
17164
- /** Window lower bound (track firstSeen ≥ since). */
17165
- since: number(),
17166
- /** Window upper bound (track firstSeen ≤ until). */
17167
- until: number(),
17168
- limit: number().int().min(1).max(200).default(50),
17169
- /** Drop tracks scoring below this importance. */
17170
- minImportance: number().min(0).max(1).optional(),
17171
- /** Restrict to a single class (e.g. 'person'). */
17172
- classFilter: string().optional()
17173
- });
17174
- var KeyEventSchema = object({
17175
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
17176
- id: string(),
17177
- trackId: string(),
17178
- /** Track start time (firstSeen). */
17179
- timestamp: number(),
17180
- className: string(),
17181
- ...TieredLabelFields,
17182
- importance: number(),
17183
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
17184
- bestEventId: string(),
17185
- /** Track lifetime in ms (lastSeen - firstSeen). */
17186
- windowMs: number().optional(),
17187
- ...TrackFlagFields,
17188
- ...TrackRetrainFields
17189
- });
17190
- object({
17191
- trackId: string(),
17192
- className: string(),
17193
- confidence: number(),
17194
- bbox: BoundingBoxSchema,
17195
- zones: array(string()).readonly(),
17196
- state: TrackStateSchema
17197
- });
17198
- var OverlayDetectionSchema = looseObject({
17199
- id: string(),
17200
- kind: _enum(["first-level", "detail"]),
17201
- macroClass: string(),
17202
- score: number(),
17203
- bbox: object({
17204
- x: number(),
17205
- y: number(),
17206
- width: number(),
17207
- height: number()
17208
- }),
17209
- labels: array(looseObject({
17210
- label: string(),
17211
- score: number()
17212
- })).readonly(),
17213
- parentId: string().optional()
17214
- });
17215
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17216
- var SearchObjectEventsInput = object({
17217
- text: string(),
17218
- deviceId: number().optional(),
17219
- since: number().optional(),
17220
- until: number().optional(),
17221
- classFilter: string().optional(),
17222
- limit: number().default(50),
17223
- minScore: number().min(0).max(1).default(.2)
17224
- });
17225
- var TrackCascadeCountsSchema = object({
17226
- /** Persisted track roots deleted (authoritative). */
17227
- tracks: number().int(),
17228
- /** Object events removed with their tracks (best-effort; see note above). */
17229
- events: number().int(),
17230
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17231
- media: number().int(),
17232
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17233
- faces: number().int(),
17234
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17235
- plates: number().int(),
17236
- /** Per-track CLIP search vectors removed (best-effort). */
17237
- embeddings: number().int(),
17238
- /** Group membership + group rows removed with their last member (best-effort). */
17239
- groups: number().int()
17240
- });
17241
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17242
- var DiskReconcileCountsSchema = object({
17243
- mediaDropped: number().int(),
17244
- tracks: number().int(),
17245
- events: number().int()
17246
- });
17247
- /** Event-store footprint for one camera. */
17248
- var EventStoreDeviceFootprintSchema = object({
17249
- deviceId: number(),
17250
- /** Persisted event rows (motion + object + audio) for the camera. */
17251
- rows: number().int(),
17252
- /** Event-owned media bytes on disk for the camera. */
17253
- bytes: number().int()
17254
- });
17255
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17256
- var EventStoreFootprintSchema = object({
17257
- totalRows: number().int(),
17258
- totalBytes: number().int(),
17259
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17260
- });
17261
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17262
- var EventPruneCountsSchema = object({
17263
- motion: number().int(),
17264
- object: number().int(),
17265
- audio: number().int()
17068
+ /**
17069
+ * Row projection for track list queries. `full` (default) returns the
17070
+ * complete Track including the frame-rate `positions[]` history and the
17071
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
17072
+ * keeps every scalar the list surfaces actually render (ids, class(es),
17073
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
17074
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
17075
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
17076
+ * `getTrack`. Mirrors the event-store `projection` convention
17077
+ * (`getObjectEvents` et al.).
17078
+ */
17079
+ var TrackProjectionSchema = _enum(["full", "slim"]);
17080
+ /**
17081
+ * One audio-classification label heard on the track's camera while the
17082
+ * track was alive, aggregated per label. An "episode" is one persisted
17083
+ * audio event (the confident-classification path: score ≥ the device's
17084
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
17085
+ * one 32 ms inference chunk, so counts stay human-scaled.
17086
+ */
17087
+ var TrackAudioLabelSchema = object({
17088
+ label: string(),
17089
+ /** Highest classification score observed across the label's episodes. */
17090
+ peakScore: number(),
17091
+ /** Number of coalesced audio-event episodes carrying this label. */
17092
+ count: number(),
17093
+ firstAt: number(),
17094
+ lastAt: number()
17266
17095
  });
17267
17096
  /**
17268
- * Re-embed stored tracks from their key frames.
17097
+ * How a track was produced. `pipeline` (default / absent) = the spatial
17098
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
17099
+ * no positions, a single snapshot, and no bbox trajectory at all:
17269
17100
  *
17270
- * The reason this is an operator-callable method and not a migration script:
17271
- * every knob that decides what a vector MEANS — encoder model, crop margin,
17272
- * squaring — is only changeable if the existing vectors can be regenerated.
17273
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17274
- * symptom is a quality regression with no visible cause.
17101
+ * - `sensor` — a linked sensor/control device state change.
17102
+ * - `audio` — an audio event on the camera itself that was anomalous for
17103
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
17104
+ *
17105
+ * The spatial subsystems (tracker association, occupancy count, re-id /
17106
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
17107
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
17108
+ * check silently readmits every source added after it was written.
17275
17109
  */
17276
- var RebuildObjectEmbeddingsInput = object({
17277
- /** Restrict to one camera. Omit for the whole fleet. */
17278
- deviceId: number().optional(),
17279
- since: number().optional(),
17280
- until: number().optional(),
17281
- /** Stop after this many tracks; the result reports whether more remain. */
17282
- maxTracks: number().int().positive().optional(),
17283
- /**
17284
- * Run every embedding on THIS node instead of round-robining the fleet.
17285
- *
17286
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17287
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17288
- * calling it that would pin the rebuild REQUEST itself to that node — the
17289
- * rebuild orchestration lives on the hub, and only the per-track step runs
17290
- * remotely. This field is data; the per-track pin is applied inside.
17291
- *
17292
- * Absent ⇒ round-robin over every online node whose runner can serve the
17293
- * pinned model.
17294
- */
17295
- executeOnNodeId: string().optional(),
17296
- /**
17297
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17298
- * run flat out.
17299
- *
17300
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17301
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17302
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17303
- * force is logged at start and finish so a deliberately slow pass reads
17304
- * differently from a stalled one.
17305
- */
17306
- pacingMs: number().int().nonnegative().optional()
17307
- });
17110
+ var TrackSourceSchema = _enum([
17111
+ "pipeline",
17112
+ "sensor",
17113
+ "audio"
17114
+ ]);
17308
17115
  /**
17309
- * Result of emptying the CLIP index.
17116
+ * Where a track sits in the RETRAIN lifecycle (D81).
17310
17117
  *
17311
- * The clean slate before a policy change: a new crop margin or encoder model
17312
- * leaves two feature spaces in one index whose cosine scores are not
17313
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17314
- * means the same thing.
17118
+ * - `none` — never marked, or un-marked. Evictable.
17119
+ * - `staging` — the operator wants this track as training material and has not
17120
+ * finished with it. **This is the only state retention holds**: the track and
17121
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
17122
+ * the device's age window.
17123
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
17124
+ * were COPIED into the retrain dataset at selection time, so the dataset no
17125
+ * longer depends on the track's media and the track becomes EVICTABLE again.
17126
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
17127
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
17128
+ *
17129
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
17130
+ * the store's filter language has only positive equality and `whereIn` — no
17131
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
17132
+ * would make the entire pre-column history immortal in one deploy.
17315
17133
  */
17316
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17134
+ var RetrainStatusSchema = _enum([
17135
+ "none",
17136
+ "staging",
17137
+ "trained"
17138
+ ]);
17317
17139
  /**
17318
- * Acknowledgement that a rebuild STARTED.
17140
+ * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
17141
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
17142
+ * so the two surfaces cannot drift.
17319
17143
  *
17320
- * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17321
- * runs detached and this returns immediately. Waiting for it made the client
17322
- * time out while the work carried on server-side, which is the worst of both:
17323
- * no result and no way to know it was still going. Poll
17324
- * `getObjectEmbeddingRebuildStatus` for progress.
17144
+ * **Absent ≠ false.** A track that has never been touched omits the field; an
17145
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
17146
+ * columns existed read as absent, and a consumer that needs a boolean should say
17147
+ * `flag === true`, not `flag !== false`.
17148
+ *
17149
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
17150
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
17151
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
17152
+ * `trained` track reports `false` while refusing both writes. The boolean is
17153
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
17154
+ * "never marked" from "already trained" must read `retrainStatus`.
17155
+ *
17156
+ * `debug` does NOT pin; it is attention, not durability.
17157
+ *
17158
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17159
+ * A favourited track is skipped by retention the same way `staging` is, but
17160
+ * it does not enter `none|staging|trained` and has no staging budget.
17325
17161
  */
17326
- var RebuildObjectEmbeddingsResultSchema = object({
17327
- started: boolean(),
17328
- /** True when a pass was already running; the new request is ignored. */
17329
- alreadyRunning: boolean()
17330
- });
17331
- var RebuildStatusSchema = object({
17332
- running: boolean(),
17333
- scanned: number(),
17334
- rebuilt: number(),
17335
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17336
- missingKeyFrame: number(),
17337
- /** Tracks with no usable detection box. */
17338
- missingBbox: number(),
17339
- /**
17340
- * Tracks an executing node REFUSED rather than broke on — an unreadable key
17341
- * frame, a step that threw. Separate from `failed` because the remedy is
17342
- * different, and because a whole camera silently contributing zero vectors
17343
- * is the shape of failure a rebuild must never hide.
17344
- */
17345
- notRunnable: number(),
17162
+ var TrackFlagFields = {
17163
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
17164
+ * `'staging'`. */
17165
+ markForTrain: boolean().optional(),
17166
+ /** Operator marked this track for diagnostic attention. */
17167
+ debug: boolean().optional(),
17168
+ /** Operator favourited this track. Pins it against pruning. */
17169
+ favourited: boolean().optional()
17170
+ };
17171
+ /**
17172
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
17173
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
17174
+ * write patch, and the status is not something the toggle sets — it is what the
17175
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
17176
+ * always present on a persisted row (the column default materialises `'none'`).
17177
+ */
17178
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
17179
+ /**
17180
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
17181
+ * one flag can never clear the other — the toggles are independent and are
17182
+ * driven from three surfaces that do not know about each other.
17183
+ */
17184
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
17185
+ /**
17186
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
17187
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
17188
+ * mutation result without a re-fetch.
17189
+ */
17190
+ var TrackFlagsSchema = object({
17191
+ trackId: string(),
17192
+ markForTrain: boolean(),
17193
+ debug: boolean(),
17194
+ favourited: boolean(),
17195
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
17196
+ * a track row) because this shape is only ever produced by the write body,
17197
+ * which always knows it — and a surface that has just written needs to render
17198
+ * `trained` without a re-fetch. */
17199
+ retrainStatus: RetrainStatusSchema
17200
+ });
17201
+ union([literal(1), literal(2)]);
17202
+ /**
17203
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
17204
+ * the step and model that produced it — which is what makes the write rule
17205
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17206
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17207
+ *
17208
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17209
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17210
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
17211
+ * that value has no provenance, and the write rule lets ANY properly-attributed
17212
+ * write of the same tier replace it regardless of score.
17213
+ */
17214
+ var LabelAttributionSchema = object({
17215
+ stepId: string(),
17216
+ modelId: string().optional(),
17217
+ decidedAt: number(),
17346
17218
  /**
17347
- * The pass stopped because NO node could serve the pinned model.
17219
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
17220
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17348
17221
  *
17349
- * Distinct from `notRunnable` on purpose: that one says "this track was
17350
- * refused", this one says "the cluster cannot do this work at all" — every
17351
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17352
- * pinned model for its engine format, or dropped out. The remedy is a model /
17353
- * engine change, not a per-camera one. Non-zero here always comes with
17354
- * `complete: false`.
17222
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
17223
+ * notification rule authored on "Gianluca" stopped matching the moment the
17224
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
17225
+ * the thing that does not move, so it is what a rule matches on
17226
+ * (`NcConditions.identities`) and the text is what a human is shown.
17227
+ *
17228
+ * Absent when the label names no gallery row — a plate the OCR read but no
17229
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17355
17230
  */
17356
- noCapableNode: number(),
17357
- failed: number(),
17358
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17359
- complete: boolean().nullable(),
17360
- startedAtMs: number().nullable(),
17361
- finishedAtMs: number().nullable(),
17362
- /** Present when the pass ended by throwing. */
17363
- error: string().nullable()
17231
+ identityId: string().optional()
17364
17232
  });
17365
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17366
- deviceId: number(),
17367
- trackId: string()
17368
- }), TrackSchema.nullable()), method(object({
17369
- deviceId: number(),
17370
- since: number().optional(),
17371
- until: number().optional(),
17372
- limit: number().optional(),
17373
- /** Spatial filter — only tracks whose trajectory intersects the zone
17374
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17375
- * envelope columns, then precisely tested per position. Tracks with
17376
- * an unknown envelope (no frame dims at persist time) always match. */
17377
- zone: TrackZoneFilterSchema.optional(),
17378
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17379
- * compatible — omitting the field keeps today's exact behaviour). */
17380
- projection: TrackProjectionSchema.optional(),
17381
- /** Include stationary-promoted rows (parked objects handed to the
17382
- * stationary registry). Default false: the timeline lists passages,
17383
- * not parking records (operator decision, 2026-08-15). */
17384
- includeStationary: boolean().optional()
17385
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17386
- deviceId: number(),
17387
- groupId: string().min(1)
17388
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17389
- kind: "mutation",
17390
- auth: "admin"
17391
- }), 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({
17392
- deviceId: number(),
17393
- since: number().optional(),
17394
- until: number().optional(),
17395
- kinds: array(string()).optional(),
17396
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17397
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17398
- deviceId: number(),
17399
- since: number(),
17400
- until: number(),
17401
- bucketMs: number().int().positive()
17402
- }), array(object({
17403
- bucketStart: number(),
17404
- motion: number().int(),
17405
- object: number().int(),
17406
- audio: number().int()
17407
- })).readonly()), method(object({
17408
- deviceId: number(),
17409
- cutoffMs: number()
17410
- }), object({
17411
- motion: number().int(),
17412
- object: number().int(),
17413
- audio: number().int()
17414
- }), {
17415
- kind: "mutation",
17416
- auth: "admin"
17417
- }), method(object({
17418
- deviceId: number(),
17419
- cutoffMs: number()
17420
- }), TrackCascadeCountsSchema, {
17421
- kind: "mutation",
17422
- auth: "admin"
17423
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17424
- kind: "mutation",
17425
- auth: "admin"
17426
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17427
- kind: "mutation",
17428
- auth: "admin"
17429
- }), method(object({
17430
- deviceId: number(),
17431
- trackIds: array(string()).min(1)
17432
- }), object({
17433
- deleted: number().int(),
17434
- failed: array(string()).readonly()
17435
- }), {
17436
- kind: "mutation",
17437
- auth: "admin"
17438
- }), method(object({
17439
- /** Log/audit scope only — the trackId is globally unique on its own. */
17233
+ /**
17234
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17235
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17236
+ * track and its events always answer the same question the same way.
17237
+ *
17238
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17239
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17240
+ * is tier 2, and each carries its own score + attribution.
17241
+ *
17242
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17243
+ * finest thing known. Before 4g the single `label` column held the finest
17244
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17245
+ * shows nothing on a species-only row; that is why the migration puts every
17246
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17247
+ * and why the read surfaces were changed in the same train.
17248
+ *
17249
+ * **Writing it.** The slots are independent, which is the whole point: a
17250
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17251
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17252
+ * higher score wins. One rule, one implementation — see
17253
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17254
+ */
17255
+ var TieredLabelFields = {
17256
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
17257
+ label: string().optional(),
17258
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17259
+ labelScore: number().optional(),
17260
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17261
+ labelMeta: LabelAttributionSchema.optional(),
17262
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
17263
+ subLabel: string().optional(),
17264
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17265
+ subLabelScore: number().optional(),
17266
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17267
+ subLabelMeta: LabelAttributionSchema.optional()
17268
+ };
17269
+ /** Per-camera slice of a training-export estimate. */
17270
+ var TrainingExportDeviceTotalsSchema = object({
17440
17271
  deviceId: number(),
17272
+ tracks: number().int(),
17273
+ files: number().int(),
17274
+ bytes: number().int()
17275
+ });
17276
+ /**
17277
+ * What a training export WOULD contain. Computed from media index rows only —
17278
+ * no blob is read to produce this.
17279
+ */
17280
+ var TrainingExportSummarySchema = object({
17281
+ generatedAt: number(),
17282
+ trackCount: number().int(),
17283
+ fileCount: number().int(),
17284
+ byteCount: number().int(),
17285
+ /** More marked tracks exist than a single pass carries. */
17286
+ truncated: boolean(),
17287
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17288
+ });
17289
+ var TrackSchema = object({
17441
17290
  trackId: string(),
17442
- flags: TrackFlagsPatchSchema
17443
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17444
- kind: "query",
17445
- auth: "admin"
17446
- }), method(object({
17447
- olderThanMs: number(),
17448
- reason: OpsLogReasonSchema.optional()
17449
- }), EventPruneCountsSchema, {
17450
- kind: "mutation",
17451
- auth: "admin"
17452
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17453
- kind: "mutation",
17454
- auth: "admin"
17455
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17456
- kind: "mutation",
17457
- auth: "admin"
17458
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17459
- kind: "mutation",
17460
- auth: "admin"
17461
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17462
- kind: "mutation",
17463
- auth: "admin"
17464
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17465
- kind: "mutation",
17466
- auth: "admin"
17467
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17468
- kind: "mutation",
17469
- auth: "admin"
17470
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17471
- kind: "query",
17472
- auth: "admin"
17473
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17474
- kind: "query",
17475
- auth: "admin"
17476
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17477
- kind: "query",
17478
- auth: "admin"
17479
- }), method(object({
17480
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17481
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17482
- * route it at one camera's owner, and "every camera" would stop being
17483
- * expressible at all. */
17484
- deviceIds: array(number()).optional(),
17485
- limit: number().int().min(1).max(500).optional()
17486
- }), array(RetrainTrackSchema).readonly(), {
17487
- kind: "query",
17488
- auth: "admin"
17489
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17490
- kind: "query",
17491
- auth: "admin"
17492
- }), method(object({
17493
17291
  deviceId: number(),
17494
- trackId: string(),
17495
- mediaKeys: array(string()).min(1)
17496
- }), RetrainFrameSelectionSchema, {
17497
- kind: "mutation",
17498
- auth: "admin"
17499
- }), method(object({
17292
+ className: string(),
17293
+ ...TieredLabelFields,
17294
+ producingDeviceName: string().optional(),
17295
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17296
+ source: TrackSourceSchema.optional(),
17297
+ firstSeen: number(),
17298
+ lastSeen: number(),
17299
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17300
+ positions: array(TrackPositionSchema).readonly(),
17301
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17302
+ * saveThumbnails policy). */
17303
+ snapshots: array(TrackSnapshotSchema).readonly(),
17304
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17305
+ zonesVisited: array(string()).readonly(),
17306
+ /**
17307
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17308
+ * `zones` capability.
17309
+ *
17310
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17311
+ * and no card can render — so every free-text search surface was structurally
17312
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17313
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17314
+ * derivation and costs the clients no extra call (the `zones` cap is
17315
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17316
+ * surface built to avoid exactly that).
17317
+ *
17318
+ * Resolved, never invented: a zone deleted since the track was written has no
17319
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17320
+ * two are not positionally aligned. Absent when the track visited no zone, or
17321
+ * when the zone catalogue could not be read.
17322
+ */
17323
+ zoneNames: array(string()).readonly().optional(),
17324
+ /** Deduplicated set of detector classes observed for this track over its
17325
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17326
+ * legacy rows written before class accumulation shipped. */
17327
+ classes: array(string()).readonly().optional(),
17328
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17329
+ totalDistance: number(),
17330
+ state: TrackStateSchema,
17331
+ active: boolean(),
17332
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17333
+ * track expiry, recomputed on late label). Absent on legacy rows written
17334
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17335
+ importance: number().optional(),
17336
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17337
+ * "best" frame). Absent when the track produced no object events. */
17338
+ bestEventId: string().optional(),
17339
+ /** Tag of the importance sub-signal that dominated the score
17340
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17341
+ importanceReason: string().optional(),
17342
+ /** Audio-classification labels heard on the camera during the track's
17343
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17344
+ * Absent on legacy rows / tracks with no confident audio. */
17345
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17346
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17347
+ * Populated from the persisted envelope columns on historical reads;
17348
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17349
+ envelope: TrackEnvelopeSchema.optional(),
17350
+ /**
17351
+ * A face DETECTOR found a face on this track — nothing more. It says the
17352
+ * detail plane produced a `face` detail; it does NOT say the face was
17353
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17354
+ * enabled. Set once and never cleared.
17355
+ *
17356
+ * **This exists so "face present but not recognised" is expressible.** A
17357
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17358
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17359
+ * and a track with no face at all were byte-identical on the wire and no
17360
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17361
+ * === undefined`.
17362
+ *
17363
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17364
+ * and so does every server that predates the field — a consumer must test
17365
+ * `=== true` and render nothing otherwise, never infer "no face".
17366
+ */
17367
+ hasFace: boolean().optional(),
17368
+ /**
17369
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17370
+ * face an operator could ASSIGN to an identity.
17371
+ *
17372
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17373
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17374
+ * branch, before every gate, and means no more than "a face detector produced
17375
+ * a face detail". This one is stamped at the single moment the gallery row
17376
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17377
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17378
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17379
+ * the crop-store drop. Everything between the detector and that insert can
17380
+ * legitimately refuse the face, so a flag written any earlier promises the
17381
+ * operator something to assign and delivers nothing.
17382
+ *
17383
+ * **Independent of recognition.** A face collected but never auto-matched is
17384
+ * still assignable — it is in fact the face an operator most wants to reach —
17385
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17386
+ * `subLabel`; this says only that the raw material exists.
17387
+ *
17388
+ * **Set once, never cleared.** A track that produced a gallery row produced
17389
+ * one; deleting the row later is the gallery's business, not this flag's.
17390
+ *
17391
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17392
+ * before the column omits it, and so does every server that predates the
17393
+ * field. A consumer must test `=== true` and render nothing otherwise —
17394
+ * never infer "no assignable face".
17395
+ */
17396
+ hasEmbeddedFace: boolean().optional(),
17397
+ /**
17398
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17399
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17400
+ * so the passage is tracked once and as a VEHICLE.
17401
+ *
17402
+ * It exists because the fold's record was dishonest. D34 and the code both
17403
+ * said "the person is not lost — it is reported so both entities stay on the
17404
+ * record"; in fact the pair went into a per-processor RAM field behind an
17405
+ * accessor nobody called, and every durable surface said `vehicle`, full
17406
+ * stop. This is the composition note that makes the row true.
17407
+ *
17408
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17409
+ * person" is not an answer to "what is this" — both label tiers would refuse
17410
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17411
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17412
+ * and a `person` rule still does not fire for someone cycling past.
17413
+ *
17414
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17415
+ * the column, and every hub that predates the field, omits it. Test
17416
+ * `=== true` and render nothing otherwise — never infer "no rider".
17417
+ */
17418
+ hasRider: boolean().optional(),
17419
+ ...TrackFlagFields,
17420
+ ...TrackRetrainFields
17421
+ });
17422
+ var BaseEventFields = {
17423
+ id: string(),
17500
17424
  deviceId: number(),
17501
- trackId: string(),
17502
- frameId: string()
17503
- }), object({
17504
- removed: boolean(),
17505
- removedAnnotations: number().int()
17506
- }), {
17507
- kind: "mutation",
17508
- auth: "admin"
17509
- }), method(object({ frameId: string() }), object({
17425
+ timestamp: number()
17426
+ };
17427
+ var MotionEventSchema = object({
17428
+ ...BaseEventFields,
17429
+ kind: literal("motion"),
17430
+ regionCount: number(),
17431
+ /** Heavy JSON array — omitted in slim projection. */
17432
+ regions: array(object({
17433
+ bbox: BoundingBoxSchema,
17434
+ pixelCount: number(),
17435
+ intensity: number()
17436
+ })).readonly().optional(),
17437
+ /** Omitted in slim projection. */
17438
+ frameWidth: number().optional(),
17439
+ /** Omitted in slim projection. */
17440
+ frameHeight: number().optional(),
17441
+ /** Populated by B5 (recording playback URL for this event). */
17442
+ mediaUrl: string().optional()
17443
+ });
17444
+ /**
17445
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17446
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17447
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17448
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17449
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17450
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17451
+ */
17452
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17453
+ /**
17454
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17455
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17456
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17457
+ * appearance event carry none, so a rule asking for a direction fails closed
17458
+ * on them.
17459
+ *
17460
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17461
+ * into its own event, so a frame in which a track enters A while leaving B
17462
+ * produces two events with two directions — never one ambiguous row.
17463
+ *
17464
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17465
+ * membership the box has NOW, and by definition it no longer contains the zone
17466
+ * that was just left. Without the id here, a zone-scoped rule could never match
17467
+ * the exit it asked for.
17468
+ */
17469
+ var ZoneCrossingSchema = object({
17470
+ direction: _enum(["enter", "exit"]),
17471
+ /** Admin zone id crossed. */
17472
+ zoneId: string(),
17473
+ /** Zone display name at crossing time (falls back to the id). */
17474
+ zoneName: string().optional()
17475
+ });
17476
+ var ObjectEventSchema = object({
17477
+ ...BaseEventFields,
17478
+ kind: literal("object"),
17479
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17480
+ source: DetectionSourceSchema.optional(),
17481
+ /**
17482
+ * Inference-frame id shared by every object event emitted from the SAME frame
17483
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17484
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17485
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17486
+ * Optional for backward-compat with pre-existing rows / the slim projection
17487
+ * includes it (it is light). Absent on rows written before this field.
17488
+ */
17489
+ frameId: string().optional(),
17490
+ /** Omitted in slim projection. */
17491
+ trackId: string().optional(),
17492
+ className: string(),
17493
+ ...TieredLabelFields,
17494
+ /** Omitted in slim projection. */
17495
+ confidence: number().optional(),
17496
+ /** Heavy JSON — omitted in slim projection. */
17497
+ bbox: BoundingBoxSchema.optional(),
17498
+ /** Heavy JSON — omitted in slim projection. */
17499
+ zones: array(string()).readonly().optional(),
17500
+ /** Omitted in slim projection. */
17501
+ state: TrackStateSchema.optional(),
17502
+ /**
17503
+ * The zone crossing this event IS, when it is one. Absent on every other
17504
+ * event kind (movement state, appearance, package) — see
17505
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17506
+ */
17507
+ zoneCrossing: ZoneCrossingSchema.optional(),
17508
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17509
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17510
+ frameWidth: number().optional(),
17511
+ frameHeight: number().optional(),
17512
+ /** MediaStore key for the crop attached to this event (if any). */
17513
+ mediaKey: string().optional(),
17514
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17515
+ * best-detection full frame). Resolve via the event-media data-plane
17516
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17517
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17518
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17519
+ keyFrameMediaKey: string().optional(),
17520
+ /** Populated by B5 (recording playback URL for this event). */
17521
+ mediaUrl: string().optional(),
17522
+ /** The parent track's key-event importance [0,1], propagated to every object
17523
+ * event of the track (so an event row can be sorted by importance without a
17524
+ * track join). Absent on legacy rows / before the track was scored. */
17525
+ importance: number().optional()
17526
+ });
17527
+ var AudioEventSchema = object({
17528
+ ...BaseEventFields,
17529
+ kind: literal("audio"),
17530
+ rms: number(),
17531
+ dbfs: number(),
17532
+ classification: object({
17533
+ className: string(),
17534
+ originalClass: string().optional(),
17535
+ score: number()
17536
+ }).optional(),
17537
+ /** Populated by B5 (recording playback URL for this event). */
17538
+ mediaUrl: string().optional()
17539
+ });
17540
+ var MediaFileKindEnum = _enum([
17541
+ "crop",
17542
+ "thumbnail",
17543
+ "snapshot",
17544
+ "firstFrame",
17545
+ "lastFrame",
17546
+ "fullFrame",
17547
+ "fullFrameBoxed",
17548
+ "faceCrop",
17549
+ "plateCrop",
17550
+ "keyFrame",
17551
+ "keyFrameSmall",
17552
+ "thumbnailSmall"
17553
+ ]);
17554
+ var MediaFileSchema = object({
17555
+ key: string(),
17556
+ kind: MediaFileKindEnum,
17510
17557
  base64: string(),
17511
- width: number().int(),
17512
- height: number().int()
17513
- }), {
17514
- kind: "query",
17515
- auth: "admin"
17516
- }), method(object({
17517
- deviceId: number(),
17518
- trackId: string(),
17519
- frameId: string(),
17520
- subject: RetrainAssistSubjectSchema,
17521
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17522
- nodeId: string().optional()
17523
- }), RetrainAssistResultSchema, {
17524
- kind: "mutation",
17525
- auth: "admin"
17526
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17527
- kind: "query",
17528
- auth: "admin"
17529
- }), method(object({
17530
- deviceId: number(),
17531
- trackId: string(),
17532
- frameId: string(),
17533
- annotations: array(RetrainAnnotationDraftSchema)
17534
- }), array(RetrainAnnotationSchema).readonly(), {
17535
- kind: "mutation",
17536
- auth: "admin"
17537
- }), method(object({
17538
- deviceId: number(),
17539
- trackId: string()
17540
- }), RetrainTransitionResultSchema, {
17541
- kind: "mutation",
17542
- auth: "admin"
17543
- }), method(object({
17544
- deviceId: number(),
17545
- trackId: string()
17546
- }), RetrainTransitionResultSchema, {
17547
- kind: "mutation",
17548
- auth: "admin"
17549
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17550
- kind: "query",
17551
- auth: "admin"
17552
- }), method(object({
17553
- eventId: string(),
17554
- kind: MediaFileKindEnum.optional(),
17555
- deviceId: number()
17556
- }), array(MediaFileSchema).readonly()), method(object({
17557
- trackId: string(),
17558
- kinds: array(MediaFileKindEnum).optional(),
17559
- deviceId: number()
17560
- }), array(MediaFileSchema).readonly()), method(object({
17558
+ sizeBytes: number(),
17559
+ timestamp: number()
17560
+ });
17561
+ /**
17562
+ * One media row WITHOUT its bytes.
17563
+ *
17564
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17565
+ * 140 s track), and a client that renders tiles from the media data plane needs
17566
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17567
+ * with an immutable cache, instead of all at once inside a tRPC response that
17568
+ * blocks the whole view.
17569
+ *
17570
+ * `sizeBytes` is carried because it is what lets a client decide between the
17571
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17572
+ */
17573
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17574
+ /**
17575
+ * The MACRO tier of an annotation — a CLOSED set.
17576
+ *
17577
+ * This is what the exported detector predicts, so a typo here is a new class
17578
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17579
+ * the whole point of the page is teaching the model things it does not know
17580
+ * yet, and constraining that vocabulary would make it useless.
17581
+ *
17582
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17583
+ * `subLabel` is one of these values, in any casing, because once `person`
17584
+ * exists in both tiers "every person box" stops being answerable without
17585
+ * knowing every string anyone ever typed — and the damage is retroactive.
17586
+ */
17587
+ var RetrainMacroClassSchema = _enum([
17588
+ "person",
17589
+ "vehicle",
17590
+ "animal",
17591
+ "package",
17592
+ "face",
17593
+ "plate"
17594
+ ]);
17595
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17596
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17597
+ /** Did a human draw this box, or did the assist propose it? */
17598
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17599
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17600
+ var RetrainBboxSchema = object({
17601
+ x: number(),
17602
+ y: number(),
17603
+ w: number(),
17604
+ h: number()
17605
+ });
17606
+ /**
17607
+ * One annotated subject.
17608
+ *
17609
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17610
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17611
+ * derived from it at export and never stored — storing them is how one feature
17612
+ * space ends up holding two crops of the same subject (D52).
17613
+ */
17614
+ var RetrainAnnotationSchema = object({
17615
+ id: string(),
17561
17616
  trackId: string(),
17562
- deviceId: number()
17563
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17564
- kind: "mutation",
17565
- auth: "admin"
17566
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17567
- kind: "mutation",
17568
- auth: "admin"
17569
- }), method(object({}), RebuildStatusSchema), object({
17570
- deviceId: number(),
17571
- timestamp: number(),
17572
- frameWidth: number(),
17573
- frameHeight: number(),
17574
- detections: array(OverlayDetectionSchema).readonly()
17575
- }), object({
17576
17617
  deviceId: number(),
17618
+ /** The COPY in retrain storage — never the source track's media key. */
17619
+ mediaKey: string(),
17620
+ bbox: RetrainBboxSchema,
17621
+ macroClass: RetrainMacroClassSchema,
17622
+ label: string().optional(),
17623
+ subLabel: string().optional(),
17624
+ kind: RetrainAnnotationKindSchema,
17625
+ source: RetrainAnnotationSourceSchema,
17626
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17627
+ assistModelId: string().optional(),
17628
+ assistScore: number().optional(),
17629
+ exportedInBatch: string().optional(),
17630
+ createdAt: number()
17631
+ });
17632
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17633
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17634
+ id: true,
17635
+ trackId: true,
17636
+ deviceId: true,
17637
+ mediaKey: true,
17638
+ createdAt: true,
17639
+ exportedInBatch: true
17640
+ });
17641
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17642
+ var RetrainTrackSchema = object({
17577
17643
  trackId: string(),
17578
- className: string()
17579
- }), object({
17580
17644
  deviceId: number(),
17581
- trackId: string(),
17582
17645
  className: string(),
17583
- durationMs: number()
17584
- }), object({
17646
+ label: string().optional(),
17647
+ firstSeen: number(),
17648
+ lastSeen: number(),
17649
+ /** How many frames the dataset already holds from this track. */
17650
+ frameCount: number().int(),
17651
+ /** How many subjects have been annotated on those frames. `0` with
17652
+ * `frameCount: 0` is exactly "staging, still to work". */
17653
+ annotationCount: number().int()
17654
+ });
17655
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17656
+ var RetrainFrameCandidateSchema = object({
17657
+ mediaKey: string(),
17658
+ kind: MediaFileKindEnum,
17659
+ timestamp: number(),
17660
+ sizeBytes: number().int(),
17661
+ /** A copy of this original already exists — selecting it is free and cannot
17662
+ * fail, whatever became of the original. */
17663
+ copied: boolean()
17664
+ });
17665
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17666
+ var RetrainFrameSchema = object({
17667
+ frameId: string(),
17585
17668
  deviceId: number(),
17586
- kind: EventKindSchema,
17587
- eventId: string(),
17588
- timestamp: number()
17669
+ trackId: string(),
17670
+ /** Provenance only. It may already point at nothing — that is expected. */
17671
+ sourceMediaKey: string(),
17672
+ sourceKind: MediaFileKindEnum,
17673
+ sizeBytes: number().int(),
17674
+ width: number().int(),
17675
+ height: number().int(),
17676
+ copiedAt: number()
17677
+ });
17678
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17679
+ var RetrainCopyRefusalSchema = _enum([
17680
+ "source-missing",
17681
+ "unreadable-image",
17682
+ "write-failed"
17683
+ ]);
17684
+ var RetrainFrameSelectionSchema = object({
17685
+ copied: array(RetrainFrameSchema).readonly(),
17686
+ refused: array(object({
17687
+ sourceMediaKey: string(),
17688
+ reason: RetrainCopyRefusalSchema
17689
+ })).readonly()
17589
17690
  });
17691
+ var RetrainFrameListSchema = object({
17692
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17693
+ copies: array(RetrainFrameSchema).readonly(),
17694
+ /** What the page pre-selects — the native key frame when one survives. */
17695
+ autoPickMediaKey: string().optional()
17696
+ });
17697
+ /** What the operator asked the assist to look for. */
17698
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17699
+ kind: literal("package"),
17700
+ zone: RetrainBboxSchema.optional()
17701
+ }), object({
17702
+ kind: literal("objects"),
17703
+ modelId: string(),
17704
+ minScore: number().optional()
17705
+ })]);
17590
17706
  /**
17591
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17592
- * within the frame, so the executor can re-cut a leaf child ROI at native
17593
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17707
+ * The assist's answer — a discriminated union, because "the model saw nothing"
17708
+ * and "this node cannot run that model" lead to different next moves and a
17709
+ * nullable result cannot tell them apart.
17594
17710
  */
17595
- var NativeCropRefSchema = object({
17596
- /** Handle keying the retained native surface (node-pinned to its owner). */
17597
- handle: FrameHandleSchema,
17598
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17599
- cropFrameSpace: object({
17600
- x: number(),
17601
- y: number(),
17602
- w: number(),
17603
- h: number()
17604
- })
17711
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17712
+ kind: literal("proposed"),
17713
+ modelId: string(),
17714
+ stepId: string(),
17715
+ minScore: number(),
17716
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17717
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17718
+ /** Returned by the runner but removed by the threshold. */
17719
+ belowThreshold: number().int()
17720
+ }), object({
17721
+ kind: literal("refused"),
17722
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17723
+ reason: string(),
17724
+ detail: string().optional()
17725
+ })]);
17726
+ /** The outcome of a lifecycle move owned by the retrain page. */
17727
+ var RetrainTransitionResultSchema = object({
17728
+ trackId: string(),
17729
+ /** Where the track ended up, whatever happened. */
17730
+ retrainStatus: RetrainStatusSchema,
17731
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17732
+ changed: boolean(),
17733
+ reason: _enum([
17734
+ "unknown-track",
17735
+ "no-frames-copied",
17736
+ "not-staging",
17737
+ "not-trained",
17738
+ "unchanged"
17739
+ ]).optional()
17605
17740
  });
17606
- object({
17607
- crop: object({
17608
- left: number(),
17609
- top: number(),
17610
- width: number().positive(),
17611
- height: number().positive()
17612
- }).optional(),
17613
- content: object({
17614
- width: number().int().positive(),
17615
- height: number().int().positive()
17616
- }),
17617
- fit: _enum(["stretch", "contain"]),
17618
- format: _enum([
17619
- "rgb",
17620
- "gray",
17621
- "jpeg"
17622
- ])
17741
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17742
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17743
+ var DeviceEventQueryInput = object({
17744
+ deviceId: number(),
17745
+ since: number().optional(),
17746
+ until: number().optional(),
17747
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17748
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17749
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17750
+ * exact behaviour. Callers may omit this field — the store defaults to
17751
+ * `full` when not provided. */
17752
+ projection: _enum(["full", "slim"]).optional()
17623
17753
  });
17624
- var FrameRefSchema = object({
17625
- registryId: string().min(1),
17626
- id: string().min(1),
17627
- width: number().int().positive(),
17628
- height: number().int().positive(),
17629
- format: _enum(["rgb", "gray"]),
17630
- timestamp: number(),
17631
- capturedAt: number().optional()
17754
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17755
+ var RecentTracksQueryInput = object({
17756
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17757
+ deviceIds: array(number()),
17758
+ /** Window lower bound on `lastSeen` (inclusive). */
17759
+ since: number().optional(),
17760
+ /** Window upper bound on `lastSeen` (inclusive). */
17761
+ until: number().optional(),
17762
+ /** Page size. Default 200, max 1000. */
17763
+ limit: number().int().min(1).max(1e3).default(200),
17764
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17765
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17766
+ cursor: string().optional(),
17767
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17768
+ projection: TrackProjectionSchema.optional(),
17769
+ /** Include stationary-promoted rows (parked objects). Default false: the
17770
+ * feed lists passages; parking records live on the stationary registry. */
17771
+ includeStationary: boolean().optional()
17632
17772
  });
17633
- var ModelFormatSchema$1 = _enum([
17634
- "onnx",
17635
- "coreml",
17636
- "openvino",
17637
- "tflite",
17638
- "pt",
17639
- "gguf"
17640
- ]);
17641
- var PipelineSlotSchema = _enum([
17642
- "detector",
17643
- "cropper",
17644
- "classifier",
17645
- "refiner",
17646
- "audio-classifier"
17647
- ]);
17648
- var PipelineEngineChoiceSchema = object({
17649
- runtime: _enum(["node", "python"]),
17650
- backend: string(),
17651
- format: ModelFormatSchema$1,
17652
- device: string().optional()
17773
+ var RecentTracksPageSchema = object({
17774
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17775
+ tracks: array(TrackSchema).readonly(),
17776
+ /** Cursor for the next page, or null when this page is the last. */
17777
+ nextCursor: string().nullable()
17778
+ });
17779
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17780
+ var LIST_GROUPS_MAX_LIMIT = 100;
17781
+ var AnalyticsGroupRecordSchema = object({
17782
+ id: string(),
17783
+ deviceId: number().int(),
17784
+ openedAt: number().int(),
17785
+ closedAt: number().int(),
17786
+ timestamp: number().int(),
17787
+ memberCount: number().int(),
17788
+ memberTrackIds: array(string()).readonly(),
17789
+ className: string(),
17790
+ classes: array(string()).readonly(),
17791
+ /** Relative event-media path, or null when the group has no picture yet. */
17792
+ mediaUrl: string().nullable(),
17793
+ singleton: boolean()
17653
17794
  });
17654
- var AvailableEngineSchema = object({
17655
- engine: PipelineEngineChoiceSchema,
17656
- devices: array(object({
17657
- id: string(),
17658
- label: string(),
17659
- description: string().optional()
17660
- })).readonly(),
17661
- defaultDevice: string()
17795
+ var AnalyticsGroupMemberSchema = object({
17796
+ trackId: string(),
17797
+ deviceId: number().int(),
17798
+ className: string(),
17799
+ firstSeen: number().int(),
17800
+ lastSeen: number().int(),
17801
+ mediaUrl: string().nullable()
17662
17802
  });
17663
- var PipelineDefaultStepSchema = lazy(() => object({
17664
- addonId: string(),
17665
- addonName: string(),
17666
- slot: PipelineSlotSchema,
17667
- inputClasses: array(string()).readonly(),
17668
- outputClasses: array(string()).readonly(),
17669
- enabled: boolean(),
17670
- modelId: string(),
17671
- children: array(PipelineDefaultStepSchema).readonly(),
17672
- group: string().optional(),
17673
- settings: record(string(), unknown()).optional()
17674
- }));
17675
- var PipelineTemplateStepSchema = lazy(() => object({
17676
- addonId: string(),
17677
- enabled: boolean(),
17678
- modelId: string(),
17679
- children: array(PipelineTemplateStepSchema).readonly(),
17680
- settings: record(string(), unknown()).optional()
17681
- }));
17682
- var PipelineTemplateSchema$1 = object({
17683
- id: string(),
17684
- name: string(),
17685
- createdAt: string(),
17686
- updatedAt: string(),
17687
- engine: PipelineEngineChoiceSchema,
17688
- steps: array(PipelineTemplateStepSchema).readonly()
17803
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17804
+ var ListGroupsQueryInput = object({
17805
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17806
+ deviceIds: array(number()),
17807
+ /** Window lower bound on `closedAt` (inclusive). */
17808
+ since: number().optional(),
17809
+ /** Window upper bound on `openedAt` (inclusive). */
17810
+ until: number().optional(),
17811
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17812
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17813
+ cursor: string().optional()
17689
17814
  });
17690
- var PipelineModelOptionSchema = object({
17691
- id: string(),
17692
- name: string(),
17693
- formats: record(string(), object({
17694
- downloaded: boolean(),
17695
- sizeMB: number()
17696
- })),
17697
- group: ModelVariantGroupSchema.optional(),
17698
- legacy: boolean().optional(),
17699
- provider: ModelProviderIdSchema.optional()
17815
+ var ListGroupsPageSchema = object({
17816
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17817
+ nextCursor: string().nullable()
17700
17818
  });
17701
- var ConfigFieldBridge = custom();
17702
- var PipelineAddonSchemaSchema = object({
17703
- id: string(),
17704
- name: string(),
17705
- slot: PipelineSlotSchema,
17706
- inputClasses: array(string()).readonly(),
17707
- outputClasses: array(string()).readonly(),
17708
- childSlots: array(PipelineSlotSchema).readonly(),
17709
- models: array(PipelineModelOptionSchema).readonly(),
17710
- defaultModelId: string(),
17711
- defaultModelIdByFormat: record(string(), string()).optional(),
17712
- enabledByDefault: boolean().optional(),
17713
- backfillIntoExistingOverrides: boolean().optional(),
17714
- defaultConfidence: number(),
17715
- group: string().optional(),
17716
- configSchema: array(ConfigFieldBridge).readonly().optional()
17819
+ var KeyEventQueryInput = object({
17820
+ deviceId: number(),
17821
+ /** Window lower bound (track firstSeen ≥ since). */
17822
+ since: number(),
17823
+ /** Window upper bound (track firstSeen ≤ until). */
17824
+ until: number(),
17825
+ limit: number().int().min(1).max(200).default(50),
17826
+ /** Drop tracks scoring below this importance. */
17827
+ minImportance: number().min(0).max(1).optional(),
17828
+ /** Restrict to a single class (e.g. 'person'). */
17829
+ classFilter: string().optional()
17717
17830
  });
17718
- var PipelineSlotSchemaSchema = object({
17719
- id: PipelineSlotSchema,
17720
- label: string(),
17721
- priority: number(),
17722
- parentSlot: PipelineSlotSchema.nullable(),
17723
- addons: array(PipelineAddonSchemaSchema).readonly()
17831
+ var KeyEventSchema = object({
17832
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17833
+ id: string(),
17834
+ trackId: string(),
17835
+ /** Track start time (firstSeen). */
17836
+ timestamp: number(),
17837
+ className: string(),
17838
+ ...TieredLabelFields,
17839
+ importance: number(),
17840
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17841
+ bestEventId: string(),
17842
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17843
+ windowMs: number().optional(),
17844
+ ...TrackFlagFields,
17845
+ ...TrackRetrainFields
17724
17846
  });
17725
- var PipelineSchemaSchema = object({
17726
- availableEngines: array(AvailableEngineSchema).readonly(),
17727
- selectedEngine: PipelineEngineChoiceSchema,
17728
- slots: array(PipelineSlotSchemaSchema).readonly()
17847
+ object({
17848
+ trackId: string(),
17849
+ className: string(),
17850
+ confidence: number(),
17851
+ bbox: BoundingBoxSchema,
17852
+ zones: array(string()).readonly(),
17853
+ state: TrackStateSchema
17729
17854
  });
17730
- var EngineProvisioningSchema = object({
17731
- runtimeId: _enum([
17732
- "onnx",
17733
- "openvino",
17734
- "coreml",
17735
- "edgetpu"
17736
- ]).nullable(),
17737
- device: string().nullable(),
17738
- state: _enum([
17739
- "idle",
17740
- "installing",
17741
- "verifying",
17742
- "ready",
17743
- "failed"
17744
- ]),
17745
- progress: number().optional(),
17746
- error: string().optional(),
17747
- nextRetryAt: number().optional(),
17748
- /**
17749
- * Gate A (config-correctness gate at engine change): human-readable
17750
- * config issues surfaced EAGERLY when the node's engine changes — model
17751
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17752
- * has a <format> build"). Additive/optional: informational only, never
17753
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17754
- * Absent/empty when the node-default tree resolves cleanly.
17755
- */
17756
- configIssues: array(string()).optional()
17855
+ var OverlayDetectionSchema = looseObject({
17856
+ id: string(),
17857
+ kind: _enum(["first-level", "detail"]),
17858
+ macroClass: string(),
17859
+ score: number(),
17860
+ bbox: object({
17861
+ x: number(),
17862
+ y: number(),
17863
+ width: number(),
17864
+ height: number()
17865
+ }),
17866
+ labels: array(looseObject({
17867
+ label: string(),
17868
+ score: number()
17869
+ })).readonly(),
17870
+ parentId: string().optional()
17757
17871
  });
17758
- var PipelineStepInputSchema = lazy(() => object({
17759
- addonId: string(),
17760
- modelId: string().optional(),
17761
- enabled: boolean().default(true),
17762
- children: array(PipelineStepInputSchema).optional(),
17763
- settings: record(string(), unknown()).optional(),
17764
- jumpDeviceKey: string().optional()
17765
- }));
17766
- var ModelSubstitutionSchema = object({
17767
- addonId: string(),
17768
- chosen: string(),
17769
- running: string(),
17770
- format: string()
17872
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17873
+ var SearchObjectEventsInput = object({
17874
+ text: string(),
17875
+ deviceId: number().optional(),
17876
+ since: number().optional(),
17877
+ until: number().optional(),
17878
+ classFilter: string().optional(),
17879
+ limit: number().default(50),
17880
+ minScore: number().min(0).max(1).default(.2)
17771
17881
  });
17772
- var PipelineValidationIssueSchema = object({
17773
- addonId: string(),
17774
- kind: _enum(["unknown-addon", "no-format-build"]),
17775
- detail: string()
17882
+ var TrackCascadeCountsSchema = object({
17883
+ /** Persisted track roots deleted (authoritative). */
17884
+ tracks: number().int(),
17885
+ /** Object events removed with their tracks (best-effort; see note above). */
17886
+ events: number().int(),
17887
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17888
+ media: number().int(),
17889
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
17890
+ faces: number().int(),
17891
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17892
+ plates: number().int(),
17893
+ /** Per-track CLIP search vectors removed (best-effort). */
17894
+ embeddings: number().int(),
17895
+ /** Group membership + group rows removed with their last member (best-effort). */
17896
+ groups: number().int()
17776
17897
  });
17777
- var PipelineValidationResultSchema = object({
17778
- ok: boolean(),
17779
- issues: array(PipelineValidationIssueSchema).readonly(),
17780
- substitutions: array(ModelSubstitutionSchema).readonly(),
17781
- /** The node's `currentEngine.format` this validation ran against. */
17782
- format: string()
17898
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17899
+ var DiskReconcileCountsSchema = object({
17900
+ mediaDropped: number().int(),
17901
+ tracks: number().int(),
17902
+ events: number().int()
17783
17903
  });
17784
- var ReferenceImageEntrySchema = object({
17785
- filename: string(),
17786
- stepIds: array(string()).readonly().optional()
17904
+ /** Event-store footprint for one camera. */
17905
+ var EventStoreDeviceFootprintSchema = object({
17906
+ deviceId: number(),
17907
+ /** Persisted event rows (motion + object + audio) for the camera. */
17908
+ rows: number().int(),
17909
+ /** Event-owned media bytes on disk for the camera. */
17910
+ bytes: number().int()
17787
17911
  });
17788
- var ReferenceImageBodySchema = object({
17789
- base64: string(),
17790
- filename: string()
17912
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17913
+ var EventStoreFootprintSchema = object({
17914
+ totalRows: number().int(),
17915
+ totalBytes: number().int(),
17916
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
17791
17917
  });
17792
- var ReferenceAudioEntrySchema = object({
17793
- filename: string(),
17794
- sizeKb: number()
17918
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
17919
+ var EventPruneCountsSchema = object({
17920
+ motion: number().int(),
17921
+ object: number().int(),
17922
+ audio: number().int()
17795
17923
  });
17796
- var ReferenceAudioBodySchema = object({ base64: string() });
17797
- var AudioBackendSchema = object({
17798
- id: string(),
17799
- name: string(),
17800
- description: string(),
17801
- available: boolean(),
17924
+ /**
17925
+ * Re-embed stored tracks from their key frames.
17926
+ *
17927
+ * The reason this is an operator-callable method and not a migration script:
17928
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
17929
+ * squaring — is only changeable if the existing vectors can be regenerated.
17930
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
17931
+ * symptom is a quality regression with no visible cause.
17932
+ */
17933
+ var RebuildObjectEmbeddingsInput = object({
17934
+ /** Restrict to one camera. Omit for the whole fleet. */
17935
+ deviceId: number().optional(),
17936
+ since: number().optional(),
17937
+ until: number().optional(),
17938
+ /** Stop after this many tracks; the result reports whether more remain. */
17939
+ maxTracks: number().int().positive().optional(),
17802
17940
  /**
17803
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17804
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17805
- * the benchmark UI to populate the `enabledMicroClasses` filter
17806
- * specific to the selected backend without a separate fetch.
17941
+ * Run every embedding on THIS node instead of round-robining the fleet.
17942
+ *
17943
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17944
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17945
+ * calling it that would pin the rebuild REQUEST itself to that node — the
17946
+ * rebuild orchestration lives on the hub, and only the per-track step runs
17947
+ * remotely. This field is data; the per-track pin is applied inside.
17948
+ *
17949
+ * Absent ⇒ round-robin over every online node whose runner can serve the
17950
+ * pinned model.
17807
17951
  */
17808
- rawLabels: array(string()).readonly().optional()
17809
- });
17810
- var AudioCapabilitiesSchema = object({
17811
- activeBackend: string(),
17812
- availableBackends: array(AudioBackendSchema).readonly(),
17813
- sampleRate: number(),
17814
- chunkDurationMs: number()
17815
- });
17816
- var DownloadModelResultSchema = object({
17817
- filePath: string(),
17818
- sizeMB: number(),
17819
- durationMs: number()
17952
+ executeOnNodeId: string().optional(),
17953
+ /**
17954
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17955
+ * run flat out.
17956
+ *
17957
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
17958
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17959
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17960
+ * force is logged at start and finish so a deliberately slow pass reads
17961
+ * differently from a stalled one.
17962
+ */
17963
+ pacingMs: number().int().nonnegative().optional()
17820
17964
  });
17821
17965
  /**
17822
- * Wrapper carrying a single test run's result. Replaces the legacy
17823
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17824
- * canonical `AudioResult` from the Phase 6 output rework: one
17825
- * `AudioDetection` per class above `minScore`, top-N candidates in
17826
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17827
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17828
- * benchmark UI can still report a clean failure when the classifier
17829
- * cap isn't available.
17966
+ * Result of emptying the CLIP index.
17967
+ *
17968
+ * The clean slate before a policy change: a new crop margin or encoder model
17969
+ * leaves two feature spaces in one index whose cosine scores are not
17970
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
17971
+ * means the same thing.
17830
17972
  */
17831
- var AudioTestResultSchema = object({
17832
- success: boolean(),
17833
- error: string().optional(),
17834
- frame: custom().optional()
17973
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17974
+ /**
17975
+ * Acknowledgement that a rebuild STARTED.
17976
+ *
17977
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17978
+ * runs detached and this returns immediately. Waiting for it made the client
17979
+ * time out while the work carried on server-side, which is the worst of both:
17980
+ * no result and no way to know it was still going. Poll
17981
+ * `getObjectEmbeddingRebuildStatus` for progress.
17982
+ */
17983
+ var RebuildObjectEmbeddingsResultSchema = object({
17984
+ started: boolean(),
17985
+ /** True when a pass was already running; the new request is ignored. */
17986
+ alreadyRunning: boolean()
17835
17987
  });
17836
- var PipelineConfigBridge = custom();
17837
- var ConfigUISchemaBridge = custom();
17838
- var ConfigUISchemaNullableBridge = custom();
17839
- var InferenceCapabilitiesBridge = custom();
17840
- var ModelAvailabilityListBridge = custom();
17841
- var PipelineRunResultBridge = custom();
17842
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17843
- modelId: string(),
17844
- settings: record(string(), unknown()).readonly()
17845
- }))), method(object({ steps: record(string(), object({
17846
- modelId: string(),
17847
- settings: record(string(), unknown()).readonly()
17848
- })) }), object({ success: literal(true) }), {
17988
+ var RebuildStatusSchema = object({
17989
+ running: boolean(),
17990
+ scanned: number(),
17991
+ rebuilt: number(),
17992
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
17993
+ missingKeyFrame: number(),
17994
+ /** Tracks with no usable detection box. */
17995
+ missingBbox: number(),
17996
+ /**
17997
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
17998
+ * frame, a step that threw. Separate from `failed` because the remedy is
17999
+ * different, and because a whole camera silently contributing zero vectors
18000
+ * is the shape of failure a rebuild must never hide.
18001
+ */
18002
+ notRunnable: number(),
18003
+ /**
18004
+ * The pass stopped because NO node could serve the pinned model.
18005
+ *
18006
+ * Distinct from `notRunnable` on purpose: that one says "this track was
18007
+ * refused", this one says "the cluster cannot do this work at all" — every
18008
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
18009
+ * pinned model for its engine format, or dropped out. The remedy is a model /
18010
+ * engine change, not a per-camera one. Non-zero here always comes with
18011
+ * `complete: false`.
18012
+ */
18013
+ noCapableNode: number(),
18014
+ failed: number(),
18015
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
18016
+ complete: boolean().nullable(),
18017
+ startedAtMs: number().nullable(),
18018
+ finishedAtMs: number().nullable(),
18019
+ /** Present when the pass ended by throwing. */
18020
+ error: string().nullable()
18021
+ });
18022
+ var ReplayFrameInputSchema = object({
18023
+ timestamp: number(),
18024
+ frame: PipelineRunResultBridge
18025
+ });
18026
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
18027
+ className: string(),
18028
+ firstSeenMs: number(),
18029
+ lastSeenMs: number(),
18030
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
18031
+ * frame — a representative box for the diff's `(className, window, IoU)`
18032
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
18033
+ * trajectory production's `Track.positions` keeps. */
18034
+ bbox: BoundingBoxSchema,
18035
+ /** How many of the input frames this track matched a real detection on
18036
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
18037
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
18038
+ framesMatched: number().int()
18039
+ })).readonly() });
18040
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
18041
+ deviceId: number(),
18042
+ trackId: string()
18043
+ }), TrackSchema.nullable()), method(object({
18044
+ deviceId: number(),
18045
+ since: number().optional(),
18046
+ until: number().optional(),
18047
+ limit: number().optional(),
18048
+ /** Spatial filter — only tracks whose trajectory intersects the zone
18049
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
18050
+ * envelope columns, then precisely tested per position. Tracks with
18051
+ * an unknown envelope (no frame dims at persist time) always match. */
18052
+ zone: TrackZoneFilterSchema.optional(),
18053
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
18054
+ * compatible — omitting the field keeps today's exact behaviour). */
18055
+ projection: TrackProjectionSchema.optional(),
18056
+ /** Include stationary-promoted rows (parked objects handed to the
18057
+ * stationary registry). Default false: the timeline lists passages,
18058
+ * not parking records (operator decision, 2026-08-15). */
18059
+ includeStationary: boolean().optional()
18060
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
18061
+ deviceId: number(),
18062
+ groupId: string().min(1)
18063
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
18064
+ kind: "mutation",
18065
+ auth: "admin"
18066
+ }), 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({
18067
+ deviceId: number(),
18068
+ since: number().optional(),
18069
+ until: number().optional(),
18070
+ kinds: array(string()).optional(),
18071
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
18072
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18073
+ deviceId: number(),
18074
+ since: number(),
18075
+ until: number(),
18076
+ bucketMs: number().int().positive()
18077
+ }), array(object({
18078
+ bucketStart: number(),
18079
+ motion: number().int(),
18080
+ object: number().int(),
18081
+ audio: number().int()
18082
+ })).readonly()), method(object({
18083
+ deviceId: number(),
18084
+ cutoffMs: number()
18085
+ }), object({
18086
+ motion: number().int(),
18087
+ object: number().int(),
18088
+ audio: number().int()
18089
+ }), {
18090
+ kind: "mutation",
18091
+ auth: "admin"
18092
+ }), method(object({
18093
+ deviceId: number(),
18094
+ cutoffMs: number()
18095
+ }), TrackCascadeCountsSchema, {
18096
+ kind: "mutation",
18097
+ auth: "admin"
18098
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18099
+ kind: "mutation",
18100
+ auth: "admin"
18101
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18102
+ kind: "mutation",
18103
+ auth: "admin"
18104
+ }), method(object({
18105
+ deviceId: number(),
18106
+ trackIds: array(string()).min(1)
18107
+ }), object({
18108
+ deleted: number().int(),
18109
+ failed: array(string()).readonly()
18110
+ }), {
18111
+ kind: "mutation",
18112
+ auth: "admin"
18113
+ }), method(object({
18114
+ /** Log/audit scope only — the trackId is globally unique on its own. */
18115
+ deviceId: number(),
18116
+ trackId: string(),
18117
+ flags: TrackFlagsPatchSchema
18118
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18119
+ kind: "query",
18120
+ auth: "admin"
18121
+ }), method(object({
18122
+ olderThanMs: number(),
18123
+ reason: OpsLogReasonSchema.optional()
18124
+ }), EventPruneCountsSchema, {
18125
+ kind: "mutation",
18126
+ auth: "admin"
18127
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
18128
+ kind: "mutation",
18129
+ auth: "admin"
18130
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18131
+ kind: "mutation",
18132
+ auth: "admin"
18133
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18134
+ kind: "mutation",
18135
+ auth: "admin"
18136
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
18137
+ kind: "mutation",
18138
+ auth: "admin"
18139
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
18140
+ kind: "mutation",
18141
+ auth: "admin"
18142
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18143
+ kind: "mutation",
18144
+ auth: "admin"
18145
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18146
+ kind: "mutation",
18147
+ auth: "admin"
18148
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18149
+ kind: "query",
18150
+ auth: "admin"
18151
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18152
+ kind: "mutation",
18153
+ auth: "admin"
18154
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
18155
+ kind: "query",
18156
+ auth: "admin"
18157
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
18158
+ kind: "query",
18159
+ auth: "admin"
18160
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18161
+ kind: "query",
18162
+ auth: "admin"
18163
+ }), method(object({
18164
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
18165
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
18166
+ * route it at one camera's owner, and "every camera" would stop being
18167
+ * expressible at all. */
18168
+ deviceIds: array(number()).optional(),
18169
+ limit: number().int().min(1).max(500).optional()
18170
+ }), array(RetrainTrackSchema).readonly(), {
18171
+ kind: "query",
18172
+ auth: "admin"
18173
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
18174
+ kind: "query",
18175
+ auth: "admin"
18176
+ }), method(object({
18177
+ deviceId: number(),
18178
+ trackId: string(),
18179
+ mediaKeys: array(string()).min(1)
18180
+ }), RetrainFrameSelectionSchema, {
17849
18181
  kind: "mutation",
17850
18182
  auth: "admin"
17851
- }), method(object({ nodeId: string() }), object({
17852
- success: literal(true),
17853
- clearedDevices: number()
18183
+ }), method(object({
18184
+ deviceId: number(),
18185
+ trackId: string(),
18186
+ frameId: string()
18187
+ }), object({
18188
+ removed: boolean(),
18189
+ removedAnnotations: number().int()
17854
18190
  }), {
17855
18191
  kind: "mutation",
17856
18192
  auth: "admin"
17857
- }), 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({
17858
- name: string(),
17859
- steps: array(PipelineTemplateStepSchema).readonly(),
17860
- engine: PipelineEngineChoiceSchema
17861
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17862
- id: string(),
17863
- name: string().optional(),
17864
- steps: array(PipelineTemplateStepSchema).readonly().optional()
17865
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17866
- addonId: string(),
17867
- modelId: string(),
17868
- format: ModelFormatSchema$1
17869
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17870
- addonId: string(),
17871
- modelId: string(),
17872
- format: ModelFormatSchema$1
17873
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17874
- engine: PipelineEngineChoiceSchema.optional(),
17875
- steps: array(PipelineStepInputSchema).min(1),
17876
- frame: FrameInputSchema.optional(),
17877
- /**
17878
- * Process-local lazy frame. Valid only when caller and provider resolve
17879
- * in the same execution-group process; split/cross-node callers use
17880
- * `frame`/`image` inline compatibility instead.
17881
- */
17882
- frameRef: FrameRefSchema.optional(),
17883
- /**
17884
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
17885
- * the decoded pixels live in. One more member of the one-of
17886
- * frame/frameHandle/image/imageBase64/referenceImage group.
17887
- */
17888
- frameHandle: FrameHandleSchema.optional(),
17889
- imageBase64: string().optional(),
17890
- /**
17891
- * Binary JPEG bytes — preferred over `imageBase64` on internal
17892
- * hops (hub → forked worker via Moleculer MsgPack) because it
17893
- * skips the 33% base64 overhead + the per-call base64 decode on
17894
- * the detection-pipeline worker. Callers can pass either; exactly
17895
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17896
- */
17897
- image: _instanceof(Uint8Array).optional(),
17898
- referenceImage: string().optional(),
17899
- deviceId: number().optional(),
17900
- sessionId: string().optional(),
17901
- /**
17902
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
17903
- * reference-image, and detail-subtree calls. 'frame' is the live
17904
- * per-frame dispatch: ONLY root-plane steps run; crop children
17905
- * (inputClasses ≠ null) are skipped and served per-track via
17906
- * pipelineRunner.runDetailSubtree (two-plane design).
17907
- */
17908
- plane: _enum(["full", "frame"]).optional(),
17909
- /**
17910
- * Inference-device selector (Phase 2 multi-device). Format
17911
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17912
- * Omitted ⇒ the runner's default device (current single-engine
17913
- * behaviour). Selects WHICH device pool of the node runs the call.
17914
- */
17915
- deviceKey: string().optional(),
17916
- /**
17917
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17918
- * when the parent crop was resolved from the frame's retained NATIVE
17919
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17920
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17921
- * resolution from that surface — the SAME quality path faces already
17922
- * had — instead of the downscaled parent tile. `handle` keys the native
17923
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17924
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17925
- * the executor's crop-normalized child ROI back into frame-normalized
17926
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17927
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17928
- * (today's behaviour on the fallback path).
17929
- */
17930
- nativeCropRef: NativeCropRefSchema.optional()
17931
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17932
- engine: PipelineEngineChoiceSchema.optional(),
17933
- steps: array(PipelineStepInputSchema).min(1),
17934
- frames: array(FrameInputSchema).min(1).max(255),
17935
- deviceId: number().optional(),
17936
- sessionId: string().optional(),
17937
- /**
17938
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17939
- * the batch to the Python pool's bench preprocess cache
17940
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17941
- * preprocessed ONCE and every later inference is a pure-inference cache
17942
- * hit — the sustained-throughput run measures inference, not
17943
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
17944
- * full preprocess every call, correct). Fresh per sustained run;
17945
- * released via `uncacheFrame`.
17946
- */
17947
- frameId: number().int().nonnegative().optional(),
17948
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17949
- deviceKey: string().optional()
17950
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17951
- data: _instanceof(Uint8Array),
17952
- width: number().int().positive(),
17953
- height: number().int().positive(),
17954
- format: _enum([
17955
- "rgb",
17956
- "bgr",
17957
- "gray"
17958
- ])
17959
- }), object({
17960
- frameId: number(),
17961
- width: number(),
17962
- height: number()
17963
- }), { kind: "mutation" }), method(object({
17964
- stepId: string(),
17965
- frameId: number().int()
17966
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17967
- batchMode: string(),
17968
- windowMs: number(),
17969
- maxBatchSize: number(),
17970
- concurrency: number()
17971
- })), method(_void(), array(object({
17972
- engineKey: string(),
17973
- engine: PipelineEngineChoiceSchema,
17974
- modelsLoaded: array(string()).readonly(),
17975
- inUseByCameras: array(number()).readonly(),
17976
- /**
17977
- * Origin of this resident factory.
17978
- * - `runtime` — main camera-serving engine (no idle TTL).
17979
- * - `warm-override` — benchmark/test override held in the warm
17980
- * cache; auto-disposed after the idle TTL.
17981
- * - `device-pool` — a concurrent per-device pool (Phase 2
17982
- * multi-device, keyed by `deviceKey`) resolved
17983
- * via `resolveDeviceFactory`. Runs alongside the
17984
- * `runtime` engine on a DIFFERENT accelerator
17985
- * (NPU / iGPU / Coral) — this is how the
17986
- * Engines tab shows all pools running at once.
17987
- */
17988
- kind: _enum([
17989
- "runtime",
17990
- "warm-override",
17991
- "device-pool"
17992
- ]),
17993
- /** Native pid of the underlying Python pool (null when no pool). */
17994
- poolPid: number().nullable(),
17995
- /** ms since this factory was last used (null when not warm-tracked). */
17996
- idleMs: number().nullable(),
17997
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17998
- idleTtlMs: number().nullable()
17999
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
18193
+ }), method(object({ frameId: string() }), object({
18194
+ base64: string(),
18195
+ width: number().int(),
18196
+ height: number().int()
18197
+ }), {
18198
+ kind: "query",
18199
+ auth: "admin"
18200
+ }), method(object({
18201
+ deviceId: number(),
18202
+ trackId: string(),
18203
+ frameId: string(),
18204
+ subject: RetrainAssistSubjectSchema,
18205
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18206
+ nodeId: string().optional()
18207
+ }), RetrainAssistResultSchema, {
18000
18208
  kind: "mutation",
18001
18209
  auth: "admin"
18002
18210
  }), method(object({
18003
- engine: PipelineEngineChoiceSchema,
18004
- force: boolean().optional()
18005
- }), object({
18006
- success: boolean(),
18007
- reason: string().optional()
18008
- }), {
18211
+ deviceId: number(),
18212
+ source: DetectionSourceSchema,
18213
+ zones: array(ZoneSchema).readonly().optional(),
18214
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
18215
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
18216
+ frames: array(ReplayFrameInputSchema).min(1)
18217
+ }), RunReplayFrameProcessorResultSchema, {
18009
18218
  kind: "mutation",
18010
18219
  auth: "admin"
18011
- }), 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({
18012
- addonId: string(),
18013
- modelId: string(),
18014
- filename: string().optional(),
18015
- settings: record(string(), unknown()).optional()
18016
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
18220
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
18221
+ kind: "query",
18222
+ auth: "admin"
18223
+ }), method(object({
18224
+ deviceId: number(),
18225
+ trackId: string(),
18226
+ frameId: string(),
18227
+ annotations: array(RetrainAnnotationDraftSchema)
18228
+ }), array(RetrainAnnotationSchema).readonly(), {
18229
+ kind: "mutation",
18230
+ auth: "admin"
18231
+ }), method(object({
18232
+ deviceId: number(),
18233
+ trackId: string()
18234
+ }), RetrainTransitionResultSchema, {
18235
+ kind: "mutation",
18236
+ auth: "admin"
18237
+ }), method(object({
18238
+ deviceId: number(),
18239
+ trackId: string()
18240
+ }), RetrainTransitionResultSchema, {
18241
+ kind: "mutation",
18242
+ auth: "admin"
18243
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18244
+ kind: "query",
18245
+ auth: "admin"
18246
+ }), method(object({
18247
+ eventId: string(),
18248
+ kind: MediaFileKindEnum.optional(),
18249
+ deviceId: number()
18250
+ }), array(MediaFileSchema).readonly()), method(object({
18251
+ trackId: string(),
18252
+ kinds: array(MediaFileKindEnum).optional(),
18253
+ deviceId: number()
18254
+ }), array(MediaFileSchema).readonly()), method(object({
18255
+ trackId: string(),
18256
+ deviceId: number()
18257
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18258
+ kind: "mutation",
18259
+ auth: "admin"
18260
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18261
+ kind: "mutation",
18262
+ auth: "admin"
18263
+ }), method(object({}), RebuildStatusSchema), object({
18264
+ deviceId: number(),
18265
+ timestamp: number(),
18266
+ frameWidth: number(),
18267
+ frameHeight: number(),
18268
+ detections: array(OverlayDetectionSchema).readonly()
18269
+ }), object({
18270
+ deviceId: number(),
18271
+ trackId: string(),
18272
+ className: string()
18273
+ }), object({
18274
+ deviceId: number(),
18275
+ trackId: string(),
18276
+ className: string(),
18277
+ durationMs: number()
18278
+ }), object({
18279
+ deviceId: number(),
18280
+ kind: EventKindSchema,
18281
+ eventId: string(),
18282
+ timestamp: number()
18283
+ });
18017
18284
  object({
18018
18285
  activeCameras: number(),
18019
18286
  throttledCameras: number(),
@@ -18039,66 +18306,6 @@ var CameraMetricsSchema = object({
18039
18306
  });
18040
18307
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
18041
18308
  /**
18042
- * Zone — pure geometry + identity. NO filtering behaviour.
18043
- *
18044
- * Zones describe **where** in the frame the operator wants to flag
18045
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
18046
- * each pipeline stage uses them. Splitting the two means a single
18047
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
18048
- * a detection-include rule on `['car']`, and an occupancy aggregate
18049
- * — without three duplicated polygons.
18050
- *
18051
- * Owned by the orchestrator addon (provider) and mirrored into the
18052
- * `zones` device-state slice on every mutation. Consumers
18053
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
18054
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
18055
- * mirror with `onChanged`).
18056
- *
18057
- * Coordinates are normalised fractions of the frame (0–1) so zones
18058
- * survive resolution changes and stream profile switches.
18059
- *
18060
- * `kind` discriminates between full polygons (closed regions used
18061
- * for intrusion / occupancy filters) and tripwires (open 2-point
18062
- * line segments used for cross events). Onboard / firmware-reported
18063
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
18064
- * task list.
18065
- */
18066
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
18067
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
18068
- var PolygonPointSchema = object({
18069
- x: number(),
18070
- y: number()
18071
- });
18072
- /** A camera detection zone — pure geometry/identity. */
18073
- var ZoneSchema = object({
18074
- id: string(),
18075
- name: string(),
18076
- kind: ZoneKindEnum.default("polygon"),
18077
- /** Polygon vertices, fraction of frame (0–1). */
18078
- polygon: array(PolygonPointSchema).readonly(),
18079
- /** Visual color for UI rendering. */
18080
- color: string().default("#3b82f6")
18081
- });
18082
- DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
18083
- deviceId: number(),
18084
- zone: ZoneSchema
18085
- }), _void(), {
18086
- kind: "mutation",
18087
- auth: "admin"
18088
- }), method(object({
18089
- deviceId: number(),
18090
- zoneId: string()
18091
- }), _void(), {
18092
- kind: "mutation",
18093
- auth: "admin"
18094
- }), method(object({
18095
- deviceId: number(),
18096
- zone: ZoneSchema
18097
- }), _void(), {
18098
- kind: "mutation",
18099
- auth: "admin"
18100
- }), object({ zones: array(ZoneSchema).readonly() });
18101
- /**
18102
18309
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
18103
18310
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
18104
18311
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -19786,7 +19993,7 @@ method(object({
19786
19993
  * linking rather than produce an eternal token.
19787
19994
  */
19788
19995
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19789
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
19996
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19790
19997
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19791
19998
  providerId: string().min(1),
19792
19999
  displayName: string().min(1),
@@ -19881,10 +20088,13 @@ var EvictResultSchema = object({
19881
20088
  /** True when the provider has nothing left it is willing to drop on this location. */
19882
20089
  exhausted: boolean()
19883
20090
  });
19884
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
20091
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19885
20092
  locationId: string(),
19886
20093
  targetBytes: number().int().positive()
19887
- }), EvictResultSchema, { kind: "mutation" });
20094
+ }), EvictResultSchema, {
20095
+ kind: "mutation",
20096
+ auth: "admin"
20097
+ });
19888
20098
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19889
20099
  kind: "mutation",
19890
20100
  auth: "admin"
@@ -19944,26 +20154,50 @@ var ReadChunkInputSchema = object({
19944
20154
  length: number()
19945
20155
  });
19946
20156
  var EndDownloadInputSchema = object({ downloadId: string() });
19947
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
20157
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19948
20158
  location: StorageLocationSchema,
19949
20159
  relativePath: string()
19950
- }), string()), method(object({
20160
+ }), string(), { auth: "admin" }), method(object({
19951
20161
  location: StorageLocationSchema,
19952
20162
  relativePath: string(),
19953
20163
  data: _instanceof(Uint8Array)
19954
- }), _void(), { kind: "mutation" }), method(object({
20164
+ }), _void(), {
20165
+ kind: "mutation",
20166
+ auth: "admin"
20167
+ }), method(object({
19955
20168
  location: StorageLocationSchema,
19956
20169
  relativePath: string()
19957
- }), _instanceof(Uint8Array)), method(object({
20170
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19958
20171
  location: StorageLocationSchema,
19959
20172
  relativePath: string()
19960
- }), boolean()), method(object({
20173
+ }), boolean(), { auth: "admin" }), method(object({
19961
20174
  location: StorageLocationSchema,
19962
20175
  prefix: string().optional()
19963
- }), array(string()).readonly()), method(object({
20176
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19964
20177
  location: StorageLocationSchema,
19965
20178
  relativePath: string()
19966
- }), _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" });
20179
+ }), _void(), {
20180
+ kind: "mutation",
20181
+ auth: "admin"
20182
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
20183
+ kind: "mutation",
20184
+ auth: "admin"
20185
+ }), method(WriteChunkInputSchema, _void(), {
20186
+ kind: "mutation",
20187
+ auth: "admin"
20188
+ }), method(FinalizeUploadInputSchema, _void(), {
20189
+ kind: "mutation",
20190
+ auth: "admin"
20191
+ }), method(AbortUploadInputSchema, _void(), {
20192
+ kind: "mutation",
20193
+ auth: "admin"
20194
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
20195
+ kind: "mutation",
20196
+ auth: "admin"
20197
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
20198
+ kind: "mutation",
20199
+ auth: "admin"
20200
+ });
19967
20201
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19968
20202
  var ProfileSettingsSchemaBridge = unknown().nullable();
19969
20203
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -20221,7 +20455,8 @@ method(object({
20221
20455
  access: "create"
20222
20456
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
20223
20457
  kind: "mutation",
20224
- access: "view"
20458
+ access: "view",
20459
+ auth: "admin"
20225
20460
  }), method(object({
20226
20461
  /** Required — the user the assertion belongs to (verified). */
20227
20462
  userId: string(),
@@ -20229,10 +20464,12 @@ method(object({
20229
20464
  response: record(string(), unknown())
20230
20465
  }), object({ verified: boolean() }), {
20231
20466
  kind: "mutation",
20232
- access: "view"
20467
+ access: "view",
20468
+ auth: "admin"
20233
20469
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
20234
20470
  kind: "mutation",
20235
- access: "view"
20471
+ access: "view",
20472
+ auth: "admin"
20236
20473
  }), method(object({
20237
20474
  /** AuthenticationResponseJSON from the browser. */
20238
20475
  response: record(string(), unknown()) }), object({
@@ -20240,7 +20477,8 @@ response: record(string(), unknown()) }), object({
20240
20477
  userId: string().nullable()
20241
20478
  }), {
20242
20479
  kind: "mutation",
20243
- access: "view"
20480
+ access: "view",
20481
+ auth: "admin"
20244
20482
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
20245
20483
  userId: string(),
20246
20484
  credentialId: string()
@@ -20412,7 +20650,19 @@ var VectorStatsResultSchema = object({
20412
20650
  /** False when the backend ranks approximately. */
20413
20651
  exact: boolean()
20414
20652
  });
20415
- 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);
20653
+ method(VectorDeclareIndexInputSchema, _void(), {
20654
+ kind: "mutation",
20655
+ auth: "admin"
20656
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20657
+ kind: "mutation",
20658
+ auth: "admin"
20659
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20660
+ kind: "mutation",
20661
+ auth: "admin"
20662
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20663
+ kind: "mutation",
20664
+ auth: "admin"
20665
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20416
20666
  var ClipSchema = object({
20417
20667
  /** Opaque, provider-namespaced id. The default provider encodes the time
20418
20668
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -22135,7 +22385,27 @@ var MediaFileLiteSchema$1 = object({
22135
22385
  sizeBytes: number(),
22136
22386
  timestamp: number()
22137
22387
  });
22138
- method(_void(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22388
+ method(object({
22389
+ /**
22390
+ * Inline {@link IdentitySchema.coverBase64} on every row.
22391
+ *
22392
+ * Default `false`, the same inversion `listRecentFaces` and
22393
+ * `listPlates` took on 2026-08-25 (see `include-crops-default.ts` for
22394
+ * why the burden belongs on the caller that WANTS the bytes). Measured
22395
+ * on the live hub the same day: four identities cost 40,979 B with the
22396
+ * covers inline, ~10 KB of base64 per row, on a query this UI mounts
22397
+ * four times and the viewer holds at `staleTime: 30_000`.
22398
+ *
22399
+ * Nothing loses its avatar: `coverMediaKey` is already on every row and
22400
+ * the `event-media` plane serves that key `immutable` with an ETag.
22401
+ *
22402
+ * **This is an INPUT field, so it does not reach the addon until the
22403
+ * next train** — the hub router validates cap inputs against its own
22404
+ * compiled Zod and strips a key it does not know. Until then the
22405
+ * provider sees `undefined`, which resolves to `false`: the cheap shape
22406
+ * is what ships, and the opt-in becomes reachable when the train lands.
22407
+ */
22408
+ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22139
22409
  kind: "mutation",
22140
22410
  auth: "admin"
22141
22411
  }), method(object({
@@ -24282,8 +24552,10 @@ var PlateInfoSchema = object({
24282
24552
  keyFrameMediaKey: string().optional(),
24283
24553
  base64: string().optional(),
24284
24554
  /**
24285
- * Same crop as a data-plane URL. `getPlateByTrack` returns this and
24286
- * never inlines JPEG; `listPlates` still inlines for the admin-ui.
24555
+ * Same crop as a data-plane URL, always present when the plate has a stored
24556
+ * crop. `getPlateByTrack` returns this and never inlines JPEG; `listPlates`
24557
+ * and `searchPlates` inline the crop only when their `includeCrops` input is
24558
+ * left at its `true` default.
24287
24559
  */
24288
24560
  cropUrl: string().optional()
24289
24561
  });
@@ -24303,14 +24575,34 @@ var PlateClusterSchema = object({
24303
24575
  });
24304
24576
  method(object({
24305
24577
  deviceId: number().int().optional(),
24306
- limit: number().int().positive().optional()
24578
+ limit: number().int().positive().optional(),
24579
+ /**
24580
+ * Inline the base64 crop on every row. Default `true` — the existing
24581
+ * behaviour, kept so no caller breaks.
24582
+ *
24583
+ * Set `false` once the caller renders {@link PlateInfo.cropUrl}.
24584
+ * Measured on the live hub at the 500 rows the Plates view asks for:
24585
+ * 879,403 B and 27.7 s with the crops inline, against a few KiB of
24586
+ * metadata without them — and the browser then caches the images.
24587
+ *
24588
+ * This is the plate twin of `faceGallery.listRecentFaces`'s option;
24589
+ * plates were the one gallery list left without it.
24590
+ *
24591
+ * **This is an INPUT field, so it does not reach the addon until the
24592
+ * next train.** The hub router validates cap inputs against its own
24593
+ * compiled Zod and strips a key it does not know. Until the train
24594
+ * ships, sending `false` is harmless and keeps the crops inline.
24595
+ */
24596
+ includeCrops: boolean().optional()
24307
24597
  }).optional(), array(PlateInfoSchema).readonly()), method(object({
24308
24598
  deviceId: number().int(),
24309
24599
  trackId: string()
24310
24600
  }), PlateInfoSchema.nullable()), method(object({ plateId: string() }), array(MediaFileLiteSchema).readonly()), method(object({
24311
24601
  text: string().min(1),
24312
24602
  maxDistance: number().int().min(0).optional(),
24313
- limit: number().int().positive().optional()
24603
+ limit: number().int().positive().optional(),
24604
+ /** See `listPlates.includeCrops`. Default `true`. */
24605
+ includeCrops: boolean().optional()
24314
24606
  }), array(PlateInfoSchema).readonly()), method(object({
24315
24607
  maxDistance: number().int().min(0).optional(),
24316
24608
  minClusterSize: number().int().min(2).optional(),
@@ -24324,7 +24616,13 @@ method(object({
24324
24616
  }), method(object({ plateId: string() }), _void(), {
24325
24617
  kind: "mutation",
24326
24618
  auth: "admin"
24327
- }), method(_void(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24619
+ }), method(object({
24620
+ /** Inline {@link VehicleSchema.coverBase64} on every row. Default
24621
+ * `false` — the vehicle twin of `faceGallery.listIdentities`'s
24622
+ * option; `coverMediaKey` + the `event-media` plane carry the picture.
24623
+ * INPUT field: stripped by the hub router until the train ships, which
24624
+ * resolves to `false` and is exactly the intended default. */
24625
+ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24328
24626
  kind: "mutation",
24329
24627
  auth: "admin"
24330
24628
  }), method(object({
@@ -25589,92 +25887,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
25589
25887
  kind: "mutation",
25590
25888
  auth: "admin"
25591
25889
  });
25592
- /**
25593
- * Per-stage gating mode applied to the zones a rule references.
25594
- *
25595
- * - `include`: the rule contributes to a **whitelist** for its stage.
25596
- * When at least one `include` rule fires for a stage, only entities
25597
- * inside one of those zones pass that stage.
25598
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
25599
- * Entities inside one of those zones are dropped at that stage.
25600
- *
25601
- * `monitor`-style observation (count without filtering) is not a rule
25602
- * mode — zones without any matching rule are observed naturally by
25603
- * `zone-analytics` (live snapshot + history), so an "I just want to
25604
- * count, not filter" use case needs no rule at all.
25605
- */
25606
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
25607
- /**
25608
- * Per-consumer rule that references existing zones (geometry) and
25609
- * defines how a specific pipeline stage should treat them. Each
25610
- * consumer addon owns its own `ZoneRule[]` array in its per-device
25611
- * settings:
25612
- *
25613
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
25614
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
25615
- * - future: notification rules, audio gating, etc.
25616
- *
25617
- * One rule applies to N zones (`zoneIds[]`) so the operator can
25618
- * express "ignore motion in ALL of {garden, street}" with a single
25619
- * rule. `classFilter` narrows the rule to specific object classes —
25620
- * "drop person detections in the street, but keep cars" is one
25621
- * `exclude` rule with `classFilter: ['person']`.
25622
- *
25623
- * `enabled` is a soft toggle — the operator can keep the rule
25624
- * configured but inert without deleting it.
25625
- */
25626
- var ZoneRuleSchema = object({
25627
- /** Stable rule id — survives edits, used by the UI for diffing. */
25628
- id: string(),
25629
- /** Optional human-readable label rendered in the rule editor. */
25630
- name: string().optional(),
25631
- /** Zones this rule targets. The rule's `mode` applies to ALL
25632
- * listed zones (OR-set: a detection in any one of them counts).
25633
- * At least one zone id required — a rule with no targets is a
25634
- * configuration mistake and the form validator rejects it. */
25635
- zoneIds: array(string()).min(1).readonly(),
25636
- mode: ZoneRuleModeEnum,
25637
- /**
25638
- * Class names this rule applies to. Empty / undefined ⇒ rule
25639
- * applies to every class. Class strings match the `macroClass`
25640
- * field on detections (e.g. `person`, `car`, `dog`).
25641
- */
25642
- classFilter: array(string()).readonly().optional(),
25643
- /**
25644
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
25645
- * required to consider an entity "in the zone". Defaults to the
25646
- * consumer's stage default when omitted. Kept for back-compat with
25647
- * existing per-rule overrides; new operators pick the value via
25648
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
25649
- * set, the lower-level engine reads it as a 0–1 fraction.
25650
- */
25651
- overlapThreshold: number().min(0).max(1).optional(),
25652
- /**
25653
- * Operator-friendly version of `overlapThreshold` — the percentage
25654
- * of the detection's bbox that must lie inside the zone for the
25655
- * rule to match. Documented default is 85%; the engine substitutes
25656
- * that when the field is omitted (kept optional so existing rules
25657
- * stored without it stay valid).
25658
- *
25659
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
25660
- * rule, the engine prefers `bboxInclusionPct` because it's the
25661
- * field exposed in the UI. Internally both feed the same gate.
25662
- */
25663
- bboxInclusionPct: number().min(0).max(100).optional(),
25664
- /**
25665
- * When `true` and a detection has a segmentation mask, use the
25666
- * mask for overlap instead of the bbox. Detection-stage only;
25667
- * motion rules ignore this field.
25668
- */
25669
- preferMask: boolean().optional(),
25670
- /**
25671
- * Soft-toggle: `false` disables the rule without deleting it.
25672
- * Defaults to `true` so operators creating a rule via the UI
25673
- * see it active immediately.
25674
- */
25675
- enabled: boolean().default(true)
25676
- });
25677
- array(ZoneRuleSchema).readonly();
25678
25890
  object({
25679
25891
  /** Whether the script is currently executing. */
25680
25892
  isRunning: boolean(),
@@ -29701,6 +29913,12 @@ Object.freeze({
29701
29913
  addonId: null,
29702
29914
  access: "create"
29703
29915
  },
29916
+ "pipelineAnalytics.cancelRelocateMedia": {
29917
+ capName: "pipeline-analytics",
29918
+ capScope: "device",
29919
+ addonId: null,
29920
+ access: "create"
29921
+ },
29704
29922
  "pipelineAnalytics.cancelStorageMigrationMove": {
29705
29923
  capName: "pipeline-analytics",
29706
29924
  capScope: "device",
@@ -29875,6 +30093,12 @@ Object.freeze({
29875
30093
  addonId: null,
29876
30094
  access: "view"
29877
30095
  },
30096
+ "pipelineAnalytics.listRelocateMediaJobs": {
30097
+ capName: "pipeline-analytics",
30098
+ capScope: "device",
30099
+ addonId: null,
30100
+ access: "view"
30101
+ },
29878
30102
  "pipelineAnalytics.listRetrainAnnotations": {
29879
30103
  capName: "pipeline-analytics",
29880
30104
  capScope: "device",
@@ -29953,6 +30177,12 @@ Object.freeze({
29953
30177
  addonId: null,
29954
30178
  access: "create"
29955
30179
  },
30180
+ "pipelineAnalytics.relocateMedia": {
30181
+ capName: "pipeline-analytics",
30182
+ capScope: "device",
30183
+ addonId: null,
30184
+ access: "create"
30185
+ },
29956
30186
  "pipelineAnalytics.restageRetrainTrack": {
29957
30187
  capName: "pipeline-analytics",
29958
30188
  capScope: "device",
@@ -29965,6 +30195,12 @@ Object.freeze({
29965
30195
  addonId: null,
29966
30196
  access: "create"
29967
30197
  },
30198
+ "pipelineAnalytics.runReplayFrameProcessor": {
30199
+ capName: "pipeline-analytics",
30200
+ capScope: "device",
30201
+ addonId: null,
30202
+ access: "create"
30203
+ },
29968
30204
  "pipelineAnalytics.saveRetrainAnnotations": {
29969
30205
  capName: "pipeline-analytics",
29970
30206
  capScope: "device",
@@ -30097,6 +30333,12 @@ Object.freeze({
30097
30333
  addonId: null,
30098
30334
  access: "view"
30099
30335
  },
30336
+ "pipelineExecutor.getInferenceDeviceHealth": {
30337
+ capName: "pipeline-executor",
30338
+ capScope: "system",
30339
+ addonId: null,
30340
+ access: "view"
30341
+ },
30100
30342
  "pipelineExecutor.getOrchestratorConfigSchema": {
30101
30343
  capName: "pipeline-executor",
30102
30344
  capScope: "system",
@@ -30169,6 +30411,12 @@ Object.freeze({
30169
30411
  addonId: null,
30170
30412
  access: "view"
30171
30413
  },
30414
+ "pipelineExecutor.rearmInferenceDevice": {
30415
+ capName: "pipeline-executor",
30416
+ capScope: "system",
30417
+ addonId: null,
30418
+ access: "create"
30419
+ },
30172
30420
  "pipelineExecutor.runAudioTest": {
30173
30421
  capName: "pipeline-executor",
30174
30422
  capScope: "system",
@@ -33417,6 +33665,11 @@ Object.freeze({
33417
33665
  form: "single",
33418
33666
  optional: false
33419
33667
  }],
33668
+ "pipelineAnalytics.runReplayFrameProcessor": [{
33669
+ name: "deviceId",
33670
+ form: "single",
33671
+ optional: false
33672
+ }],
33420
33673
  "pipelineAnalytics.saveRetrainAnnotations": [{
33421
33674
  name: "deviceId",
33422
33675
  form: "single",