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