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