@camstack/addon-decoder-ffmpeg 1.2.27 → 1.2.29

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