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