@camstack/addon-provider-onvif 1.2.27 → 1.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +2085 -1842
  2. package/dist/addon.mjs +2085 -1842
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -6633,7 +6633,7 @@ function method(input, output, options) {
6633
6633
  input,
6634
6634
  output,
6635
6635
  kind: options?.kind ?? "query",
6636
- auth: options?.auth ?? "protected",
6636
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6637
6637
  ...options?.access !== void 0 ? { access: options.access } : {},
6638
6638
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6639
6639
  timeoutMs: options?.timeoutMs
@@ -6653,7 +6653,7 @@ function systemMethod(input, output, options) {
6653
6653
  }
6654
6654
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
6655
6655
  var VersionOutputSchema$1 = object({ version: string() });
6656
- method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6656
+ method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
6657
6657
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
6658
6658
  DeviceType["Camera"] = "camera";
6659
6659
  DeviceType["Hub"] = "hub";
@@ -6974,7 +6974,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6974
6974
  }({});
6975
6975
  var StaticDirOutputSchema = object({ staticDir: string() });
6976
6976
  var VersionOutputSchema = object({ version: string() });
6977
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6977
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
6978
6978
  /**
6979
6979
  * device-ops — device-scoped cap that unifies the per-IDevice operations
6980
6980
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7600,24 +7600,6 @@ var RecordingRetentionSchema = object({
7600
7600
  maxSizeGb: number().min(0).optional()
7601
7601
  });
7602
7602
  /**
7603
- * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7604
- * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7605
- * previews at. Five graduated steps; absent on a config = `standard` (the
7606
- * shipped default, matching `sheet-geometry`/`sheet-composer`).
7607
- *
7608
- * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7609
- * Each window's index sidecar carries its own tile dims, so a camera whose
7610
- * preset changed over time renders every historical window at the dims it was
7611
- * written with.
7612
- */
7613
- var ScrubThumbnailPresetSchema = _enum([
7614
- "minimal",
7615
- "low",
7616
- "standard",
7617
- "high",
7618
- "max"
7619
- ]);
7620
- /**
7621
7603
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7622
7604
  *
7623
7605
  * `bands` is the ONLY authored recording intent: what to record, when, and on
@@ -7625,7 +7607,11 @@ var ScrubThumbnailPresetSchema = _enum([
7625
7607
  * other field is a storage knob (profiles, segment length, retention, scrub).
7626
7608
  *
7627
7609
  * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7628
- * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7610
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30,
7611
+ * and `scrubThumbnails` — a five-step fidelity knob for a sprite tier that was
7612
+ * deleted on 2026-07-24 and had ZERO consumers in the recorder — on 2026-08-25
7613
+ * (D62: a switch that writes a store nobody reads is worse than no switch).
7614
+ * Stored rows keep loading: the READ schema is `.strip()` (config-store.ts).
7629
7615
  * A stale caller must fail loudly — silently stripping its legacy intent would
7630
7616
  * persist a band-less config, i.e. silently stop recording the camera.
7631
7617
  */
@@ -7648,14 +7634,7 @@ var RecordingConfigSchema = object({
7648
7634
  * "off" is the absence of a covering band, never a band value.
7649
7635
  */
7650
7636
  bands: array(RecordingBandSchema).default([]),
7651
- retention: RecordingRetentionSchema.optional(),
7652
- /**
7653
- * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7654
- * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7655
- * windows only — existing sheets are immutable, and each window's index
7656
- * carries its own tile dims so mixed-preset history renders correctly.
7657
- */
7658
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7637
+ retention: RecordingRetentionSchema.optional()
7659
7638
  }).strict();
