@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.
@@ -6657,7 +6657,7 @@ function method(input, output, options) {
6657
6657
  input,
6658
6658
  output,
6659
6659
  kind: options?.kind ?? "query",
6660
- auth: options?.auth ?? "protected",
6660
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6661
6661
  ...options?.access !== void 0 ? { access: options.access } : {},
6662
6662
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6663
6663
  timeoutMs: options?.timeoutMs
@@ -6677,7 +6677,7 @@ function systemMethod(input, output, options) {
6677
6677
  }
6678
6678
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
6679
6679
  var VersionOutputSchema$1 = object({ version: string() });
6680
- method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6680
+ method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
6681
6681
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
6682
6682
  DeviceType["Camera"] = "camera";
6683
6683
  DeviceType["Hub"] = "hub";
@@ -6998,7 +6998,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6998
6998
  }({});
6999
6999
  var StaticDirOutputSchema = object({ staticDir: string() });
7000
7000
  var VersionOutputSchema = object({ version: string() });
7001
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
7001
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
7002
7002
  /**
7003
7003
  * device-ops — device-scoped cap that unifies the per-IDevice operations
7004
7004
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7769,24 +7769,6 @@ var RecordingRetentionSchema = object({
7769
7769
  maxSizeGb: number().min(0).optional()
7770
7770
  });
7771
7771
  /**
7772
- * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7773
- * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7774
- * previews at. Five graduated steps; absent on a config = `standard` (the
7775
- * shipped default, matching `sheet-geometry`/`sheet-composer`).
7776
- *
7777
- * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7778
- * Each window's index sidecar carries its own tile dims, so a camera whose
7779
- * preset changed over time renders every historical window at the dims it was
7780
- * written with.
7781
- */
7782
- var ScrubThumbnailPresetSchema = _enum([
7783
- "minimal",
7784
- "low",
7785
- "standard",
7786
- "high",
7787
- "max"
7788
- ]);
7789
- /**
7790
7772
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7791
7773
  *
7792
7774
  * `bands` is the ONLY authored recording intent: what to record, when, and on
@@ -7794,7 +7776,11 @@ var ScrubThumbnailPresetSchema = _enum([
7794
7776
  * other field is a storage knob (profiles, segment length, retention, scrub).
7795
7777
  *
7796
7778
  * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7797
- * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7779
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30,
7780
+ * and `scrubThumbnails` — a five-step fidelity knob for a sprite tier that was
7781
+ * deleted on 2026-07-24 and had ZERO consumers in the recorder — on 2026-08-25
7782
+ * (D62: a switch that writes a store nobody reads is worse than no switch).
7783
+ * Stored rows keep loading: the READ schema is `.strip()` (config-store.ts).
7798
7784
  * A stale caller must fail loudly — silently stripping its legacy intent would
7799
7785
  * persist a band-less config, i.e. silently stop recording the camera.
7800
7786
  */
@@ -7817,14 +7803,7 @@ var RecordingConfigSchema = object({
7817
7803
  * "off" is the absence of a covering band, never a band value.
7818
7804
  */
7819
7805
  bands: array(RecordingBandSchema).default([]),
7820
- retention: RecordingRetentionSchema.optional(),
7821
- /**
7822
- * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7823
- * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7824
- * windows only — existing sheets are immutable, and each window's index
7825
- * carries its own tile dims so mixed-preset history renders correctly.
7826
- */
7827
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7806
+ retention: RecordingRetentionSchema.optional()
7828
7807
  }).strict();
