@camstack/addon-mqtt-broker 1.2.28 → 1.2.30

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.
@@ -6670,7 +6670,7 @@ function method(input, output, options) {
6670
6670
  input,
6671
6671
  output,
6672
6672
  kind: options?.kind ?? "query",
6673
- auth: options?.auth ?? "protected",
6673
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6674
6674
  ...options?.access !== void 0 ? { access: options.access } : {},
6675
6675
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6676
6676
  timeoutMs: options?.timeoutMs
@@ -6690,7 +6690,7 @@ function systemMethod(input, output, options) {
6690
6690
  }
6691
6691
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
6692
6692
  var VersionOutputSchema$1 = object({ version: string() });
6693
- method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6693
+ method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
6694
6694
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
6695
6695
  DeviceType["Camera"] = "camera";
6696
6696
  DeviceType["Hub"] = "hub";
@@ -7011,7 +7011,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7011
7011
  }({});
7012
7012
  var StaticDirOutputSchema = object({ staticDir: string() });
7013
7013
  var VersionOutputSchema = object({ version: string() });
7014
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
7014
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
7015
7015
  /**
7016
7016
  * device-ops — device-scoped cap that unifies the per-IDevice operations
7017
7017
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7625,24 +7625,6 @@ var RecordingRetentionSchema = object({
7625
7625
  maxSizeGb: number().min(0).optional()
7626
7626
  });
7627
7627
  /**
7628
- * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7629
- * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7630
- * previews at. Five graduated steps; absent on a config = `standard` (the
7631
- * shipped default, matching `sheet-geometry`/`sheet-composer`).
7632
- *
7633
- * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7634
- * Each window's index sidecar carries its own tile dims, so a camera whose
7635
- * preset changed over time renders every historical window at the dims it was
7636
- * written with.
7637
- */
7638
- var ScrubThumbnailPresetSchema = _enum([
7639
- "minimal",
7640
- "low",
7641
- "standard",
7642
- "high",
7643
- "max"
7644
- ]);
7645
- /**
7646
7628
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7647
7629
  *
7648
7630
  * `bands` is the ONLY authored recording intent: what to record, when, and on
@@ -7650,7 +7632,11 @@ var ScrubThumbnailPresetSchema = _enum([
7650
7632
  * other field is a storage knob (profiles, segment length, retention, scrub).
7651
7633
  *
7652
7634
  * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7653
- * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7635
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30,
7636
+ * and `scrubThumbnails` — a five-step fidelity knob for a sprite tier that was
7637
+ * deleted on 2026-07-24 and had ZERO consumers in the recorder — on 2026-08-25
7638
+ * (D62: a switch that writes a store nobody reads is worse than no switch).
7639
+ * Stored rows keep loading: the READ schema is `.strip()` (config-store.ts).
7654
7640
  * A stale caller must fail loudly — silently stripping its legacy intent would
7655
7641
  * persist a band-less config, i.e. silently stop recording the camera.
7656
7642
  */
@@ -7673,14 +7659,7 @@ var RecordingConfigSchema = object({
7673
7659
  * "off" is the absence of a covering band, never a band value.
7674
7660
  */
7675
7661
  bands: array(RecordingBandSchema).default([]),
7676
- retention: RecordingRetentionSchema.optional(),
7677
- /**
7678
- * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7679
- * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7680
- * windows only — existing sheets are immutable, and each window's index
7681
- * carries its own tile dims so mixed-preset history renders correctly.
7682
- */
7683
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7662
+ retention: RecordingRetentionSchema.optional()
7684
7663
  }).strict();
