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