@camstack/addon-decoder-ffmpeg 1.2.27 → 1.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +2085 -1842
  2. package/dist/index.mjs +2085 -1842
  3. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -6631,7 +6631,7 @@ function method(input, output, options) {
6631
6631
  input,
6632
6632
  output,
6633
6633
  kind: options?.kind ?? "query",
6634
- auth: options?.auth ?? "protected",
6634
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6635
6635
  ...options?.access !== void 0 ? { access: options.access } : {},
6636
6636
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6637
6637
  timeoutMs: options?.timeoutMs
@@ -6651,7 +6651,7 @@ function systemMethod(input, output, options) {
6651
6651
  }
6652
6652
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
6653
6653
  var VersionOutputSchema$1 = object({ version: string() });
6654
- method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6654
+ method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
6655
6655
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
6656
6656
  DeviceType["Camera"] = "camera";
6657
6657
  DeviceType["Hub"] = "hub";
@@ -6972,7 +6972,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6972
6972
  }({});
6973
6973
  var StaticDirOutputSchema = object({ staticDir: string() });
6974
6974
  var VersionOutputSchema = object({ version: string() });
6975
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6975
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
6976
6976
  /**
6977
6977
  * device-ops — device-scoped cap that unifies the per-IDevice operations
6978
6978
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7598,24 +7598,6 @@ var RecordingRetentionSchema = object({
7598
7598
  maxSizeGb: number().min(0).optional()
7599
7599
  });
7600
7600
  /**
7601
- * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7602
- * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7603
- * previews at. Five graduated steps; absent on a config = `standard` (the
7604
- * shipped default, matching `sheet-geometry`/`sheet-composer`).
7605
- *
7606
- * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7607
- * Each window's index sidecar carries its own tile dims, so a camera whose
7608
- * preset changed over time renders every historical window at the dims it was
7609
- * written with.
7610
- */
7611
- var ScrubThumbnailPresetSchema = _enum([
7612
- "minimal",
7613
- "low",
7614
- "standard",
7615
- "high",
7616
- "max"
7617
- ]);
7618
- /**
7619
7601
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7620
7602
  *
7621
7603
  * `bands` is the ONLY authored recording intent: what to record, when, and on
@@ -7623,7 +7605,11 @@ var ScrubThumbnailPresetSchema = _enum([
7623
7605
  * other field is a storage knob (profiles, segment length, retention, scrub).
7624
7606
  *
7625
7607
  * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7626
- * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7608
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30,
7609
+ * and `scrubThumbnails` — a five-step fidelity knob for a sprite tier that was
7610
+ * deleted on 2026-07-24 and had ZERO consumers in the recorder — on 2026-08-25
7611
+ * (D62: a switch that writes a store nobody reads is worse than no switch).
7612
+ * Stored rows keep loading: the READ schema is `.strip()` (config-store.ts).
7627
7613
  * A stale caller must fail loudly — silently stripping its legacy intent would
7628
7614
  * persist a band-less config, i.e. silently stop recording the camera.
7629
7615
  */
@@ -7646,14 +7632,7 @@ var RecordingConfigSchema = object({
7646
7632
  * "off" is the absence of a covering band, never a band value.
7647
7633
  */
7648
7634
  bands: array(RecordingBandSchema).default([]),
7649
- retention: RecordingRetentionSchema.optional(),
7650
- /**
7651
- * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7652
- * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7653
- * windows only — existing sheets are immutable, and each window's index
7654
- * carries its own tile dims so mixed-preset history renders correctly.
7655
- */
7656
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7635
+ retention: RecordingRetentionSchema.optional()
7657
7636
  }).strict();
