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