7829
7808
  /**
7830
7809
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
@@ -7900,10 +7879,11 @@ var RelocateFootageInputSchema = object({
7900
7879
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7901
7880
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7902
7881
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7903
- var StorageMigrationMediaMoveInputSchema = object({
7882
+ var RelocateMediaInputSchema = object({
7904
7883
  toLocationId: string(),
7905
7884
  throttleMbps: number().min(1).max(1e3).optional()
7906
- }).extend({ leaseId: string().min(1) });
7885
+ });
7886
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7907
7887
  /** The independently selectable logical storage classes. `recordings`
7908
7888
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7909
7889
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8252,7 +8232,26 @@ var LabelDefinitionSchema = object({
8252
8232
  description: string().optional(),
8253
8233
  icon: string().optional()
8254
8234
  });
8255
- var ClassMapDefinitionSchema = object({
8235
+ /**
8236
+ * Wire schema for a per-model CATALOG classMap override
8237
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8238
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8239
+ * detection pipeline executor actually routes.
8240
+ *
8241
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8242
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8243
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8244
+ * enum) — the two used to share the name `ClassMapDefinition`/
8245
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8246
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8247
+ * are not: it is two different concepts colliding on a name. Keep this type
8248
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8249
+ * would either narrow every `ClassMapDefinition` consumer to the four
8250
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8251
+ * schema exists for (see the "rejects a classMap whose target is not a
8252
+ * detection macro" test in `model-catalog-schema.test.ts`).
8253
+ */
8254
+ var DetectionCatalogClassMapSchema = object({
8256
8255
  mapping: record(string(), _enum([
8257
8256
  "person",
8258
8257
  "vehicle",
@@ -8457,7 +8456,7 @@ var ModelCatalogEntrySchema = object({
8457
8456
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8458
8457
  * labels already ARE the CamStack macros (Scrypted identity map).
8459
8458
  */
8460
- classMap: ClassMapDefinitionSchema.optional()
8459
+ classMap: DetectionCatalogClassMapSchema.optional()
8461
8460
  });
8462
8461
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8463
8462
  format: literal("openvino"),
@@ -8487,7 +8486,7 @@ var ModelConvertMetadataSchema = object({
8487
8486
  "segmentation"
8488
8487
  ]),
8489
8488
  faceAlignment: boolean().optional(),
8490
- classMap: ClassMapDefinitionSchema.optional()
8489
+ classMap: DetectionCatalogClassMapSchema.optional()
8491
8490
  });
8492
8491
  var ConvertResultSchema = object({
8493
8492
  entry: ModelCatalogEntrySchema,
@@ -9357,7 +9356,7 @@ var AddonPageDeclarationSchema = object({
9357
9356
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9358
9357
  sectionLabel: string().optional()
9359
9358
  });
9360
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9359
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9361
9360
  var AddonHttpRouteSchema = object({
9362
9361
  method: _enum([
9363
9362
  "GET",
@@ -9611,7 +9610,7 @@ var WidgetMetadataSchema = object({
9611
9610
  defaultColumns: number().int().min(1).max(12).default(6),
9612
9611
  defaultRows: number().int().min(1).max(12).default(1)
9613
9612
  });
9614
- method(_void(), array(WidgetMetadataSchema).readonly());
9613
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9615
9614
  /**
9616
9615
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9617
9616
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -11155,7 +11154,7 @@ var CustomModelDescriptorSchema = object({
11155
11154
  stepId: string(),
11156
11155
  entry: ModelCatalogEntrySchema
11157
11156
  });
11158
- method(_void(), array(CustomModelDescriptorSchema).readonly());
11157
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
11159
11158
  /**
11160
11159
  * Query filter for settings-store collections.
11161
11160
  */
@@ -11242,7 +11241,8 @@ method(object({
11242
11241
  }), _void(), { kind: "mutation" }), method(object({
11243
11242
  namespace: string().optional(),
11244
11243
  collection: string(),
11245
- filter: QueryFilterSchema.optional()
11244
+ filter: QueryFilterSchema.optional(),
11245
+ columns: array(string()).readonly().optional()
11246
11246
  }), array(SettingsRecordSchema).readonly()), method(object({
11247
11247
  namespace: string().optional(),
11248
11248
  collection: string(),
@@ -11305,46 +11305,87 @@ var EngineInfoSchema = object({
11305
11305
  kind: _enum(["relational", "vector"]),
11306
11306
  displayName: string()
11307
11307
  });
11308
- method(_void(), EngineInfoSchema), method(object({
11308
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11309
11309
  namespace: string().optional(),
11310
11310
  collection: string(),
11311
11311
  key: string()
11312
- }), unknown()), method(object({
11312
+ }), unknown(), { auth: "admin" }), method(object({
11313
11313
  namespace: string().optional(),
11314
11314
  collection: string(),
11315
11315
  key: string(),
11316
11316
  value: unknown()
11317
- }), _void(), { kind: "mutation" }), method(object({
11317
+ }), _void(), {
11318
+ kind: "mutation",
11319
+ auth: "admin"
11320
+ }), method(object({
11318
11321
  namespace: string().optional(),
11319
11322
  collection: string(),
11320
- filter: QueryFilterSchema.optional()
11321
- }), array(SettingsRecordSchema).readonly()), method(object({
11323
+ filter: QueryFilterSchema.optional(),
11324
+ /**
11325
+ * SQL-level column projection — MUST mirror `settings-store.query`.
11326
+ *
11327
+ * ⚠ An earlier version of this comment blamed Zod stripping, and that
11328
+ * was wrong — corrected 2026-08-26 after the hop map
11329
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11330
+ * There is **no Zod parse at all** between the door and the engine: the
11331
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11332
+ * field declared here reaches `SqliteSettingsBackend` either way.
11333
+ *
11334
+ * What actually lost `columns` was the THIRD declaration of this shape:
11335
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11336
+ * interface the engine destructures from. The field existed on both
11337
+ * schemas and the engine still never read it, because nothing checks a
11338
+ * registered provider against `InferProvider<cap>` —
11339
+ * `ProviderRegistration.provider` is typed `object`.
11340
+ *
11341
+ * It is declared here anyway, and must stay in step with
11342
+ * `settings-store.query`: a caller reading only the cap definitions has
11343
+ * to be able to see that this call carries a projection.
11344
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11345
+ */
11346
+ columns: array(string()).readonly().optional()
11347
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11322
11348
  namespace: string().optional(),
11323
11349
  collection: string(),
11324
11350
  record: SettingsRecordSchema
11325
- }), _void(), { kind: "mutation" }), method(object({
11351
+ }), _void(), {
11352
+ kind: "mutation",
11353
+ auth: "admin"
11354
+ }), method(object({
11326
11355
  namespace: string().optional(),
11327
11356
  collection: string(),
11328
11357
  id: string(),
11329
11358
  data: record(string(), unknown())
11330
- }), _void(), { kind: "mutation" }), method(object({
11359
+ }), _void(), {
11360
+ kind: "mutation",
11361
+ auth: "admin"
11362
+ }), method(object({
11331
11363
  namespace: string().optional(),
11332
11364
  collection: string(),
11333
11365
  key: string()
11334
- }), _void(), { kind: "mutation" }), method(object({
11366
+ }), _void(), {
11367
+ kind: "mutation",
11368
+ auth: "admin"
11369
+ }), method(object({
11335
11370
  namespace: string().optional(),
11336
11371
  collection: string(),
11337
11372
  filter: MutationFilterSchema
11338
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11373
+ }), object({ deleted: number().int() }), {
11374
+ kind: "mutation",
11375
+ auth: "admin"
11376
+ }), method(object({
11339
11377
  namespace: string().optional(),
11340
11378
  collection: string(),
11341
11379
  filter: MutationFilterSchema,
11342
11380
  data: record(string(), unknown())
11343
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11381
+ }), object({ updated: number().int() }), {
11382
+ kind: "mutation",
11383
+ auth: "admin"
11384
+ }), method(object({
11344
11385
  namespace: string().optional(),
11345
11386
  collection: string(),
11346
11387
  filter: QueryFilterSchema.optional()
11347
- }), number()), method(object({
11388
+ }), number(), { auth: "admin" }), method(object({
11348
11389
  namespace: string().optional(),
11349
11390
  collection: string(),
11350
11391
  field: string(),
@@ -11354,15 +11395,18 @@ method(_void(), EngineInfoSchema), method(object({
11354
11395
  }), array(object({
11355
11396
  bucket: number().int(),
11356
11397
  count: number().int()
11357
- })).readonly()), method(object({
11398
+ })).readonly(), { auth: "admin" }), method(object({
11358
11399
  namespace: string().optional(),
11359
11400
  collection: string()
11360
- }), boolean()), method(object({
11401
+ }), boolean(), { auth: "admin" }), method(object({
11361
11402
  namespace: string().optional(),
11362
11403
  collection: string(),
11363
11404
  columns: array(CollectionColumnSchema).readonly(),
11364
11405
  indexes: array(CollectionIndexSchema).readonly().optional()
11365
- }), _void(), { kind: "mutation" });
11406
+ }), _void(), {
11407
+ kind: "mutation",
11408
+ auth: "admin"
11409
+ });
11366
11410
  /**
11367
11411
  * shm ring usage stats for a `frameSink: 'shm'` decoder session —
11368
11412
  * exposed via `decoder.getShmStats` so downstream consumers can
@@ -12515,7 +12559,7 @@ method(object({
12515
12559
  crop: _instanceof(Uint8Array),
12516
12560
  width: number(),
12517
12561
  height: number()
12518
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12562
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12519
12563
  /**
12520
12564
  * filesystem-browse — per-node capability for browsing the node's local
12521
12565
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12808,19 +12852,22 @@ method(LlmGenerateBaseInputSchema.extend({
12808
12852
  runtime: ManagedRuntimeConfigSchema,
12809
12853
  /** The managed profile's timeout, threaded by the hub provider. */
12810
12854
  timeoutMs: number().int().positive().optional()
12811
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12855
+ }), LlmGenerateResultSchema, {
12856
+ kind: "mutation",
12857
+ auth: "admin"
12858
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12812
12859
  kind: "mutation",
12813
12860
  auth: "admin"
12814
12861
  }), method(object({}), _void(), {
12815
12862
  kind: "mutation",
12816
12863
  auth: "admin"
12817
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12864
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12818
12865
  kind: "mutation",
12819
12866
  auth: "admin"
12820
12867
  }), method(object({ file: string() }), _void(), {
12821
12868
  kind: "mutation",
12822
12869
  auth: "admin"
12823
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12870
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12824
12871
  /**
12825
12872
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12826
12873
  * methods concat-fan across providers; single-row methods route to ONE
@@ -16298,1749 +16345,1969 @@ var oauthIntegrationCapability = {
16298
16345
  scope: "system",
16299
16346
  mode: "collection",
16300
16347
  internal: true,
16301
- methods: { getDescriptor: method(_void(), OauthIntegrationDescriptorSchema) }
16348
+ methods: {
16349
+ /**
16350
+ * `internal: true` did not gate the mount (see the 2026-08-26 note on
16351
+ * `data-store-provider`) — `getDescriptor` was reachable on the AppRouter
16352
+ * by ANY authenticated session at the default `auth: 'protected'`. The
16353
+ * real caller is `/api/oauth2/authorize` and `/api/oauth2/integrations`
16354
+ * (`oauth2-routes.ts`), which resolve the provider directly off the
16355
+ * capability registry — never through tRPC. `auth: 'admin'` closes the
16356
+ * tRPC surface without touching that path.
16357
+ */
16358
+ getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
16302
16359
  };
16303
16360
  /**
16304
- * pipeline-analytics — device-scoped wrapper cap. Refines raw
16305
- * per-frame detections emitted by the pipeline runner into tracked
16306
- * objects, per-kind event collections (motion / object / audio), and
16307
- * persisted media. Owns the post-detection domain end-to-end:
16308
- *
16309
- * runner emits PipelineInferenceResult
16310
- * ↓ (event bus)
16311
- * pipeline-analytics subscriber
16312
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16313
- * → three DB collections (one per kind), one FS media tree, one
16314
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16315
- * DetectionEvent on bus)
16316
- *
16317
- * Pure subscriber model. No `processFrame` cap method — the runner
16318
- * already publishes the raw frame on the bus. The cap surface is
16319
- * only QUERIES + per-device settings, bound on/off via
16320
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16321
- * every camera with a detection pipeline wants its raw detections
16322
- * refined; operators opt out per-device via BindingsTab when needed.
16323
- *
16324
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16325
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16361
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16362
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16363
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16326
16364
  */
16327
- var TrackStateSchema = _enum([
16328
- "new",
16329
- "entered",
16330
- "left",
16331
- "moving",
16332
- "idle"
16333
- ]);
16334
- var EventKindSchema = _enum([
16335
- "motion",
16336
- "object",
16337
- "audio"
16338
- ]);
16365
+ var NativeCropRefSchema = object({
16366
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16367
+ handle: FrameHandleSchema,
16368
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16369
+ cropFrameSpace: object({
16370
+ x: number(),
16371
+ y: number(),
16372
+ w: number(),
16373
+ h: number()
16374
+ })
16375
+ });
16376
+ object({
16377
+ crop: object({
16378
+ left: number(),
16379
+ top: number(),
16380
+ width: number().positive(),
16381
+ height: number().positive()
16382
+ }).optional(),
16383
+ content: object({
16384
+ width: number().int().positive(),
16385
+ height: number().int().positive()
16386
+ }),
16387
+ fit: _enum(["stretch", "contain"]),
16388
+ format: _enum([
16389
+ "rgb",
16390
+ "gray",
16391
+ "jpeg"
16392
+ ])
16393
+ });
16339
16394
  /**
16340
- * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16341
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16342
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16395
+ * Process-local frame identity. It is serializable so it can ride an in-process
16396
+ * capability call, but `registryId` deliberately prevents resolution in any
16397
+ * other process or execution group.
16343
16398
  */
16344
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16345
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16346
- var EventKindIconSchema = _enum([
16347
- "motion",
16348
- "audio",
16349
- "person",
16350
- "vehicle",
16351
- "animal",
16352
- "door",
16353
- "pir",
16354
- "smoke",
16355
- "water",
16356
- "button",
16357
- "package",
16358
- "generic"
16399
+ var FrameRefSchema = object({
16400
+ registryId: string().min(1),
16401
+ id: string().min(1),
16402
+ width: number().int().positive(),
16403
+ height: number().int().positive(),
16404
+ format: _enum(["rgb", "gray"]),
16405
+ timestamp: number(),
16406
+ capturedAt: number().optional()
16407
+ });
16408
+ var ModelFormatSchema$1 = _enum([
16409
+ "onnx",
16410
+ "coreml",
16411
+ "openvino",
16412
+ "tflite",
16413
+ "pt",
16414
+ "gguf"
16359
16415
  ]);
16360
- var EventKindCategorySchema = _enum([
16361
- "motion",
16362
- "audio",
16363
- "detection",
16364
- "sensor",
16365
- "control",
16366
- "custom",
16367
- "package"
16416
+ var PipelineSlotSchema = _enum([
16417
+ "detector",
16418
+ "cropper",
16419
+ "classifier",
16420
+ "refiner",
16421
+ "audio-classifier"
16368
16422
  ]);
16369
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16370
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16371
- var EventKindDescriptorSchema = object({
16372
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16373
- kind: string(),
16374
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16375
- labelKey: string(),
16376
- /** English fallback label (kept for clients that don't translate). */
16377
- label: string(),
16378
- /** Hex color for timeline/legend rendering. */
16379
- color: string(),
16380
- /** Dictionary id → lucide component on the UI side. */
16381
- iconId: string(),
16382
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16383
- icon: EventKindIconSchema,
16384
- category: EventKindCategorySchema,
16385
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16386
- parentKind: string().nullable(),
16387
- /** Derived from `parentKind`, explicit for the client tree. */
16388
- level: EventKindLevelSchema,
16389
- /** Which cap + device contributes this kind. For built-ins the camera
16390
- * itself; for sensor kinds the LINKED source device. */
16391
- source: object({
16392
- capName: string(),
16393
- deviceId: number()
16394
- })
16423
+ var PipelineEngineChoiceSchema = object({
16424
+ runtime: _enum(["node", "python"]),
16425
+ backend: string(),
16426
+ format: ModelFormatSchema$1,
16427
+ device: string().optional()
16395
16428
  });
16396
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16397
- var EventKindsForDeviceSchema = object({
16398
- deviceId: number(),
16399
- kinds: array(EventKindDescriptorSchema).readonly()
16429
+ var AvailableEngineSchema = object({
16430
+ engine: PipelineEngineChoiceSchema,
16431
+ devices: array(object({
16432
+ id: string(),
16433
+ label: string(),
16434
+ description: string().optional()
16435
+ })).readonly(),
16436
+ defaultDevice: string()
16400
16437
  });
16401
- var SensorEventSchema = object({
16438
+ var PipelineDefaultStepSchema = lazy(() => object({
16439
+ addonId: string(),
16440
+ addonName: string(),
16441
+ slot: PipelineSlotSchema,
16442
+ inputClasses: array(string()).readonly(),
16443
+ outputClasses: array(string()).readonly(),
16444
+ enabled: boolean(),
16445
+ modelId: string(),
16446
+ children: array(PipelineDefaultStepSchema).readonly(),
16447
+ group: string().optional(),
16448
+ settings: record(string(), unknown()).optional()
16449
+ }));
16450
+ var PipelineTemplateStepSchema = lazy(() => object({
16451
+ addonId: string(),
16452
+ enabled: boolean(),
16453
+ modelId: string(),
16454
+ children: array(PipelineTemplateStepSchema).readonly(),
16455
+ settings: record(string(), unknown()).optional()
16456
+ }));
16457
+ var PipelineTemplateSchema$1 = object({
16402
16458
  id: string(),
16403
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16404
- * yields N rows, one per camera). */
16405
- deviceId: number(),
16406
- /** The linked sensor device whose state changed. */
16407
- sourceDeviceId: number(),
16408
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16409
- kind: string(),
16410
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16411
- value: record(string(), unknown()).nullable(),
16412
- timestamp: number()
16459
+ name: string(),
16460
+ createdAt: string(),
16461
+ updatedAt: string(),
16462
+ engine: PipelineEngineChoiceSchema,
16463
+ steps: array(PipelineTemplateStepSchema).readonly()
16413
16464
  });
16414
- var TrackPositionSchema = object({
16415
- x: number(),
16416
- y: number(),
16417
- timestamp: number(),
16418
- bbox: BoundingBoxSchema
16419
- });
16420
- var TrackSnapshotSchema = object({
16421
- timestamp: number(),
16422
- position: TrackPositionSchema,
16423
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16424
- mediaKey: string()
16465
+ var PipelineModelOptionSchema = object({
16466
+ id: string(),
16467
+ name: string(),
16468
+ formats: record(string(), object({
16469
+ downloaded: boolean(),
16470
+ sizeMB: number()
16471
+ })),
16472
+ group: ModelVariantGroupSchema.optional(),
16473
+ legacy: boolean().optional(),
16474
+ provider: ModelProviderIdSchema.optional()
16425
16475
  });
16426
- /**
16427
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16428
- * divided by the track's detection-frame dims), computed at persist time.
16429
- * Absent when the frame dims were unknown when the track was persisted
16430
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16431
- */
16432
- var TrackEnvelopeSchema = object({
16433
- minX: number(),
16434
- minY: number(),
16435
- maxX: number(),
16436
- maxY: number()
16476
+ var ConfigFieldBridge = custom();
16477
+ var PipelineAddonSchemaSchema = object({
16478
+ id: string(),
16479
+ name: string(),
16480
+ slot: PipelineSlotSchema,
16481
+ inputClasses: array(string()).readonly(),
16482
+ outputClasses: array(string()).readonly(),
16483
+ childSlots: array(PipelineSlotSchema).readonly(),
16484
+ models: array(PipelineModelOptionSchema).readonly(),
16485
+ defaultModelId: string(),
16486
+ defaultModelIdByFormat: record(string(), string()).optional(),
16487
+ enabledByDefault: boolean().optional(),
16488
+ backfillIntoExistingOverrides: boolean().optional(),
16489
+ defaultConfidence: number(),
16490
+ group: string().optional(),
16491
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16437
16492
  });
16438
- /**
16439
- * Row projection for track list queries. `full` (default) returns the
16440
- * complete Track including the frame-rate `positions[]` history and the
16441
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16442
- * keeps every scalar the list surfaces actually render (ids, class(es),
16443
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16444
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16445
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16446
- * `getTrack`. Mirrors the event-store `projection` convention
16447
- * (`getObjectEvents` et al.).
16448
- */
16449
- var TrackProjectionSchema = _enum(["full", "slim"]);
16450
- /**
16451
- * One audio-classification label heard on the track's camera while the
16452
- * track was alive, aggregated per label. An "episode" is one persisted
16453
- * audio event (the confident-classification path: score ≥ the device's
16454
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16455
- * one 32 ms inference chunk, so counts stay human-scaled.
16456
- */
16457
- var TrackAudioLabelSchema = object({
16493
+ var PipelineSlotSchemaSchema = object({
16494
+ id: PipelineSlotSchema,
16458
16495
  label: string(),
16459
- /** Highest classification score observed across the label's episodes. */
16460
- peakScore: number(),
16461
- /** Number of coalesced audio-event episodes carrying this label. */
16462
- count: number(),
16463
- firstAt: number(),
16464
- lastAt: number()
16496
+ priority: number(),
16497
+ parentSlot: PipelineSlotSchema.nullable(),
16498
+ addons: array(PipelineAddonSchemaSchema).readonly()
16465
16499
  });
16466
- /**
16467
- * How a track was produced. `pipeline` (default / absent) = the spatial
16468
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16469
- * no positions, a single snapshot, and no bbox trajectory at all:
16470
- *
16471
- * - `sensor` — a linked sensor/control device state change.
16472
- * - `audio` — an audio event on the camera itself that was anomalous for
16473
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16474
- *
16475
- * The spatial subsystems (tracker association, occupancy count, re-id /
16476
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16477
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16478
- * check silently readmits every source added after it was written.
16479
- */
16480
- var TrackSourceSchema = _enum([
16481
- "pipeline",
16482
- "sensor",
16483
- "audio"
16484
- ]);
16485
- /**
16486
- * Where a track sits in the RETRAIN lifecycle (D81).
16487
- *
16488
- * - `none` — never marked, or un-marked. Evictable.
16489
- * - `staging` — the operator wants this track as training material and has not
16490
- * finished with it. **This is the only state retention holds**: the track and
16491
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16492
- * the device's age window.
16493
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16494
- * were COPIED into the retrain dataset at selection time, so the dataset no
16495
- * longer depends on the track's media and the track becomes EVICTABLE again.
16496
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16497
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16498
- *
16499
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16500
- * the store's filter language has only positive equality and `whereIn` — no
16501
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16502
- * would make the entire pre-column history immortal in one deploy.
16503
- */
16504
- var RetrainStatusSchema = _enum([
16505
- "none",
16506
- "staging",
16507
- "trained"
16508
- ]);
16509
- /**
16510
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16511
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16512
- * so the two surfaces cannot drift.
16513
- *
16514
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16515
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16516
- * columns existed read as absent, and a consumer that needs a boolean should say
16517
- * `flag === true`, not `flag !== false`.
16518
- *
16519
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16520
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16521
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16522
- * `trained` track reports `false` while refusing both writes. The boolean is
16523
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16524
- * "never marked" from "already trained" must read `retrainStatus`.
16525
- *
16526
- * `debug` does NOT pin; it is attention, not durability.
16527
- *
16528
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16529
- * A favourited track is skipped by retention the same way `staging` is, but
16530
- * it does not enter `none|staging|trained` and has no staging budget.
16531
- */
16532
- var TrackFlagFields = {
16533
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16534
- * `'staging'`. */
16535
- markForTrain: boolean().optional(),
16536
- /** Operator marked this track for diagnostic attention. */
16537
- debug: boolean().optional(),
16538
- /** Operator favourited this track. Pins it against pruning. */
16539
- favourited: boolean().optional()
16540
- };
16541
- /**
16542
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16543
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16544
- * write patch, and the status is not something the toggle sets — it is what the
16545
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16546
- * always present on a persisted row (the column default materialises `'none'`).
16547
- */
16548
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16549
- /**
16550
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16551
- * one flag can never clear the other — the toggles are independent and are
16552
- * driven from three surfaces that do not know about each other.
16553
- */
16554
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16555
- /**
16556
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16557
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16558
- * mutation result without a re-fetch.
16559
- */
16560
- var TrackFlagsSchema = object({
16561
- trackId: string(),
16562
- markForTrain: boolean(),
16563
- debug: boolean(),
16564
- favourited: boolean(),
16565
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16566
- * a track row) because this shape is only ever produced by the write body,
16567
- * which always knows it — and a surface that has just written needs to render
16568
- * `trained` without a re-fetch. */
16569
- retrainStatus: RetrainStatusSchema
16500
+ var PipelineSchemaSchema = object({
16501
+ availableEngines: array(AvailableEngineSchema).readonly(),
16502
+ selectedEngine: PipelineEngineChoiceSchema,
16503
+ slots: array(PipelineSlotSchemaSchema).readonly()
16570
16504
  });
16571
- union([literal(1), literal(2)]);
16572
- /**
16573
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16574
- * the step and model that produced it — which is what makes the write rule
16575
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16576
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16577
- *
16578
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16579
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16580
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16581
- * that value has no provenance, and the write rule lets ANY properly-attributed
16582
- * write of the same tier replace it regardless of score.
16583
- */
16584
- var LabelAttributionSchema = object({
16585
- stepId: string(),
16586
- modelId: string().optional(),
16587
- decidedAt: number(),
16505
+ var EngineProvisioningSchema = object({
16506
+ runtimeId: _enum([
16507
+ "onnx",
16508
+ "openvino",
16509
+ "coreml",
16510
+ "edgetpu"
16511
+ ]).nullable(),
16512
+ device: string().nullable(),
16513
+ state: _enum([
16514
+ "idle",
16515
+ "installing",
16516
+ "verifying",
16517
+ "ready",
16518
+ "failed"
16519
+ ]),
16520
+ progress: number().optional(),
16521
+ error: string().optional(),
16522
+ nextRetryAt: number().optional(),
16588
16523
  /**
16589
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16590
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16591
- *
16592
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16593
- * notification rule authored on "Gianluca" stopped matching the moment the
16594
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16595
- * the thing that does not move, so it is what a rule matches on
16596
- * (`NcConditions.identities`) and the text is what a human is shown.
16597
- *
16598
- * Absent when the label names no gallery row — a plate the OCR read but no
16599
- * vehicle claims, a sub-class, a species, any tier-1 value.
16524
+ * Gate A (config-correctness gate at engine change): human-readable
16525
+ * config issues surfaced EAGERLY when the node's engine changes — model
16526
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16527
+ * has a <format> build"). Additive/optional: informational only, never
16528
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
16529
+ * Absent/empty when the node-default tree resolves cleanly.
16600
16530
  */
16601
- identityId: string().optional()
16531
+ configIssues: array(string()).optional()
16602
16532
  });
16603
- /**
16604
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16605
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16606
- * track and its events always answer the same question the same way.
16607
- *
16608
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16609
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16610
- * is tier 2, and each carries its own score + attribution.
16611
- *
16612
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16613
- * finest thing known. Before 4g the single `label` column held the finest
16614
- * value, so a consumer that has not been updated reads the tier-1 slot and
16615
- * shows nothing on a species-only row; that is why the migration puts every
16616
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16617
- * and why the read surfaces were changed in the same train.
16618
- *
16619
- * **Writing it.** The slots are independent, which is the whole point: a
16620
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16621
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16622
- * higher score wins. One rule, one implementation — see
16623
- * `pipeline/label-tier.ts` in addon-post-analysis.
16624
- */
16625
- var TieredLabelFields = {
16626
- /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
16627
- label: string().optional(),
16628
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16629
- labelScore: number().optional(),
16630
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16631
- labelMeta: LabelAttributionSchema.optional(),
16632
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16633
- subLabel: string().optional(),
16634
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16635
- subLabelScore: number().optional(),
16636
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16637
- subLabelMeta: LabelAttributionSchema.optional()
16638
- };
16639
- /** Per-camera slice of a training-export estimate. */
16640
- var TrainingExportDeviceTotalsSchema = object({
16641
- deviceId: number(),
16642
- tracks: number().int(),
16643
- files: number().int(),
16644
- bytes: number().int()
16533
+ var PipelineStepInputSchema = lazy(() => object({
16534
+ addonId: string(),
16535
+ modelId: string().optional(),
16536
+ enabled: boolean().default(true),
16537
+ children: array(PipelineStepInputSchema).optional(),
16538
+ settings: record(string(), unknown()).optional(),
16539
+ jumpDeviceKey: string().optional()
16540
+ }));
16541
+ var ModelSubstitutionSchema = object({
16542
+ addonId: string(),
16543
+ chosen: string(),
16544
+ running: string(),
16545
+ format: string()
16546
+ });
16547
+ var PipelineValidationIssueSchema = object({
16548
+ addonId: string(),
16549
+ kind: _enum(["unknown-addon", "no-format-build"]),
16550
+ detail: string()
16551
+ });
16552
+ var PipelineValidationResultSchema = object({
16553
+ ok: boolean(),
16554
+ issues: array(PipelineValidationIssueSchema).readonly(),
16555
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16556
+ /** The node's `currentEngine.format` this validation ran against. */
16557
+ format: string()
16558
+ });
16559
+ var ReferenceImageEntrySchema = object({
16560
+ filename: string(),
16561
+ stepIds: array(string()).readonly().optional()
16562
+ });
16563
+ var ReferenceImageBodySchema = object({
16564
+ base64: string(),
16565
+ filename: string()
16566
+ });
16567
+ var ReferenceAudioEntrySchema = object({
16568
+ filename: string(),
16569
+ sizeKb: number()
16570
+ });
16571
+ var ReferenceAudioBodySchema = object({ base64: string() });
16572
+ var AudioBackendSchema = object({
16573
+ id: string(),
16574
+ name: string(),
16575
+ description: string(),
16576
+ available: boolean(),
16577
+ /**
16578
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16579
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16580
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16581
+ * specific to the selected backend without a separate fetch.
16582
+ */
16583
+ rawLabels: array(string()).readonly().optional()
16584
+ });
16585
+ var AudioCapabilitiesSchema = object({
16586
+ activeBackend: string(),
16587
+ availableBackends: array(AudioBackendSchema).readonly(),
16588
+ sampleRate: number(),
16589
+ chunkDurationMs: number()
16590
+ });
16591
+ var DownloadModelResultSchema = object({
16592
+ filePath: string(),
16593
+ sizeMB: number(),
16594
+ durationMs: number()
16645
16595
  });
16646
16596
  /**
16647
- * What a training export WOULD contain. Computed from media index rows only —
16648
- * no blob is read to produce this.
16597
+ * Wrapper carrying a single test run's result. Replaces the legacy
16598
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16599
+ * canonical `AudioResult` from the Phase 6 output rework: one
16600
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16601
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16602
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16603
+ * benchmark UI can still report a clean failure when the classifier
16604
+ * cap isn't available.
16649
16605
  */
16650
- var TrainingExportSummarySchema = object({
16651
- generatedAt: number(),
16652
- trackCount: number().int(),
16653
- fileCount: number().int(),
16654
- byteCount: number().int(),
16655
- /** More marked tracks exist than a single pass carries. */
16656
- truncated: boolean(),
16657
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16606
+ var AudioTestResultSchema = object({
16607
+ success: boolean(),
16608
+ error: string().optional(),
16609
+ frame: custom().optional()
16658
16610
  });
16659
- var TrackSchema = object({
16660
- trackId: string(),
16661
- deviceId: number(),
16662
- className: string(),
16663
- ...TieredLabelFields,
16664
- producingDeviceName: string().optional(),
16665
- /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16666
- source: TrackSourceSchema.optional(),
16667
- firstSeen: number(),
16668
- lastSeen: number(),
16669
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16670
- positions: array(TrackPositionSchema).readonly(),
16671
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16672
- * saveThumbnails policy). */
16673
- snapshots: array(TrackSnapshotSchema).readonly(),
16674
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16675
- zonesVisited: array(string()).readonly(),
16611
+ var PipelineConfigBridge = custom();
16612
+ var ConfigUISchemaBridge = custom();
16613
+ var ConfigUISchemaNullableBridge = custom();
16614
+ var InferenceCapabilitiesBridge = custom();
16615
+ var ModelAvailabilityListBridge = custom();
16616
+ var PipelineRunResultBridge = custom();
16617
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16618
+ modelId: string(),
16619
+ settings: record(string(), unknown()).readonly()
16620
+ }))), method(object({ steps: record(string(), object({
16621
+ modelId: string(),
16622
+ settings: record(string(), unknown()).readonly()
16623
+ })) }), object({ success: literal(true) }), {
16624
+ kind: "mutation",
16625
+ auth: "admin"
16626
+ }), method(object({ nodeId: string() }), object({
16627
+ success: literal(true),
16628
+ clearedDevices: number()
16629
+ }), {
16630
+ kind: "mutation",
16631
+ auth: "admin"
16632
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16633
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16634
+ deviceKey: string(),
16676
16635
  /**
16677
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16678
- * `zones` capability.
16679
- *
16680
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16681
- * and no card can render — so every free-text search surface was structurally
16682
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16683
- * just returned nothing. Resolving here rather than in each client keeps ONE
16684
- * derivation and costs the clients no extra call (the `zones` cap is
16685
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16686
- * surface built to avoid exactly that).
16687
- *
16688
- * Resolved, never invented: a zone deleted since the track was written has no
16689
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16690
- * two are not positionally aligned. Absent when the track visited no zone, or
16691
- * when the zone catalogue could not be read.
16636
+ * `failed` — the per-device restart budget is exhausted; no pool
16637
+ * will be spawned until an operator re-arms it or the runner
16638
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16639
+ * a cached pool observed dead and not yet condemned).
16692
16640
  */
16693
- zoneNames: array(string()).readonly().optional(),
16694
- /** Deduplicated set of detector classes observed for this track over its
16695
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16696
- * legacy rows written before class accumulation shipped. */
16697
- classes: array(string()).readonly().optional(),
16698
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16699
- totalDistance: number(),
16700
- state: TrackStateSchema,
16701
- active: boolean(),
16702
- /** Deterministic key-event importance score in [0,1] (server-computed at
16703
- * track expiry, recomputed on late label). Absent on legacy rows written
16704
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16705
- importance: number().optional(),
16706
- /** Id of the track's highest-confidence ObjectEvent (its representative
16707
- * "best" frame). Absent when the track produced no object events. */
16708
- bestEventId: string().optional(),
16709
- /** Tag of the importance sub-signal that dominated the score
16710
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16711
- importanceReason: string().optional(),
16712
- /** Audio-classification labels heard on the camera during the track's
16713
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16714
- * Absent on legacy rows / tracks with no confident audio. */
16715
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16716
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16717
- * Populated from the persisted envelope columns on historical reads;
16718
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16719
- envelope: TrackEnvelopeSchema.optional(),
16641
+ state: _enum(["failed", "backoff"]),
16642
+ /** Epoch ms of the death that produced this state. */
16643
+ since: number(),
16644
+ /** Pool deaths inside the current window. */
16645
+ deaths: number(),
16646
+ /** The last death's message. */
16647
+ lastError: string()
16648
+ })).readonly() })), method(object({
16649
+ nodeId: string(),
16650
+ deviceKey: string()
16651
+ }), object({ rearmed: boolean() }), {
16652
+ kind: "mutation",
16653
+ auth: "admin"
16654
+ }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({ steps: array(PipelineStepInputSchema) }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
16655
+ name: string(),
16656
+ steps: array(PipelineTemplateStepSchema).readonly(),
16657
+ engine: PipelineEngineChoiceSchema
16658
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16659
+ id: string(),
16660
+ name: string().optional(),
16661
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16662
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16663
+ addonId: string(),
16664
+ modelId: string(),
16665
+ format: ModelFormatSchema$1
16666
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16667
+ addonId: string(),
16668
+ modelId: string(),
16669
+ format: ModelFormatSchema$1
16670
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16671
+ engine: PipelineEngineChoiceSchema.optional(),
16672
+ steps: array(PipelineStepInputSchema).min(1),
16673
+ frame: FrameInputSchema.optional(),
16720
16674
  /**
16721
- * A face DETECTOR found a face on this track — nothing more. It says the
16722
- * detail plane produced a `face` detail; it does NOT say the face was
16723
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16724
- * enabled. Set once and never cleared.
16725
- *
16726
- * **This exists so "face present but not recognised" is expressible.** A
16727
- * recognised identity lands in `subLabel` (attributed to the face chain via
16728
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16729
- * and a track with no face at all were byte-identical on the wire and no
16730
- * surface could tell them apart. The read is `hasFace === true && subLabel
16731
- * === undefined`.
16732
- *
16733
- * **Absent ≠ false.** Every row written before the column existed omits it,
16734
- * and so does every server that predates the field — a consumer must test
16735
- * `=== true` and render nothing otherwise, never infer "no face".
16675
+ * Process-local lazy frame. Valid only when caller and provider resolve
16676
+ * in the same execution-group process; split/cross-node callers use
16677
+ * `frame`/`image` inline compatibility instead.
16736
16678
  */
16737
- hasFace: boolean().optional(),
16679
+ frameRef: FrameRefSchema.optional(),
16738
16680
  /**
16739
- * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
16740
- * face an operator could ASSIGN to an identity.
16741
- *
16742
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16743
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16744
- * branch, before every gate, and means no more than "a face detector produced
16745
- * a face detail". This one is stamped at the single moment the gallery row
16746
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16747
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16748
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16749
- * the crop-store drop. Everything between the detector and that insert can
16750
- * legitimately refuse the face, so a flag written any earlier promises the
16751
- * operator something to assign and delivers nothing.
16752
- *
16753
- * **Independent of recognition.** A face collected but never auto-matched is
16754
- * still assignable — it is in fact the face an operator most wants to reach —
16755
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16756
- * `subLabel`; this says only that the raw material exists.
16757
- *
16758
- * **Set once, never cleared.** A track that produced a gallery row produced
16759
- * one; deleting the row later is the gallery's business, not this flag's.
16760
- *
16761
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16762
- * before the column omits it, and so does every server that predates the
16763
- * field. A consumer must test `=== true` and render nothing otherwise —
16764
- * never infer "no assignable face".
16681
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
16682
+ * the decoded pixels live in. One more member of the one-of
16683
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16765
16684
  */
16766
- hasEmbeddedFace: boolean().optional(),
16685
+ frameHandle: FrameHandleSchema.optional(),
16686
+ imageBase64: string().optional(),
16767
16687
  /**
16768
- * This subject CONTAINS a folded rider — a person the rider-pairing step
16769
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16770
- * so the passage is tracked once and as a VEHICLE.
16771
- *
16772
- * It exists because the fold's record was dishonest. D34 and the code both
16773
- * said "the person is not lost — it is reported so both entities stay on the
16774
- * record"; in fact the pair went into a per-processor RAM field behind an
16775
- * accessor nobody called, and every durable surface said `vehicle`, full
16776
- * stop. This is the composition note that makes the row true.
16777
- *
16778
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16779
- * person" is not an answer to "what is this" — both label tiers would refuse
16780
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16781
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16782
- * and a `person` rule still does not fire for someone cycling past.
16783
- *
16784
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16785
- * the column, and every hub that predates the field, omits it. Test
16786
- * `=== true` and render nothing otherwise — never infer "no rider".
16688
+ * Binary JPEG bytes — preferred over `imageBase64` on internal
16689
+ * hops (hub → forked worker via Moleculer MsgPack) because it
16690
+ * skips the 33% base64 overhead + the per-call base64 decode on
16691
+ * the detection-pipeline worker. Callers can pass either; exactly
16692
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16787
16693
  */
16788
- hasRider: boolean().optional(),
16789
- ...TrackFlagFields,
16790
- ...TrackRetrainFields
16791
- });
16792
- var BaseEventFields = {
16793
- id: string(),
16794
- deviceId: number(),
16795
- timestamp: number()
16796
- };
16797
- var MotionEventSchema = object({
16798
- ...BaseEventFields,
16799
- kind: literal("motion"),
16800
- regionCount: number(),
16801
- /** Heavy JSON array — omitted in slim projection. */
16802
- regions: array(object({
16803
- bbox: BoundingBoxSchema,
16804
- pixelCount: number(),
16805
- intensity: number()
16806
- })).readonly().optional(),
16807
- /** Omitted in slim projection. */
16808
- frameWidth: number().optional(),
16809
- /** Omitted in slim projection. */
16810
- frameHeight: number().optional(),
16811
- /** Populated by B5 (recording playback URL for this event). */
16812
- mediaUrl: string().optional()
16813
- });
16694
+ image: _instanceof(Uint8Array).optional(),
16695
+ referenceImage: string().optional(),
16696
+ deviceId: number().optional(),
16697
+ sessionId: string().optional(),
16698
+ /**
16699
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16700
+ * reference-image, and detail-subtree calls. 'frame' is the live
16701
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16702
+ * (inputClasses ≠ null) are skipped and served per-track via
16703
+ * pipelineRunner.runDetailSubtree (two-plane design).
16704
+ */
16705
+ plane: _enum(["full", "frame"]).optional(),
16706
+ /**
16707
+ * Inference-device selector (Phase 2 multi-device). Format
16708
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16709
+ * Omitted ⇒ the runner's default device (current single-engine
16710
+ * behaviour). Selects WHICH device pool of the node runs the call.
16711
+ */
16712
+ deviceKey: string().optional(),
16713
+ /**
16714
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16715
+ * when the parent crop was resolved from the frame's retained NATIVE
16716
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16717
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16718
+ * resolution from that surface — the SAME quality path faces already
16719
+ * had — instead of the downscaled parent tile. `handle` keys the native
16720
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16721
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16722
+ * the executor's crop-normalized child ROI back into frame-normalized
16723
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16724
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16725
+ * (today's behaviour on the fallback path).
16726
+ */
16727
+ nativeCropRef: NativeCropRefSchema.optional()
16728
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16729
+ engine: PipelineEngineChoiceSchema.optional(),
16730
+ steps: array(PipelineStepInputSchema).min(1),
16731
+ frames: array(FrameInputSchema).min(1).max(255),
16732
+ deviceId: number().optional(),
16733
+ sessionId: string().optional(),
16734
+ /**
16735
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16736
+ * the batch to the Python pool's bench preprocess cache
16737
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16738
+ * preprocessed ONCE and every later inference is a pure-inference cache
16739
+ * hit — the sustained-throughput run measures inference, not
16740
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16741
+ * full preprocess every call, correct). Fresh per sustained run;
16742
+ * released via `uncacheFrame`.
16743
+ */
16744
+ frameId: number().int().nonnegative().optional(),
16745
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16746
+ deviceKey: string().optional()
16747
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16748
+ data: _instanceof(Uint8Array),
16749
+ width: number().int().positive(),
16750
+ height: number().int().positive(),
16751
+ format: _enum([
16752
+ "rgb",
16753
+ "bgr",
16754
+ "gray"
16755
+ ])
16756
+ }), object({
16757
+ frameId: number(),
16758
+ width: number(),
16759
+ height: number()
16760
+ }), { kind: "mutation" }), method(object({
16761
+ stepId: string(),
16762
+ frameId: number().int()
16763
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16764
+ batchMode: string(),
16765
+ windowMs: number(),
16766
+ maxBatchSize: number(),
16767
+ concurrency: number()
16768
+ })), method(_void(), array(object({
16769
+ engineKey: string(),
16770
+ engine: PipelineEngineChoiceSchema,
16771
+ modelsLoaded: array(string()).readonly(),
16772
+ inUseByCameras: array(number()).readonly(),
16773
+ /**
16774
+ * Origin of this resident factory.
16775
+ * - `runtime` — main camera-serving engine (no idle TTL).
16776
+ * - `warm-override` — benchmark/test override held in the warm
16777
+ * cache; auto-disposed after the idle TTL.
16778
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16779
+ * multi-device, keyed by `deviceKey`) resolved
16780
+ * via `resolveDeviceFactory`. Runs alongside the
16781
+ * `runtime` engine on a DIFFERENT accelerator
16782
+ * (NPU / iGPU / Coral) — this is how the
16783
+ * Engines tab shows all pools running at once.
16784
+ */
16785
+ kind: _enum([
16786
+ "runtime",
16787
+ "warm-override",
16788
+ "device-pool"
16789
+ ]),
16790
+ /** Native pid of the underlying Python pool (null when no pool). */
16791
+ poolPid: number().nullable(),
16792
+ /** ms since this factory was last used (null when not warm-tracked). */
16793
+ idleMs: number().nullable(),
16794
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16795
+ idleTtlMs: number().nullable()
16796
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16797
+ kind: "mutation",
16798
+ auth: "admin"
16799
+ }), method(object({
16800
+ engine: PipelineEngineChoiceSchema,
16801
+ force: boolean().optional()
16802
+ }), object({
16803
+ success: boolean(),
16804
+ reason: string().optional()
16805
+ }), {
16806
+ kind: "mutation",
16807
+ auth: "admin"
16808
+ }), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
16809
+ addonId: string(),
16810
+ modelId: string(),
16811
+ filename: string().optional(),
16812
+ settings: record(string(), unknown()).optional()
16813
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16814
16814
  /**
16815
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16816
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16817
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16818
- * tracking, per-kind persistence) but stay distinguishable so consumers
16819
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16820
- * Absent on legacy rows ⇒ treat as `pipeline`.
16815
+ * Per-stage gating mode applied to the zones a rule references.
16816
+ *
16817
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16818
+ * When at least one `include` rule fires for a stage, only entities
16819
+ * inside one of those zones pass that stage.
16820
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16821
+ * Entities inside one of those zones are dropped at that stage.
16822
+ *
16823
+ * `monitor`-style observation (count without filtering) is not a rule
16824
+ * mode — zones without any matching rule are observed naturally by
16825
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16826
+ * count, not filter" use case needs no rule at all.
16821
16827
  */
16822
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16828
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16823
16829
  /**
16824
- * The confirmed zone crossing that produced an object event. Present ONLY on
16825
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16826
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16827
- * appearance event carry none, so a rule asking for a direction fails closed
16828
- * on them.
16830
+ * Per-consumer rule that references existing zones (geometry) and
16831
+ * defines how a specific pipeline stage should treat them. Each
16832
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16833
+ * settings:
16829
16834
  *
16830
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16831
- * into its own event, so a frame in which a track enters A while leaving B
16832
- * produces two events with two directions — never one ambiguous row.
16835
+ * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
16836
+ * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
16837
+ * - future: notification rules, audio gating, etc.
16833
16838
  *
16834
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16835
- * membership the box has NOW, and by definition it no longer contains the zone
16836
- * that was just left. Without the id here, a zone-scoped rule could never match
16837
- * the exit it asked for.
16839
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16840
+ * express "ignore motion in ALL of {garden, street}" with a single
16841
+ * rule. `classFilter` narrows the rule to specific object classes —
16842
+ * "drop person detections in the street, but keep cars" is one
16843
+ * `exclude` rule with `classFilter: ['person']`.
16844
+ *
16845
+ * `enabled` is a soft toggle — the operator can keep the rule
16846
+ * configured but inert without deleting it.
16838
16847
  */
16839
- var ZoneCrossingSchema = object({
16840
- direction: _enum(["enter", "exit"]),
16841
- /** Admin zone id crossed. */
16842
- zoneId: string(),
16843
- /** Zone display name at crossing time (falls back to the id). */
16844
- zoneName: string().optional()
16845
- });
16846
- var ObjectEventSchema = object({
16847
- ...BaseEventFields,
16848
- kind: literal("object"),
16849
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16850
- source: DetectionSourceSchema.optional(),
16848
+ var ZoneRuleSchema = object({
16849
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16850
+ id: string(),
16851
+ /** Optional human-readable label rendered in the rule editor. */
16852
+ name: string().optional(),
16853
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16854
+ * listed zones (OR-set: a detection in any one of them counts).
16855
+ * At least one zone id required — a rule with no targets is a
16856
+ * configuration mistake and the form validator rejects it. */
16857
+ zoneIds: array(string()).min(1).readonly(),
16858
+ mode: ZoneRuleModeEnum,
16851
16859
  /**
16852
- * Inference-frame id shared by every object event emitted from the SAME frame
16853
- * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16854
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16855
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16856
- * Optional for backward-compat with pre-existing rows / the slim projection
16857
- * includes it (it is light). Absent on rows written before this field.
16860
+ * Class names this rule applies to. Empty / undefined ⇒ rule
16861
+ * applies to every class. Class strings match the `macroClass`
16862
+ * field on detections (e.g. `person`, `car`, `dog`).
16858
16863
  */
16859
- frameId: string().optional(),
16860
- /** Omitted in slim projection. */
16861
- trackId: string().optional(),
16862
- className: string(),
16863
- ...TieredLabelFields,
16864
- /** Omitted in slim projection. */
16865
- confidence: number().optional(),
16866
- /** Heavy JSON — omitted in slim projection. */
16867
- bbox: BoundingBoxSchema.optional(),
16868
- /** Heavy JSON — omitted in slim projection. */
16869
- zones: array(string()).readonly().optional(),
16870
- /** Omitted in slim projection. */
16871
- state: TrackStateSchema.optional(),
16864
+ classFilter: array(string()).readonly().optional(),
16872
16865
  /**
16873
- * The zone crossing this event IS, when it is one. Absent on every other
16874
- * event kind (movement state, appearance, package) — see
16875
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16866
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16867
+ * required to consider an entity "in the zone". Defaults to the
16868
+ * consumer's stage default when omitted. Kept for back-compat with
16869
+ * existing per-rule overrides; new operators pick the value via
16870
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16871
+ * set, the lower-level engine reads it as a 0–1 fraction.
16876
16872
  */
16877
- zoneCrossing: ZoneCrossingSchema.optional(),
16878
- /** Detection-frame dimensions in pixels — let consumers normalize the
16879
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
16880
- frameWidth: number().optional(),
16881
- frameHeight: number().optional(),
16882
- /** MediaStore key for the crop attached to this event (if any). */
16883
- mediaKey: string().optional(),
16884
- /** Design B: MediaStore key of the track's native-resolution key frame (the
16885
- * best-detection full frame). Resolve via the event-media data-plane
16886
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
16887
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
16888
- * sources — consumers fall back to `mediaKey` (the tight crop). */
16889
- keyFrameMediaKey: string().optional(),
16890
- /** Populated by B5 (recording playback URL for this event). */
16891
- mediaUrl: string().optional(),
16892
- /** The parent track's key-event importance [0,1], propagated to every object
16893
- * event of the track (so an event row can be sorted by importance without a
16894
- * track join). Absent on legacy rows / before the track was scored. */
16895
- importance: number().optional()
16896
- });
16897
- var AudioEventSchema = object({
16898
- ...BaseEventFields,
16899
- kind: literal("audio"),
16900
- rms: number(),
16901
- dbfs: number(),
16902
- classification: object({
16903
- className: string(),
16904
- originalClass: string().optional(),
16905
- score: number()
16906
- }).optional(),
16907
- /** Populated by B5 (recording playback URL for this event). */
16908
- mediaUrl: string().optional()
16909
- });
16910
- var MediaFileKindEnum = _enum([
16911
- "crop",
16912
- "thumbnail",
16913
- "snapshot",
16914
- "firstFrame",
16915
- "lastFrame",
16916
- "fullFrame",
16917
- "fullFrameBoxed",
16918
- "faceCrop",
16919
- "plateCrop",
16920
- "keyFrame",
16921
- "keyFrameSmall",
16922
- "thumbnailSmall"
16923
- ]);
16924
- var MediaFileSchema = object({
16925
- key: string(),
16926
- kind: MediaFileKindEnum,
16927
- base64: string(),
16928
- sizeBytes: number(),
16929
- timestamp: number()
16873
+ overlapThreshold: number().min(0).max(1).optional(),
16874
+ /**
16875
+ * Operator-friendly version of `overlapThreshold` — the percentage
16876
+ * of the detection's bbox that must lie inside the zone for the
16877
+ * rule to match. Documented default is 85%; the engine substitutes
16878
+ * that when the field is omitted (kept optional so existing rules
16879
+ * stored without it stay valid).
16880
+ *
16881
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16882
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16883
+ * field exposed in the UI. Internally both feed the same gate.
16884
+ */
16885
+ bboxInclusionPct: number().min(0).max(100).optional(),
16886
+ /**
16887
+ * When `true` and a detection has a segmentation mask, use the
16888
+ * mask for overlap instead of the bbox. Detection-stage only;
16889
+ * motion rules ignore this field.
16890
+ */
16891
+ preferMask: boolean().optional(),
16892
+ /**
16893
+ * Soft-toggle: `false` disables the rule without deleting it.
16894
+ * Defaults to `true` so operators creating a rule via the UI
16895
+ * see it active immediately.
16896
+ */
16897
+ enabled: boolean().default(true)
16930
16898
  });
16899
+ array(ZoneRuleSchema).readonly();
16931
16900
  /**
16932
- * One media row WITHOUT its bytes.
16901
+ * Zone — pure geometry + identity. NO filtering behaviour.
16933
16902
  *
16934
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
16935
- * 140 s track), and a client that renders tiles from the media data plane needs
16936
- * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
16937
- * with an immutable cache, instead of all at once inside a tRPC response that
16938
- * blocks the whole view.
16903
+ * Zones describe **where** in the frame the operator wants to flag
16904
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16905
+ * each pipeline stage uses them. Splitting the two means a single
16906
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16907
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16908
+ * — without three duplicated polygons.
16939
16909
  *
16940
- * `sizeBytes` is carried because it is what lets a client decide between the
16941
- * stored blob and a `?variant=thumb` rendering without fetching either.
16910
+ * Owned by the orchestrator addon (provider) and mirrored into the
16911
+ * `zones` device-state slice on every mutation. Consumers
16912
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16913
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16914
+ * mirror with `onChanged`).
16915
+ *
16916
+ * Coordinates are normalised fractions of the frame (0–1) so zones
16917
+ * survive resolution changes and stream profile switches.
16918
+ *
16919
+ * `kind` discriminates between full polygons (closed regions used
16920
+ * for intrusion / occupancy filters) and tripwires (open 2-point
16921
+ * line segments used for cross events). Onboard / firmware-reported
16922
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
16923
+ * task list.
16942
16924
  */
16943
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
16925
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
16926
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
16927
+ var PolygonPointSchema = object({
16928
+ x: number(),
16929
+ y: number()
16930
+ });
16931
+ /** A camera detection zone — pure geometry/identity. */
16932
+ var ZoneSchema = object({
16933
+ id: string(),
16934
+ name: string(),
16935
+ kind: ZoneKindEnum.default("polygon"),
16936
+ /** Polygon vertices, fraction of frame (0–1). */
16937
+ polygon: array(PolygonPointSchema).readonly(),
16938
+ /** Visual color for UI rendering. */
16939
+ color: string().default("#3b82f6")
16940
+ });
16941
+ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
16942
+ deviceId: number(),
16943
+ zone: ZoneSchema
16944
+ }), _void(), {
16945
+ kind: "mutation",
16946
+ auth: "admin"
16947
+ }), method(object({
16948
+ deviceId: number(),
16949
+ zoneId: string()
16950
+ }), _void(), {
16951
+ kind: "mutation",
16952
+ auth: "admin"
16953
+ }), method(object({
16954
+ deviceId: number(),
16955
+ zone: ZoneSchema
16956
+ }), _void(), {
16957
+ kind: "mutation",
16958
+ auth: "admin"
16959
+ }), object({ zones: array(ZoneSchema).readonly() });
16944
16960
  /**
16945
- * The MACRO tier of an annotation — a CLOSED set.
16961
+ * pipeline-analytics — device-scoped wrapper cap. Refines raw
16962
+ * per-frame detections emitted by the pipeline runner into tracked
16963
+ * objects, per-kind event collections (motion / object / audio), and
16964
+ * persisted media. Owns the post-detection domain end-to-end:
16946
16965
  *
16947
- * This is what the exported detector predicts, so a typo here is a new class
16948
- * with one example in it. `label` and `subLabel` are open strings by contrast:
16949
- * the whole point of the page is teaching the model things it does not know
16950
- * yet, and constraining that vocabulary would make it useless.
16966
+ * runner emits PipelineInferenceResult
16967
+ * ↓ (event bus)
16968
+ * pipeline-analytics subscriber
16969
+ * ↓ SORT tracker + zone engine + state analyzer + event emitter
16970
+ * → three DB collections (one per kind), one FS media tree, one
16971
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
16972
+ * DetectionEvent on bus)
16951
16973
  *
16952
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
16953
- * `subLabel` is one of these values, in any casing, because once `person`
16954
- * exists in both tiers "every person box" stops being answerable without
16955
- * knowing every string anyone ever typed — and the damage is retroactive.
16974
+ * Pure subscriber model. No `processFrame` cap method — the runner
16975
+ * already publishes the raw frame on the bus. The cap surface is
16976
+ * only QUERIES + per-device settings, bound on/off via
16977
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
16978
+ * every camera with a detection pipeline wants its raw detections
16979
+ * refined; operators opt out per-device via BindingsTab when needed.
16980
+ *
16981
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16982
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
16956
16983
  */
16957
- var RetrainMacroClassSchema = _enum([
16984
+ var TrackStateSchema = _enum([
16985
+ "new",
16986
+ "entered",
16987
+ "left",
16988
+ "moving",
16989
+ "idle"
16990
+ ]);
16991
+ var EventKindSchema = _enum([
16992
+ "motion",
16993
+ "object",
16994
+ "audio"
16995
+ ]);
16996
+ /**
16997
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16998
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16999
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
17000
+ */
17001
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
17002
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
17003
+ var EventKindIconSchema = _enum([
17004
+ "motion",
17005
+ "audio",
16958
17006
  "person",
16959
17007
  "vehicle",
16960
17008
  "animal",
17009
+ "door",
17010
+ "pir",
17011
+ "smoke",
17012
+ "water",
17013
+ "button",
16961
17014
  "package",
16962
- "face",
16963
- "plate"
17015
+ "generic"
16964
17016
  ]);
16965
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
16966
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
16967
- /** Did a human draw this box, or did the assist propose it? */
16968
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
16969
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
16970
- var RetrainBboxSchema = object({
16971
- x: number(),
16972
- y: number(),
16973
- w: number(),
16974
- h: number()
16975
- });
16976
- /**
16977
- * One annotated subject.
16978
- *
16979
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
16980
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
16981
- * derived from it at export and never stored — storing them is how one feature
16982
- * space ends up holding two crops of the same subject (D52).
16983
- */
16984
- var RetrainAnnotationSchema = object({
16985
- id: string(),
16986
- trackId: string(),
16987
- deviceId: number(),
16988
- /** The COPY in retrain storage — never the source track's media key. */
16989
- mediaKey: string(),
16990
- bbox: RetrainBboxSchema,
16991
- macroClass: RetrainMacroClassSchema,
16992
- label: string().optional(),
16993
- subLabel: string().optional(),
16994
- kind: RetrainAnnotationKindSchema,
16995
- source: RetrainAnnotationSourceSchema,
16996
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
16997
- assistModelId: string().optional(),
16998
- assistScore: number().optional(),
16999
- exportedInBatch: string().optional(),
17000
- createdAt: number()
17001
- });
17002
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17003
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17004
- id: true,
17005
- trackId: true,
17006
- deviceId: true,
17007
- mediaKey: true,
17008
- createdAt: true,
17009
- exportedInBatch: true
17017
+ var EventKindCategorySchema = _enum([
17018
+ "motion",
17019
+ "audio",
17020
+ "detection",
17021
+ "sensor",
17022
+ "control",
17023
+ "custom",
17024
+ "package"
17025
+ ]);
17026
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
17027
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
17028
+ var EventKindDescriptorSchema = object({
17029
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
17030
+ kind: string(),
17031
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
17032
+ labelKey: string(),
17033
+ /** English fallback label (kept for clients that don't translate). */
17034
+ label: string(),
17035
+ /** Hex color for timeline/legend rendering. */
17036
+ color: string(),
17037
+ /** Dictionary id → lucide component on the UI side. */
17038
+ iconId: string(),
17039
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
17040
+ icon: EventKindIconSchema,
17041
+ category: EventKindCategorySchema,
17042
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
17043
+ parentKind: string().nullable(),
17044
+ /** Derived from `parentKind`, explicit for the client tree. */
17045
+ level: EventKindLevelSchema,
17046
+ /** Which cap + device contributes this kind. For built-ins the camera
17047
+ * itself; for sensor kinds the LINKED source device. */
17048
+ source: object({
17049
+ capName: string(),
17050
+ deviceId: number()
17051
+ })
17010
17052
  });
17011
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17012
- var RetrainTrackSchema = object({
17013
- trackId: string(),
17053
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
17054
+ var EventKindsForDeviceSchema = object({
17014
17055
  deviceId: number(),
17015
- className: string(),
17016
- label: string().optional(),
17017
- firstSeen: number(),
17018
- lastSeen: number(),
17019
- /** How many frames the dataset already holds from this track. */
17020
- frameCount: number().int(),
17021
- /** How many subjects have been annotated on those frames. `0` with
17022
- * `frameCount: 0` is exactly "staging, still to work". */
17023
- annotationCount: number().int()
17024
- });
17025
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
17026
- var RetrainFrameCandidateSchema = object({
17027
- mediaKey: string(),
17028
- kind: MediaFileKindEnum,
17029
- timestamp: number(),
17030
- sizeBytes: number().int(),
17031
- /** A copy of this original already exists — selecting it is free and cannot
17032
- * fail, whatever became of the original. */
17033
- copied: boolean()
17056
+ kinds: array(EventKindDescriptorSchema).readonly()
17034
17057
  });
17035
- /** A frame the dataset OWNS: bytes copied at selection time. */
17036
- var RetrainFrameSchema = object({
17037
- frameId: string(),
17058
+ var SensorEventSchema = object({
17059
+ id: string(),
17060
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
17061
+ * yields N rows, one per camera). */
17038
17062
  deviceId: number(),
17039
- trackId: string(),
17040
- /** Provenance only. It may already point at nothing — that is expected. */
17041
- sourceMediaKey: string(),
17042
- sourceKind: MediaFileKindEnum,
17043
- sizeBytes: number().int(),
17044
- width: number().int(),
17045
- height: number().int(),
17046
- copiedAt: number()
17063
+ /** The linked sensor device whose state changed. */
17064
+ sourceDeviceId: number(),
17065
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
17066
+ kind: string(),
17067
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
17068
+ value: record(string(), unknown()).nullable(),
17069
+ timestamp: number()
17047
17070
  });
17048
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17049
- var RetrainCopyRefusalSchema = _enum([
17050
- "source-missing",
17051
- "unreadable-image",
17052
- "write-failed"
17053
- ]);
17054
- var RetrainFrameSelectionSchema = object({
17055
- copied: array(RetrainFrameSchema).readonly(),
17056
- refused: array(object({
17057
- sourceMediaKey: string(),
17058
- reason: RetrainCopyRefusalSchema
17059
- })).readonly()
17071
+ var TrackPositionSchema = object({
17072
+ x: number(),
17073
+ y: number(),
17074
+ timestamp: number(),
17075
+ bbox: BoundingBoxSchema
17060
17076
  });
17061
- var RetrainFrameListSchema = object({
17062
- candidates: array(RetrainFrameCandidateSchema).readonly(),
17063
- copies: array(RetrainFrameSchema).readonly(),
17064
- /** What the page pre-selects — the native key frame when one survives. */
17065
- autoPickMediaKey: string().optional()
17077
+ var TrackSnapshotSchema = object({
17078
+ timestamp: number(),
17079
+ position: TrackPositionSchema,
17080
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
17081
+ mediaKey: string()
17066
17082
  });
17067
- /** What the operator asked the assist to look for. */
17068
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17069
- kind: literal("package"),
17070
- zone: RetrainBboxSchema.optional()
17071
- }), object({
17072
- kind: literal("objects"),
17073
- modelId: string(),
17074
- minScore: number().optional()
17075
- })]);
17076
17083
  /**
17077
- * The assist's answer — a discriminated union, because "the model saw nothing"
17078
- * and "this node cannot run that model" lead to different next moves and a
17079
- * nullable result cannot tell them apart.
17084
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
17085
+ * divided by the track's detection-frame dims), computed at persist time.
17086
+ * Absent when the frame dims were unknown when the track was persisted
17087
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
17080
17088
  */
17081
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17082
- kind: literal("proposed"),
17083
- modelId: string(),
17084
- stepId: string(),
17085
- minScore: number(),
17086
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17087
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
17088
- /** Returned by the runner but removed by the threshold. */
17089
- belowThreshold: number().int()
17090
- }), object({
17091
- kind: literal("refused"),
17092
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17093
- reason: string(),
17094
- detail: string().optional()
17095
- })]);
17096
- /** The outcome of a lifecycle move owned by the retrain page. */
17097
- var RetrainTransitionResultSchema = object({
17098
- trackId: string(),
17099
- /** Where the track ended up, whatever happened. */
17100
- retrainStatus: RetrainStatusSchema,
17101
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17102
- changed: boolean(),
17103
- reason: _enum([
17104
- "unknown-track",
17105
- "no-frames-copied",
17106
- "not-staging",
17107
- "not-trained",
17108
- "unchanged"
17109
- ]).optional()
17110
- });
17111
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17112
- var MAX_EVENT_QUERY_LIMIT = 5e3;
17113
- var DeviceEventQueryInput = object({
17114
- deviceId: number(),
17115
- since: number().optional(),
17116
- until: number().optional(),
17117
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17118
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17119
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17120
- * exact behaviour. Callers may omit this field — the store defaults to
17121
- * `full` when not provided. */
17122
- projection: _enum(["full", "slim"]).optional()
17123
- });
17124
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17125
- var RecentTracksQueryInput = object({
17126
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17127
- deviceIds: array(number()),
17128
- /** Window lower bound on `lastSeen` (inclusive). */
17129
- since: number().optional(),
17130
- /** Window upper bound on `lastSeen` (inclusive). */
17131
- until: number().optional(),
17132
- /** Page size. Default 200, max 1000. */
17133
- limit: number().int().min(1).max(1e3).default(200),
17134
- /** Opaque continuation cursor from a previous page's `nextCursor`.
17135
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17136
- cursor: string().optional(),
17137
- /** See {@link TrackProjectionSchema}. Default `full`. */
17138
- projection: TrackProjectionSchema.optional(),
17139
- /** Include stationary-promoted rows (parked objects). Default false: the
17140
- * feed lists passages; parking records live on the stationary registry. */
17141
- includeStationary: boolean().optional()
17089
+ var TrackEnvelopeSchema = object({
17090
+ minX: number(),
17091
+ minY: number(),
17092
+ maxX: number(),
17093
+ maxY: number()
17142
17094
  });
17143
- var RecentTracksPageSchema = object({
17144
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17145
- tracks: array(TrackSchema).readonly(),
17146
- /** Cursor for the next page, or null when this page is the last. */
17147
- nextCursor: string().nullable()
17148
- });
17149
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
17150
- var LIST_GROUPS_MAX_LIMIT = 100;
17151
- var AnalyticsGroupRecordSchema = object({
17152
- id: string(),
17153
- deviceId: number().int(),
17154
- openedAt: number().int(),
17155
- closedAt: number().int(),
17156
- timestamp: number().int(),
17157
- memberCount: number().int(),
17158
- memberTrackIds: array(string()).readonly(),
17159
- className: string(),
17160
- classes: array(string()).readonly(),
17161
- /** Relative event-media path, or null when the group has no picture yet. */
17162
- mediaUrl: string().nullable(),
17163
- singleton: boolean()
17164
- });
17165
- var AnalyticsGroupMemberSchema = object({
17166
- trackId: string(),
17167
- deviceId: number().int(),
17168
- className: string(),
17169
- firstSeen: number().int(),
17170
- lastSeen: number().int(),
17171
- mediaUrl: string().nullable()
17172
- });
17173
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17174
- var ListGroupsQueryInput = object({
17175
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17176
- deviceIds: array(number()),
17177
- /** Window lower bound on `closedAt` (inclusive). */
17178
- since: number().optional(),
17179
- /** Window upper bound on `openedAt` (inclusive). */
17180
- until: number().optional(),
17181
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17182
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
17183
- cursor: string().optional()
17184
- });
17185
- var ListGroupsPageSchema = object({
17186
- groups: array(AnalyticsGroupRecordSchema).readonly(),
17187
- nextCursor: string().nullable()
17188
- });
17189
- var KeyEventQueryInput = object({
17190
- deviceId: number(),
17191
- /** Window lower bound (track firstSeen ≥ since). */
17192
- since: number(),
17193
- /** Window upper bound (track firstSeen ≤ until). */
17194
- until: number(),
17195
- limit: number().int().min(1).max(200).default(50),
17196
- /** Drop tracks scoring below this importance. */
17197
- minImportance: number().min(0).max(1).optional(),
17198
- /** Restrict to a single class (e.g. 'person'). */
17199
- classFilter: string().optional()
17200
- });
17201
- var KeyEventSchema = object({
17202
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
17203
- id: string(),
17204
- trackId: string(),
17205
- /** Track start time (firstSeen). */
17206
- timestamp: number(),
17207
- className: string(),
17208
- ...TieredLabelFields,
17209
- importance: number(),
17210
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
17211
- bestEventId: string(),
17212
- /** Track lifetime in ms (lastSeen - firstSeen). */
17213
- windowMs: number().optional(),
17214
- ...TrackFlagFields,
17215
- ...TrackRetrainFields
17216
- });
17217
- object({
17218
- trackId: string(),
17219
- className: string(),
17220
- confidence: number(),
17221
- bbox: BoundingBoxSchema,
17222
- zones: array(string()).readonly(),
17223
- state: TrackStateSchema
17224
- });
17225
- var OverlayDetectionSchema = looseObject({
17226
- id: string(),
17227
- kind: _enum(["first-level", "detail"]),
17228
- macroClass: string(),
17229
- score: number(),
17230
- bbox: object({
17231
- x: number(),
17232
- y: number(),
17233
- width: number(),
17234
- height: number()
17235
- }),
17236
- labels: array(looseObject({
17237
- label: string(),
17238
- score: number()
17239
- })).readonly(),
17240
- parentId: string().optional()
17241
- });
17242
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17243
- var SearchObjectEventsInput = object({
17244
- text: string(),
17245
- deviceId: number().optional(),
17246
- since: number().optional(),
17247
- until: number().optional(),
17248
- classFilter: string().optional(),
17249
- limit: number().default(50),
17250
- minScore: number().min(0).max(1).default(.2)
17251
- });
17252
- var TrackCascadeCountsSchema = object({
17253
- /** Persisted track roots deleted (authoritative). */
17254
- tracks: number().int(),
17255
- /** Object events removed with their tracks (best-effort; see note above). */
17256
- events: number().int(),
17257
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17258
- media: number().int(),
17259
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17260
- faces: number().int(),
17261
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17262
- plates: number().int(),
17263
- /** Per-track CLIP search vectors removed (best-effort). */
17264
- embeddings: number().int(),
17265
- /** Group membership + group rows removed with their last member (best-effort). */
17266
- groups: number().int()
17267
- });
17268
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17269
- var DiskReconcileCountsSchema = object({
17270
- mediaDropped: number().int(),
17271
- tracks: number().int(),
17272
- events: number().int()
17273
- });
17274
- /** Event-store footprint for one camera. */
17275
- var EventStoreDeviceFootprintSchema = object({
17276
- deviceId: number(),
17277
- /** Persisted event rows (motion + object + audio) for the camera. */
17278
- rows: number().int(),
17279
- /** Event-owned media bytes on disk for the camera. */
17280
- bytes: number().int()
17281
- });
17282
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17283
- var EventStoreFootprintSchema = object({
17284
- totalRows: number().int(),
17285
- totalBytes: number().int(),
17286
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17287
- });
17288
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17289
- var EventPruneCountsSchema = object({
17290
- motion: number().int(),
17291
- object: number().int(),
17292
- audio: number().int()
17095
+ /**
17096
+ * Row projection for track list queries. `full` (default) returns the
17097
+ * complete Track including the frame-rate `positions[]` history and the
17098
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
17099
+ * keeps every scalar the list surfaces actually render (ids, class(es),
17100
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
17101
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
17102
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
17103
+ * `getTrack`. Mirrors the event-store `projection` convention
17104
+ * (`getObjectEvents` et al.).
17105
+ */
17106
+ var TrackProjectionSchema = _enum(["full", "slim"]);
17107
+ /**
17108
+ * One audio-classification label heard on the track's camera while the
17109
+ * track was alive, aggregated per label. An "episode" is one persisted
17110
+ * audio event (the confident-classification path: score ≥ the device's
17111
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
17112
+ * one 32 ms inference chunk, so counts stay human-scaled.
17113
+ */
17114
+ var TrackAudioLabelSchema = object({
17115
+ label: string(),
17116
+ /** Highest classification score observed across the label's episodes. */
17117
+ peakScore: number(),
17118
+ /** Number of coalesced audio-event episodes carrying this label. */
17119
+ count: number(),
17120
+ firstAt: number(),
17121
+ lastAt: number()
17293
17122
  });
17294
17123
  /**
17295
- * Re-embed stored tracks from their key frames.
17124
+ * How a track was produced. `pipeline` (default / absent) = the spatial
17125
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
17126
+ * no positions, a single snapshot, and no bbox trajectory at all:
17296
17127
  *
17297
- * The reason this is an operator-callable method and not a migration script:
17298
- * every knob that decides what a vector MEANS — encoder model, crop margin,
17299
- * squaring — is only changeable if the existing vectors can be regenerated.
17300
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17301
- * symptom is a quality regression with no visible cause.
17128
+ * - `sensor` — a linked sensor/control device state change.
17129
+ * - `audio` — an audio event on the camera itself that was anomalous for
17130
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
17131
+ *
17132
+ * The spatial subsystems (tracker association, occupancy count, re-id /
17133
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
17134
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
17135
+ * check silently readmits every source added after it was written.
17302
17136
  */
17303
- var RebuildObjectEmbeddingsInput = object({
17304
- /** Restrict to one camera. Omit for the whole fleet. */
17305
- deviceId: number().optional(),
17306
- since: number().optional(),
17307
- until: number().optional(),
17308
- /** Stop after this many tracks; the result reports whether more remain. */
17309
- maxTracks: number().int().positive().optional(),
17310
- /**
17311
- * Run every embedding on THIS node instead of round-robining the fleet.
17312
- *
17313
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17314
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17315
- * calling it that would pin the rebuild REQUEST itself to that node — the
17316
- * rebuild orchestration lives on the hub, and only the per-track step runs
17317
- * remotely. This field is data; the per-track pin is applied inside.
17318
- *
17319
- * Absent ⇒ round-robin over every online node whose runner can serve the
17320
- * pinned model.
17321
- */
17322
- executeOnNodeId: string().optional(),
17323
- /**
17324
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17325
- * run flat out.
17326
- *
17327
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17328
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17329
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17330
- * force is logged at start and finish so a deliberately slow pass reads
17331
- * differently from a stalled one.
17332
- */
17333
- pacingMs: number().int().nonnegative().optional()
17334
- });
17137
+ var TrackSourceSchema = _enum([
17138
+ "pipeline",
17139
+ "sensor",
17140
+ "audio"
17141
+ ]);
17335
17142
  /**
17336
- * Result of emptying the CLIP index.
17143
+ * Where a track sits in the RETRAIN lifecycle (D81).
17337
17144
  *
17338
- * The clean slate before a policy change: a new crop margin or encoder model
17339
- * leaves two feature spaces in one index whose cosine scores are not
17340
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17341
- * means the same thing.
17145
+ * - `none` — never marked, or un-marked. Evictable.
17146
+ * - `staging` — the operator wants this track as training material and has not
17147
+ * finished with it. **This is the only state retention holds**: the track and
17148
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
17149
+ * the device's age window.
17150
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
17151
+ * were COPIED into the retrain dataset at selection time, so the dataset no
17152
+ * longer depends on the track's media and the track becomes EVICTABLE again.
17153
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
17154
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
17155
+ *
17156
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
17157
+ * the store's filter language has only positive equality and `whereIn` — no
17158
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
17159
+ * would make the entire pre-column history immortal in one deploy.
17342
17160
  */
17343
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17161
+ var RetrainStatusSchema = _enum([
17162
+ "none",
17163
+ "staging",
17164
+ "trained"
17165
+ ]);
17344
17166
  /**
17345
- * Acknowledgement that a rebuild STARTED.
17167
+ * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
17168
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
17169
+ * so the two surfaces cannot drift.
17346
17170
  *
17347
- * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17348
- * runs detached and this returns immediately. Waiting for it made the client
17349
- * time out while the work carried on server-side, which is the worst of both:
17350
- * no result and no way to know it was still going. Poll
17351
- * `getObjectEmbeddingRebuildStatus` for progress.
17171
+ * **Absent ≠ false.** A track that has never been touched omits the field; an
17172
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
17173
+ * columns existed read as absent, and a consumer that needs a boolean should say
17174
+ * `flag === true`, not `flag !== false`.
17175
+ *
17176
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
17177
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
17178
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
17179
+ * `trained` track reports `false` while refusing both writes. The boolean is
17180
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
17181
+ * "never marked" from "already trained" must read `retrainStatus`.
17182
+ *
17183
+ * `debug` does NOT pin; it is attention, not durability.
17184
+ *
17185
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17186
+ * A favourited track is skipped by retention the same way `staging` is, but
17187
+ * it does not enter `none|staging|trained` and has no staging budget.
17352
17188
  */
17353
- var RebuildObjectEmbeddingsResultSchema = object({
17354
- started: boolean(),
17355
- /** True when a pass was already running; the new request is ignored. */
17356
- alreadyRunning: boolean()
17357
- });
17358
- var RebuildStatusSchema = object({
17359
- running: boolean(),
17360
- scanned: number(),
17361
- rebuilt: number(),
17362
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17363
- missingKeyFrame: number(),
17364
- /** Tracks with no usable detection box. */
17365
- missingBbox: number(),
17366
- /**
17367
- * Tracks an executing node REFUSED rather than broke on — an unreadable key
17368
- * frame, a step that threw. Separate from `failed` because the remedy is
17369
- * different, and because a whole camera silently contributing zero vectors
17370
- * is the shape of failure a rebuild must never hide.
17371
- */
17372
- notRunnable: number(),
17189
+ var TrackFlagFields = {
17190
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
17191
+ * `'staging'`. */
17192
+ markForTrain: boolean().optional(),
17193
+ /** Operator marked this track for diagnostic attention. */
17194
+ debug: boolean().optional(),
17195
+ /** Operator favourited this track. Pins it against pruning. */
17196
+ favourited: boolean().optional()
17197
+ };
17198
+ /**
17199
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
17200
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
17201
+ * write patch, and the status is not something the toggle sets — it is what the
17202
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
17203
+ * always present on a persisted row (the column default materialises `'none'`).
17204
+ */
17205
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
17206
+ /**
17207
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
17208
+ * one flag can never clear the other — the toggles are independent and are
17209
+ * driven from three surfaces that do not know about each other.
17210
+ */
17211
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
17212
+ /**
17213
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
17214
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
17215
+ * mutation result without a re-fetch.
17216
+ */
17217
+ var TrackFlagsSchema = object({
17218
+ trackId: string(),
17219
+ markForTrain: boolean(),
17220
+ debug: boolean(),
17221
+ favourited: boolean(),
17222
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
17223
+ * a track row) because this shape is only ever produced by the write body,
17224
+ * which always knows it — and a surface that has just written needs to render
17225
+ * `trained` without a re-fetch. */
17226
+ retrainStatus: RetrainStatusSchema
17227
+ });
17228
+ union([literal(1), literal(2)]);
17229
+ /**
17230
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
17231
+ * the step and model that produced it — which is what makes the write rule
17232
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17233
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17234
+ *
17235
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17236
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17237
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
17238
+ * that value has no provenance, and the write rule lets ANY properly-attributed
17239
+ * write of the same tier replace it regardless of score.
17240
+ */
17241
+ var LabelAttributionSchema = object({
17242
+ stepId: string(),
17243
+ modelId: string().optional(),
17244
+ decidedAt: number(),
17373
17245
  /**
17374
- * The pass stopped because NO node could serve the pinned model.
17246
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
17247
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17375
17248
  *
17376
- * Distinct from `notRunnable` on purpose: that one says "this track was
17377
- * refused", this one says "the cluster cannot do this work at all" — every
17378
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17379
- * pinned model for its engine format, or dropped out. The remedy is a model /
17380
- * engine change, not a per-camera one. Non-zero here always comes with
17381
- * `complete: false`.
17249
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
17250
+ * notification rule authored on "Gianluca" stopped matching the moment the
17251
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
17252
+ * the thing that does not move, so it is what a rule matches on
17253
+ * (`NcConditions.identities`) and the text is what a human is shown.
17254
+ *
17255
+ * Absent when the label names no gallery row — a plate the OCR read but no
17256
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17382
17257
  */
17383
- noCapableNode: number(),
17384
- failed: number(),
17385
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17386
- complete: boolean().nullable(),
17387
- startedAtMs: number().nullable(),
17388
- finishedAtMs: number().nullable(),
17389
- /** Present when the pass ended by throwing. */
17390
- error: string().nullable()
17258
+ identityId: string().optional()
17391
17259
  });
17392
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17393
- deviceId: number(),
17394
- trackId: string()
17395
- }), TrackSchema.nullable()), method(object({
17396
- deviceId: number(),
17397
- since: number().optional(),
17398
- until: number().optional(),
17399
- limit: number().optional(),
17400
- /** Spatial filter — only tracks whose trajectory intersects the zone
17401
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17402
- * envelope columns, then precisely tested per position. Tracks with
17403
- * an unknown envelope (no frame dims at persist time) always match. */
17404
- zone: TrackZoneFilterSchema.optional(),
17405
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17406
- * compatible — omitting the field keeps today's exact behaviour). */
17407
- projection: TrackProjectionSchema.optional(),
17408
- /** Include stationary-promoted rows (parked objects handed to the
17409
- * stationary registry). Default false: the timeline lists passages,
17410
- * not parking records (operator decision, 2026-08-15). */
17411
- includeStationary: boolean().optional()
17412
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17413
- deviceId: number(),
17414
- groupId: string().min(1)
17415
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17416
- kind: "mutation",
17417
- auth: "admin"
17418
- }), 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({
17419
- deviceId: number(),
17420
- since: number().optional(),
17421
- until: number().optional(),
17422
- kinds: array(string()).optional(),
17423
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17424
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17425
- deviceId: number(),
17426
- since: number(),
17427
- until: number(),
17428
- bucketMs: number().int().positive()
17429
- }), array(object({
17430
- bucketStart: number(),
17431
- motion: number().int(),
17432
- object: number().int(),
17433
- audio: number().int()
17434
- })).readonly()), method(object({
17435
- deviceId: number(),
17436
- cutoffMs: number()
17437
- }), object({
17438
- motion: number().int(),
17439
- object: number().int(),
17440
- audio: number().int()
17441
- }), {
17442
- kind: "mutation",
17443
- auth: "admin"
17444
- }), method(object({
17445
- deviceId: number(),
17446
- cutoffMs: number()
17447
- }), TrackCascadeCountsSchema, {
17448
- kind: "mutation",
17449
- auth: "admin"
17450
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17451
- kind: "mutation",
17452
- auth: "admin"
17453
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17454
- kind: "mutation",
17455
- auth: "admin"
17456
- }), method(object({
17457
- deviceId: number(),
17458
- trackIds: array(string()).min(1)
17459
- }), object({
17460
- deleted: number().int(),
17461
- failed: array(string()).readonly()
17462
- }), {
17463
- kind: "mutation",
17464
- auth: "admin"
17465
- }), method(object({
17466
- /** Log/audit scope only — the trackId is globally unique on its own. */
17260
+ /**
17261
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17262
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17263
+ * track and its events always answer the same question the same way.
17264
+ *
17265
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17266
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17267
+ * is tier 2, and each carries its own score + attribution.
17268
+ *
17269
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17270
+ * finest thing known. Before 4g the single `label` column held the finest
17271
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17272
+ * shows nothing on a species-only row; that is why the migration puts every
17273
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17274
+ * and why the read surfaces were changed in the same train.
17275
+ *
17276
+ * **Writing it.** The slots are independent, which is the whole point: a
17277
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17278
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17279
+ * higher score wins. One rule, one implementation — see
17280
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17281
+ */
17282
+ var TieredLabelFields = {
17283
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
17284
+ label: string().optional(),
17285
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17286
+ labelScore: number().optional(),
17287
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17288
+ labelMeta: LabelAttributionSchema.optional(),
17289
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
17290
+ subLabel: string().optional(),
17291
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17292
+ subLabelScore: number().optional(),
17293
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17294
+ subLabelMeta: LabelAttributionSchema.optional()
17295
+ };
17296
+ /** Per-camera slice of a training-export estimate. */
17297
+ var TrainingExportDeviceTotalsSchema = object({
17467
17298
  deviceId: number(),
17299
+ tracks: number().int(),
17300
+ files: number().int(),
17301
+ bytes: number().int()
17302
+ });
17303
+ /**
17304
+ * What a training export WOULD contain. Computed from media index rows only —
17305
+ * no blob is read to produce this.
17306
+ */
17307
+ var TrainingExportSummarySchema = object({
17308
+ generatedAt: number(),
17309
+ trackCount: number().int(),
17310
+ fileCount: number().int(),
17311
+ byteCount: number().int(),
17312
+ /** More marked tracks exist than a single pass carries. */
17313
+ truncated: boolean(),
17314
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17315
+ });
17316
+ var TrackSchema = object({
17468
17317
  trackId: string(),
17469
- flags: TrackFlagsPatchSchema
17470
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17471
- kind: "query",
17472
- auth: "admin"
17473
- }), method(object({
17474
- olderThanMs: number(),
17475
- reason: OpsLogReasonSchema.optional()
17476
- }), EventPruneCountsSchema, {
17477
- kind: "mutation",
17478
- auth: "admin"
17479
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17480
- kind: "mutation",
17481
- auth: "admin"
17482
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17483
- kind: "mutation",
17484
- auth: "admin"
17485
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17486
- kind: "mutation",
17487
- auth: "admin"
17488
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17489
- kind: "mutation",
17490
- auth: "admin"
17491
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17492
- kind: "mutation",
17493
- auth: "admin"
17494
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17495
- kind: "mutation",
17496
- auth: "admin"
17497
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17498
- kind: "query",
17499
- auth: "admin"
17500
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17501
- kind: "query",
17502
- auth: "admin"
17503
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17504
- kind: "query",
17505
- auth: "admin"
17506
- }), method(object({
17507
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17508
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17509
- * route it at one camera's owner, and "every camera" would stop being
17510
- * expressible at all. */
17511
- deviceIds: array(number()).optional(),
17512
- limit: number().int().min(1).max(500).optional()
17513
- }), array(RetrainTrackSchema).readonly(), {
17514
- kind: "query",
17515
- auth: "admin"
17516
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17517
- kind: "query",
17518
- auth: "admin"
17519
- }), method(object({
17520
17318
  deviceId: number(),
17521
- trackId: string(),
17522
- mediaKeys: array(string()).min(1)
17523
- }), RetrainFrameSelectionSchema, {
17524
- kind: "mutation",
17525
- auth: "admin"
17526
- }), method(object({
17319
+ className: string(),
17320
+ ...TieredLabelFields,
17321
+ producingDeviceName: string().optional(),
17322
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17323
+ source: TrackSourceSchema.optional(),
17324
+ firstSeen: number(),
17325
+ lastSeen: number(),
17326
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17327
+ positions: array(TrackPositionSchema).readonly(),
17328
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17329
+ * saveThumbnails policy). */
17330
+ snapshots: array(TrackSnapshotSchema).readonly(),
17331
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17332
+ zonesVisited: array(string()).readonly(),
17333
+ /**
17334
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17335
+ * `zones` capability.
17336
+ *
17337
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17338
+ * and no card can render — so every free-text search surface was structurally
17339
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17340
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17341
+ * derivation and costs the clients no extra call (the `zones` cap is
17342
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17343
+ * surface built to avoid exactly that).
17344
+ *
17345
+ * Resolved, never invented: a zone deleted since the track was written has no
17346
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17347
+ * two are not positionally aligned. Absent when the track visited no zone, or
17348
+ * when the zone catalogue could not be read.
17349
+ */
17350
+ zoneNames: array(string()).readonly().optional(),
17351
+ /** Deduplicated set of detector classes observed for this track over its
17352
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17353
+ * legacy rows written before class accumulation shipped. */
17354
+ classes: array(string()).readonly().optional(),
17355
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17356
+ totalDistance: number(),
17357
+ state: TrackStateSchema,
17358
+ active: boolean(),
17359
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17360
+ * track expiry, recomputed on late label). Absent on legacy rows written
17361
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17362
+ importance: number().optional(),
17363
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17364
+ * "best" frame). Absent when the track produced no object events. */
17365
+ bestEventId: string().optional(),
17366
+ /** Tag of the importance sub-signal that dominated the score
17367
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17368
+ importanceReason: string().optional(),
17369
+ /** Audio-classification labels heard on the camera during the track's
17370
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17371
+ * Absent on legacy rows / tracks with no confident audio. */
17372
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17373
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17374
+ * Populated from the persisted envelope columns on historical reads;
17375
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17376
+ envelope: TrackEnvelopeSchema.optional(),
17377
+ /**
17378
+ * A face DETECTOR found a face on this track — nothing more. It says the
17379
+ * detail plane produced a `face` detail; it does NOT say the face was
17380
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17381
+ * enabled. Set once and never cleared.
17382
+ *
17383
+ * **This exists so "face present but not recognised" is expressible.** A
17384
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17385
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17386
+ * and a track with no face at all were byte-identical on the wire and no
17387
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17388
+ * === undefined`.
17389
+ *
17390
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17391
+ * and so does every server that predates the field — a consumer must test
17392
+ * `=== true` and render nothing otherwise, never infer "no face".
17393
+ */
17394
+ hasFace: boolean().optional(),
17395
+ /**
17396
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17397
+ * face an operator could ASSIGN to an identity.
17398
+ *
17399
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17400
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17401
+ * branch, before every gate, and means no more than "a face detector produced
17402
+ * a face detail". This one is stamped at the single moment the gallery row
17403
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17404
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17405
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17406
+ * the crop-store drop. Everything between the detector and that insert can
17407
+ * legitimately refuse the face, so a flag written any earlier promises the
17408
+ * operator something to assign and delivers nothing.
17409
+ *
17410
+ * **Independent of recognition.** A face collected but never auto-matched is
17411
+ * still assignable — it is in fact the face an operator most wants to reach —
17412
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17413
+ * `subLabel`; this says only that the raw material exists.
17414
+ *
17415
+ * **Set once, never cleared.** A track that produced a gallery row produced
17416
+ * one; deleting the row later is the gallery's business, not this flag's.
17417
+ *
17418
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17419
+ * before the column omits it, and so does every server that predates the
17420
+ * field. A consumer must test `=== true` and render nothing otherwise —
17421
+ * never infer "no assignable face".
17422
+ */
17423
+ hasEmbeddedFace: boolean().optional(),
17424
+ /**
17425
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17426
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17427
+ * so the passage is tracked once and as a VEHICLE.
17428
+ *
17429
+ * It exists because the fold's record was dishonest. D34 and the code both
17430
+ * said "the person is not lost — it is reported so both entities stay on the
17431
+ * record"; in fact the pair went into a per-processor RAM field behind an
17432
+ * accessor nobody called, and every durable surface said `vehicle`, full
17433
+ * stop. This is the composition note that makes the row true.
17434
+ *
17435
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17436
+ * person" is not an answer to "what is this" — both label tiers would refuse
17437
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17438
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17439
+ * and a `person` rule still does not fire for someone cycling past.
17440
+ *
17441
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17442
+ * the column, and every hub that predates the field, omits it. Test
17443
+ * `=== true` and render nothing otherwise — never infer "no rider".
17444
+ */
17445
+ hasRider: boolean().optional(),
17446
+ ...TrackFlagFields,
17447
+ ...TrackRetrainFields
17448
+ });
17449
+ var BaseEventFields = {
17450
+ id: string(),
17527
17451
  deviceId: number(),
17528
- trackId: string(),
17529
- frameId: string()
17530
- }), object({
17531
- removed: boolean(),
17532
- removedAnnotations: number().int()
17533
- }), {
17534
- kind: "mutation",
17535
- auth: "admin"
17536
- }), method(object({ frameId: string() }), object({
17452
+ timestamp: number()
17453
+ };
17454
+ var MotionEventSchema = object({
17455
+ ...BaseEventFields,
17456
+ kind: literal("motion"),
17457
+ regionCount: number(),
17458
+ /** Heavy JSON array — omitted in slim projection. */
17459
+ regions: array(object({
17460
+ bbox: BoundingBoxSchema,
17461
+ pixelCount: number(),
17462
+ intensity: number()
17463
+ })).readonly().optional(),
17464
+ /** Omitted in slim projection. */
17465
+ frameWidth: number().optional(),
17466
+ /** Omitted in slim projection. */
17467
+ frameHeight: number().optional(),
17468
+ /** Populated by B5 (recording playback URL for this event). */
17469
+ mediaUrl: string().optional()
17470
+ });
17471
+ /**
17472
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17473
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17474
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17475
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17476
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17477
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17478
+ */
17479
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17480
+ /**
17481
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17482
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17483
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17484
+ * appearance event carry none, so a rule asking for a direction fails closed
17485
+ * on them.
17486
+ *
17487
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17488
+ * into its own event, so a frame in which a track enters A while leaving B
17489
+ * produces two events with two directions — never one ambiguous row.
17490
+ *
17491
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17492
+ * membership the box has NOW, and by definition it no longer contains the zone
17493
+ * that was just left. Without the id here, a zone-scoped rule could never match
17494
+ * the exit it asked for.
17495
+ */
17496
+ var ZoneCrossingSchema = object({
17497
+ direction: _enum(["enter", "exit"]),
17498
+ /** Admin zone id crossed. */
17499
+ zoneId: string(),
17500
+ /** Zone display name at crossing time (falls back to the id). */
17501
+ zoneName: string().optional()
17502
+ });
17503
+ var ObjectEventSchema = object({
17504
+ ...BaseEventFields,
17505
+ kind: literal("object"),
17506
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17507
+ source: DetectionSourceSchema.optional(),
17508
+ /**
17509
+ * Inference-frame id shared by every object event emitted from the SAME frame
17510
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17511
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17512
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17513
+ * Optional for backward-compat with pre-existing rows / the slim projection
17514
+ * includes it (it is light). Absent on rows written before this field.
17515
+ */
17516
+ frameId: string().optional(),
17517
+ /** Omitted in slim projection. */
17518
+ trackId: string().optional(),
17519
+ className: string(),
17520
+ ...TieredLabelFields,
17521
+ /** Omitted in slim projection. */
17522
+ confidence: number().optional(),
17523
+ /** Heavy JSON — omitted in slim projection. */
17524
+ bbox: BoundingBoxSchema.optional(),
17525
+ /** Heavy JSON — omitted in slim projection. */
17526
+ zones: array(string()).readonly().optional(),
17527
+ /** Omitted in slim projection. */
17528
+ state: TrackStateSchema.optional(),
17529
+ /**
17530
+ * The zone crossing this event IS, when it is one. Absent on every other
17531
+ * event kind (movement state, appearance, package) — see
17532
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17533
+ */
17534
+ zoneCrossing: ZoneCrossingSchema.optional(),
17535
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17536
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17537
+ frameWidth: number().optional(),
17538
+ frameHeight: number().optional(),
17539
+ /** MediaStore key for the crop attached to this event (if any). */
17540
+ mediaKey: string().optional(),
17541
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17542
+ * best-detection full frame). Resolve via the event-media data-plane
17543
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17544
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17545
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17546
+ keyFrameMediaKey: string().optional(),
17547
+ /** Populated by B5 (recording playback URL for this event). */
17548
+ mediaUrl: string().optional(),
17549
+ /** The parent track's key-event importance [0,1], propagated to every object
17550
+ * event of the track (so an event row can be sorted by importance without a
17551
+ * track join). Absent on legacy rows / before the track was scored. */
17552
+ importance: number().optional()
17553
+ });
17554
+ var AudioEventSchema = object({
17555
+ ...BaseEventFields,
17556
+ kind: literal("audio"),
17557
+ rms: number(),
17558
+ dbfs: number(),
17559
+ classification: object({
17560
+ className: string(),
17561
+ originalClass: string().optional(),
17562
+ score: number()
17563
+ }).optional(),
17564
+ /** Populated by B5 (recording playback URL for this event). */
17565
+ mediaUrl: string().optional()
17566
+ });
17567
+ var MediaFileKindEnum = _enum([
17568
+ "crop",
17569
+ "thumbnail",
17570
+ "snapshot",
17571
+ "firstFrame",
17572
+ "lastFrame",
17573
+ "fullFrame",
17574
+ "fullFrameBoxed",
17575
+ "faceCrop",
17576
+ "plateCrop",
17577
+ "keyFrame",
17578
+ "keyFrameSmall",
17579
+ "thumbnailSmall"
17580
+ ]);
17581
+ var MediaFileSchema = object({
17582
+ key: string(),
17583
+ kind: MediaFileKindEnum,
17537
17584
  base64: string(),
17538
- width: number().int(),
17539
- height: number().int()
17540
- }), {
17541
- kind: "query",
17542
- auth: "admin"
17543
- }), method(object({
17544
- deviceId: number(),
17545
- trackId: string(),
17546
- frameId: string(),
17547
- subject: RetrainAssistSubjectSchema,
17548
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17549
- nodeId: string().optional()
17550
- }), RetrainAssistResultSchema, {
17551
- kind: "mutation",
17552
- auth: "admin"
17553
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17554
- kind: "query",
17555
- auth: "admin"
17556
- }), method(object({
17557
- deviceId: number(),
17558
- trackId: string(),
17559
- frameId: string(),
17560
- annotations: array(RetrainAnnotationDraftSchema)
17561
- }), array(RetrainAnnotationSchema).readonly(), {
17562
- kind: "mutation",
17563
- auth: "admin"
17564
- }), method(object({
17565
- deviceId: number(),
17566
- trackId: string()
17567
- }), RetrainTransitionResultSchema, {
17568
- kind: "mutation",
17569
- auth: "admin"
17570
- }), method(object({
17571
- deviceId: number(),
17572
- trackId: string()
17573
- }), RetrainTransitionResultSchema, {
17574
- kind: "mutation",
17575
- auth: "admin"
17576
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17577
- kind: "query",
17578
- auth: "admin"
17579
- }), method(object({
17580
- eventId: string(),
17581
- kind: MediaFileKindEnum.optional(),
17582
- deviceId: number()
17583
- }), array(MediaFileSchema).readonly()), method(object({
17584
- trackId: string(),
17585
- kinds: array(MediaFileKindEnum).optional(),
17586
- deviceId: number()
17587
- }), array(MediaFileSchema).readonly()), method(object({
17585
+ sizeBytes: number(),
17586
+ timestamp: number()
17587
+ });
17588
+ /**
17589
+ * One media row WITHOUT its bytes.
17590
+ *
17591
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17592
+ * 140 s track), and a client that renders tiles from the media data plane needs
17593
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17594
+ * with an immutable cache, instead of all at once inside a tRPC response that
17595
+ * blocks the whole view.
17596
+ *
17597
+ * `sizeBytes` is carried because it is what lets a client decide between the
17598
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17599
+ */
17600
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17601
+ /**
17602
+ * The MACRO tier of an annotation — a CLOSED set.
17603
+ *
17604
+ * This is what the exported detector predicts, so a typo here is a new class
17605
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17606
+ * the whole point of the page is teaching the model things it does not know
17607
+ * yet, and constraining that vocabulary would make it useless.
17608
+ *
17609
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17610
+ * `subLabel` is one of these values, in any casing, because once `person`
17611
+ * exists in both tiers "every person box" stops being answerable without
17612
+ * knowing every string anyone ever typed — and the damage is retroactive.
17613
+ */
17614
+ var RetrainMacroClassSchema = _enum([
17615
+ "person",
17616
+ "vehicle",
17617
+ "animal",
17618
+ "package",
17619
+ "face",
17620
+ "plate"
17621
+ ]);
17622
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17623
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17624
+ /** Did a human draw this box, or did the assist propose it? */
17625
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17626
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17627
+ var RetrainBboxSchema = object({
17628
+ x: number(),
17629
+ y: number(),
17630
+ w: number(),
17631
+ h: number()
17632
+ });
17633
+ /**
17634
+ * One annotated subject.
17635
+ *
17636
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17637
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17638
+ * derived from it at export and never stored — storing them is how one feature
17639
+ * space ends up holding two crops of the same subject (D52).
17640
+ */
17641
+ var RetrainAnnotationSchema = object({
17642
+ id: string(),
17588
17643
  trackId: string(),
17589
- deviceId: number()
17590
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17591
- kind: "mutation",
17592
- auth: "admin"
17593
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17594
- kind: "mutation",
17595
- auth: "admin"
17596
- }), method(object({}), RebuildStatusSchema), object({
17597
- deviceId: number(),
17598
- timestamp: number(),
17599
- frameWidth: number(),
17600
- frameHeight: number(),
17601
- detections: array(OverlayDetectionSchema).readonly()
17602
- }), object({
17603
17644
  deviceId: number(),
17645
+ /** The COPY in retrain storage — never the source track's media key. */
17646
+ mediaKey: string(),
17647
+ bbox: RetrainBboxSchema,
17648
+ macroClass: RetrainMacroClassSchema,
17649
+ label: string().optional(),
17650
+ subLabel: string().optional(),
17651
+ kind: RetrainAnnotationKindSchema,
17652
+ source: RetrainAnnotationSourceSchema,
17653
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17654
+ assistModelId: string().optional(),
17655
+ assistScore: number().optional(),
17656
+ exportedInBatch: string().optional(),
17657
+ createdAt: number()
17658
+ });
17659
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17660
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17661
+ id: true,
17662
+ trackId: true,
17663
+ deviceId: true,
17664
+ mediaKey: true,
17665
+ createdAt: true,
17666
+ exportedInBatch: true
17667
+ });
17668
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17669
+ var RetrainTrackSchema = object({
17604
17670
  trackId: string(),
17605
- className: string()
17606
- }), object({
17607
17671
  deviceId: number(),
17608
- trackId: string(),
17609
17672
  className: string(),
17610
- durationMs: number()
17611
- }), object({
17673
+ label: string().optional(),
17674
+ firstSeen: number(),
17675
+ lastSeen: number(),
17676
+ /** How many frames the dataset already holds from this track. */
17677
+ frameCount: number().int(),
17678
+ /** How many subjects have been annotated on those frames. `0` with
17679
+ * `frameCount: 0` is exactly "staging, still to work". */
17680
+ annotationCount: number().int()
17681
+ });
17682
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17683
+ var RetrainFrameCandidateSchema = object({
17684
+ mediaKey: string(),
17685
+ kind: MediaFileKindEnum,
17686
+ timestamp: number(),
17687
+ sizeBytes: number().int(),
17688
+ /** A copy of this original already exists — selecting it is free and cannot
17689
+ * fail, whatever became of the original. */
17690
+ copied: boolean()
17691
+ });
17692
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17693
+ var RetrainFrameSchema = object({
17694
+ frameId: string(),
17612
17695
  deviceId: number(),
17613
- kind: EventKindSchema,
17614
- eventId: string(),
17615
- timestamp: number()
17696
+ trackId: string(),
17697
+ /** Provenance only. It may already point at nothing — that is expected. */
17698
+ sourceMediaKey: string(),
17699
+ sourceKind: MediaFileKindEnum,
17700
+ sizeBytes: number().int(),
17701
+ width: number().int(),
17702
+ height: number().int(),
17703
+ copiedAt: number()
17704
+ });
17705
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17706
+ var RetrainCopyRefusalSchema = _enum([
17707
+ "source-missing",
17708
+ "unreadable-image",
17709
+ "write-failed"
17710
+ ]);
17711
+ var RetrainFrameSelectionSchema = object({
17712
+ copied: array(RetrainFrameSchema).readonly(),
17713
+ refused: array(object({
17714
+ sourceMediaKey: string(),
17715
+ reason: RetrainCopyRefusalSchema
17716
+ })).readonly()
17616
17717
  });
17718
+ var RetrainFrameListSchema = object({
17719
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17720
+ copies: array(RetrainFrameSchema).readonly(),
17721
+ /** What the page pre-selects — the native key frame when one survives. */
17722
+ autoPickMediaKey: string().optional()
17723
+ });
17724
+ /** What the operator asked the assist to look for. */
17725
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17726
+ kind: literal("package"),
17727
+ zone: RetrainBboxSchema.optional()
17728
+ }), object({
17729
+ kind: literal("objects"),
17730
+ modelId: string(),
17731
+ minScore: number().optional()
17732
+ })]);
17617
17733
  /**
17618
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17619
- * within the frame, so the executor can re-cut a leaf child ROI at native
17620
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17734
+ * The assist's answer — a discriminated union, because "the model saw nothing"
17735
+ * and "this node cannot run that model" lead to different next moves and a
17736
+ * nullable result cannot tell them apart.
17621
17737
  */
17622
- var NativeCropRefSchema = object({
17623
- /** Handle keying the retained native surface (node-pinned to its owner). */
17624
- handle: FrameHandleSchema,
17625
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17626
- cropFrameSpace: object({
17627
- x: number(),
17628
- y: number(),
17629
- w: number(),
17630
- h: number()
17631
- })
17738
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17739
+ kind: literal("proposed"),
17740
+ modelId: string(),
17741
+ stepId: string(),
17742
+ minScore: number(),
17743
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17744
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17745
+ /** Returned by the runner but removed by the threshold. */
17746
+ belowThreshold: number().int()
17747
+ }), object({
17748
+ kind: literal("refused"),
17749
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17750
+ reason: string(),
17751
+ detail: string().optional()
17752
+ })]);
17753
+ /** The outcome of a lifecycle move owned by the retrain page. */
17754
+ var RetrainTransitionResultSchema = object({
17755
+ trackId: string(),
17756
+ /** Where the track ended up, whatever happened. */
17757
+ retrainStatus: RetrainStatusSchema,
17758
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17759
+ changed: boolean(),
17760
+ reason: _enum([
17761
+ "unknown-track",
17762
+ "no-frames-copied",
17763
+ "not-staging",
17764
+ "not-trained",
17765
+ "unchanged"
17766
+ ]).optional()
17632
17767
  });
17633
- object({
17634
- crop: object({
17635
- left: number(),
17636
- top: number(),
17637
- width: number().positive(),
17638
- height: number().positive()
17639
- }).optional(),
17640
- content: object({
17641
- width: number().int().positive(),
17642
- height: number().int().positive()
17643
- }),
17644
- fit: _enum(["stretch", "contain"]),
17645
- format: _enum([
17646
- "rgb",
17647
- "gray",
17648
- "jpeg"
17649
- ])
17768
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17769
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17770
+ var DeviceEventQueryInput = object({
17771
+ deviceId: number(),
17772
+ since: number().optional(),
17773
+ until: number().optional(),
17774
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17775
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17776
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17777
+ * exact behaviour. Callers may omit this field — the store defaults to
17778
+ * `full` when not provided. */
17779
+ projection: _enum(["full", "slim"]).optional()
17650
17780
  });
17651
- var FrameRefSchema = object({
17652
- registryId: string().min(1),
17653
- id: string().min(1),
17654
- width: number().int().positive(),
17655
- height: number().int().positive(),
17656
- format: _enum(["rgb", "gray"]),
17657
- timestamp: number(),
17658
- capturedAt: number().optional()
17781
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17782
+ var RecentTracksQueryInput = object({
17783
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17784
+ deviceIds: array(number()),
17785
+ /** Window lower bound on `lastSeen` (inclusive). */
17786
+ since: number().optional(),
17787
+ /** Window upper bound on `lastSeen` (inclusive). */
17788
+ until: number().optional(),
17789
+ /** Page size. Default 200, max 1000. */
17790
+ limit: number().int().min(1).max(1e3).default(200),
17791
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17792
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17793
+ cursor: string().optional(),
17794
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17795
+ projection: TrackProjectionSchema.optional(),
17796
+ /** Include stationary-promoted rows (parked objects). Default false: the
17797
+ * feed lists passages; parking records live on the stationary registry. */
17798
+ includeStationary: boolean().optional()
17659
17799
  });
17660
- var ModelFormatSchema$1 = _enum([
17661
- "onnx",
17662
- "coreml",
17663
- "openvino",
17664
- "tflite",
17665
- "pt",
17666
- "gguf"
17667
- ]);
17668
- var PipelineSlotSchema = _enum([
17669
- "detector",
17670
- "cropper",
17671
- "classifier",
17672
- "refiner",
17673
- "audio-classifier"
17674
- ]);
17675
- var PipelineEngineChoiceSchema = object({
17676
- runtime: _enum(["node", "python"]),
17677
- backend: string(),
17678
- format: ModelFormatSchema$1,
17679
- device: string().optional()
17800
+ var RecentTracksPageSchema = object({
17801
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17802
+ tracks: array(TrackSchema).readonly(),
17803
+ /** Cursor for the next page, or null when this page is the last. */
17804
+ nextCursor: string().nullable()
17805
+ });
17806
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17807
+ var LIST_GROUPS_MAX_LIMIT = 100;
17808
+ var AnalyticsGroupRecordSchema = object({
17809
+ id: string(),
17810
+ deviceId: number().int(),
17811
+ openedAt: number().int(),
17812
+ closedAt: number().int(),
17813
+ timestamp: number().int(),
17814
+ memberCount: number().int(),
17815
+ memberTrackIds: array(string()).readonly(),
17816
+ className: string(),
17817
+ classes: array(string()).readonly(),
17818
+ /** Relative event-media path, or null when the group has no picture yet. */
17819
+ mediaUrl: string().nullable(),
17820
+ singleton: boolean()
17680
17821
  });
17681
- var AvailableEngineSchema = object({
17682
- engine: PipelineEngineChoiceSchema,
17683
- devices: array(object({
17684
- id: string(),
17685
- label: string(),
17686
- description: string().optional()
17687
- })).readonly(),
17688
- defaultDevice: string()
17822
+ var AnalyticsGroupMemberSchema = object({
17823
+ trackId: string(),
17824
+ deviceId: number().int(),
17825
+ className: string(),
17826
+ firstSeen: number().int(),
17827
+ lastSeen: number().int(),
17828
+ mediaUrl: string().nullable()
17689
17829
  });
17690
- var PipelineDefaultStepSchema = lazy(() => object({
17691
- addonId: string(),
17692
- addonName: string(),
17693
- slot: PipelineSlotSchema,
17694
- inputClasses: array(string()).readonly(),
17695
- outputClasses: array(string()).readonly(),
17696
- enabled: boolean(),
17697
- modelId: string(),
17698
- children: array(PipelineDefaultStepSchema).readonly(),
17699
- group: string().optional(),
17700
- settings: record(string(), unknown()).optional()
17701
- }));
17702
- var PipelineTemplateStepSchema = lazy(() => object({
17703
- addonId: string(),
17704
- enabled: boolean(),
17705
- modelId: string(),
17706
- children: array(PipelineTemplateStepSchema).readonly(),
17707
- settings: record(string(), unknown()).optional()
17708
- }));
17709
- var PipelineTemplateSchema$1 = object({
17710
- id: string(),
17711
- name: string(),
17712
- createdAt: string(),
17713
- updatedAt: string(),
17714
- engine: PipelineEngineChoiceSchema,
17715
- steps: array(PipelineTemplateStepSchema).readonly()
17830
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17831
+ var ListGroupsQueryInput = object({
17832
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17833
+ deviceIds: array(number()),
17834
+ /** Window lower bound on `closedAt` (inclusive). */
17835
+ since: number().optional(),
17836
+ /** Window upper bound on `openedAt` (inclusive). */
17837
+ until: number().optional(),
17838
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17839
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17840
+ cursor: string().optional()
17716
17841
  });
17717
- var PipelineModelOptionSchema = object({
17718
- id: string(),
17719
- name: string(),
17720
- formats: record(string(), object({
17721
- downloaded: boolean(),
17722
- sizeMB: number()
17723
- })),
17724
- group: ModelVariantGroupSchema.optional(),
17725
- legacy: boolean().optional(),
17726
- provider: ModelProviderIdSchema.optional()
17842
+ var ListGroupsPageSchema = object({
17843
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17844
+ nextCursor: string().nullable()
17727
17845
  });
17728
- var ConfigFieldBridge = custom();
17729
- var PipelineAddonSchemaSchema = object({
17730
- id: string(),
17731
- name: string(),
17732
- slot: PipelineSlotSchema,
17733
- inputClasses: array(string()).readonly(),
17734
- outputClasses: array(string()).readonly(),
17735
- childSlots: array(PipelineSlotSchema).readonly(),
17736
- models: array(PipelineModelOptionSchema).readonly(),
17737
- defaultModelId: string(),
17738
- defaultModelIdByFormat: record(string(), string()).optional(),
17739
- enabledByDefault: boolean().optional(),
17740
- backfillIntoExistingOverrides: boolean().optional(),
17741
- defaultConfidence: number(),
17742
- group: string().optional(),
17743
- configSchema: array(ConfigFieldBridge).readonly().optional()
17846
+ var KeyEventQueryInput = object({
17847
+ deviceId: number(),
17848
+ /** Window lower bound (track firstSeen ≥ since). */
17849
+ since: number(),
17850
+ /** Window upper bound (track firstSeen ≤ until). */
17851
+ until: number(),
17852
+ limit: number().int().min(1).max(200).default(50),
17853
+ /** Drop tracks scoring below this importance. */
17854
+ minImportance: number().min(0).max(1).optional(),
17855
+ /** Restrict to a single class (e.g. 'person'). */
17856
+ classFilter: string().optional()
17744
17857
  });
17745
- var PipelineSlotSchemaSchema = object({
17746
- id: PipelineSlotSchema,
17747
- label: string(),
17748
- priority: number(),
17749
- parentSlot: PipelineSlotSchema.nullable(),
17750
- addons: array(PipelineAddonSchemaSchema).readonly()
17858
+ var KeyEventSchema = object({
17859
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17860
+ id: string(),
17861
+ trackId: string(),
17862
+ /** Track start time (firstSeen). */
17863
+ timestamp: number(),
17864
+ className: string(),
17865
+ ...TieredLabelFields,
17866
+ importance: number(),
17867
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17868
+ bestEventId: string(),
17869
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17870
+ windowMs: number().optional(),
17871
+ ...TrackFlagFields,
17872
+ ...TrackRetrainFields
17751
17873
  });
17752
- var PipelineSchemaSchema = object({
17753
- availableEngines: array(AvailableEngineSchema).readonly(),
17754
- selectedEngine: PipelineEngineChoiceSchema,
17755
- slots: array(PipelineSlotSchemaSchema).readonly()
17874
+ object({
17875
+ trackId: string(),
17876
+ className: string(),
17877
+ confidence: number(),
17878
+ bbox: BoundingBoxSchema,
17879
+ zones: array(string()).readonly(),
17880
+ state: TrackStateSchema
17756
17881
  });
17757
- var EngineProvisioningSchema = object({
17758
- runtimeId: _enum([
17759
- "onnx",
17760
- "openvino",
17761
- "coreml",
17762
- "edgetpu"
17763
- ]).nullable(),
17764
- device: string().nullable(),
17765
- state: _enum([
17766
- "idle",
17767
- "installing",
17768
- "verifying",
17769
- "ready",
17770
- "failed"
17771
- ]),
17772
- progress: number().optional(),
17773
- error: string().optional(),
17774
- nextRetryAt: number().optional(),
17775
- /**
17776
- * Gate A (config-correctness gate at engine change): human-readable
17777
- * config issues surfaced EAGERLY when the node's engine changes — model
17778
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17779
- * has a <format> build"). Additive/optional: informational only, never
17780
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17781
- * Absent/empty when the node-default tree resolves cleanly.
17782
- */
17783
- configIssues: array(string()).optional()
17882
+ var OverlayDetectionSchema = looseObject({
17883
+ id: string(),
17884
+ kind: _enum(["first-level", "detail"]),
17885
+ macroClass: string(),
17886
+ score: number(),
17887
+ bbox: object({
17888
+ x: number(),
17889
+ y: number(),
17890
+ width: number(),
17891
+ height: number()
17892
+ }),
17893
+ labels: array(looseObject({
17894
+ label: string(),
17895
+ score: number()
17896
+ })).readonly(),
17897
+ parentId: string().optional()
17784
17898
  });
17785
- var PipelineStepInputSchema = lazy(() => object({
17786
- addonId: string(),
17787
- modelId: string().optional(),
17788
- enabled: boolean().default(true),
17789
- children: array(PipelineStepInputSchema).optional(),
17790
- settings: record(string(), unknown()).optional(),
17791
- jumpDeviceKey: string().optional()
17792
- }));
17793
- var ModelSubstitutionSchema = object({
17794
- addonId: string(),
17795
- chosen: string(),
17796
- running: string(),
17797
- format: string()
17899
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17900
+ var SearchObjectEventsInput = object({
17901
+ text: string(),
17902
+ deviceId: number().optional(),
17903
+ since: number().optional(),
17904
+ until: number().optional(),
17905
+ classFilter: string().optional(),
17906
+ limit: number().default(50),
17907
+ minScore: number().min(0).max(1).default(.2)
17798
17908
  });
17799
- var PipelineValidationIssueSchema = object({
17800
- addonId: string(),
17801
- kind: _enum(["unknown-addon", "no-format-build"]),
17802
- detail: string()
17909
+ var TrackCascadeCountsSchema = object({
17910
+ /** Persisted track roots deleted (authoritative). */
17911
+ tracks: number().int(),
17912
+ /** Object events removed with their tracks (best-effort; see note above). */
17913
+ events: number().int(),
17914
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17915
+ media: number().int(),
17916
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
17917
+ faces: number().int(),
17918
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17919
+ plates: number().int(),
17920
+ /** Per-track CLIP search vectors removed (best-effort). */
17921
+ embeddings: number().int(),
17922
+ /** Group membership + group rows removed with their last member (best-effort). */
17923
+ groups: number().int()
17803
17924
  });
17804
- var PipelineValidationResultSchema = object({
17805
- ok: boolean(),
17806
- issues: array(PipelineValidationIssueSchema).readonly(),
17807
- substitutions: array(ModelSubstitutionSchema).readonly(),
17808
- /** The node's `currentEngine.format` this validation ran against. */
17809
- format: string()
17925
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17926
+ var DiskReconcileCountsSchema = object({
17927
+ mediaDropped: number().int(),
17928
+ tracks: number().int(),
17929
+ events: number().int()
17810
17930
  });
17811
- var ReferenceImageEntrySchema = object({
17812
- filename: string(),
17813
- stepIds: array(string()).readonly().optional()
17931
+ /** Event-store footprint for one camera. */
17932
+ var EventStoreDeviceFootprintSchema = object({
17933
+ deviceId: number(),
17934
+ /** Persisted event rows (motion + object + audio) for the camera. */
17935
+ rows: number().int(),
17936
+ /** Event-owned media bytes on disk for the camera. */
17937
+ bytes: number().int()
17814
17938
  });
17815
- var ReferenceImageBodySchema = object({
17816
- base64: string(),
17817
- filename: string()
17939
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17940
+ var EventStoreFootprintSchema = object({
17941
+ totalRows: number().int(),
17942
+ totalBytes: number().int(),
17943
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
17818
17944
  });
17819
- var ReferenceAudioEntrySchema = object({
17820
- filename: string(),
17821
- sizeKb: number()
17945
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
17946
+ var EventPruneCountsSchema = object({
17947
+ motion: number().int(),
17948
+ object: number().int(),
17949
+ audio: number().int()
17822
17950
  });
17823
- var ReferenceAudioBodySchema = object({ base64: string() });
17824
- var AudioBackendSchema = object({
17825
- id: string(),
17826
- name: string(),
17827
- description: string(),
17828
- available: boolean(),
17951
+ /**
17952
+ * Re-embed stored tracks from their key frames.
17953
+ *
17954
+ * The reason this is an operator-callable method and not a migration script:
17955
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
17956
+ * squaring — is only changeable if the existing vectors can be regenerated.
17957
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
17958
+ * symptom is a quality regression with no visible cause.
17959
+ */
17960
+ var RebuildObjectEmbeddingsInput = object({
17961
+ /** Restrict to one camera. Omit for the whole fleet. */
17962
+ deviceId: number().optional(),
17963
+ since: number().optional(),
17964
+ until: number().optional(),
17965
+ /** Stop after this many tracks; the result reports whether more remain. */
17966
+ maxTracks: number().int().positive().optional(),
17829
17967
  /**
17830
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17831
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17832
- * the benchmark UI to populate the `enabledMicroClasses` filter
17833
- * specific to the selected backend without a separate fetch.
17968
+ * Run every embedding on THIS node instead of round-robining the fleet.
17969
+ *
17970
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17971
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17972
+ * calling it that would pin the rebuild REQUEST itself to that node — the
17973
+ * rebuild orchestration lives on the hub, and only the per-track step runs
17974
+ * remotely. This field is data; the per-track pin is applied inside.
17975
+ *
17976
+ * Absent ⇒ round-robin over every online node whose runner can serve the
17977
+ * pinned model.
17834
17978
  */
17835
- rawLabels: array(string()).readonly().optional()
17836
- });
17837
- var AudioCapabilitiesSchema = object({
17838
- activeBackend: string(),
17839
- availableBackends: array(AudioBackendSchema).readonly(),
17840
- sampleRate: number(),
17841
- chunkDurationMs: number()
17842
- });
17843
- var DownloadModelResultSchema = object({
17844
- filePath: string(),
17845
- sizeMB: number(),
17846
- durationMs: number()
17979
+ executeOnNodeId: string().optional(),
17980
+ /**
17981
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17982
+ * run flat out.
17983
+ *
17984
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
17985
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17986
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17987
+ * force is logged at start and finish so a deliberately slow pass reads
17988
+ * differently from a stalled one.
17989
+ */
17990
+ pacingMs: number().int().nonnegative().optional()
17847
17991
  });
17848
17992
  /**
17849
- * Wrapper carrying a single test run's result. Replaces the legacy
17850
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17851
- * canonical `AudioResult` from the Phase 6 output rework: one
17852
- * `AudioDetection` per class above `minScore`, top-N candidates in
17853
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17854
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17855
- * benchmark UI can still report a clean failure when the classifier
17856
- * cap isn't available.
17993
+ * Result of emptying the CLIP index.
17994
+ *
17995
+ * The clean slate before a policy change: a new crop margin or encoder model
17996
+ * leaves two feature spaces in one index whose cosine scores are not
17997
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
17998
+ * means the same thing.
17857
17999
  */
17858
- var AudioTestResultSchema = object({
17859
- success: boolean(),
17860
- error: string().optional(),
17861
- frame: custom().optional()
18000
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
18001
+ /**
18002
+ * Acknowledgement that a rebuild STARTED.
18003
+ *
18004
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
18005
+ * runs detached and this returns immediately. Waiting for it made the client
18006
+ * time out while the work carried on server-side, which is the worst of both:
18007
+ * no result and no way to know it was still going. Poll
18008
+ * `getObjectEmbeddingRebuildStatus` for progress.
18009
+ */
18010
+ var RebuildObjectEmbeddingsResultSchema = object({
18011
+ started: boolean(),
18012
+ /** True when a pass was already running; the new request is ignored. */
18013
+ alreadyRunning: boolean()
17862
18014
  });
17863
- var PipelineConfigBridge = custom();
17864
- var ConfigUISchemaBridge = custom();
17865
- var ConfigUISchemaNullableBridge = custom();
17866
- var InferenceCapabilitiesBridge = custom();
17867
- var ModelAvailabilityListBridge = custom();
17868
- var PipelineRunResultBridge = custom();
17869
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17870
- modelId: string(),
17871
- settings: record(string(), unknown()).readonly()
17872
- }))), method(object({ steps: record(string(), object({
17873
- modelId: string(),
17874
- settings: record(string(), unknown()).readonly()
17875
- })) }), object({ success: literal(true) }), {
18015
+ var RebuildStatusSchema = object({
18016
+ running: boolean(),
18017
+ scanned: number(),
18018
+ rebuilt: number(),
18019
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
18020
+ missingKeyFrame: number(),
18021
+ /** Tracks with no usable detection box. */
18022
+ missingBbox: number(),
18023
+ /**
18024
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
18025
+ * frame, a step that threw. Separate from `failed` because the remedy is
18026
+ * different, and because a whole camera silently contributing zero vectors
18027
+ * is the shape of failure a rebuild must never hide.
18028
+ */
18029
+ notRunnable: number(),
18030
+ /**
18031
+ * The pass stopped because NO node could serve the pinned model.
18032
+ *
18033
+ * Distinct from `notRunnable` on purpose: that one says "this track was
18034
+ * refused", this one says "the cluster cannot do this work at all" — every
18035
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
18036
+ * pinned model for its engine format, or dropped out. The remedy is a model /
18037
+ * engine change, not a per-camera one. Non-zero here always comes with
18038
+ * `complete: false`.
18039
+ */
18040
+ noCapableNode: number(),
18041
+ failed: number(),
18042
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
18043
+ complete: boolean().nullable(),
18044
+ startedAtMs: number().nullable(),
18045
+ finishedAtMs: number().nullable(),
18046
+ /** Present when the pass ended by throwing. */
18047
+ error: string().nullable()
18048
+ });
18049
+ var ReplayFrameInputSchema = object({
18050
+ timestamp: number(),
18051
+ frame: PipelineRunResultBridge
18052
+ });
18053
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
18054
+ className: string(),
18055
+ firstSeenMs: number(),
18056
+ lastSeenMs: number(),
18057
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
18058
+ * frame — a representative box for the diff's `(className, window, IoU)`
18059
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
18060
+ * trajectory production's `Track.positions` keeps. */
18061
+ bbox: BoundingBoxSchema,
18062
+ /** How many of the input frames this track matched a real detection on
18063
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
18064
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
18065
+ framesMatched: number().int()
18066
+ })).readonly() });
18067
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
18068
+ deviceId: number(),
18069
+ trackId: string()
18070
+ }), TrackSchema.nullable()), method(object({
18071
+ deviceId: number(),
18072
+ since: number().optional(),
18073
+ until: number().optional(),
18074
+ limit: number().optional(),
18075
+ /** Spatial filter — only tracks whose trajectory intersects the zone
18076
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
18077
+ * envelope columns, then precisely tested per position. Tracks with
18078
+ * an unknown envelope (no frame dims at persist time) always match. */
18079
+ zone: TrackZoneFilterSchema.optional(),
18080
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
18081
+ * compatible — omitting the field keeps today's exact behaviour). */
18082
+ projection: TrackProjectionSchema.optional(),
18083
+ /** Include stationary-promoted rows (parked objects handed to the
18084
+ * stationary registry). Default false: the timeline lists passages,
18085
+ * not parking records (operator decision, 2026-08-15). */
18086
+ includeStationary: boolean().optional()
18087
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
18088
+ deviceId: number(),
18089
+ groupId: string().min(1)
18090
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
18091
+ kind: "mutation",
18092
+ auth: "admin"
18093
+ }), 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({
18094
+ deviceId: number(),
18095
+ since: number().optional(),
18096
+ until: number().optional(),
18097
+ kinds: array(string()).optional(),
18098
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
18099
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18100
+ deviceId: number(),
18101
+ since: number(),
18102
+ until: number(),
18103
+ bucketMs: number().int().positive()
18104
+ }), array(object({
18105
+ bucketStart: number(),
18106
+ motion: number().int(),
18107
+ object: number().int(),
18108
+ audio: number().int()
18109
+ })).readonly()), method(object({
18110
+ deviceId: number(),
18111
+ cutoffMs: number()
18112
+ }), object({
18113
+ motion: number().int(),
18114
+ object: number().int(),
18115
+ audio: number().int()
18116
+ }), {
18117
+ kind: "mutation",
18118
+ auth: "admin"
18119
+ }), method(object({
18120
+ deviceId: number(),
18121
+ cutoffMs: number()
18122
+ }), TrackCascadeCountsSchema, {
18123
+ kind: "mutation",
18124
+ auth: "admin"
18125
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18126
+ kind: "mutation",
18127
+ auth: "admin"
18128
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18129
+ kind: "mutation",
18130
+ auth: "admin"
18131
+ }), method(object({
18132
+ deviceId: number(),
18133
+ trackIds: array(string()).min(1)
18134
+ }), object({
18135
+ deleted: number().int(),
18136
+ failed: array(string()).readonly()
18137
+ }), {
18138
+ kind: "mutation",
18139
+ auth: "admin"
18140
+ }), method(object({
18141
+ /** Log/audit scope only — the trackId is globally unique on its own. */
18142
+ deviceId: number(),
18143
+ trackId: string(),
18144
+ flags: TrackFlagsPatchSchema
18145
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18146
+ kind: "query",
18147
+ auth: "admin"
18148
+ }), method(object({
18149
+ olderThanMs: number(),
18150
+ reason: OpsLogReasonSchema.optional()
18151
+ }), EventPruneCountsSchema, {
18152
+ kind: "mutation",
18153
+ auth: "admin"
18154
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
18155
+ kind: "mutation",
18156
+ auth: "admin"
18157
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18158
+ kind: "mutation",
18159
+ auth: "admin"
18160
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18161
+ kind: "mutation",
18162
+ auth: "admin"
18163
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
18164
+ kind: "mutation",
18165
+ auth: "admin"
18166
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
18167
+ kind: "mutation",
18168
+ auth: "admin"
18169
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18170
+ kind: "mutation",
18171
+ auth: "admin"
18172
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18173
+ kind: "mutation",
18174
+ auth: "admin"
18175
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18176
+ kind: "query",
18177
+ auth: "admin"
18178
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18179
+ kind: "mutation",
18180
+ auth: "admin"
18181
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
18182
+ kind: "query",
18183
+ auth: "admin"
18184
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
18185
+ kind: "query",
18186
+ auth: "admin"
18187
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18188
+ kind: "query",
18189
+ auth: "admin"
18190
+ }), method(object({
18191
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
18192
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
18193
+ * route it at one camera's owner, and "every camera" would stop being
18194
+ * expressible at all. */
18195
+ deviceIds: array(number()).optional(),
18196
+ limit: number().int().min(1).max(500).optional()
18197
+ }), array(RetrainTrackSchema).readonly(), {
18198
+ kind: "query",
18199
+ auth: "admin"
18200
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
18201
+ kind: "query",
18202
+ auth: "admin"
18203
+ }), method(object({
18204
+ deviceId: number(),
18205
+ trackId: string(),
18206
+ mediaKeys: array(string()).min(1)
18207
+ }), RetrainFrameSelectionSchema, {
17876
18208
  kind: "mutation",
17877
18209
  auth: "admin"
17878
- }), method(object({ nodeId: string() }), object({
17879
- success: literal(true),
17880
- clearedDevices: number()
18210
+ }), method(object({
18211
+ deviceId: number(),
18212
+ trackId: string(),
18213
+ frameId: string()
18214
+ }), object({
18215
+ removed: boolean(),
18216
+ removedAnnotations: number().int()
17881
18217
  }), {
17882
18218
  kind: "mutation",
17883
18219
  auth: "admin"
17884
- }), 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({
17885
- name: string(),
17886
- steps: array(PipelineTemplateStepSchema).readonly(),
17887
- engine: PipelineEngineChoiceSchema
17888
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17889
- id: string(),
17890
- name: string().optional(),
17891
- steps: array(PipelineTemplateStepSchema).readonly().optional()
17892
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17893
- addonId: string(),
17894
- modelId: string(),
17895
- format: ModelFormatSchema$1
17896
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17897
- addonId: string(),
17898
- modelId: string(),
17899
- format: ModelFormatSchema$1
17900
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17901
- engine: PipelineEngineChoiceSchema.optional(),
17902
- steps: array(PipelineStepInputSchema).min(1),
17903
- frame: FrameInputSchema.optional(),
17904
- /**
17905
- * Process-local lazy frame. Valid only when caller and provider resolve
17906
- * in the same execution-group process; split/cross-node callers use
17907
- * `frame`/`image` inline compatibility instead.
17908
- */
17909
- frameRef: FrameRefSchema.optional(),
17910
- /**
17911
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
17912
- * the decoded pixels live in. One more member of the one-of
17913
- * frame/frameHandle/image/imageBase64/referenceImage group.
17914
- */
17915
- frameHandle: FrameHandleSchema.optional(),
17916
- imageBase64: string().optional(),
17917
- /**
17918
- * Binary JPEG bytes — preferred over `imageBase64` on internal
17919
- * hops (hub → forked worker via Moleculer MsgPack) because it
17920
- * skips the 33% base64 overhead + the per-call base64 decode on
17921
- * the detection-pipeline worker. Callers can pass either; exactly
17922
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17923
- */
17924
- image: _instanceof(Uint8Array).optional(),
17925
- referenceImage: string().optional(),
17926
- deviceId: number().optional(),
17927
- sessionId: string().optional(),
17928
- /**
17929
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
17930
- * reference-image, and detail-subtree calls. 'frame' is the live
17931
- * per-frame dispatch: ONLY root-plane steps run; crop children
17932
- * (inputClasses ≠ null) are skipped and served per-track via
17933
- * pipelineRunner.runDetailSubtree (two-plane design).
17934
- */
17935
- plane: _enum(["full", "frame"]).optional(),
17936
- /**
17937
- * Inference-device selector (Phase 2 multi-device). Format
17938
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17939
- * Omitted ⇒ the runner's default device (current single-engine
17940
- * behaviour). Selects WHICH device pool of the node runs the call.
17941
- */
17942
- deviceKey: string().optional(),
17943
- /**
17944
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17945
- * when the parent crop was resolved from the frame's retained NATIVE
17946
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17947
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17948
- * resolution from that surface — the SAME quality path faces already
17949
- * had — instead of the downscaled parent tile. `handle` keys the native
17950
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17951
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17952
- * the executor's crop-normalized child ROI back into frame-normalized
17953
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17954
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17955
- * (today's behaviour on the fallback path).
17956
- */
17957
- nativeCropRef: NativeCropRefSchema.optional()
17958
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17959
- engine: PipelineEngineChoiceSchema.optional(),
17960
- steps: array(PipelineStepInputSchema).min(1),
17961
- frames: array(FrameInputSchema).min(1).max(255),
17962
- deviceId: number().optional(),
17963
- sessionId: string().optional(),
17964
- /**
17965
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17966
- * the batch to the Python pool's bench preprocess cache
17967
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17968
- * preprocessed ONCE and every later inference is a pure-inference cache
17969
- * hit — the sustained-throughput run measures inference, not
17970
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
17971
- * full preprocess every call, correct). Fresh per sustained run;
17972
- * released via `uncacheFrame`.
17973
- */
17974
- frameId: number().int().nonnegative().optional(),
17975
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17976
- deviceKey: string().optional()
17977
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17978
- data: _instanceof(Uint8Array),
17979
- width: number().int().positive(),
17980
- height: number().int().positive(),
17981
- format: _enum([
17982
- "rgb",
17983
- "bgr",
17984
- "gray"
17985
- ])
17986
- }), object({
17987
- frameId: number(),
17988
- width: number(),
17989
- height: number()
17990
- }), { kind: "mutation" }), method(object({
17991
- stepId: string(),
17992
- frameId: number().int()
17993
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17994
- batchMode: string(),
17995
- windowMs: number(),
17996
- maxBatchSize: number(),
17997
- concurrency: number()
17998
- })), method(_void(), array(object({
17999
- engineKey: string(),
18000
- engine: PipelineEngineChoiceSchema,
18001
- modelsLoaded: array(string()).readonly(),
18002
- inUseByCameras: array(number()).readonly(),
18003
- /**
18004
- * Origin of this resident factory.
18005
- * - `runtime` — main camera-serving engine (no idle TTL).
18006
- * - `warm-override` — benchmark/test override held in the warm
18007
- * cache; auto-disposed after the idle TTL.
18008
- * - `device-pool` — a concurrent per-device pool (Phase 2
18009
- * multi-device, keyed by `deviceKey`) resolved
18010
- * via `resolveDeviceFactory`. Runs alongside the
18011
- * `runtime` engine on a DIFFERENT accelerator
18012
- * (NPU / iGPU / Coral) — this is how the
18013
- * Engines tab shows all pools running at once.
18014
- */
18015
- kind: _enum([
18016
- "runtime",
18017
- "warm-override",
18018
- "device-pool"
18019
- ]),
18020
- /** Native pid of the underlying Python pool (null when no pool). */
18021
- poolPid: number().nullable(),
18022
- /** ms since this factory was last used (null when not warm-tracked). */
18023
- idleMs: number().nullable(),
18024
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
18025
- idleTtlMs: number().nullable()
18026
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
18220
+ }), method(object({ frameId: string() }), object({
18221
+ base64: string(),
18222
+ width: number().int(),
18223
+ height: number().int()
18224
+ }), {
18225
+ kind: "query",
18226
+ auth: "admin"
18227
+ }), method(object({
18228
+ deviceId: number(),
18229
+ trackId: string(),
18230
+ frameId: string(),
18231
+ subject: RetrainAssistSubjectSchema,
18232
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18233
+ nodeId: string().optional()
18234
+ }), RetrainAssistResultSchema, {
18027
18235
  kind: "mutation",
18028
18236
  auth: "admin"
18029
18237
  }), method(object({
18030
- engine: PipelineEngineChoiceSchema,
18031
- force: boolean().optional()
18032
- }), object({
18033
- success: boolean(),
18034
- reason: string().optional()
18035
- }), {
18238
+ deviceId: number(),
18239
+ source: DetectionSourceSchema,
18240
+ zones: array(ZoneSchema).readonly().optional(),
18241
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
18242
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
18243
+ frames: array(ReplayFrameInputSchema).min(1)
18244
+ }), RunReplayFrameProcessorResultSchema, {
18036
18245
  kind: "mutation",
18037
18246
  auth: "admin"
18038
- }), 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({
18039
- addonId: string(),
18040
- modelId: string(),
18041
- filename: string().optional(),
18042
- settings: record(string(), unknown()).optional()
18043
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
18247
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
18248
+ kind: "query",
18249
+ auth: "admin"
18250
+ }), method(object({
18251
+ deviceId: number(),
18252
+ trackId: string(),
18253
+ frameId: string(),
18254
+ annotations: array(RetrainAnnotationDraftSchema)
18255
+ }), array(RetrainAnnotationSchema).readonly(), {
18256
+ kind: "mutation",
18257
+ auth: "admin"
18258
+ }), method(object({
18259
+ deviceId: number(),
18260
+ trackId: string()
18261
+ }), RetrainTransitionResultSchema, {
18262
+ kind: "mutation",
18263
+ auth: "admin"
18264
+ }), method(object({
18265
+ deviceId: number(),
18266
+ trackId: string()
18267
+ }), RetrainTransitionResultSchema, {
18268
+ kind: "mutation",
18269
+ auth: "admin"
18270
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18271
+ kind: "query",
18272
+ auth: "admin"
18273
+ }), method(object({
18274
+ eventId: string(),
18275
+ kind: MediaFileKindEnum.optional(),
18276
+ deviceId: number()
18277
+ }), array(MediaFileSchema).readonly()), method(object({
18278
+ trackId: string(),
18279
+ kinds: array(MediaFileKindEnum).optional(),
18280
+ deviceId: number()
18281
+ }), array(MediaFileSchema).readonly()), method(object({
18282
+ trackId: string(),
18283
+ deviceId: number()
18284
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18285
+ kind: "mutation",
18286
+ auth: "admin"
18287
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18288
+ kind: "mutation",
18289
+ auth: "admin"
18290
+ }), method(object({}), RebuildStatusSchema), object({
18291
+ deviceId: number(),
18292
+ timestamp: number(),
18293
+ frameWidth: number(),
18294
+ frameHeight: number(),
18295
+ detections: array(OverlayDetectionSchema).readonly()
18296
+ }), object({
18297
+ deviceId: number(),
18298
+ trackId: string(),
18299
+ className: string()
18300
+ }), object({
18301
+ deviceId: number(),
18302
+ trackId: string(),
18303
+ className: string(),
18304
+ durationMs: number()
18305
+ }), object({
18306
+ deviceId: number(),
18307
+ kind: EventKindSchema,
18308
+ eventId: string(),
18309
+ timestamp: number()
18310
+ });
18044
18311
  object({
18045
18312
  activeCameras: number(),
18046
18313
  throttledCameras: number(),
@@ -18066,66 +18333,6 @@ var CameraMetricsSchema = object({
18066
18333
  });
18067
18334
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
18068
18335
  /**
18069
- * Zone — pure geometry + identity. NO filtering behaviour.
18070
- *
18071
- * Zones describe **where** in the frame the operator wants to flag
18072
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
18073
- * each pipeline stage uses them. Splitting the two means a single
18074
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
18075
- * a detection-include rule on `['car']`, and an occupancy aggregate
18076
- * — without three duplicated polygons.
18077
- *
18078
- * Owned by the orchestrator addon (provider) and mirrored into the
18079
- * `zones` device-state slice on every mutation. Consumers
18080
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
18081
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
18082
- * mirror with `onChanged`).
18083
- *
18084
- * Coordinates are normalised fractions of the frame (0–1) so zones
18085
- * survive resolution changes and stream profile switches.
18086
- *
18087
- * `kind` discriminates between full polygons (closed regions used
18088
- * for intrusion / occupancy filters) and tripwires (open 2-point
18089
- * line segments used for cross events). Onboard / firmware-reported
18090
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
18091
- * task list.
18092
- */
18093
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
18094
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
18095
- var PolygonPointSchema = object({
18096
- x: number(),
18097
- y: number()
18098
- });
18099
- /** A camera detection zone — pure geometry/identity. */
18100
- var ZoneSchema = object({
18101
- id: string(),
18102
- name: string(),
18103
- kind: ZoneKindEnum.default("polygon"),
18104
- /** Polygon vertices, fraction of frame (0–1). */
18105
- polygon: array(PolygonPointSchema).readonly(),
18106
- /** Visual color for UI rendering. */
18107
- color: string().default("#3b82f6")
18108
- });
18109
- DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
18110
- deviceId: number(),
18111
- zone: ZoneSchema
18112
- }), _void(), {
18113
- kind: "mutation",
18114
- auth: "admin"
18115
- }), method(object({
18116
- deviceId: number(),
18117
- zoneId: string()
18118
- }), _void(), {
18119
- kind: "mutation",
18120
- auth: "admin"
18121
- }), method(object({
18122
- deviceId: number(),
18123
- zone: ZoneSchema
18124
- }), _void(), {
18125
- kind: "mutation",
18126
- auth: "admin"
18127
- }), object({ zones: array(ZoneSchema).readonly() });
18128
- /**
18129
18336
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
18130
18337
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
18131
18338
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -19813,7 +20020,7 @@ method(object({
19813
20020
  * linking rather than produce an eternal token.
19814
20021
  */
19815
20022
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19816
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
20023
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19817
20024
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19818
20025
  providerId: string().min(1),
19819
20026
  displayName: string().min(1),
@@ -19908,10 +20115,13 @@ var EvictResultSchema = object({
19908
20115
  /** True when the provider has nothing left it is willing to drop on this location. */
19909
20116
  exhausted: boolean()
19910
20117
  });
19911
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
20118
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19912
20119
  locationId: string(),
19913
20120
  targetBytes: number().int().positive()
19914
- }), EvictResultSchema, { kind: "mutation" });
20121
+ }), EvictResultSchema, {
20122
+ kind: "mutation",
20123
+ auth: "admin"
20124
+ });
19915
20125
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19916
20126
  kind: "mutation",
19917
20127
  auth: "admin"
@@ -19971,26 +20181,50 @@ var ReadChunkInputSchema = object({
19971
20181
  length: number()
19972
20182
  });
19973
20183
  var EndDownloadInputSchema = object({ downloadId: string() });
19974
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
20184
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19975
20185
  location: StorageLocationSchema,
19976
20186
  relativePath: string()
19977
- }), string()), method(object({
20187
+ }), string(), { auth: "admin" }), method(object({
19978
20188
  location: StorageLocationSchema,
19979
20189
  relativePath: string(),
19980
20190
  data: _instanceof(Uint8Array)
19981
- }), _void(), { kind: "mutation" }), method(object({
20191
+ }), _void(), {
20192
+ kind: "mutation",
20193
+ auth: "admin"
20194
+ }), method(object({
19982
20195
  location: StorageLocationSchema,
19983
20196
  relativePath: string()
19984
- }), _instanceof(Uint8Array)), method(object({
20197
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19985
20198
  location: StorageLocationSchema,
19986
20199
  relativePath: string()
19987
- }), boolean()), method(object({
20200
+ }), boolean(), { auth: "admin" }), method(object({
19988
20201
  location: StorageLocationSchema,
19989
20202
  prefix: string().optional()
19990
- }), array(string()).readonly()), method(object({
20203
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19991
20204
  location: StorageLocationSchema,
19992
20205
  relativePath: string()
19993
- }), _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" });
20206
+ }), _void(), {
20207
+ kind: "mutation",
20208
+ auth: "admin"
20209
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
20210
+ kind: "mutation",
20211
+ auth: "admin"
20212
+ }), method(WriteChunkInputSchema, _void(), {
20213
+ kind: "mutation",
20214
+ auth: "admin"
20215
+ }), method(FinalizeUploadInputSchema, _void(), {
20216
+ kind: "mutation",
20217
+ auth: "admin"
20218
+ }), method(AbortUploadInputSchema, _void(), {
20219
+ kind: "mutation",
20220
+ auth: "admin"
20221
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
20222
+ kind: "mutation",
20223
+ auth: "admin"
20224
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
20225
+ kind: "mutation",
20226
+ auth: "admin"
20227
+ });
19994
20228
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19995
20229
  var ProfileSettingsSchemaBridge = unknown().nullable();
19996
20230
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -20248,7 +20482,8 @@ method(object({
20248
20482
  access: "create"
20249
20483
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
20250
20484
  kind: "mutation",
20251
- access: "view"
20485
+ access: "view",
20486
+ auth: "admin"
20252
20487
  }), method(object({
20253
20488
  /** Required — the user the assertion belongs to (verified). */
20254
20489
  userId: string(),
@@ -20256,10 +20491,12 @@ method(object({
20256
20491
  response: record(string(), unknown())
20257
20492
  }), object({ verified: boolean() }), {
20258
20493
  kind: "mutation",
20259
- access: "view"
20494
+ access: "view",
20495
+ auth: "admin"
20260
20496
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
20261
20497
  kind: "mutation",
20262
- access: "view"
20498
+ access: "view",
20499
+ auth: "admin"
20263
20500
  }), method(object({
20264
20501
  /** AuthenticationResponseJSON from the browser. */
20265
20502
  response: record(string(), unknown()) }), object({
@@ -20267,7 +20504,8 @@ response: record(string(), unknown()) }), object({
20267
20504
  userId: string().nullable()
20268
20505
  }), {
20269
20506
  kind: "mutation",
20270
- access: "view"
20507
+ access: "view",
20508
+ auth: "admin"
20271
20509
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
20272
20510
  userId: string(),
20273
20511
  credentialId: string()
@@ -20439,7 +20677,19 @@ var VectorStatsResultSchema = object({
20439
20677
  /** False when the backend ranks approximately. */
20440
20678
  exact: boolean()
20441
20679
  });
20442
- 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);
20680
+ method(VectorDeclareIndexInputSchema, _void(), {
20681
+ kind: "mutation",
20682
+ auth: "admin"
20683
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20684
+ kind: "mutation",
20685
+ auth: "admin"
20686
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20687
+ kind: "mutation",
20688
+ auth: "admin"
20689
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20690
+ kind: "mutation",
20691
+ auth: "admin"
20692
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20443
20693
  var ClipSchema = object({
20444
20694
  /** Opaque, provider-namespaced id. The default provider encodes the time
20445
20695
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -22162,7 +22412,27 @@ var MediaFileLiteSchema$1 = object({
22162
22412
  sizeBytes: number(),
22163
22413
  timestamp: number()
22164
22414
  });
22165
- method(_void(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22415
+ method(object({
22416
+ /**
22417
+ * Inline {@link IdentitySchema.coverBase64} on every row.
22418
+ *
22419
+ * Default `false`, the same inversion `listRecentFaces` and
22420
+ * `listPlates` took on 2026-08-25 (see `include-crops-default.ts` for
22421
+ * why the burden belongs on the caller that WANTS the bytes). Measured
22422
+ * on the live hub the same day: four identities cost 40,979 B with the
22423
+ * covers inline, ~10 KB of base64 per row, on a query this UI mounts
22424
+ * four times and the viewer holds at `staleTime: 30_000`.
22425
+ *
22426
+ * Nothing loses its avatar: `coverMediaKey` is already on every row and
22427
+ * the `event-media` plane serves that key `immutable` with an ETag.
22428
+ *
22429
+ * **This is an INPUT field, so it does not reach the addon until the
22430
+ * next train** — the hub router validates cap inputs against its own
22431
+ * compiled Zod and strips a key it does not know. Until then the
22432
+ * provider sees `undefined`, which resolves to `false`: the cheap shape
22433
+ * is what ships, and the opt-in becomes reachable when the train lands.
22434
+ */
22435
+ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22166
22436
  kind: "mutation",
22167
22437
  auth: "admin"
22168
22438
  }), method(object({
@@ -24309,8 +24579,10 @@ var PlateInfoSchema = object({
24309
24579
  keyFrameMediaKey: string().optional(),
24310
24580
  base64: string().optional(),
24311
24581
  /**
24312
- * Same crop as a data-plane URL. `getPlateByTrack` returns this and
24313
- * never inlines JPEG; `listPlates` still inlines for the admin-ui.
24582
+ * Same crop as a data-plane URL, always present when the plate has a stored
24583
+ * crop. `getPlateByTrack` returns this and never inlines JPEG; `listPlates`
24584
+ * and `searchPlates` inline the crop only when their `includeCrops` input is
24585
+ * left at its `true` default.
24314
24586
  */
24315
24587
  cropUrl: string().optional()
24316
24588
  });
@@ -24330,14 +24602,34 @@ var PlateClusterSchema = object({
24330
24602
  });
24331
24603
  method(object({
24332
24604
  deviceId: number().int().optional(),
24333
- limit: number().int().positive().optional()
24605
+ limit: number().int().positive().optional(),
24606
+ /**
24607
+ * Inline the base64 crop on every row. Default `true` — the existing
24608
+ * behaviour, kept so no caller breaks.
24609
+ *
24610
+ * Set `false` once the caller renders {@link PlateInfo.cropUrl}.
24611
+ * Measured on the live hub at the 500 rows the Plates view asks for:
24612
+ * 879,403 B and 27.7 s with the crops inline, against a few KiB of
24613
+ * metadata without them — and the browser then caches the images.
24614
+ *
24615
+ * This is the plate twin of `faceGallery.listRecentFaces`'s option;
24616
+ * plates were the one gallery list left without it.
24617
+ *
24618
+ * **This is an INPUT field, so it does not reach the addon until the
24619
+ * next train.** The hub router validates cap inputs against its own
24620
+ * compiled Zod and strips a key it does not know. Until the train
24621
+ * ships, sending `false` is harmless and keeps the crops inline.
24622
+ */
24623
+ includeCrops: boolean().optional()
24334
24624
  }).optional(), array(PlateInfoSchema).readonly()), method(object({
24335
24625
  deviceId: number().int(),
24336
24626
  trackId: string()
24337
24627
  }), PlateInfoSchema.nullable()), method(object({ plateId: string() }), array(MediaFileLiteSchema).readonly()), method(object({
24338
24628
  text: string().min(1),
24339
24629
  maxDistance: number().int().min(0).optional(),
24340
- limit: number().int().positive().optional()
24630
+ limit: number().int().positive().optional(),
24631
+ /** See `listPlates.includeCrops`. Default `true`. */
24632
+ includeCrops: boolean().optional()
24341
24633
  }), array(PlateInfoSchema).readonly()), method(object({
24342
24634
  maxDistance: number().int().min(0).optional(),
24343
24635
  minClusterSize: number().int().min(2).optional(),
@@ -24351,7 +24643,13 @@ method(object({
24351
24643
  }), method(object({ plateId: string() }), _void(), {
24352
24644
  kind: "mutation",
24353
24645
  auth: "admin"
24354
- }), method(_void(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24646
+ }), method(object({
24647
+ /** Inline {@link VehicleSchema.coverBase64} on every row. Default
24648
+ * `false` — the vehicle twin of `faceGallery.listIdentities`'s
24649
+ * option; `coverMediaKey` + the `event-media` plane carry the picture.
24650
+ * INPUT field: stripped by the hub router until the train ships, which
24651
+ * resolves to `false` and is exactly the intended default. */
24652
+ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24355
24653
  kind: "mutation",
24356
24654
  auth: "admin"
24357
24655
  }), method(object({
@@ -25616,92 +25914,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
25616
25914
  kind: "mutation",
25617
25915
  auth: "admin"
25618
25916
  });
25619
- /**
25620
- * Per-stage gating mode applied to the zones a rule references.
25621
- *
25622
- * - `include`: the rule contributes to a **whitelist** for its stage.
25623
- * When at least one `include` rule fires for a stage, only entities
25624
- * inside one of those zones pass that stage.
25625
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
25626
- * Entities inside one of those zones are dropped at that stage.
25627
- *
25628
- * `monitor`-style observation (count without filtering) is not a rule
25629
- * mode — zones without any matching rule are observed naturally by
25630
- * `zone-analytics` (live snapshot + history), so an "I just want to
25631
- * count, not filter" use case needs no rule at all.
25632
- */
25633
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
25634
- /**
25635
- * Per-consumer rule that references existing zones (geometry) and
25636
- * defines how a specific pipeline stage should treat them. Each
25637
- * consumer addon owns its own `ZoneRule[]` array in its per-device
25638
- * settings:
25639
- *
25640
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
25641
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
25642
- * - future: notification rules, audio gating, etc.
25643
- *
25644
- * One rule applies to N zones (`zoneIds[]`) so the operator can
25645
- * express "ignore motion in ALL of {garden, street}" with a single
25646
- * rule. `classFilter` narrows the rule to specific object classes —
25647
- * "drop person detections in the street, but keep cars" is one
25648
- * `exclude` rule with `classFilter: ['person']`.
25649
- *
25650
- * `enabled` is a soft toggle — the operator can keep the rule
25651
- * configured but inert without deleting it.
25652
- */
25653
- var ZoneRuleSchema = object({
25654
- /** Stable rule id — survives edits, used by the UI for diffing. */
25655
- id: string(),
25656
- /** Optional human-readable label rendered in the rule editor. */
25657
- name: string().optional(),
25658
- /** Zones this rule targets. The rule's `mode` applies to ALL
25659
- * listed zones (OR-set: a detection in any one of them counts).
25660
- * At least one zone id required — a rule with no targets is a
25661
- * configuration mistake and the form validator rejects it. */
25662
- zoneIds: array(string()).min(1).readonly(),
25663
- mode: ZoneRuleModeEnum,
25664
- /**
25665
- * Class names this rule applies to. Empty / undefined ⇒ rule
25666
- * applies to every class. Class strings match the `macroClass`
25667
- * field on detections (e.g. `person`, `car`, `dog`).
25668
- */
25669
- classFilter: array(string()).readonly().optional(),
25670
- /**
25671
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
25672
- * required to consider an entity "in the zone". Defaults to the
25673
- * consumer's stage default when omitted. Kept for back-compat with
25674
- * existing per-rule overrides; new operators pick the value via
25675
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
25676
- * set, the lower-level engine reads it as a 0–1 fraction.
25677
- */
25678
- overlapThreshold: number().min(0).max(1).optional(),
25679
- /**
25680
- * Operator-friendly version of `overlapThreshold` — the percentage
25681
- * of the detection's bbox that must lie inside the zone for the
25682
- * rule to match. Documented default is 85%; the engine substitutes
25683
- * that when the field is omitted (kept optional so existing rules
25684
- * stored without it stay valid).
25685
- *
25686
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
25687
- * rule, the engine prefers `bboxInclusionPct` because it's the
25688
- * field exposed in the UI. Internally both feed the same gate.
25689
- */
25690
- bboxInclusionPct: number().min(0).max(100).optional(),
25691
- /**
25692
- * When `true` and a detection has a segmentation mask, use the
25693
- * mask for overlap instead of the bbox. Detection-stage only;
25694
- * motion rules ignore this field.
25695
- */
25696
- preferMask: boolean().optional(),
25697
- /**
25698
- * Soft-toggle: `false` disables the rule without deleting it.
25699
- * Defaults to `true` so operators creating a rule via the UI
25700
- * see it active immediately.
25701
- */
25702
- enabled: boolean().default(true)
25703
- });
25704
- array(ZoneRuleSchema).readonly();
25705
25917
  object({
25706
25918
  /** Whether the script is currently executing. */
25707
25919
  isRunning: boolean(),
@@ -29728,6 +29940,12 @@ Object.freeze({
29728
29940
  addonId: null,
29729
29941
  access: "create"
29730
29942
  },
29943
+ "pipelineAnalytics.cancelRelocateMedia": {
29944
+ capName: "pipeline-analytics",
29945
+ capScope: "device",
29946
+ addonId: null,
29947
+ access: "create"
29948
+ },
29731
29949
  "pipelineAnalytics.cancelStorageMigrationMove": {
29732
29950
  capName: "pipeline-analytics",
29733
29951
  capScope: "device",
@@ -29902,6 +30120,12 @@ Object.freeze({
29902
30120
  addonId: null,
29903
30121
  access: "view"
29904
30122
  },
30123
+ "pipelineAnalytics.listRelocateMediaJobs": {
30124
+ capName: "pipeline-analytics",
30125
+ capScope: "device",
30126
+ addonId: null,
30127
+ access: "view"
30128
+ },
29905
30129
  "pipelineAnalytics.listRetrainAnnotations": {
29906
30130
  capName: "pipeline-analytics",
29907
30131
  capScope: "device",
@@ -29980,6 +30204,12 @@ Object.freeze({
29980
30204
  addonId: null,
29981
30205
  access: "create"
29982
30206
  },
30207
+ "pipelineAnalytics.relocateMedia": {
30208
+ capName: "pipeline-analytics",
30209
+ capScope: "device",
30210
+ addonId: null,
30211
+ access: "create"
30212
+ },
29983
30213
  "pipelineAnalytics.restageRetrainTrack": {
29984
30214
  capName: "pipeline-analytics",
29985
30215
  capScope: "device",
@@ -29992,6 +30222,12 @@ Object.freeze({
29992
30222
  addonId: null,
29993
30223
  access: "create"
29994
30224
  },
30225
+ "pipelineAnalytics.runReplayFrameProcessor": {
30226
+ capName: "pipeline-analytics",
30227
+ capScope: "device",
30228
+ addonId: null,
30229
+ access: "create"
30230
+ },
29995
30231
  "pipelineAnalytics.saveRetrainAnnotations": {
29996
30232
  capName: "pipeline-analytics",
29997
30233
  capScope: "device",
@@ -30124,6 +30360,12 @@ Object.freeze({
30124
30360
  addonId: null,
30125
30361
  access: "view"
30126
30362
  },
30363
+ "pipelineExecutor.getInferenceDeviceHealth": {
30364
+ capName: "pipeline-executor",
30365
+ capScope: "system",
30366
+ addonId: null,
30367
+ access: "view"
30368
+ },
30127
30369
  "pipelineExecutor.getOrchestratorConfigSchema": {
30128
30370
  capName: "pipeline-executor",
30129
30371
  capScope: "system",
@@ -30196,6 +30438,12 @@ Object.freeze({
30196
30438
  addonId: null,
30197
30439
  access: "view"
30198
30440
  },
30441
+ "pipelineExecutor.rearmInferenceDevice": {
30442
+ capName: "pipeline-executor",
30443
+ capScope: "system",
30444
+ addonId: null,
30445
+ access: "create"
30446
+ },
30199
30447
  "pipelineExecutor.runAudioTest": {
30200
30448
  capName: "pipeline-executor",
30201
30449
  capScope: "system",
@@ -33444,6 +33692,11 @@ Object.freeze({
33444
33692
  form: "single",
33445
33693
  optional: false
33446
33694
  }],
33695
+ "pipelineAnalytics.runReplayFrameProcessor": [{
33696
+ name: "deviceId",
33697
+ form: "single",
33698
+ optional: false
33699
+ }],
33447
33700
  "pipelineAnalytics.saveRetrainAnnotations": [{
33448
33701
  name: "deviceId",
33449
33702
  form: "single",