@camstack/addon-decoder-nodeav 1.2.27 → 1.2.29

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