@camstack/addon-mqtt-broker 1.2.28 → 1.2.30

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