7685
7664
  /**
7686
7665
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
@@ -7756,10 +7735,11 @@ var RelocateFootageInputSchema = object({
7756
7735
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7757
7736
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7758
7737
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7759
- var StorageMigrationMediaMoveInputSchema = object({
7738
+ var RelocateMediaInputSchema = object({
7760
7739
  toLocationId: string(),
7761
7740
  throttleMbps: number().min(1).max(1e3).optional()
7762
- }).extend({ leaseId: string().min(1) });
7741
+ });
7742
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7763
7743
  /** The independently selectable logical storage classes. `recordings`
7764
7744
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7765
7745
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8054,7 +8034,26 @@ var LabelDefinitionSchema = object({
8054
8034
  description: string().optional(),
8055
8035
  icon: string().optional()
8056
8036
  });
8057
- var ClassMapDefinitionSchema = object({
8037
+ /**
8038
+ * Wire schema for a per-model CATALOG classMap override
8039
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8040
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8041
+ * detection pipeline executor actually routes.
8042
+ *
8043
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8044
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8045
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8046
+ * enum) — the two used to share the name `ClassMapDefinition`/
8047
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8048
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8049
+ * are not: it is two different concepts colliding on a name. Keep this type
8050
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8051
+ * would either narrow every `ClassMapDefinition` consumer to the four
8052
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8053
+ * schema exists for (see the "rejects a classMap whose target is not a
8054
+ * detection macro" test in `model-catalog-schema.test.ts`).
8055
+ */
8056
+ var DetectionCatalogClassMapSchema = object({
8058
8057
  mapping: record(string(), _enum([
8059
8058
  "person",
8060
8059
  "vehicle",
@@ -8259,7 +8258,7 @@ var ModelCatalogEntrySchema = object({
8259
8258
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8260
8259
  * labels already ARE the CamStack macros (Scrypted identity map).
8261
8260
  */
8262
- classMap: ClassMapDefinitionSchema.optional()
8261
+ classMap: DetectionCatalogClassMapSchema.optional()
8263
8262
  });
8264
8263
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8265
8264
  format: literal("openvino"),
@@ -8289,7 +8288,7 @@ var ModelConvertMetadataSchema = object({
8289
8288
  "segmentation"
8290
8289
  ]),
8291
8290
  faceAlignment: boolean().optional(),
8292
- classMap: ClassMapDefinitionSchema.optional()
8291
+ classMap: DetectionCatalogClassMapSchema.optional()
8293
8292
  });
8294
8293
  var ConvertResultSchema = object({
8295
8294
  entry: ModelCatalogEntrySchema,
@@ -9152,7 +9151,7 @@ var AddonPageDeclarationSchema = object({
9152
9151
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9153
9152
  sectionLabel: string().optional()
9154
9153
  });
9155
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9154
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9156
9155
  var AddonHttpRouteSchema = object({
9157
9156
  method: _enum([
9158
9157
  "GET",
@@ -9387,7 +9386,7 @@ var WidgetMetadataSchema = object({
9387
9386
  defaultColumns: number().int().min(1).max(12).default(6),
9388
9387
  defaultRows: number().int().min(1).max(12).default(1)
9389
9388
  });
9390
- method(_void(), array(WidgetMetadataSchema).readonly());
9389
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9391
9390
  /**
9392
9391
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9393
9392
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -10958,7 +10957,7 @@ var CustomModelDescriptorSchema = object({
10958
10957
  stepId: string(),
10959
10958
  entry: ModelCatalogEntrySchema
10960
10959
  });
10961
- method(_void(), array(CustomModelDescriptorSchema).readonly());
10960
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
10962
10961
  /**
10963
10962
  * Query filter for settings-store collections.
10964
10963
  */
@@ -11045,7 +11044,8 @@ method(object({
11045
11044
  }), _void(), { kind: "mutation" }), method(object({
11046
11045
  namespace: string().optional(),
11047
11046
  collection: string(),
11048
- filter: QueryFilterSchema.optional()
11047
+ filter: QueryFilterSchema.optional(),
11048
+ columns: array(string()).readonly().optional()
11049
11049
  }), array(SettingsRecordSchema).readonly()), method(object({
11050
11050
  namespace: string().optional(),
11051
11051
  collection: string(),
@@ -11108,46 +11108,87 @@ var EngineInfoSchema = object({
11108
11108
  kind: _enum(["relational", "vector"]),
11109
11109
  displayName: string()
11110
11110
  });
11111
- method(_void(), EngineInfoSchema), method(object({
11111
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11112
11112
  namespace: string().optional(),
11113
11113
  collection: string(),
11114
11114
  key: string()
11115
- }), unknown()), method(object({
11115
+ }), unknown(), { auth: "admin" }), method(object({
11116
11116
  namespace: string().optional(),
11117
11117
  collection: string(),
11118
11118
  key: string(),
11119
11119
  value: unknown()
11120
- }), _void(), { kind: "mutation" }), method(object({
11120
+ }), _void(), {
11121
+ kind: "mutation",
11122
+ auth: "admin"
11123
+ }), method(object({
11121
11124
  namespace: string().optional(),
11122
11125
  collection: string(),
11123
- filter: QueryFilterSchema.optional()
11124
- }), array(SettingsRecordSchema).readonly()), method(object({
11126
+ filter: QueryFilterSchema.optional(),
11127
+ /**
11128
+ * SQL-level column projection — MUST mirror `settings-store.query`.
11129
+ *
11130
+ * ⚠ An earlier version of this comment blamed Zod stripping, and that
11131
+ * was wrong — corrected 2026-08-26 after the hop map
11132
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11133
+ * There is **no Zod parse at all** between the door and the engine: the
11134
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11135
+ * field declared here reaches `SqliteSettingsBackend` either way.
11136
+ *
11137
+ * What actually lost `columns` was the THIRD declaration of this shape:
11138
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11139
+ * interface the engine destructures from. The field existed on both
11140
+ * schemas and the engine still never read it, because nothing checks a
11141
+ * registered provider against `InferProvider<cap>` —
11142
+ * `ProviderRegistration.provider` is typed `object`.
11143
+ *
11144
+ * It is declared here anyway, and must stay in step with
11145
+ * `settings-store.query`: a caller reading only the cap definitions has
11146
+ * to be able to see that this call carries a projection.
11147
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11148
+ */
11149
+ columns: array(string()).readonly().optional()
11150
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11125
11151
  namespace: string().optional(),
11126
11152
  collection: string(),
11127
11153
  record: SettingsRecordSchema
11128
- }), _void(), { kind: "mutation" }), method(object({
11154
+ }), _void(), {
11155
+ kind: "mutation",
11156
+ auth: "admin"
11157
+ }), method(object({
11129
11158
  namespace: string().optional(),
11130
11159
  collection: string(),
11131
11160
  id: string(),
11132
11161
  data: record(string(), unknown())
11133
- }), _void(), { kind: "mutation" }), method(object({
11162
+ }), _void(), {
11163
+ kind: "mutation",
11164
+ auth: "admin"
11165
+ }), method(object({
11134
11166
  namespace: string().optional(),
11135
11167
  collection: string(),
11136
11168
  key: string()
11137
- }), _void(), { kind: "mutation" }), method(object({
11169
+ }), _void(), {
11170
+ kind: "mutation",
11171
+ auth: "admin"
11172
+ }), method(object({
11138
11173
  namespace: string().optional(),
11139
11174
  collection: string(),
11140
11175
  filter: MutationFilterSchema
11141
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11176
+ }), object({ deleted: number().int() }), {
11177
+ kind: "mutation",
11178
+ auth: "admin"
11179
+ }), method(object({
11142
11180
  namespace: string().optional(),
11143
11181
  collection: string(),
11144
11182
  filter: MutationFilterSchema,
11145
11183
  data: record(string(), unknown())
11146
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11184
+ }), object({ updated: number().int() }), {
11185
+ kind: "mutation",
11186
+ auth: "admin"
11187
+ }), method(object({
11147
11188
  namespace: string().optional(),
11148
11189
  collection: string(),
11149
11190
  filter: QueryFilterSchema.optional()
11150
- }), number()), method(object({
11191
+ }), number(), { auth: "admin" }), method(object({
11151
11192
  namespace: string().optional(),
11152
11193
  collection: string(),
11153
11194
  field: string(),
@@ -11157,15 +11198,18 @@ method(_void(), EngineInfoSchema), method(object({
11157
11198
  }), array(object({
11158
11199
  bucket: number().int(),
11159
11200
  count: number().int()
11160
- })).readonly()), method(object({
11201
+ })).readonly(), { auth: "admin" }), method(object({
11161
11202
  namespace: string().optional(),
11162
11203
  collection: string()
11163
- }), boolean()), method(object({
11204
+ }), boolean(), { auth: "admin" }), method(object({
11164
11205
  namespace: string().optional(),
11165
11206
  collection: string(),
11166
11207
  columns: array(CollectionColumnSchema).readonly(),
11167
11208
  indexes: array(CollectionIndexSchema).readonly().optional()
11168
- }), _void(), { kind: "mutation" });
11209
+ }), _void(), {
11210
+ kind: "mutation",
11211
+ auth: "admin"
11212
+ });
11169
11213
  /**
11170
11214
  * shm ring usage stats for a `frameSink: 'shm'` decoder session —
11171
11215
  * exposed via `decoder.getShmStats` so downstream consumers can
@@ -12293,7 +12337,7 @@ method(object({
12293
12337
  crop: _instanceof(Uint8Array),
12294
12338
  width: number(),
12295
12339
  height: number()
12296
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12340
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12297
12341
  /**
12298
12342
  * filesystem-browse — per-node capability for browsing the node's local
12299
12343
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12586,19 +12630,22 @@ method(LlmGenerateBaseInputSchema.extend({
12586
12630
  runtime: ManagedRuntimeConfigSchema,
12587
12631
  /** The managed profile's timeout, threaded by the hub provider. */
12588
12632
  timeoutMs: number().int().positive().optional()
12589
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12633
+ }), LlmGenerateResultSchema, {
12634
+ kind: "mutation",
12635
+ auth: "admin"
12636
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12590
12637
  kind: "mutation",
12591
12638
  auth: "admin"
12592
12639
  }), method(object({}), _void(), {
12593
12640
  kind: "mutation",
12594
12641
  auth: "admin"
12595
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12642
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12596
12643
  kind: "mutation",
12597
12644
  auth: "admin"
12598
12645
  }), method(object({ file: string() }), _void(), {
12599
12646
  kind: "mutation",
12600
12647
  auth: "admin"
12601
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12648
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12602
12649
  /**
12603
12650
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12604
12651
  * methods concat-fan across providers; single-row methods route to ONE
@@ -16090,1748 +16137,1958 @@ var OauthIntegrationDescriptorSchema = object({
16090
16137
  */
16091
16138
  refreshTokenTtlSec: union([number().int().positive(), literal("never")]).optional()
16092
16139
  });
16093
- method(_void(), OauthIntegrationDescriptorSchema);
16140
+ method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
16094
16141
  /**
16095
- * pipeline-analytics — device-scoped wrapper cap. Refines raw
16096
- * per-frame detections emitted by the pipeline runner into tracked
16097
- * objects, per-kind event collections (motion / object / audio), and
16098
- * persisted media. Owns the post-detection domain end-to-end:
16099
- *
16100
- * runner emits PipelineInferenceResult
16101
- * ↓ (event bus)
16102
- * pipeline-analytics subscriber
16103
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16104
- * → three DB collections (one per kind), one FS media tree, one
16105
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16106
- * DetectionEvent on bus)
16107
- *
16108
- * Pure subscriber model. No `processFrame` cap method — the runner
16109
- * already publishes the raw frame on the bus. The cap surface is
16110
- * only QUERIES + per-device settings, bound on/off via
16111
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16112
- * every camera with a detection pipeline wants its raw detections
16113
- * refined; operators opt out per-device via BindingsTab when needed.
16114
- *
16115
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16116
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16142
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16143
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16144
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16117
16145
  */
16118
- var TrackStateSchema = _enum([
16119
- "new",
16120
- "entered",
16121
- "left",
16122
- "moving",
16123
- "idle"
16124
- ]);
16125
- var EventKindSchema = _enum([
16126
- "motion",
16127
- "object",
16128
- "audio"
16129
- ]);
16146
+ var NativeCropRefSchema = object({
16147
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16148
+ handle: FrameHandleSchema,
16149
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16150
+ cropFrameSpace: object({
16151
+ x: number(),
16152
+ y: number(),
16153
+ w: number(),
16154
+ h: number()
16155
+ })
16156
+ });
16157
+ object({
16158
+ crop: object({
16159
+ left: number(),
16160
+ top: number(),
16161
+ width: number().positive(),
16162
+ height: number().positive()
16163
+ }).optional(),
16164
+ content: object({
16165
+ width: number().int().positive(),
16166
+ height: number().int().positive()
16167
+ }),
16168
+ fit: _enum(["stretch", "contain"]),
16169
+ format: _enum([
16170
+ "rgb",
16171
+ "gray",
16172
+ "jpeg"
16173
+ ])
16174
+ });
16130
16175
  /**
16131
- * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16132
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16133
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16176
+ * Process-local frame identity. It is serializable so it can ride an in-process
16177
+ * capability call, but `registryId` deliberately prevents resolution in any
16178
+ * other process or execution group.
16134
16179
  */
16135
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16136
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16137
- var EventKindIconSchema = _enum([
16138
- "motion",
16139
- "audio",
16140
- "person",
16141
- "vehicle",
16142
- "animal",
16143
- "door",
16144
- "pir",
16145
- "smoke",
16146
- "water",
16147
- "button",
16148
- "package",
16149
- "generic"
16180
+ var FrameRefSchema = object({
16181
+ registryId: string().min(1),
16182
+ id: string().min(1),
16183
+ width: number().int().positive(),
16184
+ height: number().int().positive(),
16185
+ format: _enum(["rgb", "gray"]),
16186
+ timestamp: number(),
16187
+ capturedAt: number().optional()
16188
+ });
16189
+ var ModelFormatSchema$1 = _enum([
16190
+ "onnx",
16191
+ "coreml",
16192
+ "openvino",
16193
+ "tflite",
16194
+ "pt",
16195
+ "gguf"
16150
16196
  ]);
16151
- var EventKindCategorySchema = _enum([
16152
- "motion",
16153
- "audio",
16154
- "detection",
16155
- "sensor",
16156
- "control",
16157
- "custom",
16158
- "package"
16197
+ var PipelineSlotSchema = _enum([
16198
+ "detector",
16199
+ "cropper",
16200
+ "classifier",
16201
+ "refiner",
16202
+ "audio-classifier"
16159
16203
  ]);
16160
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16161
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16162
- var EventKindDescriptorSchema = object({
16163
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16164
- kind: string(),
16165
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16166
- labelKey: string(),
16167
- /** English fallback label (kept for clients that don't translate). */
16168
- label: string(),
16169
- /** Hex color for timeline/legend rendering. */
16170
- color: string(),
16171
- /** Dictionary id → lucide component on the UI side. */
16172
- iconId: string(),
16173
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16174
- icon: EventKindIconSchema,
16175
- category: EventKindCategorySchema,
16176
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16177
- parentKind: string().nullable(),
16178
- /** Derived from `parentKind`, explicit for the client tree. */
16179
- level: EventKindLevelSchema,
16180
- /** Which cap + device contributes this kind. For built-ins the camera
16181
- * itself; for sensor kinds the LINKED source device. */
16182
- source: object({
16183
- capName: string(),
16184
- deviceId: number()
16185
- })
16204
+ var PipelineEngineChoiceSchema = object({
16205
+ runtime: _enum(["node", "python"]),
16206
+ backend: string(),
16207
+ format: ModelFormatSchema$1,
16208
+ device: string().optional()
16186
16209
  });
16187
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16188
- var EventKindsForDeviceSchema = object({
16189
- deviceId: number(),
16190
- kinds: array(EventKindDescriptorSchema).readonly()
16210
+ var AvailableEngineSchema = object({
16211
+ engine: PipelineEngineChoiceSchema,
16212
+ devices: array(object({
16213
+ id: string(),
16214
+ label: string(),
16215
+ description: string().optional()
16216
+ })).readonly(),
16217
+ defaultDevice: string()
16191
16218
  });
16192
- var SensorEventSchema = object({
16219
+ var PipelineDefaultStepSchema = lazy(() => object({
16220
+ addonId: string(),
16221
+ addonName: string(),
16222
+ slot: PipelineSlotSchema,
16223
+ inputClasses: array(string()).readonly(),
16224
+ outputClasses: array(string()).readonly(),
16225
+ enabled: boolean(),
16226
+ modelId: string(),
16227
+ children: array(PipelineDefaultStepSchema).readonly(),
16228
+ group: string().optional(),
16229
+ settings: record(string(), unknown()).optional()
16230
+ }));
16231
+ var PipelineTemplateStepSchema = lazy(() => object({
16232
+ addonId: string(),
16233
+ enabled: boolean(),
16234
+ modelId: string(),
16235
+ children: array(PipelineTemplateStepSchema).readonly(),
16236
+ settings: record(string(), unknown()).optional()
16237
+ }));
16238
+ var PipelineTemplateSchema$1 = object({
16193
16239
  id: string(),
16194
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16195
- * yields N rows, one per camera). */
16196
- deviceId: number(),
16197
- /** The linked sensor device whose state changed. */
16198
- sourceDeviceId: number(),
16199
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16200
- kind: string(),
16201
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16202
- value: record(string(), unknown()).nullable(),
16203
- timestamp: number()
16240
+ name: string(),
16241
+ createdAt: string(),
16242
+ updatedAt: string(),
16243
+ engine: PipelineEngineChoiceSchema,
16244
+ steps: array(PipelineTemplateStepSchema).readonly()
16204
16245
  });
16205
- var TrackPositionSchema = object({
16206
- x: number(),
16207
- y: number(),
16208
- timestamp: number(),
16209
- bbox: BoundingBoxSchema
16210
- });
16211
- var TrackSnapshotSchema = object({
16212
- timestamp: number(),
16213
- position: TrackPositionSchema,
16214
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16215
- mediaKey: string()
16246
+ var PipelineModelOptionSchema = object({
16247
+ id: string(),
16248
+ name: string(),
16249
+ formats: record(string(), object({
16250
+ downloaded: boolean(),
16251
+ sizeMB: number()
16252
+ })),
16253
+ group: ModelVariantGroupSchema.optional(),
16254
+ legacy: boolean().optional(),
16255
+ provider: ModelProviderIdSchema.optional()
16216
16256
  });
16217
- /**
16218
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16219
- * divided by the track's detection-frame dims), computed at persist time.
16220
- * Absent when the frame dims were unknown when the track was persisted
16221
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16222
- */
16223
- var TrackEnvelopeSchema = object({
16224
- minX: number(),
16225
- minY: number(),
16226
- maxX: number(),
16227
- maxY: number()
16257
+ var ConfigFieldBridge = custom();
16258
+ var PipelineAddonSchemaSchema = object({
16259
+ id: string(),
16260
+ name: string(),
16261
+ slot: PipelineSlotSchema,
16262
+ inputClasses: array(string()).readonly(),
16263
+ outputClasses: array(string()).readonly(),
16264
+ childSlots: array(PipelineSlotSchema).readonly(),
16265
+ models: array(PipelineModelOptionSchema).readonly(),
16266
+ defaultModelId: string(),
16267
+ defaultModelIdByFormat: record(string(), string()).optional(),
16268
+ enabledByDefault: boolean().optional(),
16269
+ backfillIntoExistingOverrides: boolean().optional(),
16270
+ defaultConfidence: number(),
16271
+ group: string().optional(),
16272
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16228
16273
  });
16229
- /**
16230
- * Row projection for track list queries. `full` (default) returns the
16231
- * complete Track including the frame-rate `positions[]` history and the
16232
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16233
- * keeps every scalar the list surfaces actually render (ids, class(es),
16234
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16235
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16236
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16237
- * `getTrack`. Mirrors the event-store `projection` convention
16238
- * (`getObjectEvents` et al.).
16239
- */
16240
- var TrackProjectionSchema = _enum(["full", "slim"]);
16241
- /**
16242
- * One audio-classification label heard on the track's camera while the
16243
- * track was alive, aggregated per label. An "episode" is one persisted
16244
- * audio event (the confident-classification path: score ≥ the device's
16245
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16246
- * one 32 ms inference chunk, so counts stay human-scaled.
16247
- */
16248
- var TrackAudioLabelSchema = object({
16274
+ var PipelineSlotSchemaSchema = object({
16275
+ id: PipelineSlotSchema,
16249
16276
  label: string(),
16250
- /** Highest classification score observed across the label's episodes. */
16251
- peakScore: number(),
16252
- /** Number of coalesced audio-event episodes carrying this label. */
16253
- count: number(),
16254
- firstAt: number(),
16255
- lastAt: number()
16277
+ priority: number(),
16278
+ parentSlot: PipelineSlotSchema.nullable(),
16279
+ addons: array(PipelineAddonSchemaSchema).readonly()
16256
16280
  });
16257
- /**
16258
- * How a track was produced. `pipeline` (default / absent) = the spatial
16259
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16260
- * no positions, a single snapshot, and no bbox trajectory at all:
16261
- *
16262
- * - `sensor` — a linked sensor/control device state change.
16263
- * - `audio` — an audio event on the camera itself that was anomalous for
16264
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16265
- *
16266
- * The spatial subsystems (tracker association, occupancy count, re-id /
16267
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16268
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16269
- * check silently readmits every source added after it was written.
16270
- */
16271
- var TrackSourceSchema = _enum([
16272
- "pipeline",
16273
- "sensor",
16274
- "audio"
16275
- ]);
16276
- /**
16277
- * Where a track sits in the RETRAIN lifecycle (D81).
16278
- *
16279
- * - `none` — never marked, or un-marked. Evictable.
16280
- * - `staging` — the operator wants this track as training material and has not
16281
- * finished with it. **This is the only state retention holds**: the track and
16282
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16283
- * the device's age window.
16284
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16285
- * were COPIED into the retrain dataset at selection time, so the dataset no
16286
- * longer depends on the track's media and the track becomes EVICTABLE again.
16287
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16288
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16289
- *
16290
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16291
- * the store's filter language has only positive equality and `whereIn` — no
16292
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16293
- * would make the entire pre-column history immortal in one deploy.
16294
- */
16295
- var RetrainStatusSchema = _enum([
16296
- "none",
16297
- "staging",
16298
- "trained"
16299
- ]);
16300
- /**
16301
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16302
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16303
- * so the two surfaces cannot drift.
16304
- *
16305
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16306
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16307
- * columns existed read as absent, and a consumer that needs a boolean should say
16308
- * `flag === true`, not `flag !== false`.
16309
- *
16310
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16311
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16312
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16313
- * `trained` track reports `false` while refusing both writes. The boolean is
16314
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16315
- * "never marked" from "already trained" must read `retrainStatus`.
16316
- *
16317
- * `debug` does NOT pin; it is attention, not durability.
16318
- *
16319
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16320
- * A favourited track is skipped by retention the same way `staging` is, but
16321
- * it does not enter `none|staging|trained` and has no staging budget.
16322
- */
16323
- var TrackFlagFields = {
16324
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16325
- * `'staging'`. */
16326
- markForTrain: boolean().optional(),
16327
- /** Operator marked this track for diagnostic attention. */
16328
- debug: boolean().optional(),
16329
- /** Operator favourited this track. Pins it against pruning. */
16330
- favourited: boolean().optional()
16331
- };
16332
- /**
16333
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16334
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16335
- * write patch, and the status is not something the toggle sets — it is what the
16336
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16337
- * always present on a persisted row (the column default materialises `'none'`).
16338
- */
16339
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16340
- /**
16341
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16342
- * one flag can never clear the other — the toggles are independent and are
16343
- * driven from three surfaces that do not know about each other.
16344
- */
16345
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16346
- /**
16347
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16348
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16349
- * mutation result without a re-fetch.
16350
- */
16351
- var TrackFlagsSchema = object({
16352
- trackId: string(),
16353
- markForTrain: boolean(),
16354
- debug: boolean(),
16355
- favourited: boolean(),
16356
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16357
- * a track row) because this shape is only ever produced by the write body,
16358
- * which always knows it — and a surface that has just written needs to render
16359
- * `trained` without a re-fetch. */
16360
- retrainStatus: RetrainStatusSchema
16281
+ var PipelineSchemaSchema = object({
16282
+ availableEngines: array(AvailableEngineSchema).readonly(),
16283
+ selectedEngine: PipelineEngineChoiceSchema,
16284
+ slots: array(PipelineSlotSchemaSchema).readonly()
16361
16285
  });
16362
- union([literal(1), literal(2)]);
16363
- /**
16364
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16365
- * the step and model that produced it — which is what makes the write rule
16366
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16367
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16368
- *
16369
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16370
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16371
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16372
- * that value has no provenance, and the write rule lets ANY properly-attributed
16373
- * write of the same tier replace it regardless of score.
16374
- */
16375
- var LabelAttributionSchema = object({
16376
- stepId: string(),
16377
- modelId: string().optional(),
16378
- decidedAt: number(),
16286
+ var EngineProvisioningSchema = object({
16287
+ runtimeId: _enum([
16288
+ "onnx",
16289
+ "openvino",
16290
+ "coreml",
16291
+ "edgetpu"
16292
+ ]).nullable(),
16293
+ device: string().nullable(),
16294
+ state: _enum([
16295
+ "idle",
16296
+ "installing",
16297
+ "verifying",
16298
+ "ready",
16299
+ "failed"
16300
+ ]),
16301
+ progress: number().optional(),
16302
+ error: string().optional(),
16303
+ nextRetryAt: number().optional(),
16379
16304
  /**
16380
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16381
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16382
- *
16383
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16384
- * notification rule authored on "Gianluca" stopped matching the moment the
16385
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16386
- * the thing that does not move, so it is what a rule matches on
16387
- * (`NcConditions.identities`) and the text is what a human is shown.
16388
- *
16389
- * Absent when the label names no gallery row — a plate the OCR read but no
16390
- * vehicle claims, a sub-class, a species, any tier-1 value.
16305
+ * Gate A (config-correctness gate at engine change): human-readable
16306
+ * config issues surfaced EAGERLY when the node's engine changes — model
16307
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16308
+ * has a <format> build"). Additive/optional: informational only, never
16309
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
16310
+ * Absent/empty when the node-default tree resolves cleanly.
16391
16311
  */
16392
- identityId: string().optional()
16312
+ configIssues: array(string()).optional()
16393
16313
  });
16394
- /**
16395
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16396
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16397
- * track and its events always answer the same question the same way.
16398
- *
16399
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16400
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16401
- * is tier 2, and each carries its own score + attribution.
16402
- *
16403
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16404
- * finest thing known. Before 4g the single `label` column held the finest
16405
- * value, so a consumer that has not been updated reads the tier-1 slot and
16406
- * shows nothing on a species-only row; that is why the migration puts every
16407
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16408
- * and why the read surfaces were changed in the same train.
16409
- *
16410
- * **Writing it.** The slots are independent, which is the whole point: a
16411
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16412
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16413
- * higher score wins. One rule, one implementation — see
16414
- * `pipeline/label-tier.ts` in addon-post-analysis.
16415
- */
16416
- var TieredLabelFields = {
16417
- /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
16418
- label: string().optional(),
16419
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16420
- labelScore: number().optional(),
16421
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16422
- labelMeta: LabelAttributionSchema.optional(),
16423
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16424
- subLabel: string().optional(),
16425
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16426
- subLabelScore: number().optional(),
16427
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16428
- subLabelMeta: LabelAttributionSchema.optional()
16429
- };
16430
- /** Per-camera slice of a training-export estimate. */
16431
- var TrainingExportDeviceTotalsSchema = object({
16432
- deviceId: number(),
16433
- tracks: number().int(),
16434
- files: number().int(),
16435
- bytes: number().int()
16314
+ var PipelineStepInputSchema = lazy(() => object({
16315
+ addonId: string(),
16316
+ modelId: string().optional(),
16317
+ enabled: boolean().default(true),
16318
+ children: array(PipelineStepInputSchema).optional(),
16319
+ settings: record(string(), unknown()).optional(),
16320
+ jumpDeviceKey: string().optional()
16321
+ }));
16322
+ var ModelSubstitutionSchema = object({
16323
+ addonId: string(),
16324
+ chosen: string(),
16325
+ running: string(),
16326
+ format: string()
16327
+ });
16328
+ var PipelineValidationIssueSchema = object({
16329
+ addonId: string(),
16330
+ kind: _enum(["unknown-addon", "no-format-build"]),
16331
+ detail: string()
16332
+ });
16333
+ var PipelineValidationResultSchema = object({
16334
+ ok: boolean(),
16335
+ issues: array(PipelineValidationIssueSchema).readonly(),
16336
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16337
+ /** The node's `currentEngine.format` this validation ran against. */
16338
+ format: string()
16339
+ });
16340
+ var ReferenceImageEntrySchema = object({
16341
+ filename: string(),
16342
+ stepIds: array(string()).readonly().optional()
16343
+ });
16344
+ var ReferenceImageBodySchema = object({
16345
+ base64: string(),
16346
+ filename: string()
16347
+ });
16348
+ var ReferenceAudioEntrySchema = object({
16349
+ filename: string(),
16350
+ sizeKb: number()
16351
+ });
16352
+ var ReferenceAudioBodySchema = object({ base64: string() });
16353
+ var AudioBackendSchema = object({
16354
+ id: string(),
16355
+ name: string(),
16356
+ description: string(),
16357
+ available: boolean(),
16358
+ /**
16359
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16360
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16361
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16362
+ * specific to the selected backend without a separate fetch.
16363
+ */
16364
+ rawLabels: array(string()).readonly().optional()
16365
+ });
16366
+ var AudioCapabilitiesSchema = object({
16367
+ activeBackend: string(),
16368
+ availableBackends: array(AudioBackendSchema).readonly(),
16369
+ sampleRate: number(),
16370
+ chunkDurationMs: number()
16371
+ });
16372
+ var DownloadModelResultSchema = object({
16373
+ filePath: string(),
16374
+ sizeMB: number(),
16375
+ durationMs: number()
16436
16376
  });
16437
16377
  /**
16438
- * What a training export WOULD contain. Computed from media index rows only —
16439
- * no blob is read to produce this.
16378
+ * Wrapper carrying a single test run's result. Replaces the legacy
16379
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16380
+ * canonical `AudioResult` from the Phase 6 output rework: one
16381
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16382
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16383
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16384
+ * benchmark UI can still report a clean failure when the classifier
16385
+ * cap isn't available.
16440
16386
  */
16441
- var TrainingExportSummarySchema = object({
16442
- generatedAt: number(),
16443
- trackCount: number().int(),
16444
- fileCount: number().int(),
16445
- byteCount: number().int(),
16446
- /** More marked tracks exist than a single pass carries. */
16447
- truncated: boolean(),
16448
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16387
+ var AudioTestResultSchema = object({
16388
+ success: boolean(),
16389
+ error: string().optional(),
16390
+ frame: custom().optional()
16449
16391
  });
16450
- var TrackSchema = object({
16451
- trackId: string(),
16452
- deviceId: number(),
16453
- className: string(),
16454
- ...TieredLabelFields,
16455
- producingDeviceName: string().optional(),
16456
- /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16457
- source: TrackSourceSchema.optional(),
16458
- firstSeen: number(),
16459
- lastSeen: number(),
16460
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16461
- positions: array(TrackPositionSchema).readonly(),
16462
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16463
- * saveThumbnails policy). */
16464
- snapshots: array(TrackSnapshotSchema).readonly(),
16465
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16466
- zonesVisited: array(string()).readonly(),
16392
+ var PipelineConfigBridge = custom();
16393
+ var ConfigUISchemaBridge = custom();
16394
+ var ConfigUISchemaNullableBridge = custom();
16395
+ var InferenceCapabilitiesBridge = custom();
16396
+ var ModelAvailabilityListBridge = custom();
16397
+ var PipelineRunResultBridge = custom();
16398
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16399
+ modelId: string(),
16400
+ settings: record(string(), unknown()).readonly()
16401
+ }))), method(object({ steps: record(string(), object({
16402
+ modelId: string(),
16403
+ settings: record(string(), unknown()).readonly()
16404
+ })) }), object({ success: literal(true) }), {
16405
+ kind: "mutation",
16406
+ auth: "admin"
16407
+ }), method(object({ nodeId: string() }), object({
16408
+ success: literal(true),
16409
+ clearedDevices: number()
16410
+ }), {
16411
+ kind: "mutation",
16412
+ auth: "admin"
16413
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16414
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16415
+ deviceKey: string(),
16467
16416
  /**
16468
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16469
- * `zones` capability.
16470
- *
16471
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16472
- * and no card can render — so every free-text search surface was structurally
16473
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16474
- * just returned nothing. Resolving here rather than in each client keeps ONE
16475
- * derivation and costs the clients no extra call (the `zones` cap is
16476
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16477
- * surface built to avoid exactly that).
16478
- *
16479
- * Resolved, never invented: a zone deleted since the track was written has no
16480
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16481
- * two are not positionally aligned. Absent when the track visited no zone, or
16482
- * when the zone catalogue could not be read.
16417
+ * `failed` — the per-device restart budget is exhausted; no pool
16418
+ * will be spawned until an operator re-arms it or the runner
16419
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16420
+ * a cached pool observed dead and not yet condemned).
16483
16421
  */
16484
- zoneNames: array(string()).readonly().optional(),
16485
- /** Deduplicated set of detector classes observed for this track over its
16486
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16487
- * legacy rows written before class accumulation shipped. */
16488
- classes: array(string()).readonly().optional(),
16489
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16490
- totalDistance: number(),
16491
- state: TrackStateSchema,
16492
- active: boolean(),
16493
- /** Deterministic key-event importance score in [0,1] (server-computed at
16494
- * track expiry, recomputed on late label). Absent on legacy rows written
16495
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16496
- importance: number().optional(),
16497
- /** Id of the track's highest-confidence ObjectEvent (its representative
16498
- * "best" frame). Absent when the track produced no object events. */
16499
- bestEventId: string().optional(),
16500
- /** Tag of the importance sub-signal that dominated the score
16501
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16502
- importanceReason: string().optional(),
16503
- /** Audio-classification labels heard on the camera during the track's
16504
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16505
- * Absent on legacy rows / tracks with no confident audio. */
16506
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16507
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16508
- * Populated from the persisted envelope columns on historical reads;
16509
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16510
- envelope: TrackEnvelopeSchema.optional(),
16422
+ state: _enum(["failed", "backoff"]),
16423
+ /** Epoch ms of the death that produced this state. */
16424
+ since: number(),
16425
+ /** Pool deaths inside the current window. */
16426
+ deaths: number(),
16427
+ /** The last death's message. */
16428
+ lastError: string()
16429
+ })).readonly() })), method(object({
16430
+ nodeId: string(),
16431
+ deviceKey: string()
16432
+ }), object({ rearmed: boolean() }), {
16433
+ kind: "mutation",
16434
+ auth: "admin"
16435
+ }), 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({
16436
+ name: string(),
16437
+ steps: array(PipelineTemplateStepSchema).readonly(),
16438
+ engine: PipelineEngineChoiceSchema
16439
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16440
+ id: string(),
16441
+ name: string().optional(),
16442
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16443
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16444
+ addonId: string(),
16445
+ modelId: string(),
16446
+ format: ModelFormatSchema$1
16447
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16448
+ addonId: string(),
16449
+ modelId: string(),
16450
+ format: ModelFormatSchema$1
16451
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16452
+ engine: PipelineEngineChoiceSchema.optional(),
16453
+ steps: array(PipelineStepInputSchema).min(1),
16454
+ frame: FrameInputSchema.optional(),
16511
16455
  /**
16512
- * A face DETECTOR found a face on this track — nothing more. It says the
16513
- * detail plane produced a `face` detail; it does NOT say the face was
16514
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16515
- * enabled. Set once and never cleared.
16516
- *
16517
- * **This exists so "face present but not recognised" is expressible.** A
16518
- * recognised identity lands in `subLabel` (attributed to the face chain via
16519
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16520
- * and a track with no face at all were byte-identical on the wire and no
16521
- * surface could tell them apart. The read is `hasFace === true && subLabel
16522
- * === undefined`.
16523
- *
16524
- * **Absent ≠ false.** Every row written before the column existed omits it,
16525
- * and so does every server that predates the field — a consumer must test
16526
- * `=== true` and render nothing otherwise, never infer "no face".
16456
+ * Process-local lazy frame. Valid only when caller and provider resolve
16457
+ * in the same execution-group process; split/cross-node callers use
16458
+ * `frame`/`image` inline compatibility instead.
16527
16459
  */
16528
- hasFace: boolean().optional(),
16460
+ frameRef: FrameRefSchema.optional(),
16529
16461
  /**
16530
- * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
16531
- * face an operator could ASSIGN to an identity.
16532
- *
16533
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16534
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16535
- * branch, before every gate, and means no more than "a face detector produced
16536
- * a face detail". This one is stamped at the single moment the gallery row
16537
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16538
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16539
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16540
- * the crop-store drop. Everything between the detector and that insert can
16541
- * legitimately refuse the face, so a flag written any earlier promises the
16542
- * operator something to assign and delivers nothing.
16543
- *
16544
- * **Independent of recognition.** A face collected but never auto-matched is
16545
- * still assignable — it is in fact the face an operator most wants to reach —
16546
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16547
- * `subLabel`; this says only that the raw material exists.
16548
- *
16549
- * **Set once, never cleared.** A track that produced a gallery row produced
16550
- * one; deleting the row later is the gallery's business, not this flag's.
16551
- *
16552
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16553
- * before the column omits it, and so does every server that predates the
16554
- * field. A consumer must test `=== true` and render nothing otherwise —
16555
- * never infer "no assignable face".
16462
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
16463
+ * the decoded pixels live in. One more member of the one-of
16464
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16556
16465
  */
16557
- hasEmbeddedFace: boolean().optional(),
16466
+ frameHandle: FrameHandleSchema.optional(),
16467
+ imageBase64: string().optional(),
16558
16468
  /**
16559
- * This subject CONTAINS a folded rider — a person the rider-pairing step
16560
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16561
- * so the passage is tracked once and as a VEHICLE.
16562
- *
16563
- * It exists because the fold's record was dishonest. D34 and the code both
16564
- * said "the person is not lost — it is reported so both entities stay on the
16565
- * record"; in fact the pair went into a per-processor RAM field behind an
16566
- * accessor nobody called, and every durable surface said `vehicle`, full
16567
- * stop. This is the composition note that makes the row true.
16568
- *
16569
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16570
- * person" is not an answer to "what is this" — both label tiers would refuse
16571
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16572
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16573
- * and a `person` rule still does not fire for someone cycling past.
16574
- *
16575
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16576
- * the column, and every hub that predates the field, omits it. Test
16577
- * `=== true` and render nothing otherwise — never infer "no rider".
16469
+ * Binary JPEG bytes — preferred over `imageBase64` on internal
16470
+ * hops (hub → forked worker via Moleculer MsgPack) because it
16471
+ * skips the 33% base64 overhead + the per-call base64 decode on
16472
+ * the detection-pipeline worker. Callers can pass either; exactly
16473
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16578
16474
  */
16579
- hasRider: boolean().optional(),
16580
- ...TrackFlagFields,
16581
- ...TrackRetrainFields
16582
- });
16583
- var BaseEventFields = {
16584
- id: string(),
16585
- deviceId: number(),
16586
- timestamp: number()
16587
- };
16588
- var MotionEventSchema = object({
16589
- ...BaseEventFields,
16590
- kind: literal("motion"),
16591
- regionCount: number(),
16592
- /** Heavy JSON array — omitted in slim projection. */
16593
- regions: array(object({
16594
- bbox: BoundingBoxSchema,
16595
- pixelCount: number(),
16596
- intensity: number()
16597
- })).readonly().optional(),
16598
- /** Omitted in slim projection. */
16599
- frameWidth: number().optional(),
16600
- /** Omitted in slim projection. */
16601
- frameHeight: number().optional(),
16602
- /** Populated by B5 (recording playback URL for this event). */
16603
- mediaUrl: string().optional()
16604
- });
16475
+ image: _instanceof(Uint8Array).optional(),
16476
+ referenceImage: string().optional(),
16477
+ deviceId: number().optional(),
16478
+ sessionId: string().optional(),
16479
+ /**
16480
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16481
+ * reference-image, and detail-subtree calls. 'frame' is the live
16482
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16483
+ * (inputClasses ≠ null) are skipped and served per-track via
16484
+ * pipelineRunner.runDetailSubtree (two-plane design).
16485
+ */
16486
+ plane: _enum(["full", "frame"]).optional(),
16487
+ /**
16488
+ * Inference-device selector (Phase 2 multi-device). Format
16489
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16490
+ * Omitted ⇒ the runner's default device (current single-engine
16491
+ * behaviour). Selects WHICH device pool of the node runs the call.
16492
+ */
16493
+ deviceKey: string().optional(),
16494
+ /**
16495
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16496
+ * when the parent crop was resolved from the frame's retained NATIVE
16497
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16498
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16499
+ * resolution from that surface — the SAME quality path faces already
16500
+ * had — instead of the downscaled parent tile. `handle` keys the native
16501
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16502
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16503
+ * the executor's crop-normalized child ROI back into frame-normalized
16504
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16505
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16506
+ * (today's behaviour on the fallback path).
16507
+ */
16508
+ nativeCropRef: NativeCropRefSchema.optional()
16509
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16510
+ engine: PipelineEngineChoiceSchema.optional(),
16511
+ steps: array(PipelineStepInputSchema).min(1),
16512
+ frames: array(FrameInputSchema).min(1).max(255),
16513
+ deviceId: number().optional(),
16514
+ sessionId: string().optional(),
16515
+ /**
16516
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16517
+ * the batch to the Python pool's bench preprocess cache
16518
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16519
+ * preprocessed ONCE and every later inference is a pure-inference cache
16520
+ * hit — the sustained-throughput run measures inference, not
16521
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16522
+ * full preprocess every call, correct). Fresh per sustained run;
16523
+ * released via `uncacheFrame`.
16524
+ */
16525
+ frameId: number().int().nonnegative().optional(),
16526
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16527
+ deviceKey: string().optional()
16528
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16529
+ data: _instanceof(Uint8Array),
16530
+ width: number().int().positive(),
16531
+ height: number().int().positive(),
16532
+ format: _enum([
16533
+ "rgb",
16534
+ "bgr",
16535
+ "gray"
16536
+ ])
16537
+ }), object({
16538
+ frameId: number(),
16539
+ width: number(),
16540
+ height: number()
16541
+ }), { kind: "mutation" }), method(object({
16542
+ stepId: string(),
16543
+ frameId: number().int()
16544
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16545
+ batchMode: string(),
16546
+ windowMs: number(),
16547
+ maxBatchSize: number(),
16548
+ concurrency: number()
16549
+ })), method(_void(), array(object({
16550
+ engineKey: string(),
16551
+ engine: PipelineEngineChoiceSchema,
16552
+ modelsLoaded: array(string()).readonly(),
16553
+ inUseByCameras: array(number()).readonly(),
16554
+ /**
16555
+ * Origin of this resident factory.
16556
+ * - `runtime` — main camera-serving engine (no idle TTL).
16557
+ * - `warm-override` — benchmark/test override held in the warm
16558
+ * cache; auto-disposed after the idle TTL.
16559
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16560
+ * multi-device, keyed by `deviceKey`) resolved
16561
+ * via `resolveDeviceFactory`. Runs alongside the
16562
+ * `runtime` engine on a DIFFERENT accelerator
16563
+ * (NPU / iGPU / Coral) — this is how the
16564
+ * Engines tab shows all pools running at once.
16565
+ */
16566
+ kind: _enum([
16567
+ "runtime",
16568
+ "warm-override",
16569
+ "device-pool"
16570
+ ]),
16571
+ /** Native pid of the underlying Python pool (null when no pool). */
16572
+ poolPid: number().nullable(),
16573
+ /** ms since this factory was last used (null when not warm-tracked). */
16574
+ idleMs: number().nullable(),
16575
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16576
+ idleTtlMs: number().nullable()
16577
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16578
+ kind: "mutation",
16579
+ auth: "admin"
16580
+ }), method(object({
16581
+ engine: PipelineEngineChoiceSchema,
16582
+ force: boolean().optional()
16583
+ }), object({
16584
+ success: boolean(),
16585
+ reason: string().optional()
16586
+ }), {
16587
+ kind: "mutation",
16588
+ auth: "admin"
16589
+ }), 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({
16590
+ addonId: string(),
16591
+ modelId: string(),
16592
+ filename: string().optional(),
16593
+ settings: record(string(), unknown()).optional()
16594
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16605
16595
  /**
16606
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16607
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16608
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16609
- * tracking, per-kind persistence) but stay distinguishable so consumers
16610
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16611
- * Absent on legacy rows ⇒ treat as `pipeline`.
16596
+ * Per-stage gating mode applied to the zones a rule references.
16597
+ *
16598
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16599
+ * When at least one `include` rule fires for a stage, only entities
16600
+ * inside one of those zones pass that stage.
16601
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16602
+ * Entities inside one of those zones are dropped at that stage.
16603
+ *
16604
+ * `monitor`-style observation (count without filtering) is not a rule
16605
+ * mode — zones without any matching rule are observed naturally by
16606
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16607
+ * count, not filter" use case needs no rule at all.
16612
16608
  */
16613
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16609
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16614
16610
  /**
16615
- * The confirmed zone crossing that produced an object event. Present ONLY on
16616
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16617
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16618
- * appearance event carry none, so a rule asking for a direction fails closed
16619
- * on them.
16611
+ * Per-consumer rule that references existing zones (geometry) and
16612
+ * defines how a specific pipeline stage should treat them. Each
16613
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16614
+ * settings:
16620
16615
  *
16621
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16622
- * into its own event, so a frame in which a track enters A while leaving B
16623
- * produces two events with two directions — never one ambiguous row.
16616
+ * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
16617
+ * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
16618
+ * - future: notification rules, audio gating, etc.
16624
16619
  *
16625
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16626
- * membership the box has NOW, and by definition it no longer contains the zone
16627
- * that was just left. Without the id here, a zone-scoped rule could never match
16628
- * the exit it asked for.
16620
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16621
+ * express "ignore motion in ALL of {garden, street}" with a single
16622
+ * rule. `classFilter` narrows the rule to specific object classes —
16623
+ * "drop person detections in the street, but keep cars" is one
16624
+ * `exclude` rule with `classFilter: ['person']`.
16625
+ *
16626
+ * `enabled` is a soft toggle — the operator can keep the rule
16627
+ * configured but inert without deleting it.
16629
16628
  */
16630
- var ZoneCrossingSchema = object({
16631
- direction: _enum(["enter", "exit"]),
16632
- /** Admin zone id crossed. */
16633
- zoneId: string(),
16634
- /** Zone display name at crossing time (falls back to the id). */
16635
- zoneName: string().optional()
16636
- });
16637
- var ObjectEventSchema = object({
16638
- ...BaseEventFields,
16639
- kind: literal("object"),
16640
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16641
- source: DetectionSourceSchema.optional(),
16629
+ var ZoneRuleSchema = object({
16630
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16631
+ id: string(),
16632
+ /** Optional human-readable label rendered in the rule editor. */
16633
+ name: string().optional(),
16634
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16635
+ * listed zones (OR-set: a detection in any one of them counts).
16636
+ * At least one zone id required — a rule with no targets is a
16637
+ * configuration mistake and the form validator rejects it. */
16638
+ zoneIds: array(string()).min(1).readonly(),
16639
+ mode: ZoneRuleModeEnum,
16642
16640
  /**
16643
- * Inference-frame id shared by every object event emitted from the SAME frame
16644
- * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16645
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16646
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16647
- * Optional for backward-compat with pre-existing rows / the slim projection
16648
- * includes it (it is light). Absent on rows written before this field.
16649
- */
16650
- frameId: string().optional(),
16651
- /** Omitted in slim projection. */
16652
- trackId: string().optional(),
16653
- className: string(),
16654
- ...TieredLabelFields,
16655
- /** Omitted in slim projection. */
16656
- confidence: number().optional(),
16657
- /** Heavy JSON — omitted in slim projection. */
16658
- bbox: BoundingBoxSchema.optional(),
16659
- /** Heavy JSON — omitted in slim projection. */
16660
- zones: array(string()).readonly().optional(),
16661
- /** Omitted in slim projection. */
16662
- state: TrackStateSchema.optional(),
16641
+ * Class names this rule applies to. Empty / undefined ⇒ rule
16642
+ * applies to every class. Class strings match the `macroClass`
16643
+ * field on detections (e.g. `person`, `car`, `dog`).
16644
+ */
16645
+ classFilter: array(string()).readonly().optional(),
16663
16646
  /**
16664
- * The zone crossing this event IS, when it is one. Absent on every other
16665
- * event kind (movement state, appearance, package) — see
16666
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16647
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16648
+ * required to consider an entity "in the zone". Defaults to the
16649
+ * consumer's stage default when omitted. Kept for back-compat with
16650
+ * existing per-rule overrides; new operators pick the value via
16651
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16652
+ * set, the lower-level engine reads it as a 0–1 fraction.
16667
16653
  */
16668
- zoneCrossing: ZoneCrossingSchema.optional(),
16669
- /** Detection-frame dimensions in pixels — let consumers normalize the
16670
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
16671
- frameWidth: number().optional(),
16672
- frameHeight: number().optional(),
16673
- /** MediaStore key for the crop attached to this event (if any). */
16674
- mediaKey: string().optional(),
16675
- /** Design B: MediaStore key of the track's native-resolution key frame (the
16676
- * best-detection full frame). Resolve via the event-media data-plane
16677
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
16678
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
16679
- * sources — consumers fall back to `mediaKey` (the tight crop). */
16680
- keyFrameMediaKey: string().optional(),
16681
- /** Populated by B5 (recording playback URL for this event). */
16682
- mediaUrl: string().optional(),
16683
- /** The parent track's key-event importance [0,1], propagated to every object
16684
- * event of the track (so an event row can be sorted by importance without a
16685
- * track join). Absent on legacy rows / before the track was scored. */
16686
- importance: number().optional()
16687
- });
16688
- var AudioEventSchema = object({
16689
- ...BaseEventFields,
16690
- kind: literal("audio"),
16691
- rms: number(),
16692
- dbfs: number(),
16693
- classification: object({
16694
- className: string(),
16695
- originalClass: string().optional(),
16696
- score: number()
16697
- }).optional(),
16698
- /** Populated by B5 (recording playback URL for this event). */
16699
- mediaUrl: string().optional()
16700
- });
16701
- var MediaFileKindEnum = _enum([
16702
- "crop",
16703
- "thumbnail",
16704
- "snapshot",
16705
- "firstFrame",
16706
- "lastFrame",
16707
- "fullFrame",
16708
- "fullFrameBoxed",
16709
- "faceCrop",
16710
- "plateCrop",
16711
- "keyFrame",
16712
- "keyFrameSmall",
16713
- "thumbnailSmall"
16714
- ]);
16715
- var MediaFileSchema = object({
16716
- key: string(),
16717
- kind: MediaFileKindEnum,
16718
- base64: string(),
16719
- sizeBytes: number(),
16720
- timestamp: number()
16654
+ overlapThreshold: number().min(0).max(1).optional(),
16655
+ /**
16656
+ * Operator-friendly version of `overlapThreshold` — the percentage
16657
+ * of the detection's bbox that must lie inside the zone for the
16658
+ * rule to match. Documented default is 85%; the engine substitutes
16659
+ * that when the field is omitted (kept optional so existing rules
16660
+ * stored without it stay valid).
16661
+ *
16662
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16663
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16664
+ * field exposed in the UI. Internally both feed the same gate.
16665
+ */
16666
+ bboxInclusionPct: number().min(0).max(100).optional(),
16667
+ /**
16668
+ * When `true` and a detection has a segmentation mask, use the
16669
+ * mask for overlap instead of the bbox. Detection-stage only;
16670
+ * motion rules ignore this field.
16671
+ */
16672
+ preferMask: boolean().optional(),
16673
+ /**
16674
+ * Soft-toggle: `false` disables the rule without deleting it.
16675
+ * Defaults to `true` so operators creating a rule via the UI
16676
+ * see it active immediately.
16677
+ */
16678
+ enabled: boolean().default(true)
16721
16679
  });
16680
+ array(ZoneRuleSchema).readonly();
16722
16681
  /**
16723
- * One media row WITHOUT its bytes.
16682
+ * Zone — pure geometry + identity. NO filtering behaviour.
16724
16683
  *
16725
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
16726
- * 140 s track), and a client that renders tiles from the media data plane needs
16727
- * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
16728
- * with an immutable cache, instead of all at once inside a tRPC response that
16729
- * blocks the whole view.
16684
+ * Zones describe **where** in the frame the operator wants to flag
16685
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16686
+ * each pipeline stage uses them. Splitting the two means a single
16687
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16688
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16689
+ * — without three duplicated polygons.
16730
16690
  *
16731
- * `sizeBytes` is carried because it is what lets a client decide between the
16732
- * stored blob and a `?variant=thumb` rendering without fetching either.
16691
+ * Owned by the orchestrator addon (provider) and mirrored into the
16692
+ * `zones` device-state slice on every mutation. Consumers
16693
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16694
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16695
+ * mirror with `onChanged`).
16696
+ *
16697
+ * Coordinates are normalised fractions of the frame (0–1) so zones
16698
+ * survive resolution changes and stream profile switches.
16699
+ *
16700
+ * `kind` discriminates between full polygons (closed regions used
16701
+ * for intrusion / occupancy filters) and tripwires (open 2-point
16702
+ * line segments used for cross events). Onboard / firmware-reported
16703
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
16704
+ * task list.
16733
16705
  */
16734
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
16706
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
16707
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
16708
+ var PolygonPointSchema = object({
16709
+ x: number(),
16710
+ y: number()
16711
+ });
16712
+ /** A camera detection zone — pure geometry/identity. */
16713
+ var ZoneSchema = object({
16714
+ id: string(),
16715
+ name: string(),
16716
+ kind: ZoneKindEnum.default("polygon"),
16717
+ /** Polygon vertices, fraction of frame (0–1). */
16718
+ polygon: array(PolygonPointSchema).readonly(),
16719
+ /** Visual color for UI rendering. */
16720
+ color: string().default("#3b82f6")
16721
+ });
16722
+ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
16723
+ deviceId: number(),
16724
+ zone: ZoneSchema
16725
+ }), _void(), {
16726
+ kind: "mutation",
16727
+ auth: "admin"
16728
+ }), method(object({
16729
+ deviceId: number(),
16730
+ zoneId: string()
16731
+ }), _void(), {
16732
+ kind: "mutation",
16733
+ auth: "admin"
16734
+ }), method(object({
16735
+ deviceId: number(),
16736
+ zone: ZoneSchema
16737
+ }), _void(), {
16738
+ kind: "mutation",
16739
+ auth: "admin"
16740
+ }), object({ zones: array(ZoneSchema).readonly() });
16735
16741
  /**
16736
- * The MACRO tier of an annotation — a CLOSED set.
16742
+ * pipeline-analytics — device-scoped wrapper cap. Refines raw
16743
+ * per-frame detections emitted by the pipeline runner into tracked
16744
+ * objects, per-kind event collections (motion / object / audio), and
16745
+ * persisted media. Owns the post-detection domain end-to-end:
16737
16746
  *
16738
- * This is what the exported detector predicts, so a typo here is a new class
16739
- * with one example in it. `label` and `subLabel` are open strings by contrast:
16740
- * the whole point of the page is teaching the model things it does not know
16741
- * yet, and constraining that vocabulary would make it useless.
16747
+ * runner emits PipelineInferenceResult
16748
+ * ↓ (event bus)
16749
+ * pipeline-analytics subscriber
16750
+ * ↓ SORT tracker + zone engine + state analyzer + event emitter
16751
+ * → three DB collections (one per kind), one FS media tree, one
16752
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
16753
+ * DetectionEvent on bus)
16742
16754
  *
16743
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
16744
- * `subLabel` is one of these values, in any casing, because once `person`
16745
- * exists in both tiers "every person box" stops being answerable without
16746
- * knowing every string anyone ever typed — and the damage is retroactive.
16755
+ * Pure subscriber model. No `processFrame` cap method — the runner
16756
+ * already publishes the raw frame on the bus. The cap surface is
16757
+ * only QUERIES + per-device settings, bound on/off via
16758
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
16759
+ * every camera with a detection pipeline wants its raw detections
16760
+ * refined; operators opt out per-device via BindingsTab when needed.
16761
+ *
16762
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16763
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
16747
16764
  */
16748
- var RetrainMacroClassSchema = _enum([
16765
+ var TrackStateSchema = _enum([
16766
+ "new",
16767
+ "entered",
16768
+ "left",
16769
+ "moving",
16770
+ "idle"
16771
+ ]);
16772
+ var EventKindSchema = _enum([
16773
+ "motion",
16774
+ "object",
16775
+ "audio"
16776
+ ]);
16777
+ /**
16778
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16779
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16780
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
16781
+ */
16782
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16783
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
16784
+ var EventKindIconSchema = _enum([
16785
+ "motion",
16786
+ "audio",
16749
16787
  "person",
16750
16788
  "vehicle",
16751
16789
  "animal",
16790
+ "door",
16791
+ "pir",
16792
+ "smoke",
16793
+ "water",
16794
+ "button",
16752
16795
  "package",
16753
- "face",
16754
- "plate"
16796
+ "generic"
16755
16797
  ]);
16756
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
16757
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
16758
- /** Did a human draw this box, or did the assist propose it? */
16759
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
16760
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
16761
- var RetrainBboxSchema = object({
16762
- x: number(),
16763
- y: number(),
16764
- w: number(),
16765
- h: number()
16766
- });
16767
- /**
16768
- * One annotated subject.
16769
- *
16770
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
16771
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
16772
- * derived from it at export and never stored — storing them is how one feature
16773
- * space ends up holding two crops of the same subject (D52).
16774
- */
16775
- var RetrainAnnotationSchema = object({
16776
- id: string(),
16777
- trackId: string(),
16778
- deviceId: number(),
16779
- /** The COPY in retrain storage — never the source track's media key. */
16780
- mediaKey: string(),
16781
- bbox: RetrainBboxSchema,
16782
- macroClass: RetrainMacroClassSchema,
16783
- label: string().optional(),
16784
- subLabel: string().optional(),
16785
- kind: RetrainAnnotationKindSchema,
16786
- source: RetrainAnnotationSourceSchema,
16787
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
16788
- assistModelId: string().optional(),
16789
- assistScore: number().optional(),
16790
- exportedInBatch: string().optional(),
16791
- createdAt: number()
16792
- });
16793
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
16794
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
16795
- id: true,
16796
- trackId: true,
16797
- deviceId: true,
16798
- mediaKey: true,
16799
- createdAt: true,
16800
- exportedInBatch: true
16798
+ var EventKindCategorySchema = _enum([
16799
+ "motion",
16800
+ "audio",
16801
+ "detection",
16802
+ "sensor",
16803
+ "control",
16804
+ "custom",
16805
+ "package"
16806
+ ]);
16807
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16808
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16809
+ var EventKindDescriptorSchema = object({
16810
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16811
+ kind: string(),
16812
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16813
+ labelKey: string(),
16814
+ /** English fallback label (kept for clients that don't translate). */
16815
+ label: string(),
16816
+ /** Hex color for timeline/legend rendering. */
16817
+ color: string(),
16818
+ /** Dictionary id → lucide component on the UI side. */
16819
+ iconId: string(),
16820
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16821
+ icon: EventKindIconSchema,
16822
+ category: EventKindCategorySchema,
16823
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16824
+ parentKind: string().nullable(),
16825
+ /** Derived from `parentKind`, explicit for the client tree. */
16826
+ level: EventKindLevelSchema,
16827
+ /** Which cap + device contributes this kind. For built-ins the camera
16828
+ * itself; for sensor kinds the LINKED source device. */
16829
+ source: object({
16830
+ capName: string(),
16831
+ deviceId: number()
16832
+ })
16801
16833
  });
16802
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
16803
- var RetrainTrackSchema = object({
16804
- trackId: string(),
16834
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16835
+ var EventKindsForDeviceSchema = object({
16805
16836
  deviceId: number(),
16806
- className: string(),
16807
- label: string().optional(),
16808
- firstSeen: number(),
16809
- lastSeen: number(),
16810
- /** How many frames the dataset already holds from this track. */
16811
- frameCount: number().int(),
16812
- /** How many subjects have been annotated on those frames. `0` with
16813
- * `frameCount: 0` is exactly "staging, still to work". */
16814
- annotationCount: number().int()
16815
- });
16816
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
16817
- var RetrainFrameCandidateSchema = object({
16818
- mediaKey: string(),
16819
- kind: MediaFileKindEnum,
16820
- timestamp: number(),
16821
- sizeBytes: number().int(),
16822
- /** A copy of this original already exists — selecting it is free and cannot
16823
- * fail, whatever became of the original. */
16824
- copied: boolean()
16837
+ kinds: array(EventKindDescriptorSchema).readonly()
16825
16838
  });
16826
- /** A frame the dataset OWNS: bytes copied at selection time. */
16827
- var RetrainFrameSchema = object({
16828
- frameId: string(),
16839
+ var SensorEventSchema = object({
16840
+ id: string(),
16841
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
16842
+ * yields N rows, one per camera). */
16829
16843
  deviceId: number(),
16830
- trackId: string(),
16831
- /** Provenance only. It may already point at nothing — that is expected. */
16832
- sourceMediaKey: string(),
16833
- sourceKind: MediaFileKindEnum,
16834
- sizeBytes: number().int(),
16835
- width: number().int(),
16836
- height: number().int(),
16837
- copiedAt: number()
16844
+ /** The linked sensor device whose state changed. */
16845
+ sourceDeviceId: number(),
16846
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
16847
+ kind: string(),
16848
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
16849
+ value: record(string(), unknown()).nullable(),
16850
+ timestamp: number()
16838
16851
  });
16839
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
16840
- var RetrainCopyRefusalSchema = _enum([
16841
- "source-missing",
16842
- "unreadable-image",
16843
- "write-failed"
16844
- ]);
16845
- var RetrainFrameSelectionSchema = object({
16846
- copied: array(RetrainFrameSchema).readonly(),
16847
- refused: array(object({
16848
- sourceMediaKey: string(),
16849
- reason: RetrainCopyRefusalSchema
16850
- })).readonly()
16852
+ var TrackPositionSchema = object({
16853
+ x: number(),
16854
+ y: number(),
16855
+ timestamp: number(),
16856
+ bbox: BoundingBoxSchema
16851
16857
  });
16852
- var RetrainFrameListSchema = object({
16853
- candidates: array(RetrainFrameCandidateSchema).readonly(),
16854
- copies: array(RetrainFrameSchema).readonly(),
16855
- /** What the page pre-selects — the native key frame when one survives. */
16856
- autoPickMediaKey: string().optional()
16858
+ var TrackSnapshotSchema = object({
16859
+ timestamp: number(),
16860
+ position: TrackPositionSchema,
16861
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16862
+ mediaKey: string()
16857
16863
  });
16858
- /** What the operator asked the assist to look for. */
16859
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
16860
- kind: literal("package"),
16861
- zone: RetrainBboxSchema.optional()
16862
- }), object({
16863
- kind: literal("objects"),
16864
- modelId: string(),
16865
- minScore: number().optional()
16866
- })]);
16867
16864
  /**
16868
- * The assist's answer — a discriminated union, because "the model saw nothing"
16869
- * and "this node cannot run that model" lead to different next moves and a
16870
- * nullable result cannot tell them apart.
16865
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16866
+ * divided by the track's detection-frame dims), computed at persist time.
16867
+ * Absent when the frame dims were unknown when the track was persisted
16868
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16871
16869
  */
16872
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
16873
- kind: literal("proposed"),
16874
- modelId: string(),
16875
- stepId: string(),
16876
- minScore: number(),
16877
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
16878
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
16879
- /** Returned by the runner but removed by the threshold. */
16880
- belowThreshold: number().int()
16881
- }), object({
16882
- kind: literal("refused"),
16883
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
16884
- reason: string(),
16885
- detail: string().optional()
16886
- })]);
16887
- /** The outcome of a lifecycle move owned by the retrain page. */
16888
- var RetrainTransitionResultSchema = object({
16889
- trackId: string(),
16890
- /** Where the track ended up, whatever happened. */
16891
- retrainStatus: RetrainStatusSchema,
16892
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
16893
- changed: boolean(),
16894
- reason: _enum([
16895
- "unknown-track",
16896
- "no-frames-copied",
16897
- "not-staging",
16898
- "not-trained",
16899
- "unchanged"
16900
- ]).optional()
16901
- });
16902
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
16903
- var MAX_EVENT_QUERY_LIMIT = 5e3;
16904
- var DeviceEventQueryInput = object({
16905
- deviceId: number(),
16906
- since: number().optional(),
16907
- until: number().optional(),
16908
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
16909
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
16910
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
16911
- * exact behaviour. Callers may omit this field — the store defaults to
16912
- * `full` when not provided. */
16913
- projection: _enum(["full", "slim"]).optional()
16914
- });
16915
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
16916
- var RecentTracksQueryInput = object({
16917
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
16918
- deviceIds: array(number()),
16919
- /** Window lower bound on `lastSeen` (inclusive). */
16920
- since: number().optional(),
16921
- /** Window upper bound on `lastSeen` (inclusive). */
16922
- until: number().optional(),
16923
- /** Page size. Default 200, max 1000. */
16924
- limit: number().int().min(1).max(1e3).default(200),
16925
- /** Opaque continuation cursor from a previous page's `nextCursor`.
16926
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16927
- cursor: string().optional(),
16928
- /** See {@link TrackProjectionSchema}. Default `full`. */
16929
- projection: TrackProjectionSchema.optional(),
16930
- /** Include stationary-promoted rows (parked objects). Default false: the
16931
- * feed lists passages; parking records live on the stationary registry. */
16932
- includeStationary: boolean().optional()
16870
+ var TrackEnvelopeSchema = object({
16871
+ minX: number(),
16872
+ minY: number(),
16873
+ maxX: number(),
16874
+ maxY: number()
16933
16875
  });
16934
- var RecentTracksPageSchema = object({
16935
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
16936
- tracks: array(TrackSchema).readonly(),
16937
- /** Cursor for the next page, or null when this page is the last. */
16938
- nextCursor: string().nullable()
16939
- });
16940
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
16941
- var LIST_GROUPS_MAX_LIMIT = 100;
16942
- var AnalyticsGroupRecordSchema = object({
16943
- id: string(),
16944
- deviceId: number().int(),
16945
- openedAt: number().int(),
16946
- closedAt: number().int(),
16947
- timestamp: number().int(),
16948
- memberCount: number().int(),
16949
- memberTrackIds: array(string()).readonly(),
16950
- className: string(),
16951
- classes: array(string()).readonly(),
16952
- /** Relative event-media path, or null when the group has no picture yet. */
16953
- mediaUrl: string().nullable(),
16954
- singleton: boolean()
16955
- });
16956
- var AnalyticsGroupMemberSchema = object({
16957
- trackId: string(),
16958
- deviceId: number().int(),
16959
- className: string(),
16960
- firstSeen: number().int(),
16961
- lastSeen: number().int(),
16962
- mediaUrl: string().nullable()
16963
- });
16964
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
16965
- var ListGroupsQueryInput = object({
16966
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
16967
- deviceIds: array(number()),
16968
- /** Window lower bound on `closedAt` (inclusive). */
16969
- since: number().optional(),
16970
- /** Window upper bound on `openedAt` (inclusive). */
16971
- until: number().optional(),
16972
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
16973
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
16974
- cursor: string().optional()
16975
- });
16976
- var ListGroupsPageSchema = object({
16977
- groups: array(AnalyticsGroupRecordSchema).readonly(),
16978
- nextCursor: string().nullable()
16979
- });
16980
- var KeyEventQueryInput = object({
16981
- deviceId: number(),
16982
- /** Window lower bound (track firstSeen ≥ since). */
16983
- since: number(),
16984
- /** Window upper bound (track firstSeen ≤ until). */
16985
- until: number(),
16986
- limit: number().int().min(1).max(200).default(50),
16987
- /** Drop tracks scoring below this importance. */
16988
- minImportance: number().min(0).max(1).optional(),
16989
- /** Restrict to a single class (e.g. 'person'). */
16990
- classFilter: string().optional()
16991
- });
16992
- var KeyEventSchema = object({
16993
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
16994
- id: string(),
16995
- trackId: string(),
16996
- /** Track start time (firstSeen). */
16997
- timestamp: number(),
16998
- className: string(),
16999
- ...TieredLabelFields,
17000
- importance: number(),
17001
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
17002
- bestEventId: string(),
17003
- /** Track lifetime in ms (lastSeen - firstSeen). */
17004
- windowMs: number().optional(),
17005
- ...TrackFlagFields,
17006
- ...TrackRetrainFields
17007
- });
17008
- object({
17009
- trackId: string(),
17010
- className: string(),
17011
- confidence: number(),
17012
- bbox: BoundingBoxSchema,
17013
- zones: array(string()).readonly(),
17014
- state: TrackStateSchema
17015
- });
17016
- var OverlayDetectionSchema = looseObject({
17017
- id: string(),
17018
- kind: _enum(["first-level", "detail"]),
17019
- macroClass: string(),
17020
- score: number(),
17021
- bbox: object({
17022
- x: number(),
17023
- y: number(),
17024
- width: number(),
17025
- height: number()
17026
- }),
17027
- labels: array(looseObject({
17028
- label: string(),
17029
- score: number()
17030
- })).readonly(),
17031
- parentId: string().optional()
17032
- });
17033
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17034
- var SearchObjectEventsInput = object({
17035
- text: string(),
17036
- deviceId: number().optional(),
17037
- since: number().optional(),
17038
- until: number().optional(),
17039
- classFilter: string().optional(),
17040
- limit: number().default(50),
17041
- minScore: number().min(0).max(1).default(.2)
17042
- });
17043
- var TrackCascadeCountsSchema = object({
17044
- /** Persisted track roots deleted (authoritative). */
17045
- tracks: number().int(),
17046
- /** Object events removed with their tracks (best-effort; see note above). */
17047
- events: number().int(),
17048
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17049
- media: number().int(),
17050
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17051
- faces: number().int(),
17052
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17053
- plates: number().int(),
17054
- /** Per-track CLIP search vectors removed (best-effort). */
17055
- embeddings: number().int(),
17056
- /** Group membership + group rows removed with their last member (best-effort). */
17057
- groups: number().int()
17058
- });
17059
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17060
- var DiskReconcileCountsSchema = object({
17061
- mediaDropped: number().int(),
17062
- tracks: number().int(),
17063
- events: number().int()
17064
- });
17065
- /** Event-store footprint for one camera. */
17066
- var EventStoreDeviceFootprintSchema = object({
17067
- deviceId: number(),
17068
- /** Persisted event rows (motion + object + audio) for the camera. */
17069
- rows: number().int(),
17070
- /** Event-owned media bytes on disk for the camera. */
17071
- bytes: number().int()
17072
- });
17073
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17074
- var EventStoreFootprintSchema = object({
17075
- totalRows: number().int(),
17076
- totalBytes: number().int(),
17077
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17078
- });
17079
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17080
- var EventPruneCountsSchema = object({
17081
- motion: number().int(),
17082
- object: number().int(),
17083
- audio: number().int()
16876
+ /**
16877
+ * Row projection for track list queries. `full` (default) returns the
16878
+ * complete Track including the frame-rate `positions[]` history and the
16879
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
16880
+ * keeps every scalar the list surfaces actually render (ids, class(es),
16881
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16882
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16883
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16884
+ * `getTrack`. Mirrors the event-store `projection` convention
16885
+ * (`getObjectEvents` et al.).
16886
+ */
16887
+ var TrackProjectionSchema = _enum(["full", "slim"]);
16888
+ /**
16889
+ * One audio-classification label heard on the track's camera while the
16890
+ * track was alive, aggregated per label. An "episode" is one persisted
16891
+ * audio event (the confident-classification path: score ≥ the device's
16892
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16893
+ * one 32 ms inference chunk, so counts stay human-scaled.
16894
+ */
16895
+ var TrackAudioLabelSchema = object({
16896
+ label: string(),
16897
+ /** Highest classification score observed across the label's episodes. */
16898
+ peakScore: number(),
16899
+ /** Number of coalesced audio-event episodes carrying this label. */
16900
+ count: number(),
16901
+ firstAt: number(),
16902
+ lastAt: number()
17084
16903
  });
17085
16904
  /**
17086
- * Re-embed stored tracks from their key frames.
16905
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16906
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16907
+ * no positions, a single snapshot, and no bbox trajectory at all:
17087
16908
  *
17088
- * The reason this is an operator-callable method and not a migration script:
17089
- * every knob that decides what a vector MEANS — encoder model, crop margin,
17090
- * squaring — is only changeable if the existing vectors can be regenerated.
17091
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17092
- * symptom is a quality regression with no visible cause.
16909
+ * - `sensor` — a linked sensor/control device state change.
16910
+ * - `audio` — an audio event on the camera itself that was anomalous for
16911
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
16912
+ *
16913
+ * The spatial subsystems (tracker association, occupancy count, re-id /
16914
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
16915
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16916
+ * check silently readmits every source added after it was written.
17093
16917
  */
17094
- var RebuildObjectEmbeddingsInput = object({
17095
- /** Restrict to one camera. Omit for the whole fleet. */
17096
- deviceId: number().optional(),
17097
- since: number().optional(),
17098
- until: number().optional(),
17099
- /** Stop after this many tracks; the result reports whether more remain. */
17100
- maxTracks: number().int().positive().optional(),
17101
- /**
17102
- * Run every embedding on THIS node instead of round-robining the fleet.
17103
- *
17104
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17105
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17106
- * calling it that would pin the rebuild REQUEST itself to that node — the
17107
- * rebuild orchestration lives on the hub, and only the per-track step runs
17108
- * remotely. This field is data; the per-track pin is applied inside.
17109
- *
17110
- * Absent ⇒ round-robin over every online node whose runner can serve the
17111
- * pinned model.
17112
- */
17113
- executeOnNodeId: string().optional(),
17114
- /**
17115
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17116
- * run flat out.
17117
- *
17118
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17119
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17120
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17121
- * force is logged at start and finish so a deliberately slow pass reads
17122
- * differently from a stalled one.
17123
- */
17124
- pacingMs: number().int().nonnegative().optional()
17125
- });
16918
+ var TrackSourceSchema = _enum([
16919
+ "pipeline",
16920
+ "sensor",
16921
+ "audio"
16922
+ ]);
17126
16923
  /**
17127
- * Result of emptying the CLIP index.
16924
+ * Where a track sits in the RETRAIN lifecycle (D81).
17128
16925
  *
17129
- * The clean slate before a policy change: a new crop margin or encoder model
17130
- * leaves two feature spaces in one index whose cosine scores are not
17131
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17132
- * means the same thing.
16926
+ * - `none` — never marked, or un-marked. Evictable.
16927
+ * - `staging` — the operator wants this track as training material and has not
16928
+ * finished with it. **This is the only state retention holds**: the track and
16929
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
16930
+ * the device's age window.
16931
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
16932
+ * were COPIED into the retrain dataset at selection time, so the dataset no
16933
+ * longer depends on the track's media and the track becomes EVICTABLE again.
16934
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16935
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
16936
+ *
16937
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16938
+ * the store's filter language has only positive equality and `whereIn` — no
16939
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16940
+ * would make the entire pre-column history immortal in one deploy.
17133
16941
  */
17134
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
16942
+ var RetrainStatusSchema = _enum([
16943
+ "none",
16944
+ "staging",
16945
+ "trained"
16946
+ ]);
17135
16947
  /**
17136
- * Acknowledgement that a rebuild STARTED.
16948
+ * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16949
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16950
+ * so the two surfaces cannot drift.
17137
16951
  *
17138
- * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17139
- * runs detached and this returns immediately. Waiting for it made the client
17140
- * time out while the work carried on server-side, which is the worst of both:
17141
- * no result and no way to know it was still going. Poll
17142
- * `getObjectEmbeddingRebuildStatus` for progress.
16952
+ * **Absent ≠ false.** A track that has never been touched omits the field; an
16953
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
16954
+ * columns existed read as absent, and a consumer that needs a boolean should say
16955
+ * `flag === true`, not `flag !== false`.
16956
+ *
16957
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16958
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16959
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16960
+ * `trained` track reports `false` while refusing both writes. The boolean is
16961
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
16962
+ * "never marked" from "already trained" must read `retrainStatus`.
16963
+ *
16964
+ * `debug` does NOT pin; it is attention, not durability.
16965
+ *
16966
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16967
+ * A favourited track is skipped by retention the same way `staging` is, but
16968
+ * it does not enter `none|staging|trained` and has no staging budget.
17143
16969
  */
17144
- var RebuildObjectEmbeddingsResultSchema = object({
17145
- started: boolean(),
17146
- /** True when a pass was already running; the new request is ignored. */
17147
- alreadyRunning: boolean()
17148
- });
17149
- var RebuildStatusSchema = object({
17150
- running: boolean(),
17151
- scanned: number(),
17152
- rebuilt: number(),
17153
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17154
- missingKeyFrame: number(),
17155
- /** Tracks with no usable detection box. */
17156
- missingBbox: number(),
17157
- /**
17158
- * Tracks an executing node REFUSED rather than broke on — an unreadable key
17159
- * frame, a step that threw. Separate from `failed` because the remedy is
17160
- * different, and because a whole camera silently contributing zero vectors
17161
- * is the shape of failure a rebuild must never hide.
17162
- */
17163
- notRunnable: number(),
16970
+ var TrackFlagFields = {
16971
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
16972
+ * `'staging'`. */
16973
+ markForTrain: boolean().optional(),
16974
+ /** Operator marked this track for diagnostic attention. */
16975
+ debug: boolean().optional(),
16976
+ /** Operator favourited this track. Pins it against pruning. */
16977
+ favourited: boolean().optional()
16978
+ };
16979
+ /**
16980
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16981
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16982
+ * write patch, and the status is not something the toggle sets — it is what the
16983
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16984
+ * always present on a persisted row (the column default materialises `'none'`).
16985
+ */
16986
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16987
+ /**
16988
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16989
+ * one flag can never clear the other — the toggles are independent and are
16990
+ * driven from three surfaces that do not know about each other.
16991
+ */
16992
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
16993
+ /**
16994
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
16995
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
16996
+ * mutation result without a re-fetch.
16997
+ */
16998
+ var TrackFlagsSchema = object({
16999
+ trackId: string(),
17000
+ markForTrain: boolean(),
17001
+ debug: boolean(),
17002
+ favourited: boolean(),
17003
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
17004
+ * a track row) because this shape is only ever produced by the write body,
17005
+ * which always knows it — and a surface that has just written needs to render
17006
+ * `trained` without a re-fetch. */
17007
+ retrainStatus: RetrainStatusSchema
17008
+ });
17009
+ union([literal(1), literal(2)]);
17010
+ /**
17011
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
17012
+ * the step and model that produced it — which is what makes the write rule
17013
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17014
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17015
+ *
17016
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17017
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17018
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
17019
+ * that value has no provenance, and the write rule lets ANY properly-attributed
17020
+ * write of the same tier replace it regardless of score.
17021
+ */
17022
+ var LabelAttributionSchema = object({
17023
+ stepId: string(),
17024
+ modelId: string().optional(),
17025
+ decidedAt: number(),
17164
17026
  /**
17165
- * The pass stopped because NO node could serve the pinned model.
17027
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
17028
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17166
17029
  *
17167
- * Distinct from `notRunnable` on purpose: that one says "this track was
17168
- * refused", this one says "the cluster cannot do this work at all" — every
17169
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17170
- * pinned model for its engine format, or dropped out. The remedy is a model /
17171
- * engine change, not a per-camera one. Non-zero here always comes with
17172
- * `complete: false`.
17030
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
17031
+ * notification rule authored on "Gianluca" stopped matching the moment the
17032
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
17033
+ * the thing that does not move, so it is what a rule matches on
17034
+ * (`NcConditions.identities`) and the text is what a human is shown.
17035
+ *
17036
+ * Absent when the label names no gallery row — a plate the OCR read but no
17037
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17173
17038
  */
17174
- noCapableNode: number(),
17175
- failed: number(),
17176
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17177
- complete: boolean().nullable(),
17178
- startedAtMs: number().nullable(),
17179
- finishedAtMs: number().nullable(),
17180
- /** Present when the pass ended by throwing. */
17181
- error: string().nullable()
17039
+ identityId: string().optional()
17182
17040
  });
17183
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17184
- deviceId: number(),
17185
- trackId: string()
17186
- }), TrackSchema.nullable()), method(object({
17187
- deviceId: number(),
17188
- since: number().optional(),
17189
- until: number().optional(),
17190
- limit: number().optional(),
17191
- /** Spatial filter — only tracks whose trajectory intersects the zone
17192
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17193
- * envelope columns, then precisely tested per position. Tracks with
17194
- * an unknown envelope (no frame dims at persist time) always match. */
17195
- zone: TrackZoneFilterSchema.optional(),
17196
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17197
- * compatible — omitting the field keeps today's exact behaviour). */
17198
- projection: TrackProjectionSchema.optional(),
17199
- /** Include stationary-promoted rows (parked objects handed to the
17200
- * stationary registry). Default false: the timeline lists passages,
17201
- * not parking records (operator decision, 2026-08-15). */
17202
- includeStationary: boolean().optional()
17203
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17204
- deviceId: number(),
17205
- groupId: string().min(1)
17206
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17207
- kind: "mutation",
17208
- auth: "admin"
17209
- }), 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({
17210
- deviceId: number(),
17211
- since: number().optional(),
17212
- until: number().optional(),
17213
- kinds: array(string()).optional(),
17214
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17215
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17216
- deviceId: number(),
17217
- since: number(),
17218
- until: number(),
17219
- bucketMs: number().int().positive()
17220
- }), array(object({
17221
- bucketStart: number(),
17222
- motion: number().int(),
17223
- object: number().int(),
17224
- audio: number().int()
17225
- })).readonly()), method(object({
17226
- deviceId: number(),
17227
- cutoffMs: number()
17228
- }), object({
17229
- motion: number().int(),
17230
- object: number().int(),
17231
- audio: number().int()
17232
- }), {
17233
- kind: "mutation",
17234
- auth: "admin"
17235
- }), method(object({
17236
- deviceId: number(),
17237
- cutoffMs: number()
17238
- }), TrackCascadeCountsSchema, {
17239
- kind: "mutation",
17240
- auth: "admin"
17241
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17242
- kind: "mutation",
17243
- auth: "admin"
17244
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17245
- kind: "mutation",
17246
- auth: "admin"
17247
- }), method(object({
17248
- deviceId: number(),
17249
- trackIds: array(string()).min(1)
17250
- }), object({
17251
- deleted: number().int(),
17252
- failed: array(string()).readonly()
17253
- }), {
17254
- kind: "mutation",
17255
- auth: "admin"
17256
- }), method(object({
17257
- /** Log/audit scope only — the trackId is globally unique on its own. */
17041
+ /**
17042
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17043
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17044
+ * track and its events always answer the same question the same way.
17045
+ *
17046
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17047
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17048
+ * is tier 2, and each carries its own score + attribution.
17049
+ *
17050
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17051
+ * finest thing known. Before 4g the single `label` column held the finest
17052
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17053
+ * shows nothing on a species-only row; that is why the migration puts every
17054
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17055
+ * and why the read surfaces were changed in the same train.
17056
+ *
17057
+ * **Writing it.** The slots are independent, which is the whole point: a
17058
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17059
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17060
+ * higher score wins. One rule, one implementation — see
17061
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17062
+ */
17063
+ var TieredLabelFields = {
17064
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
17065
+ label: string().optional(),
17066
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17067
+ labelScore: number().optional(),
17068
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17069
+ labelMeta: LabelAttributionSchema.optional(),
17070
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
17071
+ subLabel: string().optional(),
17072
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17073
+ subLabelScore: number().optional(),
17074
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17075
+ subLabelMeta: LabelAttributionSchema.optional()
17076
+ };
17077
+ /** Per-camera slice of a training-export estimate. */
17078
+ var TrainingExportDeviceTotalsSchema = object({
17258
17079
  deviceId: number(),
17080
+ tracks: number().int(),
17081
+ files: number().int(),
17082
+ bytes: number().int()
17083
+ });
17084
+ /**
17085
+ * What a training export WOULD contain. Computed from media index rows only —
17086
+ * no blob is read to produce this.
17087
+ */
17088
+ var TrainingExportSummarySchema = object({
17089
+ generatedAt: number(),
17090
+ trackCount: number().int(),
17091
+ fileCount: number().int(),
17092
+ byteCount: number().int(),
17093
+ /** More marked tracks exist than a single pass carries. */
17094
+ truncated: boolean(),
17095
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17096
+ });
17097
+ var TrackSchema = object({
17259
17098
  trackId: string(),
17260
- flags: TrackFlagsPatchSchema
17261
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17262
- kind: "query",
17263
- auth: "admin"
17264
- }), method(object({
17265
- olderThanMs: number(),
17266
- reason: OpsLogReasonSchema.optional()
17267
- }), EventPruneCountsSchema, {
17268
- kind: "mutation",
17269
- auth: "admin"
17270
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17271
- kind: "mutation",
17272
- auth: "admin"
17273
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17274
- kind: "mutation",
17275
- auth: "admin"
17276
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17277
- kind: "mutation",
17278
- auth: "admin"
17279
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17280
- kind: "mutation",
17281
- auth: "admin"
17282
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17283
- kind: "mutation",
17284
- auth: "admin"
17285
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17286
- kind: "mutation",
17287
- auth: "admin"
17288
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17289
- kind: "query",
17290
- auth: "admin"
17291
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17292
- kind: "query",
17293
- auth: "admin"
17294
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17295
- kind: "query",
17296
- auth: "admin"
17297
- }), method(object({
17298
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17299
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17300
- * route it at one camera's owner, and "every camera" would stop being
17301
- * expressible at all. */
17302
- deviceIds: array(number()).optional(),
17303
- limit: number().int().min(1).max(500).optional()
17304
- }), array(RetrainTrackSchema).readonly(), {
17305
- kind: "query",
17306
- auth: "admin"
17307
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17308
- kind: "query",
17309
- auth: "admin"
17310
- }), method(object({
17311
17099
  deviceId: number(),
17312
- trackId: string(),
17313
- mediaKeys: array(string()).min(1)
17314
- }), RetrainFrameSelectionSchema, {
17315
- kind: "mutation",
17316
- auth: "admin"
17317
- }), method(object({
17100
+ className: string(),
17101
+ ...TieredLabelFields,
17102
+ producingDeviceName: string().optional(),
17103
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17104
+ source: TrackSourceSchema.optional(),
17105
+ firstSeen: number(),
17106
+ lastSeen: number(),
17107
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17108
+ positions: array(TrackPositionSchema).readonly(),
17109
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17110
+ * saveThumbnails policy). */
17111
+ snapshots: array(TrackSnapshotSchema).readonly(),
17112
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17113
+ zonesVisited: array(string()).readonly(),
17114
+ /**
17115
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17116
+ * `zones` capability.
17117
+ *
17118
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17119
+ * and no card can render — so every free-text search surface was structurally
17120
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17121
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17122
+ * derivation and costs the clients no extra call (the `zones` cap is
17123
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17124
+ * surface built to avoid exactly that).
17125
+ *
17126
+ * Resolved, never invented: a zone deleted since the track was written has no
17127
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17128
+ * two are not positionally aligned. Absent when the track visited no zone, or
17129
+ * when the zone catalogue could not be read.
17130
+ */
17131
+ zoneNames: array(string()).readonly().optional(),
17132
+ /** Deduplicated set of detector classes observed for this track over its
17133
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17134
+ * legacy rows written before class accumulation shipped. */
17135
+ classes: array(string()).readonly().optional(),
17136
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17137
+ totalDistance: number(),
17138
+ state: TrackStateSchema,
17139
+ active: boolean(),
17140
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17141
+ * track expiry, recomputed on late label). Absent on legacy rows written
17142
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17143
+ importance: number().optional(),
17144
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17145
+ * "best" frame). Absent when the track produced no object events. */
17146
+ bestEventId: string().optional(),
17147
+ /** Tag of the importance sub-signal that dominated the score
17148
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17149
+ importanceReason: string().optional(),
17150
+ /** Audio-classification labels heard on the camera during the track's
17151
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17152
+ * Absent on legacy rows / tracks with no confident audio. */
17153
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17154
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17155
+ * Populated from the persisted envelope columns on historical reads;
17156
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17157
+ envelope: TrackEnvelopeSchema.optional(),
17158
+ /**
17159
+ * A face DETECTOR found a face on this track — nothing more. It says the
17160
+ * detail plane produced a `face` detail; it does NOT say the face was
17161
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17162
+ * enabled. Set once and never cleared.
17163
+ *
17164
+ * **This exists so "face present but not recognised" is expressible.** A
17165
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17166
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17167
+ * and a track with no face at all were byte-identical on the wire and no
17168
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17169
+ * === undefined`.
17170
+ *
17171
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17172
+ * and so does every server that predates the field — a consumer must test
17173
+ * `=== true` and render nothing otherwise, never infer "no face".
17174
+ */
17175
+ hasFace: boolean().optional(),
17176
+ /**
17177
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17178
+ * face an operator could ASSIGN to an identity.
17179
+ *
17180
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17181
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17182
+ * branch, before every gate, and means no more than "a face detector produced
17183
+ * a face detail". This one is stamped at the single moment the gallery row
17184
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17185
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17186
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17187
+ * the crop-store drop. Everything between the detector and that insert can
17188
+ * legitimately refuse the face, so a flag written any earlier promises the
17189
+ * operator something to assign and delivers nothing.
17190
+ *
17191
+ * **Independent of recognition.** A face collected but never auto-matched is
17192
+ * still assignable — it is in fact the face an operator most wants to reach —
17193
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17194
+ * `subLabel`; this says only that the raw material exists.
17195
+ *
17196
+ * **Set once, never cleared.** A track that produced a gallery row produced
17197
+ * one; deleting the row later is the gallery's business, not this flag's.
17198
+ *
17199
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17200
+ * before the column omits it, and so does every server that predates the
17201
+ * field. A consumer must test `=== true` and render nothing otherwise —
17202
+ * never infer "no assignable face".
17203
+ */
17204
+ hasEmbeddedFace: boolean().optional(),
17205
+ /**
17206
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17207
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17208
+ * so the passage is tracked once and as a VEHICLE.
17209
+ *
17210
+ * It exists because the fold's record was dishonest. D34 and the code both
17211
+ * said "the person is not lost — it is reported so both entities stay on the
17212
+ * record"; in fact the pair went into a per-processor RAM field behind an
17213
+ * accessor nobody called, and every durable surface said `vehicle`, full
17214
+ * stop. This is the composition note that makes the row true.
17215
+ *
17216
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17217
+ * person" is not an answer to "what is this" — both label tiers would refuse
17218
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17219
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17220
+ * and a `person` rule still does not fire for someone cycling past.
17221
+ *
17222
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17223
+ * the column, and every hub that predates the field, omits it. Test
17224
+ * `=== true` and render nothing otherwise — never infer "no rider".
17225
+ */
17226
+ hasRider: boolean().optional(),
17227
+ ...TrackFlagFields,
17228
+ ...TrackRetrainFields
17229
+ });
17230
+ var BaseEventFields = {
17231
+ id: string(),
17318
17232
  deviceId: number(),
17319
- trackId: string(),
17320
- frameId: string()
17321
- }), object({
17322
- removed: boolean(),
17323
- removedAnnotations: number().int()
17324
- }), {
17325
- kind: "mutation",
17326
- auth: "admin"
17327
- }), method(object({ frameId: string() }), object({
17233
+ timestamp: number()
17234
+ };
17235
+ var MotionEventSchema = object({
17236
+ ...BaseEventFields,
17237
+ kind: literal("motion"),
17238
+ regionCount: number(),
17239
+ /** Heavy JSON array — omitted in slim projection. */
17240
+ regions: array(object({
17241
+ bbox: BoundingBoxSchema,
17242
+ pixelCount: number(),
17243
+ intensity: number()
17244
+ })).readonly().optional(),
17245
+ /** Omitted in slim projection. */
17246
+ frameWidth: number().optional(),
17247
+ /** Omitted in slim projection. */
17248
+ frameHeight: number().optional(),
17249
+ /** Populated by B5 (recording playback URL for this event). */
17250
+ mediaUrl: string().optional()
17251
+ });
17252
+ /**
17253
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17254
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17255
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17256
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17257
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17258
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17259
+ */
17260
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17261
+ /**
17262
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17263
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17264
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17265
+ * appearance event carry none, so a rule asking for a direction fails closed
17266
+ * on them.
17267
+ *
17268
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17269
+ * into its own event, so a frame in which a track enters A while leaving B
17270
+ * produces two events with two directions — never one ambiguous row.
17271
+ *
17272
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17273
+ * membership the box has NOW, and by definition it no longer contains the zone
17274
+ * that was just left. Without the id here, a zone-scoped rule could never match
17275
+ * the exit it asked for.
17276
+ */
17277
+ var ZoneCrossingSchema = object({
17278
+ direction: _enum(["enter", "exit"]),
17279
+ /** Admin zone id crossed. */
17280
+ zoneId: string(),
17281
+ /** Zone display name at crossing time (falls back to the id). */
17282
+ zoneName: string().optional()
17283
+ });
17284
+ var ObjectEventSchema = object({
17285
+ ...BaseEventFields,
17286
+ kind: literal("object"),
17287
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17288
+ source: DetectionSourceSchema.optional(),
17289
+ /**
17290
+ * Inference-frame id shared by every object event emitted from the SAME frame
17291
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17292
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17293
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17294
+ * Optional for backward-compat with pre-existing rows / the slim projection
17295
+ * includes it (it is light). Absent on rows written before this field.
17296
+ */
17297
+ frameId: string().optional(),
17298
+ /** Omitted in slim projection. */
17299
+ trackId: string().optional(),
17300
+ className: string(),
17301
+ ...TieredLabelFields,
17302
+ /** Omitted in slim projection. */
17303
+ confidence: number().optional(),
17304
+ /** Heavy JSON — omitted in slim projection. */
17305
+ bbox: BoundingBoxSchema.optional(),
17306
+ /** Heavy JSON — omitted in slim projection. */
17307
+ zones: array(string()).readonly().optional(),
17308
+ /** Omitted in slim projection. */
17309
+ state: TrackStateSchema.optional(),
17310
+ /**
17311
+ * The zone crossing this event IS, when it is one. Absent on every other
17312
+ * event kind (movement state, appearance, package) — see
17313
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17314
+ */
17315
+ zoneCrossing: ZoneCrossingSchema.optional(),
17316
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17317
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17318
+ frameWidth: number().optional(),
17319
+ frameHeight: number().optional(),
17320
+ /** MediaStore key for the crop attached to this event (if any). */
17321
+ mediaKey: string().optional(),
17322
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17323
+ * best-detection full frame). Resolve via the event-media data-plane
17324
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17325
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17326
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17327
+ keyFrameMediaKey: string().optional(),
17328
+ /** Populated by B5 (recording playback URL for this event). */
17329
+ mediaUrl: string().optional(),
17330
+ /** The parent track's key-event importance [0,1], propagated to every object
17331
+ * event of the track (so an event row can be sorted by importance without a
17332
+ * track join). Absent on legacy rows / before the track was scored. */
17333
+ importance: number().optional()
17334
+ });
17335
+ var AudioEventSchema = object({
17336
+ ...BaseEventFields,
17337
+ kind: literal("audio"),
17338
+ rms: number(),
17339
+ dbfs: number(),
17340
+ classification: object({
17341
+ className: string(),
17342
+ originalClass: string().optional(),
17343
+ score: number()
17344
+ }).optional(),
17345
+ /** Populated by B5 (recording playback URL for this event). */
17346
+ mediaUrl: string().optional()
17347
+ });
17348
+ var MediaFileKindEnum = _enum([
17349
+ "crop",
17350
+ "thumbnail",
17351
+ "snapshot",
17352
+ "firstFrame",
17353
+ "lastFrame",
17354
+ "fullFrame",
17355
+ "fullFrameBoxed",
17356
+ "faceCrop",
17357
+ "plateCrop",
17358
+ "keyFrame",
17359
+ "keyFrameSmall",
17360
+ "thumbnailSmall"
17361
+ ]);
17362
+ var MediaFileSchema = object({
17363
+ key: string(),
17364
+ kind: MediaFileKindEnum,
17328
17365
  base64: string(),
17329
- width: number().int(),
17330
- height: number().int()
17331
- }), {
17332
- kind: "query",
17333
- auth: "admin"
17334
- }), method(object({
17335
- deviceId: number(),
17336
- trackId: string(),
17337
- frameId: string(),
17338
- subject: RetrainAssistSubjectSchema,
17339
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17340
- nodeId: string().optional()
17341
- }), RetrainAssistResultSchema, {
17342
- kind: "mutation",
17343
- auth: "admin"
17344
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17345
- kind: "query",
17346
- auth: "admin"
17347
- }), method(object({
17348
- deviceId: number(),
17349
- trackId: string(),
17350
- frameId: string(),
17351
- annotations: array(RetrainAnnotationDraftSchema)
17352
- }), array(RetrainAnnotationSchema).readonly(), {
17353
- kind: "mutation",
17354
- auth: "admin"
17355
- }), method(object({
17356
- deviceId: number(),
17357
- trackId: string()
17358
- }), RetrainTransitionResultSchema, {
17359
- kind: "mutation",
17360
- auth: "admin"
17361
- }), method(object({
17362
- deviceId: number(),
17363
- trackId: string()
17364
- }), RetrainTransitionResultSchema, {
17365
- kind: "mutation",
17366
- auth: "admin"
17367
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17368
- kind: "query",
17369
- auth: "admin"
17370
- }), method(object({
17371
- eventId: string(),
17372
- kind: MediaFileKindEnum.optional(),
17373
- deviceId: number()
17374
- }), array(MediaFileSchema).readonly()), method(object({
17375
- trackId: string(),
17376
- kinds: array(MediaFileKindEnum).optional(),
17377
- deviceId: number()
17378
- }), array(MediaFileSchema).readonly()), method(object({
17366
+ sizeBytes: number(),
17367
+ timestamp: number()
17368
+ });
17369
+ /**
17370
+ * One media row WITHOUT its bytes.
17371
+ *
17372
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17373
+ * 140 s track), and a client that renders tiles from the media data plane needs
17374
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17375
+ * with an immutable cache, instead of all at once inside a tRPC response that
17376
+ * blocks the whole view.
17377
+ *
17378
+ * `sizeBytes` is carried because it is what lets a client decide between the
17379
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17380
+ */
17381
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17382
+ /**
17383
+ * The MACRO tier of an annotation — a CLOSED set.
17384
+ *
17385
+ * This is what the exported detector predicts, so a typo here is a new class
17386
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17387
+ * the whole point of the page is teaching the model things it does not know
17388
+ * yet, and constraining that vocabulary would make it useless.
17389
+ *
17390
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17391
+ * `subLabel` is one of these values, in any casing, because once `person`
17392
+ * exists in both tiers "every person box" stops being answerable without
17393
+ * knowing every string anyone ever typed — and the damage is retroactive.
17394
+ */
17395
+ var RetrainMacroClassSchema = _enum([
17396
+ "person",
17397
+ "vehicle",
17398
+ "animal",
17399
+ "package",
17400
+ "face",
17401
+ "plate"
17402
+ ]);
17403
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17404
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17405
+ /** Did a human draw this box, or did the assist propose it? */
17406
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17407
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17408
+ var RetrainBboxSchema = object({
17409
+ x: number(),
17410
+ y: number(),
17411
+ w: number(),
17412
+ h: number()
17413
+ });
17414
+ /**
17415
+ * One annotated subject.
17416
+ *
17417
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17418
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17419
+ * derived from it at export and never stored — storing them is how one feature
17420
+ * space ends up holding two crops of the same subject (D52).
17421
+ */
17422
+ var RetrainAnnotationSchema = object({
17423
+ id: string(),
17379
17424
  trackId: string(),
17380
- deviceId: number()
17381
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17382
- kind: "mutation",
17383
- auth: "admin"
17384
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17385
- kind: "mutation",
17386
- auth: "admin"
17387
- }), method(object({}), RebuildStatusSchema), object({
17388
- deviceId: number(),
17389
- timestamp: number(),
17390
- frameWidth: number(),
17391
- frameHeight: number(),
17392
- detections: array(OverlayDetectionSchema).readonly()
17393
- }), object({
17394
17425
  deviceId: number(),
17426
+ /** The COPY in retrain storage — never the source track's media key. */
17427
+ mediaKey: string(),
17428
+ bbox: RetrainBboxSchema,
17429
+ macroClass: RetrainMacroClassSchema,
17430
+ label: string().optional(),
17431
+ subLabel: string().optional(),
17432
+ kind: RetrainAnnotationKindSchema,
17433
+ source: RetrainAnnotationSourceSchema,
17434
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17435
+ assistModelId: string().optional(),
17436
+ assistScore: number().optional(),
17437
+ exportedInBatch: string().optional(),
17438
+ createdAt: number()
17439
+ });
17440
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17441
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17442
+ id: true,
17443
+ trackId: true,
17444
+ deviceId: true,
17445
+ mediaKey: true,
17446
+ createdAt: true,
17447
+ exportedInBatch: true
17448
+ });
17449
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17450
+ var RetrainTrackSchema = object({
17395
17451
  trackId: string(),
17396
- className: string()
17397
- }), object({
17398
17452
  deviceId: number(),
17399
- trackId: string(),
17400
17453
  className: string(),
17401
- durationMs: number()
17402
- }), object({
17454
+ label: string().optional(),
17455
+ firstSeen: number(),
17456
+ lastSeen: number(),
17457
+ /** How many frames the dataset already holds from this track. */
17458
+ frameCount: number().int(),
17459
+ /** How many subjects have been annotated on those frames. `0` with
17460
+ * `frameCount: 0` is exactly "staging, still to work". */
17461
+ annotationCount: number().int()
17462
+ });
17463
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17464
+ var RetrainFrameCandidateSchema = object({
17465
+ mediaKey: string(),
17466
+ kind: MediaFileKindEnum,
17467
+ timestamp: number(),
17468
+ sizeBytes: number().int(),
17469
+ /** A copy of this original already exists — selecting it is free and cannot
17470
+ * fail, whatever became of the original. */
17471
+ copied: boolean()
17472
+ });
17473
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17474
+ var RetrainFrameSchema = object({
17475
+ frameId: string(),
17403
17476
  deviceId: number(),
17404
- kind: EventKindSchema,
17405
- eventId: string(),
17406
- timestamp: number()
17477
+ trackId: string(),
17478
+ /** Provenance only. It may already point at nothing — that is expected. */
17479
+ sourceMediaKey: string(),
17480
+ sourceKind: MediaFileKindEnum,
17481
+ sizeBytes: number().int(),
17482
+ width: number().int(),
17483
+ height: number().int(),
17484
+ copiedAt: number()
17485
+ });
17486
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17487
+ var RetrainCopyRefusalSchema = _enum([
17488
+ "source-missing",
17489
+ "unreadable-image",
17490
+ "write-failed"
17491
+ ]);
17492
+ var RetrainFrameSelectionSchema = object({
17493
+ copied: array(RetrainFrameSchema).readonly(),
17494
+ refused: array(object({
17495
+ sourceMediaKey: string(),
17496
+ reason: RetrainCopyRefusalSchema
17497
+ })).readonly()
17407
17498
  });
17499
+ var RetrainFrameListSchema = object({
17500
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17501
+ copies: array(RetrainFrameSchema).readonly(),
17502
+ /** What the page pre-selects — the native key frame when one survives. */
17503
+ autoPickMediaKey: string().optional()
17504
+ });
17505
+ /** What the operator asked the assist to look for. */
17506
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17507
+ kind: literal("package"),
17508
+ zone: RetrainBboxSchema.optional()
17509
+ }), object({
17510
+ kind: literal("objects"),
17511
+ modelId: string(),
17512
+ minScore: number().optional()
17513
+ })]);
17408
17514
  /**
17409
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17410
- * within the frame, so the executor can re-cut a leaf child ROI at native
17411
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17515
+ * The assist's answer — a discriminated union, because "the model saw nothing"
17516
+ * and "this node cannot run that model" lead to different next moves and a
17517
+ * nullable result cannot tell them apart.
17412
17518
  */
17413
- var NativeCropRefSchema = object({
17414
- /** Handle keying the retained native surface (node-pinned to its owner). */
17415
- handle: FrameHandleSchema,
17416
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17417
- cropFrameSpace: object({
17418
- x: number(),
17419
- y: number(),
17420
- w: number(),
17421
- h: number()
17422
- })
17519
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17520
+ kind: literal("proposed"),
17521
+ modelId: string(),
17522
+ stepId: string(),
17523
+ minScore: number(),
17524
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17525
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17526
+ /** Returned by the runner but removed by the threshold. */
17527
+ belowThreshold: number().int()
17528
+ }), object({
17529
+ kind: literal("refused"),
17530
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17531
+ reason: string(),
17532
+ detail: string().optional()
17533
+ })]);
17534
+ /** The outcome of a lifecycle move owned by the retrain page. */
17535
+ var RetrainTransitionResultSchema = object({
17536
+ trackId: string(),
17537
+ /** Where the track ended up, whatever happened. */
17538
+ retrainStatus: RetrainStatusSchema,
17539
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17540
+ changed: boolean(),
17541
+ reason: _enum([
17542
+ "unknown-track",
17543
+ "no-frames-copied",
17544
+ "not-staging",
17545
+ "not-trained",
17546
+ "unchanged"
17547
+ ]).optional()
17423
17548
  });
17424
- object({
17425
- crop: object({
17426
- left: number(),
17427
- top: number(),
17428
- width: number().positive(),
17429
- height: number().positive()
17430
- }).optional(),
17431
- content: object({
17432
- width: number().int().positive(),
17433
- height: number().int().positive()
17434
- }),
17435
- fit: _enum(["stretch", "contain"]),
17436
- format: _enum([
17437
- "rgb",
17438
- "gray",
17439
- "jpeg"
17440
- ])
17549
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17550
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17551
+ var DeviceEventQueryInput = object({
17552
+ deviceId: number(),
17553
+ since: number().optional(),
17554
+ until: number().optional(),
17555
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17556
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17557
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17558
+ * exact behaviour. Callers may omit this field — the store defaults to
17559
+ * `full` when not provided. */
17560
+ projection: _enum(["full", "slim"]).optional()
17441
17561
  });
17442
- var FrameRefSchema = object({
17443
- registryId: string().min(1),
17444
- id: string().min(1),
17445
- width: number().int().positive(),
17446
- height: number().int().positive(),
17447
- format: _enum(["rgb", "gray"]),
17448
- timestamp: number(),
17449
- capturedAt: number().optional()
17562
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17563
+ var RecentTracksQueryInput = object({
17564
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17565
+ deviceIds: array(number()),
17566
+ /** Window lower bound on `lastSeen` (inclusive). */
17567
+ since: number().optional(),
17568
+ /** Window upper bound on `lastSeen` (inclusive). */
17569
+ until: number().optional(),
17570
+ /** Page size. Default 200, max 1000. */
17571
+ limit: number().int().min(1).max(1e3).default(200),
17572
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17573
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17574
+ cursor: string().optional(),
17575
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17576
+ projection: TrackProjectionSchema.optional(),
17577
+ /** Include stationary-promoted rows (parked objects). Default false: the
17578
+ * feed lists passages; parking records live on the stationary registry. */
17579
+ includeStationary: boolean().optional()
17450
17580
  });
17451
- var ModelFormatSchema$1 = _enum([
17452
- "onnx",
17453
- "coreml",
17454
- "openvino",
17455
- "tflite",
17456
- "pt",
17457
- "gguf"
17458
- ]);
17459
- var PipelineSlotSchema = _enum([
17460
- "detector",
17461
- "cropper",
17462
- "classifier",
17463
- "refiner",
17464
- "audio-classifier"
17465
- ]);
17466
- var PipelineEngineChoiceSchema = object({
17467
- runtime: _enum(["node", "python"]),
17468
- backend: string(),
17469
- format: ModelFormatSchema$1,
17470
- device: string().optional()
17581
+ var RecentTracksPageSchema = object({
17582
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17583
+ tracks: array(TrackSchema).readonly(),
17584
+ /** Cursor for the next page, or null when this page is the last. */
17585
+ nextCursor: string().nullable()
17586
+ });
17587
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17588
+ var LIST_GROUPS_MAX_LIMIT = 100;
17589
+ var AnalyticsGroupRecordSchema = object({
17590
+ id: string(),
17591
+ deviceId: number().int(),
17592
+ openedAt: number().int(),
17593
+ closedAt: number().int(),
17594
+ timestamp: number().int(),
17595
+ memberCount: number().int(),
17596
+ memberTrackIds: array(string()).readonly(),
17597
+ className: string(),
17598
+ classes: array(string()).readonly(),
17599
+ /** Relative event-media path, or null when the group has no picture yet. */
17600
+ mediaUrl: string().nullable(),
17601
+ singleton: boolean()
17471
17602
  });
17472
- var AvailableEngineSchema = object({
17473
- engine: PipelineEngineChoiceSchema,
17474
- devices: array(object({
17475
- id: string(),
17476
- label: string(),
17477
- description: string().optional()
17478
- })).readonly(),
17479
- defaultDevice: string()
17603
+ var AnalyticsGroupMemberSchema = object({
17604
+ trackId: string(),
17605
+ deviceId: number().int(),
17606
+ className: string(),
17607
+ firstSeen: number().int(),
17608
+ lastSeen: number().int(),
17609
+ mediaUrl: string().nullable()
17480
17610
  });
17481
- var PipelineDefaultStepSchema = lazy(() => object({
17482
- addonId: string(),
17483
- addonName: string(),
17484
- slot: PipelineSlotSchema,
17485
- inputClasses: array(string()).readonly(),
17486
- outputClasses: array(string()).readonly(),
17487
- enabled: boolean(),
17488
- modelId: string(),
17489
- children: array(PipelineDefaultStepSchema).readonly(),
17490
- group: string().optional(),
17491
- settings: record(string(), unknown()).optional()
17492
- }));
17493
- var PipelineTemplateStepSchema = lazy(() => object({
17494
- addonId: string(),
17495
- enabled: boolean(),
17496
- modelId: string(),
17497
- children: array(PipelineTemplateStepSchema).readonly(),
17498
- settings: record(string(), unknown()).optional()
17499
- }));
17500
- var PipelineTemplateSchema$1 = object({
17501
- id: string(),
17502
- name: string(),
17503
- createdAt: string(),
17504
- updatedAt: string(),
17505
- engine: PipelineEngineChoiceSchema,
17506
- steps: array(PipelineTemplateStepSchema).readonly()
17611
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17612
+ var ListGroupsQueryInput = object({
17613
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17614
+ deviceIds: array(number()),
17615
+ /** Window lower bound on `closedAt` (inclusive). */
17616
+ since: number().optional(),
17617
+ /** Window upper bound on `openedAt` (inclusive). */
17618
+ until: number().optional(),
17619
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17620
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17621
+ cursor: string().optional()
17507
17622
  });
17508
- var PipelineModelOptionSchema = object({
17509
- id: string(),
17510
- name: string(),
17511
- formats: record(string(), object({
17512
- downloaded: boolean(),
17513
- sizeMB: number()
17514
- })),
17515
- group: ModelVariantGroupSchema.optional(),
17516
- legacy: boolean().optional(),
17517
- provider: ModelProviderIdSchema.optional()
17623
+ var ListGroupsPageSchema = object({
17624
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17625
+ nextCursor: string().nullable()
17518
17626
  });
17519
- var ConfigFieldBridge = custom();
17520
- var PipelineAddonSchemaSchema = object({
17521
- id: string(),
17522
- name: string(),
17523
- slot: PipelineSlotSchema,
17524
- inputClasses: array(string()).readonly(),
17525
- outputClasses: array(string()).readonly(),
17526
- childSlots: array(PipelineSlotSchema).readonly(),
17527
- models: array(PipelineModelOptionSchema).readonly(),
17528
- defaultModelId: string(),
17529
- defaultModelIdByFormat: record(string(), string()).optional(),
17530
- enabledByDefault: boolean().optional(),
17531
- backfillIntoExistingOverrides: boolean().optional(),
17532
- defaultConfidence: number(),
17533
- group: string().optional(),
17534
- configSchema: array(ConfigFieldBridge).readonly().optional()
17627
+ var KeyEventQueryInput = object({
17628
+ deviceId: number(),
17629
+ /** Window lower bound (track firstSeen ≥ since). */
17630
+ since: number(),
17631
+ /** Window upper bound (track firstSeen ≤ until). */
17632
+ until: number(),
17633
+ limit: number().int().min(1).max(200).default(50),
17634
+ /** Drop tracks scoring below this importance. */
17635
+ minImportance: number().min(0).max(1).optional(),
17636
+ /** Restrict to a single class (e.g. 'person'). */
17637
+ classFilter: string().optional()
17535
17638
  });
17536
- var PipelineSlotSchemaSchema = object({
17537
- id: PipelineSlotSchema,
17538
- label: string(),
17539
- priority: number(),
17540
- parentSlot: PipelineSlotSchema.nullable(),
17541
- addons: array(PipelineAddonSchemaSchema).readonly()
17639
+ var KeyEventSchema = object({
17640
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17641
+ id: string(),
17642
+ trackId: string(),
17643
+ /** Track start time (firstSeen). */
17644
+ timestamp: number(),
17645
+ className: string(),
17646
+ ...TieredLabelFields,
17647
+ importance: number(),
17648
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17649
+ bestEventId: string(),
17650
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17651
+ windowMs: number().optional(),
17652
+ ...TrackFlagFields,
17653
+ ...TrackRetrainFields
17542
17654
  });
17543
- var PipelineSchemaSchema = object({
17544
- availableEngines: array(AvailableEngineSchema).readonly(),
17545
- selectedEngine: PipelineEngineChoiceSchema,
17546
- slots: array(PipelineSlotSchemaSchema).readonly()
17655
+ object({
17656
+ trackId: string(),
17657
+ className: string(),
17658
+ confidence: number(),
17659
+ bbox: BoundingBoxSchema,
17660
+ zones: array(string()).readonly(),
17661
+ state: TrackStateSchema
17547
17662
  });
17548
- var EngineProvisioningSchema = object({
17549
- runtimeId: _enum([
17550
- "onnx",
17551
- "openvino",
17552
- "coreml",
17553
- "edgetpu"
17554
- ]).nullable(),
17555
- device: string().nullable(),
17556
- state: _enum([
17557
- "idle",
17558
- "installing",
17559
- "verifying",
17560
- "ready",
17561
- "failed"
17562
- ]),
17563
- progress: number().optional(),
17564
- error: string().optional(),
17565
- nextRetryAt: number().optional(),
17566
- /**
17567
- * Gate A (config-correctness gate at engine change): human-readable
17568
- * config issues surfaced EAGERLY when the node's engine changes — model
17569
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17570
- * has a <format> build"). Additive/optional: informational only, never
17571
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17572
- * Absent/empty when the node-default tree resolves cleanly.
17573
- */
17574
- configIssues: array(string()).optional()
17663
+ var OverlayDetectionSchema = looseObject({
17664
+ id: string(),
17665
+ kind: _enum(["first-level", "detail"]),
17666
+ macroClass: string(),
17667
+ score: number(),
17668
+ bbox: object({
17669
+ x: number(),
17670
+ y: number(),
17671
+ width: number(),
17672
+ height: number()
17673
+ }),
17674
+ labels: array(looseObject({
17675
+ label: string(),
17676
+ score: number()
17677
+ })).readonly(),
17678
+ parentId: string().optional()
17575
17679
  });
17576
- var PipelineStepInputSchema = lazy(() => object({
17577
- addonId: string(),
17578
- modelId: string().optional(),
17579
- enabled: boolean().default(true),
17580
- children: array(PipelineStepInputSchema).optional(),
17581
- settings: record(string(), unknown()).optional(),
17582
- jumpDeviceKey: string().optional()
17583
- }));
17584
- var ModelSubstitutionSchema = object({
17585
- addonId: string(),
17586
- chosen: string(),
17587
- running: string(),
17588
- format: string()
17680
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17681
+ var SearchObjectEventsInput = object({
17682
+ text: string(),
17683
+ deviceId: number().optional(),
17684
+ since: number().optional(),
17685
+ until: number().optional(),
17686
+ classFilter: string().optional(),
17687
+ limit: number().default(50),
17688
+ minScore: number().min(0).max(1).default(.2)
17589
17689
  });
17590
- var PipelineValidationIssueSchema = object({
17591
- addonId: string(),
17592
- kind: _enum(["unknown-addon", "no-format-build"]),
17593
- detail: string()
17690
+ var TrackCascadeCountsSchema = object({
17691
+ /** Persisted track roots deleted (authoritative). */
17692
+ tracks: number().int(),
17693
+ /** Object events removed with their tracks (best-effort; see note above). */
17694
+ events: number().int(),
17695
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17696
+ media: number().int(),
17697
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
17698
+ faces: number().int(),
17699
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17700
+ plates: number().int(),
17701
+ /** Per-track CLIP search vectors removed (best-effort). */
17702
+ embeddings: number().int(),
17703
+ /** Group membership + group rows removed with their last member (best-effort). */
17704
+ groups: number().int()
17594
17705
  });
17595
- var PipelineValidationResultSchema = object({
17596
- ok: boolean(),
17597
- issues: array(PipelineValidationIssueSchema).readonly(),
17598
- substitutions: array(ModelSubstitutionSchema).readonly(),
17599
- /** The node's `currentEngine.format` this validation ran against. */
17600
- format: string()
17706
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17707
+ var DiskReconcileCountsSchema = object({
17708
+ mediaDropped: number().int(),
17709
+ tracks: number().int(),
17710
+ events: number().int()
17601
17711
  });
17602
- var ReferenceImageEntrySchema = object({
17603
- filename: string(),
17604
- stepIds: array(string()).readonly().optional()
17712
+ /** Event-store footprint for one camera. */
17713
+ var EventStoreDeviceFootprintSchema = object({
17714
+ deviceId: number(),
17715
+ /** Persisted event rows (motion + object + audio) for the camera. */
17716
+ rows: number().int(),
17717
+ /** Event-owned media bytes on disk for the camera. */
17718
+ bytes: number().int()
17605
17719
  });
17606
- var ReferenceImageBodySchema = object({
17607
- base64: string(),
17608
- filename: string()
17720
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17721
+ var EventStoreFootprintSchema = object({
17722
+ totalRows: number().int(),
17723
+ totalBytes: number().int(),
17724
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
17609
17725
  });
17610
- var ReferenceAudioEntrySchema = object({
17611
- filename: string(),
17612
- sizeKb: number()
17726
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
17727
+ var EventPruneCountsSchema = object({
17728
+ motion: number().int(),
17729
+ object: number().int(),
17730
+ audio: number().int()
17613
17731
  });
17614
- var ReferenceAudioBodySchema = object({ base64: string() });
17615
- var AudioBackendSchema = object({
17616
- id: string(),
17617
- name: string(),
17618
- description: string(),
17619
- available: boolean(),
17732
+ /**
17733
+ * Re-embed stored tracks from their key frames.
17734
+ *
17735
+ * The reason this is an operator-callable method and not a migration script:
17736
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
17737
+ * squaring — is only changeable if the existing vectors can be regenerated.
17738
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
17739
+ * symptom is a quality regression with no visible cause.
17740
+ */
17741
+ var RebuildObjectEmbeddingsInput = object({
17742
+ /** Restrict to one camera. Omit for the whole fleet. */
17743
+ deviceId: number().optional(),
17744
+ since: number().optional(),
17745
+ until: number().optional(),
17746
+ /** Stop after this many tracks; the result reports whether more remain. */
17747
+ maxTracks: number().int().positive().optional(),
17620
17748
  /**
17621
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17622
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17623
- * the benchmark UI to populate the `enabledMicroClasses` filter
17624
- * specific to the selected backend without a separate fetch.
17749
+ * Run every embedding on THIS node instead of round-robining the fleet.
17750
+ *
17751
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17752
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17753
+ * calling it that would pin the rebuild REQUEST itself to that node — the
17754
+ * rebuild orchestration lives on the hub, and only the per-track step runs
17755
+ * remotely. This field is data; the per-track pin is applied inside.
17756
+ *
17757
+ * Absent ⇒ round-robin over every online node whose runner can serve the
17758
+ * pinned model.
17625
17759
  */
17626
- rawLabels: array(string()).readonly().optional()
17627
- });
17628
- var AudioCapabilitiesSchema = object({
17629
- activeBackend: string(),
17630
- availableBackends: array(AudioBackendSchema).readonly(),
17631
- sampleRate: number(),
17632
- chunkDurationMs: number()
17633
- });
17634
- var DownloadModelResultSchema = object({
17635
- filePath: string(),
17636
- sizeMB: number(),
17637
- durationMs: number()
17760
+ executeOnNodeId: string().optional(),
17761
+ /**
17762
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17763
+ * run flat out.
17764
+ *
17765
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
17766
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17767
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17768
+ * force is logged at start and finish so a deliberately slow pass reads
17769
+ * differently from a stalled one.
17770
+ */
17771
+ pacingMs: number().int().nonnegative().optional()
17638
17772
  });
17639
17773
  /**
17640
- * Wrapper carrying a single test run's result. Replaces the legacy
17641
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17642
- * canonical `AudioResult` from the Phase 6 output rework: one
17643
- * `AudioDetection` per class above `minScore`, top-N candidates in
17644
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17645
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17646
- * benchmark UI can still report a clean failure when the classifier
17647
- * cap isn't available.
17774
+ * Result of emptying the CLIP index.
17775
+ *
17776
+ * The clean slate before a policy change: a new crop margin or encoder model
17777
+ * leaves two feature spaces in one index whose cosine scores are not
17778
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
17779
+ * means the same thing.
17648
17780
  */
17649
- var AudioTestResultSchema = object({
17650
- success: boolean(),
17651
- error: string().optional(),
17652
- frame: custom().optional()
17781
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17782
+ /**
17783
+ * Acknowledgement that a rebuild STARTED.
17784
+ *
17785
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17786
+ * runs detached and this returns immediately. Waiting for it made the client
17787
+ * time out while the work carried on server-side, which is the worst of both:
17788
+ * no result and no way to know it was still going. Poll
17789
+ * `getObjectEmbeddingRebuildStatus` for progress.
17790
+ */
17791
+ var RebuildObjectEmbeddingsResultSchema = object({
17792
+ started: boolean(),
17793
+ /** True when a pass was already running; the new request is ignored. */
17794
+ alreadyRunning: boolean()
17653
17795
  });
17654
- var PipelineConfigBridge = custom();
17655
- var ConfigUISchemaBridge = custom();
17656
- var ConfigUISchemaNullableBridge = custom();
17657
- var InferenceCapabilitiesBridge = custom();
17658
- var ModelAvailabilityListBridge = custom();
17659
- var PipelineRunResultBridge = custom();
17660
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17661
- modelId: string(),
17662
- settings: record(string(), unknown()).readonly()
17663
- }))), method(object({ steps: record(string(), object({
17664
- modelId: string(),
17665
- settings: record(string(), unknown()).readonly()
17666
- })) }), object({ success: literal(true) }), {
17796
+ var RebuildStatusSchema = object({
17797
+ running: boolean(),
17798
+ scanned: number(),
17799
+ rebuilt: number(),
17800
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
17801
+ missingKeyFrame: number(),
17802
+ /** Tracks with no usable detection box. */
17803
+ missingBbox: number(),
17804
+ /**
17805
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
17806
+ * frame, a step that threw. Separate from `failed` because the remedy is
17807
+ * different, and because a whole camera silently contributing zero vectors
17808
+ * is the shape of failure a rebuild must never hide.
17809
+ */
17810
+ notRunnable: number(),
17811
+ /**
17812
+ * The pass stopped because NO node could serve the pinned model.
17813
+ *
17814
+ * Distinct from `notRunnable` on purpose: that one says "this track was
17815
+ * refused", this one says "the cluster cannot do this work at all" — every
17816
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
17817
+ * pinned model for its engine format, or dropped out. The remedy is a model /
17818
+ * engine change, not a per-camera one. Non-zero here always comes with
17819
+ * `complete: false`.
17820
+ */
17821
+ noCapableNode: number(),
17822
+ failed: number(),
17823
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
17824
+ complete: boolean().nullable(),
17825
+ startedAtMs: number().nullable(),
17826
+ finishedAtMs: number().nullable(),
17827
+ /** Present when the pass ended by throwing. */
17828
+ error: string().nullable()
17829
+ });
17830
+ var ReplayFrameInputSchema = object({
17831
+ timestamp: number(),
17832
+ frame: PipelineRunResultBridge
17833
+ });
17834
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
17835
+ className: string(),
17836
+ firstSeenMs: number(),
17837
+ lastSeenMs: number(),
17838
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
17839
+ * frame — a representative box for the diff's `(className, window, IoU)`
17840
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
17841
+ * trajectory production's `Track.positions` keeps. */
17842
+ bbox: BoundingBoxSchema,
17843
+ /** How many of the input frames this track matched a real detection on
17844
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
17845
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
17846
+ framesMatched: number().int()
17847
+ })).readonly() });
17848
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17849
+ deviceId: number(),
17850
+ trackId: string()
17851
+ }), TrackSchema.nullable()), method(object({
17852
+ deviceId: number(),
17853
+ since: number().optional(),
17854
+ until: number().optional(),
17855
+ limit: number().optional(),
17856
+ /** Spatial filter — only tracks whose trajectory intersects the zone
17857
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17858
+ * envelope columns, then precisely tested per position. Tracks with
17859
+ * an unknown envelope (no frame dims at persist time) always match. */
17860
+ zone: TrackZoneFilterSchema.optional(),
17861
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
17862
+ * compatible — omitting the field keeps today's exact behaviour). */
17863
+ projection: TrackProjectionSchema.optional(),
17864
+ /** Include stationary-promoted rows (parked objects handed to the
17865
+ * stationary registry). Default false: the timeline lists passages,
17866
+ * not parking records (operator decision, 2026-08-15). */
17867
+ includeStationary: boolean().optional()
17868
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17869
+ deviceId: number(),
17870
+ groupId: string().min(1)
17871
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17872
+ kind: "mutation",
17873
+ auth: "admin"
17874
+ }), 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({
17875
+ deviceId: number(),
17876
+ since: number().optional(),
17877
+ until: number().optional(),
17878
+ kinds: array(string()).optional(),
17879
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17880
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17881
+ deviceId: number(),
17882
+ since: number(),
17883
+ until: number(),
17884
+ bucketMs: number().int().positive()
17885
+ }), array(object({
17886
+ bucketStart: number(),
17887
+ motion: number().int(),
17888
+ object: number().int(),
17889
+ audio: number().int()
17890
+ })).readonly()), method(object({
17891
+ deviceId: number(),
17892
+ cutoffMs: number()
17893
+ }), object({
17894
+ motion: number().int(),
17895
+ object: number().int(),
17896
+ audio: number().int()
17897
+ }), {
17898
+ kind: "mutation",
17899
+ auth: "admin"
17900
+ }), method(object({
17901
+ deviceId: number(),
17902
+ cutoffMs: number()
17903
+ }), TrackCascadeCountsSchema, {
17904
+ kind: "mutation",
17905
+ auth: "admin"
17906
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17907
+ kind: "mutation",
17908
+ auth: "admin"
17909
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17910
+ kind: "mutation",
17911
+ auth: "admin"
17912
+ }), method(object({
17913
+ deviceId: number(),
17914
+ trackIds: array(string()).min(1)
17915
+ }), object({
17916
+ deleted: number().int(),
17917
+ failed: array(string()).readonly()
17918
+ }), {
17919
+ kind: "mutation",
17920
+ auth: "admin"
17921
+ }), method(object({
17922
+ /** Log/audit scope only — the trackId is globally unique on its own. */
17923
+ deviceId: number(),
17924
+ trackId: string(),
17925
+ flags: TrackFlagsPatchSchema
17926
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17927
+ kind: "query",
17928
+ auth: "admin"
17929
+ }), method(object({
17930
+ olderThanMs: number(),
17931
+ reason: OpsLogReasonSchema.optional()
17932
+ }), EventPruneCountsSchema, {
17933
+ kind: "mutation",
17934
+ auth: "admin"
17935
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17936
+ kind: "mutation",
17937
+ auth: "admin"
17938
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17939
+ kind: "mutation",
17940
+ auth: "admin"
17941
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17942
+ kind: "mutation",
17943
+ auth: "admin"
17944
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17945
+ kind: "mutation",
17946
+ auth: "admin"
17947
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17948
+ kind: "mutation",
17949
+ auth: "admin"
17950
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17951
+ kind: "mutation",
17952
+ auth: "admin"
17953
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
17954
+ kind: "mutation",
17955
+ auth: "admin"
17956
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
17957
+ kind: "query",
17958
+ auth: "admin"
17959
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17960
+ kind: "mutation",
17961
+ auth: "admin"
17962
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17963
+ kind: "query",
17964
+ auth: "admin"
17965
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17966
+ kind: "query",
17967
+ auth: "admin"
17968
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17969
+ kind: "query",
17970
+ auth: "admin"
17971
+ }), method(object({
17972
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17973
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
17974
+ * route it at one camera's owner, and "every camera" would stop being
17975
+ * expressible at all. */
17976
+ deviceIds: array(number()).optional(),
17977
+ limit: number().int().min(1).max(500).optional()
17978
+ }), array(RetrainTrackSchema).readonly(), {
17979
+ kind: "query",
17980
+ auth: "admin"
17981
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17982
+ kind: "query",
17983
+ auth: "admin"
17984
+ }), method(object({
17985
+ deviceId: number(),
17986
+ trackId: string(),
17987
+ mediaKeys: array(string()).min(1)
17988
+ }), RetrainFrameSelectionSchema, {
17667
17989
  kind: "mutation",
17668
17990
  auth: "admin"
17669
- }), method(object({ nodeId: string() }), object({
17670
- success: literal(true),
17671
- clearedDevices: number()
17991
+ }), method(object({
17992
+ deviceId: number(),
17993
+ trackId: string(),
17994
+ frameId: string()
17995
+ }), object({
17996
+ removed: boolean(),
17997
+ removedAnnotations: number().int()
17672
17998
  }), {
17673
17999
  kind: "mutation",
17674
18000
  auth: "admin"
17675
- }), 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({
17676
- name: string(),
17677
- steps: array(PipelineTemplateStepSchema).readonly(),
17678
- engine: PipelineEngineChoiceSchema
17679
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17680
- id: string(),
17681
- name: string().optional(),
17682
- steps: array(PipelineTemplateStepSchema).readonly().optional()
17683
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17684
- addonId: string(),
17685
- modelId: string(),
17686
- format: ModelFormatSchema$1
17687
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17688
- addonId: string(),
17689
- modelId: string(),
17690
- format: ModelFormatSchema$1
17691
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17692
- engine: PipelineEngineChoiceSchema.optional(),
17693
- steps: array(PipelineStepInputSchema).min(1),
17694
- frame: FrameInputSchema.optional(),
17695
- /**
17696
- * Process-local lazy frame. Valid only when caller and provider resolve
17697
- * in the same execution-group process; split/cross-node callers use
17698
- * `frame`/`image` inline compatibility instead.
17699
- */
17700
- frameRef: FrameRefSchema.optional(),
17701
- /**
17702
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
17703
- * the decoded pixels live in. One more member of the one-of
17704
- * frame/frameHandle/image/imageBase64/referenceImage group.
17705
- */
17706
- frameHandle: FrameHandleSchema.optional(),
17707
- imageBase64: string().optional(),
17708
- /**
17709
- * Binary JPEG bytes — preferred over `imageBase64` on internal
17710
- * hops (hub → forked worker via Moleculer MsgPack) because it
17711
- * skips the 33% base64 overhead + the per-call base64 decode on
17712
- * the detection-pipeline worker. Callers can pass either; exactly
17713
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17714
- */
17715
- image: _instanceof(Uint8Array).optional(),
17716
- referenceImage: string().optional(),
17717
- deviceId: number().optional(),
17718
- sessionId: string().optional(),
17719
- /**
17720
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
17721
- * reference-image, and detail-subtree calls. 'frame' is the live
17722
- * per-frame dispatch: ONLY root-plane steps run; crop children
17723
- * (inputClasses ≠ null) are skipped and served per-track via
17724
- * pipelineRunner.runDetailSubtree (two-plane design).
17725
- */
17726
- plane: _enum(["full", "frame"]).optional(),
17727
- /**
17728
- * Inference-device selector (Phase 2 multi-device). Format
17729
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17730
- * Omitted ⇒ the runner's default device (current single-engine
17731
- * behaviour). Selects WHICH device pool of the node runs the call.
17732
- */
17733
- deviceKey: string().optional(),
17734
- /**
17735
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17736
- * when the parent crop was resolved from the frame's retained NATIVE
17737
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17738
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17739
- * resolution from that surface — the SAME quality path faces already
17740
- * had — instead of the downscaled parent tile. `handle` keys the native
17741
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17742
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17743
- * the executor's crop-normalized child ROI back into frame-normalized
17744
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17745
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17746
- * (today's behaviour on the fallback path).
17747
- */
17748
- nativeCropRef: NativeCropRefSchema.optional()
17749
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17750
- engine: PipelineEngineChoiceSchema.optional(),
17751
- steps: array(PipelineStepInputSchema).min(1),
17752
- frames: array(FrameInputSchema).min(1).max(255),
17753
- deviceId: number().optional(),
17754
- sessionId: string().optional(),
17755
- /**
17756
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17757
- * the batch to the Python pool's bench preprocess cache
17758
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17759
- * preprocessed ONCE and every later inference is a pure-inference cache
17760
- * hit — the sustained-throughput run measures inference, not
17761
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
17762
- * full preprocess every call, correct). Fresh per sustained run;
17763
- * released via `uncacheFrame`.
17764
- */
17765
- frameId: number().int().nonnegative().optional(),
17766
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17767
- deviceKey: string().optional()
17768
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17769
- data: _instanceof(Uint8Array),
17770
- width: number().int().positive(),
17771
- height: number().int().positive(),
17772
- format: _enum([
17773
- "rgb",
17774
- "bgr",
17775
- "gray"
17776
- ])
17777
- }), object({
17778
- frameId: number(),
17779
- width: number(),
17780
- height: number()
17781
- }), { kind: "mutation" }), method(object({
17782
- stepId: string(),
17783
- frameId: number().int()
17784
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17785
- batchMode: string(),
17786
- windowMs: number(),
17787
- maxBatchSize: number(),
17788
- concurrency: number()
17789
- })), method(_void(), array(object({
17790
- engineKey: string(),
17791
- engine: PipelineEngineChoiceSchema,
17792
- modelsLoaded: array(string()).readonly(),
17793
- inUseByCameras: array(number()).readonly(),
17794
- /**
17795
- * Origin of this resident factory.
17796
- * - `runtime` — main camera-serving engine (no idle TTL).
17797
- * - `warm-override` — benchmark/test override held in the warm
17798
- * cache; auto-disposed after the idle TTL.
17799
- * - `device-pool` — a concurrent per-device pool (Phase 2
17800
- * multi-device, keyed by `deviceKey`) resolved
17801
- * via `resolveDeviceFactory`. Runs alongside the
17802
- * `runtime` engine on a DIFFERENT accelerator
17803
- * (NPU / iGPU / Coral) — this is how the
17804
- * Engines tab shows all pools running at once.
17805
- */
17806
- kind: _enum([
17807
- "runtime",
17808
- "warm-override",
17809
- "device-pool"
17810
- ]),
17811
- /** Native pid of the underlying Python pool (null when no pool). */
17812
- poolPid: number().nullable(),
17813
- /** ms since this factory was last used (null when not warm-tracked). */
17814
- idleMs: number().nullable(),
17815
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17816
- idleTtlMs: number().nullable()
17817
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
18001
+ }), method(object({ frameId: string() }), object({
18002
+ base64: string(),
18003
+ width: number().int(),
18004
+ height: number().int()
18005
+ }), {
18006
+ kind: "query",
18007
+ auth: "admin"
18008
+ }), method(object({
18009
+ deviceId: number(),
18010
+ trackId: string(),
18011
+ frameId: string(),
18012
+ subject: RetrainAssistSubjectSchema,
18013
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18014
+ nodeId: string().optional()
18015
+ }), RetrainAssistResultSchema, {
17818
18016
  kind: "mutation",
17819
18017
  auth: "admin"
17820
18018
  }), method(object({
17821
- engine: PipelineEngineChoiceSchema,
17822
- force: boolean().optional()
17823
- }), object({
17824
- success: boolean(),
17825
- reason: string().optional()
17826
- }), {
18019
+ deviceId: number(),
18020
+ source: DetectionSourceSchema,
18021
+ zones: array(ZoneSchema).readonly().optional(),
18022
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
18023
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
18024
+ frames: array(ReplayFrameInputSchema).min(1)
18025
+ }), RunReplayFrameProcessorResultSchema, {
17827
18026
  kind: "mutation",
17828
18027
  auth: "admin"
17829
- }), 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({
17830
- addonId: string(),
17831
- modelId: string(),
17832
- filename: string().optional(),
17833
- settings: record(string(), unknown()).optional()
17834
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
18028
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
18029
+ kind: "query",
18030
+ auth: "admin"
18031
+ }), method(object({
18032
+ deviceId: number(),
18033
+ trackId: string(),
18034
+ frameId: string(),
18035
+ annotations: array(RetrainAnnotationDraftSchema)
18036
+ }), array(RetrainAnnotationSchema).readonly(), {
18037
+ kind: "mutation",
18038
+ auth: "admin"
18039
+ }), method(object({
18040
+ deviceId: number(),
18041
+ trackId: string()
18042
+ }), RetrainTransitionResultSchema, {
18043
+ kind: "mutation",
18044
+ auth: "admin"
18045
+ }), method(object({
18046
+ deviceId: number(),
18047
+ trackId: string()
18048
+ }), RetrainTransitionResultSchema, {
18049
+ kind: "mutation",
18050
+ auth: "admin"
18051
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18052
+ kind: "query",
18053
+ auth: "admin"
18054
+ }), method(object({
18055
+ eventId: string(),
18056
+ kind: MediaFileKindEnum.optional(),
18057
+ deviceId: number()
18058
+ }), array(MediaFileSchema).readonly()), method(object({
18059
+ trackId: string(),
18060
+ kinds: array(MediaFileKindEnum).optional(),
18061
+ deviceId: number()
18062
+ }), array(MediaFileSchema).readonly()), method(object({
18063
+ trackId: string(),
18064
+ deviceId: number()
18065
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18066
+ kind: "mutation",
18067
+ auth: "admin"
18068
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18069
+ kind: "mutation",
18070
+ auth: "admin"
18071
+ }), method(object({}), RebuildStatusSchema), object({
18072
+ deviceId: number(),
18073
+ timestamp: number(),
18074
+ frameWidth: number(),
18075
+ frameHeight: number(),
18076
+ detections: array(OverlayDetectionSchema).readonly()
18077
+ }), object({
18078
+ deviceId: number(),
18079
+ trackId: string(),
18080
+ className: string()
18081
+ }), object({
18082
+ deviceId: number(),
18083
+ trackId: string(),
18084
+ className: string(),
18085
+ durationMs: number()
18086
+ }), object({
18087
+ deviceId: number(),
18088
+ kind: EventKindSchema,
18089
+ eventId: string(),
18090
+ timestamp: number()
18091
+ });
17835
18092
  object({
17836
18093
  activeCameras: number(),
17837
18094
  throttledCameras: number(),
@@ -17857,66 +18114,6 @@ var CameraMetricsSchema = object({
17857
18114
  });
17858
18115
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
17859
18116
  /**
17860
- * Zone — pure geometry + identity. NO filtering behaviour.
17861
- *
17862
- * Zones describe **where** in the frame the operator wants to flag
17863
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
17864
- * each pipeline stage uses them. Splitting the two means a single
17865
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
17866
- * a detection-include rule on `['car']`, and an occupancy aggregate
17867
- * — without three duplicated polygons.
17868
- *
17869
- * Owned by the orchestrator addon (provider) and mirrored into the
17870
- * `zones` device-state slice on every mutation. Consumers
17871
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
17872
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
17873
- * mirror with `onChanged`).
17874
- *
17875
- * Coordinates are normalised fractions of the frame (0–1) so zones
17876
- * survive resolution changes and stream profile switches.
17877
- *
17878
- * `kind` discriminates between full polygons (closed regions used
17879
- * for intrusion / occupancy filters) and tripwires (open 2-point
17880
- * line segments used for cross events). Onboard / firmware-reported
17881
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17882
- * task list.
17883
- */
17884
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
17885
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17886
- var PolygonPointSchema = object({
17887
- x: number(),
17888
- y: number()
17889
- });
17890
- /** A camera detection zone — pure geometry/identity. */
17891
- var ZoneSchema = object({
17892
- id: string(),
17893
- name: string(),
17894
- kind: ZoneKindEnum.default("polygon"),
17895
- /** Polygon vertices, fraction of frame (0–1). */
17896
- polygon: array(PolygonPointSchema).readonly(),
17897
- /** Visual color for UI rendering. */
17898
- color: string().default("#3b82f6")
17899
- });
17900
- DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
17901
- deviceId: number(),
17902
- zone: ZoneSchema
17903
- }), _void(), {
17904
- kind: "mutation",
17905
- auth: "admin"
17906
- }), method(object({
17907
- deviceId: number(),
17908
- zoneId: string()
17909
- }), _void(), {
17910
- kind: "mutation",
17911
- auth: "admin"
17912
- }), method(object({
17913
- deviceId: number(),
17914
- zone: ZoneSchema
17915
- }), _void(), {
17916
- kind: "mutation",
17917
- auth: "admin"
17918
- }), object({ zones: array(ZoneSchema).readonly() });
17919
- /**
17920
18117
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
17921
18118
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
17922
18119
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -19604,7 +19801,7 @@ method(object({
19604
19801
  * linking rather than produce an eternal token.
19605
19802
  */
19606
19803
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19607
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
19804
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19608
19805
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19609
19806
  providerId: string().min(1),
19610
19807
  displayName: string().min(1),
@@ -19699,10 +19896,13 @@ var EvictResultSchema = object({
19699
19896
  /** True when the provider has nothing left it is willing to drop on this location. */
19700
19897
  exhausted: boolean()
19701
19898
  });
19702
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
19899
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19703
19900
  locationId: string(),
19704
19901
  targetBytes: number().int().positive()
19705
- }), EvictResultSchema, { kind: "mutation" });
19902
+ }), EvictResultSchema, {
19903
+ kind: "mutation",
19904
+ auth: "admin"
19905
+ });
19706
19906
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19707
19907
  kind: "mutation",
19708
19908
  auth: "admin"
@@ -19762,26 +19962,50 @@ var ReadChunkInputSchema = object({
19762
19962
  length: number()
19763
19963
  });
19764
19964
  var EndDownloadInputSchema = object({ downloadId: string() });
19765
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19965
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19766
19966
  location: StorageLocationSchema,
19767
19967
  relativePath: string()
19768
- }), string()), method(object({
19968
+ }), string(), { auth: "admin" }), method(object({
19769
19969
  location: StorageLocationSchema,
19770
19970
  relativePath: string(),
19771
19971
  data: _instanceof(Uint8Array)
19772
- }), _void(), { kind: "mutation" }), method(object({
19972
+ }), _void(), {
19973
+ kind: "mutation",
19974
+ auth: "admin"
19975
+ }), method(object({
19773
19976
  location: StorageLocationSchema,
19774
19977
  relativePath: string()
19775
- }), _instanceof(Uint8Array)), method(object({
19978
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19776
19979
  location: StorageLocationSchema,
19777
19980
  relativePath: string()
19778
- }), boolean()), method(object({
19981
+ }), boolean(), { auth: "admin" }), method(object({
19779
19982
  location: StorageLocationSchema,
19780
19983
  prefix: string().optional()
19781
- }), array(string()).readonly()), method(object({
19984
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19782
19985
  location: StorageLocationSchema,
19783
19986
  relativePath: string()
19784
- }), _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" });
19987
+ }), _void(), {
19988
+ kind: "mutation",
19989
+ auth: "admin"
19990
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
19991
+ kind: "mutation",
19992
+ auth: "admin"
19993
+ }), method(WriteChunkInputSchema, _void(), {
19994
+ kind: "mutation",
19995
+ auth: "admin"
19996
+ }), method(FinalizeUploadInputSchema, _void(), {
19997
+ kind: "mutation",
19998
+ auth: "admin"
19999
+ }), method(AbortUploadInputSchema, _void(), {
20000
+ kind: "mutation",
20001
+ auth: "admin"
20002
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
20003
+ kind: "mutation",
20004
+ auth: "admin"
20005
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
20006
+ kind: "mutation",
20007
+ auth: "admin"
20008
+ });
19785
20009
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19786
20010
  var ProfileSettingsSchemaBridge = unknown().nullable();
19787
20011
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -20039,7 +20263,8 @@ method(object({
20039
20263
  access: "create"
20040
20264
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
20041
20265
  kind: "mutation",
20042
- access: "view"
20266
+ access: "view",
20267
+ auth: "admin"
20043
20268
  }), method(object({
20044
20269
  /** Required — the user the assertion belongs to (verified). */
20045
20270
  userId: string(),
@@ -20047,10 +20272,12 @@ method(object({
20047
20272
  response: record(string(), unknown())
20048
20273
  }), object({ verified: boolean() }), {
20049
20274
  kind: "mutation",
20050
- access: "view"
20275
+ access: "view",
20276
+ auth: "admin"
20051
20277
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
20052
20278
  kind: "mutation",
20053
- access: "view"
20279
+ access: "view",
20280
+ auth: "admin"
20054
20281
  }), method(object({
20055
20282
  /** AuthenticationResponseJSON from the browser. */
20056
20283
  response: record(string(), unknown()) }), object({
@@ -20058,7 +20285,8 @@ response: record(string(), unknown()) }), object({
20058
20285
  userId: string().nullable()
20059
20286
  }), {
20060
20287
  kind: "mutation",
20061
- access: "view"
20288
+ access: "view",
20289
+ auth: "admin"
20062
20290
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
20063
20291
  userId: string(),
20064
20292
  credentialId: string()
@@ -20230,7 +20458,19 @@ var VectorStatsResultSchema = object({
20230
20458
  /** False when the backend ranks approximately. */
20231
20459
  exact: boolean()
20232
20460
  });
20233
- 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);
20461
+ method(VectorDeclareIndexInputSchema, _void(), {
20462
+ kind: "mutation",
20463
+ auth: "admin"
20464
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20465
+ kind: "mutation",
20466
+ auth: "admin"
20467
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20468
+ kind: "mutation",
20469
+ auth: "admin"
20470
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20471
+ kind: "mutation",
20472
+ auth: "admin"
20473
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20234
20474
  var ClipSchema = object({
20235
20475
  /** Opaque, provider-namespaced id. The default provider encodes the time
20236
20476
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -21953,7 +22193,27 @@ var MediaFileLiteSchema$1 = object({
21953
22193
  sizeBytes: number(),
21954
22194
  timestamp: number()
21955
22195
  });
21956
- method(_void(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22196
+ method(object({
22197
+ /**
22198
+ * Inline {@link IdentitySchema.coverBase64} on every row.
22199
+ *
22200
+ * Default `false`, the same inversion `listRecentFaces` and
22201
+ * `listPlates` took on 2026-08-25 (see `include-crops-default.ts` for
22202
+ * why the burden belongs on the caller that WANTS the bytes). Measured
22203
+ * on the live hub the same day: four identities cost 40,979 B with the
22204
+ * covers inline, ~10 KB of base64 per row, on a query this UI mounts
22205
+ * four times and the viewer holds at `staleTime: 30_000`.
22206
+ *
22207
+ * Nothing loses its avatar: `coverMediaKey` is already on every row and
22208
+ * the `event-media` plane serves that key `immutable` with an ETag.
22209
+ *
22210
+ * **This is an INPUT field, so it does not reach the addon until the
22211
+ * next train** — the hub router validates cap inputs against its own
22212
+ * compiled Zod and strips a key it does not know. Until then the
22213
+ * provider sees `undefined`, which resolves to `false`: the cheap shape
22214
+ * is what ships, and the opt-in becomes reachable when the train lands.
22215
+ */
22216
+ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
21957
22217
  kind: "mutation",
21958
22218
  auth: "admin"
21959
22219
  }), method(object({
@@ -24100,8 +24360,10 @@ var PlateInfoSchema = object({
24100
24360
  keyFrameMediaKey: string().optional(),
24101
24361
  base64: string().optional(),
24102
24362
  /**
24103
- * Same crop as a data-plane URL. `getPlateByTrack` returns this and
24104
- * never inlines JPEG; `listPlates` still inlines for the admin-ui.
24363
+ * Same crop as a data-plane URL, always present when the plate has a stored
24364
+ * crop. `getPlateByTrack` returns this and never inlines JPEG; `listPlates`
24365
+ * and `searchPlates` inline the crop only when their `includeCrops` input is
24366
+ * left at its `true` default.
24105
24367
  */
24106
24368
  cropUrl: string().optional()
24107
24369
  });
@@ -24121,14 +24383,34 @@ var PlateClusterSchema = object({
24121
24383
  });
24122
24384
  method(object({
24123
24385
  deviceId: number().int().optional(),
24124
- limit: number().int().positive().optional()
24386
+ limit: number().int().positive().optional(),
24387
+ /**
24388
+ * Inline the base64 crop on every row. Default `true` — the existing
24389
+ * behaviour, kept so no caller breaks.
24390
+ *
24391
+ * Set `false` once the caller renders {@link PlateInfo.cropUrl}.
24392
+ * Measured on the live hub at the 500 rows the Plates view asks for:
24393
+ * 879,403 B and 27.7 s with the crops inline, against a few KiB of
24394
+ * metadata without them — and the browser then caches the images.
24395
+ *
24396
+ * This is the plate twin of `faceGallery.listRecentFaces`'s option;
24397
+ * plates were the one gallery list left without it.
24398
+ *
24399
+ * **This is an INPUT field, so it does not reach the addon until the
24400
+ * next train.** The hub router validates cap inputs against its own
24401
+ * compiled Zod and strips a key it does not know. Until the train
24402
+ * ships, sending `false` is harmless and keeps the crops inline.
24403
+ */
24404
+ includeCrops: boolean().optional()
24125
24405
  }).optional(), array(PlateInfoSchema).readonly()), method(object({
24126
24406
  deviceId: number().int(),
24127
24407
  trackId: string()
24128
24408
  }), PlateInfoSchema.nullable()), method(object({ plateId: string() }), array(MediaFileLiteSchema).readonly()), method(object({
24129
24409
  text: string().min(1),
24130
24410
  maxDistance: number().int().min(0).optional(),
24131
- limit: number().int().positive().optional()
24411
+ limit: number().int().positive().optional(),
24412
+ /** See `listPlates.includeCrops`. Default `true`. */
24413
+ includeCrops: boolean().optional()
24132
24414
  }), array(PlateInfoSchema).readonly()), method(object({
24133
24415
  maxDistance: number().int().min(0).optional(),
24134
24416
  minClusterSize: number().int().min(2).optional(),
@@ -24142,7 +24424,13 @@ method(object({
24142
24424
  }), method(object({ plateId: string() }), _void(), {
24143
24425
  kind: "mutation",
24144
24426
  auth: "admin"
24145
- }), method(_void(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24427
+ }), method(object({
24428
+ /** Inline {@link VehicleSchema.coverBase64} on every row. Default
24429
+ * `false` — the vehicle twin of `faceGallery.listIdentities`'s
24430
+ * option; `coverMediaKey` + the `event-media` plane carry the picture.
24431
+ * INPUT field: stripped by the hub router until the train ships, which
24432
+ * resolves to `false` and is exactly the intended default. */
24433
+ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24146
24434
  kind: "mutation",
24147
24435
  auth: "admin"
24148
24436
  }), method(object({
@@ -25407,92 +25695,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
25407
25695
  kind: "mutation",
25408
25696
  auth: "admin"
25409
25697
  });
25410
- /**
25411
- * Per-stage gating mode applied to the zones a rule references.
25412
- *
25413
- * - `include`: the rule contributes to a **whitelist** for its stage.
25414
- * When at least one `include` rule fires for a stage, only entities
25415
- * inside one of those zones pass that stage.
25416
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
25417
- * Entities inside one of those zones are dropped at that stage.
25418
- *
25419
- * `monitor`-style observation (count without filtering) is not a rule
25420
- * mode — zones without any matching rule are observed naturally by
25421
- * `zone-analytics` (live snapshot + history), so an "I just want to
25422
- * count, not filter" use case needs no rule at all.
25423
- */
25424
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
25425
- /**
25426
- * Per-consumer rule that references existing zones (geometry) and
25427
- * defines how a specific pipeline stage should treat them. Each
25428
- * consumer addon owns its own `ZoneRule[]` array in its per-device
25429
- * settings:
25430
- *
25431
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
25432
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
25433
- * - future: notification rules, audio gating, etc.
25434
- *
25435
- * One rule applies to N zones (`zoneIds[]`) so the operator can
25436
- * express "ignore motion in ALL of {garden, street}" with a single
25437
- * rule. `classFilter` narrows the rule to specific object classes —
25438
- * "drop person detections in the street, but keep cars" is one
25439
- * `exclude` rule with `classFilter: ['person']`.
25440
- *
25441
- * `enabled` is a soft toggle — the operator can keep the rule
25442
- * configured but inert without deleting it.
25443
- */
25444
- var ZoneRuleSchema = object({
25445
- /** Stable rule id — survives edits, used by the UI for diffing. */
25446
- id: string(),
25447
- /** Optional human-readable label rendered in the rule editor. */
25448
- name: string().optional(),
25449
- /** Zones this rule targets. The rule's `mode` applies to ALL
25450
- * listed zones (OR-set: a detection in any one of them counts).
25451
- * At least one zone id required — a rule with no targets is a
25452
- * configuration mistake and the form validator rejects it. */
25453
- zoneIds: array(string()).min(1).readonly(),
25454
- mode: ZoneRuleModeEnum,
25455
- /**
25456
- * Class names this rule applies to. Empty / undefined ⇒ rule
25457
- * applies to every class. Class strings match the `macroClass`
25458
- * field on detections (e.g. `person`, `car`, `dog`).
25459
- */
25460
- classFilter: array(string()).readonly().optional(),
25461
- /**
25462
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
25463
- * required to consider an entity "in the zone". Defaults to the
25464
- * consumer's stage default when omitted. Kept for back-compat with
25465
- * existing per-rule overrides; new operators pick the value via
25466
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
25467
- * set, the lower-level engine reads it as a 0–1 fraction.
25468
- */
25469
- overlapThreshold: number().min(0).max(1).optional(),
25470
- /**
25471
- * Operator-friendly version of `overlapThreshold` — the percentage
25472
- * of the detection's bbox that must lie inside the zone for the
25473
- * rule to match. Documented default is 85%; the engine substitutes
25474
- * that when the field is omitted (kept optional so existing rules
25475
- * stored without it stay valid).
25476
- *
25477
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
25478
- * rule, the engine prefers `bboxInclusionPct` because it's the
25479
- * field exposed in the UI. Internally both feed the same gate.
25480
- */
25481
- bboxInclusionPct: number().min(0).max(100).optional(),
25482
- /**
25483
- * When `true` and a detection has a segmentation mask, use the
25484
- * mask for overlap instead of the bbox. Detection-stage only;
25485
- * motion rules ignore this field.
25486
- */
25487
- preferMask: boolean().optional(),
25488
- /**
25489
- * Soft-toggle: `false` disables the rule without deleting it.
25490
- * Defaults to `true` so operators creating a rule via the UI
25491
- * see it active immediately.
25492
- */
25493
- enabled: boolean().default(true)
25494
- });
25495
- array(ZoneRuleSchema).readonly();
25496
25698
  object({
25497
25699
  /** Whether the script is currently executing. */
25498
25700
  isRunning: boolean(),
@@ -29519,6 +29721,12 @@ Object.freeze({
29519
29721
  addonId: null,
29520
29722
  access: "create"
29521
29723
  },
29724
+ "pipelineAnalytics.cancelRelocateMedia": {
29725
+ capName: "pipeline-analytics",
29726
+ capScope: "device",
29727
+ addonId: null,
29728
+ access: "create"
29729
+ },
29522
29730
  "pipelineAnalytics.cancelStorageMigrationMove": {
29523
29731
  capName: "pipeline-analytics",
29524
29732
  capScope: "device",
@@ -29693,6 +29901,12 @@ Object.freeze({
29693
29901
  addonId: null,
29694
29902
  access: "view"
29695
29903
  },
29904
+ "pipelineAnalytics.listRelocateMediaJobs": {
29905
+ capName: "pipeline-analytics",
29906
+ capScope: "device",
29907
+ addonId: null,
29908
+ access: "view"
29909
+ },
29696
29910
  "pipelineAnalytics.listRetrainAnnotations": {
29697
29911
  capName: "pipeline-analytics",
29698
29912
  capScope: "device",
@@ -29771,6 +29985,12 @@ Object.freeze({
29771
29985
  addonId: null,
29772
29986
  access: "create"
29773
29987
  },
29988
+ "pipelineAnalytics.relocateMedia": {
29989
+ capName: "pipeline-analytics",
29990
+ capScope: "device",
29991
+ addonId: null,
29992
+ access: "create"
29993
+ },
29774
29994
  "pipelineAnalytics.restageRetrainTrack": {
29775
29995
  capName: "pipeline-analytics",
29776
29996
  capScope: "device",
@@ -29783,6 +30003,12 @@ Object.freeze({
29783
30003
  addonId: null,
29784
30004
  access: "create"
29785
30005
  },
30006
+ "pipelineAnalytics.runReplayFrameProcessor": {
30007
+ capName: "pipeline-analytics",
30008
+ capScope: "device",
30009
+ addonId: null,
30010
+ access: "create"
30011
+ },
29786
30012
  "pipelineAnalytics.saveRetrainAnnotations": {
29787
30013
  capName: "pipeline-analytics",
29788
30014
  capScope: "device",
@@ -29915,6 +30141,12 @@ Object.freeze({
29915
30141
  addonId: null,
29916
30142
  access: "view"
29917
30143
  },
30144
+ "pipelineExecutor.getInferenceDeviceHealth": {
30145
+ capName: "pipeline-executor",
30146
+ capScope: "system",
30147
+ addonId: null,
30148
+ access: "view"
30149
+ },
29918
30150
  "pipelineExecutor.getOrchestratorConfigSchema": {
29919
30151
  capName: "pipeline-executor",
29920
30152
  capScope: "system",
@@ -29987,6 +30219,12 @@ Object.freeze({
29987
30219
  addonId: null,
29988
30220
  access: "view"
29989
30221
  },
30222
+ "pipelineExecutor.rearmInferenceDevice": {
30223
+ capName: "pipeline-executor",
30224
+ capScope: "system",
30225
+ addonId: null,
30226
+ access: "create"
30227
+ },
29990
30228
  "pipelineExecutor.runAudioTest": {
29991
30229
  capName: "pipeline-executor",
29992
30230
  capScope: "system",
@@ -33235,6 +33473,11 @@ Object.freeze({
33235
33473
  form: "single",
33236
33474
  optional: false
33237
33475
  }],
33476
+ "pipelineAnalytics.runReplayFrameProcessor": [{
33477
+ name: "deviceId",
33478
+ form: "single",
33479
+ optional: false
33480
+ }],
33238
33481
  "pipelineAnalytics.saveRetrainAnnotations": [{
33239
33482
  name: "deviceId",
33240
33483
  form: "single",