@camstack/addon-notifiers 1.2.32 → 1.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2085 -1842
  2. package/dist/addon.mjs +2085 -1842
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -6660,7 +6660,7 @@ function method(input, output, options) {
6660
6660
  input,
6661
6661
  output,
6662
6662
  kind: options?.kind ?? "query",
6663
- auth: options?.auth ?? "protected",
6663
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6664
6664
  ...options?.access !== void 0 ? { access: options.access } : {},
6665
6665
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6666
6666
  timeoutMs: options?.timeoutMs
@@ -6680,7 +6680,7 @@ function systemMethod(input, output, options) {
6680
6680
  }
6681
6681
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
6682
6682
  var VersionOutputSchema$1 = object({ version: string() });
6683
- method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6683
+ method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
6684
6684
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
6685
6685
  DeviceType["Camera"] = "camera";
6686
6686
  DeviceType["Hub"] = "hub";
@@ -7001,7 +7001,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7001
7001
  }({});
7002
7002
  var StaticDirOutputSchema = object({ staticDir: string() });
7003
7003
  var VersionOutputSchema = object({ version: string() });
7004
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
7004
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
7005
7005
  /**
7006
7006
  * device-ops — device-scoped cap that unifies the per-IDevice operations
7007
7007
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7734,24 +7734,6 @@ var RecordingRetentionSchema = object({
7734
7734
  maxSizeGb: number().min(0).optional()
7735
7735
  });
7736
7736
  /**
7737
- * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7738
- * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7739
- * previews at. Five graduated steps; absent on a config = `standard` (the
7740
- * shipped default, matching `sheet-geometry`/`sheet-composer`).
7741
- *
7742
- * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7743
- * Each window's index sidecar carries its own tile dims, so a camera whose
7744
- * preset changed over time renders every historical window at the dims it was
7745
- * written with.
7746
- */
7747
- var ScrubThumbnailPresetSchema = _enum([
7748
- "minimal",
7749
- "low",
7750
- "standard",
7751
- "high",
7752
- "max"
7753
- ]);
7754
- /**
7755
7737
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7756
7738
  *
7757
7739
  * `bands` is the ONLY authored recording intent: what to record, when, and on
@@ -7759,7 +7741,11 @@ var ScrubThumbnailPresetSchema = _enum([
7759
7741
  * other field is a storage knob (profiles, segment length, retention, scrub).
7760
7742
  *
7761
7743
  * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7762
- * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7744
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30,
7745
+ * and `scrubThumbnails` — a five-step fidelity knob for a sprite tier that was
7746
+ * deleted on 2026-07-24 and had ZERO consumers in the recorder — on 2026-08-25
7747
+ * (D62: a switch that writes a store nobody reads is worse than no switch).
7748
+ * Stored rows keep loading: the READ schema is `.strip()` (config-store.ts).
7763
7749
  * A stale caller must fail loudly — silently stripping its legacy intent would
7764
7750
  * persist a band-less config, i.e. silently stop recording the camera.
7765
7751
  */
@@ -7782,14 +7768,7 @@ var RecordingConfigSchema = object({
7782
7768
  * "off" is the absence of a covering band, never a band value.
7783
7769
  */
7784
7770
  bands: array(RecordingBandSchema).default([]),
7785
- retention: RecordingRetentionSchema.optional(),
7786
- /**
7787
- * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7788
- * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7789
- * windows only — existing sheets are immutable, and each window's index
7790
- * carries its own tile dims so mixed-preset history renders correctly.
7791
- */
7792
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7771
+ retention: RecordingRetentionSchema.optional()
7793
7772
  }).strict();
