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