7660
7639
  /**
7661
7640
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
@@ -7731,10 +7710,11 @@ var RelocateFootageInputSchema = object({
7731
7710
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7732
7711
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7733
7712
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7734
- var StorageMigrationMediaMoveInputSchema = object({
7713
+ var RelocateMediaInputSchema = object({
7735
7714
  toLocationId: string(),
7736
7715
  throttleMbps: number().min(1).max(1e3).optional()
7737
- }).extend({ leaseId: string().min(1) });
7716
+ });
7717
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7738
7718
  /** The independently selectable logical storage classes. `recordings`
7739
7719
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7740
7720
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8029,7 +8009,26 @@ var LabelDefinitionSchema = object({
8029
8009
  description: string().optional(),
8030
8010
  icon: string().optional()
8031
8011
  });
8032
- var ClassMapDefinitionSchema = object({
8012
+ /**
8013
+ * Wire schema for a per-model CATALOG classMap override
8014
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8015
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8016
+ * detection pipeline executor actually routes.
8017
+ *
8018
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8019
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8020
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8021
+ * enum) — the two used to share the name `ClassMapDefinition`/
8022
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8023
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8024
+ * are not: it is two different concepts colliding on a name. Keep this type
8025
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8026
+ * would either narrow every `ClassMapDefinition` consumer to the four
8027
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8028
+ * schema exists for (see the "rejects a classMap whose target is not a
8029
+ * detection macro" test in `model-catalog-schema.test.ts`).
8030
+ */
8031
+ var DetectionCatalogClassMapSchema = object({
8033
8032
  mapping: record(string(), _enum([
8034
8033
  "person",
8035
8034
  "vehicle",
@@ -8234,7 +8233,7 @@ var ModelCatalogEntrySchema = object({
8234
8233
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8235
8234
  * labels already ARE the CamStack macros (Scrypted identity map).
8236
8235
  */
8237
- classMap: ClassMapDefinitionSchema.optional()
8236
+ classMap: DetectionCatalogClassMapSchema.optional()
8238
8237
  });
8239
8238
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8240
8239
  format: literal("openvino"),
@@ -8264,7 +8263,7 @@ var ModelConvertMetadataSchema = object({
8264
8263
  "segmentation"
8265
8264
  ]),
8266
8265
  faceAlignment: boolean().optional(),
8267
- classMap: ClassMapDefinitionSchema.optional()
8266
+ classMap: DetectionCatalogClassMapSchema.optional()
8268
8267
  });
8269
8268
  var ConvertResultSchema = object({
8270
8269
  entry: ModelCatalogEntrySchema,
@@ -9127,7 +9126,7 @@ var AddonPageDeclarationSchema = object({
9127
9126
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9128
9127
  sectionLabel: string().optional()
9129
9128
  });
9130
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9129
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9131
9130
  var AddonHttpRouteSchema = object({
9132
9131
  method: _enum([
9133
9132
  "GET",
@@ -9362,7 +9361,7 @@ var WidgetMetadataSchema = object({
9362
9361
  defaultColumns: number().int().min(1).max(12).default(6),
9363
9362
  defaultRows: number().int().min(1).max(12).default(1)
9364
9363
  });
9365
- method(_void(), array(WidgetMetadataSchema).readonly());
9364
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9366
9365
  /**
9367
9366
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9368
9367
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -10884,7 +10883,7 @@ var CustomModelDescriptorSchema = object({
10884
10883
  stepId: string(),
10885
10884
  entry: ModelCatalogEntrySchema
10886
10885
  });
10887
- method(_void(), array(CustomModelDescriptorSchema).readonly());
10886
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
10888
10887
  /**
10889
10888
  * Query filter for settings-store collections.
10890
10889
  */
@@ -10971,7 +10970,8 @@ method(object({
10971
10970
  }), _void(), { kind: "mutation" }), method(object({
10972
10971
  namespace: string().optional(),
10973
10972
  collection: string(),
10974
- filter: QueryFilterSchema.optional()
10973
+ filter: QueryFilterSchema.optional(),
10974
+ columns: array(string()).readonly().optional()
10975
10975
  }), array(SettingsRecordSchema).readonly()), method(object({
10976
10976
  namespace: string().optional(),
10977
10977
  collection: string(),
@@ -11034,46 +11034,87 @@ var EngineInfoSchema = object({
11034
11034
  kind: _enum(["relational", "vector"]),
11035
11035
  displayName: string()
11036
11036
  });
11037
- method(_void(), EngineInfoSchema), method(object({
11037
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11038
11038
  namespace: string().optional(),
11039
11039
  collection: string(),
11040
11040
  key: string()
11041
- }), unknown()), method(object({
11041
+ }), unknown(), { auth: "admin" }), method(object({
11042
11042
  namespace: string().optional(),
11043
11043
  collection: string(),
11044
11044
  key: string(),
11045
11045
  value: unknown()
11046
- }), _void(), { kind: "mutation" }), method(object({
11046
+ }), _void(), {
11047
+ kind: "mutation",
11048
+ auth: "admin"
11049
+ }), method(object({
11047
11050
  namespace: string().optional(),
11048
11051
  collection: string(),
11049
- filter: QueryFilterSchema.optional()
11050
- }), array(SettingsRecordSchema).readonly()), method(object({
11052
+ filter: QueryFilterSchema.optional(),
11053
+ /**
11054
+ * SQL-level column projection — MUST mirror `settings-store.query`.
11055
+ *
11056
+ * ⚠ An earlier version of this comment blamed Zod stripping, and that
11057
+ * was wrong — corrected 2026-08-26 after the hop map
11058
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11059
+ * There is **no Zod parse at all** between the door and the engine: the
11060
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11061
+ * field declared here reaches `SqliteSettingsBackend` either way.
11062
+ *
11063
+ * What actually lost `columns` was the THIRD declaration of this shape:
11064
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11065
+ * interface the engine destructures from. The field existed on both
11066
+ * schemas and the engine still never read it, because nothing checks a
11067
+ * registered provider against `InferProvider<cap>` —
11068
+ * `ProviderRegistration.provider` is typed `object`.
11069
+ *
11070
+ * It is declared here anyway, and must stay in step with
11071
+ * `settings-store.query`: a caller reading only the cap definitions has
11072
+ * to be able to see that this call carries a projection.
11073
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11074
+ */
11075
+ columns: array(string()).readonly().optional()
11076
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11051
11077
  namespace: string().optional(),
11052
11078
  collection: string(),
11053
11079
  record: SettingsRecordSchema
11054
- }), _void(), { kind: "mutation" }), method(object({
11080
+ }), _void(), {
11081
+ kind: "mutation",
11082
+ auth: "admin"
11083
+ }), method(object({
11055
11084
  namespace: string().optional(),
11056
11085
  collection: string(),
11057
11086
  id: string(),
11058
11087
  data: record(string(), unknown())
11059
- }), _void(), { kind: "mutation" }), method(object({
11088
+ }), _void(), {
11089
+ kind: "mutation",
11090
+ auth: "admin"
11091
+ }), method(object({
11060
11092
  namespace: string().optional(),
11061
11093
  collection: string(),
11062
11094
  key: string()
11063
- }), _void(), { kind: "mutation" }), method(object({
11095
+ }), _void(), {
11096
+ kind: "mutation",
11097
+ auth: "admin"
11098
+ }), method(object({
11064
11099
  namespace: string().optional(),
11065
11100
  collection: string(),
11066
11101
  filter: MutationFilterSchema
11067
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11102
+ }), object({ deleted: number().int() }), {
11103
+ kind: "mutation",
11104
+ auth: "admin"
11105
+ }), method(object({
11068
11106
  namespace: string().optional(),
11069
11107
  collection: string(),
11070
11108
  filter: MutationFilterSchema,
11071
11109
  data: record(string(), unknown())
11072
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11110
+ }), object({ updated: number().int() }), {
11111
+ kind: "mutation",
11112
+ auth: "admin"
11113
+ }), method(object({
11073
11114
  namespace: string().optional(),
11074
11115
  collection: string(),
11075
11116
  filter: QueryFilterSchema.optional()
11076
- }), number()), method(object({
11117
+ }), number(), { auth: "admin" }), method(object({
11077
11118
  namespace: string().optional(),
11078
11119
  collection: string(),
11079
11120
  field: string(),
@@ -11083,15 +11124,18 @@ method(_void(), EngineInfoSchema), method(object({
11083
11124
  }), array(object({
11084
11125
  bucket: number().int(),
11085
11126
  count: number().int()
11086
- })).readonly()), method(object({
11127
+ })).readonly(), { auth: "admin" }), method(object({
11087
11128
  namespace: string().optional(),
11088
11129
  collection: string()
11089
- }), boolean()), method(object({
11130
+ }), boolean(), { auth: "admin" }), method(object({
11090
11131
  namespace: string().optional(),
11091
11132
  collection: string(),
11092
11133
  columns: array(CollectionColumnSchema).readonly(),
11093
11134
  indexes: array(CollectionIndexSchema).readonly().optional()
11094
- }), _void(), { kind: "mutation" });
11135
+ }), _void(), {
11136
+ kind: "mutation",
11137
+ auth: "admin"
11138
+ });
11095
11139
  /**
11096
11140
  * shm ring usage stats for a `frameSink: 'shm'` decoder session —
11097
11141
  * exposed via `decoder.getShmStats` so downstream consumers can
@@ -12274,7 +12318,7 @@ method(object({
12274
12318
  crop: _instanceof(Uint8Array),
12275
12319
  width: number(),
12276
12320
  height: number()
12277
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12321
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12278
12322
  /**
12279
12323
  * filesystem-browse — per-node capability for browsing the node's local
12280
12324
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12567,19 +12611,22 @@ method(LlmGenerateBaseInputSchema.extend({
12567
12611
  runtime: ManagedRuntimeConfigSchema,
12568
12612
  /** The managed profile's timeout, threaded by the hub provider. */
12569
12613
  timeoutMs: number().int().positive().optional()
12570
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12614
+ }), LlmGenerateResultSchema, {
12615
+ kind: "mutation",
12616
+ auth: "admin"
12617
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12571
12618
  kind: "mutation",
12572
12619
  auth: "admin"
12573
12620
  }), method(object({}), _void(), {
12574
12621
  kind: "mutation",
12575
12622
  auth: "admin"
12576
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12623
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12577
12624
  kind: "mutation",
12578
12625
  auth: "admin"
12579
12626
  }), method(object({ file: string() }), _void(), {
12580
12627
  kind: "mutation",
12581
12628
  auth: "admin"
12582
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12629
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12583
12630
  /**
12584
12631
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12585
12632
  * methods concat-fan across providers; single-row methods route to ONE
@@ -16052,1748 +16099,1958 @@ var OauthIntegrationDescriptorSchema = object({
16052
16099
  */
16053
16100
  refreshTokenTtlSec: union([number().int().positive(), literal("never")]).optional()
16054
16101
  });
16055
- method(_void(), OauthIntegrationDescriptorSchema);
16102
+ method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
16056
16103
  /**
16057
- * pipeline-analytics device-scoped wrapper cap. Refines raw
16058
- * per-frame detections emitted by the pipeline runner into tracked
16059
- * objects, per-kind event collections (motion / object / audio), and
16060
- * persisted media. Owns the post-detection domain end-to-end:
16061
- *
16062
- * runner emits PipelineInferenceResult
16063
- * ↓ (event bus)
16064
- * pipeline-analytics subscriber
16065
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16066
- * → three DB collections (one per kind), one FS media tree, one
16067
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16068
- * DetectionEvent on bus)
16069
- *
16070
- * Pure subscriber model. No `processFrame` cap method — the runner
16071
- * already publishes the raw frame on the bus. The cap surface is
16072
- * only QUERIES + per-device settings, bound on/off via
16073
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16074
- * every camera with a detection pipeline wants its raw detections
16075
- * refined; operators opt out per-device via BindingsTab when needed.
16076
- *
16077
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16078
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16104
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16105
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16106
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16079
16107
  */
16080
- var TrackStateSchema = _enum([
16081
- "new",
16082
- "entered",
16083
- "left",
16084
- "moving",
16085
- "idle"
16086
- ]);
16087
- var EventKindSchema = _enum([
16088
- "motion",
16089
- "object",
16090
- "audio"
16091
- ]);
16108
+ var NativeCropRefSchema = object({
16109
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16110
+ handle: FrameHandleSchema,
16111
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16112
+ cropFrameSpace: object({
16113
+ x: number(),
16114
+ y: number(),
16115
+ w: number(),
16116
+ h: number()
16117
+ })
16118
+ });
16119
+ object({
16120
+ crop: object({
16121
+ left: number(),
16122
+ top: number(),
16123
+ width: number().positive(),
16124
+ height: number().positive()
16125
+ }).optional(),
16126
+ content: object({
16127
+ width: number().int().positive(),
16128
+ height: number().int().positive()
16129
+ }),
16130
+ fit: _enum(["stretch", "contain"]),
16131
+ format: _enum([
16132
+ "rgb",
16133
+ "gray",
16134
+ "jpeg"
16135
+ ])
16136
+ });
16092
16137
  /**
16093
- * Spatial filter for `listTracks` the rect + polygon variants of the shared
16094
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16095
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16138
+ * Process-local frame identity. It is serializable so it can ride an in-process
16139
+ * capability call, but `registryId` deliberately prevents resolution in any
16140
+ * other process or execution group.
16096
16141
  */
16097
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16098
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16099
- var EventKindIconSchema = _enum([
16100
- "motion",
16101
- "audio",
16102
- "person",
16103
- "vehicle",
16104
- "animal",
16105
- "door",
16106
- "pir",
16107
- "smoke",
16108
- "water",
16109
- "button",
16110
- "package",
16111
- "generic"
16142
+ var FrameRefSchema = object({
16143
+ registryId: string().min(1),
16144
+ id: string().min(1),
16145
+ width: number().int().positive(),
16146
+ height: number().int().positive(),
16147
+ format: _enum(["rgb", "gray"]),
16148
+ timestamp: number(),
16149
+ capturedAt: number().optional()
16150
+ });
16151
+ var ModelFormatSchema$1 = _enum([
16152
+ "onnx",
16153
+ "coreml",
16154
+ "openvino",
16155
+ "tflite",
16156
+ "pt",
16157
+ "gguf"
16112
16158
  ]);
16113
- var EventKindCategorySchema = _enum([
16114
- "motion",
16115
- "audio",
16116
- "detection",
16117
- "sensor",
16118
- "control",
16119
- "custom",
16120
- "package"
16159
+ var PipelineSlotSchema = _enum([
16160
+ "detector",
16161
+ "cropper",
16162
+ "classifier",
16163
+ "refiner",
16164
+ "audio-classifier"
16121
16165
  ]);
16122
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16123
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16124
- var EventKindDescriptorSchema = object({
16125
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16126
- kind: string(),
16127
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16128
- labelKey: string(),
16129
- /** English fallback label (kept for clients that don't translate). */
16130
- label: string(),
16131
- /** Hex color for timeline/legend rendering. */
16132
- color: string(),
16133
- /** Dictionary id → lucide component on the UI side. */
16134
- iconId: string(),
16135
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16136
- icon: EventKindIconSchema,
16137
- category: EventKindCategorySchema,
16138
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16139
- parentKind: string().nullable(),
16140
- /** Derived from `parentKind`, explicit for the client tree. */
16141
- level: EventKindLevelSchema,
16142
- /** Which cap + device contributes this kind. For built-ins the camera
16143
- * itself; for sensor kinds the LINKED source device. */
16144
- source: object({
16145
- capName: string(),
16146
- deviceId: number()
16147
- })
16166
+ var PipelineEngineChoiceSchema = object({
16167
+ runtime: _enum(["node", "python"]),
16168
+ backend: string(),
16169
+ format: ModelFormatSchema$1,
16170
+ device: string().optional()
16148
16171
  });
16149
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16150
- var EventKindsForDeviceSchema = object({
16151
- deviceId: number(),
16152
- kinds: array(EventKindDescriptorSchema).readonly()
16172
+ var AvailableEngineSchema = object({
16173
+ engine: PipelineEngineChoiceSchema,
16174
+ devices: array(object({
16175
+ id: string(),
16176
+ label: string(),
16177
+ description: string().optional()
16178
+ })).readonly(),
16179
+ defaultDevice: string()
16153
16180
  });
16154
- var SensorEventSchema = object({
16181
+ var PipelineDefaultStepSchema = lazy(() => object({
16182
+ addonId: string(),
16183
+ addonName: string(),
16184
+ slot: PipelineSlotSchema,
16185
+ inputClasses: array(string()).readonly(),
16186
+ outputClasses: array(string()).readonly(),
16187
+ enabled: boolean(),
16188
+ modelId: string(),
16189
+ children: array(PipelineDefaultStepSchema).readonly(),
16190
+ group: string().optional(),
16191
+ settings: record(string(), unknown()).optional()
16192
+ }));
16193
+ var PipelineTemplateStepSchema = lazy(() => object({
16194
+ addonId: string(),
16195
+ enabled: boolean(),
16196
+ modelId: string(),
16197
+ children: array(PipelineTemplateStepSchema).readonly(),
16198
+ settings: record(string(), unknown()).optional()
16199
+ }));
16200
+ var PipelineTemplateSchema$1 = object({
16155
16201
  id: string(),
16156
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16157
- * yields N rows, one per camera). */
16158
- deviceId: number(),
16159
- /** The linked sensor device whose state changed. */
16160
- sourceDeviceId: number(),
16161
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16162
- kind: string(),
16163
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16164
- value: record(string(), unknown()).nullable(),
16165
- timestamp: number()
16166
- });
16167
- var TrackPositionSchema = object({
16168
- x: number(),
16169
- y: number(),
16170
- timestamp: number(),
16171
- bbox: BoundingBoxSchema
16202
+ name: string(),
16203
+ createdAt: string(),
16204
+ updatedAt: string(),
16205
+ engine: PipelineEngineChoiceSchema,
16206
+ steps: array(PipelineTemplateStepSchema).readonly()
16172
16207
  });
16173
- var TrackSnapshotSchema = object({
16174
- timestamp: number(),
16175
- position: TrackPositionSchema,
16176
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16177
- mediaKey: string()
16208
+ var PipelineModelOptionSchema = object({
16209
+ id: string(),
16210
+ name: string(),
16211
+ formats: record(string(), object({
16212
+ downloaded: boolean(),
16213
+ sizeMB: number()
16214
+ })),
16215
+ group: ModelVariantGroupSchema.optional(),
16216
+ legacy: boolean().optional(),
16217
+ provider: ModelProviderIdSchema.optional()
16178
16218
  });
16179
- /**
16180
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16181
- * divided by the track's detection-frame dims), computed at persist time.
16182
- * Absent when the frame dims were unknown when the track was persisted
16183
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16184
- */
16185
- var TrackEnvelopeSchema = object({
16186
- minX: number(),
16187
- minY: number(),
16188
- maxX: number(),
16189
- maxY: number()
16219
+ var ConfigFieldBridge = custom();
16220
+ var PipelineAddonSchemaSchema = object({
16221
+ id: string(),
16222
+ name: string(),
16223
+ slot: PipelineSlotSchema,
16224
+ inputClasses: array(string()).readonly(),
16225
+ outputClasses: array(string()).readonly(),
16226
+ childSlots: array(PipelineSlotSchema).readonly(),
16227
+ models: array(PipelineModelOptionSchema).readonly(),
16228
+ defaultModelId: string(),
16229
+ defaultModelIdByFormat: record(string(), string()).optional(),
16230
+ enabledByDefault: boolean().optional(),
16231
+ backfillIntoExistingOverrides: boolean().optional(),
16232
+ defaultConfidence: number(),
16233
+ group: string().optional(),
16234
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16190
16235
  });
16191
- /**
16192
- * Row projection for track list queries. `full` (default) returns the
16193
- * complete Track including the frame-rate `positions[]` history and the
16194
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16195
- * keeps every scalar the list surfaces actually render (ids, class(es),
16196
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16197
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16198
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16199
- * `getTrack`. Mirrors the event-store `projection` convention
16200
- * (`getObjectEvents` et al.).
16201
- */
16202
- var TrackProjectionSchema = _enum(["full", "slim"]);
16203
- /**
16204
- * One audio-classification label heard on the track's camera while the
16205
- * track was alive, aggregated per label. An "episode" is one persisted
16206
- * audio event (the confident-classification path: score ≥ the device's
16207
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16208
- * one 32 ms inference chunk, so counts stay human-scaled.
16209
- */
16210
- var TrackAudioLabelSchema = object({
16236
+ var PipelineSlotSchemaSchema = object({
16237
+ id: PipelineSlotSchema,
16211
16238
  label: string(),
16212
- /** Highest classification score observed across the label's episodes. */
16213
- peakScore: number(),
16214
- /** Number of coalesced audio-event episodes carrying this label. */
16215
- count: number(),
16216
- firstAt: number(),
16217
- lastAt: number()
16239
+ priority: number(),
16240
+ parentSlot: PipelineSlotSchema.nullable(),
16241
+ addons: array(PipelineAddonSchemaSchema).readonly()
16218
16242
  });
16219
- /**
16220
- * How a track was produced. `pipeline` (default / absent) = the spatial
16221
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16222
- * no positions, a single snapshot, and no bbox trajectory at all:
16223
- *
16224
- * - `sensor` — a linked sensor/control device state change.
16225
- * - `audio` — an audio event on the camera itself that was anomalous for
16226
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16227
- *
16228
- * The spatial subsystems (tracker association, occupancy count, re-id /
16229
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16230
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16231
- * check silently readmits every source added after it was written.
16232
- */
16233
- var TrackSourceSchema = _enum([
16234
- "pipeline",
16235
- "sensor",
16236
- "audio"
16237
- ]);
16238
- /**
16239
- * Where a track sits in the RETRAIN lifecycle (D81).
16240
- *
16241
- * - `none` — never marked, or un-marked. Evictable.
16242
- * - `staging` — the operator wants this track as training material and has not
16243
- * finished with it. **This is the only state retention holds**: the track and
16244
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16245
- * the device's age window.
16246
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16247
- * were COPIED into the retrain dataset at selection time, so the dataset no
16248
- * longer depends on the track's media and the track becomes EVICTABLE again.
16249
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16250
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16251
- *
16252
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16253
- * the store's filter language has only positive equality and `whereIn` — no
16254
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16255
- * would make the entire pre-column history immortal in one deploy.
16256
- */
16257
- var RetrainStatusSchema = _enum([
16258
- "none",
16259
- "staging",
16260
- "trained"
16261
- ]);
16262
- /**
16263
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16264
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16265
- * so the two surfaces cannot drift.
16266
- *
16267
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16268
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16269
- * columns existed read as absent, and a consumer that needs a boolean should say
16270
- * `flag === true`, not `flag !== false`.
16271
- *
16272
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16273
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16274
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16275
- * `trained` track reports `false` while refusing both writes. The boolean is
16276
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16277
- * "never marked" from "already trained" must read `retrainStatus`.
16278
- *
16279
- * `debug` does NOT pin; it is attention, not durability.
16280
- *
16281
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16282
- * A favourited track is skipped by retention the same way `staging` is, but
16283
- * it does not enter `none|staging|trained` and has no staging budget.
16284
- */
16285
- var TrackFlagFields = {
16286
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16287
- * `'staging'`. */
16288
- markForTrain: boolean().optional(),
16289
- /** Operator marked this track for diagnostic attention. */
16290
- debug: boolean().optional(),
16291
- /** Operator favourited this track. Pins it against pruning. */
16292
- favourited: boolean().optional()
16293
- };
16294
- /**
16295
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16296
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16297
- * write patch, and the status is not something the toggle sets — it is what the
16298
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16299
- * always present on a persisted row (the column default materialises `'none'`).
16300
- */
16301
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16302
- /**
16303
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16304
- * one flag can never clear the other — the toggles are independent and are
16305
- * driven from three surfaces that do not know about each other.
16306
- */
16307
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16308
- /**
16309
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16310
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16311
- * mutation result without a re-fetch.
16312
- */
16313
- var TrackFlagsSchema = object({
16314
- trackId: string(),
16315
- markForTrain: boolean(),
16316
- debug: boolean(),
16317
- favourited: boolean(),
16318
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16319
- * a track row) because this shape is only ever produced by the write body,
16320
- * which always knows it — and a surface that has just written needs to render
16321
- * `trained` without a re-fetch. */
16322
- retrainStatus: RetrainStatusSchema
16243
+ var PipelineSchemaSchema = object({
16244
+ availableEngines: array(AvailableEngineSchema).readonly(),
16245
+ selectedEngine: PipelineEngineChoiceSchema,
16246
+ slots: array(PipelineSlotSchemaSchema).readonly()
16323
16247
  });
16324
- union([literal(1), literal(2)]);
16325
- /**
16326
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16327
- * the step and model that produced it — which is what makes the write rule
16328
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16329
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16330
- *
16331
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16332
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16333
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16334
- * that value has no provenance, and the write rule lets ANY properly-attributed
16335
- * write of the same tier replace it regardless of score.
16336
- */
16337
- var LabelAttributionSchema = object({
16338
- stepId: string(),
16339
- modelId: string().optional(),
16340
- decidedAt: number(),
16248
+ var EngineProvisioningSchema = object({
16249
+ runtimeId: _enum([
16250
+ "onnx",
16251
+ "openvino",
16252
+ "coreml",
16253
+ "edgetpu"
16254
+ ]).nullable(),
16255
+ device: string().nullable(),
16256
+ state: _enum([
16257
+ "idle",
16258
+ "installing",
16259
+ "verifying",
16260
+ "ready",
16261
+ "failed"
16262
+ ]),
16263
+ progress: number().optional(),
16264
+ error: string().optional(),
16265
+ nextRetryAt: number().optional(),
16341
16266
  /**
16342
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16343
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16344
- *
16345
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16346
- * notification rule authored on "Gianluca" stopped matching the moment the
16347
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16348
- * the thing that does not move, so it is what a rule matches on
16349
- * (`NcConditions.identities`) and the text is what a human is shown.
16350
- *
16351
- * Absent when the label names no gallery row — a plate the OCR read but no
16352
- * vehicle claims, a sub-class, a species, any tier-1 value.
16267
+ * Gate A (config-correctness gate at engine change): human-readable
16268
+ * config issues surfaced EAGERLY when the node's engine changes — model
16269
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16270
+ * has a <format> build"). Additive/optional: informational only, never
16271
+ * enforced here `assertEngineReady` (readiness) still gates inference.
16272
+ * Absent/empty when the node-default tree resolves cleanly.
16353
16273
  */
16354
- identityId: string().optional()
16274
+ configIssues: array(string()).optional()
16355
16275
  });
16356
- /**
16357
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16358
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16359
- * track and its events always answer the same question the same way.
16360
- *
16361
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16362
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16363
- * is tier 2, and each carries its own score + attribution.
16364
- *
16365
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16366
- * finest thing known. Before 4g the single `label` column held the finest
16367
- * value, so a consumer that has not been updated reads the tier-1 slot and
16368
- * shows nothing on a species-only row; that is why the migration puts every
16369
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16370
- * and why the read surfaces were changed in the same train.
16371
- *
16372
- * **Writing it.** The slots are independent, which is the whole point: a
16373
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16374
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16375
- * higher score wins. One rule, one implementation — see
16376
- * `pipeline/label-tier.ts` in addon-post-analysis.
16377
- */
16378
- var TieredLabelFields = {
16379
- /** Tier 1 the sub-class. See {@link LabelTierSchema}. */
16380
- label: string().optional(),
16381
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16382
- labelScore: number().optional(),
16383
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16384
- labelMeta: LabelAttributionSchema.optional(),
16385
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16386
- subLabel: string().optional(),
16387
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16388
- subLabelScore: number().optional(),
16389
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16390
- subLabelMeta: LabelAttributionSchema.optional()
16391
- };
16392
- /** Per-camera slice of a training-export estimate. */
16393
- var TrainingExportDeviceTotalsSchema = object({
16394
- deviceId: number(),
16395
- tracks: number().int(),
16396
- files: number().int(),
16397
- bytes: number().int()
16276
+ var PipelineStepInputSchema = lazy(() => object({
16277
+ addonId: string(),
16278
+ modelId: string().optional(),
16279
+ enabled: boolean().default(true),
16280
+ children: array(PipelineStepInputSchema).optional(),
16281
+ settings: record(string(), unknown()).optional(),
16282
+ jumpDeviceKey: string().optional()
16283
+ }));
16284
+ var ModelSubstitutionSchema = object({
16285
+ addonId: string(),
16286
+ chosen: string(),
16287
+ running: string(),
16288
+ format: string()
16289
+ });
16290
+ var PipelineValidationIssueSchema = object({
16291
+ addonId: string(),
16292
+ kind: _enum(["unknown-addon", "no-format-build"]),
16293
+ detail: string()
16294
+ });
16295
+ var PipelineValidationResultSchema = object({
16296
+ ok: boolean(),
16297
+ issues: array(PipelineValidationIssueSchema).readonly(),
16298
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16299
+ /** The node's `currentEngine.format` this validation ran against. */
16300
+ format: string()
16301
+ });
16302
+ var ReferenceImageEntrySchema = object({
16303
+ filename: string(),
16304
+ stepIds: array(string()).readonly().optional()
16305
+ });
16306
+ var ReferenceImageBodySchema = object({
16307
+ base64: string(),
16308
+ filename: string()
16309
+ });
16310
+ var ReferenceAudioEntrySchema = object({
16311
+ filename: string(),
16312
+ sizeKb: number()
16313
+ });
16314
+ var ReferenceAudioBodySchema = object({ base64: string() });
16315
+ var AudioBackendSchema = object({
16316
+ id: string(),
16317
+ name: string(),
16318
+ description: string(),
16319
+ available: boolean(),
16320
+ /**
16321
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16322
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16323
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16324
+ * specific to the selected backend without a separate fetch.
16325
+ */
16326
+ rawLabels: array(string()).readonly().optional()
16327
+ });
16328
+ var AudioCapabilitiesSchema = object({
16329
+ activeBackend: string(),
16330
+ availableBackends: array(AudioBackendSchema).readonly(),
16331
+ sampleRate: number(),
16332
+ chunkDurationMs: number()
16333
+ });
16334
+ var DownloadModelResultSchema = object({
16335
+ filePath: string(),
16336
+ sizeMB: number(),
16337
+ durationMs: number()
16398
16338
  });
16399
16339
  /**
16400
- * What a training export WOULD contain. Computed from media index rows only —
16401
- * no blob is read to produce this.
16340
+ * Wrapper carrying a single test run's result. Replaces the legacy
16341
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16342
+ * canonical `AudioResult` from the Phase 6 output rework: one
16343
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16344
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16345
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16346
+ * benchmark UI can still report a clean failure when the classifier
16347
+ * cap isn't available.
16402
16348
  */
16403
- var TrainingExportSummarySchema = object({
16404
- generatedAt: number(),
16405
- trackCount: number().int(),
16406
- fileCount: number().int(),
16407
- byteCount: number().int(),
16408
- /** More marked tracks exist than a single pass carries. */
16409
- truncated: boolean(),
16410
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16349
+ var AudioTestResultSchema = object({
16350
+ success: boolean(),
16351
+ error: string().optional(),
16352
+ frame: custom().optional()
16411
16353
  });
16412
- var TrackSchema = object({
16413
- trackId: string(),
16414
- deviceId: number(),
16415
- className: string(),
16416
- ...TieredLabelFields,
16417
- producingDeviceName: string().optional(),
16418
- /** Track provenance. Absent `pipeline` (legacy rows). */
16419
- source: TrackSourceSchema.optional(),
16420
- firstSeen: number(),
16421
- lastSeen: number(),
16422
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16423
- positions: array(TrackPositionSchema).readonly(),
16424
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16425
- * saveThumbnails policy). */
16426
- snapshots: array(TrackSnapshotSchema).readonly(),
16427
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16428
- zonesVisited: array(string()).readonly(),
16354
+ var PipelineConfigBridge = custom();
16355
+ var ConfigUISchemaBridge = custom();
16356
+ var ConfigUISchemaNullableBridge = custom();
16357
+ var InferenceCapabilitiesBridge = custom();
16358
+ var ModelAvailabilityListBridge = custom();
16359
+ var PipelineRunResultBridge = custom();
16360
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16361
+ modelId: string(),
16362
+ settings: record(string(), unknown()).readonly()
16363
+ }))), method(object({ steps: record(string(), object({
16364
+ modelId: string(),
16365
+ settings: record(string(), unknown()).readonly()
16366
+ })) }), object({ success: literal(true) }), {
16367
+ kind: "mutation",
16368
+ auth: "admin"
16369
+ }), method(object({ nodeId: string() }), object({
16370
+ success: literal(true),
16371
+ clearedDevices: number()
16372
+ }), {
16373
+ kind: "mutation",
16374
+ auth: "admin"
16375
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16376
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16377
+ deviceKey: string(),
16429
16378
  /**
16430
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16431
- * `zones` capability.
16432
- *
16433
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16434
- * and no card can render — so every free-text search surface was structurally
16435
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16436
- * just returned nothing. Resolving here rather than in each client keeps ONE
16437
- * derivation and costs the clients no extra call (the `zones` cap is
16438
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16439
- * surface built to avoid exactly that).
16440
- *
16441
- * Resolved, never invented: a zone deleted since the track was written has no
16442
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16443
- * two are not positionally aligned. Absent when the track visited no zone, or
16444
- * when the zone catalogue could not be read.
16379
+ * `failed` the per-device restart budget is exhausted; no pool
16380
+ * will be spawned until an operator re-arms it or the runner
16381
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16382
+ * a cached pool observed dead and not yet condemned).
16445
16383
  */
16446
- zoneNames: array(string()).readonly().optional(),
16447
- /** Deduplicated set of detector classes observed for this track over its
16448
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16449
- * legacy rows written before class accumulation shipped. */
16450
- classes: array(string()).readonly().optional(),
16451
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16452
- totalDistance: number(),
16453
- state: TrackStateSchema,
16454
- active: boolean(),
16455
- /** Deterministic key-event importance score in [0,1] (server-computed at
16456
- * track expiry, recomputed on late label). Absent on legacy rows written
16457
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16458
- importance: number().optional(),
16459
- /** Id of the track's highest-confidence ObjectEvent (its representative
16460
- * "best" frame). Absent when the track produced no object events. */
16461
- bestEventId: string().optional(),
16462
- /** Tag of the importance sub-signal that dominated the score
16463
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16464
- importanceReason: string().optional(),
16465
- /** Audio-classification labels heard on the camera during the track's
16466
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16467
- * Absent on legacy rows / tracks with no confident audio. */
16468
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16469
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16470
- * Populated from the persisted envelope columns on historical reads;
16471
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16472
- envelope: TrackEnvelopeSchema.optional(),
16384
+ state: _enum(["failed", "backoff"]),
16385
+ /** Epoch ms of the death that produced this state. */
16386
+ since: number(),
16387
+ /** Pool deaths inside the current window. */
16388
+ deaths: number(),
16389
+ /** The last death's message. */
16390
+ lastError: string()
16391
+ })).readonly() })), method(object({
16392
+ nodeId: string(),
16393
+ deviceKey: string()
16394
+ }), object({ rearmed: boolean() }), {
16395
+ kind: "mutation",
16396
+ auth: "admin"
16397
+ }), 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({
16398
+ name: string(),
16399
+ steps: array(PipelineTemplateStepSchema).readonly(),
16400
+ engine: PipelineEngineChoiceSchema
16401
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16402
+ id: string(),
16403
+ name: string().optional(),
16404
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16405
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16406
+ addonId: string(),
16407
+ modelId: string(),
16408
+ format: ModelFormatSchema$1
16409
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16410
+ addonId: string(),
16411
+ modelId: string(),
16412
+ format: ModelFormatSchema$1
16413
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16414
+ engine: PipelineEngineChoiceSchema.optional(),
16415
+ steps: array(PipelineStepInputSchema).min(1),
16416
+ frame: FrameInputSchema.optional(),
16473
16417
  /**
16474
- * A face DETECTOR found a face on this track — nothing more. It says the
16475
- * detail plane produced a `face` detail; it does NOT say the face was
16476
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16477
- * enabled. Set once and never cleared.
16478
- *
16479
- * **This exists so "face present but not recognised" is expressible.** A
16480
- * recognised identity lands in `subLabel` (attributed to the face chain via
16481
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16482
- * and a track with no face at all were byte-identical on the wire and no
16483
- * surface could tell them apart. The read is `hasFace === true && subLabel
16484
- * === undefined`.
16485
- *
16486
- * **Absent ≠ false.** Every row written before the column existed omits it,
16487
- * and so does every server that predates the field — a consumer must test
16488
- * `=== true` and render nothing otherwise, never infer "no face".
16418
+ * Process-local lazy frame. Valid only when caller and provider resolve
16419
+ * in the same execution-group process; split/cross-node callers use
16420
+ * `frame`/`image` inline compatibility instead.
16489
16421
  */
16490
- hasFace: boolean().optional(),
16422
+ frameRef: FrameRefSchema.optional(),
16491
16423
  /**
16492
- * This track has a face row IN THE GALLERY: a crop **and** an embedding a
16493
- * face an operator could ASSIGN to an identity.
16494
- *
16495
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16496
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16497
- * branch, before every gate, and means no more than "a face detector produced
16498
- * a face detail". This one is stamped at the single moment the gallery row
16499
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16500
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16501
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16502
- * the crop-store drop. Everything between the detector and that insert can
16503
- * legitimately refuse the face, so a flag written any earlier promises the
16504
- * operator something to assign and delivers nothing.
16505
- *
16506
- * **Independent of recognition.** A face collected but never auto-matched is
16507
- * still assignable — it is in fact the face an operator most wants to reach —
16508
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16509
- * `subLabel`; this says only that the raw material exists.
16510
- *
16511
- * **Set once, never cleared.** A track that produced a gallery row produced
16512
- * one; deleting the row later is the gallery's business, not this flag's.
16513
- *
16514
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16515
- * before the column omits it, and so does every server that predates the
16516
- * field. A consumer must test `=== true` and render nothing otherwise —
16517
- * never infer "no assignable face".
16424
+ * CB5 shm passthrough a `FrameHandle` naming the same ring slot
16425
+ * the decoded pixels live in. One more member of the one-of
16426
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16518
16427
  */
16519
- hasEmbeddedFace: boolean().optional(),
16428
+ frameHandle: FrameHandleSchema.optional(),
16429
+ imageBase64: string().optional(),
16520
16430
  /**
16521
- * This subject CONTAINS a folded rider a person the rider-pairing step
16522
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16523
- * so the passage is tracked once and as a VEHICLE.
16524
- *
16525
- * It exists because the fold's record was dishonest. D34 and the code both
16526
- * said "the person is not lost — it is reported so both entities stay on the
16527
- * record"; in fact the pair went into a per-processor RAM field behind an
16528
- * accessor nobody called, and every durable surface said `vehicle`, full
16529
- * stop. This is the composition note that makes the row true.
16530
- *
16531
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16532
- * person" is not an answer to "what is this" — both label tiers would refuse
16533
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16534
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16535
- * and a `person` rule still does not fire for someone cycling past.
16536
- *
16537
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16538
- * the column, and every hub that predates the field, omits it. Test
16539
- * `=== true` and render nothing otherwise — never infer "no rider".
16431
+ * Binary JPEG bytespreferred over `imageBase64` on internal
16432
+ * hops (hub forked worker via Moleculer MsgPack) because it
16433
+ * skips the 33% base64 overhead + the per-call base64 decode on
16434
+ * the detection-pipeline worker. Callers can pass either; exactly
16435
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16540
16436
  */
16541
- hasRider: boolean().optional(),
16542
- ...TrackFlagFields,
16543
- ...TrackRetrainFields
16544
- });
16545
- var BaseEventFields = {
16546
- id: string(),
16547
- deviceId: number(),
16548
- timestamp: number()
16549
- };
16550
- var MotionEventSchema = object({
16551
- ...BaseEventFields,
16552
- kind: literal("motion"),
16553
- regionCount: number(),
16554
- /** Heavy JSON array omitted in slim projection. */
16555
- regions: array(object({
16556
- bbox: BoundingBoxSchema,
16557
- pixelCount: number(),
16558
- intensity: number()
16559
- })).readonly().optional(),
16560
- /** Omitted in slim projection. */
16561
- frameWidth: number().optional(),
16562
- /** Omitted in slim projection. */
16563
- frameHeight: number().optional(),
16564
- /** Populated by B5 (recording playback URL for this event). */
16565
- mediaUrl: string().optional()
16566
- });
16437
+ image: _instanceof(Uint8Array).optional(),
16438
+ referenceImage: string().optional(),
16439
+ deviceId: number().optional(),
16440
+ sessionId: string().optional(),
16441
+ /**
16442
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16443
+ * reference-image, and detail-subtree calls. 'frame' is the live
16444
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16445
+ * (inputClasses ≠ null) are skipped and served per-track via
16446
+ * pipelineRunner.runDetailSubtree (two-plane design).
16447
+ */
16448
+ plane: _enum(["full", "frame"]).optional(),
16449
+ /**
16450
+ * Inference-device selector (Phase 2 multi-device). Format
16451
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16452
+ * Omitted ⇒ the runner's default device (current single-engine
16453
+ * behaviour). Selects WHICH device pool of the node runs the call.
16454
+ */
16455
+ deviceKey: string().optional(),
16456
+ /**
16457
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16458
+ * when the parent crop was resolved from the frame's retained NATIVE
16459
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16460
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16461
+ * resolution from that surface — the SAME quality path faces already
16462
+ * had — instead of the downscaled parent tile. `handle` keys the native
16463
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16464
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16465
+ * the executor's crop-normalized child ROI back into frame-normalized
16466
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16467
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16468
+ * (today's behaviour on the fallback path).
16469
+ */
16470
+ nativeCropRef: NativeCropRefSchema.optional()
16471
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16472
+ engine: PipelineEngineChoiceSchema.optional(),
16473
+ steps: array(PipelineStepInputSchema).min(1),
16474
+ frames: array(FrameInputSchema).min(1).max(255),
16475
+ deviceId: number().optional(),
16476
+ sessionId: string().optional(),
16477
+ /**
16478
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16479
+ * the batch to the Python pool's bench preprocess cache
16480
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16481
+ * preprocessed ONCE and every later inference is a pure-inference cache
16482
+ * hit — the sustained-throughput run measures inference, not
16483
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16484
+ * full preprocess every call, correct). Fresh per sustained run;
16485
+ * released via `uncacheFrame`.
16486
+ */
16487
+ frameId: number().int().nonnegative().optional(),
16488
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16489
+ deviceKey: string().optional()
16490
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16491
+ data: _instanceof(Uint8Array),
16492
+ width: number().int().positive(),
16493
+ height: number().int().positive(),
16494
+ format: _enum([
16495
+ "rgb",
16496
+ "bgr",
16497
+ "gray"
16498
+ ])
16499
+ }), object({
16500
+ frameId: number(),
16501
+ width: number(),
16502
+ height: number()
16503
+ }), { kind: "mutation" }), method(object({
16504
+ stepId: string(),
16505
+ frameId: number().int()
16506
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16507
+ batchMode: string(),
16508
+ windowMs: number(),
16509
+ maxBatchSize: number(),
16510
+ concurrency: number()
16511
+ })), method(_void(), array(object({
16512
+ engineKey: string(),
16513
+ engine: PipelineEngineChoiceSchema,
16514
+ modelsLoaded: array(string()).readonly(),
16515
+ inUseByCameras: array(number()).readonly(),
16516
+ /**
16517
+ * Origin of this resident factory.
16518
+ * - `runtime` — main camera-serving engine (no idle TTL).
16519
+ * - `warm-override` — benchmark/test override held in the warm
16520
+ * cache; auto-disposed after the idle TTL.
16521
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16522
+ * multi-device, keyed by `deviceKey`) resolved
16523
+ * via `resolveDeviceFactory`. Runs alongside the
16524
+ * `runtime` engine on a DIFFERENT accelerator
16525
+ * (NPU / iGPU / Coral) — this is how the
16526
+ * Engines tab shows all pools running at once.
16527
+ */
16528
+ kind: _enum([
16529
+ "runtime",
16530
+ "warm-override",
16531
+ "device-pool"
16532
+ ]),
16533
+ /** Native pid of the underlying Python pool (null when no pool). */
16534
+ poolPid: number().nullable(),
16535
+ /** ms since this factory was last used (null when not warm-tracked). */
16536
+ idleMs: number().nullable(),
16537
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16538
+ idleTtlMs: number().nullable()
16539
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16540
+ kind: "mutation",
16541
+ auth: "admin"
16542
+ }), method(object({
16543
+ engine: PipelineEngineChoiceSchema,
16544
+ force: boolean().optional()
16545
+ }), object({
16546
+ success: boolean(),
16547
+ reason: string().optional()
16548
+ }), {
16549
+ kind: "mutation",
16550
+ auth: "admin"
16551
+ }), 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({
16552
+ addonId: string(),
16553
+ modelId: string(),
16554
+ filename: string().optional(),
16555
+ settings: record(string(), unknown()).optional()
16556
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16567
16557
  /**
16568
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16569
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16570
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16571
- * tracking, per-kind persistence) but stay distinguishable so consumers
16572
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16573
- * Absent on legacy rows treat as `pipeline`.
16558
+ * Per-stage gating mode applied to the zones a rule references.
16559
+ *
16560
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16561
+ * When at least one `include` rule fires for a stage, only entities
16562
+ * inside one of those zones pass that stage.
16563
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16564
+ * Entities inside one of those zones are dropped at that stage.
16565
+ *
16566
+ * `monitor`-style observation (count without filtering) is not a rule
16567
+ * mode — zones without any matching rule are observed naturally by
16568
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16569
+ * count, not filter" use case needs no rule at all.
16574
16570
  */
16575
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16571
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16576
16572
  /**
16577
- * The confirmed zone crossing that produced an object event. Present ONLY on
16578
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16579
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16580
- * appearance event carry none, so a rule asking for a direction fails closed
16581
- * on them.
16573
+ * Per-consumer rule that references existing zones (geometry) and
16574
+ * defines how a specific pipeline stage should treat them. Each
16575
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16576
+ * settings:
16582
16577
  *
16583
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16584
- * into its own event, so a frame in which a track enters A while leaving B
16585
- * produces two events with two directions — never one ambiguous row.
16578
+ * - `addon-motion-wasm` `motionZoneRules: ZoneRule[]` (motion stage)
16579
+ * - `addon-detection-pipeline` `detectionZoneRules: ZoneRule[]` (detection stage)
16580
+ * - future: notification rules, audio gating, etc.
16586
16581
  *
16587
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16588
- * membership the box has NOW, and by definition it no longer contains the zone
16589
- * that was just left. Without the id here, a zone-scoped rule could never match
16590
- * the exit it asked for.
16582
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16583
+ * express "ignore motion in ALL of {garden, street}" with a single
16584
+ * rule. `classFilter` narrows the rule to specific object classes
16585
+ * "drop person detections in the street, but keep cars" is one
16586
+ * `exclude` rule with `classFilter: ['person']`.
16587
+ *
16588
+ * `enabled` is a soft toggle — the operator can keep the rule
16589
+ * configured but inert without deleting it.
16591
16590
  */
16592
- var ZoneCrossingSchema = object({
16593
- direction: _enum(["enter", "exit"]),
16594
- /** Admin zone id crossed. */
16595
- zoneId: string(),
16596
- /** Zone display name at crossing time (falls back to the id). */
16597
- zoneName: string().optional()
16598
- });
16599
- var ObjectEventSchema = object({
16600
- ...BaseEventFields,
16601
- kind: literal("object"),
16602
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16603
- source: DetectionSourceSchema.optional(),
16591
+ var ZoneRuleSchema = object({
16592
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16593
+ id: string(),
16594
+ /** Optional human-readable label rendered in the rule editor. */
16595
+ name: string().optional(),
16596
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16597
+ * listed zones (OR-set: a detection in any one of them counts).
16598
+ * At least one zone id required — a rule with no targets is a
16599
+ * configuration mistake and the form validator rejects it. */
16600
+ zoneIds: array(string()).min(1).readonly(),
16601
+ mode: ZoneRuleModeEnum,
16604
16602
  /**
16605
- * Inference-frame id shared by every object event emitted from the SAME frame
16606
- * the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16607
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16608
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16609
- * Optional for backward-compat with pre-existing rows / the slim projection
16610
- * includes it (it is light). Absent on rows written before this field.
16603
+ * Class names this rule applies to. Empty / undefined rule
16604
+ * applies to every class. Class strings match the `macroClass`
16605
+ * field on detections (e.g. `person`, `car`, `dog`).
16611
16606
  */
16612
- frameId: string().optional(),
16613
- /** Omitted in slim projection. */
16614
- trackId: string().optional(),
16615
- className: string(),
16616
- ...TieredLabelFields,
16617
- /** Omitted in slim projection. */
16618
- confidence: number().optional(),
16619
- /** Heavy JSON — omitted in slim projection. */
16620
- bbox: BoundingBoxSchema.optional(),
16621
- /** Heavy JSON — omitted in slim projection. */
16622
- zones: array(string()).readonly().optional(),
16623
- /** Omitted in slim projection. */
16624
- state: TrackStateSchema.optional(),
16607
+ classFilter: array(string()).readonly().optional(),
16625
16608
  /**
16626
- * The zone crossing this event IS, when it is one. Absent on every other
16627
- * event kind (movement state, appearance, package) see
16628
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16609
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16610
+ * required to consider an entity "in the zone". Defaults to the
16611
+ * consumer's stage default when omitted. Kept for back-compat with
16612
+ * existing per-rule overrides; new operators pick the value via
16613
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16614
+ * set, the lower-level engine reads it as a 0–1 fraction.
16629
16615
  */
16630
- zoneCrossing: ZoneCrossingSchema.optional(),
16631
- /** Detection-frame dimensions in pixels — let consumers normalize the
16632
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
16633
- frameWidth: number().optional(),
16634
- frameHeight: number().optional(),
16635
- /** MediaStore key for the crop attached to this event (if any). */
16636
- mediaKey: string().optional(),
16637
- /** Design B: MediaStore key of the track's native-resolution key frame (the
16638
- * best-detection full frame). Resolve via the event-media data-plane
16639
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
16640
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
16641
- * sources — consumers fall back to `mediaKey` (the tight crop). */
16642
- keyFrameMediaKey: string().optional(),
16643
- /** Populated by B5 (recording playback URL for this event). */
16644
- mediaUrl: string().optional(),
16645
- /** The parent track's key-event importance [0,1], propagated to every object
16646
- * event of the track (so an event row can be sorted by importance without a
16647
- * track join). Absent on legacy rows / before the track was scored. */
16648
- importance: number().optional()
16649
- });
16650
- var AudioEventSchema = object({
16651
- ...BaseEventFields,
16652
- kind: literal("audio"),
16653
- rms: number(),
16654
- dbfs: number(),
16655
- classification: object({
16656
- className: string(),
16657
- originalClass: string().optional(),
16658
- score: number()
16659
- }).optional(),
16660
- /** Populated by B5 (recording playback URL for this event). */
16661
- mediaUrl: string().optional()
16662
- });
16663
- var MediaFileKindEnum = _enum([
16664
- "crop",
16665
- "thumbnail",
16666
- "snapshot",
16667
- "firstFrame",
16668
- "lastFrame",
16669
- "fullFrame",
16670
- "fullFrameBoxed",
16671
- "faceCrop",
16672
- "plateCrop",
16673
- "keyFrame",
16674
- "keyFrameSmall",
16675
- "thumbnailSmall"
16676
- ]);
16677
- var MediaFileSchema = object({
16678
- key: string(),
16679
- kind: MediaFileKindEnum,
16680
- base64: string(),
16681
- sizeBytes: number(),
16682
- timestamp: number()
16616
+ overlapThreshold: number().min(0).max(1).optional(),
16617
+ /**
16618
+ * Operator-friendly version of `overlapThreshold` the percentage
16619
+ * of the detection's bbox that must lie inside the zone for the
16620
+ * rule to match. Documented default is 85%; the engine substitutes
16621
+ * that when the field is omitted (kept optional so existing rules
16622
+ * stored without it stay valid).
16623
+ *
16624
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16625
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16626
+ * field exposed in the UI. Internally both feed the same gate.
16627
+ */
16628
+ bboxInclusionPct: number().min(0).max(100).optional(),
16629
+ /**
16630
+ * When `true` and a detection has a segmentation mask, use the
16631
+ * mask for overlap instead of the bbox. Detection-stage only;
16632
+ * motion rules ignore this field.
16633
+ */
16634
+ preferMask: boolean().optional(),
16635
+ /**
16636
+ * Soft-toggle: `false` disables the rule without deleting it.
16637
+ * Defaults to `true` so operators creating a rule via the UI
16638
+ * see it active immediately.
16639
+ */
16640
+ enabled: boolean().default(true)
16683
16641
  });
16642
+ array(ZoneRuleSchema).readonly();
16684
16643
  /**
16685
- * One media row WITHOUT its bytes.
16644
+ * Zone pure geometry + identity. NO filtering behaviour.
16686
16645
  *
16687
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
16688
- * 140 s track), and a client that renders tiles from the media data plane needs
16689
- * to know only WHAT EXISTS the bytes then arrive per tile, lazily, over HTTP
16690
- * with an immutable cache, instead of all at once inside a tRPC response that
16691
- * blocks the whole view.
16646
+ * Zones describe **where** in the frame the operator wants to flag
16647
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16648
+ * each pipeline stage uses them. Splitting the two means a single
16649
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16650
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16651
+ * — without three duplicated polygons.
16692
16652
  *
16693
- * `sizeBytes` is carried because it is what lets a client decide between the
16694
- * stored blob and a `?variant=thumb` rendering without fetching either.
16653
+ * Owned by the orchestrator addon (provider) and mirrored into the
16654
+ * `zones` device-state slice on every mutation. Consumers
16655
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16656
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16657
+ * mirror with `onChanged`).
16658
+ *
16659
+ * Coordinates are normalised fractions of the frame (0–1) so zones
16660
+ * survive resolution changes and stream profile switches.
16661
+ *
16662
+ * `kind` discriminates between full polygons (closed regions used
16663
+ * for intrusion / occupancy filters) and tripwires (open 2-point
16664
+ * line segments used for cross events). Onboard / firmware-reported
16665
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
16666
+ * task list.
16695
16667
  */
16696
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
16668
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
16669
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
16670
+ var PolygonPointSchema = object({
16671
+ x: number(),
16672
+ y: number()
16673
+ });
16674
+ /** A camera detection zone — pure geometry/identity. */
16675
+ var ZoneSchema = object({
16676
+ id: string(),
16677
+ name: string(),
16678
+ kind: ZoneKindEnum.default("polygon"),
16679
+ /** Polygon vertices, fraction of frame (0–1). */
16680
+ polygon: array(PolygonPointSchema).readonly(),
16681
+ /** Visual color for UI rendering. */
16682
+ color: string().default("#3b82f6")
16683
+ });
16684
+ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
16685
+ deviceId: number(),
16686
+ zone: ZoneSchema
16687
+ }), _void(), {
16688
+ kind: "mutation",
16689
+ auth: "admin"
16690
+ }), method(object({
16691
+ deviceId: number(),
16692
+ zoneId: string()
16693
+ }), _void(), {
16694
+ kind: "mutation",
16695
+ auth: "admin"
16696
+ }), method(object({
16697
+ deviceId: number(),
16698
+ zone: ZoneSchema
16699
+ }), _void(), {
16700
+ kind: "mutation",
16701
+ auth: "admin"
16702
+ }), object({ zones: array(ZoneSchema).readonly() });
16697
16703
  /**
16698
- * The MACRO tier of an annotation — a CLOSED set.
16704
+ * pipeline-analytics device-scoped wrapper cap. Refines raw
16705
+ * per-frame detections emitted by the pipeline runner into tracked
16706
+ * objects, per-kind event collections (motion / object / audio), and
16707
+ * persisted media. Owns the post-detection domain end-to-end:
16699
16708
  *
16700
- * This is what the exported detector predicts, so a typo here is a new class
16701
- * with one example in it. `label` and `subLabel` are open strings by contrast:
16702
- * the whole point of the page is teaching the model things it does not know
16703
- * yet, and constraining that vocabulary would make it useless.
16709
+ * runner emits PipelineInferenceResult
16710
+ * (event bus)
16711
+ * pipeline-analytics subscriber
16712
+ * SORT tracker + zone engine + state analyzer + event emitter
16713
+ * → three DB collections (one per kind), one FS media tree, one
16714
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
16715
+ * DetectionEvent on bus)
16704
16716
  *
16705
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
16706
- * `subLabel` is one of these values, in any casing, because once `person`
16707
- * exists in both tiers "every person box" stops being answerable without
16708
- * knowing every string anyone ever typed — and the damage is retroactive.
16717
+ * Pure subscriber model. No `processFrame` cap method the runner
16718
+ * already publishes the raw frame on the bus. The cap surface is
16719
+ * only QUERIES + per-device settings, bound on/off via
16720
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
16721
+ * every camera with a detection pipeline wants its raw detections
16722
+ * refined; operators opt out per-device via BindingsTab when needed.
16723
+ *
16724
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16725
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
16709
16726
  */
16710
- var RetrainMacroClassSchema = _enum([
16727
+ var TrackStateSchema = _enum([
16728
+ "new",
16729
+ "entered",
16730
+ "left",
16731
+ "moving",
16732
+ "idle"
16733
+ ]);
16734
+ var EventKindSchema = _enum([
16735
+ "motion",
16736
+ "object",
16737
+ "audio"
16738
+ ]);
16739
+ /**
16740
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16741
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16742
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
16743
+ */
16744
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16745
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
16746
+ var EventKindIconSchema = _enum([
16747
+ "motion",
16748
+ "audio",
16711
16749
  "person",
16712
16750
  "vehicle",
16713
16751
  "animal",
16752
+ "door",
16753
+ "pir",
16754
+ "smoke",
16755
+ "water",
16756
+ "button",
16714
16757
  "package",
16715
- "face",
16716
- "plate"
16758
+ "generic"
16717
16759
  ]);
16718
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
16719
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
16720
- /** Did a human draw this box, or did the assist propose it? */
16721
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
16722
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
16723
- var RetrainBboxSchema = object({
16724
- x: number(),
16725
- y: number(),
16726
- w: number(),
16727
- h: number()
16728
- });
16729
- /**
16730
- * One annotated subject.
16731
- *
16732
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
16733
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
16734
- * derived from it at export and never stored storing them is how one feature
16735
- * space ends up holding two crops of the same subject (D52).
16736
- */
16737
- var RetrainAnnotationSchema = object({
16738
- id: string(),
16739
- trackId: string(),
16740
- deviceId: number(),
16741
- /** The COPY in retrain storage — never the source track's media key. */
16742
- mediaKey: string(),
16743
- bbox: RetrainBboxSchema,
16744
- macroClass: RetrainMacroClassSchema,
16745
- label: string().optional(),
16746
- subLabel: string().optional(),
16747
- kind: RetrainAnnotationKindSchema,
16748
- source: RetrainAnnotationSourceSchema,
16749
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
16750
- assistModelId: string().optional(),
16751
- assistScore: number().optional(),
16752
- exportedInBatch: string().optional(),
16753
- createdAt: number()
16754
- });
16755
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
16756
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
16757
- id: true,
16758
- trackId: true,
16759
- deviceId: true,
16760
- mediaKey: true,
16761
- createdAt: true,
16762
- exportedInBatch: true
16760
+ var EventKindCategorySchema = _enum([
16761
+ "motion",
16762
+ "audio",
16763
+ "detection",
16764
+ "sensor",
16765
+ "control",
16766
+ "custom",
16767
+ "package"
16768
+ ]);
16769
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16770
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16771
+ var EventKindDescriptorSchema = object({
16772
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16773
+ kind: string(),
16774
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16775
+ labelKey: string(),
16776
+ /** English fallback label (kept for clients that don't translate). */
16777
+ label: string(),
16778
+ /** Hex color for timeline/legend rendering. */
16779
+ color: string(),
16780
+ /** Dictionary id → lucide component on the UI side. */
16781
+ iconId: string(),
16782
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16783
+ icon: EventKindIconSchema,
16784
+ category: EventKindCategorySchema,
16785
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16786
+ parentKind: string().nullable(),
16787
+ /** Derived from `parentKind`, explicit for the client tree. */
16788
+ level: EventKindLevelSchema,
16789
+ /** Which cap + device contributes this kind. For built-ins the camera
16790
+ * itself; for sensor kinds the LINKED source device. */
16791
+ source: object({
16792
+ capName: string(),
16793
+ deviceId: number()
16794
+ })
16763
16795
  });
16764
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
16765
- var RetrainTrackSchema = object({
16766
- trackId: string(),
16796
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16797
+ var EventKindsForDeviceSchema = object({
16767
16798
  deviceId: number(),
16768
- className: string(),
16769
- label: string().optional(),
16770
- firstSeen: number(),
16771
- lastSeen: number(),
16772
- /** How many frames the dataset already holds from this track. */
16773
- frameCount: number().int(),
16774
- /** How many subjects have been annotated on those frames. `0` with
16775
- * `frameCount: 0` is exactly "staging, still to work". */
16776
- annotationCount: number().int()
16777
- });
16778
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
16779
- var RetrainFrameCandidateSchema = object({
16780
- mediaKey: string(),
16781
- kind: MediaFileKindEnum,
16782
- timestamp: number(),
16783
- sizeBytes: number().int(),
16784
- /** A copy of this original already exists — selecting it is free and cannot
16785
- * fail, whatever became of the original. */
16786
- copied: boolean()
16799
+ kinds: array(EventKindDescriptorSchema).readonly()
16787
16800
  });
16788
- /** A frame the dataset OWNS: bytes copied at selection time. */
16789
- var RetrainFrameSchema = object({
16790
- frameId: string(),
16801
+ var SensorEventSchema = object({
16802
+ id: string(),
16803
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
16804
+ * yields N rows, one per camera). */
16791
16805
  deviceId: number(),
16792
- trackId: string(),
16793
- /** Provenance only. It may already point at nothing — that is expected. */
16794
- sourceMediaKey: string(),
16795
- sourceKind: MediaFileKindEnum,
16796
- sizeBytes: number().int(),
16797
- width: number().int(),
16798
- height: number().int(),
16799
- copiedAt: number()
16806
+ /** The linked sensor device whose state changed. */
16807
+ sourceDeviceId: number(),
16808
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
16809
+ kind: string(),
16810
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
16811
+ value: record(string(), unknown()).nullable(),
16812
+ timestamp: number()
16800
16813
  });
16801
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
16802
- var RetrainCopyRefusalSchema = _enum([
16803
- "source-missing",
16804
- "unreadable-image",
16805
- "write-failed"
16806
- ]);
16807
- var RetrainFrameSelectionSchema = object({
16808
- copied: array(RetrainFrameSchema).readonly(),
16809
- refused: array(object({
16810
- sourceMediaKey: string(),
16811
- reason: RetrainCopyRefusalSchema
16812
- })).readonly()
16814
+ var TrackPositionSchema = object({
16815
+ x: number(),
16816
+ y: number(),
16817
+ timestamp: number(),
16818
+ bbox: BoundingBoxSchema
16813
16819
  });
16814
- var RetrainFrameListSchema = object({
16815
- candidates: array(RetrainFrameCandidateSchema).readonly(),
16816
- copies: array(RetrainFrameSchema).readonly(),
16817
- /** What the page pre-selects the native key frame when one survives. */
16818
- autoPickMediaKey: string().optional()
16820
+ var TrackSnapshotSchema = object({
16821
+ timestamp: number(),
16822
+ position: TrackPositionSchema,
16823
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16824
+ mediaKey: string()
16819
16825
  });
16820
- /** What the operator asked the assist to look for. */
16821
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
16822
- kind: literal("package"),
16823
- zone: RetrainBboxSchema.optional()
16824
- }), object({
16825
- kind: literal("objects"),
16826
- modelId: string(),
16827
- minScore: number().optional()
16828
- })]);
16829
16826
  /**
16830
- * The assist's answer a discriminated union, because "the model saw nothing"
16831
- * and "this node cannot run that model" lead to different next moves and a
16832
- * nullable result cannot tell them apart.
16827
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16828
+ * divided by the track's detection-frame dims), computed at persist time.
16829
+ * Absent when the frame dims were unknown when the track was persisted
16830
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16833
16831
  */
16834
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
16835
- kind: literal("proposed"),
16836
- modelId: string(),
16837
- stepId: string(),
16838
- minScore: number(),
16839
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
16840
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
16841
- /** Returned by the runner but removed by the threshold. */
16842
- belowThreshold: number().int()
16843
- }), object({
16844
- kind: literal("refused"),
16845
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
16846
- reason: string(),
16847
- detail: string().optional()
16848
- })]);
16849
- /** The outcome of a lifecycle move owned by the retrain page. */
16850
- var RetrainTransitionResultSchema = object({
16851
- trackId: string(),
16852
- /** Where the track ended up, whatever happened. */
16853
- retrainStatus: RetrainStatusSchema,
16854
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
16855
- changed: boolean(),
16856
- reason: _enum([
16857
- "unknown-track",
16858
- "no-frames-copied",
16859
- "not-staging",
16860
- "not-trained",
16861
- "unchanged"
16862
- ]).optional()
16863
- });
16864
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
16865
- var MAX_EVENT_QUERY_LIMIT = 5e3;
16866
- var DeviceEventQueryInput = object({
16867
- deviceId: number(),
16868
- since: number().optional(),
16869
- until: number().optional(),
16870
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
16871
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
16872
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
16873
- * exact behaviour. Callers may omit this field — the store defaults to
16874
- * `full` when not provided. */
16875
- projection: _enum(["full", "slim"]).optional()
16876
- });
16877
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
16878
- var RecentTracksQueryInput = object({
16879
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
16880
- deviceIds: array(number()),
16881
- /** Window lower bound on `lastSeen` (inclusive). */
16882
- since: number().optional(),
16883
- /** Window upper bound on `lastSeen` (inclusive). */
16884
- until: number().optional(),
16885
- /** Page size. Default 200, max 1000. */
16886
- limit: number().int().min(1).max(1e3).default(200),
16887
- /** Opaque continuation cursor from a previous page's `nextCursor`.
16888
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16889
- cursor: string().optional(),
16890
- /** See {@link TrackProjectionSchema}. Default `full`. */
16891
- projection: TrackProjectionSchema.optional(),
16892
- /** Include stationary-promoted rows (parked objects). Default false: the
16893
- * feed lists passages; parking records live on the stationary registry. */
16894
- includeStationary: boolean().optional()
16895
- });
16896
- var RecentTracksPageSchema = object({
16897
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
16898
- tracks: array(TrackSchema).readonly(),
16899
- /** Cursor for the next page, or null when this page is the last. */
16900
- nextCursor: string().nullable()
16832
+ var TrackEnvelopeSchema = object({
16833
+ minX: number(),
16834
+ minY: number(),
16835
+ maxX: number(),
16836
+ maxY: number()
16901
16837
  });
16902
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
16903
- var LIST_GROUPS_MAX_LIMIT = 100;
16904
- var AnalyticsGroupRecordSchema = object({
16905
- id: string(),
16906
- deviceId: number().int(),
16907
- openedAt: number().int(),
16908
- closedAt: number().int(),
16909
- timestamp: number().int(),
16910
- memberCount: number().int(),
16911
- memberTrackIds: array(string()).readonly(),
16912
- className: string(),
16913
- classes: array(string()).readonly(),
16914
- /** Relative event-media path, or null when the group has no picture yet. */
16915
- mediaUrl: string().nullable(),
16916
- singleton: boolean()
16917
- });
16918
- var AnalyticsGroupMemberSchema = object({
16919
- trackId: string(),
16920
- deviceId: number().int(),
16921
- className: string(),
16922
- firstSeen: number().int(),
16923
- lastSeen: number().int(),
16924
- mediaUrl: string().nullable()
16925
- });
16926
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
16927
- var ListGroupsQueryInput = object({
16928
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
16929
- deviceIds: array(number()),
16930
- /** Window lower bound on `closedAt` (inclusive). */
16931
- since: number().optional(),
16932
- /** Window upper bound on `openedAt` (inclusive). */
16933
- until: number().optional(),
16934
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
16935
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
16936
- cursor: string().optional()
16937
- });
16938
- var ListGroupsPageSchema = object({
16939
- groups: array(AnalyticsGroupRecordSchema).readonly(),
16940
- nextCursor: string().nullable()
16941
- });
16942
- var KeyEventQueryInput = object({
16943
- deviceId: number(),
16944
- /** Window lower bound (track firstSeen ≥ since). */
16945
- since: number(),
16946
- /** Window upper bound (track firstSeen ≤ until). */
16947
- until: number(),
16948
- limit: number().int().min(1).max(200).default(50),
16949
- /** Drop tracks scoring below this importance. */
16950
- minImportance: number().min(0).max(1).optional(),
16951
- /** Restrict to a single class (e.g. 'person'). */
16952
- classFilter: string().optional()
16953
- });
16954
- var KeyEventSchema = object({
16955
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
16956
- id: string(),
16957
- trackId: string(),
16958
- /** Track start time (firstSeen). */
16959
- timestamp: number(),
16960
- className: string(),
16961
- ...TieredLabelFields,
16962
- importance: number(),
16963
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
16964
- bestEventId: string(),
16965
- /** Track lifetime in ms (lastSeen - firstSeen). */
16966
- windowMs: number().optional(),
16967
- ...TrackFlagFields,
16968
- ...TrackRetrainFields
16969
- });
16970
- object({
16971
- trackId: string(),
16972
- className: string(),
16973
- confidence: number(),
16974
- bbox: BoundingBoxSchema,
16975
- zones: array(string()).readonly(),
16976
- state: TrackStateSchema
16977
- });
16978
- var OverlayDetectionSchema = looseObject({
16979
- id: string(),
16980
- kind: _enum(["first-level", "detail"]),
16981
- macroClass: string(),
16982
- score: number(),
16983
- bbox: object({
16984
- x: number(),
16985
- y: number(),
16986
- width: number(),
16987
- height: number()
16988
- }),
16989
- labels: array(looseObject({
16990
- label: string(),
16991
- score: number()
16992
- })).readonly(),
16993
- parentId: string().optional()
16994
- });
16995
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
16996
- var SearchObjectEventsInput = object({
16997
- text: string(),
16998
- deviceId: number().optional(),
16999
- since: number().optional(),
17000
- until: number().optional(),
17001
- classFilter: string().optional(),
17002
- limit: number().default(50),
17003
- minScore: number().min(0).max(1).default(.2)
17004
- });
17005
- var TrackCascadeCountsSchema = object({
17006
- /** Persisted track roots deleted (authoritative). */
17007
- tracks: number().int(),
17008
- /** Object events removed with their tracks (best-effort; see note above). */
17009
- events: number().int(),
17010
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17011
- media: number().int(),
17012
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17013
- faces: number().int(),
17014
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17015
- plates: number().int(),
17016
- /** Per-track CLIP search vectors removed (best-effort). */
17017
- embeddings: number().int(),
17018
- /** Group membership + group rows removed with their last member (best-effort). */
17019
- groups: number().int()
17020
- });
17021
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17022
- var DiskReconcileCountsSchema = object({
17023
- mediaDropped: number().int(),
17024
- tracks: number().int(),
17025
- events: number().int()
17026
- });
17027
- /** Event-store footprint for one camera. */
17028
- var EventStoreDeviceFootprintSchema = object({
17029
- deviceId: number(),
17030
- /** Persisted event rows (motion + object + audio) for the camera. */
17031
- rows: number().int(),
17032
- /** Event-owned media bytes on disk for the camera. */
17033
- bytes: number().int()
17034
- });
17035
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17036
- var EventStoreFootprintSchema = object({
17037
- totalRows: number().int(),
17038
- totalBytes: number().int(),
17039
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17040
- });
17041
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17042
- var EventPruneCountsSchema = object({
17043
- motion: number().int(),
17044
- object: number().int(),
17045
- audio: number().int()
16838
+ /**
16839
+ * Row projection for track list queries. `full` (default) returns the
16840
+ * complete Track including the frame-rate `positions[]` history and the
16841
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
16842
+ * keeps every scalar the list surfaces actually render (ids, class(es),
16843
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16844
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16845
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16846
+ * `getTrack`. Mirrors the event-store `projection` convention
16847
+ * (`getObjectEvents` et al.).
16848
+ */
16849
+ var TrackProjectionSchema = _enum(["full", "slim"]);
16850
+ /**
16851
+ * One audio-classification label heard on the track's camera while the
16852
+ * track was alive, aggregated per label. An "episode" is one persisted
16853
+ * audio event (the confident-classification path: score ≥ the device's
16854
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16855
+ * one 32 ms inference chunk, so counts stay human-scaled.
16856
+ */
16857
+ var TrackAudioLabelSchema = object({
16858
+ label: string(),
16859
+ /** Highest classification score observed across the label's episodes. */
16860
+ peakScore: number(),
16861
+ /** Number of coalesced audio-event episodes carrying this label. */
16862
+ count: number(),
16863
+ firstAt: number(),
16864
+ lastAt: number()
17046
16865
  });
17047
16866
  /**
17048
- * Re-embed stored tracks from their key frames.
16867
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16868
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16869
+ * no positions, a single snapshot, and no bbox trajectory at all:
17049
16870
  *
17050
- * The reason this is an operator-callable method and not a migration script:
17051
- * every knob that decides what a vector MEANS encoder model, crop margin,
17052
- * squaring is only changeable if the existing vectors can be regenerated.
17053
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17054
- * symptom is a quality regression with no visible cause.
16871
+ * - `sensor` a linked sensor/control device state change.
16872
+ * - `audio` an audio event on the camera itself that was anomalous for
16873
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
16874
+ *
16875
+ * The spatial subsystems (tracker association, occupancy count, re-id /
16876
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
16877
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16878
+ * check silently readmits every source added after it was written.
17055
16879
  */
17056
- var RebuildObjectEmbeddingsInput = object({
17057
- /** Restrict to one camera. Omit for the whole fleet. */
17058
- deviceId: number().optional(),
17059
- since: number().optional(),
17060
- until: number().optional(),
17061
- /** Stop after this many tracks; the result reports whether more remain. */
17062
- maxTracks: number().int().positive().optional(),
17063
- /**
17064
- * Run every embedding on THIS node instead of round-robining the fleet.
17065
- *
17066
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17067
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17068
- * calling it that would pin the rebuild REQUEST itself to that node — the
17069
- * rebuild orchestration lives on the hub, and only the per-track step runs
17070
- * remotely. This field is data; the per-track pin is applied inside.
17071
- *
17072
- * Absent ⇒ round-robin over every online node whose runner can serve the
17073
- * pinned model.
17074
- */
17075
- executeOnNodeId: string().optional(),
17076
- /**
17077
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17078
- * run flat out.
17079
- *
17080
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17081
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17082
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17083
- * force is logged at start and finish so a deliberately slow pass reads
17084
- * differently from a stalled one.
17085
- */
17086
- pacingMs: number().int().nonnegative().optional()
17087
- });
16880
+ var TrackSourceSchema = _enum([
16881
+ "pipeline",
16882
+ "sensor",
16883
+ "audio"
16884
+ ]);
17088
16885
  /**
17089
- * Result of emptying the CLIP index.
16886
+ * Where a track sits in the RETRAIN lifecycle (D81).
17090
16887
  *
17091
- * The clean slate before a policy change: a new crop margin or encoder model
17092
- * leaves two feature spaces in one index whose cosine scores are not
17093
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17094
- * means the same thing.
16888
+ * - `none` never marked, or un-marked. Evictable.
16889
+ * - `staging` the operator wants this track as training material and has not
16890
+ * finished with it. **This is the only state retention holds**: the track and
16891
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
16892
+ * the device's age window.
16893
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
16894
+ * were COPIED into the retrain dataset at selection time, so the dataset no
16895
+ * longer depends on the track's media and the track becomes EVICTABLE again.
16896
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16897
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
16898
+ *
16899
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16900
+ * the store's filter language has only positive equality and `whereIn` — no
16901
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16902
+ * would make the entire pre-column history immortal in one deploy.
17095
16903
  */
17096
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
16904
+ var RetrainStatusSchema = _enum([
16905
+ "none",
16906
+ "staging",
16907
+ "trained"
16908
+ ]);
17097
16909
  /**
17098
- * Acknowledgement that a rebuild STARTED.
16910
+ * Per-track OPERATOR flags set by hand from the admin UI or the viewer, never
16911
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16912
+ * so the two surfaces cannot drift.
17099
16913
  *
17100
- * The pass costs ~1s per track 45 minutes for a 2,600-track fleet so it
17101
- * runs detached and this returns immediately. Waiting for it made the client
17102
- * time out while the work carried on server-side, which is the worst of both:
17103
- * no result and no way to know it was still going. Poll
17104
- * `getObjectEmbeddingRebuildStatus` for progress.
16914
+ * **Absent false.** A track that has never been touched omits the field; an
16915
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
16916
+ * columns existed read as absent, and a consumer that needs a boolean should say
16917
+ * `flag === true`, not `flag !== false`.
16918
+ *
16919
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16920
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16921
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16922
+ * `trained` track reports `false` while refusing both writes. The boolean is
16923
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
16924
+ * "never marked" from "already trained" must read `retrainStatus`.
16925
+ *
16926
+ * `debug` does NOT pin; it is attention, not durability.
16927
+ *
16928
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16929
+ * A favourited track is skipped by retention the same way `staging` is, but
16930
+ * it does not enter `none|staging|trained` and has no staging budget.
17105
16931
  */
17106
- var RebuildObjectEmbeddingsResultSchema = object({
17107
- started: boolean(),
17108
- /** True when a pass was already running; the new request is ignored. */
17109
- alreadyRunning: boolean()
17110
- });
17111
- var RebuildStatusSchema = object({
17112
- running: boolean(),
17113
- scanned: number(),
17114
- rebuilt: number(),
17115
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17116
- missingKeyFrame: number(),
17117
- /** Tracks with no usable detection box. */
17118
- missingBbox: number(),
17119
- /**
17120
- * Tracks an executing node REFUSED rather than broke on an unreadable key
17121
- * frame, a step that threw. Separate from `failed` because the remedy is
17122
- * different, and because a whole camera silently contributing zero vectors
17123
- * is the shape of failure a rebuild must never hide.
17124
- */
17125
- notRunnable: number(),
17126
- /**
17127
- * The pass stopped because NO node could serve the pinned model.
16932
+ var TrackFlagFields = {
16933
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
16934
+ * `'staging'`. */
16935
+ markForTrain: boolean().optional(),
16936
+ /** Operator marked this track for diagnostic attention. */
16937
+ debug: boolean().optional(),
16938
+ /** Operator favourited this track. Pins it against pruning. */
16939
+ favourited: boolean().optional()
16940
+ };
16941
+ /**
16942
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16943
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16944
+ * write patch, and the status is not something the toggle sets — it is what the
16945
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16946
+ * always present on a persisted row (the column default materialises `'none'`).
16947
+ */
16948
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16949
+ /**
16950
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16951
+ * one flag can never clear the other — the toggles are independent and are
16952
+ * driven from three surfaces that do not know about each other.
16953
+ */
16954
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
16955
+ /**
16956
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
16957
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
16958
+ * mutation result without a re-fetch.
16959
+ */
16960
+ var TrackFlagsSchema = object({
16961
+ trackId: string(),
16962
+ markForTrain: boolean(),
16963
+ debug: boolean(),
16964
+ favourited: boolean(),
16965
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
16966
+ * a track row) because this shape is only ever produced by the write body,
16967
+ * which always knows it — and a surface that has just written needs to render
16968
+ * `trained` without a re-fetch. */
16969
+ retrainStatus: RetrainStatusSchema
16970
+ });
16971
+ union([literal(1), literal(2)]);
16972
+ /**
16973
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
16974
+ * the step and model that produced it — which is what makes the write rule
16975
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16976
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16977
+ *
16978
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16979
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16980
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
16981
+ * that value has no provenance, and the write rule lets ANY properly-attributed
16982
+ * write of the same tier replace it regardless of score.
16983
+ */
16984
+ var LabelAttributionSchema = object({
16985
+ stepId: string(),
16986
+ modelId: string().optional(),
16987
+ decidedAt: number(),
16988
+ /**
16989
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
16990
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17128
16991
  *
17129
- * Distinct from `notRunnable` on purpose: that one says "this track was
17130
- * refused", this one says "the cluster cannot do this work at all" — every
17131
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17132
- * pinned model for its engine format, or dropped out. The remedy is a model /
17133
- * engine change, not a per-camera one. Non-zero here always comes with
17134
- * `complete: false`.
16992
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
16993
+ * notification rule authored on "Gianluca" stopped matching the moment the
16994
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
16995
+ * the thing that does not move, so it is what a rule matches on
16996
+ * (`NcConditions.identities`) and the text is what a human is shown.
16997
+ *
16998
+ * Absent when the label names no gallery row — a plate the OCR read but no
16999
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17135
17000
  */
17136
- noCapableNode: number(),
17137
- failed: number(),
17138
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17139
- complete: boolean().nullable(),
17140
- startedAtMs: number().nullable(),
17141
- finishedAtMs: number().nullable(),
17142
- /** Present when the pass ended by throwing. */
17143
- error: string().nullable()
17001
+ identityId: string().optional()
17144
17002
  });
17145
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17146
- deviceId: number(),
17147
- trackId: string()
17148
- }), TrackSchema.nullable()), method(object({
17149
- deviceId: number(),
17150
- since: number().optional(),
17151
- until: number().optional(),
17152
- limit: number().optional(),
17153
- /** Spatial filter — only tracks whose trajectory intersects the zone
17154
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17155
- * envelope columns, then precisely tested per position. Tracks with
17156
- * an unknown envelope (no frame dims at persist time) always match. */
17157
- zone: TrackZoneFilterSchema.optional(),
17158
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17159
- * compatible omitting the field keeps today's exact behaviour). */
17160
- projection: TrackProjectionSchema.optional(),
17161
- /** Include stationary-promoted rows (parked objects handed to the
17162
- * stationary registry). Default false: the timeline lists passages,
17163
- * not parking records (operator decision, 2026-08-15). */
17164
- includeStationary: boolean().optional()
17165
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17166
- deviceId: number(),
17167
- groupId: string().min(1)
17168
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17169
- kind: "mutation",
17170
- auth: "admin"
17171
- }), 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({
17172
- deviceId: number(),
17173
- since: number().optional(),
17174
- until: number().optional(),
17175
- kinds: array(string()).optional(),
17176
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17177
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17178
- deviceId: number(),
17179
- since: number(),
17180
- until: number(),
17181
- bucketMs: number().int().positive()
17182
- }), array(object({
17183
- bucketStart: number(),
17184
- motion: number().int(),
17185
- object: number().int(),
17186
- audio: number().int()
17187
- })).readonly()), method(object({
17188
- deviceId: number(),
17189
- cutoffMs: number()
17190
- }), object({
17191
- motion: number().int(),
17192
- object: number().int(),
17193
- audio: number().int()
17194
- }), {
17195
- kind: "mutation",
17196
- auth: "admin"
17197
- }), method(object({
17198
- deviceId: number(),
17199
- cutoffMs: number()
17200
- }), TrackCascadeCountsSchema, {
17201
- kind: "mutation",
17202
- auth: "admin"
17203
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17204
- kind: "mutation",
17205
- auth: "admin"
17206
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17207
- kind: "mutation",
17208
- auth: "admin"
17209
- }), method(object({
17210
- deviceId: number(),
17211
- trackIds: array(string()).min(1)
17212
- }), object({
17213
- deleted: number().int(),
17214
- failed: array(string()).readonly()
17215
- }), {
17216
- kind: "mutation",
17217
- auth: "admin"
17218
- }), method(object({
17219
- /** Log/audit scope only — the trackId is globally unique on its own. */
17003
+ /**
17004
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17005
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17006
+ * track and its events always answer the same question the same way.
17007
+ *
17008
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17009
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17010
+ * is tier 2, and each carries its own score + attribution.
17011
+ *
17012
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17013
+ * finest thing known. Before 4g the single `label` column held the finest
17014
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17015
+ * shows nothing on a species-only row; that is why the migration puts every
17016
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17017
+ * and why the read surfaces were changed in the same train.
17018
+ *
17019
+ * **Writing it.** The slots are independent, which is the whole point: a
17020
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17021
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17022
+ * higher score wins. One rule, one implementation — see
17023
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17024
+ */
17025
+ var TieredLabelFields = {
17026
+ /** Tier 1 the sub-class. See {@link LabelTierSchema}. */
17027
+ label: string().optional(),
17028
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17029
+ labelScore: number().optional(),
17030
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17031
+ labelMeta: LabelAttributionSchema.optional(),
17032
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
17033
+ subLabel: string().optional(),
17034
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17035
+ subLabelScore: number().optional(),
17036
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17037
+ subLabelMeta: LabelAttributionSchema.optional()
17038
+ };
17039
+ /** Per-camera slice of a training-export estimate. */
17040
+ var TrainingExportDeviceTotalsSchema = object({
17220
17041
  deviceId: number(),
17042
+ tracks: number().int(),
17043
+ files: number().int(),
17044
+ bytes: number().int()
17045
+ });
17046
+ /**
17047
+ * What a training export WOULD contain. Computed from media index rows only —
17048
+ * no blob is read to produce this.
17049
+ */
17050
+ var TrainingExportSummarySchema = object({
17051
+ generatedAt: number(),
17052
+ trackCount: number().int(),
17053
+ fileCount: number().int(),
17054
+ byteCount: number().int(),
17055
+ /** More marked tracks exist than a single pass carries. */
17056
+ truncated: boolean(),
17057
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17058
+ });
17059
+ var TrackSchema = object({
17221
17060
  trackId: string(),
17222
- flags: TrackFlagsPatchSchema
17223
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17224
- kind: "query",
17225
- auth: "admin"
17226
- }), method(object({
17227
- olderThanMs: number(),
17228
- reason: OpsLogReasonSchema.optional()
17229
- }), EventPruneCountsSchema, {
17230
- kind: "mutation",
17231
- auth: "admin"
17232
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17233
- kind: "mutation",
17234
- auth: "admin"
17235
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17236
- kind: "mutation",
17237
- auth: "admin"
17238
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17239
- kind: "mutation",
17240
- auth: "admin"
17241
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17242
- kind: "mutation",
17243
- auth: "admin"
17244
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17245
- kind: "mutation",
17246
- auth: "admin"
17247
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17248
- kind: "mutation",
17249
- auth: "admin"
17250
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17251
- kind: "query",
17252
- auth: "admin"
17253
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17254
- kind: "query",
17255
- auth: "admin"
17256
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17257
- kind: "query",
17258
- auth: "admin"
17259
- }), method(object({
17260
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17261
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17262
- * route it at one camera's owner, and "every camera" would stop being
17263
- * expressible at all. */
17264
- deviceIds: array(number()).optional(),
17265
- limit: number().int().min(1).max(500).optional()
17266
- }), array(RetrainTrackSchema).readonly(), {
17267
- kind: "query",
17268
- auth: "admin"
17269
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17270
- kind: "query",
17271
- auth: "admin"
17272
- }), method(object({
17273
17061
  deviceId: number(),
17274
- trackId: string(),
17275
- mediaKeys: array(string()).min(1)
17276
- }), RetrainFrameSelectionSchema, {
17277
- kind: "mutation",
17278
- auth: "admin"
17279
- }), method(object({
17062
+ className: string(),
17063
+ ...TieredLabelFields,
17064
+ producingDeviceName: string().optional(),
17065
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17066
+ source: TrackSourceSchema.optional(),
17067
+ firstSeen: number(),
17068
+ lastSeen: number(),
17069
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17070
+ positions: array(TrackPositionSchema).readonly(),
17071
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17072
+ * saveThumbnails policy). */
17073
+ snapshots: array(TrackSnapshotSchema).readonly(),
17074
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17075
+ zonesVisited: array(string()).readonly(),
17076
+ /**
17077
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17078
+ * `zones` capability.
17079
+ *
17080
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17081
+ * and no card can render — so every free-text search surface was structurally
17082
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17083
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17084
+ * derivation and costs the clients no extra call (the `zones` cap is
17085
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17086
+ * surface built to avoid exactly that).
17087
+ *
17088
+ * Resolved, never invented: a zone deleted since the track was written has no
17089
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17090
+ * two are not positionally aligned. Absent when the track visited no zone, or
17091
+ * when the zone catalogue could not be read.
17092
+ */
17093
+ zoneNames: array(string()).readonly().optional(),
17094
+ /** Deduplicated set of detector classes observed for this track over its
17095
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17096
+ * legacy rows written before class accumulation shipped. */
17097
+ classes: array(string()).readonly().optional(),
17098
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17099
+ totalDistance: number(),
17100
+ state: TrackStateSchema,
17101
+ active: boolean(),
17102
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17103
+ * track expiry, recomputed on late label). Absent on legacy rows written
17104
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17105
+ importance: number().optional(),
17106
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17107
+ * "best" frame). Absent when the track produced no object events. */
17108
+ bestEventId: string().optional(),
17109
+ /** Tag of the importance sub-signal that dominated the score
17110
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17111
+ importanceReason: string().optional(),
17112
+ /** Audio-classification labels heard on the camera during the track's
17113
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17114
+ * Absent on legacy rows / tracks with no confident audio. */
17115
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17116
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17117
+ * Populated from the persisted envelope columns on historical reads;
17118
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17119
+ envelope: TrackEnvelopeSchema.optional(),
17120
+ /**
17121
+ * A face DETECTOR found a face on this track — nothing more. It says the
17122
+ * detail plane produced a `face` detail; it does NOT say the face was
17123
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17124
+ * enabled. Set once and never cleared.
17125
+ *
17126
+ * **This exists so "face present but not recognised" is expressible.** A
17127
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17128
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17129
+ * and a track with no face at all were byte-identical on the wire and no
17130
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17131
+ * === undefined`.
17132
+ *
17133
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17134
+ * and so does every server that predates the field — a consumer must test
17135
+ * `=== true` and render nothing otherwise, never infer "no face".
17136
+ */
17137
+ hasFace: boolean().optional(),
17138
+ /**
17139
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17140
+ * face an operator could ASSIGN to an identity.
17141
+ *
17142
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17143
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17144
+ * branch, before every gate, and means no more than "a face detector produced
17145
+ * a face detail". This one is stamped at the single moment the gallery row
17146
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17147
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17148
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17149
+ * the crop-store drop. Everything between the detector and that insert can
17150
+ * legitimately refuse the face, so a flag written any earlier promises the
17151
+ * operator something to assign and delivers nothing.
17152
+ *
17153
+ * **Independent of recognition.** A face collected but never auto-matched is
17154
+ * still assignable — it is in fact the face an operator most wants to reach —
17155
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17156
+ * `subLabel`; this says only that the raw material exists.
17157
+ *
17158
+ * **Set once, never cleared.** A track that produced a gallery row produced
17159
+ * one; deleting the row later is the gallery's business, not this flag's.
17160
+ *
17161
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17162
+ * before the column omits it, and so does every server that predates the
17163
+ * field. A consumer must test `=== true` and render nothing otherwise —
17164
+ * never infer "no assignable face".
17165
+ */
17166
+ hasEmbeddedFace: boolean().optional(),
17167
+ /**
17168
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17169
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17170
+ * so the passage is tracked once and as a VEHICLE.
17171
+ *
17172
+ * It exists because the fold's record was dishonest. D34 and the code both
17173
+ * said "the person is not lost — it is reported so both entities stay on the
17174
+ * record"; in fact the pair went into a per-processor RAM field behind an
17175
+ * accessor nobody called, and every durable surface said `vehicle`, full
17176
+ * stop. This is the composition note that makes the row true.
17177
+ *
17178
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17179
+ * person" is not an answer to "what is this" — both label tiers would refuse
17180
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17181
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17182
+ * and a `person` rule still does not fire for someone cycling past.
17183
+ *
17184
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17185
+ * the column, and every hub that predates the field, omits it. Test
17186
+ * `=== true` and render nothing otherwise — never infer "no rider".
17187
+ */
17188
+ hasRider: boolean().optional(),
17189
+ ...TrackFlagFields,
17190
+ ...TrackRetrainFields
17191
+ });
17192
+ var BaseEventFields = {
17193
+ id: string(),
17280
17194
  deviceId: number(),
17281
- trackId: string(),
17282
- frameId: string()
17283
- }), object({
17284
- removed: boolean(),
17285
- removedAnnotations: number().int()
17286
- }), {
17287
- kind: "mutation",
17288
- auth: "admin"
17289
- }), method(object({ frameId: string() }), object({
17195
+ timestamp: number()
17196
+ };
17197
+ var MotionEventSchema = object({
17198
+ ...BaseEventFields,
17199
+ kind: literal("motion"),
17200
+ regionCount: number(),
17201
+ /** Heavy JSON array — omitted in slim projection. */
17202
+ regions: array(object({
17203
+ bbox: BoundingBoxSchema,
17204
+ pixelCount: number(),
17205
+ intensity: number()
17206
+ })).readonly().optional(),
17207
+ /** Omitted in slim projection. */
17208
+ frameWidth: number().optional(),
17209
+ /** Omitted in slim projection. */
17210
+ frameHeight: number().optional(),
17211
+ /** Populated by B5 (recording playback URL for this event). */
17212
+ mediaUrl: string().optional()
17213
+ });
17214
+ /**
17215
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17216
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17217
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17218
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17219
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17220
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17221
+ */
17222
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17223
+ /**
17224
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17225
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17226
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17227
+ * appearance event carry none, so a rule asking for a direction fails closed
17228
+ * on them.
17229
+ *
17230
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17231
+ * into its own event, so a frame in which a track enters A while leaving B
17232
+ * produces two events with two directions — never one ambiguous row.
17233
+ *
17234
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17235
+ * membership the box has NOW, and by definition it no longer contains the zone
17236
+ * that was just left. Without the id here, a zone-scoped rule could never match
17237
+ * the exit it asked for.
17238
+ */
17239
+ var ZoneCrossingSchema = object({
17240
+ direction: _enum(["enter", "exit"]),
17241
+ /** Admin zone id crossed. */
17242
+ zoneId: string(),
17243
+ /** Zone display name at crossing time (falls back to the id). */
17244
+ zoneName: string().optional()
17245
+ });
17246
+ var ObjectEventSchema = object({
17247
+ ...BaseEventFields,
17248
+ kind: literal("object"),
17249
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17250
+ source: DetectionSourceSchema.optional(),
17251
+ /**
17252
+ * Inference-frame id shared by every object event emitted from the SAME frame
17253
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17254
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17255
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17256
+ * Optional for backward-compat with pre-existing rows / the slim projection
17257
+ * includes it (it is light). Absent on rows written before this field.
17258
+ */
17259
+ frameId: string().optional(),
17260
+ /** Omitted in slim projection. */
17261
+ trackId: string().optional(),
17262
+ className: string(),
17263
+ ...TieredLabelFields,
17264
+ /** Omitted in slim projection. */
17265
+ confidence: number().optional(),
17266
+ /** Heavy JSON — omitted in slim projection. */
17267
+ bbox: BoundingBoxSchema.optional(),
17268
+ /** Heavy JSON — omitted in slim projection. */
17269
+ zones: array(string()).readonly().optional(),
17270
+ /** Omitted in slim projection. */
17271
+ state: TrackStateSchema.optional(),
17272
+ /**
17273
+ * The zone crossing this event IS, when it is one. Absent on every other
17274
+ * event kind (movement state, appearance, package) — see
17275
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17276
+ */
17277
+ zoneCrossing: ZoneCrossingSchema.optional(),
17278
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17279
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17280
+ frameWidth: number().optional(),
17281
+ frameHeight: number().optional(),
17282
+ /** MediaStore key for the crop attached to this event (if any). */
17283
+ mediaKey: string().optional(),
17284
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17285
+ * best-detection full frame). Resolve via the event-media data-plane
17286
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17287
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17288
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17289
+ keyFrameMediaKey: string().optional(),
17290
+ /** Populated by B5 (recording playback URL for this event). */
17291
+ mediaUrl: string().optional(),
17292
+ /** The parent track's key-event importance [0,1], propagated to every object
17293
+ * event of the track (so an event row can be sorted by importance without a
17294
+ * track join). Absent on legacy rows / before the track was scored. */
17295
+ importance: number().optional()
17296
+ });
17297
+ var AudioEventSchema = object({
17298
+ ...BaseEventFields,
17299
+ kind: literal("audio"),
17300
+ rms: number(),
17301
+ dbfs: number(),
17302
+ classification: object({
17303
+ className: string(),
17304
+ originalClass: string().optional(),
17305
+ score: number()
17306
+ }).optional(),
17307
+ /** Populated by B5 (recording playback URL for this event). */
17308
+ mediaUrl: string().optional()
17309
+ });
17310
+ var MediaFileKindEnum = _enum([
17311
+ "crop",
17312
+ "thumbnail",
17313
+ "snapshot",
17314
+ "firstFrame",
17315
+ "lastFrame",
17316
+ "fullFrame",
17317
+ "fullFrameBoxed",
17318
+ "faceCrop",
17319
+ "plateCrop",
17320
+ "keyFrame",
17321
+ "keyFrameSmall",
17322
+ "thumbnailSmall"
17323
+ ]);
17324
+ var MediaFileSchema = object({
17325
+ key: string(),
17326
+ kind: MediaFileKindEnum,
17290
17327
  base64: string(),
17291
- width: number().int(),
17292
- height: number().int()
17293
- }), {
17294
- kind: "query",
17295
- auth: "admin"
17296
- }), method(object({
17297
- deviceId: number(),
17298
- trackId: string(),
17299
- frameId: string(),
17300
- subject: RetrainAssistSubjectSchema,
17301
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17302
- nodeId: string().optional()
17303
- }), RetrainAssistResultSchema, {
17304
- kind: "mutation",
17305
- auth: "admin"
17306
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17307
- kind: "query",
17308
- auth: "admin"
17309
- }), method(object({
17310
- deviceId: number(),
17311
- trackId: string(),
17312
- frameId: string(),
17313
- annotations: array(RetrainAnnotationDraftSchema)
17314
- }), array(RetrainAnnotationSchema).readonly(), {
17315
- kind: "mutation",
17316
- auth: "admin"
17317
- }), method(object({
17318
- deviceId: number(),
17319
- trackId: string()
17320
- }), RetrainTransitionResultSchema, {
17321
- kind: "mutation",
17322
- auth: "admin"
17323
- }), method(object({
17324
- deviceId: number(),
17325
- trackId: string()
17326
- }), RetrainTransitionResultSchema, {
17327
- kind: "mutation",
17328
- auth: "admin"
17329
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17330
- kind: "query",
17331
- auth: "admin"
17332
- }), method(object({
17333
- eventId: string(),
17334
- kind: MediaFileKindEnum.optional(),
17335
- deviceId: number()
17336
- }), array(MediaFileSchema).readonly()), method(object({
17337
- trackId: string(),
17338
- kinds: array(MediaFileKindEnum).optional(),
17339
- deviceId: number()
17340
- }), array(MediaFileSchema).readonly()), method(object({
17328
+ sizeBytes: number(),
17329
+ timestamp: number()
17330
+ });
17331
+ /**
17332
+ * One media row WITHOUT its bytes.
17333
+ *
17334
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17335
+ * 140 s track), and a client that renders tiles from the media data plane needs
17336
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17337
+ * with an immutable cache, instead of all at once inside a tRPC response that
17338
+ * blocks the whole view.
17339
+ *
17340
+ * `sizeBytes` is carried because it is what lets a client decide between the
17341
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17342
+ */
17343
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17344
+ /**
17345
+ * The MACRO tier of an annotation — a CLOSED set.
17346
+ *
17347
+ * This is what the exported detector predicts, so a typo here is a new class
17348
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17349
+ * the whole point of the page is teaching the model things it does not know
17350
+ * yet, and constraining that vocabulary would make it useless.
17351
+ *
17352
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17353
+ * `subLabel` is one of these values, in any casing, because once `person`
17354
+ * exists in both tiers "every person box" stops being answerable without
17355
+ * knowing every string anyone ever typed — and the damage is retroactive.
17356
+ */
17357
+ var RetrainMacroClassSchema = _enum([
17358
+ "person",
17359
+ "vehicle",
17360
+ "animal",
17361
+ "package",
17362
+ "face",
17363
+ "plate"
17364
+ ]);
17365
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17366
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17367
+ /** Did a human draw this box, or did the assist propose it? */
17368
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17369
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17370
+ var RetrainBboxSchema = object({
17371
+ x: number(),
17372
+ y: number(),
17373
+ w: number(),
17374
+ h: number()
17375
+ });
17376
+ /**
17377
+ * One annotated subject.
17378
+ *
17379
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17380
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17381
+ * derived from it at export and never stored — storing them is how one feature
17382
+ * space ends up holding two crops of the same subject (D52).
17383
+ */
17384
+ var RetrainAnnotationSchema = object({
17385
+ id: string(),
17341
17386
  trackId: string(),
17342
- deviceId: number()
17343
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17344
- kind: "mutation",
17345
- auth: "admin"
17346
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17347
- kind: "mutation",
17348
- auth: "admin"
17349
- }), method(object({}), RebuildStatusSchema), object({
17350
- deviceId: number(),
17351
- timestamp: number(),
17352
- frameWidth: number(),
17353
- frameHeight: number(),
17354
- detections: array(OverlayDetectionSchema).readonly()
17355
- }), object({
17356
17387
  deviceId: number(),
17388
+ /** The COPY in retrain storage — never the source track's media key. */
17389
+ mediaKey: string(),
17390
+ bbox: RetrainBboxSchema,
17391
+ macroClass: RetrainMacroClassSchema,
17392
+ label: string().optional(),
17393
+ subLabel: string().optional(),
17394
+ kind: RetrainAnnotationKindSchema,
17395
+ source: RetrainAnnotationSourceSchema,
17396
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17397
+ assistModelId: string().optional(),
17398
+ assistScore: number().optional(),
17399
+ exportedInBatch: string().optional(),
17400
+ createdAt: number()
17401
+ });
17402
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17403
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17404
+ id: true,
17405
+ trackId: true,
17406
+ deviceId: true,
17407
+ mediaKey: true,
17408
+ createdAt: true,
17409
+ exportedInBatch: true
17410
+ });
17411
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17412
+ var RetrainTrackSchema = object({
17357
17413
  trackId: string(),
17358
- className: string()
17359
- }), object({
17360
17414
  deviceId: number(),
17361
- trackId: string(),
17362
17415
  className: string(),
17363
- durationMs: number()
17364
- }), object({
17416
+ label: string().optional(),
17417
+ firstSeen: number(),
17418
+ lastSeen: number(),
17419
+ /** How many frames the dataset already holds from this track. */
17420
+ frameCount: number().int(),
17421
+ /** How many subjects have been annotated on those frames. `0` with
17422
+ * `frameCount: 0` is exactly "staging, still to work". */
17423
+ annotationCount: number().int()
17424
+ });
17425
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17426
+ var RetrainFrameCandidateSchema = object({
17427
+ mediaKey: string(),
17428
+ kind: MediaFileKindEnum,
17429
+ timestamp: number(),
17430
+ sizeBytes: number().int(),
17431
+ /** A copy of this original already exists — selecting it is free and cannot
17432
+ * fail, whatever became of the original. */
17433
+ copied: boolean()
17434
+ });
17435
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17436
+ var RetrainFrameSchema = object({
17437
+ frameId: string(),
17365
17438
  deviceId: number(),
17366
- kind: EventKindSchema,
17367
- eventId: string(),
17368
- timestamp: number()
17439
+ trackId: string(),
17440
+ /** Provenance only. It may already point at nothing — that is expected. */
17441
+ sourceMediaKey: string(),
17442
+ sourceKind: MediaFileKindEnum,
17443
+ sizeBytes: number().int(),
17444
+ width: number().int(),
17445
+ height: number().int(),
17446
+ copiedAt: number()
17447
+ });
17448
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17449
+ var RetrainCopyRefusalSchema = _enum([
17450
+ "source-missing",
17451
+ "unreadable-image",
17452
+ "write-failed"
17453
+ ]);
17454
+ var RetrainFrameSelectionSchema = object({
17455
+ copied: array(RetrainFrameSchema).readonly(),
17456
+ refused: array(object({
17457
+ sourceMediaKey: string(),
17458
+ reason: RetrainCopyRefusalSchema
17459
+ })).readonly()
17369
17460
  });
17461
+ var RetrainFrameListSchema = object({
17462
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17463
+ copies: array(RetrainFrameSchema).readonly(),
17464
+ /** What the page pre-selects — the native key frame when one survives. */
17465
+ autoPickMediaKey: string().optional()
17466
+ });
17467
+ /** What the operator asked the assist to look for. */
17468
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17469
+ kind: literal("package"),
17470
+ zone: RetrainBboxSchema.optional()
17471
+ }), object({
17472
+ kind: literal("objects"),
17473
+ modelId: string(),
17474
+ minScore: number().optional()
17475
+ })]);
17370
17476
  /**
17371
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17372
- * within the frame, so the executor can re-cut a leaf child ROI at native
17373
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17477
+ * The assist's answer a discriminated union, because "the model saw nothing"
17478
+ * and "this node cannot run that model" lead to different next moves and a
17479
+ * nullable result cannot tell them apart.
17374
17480
  */
17375
- var NativeCropRefSchema = object({
17376
- /** Handle keying the retained native surface (node-pinned to its owner). */
17377
- handle: FrameHandleSchema,
17378
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17379
- cropFrameSpace: object({
17380
- x: number(),
17381
- y: number(),
17382
- w: number(),
17383
- h: number()
17384
- })
17481
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17482
+ kind: literal("proposed"),
17483
+ modelId: string(),
17484
+ stepId: string(),
17485
+ minScore: number(),
17486
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17487
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17488
+ /** Returned by the runner but removed by the threshold. */
17489
+ belowThreshold: number().int()
17490
+ }), object({
17491
+ kind: literal("refused"),
17492
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17493
+ reason: string(),
17494
+ detail: string().optional()
17495
+ })]);
17496
+ /** The outcome of a lifecycle move owned by the retrain page. */
17497
+ var RetrainTransitionResultSchema = object({
17498
+ trackId: string(),
17499
+ /** Where the track ended up, whatever happened. */
17500
+ retrainStatus: RetrainStatusSchema,
17501
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17502
+ changed: boolean(),
17503
+ reason: _enum([
17504
+ "unknown-track",
17505
+ "no-frames-copied",
17506
+ "not-staging",
17507
+ "not-trained",
17508
+ "unchanged"
17509
+ ]).optional()
17385
17510
  });
17386
- object({
17387
- crop: object({
17388
- left: number(),
17389
- top: number(),
17390
- width: number().positive(),
17391
- height: number().positive()
17392
- }).optional(),
17393
- content: object({
17394
- width: number().int().positive(),
17395
- height: number().int().positive()
17396
- }),
17397
- fit: _enum(["stretch", "contain"]),
17398
- format: _enum([
17399
- "rgb",
17400
- "gray",
17401
- "jpeg"
17402
- ])
17511
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17512
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17513
+ var DeviceEventQueryInput = object({
17514
+ deviceId: number(),
17515
+ since: number().optional(),
17516
+ until: number().optional(),
17517
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17518
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17519
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17520
+ * exact behaviour. Callers may omit this field — the store defaults to
17521
+ * `full` when not provided. */
17522
+ projection: _enum(["full", "slim"]).optional()
17403
17523
  });
17404
- var FrameRefSchema = object({
17405
- registryId: string().min(1),
17406
- id: string().min(1),
17407
- width: number().int().positive(),
17408
- height: number().int().positive(),
17409
- format: _enum(["rgb", "gray"]),
17410
- timestamp: number(),
17411
- capturedAt: number().optional()
17524
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17525
+ var RecentTracksQueryInput = object({
17526
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17527
+ deviceIds: array(number()),
17528
+ /** Window lower bound on `lastSeen` (inclusive). */
17529
+ since: number().optional(),
17530
+ /** Window upper bound on `lastSeen` (inclusive). */
17531
+ until: number().optional(),
17532
+ /** Page size. Default 200, max 1000. */
17533
+ limit: number().int().min(1).max(1e3).default(200),
17534
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17535
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17536
+ cursor: string().optional(),
17537
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17538
+ projection: TrackProjectionSchema.optional(),
17539
+ /** Include stationary-promoted rows (parked objects). Default false: the
17540
+ * feed lists passages; parking records live on the stationary registry. */
17541
+ includeStationary: boolean().optional()
17412
17542
  });
17413
- var ModelFormatSchema$1 = _enum([
17414
- "onnx",
17415
- "coreml",
17416
- "openvino",
17417
- "tflite",
17418
- "pt",
17419
- "gguf"
17420
- ]);
17421
- var PipelineSlotSchema = _enum([
17422
- "detector",
17423
- "cropper",
17424
- "classifier",
17425
- "refiner",
17426
- "audio-classifier"
17427
- ]);
17428
- var PipelineEngineChoiceSchema = object({
17429
- runtime: _enum(["node", "python"]),
17430
- backend: string(),
17431
- format: ModelFormatSchema$1,
17432
- device: string().optional()
17543
+ var RecentTracksPageSchema = object({
17544
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17545
+ tracks: array(TrackSchema).readonly(),
17546
+ /** Cursor for the next page, or null when this page is the last. */
17547
+ nextCursor: string().nullable()
17548
+ });
17549
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17550
+ var LIST_GROUPS_MAX_LIMIT = 100;
17551
+ var AnalyticsGroupRecordSchema = object({
17552
+ id: string(),
17553
+ deviceId: number().int(),
17554
+ openedAt: number().int(),
17555
+ closedAt: number().int(),
17556
+ timestamp: number().int(),
17557
+ memberCount: number().int(),
17558
+ memberTrackIds: array(string()).readonly(),
17559
+ className: string(),
17560
+ classes: array(string()).readonly(),
17561
+ /** Relative event-media path, or null when the group has no picture yet. */
17562
+ mediaUrl: string().nullable(),
17563
+ singleton: boolean()
17433
17564
  });
17434
- var AvailableEngineSchema = object({
17435
- engine: PipelineEngineChoiceSchema,
17436
- devices: array(object({
17437
- id: string(),
17438
- label: string(),
17439
- description: string().optional()
17440
- })).readonly(),
17441
- defaultDevice: string()
17565
+ var AnalyticsGroupMemberSchema = object({
17566
+ trackId: string(),
17567
+ deviceId: number().int(),
17568
+ className: string(),
17569
+ firstSeen: number().int(),
17570
+ lastSeen: number().int(),
17571
+ mediaUrl: string().nullable()
17442
17572
  });
17443
- var PipelineDefaultStepSchema = lazy(() => object({
17444
- addonId: string(),
17445
- addonName: string(),
17446
- slot: PipelineSlotSchema,
17447
- inputClasses: array(string()).readonly(),
17448
- outputClasses: array(string()).readonly(),
17449
- enabled: boolean(),
17450
- modelId: string(),
17451
- children: array(PipelineDefaultStepSchema).readonly(),
17452
- group: string().optional(),
17453
- settings: record(string(), unknown()).optional()
17454
- }));
17455
- var PipelineTemplateStepSchema = lazy(() => object({
17456
- addonId: string(),
17457
- enabled: boolean(),
17458
- modelId: string(),
17459
- children: array(PipelineTemplateStepSchema).readonly(),
17460
- settings: record(string(), unknown()).optional()
17461
- }));
17462
- var PipelineTemplateSchema$1 = object({
17463
- id: string(),
17464
- name: string(),
17465
- createdAt: string(),
17466
- updatedAt: string(),
17467
- engine: PipelineEngineChoiceSchema,
17468
- steps: array(PipelineTemplateStepSchema).readonly()
17573
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17574
+ var ListGroupsQueryInput = object({
17575
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17576
+ deviceIds: array(number()),
17577
+ /** Window lower bound on `closedAt` (inclusive). */
17578
+ since: number().optional(),
17579
+ /** Window upper bound on `openedAt` (inclusive). */
17580
+ until: number().optional(),
17581
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17582
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17583
+ cursor: string().optional()
17469
17584
  });
17470
- var PipelineModelOptionSchema = object({
17471
- id: string(),
17472
- name: string(),
17473
- formats: record(string(), object({
17474
- downloaded: boolean(),
17475
- sizeMB: number()
17476
- })),
17477
- group: ModelVariantGroupSchema.optional(),
17478
- legacy: boolean().optional(),
17479
- provider: ModelProviderIdSchema.optional()
17585
+ var ListGroupsPageSchema = object({
17586
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17587
+ nextCursor: string().nullable()
17480
17588
  });
17481
- var ConfigFieldBridge = custom();
17482
- var PipelineAddonSchemaSchema = object({
17483
- id: string(),
17484
- name: string(),
17485
- slot: PipelineSlotSchema,
17486
- inputClasses: array(string()).readonly(),
17487
- outputClasses: array(string()).readonly(),
17488
- childSlots: array(PipelineSlotSchema).readonly(),
17489
- models: array(PipelineModelOptionSchema).readonly(),
17490
- defaultModelId: string(),
17491
- defaultModelIdByFormat: record(string(), string()).optional(),
17492
- enabledByDefault: boolean().optional(),
17493
- backfillIntoExistingOverrides: boolean().optional(),
17494
- defaultConfidence: number(),
17495
- group: string().optional(),
17496
- configSchema: array(ConfigFieldBridge).readonly().optional()
17589
+ var KeyEventQueryInput = object({
17590
+ deviceId: number(),
17591
+ /** Window lower bound (track firstSeen ≥ since). */
17592
+ since: number(),
17593
+ /** Window upper bound (track firstSeen ≤ until). */
17594
+ until: number(),
17595
+ limit: number().int().min(1).max(200).default(50),
17596
+ /** Drop tracks scoring below this importance. */
17597
+ minImportance: number().min(0).max(1).optional(),
17598
+ /** Restrict to a single class (e.g. 'person'). */
17599
+ classFilter: string().optional()
17497
17600
  });
17498
- var PipelineSlotSchemaSchema = object({
17499
- id: PipelineSlotSchema,
17500
- label: string(),
17501
- priority: number(),
17502
- parentSlot: PipelineSlotSchema.nullable(),
17503
- addons: array(PipelineAddonSchemaSchema).readonly()
17601
+ var KeyEventSchema = object({
17602
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17603
+ id: string(),
17604
+ trackId: string(),
17605
+ /** Track start time (firstSeen). */
17606
+ timestamp: number(),
17607
+ className: string(),
17608
+ ...TieredLabelFields,
17609
+ importance: number(),
17610
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17611
+ bestEventId: string(),
17612
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17613
+ windowMs: number().optional(),
17614
+ ...TrackFlagFields,
17615
+ ...TrackRetrainFields
17504
17616
  });
17505
- var PipelineSchemaSchema = object({
17506
- availableEngines: array(AvailableEngineSchema).readonly(),
17507
- selectedEngine: PipelineEngineChoiceSchema,
17508
- slots: array(PipelineSlotSchemaSchema).readonly()
17617
+ object({
17618
+ trackId: string(),
17619
+ className: string(),
17620
+ confidence: number(),
17621
+ bbox: BoundingBoxSchema,
17622
+ zones: array(string()).readonly(),
17623
+ state: TrackStateSchema
17509
17624
  });
17510
- var EngineProvisioningSchema = object({
17511
- runtimeId: _enum([
17512
- "onnx",
17513
- "openvino",
17514
- "coreml",
17515
- "edgetpu"
17516
- ]).nullable(),
17517
- device: string().nullable(),
17518
- state: _enum([
17519
- "idle",
17520
- "installing",
17521
- "verifying",
17522
- "ready",
17523
- "failed"
17524
- ]),
17525
- progress: number().optional(),
17526
- error: string().optional(),
17527
- nextRetryAt: number().optional(),
17528
- /**
17529
- * Gate A (config-correctness gate at engine change): human-readable
17530
- * config issues surfaced EAGERLY when the node's engine changes — model
17531
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17532
- * has a <format> build"). Additive/optional: informational only, never
17533
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17534
- * Absent/empty when the node-default tree resolves cleanly.
17535
- */
17536
- configIssues: array(string()).optional()
17625
+ var OverlayDetectionSchema = looseObject({
17626
+ id: string(),
17627
+ kind: _enum(["first-level", "detail"]),
17628
+ macroClass: string(),
17629
+ score: number(),
17630
+ bbox: object({
17631
+ x: number(),
17632
+ y: number(),
17633
+ width: number(),
17634
+ height: number()
17635
+ }),
17636
+ labels: array(looseObject({
17637
+ label: string(),
17638
+ score: number()
17639
+ })).readonly(),
17640
+ parentId: string().optional()
17537
17641
  });
17538
- var PipelineStepInputSchema = lazy(() => object({
17539
- addonId: string(),
17540
- modelId: string().optional(),
17541
- enabled: boolean().default(true),
17542
- children: array(PipelineStepInputSchema).optional(),
17543
- settings: record(string(), unknown()).optional(),
17544
- jumpDeviceKey: string().optional()
17545
- }));
17546
- var ModelSubstitutionSchema = object({
17547
- addonId: string(),
17548
- chosen: string(),
17549
- running: string(),
17550
- format: string()
17642
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17643
+ var SearchObjectEventsInput = object({
17644
+ text: string(),
17645
+ deviceId: number().optional(),
17646
+ since: number().optional(),
17647
+ until: number().optional(),
17648
+ classFilter: string().optional(),
17649
+ limit: number().default(50),
17650
+ minScore: number().min(0).max(1).default(.2)
17551
17651
  });
17552
- var PipelineValidationIssueSchema = object({
17553
- addonId: string(),
17554
- kind: _enum(["unknown-addon", "no-format-build"]),
17555
- detail: string()
17652
+ var TrackCascadeCountsSchema = object({
17653
+ /** Persisted track roots deleted (authoritative). */
17654
+ tracks: number().int(),
17655
+ /** Object events removed with their tracks (best-effort; see note above). */
17656
+ events: number().int(),
17657
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17658
+ media: number().int(),
17659
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
17660
+ faces: number().int(),
17661
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17662
+ plates: number().int(),
17663
+ /** Per-track CLIP search vectors removed (best-effort). */
17664
+ embeddings: number().int(),
17665
+ /** Group membership + group rows removed with their last member (best-effort). */
17666
+ groups: number().int()
17556
17667
  });
17557
- var PipelineValidationResultSchema = object({
17558
- ok: boolean(),
17559
- issues: array(PipelineValidationIssueSchema).readonly(),
17560
- substitutions: array(ModelSubstitutionSchema).readonly(),
17561
- /** The node's `currentEngine.format` this validation ran against. */
17562
- format: string()
17668
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17669
+ var DiskReconcileCountsSchema = object({
17670
+ mediaDropped: number().int(),
17671
+ tracks: number().int(),
17672
+ events: number().int()
17563
17673
  });
17564
- var ReferenceImageEntrySchema = object({
17565
- filename: string(),
17566
- stepIds: array(string()).readonly().optional()
17674
+ /** Event-store footprint for one camera. */
17675
+ var EventStoreDeviceFootprintSchema = object({
17676
+ deviceId: number(),
17677
+ /** Persisted event rows (motion + object + audio) for the camera. */
17678
+ rows: number().int(),
17679
+ /** Event-owned media bytes on disk for the camera. */
17680
+ bytes: number().int()
17567
17681
  });
17568
- var ReferenceImageBodySchema = object({
17569
- base64: string(),
17570
- filename: string()
17682
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17683
+ var EventStoreFootprintSchema = object({
17684
+ totalRows: number().int(),
17685
+ totalBytes: number().int(),
17686
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
17571
17687
  });
17572
- var ReferenceAudioEntrySchema = object({
17573
- filename: string(),
17574
- sizeKb: number()
17688
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
17689
+ var EventPruneCountsSchema = object({
17690
+ motion: number().int(),
17691
+ object: number().int(),
17692
+ audio: number().int()
17575
17693
  });
17576
- var ReferenceAudioBodySchema = object({ base64: string() });
17577
- var AudioBackendSchema = object({
17578
- id: string(),
17579
- name: string(),
17580
- description: string(),
17581
- available: boolean(),
17694
+ /**
17695
+ * Re-embed stored tracks from their key frames.
17696
+ *
17697
+ * The reason this is an operator-callable method and not a migration script:
17698
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
17699
+ * squaring — is only changeable if the existing vectors can be regenerated.
17700
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
17701
+ * symptom is a quality regression with no visible cause.
17702
+ */
17703
+ var RebuildObjectEmbeddingsInput = object({
17704
+ /** Restrict to one camera. Omit for the whole fleet. */
17705
+ deviceId: number().optional(),
17706
+ since: number().optional(),
17707
+ until: number().optional(),
17708
+ /** Stop after this many tracks; the result reports whether more remain. */
17709
+ maxTracks: number().int().positive().optional(),
17582
17710
  /**
17583
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17584
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17585
- * the benchmark UI to populate the `enabledMicroClasses` filter
17586
- * specific to the selected backend without a separate fetch.
17711
+ * Run every embedding on THIS node instead of round-robining the fleet.
17712
+ *
17713
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17714
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17715
+ * calling it that would pin the rebuild REQUEST itself to that node — the
17716
+ * rebuild orchestration lives on the hub, and only the per-track step runs
17717
+ * remotely. This field is data; the per-track pin is applied inside.
17718
+ *
17719
+ * Absent ⇒ round-robin over every online node whose runner can serve the
17720
+ * pinned model.
17587
17721
  */
17588
- rawLabels: array(string()).readonly().optional()
17589
- });
17590
- var AudioCapabilitiesSchema = object({
17591
- activeBackend: string(),
17592
- availableBackends: array(AudioBackendSchema).readonly(),
17593
- sampleRate: number(),
17594
- chunkDurationMs: number()
17595
- });
17596
- var DownloadModelResultSchema = object({
17597
- filePath: string(),
17598
- sizeMB: number(),
17599
- durationMs: number()
17722
+ executeOnNodeId: string().optional(),
17723
+ /**
17724
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17725
+ * run flat out.
17726
+ *
17727
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
17728
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17729
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17730
+ * force is logged at start and finish so a deliberately slow pass reads
17731
+ * differently from a stalled one.
17732
+ */
17733
+ pacingMs: number().int().nonnegative().optional()
17600
17734
  });
17601
17735
  /**
17602
- * Wrapper carrying a single test run's result. Replaces the legacy
17603
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17604
- * canonical `AudioResult` from the Phase 6 output rework: one
17605
- * `AudioDetection` per class above `minScore`, top-N candidates in
17606
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17607
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17608
- * benchmark UI can still report a clean failure when the classifier
17609
- * cap isn't available.
17736
+ * Result of emptying the CLIP index.
17737
+ *
17738
+ * The clean slate before a policy change: a new crop margin or encoder model
17739
+ * leaves two feature spaces in one index whose cosine scores are not
17740
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
17741
+ * means the same thing.
17610
17742
  */
17611
- var AudioTestResultSchema = object({
17612
- success: boolean(),
17613
- error: string().optional(),
17614
- frame: custom().optional()
17743
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17744
+ /**
17745
+ * Acknowledgement that a rebuild STARTED.
17746
+ *
17747
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17748
+ * runs detached and this returns immediately. Waiting for it made the client
17749
+ * time out while the work carried on server-side, which is the worst of both:
17750
+ * no result and no way to know it was still going. Poll
17751
+ * `getObjectEmbeddingRebuildStatus` for progress.
17752
+ */
17753
+ var RebuildObjectEmbeddingsResultSchema = object({
17754
+ started: boolean(),
17755
+ /** True when a pass was already running; the new request is ignored. */
17756
+ alreadyRunning: boolean()
17615
17757
  });
17616
- var PipelineConfigBridge = custom();
17617
- var ConfigUISchemaBridge = custom();
17618
- var ConfigUISchemaNullableBridge = custom();
17619
- var InferenceCapabilitiesBridge = custom();
17620
- var ModelAvailabilityListBridge = custom();
17621
- var PipelineRunResultBridge = custom();
17622
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17623
- modelId: string(),
17624
- settings: record(string(), unknown()).readonly()
17625
- }))), method(object({ steps: record(string(), object({
17626
- modelId: string(),
17627
- settings: record(string(), unknown()).readonly()
17628
- })) }), object({ success: literal(true) }), {
17758
+ var RebuildStatusSchema = object({
17759
+ running: boolean(),
17760
+ scanned: number(),
17761
+ rebuilt: number(),
17762
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
17763
+ missingKeyFrame: number(),
17764
+ /** Tracks with no usable detection box. */
17765
+ missingBbox: number(),
17766
+ /**
17767
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
17768
+ * frame, a step that threw. Separate from `failed` because the remedy is
17769
+ * different, and because a whole camera silently contributing zero vectors
17770
+ * is the shape of failure a rebuild must never hide.
17771
+ */
17772
+ notRunnable: number(),
17773
+ /**
17774
+ * The pass stopped because NO node could serve the pinned model.
17775
+ *
17776
+ * Distinct from `notRunnable` on purpose: that one says "this track was
17777
+ * refused", this one says "the cluster cannot do this work at all" — every
17778
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
17779
+ * pinned model for its engine format, or dropped out. The remedy is a model /
17780
+ * engine change, not a per-camera one. Non-zero here always comes with
17781
+ * `complete: false`.
17782
+ */
17783
+ noCapableNode: number(),
17784
+ failed: number(),
17785
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
17786
+ complete: boolean().nullable(),
17787
+ startedAtMs: number().nullable(),
17788
+ finishedAtMs: number().nullable(),
17789
+ /** Present when the pass ended by throwing. */
17790
+ error: string().nullable()
17791
+ });
17792
+ var ReplayFrameInputSchema = object({
17793
+ timestamp: number(),
17794
+ frame: PipelineRunResultBridge
17795
+ });
17796
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
17797
+ className: string(),
17798
+ firstSeenMs: number(),
17799
+ lastSeenMs: number(),
17800
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
17801
+ * frame — a representative box for the diff's `(className, window, IoU)`
17802
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
17803
+ * trajectory production's `Track.positions` keeps. */
17804
+ bbox: BoundingBoxSchema,
17805
+ /** How many of the input frames this track matched a real detection on
17806
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
17807
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
17808
+ framesMatched: number().int()
17809
+ })).readonly() });
17810
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17811
+ deviceId: number(),
17812
+ trackId: string()
17813
+ }), TrackSchema.nullable()), method(object({
17814
+ deviceId: number(),
17815
+ since: number().optional(),
17816
+ until: number().optional(),
17817
+ limit: number().optional(),
17818
+ /** Spatial filter — only tracks whose trajectory intersects the zone
17819
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17820
+ * envelope columns, then precisely tested per position. Tracks with
17821
+ * an unknown envelope (no frame dims at persist time) always match. */
17822
+ zone: TrackZoneFilterSchema.optional(),
17823
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
17824
+ * compatible — omitting the field keeps today's exact behaviour). */
17825
+ projection: TrackProjectionSchema.optional(),
17826
+ /** Include stationary-promoted rows (parked objects handed to the
17827
+ * stationary registry). Default false: the timeline lists passages,
17828
+ * not parking records (operator decision, 2026-08-15). */
17829
+ includeStationary: boolean().optional()
17830
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17831
+ deviceId: number(),
17832
+ groupId: string().min(1)
17833
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17834
+ kind: "mutation",
17835
+ auth: "admin"
17836
+ }), 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({
17837
+ deviceId: number(),
17838
+ since: number().optional(),
17839
+ until: number().optional(),
17840
+ kinds: array(string()).optional(),
17841
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17842
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17843
+ deviceId: number(),
17844
+ since: number(),
17845
+ until: number(),
17846
+ bucketMs: number().int().positive()
17847
+ }), array(object({
17848
+ bucketStart: number(),
17849
+ motion: number().int(),
17850
+ object: number().int(),
17851
+ audio: number().int()
17852
+ })).readonly()), method(object({
17853
+ deviceId: number(),
17854
+ cutoffMs: number()
17855
+ }), object({
17856
+ motion: number().int(),
17857
+ object: number().int(),
17858
+ audio: number().int()
17859
+ }), {
17860
+ kind: "mutation",
17861
+ auth: "admin"
17862
+ }), method(object({
17863
+ deviceId: number(),
17864
+ cutoffMs: number()
17865
+ }), TrackCascadeCountsSchema, {
17866
+ kind: "mutation",
17867
+ auth: "admin"
17868
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17869
+ kind: "mutation",
17870
+ auth: "admin"
17871
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17872
+ kind: "mutation",
17873
+ auth: "admin"
17874
+ }), method(object({
17875
+ deviceId: number(),
17876
+ trackIds: array(string()).min(1)
17877
+ }), object({
17878
+ deleted: number().int(),
17879
+ failed: array(string()).readonly()
17880
+ }), {
17881
+ kind: "mutation",
17882
+ auth: "admin"
17883
+ }), method(object({
17884
+ /** Log/audit scope only — the trackId is globally unique on its own. */
17885
+ deviceId: number(),
17886
+ trackId: string(),
17887
+ flags: TrackFlagsPatchSchema
17888
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17889
+ kind: "query",
17890
+ auth: "admin"
17891
+ }), method(object({
17892
+ olderThanMs: number(),
17893
+ reason: OpsLogReasonSchema.optional()
17894
+ }), EventPruneCountsSchema, {
17895
+ kind: "mutation",
17896
+ auth: "admin"
17897
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17898
+ kind: "mutation",
17899
+ auth: "admin"
17900
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17901
+ kind: "mutation",
17902
+ auth: "admin"
17903
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17904
+ kind: "mutation",
17905
+ auth: "admin"
17906
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17907
+ kind: "mutation",
17908
+ auth: "admin"
17909
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17910
+ kind: "mutation",
17911
+ auth: "admin"
17912
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17913
+ kind: "mutation",
17914
+ auth: "admin"
17915
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
17916
+ kind: "mutation",
17917
+ auth: "admin"
17918
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
17919
+ kind: "query",
17920
+ auth: "admin"
17921
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17922
+ kind: "mutation",
17923
+ auth: "admin"
17924
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17925
+ kind: "query",
17926
+ auth: "admin"
17927
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17928
+ kind: "query",
17929
+ auth: "admin"
17930
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17931
+ kind: "query",
17932
+ auth: "admin"
17933
+ }), method(object({
17934
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17935
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
17936
+ * route it at one camera's owner, and "every camera" would stop being
17937
+ * expressible at all. */
17938
+ deviceIds: array(number()).optional(),
17939
+ limit: number().int().min(1).max(500).optional()
17940
+ }), array(RetrainTrackSchema).readonly(), {
17941
+ kind: "query",
17942
+ auth: "admin"
17943
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17944
+ kind: "query",
17945
+ auth: "admin"
17946
+ }), method(object({
17947
+ deviceId: number(),
17948
+ trackId: string(),
17949
+ mediaKeys: array(string()).min(1)
17950
+ }), RetrainFrameSelectionSchema, {
17629
17951
  kind: "mutation",
17630
17952
  auth: "admin"
17631
- }), method(object({ nodeId: string() }), object({
17632
- success: literal(true),
17633
- clearedDevices: number()
17953
+ }), method(object({
17954
+ deviceId: number(),
17955
+ trackId: string(),
17956
+ frameId: string()
17957
+ }), object({
17958
+ removed: boolean(),
17959
+ removedAnnotations: number().int()
17634
17960
  }), {
17635
17961
  kind: "mutation",
17636
17962
  auth: "admin"
17637
- }), 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({
17638
- name: string(),
17639
- steps: array(PipelineTemplateStepSchema).readonly(),
17640
- engine: PipelineEngineChoiceSchema
17641
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17642
- id: string(),
17643
- name: string().optional(),
17644
- steps: array(PipelineTemplateStepSchema).readonly().optional()
17645
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17646
- addonId: string(),
17647
- modelId: string(),
17648
- format: ModelFormatSchema$1
17649
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17650
- addonId: string(),
17651
- modelId: string(),
17652
- format: ModelFormatSchema$1
17653
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17654
- engine: PipelineEngineChoiceSchema.optional(),
17655
- steps: array(PipelineStepInputSchema).min(1),
17656
- frame: FrameInputSchema.optional(),
17657
- /**
17658
- * Process-local lazy frame. Valid only when caller and provider resolve
17659
- * in the same execution-group process; split/cross-node callers use
17660
- * `frame`/`image` inline compatibility instead.
17661
- */
17662
- frameRef: FrameRefSchema.optional(),
17663
- /**
17664
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
17665
- * the decoded pixels live in. One more member of the one-of
17666
- * frame/frameHandle/image/imageBase64/referenceImage group.
17667
- */
17668
- frameHandle: FrameHandleSchema.optional(),
17669
- imageBase64: string().optional(),
17670
- /**
17671
- * Binary JPEG bytes — preferred over `imageBase64` on internal
17672
- * hops (hub → forked worker via Moleculer MsgPack) because it
17673
- * skips the 33% base64 overhead + the per-call base64 decode on
17674
- * the detection-pipeline worker. Callers can pass either; exactly
17675
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17676
- */
17677
- image: _instanceof(Uint8Array).optional(),
17678
- referenceImage: string().optional(),
17679
- deviceId: number().optional(),
17680
- sessionId: string().optional(),
17681
- /**
17682
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
17683
- * reference-image, and detail-subtree calls. 'frame' is the live
17684
- * per-frame dispatch: ONLY root-plane steps run; crop children
17685
- * (inputClasses ≠ null) are skipped and served per-track via
17686
- * pipelineRunner.runDetailSubtree (two-plane design).
17687
- */
17688
- plane: _enum(["full", "frame"]).optional(),
17689
- /**
17690
- * Inference-device selector (Phase 2 multi-device). Format
17691
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17692
- * Omitted ⇒ the runner's default device (current single-engine
17693
- * behaviour). Selects WHICH device pool of the node runs the call.
17694
- */
17695
- deviceKey: string().optional(),
17696
- /**
17697
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17698
- * when the parent crop was resolved from the frame's retained NATIVE
17699
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17700
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17701
- * resolution from that surface — the SAME quality path faces already
17702
- * had — instead of the downscaled parent tile. `handle` keys the native
17703
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17704
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17705
- * the executor's crop-normalized child ROI back into frame-normalized
17706
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17707
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17708
- * (today's behaviour on the fallback path).
17709
- */
17710
- nativeCropRef: NativeCropRefSchema.optional()
17711
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17712
- engine: PipelineEngineChoiceSchema.optional(),
17713
- steps: array(PipelineStepInputSchema).min(1),
17714
- frames: array(FrameInputSchema).min(1).max(255),
17715
- deviceId: number().optional(),
17716
- sessionId: string().optional(),
17717
- /**
17718
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17719
- * the batch to the Python pool's bench preprocess cache
17720
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17721
- * preprocessed ONCE and every later inference is a pure-inference cache
17722
- * hit — the sustained-throughput run measures inference, not
17723
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
17724
- * full preprocess every call, correct). Fresh per sustained run;
17725
- * released via `uncacheFrame`.
17726
- */
17727
- frameId: number().int().nonnegative().optional(),
17728
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17729
- deviceKey: string().optional()
17730
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17731
- data: _instanceof(Uint8Array),
17732
- width: number().int().positive(),
17733
- height: number().int().positive(),
17734
- format: _enum([
17735
- "rgb",
17736
- "bgr",
17737
- "gray"
17738
- ])
17739
- }), object({
17740
- frameId: number(),
17741
- width: number(),
17742
- height: number()
17743
- }), { kind: "mutation" }), method(object({
17744
- stepId: string(),
17745
- frameId: number().int()
17746
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17747
- batchMode: string(),
17748
- windowMs: number(),
17749
- maxBatchSize: number(),
17750
- concurrency: number()
17751
- })), method(_void(), array(object({
17752
- engineKey: string(),
17753
- engine: PipelineEngineChoiceSchema,
17754
- modelsLoaded: array(string()).readonly(),
17755
- inUseByCameras: array(number()).readonly(),
17756
- /**
17757
- * Origin of this resident factory.
17758
- * - `runtime` — main camera-serving engine (no idle TTL).
17759
- * - `warm-override` — benchmark/test override held in the warm
17760
- * cache; auto-disposed after the idle TTL.
17761
- * - `device-pool` — a concurrent per-device pool (Phase 2
17762
- * multi-device, keyed by `deviceKey`) resolved
17763
- * via `resolveDeviceFactory`. Runs alongside the
17764
- * `runtime` engine on a DIFFERENT accelerator
17765
- * (NPU / iGPU / Coral) — this is how the
17766
- * Engines tab shows all pools running at once.
17767
- */
17768
- kind: _enum([
17769
- "runtime",
17770
- "warm-override",
17771
- "device-pool"
17772
- ]),
17773
- /** Native pid of the underlying Python pool (null when no pool). */
17774
- poolPid: number().nullable(),
17775
- /** ms since this factory was last used (null when not warm-tracked). */
17776
- idleMs: number().nullable(),
17777
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17778
- idleTtlMs: number().nullable()
17779
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
17963
+ }), method(object({ frameId: string() }), object({
17964
+ base64: string(),
17965
+ width: number().int(),
17966
+ height: number().int()
17967
+ }), {
17968
+ kind: "query",
17969
+ auth: "admin"
17970
+ }), method(object({
17971
+ deviceId: number(),
17972
+ trackId: string(),
17973
+ frameId: string(),
17974
+ subject: RetrainAssistSubjectSchema,
17975
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17976
+ nodeId: string().optional()
17977
+ }), RetrainAssistResultSchema, {
17780
17978
  kind: "mutation",
17781
17979
  auth: "admin"
17782
17980
  }), method(object({
17783
- engine: PipelineEngineChoiceSchema,
17784
- force: boolean().optional()
17785
- }), object({
17786
- success: boolean(),
17787
- reason: string().optional()
17788
- }), {
17981
+ deviceId: number(),
17982
+ source: DetectionSourceSchema,
17983
+ zones: array(ZoneSchema).readonly().optional(),
17984
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
17985
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
17986
+ frames: array(ReplayFrameInputSchema).min(1)
17987
+ }), RunReplayFrameProcessorResultSchema, {
17789
17988
  kind: "mutation",
17790
17989
  auth: "admin"
17791
- }), 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({
17792
- addonId: string(),
17793
- modelId: string(),
17794
- filename: string().optional(),
17795
- settings: record(string(), unknown()).optional()
17796
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
17990
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17991
+ kind: "query",
17992
+ auth: "admin"
17993
+ }), method(object({
17994
+ deviceId: number(),
17995
+ trackId: string(),
17996
+ frameId: string(),
17997
+ annotations: array(RetrainAnnotationDraftSchema)
17998
+ }), array(RetrainAnnotationSchema).readonly(), {
17999
+ kind: "mutation",
18000
+ auth: "admin"
18001
+ }), method(object({
18002
+ deviceId: number(),
18003
+ trackId: string()
18004
+ }), RetrainTransitionResultSchema, {
18005
+ kind: "mutation",
18006
+ auth: "admin"
18007
+ }), method(object({
18008
+ deviceId: number(),
18009
+ trackId: string()
18010
+ }), RetrainTransitionResultSchema, {
18011
+ kind: "mutation",
18012
+ auth: "admin"
18013
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
18014
+ kind: "query",
18015
+ auth: "admin"
18016
+ }), method(object({
18017
+ eventId: string(),
18018
+ kind: MediaFileKindEnum.optional(),
18019
+ deviceId: number()
18020
+ }), array(MediaFileSchema).readonly()), method(object({
18021
+ trackId: string(),
18022
+ kinds: array(MediaFileKindEnum).optional(),
18023
+ deviceId: number()
18024
+ }), array(MediaFileSchema).readonly()), method(object({
18025
+ trackId: string(),
18026
+ deviceId: number()
18027
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18028
+ kind: "mutation",
18029
+ auth: "admin"
18030
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18031
+ kind: "mutation",
18032
+ auth: "admin"
18033
+ }), method(object({}), RebuildStatusSchema), object({
18034
+ deviceId: number(),
18035
+ timestamp: number(),
18036
+ frameWidth: number(),
18037
+ frameHeight: number(),
18038
+ detections: array(OverlayDetectionSchema).readonly()
18039
+ }), object({
18040
+ deviceId: number(),
18041
+ trackId: string(),
18042
+ className: string()
18043
+ }), object({
18044
+ deviceId: number(),
18045
+ trackId: string(),
18046
+ className: string(),
18047
+ durationMs: number()
18048
+ }), object({
18049
+ deviceId: number(),
18050
+ kind: EventKindSchema,
18051
+ eventId: string(),
18052
+ timestamp: number()
18053
+ });
17797
18054
  object({
17798
18055
  activeCameras: number(),
17799
18056
  throttledCameras: number(),
@@ -17819,66 +18076,6 @@ var CameraMetricsSchema = object({
17819
18076
  });
17820
18077
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
17821
18078
  /**
17822
- * Zone — pure geometry + identity. NO filtering behaviour.
17823
- *
17824
- * Zones describe **where** in the frame the operator wants to flag
17825
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
17826
- * each pipeline stage uses them. Splitting the two means a single
17827
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
17828
- * a detection-include rule on `['car']`, and an occupancy aggregate
17829
- * — without three duplicated polygons.
17830
- *
17831
- * Owned by the orchestrator addon (provider) and mirrored into the
17832
- * `zones` device-state slice on every mutation. Consumers
17833
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
17834
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
17835
- * mirror with `onChanged`).
17836
- *
17837
- * Coordinates are normalised fractions of the frame (0–1) so zones
17838
- * survive resolution changes and stream profile switches.
17839
- *
17840
- * `kind` discriminates between full polygons (closed regions used
17841
- * for intrusion / occupancy filters) and tripwires (open 2-point
17842
- * line segments used for cross events). Onboard / firmware-reported
17843
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17844
- * task list.
17845
- */
17846
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
17847
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17848
- var PolygonPointSchema = object({
17849
- x: number(),
17850
- y: number()
17851
- });
17852
- /** A camera detection zone — pure geometry/identity. */
17853
- var ZoneSchema = object({
17854
- id: string(),
17855
- name: string(),
17856
- kind: ZoneKindEnum.default("polygon"),
17857
- /** Polygon vertices, fraction of frame (0–1). */
17858
- polygon: array(PolygonPointSchema).readonly(),
17859
- /** Visual color for UI rendering. */
17860
- color: string().default("#3b82f6")
17861
- });
17862
- DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
17863
- deviceId: number(),
17864
- zone: ZoneSchema
17865
- }), _void(), {
17866
- kind: "mutation",
17867
- auth: "admin"
17868
- }), method(object({
17869
- deviceId: number(),
17870
- zoneId: string()
17871
- }), _void(), {
17872
- kind: "mutation",
17873
- auth: "admin"
17874
- }), method(object({
17875
- deviceId: number(),
17876
- zone: ZoneSchema
17877
- }), _void(), {
17878
- kind: "mutation",
17879
- auth: "admin"
17880
- }), object({ zones: array(ZoneSchema).readonly() });
17881
- /**
17882
18079
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
17883
18080
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
17884
18081
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -19670,7 +19867,7 @@ method(object({
19670
19867
  * linking rather than produce an eternal token.
19671
19868
  */
19672
19869
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19673
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
19870
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19674
19871
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19675
19872
  providerId: string().min(1),
19676
19873
  displayName: string().min(1),
@@ -19765,10 +19962,13 @@ var EvictResultSchema = object({
19765
19962
  /** True when the provider has nothing left it is willing to drop on this location. */
19766
19963
  exhausted: boolean()
19767
19964
  });
19768
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
19965
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19769
19966
  locationId: string(),
19770
19967
  targetBytes: number().int().positive()
19771
- }), EvictResultSchema, { kind: "mutation" });
19968
+ }), EvictResultSchema, {
19969
+ kind: "mutation",
19970
+ auth: "admin"
19971
+ });
19772
19972
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19773
19973
  kind: "mutation",
19774
19974
  auth: "admin"
@@ -19828,26 +20028,50 @@ var ReadChunkInputSchema = object({
19828
20028
  length: number()
19829
20029
  });
19830
20030
  var EndDownloadInputSchema = object({ downloadId: string() });
19831
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
20031
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19832
20032
  location: StorageLocationSchema,
19833
20033
  relativePath: string()
19834
- }), string()), method(object({
20034
+ }), string(), { auth: "admin" }), method(object({
19835
20035
  location: StorageLocationSchema,
19836
20036
  relativePath: string(),
19837
20037
  data: _instanceof(Uint8Array)
19838
- }), _void(), { kind: "mutation" }), method(object({
20038
+ }), _void(), {
20039
+ kind: "mutation",
20040
+ auth: "admin"
20041
+ }), method(object({
19839
20042
  location: StorageLocationSchema,
19840
20043
  relativePath: string()
19841
- }), _instanceof(Uint8Array)), method(object({
20044
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19842
20045
  location: StorageLocationSchema,
19843
20046
  relativePath: string()
19844
- }), boolean()), method(object({
20047
+ }), boolean(), { auth: "admin" }), method(object({
19845
20048
  location: StorageLocationSchema,
19846
20049
  prefix: string().optional()
19847
- }), array(string()).readonly()), method(object({
20050
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19848
20051
  location: StorageLocationSchema,
19849
20052
  relativePath: string()
19850
- }), _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" });
20053
+ }), _void(), {
20054
+ kind: "mutation",
20055
+ auth: "admin"
20056
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
20057
+ kind: "mutation",
20058
+ auth: "admin"
20059
+ }), method(WriteChunkInputSchema, _void(), {
20060
+ kind: "mutation",
20061
+ auth: "admin"
20062
+ }), method(FinalizeUploadInputSchema, _void(), {
20063
+ kind: "mutation",
20064
+ auth: "admin"
20065
+ }), method(AbortUploadInputSchema, _void(), {
20066
+ kind: "mutation",
20067
+ auth: "admin"
20068
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
20069
+ kind: "mutation",
20070
+ auth: "admin"
20071
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
20072
+ kind: "mutation",
20073
+ auth: "admin"
20074
+ });
19851
20075
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19852
20076
  var ProfileSettingsSchemaBridge = unknown().nullable();
19853
20077
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -20105,7 +20329,8 @@ method(object({
20105
20329
  access: "create"
20106
20330
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
20107
20331
  kind: "mutation",
20108
- access: "view"
20332
+ access: "view",
20333
+ auth: "admin"
20109
20334
  }), method(object({
20110
20335
  /** Required — the user the assertion belongs to (verified). */
20111
20336
  userId: string(),
@@ -20113,10 +20338,12 @@ method(object({
20113
20338
  response: record(string(), unknown())
20114
20339
  }), object({ verified: boolean() }), {
20115
20340
  kind: "mutation",
20116
- access: "view"
20341
+ access: "view",
20342
+ auth: "admin"
20117
20343
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
20118
20344
  kind: "mutation",
20119
- access: "view"
20345
+ access: "view",
20346
+ auth: "admin"
20120
20347
  }), method(object({
20121
20348
  /** AuthenticationResponseJSON from the browser. */
20122
20349
  response: record(string(), unknown()) }), object({
@@ -20124,7 +20351,8 @@ response: record(string(), unknown()) }), object({
20124
20351
  userId: string().nullable()
20125
20352
  }), {
20126
20353
  kind: "mutation",
20127
- access: "view"
20354
+ access: "view",
20355
+ auth: "admin"
20128
20356
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
20129
20357
  userId: string(),
20130
20358
  credentialId: string()
@@ -20296,7 +20524,19 @@ var VectorStatsResultSchema = object({
20296
20524
  /** False when the backend ranks approximately. */
20297
20525
  exact: boolean()
20298
20526
  });
20299
- 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);
20527
+ method(VectorDeclareIndexInputSchema, _void(), {
20528
+ kind: "mutation",
20529
+ auth: "admin"
20530
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20531
+ kind: "mutation",
20532
+ auth: "admin"
20533
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20534
+ kind: "mutation",
20535
+ auth: "admin"
20536
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20537
+ kind: "mutation",
20538
+ auth: "admin"
20539
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20300
20540
  var ClipSchema = object({
20301
20541
  /** Opaque, provider-namespaced id. The default provider encodes the time
20302
20542
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -22019,7 +22259,27 @@ var MediaFileLiteSchema$1 = object({
22019
22259
  sizeBytes: number(),
22020
22260
  timestamp: number()
22021
22261
  });
22022
- method(_void(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22262
+ method(object({
22263
+ /**
22264
+ * Inline {@link IdentitySchema.coverBase64} on every row.
22265
+ *
22266
+ * Default `false`, the same inversion `listRecentFaces` and
22267
+ * `listPlates` took on 2026-08-25 (see `include-crops-default.ts` for
22268
+ * why the burden belongs on the caller that WANTS the bytes). Measured
22269
+ * on the live hub the same day: four identities cost 40,979 B with the
22270
+ * covers inline, ~10 KB of base64 per row, on a query this UI mounts
22271
+ * four times and the viewer holds at `staleTime: 30_000`.
22272
+ *
22273
+ * Nothing loses its avatar: `coverMediaKey` is already on every row and
22274
+ * the `event-media` plane serves that key `immutable` with an ETag.
22275
+ *
22276
+ * **This is an INPUT field, so it does not reach the addon until the
22277
+ * next train** — the hub router validates cap inputs against its own
22278
+ * compiled Zod and strips a key it does not know. Until then the
22279
+ * provider sees `undefined`, which resolves to `false`: the cheap shape
22280
+ * is what ships, and the opt-in becomes reachable when the train lands.
22281
+ */
22282
+ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22023
22283
  kind: "mutation",
22024
22284
  auth: "admin"
22025
22285
  }), method(object({
@@ -24166,8 +24426,10 @@ var PlateInfoSchema = object({
24166
24426
  keyFrameMediaKey: string().optional(),
24167
24427
  base64: string().optional(),
24168
24428
  /**
24169
- * Same crop as a data-plane URL. `getPlateByTrack` returns this and
24170
- * never inlines JPEG; `listPlates` still inlines for the admin-ui.
24429
+ * Same crop as a data-plane URL, always present when the plate has a stored
24430
+ * crop. `getPlateByTrack` returns this and never inlines JPEG; `listPlates`
24431
+ * and `searchPlates` inline the crop only when their `includeCrops` input is
24432
+ * left at its `true` default.
24171
24433
  */
24172
24434
  cropUrl: string().optional()
24173
24435
  });
@@ -24187,14 +24449,34 @@ var PlateClusterSchema = object({
24187
24449
  });
24188
24450
  method(object({
24189
24451
  deviceId: number().int().optional(),
24190
- limit: number().int().positive().optional()
24452
+ limit: number().int().positive().optional(),
24453
+ /**
24454
+ * Inline the base64 crop on every row. Default `true` — the existing
24455
+ * behaviour, kept so no caller breaks.
24456
+ *
24457
+ * Set `false` once the caller renders {@link PlateInfo.cropUrl}.
24458
+ * Measured on the live hub at the 500 rows the Plates view asks for:
24459
+ * 879,403 B and 27.7 s with the crops inline, against a few KiB of
24460
+ * metadata without them — and the browser then caches the images.
24461
+ *
24462
+ * This is the plate twin of `faceGallery.listRecentFaces`'s option;
24463
+ * plates were the one gallery list left without it.
24464
+ *
24465
+ * **This is an INPUT field, so it does not reach the addon until the
24466
+ * next train.** The hub router validates cap inputs against its own
24467
+ * compiled Zod and strips a key it does not know. Until the train
24468
+ * ships, sending `false` is harmless and keeps the crops inline.
24469
+ */
24470
+ includeCrops: boolean().optional()
24191
24471
  }).optional(), array(PlateInfoSchema).readonly()), method(object({
24192
24472
  deviceId: number().int(),
24193
24473
  trackId: string()
24194
24474
  }), PlateInfoSchema.nullable()), method(object({ plateId: string() }), array(MediaFileLiteSchema).readonly()), method(object({
24195
24475
  text: string().min(1),
24196
24476
  maxDistance: number().int().min(0).optional(),
24197
- limit: number().int().positive().optional()
24477
+ limit: number().int().positive().optional(),
24478
+ /** See `listPlates.includeCrops`. Default `true`. */
24479
+ includeCrops: boolean().optional()
24198
24480
  }), array(PlateInfoSchema).readonly()), method(object({
24199
24481
  maxDistance: number().int().min(0).optional(),
24200
24482
  minClusterSize: number().int().min(2).optional(),
@@ -24208,7 +24490,13 @@ method(object({
24208
24490
  }), method(object({ plateId: string() }), _void(), {
24209
24491
  kind: "mutation",
24210
24492
  auth: "admin"
24211
- }), method(_void(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24493
+ }), method(object({
24494
+ /** Inline {@link VehicleSchema.coverBase64} on every row. Default
24495
+ * `false` — the vehicle twin of `faceGallery.listIdentities`'s
24496
+ * option; `coverMediaKey` + the `event-media` plane carry the picture.
24497
+ * INPUT field: stripped by the hub router until the train ships, which
24498
+ * resolves to `false` and is exactly the intended default. */
24499
+ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24212
24500
  kind: "mutation",
24213
24501
  auth: "admin"
24214
24502
  }), method(object({
@@ -25515,92 +25803,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
25515
25803
  kind: "mutation",
25516
25804
  auth: "admin"
25517
25805
  });
25518
- /**
25519
- * Per-stage gating mode applied to the zones a rule references.
25520
- *
25521
- * - `include`: the rule contributes to a **whitelist** for its stage.
25522
- * When at least one `include` rule fires for a stage, only entities
25523
- * inside one of those zones pass that stage.
25524
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
25525
- * Entities inside one of those zones are dropped at that stage.
25526
- *
25527
- * `monitor`-style observation (count without filtering) is not a rule
25528
- * mode — zones without any matching rule are observed naturally by
25529
- * `zone-analytics` (live snapshot + history), so an "I just want to
25530
- * count, not filter" use case needs no rule at all.
25531
- */
25532
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
25533
- /**
25534
- * Per-consumer rule that references existing zones (geometry) and
25535
- * defines how a specific pipeline stage should treat them. Each
25536
- * consumer addon owns its own `ZoneRule[]` array in its per-device
25537
- * settings:
25538
- *
25539
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
25540
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
25541
- * - future: notification rules, audio gating, etc.
25542
- *
25543
- * One rule applies to N zones (`zoneIds[]`) so the operator can
25544
- * express "ignore motion in ALL of {garden, street}" with a single
25545
- * rule. `classFilter` narrows the rule to specific object classes —
25546
- * "drop person detections in the street, but keep cars" is one
25547
- * `exclude` rule with `classFilter: ['person']`.
25548
- *
25549
- * `enabled` is a soft toggle — the operator can keep the rule
25550
- * configured but inert without deleting it.
25551
- */
25552
- var ZoneRuleSchema = object({
25553
- /** Stable rule id — survives edits, used by the UI for diffing. */
25554
- id: string(),
25555
- /** Optional human-readable label rendered in the rule editor. */
25556
- name: string().optional(),
25557
- /** Zones this rule targets. The rule's `mode` applies to ALL
25558
- * listed zones (OR-set: a detection in any one of them counts).
25559
- * At least one zone id required — a rule with no targets is a
25560
- * configuration mistake and the form validator rejects it. */
25561
- zoneIds: array(string()).min(1).readonly(),
25562
- mode: ZoneRuleModeEnum,
25563
- /**
25564
- * Class names this rule applies to. Empty / undefined ⇒ rule
25565
- * applies to every class. Class strings match the `macroClass`
25566
- * field on detections (e.g. `person`, `car`, `dog`).
25567
- */
25568
- classFilter: array(string()).readonly().optional(),
25569
- /**
25570
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
25571
- * required to consider an entity "in the zone". Defaults to the
25572
- * consumer's stage default when omitted. Kept for back-compat with
25573
- * existing per-rule overrides; new operators pick the value via
25574
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
25575
- * set, the lower-level engine reads it as a 0–1 fraction.
25576
- */
25577
- overlapThreshold: number().min(0).max(1).optional(),
25578
- /**
25579
- * Operator-friendly version of `overlapThreshold` — the percentage
25580
- * of the detection's bbox that must lie inside the zone for the
25581
- * rule to match. Documented default is 85%; the engine substitutes
25582
- * that when the field is omitted (kept optional so existing rules
25583
- * stored without it stay valid).
25584
- *
25585
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
25586
- * rule, the engine prefers `bboxInclusionPct` because it's the
25587
- * field exposed in the UI. Internally both feed the same gate.
25588
- */
25589
- bboxInclusionPct: number().min(0).max(100).optional(),
25590
- /**
25591
- * When `true` and a detection has a segmentation mask, use the
25592
- * mask for overlap instead of the bbox. Detection-stage only;
25593
- * motion rules ignore this field.
25594
- */
25595
- preferMask: boolean().optional(),
25596
- /**
25597
- * Soft-toggle: `false` disables the rule without deleting it.
25598
- * Defaults to `true` so operators creating a rule via the UI
25599
- * see it active immediately.
25600
- */
25601
- enabled: boolean().default(true)
25602
- });
25603
- array(ZoneRuleSchema).readonly();
25604
25806
  object({
25605
25807
  /** Whether the script is currently executing. */
25606
25808
  isRunning: boolean(),
@@ -30037,6 +30239,12 @@ Object.freeze({
30037
30239
  addonId: null,
30038
30240
  access: "create"
30039
30241
  },
30242
+ "pipelineAnalytics.cancelRelocateMedia": {
30243
+ capName: "pipeline-analytics",
30244
+ capScope: "device",
30245
+ addonId: null,
30246
+ access: "create"
30247
+ },
30040
30248
  "pipelineAnalytics.cancelStorageMigrationMove": {
30041
30249
  capName: "pipeline-analytics",
30042
30250
  capScope: "device",
@@ -30211,6 +30419,12 @@ Object.freeze({
30211
30419
  addonId: null,
30212
30420
  access: "view"
30213
30421
  },
30422
+ "pipelineAnalytics.listRelocateMediaJobs": {
30423
+ capName: "pipeline-analytics",
30424
+ capScope: "device",
30425
+ addonId: null,
30426
+ access: "view"
30427
+ },
30214
30428
  "pipelineAnalytics.listRetrainAnnotations": {
30215
30429
  capName: "pipeline-analytics",
30216
30430
  capScope: "device",
@@ -30289,6 +30503,12 @@ Object.freeze({
30289
30503
  addonId: null,
30290
30504
  access: "create"
30291
30505
  },
30506
+ "pipelineAnalytics.relocateMedia": {
30507
+ capName: "pipeline-analytics",
30508
+ capScope: "device",
30509
+ addonId: null,
30510
+ access: "create"
30511
+ },
30292
30512
  "pipelineAnalytics.restageRetrainTrack": {
30293
30513
  capName: "pipeline-analytics",
30294
30514
  capScope: "device",
@@ -30301,6 +30521,12 @@ Object.freeze({
30301
30521
  addonId: null,
30302
30522
  access: "create"
30303
30523
  },
30524
+ "pipelineAnalytics.runReplayFrameProcessor": {
30525
+ capName: "pipeline-analytics",
30526
+ capScope: "device",
30527
+ addonId: null,
30528
+ access: "create"
30529
+ },
30304
30530
  "pipelineAnalytics.saveRetrainAnnotations": {
30305
30531
  capName: "pipeline-analytics",
30306
30532
  capScope: "device",
@@ -30433,6 +30659,12 @@ Object.freeze({
30433
30659
  addonId: null,
30434
30660
  access: "view"
30435
30661
  },
30662
+ "pipelineExecutor.getInferenceDeviceHealth": {
30663
+ capName: "pipeline-executor",
30664
+ capScope: "system",
30665
+ addonId: null,
30666
+ access: "view"
30667
+ },
30436
30668
  "pipelineExecutor.getOrchestratorConfigSchema": {
30437
30669
  capName: "pipeline-executor",
30438
30670
  capScope: "system",
@@ -30505,6 +30737,12 @@ Object.freeze({
30505
30737
  addonId: null,
30506
30738
  access: "view"
30507
30739
  },
30740
+ "pipelineExecutor.rearmInferenceDevice": {
30741
+ capName: "pipeline-executor",
30742
+ capScope: "system",
30743
+ addonId: null,
30744
+ access: "create"
30745
+ },
30508
30746
  "pipelineExecutor.runAudioTest": {
30509
30747
  capName: "pipeline-executor",
30510
30748
  capScope: "system",
@@ -33753,6 +33991,11 @@ Object.freeze({
33753
33991
  form: "single",
33754
33992
  optional: false
33755
33993
  }],
33994
+ "pipelineAnalytics.runReplayFrameProcessor": [{
33995
+ name: "deviceId",
33996
+ form: "single",
33997
+ optional: false
33998
+ }],
33756
33999
  "pipelineAnalytics.saveRetrainAnnotations": [{
33757
34000
  name: "deviceId",
33758
34001
  form: "single",