@camstack/addon-auth 1.2.31 → 1.2.33

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