7794
7773
  /**
7795
7774
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
@@ -7865,10 +7844,11 @@ var RelocateFootageInputSchema = object({
7865
7844
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7866
7845
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7867
7846
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7868
- var StorageMigrationMediaMoveInputSchema = object({
7847
+ var RelocateMediaInputSchema = object({
7869
7848
  toLocationId: string(),
7870
7849
  throttleMbps: number().min(1).max(1e3).optional()
7871
- }).extend({ leaseId: string().min(1) });
7850
+ });
7851
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7872
7852
  /** The independently selectable logical storage classes. `recordings`
7873
7853
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7874
7854
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8163,7 +8143,26 @@ var LabelDefinitionSchema = object({
8163
8143
  description: string().optional(),
8164
8144
  icon: string().optional()
8165
8145
  });
8166
- var ClassMapDefinitionSchema = object({
8146
+ /**
8147
+ * Wire schema for a per-model CATALOG classMap override
8148
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8149
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8150
+ * detection pipeline executor actually routes.
8151
+ *
8152
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8153
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8154
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8155
+ * enum) — the two used to share the name `ClassMapDefinition`/
8156
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8157
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8158
+ * are not: it is two different concepts colliding on a name. Keep this type
8159
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8160
+ * would either narrow every `ClassMapDefinition` consumer to the four
8161
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8162
+ * schema exists for (see the "rejects a classMap whose target is not a
8163
+ * detection macro" test in `model-catalog-schema.test.ts`).
8164
+ */
8165
+ var DetectionCatalogClassMapSchema = object({
8167
8166
  mapping: record(string(), _enum([
8168
8167
  "person",
8169
8168
  "vehicle",
@@ -8368,7 +8367,7 @@ var ModelCatalogEntrySchema = object({
8368
8367
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8369
8368
  * labels already ARE the CamStack macros (Scrypted identity map).
8370
8369
  */
8371
- classMap: ClassMapDefinitionSchema.optional()
8370
+ classMap: DetectionCatalogClassMapSchema.optional()
8372
8371
  });
8373
8372
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8374
8373
  format: literal("openvino"),
@@ -8398,7 +8397,7 @@ var ModelConvertMetadataSchema = object({
8398
8397
  "segmentation"
8399
8398
  ]),
8400
8399
  faceAlignment: boolean().optional(),
8401
- classMap: ClassMapDefinitionSchema.optional()
8400
+ classMap: DetectionCatalogClassMapSchema.optional()
8402
8401
  });
8403
8402
  var ConvertResultSchema = object({
8404
8403
  entry: ModelCatalogEntrySchema,
@@ -9261,7 +9260,7 @@ var AddonPageDeclarationSchema = object({
9261
9260
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9262
9261
  sectionLabel: string().optional()
9263
9262
  });
9264
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9263
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9265
9264
  var AddonHttpRouteSchema = object({
9266
9265
  method: _enum([
9267
9266
  "GET",
@@ -9515,7 +9514,7 @@ var WidgetMetadataSchema = object({
9515
9514
  defaultColumns: number().int().min(1).max(12).default(6),
9516
9515
  defaultRows: number().int().min(1).max(12).default(1)
9517
9516
  });
9518
- method(_void(), array(WidgetMetadataSchema).readonly());
9517
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9519
9518
  /**
9520
9519
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9521
9520
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -11059,7 +11058,7 @@ var CustomModelDescriptorSchema = object({
11059
11058
  stepId: string(),
11060
11059
  entry: ModelCatalogEntrySchema
11061
11060
  });
11062
- method(_void(), array(CustomModelDescriptorSchema).readonly());
11061
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
11063
11062
  /**
11064
11063
  * Query filter for settings-store collections.
11065
11064
  */
@@ -11146,7 +11145,8 @@ method(object({
11146
11145
  }), _void(), { kind: "mutation" }), method(object({
11147
11146
  namespace: string().optional(),
11148
11147
  collection: string(),
11149
- filter: QueryFilterSchema.optional()
11148
+ filter: QueryFilterSchema.optional(),
11149
+ columns: array(string()).readonly().optional()
11150
11150
  }), array(SettingsRecordSchema).readonly()), method(object({
11151
11151
  namespace: string().optional(),
11152
11152
  collection: string(),
@@ -11209,46 +11209,87 @@ var EngineInfoSchema = object({
11209
11209
  kind: _enum(["relational", "vector"]),
11210
11210
  displayName: string()
11211
11211
  });
11212
- method(_void(), EngineInfoSchema), method(object({
11212
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11213
11213
  namespace: string().optional(),
11214
11214
  collection: string(),
11215
11215
  key: string()
11216
- }), unknown()), method(object({
11216
+ }), unknown(), { auth: "admin" }), method(object({
11217
11217
  namespace: string().optional(),
11218
11218
  collection: string(),
11219
11219
  key: string(),
11220
11220
  value: unknown()
11221
- }), _void(), { kind: "mutation" }), method(object({
11221
+ }), _void(), {
11222
+ kind: "mutation",
11223
+ auth: "admin"
11224
+ }), method(object({
11222
11225
  namespace: string().optional(),
11223
11226
  collection: string(),
11224
- filter: QueryFilterSchema.optional()
11225
- }), array(SettingsRecordSchema).readonly()), method(object({
11227
+ filter: QueryFilterSchema.optional(),
11228
+ /**
11229
+ * SQL-level column projection — MUST mirror `settings-store.query`.
11230
+ *
11231
+ * ⚠ An earlier version of this comment blamed Zod stripping, and that
11232
+ * was wrong — corrected 2026-08-26 after the hop map
11233
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11234
+ * There is **no Zod parse at all** between the door and the engine: the
11235
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11236
+ * field declared here reaches `SqliteSettingsBackend` either way.
11237
+ *
11238
+ * What actually lost `columns` was the THIRD declaration of this shape:
11239
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11240
+ * interface the engine destructures from. The field existed on both
11241
+ * schemas and the engine still never read it, because nothing checks a
11242
+ * registered provider against `InferProvider<cap>` —
11243
+ * `ProviderRegistration.provider` is typed `object`.
11244
+ *
11245
+ * It is declared here anyway, and must stay in step with
11246
+ * `settings-store.query`: a caller reading only the cap definitions has
11247
+ * to be able to see that this call carries a projection.
11248
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11249
+ */
11250
+ columns: array(string()).readonly().optional()
11251
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11226
11252
  namespace: string().optional(),
11227
11253
  collection: string(),
11228
11254
  record: SettingsRecordSchema
11229
- }), _void(), { kind: "mutation" }), method(object({
11255
+ }), _void(), {
11256
+ kind: "mutation",
11257
+ auth: "admin"
11258
+ }), method(object({
11230
11259
  namespace: string().optional(),
11231
11260
  collection: string(),
11232
11261
  id: string(),
11233
11262
  data: record(string(), unknown())
11234
- }), _void(), { kind: "mutation" }), method(object({
11263
+ }), _void(), {
11264
+ kind: "mutation",
11265
+ auth: "admin"
11266
+ }), method(object({
11235
11267
  namespace: string().optional(),
11236
11268
  collection: string(),
11237
11269
  key: string()
11238
- }), _void(), { kind: "mutation" }), method(object({
11270
+ }), _void(), {
11271
+ kind: "mutation",
11272
+ auth: "admin"
11273
+ }), method(object({
11239
11274
  namespace: string().optional(),
11240
11275
  collection: string(),
11241
11276
  filter: MutationFilterSchema
11242
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11277
+ }), object({ deleted: number().int() }), {
11278
+ kind: "mutation",
11279
+ auth: "admin"
11280
+ }), method(object({
11243
11281
  namespace: string().optional(),
11244
11282
  collection: string(),
11245
11283
  filter: MutationFilterSchema,
11246
11284
  data: record(string(), unknown())
11247
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11285
+ }), object({ updated: number().int() }), {
11286
+ kind: "mutation",
11287
+ auth: "admin"
11288
+ }), method(object({
11248
11289
  namespace: string().optional(),
11249
11290
  collection: string(),
11250
11291
  filter: QueryFilterSchema.optional()
11251
- }), number()), method(object({
11292
+ }), number(), { auth: "admin" }), method(object({
11252
11293
  namespace: string().optional(),
11253
11294
  collection: string(),
11254
11295
  field: string(),
@@ -11258,15 +11299,18 @@ method(_void(), EngineInfoSchema), method(object({
11258
11299
  }), array(object({
11259
11300
  bucket: number().int(),
11260
11301
  count: number().int()
11261
- })).readonly()), method(object({
11302
+ })).readonly(), { auth: "admin" }), method(object({
11262
11303
  namespace: string().optional(),
11263
11304
  collection: string()
11264
- }), boolean()), method(object({
11305
+ }), boolean(), { auth: "admin" }), method(object({
11265
11306
  namespace: string().optional(),
11266
11307
  collection: string(),
11267
11308
  columns: array(CollectionColumnSchema).readonly(),
11268
11309
  indexes: array(CollectionIndexSchema).readonly().optional()
11269
- }), _void(), { kind: "mutation" });
11310
+ }), _void(), {
11311
+ kind: "mutation",
11312
+ auth: "admin"
11313
+ });
11270
11314
  /**
11271
11315
  * shm ring usage stats for a `frameSink: 'shm'` decoder session —
11272
11316
  * exposed via `decoder.getShmStats` so downstream consumers can
@@ -12394,7 +12438,7 @@ method(object({
12394
12438
  crop: _instanceof(Uint8Array),
12395
12439
  width: number(),
12396
12440
  height: number()
12397
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12441
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12398
12442
  /**
12399
12443
  * filesystem-browse — per-node capability for browsing the node's local
12400
12444
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12687,19 +12731,22 @@ method(LlmGenerateBaseInputSchema.extend({
12687
12731
  runtime: ManagedRuntimeConfigSchema,
12688
12732
  /** The managed profile's timeout, threaded by the hub provider. */
12689
12733
  timeoutMs: number().int().positive().optional()
12690
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12734
+ }), LlmGenerateResultSchema, {
12735
+ kind: "mutation",
12736
+ auth: "admin"
12737
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12691
12738
  kind: "mutation",
12692
12739
  auth: "admin"
12693
12740
  }), method(object({}), _void(), {
12694
12741
  kind: "mutation",
12695
12742
  auth: "admin"
12696
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12743
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12697
12744
  kind: "mutation",
12698
12745
  auth: "admin"
12699
12746
  }), method(object({ file: string() }), _void(), {
12700
12747
  kind: "mutation",
12701
12748
  auth: "admin"
12702
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12749
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12703
12750
  /**
12704
12751
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12705
12752
  * methods concat-fan across providers; single-row methods route to ONE
@@ -16186,1748 +16233,1958 @@ var OauthIntegrationDescriptorSchema = object({
16186
16233
  */
16187
16234
  refreshTokenTtlSec: union([number().int().positive(), literal("never")]).optional()
16188
16235
  });
16189
- method(_void(), OauthIntegrationDescriptorSchema);
16236
+ method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
16190
16237
  /**
16191
- * pipeline-analytics — device-scoped wrapper cap. Refines raw
16192
- * per-frame detections emitted by the pipeline runner into tracked
16193
- * objects, per-kind event collections (motion / object / audio), and
16194
- * persisted media. Owns the post-detection domain end-to-end:
16195
- *
16196
- * runner emits PipelineInferenceResult
16197
- * ↓ (event bus)
16198
- * pipeline-analytics subscriber
16199
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16200
- * → three DB collections (one per kind), one FS media tree, one
16201
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16202
- * DetectionEvent on bus)
16203
- *
16204
- * Pure subscriber model. No `processFrame` cap method — the runner
16205
- * already publishes the raw frame on the bus. The cap surface is
16206
- * only QUERIES + per-device settings, bound on/off via
16207
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16208
- * every camera with a detection pipeline wants its raw detections
16209
- * refined; operators opt out per-device via BindingsTab when needed.
16210
- *
16211
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16212
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16238
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16239
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16240
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16213
16241
  */
16214
- var TrackStateSchema = _enum([
16215
- "new",
16216
- "entered",
16217
- "left",
16218
- "moving",
16219
- "idle"
16220
- ]);
16221
- var EventKindSchema = _enum([
16222
- "motion",
16223
- "object",
16224
- "audio"
16225
- ]);
16242
+ var NativeCropRefSchema = object({
16243
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16244
+ handle: FrameHandleSchema,
16245
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16246
+ cropFrameSpace: object({
16247
+ x: number(),
16248
+ y: number(),
16249
+ w: number(),
16250
+ h: number()
16251
+ })
16252
+ });
16253
+ object({
16254
+ crop: object({
16255
+ left: number(),
16256
+ top: number(),
16257
+ width: number().positive(),
16258
+ height: number().positive()
16259
+ }).optional(),
16260
+ content: object({
16261
+ width: number().int().positive(),
16262
+ height: number().int().positive()
16263
+ }),
16264
+ fit: _enum(["stretch", "contain"]),
16265
+ format: _enum([
16266
+ "rgb",
16267
+ "gray",
16268
+ "jpeg"
16269
+ ])
16270
+ });
16226
16271
  /**
16227
- * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16228
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16229
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16272
+ * Process-local frame identity. It is serializable so it can ride an in-process
16273
+ * capability call, but `registryId` deliberately prevents resolution in any
16274
+ * other process or execution group.
16230
16275
  */
16231
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16232
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16233
- var EventKindIconSchema = _enum([
16234
- "motion",
16235
- "audio",
16236
- "person",
16237
- "vehicle",
16238
- "animal",
16239
- "door",
16240
- "pir",
16241
- "smoke",
16242
- "water",
16243
- "button",
16244
- "package",
16245
- "generic"
16276
+ var FrameRefSchema = object({
16277
+ registryId: string().min(1),
16278
+ id: string().min(1),
16279
+ width: number().int().positive(),
16280
+ height: number().int().positive(),
16281
+ format: _enum(["rgb", "gray"]),
16282
+ timestamp: number(),
16283
+ capturedAt: number().optional()
16284
+ });
16285
+ var ModelFormatSchema$1 = _enum([
16286
+ "onnx",
16287
+ "coreml",
16288
+ "openvino",
16289
+ "tflite",
16290
+ "pt",
16291
+ "gguf"
16246
16292
  ]);
16247
- var EventKindCategorySchema = _enum([
16248
- "motion",
16249
- "audio",
16250
- "detection",
16251
- "sensor",
16252
- "control",
16253
- "custom",
16254
- "package"
16293
+ var PipelineSlotSchema = _enum([
16294
+ "detector",
16295
+ "cropper",
16296
+ "classifier",
16297
+ "refiner",
16298
+ "audio-classifier"
16255
16299
  ]);
16256
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16257
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16258
- var EventKindDescriptorSchema = object({
16259
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16260
- kind: string(),
16261
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16262
- labelKey: string(),
16263
- /** English fallback label (kept for clients that don't translate). */
16264
- label: string(),
16265
- /** Hex color for timeline/legend rendering. */
16266
- color: string(),
16267
- /** Dictionary id → lucide component on the UI side. */
16268
- iconId: string(),
16269
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16270
- icon: EventKindIconSchema,
16271
- category: EventKindCategorySchema,
16272
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16273
- parentKind: string().nullable(),
16274
- /** Derived from `parentKind`, explicit for the client tree. */
16275
- level: EventKindLevelSchema,
16276
- /** Which cap + device contributes this kind. For built-ins the camera
16277
- * itself; for sensor kinds the LINKED source device. */
16278
- source: object({
16279
- capName: string(),
16280
- deviceId: number()
16281
- })
16300
+ var PipelineEngineChoiceSchema = object({
16301
+ runtime: _enum(["node", "python"]),
16302
+ backend: string(),
16303
+ format: ModelFormatSchema$1,
16304
+ device: string().optional()
16282
16305
  });
16283
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16284
- var EventKindsForDeviceSchema = object({
16285
- deviceId: number(),
16286
- kinds: array(EventKindDescriptorSchema).readonly()
16306
+ var AvailableEngineSchema = object({
16307
+ engine: PipelineEngineChoiceSchema,
16308
+ devices: array(object({
16309
+ id: string(),
16310
+ label: string(),
16311
+ description: string().optional()
16312
+ })).readonly(),
16313
+ defaultDevice: string()
16287
16314
  });
16288
- var SensorEventSchema = object({
16315
+ var PipelineDefaultStepSchema = lazy(() => object({
16316
+ addonId: string(),
16317
+ addonName: string(),
16318
+ slot: PipelineSlotSchema,
16319
+ inputClasses: array(string()).readonly(),
16320
+ outputClasses: array(string()).readonly(),
16321
+ enabled: boolean(),
16322
+ modelId: string(),
16323
+ children: array(PipelineDefaultStepSchema).readonly(),
16324
+ group: string().optional(),
16325
+ settings: record(string(), unknown()).optional()
16326
+ }));
16327
+ var PipelineTemplateStepSchema = lazy(() => object({
16328
+ addonId: string(),
16329
+ enabled: boolean(),
16330
+ modelId: string(),
16331
+ children: array(PipelineTemplateStepSchema).readonly(),
16332
+ settings: record(string(), unknown()).optional()
16333
+ }));
16334
+ var PipelineTemplateSchema$1 = object({
16289
16335
  id: string(),
16290
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16291
- * yields N rows, one per camera). */
16292
- deviceId: number(),
16293
- /** The linked sensor device whose state changed. */
16294
- sourceDeviceId: number(),
16295
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16296
- kind: string(),
16297
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16298
- value: record(string(), unknown()).nullable(),
16299
- timestamp: number()
16336
+ name: string(),
16337
+ createdAt: string(),
16338
+ updatedAt: string(),
16339
+ engine: PipelineEngineChoiceSchema,
16340
+ steps: array(PipelineTemplateStepSchema).readonly()
16300
16341
  });
16301
- var TrackPositionSchema = object({
16302
- x: number(),
16303
- y: number(),
16304
- timestamp: number(),
16305
- bbox: BoundingBoxSchema
16306
- });
16307
- var TrackSnapshotSchema = object({
16308
- timestamp: number(),
16309
- position: TrackPositionSchema,
16310
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16311
- mediaKey: string()
16342
+ var PipelineModelOptionSchema = object({
16343
+ id: string(),
16344
+ name: string(),
16345
+ formats: record(string(), object({
16346
+ downloaded: boolean(),
16347
+ sizeMB: number()
16348
+ })),
16349
+ group: ModelVariantGroupSchema.optional(),
16350
+ legacy: boolean().optional(),
16351
+ provider: ModelProviderIdSchema.optional()
16312
16352
  });
16313
- /**
16314
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16315
- * divided by the track's detection-frame dims), computed at persist time.
16316
- * Absent when the frame dims were unknown when the track was persisted
16317
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16318
- */
16319
- var TrackEnvelopeSchema = object({
16320
- minX: number(),
16321
- minY: number(),
16322
- maxX: number(),
16323
- maxY: number()
16353
+ var ConfigFieldBridge = custom();
16354
+ var PipelineAddonSchemaSchema = object({
16355
+ id: string(),
16356
+ name: string(),
16357
+ slot: PipelineSlotSchema,
16358
+ inputClasses: array(string()).readonly(),
16359
+ outputClasses: array(string()).readonly(),
16360
+ childSlots: array(PipelineSlotSchema).readonly(),
16361
+ models: array(PipelineModelOptionSchema).readonly(),
16362
+ defaultModelId: string(),
16363
+ defaultModelIdByFormat: record(string(), string()).optional(),
16364
+ enabledByDefault: boolean().optional(),
16365
+ backfillIntoExistingOverrides: boolean().optional(),
16366
+ defaultConfidence: number(),
16367
+ group: string().optional(),
16368
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16324
16369
  });
16325
- /**
16326
- * Row projection for track list queries. `full` (default) returns the
16327
- * complete Track including the frame-rate `positions[]` history and the
16328
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16329
- * keeps every scalar the list surfaces actually render (ids, class(es),
16330
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16331
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16332
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16333
- * `getTrack`. Mirrors the event-store `projection` convention
16334
- * (`getObjectEvents` et al.).
16335
- */
16336
- var TrackProjectionSchema = _enum(["full", "slim"]);
16337
- /**
16338
- * One audio-classification label heard on the track's camera while the
16339
- * track was alive, aggregated per label. An "episode" is one persisted
16340
- * audio event (the confident-classification path: score ≥ the device's
16341
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16342
- * one 32 ms inference chunk, so counts stay human-scaled.
16343
- */
16344
- var TrackAudioLabelSchema = object({
16370
+ var PipelineSlotSchemaSchema = object({
16371
+ id: PipelineSlotSchema,
16345
16372
  label: string(),
16346
- /** Highest classification score observed across the label's episodes. */
16347
- peakScore: number(),
16348
- /** Number of coalesced audio-event episodes carrying this label. */
16349
- count: number(),
16350
- firstAt: number(),
16351
- lastAt: number()
16373
+ priority: number(),
16374
+ parentSlot: PipelineSlotSchema.nullable(),
16375
+ addons: array(PipelineAddonSchemaSchema).readonly()
16352
16376
  });
16353
- /**
16354
- * How a track was produced. `pipeline` (default / absent) = the spatial
16355
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16356
- * no positions, a single snapshot, and no bbox trajectory at all:
16357
- *
16358
- * - `sensor` — a linked sensor/control device state change.
16359
- * - `audio` — an audio event on the camera itself that was anomalous for
16360
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16361
- *
16362
- * The spatial subsystems (tracker association, occupancy count, re-id /
16363
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16364
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16365
- * check silently readmits every source added after it was written.
16366
- */
16367
- var TrackSourceSchema = _enum([
16368
- "pipeline",
16369
- "sensor",
16370
- "audio"
16371
- ]);
16372
- /**
16373
- * Where a track sits in the RETRAIN lifecycle (D81).
16374
- *
16375
- * - `none` — never marked, or un-marked. Evictable.
16376
- * - `staging` — the operator wants this track as training material and has not
16377
- * finished with it. **This is the only state retention holds**: the track and
16378
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16379
- * the device's age window.
16380
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16381
- * were COPIED into the retrain dataset at selection time, so the dataset no
16382
- * longer depends on the track's media and the track becomes EVICTABLE again.
16383
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16384
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16385
- *
16386
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16387
- * the store's filter language has only positive equality and `whereIn` — no
16388
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16389
- * would make the entire pre-column history immortal in one deploy.
16390
- */
16391
- var RetrainStatusSchema = _enum([
16392
- "none",
16393
- "staging",
16394
- "trained"
16395
- ]);
16396
- /**
16397
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16398
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16399
- * so the two surfaces cannot drift.
16400
- *
16401
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16402
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16403
- * columns existed read as absent, and a consumer that needs a boolean should say
16404
- * `flag === true`, not `flag !== false`.
16405
- *
16406
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16407
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16408
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16409
- * `trained` track reports `false` while refusing both writes. The boolean is
16410
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16411
- * "never marked" from "already trained" must read `retrainStatus`.
16412
- *
16413
- * `debug` does NOT pin; it is attention, not durability.
16414
- *
16415
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16416
- * A favourited track is skipped by retention the same way `staging` is, but
16417
- * it does not enter `none|staging|trained` and has no staging budget.
16418
- */
16419
- var TrackFlagFields = {
16420
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16421
- * `'staging'`. */
16422
- markForTrain: boolean().optional(),
16423
- /** Operator marked this track for diagnostic attention. */
16424
- debug: boolean().optional(),
16425
- /** Operator favourited this track. Pins it against pruning. */
16426
- favourited: boolean().optional()
16427
- };
16428
- /**
16429
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16430
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16431
- * write patch, and the status is not something the toggle sets — it is what the
16432
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16433
- * always present on a persisted row (the column default materialises `'none'`).
16434
- */
16435
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16436
- /**
16437
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16438
- * one flag can never clear the other — the toggles are independent and are
16439
- * driven from three surfaces that do not know about each other.
16440
- */
16441
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16442
- /**
16443
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16444
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16445
- * mutation result without a re-fetch.
16446
- */
16447
- var TrackFlagsSchema = object({
16448
- trackId: string(),
16449
- markForTrain: boolean(),
16450
- debug: boolean(),
16451
- favourited: boolean(),
16452
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16453
- * a track row) because this shape is only ever produced by the write body,
16454
- * which always knows it — and a surface that has just written needs to render
16455
- * `trained` without a re-fetch. */
16456
- retrainStatus: RetrainStatusSchema
16377
+ var PipelineSchemaSchema = object({
16378
+ availableEngines: array(AvailableEngineSchema).readonly(),
16379
+ selectedEngine: PipelineEngineChoiceSchema,
16380
+ slots: array(PipelineSlotSchemaSchema).readonly()
16457
16381
  });
16458
- union([literal(1), literal(2)]);
16459
- /**
16460
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16461
- * the step and model that produced it — which is what makes the write rule
16462
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16463
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16464
- *
16465
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16466
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16467
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16468
- * that value has no provenance, and the write rule lets ANY properly-attributed
16469
- * write of the same tier replace it regardless of score.
16470
- */
16471
- var LabelAttributionSchema = object({
16472
- stepId: string(),
16473
- modelId: string().optional(),
16474
- decidedAt: number(),
16382
+ var EngineProvisioningSchema = object({
16383
+ runtimeId: _enum([
16384
+ "onnx",
16385
+ "openvino",
16386
+ "coreml",
16387
+ "edgetpu"
16388
+ ]).nullable(),
16389
+ device: string().nullable(),
16390
+ state: _enum([
16391
+ "idle",
16392
+ "installing",
16393
+ "verifying",
16394
+ "ready",
16395
+ "failed"
16396
+ ]),
16397
+ progress: number().optional(),
16398
+ error: string().optional(),
16399
+ nextRetryAt: number().optional(),
16475
16400
  /**
16476
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16477
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16478
- *
16479
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16480
- * notification rule authored on "Gianluca" stopped matching the moment the
16481
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16482
- * the thing that does not move, so it is what a rule matches on
16483
- * (`NcConditions.identities`) and the text is what a human is shown.
16484
- *
16485
- * Absent when the label names no gallery row — a plate the OCR read but no
16486
- * vehicle claims, a sub-class, a species, any tier-1 value.
16401
+ * Gate A (config-correctness gate at engine change): human-readable
16402
+ * config issues surfaced EAGERLY when the node's engine changes — model
16403
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16404
+ * has a <format> build"). Additive/optional: informational only, never
16405
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
16406
+ * Absent/empty when the node-default tree resolves cleanly.
16487
16407
  */
16488
- identityId: string().optional()
16408
+ configIssues: array(string()).optional()
16489
16409
  });
16490
- /**
16491
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16492
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16493
- * track and its events always answer the same question the same way.
16494
- *
16495
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16496
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16497
- * is tier 2, and each carries its own score + attribution.
16498
- *
16499
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16500
- * finest thing known. Before 4g the single `label` column held the finest
16501
- * value, so a consumer that has not been updated reads the tier-1 slot and
16502
- * shows nothing on a species-only row; that is why the migration puts every
16503
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16504
- * and why the read surfaces were changed in the same train.
16505
- *
16506
- * **Writing it.** The slots are independent, which is the whole point: a
16507
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16508
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16509
- * higher score wins. One rule, one implementation — see
16510
- * `pipeline/label-tier.ts` in addon-post-analysis.
16511
- */
16512
- var TieredLabelFields = {
16513
- /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
16514
- label: string().optional(),
16515
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16516
- labelScore: number().optional(),
16517
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16518
- labelMeta: LabelAttributionSchema.optional(),
16519
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16520
- subLabel: string().optional(),
16521
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16522
- subLabelScore: number().optional(),
16523
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16524
- subLabelMeta: LabelAttributionSchema.optional()
16525
- };
16526
- /** Per-camera slice of a training-export estimate. */
16527
- var TrainingExportDeviceTotalsSchema = object({
16528
- deviceId: number(),
16529
- tracks: number().int(),
16530
- files: number().int(),
16531
- bytes: number().int()
16410
+ var PipelineStepInputSchema = lazy(() => object({
16411
+ addonId: string(),
16412
+ modelId: string().optional(),
16413
+ enabled: boolean().default(true),
16414
+ children: array(PipelineStepInputSchema).optional(),
16415
+ settings: record(string(), unknown()).optional(),
16416
+ jumpDeviceKey: string().optional()
16417
+ }));
16418
+ var ModelSubstitutionSchema = object({
16419
+ addonId: string(),
16420
+ chosen: string(),
16421
+ running: string(),
16422
+ format: string()
16423
+ });
16424
+ var PipelineValidationIssueSchema = object({
16425
+ addonId: string(),
16426
+ kind: _enum(["unknown-addon", "no-format-build"]),
16427
+ detail: string()
16428
+ });
16429
+ var PipelineValidationResultSchema = object({
16430
+ ok: boolean(),
16431
+ issues: array(PipelineValidationIssueSchema).readonly(),
16432
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16433
+ /** The node's `currentEngine.format` this validation ran against. */
16434
+ format: string()
16435
+ });
16436
+ var ReferenceImageEntrySchema = object({
16437
+ filename: string(),
16438
+ stepIds: array(string()).readonly().optional()
16439
+ });
16440
+ var ReferenceImageBodySchema = object({
16441
+ base64: string(),
16442
+ filename: string()
16443
+ });
16444
+ var ReferenceAudioEntrySchema = object({
16445
+ filename: string(),
16446
+ sizeKb: number()
16447
+ });
16448
+ var ReferenceAudioBodySchema = object({ base64: string() });
16449
+ var AudioBackendSchema = object({
16450
+ id: string(),
16451
+ name: string(),
16452
+ description: string(),
16453
+ available: boolean(),
16454
+ /**
16455
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16456
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16457
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16458
+ * specific to the selected backend without a separate fetch.
16459
+ */
16460
+ rawLabels: array(string()).readonly().optional()
16461
+ });
16462
+ var AudioCapabilitiesSchema = object({
16463
+ activeBackend: string(),
16464
+ availableBackends: array(AudioBackendSchema).readonly(),
16465
+ sampleRate: number(),
16466
+ chunkDurationMs: number()
16467
+ });
16468
+ var DownloadModelResultSchema = object({
16469
+ filePath: string(),
16470
+ sizeMB: number(),
16471
+ durationMs: number()
16532
16472
  });
16533
16473
  /**
16534
- * What a training export WOULD contain. Computed from media index rows only —
16535
- * no blob is read to produce this.
16474
+ * Wrapper carrying a single test run's result. Replaces the legacy
16475
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16476
+ * canonical `AudioResult` from the Phase 6 output rework: one
16477
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16478
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16479
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16480
+ * benchmark UI can still report a clean failure when the classifier
16481
+ * cap isn't available.
16536
16482
  */
16537
- var TrainingExportSummarySchema = object({
16538
- generatedAt: number(),
16539
- trackCount: number().int(),
16540
- fileCount: number().int(),
16541
- byteCount: number().int(),
16542
- /** More marked tracks exist than a single pass carries. */
16543
- truncated: boolean(),
16544
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16483
+ var AudioTestResultSchema = object({
16484
+ success: boolean(),
16485
+ error: string().optional(),
16486
+ frame: custom().optional()
16545
16487
  });
16546
- var TrackSchema = object({
16547
- trackId: string(),
16548
- deviceId: number(),
16549
- className: string(),
16550
- ...TieredLabelFields,
16551
- producingDeviceName: string().optional(),
16552
- /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16553
- source: TrackSourceSchema.optional(),
16554
- firstSeen: number(),
16555
- lastSeen: number(),
16556
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16557
- positions: array(TrackPositionSchema).readonly(),
16558
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16559
- * saveThumbnails policy). */
16560
- snapshots: array(TrackSnapshotSchema).readonly(),
16561
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16562
- zonesVisited: array(string()).readonly(),
16488
+ var PipelineConfigBridge = custom();
16489
+ var ConfigUISchemaBridge = custom();
16490
+ var ConfigUISchemaNullableBridge = custom();
16491
+ var InferenceCapabilitiesBridge = custom();
16492
+ var ModelAvailabilityListBridge = custom();
16493
+ var PipelineRunResultBridge = custom();
16494
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16495
+ modelId: string(),
16496
+ settings: record(string(), unknown()).readonly()
16497
+ }))), method(object({ steps: record(string(), object({
16498
+ modelId: string(),
16499
+ settings: record(string(), unknown()).readonly()
16500
+ })) }), object({ success: literal(true) }), {
16501
+ kind: "mutation",
16502
+ auth: "admin"
16503
+ }), method(object({ nodeId: string() }), object({
16504
+ success: literal(true),
16505
+ clearedDevices: number()
16506
+ }), {
16507
+ kind: "mutation",
16508
+ auth: "admin"
16509
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16510
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16511
+ deviceKey: string(),
16563
16512
  /**
16564
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16565
- * `zones` capability.
16566
- *
16567
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16568
- * and no card can render — so every free-text search surface was structurally
16569
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16570
- * just returned nothing. Resolving here rather than in each client keeps ONE
16571
- * derivation and costs the clients no extra call (the `zones` cap is
16572
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16573
- * surface built to avoid exactly that).
16574
- *
16575
- * Resolved, never invented: a zone deleted since the track was written has no
16576
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16577
- * two are not positionally aligned. Absent when the track visited no zone, or
16578
- * when the zone catalogue could not be read.
16513
+ * `failed` — the per-device restart budget is exhausted; no pool
16514
+ * will be spawned until an operator re-arms it or the runner
16515
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16516
+ * a cached pool observed dead and not yet condemned).
16579
16517
  */
16580
- zoneNames: array(string()).readonly().optional(),
16581
- /** Deduplicated set of detector classes observed for this track over its
16582
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16583
- * legacy rows written before class accumulation shipped. */
16584
- classes: array(string()).readonly().optional(),
16585
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16586
- totalDistance: number(),
16587
- state: TrackStateSchema,
16588
- active: boolean(),
16589
- /** Deterministic key-event importance score in [0,1] (server-computed at
16590
- * track expiry, recomputed on late label). Absent on legacy rows written
16591
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16592
- importance: number().optional(),
16593
- /** Id of the track's highest-confidence ObjectEvent (its representative
16594
- * "best" frame). Absent when the track produced no object events. */
16595
- bestEventId: string().optional(),
16596
- /** Tag of the importance sub-signal that dominated the score
16597
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16598
- importanceReason: string().optional(),
16599
- /** Audio-classification labels heard on the camera during the track's
16600
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16601
- * Absent on legacy rows / tracks with no confident audio. */
16602
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16603
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16604
- * Populated from the persisted envelope columns on historical reads;
16605
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16606
- envelope: TrackEnvelopeSchema.optional(),
16518
+ state: _enum(["failed", "backoff"]),
16519
+ /** Epoch ms of the death that produced this state. */
16520
+ since: number(),
16521
+ /** Pool deaths inside the current window. */
16522
+ deaths: number(),
16523
+ /** The last death's message. */
16524
+ lastError: string()
16525
+ })).readonly() })), method(object({
16526
+ nodeId: string(),
16527
+ deviceKey: string()
16528
+ }), object({ rearmed: boolean() }), {
16529
+ kind: "mutation",
16530
+ auth: "admin"
16531
+ }), 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({
16532
+ name: string(),
16533
+ steps: array(PipelineTemplateStepSchema).readonly(),
16534
+ engine: PipelineEngineChoiceSchema
16535
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16536
+ id: string(),
16537
+ name: string().optional(),
16538
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16539
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16540
+ addonId: string(),
16541
+ modelId: string(),
16542
+ format: ModelFormatSchema$1
16543
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16544
+ addonId: string(),
16545
+ modelId: string(),
16546
+ format: ModelFormatSchema$1
16547
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16548
+ engine: PipelineEngineChoiceSchema.optional(),
16549
+ steps: array(PipelineStepInputSchema).min(1),
16550
+ frame: FrameInputSchema.optional(),
16607
16551
  /**
16608
- * A face DETECTOR found a face on this track — nothing more. It says the
16609
- * detail plane produced a `face` detail; it does NOT say the face was
16610
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16611
- * enabled. Set once and never cleared.
16612
- *
16613
- * **This exists so "face present but not recognised" is expressible.** A
16614
- * recognised identity lands in `subLabel` (attributed to the face chain via
16615
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16616
- * and a track with no face at all were byte-identical on the wire and no
16617
- * surface could tell them apart. The read is `hasFace === true && subLabel
16618
- * === undefined`.
16619
- *
16620
- * **Absent ≠ false.** Every row written before the column existed omits it,
16621
- * and so does every server that predates the field — a consumer must test
16622
- * `=== true` and render nothing otherwise, never infer "no face".
16552
+ * Process-local lazy frame. Valid only when caller and provider resolve
16553
+ * in the same execution-group process; split/cross-node callers use
16554
+ * `frame`/`image` inline compatibility instead.
16623
16555
  */
16624
- hasFace: boolean().optional(),
16556
+ frameRef: FrameRefSchema.optional(),
16625
16557
  /**
16626
- * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
16627
- * face an operator could ASSIGN to an identity.
16628
- *
16629
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16630
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16631
- * branch, before every gate, and means no more than "a face detector produced
16632
- * a face detail". This one is stamped at the single moment the gallery row
16633
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16634
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16635
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16636
- * the crop-store drop. Everything between the detector and that insert can
16637
- * legitimately refuse the face, so a flag written any earlier promises the
16638
- * operator something to assign and delivers nothing.
16639
- *
16640
- * **Independent of recognition.** A face collected but never auto-matched is
16641
- * still assignable — it is in fact the face an operator most wants to reach —
16642
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16643
- * `subLabel`; this says only that the raw material exists.
16644
- *
16645
- * **Set once, never cleared.** A track that produced a gallery row produced
16646
- * one; deleting the row later is the gallery's business, not this flag's.
16647
- *
16648
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16649
- * before the column omits it, and so does every server that predates the
16650
- * field. A consumer must test `=== true` and render nothing otherwise —
16651
- * never infer "no assignable face".
16558
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
16559
+ * the decoded pixels live in. One more member of the one-of
16560
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16652
16561
  */
16653
- hasEmbeddedFace: boolean().optional(),
16562
+ frameHandle: FrameHandleSchema.optional(),
16563
+ imageBase64: string().optional(),
16654
16564
  /**
16655
- * This subject CONTAINS a folded rider — a person the rider-pairing step
16656
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16657
- * so the passage is tracked once and as a VEHICLE.
16658
- *
16659
- * It exists because the fold's record was dishonest. D34 and the code both
16660
- * said "the person is not lost — it is reported so both entities stay on the
16661
- * record"; in fact the pair went into a per-processor RAM field behind an
16662
- * accessor nobody called, and every durable surface said `vehicle`, full
16663
- * stop. This is the composition note that makes the row true.
16664
- *
16665
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16666
- * person" is not an answer to "what is this" — both label tiers would refuse
16667
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16668
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16669
- * and a `person` rule still does not fire for someone cycling past.
16670
- *
16671
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16672
- * the column, and every hub that predates the field, omits it. Test
16673
- * `=== true` and render nothing otherwise — never infer "no rider".
16565
+ * Binary JPEG bytes — preferred over `imageBase64` on internal
16566
+ * hops (hub → forked worker via Moleculer MsgPack) because it
16567
+ * skips the 33% base64 overhead + the per-call base64 decode on
16568
+ * the detection-pipeline worker. Callers can pass either; exactly
16569
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16674
16570
  */
16675
- hasRider: boolean().optional(),
16676
- ...TrackFlagFields,
16677
- ...TrackRetrainFields
16678
- });
16679
- var BaseEventFields = {
16680
- id: string(),
16681
- deviceId: number(),
16682
- timestamp: number()
16683
- };
16684
- var MotionEventSchema = object({
16685
- ...BaseEventFields,
16686
- kind: literal("motion"),
16687
- regionCount: number(),
16688
- /** Heavy JSON array — omitted in slim projection. */
16689
- regions: array(object({
16690
- bbox: BoundingBoxSchema,
16691
- pixelCount: number(),
16692
- intensity: number()
16693
- })).readonly().optional(),
16694
- /** Omitted in slim projection. */
16695
- frameWidth: number().optional(),
16696
- /** Omitted in slim projection. */
16697
- frameHeight: number().optional(),
16698
- /** Populated by B5 (recording playback URL for this event). */
16699
- mediaUrl: string().optional()
16700
- });
16571
+ image: _instanceof(Uint8Array).optional(),
16572
+ referenceImage: string().optional(),
16573
+ deviceId: number().optional(),
16574
+ sessionId: string().optional(),
16575
+ /**
16576
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16577
+ * reference-image, and detail-subtree calls. 'frame' is the live
16578
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16579
+ * (inputClasses ≠ null) are skipped and served per-track via
16580
+ * pipelineRunner.runDetailSubtree (two-plane design).
16581
+ */
16582
+ plane: _enum(["full", "frame"]).optional(),
16583
+ /**
16584
+ * Inference-device selector (Phase 2 multi-device). Format
16585
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16586
+ * Omitted ⇒ the runner's default device (current single-engine
16587
+ * behaviour). Selects WHICH device pool of the node runs the call.
16588
+ */
16589
+ deviceKey: string().optional(),
16590
+ /**
16591
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16592
+ * when the parent crop was resolved from the frame's retained NATIVE
16593
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16594
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16595
+ * resolution from that surface — the SAME quality path faces already
16596
+ * had — instead of the downscaled parent tile. `handle` keys the native
16597
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16598
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16599
+ * the executor's crop-normalized child ROI back into frame-normalized
16600
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16601
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16602
+ * (today's behaviour on the fallback path).
16603
+ */
16604
+ nativeCropRef: NativeCropRefSchema.optional()
16605
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16606
+ engine: PipelineEngineChoiceSchema.optional(),
16607
+ steps: array(PipelineStepInputSchema).min(1),
16608
+ frames: array(FrameInputSchema).min(1).max(255),
16609
+ deviceId: number().optional(),
16610
+ sessionId: string().optional(),
16611
+ /**
16612
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16613
+ * the batch to the Python pool's bench preprocess cache
16614
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16615
+ * preprocessed ONCE and every later inference is a pure-inference cache
16616
+ * hit — the sustained-throughput run measures inference, not
16617
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16618
+ * full preprocess every call, correct). Fresh per sustained run;
16619
+ * released via `uncacheFrame`.
16620
+ */
16621
+ frameId: number().int().nonnegative().optional(),
16622
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16623
+ deviceKey: string().optional()
16624
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16625
+ data: _instanceof(Uint8Array),
16626
+ width: number().int().positive(),
16627
+ height: number().int().positive(),
16628
+ format: _enum([
16629
+ "rgb",
16630
+ "bgr",
16631
+ "gray"
16632
+ ])
16633
+ }), object({
16634
+ frameId: number(),
16635
+ width: number(),
16636
+ height: number()
16637
+ }), { kind: "mutation" }), method(object({
16638
+ stepId: string(),
16639
+ frameId: number().int()
16640
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16641
+ batchMode: string(),
16642
+ windowMs: number(),
16643
+ maxBatchSize: number(),
16644
+ concurrency: number()
16645
+ })), method(_void(), array(object({
16646
+ engineKey: string(),
16647
+ engine: PipelineEngineChoiceSchema,
16648
+ modelsLoaded: array(string()).readonly(),
16649
+ inUseByCameras: array(number()).readonly(),
16650
+ /**
16651
+ * Origin of this resident factory.
16652
+ * - `runtime` — main camera-serving engine (no idle TTL).
16653
+ * - `warm-override` — benchmark/test override held in the warm
16654
+ * cache; auto-disposed after the idle TTL.
16655
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16656
+ * multi-device, keyed by `deviceKey`) resolved
16657
+ * via `resolveDeviceFactory`. Runs alongside the
16658
+ * `runtime` engine on a DIFFERENT accelerator
16659
+ * (NPU / iGPU / Coral) — this is how the
16660
+ * Engines tab shows all pools running at once.
16661
+ */
16662
+ kind: _enum([
16663
+ "runtime",
16664
+ "warm-override",
16665
+ "device-pool"
16666
+ ]),
16667
+ /** Native pid of the underlying Python pool (null when no pool). */
16668
+ poolPid: number().nullable(),
16669
+ /** ms since this factory was last used (null when not warm-tracked). */
16670
+ idleMs: number().nullable(),
16671
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16672
+ idleTtlMs: number().nullable()
16673
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16674
+ kind: "mutation",
16675
+ auth: "admin"
16676
+ }), method(object({
16677
+ engine: PipelineEngineChoiceSchema,
16678
+ force: boolean().optional()
16679
+ }), object({
16680
+ success: boolean(),
16681
+ reason: string().optional()
16682
+ }), {
16683
+ kind: "mutation",
16684
+ auth: "admin"
16685
+ }), 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({
16686
+ addonId: string(),
16687
+ modelId: string(),
16688
+ filename: string().optional(),
16689
+ settings: record(string(), unknown()).optional()
16690
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16701
16691
  /**
16702
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16703
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16704
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16705
- * tracking, per-kind persistence) but stay distinguishable so consumers
16706
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16707
- * Absent on legacy rows ⇒ treat as `pipeline`.
16692
+ * Per-stage gating mode applied to the zones a rule references.
16693
+ *
16694
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16695
+ * When at least one `include` rule fires for a stage, only entities
16696
+ * inside one of those zones pass that stage.
16697
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16698
+ * Entities inside one of those zones are dropped at that stage.
16699
+ *
16700
+ * `monitor`-style observation (count without filtering) is not a rule
16701
+ * mode — zones without any matching rule are observed naturally by
16702
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16703
+ * count, not filter" use case needs no rule at all.
16708
16704
  */
16709
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16705
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16710
16706
  /**
16711
- * The confirmed zone crossing that produced an object event. Present ONLY on
16712
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16713
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16714
- * appearance event carry none, so a rule asking for a direction fails closed
16715
- * on them.
16707
+ * Per-consumer rule that references existing zones (geometry) and
16708
+ * defines how a specific pipeline stage should treat them. Each
16709
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16710
+ * settings:
16716
16711
  *
16717
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16718
- * into its own event, so a frame in which a track enters A while leaving B
16719
- * produces two events with two directions — never one ambiguous row.
16712
+ * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
16713
+ * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
16714
+ * - future: notification rules, audio gating, etc.
16720
16715
  *
16721
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16722
- * membership the box has NOW, and by definition it no longer contains the zone
16723
- * that was just left. Without the id here, a zone-scoped rule could never match
16724
- * the exit it asked for.
16716
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16717
+ * express "ignore motion in ALL of {garden, street}" with a single
16718
+ * rule. `classFilter` narrows the rule to specific object classes —
16719
+ * "drop person detections in the street, but keep cars" is one
16720
+ * `exclude` rule with `classFilter: ['person']`.
16721
+ *
16722
+ * `enabled` is a soft toggle — the operator can keep the rule
16723
+ * configured but inert without deleting it.
16725
16724
  */
16726
- var ZoneCrossingSchema = object({
16727
- direction: _enum(["enter", "exit"]),
16728
- /** Admin zone id crossed. */
16729
- zoneId: string(),
16730
- /** Zone display name at crossing time (falls back to the id). */
16731
- zoneName: string().optional()
16732
- });
16733
- var ObjectEventSchema = object({
16734
- ...BaseEventFields,
16735
- kind: literal("object"),
16736
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16737
- source: DetectionSourceSchema.optional(),
16725
+ var ZoneRuleSchema = object({
16726
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16727
+ id: string(),
16728
+ /** Optional human-readable label rendered in the rule editor. */
16729
+ name: string().optional(),
16730
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16731
+ * listed zones (OR-set: a detection in any one of them counts).
16732
+ * At least one zone id required — a rule with no targets is a
16733
+ * configuration mistake and the form validator rejects it. */
16734
+ zoneIds: array(string()).min(1).readonly(),
16735
+ mode: ZoneRuleModeEnum,
16738
16736
  /**
16739
- * Inference-frame id shared by every object event emitted from the SAME frame
16740
- * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16741
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16742
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16743
- * Optional for backward-compat with pre-existing rows / the slim projection
16744
- * includes it (it is light). Absent on rows written before this field.
16745
- */
16746
- frameId: string().optional(),
16747
- /** Omitted in slim projection. */
16748
- trackId: string().optional(),
16749
- className: string(),
16750
- ...TieredLabelFields,
16751
- /** Omitted in slim projection. */
16752
- confidence: number().optional(),
16753
- /** Heavy JSON — omitted in slim projection. */
16754
- bbox: BoundingBoxSchema.optional(),
16755
- /** Heavy JSON — omitted in slim projection. */
16756
- zones: array(string()).readonly().optional(),
16757
- /** Omitted in slim projection. */
16758
- state: TrackStateSchema.optional(),
16737
+ * Class names this rule applies to. Empty / undefined ⇒ rule
16738
+ * applies to every class. Class strings match the `macroClass`
16739
+ * field on detections (e.g. `person`, `car`, `dog`).
16740
+ */
16741
+ classFilter: array(string()).readonly().optional(),
16759
16742
  /**
16760
- * The zone crossing this event IS, when it is one. Absent on every other
16761
- * event kind (movement state, appearance, package) — see
16762
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16743
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16744
+ * required to consider an entity "in the zone". Defaults to the
16745
+ * consumer's stage default when omitted. Kept for back-compat with
16746
+ * existing per-rule overrides; new operators pick the value via
16747
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16748
+ * set, the lower-level engine reads it as a 0–1 fraction.
16763
16749
  */
16764
- zoneCrossing: ZoneCrossingSchema.optional(),
16765
- /** Detection-frame dimensions in pixels — let consumers normalize the
16766
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
16767
- frameWidth: number().optional(),
16768
- frameHeight: number().optional(),
16769
- /** MediaStore key for the crop attached to this event (if any). */
16770
- mediaKey: string().optional(),
16771
- /** Design B: MediaStore key of the track's native-resolution key frame (the
16772
- * best-detection full frame). Resolve via the event-media data-plane
16773
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
16774
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
16775
- * sources — consumers fall back to `mediaKey` (the tight crop). */
16776
- keyFrameMediaKey: string().optional(),
16777
- /** Populated by B5 (recording playback URL for this event). */
16778
- mediaUrl: string().optional(),
16779
- /** The parent track's key-event importance [0,1], propagated to every object
16780
- * event of the track (so an event row can be sorted by importance without a
16781
- * track join). Absent on legacy rows / before the track was scored. */
16782
- importance: number().optional()
16783
- });
16784
- var AudioEventSchema = object({
16785
- ...BaseEventFields,
16786
- kind: literal("audio"),
16787
- rms: number(),
16788
- dbfs: number(),
16789
- classification: object({
16790
- className: string(),
16791
- originalClass: string().optional(),
16792
- score: number()
16793
- }).optional(),
16794
- /** Populated by B5 (recording playback URL for this event). */
16795
- mediaUrl: string().optional()
16796
- });
16797
- var MediaFileKindEnum = _enum([
16798
- "crop",
16799
- "thumbnail",
16800
- "snapshot",
16801
- "firstFrame",
16802
- "lastFrame",
16803
- "fullFrame",
16804
- "fullFrameBoxed",
16805
- "faceCrop",
16806
- "plateCrop",
16807
- "keyFrame",
16808
- "keyFrameSmall",
16809
- "thumbnailSmall"
16810
- ]);
16811
- var MediaFileSchema = object({
16812
- key: string(),
16813
- kind: MediaFileKindEnum,
16814
- base64: string(),
16815
- sizeBytes: number(),
16816
- timestamp: number()
16750
+ overlapThreshold: number().min(0).max(1).optional(),
16751
+ /**
16752
+ * Operator-friendly version of `overlapThreshold` — the percentage
16753
+ * of the detection's bbox that must lie inside the zone for the
16754
+ * rule to match. Documented default is 85%; the engine substitutes
16755
+ * that when the field is omitted (kept optional so existing rules
16756
+ * stored without it stay valid).
16757
+ *
16758
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16759
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16760
+ * field exposed in the UI. Internally both feed the same gate.
16761
+ */
16762
+ bboxInclusionPct: number().min(0).max(100).optional(),
16763
+ /**
16764
+ * When `true` and a detection has a segmentation mask, use the
16765
+ * mask for overlap instead of the bbox. Detection-stage only;
16766
+ * motion rules ignore this field.
16767
+ */
16768
+ preferMask: boolean().optional(),
16769
+ /**
16770
+ * Soft-toggle: `false` disables the rule without deleting it.
16771
+ * Defaults to `true` so operators creating a rule via the UI
16772
+ * see it active immediately.
16773
+ */
16774
+ enabled: boolean().default(true)
16817
16775
  });
16776
+ array(ZoneRuleSchema).readonly();
16818
16777
  /**
16819
- * One media row WITHOUT its bytes.
16778
+ * Zone — pure geometry + identity. NO filtering behaviour.
16820
16779
  *
16821
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
16822
- * 140 s track), and a client that renders tiles from the media data plane needs
16823
- * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
16824
- * with an immutable cache, instead of all at once inside a tRPC response that
16825
- * blocks the whole view.
16780
+ * Zones describe **where** in the frame the operator wants to flag
16781
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16782
+ * each pipeline stage uses them. Splitting the two means a single
16783
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16784
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16785
+ * — without three duplicated polygons.
16826
16786
  *
16827
- * `sizeBytes` is carried because it is what lets a client decide between the
16828
- * stored blob and a `?variant=thumb` rendering without fetching either.
16787
+ * Owned by the orchestrator addon (provider) and mirrored into the
16788
+ * `zones` device-state slice on every mutation. Consumers
16789
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16790
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16791
+ * mirror with `onChanged`).
16792
+ *
16793
+ * Coordinates are normalised fractions of the frame (0–1) so zones
16794
+ * survive resolution changes and stream profile switches.
16795
+ *
16796
+ * `kind` discriminates between full polygons (closed regions used
16797
+ * for intrusion / occupancy filters) and tripwires (open 2-point
16798
+ * line segments used for cross events). Onboard / firmware-reported
16799
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
16800
+ * task list.
16829
16801
  */
16830
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
16802
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
16803
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
16804
+ var PolygonPointSchema = object({
16805
+ x: number(),
16806
+ y: number()
16807
+ });
16808
+ /** A camera detection zone — pure geometry/identity. */
16809
+ var ZoneSchema = object({
16810
+ id: string(),
16811
+ name: string(),
16812
+ kind: ZoneKindEnum.default("polygon"),
16813
+ /** Polygon vertices, fraction of frame (0–1). */
16814
+ polygon: array(PolygonPointSchema).readonly(),
16815
+ /** Visual color for UI rendering. */
16816
+ color: string().default("#3b82f6")
16817
+ });
16818
+ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
16819
+ deviceId: number(),
16820
+ zone: ZoneSchema
16821
+ }), _void(), {
16822
+ kind: "mutation",
16823
+ auth: "admin"
16824
+ }), method(object({
16825
+ deviceId: number(),
16826
+ zoneId: string()
16827
+ }), _void(), {
16828
+ kind: "mutation",
16829
+ auth: "admin"
16830
+ }), method(object({
16831
+ deviceId: number(),
16832
+ zone: ZoneSchema
16833
+ }), _void(), {
16834
+ kind: "mutation",
16835
+ auth: "admin"
16836
+ }), object({ zones: array(ZoneSchema).readonly() });
16831
16837
  /**
16832
- * The MACRO tier of an annotation — a CLOSED set.
16838
+ * pipeline-analytics — device-scoped wrapper cap. Refines raw
16839
+ * per-frame detections emitted by the pipeline runner into tracked
16840
+ * objects, per-kind event collections (motion / object / audio), and
16841
+ * persisted media. Owns the post-detection domain end-to-end:
16833
16842
  *
16834
- * This is what the exported detector predicts, so a typo here is a new class
16835
- * with one example in it. `label` and `subLabel` are open strings by contrast:
16836
- * the whole point of the page is teaching the model things it does not know
16837
- * yet, and constraining that vocabulary would make it useless.
16843
+ * runner emits PipelineInferenceResult
16844
+ * ↓ (event bus)
16845
+ * pipeline-analytics subscriber
16846
+ * ↓ SORT tracker + zone engine + state analyzer + event emitter
16847
+ * → three DB collections (one per kind), one FS media tree, one
16848
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
16849
+ * DetectionEvent on bus)
16838
16850
  *
16839
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
16840
- * `subLabel` is one of these values, in any casing, because once `person`
16841
- * exists in both tiers "every person box" stops being answerable without
16842
- * knowing every string anyone ever typed — and the damage is retroactive.
16851
+ * Pure subscriber model. No `processFrame` cap method — the runner
16852
+ * already publishes the raw frame on the bus. The cap surface is
16853
+ * only QUERIES + per-device settings, bound on/off via
16854
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
16855
+ * every camera with a detection pipeline wants its raw detections
16856
+ * refined; operators opt out per-device via BindingsTab when needed.
16857
+ *
16858
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16859
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
16843
16860
  */
16844
- var RetrainMacroClassSchema = _enum([
16861
+ var TrackStateSchema = _enum([
16862
+ "new",
16863
+ "entered",
16864
+ "left",
16865
+ "moving",
16866
+ "idle"
16867
+ ]);
16868
+ var EventKindSchema = _enum([
16869
+ "motion",
16870
+ "object",
16871
+ "audio"
16872
+ ]);
16873
+ /**
16874
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16875
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16876
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
16877
+ */
16878
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16879
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
16880
+ var EventKindIconSchema = _enum([
16881
+ "motion",
16882
+ "audio",
16845
16883
  "person",
16846
16884
  "vehicle",
16847
16885
  "animal",
16886
+ "door",
16887
+ "pir",
16888
+ "smoke",
16889
+ "water",
16890
+ "button",
16848
16891
  "package",
16849
- "face",
16850
- "plate"
16892
+ "generic"
16851
16893
  ]);
16852
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
16853
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
16854
- /** Did a human draw this box, or did the assist propose it? */
16855
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
16856
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
16857
- var RetrainBboxSchema = object({
16858
- x: number(),
16859
- y: number(),
16860
- w: number(),
16861
- h: number()
16862
- });
16863
- /**
16864
- * One annotated subject.
16865
- *
16866
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
16867
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
16868
- * derived from it at export and never stored — storing them is how one feature
16869
- * space ends up holding two crops of the same subject (D52).
16870
- */
16871
- var RetrainAnnotationSchema = object({
16872
- id: string(),
16873
- trackId: string(),
16874
- deviceId: number(),
16875
- /** The COPY in retrain storage — never the source track's media key. */
16876
- mediaKey: string(),
16877
- bbox: RetrainBboxSchema,
16878
- macroClass: RetrainMacroClassSchema,
16879
- label: string().optional(),
16880
- subLabel: string().optional(),
16881
- kind: RetrainAnnotationKindSchema,
16882
- source: RetrainAnnotationSourceSchema,
16883
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
16884
- assistModelId: string().optional(),
16885
- assistScore: number().optional(),
16886
- exportedInBatch: string().optional(),
16887
- createdAt: number()
16888
- });
16889
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
16890
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
16891
- id: true,
16892
- trackId: true,
16893
- deviceId: true,
16894
- mediaKey: true,
16895
- createdAt: true,
16896
- exportedInBatch: true
16894
+ var EventKindCategorySchema = _enum([
16895
+ "motion",
16896
+ "audio",
16897
+ "detection",
16898
+ "sensor",
16899
+ "control",
16900
+ "custom",
16901
+ "package"
16902
+ ]);
16903
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16904
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16905
+ var EventKindDescriptorSchema = object({
16906
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16907
+ kind: string(),
16908
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16909
+ labelKey: string(),
16910
+ /** English fallback label (kept for clients that don't translate). */
16911
+ label: string(),
16912
+ /** Hex color for timeline/legend rendering. */
16913
+ color: string(),
16914
+ /** Dictionary id → lucide component on the UI side. */
16915
+ iconId: string(),
16916
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16917
+ icon: EventKindIconSchema,
16918
+ category: EventKindCategorySchema,
16919
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16920
+ parentKind: string().nullable(),
16921
+ /** Derived from `parentKind`, explicit for the client tree. */
16922
+ level: EventKindLevelSchema,
16923
+ /** Which cap + device contributes this kind. For built-ins the camera
16924
+ * itself; for sensor kinds the LINKED source device. */
16925
+ source: object({
16926
+ capName: string(),
16927
+ deviceId: number()
16928
+ })
16897
16929
  });
16898
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
16899
- var RetrainTrackSchema = object({
16900
- trackId: string(),
16930
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16931
+ var EventKindsForDeviceSchema = object({
16901
16932
  deviceId: number(),
16902
- className: string(),
16903
- label: string().optional(),
16904
- firstSeen: number(),
16905
- lastSeen: number(),
16906
- /** How many frames the dataset already holds from this track. */
16907
- frameCount: number().int(),
16908
- /** How many subjects have been annotated on those frames. `0` with
16909
- * `frameCount: 0` is exactly "staging, still to work". */
16910
- annotationCount: number().int()
16911
- });
16912
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
16913
- var RetrainFrameCandidateSchema = object({
16914
- mediaKey: string(),
16915
- kind: MediaFileKindEnum,
16916
- timestamp: number(),
16917
- sizeBytes: number().int(),
16918
- /** A copy of this original already exists — selecting it is free and cannot
16919
- * fail, whatever became of the original. */
16920
- copied: boolean()
16933
+ kinds: array(EventKindDescriptorSchema).readonly()
16921
16934
  });
16922
- /** A frame the dataset OWNS: bytes copied at selection time. */
16923
- var RetrainFrameSchema = object({
16924
- frameId: string(),
16935
+ var SensorEventSchema = object({
16936
+ id: string(),
16937
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
16938
+ * yields N rows, one per camera). */
16925
16939
  deviceId: number(),
16926
- trackId: string(),
16927
- /** Provenance only. It may already point at nothing — that is expected. */
16928
- sourceMediaKey: string(),
16929
- sourceKind: MediaFileKindEnum,
16930
- sizeBytes: number().int(),
16931
- width: number().int(),
16932
- height: number().int(),
16933
- copiedAt: number()
16940
+ /** The linked sensor device whose state changed. */
16941
+ sourceDeviceId: number(),
16942
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
16943
+ kind: string(),
16944
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
16945
+ value: record(string(), unknown()).nullable(),
16946
+ timestamp: number()
16934
16947
  });
16935
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
16936
- var RetrainCopyRefusalSchema = _enum([
16937
- "source-missing",
16938
- "unreadable-image",
16939
- "write-failed"
16940
- ]);
16941
- var RetrainFrameSelectionSchema = object({
16942
- copied: array(RetrainFrameSchema).readonly(),
16943
- refused: array(object({
16944
- sourceMediaKey: string(),
16945
- reason: RetrainCopyRefusalSchema
16946
- })).readonly()
16948
+ var TrackPositionSchema = object({
16949
+ x: number(),
16950
+ y: number(),
16951
+ timestamp: number(),
16952
+ bbox: BoundingBoxSchema
16947
16953
  });
16948
- var RetrainFrameListSchema = object({
16949
- candidates: array(RetrainFrameCandidateSchema).readonly(),
16950
- copies: array(RetrainFrameSchema).readonly(),
16951
- /** What the page pre-selects — the native key frame when one survives. */
16952
- autoPickMediaKey: string().optional()
16954
+ var TrackSnapshotSchema = object({
16955
+ timestamp: number(),
16956
+ position: TrackPositionSchema,
16957
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16958
+ mediaKey: string()
16953
16959
  });
16954
- /** What the operator asked the assist to look for. */
16955
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
16956
- kind: literal("package"),
16957
- zone: RetrainBboxSchema.optional()
16958
- }), object({
16959
- kind: literal("objects"),
16960
- modelId: string(),
16961
- minScore: number().optional()
16962
- })]);
16963
16960
  /**
16964
- * The assist's answer — a discriminated union, because "the model saw nothing"
16965
- * and "this node cannot run that model" lead to different next moves and a
16966
- * nullable result cannot tell them apart.
16961
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16962
+ * divided by the track's detection-frame dims), computed at persist time.
16963
+ * Absent when the frame dims were unknown when the track was persisted
16964
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16967
16965
  */
16968
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
16969
- kind: literal("proposed"),
16970
- modelId: string(),
16971
- stepId: string(),
16972
- minScore: number(),
16973
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
16974
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
16975
- /** Returned by the runner but removed by the threshold. */
16976
- belowThreshold: number().int()
16977
- }), object({
16978
- kind: literal("refused"),
16979
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
16980
- reason: string(),
16981
- detail: string().optional()
16982
- })]);
16983
- /** The outcome of a lifecycle move owned by the retrain page. */
16984
- var RetrainTransitionResultSchema = object({
16985
- trackId: string(),
16986
- /** Where the track ended up, whatever happened. */
16987
- retrainStatus: RetrainStatusSchema,
16988
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
16989
- changed: boolean(),
16990
- reason: _enum([
16991
- "unknown-track",
16992
- "no-frames-copied",
16993
- "not-staging",
16994
- "not-trained",
16995
- "unchanged"
16996
- ]).optional()
16997
- });
16998
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
16999
- var MAX_EVENT_QUERY_LIMIT = 5e3;
17000
- var DeviceEventQueryInput = object({
17001
- deviceId: number(),
17002
- since: number().optional(),
17003
- until: number().optional(),
17004
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17005
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17006
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17007
- * exact behaviour. Callers may omit this field — the store defaults to
17008
- * `full` when not provided. */
17009
- projection: _enum(["full", "slim"]).optional()
17010
- });
17011
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17012
- var RecentTracksQueryInput = object({
17013
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17014
- deviceIds: array(number()),
17015
- /** Window lower bound on `lastSeen` (inclusive). */
17016
- since: number().optional(),
17017
- /** Window upper bound on `lastSeen` (inclusive). */
17018
- until: number().optional(),
17019
- /** Page size. Default 200, max 1000. */
17020
- limit: number().int().min(1).max(1e3).default(200),
17021
- /** Opaque continuation cursor from a previous page's `nextCursor`.
17022
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17023
- cursor: string().optional(),
17024
- /** See {@link TrackProjectionSchema}. Default `full`. */
17025
- projection: TrackProjectionSchema.optional(),
17026
- /** Include stationary-promoted rows (parked objects). Default false: the
17027
- * feed lists passages; parking records live on the stationary registry. */
17028
- includeStationary: boolean().optional()
16966
+ var TrackEnvelopeSchema = object({
16967
+ minX: number(),
16968
+ minY: number(),
16969
+ maxX: number(),
16970
+ maxY: number()
17029
16971
  });
17030
- var RecentTracksPageSchema = object({
17031
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17032
- tracks: array(TrackSchema).readonly(),
17033
- /** Cursor for the next page, or null when this page is the last. */
17034
- nextCursor: string().nullable()
17035
- });
17036
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
17037
- var LIST_GROUPS_MAX_LIMIT = 100;
17038
- var AnalyticsGroupRecordSchema = object({
17039
- id: string(),
17040
- deviceId: number().int(),
17041
- openedAt: number().int(),
17042
- closedAt: number().int(),
17043
- timestamp: number().int(),
17044
- memberCount: number().int(),
17045
- memberTrackIds: array(string()).readonly(),
17046
- className: string(),
17047
- classes: array(string()).readonly(),
17048
- /** Relative event-media path, or null when the group has no picture yet. */
17049
- mediaUrl: string().nullable(),
17050
- singleton: boolean()
17051
- });
17052
- var AnalyticsGroupMemberSchema = object({
17053
- trackId: string(),
17054
- deviceId: number().int(),
17055
- className: string(),
17056
- firstSeen: number().int(),
17057
- lastSeen: number().int(),
17058
- mediaUrl: string().nullable()
17059
- });
17060
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17061
- var ListGroupsQueryInput = object({
17062
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17063
- deviceIds: array(number()),
17064
- /** Window lower bound on `closedAt` (inclusive). */
17065
- since: number().optional(),
17066
- /** Window upper bound on `openedAt` (inclusive). */
17067
- until: number().optional(),
17068
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17069
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
17070
- cursor: string().optional()
17071
- });
17072
- var ListGroupsPageSchema = object({
17073
- groups: array(AnalyticsGroupRecordSchema).readonly(),
17074
- nextCursor: string().nullable()
17075
- });
17076
- var KeyEventQueryInput = object({
17077
- deviceId: number(),
17078
- /** Window lower bound (track firstSeen ≥ since). */
17079
- since: number(),
17080
- /** Window upper bound (track firstSeen ≤ until). */
17081
- until: number(),
17082
- limit: number().int().min(1).max(200).default(50),
17083
- /** Drop tracks scoring below this importance. */
17084
- minImportance: number().min(0).max(1).optional(),
17085
- /** Restrict to a single class (e.g. 'person'). */
17086
- classFilter: string().optional()
17087
- });
17088
- var KeyEventSchema = object({
17089
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
17090
- id: string(),
17091
- trackId: string(),
17092
- /** Track start time (firstSeen). */
17093
- timestamp: number(),
17094
- className: string(),
17095
- ...TieredLabelFields,
17096
- importance: number(),
17097
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
17098
- bestEventId: string(),
17099
- /** Track lifetime in ms (lastSeen - firstSeen). */
17100
- windowMs: number().optional(),
17101
- ...TrackFlagFields,
17102
- ...TrackRetrainFields
17103
- });
17104
- object({
17105
- trackId: string(),
17106
- className: string(),
17107
- confidence: number(),
17108
- bbox: BoundingBoxSchema,
17109
- zones: array(string()).readonly(),
17110
- state: TrackStateSchema
17111
- });
17112
- var OverlayDetectionSchema = looseObject({
17113
- id: string(),
17114
- kind: _enum(["first-level", "detail"]),
17115
- macroClass: string(),
17116
- score: number(),
17117
- bbox: object({
17118
- x: number(),
17119
- y: number(),
17120
- width: number(),
17121
- height: number()
17122
- }),
17123
- labels: array(looseObject({
17124
- label: string(),
17125
- score: number()
17126
- })).readonly(),
17127
- parentId: string().optional()
17128
- });
17129
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17130
- var SearchObjectEventsInput = object({
17131
- text: string(),
17132
- deviceId: number().optional(),
17133
- since: number().optional(),
17134
- until: number().optional(),
17135
- classFilter: string().optional(),
17136
- limit: number().default(50),
17137
- minScore: number().min(0).max(1).default(.2)
17138
- });
17139
- var TrackCascadeCountsSchema = object({
17140
- /** Persisted track roots deleted (authoritative). */
17141
- tracks: number().int(),
17142
- /** Object events removed with their tracks (best-effort; see note above). */
17143
- events: number().int(),
17144
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17145
- media: number().int(),
17146
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17147
- faces: number().int(),
17148
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17149
- plates: number().int(),
17150
- /** Per-track CLIP search vectors removed (best-effort). */
17151
- embeddings: number().int(),
17152
- /** Group membership + group rows removed with their last member (best-effort). */
17153
- groups: number().int()
17154
- });
17155
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17156
- var DiskReconcileCountsSchema = object({
17157
- mediaDropped: number().int(),
17158
- tracks: number().int(),
17159
- events: number().int()
17160
- });
17161
- /** Event-store footprint for one camera. */
17162
- var EventStoreDeviceFootprintSchema = object({
17163
- deviceId: number(),
17164
- /** Persisted event rows (motion + object + audio) for the camera. */
17165
- rows: number().int(),
17166
- /** Event-owned media bytes on disk for the camera. */
17167
- bytes: number().int()
17168
- });
17169
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17170
- var EventStoreFootprintSchema = object({
17171
- totalRows: number().int(),
17172
- totalBytes: number().int(),
17173
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17174
- });
17175
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17176
- var EventPruneCountsSchema = object({
17177
- motion: number().int(),
17178
- object: number().int(),
17179
- audio: number().int()
16972
+ /**
16973
+ * Row projection for track list queries. `full` (default) returns the
16974
+ * complete Track including the frame-rate `positions[]` history and the
16975
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
16976
+ * keeps every scalar the list surfaces actually render (ids, class(es),
16977
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16978
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16979
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16980
+ * `getTrack`. Mirrors the event-store `projection` convention
16981
+ * (`getObjectEvents` et al.).
16982
+ */
16983
+ var TrackProjectionSchema = _enum(["full", "slim"]);
16984
+ /**
16985
+ * One audio-classification label heard on the track's camera while the
16986
+ * track was alive, aggregated per label. An "episode" is one persisted
16987
+ * audio event (the confident-classification path: score ≥ the device's
16988
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16989
+ * one 32 ms inference chunk, so counts stay human-scaled.
16990
+ */
16991
+ var TrackAudioLabelSchema = object({
16992
+ label: string(),
16993
+ /** Highest classification score observed across the label's episodes. */
16994
+ peakScore: number(),
16995
+ /** Number of coalesced audio-event episodes carrying this label. */
16996
+ count: number(),
16997
+ firstAt: number(),
16998
+ lastAt: number()
17180
16999
  });
17181
17000
  /**
17182
- * Re-embed stored tracks from their key frames.
17001
+ * How a track was produced. `pipeline` (default / absent) = the spatial
17002
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
17003
+ * no positions, a single snapshot, and no bbox trajectory at all:
17183
17004
  *
17184
- * The reason this is an operator-callable method and not a migration script:
17185
- * every knob that decides what a vector MEANS — encoder model, crop margin,
17186
- * squaring — is only changeable if the existing vectors can be regenerated.
17187
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17188
- * symptom is a quality regression with no visible cause.
17005
+ * - `sensor` — a linked sensor/control device state change.
17006
+ * - `audio` — an audio event on the camera itself that was anomalous for
17007
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
17008
+ *
17009
+ * The spatial subsystems (tracker association, occupancy count, re-id /
17010
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
17011
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
17012
+ * check silently readmits every source added after it was written.
17189
17013
  */
17190
- var RebuildObjectEmbeddingsInput = object({
17191
- /** Restrict to one camera. Omit for the whole fleet. */
17192
- deviceId: number().optional(),
17193
- since: number().optional(),
17194
- until: number().optional(),
17195
- /** Stop after this many tracks; the result reports whether more remain. */
17196
- maxTracks: number().int().positive().optional(),
17197
- /**
17198
- * Run every embedding on THIS node instead of round-robining the fleet.
17199
- *
17200
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17201
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17202
- * calling it that would pin the rebuild REQUEST itself to that node — the
17203
- * rebuild orchestration lives on the hub, and only the per-track step runs
17204
- * remotely. This field is data; the per-track pin is applied inside.
17205
- *
17206
- * Absent ⇒ round-robin over every online node whose runner can serve the
17207
- * pinned model.
17208
- */
17209
- executeOnNodeId: string().optional(),
17210
- /**
17211
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17212
- * run flat out.
17213
- *
17214
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17215
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17216
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17217
- * force is logged at start and finish so a deliberately slow pass reads
17218
- * differently from a stalled one.
17219
- */
17220
- pacingMs: number().int().nonnegative().optional()
17221
- });
17014
+ var TrackSourceSchema = _enum([
17015
+ "pipeline",
17016
+ "sensor",
17017
+ "audio"
17018
+ ]);
17222
17019
  /**
17223
- * Result of emptying the CLIP index.
17020
+ * Where a track sits in the RETRAIN lifecycle (D81).
17224
17021
  *
17225
- * The clean slate before a policy change: a new crop margin or encoder model
17226
- * leaves two feature spaces in one index whose cosine scores are not
17227
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17228
- * means the same thing.
17022
+ * - `none` — never marked, or un-marked. Evictable.
17023
+ * - `staging` — the operator wants this track as training material and has not
17024
+ * finished with it. **This is the only state retention holds**: the track and
17025
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
17026
+ * the device's age window.
17027
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
17028
+ * were COPIED into the retrain dataset at selection time, so the dataset no
17029
+ * longer depends on the track's media and the track becomes EVICTABLE again.
17030
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
17031
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
17032
+ *
17033
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
17034
+ * the store's filter language has only positive equality and `whereIn` — no
17035
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
17036
+ * would make the entire pre-column history immortal in one deploy.
17229
17037
  */
17230
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17038
+ var RetrainStatusSchema = _enum([
17039
+ "none",
17040
+ "staging",
17041
+ "trained"
17042
+ ]);
17231
17043
  /**
17232
- * Acknowledgement that a rebuild STARTED.
17044
+ * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
17045
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
17046
+ * so the two surfaces cannot drift.
17233
17047
  *
17234
- * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17235
- * runs detached and this returns immediately. Waiting for it made the client
17236
- * time out while the work carried on server-side, which is the worst of both:
17237
- * no result and no way to know it was still going. Poll
17238
- * `getObjectEmbeddingRebuildStatus` for progress.
17048
+ * **Absent ≠ false.** A track that has never been touched omits the field; an
17049
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
17050
+ * columns existed read as absent, and a consumer that needs a boolean should say
17051
+ * `flag === true`, not `flag !== false`.
17052
+ *
17053
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
17054
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
17055
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
17056
+ * `trained` track reports `false` while refusing both writes. The boolean is
17057
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
17058
+ * "never marked" from "already trained" must read `retrainStatus`.
17059
+ *
17060
+ * `debug` does NOT pin; it is attention, not durability.
17061
+ *
17062
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17063
+ * A favourited track is skipped by retention the same way `staging` is, but
17064
+ * it does not enter `none|staging|trained` and has no staging budget.
17239
17065
  */
17240
- var RebuildObjectEmbeddingsResultSchema = object({
17241
- started: boolean(),
17242
- /** True when a pass was already running; the new request is ignored. */
17243
- alreadyRunning: boolean()
17244
- });
17245
- var RebuildStatusSchema = object({
17246
- running: boolean(),
17247
- scanned: number(),
17248
- rebuilt: number(),
17249
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17250
- missingKeyFrame: number(),
17251
- /** Tracks with no usable detection box. */
17252
- missingBbox: number(),
17253
- /**
17254
- * Tracks an executing node REFUSED rather than broke on — an unreadable key
17255
- * frame, a step that threw. Separate from `failed` because the remedy is
17256
- * different, and because a whole camera silently contributing zero vectors
17257
- * is the shape of failure a rebuild must never hide.
17258
- */
17259
- notRunnable: number(),
17066
+ var TrackFlagFields = {
17067
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
17068
+ * `'staging'`. */
17069
+ markForTrain: boolean().optional(),
17070
+ /** Operator marked this track for diagnostic attention. */
17071
+ debug: boolean().optional(),
17072
+ /** Operator favourited this track. Pins it against pruning. */
17073
+ favourited: boolean().optional()
17074
+ };
17075
+ /**
17076
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
17077
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
17078
+ * write patch, and the status is not something the toggle sets — it is what the
17079
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
17080
+ * always present on a persisted row (the column default materialises `'none'`).
17081
+ */
17082
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
17083
+ /**
17084
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
17085
+ * one flag can never clear the other — the toggles are independent and are
17086
+ * driven from three surfaces that do not know about each other.
17087
+ */
17088
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
17089
+ /**
17090
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
17091
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
17092
+ * mutation result without a re-fetch.
17093
+ */
17094
+ var TrackFlagsSchema = object({
17095
+ trackId: string(),
17096
+ markForTrain: boolean(),
17097
+ debug: boolean(),
17098
+ favourited: boolean(),
17099
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
17100
+ * a track row) because this shape is only ever produced by the write body,
17101
+ * which always knows it — and a surface that has just written needs to render
17102
+ * `trained` without a re-fetch. */
17103
+ retrainStatus: RetrainStatusSchema
17104
+ });
17105
+ union([literal(1), literal(2)]);
17106
+ /**
17107
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
17108
+ * the step and model that produced it — which is what makes the write rule
17109
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17110
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17111
+ *
17112
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17113
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17114
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
17115
+ * that value has no provenance, and the write rule lets ANY properly-attributed
17116
+ * write of the same tier replace it regardless of score.
17117
+ */
17118
+ var LabelAttributionSchema = object({
17119
+ stepId: string(),
17120
+ modelId: string().optional(),
17121
+ decidedAt: number(),
17260
17122
  /**
17261
- * The pass stopped because NO node could serve the pinned model.
17123
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
17124
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17262
17125
  *
17263
- * Distinct from `notRunnable` on purpose: that one says "this track was
17264
- * refused", this one says "the cluster cannot do this work at all" — every
17265
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17266
- * pinned model for its engine format, or dropped out. The remedy is a model /
17267
- * engine change, not a per-camera one. Non-zero here always comes with
17268
- * `complete: false`.
17126
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
17127
+ * notification rule authored on "Gianluca" stopped matching the moment the
17128
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
17129
+ * the thing that does not move, so it is what a rule matches on
17130
+ * (`NcConditions.identities`) and the text is what a human is shown.
17131
+ *
17132
+ * Absent when the label names no gallery row — a plate the OCR read but no
17133
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17269
17134
  */
17270
- noCapableNode: number(),
17271
- failed: number(),
17272
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17273
- complete: boolean().nullable(),
17274
- startedAtMs: number().nullable(),
17275
- finishedAtMs: number().nullable(),
17276
- /** Present when the pass ended by throwing. */
17277
- error: string().nullable()
17135
+ identityId: string().optional()
17278
17136
  });
17279
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17280
- deviceId: number(),
17281
- trackId: string()
17282
- }), TrackSchema.nullable()), method(object({
17283
- deviceId: number(),
17284
- since: number().optional(),
17285
- until: number().optional(),
17286
- limit: number().optional(),
17287
- /** Spatial filter — only tracks whose trajectory intersects the zone
17288
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17289
- * envelope columns, then precisely tested per position. Tracks with
17290
- * an unknown envelope (no frame dims at persist time) always match. */
17291
- zone: TrackZoneFilterSchema.optional(),
17292
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17293
- * compatible — omitting the field keeps today's exact behaviour). */
17294
- projection: TrackProjectionSchema.optional(),
17295
- /** Include stationary-promoted rows (parked objects handed to the
17296
- * stationary registry). Default false: the timeline lists passages,
17297
- * not parking records (operator decision, 2026-08-15). */
17298
- includeStationary: boolean().optional()
17299
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17300
- deviceId: number(),
17301
- groupId: string().min(1)
17302
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17303
- kind: "mutation",
17304
- auth: "admin"
17305
- }), 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({
17306
- deviceId: number(),
17307
- since: number().optional(),
17308
- until: number().optional(),
17309
- kinds: array(string()).optional(),
17310
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17311
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17312
- deviceId: number(),
17313
- since: number(),
17314
- until: number(),
17315
- bucketMs: number().int().positive()
17316
- }), array(object({
17317
- bucketStart: number(),
17318
- motion: number().int(),
17319
- object: number().int(),
17320
- audio: number().int()
17321
- })).readonly()), method(object({
17322
- deviceId: number(),
17323
- cutoffMs: number()
17324
- }), object({
17325
- motion: number().int(),
17326
- object: number().int(),
17327
- audio: number().int()
17328
- }), {
17329
- kind: "mutation",
17330
- auth: "admin"
17331
- }), method(object({
17332
- deviceId: number(),
17333
- cutoffMs: number()
17334
- }), TrackCascadeCountsSchema, {
17335
- kind: "mutation",
17336
- auth: "admin"
17337
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17338
- kind: "mutation",
17339
- auth: "admin"
17340
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17341
- kind: "mutation",
17342
- auth: "admin"
17343
- }), method(object({
17344
- deviceId: number(),
17345
- trackIds: array(string()).min(1)
17346
- }), object({
17347
- deleted: number().int(),
17348
- failed: array(string()).readonly()
17349
- }), {
17350
- kind: "mutation",
17351
- auth: "admin"
17352
- }), method(object({
17353
- /** Log/audit scope only — the trackId is globally unique on its own. */
17137
+ /**
17138
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17139
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17140
+ * track and its events always answer the same question the same way.
17141
+ *
17142
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17143
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17144
+ * is tier 2, and each carries its own score + attribution.
17145
+ *
17146
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17147
+ * finest thing known. Before 4g the single `label` column held the finest
17148
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17149
+ * shows nothing on a species-only row; that is why the migration puts every
17150
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17151
+ * and why the read surfaces were changed in the same train.
17152
+ *
17153
+ * **Writing it.** The slots are independent, which is the whole point: a
17154
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17155
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17156
+ * higher score wins. One rule, one implementation — see
17157
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17158
+ */
17159
+ var TieredLabelFields = {
17160
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
17161
+ label: string().optional(),
17162
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17163
+ labelScore: number().optional(),
17164
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17165
+ labelMeta: LabelAttributionSchema.optional(),
17166
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
17167
+ subLabel: string().optional(),
17168
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17169
+ subLabelScore: number().optional(),
17170
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17171
+ subLabelMeta: LabelAttributionSchema.optional()
17172
+ };
17173
+ /** Per-camera slice of a training-export estimate. */
17174
+ var TrainingExportDeviceTotalsSchema = object({
17354
17175
  deviceId: number(),
17176
+ tracks: number().int(),
17177
+ files: number().int(),
17178
+ bytes: number().int()
17179
+ });
17180
+ /**
17181
+ * What a training export WOULD contain. Computed from media index rows only —
17182
+ * no blob is read to produce this.
17183
+ */
17184
+ var TrainingExportSummarySchema = object({
17185
+ generatedAt: number(),
17186
+ trackCount: number().int(),
17187
+ fileCount: number().int(),
17188
+ byteCount: number().int(),
17189
+ /** More marked tracks exist than a single pass carries. */
17190
+ truncated: boolean(),
17191
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17192
+ });
17193
+ var TrackSchema = object({
17355
17194
  trackId: string(),
17356
- flags: TrackFlagsPatchSchema
17357
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17358
- kind: "query",
17359
- auth: "admin"
17360
- }), method(object({
17361
- olderThanMs: number(),
17362
- reason: OpsLogReasonSchema.optional()
17363
- }), EventPruneCountsSchema, {
17364
- kind: "mutation",
17365
- auth: "admin"
17366
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17367
- kind: "mutation",
17368
- auth: "admin"
17369
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17370
- kind: "mutation",
17371
- auth: "admin"
17372
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17373
- kind: "mutation",
17374
- auth: "admin"
17375
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17376
- kind: "mutation",
17377
- auth: "admin"
17378
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17379
- kind: "mutation",
17380
- auth: "admin"
17381
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17382
- kind: "mutation",
17383
- auth: "admin"
17384
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17385
- kind: "query",
17386
- auth: "admin"
17387
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17388
- kind: "query",
17389
- auth: "admin"
17390
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17391
- kind: "query",
17392
- auth: "admin"
17393
- }), method(object({
17394
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17395
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17396
- * route it at one camera's owner, and "every camera" would stop being
17397
- * expressible at all. */
17398
- deviceIds: array(number()).optional(),
17399
- limit: number().int().min(1).max(500).optional()
17400
- }), array(RetrainTrackSchema).readonly(), {
17401
- kind: "query",
17402
- auth: "admin"
17403
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17404
- kind: "query",
17405
- auth: "admin"
17406
- }), method(object({
17407
17195
  deviceId: number(),
17408
- trackId: string(),
17409
- mediaKeys: array(string()).min(1)
17410
- }), RetrainFrameSelectionSchema, {
17411
- kind: "mutation",
17412
- auth: "admin"
17413
- }), method(object({
17196
+ className: string(),
17197
+ ...TieredLabelFields,
17198
+ producingDeviceName: string().optional(),
17199
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17200
+ source: TrackSourceSchema.optional(),
17201
+ firstSeen: number(),
17202
+ lastSeen: number(),
17203
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17204
+ positions: array(TrackPositionSchema).readonly(),
17205
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17206
+ * saveThumbnails policy). */
17207
+ snapshots: array(TrackSnapshotSchema).readonly(),
17208
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17209
+ zonesVisited: array(string()).readonly(),
17210
+ /**
17211
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17212
+ * `zones` capability.
17213
+ *
17214
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17215
+ * and no card can render — so every free-text search surface was structurally
17216
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17217
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17218
+ * derivation and costs the clients no extra call (the `zones` cap is
17219
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17220
+ * surface built to avoid exactly that).
17221
+ *
17222
+ * Resolved, never invented: a zone deleted since the track was written has no
17223
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17224
+ * two are not positionally aligned. Absent when the track visited no zone, or
17225
+ * when the zone catalogue could not be read.
17226
+ */
17227
+ zoneNames: array(string()).readonly().optional(),
17228
+ /** Deduplicated set of detector classes observed for this track over its
17229
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17230
+ * legacy rows written before class accumulation shipped. */
17231
+ classes: array(string()).readonly().optional(),
17232
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17233
+ totalDistance: number(),
17234
+ state: TrackStateSchema,
17235
+ active: boolean(),
17236
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17237
+ * track expiry, recomputed on late label). Absent on legacy rows written
17238
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17239
+ importance: number().optional(),
17240
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17241
+ * "best" frame). Absent when the track produced no object events. */
17242
+ bestEventId: string().optional(),
17243
+ /** Tag of the importance sub-signal that dominated the score
17244
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17245
+ importanceReason: string().optional(),
17246
+ /** Audio-classification labels heard on the camera during the track's
17247
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17248
+ * Absent on legacy rows / tracks with no confident audio. */
17249
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17250
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17251
+ * Populated from the persisted envelope columns on historical reads;
17252
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17253
+ envelope: TrackEnvelopeSchema.optional(),
17254
+ /**
17255
+ * A face DETECTOR found a face on this track — nothing more. It says the
17256
+ * detail plane produced a `face` detail; it does NOT say the face was
17257
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17258
+ * enabled. Set once and never cleared.
17259
+ *
17260
+ * **This exists so "face present but not recognised" is expressible.** A
17261
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17262
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17263
+ * and a track with no face at all were byte-identical on the wire and no
17264
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17265
+ * === undefined`.
17266
+ *
17267
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17268
+ * and so does every server that predates the field — a consumer must test
17269
+ * `=== true` and render nothing otherwise, never infer "no face".
17270
+ */
17271
+ hasFace: boolean().optional(),
17272
+ /**
17273
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17274
+ * face an operator could ASSIGN to an identity.
17275
+ *
17276
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17277
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17278
+ * branch, before every gate, and means no more than "a face detector produced
17279
+ * a face detail". This one is stamped at the single moment the gallery row
17280
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17281
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17282
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17283
+ * the crop-store drop. Everything between the detector and that insert can
17284
+ * legitimately refuse the face, so a flag written any earlier promises the
17285
+ * operator something to assign and delivers nothing.
17286
+ *
17287
+ * **Independent of recognition.** A face collected but never auto-matched is
17288
+ * still assignable — it is in fact the face an operator most wants to reach —
17289
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17290
+ * `subLabel`; this says only that the raw material exists.
17291
+ *
17292
+ * **Set once, never cleared.** A track that produced a gallery row produced
17293
+ * one; deleting the row later is the gallery's business, not this flag's.
17294
+ *
17295
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17296
+ * before the column omits it, and so does every server that predates the
17297
+ * field. A consumer must test `=== true` and render nothing otherwise —
17298
+ * never infer "no assignable face".
17299
+ */
17300
+ hasEmbeddedFace: boolean().optional(),
17301
+ /**
17302
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17303
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17304
+ * so the passage is tracked once and as a VEHICLE.
17305
+ *
17306
+ * It exists because the fold's record was dishonest. D34 and the code both
17307
+ * said "the person is not lost — it is reported so both entities stay on the
17308
+ * record"; in fact the pair went into a per-processor RAM field behind an
17309
+ * accessor nobody called, and every durable surface said `vehicle`, full
17310
+ * stop. This is the composition note that makes the row true.
17311
+ *
17312
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17313
+ * person" is not an answer to "what is this" — both label tiers would refuse
17314
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17315
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17316
+ * and a `person` rule still does not fire for someone cycling past.
17317
+ *
17318
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17319
+ * the column, and every hub that predates the field, omits it. Test
17320
+ * `=== true` and render nothing otherwise — never infer "no rider".
17321
+ */
17322
+ hasRider: boolean().optional(),
17323
+ ...TrackFlagFields,
17324
+ ...TrackRetrainFields
17325
+ });
17326
+ var BaseEventFields = {
17327
+ id: string(),
17414
17328
  deviceId: number(),
17415
- trackId: string(),
17416
- frameId: string()
17417
- }), object({
17418
- removed: boolean(),
17419
- removedAnnotations: number().int()
17420
- }), {
17421
- kind: "mutation",
17422
- auth: "admin"
17423
- }), method(object({ frameId: string() }), object({
17329
+ timestamp: number()
17330
+ };
17331
+ var MotionEventSchema = object({
17332
+ ...BaseEventFields,
17333
+ kind: literal("motion"),
17334
+ regionCount: number(),
17335
+ /** Heavy JSON array — omitted in slim projection. */
17336
+ regions: array(object({
17337
+ bbox: BoundingBoxSchema,
17338
+ pixelCount: number(),
17339
+ intensity: number()
17340
+ })).readonly().optional(),
17341
+ /** Omitted in slim projection. */
17342
+ frameWidth: number().optional(),
17343
+ /** Omitted in slim projection. */
17344
+ frameHeight: number().optional(),
17345
+ /** Populated by B5 (recording playback URL for this event). */
17346
+ mediaUrl: string().optional()
17347
+ });
17348
+ /**
17349
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17350
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17351
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17352
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17353
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17354
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17355
+ */
17356
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17357
+ /**
17358
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17359
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17360
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17361
+ * appearance event carry none, so a rule asking for a direction fails closed
17362
+ * on them.
17363
+ *
17364
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17365
+ * into its own event, so a frame in which a track enters A while leaving B
17366
+ * produces two events with two directions — never one ambiguous row.
17367
+ *
17368
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17369
+ * membership the box has NOW, and by definition it no longer contains the zone
17370
+ * that was just left. Without the id here, a zone-scoped rule could never match
17371
+ * the exit it asked for.
17372
+ */
17373
+ var ZoneCrossingSchema = object({
17374
+ direction: _enum(["enter", "exit"]),
17375
+ /** Admin zone id crossed. */
17376
+ zoneId: string(),
17377
+ /** Zone display name at crossing time (falls back to the id). */
17378
+ zoneName: string().optional()
17379
+ });
17380
+ var ObjectEventSchema = object({
17381
+ ...BaseEventFields,
17382
+ kind: literal("object"),
17383
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17384
+ source: DetectionSourceSchema.optional(),
17385
+ /**
17386
+ * Inference-frame id shared by every object event emitted from the SAME frame
17387
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17388
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17389
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17390
+ * Optional for backward-compat with pre-existing rows / the slim projection
17391
+ * includes it (it is light). Absent on rows written before this field.
17392
+ */
17393
+ frameId: string().optional(),
17394
+ /** Omitted in slim projection. */
17395
+ trackId: string().optional(),
17396
+ className: string(),
17397
+ ...TieredLabelFields,
17398
+ /** Omitted in slim projection. */
17399
+ confidence: number().optional(),
17400
+ /** Heavy JSON — omitted in slim projection. */
17401
+ bbox: BoundingBoxSchema.optional(),
17402
+ /** Heavy JSON — omitted in slim projection. */
17403
+ zones: array(string()).readonly().optional(),
17404
+ /** Omitted in slim projection. */
17405
+ state: TrackStateSchema.optional(),
17406
+ /**
17407
+ * The zone crossing this event IS, when it is one. Absent on every other
17408
+ * event kind (movement state, appearance, package) — see
17409
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17410
+ */
17411
+ zoneCrossing: ZoneCrossingSchema.optional(),
17412
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17413
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17414
+ frameWidth: number().optional(),
17415
+ frameHeight: number().optional(),
17416
+ /** MediaStore key for the crop attached to this event (if any). */
17417
+ mediaKey: string().optional(),
17418
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17419
+ * best-detection full frame). Resolve via the event-media data-plane
17420
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17421
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17422
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17423
+ keyFrameMediaKey: string().optional(),
17424
+ /** Populated by B5 (recording playback URL for this event). */
17425
+ mediaUrl: string().optional(),
17426
+ /** The parent track's key-event importance [0,1], propagated to every object
17427
+ * event of the track (so an event row can be sorted by importance without a
17428
+ * track join). Absent on legacy rows / before the track was scored. */
17429
+ importance: number().optional()
17430
+ });
17431
+ var AudioEventSchema = object({
17432
+ ...BaseEventFields,
17433
+ kind: literal("audio"),
17434
+ rms: number(),
17435
+ dbfs: number(),
17436
+ classification: object({
17437
+ className: string(),
17438
+ originalClass: string().optional(),
17439
+ score: number()
17440
+ }).optional(),
17441
+ /** Populated by B5 (recording playback URL for this event). */
17442
+ mediaUrl: string().optional()
17443
+ });
17444
+ var MediaFileKindEnum = _enum([
17445
+ "crop",
17446
+ "thumbnail",
17447
+ "snapshot",
17448
+ "firstFrame",
17449
+ "lastFrame",
17450
+ "fullFrame",
17451
+ "fullFrameBoxed",
17452
+ "faceCrop",
17453
+ "plateCrop",
17454
+ "keyFrame",
17455
+ "keyFrameSmall",
17456
+ "thumbnailSmall"
17457
+ ]);
17458
+ var MediaFileSchema = object({
17459
+ key: string(),
17460
+ kind: MediaFileKindEnum,
17424
17461
  base64: string(),
17425
- width: number().int(),
17426
- height: number().int()
17427
- }), {
17428
- kind: "query",
17429
- auth: "admin"
17430
- }), method(object({
17431
- deviceId: number(),
17432
- trackId: string(),
17433
- frameId: string(),
17434
- subject: RetrainAssistSubjectSchema,
17435
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17436
- nodeId: string().optional()
17437
- }), RetrainAssistResultSchema, {
17438
- kind: "mutation",
17439
- auth: "admin"
17440
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17441
- kind: "query",
17442
- auth: "admin"
17443
- }), method(object({
17444
- deviceId: number(),
17445
- trackId: string(),
17446
- frameId: string(),
17447
- annotations: array(RetrainAnnotationDraftSchema)
17448
- }), array(RetrainAnnotationSchema).readonly(), {
17449
- kind: "mutation",
17450
- auth: "admin"
17451
- }), method(object({
17452
- deviceId: number(),
17453
- trackId: string()
17454
- }), RetrainTransitionResultSchema, {
17455
- kind: "mutation",
17456
- auth: "admin"
17457
- }), method(object({
17458
- deviceId: number(),
17459
- trackId: string()
17460
- }), RetrainTransitionResultSchema, {
17461
- kind: "mutation",
17462
- auth: "admin"
17463
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17464
- kind: "query",
17465
- auth: "admin"
17466
- }), method(object({
17467
- eventId: string(),
17468
- kind: MediaFileKindEnum.optional(),
17469
- deviceId: number()
17470
- }), array(MediaFileSchema).readonly()), method(object({
17471
- trackId: string(),
17472
- kinds: array(MediaFileKindEnum).optional(),
17473
- deviceId: number()
17474
- }), array(MediaFileSchema).readonly()), method(object({
17462
+ sizeBytes: number(),
17463
+ timestamp: number()
17464
+ });
17465
+ /**
17466
+ * One media row WITHOUT its bytes.
17467
+ *
17468
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17469
+ * 140 s track), and a client that renders tiles from the media data plane needs
17470
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17471
+ * with an immutable cache, instead of all at once inside a tRPC response that
17472
+ * blocks the whole view.
17473
+ *
17474
+ * `sizeBytes` is carried because it is what lets a client decide between the
17475
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17476
+ */
17477
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17478
+ /**
17479
+ * The MACRO tier of an annotation — a CLOSED set.
17480
+ *
17481
+ * This is what the exported detector predicts, so a typo here is a new class
17482
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17483
+ * the whole point of the page is teaching the model things it does not know
17484
+ * yet, and constraining that vocabulary would make it useless.
17485
+ *
17486
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17487
+ * `subLabel` is one of these values, in any casing, because once `person`
17488
+ * exists in both tiers "every person box" stops being answerable without
17489
+ * knowing every string anyone ever typed — and the damage is retroactive.
17490
+ */
17491
+ var RetrainMacroClassSchema = _enum([
17492
+ "person",
17493
+ "vehicle",
17494
+ "animal",
17495
+ "package",
17496
+ "face",
17497
+ "plate"
17498
+ ]);
17499
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17500
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17501
+ /** Did a human draw this box, or did the assist propose it? */
17502
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17503
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17504
+ var RetrainBboxSchema = object({
17505
+ x: number(),
17506
+ y: number(),
17507
+ w: number(),
17508
+ h: number()
17509
+ });
17510
+ /**
17511
+ * One annotated subject.
17512
+ *
17513
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17514
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17515
+ * derived from it at export and never stored — storing them is how one feature
17516
+ * space ends up holding two crops of the same subject (D52).
17517
+ */
17518
+ var RetrainAnnotationSchema = object({
17519
+ id: string(),
17475
17520
  trackId: string(),
17476
- deviceId: number()
17477
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17478
- kind: "mutation",
17479
- auth: "admin"
17480
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17481
- kind: "mutation",
17482
- auth: "admin"
17483
- }), method(object({}), RebuildStatusSchema), object({
17484
- deviceId: number(),
17485
- timestamp: number(),
17486
- frameWidth: number(),
17487
- frameHeight: number(),
17488
- detections: array(OverlayDetectionSchema).readonly()
17489
- }), object({
17490
17521
  deviceId: number(),
17522
+ /** The COPY in retrain storage — never the source track's media key. */
17523
+ mediaKey: string(),
17524
+ bbox: RetrainBboxSchema,
17525
+ macroClass: RetrainMacroClassSchema,
17526
+ label: string().optional(),
17527
+ subLabel: string().optional(),
17528
+ kind: RetrainAnnotationKindSchema,
17529
+ source: RetrainAnnotationSourceSchema,
17530
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17531
+ assistModelId: string().optional(),
17532
+ assistScore: number().optional(),
17533
+ exportedInBatch: string().optional(),
17534
+ createdAt: number()
17535
+ });
17536
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17537
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17538
+ id: true,
17539
+ trackId: true,
17540
+ deviceId: true,
17541
+ mediaKey: true,
17542
+ createdAt: true,
17543
+ exportedInBatch: true
17544
+ });
17545
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17546
+ var RetrainTrackSchema = object({
17491
17547
  trackId: string(),
17492
- className: string()
17493
- }), object({
17494
17548
  deviceId: number(),
17495
- trackId: string(),
17496
17549
  className: string(),
17497
- durationMs: number()
17498
- }), object({
17550
+ label: string().optional(),
17551
+ firstSeen: number(),
17552
+ lastSeen: number(),
17553
+ /** How many frames the dataset already holds from this track. */
17554
+ frameCount: number().int(),
17555
+ /** How many subjects have been annotated on those frames. `0` with
17556
+ * `frameCount: 0` is exactly "staging, still to work". */
17557
+ annotationCount: number().int()
17558
+ });
17559
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17560
+ var RetrainFrameCandidateSchema = object({
17561
+ mediaKey: string(),
17562
+ kind: MediaFileKindEnum,
17563
+ timestamp: number(),
17564
+ sizeBytes: number().int(),
17565
+ /** A copy of this original already exists — selecting it is free and cannot
17566
+ * fail, whatever became of the original. */
17567
+ copied: boolean()
17568
+ });
17569
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17570
+ var RetrainFrameSchema = object({
17571
+ frameId: string(),
17499
17572
  deviceId: number(),
17500
- kind: EventKindSchema,
17501
- eventId: string(),
17502
- timestamp: number()
17573
+ trackId: string(),
17574
+ /** Provenance only. It may already point at nothing — that is expected. */
17575
+ sourceMediaKey: string(),
17576
+ sourceKind: MediaFileKindEnum,
17577
+ sizeBytes: number().int(),
17578
+ width: number().int(),
17579
+ height: number().int(),
17580
+ copiedAt: number()
17581
+ });
17582
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17583
+ var RetrainCopyRefusalSchema = _enum([
17584
+ "source-missing",
17585
+ "unreadable-image",
17586
+ "write-failed"
17587
+ ]);
17588
+ var RetrainFrameSelectionSchema = object({
17589
+ copied: array(RetrainFrameSchema).readonly(),
17590
+ refused: array(object({
17591
+ sourceMediaKey: string(),
17592
+ reason: RetrainCopyRefusalSchema
17593
+ })).readonly()
17503
17594
  });
17595
+ var RetrainFrameListSchema = object({
17596
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17597
+ copies: array(RetrainFrameSchema).readonly(),
17598
+ /** What the page pre-selects — the native key frame when one survives. */
17599
+ autoPickMediaKey: string().optional()
17600
+ });
17601
+ /** What the operator asked the assist to look for. */
17602
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17603
+ kind: literal("package"),
17604
+ zone: RetrainBboxSchema.optional()
17605
+ }), object({
17606
+ kind: literal("objects"),
17607
+ modelId: string(),
17608
+ minScore: number().optional()
17609
+ })]);
17504
17610
  /**
17505
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17506
- * within the frame, so the executor can re-cut a leaf child ROI at native
17507
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17611
+ * The assist's answer — a discriminated union, because "the model saw nothing"
17612
+ * and "this node cannot run that model" lead to different next moves and a
17613
+ * nullable result cannot tell them apart.
17508
17614
  */
17509
- var NativeCropRefSchema = object({
17510
- /** Handle keying the retained native surface (node-pinned to its owner). */
17511
- handle: FrameHandleSchema,
17512
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17513
- cropFrameSpace: object({
17514
- x: number(),
17515
- y: number(),
17516
- w: number(),
17517
- h: number()
17518
- })
17615
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17616
+ kind: literal("proposed"),
17617
+ modelId: string(),
17618
+ stepId: string(),
17619
+ minScore: number(),
17620
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17621
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17622
+ /** Returned by the runner but removed by the threshold. */
17623
+ belowThreshold: number().int()
17624
+ }), object({
17625
+ kind: literal("refused"),
17626
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17627
+ reason: string(),
17628
+ detail: string().optional()
17629
+ })]);
17630
+ /** The outcome of a lifecycle move owned by the retrain page. */
17631
+ var RetrainTransitionResultSchema = object({
17632
+ trackId: string(),
17633
+ /** Where the track ended up, whatever happened. */
17634
+ retrainStatus: RetrainStatusSchema,
17635
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17636
+ changed: boolean(),
17637
+ reason: _enum([
17638
+ "unknown-track",
17639
+ "no-frames-copied",
17640
+ "not-staging",
17641
+ "not-trained",
17642
+ "unchanged"
17643
+ ]).optional()
17519
17644
  });
17520
- object({
17521
- crop: object({
17522
- left: number(),
17523
- top: number(),
17524
- width: number().positive(),
17525
- height: number().positive()
17526
- }).optional(),
17527
- content: object({
17528
- width: number().int().positive(),
17529
- height: number().int().positive()
17530
- }),
17531
- fit: _enum(["stretch", "contain"]),
17532
- format: _enum([
17533
- "rgb",
17534
- "gray",
17535
- "jpeg"
17536
- ])
17645
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17646
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17647
+ var DeviceEventQueryInput = object({
17648
+ deviceId: number(),
17649
+ since: number().optional(),
17650
+ until: number().optional(),
17651
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17652
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17653
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17654
+ * exact behaviour. Callers may omit this field — the store defaults to
17655
+ * `full` when not provided. */
17656
+ projection: _enum(["full", "slim"]).optional()
17537
17657
  });
17538
- var FrameRefSchema = object({
17539
- registryId: string().min(1),
17540
- id: string().min(1),
17541
- width: number().int().positive(),
17542
- height: number().int().positive(),
17543
- format: _enum(["rgb", "gray"]),
17544
- timestamp: number(),
17545
- capturedAt: number().optional()
17658
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17659
+ var RecentTracksQueryInput = object({
17660
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17661
+ deviceIds: array(number()),
17662
+ /** Window lower bound on `lastSeen` (inclusive). */
17663
+ since: number().optional(),
17664
+ /** Window upper bound on `lastSeen` (inclusive). */
17665
+ until: number().optional(),
17666
+ /** Page size. Default 200, max 1000. */
17667
+ limit: number().int().min(1).max(1e3).default(200),
17668
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17669
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17670
+ cursor: string().optional(),
17671
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17672
+ projection: TrackProjectionSchema.optional(),
17673
+ /** Include stationary-promoted rows (parked objects). Default false: the
17674
+ * feed lists passages; parking records live on the stationary registry. */
17675
+ includeStationary: boolean().optional()
17546
17676
  });
17547
- var ModelFormatSchema$1 = _enum([
17548
- "onnx",
17549
- "coreml",
17550
- "openvino",
17551
- "tflite",
17552
- "pt",
17553
- "gguf"
17554
- ]);
17555
- var PipelineSlotSchema = _enum([
17556
- "detector",
17557
- "cropper",
17558
- "classifier",
17559
- "refiner",
17560
- "audio-classifier"
17561
- ]);
17562
- var PipelineEngineChoiceSchema = object({
17563
- runtime: _enum(["node", "python"]),
17564
- backend: string(),
17565
- format: ModelFormatSchema$1,
17566
- device: string().optional()
17677
+ var RecentTracksPageSchema = object({
17678
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17679
+ tracks: array(TrackSchema).readonly(),
17680
+ /** Cursor for the next page, or null when this page is the last. */
17681
+ nextCursor: string().nullable()
17682
+ });
17683
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17684
+ var LIST_GROUPS_MAX_LIMIT = 100;
17685
+ var AnalyticsGroupRecordSchema = object({
17686
+ id: string(),
17687
+ deviceId: number().int(),
17688
+ openedAt: number().int(),
17689
+ closedAt: number().int(),
17690
+ timestamp: number().int(),
17691
+ memberCount: number().int(),
17692
+ memberTrackIds: array(string()).readonly(),
17693
+ className: string(),
17694
+ classes: array(string()).readonly(),
17695
+ /** Relative event-media path, or null when the group has no picture yet. */
17696
+ mediaUrl: string().nullable(),
17697
+ singleton: boolean()
17567
17698
  });
17568
- var AvailableEngineSchema = object({
17569
- engine: PipelineEngineChoiceSchema,
17570
- devices: array(object({
17571
- id: string(),
17572
- label: string(),
17573
- description: string().optional()
17574
- })).readonly(),
17575
- defaultDevice: string()
17699
+ var AnalyticsGroupMemberSchema = object({
17700
+ trackId: string(),
17701
+ deviceId: number().int(),
17702
+ className: string(),
17703
+ firstSeen: number().int(),
17704
+ lastSeen: number().int(),
17705
+ mediaUrl: string().nullable()
17576
17706
  });
17577
- var PipelineDefaultStepSchema = lazy(() => object({
17578
- addonId: string(),
17579
- addonName: string(),
17580
- slot: PipelineSlotSchema,
17581
- inputClasses: array(string()).readonly(),
17582
- outputClasses: array(string()).readonly(),
17583
- enabled: boolean(),
17584
- modelId: string(),
17585
- children: array(PipelineDefaultStepSchema).readonly(),
17586
- group: string().optional(),
17587
- settings: record(string(), unknown()).optional()
17588
- }));
17589
- var PipelineTemplateStepSchema = lazy(() => object({
17590
- addonId: string(),
17591
- enabled: boolean(),
17592
- modelId: string(),
17593
- children: array(PipelineTemplateStepSchema).readonly(),
17594
- settings: record(string(), unknown()).optional()
17595
- }));
17596
- var PipelineTemplateSchema$1 = object({
17597
- id: string(),
17598
- name: string(),
17599
- createdAt: string(),
17600
- updatedAt: string(),
17601
- engine: PipelineEngineChoiceSchema,
17602
- steps: array(PipelineTemplateStepSchema).readonly()
17707
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17708
+ var ListGroupsQueryInput = object({
17709
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17710
+ deviceIds: array(number()),
17711
+ /** Window lower bound on `closedAt` (inclusive). */
17712
+ since: number().optional(),
17713
+ /** Window upper bound on `openedAt` (inclusive). */
17714
+ until: number().optional(),
17715
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17716
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17717
+ cursor: string().optional()
17603
17718
  });
17604
- var PipelineModelOptionSchema = object({
17605
- id: string(),
17606
- name: string(),
17607
- formats: record(string(), object({
17608
- downloaded: boolean(),
17609
- sizeMB: number()
17610
- })),
17611
- group: ModelVariantGroupSchema.optional(),
17612
- legacy: boolean().optional(),
17613
- provider: ModelProviderIdSchema.optional()
17719
+ var ListGroupsPageSchema = object({
17720
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17721
+ nextCursor: string().nullable()
17614
17722
  });
17615
- var ConfigFieldBridge = custom();
17616
- var PipelineAddonSchemaSchema = object({
17617
- id: string(),
17618
- name: string(),
17619
- slot: PipelineSlotSchema,
17620
- inputClasses: array(string()).readonly(),
17621
- outputClasses: array(string()).readonly(),
17622
- childSlots: array(PipelineSlotSchema).readonly(),
17623
- models: array(PipelineModelOptionSchema).readonly(),
17624
- defaultModelId: string(),
17625
- defaultModelIdByFormat: record(string(), string()).optional(),
17626
- enabledByDefault: boolean().optional(),
17627
- backfillIntoExistingOverrides: boolean().optional(),
17628
- defaultConfidence: number(),
17629
- group: string().optional(),
17630
- configSchema: array(ConfigFieldBridge).readonly().optional()
17723
+ var KeyEventQueryInput = object({
17724
+ deviceId: number(),
17725
+ /** Window lower bound (track firstSeen ≥ since). */
17726
+ since: number(),
17727
+ /** Window upper bound (track firstSeen ≤ until). */
17728
+ until: number(),
17729
+ limit: number().int().min(1).max(200).default(50),
17730
+ /** Drop tracks scoring below this importance. */
17731
+ minImportance: number().min(0).max(1).optional(),
17732
+ /** Restrict to a single class (e.g. 'person'). */
17733
+ classFilter: string().optional()
17631
17734
  });
17632
- var PipelineSlotSchemaSchema = object({
17633
- id: PipelineSlotSchema,
17634
- label: string(),
17635
- priority: number(),
17636
- parentSlot: PipelineSlotSchema.nullable(),
17637
- addons: array(PipelineAddonSchemaSchema).readonly()
17735
+ var KeyEventSchema = object({
17736
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17737
+ id: string(),
17738
+ trackId: string(),
17739
+ /** Track start time (firstSeen). */
17740
+ timestamp: number(),
17741
+ className: string(),
17742
+ ...TieredLabelFields,
17743
+ importance: number(),
17744
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17745
+ bestEventId: string(),
17746
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17747
+ windowMs: number().optional(),
17748
+ ...TrackFlagFields,
17749
+ ...TrackRetrainFields
17638
17750
  });
17639
- var PipelineSchemaSchema = object({
17640
- availableEngines: array(AvailableEngineSchema).readonly(),
17641
- selectedEngine: PipelineEngineChoiceSchema,
17642
- slots: array(PipelineSlotSchemaSchema).readonly()
17751
+ object({
17752
+ trackId: string(),
17753
+ className: string(),
17754
+ confidence: number(),
17755
+ bbox: BoundingBoxSchema,
17756
+ zones: array(string()).readonly(),
17757
+ state: TrackStateSchema
17643
17758
  });
17644
- var EngineProvisioningSchema = object({
17645
- runtimeId: _enum([
17646
- "onnx",
17647
- "openvino",
17648
- "coreml",
17649
- "edgetpu"
17650
- ]).nullable(),
17651
- device: string().nullable(),
17652
- state: _enum([
17653
- "idle",
17654
- "installing",
17655
- "verifying",
17656
- "ready",
17657
- "failed"
17658
- ]),
17659
- progress: number().optional(),
17660
- error: string().optional(),
17661
- nextRetryAt: number().optional(),
17662
- /**
17663
- * Gate A (config-correctness gate at engine change): human-readable
17664
- * config issues surfaced EAGERLY when the node's engine changes — model
17665
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17666
- * has a <format> build"). Additive/optional: informational only, never
17667
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17668
- * Absent/empty when the node-default tree resolves cleanly.
17669
- */
17670
- configIssues: array(string()).optional()
17759
+ var OverlayDetectionSchema = looseObject({
17760
+ id: string(),
17761
+ kind: _enum(["first-level", "detail"]),
17762
+ macroClass: string(),
17763
+ score: number(),
17764
+ bbox: object({
17765
+ x: number(),
17766
+ y: number(),
17767
+ width: number(),
17768
+ height: number()
17769
+ }),
17770
+ labels: array(looseObject({
17771
+ label: string(),
17772
+ score: number()
17773
+ })).readonly(),
17774
+ parentId: string().optional()
17671
17775
  });
17672
- var PipelineStepInputSchema = lazy(() => object({
17673
- addonId: string(),
17674
- modelId: string().optional(),
17675
- enabled: boolean().default(true),
17676
- children: array(PipelineStepInputSchema).optional(),
17677
- settings: record(string(), unknown()).optional(),
17678
- jumpDeviceKey: string().optional()
17679
- }));
17680
- var ModelSubstitutionSchema = object({
17681
- addonId: string(),
17682
- chosen: string(),
17683
- running: string(),
17684
- format: string()
17776
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17777
+ var SearchObjectEventsInput = object({
17778
+ text: string(),
17779
+ deviceId: number().optional(),
17780
+ since: number().optional(),
17781
+ until: number().optional(),
17782
+ classFilter: string().optional(),
17783
+ limit: number().default(50),
17784
+ minScore: number().min(0).max(1).default(.2)
17685
17785
  });
17686
- var PipelineValidationIssueSchema = object({
17687
- addonId: string(),
17688
- kind: _enum(["unknown-addon", "no-format-build"]),
17689
- detail: string()
17786
+ var TrackCascadeCountsSchema = object({
17787
+ /** Persisted track roots deleted (authoritative). */
17788
+ tracks: number().int(),
17789
+ /** Object events removed with their tracks (best-effort; see note above). */
17790
+ events: number().int(),
17791
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17792
+ media: number().int(),
17793
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
17794
+ faces: number().int(),
17795
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17796
+ plates: number().int(),
17797
+ /** Per-track CLIP search vectors removed (best-effort). */
17798
+ embeddings: number().int(),
17799
+ /** Group membership + group rows removed with their last member (best-effort). */
17800
+ groups: number().int()
17690
17801
  });
17691
- var PipelineValidationResultSchema = object({
17692
- ok: boolean(),
17693
- issues: array(PipelineValidationIssueSchema).readonly(),
17694
- substitutions: array(ModelSubstitutionSchema).readonly(),
17695
- /** The node's `currentEngine.format` this validation ran against. */
17696
- format: string()
17802
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17803
+ var DiskReconcileCountsSchema = object({
17804
+ mediaDropped: number().int(),
17805
+ tracks: number().int(),
17806
+ events: number().int()
17697
17807
  });
17698
- var ReferenceImageEntrySchema = object({
17699
- filename: string(),
17700
- stepIds: array(string()).readonly().optional()
17808
+ /** Event-store footprint for one camera. */
17809
+ var EventStoreDeviceFootprintSchema = object({
17810
+ deviceId: number(),
17811
+ /** Persisted event rows (motion + object + audio) for the camera. */
17812
+ rows: number().int(),
17813
+ /** Event-owned media bytes on disk for the camera. */
17814
+ bytes: number().int()
17701
17815
  });
17702
- var ReferenceImageBodySchema = object({
17703
- base64: string(),
17704
- filename: string()
17816
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17817
+ var EventStoreFootprintSchema = object({
17818
+ totalRows: number().int(),
17819
+ totalBytes: number().int(),
17820
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
17705
17821
  });
17706
- var ReferenceAudioEntrySchema = object({
17707
- filename: string(),
17708
- sizeKb: number()
17822
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
17823
+ var EventPruneCountsSchema = object({
17824
+ motion: number().int(),
17825
+ object: number().int(),
17826
+ audio: number().int()
17709
17827
  });
17710
- var ReferenceAudioBodySchema = object({ base64: string() });
17711
- var AudioBackendSchema = object({
17712
- id: string(),
17713
- name: string(),
17714
- description: string(),
17715
- available: boolean(),
17828
+ /**
17829
+ * Re-embed stored tracks from their key frames.
17830
+ *
17831
+ * The reason this is an operator-callable method and not a migration script:
17832
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
17833
+ * squaring — is only changeable if the existing vectors can be regenerated.
17834
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
17835
+ * symptom is a quality regression with no visible cause.
17836
+ */
17837
+ var RebuildObjectEmbeddingsInput = object({
17838
+ /** Restrict to one camera. Omit for the whole fleet. */
17839
+ deviceId: number().optional(),
17840
+ since: number().optional(),
17841
+ until: number().optional(),
17842
+ /** Stop after this many tracks; the result reports whether more remain. */
17843
+ maxTracks: number().int().positive().optional(),
17716
17844
  /**
17717
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17718
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17719
- * the benchmark UI to populate the `enabledMicroClasses` filter
17720
- * specific to the selected backend without a separate fetch.
17845
+ * Run every embedding on THIS node instead of round-robining the fleet.
17846
+ *
17847
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17848
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17849
+ * calling it that would pin the rebuild REQUEST itself to that node — the
17850
+ * rebuild orchestration lives on the hub, and only the per-track step runs
17851
+ * remotely. This field is data; the per-track pin is applied inside.
17852
+ *
17853
+ * Absent ⇒ round-robin over every online node whose runner can serve the
17854
+ * pinned model.
17721
17855
  */
17722
- rawLabels: array(string()).readonly().optional()
17723
- });
17724
- var AudioCapabilitiesSchema = object({
17725
- activeBackend: string(),
17726
- availableBackends: array(AudioBackendSchema).readonly(),
17727
- sampleRate: number(),
17728
- chunkDurationMs: number()
17729
- });
17730
- var DownloadModelResultSchema = object({
17731
- filePath: string(),
17732
- sizeMB: number(),
17733
- durationMs: number()
17856
+ executeOnNodeId: string().optional(),
17857
+ /**
17858
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17859
+ * run flat out.
17860
+ *
17861
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
17862
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17863
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17864
+ * force is logged at start and finish so a deliberately slow pass reads
17865
+ * differently from a stalled one.
17866
+ */
17867
+ pacingMs: number().int().nonnegative().optional()
17734
17868
  });
17735
17869
  /**
17736
- * Wrapper carrying a single test run's result. Replaces the legacy
17737
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17738
- * canonical `AudioResult` from the Phase 6 output rework: one
17739
- * `AudioDetection` per class above `minScore`, top-N candidates in
17740
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17741
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17742
- * benchmark UI can still report a clean failure when the classifier
17743
- * cap isn't available.
17870
+ * Result of emptying the CLIP index.
17871
+ *
17872
+ * The clean slate before a policy change: a new crop margin or encoder model
17873
+ * leaves two feature spaces in one index whose cosine scores are not
17874
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
17875
+ * means the same thing.
17744
17876
  */
17745
- var AudioTestResultSchema = object({
17746
- success: boolean(),
17747
- error: string().optional(),
17748
- frame: custom().optional()
17877
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17878
+ /**
17879
+ * Acknowledgement that a rebuild STARTED.
17880
+ *
17881
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17882
+ * runs detached and this returns immediately. Waiting for it made the client
17883
+ * time out while the work carried on server-side, which is the worst of both:
17884
+ * no result and no way to know it was still going. Poll
17885
+ * `getObjectEmbeddingRebuildStatus` for progress.
17886
+ */
17887
+ var RebuildObjectEmbeddingsResultSchema = object({
17888
+ started: boolean(),
17889
+ /** True when a pass was already running; the new request is ignored. */
17890
+ alreadyRunning: boolean()
17749
17891
  });
17750
- var PipelineConfigBridge = custom();
17751
- var ConfigUISchemaBridge = custom();
17752
- var ConfigUISchemaNullableBridge = custom();
17753
- var InferenceCapabilitiesBridge = custom();
17754
- var ModelAvailabilityListBridge = custom();
17755
- var PipelineRunResultBridge = custom();
17756
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17757
- modelId: string(),
17758
- settings: record(string(), unknown()).readonly()
17759
- }))), method(object({ steps: record(string(), object({
17760
- modelId: string(),
17761
- settings: record(string(), unknown()).readonly()
17762
- })) }), object({ success: literal(true) }), {
17892
+ var RebuildStatusSchema = object({
17893
+ running: boolean(),
17894
+ scanned: number(),
17895
+ rebuilt: number(),
17896
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
17897
+ missingKeyFrame: number(),
17898
+ /** Tracks with no usable detection box. */
17899
+ missingBbox: number(),
17900
+ /**
17901
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
17902
+ * frame, a step that threw. Separate from `failed` because the remedy is
17903
+ * different, and because a whole camera silently contributing zero vectors
17904
+ * is the shape of failure a rebuild must never hide.
17905
+ */
17906
+ notRunnable: number(),
17907
+ /**
17908
+ * The pass stopped because NO node could serve the pinned model.
17909
+ *
17910
+ * Distinct from `notRunnable` on purpose: that one says "this track was
17911
+ * refused", this one says "the cluster cannot do this work at all" — every
17912
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
17913
+ * pinned model for its engine format, or dropped out. The remedy is a model /
17914
+ * engine change, not a per-camera one. Non-zero here always comes with
17915
+ * `complete: false`.
17916
+ */
17917
+ noCapableNode: number(),
17918
+ failed: number(),
17919
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
17920
+ complete: boolean().nullable(),
17921
+ startedAtMs: number().nullable(),
17922
+ finishedAtMs: number().nullable(),
17923
+ /** Present when the pass ended by throwing. */
17924
+ error: string().nullable()
17925
+ });
17926
+ var ReplayFrameInputSchema = object({
17927
+ timestamp: number(),
17928
+ frame: PipelineRunResultBridge
17929
+ });
17930
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
17931
+ className: string(),
17932
+ firstSeenMs: number(),
17933
+ lastSeenMs: number(),
17934
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
17935
+ * frame — a representative box for the diff's `(className, window, IoU)`
17936
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
17937
+ * trajectory production's `Track.positions` keeps. */
17938
+ bbox: BoundingBoxSchema,
17939
+ /** How many of the input frames this track matched a real detection on
17940
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
17941
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
17942
+ framesMatched: number().int()
17943
+ })).readonly() });
17944
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17945
+ deviceId: number(),
17946
+ trackId: string()
17947
+ }), TrackSchema.nullable()), method(object({
17948
+ deviceId: number(),
17949
+ since: number().optional(),
17950
+ until: number().optional(),
17951
+ limit: number().optional(),
17952
+ /** Spatial filter — only tracks whose trajectory intersects the zone
17953
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17954
+ * envelope columns, then precisely tested per position. Tracks with
17955
+ * an unknown envelope (no frame dims at persist time) always match. */
17956
+ zone: TrackZoneFilterSchema.optional(),
17957
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
17958
+ * compatible — omitting the field keeps today's exact behaviour). */
17959
+ projection: TrackProjectionSchema.optional(),
17960
+ /** Include stationary-promoted rows (parked objects handed to the
17961
+ * stationary registry). Default false: the timeline lists passages,
17962
+ * not parking records (operator decision, 2026-08-15). */
17963
+ includeStationary: boolean().optional()
17964
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17965
+ deviceId: number(),
17966
+ groupId: string().min(1)
17967
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17968
+ kind: "mutation",
17969
+ auth: "admin"
17970
+ }), 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({
17971
+ deviceId: number(),
17972
+ since: number().optional(),
17973
+ until: number().optional(),
17974
+ kinds: array(string()).optional(),
17975
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17976
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17977
+ deviceId: number(),
17978
+ since: number(),
17979
+ until: number(),
17980
+ bucketMs: number().int().positive()
17981
+ }), array(object({
17982
+ bucketStart: number(),
17983
+ motion: number().int(),
17984
+ object: number().int(),
17985
+ audio: number().int()
17986
+ })).readonly()), method(object({
17987
+ deviceId: number(),
17988
+ cutoffMs: number()
17989
+ }), object({
17990
+ motion: number().int(),
17991
+ object: number().int(),
17992
+ audio: number().int()
17993
+ }), {
17994
+ kind: "mutation",
17995
+ auth: "admin"
17996
+ }), method(object({
17997
+ deviceId: number(),
17998
+ cutoffMs: number()
17999
+ }), TrackCascadeCountsSchema, {
18000
+ kind: "mutation",
18001
+ auth: "admin"
18002
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18003
+ kind: "mutation",
18004
+ auth: "admin"
18005
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18006
+ kind: "mutation",
18007
+ auth: "admin"
18008
+ }), method(object({
18009
+ deviceId: number(),
18010
+ trackIds: array(string()).min(1)
18011
+ }), object({
18012
+ deleted: number().int(),
18013
+ failed: array(string()).readonly()
18014
+ }), {
18015
+ kind: "mutation",
18016
+ auth: "admin"
18017
+ }), method(object({
18018
+ /** Log/audit scope only — the trackId is globally unique on its own. */
18019
+ deviceId: number(),
18020
+ trackId: string(),
18021
+ flags: TrackFlagsPatchSchema
18022
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18023
+ kind: "query",
18024
+ auth: "admin"
18025
+ }), method(object({
18026
+ olderThanMs: number(),
18027
+ reason: OpsLogReasonSchema.optional()
18028
+ }), EventPruneCountsSchema, {
18029
+ kind: "mutation",
18030
+ auth: "admin"
18031
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
18032
+ kind: "mutation",
18033
+ auth: "admin"
18034
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18035
+ kind: "mutation",
18036
+ auth: "admin"
18037
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18038
+ kind: "mutation",
18039
+ auth: "admin"
18040
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
18041
+ kind: "mutation",
18042
+ auth: "admin"
18043
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
18044
+ kind: "mutation",
18045
+ auth: "admin"
18046
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18047
+ kind: "mutation",
18048
+ auth: "admin"
18049
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18050
+ kind: "mutation",
18051
+ auth: "admin"
18052
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18053
+ kind: "query",
18054
+ auth: "admin"
18055
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18056
+ kind: "mutation",
18057
+ auth: "admin"
18058
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
18059
+ kind: "query",
18060
+ auth: "admin"
18061
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
18062
+ kind: "query",
18063
+ auth: "admin"
18064
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18065
+ kind: "query",
18066
+ auth: "admin"
18067
+ }), method(object({
18068
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
18069
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
18070
+ * route it at one camera's owner, and "every camera" would stop being
18071
+ * expressible at all. */
18072
+ deviceIds: array(number()).optional(),
18073
+ limit: number().int().min(1).max(500).optional()
18074
+ }), array(RetrainTrackSchema).readonly(), {
18075
+ kind: "query",
18076
+ auth: "admin"
18077
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
18078
+ kind: "query",
18079
+ auth: "admin"
18080
+ }), method(object({
18081
+ deviceId: number(),
18082
+ trackId: string(),
18083
+ mediaKeys: array(string()).min(1)
18084
+ }), RetrainFrameSelectionSchema, {
17763
18085
  kind: "mutation",
17764
18086
  auth: "admin"
17765
- }), method(object({ nodeId: string() }), object({
17766
- success: literal(true),
17767
- clearedDevices: number()
18087
+ }), method(object({
18088
+ deviceId: number(),
18089
+ trackId: string(),
18090
+ frameId: string()
18091
+ }), object({
18092
+ removed: boolean(),
18093
+ removedAnnotations: number().int()
17768
18094
  }), {
17769
18095
  kind: "mutation",
17770
18096
  auth: "admin"
17771
- }), 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({
17772
- name: string(),
17773
- steps: array(PipelineTemplateStepSchema).readonly(),
17774
- engine: PipelineEngineChoiceSchema
17775
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17776
- id: string(),
17777
- name: string().optional(),
17778
- steps: array(PipelineTemplateStepSchema).readonly().optional()
17779
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17780
- addonId: string(),
17781
- modelId: string(),
17782
- format: ModelFormatSchema$1
17783
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17784
- addonId: string(),
17785
- modelId: string(),
17786
- format: ModelFormatSchema$1
17787
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17788
- engine: PipelineEngineChoiceSchema.optional(),
17789
- steps: array(PipelineStepInputSchema).min(1),
17790
- frame: FrameInputSchema.optional(),
17791
- /**
17792
- * Process-local lazy frame. Valid only when caller and provider resolve
17793
- * in the same execution-group process; split/cross-node callers use
17794
- * `frame`/`image` inline compatibility instead.
17795
- */
17796
- frameRef: FrameRefSchema.optional(),
17797
- /**
17798
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
17799
- * the decoded pixels live in. One more member of the one-of
17800
- * frame/frameHandle/image/imageBase64/referenceImage group.
17801
- */
17802
- frameHandle: FrameHandleSchema.optional(),
17803
- imageBase64: string().optional(),
17804
- /**
17805
- * Binary JPEG bytes — preferred over `imageBase64` on internal
17806
- * hops (hub → forked worker via Moleculer MsgPack) because it
17807
- * skips the 33% base64 overhead + the per-call base64 decode on
17808
- * the detection-pipeline worker. Callers can pass either; exactly
17809
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17810
- */
17811
- image: _instanceof(Uint8Array).optional(),
17812
- referenceImage: string().optional(),
17813
- deviceId: number().optional(),
17814
- sessionId: string().optional(),
17815
- /**
17816
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
17817
- * reference-image, and detail-subtree calls. 'frame' is the live
17818
- * per-frame dispatch: ONLY root-plane steps run; crop children
17819
- * (inputClasses ≠ null) are skipped and served per-track via
17820
- * pipelineRunner.runDetailSubtree (two-plane design).
17821
- */
17822
- plane: _enum(["full", "frame"]).optional(),
17823
- /**
17824
- * Inference-device selector (Phase 2 multi-device). Format
17825
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17826
- * Omitted ⇒ the runner's default device (current single-engine
17827
- * behaviour). Selects WHICH device pool of the node runs the call.
17828
- */
17829
- deviceKey: string().optional(),
17830
- /**
17831
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17832
- * when the parent crop was resolved from the frame's retained NATIVE
17833
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17834
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17835
- * resolution from that surface — the SAME quality path faces already
17836
- * had — instead of the downscaled parent tile. `handle` keys the native
17837
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17838
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17839
- * the executor's crop-normalized child ROI back into frame-normalized
17840
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17841
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17842
- * (today's behaviour on the fallback path).
17843
- */
17844
- nativeCropRef: NativeCropRefSchema.optional()
17845
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17846
- engine: PipelineEngineChoiceSchema.optional(),
17847
- steps: array(PipelineStepInputSchema).min(1),
17848
- frames: array(FrameInputSchema).min(1).max(255),
17849
- deviceId: number().optional(),
17850
- sessionId: string().optional(),
17851
- /**
17852
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17853
- * the batch to the Python pool's bench preprocess cache
17854
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17855
- * preprocessed ONCE and every later inference is a pure-inference cache
17856
- * hit — the sustained-throughput run measures inference, not
17857
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
17858
- * full preprocess every call, correct). Fresh per sustained run;
17859
- * released via `uncacheFrame`.
17860
- */
17861
- frameId: number().int().nonnegative().optional(),
17862
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17863
- deviceKey: string().optional()
17864
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17865
- data: _instanceof(Uint8Array),
17866
- width: number().int().positive(),
17867
- height: number().int().positive(),
17868
- format: _enum([
17869
- "rgb",
17870
- "bgr",
17871
- "gray"
17872
- ])
17873
- }), object({
17874
- frameId: number(),
17875
- width: number(),
17876
- height: number()
17877
- }), { kind: "mutation" }), method(object({
17878
- stepId: string(),
17879
- frameId: number().int()
17880
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17881
- batchMode: string(),
17882
- windowMs: number(),
17883
- maxBatchSize: number(),
17884
- concurrency: number()
17885
- })), method(_void(), array(object({
17886
- engineKey: string(),
17887
- engine: PipelineEngineChoiceSchema,
17888
- modelsLoaded: array(string()).readonly(),
17889
- inUseByCameras: array(number()).readonly(),
17890
- /**
17891
- * Origin of this resident factory.
17892
- * - `runtime` — main camera-serving engine (no idle TTL).
17893
- * - `warm-override` — benchmark/test override held in the warm
17894
- * cache; auto-disposed after the idle TTL.
17895
- * - `device-pool` — a concurrent per-device pool (Phase 2
17896
- * multi-device, keyed by `deviceKey`) resolved
17897
- * via `resolveDeviceFactory`. Runs alongside the
17898
- * `runtime` engine on a DIFFERENT accelerator
17899
- * (NPU / iGPU / Coral) — this is how the
17900
- * Engines tab shows all pools running at once.
17901
- */
17902
- kind: _enum([
17903
- "runtime",
17904
- "warm-override",
17905
- "device-pool"
17906
- ]),
17907
- /** Native pid of the underlying Python pool (null when no pool). */
17908
- poolPid: number().nullable(),
17909
- /** ms since this factory was last used (null when not warm-tracked). */
17910
- idleMs: number().nullable(),
17911
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17912
- idleTtlMs: number().nullable()
17913
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
18097
+ }), method(object({ frameId: string() }), object({
18098
+ base64: string(),
18099
+ width: number().int(),
18100
+ height: number().int()
18101
+ }), {
18102
+ kind: "query",
18103
+ auth: "admin"
18104
+ }), method(object({
18105
+ deviceId: number(),
18106
+ trackId: string(),
18107
+ frameId: string(),
18108
+ subject: RetrainAssistSubjectSchema,
18109
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18110
+ nodeId: string().optional()
18111
+ }), RetrainAssistResultSchema, {
17914
18112
  kind: "mutation",
17915
18113
  auth: "admin"
17916
18114
  }), method(object({
17917
- engine: PipelineEngineChoiceSchema,
17918
- force: boolean().optional()
17919
- }), object({
17920
- success: boolean(),
17921
- reason: string().optional()
17922
- }), {
18115
+ deviceId: number(),
18116
+ source: DetectionSourceSchema,
18117
+ zones: array(ZoneSchema).readonly().optional(),
18118
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
18119
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
18120
+ frames: array(ReplayFrameInputSchema).min(1)
18121
+ }), RunReplayFrameProcessorResultSchema, {
17923
18122
  kind: "mutation",
17924
18123
  auth: "admin"
17925
- }), 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({
17926
- addonId: string(),
17927
- modelId: string(),
17928
- filename: string().optional(),
17929
- settings: record(string(), unknown()).optional()
17930
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
18124
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
18125
+ kind: "query",
18126
+ auth: "admin"
18127
+ }), method(object({
18128
+ deviceId: number(),
18129
+ trackId: string(),
18130
+ frameId: string(),
18131
+ annotations: array(RetrainAnnotationDraftSchema)
18132
+ }), array(RetrainAnnotationSchema).readonly(), {
18133
+ kind: "mutation",
18134
+ auth: "admin"
18135
+ }), method(object({
18136
+ deviceId: number(),
18137
+ trackId: string()
18138
+ }), RetrainTransitionResultSchema, {
18139
+ kind: "mutation",
18140
+ auth: "admin"
18141
+ }), method(object({
18142
+ deviceId: number(),
18143
+ trackId: string()
18144
+ }), RetrainTransitionResultSchema, {
18145
+ kind: "mutation",
18146
+ auth: "admin"
18147
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18148
+ kind: "query",
18149
+ auth: "admin"
18150
+ }), method(object({
18151
+ eventId: string(),
18152
+ kind: MediaFileKindEnum.optional(),
18153
+ deviceId: number()
18154
+ }), array(MediaFileSchema).readonly()), method(object({
18155
+ trackId: string(),
18156
+ kinds: array(MediaFileKindEnum).optional(),
18157
+ deviceId: number()
18158
+ }), array(MediaFileSchema).readonly()), method(object({
18159
+ trackId: string(),
18160
+ deviceId: number()
18161
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18162
+ kind: "mutation",
18163
+ auth: "admin"
18164
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18165
+ kind: "mutation",
18166
+ auth: "admin"
18167
+ }), method(object({}), RebuildStatusSchema), object({
18168
+ deviceId: number(),
18169
+ timestamp: number(),
18170
+ frameWidth: number(),
18171
+ frameHeight: number(),
18172
+ detections: array(OverlayDetectionSchema).readonly()
18173
+ }), object({
18174
+ deviceId: number(),
18175
+ trackId: string(),
18176
+ className: string()
18177
+ }), object({
18178
+ deviceId: number(),
18179
+ trackId: string(),
18180
+ className: string(),
18181
+ durationMs: number()
18182
+ }), object({
18183
+ deviceId: number(),
18184
+ kind: EventKindSchema,
18185
+ eventId: string(),
18186
+ timestamp: number()
18187
+ });
17931
18188
  object({
17932
18189
  activeCameras: number(),
17933
18190
  throttledCameras: number(),
@@ -17953,66 +18210,6 @@ var CameraMetricsSchema = object({
17953
18210
  });
17954
18211
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
17955
18212
  /**
17956
- * Zone — pure geometry + identity. NO filtering behaviour.
17957
- *
17958
- * Zones describe **where** in the frame the operator wants to flag
17959
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
17960
- * each pipeline stage uses them. Splitting the two means a single
17961
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
17962
- * a detection-include rule on `['car']`, and an occupancy aggregate
17963
- * — without three duplicated polygons.
17964
- *
17965
- * Owned by the orchestrator addon (provider) and mirrored into the
17966
- * `zones` device-state slice on every mutation. Consumers
17967
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
17968
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
17969
- * mirror with `onChanged`).
17970
- *
17971
- * Coordinates are normalised fractions of the frame (0–1) so zones
17972
- * survive resolution changes and stream profile switches.
17973
- *
17974
- * `kind` discriminates between full polygons (closed regions used
17975
- * for intrusion / occupancy filters) and tripwires (open 2-point
17976
- * line segments used for cross events). Onboard / firmware-reported
17977
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17978
- * task list.
17979
- */
17980
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
17981
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17982
- var PolygonPointSchema = object({
17983
- x: number(),
17984
- y: number()
17985
- });
17986
- /** A camera detection zone — pure geometry/identity. */
17987
- var ZoneSchema = object({
17988
- id: string(),
17989
- name: string(),
17990
- kind: ZoneKindEnum.default("polygon"),
17991
- /** Polygon vertices, fraction of frame (0–1). */
17992
- polygon: array(PolygonPointSchema).readonly(),
17993
- /** Visual color for UI rendering. */
17994
- color: string().default("#3b82f6")
17995
- });
17996
- DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
17997
- deviceId: number(),
17998
- zone: ZoneSchema
17999
- }), _void(), {
18000
- kind: "mutation",
18001
- auth: "admin"
18002
- }), method(object({
18003
- deviceId: number(),
18004
- zoneId: string()
18005
- }), _void(), {
18006
- kind: "mutation",
18007
- auth: "admin"
18008
- }), method(object({
18009
- deviceId: number(),
18010
- zone: ZoneSchema
18011
- }), _void(), {
18012
- kind: "mutation",
18013
- auth: "admin"
18014
- }), object({ zones: array(ZoneSchema).readonly() });
18015
- /**
18016
18213
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
18017
18214
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
18018
18215
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -19700,7 +19897,7 @@ method(object({
19700
19897
  * linking rather than produce an eternal token.
19701
19898
  */
19702
19899
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19703
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
19900
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19704
19901
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19705
19902
  providerId: string().min(1),
19706
19903
  displayName: string().min(1),
@@ -19795,10 +19992,13 @@ var EvictResultSchema = object({
19795
19992
  /** True when the provider has nothing left it is willing to drop on this location. */
19796
19993
  exhausted: boolean()
19797
19994
  });
19798
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
19995
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19799
19996
  locationId: string(),
19800
19997
  targetBytes: number().int().positive()
19801
- }), EvictResultSchema, { kind: "mutation" });
19998
+ }), EvictResultSchema, {
19999
+ kind: "mutation",
20000
+ auth: "admin"
20001
+ });
19802
20002
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19803
20003
  kind: "mutation",
19804
20004
  auth: "admin"
@@ -19858,26 +20058,50 @@ var ReadChunkInputSchema = object({
19858
20058
  length: number()
19859
20059
  });
19860
20060
  var EndDownloadInputSchema = object({ downloadId: string() });
19861
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
20061
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19862
20062
  location: StorageLocationSchema,
19863
20063
  relativePath: string()
19864
- }), string()), method(object({
20064
+ }), string(), { auth: "admin" }), method(object({
19865
20065
  location: StorageLocationSchema,
19866
20066
  relativePath: string(),
19867
20067
  data: _instanceof(Uint8Array)
19868
- }), _void(), { kind: "mutation" }), method(object({
20068
+ }), _void(), {
20069
+ kind: "mutation",
20070
+ auth: "admin"
20071
+ }), method(object({
19869
20072
  location: StorageLocationSchema,
19870
20073
  relativePath: string()
19871
- }), _instanceof(Uint8Array)), method(object({
20074
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19872
20075
  location: StorageLocationSchema,
19873
20076
  relativePath: string()
19874
- }), boolean()), method(object({
20077
+ }), boolean(), { auth: "admin" }), method(object({
19875
20078
  location: StorageLocationSchema,
19876
20079
  prefix: string().optional()
19877
- }), array(string()).readonly()), method(object({
20080
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19878
20081
  location: StorageLocationSchema,
19879
20082
  relativePath: string()
19880
- }), _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" });
20083
+ }), _void(), {
20084
+ kind: "mutation",
20085
+ auth: "admin"
20086
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
20087
+ kind: "mutation",
20088
+ auth: "admin"
20089
+ }), method(WriteChunkInputSchema, _void(), {
20090
+ kind: "mutation",
20091
+ auth: "admin"
20092
+ }), method(FinalizeUploadInputSchema, _void(), {
20093
+ kind: "mutation",
20094
+ auth: "admin"
20095
+ }), method(AbortUploadInputSchema, _void(), {
20096
+ kind: "mutation",
20097
+ auth: "admin"
20098
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
20099
+ kind: "mutation",
20100
+ auth: "admin"
20101
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
20102
+ kind: "mutation",
20103
+ auth: "admin"
20104
+ });
19881
20105
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19882
20106
  var ProfileSettingsSchemaBridge = unknown().nullable();
19883
20107
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -20135,7 +20359,8 @@ method(object({
20135
20359
  access: "create"
20136
20360
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
20137
20361
  kind: "mutation",
20138
- access: "view"
20362
+ access: "view",
20363
+ auth: "admin"
20139
20364
  }), method(object({
20140
20365
  /** Required — the user the assertion belongs to (verified). */
20141
20366
  userId: string(),
@@ -20143,10 +20368,12 @@ method(object({
20143
20368
  response: record(string(), unknown())
20144
20369
  }), object({ verified: boolean() }), {
20145
20370
  kind: "mutation",
20146
- access: "view"
20371
+ access: "view",
20372
+ auth: "admin"
20147
20373
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
20148
20374
  kind: "mutation",
20149
- access: "view"
20375
+ access: "view",
20376
+ auth: "admin"
20150
20377
  }), method(object({
20151
20378
  /** AuthenticationResponseJSON from the browser. */
20152
20379
  response: record(string(), unknown()) }), object({
@@ -20154,7 +20381,8 @@ response: record(string(), unknown()) }), object({
20154
20381
  userId: string().nullable()
20155
20382
  }), {
20156
20383
  kind: "mutation",
20157
- access: "view"
20384
+ access: "view",
20385
+ auth: "admin"
20158
20386
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
20159
20387
  userId: string(),
20160
20388
  credentialId: string()
@@ -20326,7 +20554,19 @@ var VectorStatsResultSchema = object({
20326
20554
  /** False when the backend ranks approximately. */
20327
20555
  exact: boolean()
20328
20556
  });
20329
- 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);
20557
+ method(VectorDeclareIndexInputSchema, _void(), {
20558
+ kind: "mutation",
20559
+ auth: "admin"
20560
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20561
+ kind: "mutation",
20562
+ auth: "admin"
20563
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20564
+ kind: "mutation",
20565
+ auth: "admin"
20566
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20567
+ kind: "mutation",
20568
+ auth: "admin"
20569
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20330
20570
  var ClipSchema = object({
20331
20571
  /** Opaque, provider-namespaced id. The default provider encodes the time
20332
20572
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -22049,7 +22289,27 @@ var MediaFileLiteSchema$1 = object({
22049
22289
  sizeBytes: number(),
22050
22290
  timestamp: number()
22051
22291
  });
22052
- method(_void(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22292
+ method(object({
22293
+ /**
22294
+ * Inline {@link IdentitySchema.coverBase64} on every row.
22295
+ *
22296
+ * Default `false`, the same inversion `listRecentFaces` and
22297
+ * `listPlates` took on 2026-08-25 (see `include-crops-default.ts` for
22298
+ * why the burden belongs on the caller that WANTS the bytes). Measured
22299
+ * on the live hub the same day: four identities cost 40,979 B with the
22300
+ * covers inline, ~10 KB of base64 per row, on a query this UI mounts
22301
+ * four times and the viewer holds at `staleTime: 30_000`.
22302
+ *
22303
+ * Nothing loses its avatar: `coverMediaKey` is already on every row and
22304
+ * the `event-media` plane serves that key `immutable` with an ETag.
22305
+ *
22306
+ * **This is an INPUT field, so it does not reach the addon until the
22307
+ * next train** — the hub router validates cap inputs against its own
22308
+ * compiled Zod and strips a key it does not know. Until then the
22309
+ * provider sees `undefined`, which resolves to `false`: the cheap shape
22310
+ * is what ships, and the opt-in becomes reachable when the train lands.
22311
+ */
22312
+ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22053
22313
  kind: "mutation",
22054
22314
  auth: "admin"
22055
22315
  }), method(object({
@@ -24196,8 +24456,10 @@ var PlateInfoSchema = object({
24196
24456
  keyFrameMediaKey: string().optional(),
24197
24457
  base64: string().optional(),
24198
24458
  /**
24199
- * Same crop as a data-plane URL. `getPlateByTrack` returns this and
24200
- * never inlines JPEG; `listPlates` still inlines for the admin-ui.
24459
+ * Same crop as a data-plane URL, always present when the plate has a stored
24460
+ * crop. `getPlateByTrack` returns this and never inlines JPEG; `listPlates`
24461
+ * and `searchPlates` inline the crop only when their `includeCrops` input is
24462
+ * left at its `true` default.
24201
24463
  */
24202
24464
  cropUrl: string().optional()
24203
24465
  });
@@ -24217,14 +24479,34 @@ var PlateClusterSchema = object({
24217
24479
  });
24218
24480
  method(object({
24219
24481
  deviceId: number().int().optional(),
24220
- limit: number().int().positive().optional()
24482
+ limit: number().int().positive().optional(),
24483
+ /**
24484
+ * Inline the base64 crop on every row. Default `true` — the existing
24485
+ * behaviour, kept so no caller breaks.
24486
+ *
24487
+ * Set `false` once the caller renders {@link PlateInfo.cropUrl}.
24488
+ * Measured on the live hub at the 500 rows the Plates view asks for:
24489
+ * 879,403 B and 27.7 s with the crops inline, against a few KiB of
24490
+ * metadata without them — and the browser then caches the images.
24491
+ *
24492
+ * This is the plate twin of `faceGallery.listRecentFaces`'s option;
24493
+ * plates were the one gallery list left without it.
24494
+ *
24495
+ * **This is an INPUT field, so it does not reach the addon until the
24496
+ * next train.** The hub router validates cap inputs against its own
24497
+ * compiled Zod and strips a key it does not know. Until the train
24498
+ * ships, sending `false` is harmless and keeps the crops inline.
24499
+ */
24500
+ includeCrops: boolean().optional()
24221
24501
  }).optional(), array(PlateInfoSchema).readonly()), method(object({
24222
24502
  deviceId: number().int(),
24223
24503
  trackId: string()
24224
24504
  }), PlateInfoSchema.nullable()), method(object({ plateId: string() }), array(MediaFileLiteSchema).readonly()), method(object({
24225
24505
  text: string().min(1),
24226
24506
  maxDistance: number().int().min(0).optional(),
24227
- limit: number().int().positive().optional()
24507
+ limit: number().int().positive().optional(),
24508
+ /** See `listPlates.includeCrops`. Default `true`. */
24509
+ includeCrops: boolean().optional()
24228
24510
  }), array(PlateInfoSchema).readonly()), method(object({
24229
24511
  maxDistance: number().int().min(0).optional(),
24230
24512
  minClusterSize: number().int().min(2).optional(),
@@ -24238,7 +24520,13 @@ method(object({
24238
24520
  }), method(object({ plateId: string() }), _void(), {
24239
24521
  kind: "mutation",
24240
24522
  auth: "admin"
24241
- }), method(_void(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24523
+ }), method(object({
24524
+ /** Inline {@link VehicleSchema.coverBase64} on every row. Default
24525
+ * `false` — the vehicle twin of `faceGallery.listIdentities`'s
24526
+ * option; `coverMediaKey` + the `event-media` plane carry the picture.
24527
+ * INPUT field: stripped by the hub router until the train ships, which
24528
+ * resolves to `false` and is exactly the intended default. */
24529
+ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24242
24530
  kind: "mutation",
24243
24531
  auth: "admin"
24244
24532
  }), method(object({
@@ -25503,92 +25791,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
25503
25791
  kind: "mutation",
25504
25792
  auth: "admin"
25505
25793
  });
25506
- /**
25507
- * Per-stage gating mode applied to the zones a rule references.
25508
- *
25509
- * - `include`: the rule contributes to a **whitelist** for its stage.
25510
- * When at least one `include` rule fires for a stage, only entities
25511
- * inside one of those zones pass that stage.
25512
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
25513
- * Entities inside one of those zones are dropped at that stage.
25514
- *
25515
- * `monitor`-style observation (count without filtering) is not a rule
25516
- * mode — zones without any matching rule are observed naturally by
25517
- * `zone-analytics` (live snapshot + history), so an "I just want to
25518
- * count, not filter" use case needs no rule at all.
25519
- */
25520
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
25521
- /**
25522
- * Per-consumer rule that references existing zones (geometry) and
25523
- * defines how a specific pipeline stage should treat them. Each
25524
- * consumer addon owns its own `ZoneRule[]` array in its per-device
25525
- * settings:
25526
- *
25527
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
25528
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
25529
- * - future: notification rules, audio gating, etc.
25530
- *
25531
- * One rule applies to N zones (`zoneIds[]`) so the operator can
25532
- * express "ignore motion in ALL of {garden, street}" with a single
25533
- * rule. `classFilter` narrows the rule to specific object classes —
25534
- * "drop person detections in the street, but keep cars" is one
25535
- * `exclude` rule with `classFilter: ['person']`.
25536
- *
25537
- * `enabled` is a soft toggle — the operator can keep the rule
25538
- * configured but inert without deleting it.
25539
- */
25540
- var ZoneRuleSchema = object({
25541
- /** Stable rule id — survives edits, used by the UI for diffing. */
25542
- id: string(),
25543
- /** Optional human-readable label rendered in the rule editor. */
25544
- name: string().optional(),
25545
- /** Zones this rule targets. The rule's `mode` applies to ALL
25546
- * listed zones (OR-set: a detection in any one of them counts).
25547
- * At least one zone id required — a rule with no targets is a
25548
- * configuration mistake and the form validator rejects it. */
25549
- zoneIds: array(string()).min(1).readonly(),
25550
- mode: ZoneRuleModeEnum,
25551
- /**
25552
- * Class names this rule applies to. Empty / undefined ⇒ rule
25553
- * applies to every class. Class strings match the `macroClass`
25554
- * field on detections (e.g. `person`, `car`, `dog`).
25555
- */
25556
- classFilter: array(string()).readonly().optional(),
25557
- /**
25558
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
25559
- * required to consider an entity "in the zone". Defaults to the
25560
- * consumer's stage default when omitted. Kept for back-compat with
25561
- * existing per-rule overrides; new operators pick the value via
25562
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
25563
- * set, the lower-level engine reads it as a 0–1 fraction.
25564
- */
25565
- overlapThreshold: number().min(0).max(1).optional(),
25566
- /**
25567
- * Operator-friendly version of `overlapThreshold` — the percentage
25568
- * of the detection's bbox that must lie inside the zone for the
25569
- * rule to match. Documented default is 85%; the engine substitutes
25570
- * that when the field is omitted (kept optional so existing rules
25571
- * stored without it stay valid).
25572
- *
25573
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
25574
- * rule, the engine prefers `bboxInclusionPct` because it's the
25575
- * field exposed in the UI. Internally both feed the same gate.
25576
- */
25577
- bboxInclusionPct: number().min(0).max(100).optional(),
25578
- /**
25579
- * When `true` and a detection has a segmentation mask, use the
25580
- * mask for overlap instead of the bbox. Detection-stage only;
25581
- * motion rules ignore this field.
25582
- */
25583
- preferMask: boolean().optional(),
25584
- /**
25585
- * Soft-toggle: `false` disables the rule without deleting it.
25586
- * Defaults to `true` so operators creating a rule via the UI
25587
- * see it active immediately.
25588
- */
25589
- enabled: boolean().default(true)
25590
- });
25591
- array(ZoneRuleSchema).readonly();
25592
25794
  object({
25593
25795
  /** Whether the script is currently executing. */
25594
25796
  isRunning: boolean(),
@@ -29615,6 +29817,12 @@ Object.freeze({
29615
29817
  addonId: null,
29616
29818
  access: "create"
29617
29819
  },
29820
+ "pipelineAnalytics.cancelRelocateMedia": {
29821
+ capName: "pipeline-analytics",
29822
+ capScope: "device",
29823
+ addonId: null,
29824
+ access: "create"
29825
+ },
29618
29826
  "pipelineAnalytics.cancelStorageMigrationMove": {
29619
29827
  capName: "pipeline-analytics",
29620
29828
  capScope: "device",
@@ -29789,6 +29997,12 @@ Object.freeze({
29789
29997
  addonId: null,
29790
29998
  access: "view"
29791
29999
  },
30000
+ "pipelineAnalytics.listRelocateMediaJobs": {
30001
+ capName: "pipeline-analytics",
30002
+ capScope: "device",
30003
+ addonId: null,
30004
+ access: "view"
30005
+ },
29792
30006
  "pipelineAnalytics.listRetrainAnnotations": {
29793
30007
  capName: "pipeline-analytics",
29794
30008
  capScope: "device",
@@ -29867,6 +30081,12 @@ Object.freeze({
29867
30081
  addonId: null,
29868
30082
  access: "create"
29869
30083
  },
30084
+ "pipelineAnalytics.relocateMedia": {
30085
+ capName: "pipeline-analytics",
30086
+ capScope: "device",
30087
+ addonId: null,
30088
+ access: "create"
30089
+ },
29870
30090
  "pipelineAnalytics.restageRetrainTrack": {
29871
30091
  capName: "pipeline-analytics",
29872
30092
  capScope: "device",
@@ -29879,6 +30099,12 @@ Object.freeze({
29879
30099
  addonId: null,
29880
30100
  access: "create"
29881
30101
  },
30102
+ "pipelineAnalytics.runReplayFrameProcessor": {
30103
+ capName: "pipeline-analytics",
30104
+ capScope: "device",
30105
+ addonId: null,
30106
+ access: "create"
30107
+ },
29882
30108
  "pipelineAnalytics.saveRetrainAnnotations": {
29883
30109
  capName: "pipeline-analytics",
29884
30110
  capScope: "device",
@@ -30011,6 +30237,12 @@ Object.freeze({
30011
30237
  addonId: null,
30012
30238
  access: "view"
30013
30239
  },
30240
+ "pipelineExecutor.getInferenceDeviceHealth": {
30241
+ capName: "pipeline-executor",
30242
+ capScope: "system",
30243
+ addonId: null,
30244
+ access: "view"
30245
+ },
30014
30246
  "pipelineExecutor.getOrchestratorConfigSchema": {
30015
30247
  capName: "pipeline-executor",
30016
30248
  capScope: "system",
@@ -30083,6 +30315,12 @@ Object.freeze({
30083
30315
  addonId: null,
30084
30316
  access: "view"
30085
30317
  },
30318
+ "pipelineExecutor.rearmInferenceDevice": {
30319
+ capName: "pipeline-executor",
30320
+ capScope: "system",
30321
+ addonId: null,
30322
+ access: "create"
30323
+ },
30086
30324
  "pipelineExecutor.runAudioTest": {
30087
30325
  capName: "pipeline-executor",
30088
30326
  capScope: "system",
@@ -33331,6 +33569,11 @@ Object.freeze({
33331
33569
  form: "single",
33332
33570
  optional: false
33333
33571
  }],
33572
+ "pipelineAnalytics.runReplayFrameProcessor": [{
33573
+ name: "deviceId",
33574
+ form: "single",
33575
+ optional: false
33576
+ }],
33334
33577
  "pipelineAnalytics.saveRetrainAnnotations": [{
33335
33578
  name: "deviceId",
33336
33579
  form: "single",