@camstack/addon-smtp-nodemailer 1.2.27 → 1.2.29

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