7658
7637
  /**
7659
7638
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
@@ -7729,10 +7708,11 @@ var RelocateFootageInputSchema = object({
7729
7708
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7730
7709
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7731
7710
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7732
- var StorageMigrationMediaMoveInputSchema = object({
7711
+ var RelocateMediaInputSchema = object({
7733
7712
  toLocationId: string(),
7734
7713
  throttleMbps: number().min(1).max(1e3).optional()
7735
- }).extend({ leaseId: string().min(1) });
7714
+ });
7715
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7736
7716
  /** The independently selectable logical storage classes. `recordings`
7737
7717
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7738
7718
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8027,7 +8007,26 @@ var LabelDefinitionSchema = object({
8027
8007
  description: string().optional(),
8028
8008
  icon: string().optional()
8029
8009
  });
8030
- var ClassMapDefinitionSchema = object({
8010
+ /**
8011
+ * Wire schema for a per-model CATALOG classMap override
8012
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8013
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8014
+ * detection pipeline executor actually routes.
8015
+ *
8016
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8017
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8018
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8019
+ * enum) — the two used to share the name `ClassMapDefinition`/
8020
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8021
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8022
+ * are not: it is two different concepts colliding on a name. Keep this type
8023
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8024
+ * would either narrow every `ClassMapDefinition` consumer to the four
8025
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8026
+ * schema exists for (see the "rejects a classMap whose target is not a
8027
+ * detection macro" test in `model-catalog-schema.test.ts`).
8028
+ */
8029
+ var DetectionCatalogClassMapSchema = object({
8031
8030
  mapping: record(string(), _enum([
8032
8031
  "person",
8033
8032
  "vehicle",
@@ -8232,7 +8231,7 @@ var ModelCatalogEntrySchema = object({
8232
8231
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8233
8232
  * labels already ARE the CamStack macros (Scrypted identity map).
8234
8233
  */
8235
- classMap: ClassMapDefinitionSchema.optional()
8234
+ classMap: DetectionCatalogClassMapSchema.optional()
8236
8235
  });
8237
8236
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8238
8237
  format: literal("openvino"),
@@ -8262,7 +8261,7 @@ var ModelConvertMetadataSchema = object({
8262
8261
  "segmentation"
8263
8262
  ]),
8264
8263
  faceAlignment: boolean().optional(),
8265
- classMap: ClassMapDefinitionSchema.optional()
8264
+ classMap: DetectionCatalogClassMapSchema.optional()
8266
8265
  });
8267
8266
  var ConvertResultSchema = object({
8268
8267
  entry: ModelCatalogEntrySchema,
@@ -9125,7 +9124,7 @@ var AddonPageDeclarationSchema = object({
9125
9124
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9126
9125
  sectionLabel: string().optional()
9127
9126
  });
9128
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9127
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9129
9128
  var AddonHttpRouteSchema = object({
9130
9129
  method: _enum([
9131
9130
  "GET",
@@ -9360,7 +9359,7 @@ var WidgetMetadataSchema = object({
9360
9359
  defaultColumns: number().int().min(1).max(12).default(6),
9361
9360
  defaultRows: number().int().min(1).max(12).default(1)
9362
9361
  });
9363
- method(_void(), array(WidgetMetadataSchema).readonly());
9362
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9364
9363
  /**
9365
9364
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9366
9365
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -10919,7 +10918,7 @@ var CustomModelDescriptorSchema = object({
10919
10918
  stepId: string(),
10920
10919
  entry: ModelCatalogEntrySchema
10921
10920
  });
10922
- method(_void(), array(CustomModelDescriptorSchema).readonly());
10921
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
10923
10922
  /**
10924
10923
  * Query filter for settings-store collections.
10925
10924
  */
@@ -11006,7 +11005,8 @@ method(object({
11006
11005
  }), _void(), { kind: "mutation" }), method(object({
11007
11006
  namespace: string().optional(),
11008
11007
  collection: string(),
11009
- filter: QueryFilterSchema.optional()
11008
+ filter: QueryFilterSchema.optional(),
11009
+ columns: array(string()).readonly().optional()
11010
11010
  }), array(SettingsRecordSchema).readonly()), method(object({
11011
11011
  namespace: string().optional(),
11012
11012
  collection: string(),
@@ -11069,46 +11069,87 @@ var EngineInfoSchema = object({
11069
11069
  kind: _enum(["relational", "vector"]),
11070
11070
  displayName: string()
11071
11071
  });
11072
- method(_void(), EngineInfoSchema), method(object({
11072
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11073
11073
  namespace: string().optional(),
11074
11074
  collection: string(),
11075
11075
  key: string()
11076
- }), unknown()), method(object({
11076
+ }), unknown(), { auth: "admin" }), method(object({
11077
11077
  namespace: string().optional(),
11078
11078
  collection: string(),
11079
11079
  key: string(),
11080
11080
  value: unknown()
11081
- }), _void(), { kind: "mutation" }), method(object({
11081
+ }), _void(), {
11082
+ kind: "mutation",
11083
+ auth: "admin"
11084
+ }), method(object({
11082
11085
  namespace: string().optional(),
11083
11086
  collection: string(),
11084
- filter: QueryFilterSchema.optional()
11085
- }), array(SettingsRecordSchema).readonly()), method(object({
11087
+ filter: QueryFilterSchema.optional(),
11088
+ /**
11089
+ * SQL-level column projection — MUST mirror `settings-store.query`.
11090
+ *
11091
+ * ⚠ An earlier version of this comment blamed Zod stripping, and that
11092
+ * was wrong — corrected 2026-08-26 after the hop map
11093
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11094
+ * There is **no Zod parse at all** between the door and the engine: the
11095
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11096
+ * field declared here reaches `SqliteSettingsBackend` either way.
11097
+ *
11098
+ * What actually lost `columns` was the THIRD declaration of this shape:
11099
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11100
+ * interface the engine destructures from. The field existed on both
11101
+ * schemas and the engine still never read it, because nothing checks a
11102
+ * registered provider against `InferProvider<cap>` —
11103
+ * `ProviderRegistration.provider` is typed `object`.
11104
+ *
11105
+ * It is declared here anyway, and must stay in step with
11106
+ * `settings-store.query`: a caller reading only the cap definitions has
11107
+ * to be able to see that this call carries a projection.
11108
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11109
+ */
11110
+ columns: array(string()).readonly().optional()
11111
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11086
11112
  namespace: string().optional(),
11087
11113
  collection: string(),
11088
11114
  record: SettingsRecordSchema
11089
- }), _void(), { kind: "mutation" }), method(object({
11115
+ }), _void(), {
11116
+ kind: "mutation",
11117
+ auth: "admin"
11118
+ }), method(object({
11090
11119
  namespace: string().optional(),
11091
11120
  collection: string(),
11092
11121
  id: string(),
11093
11122
  data: record(string(), unknown())
11094
- }), _void(), { kind: "mutation" }), method(object({
11123
+ }), _void(), {
11124
+ kind: "mutation",
11125
+ auth: "admin"
11126
+ }), method(object({
11095
11127
  namespace: string().optional(),
11096
11128
  collection: string(),
11097
11129
  key: string()
11098
- }), _void(), { kind: "mutation" }), method(object({
11130
+ }), _void(), {
11131
+ kind: "mutation",
11132
+ auth: "admin"
11133
+ }), method(object({
11099
11134
  namespace: string().optional(),
11100
11135
  collection: string(),
11101
11136
  filter: MutationFilterSchema
11102
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11137
+ }), object({ deleted: number().int() }), {
11138
+ kind: "mutation",
11139
+ auth: "admin"
11140
+ }), method(object({
11103
11141
  namespace: string().optional(),
11104
11142
  collection: string(),
11105
11143
  filter: MutationFilterSchema,
11106
11144
  data: record(string(), unknown())
11107
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11145
+ }), object({ updated: number().int() }), {
11146
+ kind: "mutation",
11147
+ auth: "admin"
11148
+ }), method(object({
11108
11149
  namespace: string().optional(),
11109
11150
  collection: string(),
11110
11151
  filter: QueryFilterSchema.optional()
11111
- }), number()), method(object({
11152
+ }), number(), { auth: "admin" }), method(object({
11112
11153
  namespace: string().optional(),
11113
11154
  collection: string(),
11114
11155
  field: string(),
@@ -11118,15 +11159,18 @@ method(_void(), EngineInfoSchema), method(object({
11118
11159
  }), array(object({
11119
11160
  bucket: number().int(),
11120
11161
  count: number().int()
11121
- })).readonly()), method(object({
11162
+ })).readonly(), { auth: "admin" }), method(object({
11122
11163
  namespace: string().optional(),
11123
11164
  collection: string()
11124
- }), boolean()), method(object({
11165
+ }), boolean(), { auth: "admin" }), method(object({
11125
11166
  namespace: string().optional(),
11126
11167
  collection: string(),
11127
11168
  columns: array(CollectionColumnSchema).readonly(),
11128
11169
  indexes: array(CollectionIndexSchema).readonly().optional()
11129
- }), _void(), { kind: "mutation" });
11170
+ }), _void(), {
11171
+ kind: "mutation",
11172
+ auth: "admin"
11173
+ });
11130
11174
  /**
11131
11175
  * Stable UI option list for the `hwaccel` setting. Decoder addons
11132
11176
  * reuse this for `globalSettingsSchema()` so the dropdown is
@@ -12347,7 +12391,7 @@ method(object({
12347
12391
  crop: _instanceof(Uint8Array),
12348
12392
  width: number(),
12349
12393
  height: number()
12350
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12394
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12351
12395
  /**
12352
12396
  * filesystem-browse — per-node capability for browsing the node's local
12353
12397
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12640,19 +12684,22 @@ method(LlmGenerateBaseInputSchema.extend({
12640
12684
  runtime: ManagedRuntimeConfigSchema,
12641
12685
  /** The managed profile's timeout, threaded by the hub provider. */
12642
12686
  timeoutMs: number().int().positive().optional()
12643
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12687
+ }), LlmGenerateResultSchema, {
12688
+ kind: "mutation",
12689
+ auth: "admin"
12690
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12644
12691
  kind: "mutation",
12645
12692
  auth: "admin"
12646
12693
  }), method(object({}), _void(), {
12647
12694
  kind: "mutation",
12648
12695
  auth: "admin"
12649
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12696
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12650
12697
  kind: "mutation",
12651
12698
  auth: "admin"
12652
12699
  }), method(object({ file: string() }), _void(), {
12653
12700
  kind: "mutation",
12654
12701
  auth: "admin"
12655
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12702
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12656
12703
  /**
12657
12704
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12658
12705
  * methods concat-fan across providers; single-row methods route to ONE
@@ -16125,1748 +16172,1958 @@ var OauthIntegrationDescriptorSchema = object({
16125
16172
  */
16126
16173
  refreshTokenTtlSec: union([number().int().positive(), literal("never")]).optional()
16127
16174
  });
16128
- method(_void(), OauthIntegrationDescriptorSchema);
16175
+ method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
16129
16176
  /**
16130
- * pipeline-analytics device-scoped wrapper cap. Refines raw
16131
- * per-frame detections emitted by the pipeline runner into tracked
16132
- * objects, per-kind event collections (motion / object / audio), and
16133
- * persisted media. Owns the post-detection domain end-to-end:
16134
- *
16135
- * runner emits PipelineInferenceResult
16136
- * ↓ (event bus)
16137
- * pipeline-analytics subscriber
16138
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16139
- * → three DB collections (one per kind), one FS media tree, one
16140
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16141
- * DetectionEvent on bus)
16142
- *
16143
- * Pure subscriber model. No `processFrame` cap method — the runner
16144
- * already publishes the raw frame on the bus. The cap surface is
16145
- * only QUERIES + per-device settings, bound on/off via
16146
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16147
- * every camera with a detection pipeline wants its raw detections
16148
- * refined; operators opt out per-device via BindingsTab when needed.
16149
- *
16150
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16151
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16177
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16178
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16179
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16152
16180
  */
16153
- var TrackStateSchema = _enum([
16154
- "new",
16155
- "entered",
16156
- "left",
16157
- "moving",
16158
- "idle"
16159
- ]);
16160
- var EventKindSchema = _enum([
16161
- "motion",
16162
- "object",
16163
- "audio"
16164
- ]);
16181
+ var NativeCropRefSchema = object({
16182
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16183
+ handle: FrameHandleSchema,
16184
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16185
+ cropFrameSpace: object({
16186
+ x: number(),
16187
+ y: number(),
16188
+ w: number(),
16189
+ h: number()
16190
+ })
16191
+ });
16192
+ object({
16193
+ crop: object({
16194
+ left: number(),
16195
+ top: number(),
16196
+ width: number().positive(),
16197
+ height: number().positive()
16198
+ }).optional(),
16199
+ content: object({
16200
+ width: number().int().positive(),
16201
+ height: number().int().positive()
16202
+ }),
16203
+ fit: _enum(["stretch", "contain"]),
16204
+ format: _enum([
16205
+ "rgb",
16206
+ "gray",
16207
+ "jpeg"
16208
+ ])
16209
+ });
16165
16210
  /**
16166
- * Spatial filter for `listTracks` the rect + polygon variants of the shared
16167
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16168
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16211
+ * Process-local frame identity. It is serializable so it can ride an in-process
16212
+ * capability call, but `registryId` deliberately prevents resolution in any
16213
+ * other process or execution group.
16169
16214
  */
16170
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16171
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16172
- var EventKindIconSchema = _enum([
16173
- "motion",
16174
- "audio",
16175
- "person",
16176
- "vehicle",
16177
- "animal",
16178
- "door",
16179
- "pir",
16180
- "smoke",
16181
- "water",
16182
- "button",
16183
- "package",
16184
- "generic"
16215
+ var FrameRefSchema = object({
16216
+ registryId: string().min(1),
16217
+ id: string().min(1),
16218
+ width: number().int().positive(),
16219
+ height: number().int().positive(),
16220
+ format: _enum(["rgb", "gray"]),
16221
+ timestamp: number(),
16222
+ capturedAt: number().optional()
16223
+ });
16224
+ var ModelFormatSchema$1 = _enum([
16225
+ "onnx",
16226
+ "coreml",
16227
+ "openvino",
16228
+ "tflite",
16229
+ "pt",
16230
+ "gguf"
16185
16231
  ]);
16186
- var EventKindCategorySchema = _enum([
16187
- "motion",
16188
- "audio",
16189
- "detection",
16190
- "sensor",
16191
- "control",
16192
- "custom",
16193
- "package"
16232
+ var PipelineSlotSchema = _enum([
16233
+ "detector",
16234
+ "cropper",
16235
+ "classifier",
16236
+ "refiner",
16237
+ "audio-classifier"
16194
16238
  ]);
16195
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16196
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16197
- var EventKindDescriptorSchema = object({
16198
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16199
- kind: string(),
16200
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16201
- labelKey: string(),
16202
- /** English fallback label (kept for clients that don't translate). */
16203
- label: string(),
16204
- /** Hex color for timeline/legend rendering. */
16205
- color: string(),
16206
- /** Dictionary id → lucide component on the UI side. */
16207
- iconId: string(),
16208
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16209
- icon: EventKindIconSchema,
16210
- category: EventKindCategorySchema,
16211
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16212
- parentKind: string().nullable(),
16213
- /** Derived from `parentKind`, explicit for the client tree. */
16214
- level: EventKindLevelSchema,
16215
- /** Which cap + device contributes this kind. For built-ins the camera
16216
- * itself; for sensor kinds the LINKED source device. */
16217
- source: object({
16218
- capName: string(),
16219
- deviceId: number()
16220
- })
16239
+ var PipelineEngineChoiceSchema = object({
16240
+ runtime: _enum(["node", "python"]),
16241
+ backend: string(),
16242
+ format: ModelFormatSchema$1,
16243
+ device: string().optional()
16221
16244
  });
16222
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16223
- var EventKindsForDeviceSchema = object({
16224
- deviceId: number(),
16225
- kinds: array(EventKindDescriptorSchema).readonly()
16245
+ var AvailableEngineSchema = object({
16246
+ engine: PipelineEngineChoiceSchema,
16247
+ devices: array(object({
16248
+ id: string(),
16249
+ label: string(),
16250
+ description: string().optional()
16251
+ })).readonly(),
16252
+ defaultDevice: string()
16226
16253
  });
16227
- var SensorEventSchema = object({
16254
+ var PipelineDefaultStepSchema = lazy(() => object({
16255
+ addonId: string(),
16256
+ addonName: string(),
16257
+ slot: PipelineSlotSchema,
16258
+ inputClasses: array(string()).readonly(),
16259
+ outputClasses: array(string()).readonly(),
16260
+ enabled: boolean(),
16261
+ modelId: string(),
16262
+ children: array(PipelineDefaultStepSchema).readonly(),
16263
+ group: string().optional(),
16264
+ settings: record(string(), unknown()).optional()
16265
+ }));
16266
+ var PipelineTemplateStepSchema = lazy(() => object({
16267
+ addonId: string(),
16268
+ enabled: boolean(),
16269
+ modelId: string(),
16270
+ children: array(PipelineTemplateStepSchema).readonly(),
16271
+ settings: record(string(), unknown()).optional()
16272
+ }));
16273
+ var PipelineTemplateSchema$1 = object({
16228
16274
  id: string(),
16229
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16230
- * yields N rows, one per camera). */
16231
- deviceId: number(),
16232
- /** The linked sensor device whose state changed. */
16233
- sourceDeviceId: number(),
16234
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16235
- kind: string(),
16236
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16237
- value: record(string(), unknown()).nullable(),
16238
- timestamp: number()
16239
- });
16240
- var TrackPositionSchema = object({
16241
- x: number(),
16242
- y: number(),
16243
- timestamp: number(),
16244
- bbox: BoundingBoxSchema
16275
+ name: string(),
16276
+ createdAt: string(),
16277
+ updatedAt: string(),
16278
+ engine: PipelineEngineChoiceSchema,
16279
+ steps: array(PipelineTemplateStepSchema).readonly()
16245
16280
  });
16246
- var TrackSnapshotSchema = object({
16247
- timestamp: number(),
16248
- position: TrackPositionSchema,
16249
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16250
- mediaKey: string()
16281
+ var PipelineModelOptionSchema = object({
16282
+ id: string(),
16283
+ name: string(),
16284
+ formats: record(string(), object({
16285
+ downloaded: boolean(),
16286
+ sizeMB: number()
16287
+ })),
16288
+ group: ModelVariantGroupSchema.optional(),
16289
+ legacy: boolean().optional(),
16290
+ provider: ModelProviderIdSchema.optional()
16251
16291
  });
16252
- /**
16253
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16254
- * divided by the track's detection-frame dims), computed at persist time.
16255
- * Absent when the frame dims were unknown when the track was persisted
16256
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16257
- */
16258
- var TrackEnvelopeSchema = object({
16259
- minX: number(),
16260
- minY: number(),
16261
- maxX: number(),
16262
- maxY: number()
16292
+ var ConfigFieldBridge = custom();
16293
+ var PipelineAddonSchemaSchema = object({
16294
+ id: string(),
16295
+ name: string(),
16296
+ slot: PipelineSlotSchema,
16297
+ inputClasses: array(string()).readonly(),
16298
+ outputClasses: array(string()).readonly(),
16299
+ childSlots: array(PipelineSlotSchema).readonly(),
16300
+ models: array(PipelineModelOptionSchema).readonly(),
16301
+ defaultModelId: string(),
16302
+ defaultModelIdByFormat: record(string(), string()).optional(),
16303
+ enabledByDefault: boolean().optional(),
16304
+ backfillIntoExistingOverrides: boolean().optional(),
16305
+ defaultConfidence: number(),
16306
+ group: string().optional(),
16307
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16263
16308
  });
16264
- /**
16265
- * Row projection for track list queries. `full` (default) returns the
16266
- * complete Track including the frame-rate `positions[]` history and the
16267
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16268
- * keeps every scalar the list surfaces actually render (ids, class(es),
16269
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16270
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16271
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16272
- * `getTrack`. Mirrors the event-store `projection` convention
16273
- * (`getObjectEvents` et al.).
16274
- */
16275
- var TrackProjectionSchema = _enum(["full", "slim"]);
16276
- /**
16277
- * One audio-classification label heard on the track's camera while the
16278
- * track was alive, aggregated per label. An "episode" is one persisted
16279
- * audio event (the confident-classification path: score ≥ the device's
16280
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16281
- * one 32 ms inference chunk, so counts stay human-scaled.
16282
- */
16283
- var TrackAudioLabelSchema = object({
16309
+ var PipelineSlotSchemaSchema = object({
16310
+ id: PipelineSlotSchema,
16284
16311
  label: string(),
16285
- /** Highest classification score observed across the label's episodes. */
16286
- peakScore: number(),
16287
- /** Number of coalesced audio-event episodes carrying this label. */
16288
- count: number(),
16289
- firstAt: number(),
16290
- lastAt: number()
16312
+ priority: number(),
16313
+ parentSlot: PipelineSlotSchema.nullable(),
16314
+ addons: array(PipelineAddonSchemaSchema).readonly()
16291
16315
  });
16292
- /**
16293
- * How a track was produced. `pipeline` (default / absent) = the spatial
16294
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16295
- * no positions, a single snapshot, and no bbox trajectory at all:
16296
- *
16297
- * - `sensor` — a linked sensor/control device state change.
16298
- * - `audio` — an audio event on the camera itself that was anomalous for
16299
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16300
- *
16301
- * The spatial subsystems (tracker association, occupancy count, re-id /
16302
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16303
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16304
- * check silently readmits every source added after it was written.
16305
- */
16306
- var TrackSourceSchema = _enum([
16307
- "pipeline",
16308
- "sensor",
16309
- "audio"
16310
- ]);
16311
- /**
16312
- * Where a track sits in the RETRAIN lifecycle (D81).
16313
- *
16314
- * - `none` — never marked, or un-marked. Evictable.
16315
- * - `staging` — the operator wants this track as training material and has not
16316
- * finished with it. **This is the only state retention holds**: the track and
16317
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16318
- * the device's age window.
16319
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16320
- * were COPIED into the retrain dataset at selection time, so the dataset no
16321
- * longer depends on the track's media and the track becomes EVICTABLE again.
16322
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16323
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16324
- *
16325
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16326
- * the store's filter language has only positive equality and `whereIn` — no
16327
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16328
- * would make the entire pre-column history immortal in one deploy.
16329
- */
16330
- var RetrainStatusSchema = _enum([
16331
- "none",
16332
- "staging",
16333
- "trained"
16334
- ]);
16335
- /**
16336
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16337
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16338
- * so the two surfaces cannot drift.
16339
- *
16340
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16341
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16342
- * columns existed read as absent, and a consumer that needs a boolean should say
16343
- * `flag === true`, not `flag !== false`.
16344
- *
16345
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16346
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16347
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16348
- * `trained` track reports `false` while refusing both writes. The boolean is
16349
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16350
- * "never marked" from "already trained" must read `retrainStatus`.
16351
- *
16352
- * `debug` does NOT pin; it is attention, not durability.
16353
- *
16354
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16355
- * A favourited track is skipped by retention the same way `staging` is, but
16356
- * it does not enter `none|staging|trained` and has no staging budget.
16357
- */
16358
- var TrackFlagFields = {
16359
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16360
- * `'staging'`. */
16361
- markForTrain: boolean().optional(),
16362
- /** Operator marked this track for diagnostic attention. */
16363
- debug: boolean().optional(),
16364
- /** Operator favourited this track. Pins it against pruning. */
16365
- favourited: boolean().optional()
16366
- };
16367
- /**
16368
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16369
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16370
- * write patch, and the status is not something the toggle sets — it is what the
16371
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16372
- * always present on a persisted row (the column default materialises `'none'`).
16373
- */
16374
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16375
- /**
16376
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16377
- * one flag can never clear the other — the toggles are independent and are
16378
- * driven from three surfaces that do not know about each other.
16379
- */
16380
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16381
- /**
16382
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16383
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16384
- * mutation result without a re-fetch.
16385
- */
16386
- var TrackFlagsSchema = object({
16387
- trackId: string(),
16388
- markForTrain: boolean(),
16389
- debug: boolean(),
16390
- favourited: boolean(),
16391
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16392
- * a track row) because this shape is only ever produced by the write body,
16393
- * which always knows it — and a surface that has just written needs to render
16394
- * `trained` without a re-fetch. */
16395
- retrainStatus: RetrainStatusSchema
16316
+ var PipelineSchemaSchema = object({
16317
+ availableEngines: array(AvailableEngineSchema).readonly(),
16318
+ selectedEngine: PipelineEngineChoiceSchema,
16319
+ slots: array(PipelineSlotSchemaSchema).readonly()
16396
16320
  });
16397
- union([literal(1), literal(2)]);
16398
- /**
16399
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16400
- * the step and model that produced it — which is what makes the write rule
16401
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16402
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16403
- *
16404
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16405
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16406
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16407
- * that value has no provenance, and the write rule lets ANY properly-attributed
16408
- * write of the same tier replace it regardless of score.
16409
- */
16410
- var LabelAttributionSchema = object({
16411
- stepId: string(),
16412
- modelId: string().optional(),
16413
- decidedAt: number(),
16321
+ var EngineProvisioningSchema = object({
16322
+ runtimeId: _enum([
16323
+ "onnx",
16324
+ "openvino",
16325
+ "coreml",
16326
+ "edgetpu"
16327
+ ]).nullable(),
16328
+ device: string().nullable(),
16329
+ state: _enum([
16330
+ "idle",
16331
+ "installing",
16332
+ "verifying",
16333
+ "ready",
16334
+ "failed"
16335
+ ]),
16336
+ progress: number().optional(),
16337
+ error: string().optional(),
16338
+ nextRetryAt: number().optional(),
16414
16339
  /**
16415
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16416
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16417
- *
16418
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16419
- * notification rule authored on "Gianluca" stopped matching the moment the
16420
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16421
- * the thing that does not move, so it is what a rule matches on
16422
- * (`NcConditions.identities`) and the text is what a human is shown.
16423
- *
16424
- * Absent when the label names no gallery row — a plate the OCR read but no
16425
- * vehicle claims, a sub-class, a species, any tier-1 value.
16340
+ * Gate A (config-correctness gate at engine change): human-readable
16341
+ * config issues surfaced EAGERLY when the node's engine changes — model
16342
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16343
+ * has a <format> build"). Additive/optional: informational only, never
16344
+ * enforced here `assertEngineReady` (readiness) still gates inference.
16345
+ * Absent/empty when the node-default tree resolves cleanly.
16426
16346
  */
16427
- identityId: string().optional()
16347
+ configIssues: array(string()).optional()
16428
16348
  });
16429
- /**
16430
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16431
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16432
- * track and its events always answer the same question the same way.
16433
- *
16434
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16435
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16436
- * is tier 2, and each carries its own score + attribution.
16437
- *
16438
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16439
- * finest thing known. Before 4g the single `label` column held the finest
16440
- * value, so a consumer that has not been updated reads the tier-1 slot and
16441
- * shows nothing on a species-only row; that is why the migration puts every
16442
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16443
- * and why the read surfaces were changed in the same train.
16444
- *
16445
- * **Writing it.** The slots are independent, which is the whole point: a
16446
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16447
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16448
- * higher score wins. One rule, one implementation — see
16449
- * `pipeline/label-tier.ts` in addon-post-analysis.
16450
- */
16451
- var TieredLabelFields = {
16452
- /** Tier 1 the sub-class. See {@link LabelTierSchema}. */
16453
- label: string().optional(),
16454
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16455
- labelScore: number().optional(),
16456
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16457
- labelMeta: LabelAttributionSchema.optional(),
16458
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16459
- subLabel: string().optional(),
16460
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16461
- subLabelScore: number().optional(),
16462
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16463
- subLabelMeta: LabelAttributionSchema.optional()
16464
- };
16465
- /** Per-camera slice of a training-export estimate. */
16466
- var TrainingExportDeviceTotalsSchema = object({
16467
- deviceId: number(),
16468
- tracks: number().int(),
16469
- files: number().int(),
16470
- bytes: number().int()
16349
+ var PipelineStepInputSchema = lazy(() => object({
16350
+ addonId: string(),
16351
+ modelId: string().optional(),
16352
+ enabled: boolean().default(true),
16353
+ children: array(PipelineStepInputSchema).optional(),
16354
+ settings: record(string(), unknown()).optional(),
16355
+ jumpDeviceKey: string().optional()
16356
+ }));
16357
+ var ModelSubstitutionSchema = object({
16358
+ addonId: string(),
16359
+ chosen: string(),
16360
+ running: string(),
16361
+ format: string()
16362
+ });
16363
+ var PipelineValidationIssueSchema = object({
16364
+ addonId: string(),
16365
+ kind: _enum(["unknown-addon", "no-format-build"]),
16366
+ detail: string()
16367
+ });
16368
+ var PipelineValidationResultSchema = object({
16369
+ ok: boolean(),
16370
+ issues: array(PipelineValidationIssueSchema).readonly(),
16371
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16372
+ /** The node's `currentEngine.format` this validation ran against. */
16373
+ format: string()
16374
+ });
16375
+ var ReferenceImageEntrySchema = object({
16376
+ filename: string(),
16377
+ stepIds: array(string()).readonly().optional()
16378
+ });
16379
+ var ReferenceImageBodySchema = object({
16380
+ base64: string(),
16381
+ filename: string()
16382
+ });
16383
+ var ReferenceAudioEntrySchema = object({
16384
+ filename: string(),
16385
+ sizeKb: number()
16386
+ });
16387
+ var ReferenceAudioBodySchema = object({ base64: string() });
16388
+ var AudioBackendSchema = object({
16389
+ id: string(),
16390
+ name: string(),
16391
+ description: string(),
16392
+ available: boolean(),
16393
+ /**
16394
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16395
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16396
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16397
+ * specific to the selected backend without a separate fetch.
16398
+ */
16399
+ rawLabels: array(string()).readonly().optional()
16400
+ });
16401
+ var AudioCapabilitiesSchema = object({
16402
+ activeBackend: string(),
16403
+ availableBackends: array(AudioBackendSchema).readonly(),
16404
+ sampleRate: number(),
16405
+ chunkDurationMs: number()
16406
+ });
16407
+ var DownloadModelResultSchema = object({
16408
+ filePath: string(),
16409
+ sizeMB: number(),
16410
+ durationMs: number()
16471
16411
  });
16472
16412
  /**
16473
- * What a training export WOULD contain. Computed from media index rows only —
16474
- * no blob is read to produce this.
16413
+ * Wrapper carrying a single test run's result. Replaces the legacy
16414
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16415
+ * canonical `AudioResult` from the Phase 6 output rework: one
16416
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16417
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16418
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16419
+ * benchmark UI can still report a clean failure when the classifier
16420
+ * cap isn't available.
16475
16421
  */
16476
- var TrainingExportSummarySchema = object({
16477
- generatedAt: number(),
16478
- trackCount: number().int(),
16479
- fileCount: number().int(),
16480
- byteCount: number().int(),
16481
- /** More marked tracks exist than a single pass carries. */
16482
- truncated: boolean(),
16483
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16422
+ var AudioTestResultSchema = object({
16423
+ success: boolean(),
16424
+ error: string().optional(),
16425
+ frame: custom().optional()
16484
16426
  });
16485
- var TrackSchema = object({
16486
- trackId: string(),
16487
- deviceId: number(),
16488
- className: string(),
16489
- ...TieredLabelFields,
16490
- producingDeviceName: string().optional(),
16491
- /** Track provenance. Absent `pipeline` (legacy rows). */
16492
- source: TrackSourceSchema.optional(),
16493
- firstSeen: number(),
16494
- lastSeen: number(),
16495
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16496
- positions: array(TrackPositionSchema).readonly(),
16497
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16498
- * saveThumbnails policy). */
16499
- snapshots: array(TrackSnapshotSchema).readonly(),
16500
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16501
- zonesVisited: array(string()).readonly(),
16427
+ var PipelineConfigBridge = custom();
16428
+ var ConfigUISchemaBridge = custom();
16429
+ var ConfigUISchemaNullableBridge = custom();
16430
+ var InferenceCapabilitiesBridge = custom();
16431
+ var ModelAvailabilityListBridge = custom();
16432
+ var PipelineRunResultBridge = custom();
16433
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16434
+ modelId: string(),
16435
+ settings: record(string(), unknown()).readonly()
16436
+ }))), method(object({ steps: record(string(), object({
16437
+ modelId: string(),
16438
+ settings: record(string(), unknown()).readonly()
16439
+ })) }), object({ success: literal(true) }), {
16440
+ kind: "mutation",
16441
+ auth: "admin"
16442
+ }), method(object({ nodeId: string() }), object({
16443
+ success: literal(true),
16444
+ clearedDevices: number()
16445
+ }), {
16446
+ kind: "mutation",
16447
+ auth: "admin"
16448
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16449
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16450
+ deviceKey: string(),
16502
16451
  /**
16503
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16504
- * `zones` capability.
16505
- *
16506
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16507
- * and no card can render — so every free-text search surface was structurally
16508
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16509
- * just returned nothing. Resolving here rather than in each client keeps ONE
16510
- * derivation and costs the clients no extra call (the `zones` cap is
16511
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16512
- * surface built to avoid exactly that).
16513
- *
16514
- * Resolved, never invented: a zone deleted since the track was written has no
16515
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16516
- * two are not positionally aligned. Absent when the track visited no zone, or
16517
- * when the zone catalogue could not be read.
16452
+ * `failed` the per-device restart budget is exhausted; no pool
16453
+ * will be spawned until an operator re-arms it or the runner
16454
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16455
+ * a cached pool observed dead and not yet condemned).
16518
16456
  */
16519
- zoneNames: array(string()).readonly().optional(),
16520
- /** Deduplicated set of detector classes observed for this track over its
16521
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16522
- * legacy rows written before class accumulation shipped. */
16523
- classes: array(string()).readonly().optional(),
16524
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16525
- totalDistance: number(),
16526
- state: TrackStateSchema,
16527
- active: boolean(),
16528
- /** Deterministic key-event importance score in [0,1] (server-computed at
16529
- * track expiry, recomputed on late label). Absent on legacy rows written
16530
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16531
- importance: number().optional(),
16532
- /** Id of the track's highest-confidence ObjectEvent (its representative
16533
- * "best" frame). Absent when the track produced no object events. */
16534
- bestEventId: string().optional(),
16535
- /** Tag of the importance sub-signal that dominated the score
16536
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16537
- importanceReason: string().optional(),
16538
- /** Audio-classification labels heard on the camera during the track's
16539
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16540
- * Absent on legacy rows / tracks with no confident audio. */
16541
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16542
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16543
- * Populated from the persisted envelope columns on historical reads;
16544
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16545
- envelope: TrackEnvelopeSchema.optional(),
16457
+ state: _enum(["failed", "backoff"]),
16458
+ /** Epoch ms of the death that produced this state. */
16459
+ since: number(),
16460
+ /** Pool deaths inside the current window. */
16461
+ deaths: number(),
16462
+ /** The last death's message. */
16463
+ lastError: string()
16464
+ })).readonly() })), method(object({
16465
+ nodeId: string(),
16466
+ deviceKey: string()
16467
+ }), object({ rearmed: boolean() }), {
16468
+ kind: "mutation",
16469
+ auth: "admin"
16470
+ }), 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({
16471
+ name: string(),
16472
+ steps: array(PipelineTemplateStepSchema).readonly(),
16473
+ engine: PipelineEngineChoiceSchema
16474
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16475
+ id: string(),
16476
+ name: string().optional(),
16477
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16478
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16479
+ addonId: string(),
16480
+ modelId: string(),
16481
+ format: ModelFormatSchema$1
16482
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16483
+ addonId: string(),
16484
+ modelId: string(),
16485
+ format: ModelFormatSchema$1
16486
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16487
+ engine: PipelineEngineChoiceSchema.optional(),
16488
+ steps: array(PipelineStepInputSchema).min(1),
16489
+ frame: FrameInputSchema.optional(),
16546
16490
  /**
16547
- * A face DETECTOR found a face on this track — nothing more. It says the
16548
- * detail plane produced a `face` detail; it does NOT say the face was
16549
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16550
- * enabled. Set once and never cleared.
16551
- *
16552
- * **This exists so "face present but not recognised" is expressible.** A
16553
- * recognised identity lands in `subLabel` (attributed to the face chain via
16554
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16555
- * and a track with no face at all were byte-identical on the wire and no
16556
- * surface could tell them apart. The read is `hasFace === true && subLabel
16557
- * === undefined`.
16558
- *
16559
- * **Absent ≠ false.** Every row written before the column existed omits it,
16560
- * and so does every server that predates the field — a consumer must test
16561
- * `=== true` and render nothing otherwise, never infer "no face".
16491
+ * Process-local lazy frame. Valid only when caller and provider resolve
16492
+ * in the same execution-group process; split/cross-node callers use
16493
+ * `frame`/`image` inline compatibility instead.
16562
16494
  */
16563
- hasFace: boolean().optional(),
16495
+ frameRef: FrameRefSchema.optional(),
16564
16496
  /**
16565
- * This track has a face row IN THE GALLERY: a crop **and** an embedding a
16566
- * face an operator could ASSIGN to an identity.
16567
- *
16568
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16569
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16570
- * branch, before every gate, and means no more than "a face detector produced
16571
- * a face detail". This one is stamped at the single moment the gallery row
16572
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16573
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16574
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16575
- * the crop-store drop. Everything between the detector and that insert can
16576
- * legitimately refuse the face, so a flag written any earlier promises the
16577
- * operator something to assign and delivers nothing.
16578
- *
16579
- * **Independent of recognition.** A face collected but never auto-matched is
16580
- * still assignable — it is in fact the face an operator most wants to reach —
16581
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16582
- * `subLabel`; this says only that the raw material exists.
16583
- *
16584
- * **Set once, never cleared.** A track that produced a gallery row produced
16585
- * one; deleting the row later is the gallery's business, not this flag's.
16586
- *
16587
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16588
- * before the column omits it, and so does every server that predates the
16589
- * field. A consumer must test `=== true` and render nothing otherwise —
16590
- * never infer "no assignable face".
16497
+ * CB5 shm passthrough a `FrameHandle` naming the same ring slot
16498
+ * the decoded pixels live in. One more member of the one-of
16499
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16591
16500
  */
16592
- hasEmbeddedFace: boolean().optional(),
16501
+ frameHandle: FrameHandleSchema.optional(),
16502
+ imageBase64: string().optional(),
16593
16503
  /**
16594
- * This subject CONTAINS a folded rider a person the rider-pairing step
16595
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16596
- * so the passage is tracked once and as a VEHICLE.
16597
- *
16598
- * It exists because the fold's record was dishonest. D34 and the code both
16599
- * said "the person is not lost — it is reported so both entities stay on the
16600
- * record"; in fact the pair went into a per-processor RAM field behind an
16601
- * accessor nobody called, and every durable surface said `vehicle`, full
16602
- * stop. This is the composition note that makes the row true.
16603
- *
16604
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16605
- * person" is not an answer to "what is this" — both label tiers would refuse
16606
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16607
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16608
- * and a `person` rule still does not fire for someone cycling past.
16609
- *
16610
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16611
- * the column, and every hub that predates the field, omits it. Test
16612
- * `=== true` and render nothing otherwise — never infer "no rider".
16504
+ * Binary JPEG bytespreferred over `imageBase64` on internal
16505
+ * hops (hub forked worker via Moleculer MsgPack) because it
16506
+ * skips the 33% base64 overhead + the per-call base64 decode on
16507
+ * the detection-pipeline worker. Callers can pass either; exactly
16508
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16613
16509
  */
16614
- hasRider: boolean().optional(),
16615
- ...TrackFlagFields,
16616
- ...TrackRetrainFields
16617
- });
16618
- var BaseEventFields = {
16619
- id: string(),
16620
- deviceId: number(),
16621
- timestamp: number()
16622
- };
16623
- var MotionEventSchema = object({
16624
- ...BaseEventFields,
16625
- kind: literal("motion"),
16626
- regionCount: number(),
16627
- /** Heavy JSON array omitted in slim projection. */
16628
- regions: array(object({
16629
- bbox: BoundingBoxSchema,
16630
- pixelCount: number(),
16631
- intensity: number()
16632
- })).readonly().optional(),
16633
- /** Omitted in slim projection. */
16634
- frameWidth: number().optional(),
16635
- /** Omitted in slim projection. */
16636
- frameHeight: number().optional(),
16637
- /** Populated by B5 (recording playback URL for this event). */
16638
- mediaUrl: string().optional()
16639
- });
16510
+ image: _instanceof(Uint8Array).optional(),
16511
+ referenceImage: string().optional(),
16512
+ deviceId: number().optional(),
16513
+ sessionId: string().optional(),
16514
+ /**
16515
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16516
+ * reference-image, and detail-subtree calls. 'frame' is the live
16517
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16518
+ * (inputClasses ≠ null) are skipped and served per-track via
16519
+ * pipelineRunner.runDetailSubtree (two-plane design).
16520
+ */
16521
+ plane: _enum(["full", "frame"]).optional(),
16522
+ /**
16523
+ * Inference-device selector (Phase 2 multi-device). Format
16524
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16525
+ * Omitted ⇒ the runner's default device (current single-engine
16526
+ * behaviour). Selects WHICH device pool of the node runs the call.
16527
+ */
16528
+ deviceKey: string().optional(),
16529
+ /**
16530
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16531
+ * when the parent crop was resolved from the frame's retained NATIVE
16532
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16533
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16534
+ * resolution from that surface — the SAME quality path faces already
16535
+ * had — instead of the downscaled parent tile. `handle` keys the native
16536
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16537
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16538
+ * the executor's crop-normalized child ROI back into frame-normalized
16539
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16540
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16541
+ * (today's behaviour on the fallback path).
16542
+ */
16543
+ nativeCropRef: NativeCropRefSchema.optional()
16544
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16545
+ engine: PipelineEngineChoiceSchema.optional(),
16546
+ steps: array(PipelineStepInputSchema).min(1),
16547
+ frames: array(FrameInputSchema).min(1).max(255),
16548
+ deviceId: number().optional(),
16549
+ sessionId: string().optional(),
16550
+ /**
16551
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16552
+ * the batch to the Python pool's bench preprocess cache
16553
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16554
+ * preprocessed ONCE and every later inference is a pure-inference cache
16555
+ * hit — the sustained-throughput run measures inference, not
16556
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16557
+ * full preprocess every call, correct). Fresh per sustained run;
16558
+ * released via `uncacheFrame`.
16559
+ */
16560
+ frameId: number().int().nonnegative().optional(),
16561
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16562
+ deviceKey: string().optional()
16563
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16564
+ data: _instanceof(Uint8Array),
16565
+ width: number().int().positive(),
16566
+ height: number().int().positive(),
16567
+ format: _enum([
16568
+ "rgb",
16569
+ "bgr",
16570
+ "gray"
16571
+ ])
16572
+ }), object({
16573
+ frameId: number(),
16574
+ width: number(),
16575
+ height: number()
16576
+ }), { kind: "mutation" }), method(object({
16577
+ stepId: string(),
16578
+ frameId: number().int()
16579
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16580
+ batchMode: string(),
16581
+ windowMs: number(),
16582
+ maxBatchSize: number(),
16583
+ concurrency: number()
16584
+ })), method(_void(), array(object({
16585
+ engineKey: string(),
16586
+ engine: PipelineEngineChoiceSchema,
16587
+ modelsLoaded: array(string()).readonly(),
16588
+ inUseByCameras: array(number()).readonly(),
16589
+ /**
16590
+ * Origin of this resident factory.
16591
+ * - `runtime` — main camera-serving engine (no idle TTL).
16592
+ * - `warm-override` — benchmark/test override held in the warm
16593
+ * cache; auto-disposed after the idle TTL.
16594
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16595
+ * multi-device, keyed by `deviceKey`) resolved
16596
+ * via `resolveDeviceFactory`. Runs alongside the
16597
+ * `runtime` engine on a DIFFERENT accelerator
16598
+ * (NPU / iGPU / Coral) — this is how the
16599
+ * Engines tab shows all pools running at once.
16600
+ */
16601
+ kind: _enum([
16602
+ "runtime",
16603
+ "warm-override",
16604
+ "device-pool"
16605
+ ]),
16606
+ /** Native pid of the underlying Python pool (null when no pool). */
16607
+ poolPid: number().nullable(),
16608
+ /** ms since this factory was last used (null when not warm-tracked). */
16609
+ idleMs: number().nullable(),
16610
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16611
+ idleTtlMs: number().nullable()
16612
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16613
+ kind: "mutation",
16614
+ auth: "admin"
16615
+ }), method(object({
16616
+ engine: PipelineEngineChoiceSchema,
16617
+ force: boolean().optional()
16618
+ }), object({
16619
+ success: boolean(),
16620
+ reason: string().optional()
16621
+ }), {
16622
+ kind: "mutation",
16623
+ auth: "admin"
16624
+ }), 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({
16625
+ addonId: string(),
16626
+ modelId: string(),
16627
+ filename: string().optional(),
16628
+ settings: record(string(), unknown()).optional()
16629
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16640
16630
  /**
16641
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16642
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16643
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16644
- * tracking, per-kind persistence) but stay distinguishable so consumers
16645
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16646
- * Absent on legacy rows treat as `pipeline`.
16631
+ * Per-stage gating mode applied to the zones a rule references.
16632
+ *
16633
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16634
+ * When at least one `include` rule fires for a stage, only entities
16635
+ * inside one of those zones pass that stage.
16636
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16637
+ * Entities inside one of those zones are dropped at that stage.
16638
+ *
16639
+ * `monitor`-style observation (count without filtering) is not a rule
16640
+ * mode — zones without any matching rule are observed naturally by
16641
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16642
+ * count, not filter" use case needs no rule at all.
16647
16643
  */
16648
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16644
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16649
16645
  /**
16650
- * The confirmed zone crossing that produced an object event. Present ONLY on
16651
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16652
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16653
- * appearance event carry none, so a rule asking for a direction fails closed
16654
- * on them.
16646
+ * Per-consumer rule that references existing zones (geometry) and
16647
+ * defines how a specific pipeline stage should treat them. Each
16648
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16649
+ * settings:
16655
16650
  *
16656
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16657
- * into its own event, so a frame in which a track enters A while leaving B
16658
- * produces two events with two directions — never one ambiguous row.
16651
+ * - `addon-motion-wasm` `motionZoneRules: ZoneRule[]` (motion stage)
16652
+ * - `addon-detection-pipeline` `detectionZoneRules: ZoneRule[]` (detection stage)
16653
+ * - future: notification rules, audio gating, etc.
16659
16654
  *
16660
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16661
- * membership the box has NOW, and by definition it no longer contains the zone
16662
- * that was just left. Without the id here, a zone-scoped rule could never match
16663
- * the exit it asked for.
16655
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16656
+ * express "ignore motion in ALL of {garden, street}" with a single
16657
+ * rule. `classFilter` narrows the rule to specific object classes
16658
+ * "drop person detections in the street, but keep cars" is one
16659
+ * `exclude` rule with `classFilter: ['person']`.
16660
+ *
16661
+ * `enabled` is a soft toggle — the operator can keep the rule
16662
+ * configured but inert without deleting it.
16664
16663
  */
16665
- var ZoneCrossingSchema = object({
16666
- direction: _enum(["enter", "exit"]),
16667
- /** Admin zone id crossed. */
16668
- zoneId: string(),
16669
- /** Zone display name at crossing time (falls back to the id). */
16670
- zoneName: string().optional()
16671
- });
16672
- var ObjectEventSchema = object({
16673
- ...BaseEventFields,
16674
- kind: literal("object"),
16675
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16676
- source: DetectionSourceSchema.optional(),
16664
+ var ZoneRuleSchema = object({
16665
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16666
+ id: string(),
16667
+ /** Optional human-readable label rendered in the rule editor. */
16668
+ name: string().optional(),
16669
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16670
+ * listed zones (OR-set: a detection in any one of them counts).
16671
+ * At least one zone id required — a rule with no targets is a
16672
+ * configuration mistake and the form validator rejects it. */
16673
+ zoneIds: array(string()).min(1).readonly(),
16674
+ mode: ZoneRuleModeEnum,
16677
16675
  /**
16678
- * Inference-frame id shared by every object event emitted from the SAME frame
16679
- * the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16680
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16681
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16682
- * Optional for backward-compat with pre-existing rows / the slim projection
16683
- * includes it (it is light). Absent on rows written before this field.
16676
+ * Class names this rule applies to. Empty / undefined rule
16677
+ * applies to every class. Class strings match the `macroClass`
16678
+ * field on detections (e.g. `person`, `car`, `dog`).
16684
16679
  */
16685
- frameId: string().optional(),
16686
- /** Omitted in slim projection. */
16687
- trackId: string().optional(),
16688
- className: string(),
16689
- ...TieredLabelFields,
16690
- /** Omitted in slim projection. */
16691
- confidence: number().optional(),
16692
- /** Heavy JSON — omitted in slim projection. */
16693
- bbox: BoundingBoxSchema.optional(),
16694
- /** Heavy JSON — omitted in slim projection. */
16695
- zones: array(string()).readonly().optional(),
16696
- /** Omitted in slim projection. */
16697
- state: TrackStateSchema.optional(),
16680
+ classFilter: array(string()).readonly().optional(),
16698
16681
  /**
16699
- * The zone crossing this event IS, when it is one. Absent on every other
16700
- * event kind (movement state, appearance, package) see
16701
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16682
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16683
+ * required to consider an entity "in the zone". Defaults to the
16684
+ * consumer's stage default when omitted. Kept for back-compat with
16685
+ * existing per-rule overrides; new operators pick the value via
16686
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16687
+ * set, the lower-level engine reads it as a 0–1 fraction.
16702
16688
  */
16703
- zoneCrossing: ZoneCrossingSchema.optional(),
16704
- /** Detection-frame dimensions in pixels — let consumers normalize the
16705
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
16706
- frameWidth: number().optional(),
16707
- frameHeight: number().optional(),
16708
- /** MediaStore key for the crop attached to this event (if any). */
16709
- mediaKey: string().optional(),
16710
- /** Design B: MediaStore key of the track's native-resolution key frame (the
16711
- * best-detection full frame). Resolve via the event-media data-plane
16712
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
16713
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
16714
- * sources — consumers fall back to `mediaKey` (the tight crop). */
16715
- keyFrameMediaKey: string().optional(),
16716
- /** Populated by B5 (recording playback URL for this event). */
16717
- mediaUrl: string().optional(),
16718
- /** The parent track's key-event importance [0,1], propagated to every object
16719
- * event of the track (so an event row can be sorted by importance without a
16720
- * track join). Absent on legacy rows / before the track was scored. */
16721
- importance: number().optional()
16722
- });
16723
- var AudioEventSchema = object({
16724
- ...BaseEventFields,
16725
- kind: literal("audio"),
16726
- rms: number(),
16727
- dbfs: number(),
16728
- classification: object({
16729
- className: string(),
16730
- originalClass: string().optional(),
16731
- score: number()
16732
- }).optional(),
16733
- /** Populated by B5 (recording playback URL for this event). */
16734
- mediaUrl: string().optional()
16735
- });
16736
- var MediaFileKindEnum = _enum([
16737
- "crop",
16738
- "thumbnail",
16739
- "snapshot",
16740
- "firstFrame",
16741
- "lastFrame",
16742
- "fullFrame",
16743
- "fullFrameBoxed",
16744
- "faceCrop",
16745
- "plateCrop",
16746
- "keyFrame",
16747
- "keyFrameSmall",
16748
- "thumbnailSmall"
16749
- ]);
16750
- var MediaFileSchema = object({
16751
- key: string(),
16752
- kind: MediaFileKindEnum,
16753
- base64: string(),
16754
- sizeBytes: number(),
16755
- timestamp: number()
16689
+ overlapThreshold: number().min(0).max(1).optional(),
16690
+ /**
16691
+ * Operator-friendly version of `overlapThreshold` the percentage
16692
+ * of the detection's bbox that must lie inside the zone for the
16693
+ * rule to match. Documented default is 85%; the engine substitutes
16694
+ * that when the field is omitted (kept optional so existing rules
16695
+ * stored without it stay valid).
16696
+ *
16697
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16698
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16699
+ * field exposed in the UI. Internally both feed the same gate.
16700
+ */
16701
+ bboxInclusionPct: number().min(0).max(100).optional(),
16702
+ /**
16703
+ * When `true` and a detection has a segmentation mask, use the
16704
+ * mask for overlap instead of the bbox. Detection-stage only;
16705
+ * motion rules ignore this field.
16706
+ */
16707
+ preferMask: boolean().optional(),
16708
+ /**
16709
+ * Soft-toggle: `false` disables the rule without deleting it.
16710
+ * Defaults to `true` so operators creating a rule via the UI
16711
+ * see it active immediately.
16712
+ */
16713
+ enabled: boolean().default(true)
16756
16714
  });
16715
+ array(ZoneRuleSchema).readonly();
16757
16716
  /**
16758
- * One media row WITHOUT its bytes.
16717
+ * Zone pure geometry + identity. NO filtering behaviour.
16759
16718
  *
16760
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
16761
- * 140 s track), and a client that renders tiles from the media data plane needs
16762
- * to know only WHAT EXISTS the bytes then arrive per tile, lazily, over HTTP
16763
- * with an immutable cache, instead of all at once inside a tRPC response that
16764
- * blocks the whole view.
16719
+ * Zones describe **where** in the frame the operator wants to flag
16720
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16721
+ * each pipeline stage uses them. Splitting the two means a single
16722
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16723
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16724
+ * — without three duplicated polygons.
16765
16725
  *
16766
- * `sizeBytes` is carried because it is what lets a client decide between the
16767
- * stored blob and a `?variant=thumb` rendering without fetching either.
16726
+ * Owned by the orchestrator addon (provider) and mirrored into the
16727
+ * `zones` device-state slice on every mutation. Consumers
16728
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16729
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16730
+ * mirror with `onChanged`).
16731
+ *
16732
+ * Coordinates are normalised fractions of the frame (0–1) so zones
16733
+ * survive resolution changes and stream profile switches.
16734
+ *
16735
+ * `kind` discriminates between full polygons (closed regions used
16736
+ * for intrusion / occupancy filters) and tripwires (open 2-point
16737
+ * line segments used for cross events). Onboard / firmware-reported
16738
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
16739
+ * task list.
16768
16740
  */
16769
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
16741
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
16742
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
16743
+ var PolygonPointSchema = object({
16744
+ x: number(),
16745
+ y: number()
16746
+ });
16747
+ /** A camera detection zone — pure geometry/identity. */
16748
+ var ZoneSchema = object({
16749
+ id: string(),
16750
+ name: string(),
16751
+ kind: ZoneKindEnum.default("polygon"),
16752
+ /** Polygon vertices, fraction of frame (0–1). */
16753
+ polygon: array(PolygonPointSchema).readonly(),
16754
+ /** Visual color for UI rendering. */
16755
+ color: string().default("#3b82f6")
16756
+ });
16757
+ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
16758
+ deviceId: number(),
16759
+ zone: ZoneSchema
16760
+ }), _void(), {
16761
+ kind: "mutation",
16762
+ auth: "admin"
16763
+ }), method(object({
16764
+ deviceId: number(),
16765
+ zoneId: string()
16766
+ }), _void(), {
16767
+ kind: "mutation",
16768
+ auth: "admin"
16769
+ }), method(object({
16770
+ deviceId: number(),
16771
+ zone: ZoneSchema
16772
+ }), _void(), {
16773
+ kind: "mutation",
16774
+ auth: "admin"
16775
+ }), object({ zones: array(ZoneSchema).readonly() });
16770
16776
  /**
16771
- * The MACRO tier of an annotation — a CLOSED set.
16777
+ * pipeline-analytics device-scoped wrapper cap. Refines raw
16778
+ * per-frame detections emitted by the pipeline runner into tracked
16779
+ * objects, per-kind event collections (motion / object / audio), and
16780
+ * persisted media. Owns the post-detection domain end-to-end:
16772
16781
  *
16773
- * This is what the exported detector predicts, so a typo here is a new class
16774
- * with one example in it. `label` and `subLabel` are open strings by contrast:
16775
- * the whole point of the page is teaching the model things it does not know
16776
- * yet, and constraining that vocabulary would make it useless.
16782
+ * runner emits PipelineInferenceResult
16783
+ * (event bus)
16784
+ * pipeline-analytics subscriber
16785
+ * SORT tracker + zone engine + state analyzer + event emitter
16786
+ * → three DB collections (one per kind), one FS media tree, one
16787
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
16788
+ * DetectionEvent on bus)
16777
16789
  *
16778
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
16779
- * `subLabel` is one of these values, in any casing, because once `person`
16780
- * exists in both tiers "every person box" stops being answerable without
16781
- * knowing every string anyone ever typed — and the damage is retroactive.
16790
+ * Pure subscriber model. No `processFrame` cap method the runner
16791
+ * already publishes the raw frame on the bus. The cap surface is
16792
+ * only QUERIES + per-device settings, bound on/off via
16793
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
16794
+ * every camera with a detection pipeline wants its raw detections
16795
+ * refined; operators opt out per-device via BindingsTab when needed.
16796
+ *
16797
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16798
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
16782
16799
  */
16783
- var RetrainMacroClassSchema = _enum([
16800
+ var TrackStateSchema = _enum([
16801
+ "new",
16802
+ "entered",
16803
+ "left",
16804
+ "moving",
16805
+ "idle"
16806
+ ]);
16807
+ var EventKindSchema = _enum([
16808
+ "motion",
16809
+ "object",
16810
+ "audio"
16811
+ ]);
16812
+ /**
16813
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16814
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16815
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
16816
+ */
16817
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16818
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
16819
+ var EventKindIconSchema = _enum([
16820
+ "motion",
16821
+ "audio",
16784
16822
  "person",
16785
16823
  "vehicle",
16786
16824
  "animal",
16825
+ "door",
16826
+ "pir",
16827
+ "smoke",
16828
+ "water",
16829
+ "button",
16787
16830
  "package",
16788
- "face",
16789
- "plate"
16831
+ "generic"
16790
16832
  ]);
16791
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
16792
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
16793
- /** Did a human draw this box, or did the assist propose it? */
16794
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
16795
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
16796
- var RetrainBboxSchema = object({
16797
- x: number(),
16798
- y: number(),
16799
- w: number(),
16800
- h: number()
16801
- });
16802
- /**
16803
- * One annotated subject.
16804
- *
16805
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
16806
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
16807
- * derived from it at export and never stored storing them is how one feature
16808
- * space ends up holding two crops of the same subject (D52).
16809
- */
16810
- var RetrainAnnotationSchema = object({
16811
- id: string(),
16812
- trackId: string(),
16813
- deviceId: number(),
16814
- /** The COPY in retrain storage — never the source track's media key. */
16815
- mediaKey: string(),
16816
- bbox: RetrainBboxSchema,
16817
- macroClass: RetrainMacroClassSchema,
16818
- label: string().optional(),
16819
- subLabel: string().optional(),
16820
- kind: RetrainAnnotationKindSchema,
16821
- source: RetrainAnnotationSourceSchema,
16822
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
16823
- assistModelId: string().optional(),
16824
- assistScore: number().optional(),
16825
- exportedInBatch: string().optional(),
16826
- createdAt: number()
16827
- });
16828
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
16829
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
16830
- id: true,
16831
- trackId: true,
16832
- deviceId: true,
16833
- mediaKey: true,
16834
- createdAt: true,
16835
- exportedInBatch: true
16833
+ var EventKindCategorySchema = _enum([
16834
+ "motion",
16835
+ "audio",
16836
+ "detection",
16837
+ "sensor",
16838
+ "control",
16839
+ "custom",
16840
+ "package"
16841
+ ]);
16842
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16843
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16844
+ var EventKindDescriptorSchema = object({
16845
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16846
+ kind: string(),
16847
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16848
+ labelKey: string(),
16849
+ /** English fallback label (kept for clients that don't translate). */
16850
+ label: string(),
16851
+ /** Hex color for timeline/legend rendering. */
16852
+ color: string(),
16853
+ /** Dictionary id → lucide component on the UI side. */
16854
+ iconId: string(),
16855
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16856
+ icon: EventKindIconSchema,
16857
+ category: EventKindCategorySchema,
16858
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16859
+ parentKind: string().nullable(),
16860
+ /** Derived from `parentKind`, explicit for the client tree. */
16861
+ level: EventKindLevelSchema,
16862
+ /** Which cap + device contributes this kind. For built-ins the camera
16863
+ * itself; for sensor kinds the LINKED source device. */
16864
+ source: object({
16865
+ capName: string(),
16866
+ deviceId: number()
16867
+ })
16836
16868
  });
16837
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
16838
- var RetrainTrackSchema = object({
16839
- trackId: string(),
16869
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16870
+ var EventKindsForDeviceSchema = object({
16840
16871
  deviceId: number(),
16841
- className: string(),
16842
- label: string().optional(),
16843
- firstSeen: number(),
16844
- lastSeen: number(),
16845
- /** How many frames the dataset already holds from this track. */
16846
- frameCount: number().int(),
16847
- /** How many subjects have been annotated on those frames. `0` with
16848
- * `frameCount: 0` is exactly "staging, still to work". */
16849
- annotationCount: number().int()
16850
- });
16851
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
16852
- var RetrainFrameCandidateSchema = object({
16853
- mediaKey: string(),
16854
- kind: MediaFileKindEnum,
16855
- timestamp: number(),
16856
- sizeBytes: number().int(),
16857
- /** A copy of this original already exists — selecting it is free and cannot
16858
- * fail, whatever became of the original. */
16859
- copied: boolean()
16872
+ kinds: array(EventKindDescriptorSchema).readonly()
16860
16873
  });
16861
- /** A frame the dataset OWNS: bytes copied at selection time. */
16862
- var RetrainFrameSchema = object({
16863
- frameId: string(),
16874
+ var SensorEventSchema = object({
16875
+ id: string(),
16876
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
16877
+ * yields N rows, one per camera). */
16864
16878
  deviceId: number(),
16865
- trackId: string(),
16866
- /** Provenance only. It may already point at nothing — that is expected. */
16867
- sourceMediaKey: string(),
16868
- sourceKind: MediaFileKindEnum,
16869
- sizeBytes: number().int(),
16870
- width: number().int(),
16871
- height: number().int(),
16872
- copiedAt: number()
16879
+ /** The linked sensor device whose state changed. */
16880
+ sourceDeviceId: number(),
16881
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
16882
+ kind: string(),
16883
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
16884
+ value: record(string(), unknown()).nullable(),
16885
+ timestamp: number()
16873
16886
  });
16874
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
16875
- var RetrainCopyRefusalSchema = _enum([
16876
- "source-missing",
16877
- "unreadable-image",
16878
- "write-failed"
16879
- ]);
16880
- var RetrainFrameSelectionSchema = object({
16881
- copied: array(RetrainFrameSchema).readonly(),
16882
- refused: array(object({
16883
- sourceMediaKey: string(),
16884
- reason: RetrainCopyRefusalSchema
16885
- })).readonly()
16887
+ var TrackPositionSchema = object({
16888
+ x: number(),
16889
+ y: number(),
16890
+ timestamp: number(),
16891
+ bbox: BoundingBoxSchema
16886
16892
  });
16887
- var RetrainFrameListSchema = object({
16888
- candidates: array(RetrainFrameCandidateSchema).readonly(),
16889
- copies: array(RetrainFrameSchema).readonly(),
16890
- /** What the page pre-selects the native key frame when one survives. */
16891
- autoPickMediaKey: string().optional()
16893
+ var TrackSnapshotSchema = object({
16894
+ timestamp: number(),
16895
+ position: TrackPositionSchema,
16896
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16897
+ mediaKey: string()
16892
16898
  });
16893
- /** What the operator asked the assist to look for. */
16894
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
16895
- kind: literal("package"),
16896
- zone: RetrainBboxSchema.optional()
16897
- }), object({
16898
- kind: literal("objects"),
16899
- modelId: string(),
16900
- minScore: number().optional()
16901
- })]);
16902
16899
  /**
16903
- * The assist's answer a discriminated union, because "the model saw nothing"
16904
- * and "this node cannot run that model" lead to different next moves and a
16905
- * nullable result cannot tell them apart.
16900
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16901
+ * divided by the track's detection-frame dims), computed at persist time.
16902
+ * Absent when the frame dims were unknown when the track was persisted
16903
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16906
16904
  */
16907
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
16908
- kind: literal("proposed"),
16909
- modelId: string(),
16910
- stepId: string(),
16911
- minScore: number(),
16912
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
16913
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
16914
- /** Returned by the runner but removed by the threshold. */
16915
- belowThreshold: number().int()
16916
- }), object({
16917
- kind: literal("refused"),
16918
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
16919
- reason: string(),
16920
- detail: string().optional()
16921
- })]);
16922
- /** The outcome of a lifecycle move owned by the retrain page. */
16923
- var RetrainTransitionResultSchema = object({
16924
- trackId: string(),
16925
- /** Where the track ended up, whatever happened. */
16926
- retrainStatus: RetrainStatusSchema,
16927
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
16928
- changed: boolean(),
16929
- reason: _enum([
16930
- "unknown-track",
16931
- "no-frames-copied",
16932
- "not-staging",
16933
- "not-trained",
16934
- "unchanged"
16935
- ]).optional()
16936
- });
16937
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
16938
- var MAX_EVENT_QUERY_LIMIT = 5e3;
16939
- var DeviceEventQueryInput = object({
16940
- deviceId: number(),
16941
- since: number().optional(),
16942
- until: number().optional(),
16943
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
16944
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
16945
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
16946
- * exact behaviour. Callers may omit this field — the store defaults to
16947
- * `full` when not provided. */
16948
- projection: _enum(["full", "slim"]).optional()
16949
- });
16950
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
16951
- var RecentTracksQueryInput = object({
16952
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
16953
- deviceIds: array(number()),
16954
- /** Window lower bound on `lastSeen` (inclusive). */
16955
- since: number().optional(),
16956
- /** Window upper bound on `lastSeen` (inclusive). */
16957
- until: number().optional(),
16958
- /** Page size. Default 200, max 1000. */
16959
- limit: number().int().min(1).max(1e3).default(200),
16960
- /** Opaque continuation cursor from a previous page's `nextCursor`.
16961
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16962
- cursor: string().optional(),
16963
- /** See {@link TrackProjectionSchema}. Default `full`. */
16964
- projection: TrackProjectionSchema.optional(),
16965
- /** Include stationary-promoted rows (parked objects). Default false: the
16966
- * feed lists passages; parking records live on the stationary registry. */
16967
- includeStationary: boolean().optional()
16968
- });
16969
- var RecentTracksPageSchema = object({
16970
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
16971
- tracks: array(TrackSchema).readonly(),
16972
- /** Cursor for the next page, or null when this page is the last. */
16973
- nextCursor: string().nullable()
16905
+ var TrackEnvelopeSchema = object({
16906
+ minX: number(),
16907
+ minY: number(),
16908
+ maxX: number(),
16909
+ maxY: number()
16974
16910
  });
16975
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
16976
- var LIST_GROUPS_MAX_LIMIT = 100;
16977
- var AnalyticsGroupRecordSchema = object({
16978
- id: string(),
16979
- deviceId: number().int(),
16980
- openedAt: number().int(),
16981
- closedAt: number().int(),
16982
- timestamp: number().int(),
16983
- memberCount: number().int(),
16984
- memberTrackIds: array(string()).readonly(),
16985
- className: string(),
16986
- classes: array(string()).readonly(),
16987
- /** Relative event-media path, or null when the group has no picture yet. */
16988
- mediaUrl: string().nullable(),
16989
- singleton: boolean()
16990
- });
16991
- var AnalyticsGroupMemberSchema = object({
16992
- trackId: string(),
16993
- deviceId: number().int(),
16994
- className: string(),
16995
- firstSeen: number().int(),
16996
- lastSeen: number().int(),
16997
- mediaUrl: string().nullable()
16998
- });
16999
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17000
- var ListGroupsQueryInput = object({
17001
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17002
- deviceIds: array(number()),
17003
- /** Window lower bound on `closedAt` (inclusive). */
17004
- since: number().optional(),
17005
- /** Window upper bound on `openedAt` (inclusive). */
17006
- until: number().optional(),
17007
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17008
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
17009
- cursor: string().optional()
17010
- });
17011
- var ListGroupsPageSchema = object({
17012
- groups: array(AnalyticsGroupRecordSchema).readonly(),
17013
- nextCursor: string().nullable()
17014
- });
17015
- var KeyEventQueryInput = object({
17016
- deviceId: number(),
17017
- /** Window lower bound (track firstSeen ≥ since). */
17018
- since: number(),
17019
- /** Window upper bound (track firstSeen ≤ until). */
17020
- until: number(),
17021
- limit: number().int().min(1).max(200).default(50),
17022
- /** Drop tracks scoring below this importance. */
17023
- minImportance: number().min(0).max(1).optional(),
17024
- /** Restrict to a single class (e.g. 'person'). */
17025
- classFilter: string().optional()
17026
- });
17027
- var KeyEventSchema = object({
17028
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
17029
- id: string(),
17030
- trackId: string(),
17031
- /** Track start time (firstSeen). */
17032
- timestamp: number(),
17033
- className: string(),
17034
- ...TieredLabelFields,
17035
- importance: number(),
17036
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
17037
- bestEventId: string(),
17038
- /** Track lifetime in ms (lastSeen - firstSeen). */
17039
- windowMs: number().optional(),
17040
- ...TrackFlagFields,
17041
- ...TrackRetrainFields
17042
- });
17043
- object({
17044
- trackId: string(),
17045
- className: string(),
17046
- confidence: number(),
17047
- bbox: BoundingBoxSchema,
17048
- zones: array(string()).readonly(),
17049
- state: TrackStateSchema
17050
- });
17051
- var OverlayDetectionSchema = looseObject({
17052
- id: string(),
17053
- kind: _enum(["first-level", "detail"]),
17054
- macroClass: string(),
17055
- score: number(),
17056
- bbox: object({
17057
- x: number(),
17058
- y: number(),
17059
- width: number(),
17060
- height: number()
17061
- }),
17062
- labels: array(looseObject({
17063
- label: string(),
17064
- score: number()
17065
- })).readonly(),
17066
- parentId: string().optional()
17067
- });
17068
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17069
- var SearchObjectEventsInput = object({
17070
- text: string(),
17071
- deviceId: number().optional(),
17072
- since: number().optional(),
17073
- until: number().optional(),
17074
- classFilter: string().optional(),
17075
- limit: number().default(50),
17076
- minScore: number().min(0).max(1).default(.2)
17077
- });
17078
- var TrackCascadeCountsSchema = object({
17079
- /** Persisted track roots deleted (authoritative). */
17080
- tracks: number().int(),
17081
- /** Object events removed with their tracks (best-effort; see note above). */
17082
- events: number().int(),
17083
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17084
- media: number().int(),
17085
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17086
- faces: number().int(),
17087
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17088
- plates: number().int(),
17089
- /** Per-track CLIP search vectors removed (best-effort). */
17090
- embeddings: number().int(),
17091
- /** Group membership + group rows removed with their last member (best-effort). */
17092
- groups: number().int()
17093
- });
17094
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17095
- var DiskReconcileCountsSchema = object({
17096
- mediaDropped: number().int(),
17097
- tracks: number().int(),
17098
- events: number().int()
17099
- });
17100
- /** Event-store footprint for one camera. */
17101
- var EventStoreDeviceFootprintSchema = object({
17102
- deviceId: number(),
17103
- /** Persisted event rows (motion + object + audio) for the camera. */
17104
- rows: number().int(),
17105
- /** Event-owned media bytes on disk for the camera. */
17106
- bytes: number().int()
17107
- });
17108
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17109
- var EventStoreFootprintSchema = object({
17110
- totalRows: number().int(),
17111
- totalBytes: number().int(),
17112
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17113
- });
17114
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17115
- var EventPruneCountsSchema = object({
17116
- motion: number().int(),
17117
- object: number().int(),
17118
- audio: number().int()
16911
+ /**
16912
+ * Row projection for track list queries. `full` (default) returns the
16913
+ * complete Track including the frame-rate `positions[]` history and the
16914
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
16915
+ * keeps every scalar the list surfaces actually render (ids, class(es),
16916
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16917
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16918
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16919
+ * `getTrack`. Mirrors the event-store `projection` convention
16920
+ * (`getObjectEvents` et al.).
16921
+ */
16922
+ var TrackProjectionSchema = _enum(["full", "slim"]);
16923
+ /**
16924
+ * One audio-classification label heard on the track's camera while the
16925
+ * track was alive, aggregated per label. An "episode" is one persisted
16926
+ * audio event (the confident-classification path: score ≥ the device's
16927
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16928
+ * one 32 ms inference chunk, so counts stay human-scaled.
16929
+ */
16930
+ var TrackAudioLabelSchema = object({
16931
+ label: string(),
16932
+ /** Highest classification score observed across the label's episodes. */
16933
+ peakScore: number(),
16934
+ /** Number of coalesced audio-event episodes carrying this label. */
16935
+ count: number(),
16936
+ firstAt: number(),
16937
+ lastAt: number()
17119
16938
  });
17120
16939
  /**
17121
- * Re-embed stored tracks from their key frames.
16940
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16941
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16942
+ * no positions, a single snapshot, and no bbox trajectory at all:
17122
16943
  *
17123
- * The reason this is an operator-callable method and not a migration script:
17124
- * every knob that decides what a vector MEANS encoder model, crop margin,
17125
- * squaring is only changeable if the existing vectors can be regenerated.
17126
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17127
- * symptom is a quality regression with no visible cause.
16944
+ * - `sensor` a linked sensor/control device state change.
16945
+ * - `audio` an audio event on the camera itself that was anomalous for
16946
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
16947
+ *
16948
+ * The spatial subsystems (tracker association, occupancy count, re-id /
16949
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
16950
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16951
+ * check silently readmits every source added after it was written.
17128
16952
  */
17129
- var RebuildObjectEmbeddingsInput = object({
17130
- /** Restrict to one camera. Omit for the whole fleet. */
17131
- deviceId: number().optional(),
17132
- since: number().optional(),
17133
- until: number().optional(),
17134
- /** Stop after this many tracks; the result reports whether more remain. */
17135
- maxTracks: number().int().positive().optional(),
17136
- /**
17137
- * Run every embedding on THIS node instead of round-robining the fleet.
17138
- *
17139
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17140
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17141
- * calling it that would pin the rebuild REQUEST itself to that node — the
17142
- * rebuild orchestration lives on the hub, and only the per-track step runs
17143
- * remotely. This field is data; the per-track pin is applied inside.
17144
- *
17145
- * Absent ⇒ round-robin over every online node whose runner can serve the
17146
- * pinned model.
17147
- */
17148
- executeOnNodeId: string().optional(),
17149
- /**
17150
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17151
- * run flat out.
17152
- *
17153
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17154
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17155
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17156
- * force is logged at start and finish so a deliberately slow pass reads
17157
- * differently from a stalled one.
17158
- */
17159
- pacingMs: number().int().nonnegative().optional()
17160
- });
16953
+ var TrackSourceSchema = _enum([
16954
+ "pipeline",
16955
+ "sensor",
16956
+ "audio"
16957
+ ]);
17161
16958
  /**
17162
- * Result of emptying the CLIP index.
16959
+ * Where a track sits in the RETRAIN lifecycle (D81).
17163
16960
  *
17164
- * The clean slate before a policy change: a new crop margin or encoder model
17165
- * leaves two feature spaces in one index whose cosine scores are not
17166
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17167
- * means the same thing.
16961
+ * - `none` never marked, or un-marked. Evictable.
16962
+ * - `staging` the operator wants this track as training material and has not
16963
+ * finished with it. **This is the only state retention holds**: the track and
16964
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
16965
+ * the device's age window.
16966
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
16967
+ * were COPIED into the retrain dataset at selection time, so the dataset no
16968
+ * longer depends on the track's media and the track becomes EVICTABLE again.
16969
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16970
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
16971
+ *
16972
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16973
+ * the store's filter language has only positive equality and `whereIn` — no
16974
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16975
+ * would make the entire pre-column history immortal in one deploy.
17168
16976
  */
17169
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
16977
+ var RetrainStatusSchema = _enum([
16978
+ "none",
16979
+ "staging",
16980
+ "trained"
16981
+ ]);
17170
16982
  /**
17171
- * Acknowledgement that a rebuild STARTED.
16983
+ * Per-track OPERATOR flags set by hand from the admin UI or the viewer, never
16984
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16985
+ * so the two surfaces cannot drift.
17172
16986
  *
17173
- * The pass costs ~1s per track 45 minutes for a 2,600-track fleet so it
17174
- * runs detached and this returns immediately. Waiting for it made the client
17175
- * time out while the work carried on server-side, which is the worst of both:
17176
- * no result and no way to know it was still going. Poll
17177
- * `getObjectEmbeddingRebuildStatus` for progress.
16987
+ * **Absent false.** A track that has never been touched omits the field; an
16988
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
16989
+ * columns existed read as absent, and a consumer that needs a boolean should say
16990
+ * `flag === true`, not `flag !== false`.
16991
+ *
16992
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16993
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16994
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16995
+ * `trained` track reports `false` while refusing both writes. The boolean is
16996
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
16997
+ * "never marked" from "already trained" must read `retrainStatus`.
16998
+ *
16999
+ * `debug` does NOT pin; it is attention, not durability.
17000
+ *
17001
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17002
+ * A favourited track is skipped by retention the same way `staging` is, but
17003
+ * it does not enter `none|staging|trained` and has no staging budget.
17178
17004
  */
17179
- var RebuildObjectEmbeddingsResultSchema = object({
17180
- started: boolean(),
17181
- /** True when a pass was already running; the new request is ignored. */
17182
- alreadyRunning: boolean()
17183
- });
17184
- var RebuildStatusSchema = object({
17185
- running: boolean(),
17186
- scanned: number(),
17187
- rebuilt: number(),
17188
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17189
- missingKeyFrame: number(),
17190
- /** Tracks with no usable detection box. */
17191
- missingBbox: number(),
17192
- /**
17193
- * Tracks an executing node REFUSED rather than broke on an unreadable key
17194
- * frame, a step that threw. Separate from `failed` because the remedy is
17195
- * different, and because a whole camera silently contributing zero vectors
17196
- * is the shape of failure a rebuild must never hide.
17197
- */
17198
- notRunnable: number(),
17199
- /**
17200
- * The pass stopped because NO node could serve the pinned model.
17005
+ var TrackFlagFields = {
17006
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
17007
+ * `'staging'`. */
17008
+ markForTrain: boolean().optional(),
17009
+ /** Operator marked this track for diagnostic attention. */
17010
+ debug: boolean().optional(),
17011
+ /** Operator favourited this track. Pins it against pruning. */
17012
+ favourited: boolean().optional()
17013
+ };
17014
+ /**
17015
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
17016
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
17017
+ * write patch, and the status is not something the toggle sets — it is what the
17018
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
17019
+ * always present on a persisted row (the column default materialises `'none'`).
17020
+ */
17021
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
17022
+ /**
17023
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
17024
+ * one flag can never clear the other — the toggles are independent and are
17025
+ * driven from three surfaces that do not know about each other.
17026
+ */
17027
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
17028
+ /**
17029
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
17030
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
17031
+ * mutation result without a re-fetch.
17032
+ */
17033
+ var TrackFlagsSchema = object({
17034
+ trackId: string(),
17035
+ markForTrain: boolean(),
17036
+ debug: boolean(),
17037
+ favourited: boolean(),
17038
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
17039
+ * a track row) because this shape is only ever produced by the write body,
17040
+ * which always knows it — and a surface that has just written needs to render
17041
+ * `trained` without a re-fetch. */
17042
+ retrainStatus: RetrainStatusSchema
17043
+ });
17044
+ union([literal(1), literal(2)]);
17045
+ /**
17046
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
17047
+ * the step and model that produced it — which is what makes the write rule
17048
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17049
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17050
+ *
17051
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17052
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17053
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
17054
+ * that value has no provenance, and the write rule lets ANY properly-attributed
17055
+ * write of the same tier replace it regardless of score.
17056
+ */
17057
+ var LabelAttributionSchema = object({
17058
+ stepId: string(),
17059
+ modelId: string().optional(),
17060
+ decidedAt: number(),
17061
+ /**
17062
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
17063
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17201
17064
  *
17202
- * Distinct from `notRunnable` on purpose: that one says "this track was
17203
- * refused", this one says "the cluster cannot do this work at all" — every
17204
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17205
- * pinned model for its engine format, or dropped out. The remedy is a model /
17206
- * engine change, not a per-camera one. Non-zero here always comes with
17207
- * `complete: false`.
17065
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
17066
+ * notification rule authored on "Gianluca" stopped matching the moment the
17067
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
17068
+ * the thing that does not move, so it is what a rule matches on
17069
+ * (`NcConditions.identities`) and the text is what a human is shown.
17070
+ *
17071
+ * Absent when the label names no gallery row — a plate the OCR read but no
17072
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17208
17073
  */
17209
- noCapableNode: number(),
17210
- failed: number(),
17211
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17212
- complete: boolean().nullable(),
17213
- startedAtMs: number().nullable(),
17214
- finishedAtMs: number().nullable(),
17215
- /** Present when the pass ended by throwing. */
17216
- error: string().nullable()
17074
+ identityId: string().optional()
17217
17075
  });
17218
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17219
- deviceId: number(),
17220
- trackId: string()
17221
- }), TrackSchema.nullable()), method(object({
17222
- deviceId: number(),
17223
- since: number().optional(),
17224
- until: number().optional(),
17225
- limit: number().optional(),
17226
- /** Spatial filter — only tracks whose trajectory intersects the zone
17227
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17228
- * envelope columns, then precisely tested per position. Tracks with
17229
- * an unknown envelope (no frame dims at persist time) always match. */
17230
- zone: TrackZoneFilterSchema.optional(),
17231
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17232
- * compatible omitting the field keeps today's exact behaviour). */
17233
- projection: TrackProjectionSchema.optional(),
17234
- /** Include stationary-promoted rows (parked objects handed to the
17235
- * stationary registry). Default false: the timeline lists passages,
17236
- * not parking records (operator decision, 2026-08-15). */
17237
- includeStationary: boolean().optional()
17238
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17239
- deviceId: number(),
17240
- groupId: string().min(1)
17241
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17242
- kind: "mutation",
17243
- auth: "admin"
17244
- }), 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({
17245
- deviceId: number(),
17246
- since: number().optional(),
17247
- until: number().optional(),
17248
- kinds: array(string()).optional(),
17249
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17250
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17251
- deviceId: number(),
17252
- since: number(),
17253
- until: number(),
17254
- bucketMs: number().int().positive()
17255
- }), array(object({
17256
- bucketStart: number(),
17257
- motion: number().int(),
17258
- object: number().int(),
17259
- audio: number().int()
17260
- })).readonly()), method(object({
17261
- deviceId: number(),
17262
- cutoffMs: number()
17263
- }), object({
17264
- motion: number().int(),
17265
- object: number().int(),
17266
- audio: number().int()
17267
- }), {
17268
- kind: "mutation",
17269
- auth: "admin"
17270
- }), method(object({
17271
- deviceId: number(),
17272
- cutoffMs: number()
17273
- }), TrackCascadeCountsSchema, {
17274
- kind: "mutation",
17275
- auth: "admin"
17276
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17277
- kind: "mutation",
17278
- auth: "admin"
17279
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17280
- kind: "mutation",
17281
- auth: "admin"
17282
- }), method(object({
17283
- deviceId: number(),
17284
- trackIds: array(string()).min(1)
17285
- }), object({
17286
- deleted: number().int(),
17287
- failed: array(string()).readonly()
17288
- }), {
17289
- kind: "mutation",
17290
- auth: "admin"
17291
- }), method(object({
17292
- /** Log/audit scope only — the trackId is globally unique on its own. */
17076
+ /**
17077
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17078
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17079
+ * track and its events always answer the same question the same way.
17080
+ *
17081
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17082
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17083
+ * is tier 2, and each carries its own score + attribution.
17084
+ *
17085
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17086
+ * finest thing known. Before 4g the single `label` column held the finest
17087
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17088
+ * shows nothing on a species-only row; that is why the migration puts every
17089
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17090
+ * and why the read surfaces were changed in the same train.
17091
+ *
17092
+ * **Writing it.** The slots are independent, which is the whole point: a
17093
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17094
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17095
+ * higher score wins. One rule, one implementation — see
17096
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17097
+ */
17098
+ var TieredLabelFields = {
17099
+ /** Tier 1 the sub-class. See {@link LabelTierSchema}. */
17100
+ label: string().optional(),
17101
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17102
+ labelScore: number().optional(),
17103
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17104
+ labelMeta: LabelAttributionSchema.optional(),
17105
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
17106
+ subLabel: string().optional(),
17107
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17108
+ subLabelScore: number().optional(),
17109
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17110
+ subLabelMeta: LabelAttributionSchema.optional()
17111
+ };
17112
+ /** Per-camera slice of a training-export estimate. */
17113
+ var TrainingExportDeviceTotalsSchema = object({
17293
17114
  deviceId: number(),
17115
+ tracks: number().int(),
17116
+ files: number().int(),
17117
+ bytes: number().int()
17118
+ });
17119
+ /**
17120
+ * What a training export WOULD contain. Computed from media index rows only —
17121
+ * no blob is read to produce this.
17122
+ */
17123
+ var TrainingExportSummarySchema = object({
17124
+ generatedAt: number(),
17125
+ trackCount: number().int(),
17126
+ fileCount: number().int(),
17127
+ byteCount: number().int(),
17128
+ /** More marked tracks exist than a single pass carries. */
17129
+ truncated: boolean(),
17130
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17131
+ });
17132
+ var TrackSchema = object({
17294
17133
  trackId: string(),
17295
- flags: TrackFlagsPatchSchema
17296
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17297
- kind: "query",
17298
- auth: "admin"
17299
- }), method(object({
17300
- olderThanMs: number(),
17301
- reason: OpsLogReasonSchema.optional()
17302
- }), EventPruneCountsSchema, {
17303
- kind: "mutation",
17304
- auth: "admin"
17305
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17306
- kind: "mutation",
17307
- auth: "admin"
17308
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17309
- kind: "mutation",
17310
- auth: "admin"
17311
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17312
- kind: "mutation",
17313
- auth: "admin"
17314
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17315
- kind: "mutation",
17316
- auth: "admin"
17317
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17318
- kind: "mutation",
17319
- auth: "admin"
17320
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17321
- kind: "mutation",
17322
- auth: "admin"
17323
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17324
- kind: "query",
17325
- auth: "admin"
17326
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17327
- kind: "query",
17328
- auth: "admin"
17329
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17330
- kind: "query",
17331
- auth: "admin"
17332
- }), method(object({
17333
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17334
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17335
- * route it at one camera's owner, and "every camera" would stop being
17336
- * expressible at all. */
17337
- deviceIds: array(number()).optional(),
17338
- limit: number().int().min(1).max(500).optional()
17339
- }), array(RetrainTrackSchema).readonly(), {
17340
- kind: "query",
17341
- auth: "admin"
17342
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17343
- kind: "query",
17344
- auth: "admin"
17345
- }), method(object({
17346
17134
  deviceId: number(),
17347
- trackId: string(),
17348
- mediaKeys: array(string()).min(1)
17349
- }), RetrainFrameSelectionSchema, {
17350
- kind: "mutation",
17351
- auth: "admin"
17352
- }), method(object({
17135
+ className: string(),
17136
+ ...TieredLabelFields,
17137
+ producingDeviceName: string().optional(),
17138
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17139
+ source: TrackSourceSchema.optional(),
17140
+ firstSeen: number(),
17141
+ lastSeen: number(),
17142
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17143
+ positions: array(TrackPositionSchema).readonly(),
17144
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17145
+ * saveThumbnails policy). */
17146
+ snapshots: array(TrackSnapshotSchema).readonly(),
17147
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17148
+ zonesVisited: array(string()).readonly(),
17149
+ /**
17150
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17151
+ * `zones` capability.
17152
+ *
17153
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17154
+ * and no card can render — so every free-text search surface was structurally
17155
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17156
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17157
+ * derivation and costs the clients no extra call (the `zones` cap is
17158
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17159
+ * surface built to avoid exactly that).
17160
+ *
17161
+ * Resolved, never invented: a zone deleted since the track was written has no
17162
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17163
+ * two are not positionally aligned. Absent when the track visited no zone, or
17164
+ * when the zone catalogue could not be read.
17165
+ */
17166
+ zoneNames: array(string()).readonly().optional(),
17167
+ /** Deduplicated set of detector classes observed for this track over its
17168
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17169
+ * legacy rows written before class accumulation shipped. */
17170
+ classes: array(string()).readonly().optional(),
17171
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17172
+ totalDistance: number(),
17173
+ state: TrackStateSchema,
17174
+ active: boolean(),
17175
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17176
+ * track expiry, recomputed on late label). Absent on legacy rows written
17177
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17178
+ importance: number().optional(),
17179
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17180
+ * "best" frame). Absent when the track produced no object events. */
17181
+ bestEventId: string().optional(),
17182
+ /** Tag of the importance sub-signal that dominated the score
17183
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17184
+ importanceReason: string().optional(),
17185
+ /** Audio-classification labels heard on the camera during the track's
17186
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17187
+ * Absent on legacy rows / tracks with no confident audio. */
17188
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17189
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17190
+ * Populated from the persisted envelope columns on historical reads;
17191
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17192
+ envelope: TrackEnvelopeSchema.optional(),
17193
+ /**
17194
+ * A face DETECTOR found a face on this track — nothing more. It says the
17195
+ * detail plane produced a `face` detail; it does NOT say the face was
17196
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17197
+ * enabled. Set once and never cleared.
17198
+ *
17199
+ * **This exists so "face present but not recognised" is expressible.** A
17200
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17201
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17202
+ * and a track with no face at all were byte-identical on the wire and no
17203
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17204
+ * === undefined`.
17205
+ *
17206
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17207
+ * and so does every server that predates the field — a consumer must test
17208
+ * `=== true` and render nothing otherwise, never infer "no face".
17209
+ */
17210
+ hasFace: boolean().optional(),
17211
+ /**
17212
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17213
+ * face an operator could ASSIGN to an identity.
17214
+ *
17215
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17216
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17217
+ * branch, before every gate, and means no more than "a face detector produced
17218
+ * a face detail". This one is stamped at the single moment the gallery row
17219
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17220
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17221
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17222
+ * the crop-store drop. Everything between the detector and that insert can
17223
+ * legitimately refuse the face, so a flag written any earlier promises the
17224
+ * operator something to assign and delivers nothing.
17225
+ *
17226
+ * **Independent of recognition.** A face collected but never auto-matched is
17227
+ * still assignable — it is in fact the face an operator most wants to reach —
17228
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17229
+ * `subLabel`; this says only that the raw material exists.
17230
+ *
17231
+ * **Set once, never cleared.** A track that produced a gallery row produced
17232
+ * one; deleting the row later is the gallery's business, not this flag's.
17233
+ *
17234
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17235
+ * before the column omits it, and so does every server that predates the
17236
+ * field. A consumer must test `=== true` and render nothing otherwise —
17237
+ * never infer "no assignable face".
17238
+ */
17239
+ hasEmbeddedFace: boolean().optional(),
17240
+ /**
17241
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17242
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17243
+ * so the passage is tracked once and as a VEHICLE.
17244
+ *
17245
+ * It exists because the fold's record was dishonest. D34 and the code both
17246
+ * said "the person is not lost — it is reported so both entities stay on the
17247
+ * record"; in fact the pair went into a per-processor RAM field behind an
17248
+ * accessor nobody called, and every durable surface said `vehicle`, full
17249
+ * stop. This is the composition note that makes the row true.
17250
+ *
17251
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17252
+ * person" is not an answer to "what is this" — both label tiers would refuse
17253
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17254
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17255
+ * and a `person` rule still does not fire for someone cycling past.
17256
+ *
17257
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17258
+ * the column, and every hub that predates the field, omits it. Test
17259
+ * `=== true` and render nothing otherwise — never infer "no rider".
17260
+ */
17261
+ hasRider: boolean().optional(),
17262
+ ...TrackFlagFields,
17263
+ ...TrackRetrainFields
17264
+ });
17265
+ var BaseEventFields = {
17266
+ id: string(),
17353
17267
  deviceId: number(),
17354
- trackId: string(),
17355
- frameId: string()
17356
- }), object({
17357
- removed: boolean(),
17358
- removedAnnotations: number().int()
17359
- }), {
17360
- kind: "mutation",
17361
- auth: "admin"
17362
- }), method(object({ frameId: string() }), object({
17268
+ timestamp: number()
17269
+ };
17270
+ var MotionEventSchema = object({
17271
+ ...BaseEventFields,
17272
+ kind: literal("motion"),
17273
+ regionCount: number(),
17274
+ /** Heavy JSON array — omitted in slim projection. */
17275
+ regions: array(object({
17276
+ bbox: BoundingBoxSchema,
17277
+ pixelCount: number(),
17278
+ intensity: number()
17279
+ })).readonly().optional(),
17280
+ /** Omitted in slim projection. */
17281
+ frameWidth: number().optional(),
17282
+ /** Omitted in slim projection. */
17283
+ frameHeight: number().optional(),
17284
+ /** Populated by B5 (recording playback URL for this event). */
17285
+ mediaUrl: string().optional()
17286
+ });
17287
+ /**
17288
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17289
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17290
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17291
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17292
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17293
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17294
+ */
17295
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17296
+ /**
17297
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17298
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17299
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17300
+ * appearance event carry none, so a rule asking for a direction fails closed
17301
+ * on them.
17302
+ *
17303
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17304
+ * into its own event, so a frame in which a track enters A while leaving B
17305
+ * produces two events with two directions — never one ambiguous row.
17306
+ *
17307
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17308
+ * membership the box has NOW, and by definition it no longer contains the zone
17309
+ * that was just left. Without the id here, a zone-scoped rule could never match
17310
+ * the exit it asked for.
17311
+ */
17312
+ var ZoneCrossingSchema = object({
17313
+ direction: _enum(["enter", "exit"]),
17314
+ /** Admin zone id crossed. */
17315
+ zoneId: string(),
17316
+ /** Zone display name at crossing time (falls back to the id). */
17317
+ zoneName: string().optional()
17318
+ });
17319
+ var ObjectEventSchema = object({
17320
+ ...BaseEventFields,
17321
+ kind: literal("object"),
17322
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17323
+ source: DetectionSourceSchema.optional(),
17324
+ /**
17325
+ * Inference-frame id shared by every object event emitted from the SAME frame
17326
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17327
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17328
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17329
+ * Optional for backward-compat with pre-existing rows / the slim projection
17330
+ * includes it (it is light). Absent on rows written before this field.
17331
+ */
17332
+ frameId: string().optional(),
17333
+ /** Omitted in slim projection. */
17334
+ trackId: string().optional(),
17335
+ className: string(),
17336
+ ...TieredLabelFields,
17337
+ /** Omitted in slim projection. */
17338
+ confidence: number().optional(),
17339
+ /** Heavy JSON — omitted in slim projection. */
17340
+ bbox: BoundingBoxSchema.optional(),
17341
+ /** Heavy JSON — omitted in slim projection. */
17342
+ zones: array(string()).readonly().optional(),
17343
+ /** Omitted in slim projection. */
17344
+ state: TrackStateSchema.optional(),
17345
+ /**
17346
+ * The zone crossing this event IS, when it is one. Absent on every other
17347
+ * event kind (movement state, appearance, package) — see
17348
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17349
+ */
17350
+ zoneCrossing: ZoneCrossingSchema.optional(),
17351
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17352
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17353
+ frameWidth: number().optional(),
17354
+ frameHeight: number().optional(),
17355
+ /** MediaStore key for the crop attached to this event (if any). */
17356
+ mediaKey: string().optional(),
17357
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17358
+ * best-detection full frame). Resolve via the event-media data-plane
17359
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17360
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17361
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17362
+ keyFrameMediaKey: string().optional(),
17363
+ /** Populated by B5 (recording playback URL for this event). */
17364
+ mediaUrl: string().optional(),
17365
+ /** The parent track's key-event importance [0,1], propagated to every object
17366
+ * event of the track (so an event row can be sorted by importance without a
17367
+ * track join). Absent on legacy rows / before the track was scored. */
17368
+ importance: number().optional()
17369
+ });
17370
+ var AudioEventSchema = object({
17371
+ ...BaseEventFields,
17372
+ kind: literal("audio"),
17373
+ rms: number(),
17374
+ dbfs: number(),
17375
+ classification: object({
17376
+ className: string(),
17377
+ originalClass: string().optional(),
17378
+ score: number()
17379
+ }).optional(),
17380
+ /** Populated by B5 (recording playback URL for this event). */
17381
+ mediaUrl: string().optional()
17382
+ });
17383
+ var MediaFileKindEnum = _enum([
17384
+ "crop",
17385
+ "thumbnail",
17386
+ "snapshot",
17387
+ "firstFrame",
17388
+ "lastFrame",
17389
+ "fullFrame",
17390
+ "fullFrameBoxed",
17391
+ "faceCrop",
17392
+ "plateCrop",
17393
+ "keyFrame",
17394
+ "keyFrameSmall",
17395
+ "thumbnailSmall"
17396
+ ]);
17397
+ var MediaFileSchema = object({
17398
+ key: string(),
17399
+ kind: MediaFileKindEnum,
17363
17400
  base64: string(),
17364
- width: number().int(),
17365
- height: number().int()
17366
- }), {
17367
- kind: "query",
17368
- auth: "admin"
17369
- }), method(object({
17370
- deviceId: number(),
17371
- trackId: string(),
17372
- frameId: string(),
17373
- subject: RetrainAssistSubjectSchema,
17374
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17375
- nodeId: string().optional()
17376
- }), RetrainAssistResultSchema, {
17377
- kind: "mutation",
17378
- auth: "admin"
17379
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17380
- kind: "query",
17381
- auth: "admin"
17382
- }), method(object({
17383
- deviceId: number(),
17384
- trackId: string(),
17385
- frameId: string(),
17386
- annotations: array(RetrainAnnotationDraftSchema)
17387
- }), array(RetrainAnnotationSchema).readonly(), {
17388
- kind: "mutation",
17389
- auth: "admin"
17390
- }), method(object({
17391
- deviceId: number(),
17392
- trackId: string()
17393
- }), RetrainTransitionResultSchema, {
17394
- kind: "mutation",
17395
- auth: "admin"
17396
- }), method(object({
17397
- deviceId: number(),
17398
- trackId: string()
17399
- }), RetrainTransitionResultSchema, {
17400
- kind: "mutation",
17401
- auth: "admin"
17402
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17403
- kind: "query",
17404
- auth: "admin"
17405
- }), method(object({
17406
- eventId: string(),
17407
- kind: MediaFileKindEnum.optional(),
17408
- deviceId: number()
17409
- }), array(MediaFileSchema).readonly()), method(object({
17410
- trackId: string(),
17411
- kinds: array(MediaFileKindEnum).optional(),
17412
- deviceId: number()
17413
- }), array(MediaFileSchema).readonly()), method(object({
17401
+ sizeBytes: number(),
17402
+ timestamp: number()
17403
+ });
17404
+ /**
17405
+ * One media row WITHOUT its bytes.
17406
+ *
17407
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17408
+ * 140 s track), and a client that renders tiles from the media data plane needs
17409
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17410
+ * with an immutable cache, instead of all at once inside a tRPC response that
17411
+ * blocks the whole view.
17412
+ *
17413
+ * `sizeBytes` is carried because it is what lets a client decide between the
17414
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17415
+ */
17416
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17417
+ /**
17418
+ * The MACRO tier of an annotation — a CLOSED set.
17419
+ *
17420
+ * This is what the exported detector predicts, so a typo here is a new class
17421
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17422
+ * the whole point of the page is teaching the model things it does not know
17423
+ * yet, and constraining that vocabulary would make it useless.
17424
+ *
17425
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17426
+ * `subLabel` is one of these values, in any casing, because once `person`
17427
+ * exists in both tiers "every person box" stops being answerable without
17428
+ * knowing every string anyone ever typed — and the damage is retroactive.
17429
+ */
17430
+ var RetrainMacroClassSchema = _enum([
17431
+ "person",
17432
+ "vehicle",
17433
+ "animal",
17434
+ "package",
17435
+ "face",
17436
+ "plate"
17437
+ ]);
17438
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17439
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17440
+ /** Did a human draw this box, or did the assist propose it? */
17441
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17442
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17443
+ var RetrainBboxSchema = object({
17444
+ x: number(),
17445
+ y: number(),
17446
+ w: number(),
17447
+ h: number()
17448
+ });
17449
+ /**
17450
+ * One annotated subject.
17451
+ *
17452
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17453
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17454
+ * derived from it at export and never stored — storing them is how one feature
17455
+ * space ends up holding two crops of the same subject (D52).
17456
+ */
17457
+ var RetrainAnnotationSchema = object({
17458
+ id: string(),
17414
17459
  trackId: string(),
17415
- deviceId: number()
17416
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17417
- kind: "mutation",
17418
- auth: "admin"
17419
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17420
- kind: "mutation",
17421
- auth: "admin"
17422
- }), method(object({}), RebuildStatusSchema), object({
17423
- deviceId: number(),
17424
- timestamp: number(),
17425
- frameWidth: number(),
17426
- frameHeight: number(),
17427
- detections: array(OverlayDetectionSchema).readonly()
17428
- }), object({
17429
17460
  deviceId: number(),
17461
+ /** The COPY in retrain storage — never the source track's media key. */
17462
+ mediaKey: string(),
17463
+ bbox: RetrainBboxSchema,
17464
+ macroClass: RetrainMacroClassSchema,
17465
+ label: string().optional(),
17466
+ subLabel: string().optional(),
17467
+ kind: RetrainAnnotationKindSchema,
17468
+ source: RetrainAnnotationSourceSchema,
17469
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17470
+ assistModelId: string().optional(),
17471
+ assistScore: number().optional(),
17472
+ exportedInBatch: string().optional(),
17473
+ createdAt: number()
17474
+ });
17475
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17476
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17477
+ id: true,
17478
+ trackId: true,
17479
+ deviceId: true,
17480
+ mediaKey: true,
17481
+ createdAt: true,
17482
+ exportedInBatch: true
17483
+ });
17484
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17485
+ var RetrainTrackSchema = object({
17430
17486
  trackId: string(),
17431
- className: string()
17432
- }), object({
17433
17487
  deviceId: number(),
17434
- trackId: string(),
17435
17488
  className: string(),
17436
- durationMs: number()
17437
- }), object({
17489
+ label: string().optional(),
17490
+ firstSeen: number(),
17491
+ lastSeen: number(),
17492
+ /** How many frames the dataset already holds from this track. */
17493
+ frameCount: number().int(),
17494
+ /** How many subjects have been annotated on those frames. `0` with
17495
+ * `frameCount: 0` is exactly "staging, still to work". */
17496
+ annotationCount: number().int()
17497
+ });
17498
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17499
+ var RetrainFrameCandidateSchema = object({
17500
+ mediaKey: string(),
17501
+ kind: MediaFileKindEnum,
17502
+ timestamp: number(),
17503
+ sizeBytes: number().int(),
17504
+ /** A copy of this original already exists — selecting it is free and cannot
17505
+ * fail, whatever became of the original. */
17506
+ copied: boolean()
17507
+ });
17508
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17509
+ var RetrainFrameSchema = object({
17510
+ frameId: string(),
17438
17511
  deviceId: number(),
17439
- kind: EventKindSchema,
17440
- eventId: string(),
17441
- timestamp: number()
17512
+ trackId: string(),
17513
+ /** Provenance only. It may already point at nothing — that is expected. */
17514
+ sourceMediaKey: string(),
17515
+ sourceKind: MediaFileKindEnum,
17516
+ sizeBytes: number().int(),
17517
+ width: number().int(),
17518
+ height: number().int(),
17519
+ copiedAt: number()
17520
+ });
17521
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17522
+ var RetrainCopyRefusalSchema = _enum([
17523
+ "source-missing",
17524
+ "unreadable-image",
17525
+ "write-failed"
17526
+ ]);
17527
+ var RetrainFrameSelectionSchema = object({
17528
+ copied: array(RetrainFrameSchema).readonly(),
17529
+ refused: array(object({
17530
+ sourceMediaKey: string(),
17531
+ reason: RetrainCopyRefusalSchema
17532
+ })).readonly()
17442
17533
  });
17534
+ var RetrainFrameListSchema = object({
17535
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17536
+ copies: array(RetrainFrameSchema).readonly(),
17537
+ /** What the page pre-selects — the native key frame when one survives. */
17538
+ autoPickMediaKey: string().optional()
17539
+ });
17540
+ /** What the operator asked the assist to look for. */
17541
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17542
+ kind: literal("package"),
17543
+ zone: RetrainBboxSchema.optional()
17544
+ }), object({
17545
+ kind: literal("objects"),
17546
+ modelId: string(),
17547
+ minScore: number().optional()
17548
+ })]);
17443
17549
  /**
17444
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17445
- * within the frame, so the executor can re-cut a leaf child ROI at native
17446
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17550
+ * The assist's answer a discriminated union, because "the model saw nothing"
17551
+ * and "this node cannot run that model" lead to different next moves and a
17552
+ * nullable result cannot tell them apart.
17447
17553
  */
17448
- var NativeCropRefSchema = object({
17449
- /** Handle keying the retained native surface (node-pinned to its owner). */
17450
- handle: FrameHandleSchema,
17451
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17452
- cropFrameSpace: object({
17453
- x: number(),
17454
- y: number(),
17455
- w: number(),
17456
- h: number()
17457
- })
17554
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17555
+ kind: literal("proposed"),
17556
+ modelId: string(),
17557
+ stepId: string(),
17558
+ minScore: number(),
17559
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17560
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17561
+ /** Returned by the runner but removed by the threshold. */
17562
+ belowThreshold: number().int()
17563
+ }), object({
17564
+ kind: literal("refused"),
17565
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17566
+ reason: string(),
17567
+ detail: string().optional()
17568
+ })]);
17569
+ /** The outcome of a lifecycle move owned by the retrain page. */
17570
+ var RetrainTransitionResultSchema = object({
17571
+ trackId: string(),
17572
+ /** Where the track ended up, whatever happened. */
17573
+ retrainStatus: RetrainStatusSchema,
17574
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17575
+ changed: boolean(),
17576
+ reason: _enum([
17577
+ "unknown-track",
17578
+ "no-frames-copied",
17579
+ "not-staging",
17580
+ "not-trained",
17581
+ "unchanged"
17582
+ ]).optional()
17458
17583
  });
17459
- object({
17460
- crop: object({
17461
- left: number(),
17462
- top: number(),
17463
- width: number().positive(),
17464
- height: number().positive()
17465
- }).optional(),
17466
- content: object({
17467
- width: number().int().positive(),
17468
- height: number().int().positive()
17469
- }),
17470
- fit: _enum(["stretch", "contain"]),
17471
- format: _enum([
17472
- "rgb",
17473
- "gray",
17474
- "jpeg"
17475
- ])
17584
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17585
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17586
+ var DeviceEventQueryInput = object({
17587
+ deviceId: number(),
17588
+ since: number().optional(),
17589
+ until: number().optional(),
17590
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17591
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17592
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17593
+ * exact behaviour. Callers may omit this field — the store defaults to
17594
+ * `full` when not provided. */
17595
+ projection: _enum(["full", "slim"]).optional()
17476
17596
  });
17477
- var FrameRefSchema = object({
17478
- registryId: string().min(1),
17479
- id: string().min(1),
17480
- width: number().int().positive(),
17481
- height: number().int().positive(),
17482
- format: _enum(["rgb", "gray"]),
17483
- timestamp: number(),
17484
- capturedAt: number().optional()
17597
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17598
+ var RecentTracksQueryInput = object({
17599
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17600
+ deviceIds: array(number()),
17601
+ /** Window lower bound on `lastSeen` (inclusive). */
17602
+ since: number().optional(),
17603
+ /** Window upper bound on `lastSeen` (inclusive). */
17604
+ until: number().optional(),
17605
+ /** Page size. Default 200, max 1000. */
17606
+ limit: number().int().min(1).max(1e3).default(200),
17607
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17608
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17609
+ cursor: string().optional(),
17610
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17611
+ projection: TrackProjectionSchema.optional(),
17612
+ /** Include stationary-promoted rows (parked objects). Default false: the
17613
+ * feed lists passages; parking records live on the stationary registry. */
17614
+ includeStationary: boolean().optional()
17485
17615
  });
17486
- var ModelFormatSchema$1 = _enum([
17487
- "onnx",
17488
- "coreml",
17489
- "openvino",
17490
- "tflite",
17491
- "pt",
17492
- "gguf"
17493
- ]);
17494
- var PipelineSlotSchema = _enum([
17495
- "detector",
17496
- "cropper",
17497
- "classifier",
17498
- "refiner",
17499
- "audio-classifier"
17500
- ]);
17501
- var PipelineEngineChoiceSchema = object({
17502
- runtime: _enum(["node", "python"]),
17503
- backend: string(),
17504
- format: ModelFormatSchema$1,
17505
- device: string().optional()
17616
+ var RecentTracksPageSchema = object({
17617
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17618
+ tracks: array(TrackSchema).readonly(),
17619
+ /** Cursor for the next page, or null when this page is the last. */
17620
+ nextCursor: string().nullable()
17621
+ });
17622
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17623
+ var LIST_GROUPS_MAX_LIMIT = 100;
17624
+ var AnalyticsGroupRecordSchema = object({
17625
+ id: string(),
17626
+ deviceId: number().int(),
17627
+ openedAt: number().int(),
17628
+ closedAt: number().int(),
17629
+ timestamp: number().int(),
17630
+ memberCount: number().int(),
17631
+ memberTrackIds: array(string()).readonly(),
17632
+ className: string(),
17633
+ classes: array(string()).readonly(),
17634
+ /** Relative event-media path, or null when the group has no picture yet. */
17635
+ mediaUrl: string().nullable(),
17636
+ singleton: boolean()
17506
17637
  });
17507
- var AvailableEngineSchema = object({
17508
- engine: PipelineEngineChoiceSchema,
17509
- devices: array(object({
17510
- id: string(),
17511
- label: string(),
17512
- description: string().optional()
17513
- })).readonly(),
17514
- defaultDevice: string()
17638
+ var AnalyticsGroupMemberSchema = object({
17639
+ trackId: string(),
17640
+ deviceId: number().int(),
17641
+ className: string(),
17642
+ firstSeen: number().int(),
17643
+ lastSeen: number().int(),
17644
+ mediaUrl: string().nullable()
17515
17645
  });
17516
- var PipelineDefaultStepSchema = lazy(() => object({
17517
- addonId: string(),
17518
- addonName: string(),
17519
- slot: PipelineSlotSchema,
17520
- inputClasses: array(string()).readonly(),
17521
- outputClasses: array(string()).readonly(),
17522
- enabled: boolean(),
17523
- modelId: string(),
17524
- children: array(PipelineDefaultStepSchema).readonly(),
17525
- group: string().optional(),
17526
- settings: record(string(), unknown()).optional()
17527
- }));
17528
- var PipelineTemplateStepSchema = lazy(() => object({
17529
- addonId: string(),
17530
- enabled: boolean(),
17531
- modelId: string(),
17532
- children: array(PipelineTemplateStepSchema).readonly(),
17533
- settings: record(string(), unknown()).optional()
17534
- }));
17535
- var PipelineTemplateSchema$1 = object({
17536
- id: string(),
17537
- name: string(),
17538
- createdAt: string(),
17539
- updatedAt: string(),
17540
- engine: PipelineEngineChoiceSchema,
17541
- steps: array(PipelineTemplateStepSchema).readonly()
17646
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17647
+ var ListGroupsQueryInput = object({
17648
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17649
+ deviceIds: array(number()),
17650
+ /** Window lower bound on `closedAt` (inclusive). */
17651
+ since: number().optional(),
17652
+ /** Window upper bound on `openedAt` (inclusive). */
17653
+ until: number().optional(),
17654
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17655
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17656
+ cursor: string().optional()
17542
17657
  });
17543
- var PipelineModelOptionSchema = object({
17544
- id: string(),
17545
- name: string(),
17546
- formats: record(string(), object({
17547
- downloaded: boolean(),
17548
- sizeMB: number()
17549
- })),
17550
- group: ModelVariantGroupSchema.optional(),
17551
- legacy: boolean().optional(),
17552
- provider: ModelProviderIdSchema.optional()
17658
+ var ListGroupsPageSchema = object({
17659
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17660
+ nextCursor: string().nullable()
17553
17661
  });
17554
- var ConfigFieldBridge = custom();
17555
- var PipelineAddonSchemaSchema = object({
17556
- id: string(),
17557
- name: string(),
17558
- slot: PipelineSlotSchema,
17559
- inputClasses: array(string()).readonly(),
17560
- outputClasses: array(string()).readonly(),
17561
- childSlots: array(PipelineSlotSchema).readonly(),
17562
- models: array(PipelineModelOptionSchema).readonly(),
17563
- defaultModelId: string(),
17564
- defaultModelIdByFormat: record(string(), string()).optional(),
17565
- enabledByDefault: boolean().optional(),
17566
- backfillIntoExistingOverrides: boolean().optional(),
17567
- defaultConfidence: number(),
17568
- group: string().optional(),
17569
- configSchema: array(ConfigFieldBridge).readonly().optional()
17662
+ var KeyEventQueryInput = object({
17663
+ deviceId: number(),
17664
+ /** Window lower bound (track firstSeen ≥ since). */
17665
+ since: number(),
17666
+ /** Window upper bound (track firstSeen ≤ until). */
17667
+ until: number(),
17668
+ limit: number().int().min(1).max(200).default(50),
17669
+ /** Drop tracks scoring below this importance. */
17670
+ minImportance: number().min(0).max(1).optional(),
17671
+ /** Restrict to a single class (e.g. 'person'). */
17672
+ classFilter: string().optional()
17570
17673
  });
17571
- var PipelineSlotSchemaSchema = object({
17572
- id: PipelineSlotSchema,
17573
- label: string(),
17574
- priority: number(),
17575
- parentSlot: PipelineSlotSchema.nullable(),
17576
- addons: array(PipelineAddonSchemaSchema).readonly()
17674
+ var KeyEventSchema = object({
17675
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17676
+ id: string(),
17677
+ trackId: string(),
17678
+ /** Track start time (firstSeen). */
17679
+ timestamp: number(),
17680
+ className: string(),
17681
+ ...TieredLabelFields,
17682
+ importance: number(),
17683
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17684
+ bestEventId: string(),
17685
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17686
+ windowMs: number().optional(),
17687
+ ...TrackFlagFields,
17688
+ ...TrackRetrainFields
17577
17689
  });
17578
- var PipelineSchemaSchema = object({
17579
- availableEngines: array(AvailableEngineSchema).readonly(),
17580
- selectedEngine: PipelineEngineChoiceSchema,
17581
- slots: array(PipelineSlotSchemaSchema).readonly()
17690
+ object({
17691
+ trackId: string(),
17692
+ className: string(),
17693
+ confidence: number(),
17694
+ bbox: BoundingBoxSchema,
17695
+ zones: array(string()).readonly(),
17696
+ state: TrackStateSchema
17582
17697
  });
17583
- var EngineProvisioningSchema = object({
17584
- runtimeId: _enum([
17585
- "onnx",
17586
- "openvino",
17587
- "coreml",
17588
- "edgetpu"
17589
- ]).nullable(),
17590
- device: string().nullable(),
17591
- state: _enum([
17592
- "idle",
17593
- "installing",
17594
- "verifying",
17595
- "ready",
17596
- "failed"
17597
- ]),
17598
- progress: number().optional(),
17599
- error: string().optional(),
17600
- nextRetryAt: number().optional(),
17601
- /**
17602
- * Gate A (config-correctness gate at engine change): human-readable
17603
- * config issues surfaced EAGERLY when the node's engine changes — model
17604
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17605
- * has a <format> build"). Additive/optional: informational only, never
17606
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17607
- * Absent/empty when the node-default tree resolves cleanly.
17608
- */
17609
- configIssues: array(string()).optional()
17698
+ var OverlayDetectionSchema = looseObject({
17699
+ id: string(),
17700
+ kind: _enum(["first-level", "detail"]),
17701
+ macroClass: string(),
17702
+ score: number(),
17703
+ bbox: object({
17704
+ x: number(),
17705
+ y: number(),
17706
+ width: number(),
17707
+ height: number()
17708
+ }),
17709
+ labels: array(looseObject({
17710
+ label: string(),
17711
+ score: number()
17712
+ })).readonly(),
17713
+ parentId: string().optional()
17610
17714
  });
17611
- var PipelineStepInputSchema = lazy(() => object({
17612
- addonId: string(),
17613
- modelId: string().optional(),
17614
- enabled: boolean().default(true),
17615
- children: array(PipelineStepInputSchema).optional(),
17616
- settings: record(string(), unknown()).optional(),
17617
- jumpDeviceKey: string().optional()
17618
- }));
17619
- var ModelSubstitutionSchema = object({
17620
- addonId: string(),
17621
- chosen: string(),
17622
- running: string(),
17623
- format: string()
17715
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17716
+ var SearchObjectEventsInput = object({
17717
+ text: string(),
17718
+ deviceId: number().optional(),
17719
+ since: number().optional(),
17720
+ until: number().optional(),
17721
+ classFilter: string().optional(),
17722
+ limit: number().default(50),
17723
+ minScore: number().min(0).max(1).default(.2)
17624
17724
  });
17625
- var PipelineValidationIssueSchema = object({
17626
- addonId: string(),
17627
- kind: _enum(["unknown-addon", "no-format-build"]),
17628
- detail: string()
17725
+ var TrackCascadeCountsSchema = object({
17726
+ /** Persisted track roots deleted (authoritative). */
17727
+ tracks: number().int(),
17728
+ /** Object events removed with their tracks (best-effort; see note above). */
17729
+ events: number().int(),
17730
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17731
+ media: number().int(),
17732
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
17733
+ faces: number().int(),
17734
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17735
+ plates: number().int(),
17736
+ /** Per-track CLIP search vectors removed (best-effort). */
17737
+ embeddings: number().int(),
17738
+ /** Group membership + group rows removed with their last member (best-effort). */
17739
+ groups: number().int()
17629
17740
  });
17630
- var PipelineValidationResultSchema = object({
17631
- ok: boolean(),
17632
- issues: array(PipelineValidationIssueSchema).readonly(),
17633
- substitutions: array(ModelSubstitutionSchema).readonly(),
17634
- /** The node's `currentEngine.format` this validation ran against. */
17635
- format: string()
17741
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17742
+ var DiskReconcileCountsSchema = object({
17743
+ mediaDropped: number().int(),
17744
+ tracks: number().int(),
17745
+ events: number().int()
17636
17746
  });
17637
- var ReferenceImageEntrySchema = object({
17638
- filename: string(),
17639
- stepIds: array(string()).readonly().optional()
17747
+ /** Event-store footprint for one camera. */
17748
+ var EventStoreDeviceFootprintSchema = object({
17749
+ deviceId: number(),
17750
+ /** Persisted event rows (motion + object + audio) for the camera. */
17751
+ rows: number().int(),
17752
+ /** Event-owned media bytes on disk for the camera. */
17753
+ bytes: number().int()
17640
17754
  });
17641
- var ReferenceImageBodySchema = object({
17642
- base64: string(),
17643
- filename: string()
17755
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17756
+ var EventStoreFootprintSchema = object({
17757
+ totalRows: number().int(),
17758
+ totalBytes: number().int(),
17759
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
17644
17760
  });
17645
- var ReferenceAudioEntrySchema = object({
17646
- filename: string(),
17647
- sizeKb: number()
17761
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
17762
+ var EventPruneCountsSchema = object({
17763
+ motion: number().int(),
17764
+ object: number().int(),
17765
+ audio: number().int()
17648
17766
  });
17649
- var ReferenceAudioBodySchema = object({ base64: string() });
17650
- var AudioBackendSchema = object({
17651
- id: string(),
17652
- name: string(),
17653
- description: string(),
17654
- available: boolean(),
17767
+ /**
17768
+ * Re-embed stored tracks from their key frames.
17769
+ *
17770
+ * The reason this is an operator-callable method and not a migration script:
17771
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
17772
+ * squaring — is only changeable if the existing vectors can be regenerated.
17773
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
17774
+ * symptom is a quality regression with no visible cause.
17775
+ */
17776
+ var RebuildObjectEmbeddingsInput = object({
17777
+ /** Restrict to one camera. Omit for the whole fleet. */
17778
+ deviceId: number().optional(),
17779
+ since: number().optional(),
17780
+ until: number().optional(),
17781
+ /** Stop after this many tracks; the result reports whether more remain. */
17782
+ maxTracks: number().int().positive().optional(),
17655
17783
  /**
17656
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17657
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17658
- * the benchmark UI to populate the `enabledMicroClasses` filter
17659
- * specific to the selected backend without a separate fetch.
17784
+ * Run every embedding on THIS node instead of round-robining the fleet.
17785
+ *
17786
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17787
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17788
+ * calling it that would pin the rebuild REQUEST itself to that node — the
17789
+ * rebuild orchestration lives on the hub, and only the per-track step runs
17790
+ * remotely. This field is data; the per-track pin is applied inside.
17791
+ *
17792
+ * Absent ⇒ round-robin over every online node whose runner can serve the
17793
+ * pinned model.
17660
17794
  */
17661
- rawLabels: array(string()).readonly().optional()
17662
- });
17663
- var AudioCapabilitiesSchema = object({
17664
- activeBackend: string(),
17665
- availableBackends: array(AudioBackendSchema).readonly(),
17666
- sampleRate: number(),
17667
- chunkDurationMs: number()
17668
- });
17669
- var DownloadModelResultSchema = object({
17670
- filePath: string(),
17671
- sizeMB: number(),
17672
- durationMs: number()
17795
+ executeOnNodeId: string().optional(),
17796
+ /**
17797
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17798
+ * run flat out.
17799
+ *
17800
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
17801
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17802
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17803
+ * force is logged at start and finish so a deliberately slow pass reads
17804
+ * differently from a stalled one.
17805
+ */
17806
+ pacingMs: number().int().nonnegative().optional()
17673
17807
  });
17674
17808
  /**
17675
- * Wrapper carrying a single test run's result. Replaces the legacy
17676
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17677
- * canonical `AudioResult` from the Phase 6 output rework: one
17678
- * `AudioDetection` per class above `minScore`, top-N candidates in
17679
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17680
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17681
- * benchmark UI can still report a clean failure when the classifier
17682
- * cap isn't available.
17809
+ * Result of emptying the CLIP index.
17810
+ *
17811
+ * The clean slate before a policy change: a new crop margin or encoder model
17812
+ * leaves two feature spaces in one index whose cosine scores are not
17813
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
17814
+ * means the same thing.
17683
17815
  */
17684
- var AudioTestResultSchema = object({
17685
- success: boolean(),
17686
- error: string().optional(),
17687
- frame: custom().optional()
17816
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17817
+ /**
17818
+ * Acknowledgement that a rebuild STARTED.
17819
+ *
17820
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17821
+ * runs detached and this returns immediately. Waiting for it made the client
17822
+ * time out while the work carried on server-side, which is the worst of both:
17823
+ * no result and no way to know it was still going. Poll
17824
+ * `getObjectEmbeddingRebuildStatus` for progress.
17825
+ */
17826
+ var RebuildObjectEmbeddingsResultSchema = object({
17827
+ started: boolean(),
17828
+ /** True when a pass was already running; the new request is ignored. */
17829
+ alreadyRunning: boolean()
17688
17830
  });
17689
- var PipelineConfigBridge = custom();
17690
- var ConfigUISchemaBridge = custom();
17691
- var ConfigUISchemaNullableBridge = custom();
17692
- var InferenceCapabilitiesBridge = custom();
17693
- var ModelAvailabilityListBridge = custom();
17694
- var PipelineRunResultBridge = custom();
17695
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17696
- modelId: string(),
17697
- settings: record(string(), unknown()).readonly()
17698
- }))), method(object({ steps: record(string(), object({
17699
- modelId: string(),
17700
- settings: record(string(), unknown()).readonly()
17701
- })) }), object({ success: literal(true) }), {
17831
+ var RebuildStatusSchema = object({
17832
+ running: boolean(),
17833
+ scanned: number(),
17834
+ rebuilt: number(),
17835
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
17836
+ missingKeyFrame: number(),
17837
+ /** Tracks with no usable detection box. */
17838
+ missingBbox: number(),
17839
+ /**
17840
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
17841
+ * frame, a step that threw. Separate from `failed` because the remedy is
17842
+ * different, and because a whole camera silently contributing zero vectors
17843
+ * is the shape of failure a rebuild must never hide.
17844
+ */
17845
+ notRunnable: number(),
17846
+ /**
17847
+ * The pass stopped because NO node could serve the pinned model.
17848
+ *
17849
+ * Distinct from `notRunnable` on purpose: that one says "this track was
17850
+ * refused", this one says "the cluster cannot do this work at all" — every
17851
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
17852
+ * pinned model for its engine format, or dropped out. The remedy is a model /
17853
+ * engine change, not a per-camera one. Non-zero here always comes with
17854
+ * `complete: false`.
17855
+ */
17856
+ noCapableNode: number(),
17857
+ failed: number(),
17858
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
17859
+ complete: boolean().nullable(),
17860
+ startedAtMs: number().nullable(),
17861
+ finishedAtMs: number().nullable(),
17862
+ /** Present when the pass ended by throwing. */
17863
+ error: string().nullable()
17864
+ });
17865
+ var ReplayFrameInputSchema = object({
17866
+ timestamp: number(),
17867
+ frame: PipelineRunResultBridge
17868
+ });
17869
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
17870
+ className: string(),
17871
+ firstSeenMs: number(),
17872
+ lastSeenMs: number(),
17873
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
17874
+ * frame — a representative box for the diff's `(className, window, IoU)`
17875
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
17876
+ * trajectory production's `Track.positions` keeps. */
17877
+ bbox: BoundingBoxSchema,
17878
+ /** How many of the input frames this track matched a real detection on
17879
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
17880
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
17881
+ framesMatched: number().int()
17882
+ })).readonly() });
17883
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17884
+ deviceId: number(),
17885
+ trackId: string()
17886
+ }), TrackSchema.nullable()), method(object({
17887
+ deviceId: number(),
17888
+ since: number().optional(),
17889
+ until: number().optional(),
17890
+ limit: number().optional(),
17891
+ /** Spatial filter — only tracks whose trajectory intersects the zone
17892
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17893
+ * envelope columns, then precisely tested per position. Tracks with
17894
+ * an unknown envelope (no frame dims at persist time) always match. */
17895
+ zone: TrackZoneFilterSchema.optional(),
17896
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
17897
+ * compatible — omitting the field keeps today's exact behaviour). */
17898
+ projection: TrackProjectionSchema.optional(),
17899
+ /** Include stationary-promoted rows (parked objects handed to the
17900
+ * stationary registry). Default false: the timeline lists passages,
17901
+ * not parking records (operator decision, 2026-08-15). */
17902
+ includeStationary: boolean().optional()
17903
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17904
+ deviceId: number(),
17905
+ groupId: string().min(1)
17906
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17907
+ kind: "mutation",
17908
+ auth: "admin"
17909
+ }), 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({
17910
+ deviceId: number(),
17911
+ since: number().optional(),
17912
+ until: number().optional(),
17913
+ kinds: array(string()).optional(),
17914
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17915
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17916
+ deviceId: number(),
17917
+ since: number(),
17918
+ until: number(),
17919
+ bucketMs: number().int().positive()
17920
+ }), array(object({
17921
+ bucketStart: number(),
17922
+ motion: number().int(),
17923
+ object: number().int(),
17924
+ audio: number().int()
17925
+ })).readonly()), method(object({
17926
+ deviceId: number(),
17927
+ cutoffMs: number()
17928
+ }), object({
17929
+ motion: number().int(),
17930
+ object: number().int(),
17931
+ audio: number().int()
17932
+ }), {
17933
+ kind: "mutation",
17934
+ auth: "admin"
17935
+ }), method(object({
17936
+ deviceId: number(),
17937
+ cutoffMs: number()
17938
+ }), TrackCascadeCountsSchema, {
17939
+ kind: "mutation",
17940
+ auth: "admin"
17941
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17942
+ kind: "mutation",
17943
+ auth: "admin"
17944
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17945
+ kind: "mutation",
17946
+ auth: "admin"
17947
+ }), method(object({
17948
+ deviceId: number(),
17949
+ trackIds: array(string()).min(1)
17950
+ }), object({
17951
+ deleted: number().int(),
17952
+ failed: array(string()).readonly()
17953
+ }), {
17954
+ kind: "mutation",
17955
+ auth: "admin"
17956
+ }), method(object({
17957
+ /** Log/audit scope only — the trackId is globally unique on its own. */
17958
+ deviceId: number(),
17959
+ trackId: string(),
17960
+ flags: TrackFlagsPatchSchema
17961
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17962
+ kind: "query",
17963
+ auth: "admin"
17964
+ }), method(object({
17965
+ olderThanMs: number(),
17966
+ reason: OpsLogReasonSchema.optional()
17967
+ }), EventPruneCountsSchema, {
17968
+ kind: "mutation",
17969
+ auth: "admin"
17970
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17971
+ kind: "mutation",
17972
+ auth: "admin"
17973
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17974
+ kind: "mutation",
17975
+ auth: "admin"
17976
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17977
+ kind: "mutation",
17978
+ auth: "admin"
17979
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17980
+ kind: "mutation",
17981
+ auth: "admin"
17982
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17983
+ kind: "mutation",
17984
+ auth: "admin"
17985
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17986
+ kind: "mutation",
17987
+ auth: "admin"
17988
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
17989
+ kind: "mutation",
17990
+ auth: "admin"
17991
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
17992
+ kind: "query",
17993
+ auth: "admin"
17994
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17995
+ kind: "mutation",
17996
+ auth: "admin"
17997
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17998
+ kind: "query",
17999
+ auth: "admin"
18000
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
18001
+ kind: "query",
18002
+ auth: "admin"
18003
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18004
+ kind: "query",
18005
+ auth: "admin"
18006
+ }), method(object({
18007
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
18008
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
18009
+ * route it at one camera's owner, and "every camera" would stop being
18010
+ * expressible at all. */
18011
+ deviceIds: array(number()).optional(),
18012
+ limit: number().int().min(1).max(500).optional()
18013
+ }), array(RetrainTrackSchema).readonly(), {
18014
+ kind: "query",
18015
+ auth: "admin"
18016
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
18017
+ kind: "query",
18018
+ auth: "admin"
18019
+ }), method(object({
18020
+ deviceId: number(),
18021
+ trackId: string(),
18022
+ mediaKeys: array(string()).min(1)
18023
+ }), RetrainFrameSelectionSchema, {
17702
18024
  kind: "mutation",
17703
18025
  auth: "admin"
17704
- }), method(object({ nodeId: string() }), object({
17705
- success: literal(true),
17706
- clearedDevices: number()
18026
+ }), method(object({
18027
+ deviceId: number(),
18028
+ trackId: string(),
18029
+ frameId: string()
18030
+ }), object({
18031
+ removed: boolean(),
18032
+ removedAnnotations: number().int()
17707
18033
  }), {
17708
18034
  kind: "mutation",
17709
18035
  auth: "admin"
17710
- }), 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({
17711
- name: string(),
17712
- steps: array(PipelineTemplateStepSchema).readonly(),
17713
- engine: PipelineEngineChoiceSchema
17714
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17715
- id: string(),
17716
- name: string().optional(),
17717
- steps: array(PipelineTemplateStepSchema).readonly().optional()
17718
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17719
- addonId: string(),
17720
- modelId: string(),
17721
- format: ModelFormatSchema$1
17722
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17723
- addonId: string(),
17724
- modelId: string(),
17725
- format: ModelFormatSchema$1
17726
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17727
- engine: PipelineEngineChoiceSchema.optional(),
17728
- steps: array(PipelineStepInputSchema).min(1),
17729
- frame: FrameInputSchema.optional(),
17730
- /**
17731
- * Process-local lazy frame. Valid only when caller and provider resolve
17732
- * in the same execution-group process; split/cross-node callers use
17733
- * `frame`/`image` inline compatibility instead.
17734
- */
17735
- frameRef: FrameRefSchema.optional(),
17736
- /**
17737
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
17738
- * the decoded pixels live in. One more member of the one-of
17739
- * frame/frameHandle/image/imageBase64/referenceImage group.
17740
- */
17741
- frameHandle: FrameHandleSchema.optional(),
17742
- imageBase64: string().optional(),
17743
- /**
17744
- * Binary JPEG bytes — preferred over `imageBase64` on internal
17745
- * hops (hub → forked worker via Moleculer MsgPack) because it
17746
- * skips the 33% base64 overhead + the per-call base64 decode on
17747
- * the detection-pipeline worker. Callers can pass either; exactly
17748
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17749
- */
17750
- image: _instanceof(Uint8Array).optional(),
17751
- referenceImage: string().optional(),
17752
- deviceId: number().optional(),
17753
- sessionId: string().optional(),
17754
- /**
17755
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
17756
- * reference-image, and detail-subtree calls. 'frame' is the live
17757
- * per-frame dispatch: ONLY root-plane steps run; crop children
17758
- * (inputClasses ≠ null) are skipped and served per-track via
17759
- * pipelineRunner.runDetailSubtree (two-plane design).
17760
- */
17761
- plane: _enum(["full", "frame"]).optional(),
17762
- /**
17763
- * Inference-device selector (Phase 2 multi-device). Format
17764
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17765
- * Omitted ⇒ the runner's default device (current single-engine
17766
- * behaviour). Selects WHICH device pool of the node runs the call.
17767
- */
17768
- deviceKey: string().optional(),
17769
- /**
17770
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17771
- * when the parent crop was resolved from the frame's retained NATIVE
17772
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17773
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17774
- * resolution from that surface — the SAME quality path faces already
17775
- * had — instead of the downscaled parent tile. `handle` keys the native
17776
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17777
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17778
- * the executor's crop-normalized child ROI back into frame-normalized
17779
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17780
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17781
- * (today's behaviour on the fallback path).
17782
- */
17783
- nativeCropRef: NativeCropRefSchema.optional()
17784
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17785
- engine: PipelineEngineChoiceSchema.optional(),
17786
- steps: array(PipelineStepInputSchema).min(1),
17787
- frames: array(FrameInputSchema).min(1).max(255),
17788
- deviceId: number().optional(),
17789
- sessionId: string().optional(),
17790
- /**
17791
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17792
- * the batch to the Python pool's bench preprocess cache
17793
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17794
- * preprocessed ONCE and every later inference is a pure-inference cache
17795
- * hit — the sustained-throughput run measures inference, not
17796
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
17797
- * full preprocess every call, correct). Fresh per sustained run;
17798
- * released via `uncacheFrame`.
17799
- */
17800
- frameId: number().int().nonnegative().optional(),
17801
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17802
- deviceKey: string().optional()
17803
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17804
- data: _instanceof(Uint8Array),
17805
- width: number().int().positive(),
17806
- height: number().int().positive(),
17807
- format: _enum([
17808
- "rgb",
17809
- "bgr",
17810
- "gray"
17811
- ])
17812
- }), object({
17813
- frameId: number(),
17814
- width: number(),
17815
- height: number()
17816
- }), { kind: "mutation" }), method(object({
17817
- stepId: string(),
17818
- frameId: number().int()
17819
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17820
- batchMode: string(),
17821
- windowMs: number(),
17822
- maxBatchSize: number(),
17823
- concurrency: number()
17824
- })), method(_void(), array(object({
17825
- engineKey: string(),
17826
- engine: PipelineEngineChoiceSchema,
17827
- modelsLoaded: array(string()).readonly(),
17828
- inUseByCameras: array(number()).readonly(),
17829
- /**
17830
- * Origin of this resident factory.
17831
- * - `runtime` — main camera-serving engine (no idle TTL).
17832
- * - `warm-override` — benchmark/test override held in the warm
17833
- * cache; auto-disposed after the idle TTL.
17834
- * - `device-pool` — a concurrent per-device pool (Phase 2
17835
- * multi-device, keyed by `deviceKey`) resolved
17836
- * via `resolveDeviceFactory`. Runs alongside the
17837
- * `runtime` engine on a DIFFERENT accelerator
17838
- * (NPU / iGPU / Coral) — this is how the
17839
- * Engines tab shows all pools running at once.
17840
- */
17841
- kind: _enum([
17842
- "runtime",
17843
- "warm-override",
17844
- "device-pool"
17845
- ]),
17846
- /** Native pid of the underlying Python pool (null when no pool). */
17847
- poolPid: number().nullable(),
17848
- /** ms since this factory was last used (null when not warm-tracked). */
17849
- idleMs: number().nullable(),
17850
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17851
- idleTtlMs: number().nullable()
17852
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
18036
+ }), method(object({ frameId: string() }), object({
18037
+ base64: string(),
18038
+ width: number().int(),
18039
+ height: number().int()
18040
+ }), {
18041
+ kind: "query",
18042
+ auth: "admin"
18043
+ }), method(object({
18044
+ deviceId: number(),
18045
+ trackId: string(),
18046
+ frameId: string(),
18047
+ subject: RetrainAssistSubjectSchema,
18048
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18049
+ nodeId: string().optional()
18050
+ }), RetrainAssistResultSchema, {
17853
18051
  kind: "mutation",
17854
18052
  auth: "admin"
17855
18053
  }), method(object({
17856
- engine: PipelineEngineChoiceSchema,
17857
- force: boolean().optional()
17858
- }), object({
17859
- success: boolean(),
17860
- reason: string().optional()
17861
- }), {
18054
+ deviceId: number(),
18055
+ source: DetectionSourceSchema,
18056
+ zones: array(ZoneSchema).readonly().optional(),
18057
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
18058
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
18059
+ frames: array(ReplayFrameInputSchema).min(1)
18060
+ }), RunReplayFrameProcessorResultSchema, {
17862
18061
  kind: "mutation",
17863
18062
  auth: "admin"
17864
- }), 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({
17865
- addonId: string(),
17866
- modelId: string(),
17867
- filename: string().optional(),
17868
- settings: record(string(), unknown()).optional()
17869
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
18063
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
18064
+ kind: "query",
18065
+ auth: "admin"
18066
+ }), method(object({
18067
+ deviceId: number(),
18068
+ trackId: string(),
18069
+ frameId: string(),
18070
+ annotations: array(RetrainAnnotationDraftSchema)
18071
+ }), array(RetrainAnnotationSchema).readonly(), {
18072
+ kind: "mutation",
18073
+ auth: "admin"
18074
+ }), method(object({
18075
+ deviceId: number(),
18076
+ trackId: string()
18077
+ }), RetrainTransitionResultSchema, {
18078
+ kind: "mutation",
18079
+ auth: "admin"
18080
+ }), method(object({
18081
+ deviceId: number(),
18082
+ trackId: string()
18083
+ }), RetrainTransitionResultSchema, {
18084
+ kind: "mutation",
18085
+ auth: "admin"
18086
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18087
+ kind: "query",
18088
+ auth: "admin"
18089
+ }), method(object({
18090
+ eventId: string(),
18091
+ kind: MediaFileKindEnum.optional(),
18092
+ deviceId: number()
18093
+ }), array(MediaFileSchema).readonly()), method(object({
18094
+ trackId: string(),
18095
+ kinds: array(MediaFileKindEnum).optional(),
18096
+ deviceId: number()
18097
+ }), array(MediaFileSchema).readonly()), method(object({
18098
+ trackId: string(),
18099
+ deviceId: number()
18100
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18101
+ kind: "mutation",
18102
+ auth: "admin"
18103
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18104
+ kind: "mutation",
18105
+ auth: "admin"
18106
+ }), method(object({}), RebuildStatusSchema), object({
18107
+ deviceId: number(),
18108
+ timestamp: number(),
18109
+ frameWidth: number(),
18110
+ frameHeight: number(),
18111
+ detections: array(OverlayDetectionSchema).readonly()
18112
+ }), object({
18113
+ deviceId: number(),
18114
+ trackId: string(),
18115
+ className: string()
18116
+ }), object({
18117
+ deviceId: number(),
18118
+ trackId: string(),
18119
+ className: string(),
18120
+ durationMs: number()
18121
+ }), object({
18122
+ deviceId: number(),
18123
+ kind: EventKindSchema,
18124
+ eventId: string(),
18125
+ timestamp: number()
18126
+ });
17870
18127
  object({
17871
18128
  activeCameras: number(),
17872
18129
  throttledCameras: number(),
@@ -17892,66 +18149,6 @@ var CameraMetricsSchema = object({
17892
18149
  });
17893
18150
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
17894
18151
  /**
17895
- * Zone — pure geometry + identity. NO filtering behaviour.
17896
- *
17897
- * Zones describe **where** in the frame the operator wants to flag
17898
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
17899
- * each pipeline stage uses them. Splitting the two means a single
17900
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
17901
- * a detection-include rule on `['car']`, and an occupancy aggregate
17902
- * — without three duplicated polygons.
17903
- *
17904
- * Owned by the orchestrator addon (provider) and mirrored into the
17905
- * `zones` device-state slice on every mutation. Consumers
17906
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
17907
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
17908
- * mirror with `onChanged`).
17909
- *
17910
- * Coordinates are normalised fractions of the frame (0–1) so zones
17911
- * survive resolution changes and stream profile switches.
17912
- *
17913
- * `kind` discriminates between full polygons (closed regions used
17914
- * for intrusion / occupancy filters) and tripwires (open 2-point
17915
- * line segments used for cross events). Onboard / firmware-reported
17916
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17917
- * task list.
17918
- */
17919
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
17920
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17921
- var PolygonPointSchema = object({
17922
- x: number(),
17923
- y: number()
17924
- });
17925
- /** A camera detection zone — pure geometry/identity. */
17926
- var ZoneSchema = object({
17927
- id: string(),
17928
- name: string(),
17929
- kind: ZoneKindEnum.default("polygon"),
17930
- /** Polygon vertices, fraction of frame (0–1). */
17931
- polygon: array(PolygonPointSchema).readonly(),
17932
- /** Visual color for UI rendering. */
17933
- color: string().default("#3b82f6")
17934
- });
17935
- DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
17936
- deviceId: number(),
17937
- zone: ZoneSchema
17938
- }), _void(), {
17939
- kind: "mutation",
17940
- auth: "admin"
17941
- }), method(object({
17942
- deviceId: number(),
17943
- zoneId: string()
17944
- }), _void(), {
17945
- kind: "mutation",
17946
- auth: "admin"
17947
- }), method(object({
17948
- deviceId: number(),
17949
- zone: ZoneSchema
17950
- }), _void(), {
17951
- kind: "mutation",
17952
- auth: "admin"
17953
- }), object({ zones: array(ZoneSchema).readonly() });
17954
- /**
17955
18152
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
17956
18153
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
17957
18154
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -19639,7 +19836,7 @@ method(object({
19639
19836
  * linking rather than produce an eternal token.
19640
19837
  */
19641
19838
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19642
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
19839
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19643
19840
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19644
19841
  providerId: string().min(1),
19645
19842
  displayName: string().min(1),
@@ -19734,10 +19931,13 @@ var EvictResultSchema = object({
19734
19931
  /** True when the provider has nothing left it is willing to drop on this location. */
19735
19932
  exhausted: boolean()
19736
19933
  });
19737
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
19934
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19738
19935
  locationId: string(),
19739
19936
  targetBytes: number().int().positive()
19740
- }), EvictResultSchema, { kind: "mutation" });
19937
+ }), EvictResultSchema, {
19938
+ kind: "mutation",
19939
+ auth: "admin"
19940
+ });
19741
19941
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19742
19942
  kind: "mutation",
19743
19943
  auth: "admin"
@@ -19797,26 +19997,50 @@ var ReadChunkInputSchema = object({
19797
19997
  length: number()
19798
19998
  });
19799
19999
  var EndDownloadInputSchema = object({ downloadId: string() });
19800
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
20000
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19801
20001
  location: StorageLocationSchema,
19802
20002
  relativePath: string()
19803
- }), string()), method(object({
20003
+ }), string(), { auth: "admin" }), method(object({
19804
20004
  location: StorageLocationSchema,
19805
20005
  relativePath: string(),
19806
20006
  data: _instanceof(Uint8Array)
19807
- }), _void(), { kind: "mutation" }), method(object({
20007
+ }), _void(), {
20008
+ kind: "mutation",
20009
+ auth: "admin"
20010
+ }), method(object({
19808
20011
  location: StorageLocationSchema,
19809
20012
  relativePath: string()
19810
- }), _instanceof(Uint8Array)), method(object({
20013
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19811
20014
  location: StorageLocationSchema,
19812
20015
  relativePath: string()
19813
- }), boolean()), method(object({
20016
+ }), boolean(), { auth: "admin" }), method(object({
19814
20017
  location: StorageLocationSchema,
19815
20018
  prefix: string().optional()
19816
- }), array(string()).readonly()), method(object({
20019
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19817
20020
  location: StorageLocationSchema,
19818
20021
  relativePath: string()
19819
- }), _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" });
20022
+ }), _void(), {
20023
+ kind: "mutation",
20024
+ auth: "admin"
20025
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
20026
+ kind: "mutation",
20027
+ auth: "admin"
20028
+ }), method(WriteChunkInputSchema, _void(), {
20029
+ kind: "mutation",
20030
+ auth: "admin"
20031
+ }), method(FinalizeUploadInputSchema, _void(), {
20032
+ kind: "mutation",
20033
+ auth: "admin"
20034
+ }), method(AbortUploadInputSchema, _void(), {
20035
+ kind: "mutation",
20036
+ auth: "admin"
20037
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
20038
+ kind: "mutation",
20039
+ auth: "admin"
20040
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
20041
+ kind: "mutation",
20042
+ auth: "admin"
20043
+ });
19820
20044
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19821
20045
  var ProfileSettingsSchemaBridge = unknown().nullable();
19822
20046
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -20074,7 +20298,8 @@ method(object({
20074
20298
  access: "create"
20075
20299
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
20076
20300
  kind: "mutation",
20077
- access: "view"
20301
+ access: "view",
20302
+ auth: "admin"
20078
20303
  }), method(object({
20079
20304
  /** Required — the user the assertion belongs to (verified). */
20080
20305
  userId: string(),
@@ -20082,10 +20307,12 @@ method(object({
20082
20307
  response: record(string(), unknown())
20083
20308
  }), object({ verified: boolean() }), {
20084
20309
  kind: "mutation",
20085
- access: "view"
20310
+ access: "view",
20311
+ auth: "admin"
20086
20312
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
20087
20313
  kind: "mutation",
20088
- access: "view"
20314
+ access: "view",
20315
+ auth: "admin"
20089
20316
  }), method(object({
20090
20317
  /** AuthenticationResponseJSON from the browser. */
20091
20318
  response: record(string(), unknown()) }), object({
@@ -20093,7 +20320,8 @@ response: record(string(), unknown()) }), object({
20093
20320
  userId: string().nullable()
20094
20321
  }), {
20095
20322
  kind: "mutation",
20096
- access: "view"
20323
+ access: "view",
20324
+ auth: "admin"
20097
20325
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
20098
20326
  userId: string(),
20099
20327
  credentialId: string()
@@ -20265,7 +20493,19 @@ var VectorStatsResultSchema = object({
20265
20493
  /** False when the backend ranks approximately. */
20266
20494
  exact: boolean()
20267
20495
  });
20268
- 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);
20496
+ method(VectorDeclareIndexInputSchema, _void(), {
20497
+ kind: "mutation",
20498
+ auth: "admin"
20499
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20500
+ kind: "mutation",
20501
+ auth: "admin"
20502
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20503
+ kind: "mutation",
20504
+ auth: "admin"
20505
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20506
+ kind: "mutation",
20507
+ auth: "admin"
20508
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20269
20509
  var ClipSchema = object({
20270
20510
  /** Opaque, provider-namespaced id. The default provider encodes the time
20271
20511
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -21988,7 +22228,27 @@ var MediaFileLiteSchema$1 = object({
21988
22228
  sizeBytes: number(),
21989
22229
  timestamp: number()
21990
22230
  });
21991
- method(_void(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22231
+ method(object({
22232
+ /**
22233
+ * Inline {@link IdentitySchema.coverBase64} on every row.
22234
+ *
22235
+ * Default `false`, the same inversion `listRecentFaces` and
22236
+ * `listPlates` took on 2026-08-25 (see `include-crops-default.ts` for
22237
+ * why the burden belongs on the caller that WANTS the bytes). Measured
22238
+ * on the live hub the same day: four identities cost 40,979 B with the
22239
+ * covers inline, ~10 KB of base64 per row, on a query this UI mounts
22240
+ * four times and the viewer holds at `staleTime: 30_000`.
22241
+ *
22242
+ * Nothing loses its avatar: `coverMediaKey` is already on every row and
22243
+ * the `event-media` plane serves that key `immutable` with an ETag.
22244
+ *
22245
+ * **This is an INPUT field, so it does not reach the addon until the
22246
+ * next train** — the hub router validates cap inputs against its own
22247
+ * compiled Zod and strips a key it does not know. Until then the
22248
+ * provider sees `undefined`, which resolves to `false`: the cheap shape
22249
+ * is what ships, and the opt-in becomes reachable when the train lands.
22250
+ */
22251
+ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
21992
22252
  kind: "mutation",
21993
22253
  auth: "admin"
21994
22254
  }), method(object({
@@ -24135,8 +24395,10 @@ var PlateInfoSchema = object({
24135
24395
  keyFrameMediaKey: string().optional(),
24136
24396
  base64: string().optional(),
24137
24397
  /**
24138
- * Same crop as a data-plane URL. `getPlateByTrack` returns this and
24139
- * never inlines JPEG; `listPlates` still inlines for the admin-ui.
24398
+ * Same crop as a data-plane URL, always present when the plate has a stored
24399
+ * crop. `getPlateByTrack` returns this and never inlines JPEG; `listPlates`
24400
+ * and `searchPlates` inline the crop only when their `includeCrops` input is
24401
+ * left at its `true` default.
24140
24402
  */
24141
24403
  cropUrl: string().optional()
24142
24404
  });
@@ -24156,14 +24418,34 @@ var PlateClusterSchema = object({
24156
24418
  });
24157
24419
  method(object({
24158
24420
  deviceId: number().int().optional(),
24159
- limit: number().int().positive().optional()
24421
+ limit: number().int().positive().optional(),
24422
+ /**
24423
+ * Inline the base64 crop on every row. Default `true` — the existing
24424
+ * behaviour, kept so no caller breaks.
24425
+ *
24426
+ * Set `false` once the caller renders {@link PlateInfo.cropUrl}.
24427
+ * Measured on the live hub at the 500 rows the Plates view asks for:
24428
+ * 879,403 B and 27.7 s with the crops inline, against a few KiB of
24429
+ * metadata without them — and the browser then caches the images.
24430
+ *
24431
+ * This is the plate twin of `faceGallery.listRecentFaces`'s option;
24432
+ * plates were the one gallery list left without it.
24433
+ *
24434
+ * **This is an INPUT field, so it does not reach the addon until the
24435
+ * next train.** The hub router validates cap inputs against its own
24436
+ * compiled Zod and strips a key it does not know. Until the train
24437
+ * ships, sending `false` is harmless and keeps the crops inline.
24438
+ */
24439
+ includeCrops: boolean().optional()
24160
24440
  }).optional(), array(PlateInfoSchema).readonly()), method(object({
24161
24441
  deviceId: number().int(),
24162
24442
  trackId: string()
24163
24443
  }), PlateInfoSchema.nullable()), method(object({ plateId: string() }), array(MediaFileLiteSchema).readonly()), method(object({
24164
24444
  text: string().min(1),
24165
24445
  maxDistance: number().int().min(0).optional(),
24166
- limit: number().int().positive().optional()
24446
+ limit: number().int().positive().optional(),
24447
+ /** See `listPlates.includeCrops`. Default `true`. */
24448
+ includeCrops: boolean().optional()
24167
24449
  }), array(PlateInfoSchema).readonly()), method(object({
24168
24450
  maxDistance: number().int().min(0).optional(),
24169
24451
  minClusterSize: number().int().min(2).optional(),
@@ -24177,7 +24459,13 @@ method(object({
24177
24459
  }), method(object({ plateId: string() }), _void(), {
24178
24460
  kind: "mutation",
24179
24461
  auth: "admin"
24180
- }), method(_void(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24462
+ }), method(object({
24463
+ /** Inline {@link VehicleSchema.coverBase64} on every row. Default
24464
+ * `false` — the vehicle twin of `faceGallery.listIdentities`'s
24465
+ * option; `coverMediaKey` + the `event-media` plane carry the picture.
24466
+ * INPUT field: stripped by the hub router until the train ships, which
24467
+ * resolves to `false` and is exactly the intended default. */
24468
+ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24181
24469
  kind: "mutation",
24182
24470
  auth: "admin"
24183
24471
  }), method(object({
@@ -25442,92 +25730,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
25442
25730
  kind: "mutation",
25443
25731
  auth: "admin"
25444
25732
  });
25445
- /**
25446
- * Per-stage gating mode applied to the zones a rule references.
25447
- *
25448
- * - `include`: the rule contributes to a **whitelist** for its stage.
25449
- * When at least one `include` rule fires for a stage, only entities
25450
- * inside one of those zones pass that stage.
25451
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
25452
- * Entities inside one of those zones are dropped at that stage.
25453
- *
25454
- * `monitor`-style observation (count without filtering) is not a rule
25455
- * mode — zones without any matching rule are observed naturally by
25456
- * `zone-analytics` (live snapshot + history), so an "I just want to
25457
- * count, not filter" use case needs no rule at all.
25458
- */
25459
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
25460
- /**
25461
- * Per-consumer rule that references existing zones (geometry) and
25462
- * defines how a specific pipeline stage should treat them. Each
25463
- * consumer addon owns its own `ZoneRule[]` array in its per-device
25464
- * settings:
25465
- *
25466
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
25467
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
25468
- * - future: notification rules, audio gating, etc.
25469
- *
25470
- * One rule applies to N zones (`zoneIds[]`) so the operator can
25471
- * express "ignore motion in ALL of {garden, street}" with a single
25472
- * rule. `classFilter` narrows the rule to specific object classes —
25473
- * "drop person detections in the street, but keep cars" is one
25474
- * `exclude` rule with `classFilter: ['person']`.
25475
- *
25476
- * `enabled` is a soft toggle — the operator can keep the rule
25477
- * configured but inert without deleting it.
25478
- */
25479
- var ZoneRuleSchema = object({
25480
- /** Stable rule id — survives edits, used by the UI for diffing. */
25481
- id: string(),
25482
- /** Optional human-readable label rendered in the rule editor. */
25483
- name: string().optional(),
25484
- /** Zones this rule targets. The rule's `mode` applies to ALL
25485
- * listed zones (OR-set: a detection in any one of them counts).
25486
- * At least one zone id required — a rule with no targets is a
25487
- * configuration mistake and the form validator rejects it. */
25488
- zoneIds: array(string()).min(1).readonly(),
25489
- mode: ZoneRuleModeEnum,
25490
- /**
25491
- * Class names this rule applies to. Empty / undefined ⇒ rule
25492
- * applies to every class. Class strings match the `macroClass`
25493
- * field on detections (e.g. `person`, `car`, `dog`).
25494
- */
25495
- classFilter: array(string()).readonly().optional(),
25496
- /**
25497
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
25498
- * required to consider an entity "in the zone". Defaults to the
25499
- * consumer's stage default when omitted. Kept for back-compat with
25500
- * existing per-rule overrides; new operators pick the value via
25501
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
25502
- * set, the lower-level engine reads it as a 0–1 fraction.
25503
- */
25504
- overlapThreshold: number().min(0).max(1).optional(),
25505
- /**
25506
- * Operator-friendly version of `overlapThreshold` — the percentage
25507
- * of the detection's bbox that must lie inside the zone for the
25508
- * rule to match. Documented default is 85%; the engine substitutes
25509
- * that when the field is omitted (kept optional so existing rules
25510
- * stored without it stay valid).
25511
- *
25512
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
25513
- * rule, the engine prefers `bboxInclusionPct` because it's the
25514
- * field exposed in the UI. Internally both feed the same gate.
25515
- */
25516
- bboxInclusionPct: number().min(0).max(100).optional(),
25517
- /**
25518
- * When `true` and a detection has a segmentation mask, use the
25519
- * mask for overlap instead of the bbox. Detection-stage only;
25520
- * motion rules ignore this field.
25521
- */
25522
- preferMask: boolean().optional(),
25523
- /**
25524
- * Soft-toggle: `false` disables the rule without deleting it.
25525
- * Defaults to `true` so operators creating a rule via the UI
25526
- * see it active immediately.
25527
- */
25528
- enabled: boolean().default(true)
25529
- });
25530
- array(ZoneRuleSchema).readonly();
25531
25733
  object({
25532
25734
  /** Whether the script is currently executing. */
25533
25735
  isRunning: boolean(),
@@ -29554,6 +29756,12 @@ Object.freeze({
29554
29756
  addonId: null,
29555
29757
  access: "create"
29556
29758
  },
29759
+ "pipelineAnalytics.cancelRelocateMedia": {
29760
+ capName: "pipeline-analytics",
29761
+ capScope: "device",
29762
+ addonId: null,
29763
+ access: "create"
29764
+ },
29557
29765
  "pipelineAnalytics.cancelStorageMigrationMove": {
29558
29766
  capName: "pipeline-analytics",
29559
29767
  capScope: "device",
@@ -29728,6 +29936,12 @@ Object.freeze({
29728
29936
  addonId: null,
29729
29937
  access: "view"
29730
29938
  },
29939
+ "pipelineAnalytics.listRelocateMediaJobs": {
29940
+ capName: "pipeline-analytics",
29941
+ capScope: "device",
29942
+ addonId: null,
29943
+ access: "view"
29944
+ },
29731
29945
  "pipelineAnalytics.listRetrainAnnotations": {
29732
29946
  capName: "pipeline-analytics",
29733
29947
  capScope: "device",
@@ -29806,6 +30020,12 @@ Object.freeze({
29806
30020
  addonId: null,
29807
30021
  access: "create"
29808
30022
  },
30023
+ "pipelineAnalytics.relocateMedia": {
30024
+ capName: "pipeline-analytics",
30025
+ capScope: "device",
30026
+ addonId: null,
30027
+ access: "create"
30028
+ },
29809
30029
  "pipelineAnalytics.restageRetrainTrack": {
29810
30030
  capName: "pipeline-analytics",
29811
30031
  capScope: "device",
@@ -29818,6 +30038,12 @@ Object.freeze({
29818
30038
  addonId: null,
29819
30039
  access: "create"
29820
30040
  },
30041
+ "pipelineAnalytics.runReplayFrameProcessor": {
30042
+ capName: "pipeline-analytics",
30043
+ capScope: "device",
30044
+ addonId: null,
30045
+ access: "create"
30046
+ },
29821
30047
  "pipelineAnalytics.saveRetrainAnnotations": {
29822
30048
  capName: "pipeline-analytics",
29823
30049
  capScope: "device",
@@ -29950,6 +30176,12 @@ Object.freeze({
29950
30176
  addonId: null,
29951
30177
  access: "view"
29952
30178
  },
30179
+ "pipelineExecutor.getInferenceDeviceHealth": {
30180
+ capName: "pipeline-executor",
30181
+ capScope: "system",
30182
+ addonId: null,
30183
+ access: "view"
30184
+ },
29953
30185
  "pipelineExecutor.getOrchestratorConfigSchema": {
29954
30186
  capName: "pipeline-executor",
29955
30187
  capScope: "system",
@@ -30022,6 +30254,12 @@ Object.freeze({
30022
30254
  addonId: null,
30023
30255
  access: "view"
30024
30256
  },
30257
+ "pipelineExecutor.rearmInferenceDevice": {
30258
+ capName: "pipeline-executor",
30259
+ capScope: "system",
30260
+ addonId: null,
30261
+ access: "create"
30262
+ },
30025
30263
  "pipelineExecutor.runAudioTest": {
30026
30264
  capName: "pipeline-executor",
30027
30265
  capScope: "system",
@@ -33270,6 +33508,11 @@ Object.freeze({
33270
33508
  form: "single",
33271
33509
  optional: false
33272
33510
  }],
33511
+ "pipelineAnalytics.runReplayFrameProcessor": [{
33512
+ name: "deviceId",
33513
+ form: "single",
33514
+ optional: false
33515
+ }],
33273
33516
  "pipelineAnalytics.saveRetrainAnnotations": [{
33274
33517
  name: "deviceId",
33275
33518
  form: "single",