@camstack/addon-agent-ui 1.2.29 → 1.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/addon.js +2096 -1844
  2. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -6631,7 +6631,7 @@ function method(input, output, options) {
6631
6631
  input,
6632
6632
  output,
6633
6633
  kind: options?.kind ?? "query",
6634
- auth: options?.auth ?? "protected",
6634
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6635
6635
  ...options?.access !== void 0 ? { access: options.access } : {},
6636
6636
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6637
6637
  timeoutMs: options?.timeoutMs
@@ -6657,8 +6657,17 @@ var adminUiCapability = {
6657
6657
  mode: "singleton",
6658
6658
  internal: true,
6659
6659
  methods: {
6660
- getStaticDir: method(_void(), StaticDirOutputSchema$1),
6661
- getVersion: method(_void(), VersionOutputSchema$1)
6660
+ /**
6661
+ * `internal: true` did not gate the mount (see the 2026-08-26 note on
6662
+ * `data-store-provider`) — both methods were reachable on the AppRouter
6663
+ * by ANY authenticated session at the default `auth: 'protected'`, and
6664
+ * `getStaticDir` leaks a hub filesystem path. The only caller is
6665
+ * `main.ts`'s static-file bootstrap, via `capRegistry.getSingletonForNode`
6666
+ * — never tRPC — so `auth: 'admin'` costs it nothing. The actual admin-ui
6667
+ * SPA assets are served as plain static files, unaffected by this gate.
6668
+ */
6669
+ getStaticDir: method(_void(), StaticDirOutputSchema$1, { auth: "admin" }),
6670
+ getVersion: method(_void(), VersionOutputSchema$1, { auth: "admin" })
6662
6671
  }
6663
6672
  };
6664
6673
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
@@ -6981,7 +6990,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6981
6990
  }({});
6982
6991
  var StaticDirOutputSchema = object({ staticDir: string() });
6983
6992
  var VersionOutputSchema = object({ version: string() });
6984
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6993
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
6985
6994
  /**
6986
6995
  * device-ops — device-scoped cap that unifies the per-IDevice operations
6987
6996
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7595,24 +7604,6 @@ var RecordingRetentionSchema = object({
7595
7604
  maxSizeGb: number().min(0).optional()
7596
7605
  });
7597
7606
  /**
7598
- * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7599
- * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7600
- * previews at. Five graduated steps; absent on a config = `standard` (the
7601
- * shipped default, matching `sheet-geometry`/`sheet-composer`).
7602
- *
7603
- * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7604
- * Each window's index sidecar carries its own tile dims, so a camera whose
7605
- * preset changed over time renders every historical window at the dims it was
7606
- * written with.
7607
- */
7608
- var ScrubThumbnailPresetSchema = _enum([
7609
- "minimal",
7610
- "low",
7611
- "standard",
7612
- "high",
7613
- "max"
7614
- ]);
7615
- /**
7616
7607
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7617
7608
  *
7618
7609
  * `bands` is the ONLY authored recording intent: what to record, when, and on
@@ -7620,7 +7611,11 @@ var ScrubThumbnailPresetSchema = _enum([
7620
7611
  * other field is a storage knob (profiles, segment length, retention, scrub).
7621
7612
  *
7622
7613
  * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7623
- * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7614
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30,
7615
+ * and `scrubThumbnails` — a five-step fidelity knob for a sprite tier that was
7616
+ * deleted on 2026-07-24 and had ZERO consumers in the recorder — on 2026-08-25
7617
+ * (D62: a switch that writes a store nobody reads is worse than no switch).
7618
+ * Stored rows keep loading: the READ schema is `.strip()` (config-store.ts).
7624
7619
  * A stale caller must fail loudly — silently stripping its legacy intent would
7625
7620
  * persist a band-less config, i.e. silently stop recording the camera.
7626
7621
  */
@@ -7643,14 +7638,7 @@ var RecordingConfigSchema = object({
7643
7638
  * "off" is the absence of a covering band, never a band value.
7644
7639
  */
7645
7640
  bands: array(RecordingBandSchema).default([]),
7646
- retention: RecordingRetentionSchema.optional(),
7647
- /**
7648
- * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7649
- * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7650
- * windows only — existing sheets are immutable, and each window's index
7651
- * carries its own tile dims so mixed-preset history renders correctly.
7652
- */
7653
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7641
+ retention: RecordingRetentionSchema.optional()
7654
7642
  }).strict();
7655
7643
  /**
7656
7644
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
@@ -7726,10 +7714,11 @@ var RelocateFootageInputSchema = object({
7726
7714
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7727
7715
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7728
7716
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7729
- var StorageMigrationMediaMoveInputSchema = object({
7717
+ var RelocateMediaInputSchema = object({
7730
7718
  toLocationId: string(),
7731
7719
  throttleMbps: number().min(1).max(1e3).optional()
7732
- }).extend({ leaseId: string().min(1) });
7720
+ });
7721
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7733
7722
  /** The independently selectable logical storage classes. `recordings`
7734
7723
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7735
7724
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8024,7 +8013,26 @@ var LabelDefinitionSchema = object({
8024
8013
  description: string().optional(),
8025
8014
  icon: string().optional()
8026
8015
  });
8027
- var ClassMapDefinitionSchema = object({
8016
+ /**
8017
+ * Wire schema for a per-model CATALOG classMap override
8018
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8019
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8020
+ * detection pipeline executor actually routes.
8021
+ *
8022
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8023
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8024
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8025
+ * enum) — the two used to share the name `ClassMapDefinition`/
8026
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8027
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8028
+ * are not: it is two different concepts colliding on a name. Keep this type
8029
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8030
+ * would either narrow every `ClassMapDefinition` consumer to the four
8031
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8032
+ * schema exists for (see the "rejects a classMap whose target is not a
8033
+ * detection macro" test in `model-catalog-schema.test.ts`).
8034
+ */
8035
+ var DetectionCatalogClassMapSchema = object({
8028
8036
  mapping: record(string(), _enum([
8029
8037
  "person",
8030
8038
  "vehicle",
@@ -8229,7 +8237,7 @@ var ModelCatalogEntrySchema = object({
8229
8237
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8230
8238
  * labels already ARE the CamStack macros (Scrypted identity map).
8231
8239
  */
8232
- classMap: ClassMapDefinitionSchema.optional()
8240
+ classMap: DetectionCatalogClassMapSchema.optional()
8233
8241
  });
8234
8242
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8235
8243
  format: literal("openvino"),
@@ -8259,7 +8267,7 @@ var ModelConvertMetadataSchema = object({
8259
8267
  "segmentation"
8260
8268
  ]),
8261
8269
  faceAlignment: boolean().optional(),
8262
- classMap: ClassMapDefinitionSchema.optional()
8270
+ classMap: DetectionCatalogClassMapSchema.optional()
8263
8271
  });
8264
8272
  var ConvertResultSchema = object({
8265
8273
  entry: ModelCatalogEntrySchema,
@@ -9122,7 +9130,7 @@ var AddonPageDeclarationSchema = object({
9122
9130
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9123
9131
  sectionLabel: string().optional()
9124
9132
  });
9125
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9133
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9126
9134
  var AddonHttpRouteSchema = object({
9127
9135
  method: _enum([
9128
9136
  "GET",
@@ -9357,7 +9365,7 @@ var WidgetMetadataSchema = object({
9357
9365
  defaultColumns: number().int().min(1).max(12).default(6),
9358
9366
  defaultRows: number().int().min(1).max(12).default(1)
9359
9367
  });
9360
- method(_void(), array(WidgetMetadataSchema).readonly());
9368
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9361
9369
  /**
9362
9370
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9363
9371
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -10879,7 +10887,7 @@ var CustomModelDescriptorSchema = object({
10879
10887
  stepId: string(),
10880
10888
  entry: ModelCatalogEntrySchema
10881
10889
  });
10882
- method(_void(), array(CustomModelDescriptorSchema).readonly());
10890
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
10883
10891
  /**
10884
10892
  * Query filter for settings-store collections.
10885
10893
  */
@@ -10966,7 +10974,8 @@ method(object({
10966
10974
  }), _void(), { kind: "mutation" }), method(object({
10967
10975
  namespace: string().optional(),
10968
10976
  collection: string(),
10969
- filter: QueryFilterSchema.optional()
10977
+ filter: QueryFilterSchema.optional(),
10978
+ columns: array(string()).readonly().optional()
10970
10979
  }), array(SettingsRecordSchema).readonly()), method(object({
10971
10980
  namespace: string().optional(),
10972
10981
  collection: string(),
@@ -11029,46 +11038,87 @@ var EngineInfoSchema = object({
11029
11038
  kind: _enum(["relational", "vector"]),
11030
11039
  displayName: string()
11031
11040
  });
11032
- method(_void(), EngineInfoSchema), method(object({
11041
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11033
11042
  namespace: string().optional(),
11034
11043
  collection: string(),
11035
11044
  key: string()
11036
- }), unknown()), method(object({
11045
+ }), unknown(), { auth: "admin" }), method(object({
11037
11046
  namespace: string().optional(),
11038
11047
  collection: string(),
11039
11048
  key: string(),
11040
11049
  value: unknown()
11041
- }), _void(), { kind: "mutation" }), method(object({
11050
+ }), _void(), {
11051
+ kind: "mutation",
11052
+ auth: "admin"
11053
+ }), method(object({
11042
11054
  namespace: string().optional(),
11043
11055
  collection: string(),
11044
- filter: QueryFilterSchema.optional()
11045
- }), array(SettingsRecordSchema).readonly()), method(object({
11056
+ filter: QueryFilterSchema.optional(),
11057
+ /**
11058
+ * SQL-level column projection — MUST mirror `settings-store.query`.
11059
+ *
11060
+ * ⚠ An earlier version of this comment blamed Zod stripping, and that
11061
+ * was wrong — corrected 2026-08-26 after the hop map
11062
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11063
+ * There is **no Zod parse at all** between the door and the engine: the
11064
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11065
+ * field declared here reaches `SqliteSettingsBackend` either way.
11066
+ *
11067
+ * What actually lost `columns` was the THIRD declaration of this shape:
11068
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11069
+ * interface the engine destructures from. The field existed on both
11070
+ * schemas and the engine still never read it, because nothing checks a
11071
+ * registered provider against `InferProvider<cap>` —
11072
+ * `ProviderRegistration.provider` is typed `object`.
11073
+ *
11074
+ * It is declared here anyway, and must stay in step with
11075
+ * `settings-store.query`: a caller reading only the cap definitions has
11076
+ * to be able to see that this call carries a projection.
11077
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11078
+ */
11079
+ columns: array(string()).readonly().optional()
11080
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11046
11081
  namespace: string().optional(),
11047
11082
  collection: string(),
11048
11083
  record: SettingsRecordSchema
11049
- }), _void(), { kind: "mutation" }), method(object({
11084
+ }), _void(), {
11085
+ kind: "mutation",
11086
+ auth: "admin"
11087
+ }), method(object({
11050
11088
  namespace: string().optional(),
11051
11089
  collection: string(),
11052
11090
  id: string(),
11053
11091
  data: record(string(), unknown())
11054
- }), _void(), { kind: "mutation" }), method(object({
11092
+ }), _void(), {
11093
+ kind: "mutation",
11094
+ auth: "admin"
11095
+ }), method(object({
11055
11096
  namespace: string().optional(),
11056
11097
  collection: string(),
11057
11098
  key: string()
11058
- }), _void(), { kind: "mutation" }), method(object({
11099
+ }), _void(), {
11100
+ kind: "mutation",
11101
+ auth: "admin"
11102
+ }), method(object({
11059
11103
  namespace: string().optional(),
11060
11104
  collection: string(),
11061
11105
  filter: MutationFilterSchema
11062
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11106
+ }), object({ deleted: number().int() }), {
11107
+ kind: "mutation",
11108
+ auth: "admin"
11109
+ }), method(object({
11063
11110
  namespace: string().optional(),
11064
11111
  collection: string(),
11065
11112
  filter: MutationFilterSchema,
11066
11113
  data: record(string(), unknown())
11067
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11114
+ }), object({ updated: number().int() }), {
11115
+ kind: "mutation",
11116
+ auth: "admin"
11117
+ }), method(object({
11068
11118
  namespace: string().optional(),
11069
11119
  collection: string(),
11070
11120
  filter: QueryFilterSchema.optional()
11071
- }), number()), method(object({
11121
+ }), number(), { auth: "admin" }), method(object({
11072
11122
  namespace: string().optional(),
11073
11123
  collection: string(),
11074
11124
  field: string(),
@@ -11078,15 +11128,18 @@ method(_void(), EngineInfoSchema), method(object({
11078
11128
  }), array(object({
11079
11129
  bucket: number().int(),
11080
11130
  count: number().int()
11081
- })).readonly()), method(object({
11131
+ })).readonly(), { auth: "admin" }), method(object({
11082
11132
  namespace: string().optional(),
11083
11133
  collection: string()
11084
- }), boolean()), method(object({
11134
+ }), boolean(), { auth: "admin" }), method(object({
11085
11135
  namespace: string().optional(),
11086
11136
  collection: string(),
11087
11137
  columns: array(CollectionColumnSchema).readonly(),
11088
11138
  indexes: array(CollectionIndexSchema).readonly().optional()
11089
- }), _void(), { kind: "mutation" });
11139
+ }), _void(), {
11140
+ kind: "mutation",
11141
+ auth: "admin"
11142
+ });
11090
11143
  /**
11091
11144
  * shm ring usage stats for a `frameSink: 'shm'` decoder session —
11092
11145
  * exposed via `decoder.getShmStats` so downstream consumers can
@@ -12214,7 +12267,7 @@ method(object({
12214
12267
  crop: _instanceof(Uint8Array),
12215
12268
  width: number(),
12216
12269
  height: number()
12217
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12270
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12218
12271
  /**
12219
12272
  * filesystem-browse — per-node capability for browsing the node's local
12220
12273
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12507,19 +12560,22 @@ method(LlmGenerateBaseInputSchema.extend({
12507
12560
  runtime: ManagedRuntimeConfigSchema,
12508
12561
  /** The managed profile's timeout, threaded by the hub provider. */
12509
12562
  timeoutMs: number().int().positive().optional()
12510
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12563
+ }), LlmGenerateResultSchema, {
12564
+ kind: "mutation",
12565
+ auth: "admin"
12566
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12511
12567
  kind: "mutation",
12512
12568
  auth: "admin"
12513
12569
  }), method(object({}), _void(), {
12514
12570
  kind: "mutation",
12515
12571
  auth: "admin"
12516
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12572
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12517
12573
  kind: "mutation",
12518
12574
  auth: "admin"
12519
12575
  }), method(object({ file: string() }), _void(), {
12520
12576
  kind: "mutation",
12521
12577
  auth: "admin"
12522
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12578
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12523
12579
  /**
12524
12580
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12525
12581
  * methods concat-fan across providers; single-row methods route to ONE
@@ -15992,1748 +16048,1958 @@ var OauthIntegrationDescriptorSchema = object({
15992
16048
  */
15993
16049
  refreshTokenTtlSec: union([number().int().positive(), literal("never")]).optional()
15994
16050
  });
15995
- method(_void(), OauthIntegrationDescriptorSchema);
16051
+ method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
15996
16052
  /**
15997
- * pipeline-analytics device-scoped wrapper cap. Refines raw
15998
- * per-frame detections emitted by the pipeline runner into tracked
15999
- * objects, per-kind event collections (motion / object / audio), and
16000
- * persisted media. Owns the post-detection domain end-to-end:
16001
- *
16002
- * runner emits PipelineInferenceResult
16003
- * ↓ (event bus)
16004
- * pipeline-analytics subscriber
16005
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16006
- * → three DB collections (one per kind), one FS media tree, one
16007
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16008
- * DetectionEvent on bus)
16009
- *
16010
- * Pure subscriber model. No `processFrame` cap method — the runner
16011
- * already publishes the raw frame on the bus. The cap surface is
16012
- * only QUERIES + per-device settings, bound on/off via
16013
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16014
- * every camera with a detection pipeline wants its raw detections
16015
- * refined; operators opt out per-device via BindingsTab when needed.
16016
- *
16017
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16018
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16053
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16054
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16055
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16019
16056
  */
16020
- var TrackStateSchema = _enum([
16021
- "new",
16022
- "entered",
16023
- "left",
16024
- "moving",
16025
- "idle"
16026
- ]);
16027
- var EventKindSchema = _enum([
16028
- "motion",
16029
- "object",
16030
- "audio"
16031
- ]);
16057
+ var NativeCropRefSchema = object({
16058
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16059
+ handle: FrameHandleSchema,
16060
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16061
+ cropFrameSpace: object({
16062
+ x: number(),
16063
+ y: number(),
16064
+ w: number(),
16065
+ h: number()
16066
+ })
16067
+ });
16068
+ object({
16069
+ crop: object({
16070
+ left: number(),
16071
+ top: number(),
16072
+ width: number().positive(),
16073
+ height: number().positive()
16074
+ }).optional(),
16075
+ content: object({
16076
+ width: number().int().positive(),
16077
+ height: number().int().positive()
16078
+ }),
16079
+ fit: _enum(["stretch", "contain"]),
16080
+ format: _enum([
16081
+ "rgb",
16082
+ "gray",
16083
+ "jpeg"
16084
+ ])
16085
+ });
16032
16086
  /**
16033
- * Spatial filter for `listTracks` the rect + polygon variants of the shared
16034
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16035
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16087
+ * Process-local frame identity. It is serializable so it can ride an in-process
16088
+ * capability call, but `registryId` deliberately prevents resolution in any
16089
+ * other process or execution group.
16036
16090
  */
16037
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16038
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16039
- var EventKindIconSchema = _enum([
16040
- "motion",
16041
- "audio",
16042
- "person",
16043
- "vehicle",
16044
- "animal",
16045
- "door",
16046
- "pir",
16047
- "smoke",
16048
- "water",
16049
- "button",
16050
- "package",
16051
- "generic"
16091
+ var FrameRefSchema = object({
16092
+ registryId: string().min(1),
16093
+ id: string().min(1),
16094
+ width: number().int().positive(),
16095
+ height: number().int().positive(),
16096
+ format: _enum(["rgb", "gray"]),
16097
+ timestamp: number(),
16098
+ capturedAt: number().optional()
16099
+ });
16100
+ var ModelFormatSchema$1 = _enum([
16101
+ "onnx",
16102
+ "coreml",
16103
+ "openvino",
16104
+ "tflite",
16105
+ "pt",
16106
+ "gguf"
16052
16107
  ]);
16053
- var EventKindCategorySchema = _enum([
16054
- "motion",
16055
- "audio",
16056
- "detection",
16057
- "sensor",
16058
- "control",
16059
- "custom",
16060
- "package"
16108
+ var PipelineSlotSchema = _enum([
16109
+ "detector",
16110
+ "cropper",
16111
+ "classifier",
16112
+ "refiner",
16113
+ "audio-classifier"
16061
16114
  ]);
16062
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16063
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16064
- var EventKindDescriptorSchema = object({
16065
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16066
- kind: string(),
16067
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16068
- labelKey: string(),
16069
- /** English fallback label (kept for clients that don't translate). */
16070
- label: string(),
16071
- /** Hex color for timeline/legend rendering. */
16072
- color: string(),
16073
- /** Dictionary id → lucide component on the UI side. */
16074
- iconId: string(),
16075
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16076
- icon: EventKindIconSchema,
16077
- category: EventKindCategorySchema,
16078
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16079
- parentKind: string().nullable(),
16080
- /** Derived from `parentKind`, explicit for the client tree. */
16081
- level: EventKindLevelSchema,
16082
- /** Which cap + device contributes this kind. For built-ins the camera
16083
- * itself; for sensor kinds the LINKED source device. */
16084
- source: object({
16085
- capName: string(),
16086
- deviceId: number()
16087
- })
16115
+ var PipelineEngineChoiceSchema = object({
16116
+ runtime: _enum(["node", "python"]),
16117
+ backend: string(),
16118
+ format: ModelFormatSchema$1,
16119
+ device: string().optional()
16088
16120
  });
16089
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16090
- var EventKindsForDeviceSchema = object({
16091
- deviceId: number(),
16092
- kinds: array(EventKindDescriptorSchema).readonly()
16121
+ var AvailableEngineSchema = object({
16122
+ engine: PipelineEngineChoiceSchema,
16123
+ devices: array(object({
16124
+ id: string(),
16125
+ label: string(),
16126
+ description: string().optional()
16127
+ })).readonly(),
16128
+ defaultDevice: string()
16093
16129
  });
16094
- var SensorEventSchema = object({
16130
+ var PipelineDefaultStepSchema = lazy(() => object({
16131
+ addonId: string(),
16132
+ addonName: string(),
16133
+ slot: PipelineSlotSchema,
16134
+ inputClasses: array(string()).readonly(),
16135
+ outputClasses: array(string()).readonly(),
16136
+ enabled: boolean(),
16137
+ modelId: string(),
16138
+ children: array(PipelineDefaultStepSchema).readonly(),
16139
+ group: string().optional(),
16140
+ settings: record(string(), unknown()).optional()
16141
+ }));
16142
+ var PipelineTemplateStepSchema = lazy(() => object({
16143
+ addonId: string(),
16144
+ enabled: boolean(),
16145
+ modelId: string(),
16146
+ children: array(PipelineTemplateStepSchema).readonly(),
16147
+ settings: record(string(), unknown()).optional()
16148
+ }));
16149
+ var PipelineTemplateSchema$1 = object({
16095
16150
  id: string(),
16096
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16097
- * yields N rows, one per camera). */
16098
- deviceId: number(),
16099
- /** The linked sensor device whose state changed. */
16100
- sourceDeviceId: number(),
16101
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16102
- kind: string(),
16103
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16104
- value: record(string(), unknown()).nullable(),
16105
- timestamp: number()
16151
+ name: string(),
16152
+ createdAt: string(),
16153
+ updatedAt: string(),
16154
+ engine: PipelineEngineChoiceSchema,
16155
+ steps: array(PipelineTemplateStepSchema).readonly()
16106
16156
  });
16107
- var TrackPositionSchema = object({
16108
- x: number(),
16109
- y: number(),
16110
- timestamp: number(),
16111
- bbox: BoundingBoxSchema
16112
- });
16113
- var TrackSnapshotSchema = object({
16114
- timestamp: number(),
16115
- position: TrackPositionSchema,
16116
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16117
- mediaKey: string()
16157
+ var PipelineModelOptionSchema = object({
16158
+ id: string(),
16159
+ name: string(),
16160
+ formats: record(string(), object({
16161
+ downloaded: boolean(),
16162
+ sizeMB: number()
16163
+ })),
16164
+ group: ModelVariantGroupSchema.optional(),
16165
+ legacy: boolean().optional(),
16166
+ provider: ModelProviderIdSchema.optional()
16118
16167
  });
16119
- /**
16120
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16121
- * divided by the track's detection-frame dims), computed at persist time.
16122
- * Absent when the frame dims were unknown when the track was persisted
16123
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16124
- */
16125
- var TrackEnvelopeSchema = object({
16126
- minX: number(),
16127
- minY: number(),
16128
- maxX: number(),
16129
- maxY: number()
16168
+ var ConfigFieldBridge = custom();
16169
+ var PipelineAddonSchemaSchema = object({
16170
+ id: string(),
16171
+ name: string(),
16172
+ slot: PipelineSlotSchema,
16173
+ inputClasses: array(string()).readonly(),
16174
+ outputClasses: array(string()).readonly(),
16175
+ childSlots: array(PipelineSlotSchema).readonly(),
16176
+ models: array(PipelineModelOptionSchema).readonly(),
16177
+ defaultModelId: string(),
16178
+ defaultModelIdByFormat: record(string(), string()).optional(),
16179
+ enabledByDefault: boolean().optional(),
16180
+ backfillIntoExistingOverrides: boolean().optional(),
16181
+ defaultConfidence: number(),
16182
+ group: string().optional(),
16183
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16130
16184
  });
16131
- /**
16132
- * Row projection for track list queries. `full` (default) returns the
16133
- * complete Track including the frame-rate `positions[]` history and the
16134
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16135
- * keeps every scalar the list surfaces actually render (ids, class(es),
16136
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16137
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16138
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16139
- * `getTrack`. Mirrors the event-store `projection` convention
16140
- * (`getObjectEvents` et al.).
16141
- */
16142
- var TrackProjectionSchema = _enum(["full", "slim"]);
16143
- /**
16144
- * One audio-classification label heard on the track's camera while the
16145
- * track was alive, aggregated per label. An "episode" is one persisted
16146
- * audio event (the confident-classification path: score ≥ the device's
16147
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16148
- * one 32 ms inference chunk, so counts stay human-scaled.
16149
- */
16150
- var TrackAudioLabelSchema = object({
16185
+ var PipelineSlotSchemaSchema = object({
16186
+ id: PipelineSlotSchema,
16151
16187
  label: string(),
16152
- /** Highest classification score observed across the label's episodes. */
16153
- peakScore: number(),
16154
- /** Number of coalesced audio-event episodes carrying this label. */
16155
- count: number(),
16156
- firstAt: number(),
16157
- lastAt: number()
16188
+ priority: number(),
16189
+ parentSlot: PipelineSlotSchema.nullable(),
16190
+ addons: array(PipelineAddonSchemaSchema).readonly()
16158
16191
  });
16159
- /**
16160
- * How a track was produced. `pipeline` (default / absent) = the spatial
16161
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16162
- * no positions, a single snapshot, and no bbox trajectory at all:
16163
- *
16164
- * - `sensor` — a linked sensor/control device state change.
16165
- * - `audio` — an audio event on the camera itself that was anomalous for
16166
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16167
- *
16168
- * The spatial subsystems (tracker association, occupancy count, re-id /
16169
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16170
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16171
- * check silently readmits every source added after it was written.
16172
- */
16173
- var TrackSourceSchema = _enum([
16174
- "pipeline",
16175
- "sensor",
16176
- "audio"
16177
- ]);
16178
- /**
16179
- * Where a track sits in the RETRAIN lifecycle (D81).
16180
- *
16181
- * - `none` — never marked, or un-marked. Evictable.
16182
- * - `staging` — the operator wants this track as training material and has not
16183
- * finished with it. **This is the only state retention holds**: the track and
16184
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16185
- * the device's age window.
16186
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16187
- * were COPIED into the retrain dataset at selection time, so the dataset no
16188
- * longer depends on the track's media and the track becomes EVICTABLE again.
16189
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16190
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16191
- *
16192
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16193
- * the store's filter language has only positive equality and `whereIn` — no
16194
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16195
- * would make the entire pre-column history immortal in one deploy.
16196
- */
16197
- var RetrainStatusSchema = _enum([
16198
- "none",
16199
- "staging",
16200
- "trained"
16201
- ]);
16202
- /**
16203
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16204
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16205
- * so the two surfaces cannot drift.
16206
- *
16207
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16208
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16209
- * columns existed read as absent, and a consumer that needs a boolean should say
16210
- * `flag === true`, not `flag !== false`.
16211
- *
16212
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16213
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16214
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16215
- * `trained` track reports `false` while refusing both writes. The boolean is
16216
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16217
- * "never marked" from "already trained" must read `retrainStatus`.
16218
- *
16219
- * `debug` does NOT pin; it is attention, not durability.
16220
- *
16221
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16222
- * A favourited track is skipped by retention the same way `staging` is, but
16223
- * it does not enter `none|staging|trained` and has no staging budget.
16224
- */
16225
- var TrackFlagFields = {
16226
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16227
- * `'staging'`. */
16228
- markForTrain: boolean().optional(),
16229
- /** Operator marked this track for diagnostic attention. */
16230
- debug: boolean().optional(),
16231
- /** Operator favourited this track. Pins it against pruning. */
16232
- favourited: boolean().optional()
16233
- };
16234
- /**
16235
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16236
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16237
- * write patch, and the status is not something the toggle sets — it is what the
16238
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16239
- * always present on a persisted row (the column default materialises `'none'`).
16240
- */
16241
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16242
- /**
16243
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16244
- * one flag can never clear the other — the toggles are independent and are
16245
- * driven from three surfaces that do not know about each other.
16246
- */
16247
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16248
- /**
16249
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16250
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16251
- * mutation result without a re-fetch.
16252
- */
16253
- var TrackFlagsSchema = object({
16254
- trackId: string(),
16255
- markForTrain: boolean(),
16256
- debug: boolean(),
16257
- favourited: boolean(),
16258
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16259
- * a track row) because this shape is only ever produced by the write body,
16260
- * which always knows it — and a surface that has just written needs to render
16261
- * `trained` without a re-fetch. */
16262
- retrainStatus: RetrainStatusSchema
16192
+ var PipelineSchemaSchema = object({
16193
+ availableEngines: array(AvailableEngineSchema).readonly(),
16194
+ selectedEngine: PipelineEngineChoiceSchema,
16195
+ slots: array(PipelineSlotSchemaSchema).readonly()
16263
16196
  });
16264
- union([literal(1), literal(2)]);
16265
- /**
16266
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16267
- * the step and model that produced it — which is what makes the write rule
16268
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16269
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16270
- *
16271
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16272
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16273
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16274
- * that value has no provenance, and the write rule lets ANY properly-attributed
16275
- * write of the same tier replace it regardless of score.
16276
- */
16277
- var LabelAttributionSchema = object({
16278
- stepId: string(),
16279
- modelId: string().optional(),
16280
- decidedAt: number(),
16197
+ var EngineProvisioningSchema = object({
16198
+ runtimeId: _enum([
16199
+ "onnx",
16200
+ "openvino",
16201
+ "coreml",
16202
+ "edgetpu"
16203
+ ]).nullable(),
16204
+ device: string().nullable(),
16205
+ state: _enum([
16206
+ "idle",
16207
+ "installing",
16208
+ "verifying",
16209
+ "ready",
16210
+ "failed"
16211
+ ]),
16212
+ progress: number().optional(),
16213
+ error: string().optional(),
16214
+ nextRetryAt: number().optional(),
16281
16215
  /**
16282
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16283
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16284
- *
16285
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16286
- * notification rule authored on "Gianluca" stopped matching the moment the
16287
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16288
- * the thing that does not move, so it is what a rule matches on
16289
- * (`NcConditions.identities`) and the text is what a human is shown.
16290
- *
16291
- * Absent when the label names no gallery row — a plate the OCR read but no
16292
- * vehicle claims, a sub-class, a species, any tier-1 value.
16216
+ * Gate A (config-correctness gate at engine change): human-readable
16217
+ * config issues surfaced EAGERLY when the node's engine changes — model
16218
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16219
+ * has a <format> build"). Additive/optional: informational only, never
16220
+ * enforced here `assertEngineReady` (readiness) still gates inference.
16221
+ * Absent/empty when the node-default tree resolves cleanly.
16293
16222
  */
16294
- identityId: string().optional()
16223
+ configIssues: array(string()).optional()
16295
16224
  });
16296
- /**
16297
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16298
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16299
- * track and its events always answer the same question the same way.
16300
- *
16301
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16302
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16303
- * is tier 2, and each carries its own score + attribution.
16304
- *
16305
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16306
- * finest thing known. Before 4g the single `label` column held the finest
16307
- * value, so a consumer that has not been updated reads the tier-1 slot and
16308
- * shows nothing on a species-only row; that is why the migration puts every
16309
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16310
- * and why the read surfaces were changed in the same train.
16311
- *
16312
- * **Writing it.** The slots are independent, which is the whole point: a
16313
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16314
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16315
- * higher score wins. One rule, one implementation — see
16316
- * `pipeline/label-tier.ts` in addon-post-analysis.
16317
- */
16318
- var TieredLabelFields = {
16319
- /** Tier 1 the sub-class. See {@link LabelTierSchema}. */
16320
- label: string().optional(),
16321
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16322
- labelScore: number().optional(),
16323
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16324
- labelMeta: LabelAttributionSchema.optional(),
16325
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16326
- subLabel: string().optional(),
16327
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16328
- subLabelScore: number().optional(),
16329
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16330
- subLabelMeta: LabelAttributionSchema.optional()
16331
- };
16332
- /** Per-camera slice of a training-export estimate. */
16333
- var TrainingExportDeviceTotalsSchema = object({
16334
- deviceId: number(),
16335
- tracks: number().int(),
16336
- files: number().int(),
16337
- bytes: number().int()
16225
+ var PipelineStepInputSchema = lazy(() => object({
16226
+ addonId: string(),
16227
+ modelId: string().optional(),
16228
+ enabled: boolean().default(true),
16229
+ children: array(PipelineStepInputSchema).optional(),
16230
+ settings: record(string(), unknown()).optional(),
16231
+ jumpDeviceKey: string().optional()
16232
+ }));
16233
+ var ModelSubstitutionSchema = object({
16234
+ addonId: string(),
16235
+ chosen: string(),
16236
+ running: string(),
16237
+ format: string()
16238
+ });
16239
+ var PipelineValidationIssueSchema = object({
16240
+ addonId: string(),
16241
+ kind: _enum(["unknown-addon", "no-format-build"]),
16242
+ detail: string()
16243
+ });
16244
+ var PipelineValidationResultSchema = object({
16245
+ ok: boolean(),
16246
+ issues: array(PipelineValidationIssueSchema).readonly(),
16247
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16248
+ /** The node's `currentEngine.format` this validation ran against. */
16249
+ format: string()
16250
+ });
16251
+ var ReferenceImageEntrySchema = object({
16252
+ filename: string(),
16253
+ stepIds: array(string()).readonly().optional()
16254
+ });
16255
+ var ReferenceImageBodySchema = object({
16256
+ base64: string(),
16257
+ filename: string()
16258
+ });
16259
+ var ReferenceAudioEntrySchema = object({
16260
+ filename: string(),
16261
+ sizeKb: number()
16262
+ });
16263
+ var ReferenceAudioBodySchema = object({ base64: string() });
16264
+ var AudioBackendSchema = object({
16265
+ id: string(),
16266
+ name: string(),
16267
+ description: string(),
16268
+ available: boolean(),
16269
+ /**
16270
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16271
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16272
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16273
+ * specific to the selected backend without a separate fetch.
16274
+ */
16275
+ rawLabels: array(string()).readonly().optional()
16276
+ });
16277
+ var AudioCapabilitiesSchema = object({
16278
+ activeBackend: string(),
16279
+ availableBackends: array(AudioBackendSchema).readonly(),
16280
+ sampleRate: number(),
16281
+ chunkDurationMs: number()
16282
+ });
16283
+ var DownloadModelResultSchema = object({
16284
+ filePath: string(),
16285
+ sizeMB: number(),
16286
+ durationMs: number()
16338
16287
  });
16339
16288
  /**
16340
- * What a training export WOULD contain. Computed from media index rows only —
16341
- * no blob is read to produce this.
16289
+ * Wrapper carrying a single test run's result. Replaces the legacy
16290
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16291
+ * canonical `AudioResult` from the Phase 6 output rework: one
16292
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16293
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16294
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16295
+ * benchmark UI can still report a clean failure when the classifier
16296
+ * cap isn't available.
16342
16297
  */
16343
- var TrainingExportSummarySchema = object({
16344
- generatedAt: number(),
16345
- trackCount: number().int(),
16346
- fileCount: number().int(),
16347
- byteCount: number().int(),
16348
- /** More marked tracks exist than a single pass carries. */
16349
- truncated: boolean(),
16350
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16298
+ var AudioTestResultSchema = object({
16299
+ success: boolean(),
16300
+ error: string().optional(),
16301
+ frame: custom().optional()
16351
16302
  });
16352
- var TrackSchema = object({
16353
- trackId: string(),
16354
- deviceId: number(),
16355
- className: string(),
16356
- ...TieredLabelFields,
16357
- producingDeviceName: string().optional(),
16358
- /** Track provenance. Absent `pipeline` (legacy rows). */
16359
- source: TrackSourceSchema.optional(),
16360
- firstSeen: number(),
16361
- lastSeen: number(),
16362
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16363
- positions: array(TrackPositionSchema).readonly(),
16364
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16365
- * saveThumbnails policy). */
16366
- snapshots: array(TrackSnapshotSchema).readonly(),
16367
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16368
- zonesVisited: array(string()).readonly(),
16303
+ var PipelineConfigBridge = custom();
16304
+ var ConfigUISchemaBridge = custom();
16305
+ var ConfigUISchemaNullableBridge = custom();
16306
+ var InferenceCapabilitiesBridge = custom();
16307
+ var ModelAvailabilityListBridge = custom();
16308
+ var PipelineRunResultBridge = custom();
16309
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
16310
+ modelId: string(),
16311
+ settings: record(string(), unknown()).readonly()
16312
+ }))), method(object({ steps: record(string(), object({
16313
+ modelId: string(),
16314
+ settings: record(string(), unknown()).readonly()
16315
+ })) }), object({ success: literal(true) }), {
16316
+ kind: "mutation",
16317
+ auth: "admin"
16318
+ }), method(object({ nodeId: string() }), object({
16319
+ success: literal(true),
16320
+ clearedDevices: number()
16321
+ }), {
16322
+ kind: "mutation",
16323
+ auth: "admin"
16324
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
16325
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16326
+ deviceKey: string(),
16369
16327
  /**
16370
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16371
- * `zones` capability.
16372
- *
16373
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16374
- * and no card can render — so every free-text search surface was structurally
16375
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16376
- * just returned nothing. Resolving here rather than in each client keeps ONE
16377
- * derivation and costs the clients no extra call (the `zones` cap is
16378
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16379
- * surface built to avoid exactly that).
16380
- *
16381
- * Resolved, never invented: a zone deleted since the track was written has no
16382
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16383
- * two are not positionally aligned. Absent when the track visited no zone, or
16384
- * when the zone catalogue could not be read.
16328
+ * `failed` the per-device restart budget is exhausted; no pool
16329
+ * will be spawned until an operator re-arms it or the runner
16330
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16331
+ * a cached pool observed dead and not yet condemned).
16385
16332
  */
16386
- zoneNames: array(string()).readonly().optional(),
16387
- /** Deduplicated set of detector classes observed for this track over its
16388
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16389
- * legacy rows written before class accumulation shipped. */
16390
- classes: array(string()).readonly().optional(),
16391
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16392
- totalDistance: number(),
16393
- state: TrackStateSchema,
16394
- active: boolean(),
16395
- /** Deterministic key-event importance score in [0,1] (server-computed at
16396
- * track expiry, recomputed on late label). Absent on legacy rows written
16397
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16398
- importance: number().optional(),
16399
- /** Id of the track's highest-confidence ObjectEvent (its representative
16400
- * "best" frame). Absent when the track produced no object events. */
16401
- bestEventId: string().optional(),
16402
- /** Tag of the importance sub-signal that dominated the score
16403
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16404
- importanceReason: string().optional(),
16405
- /** Audio-classification labels heard on the camera during the track's
16406
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16407
- * Absent on legacy rows / tracks with no confident audio. */
16408
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16409
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16410
- * Populated from the persisted envelope columns on historical reads;
16411
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16412
- envelope: TrackEnvelopeSchema.optional(),
16333
+ state: _enum(["failed", "backoff"]),
16334
+ /** Epoch ms of the death that produced this state. */
16335
+ since: number(),
16336
+ /** Pool deaths inside the current window. */
16337
+ deaths: number(),
16338
+ /** The last death's message. */
16339
+ lastError: string()
16340
+ })).readonly() })), method(object({
16341
+ nodeId: string(),
16342
+ deviceKey: string()
16343
+ }), object({ rearmed: boolean() }), {
16344
+ kind: "mutation",
16345
+ auth: "admin"
16346
+ }), 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({
16347
+ name: string(),
16348
+ steps: array(PipelineTemplateStepSchema).readonly(),
16349
+ engine: PipelineEngineChoiceSchema
16350
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16351
+ id: string(),
16352
+ name: string().optional(),
16353
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16354
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
16355
+ addonId: string(),
16356
+ modelId: string(),
16357
+ format: ModelFormatSchema$1
16358
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16359
+ addonId: string(),
16360
+ modelId: string(),
16361
+ format: ModelFormatSchema$1
16362
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16363
+ engine: PipelineEngineChoiceSchema.optional(),
16364
+ steps: array(PipelineStepInputSchema).min(1),
16365
+ frame: FrameInputSchema.optional(),
16413
16366
  /**
16414
- * A face DETECTOR found a face on this track — nothing more. It says the
16415
- * detail plane produced a `face` detail; it does NOT say the face was
16416
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16417
- * enabled. Set once and never cleared.
16418
- *
16419
- * **This exists so "face present but not recognised" is expressible.** A
16420
- * recognised identity lands in `subLabel` (attributed to the face chain via
16421
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16422
- * and a track with no face at all were byte-identical on the wire and no
16423
- * surface could tell them apart. The read is `hasFace === true && subLabel
16424
- * === undefined`.
16425
- *
16426
- * **Absent ≠ false.** Every row written before the column existed omits it,
16427
- * and so does every server that predates the field — a consumer must test
16428
- * `=== true` and render nothing otherwise, never infer "no face".
16367
+ * Process-local lazy frame. Valid only when caller and provider resolve
16368
+ * in the same execution-group process; split/cross-node callers use
16369
+ * `frame`/`image` inline compatibility instead.
16429
16370
  */
16430
- hasFace: boolean().optional(),
16371
+ frameRef: FrameRefSchema.optional(),
16431
16372
  /**
16432
- * This track has a face row IN THE GALLERY: a crop **and** an embedding a
16433
- * face an operator could ASSIGN to an identity.
16434
- *
16435
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16436
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16437
- * branch, before every gate, and means no more than "a face detector produced
16438
- * a face detail". This one is stamped at the single moment the gallery row
16439
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16440
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16441
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16442
- * the crop-store drop. Everything between the detector and that insert can
16443
- * legitimately refuse the face, so a flag written any earlier promises the
16444
- * operator something to assign and delivers nothing.
16445
- *
16446
- * **Independent of recognition.** A face collected but never auto-matched is
16447
- * still assignable — it is in fact the face an operator most wants to reach —
16448
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16449
- * `subLabel`; this says only that the raw material exists.
16450
- *
16451
- * **Set once, never cleared.** A track that produced a gallery row produced
16452
- * one; deleting the row later is the gallery's business, not this flag's.
16453
- *
16454
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16455
- * before the column omits it, and so does every server that predates the
16456
- * field. A consumer must test `=== true` and render nothing otherwise —
16457
- * never infer "no assignable face".
16373
+ * CB5 shm passthrough a `FrameHandle` naming the same ring slot
16374
+ * the decoded pixels live in. One more member of the one-of
16375
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16458
16376
  */
16459
- hasEmbeddedFace: boolean().optional(),
16377
+ frameHandle: FrameHandleSchema.optional(),
16378
+ imageBase64: string().optional(),
16460
16379
  /**
16461
- * This subject CONTAINS a folded rider a person the rider-pairing step
16462
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16463
- * so the passage is tracked once and as a VEHICLE.
16464
- *
16465
- * It exists because the fold's record was dishonest. D34 and the code both
16466
- * said "the person is not lost — it is reported so both entities stay on the
16467
- * record"; in fact the pair went into a per-processor RAM field behind an
16468
- * accessor nobody called, and every durable surface said `vehicle`, full
16469
- * stop. This is the composition note that makes the row true.
16470
- *
16471
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16472
- * person" is not an answer to "what is this" — both label tiers would refuse
16473
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16474
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16475
- * and a `person` rule still does not fire for someone cycling past.
16476
- *
16477
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16478
- * the column, and every hub that predates the field, omits it. Test
16479
- * `=== true` and render nothing otherwise — never infer "no rider".
16380
+ * Binary JPEG bytespreferred over `imageBase64` on internal
16381
+ * hops (hub forked worker via Moleculer MsgPack) because it
16382
+ * skips the 33% base64 overhead + the per-call base64 decode on
16383
+ * the detection-pipeline worker. Callers can pass either; exactly
16384
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16480
16385
  */
16481
- hasRider: boolean().optional(),
16482
- ...TrackFlagFields,
16483
- ...TrackRetrainFields
16484
- });
16485
- var BaseEventFields = {
16486
- id: string(),
16487
- deviceId: number(),
16488
- timestamp: number()
16489
- };
16490
- var MotionEventSchema = object({
16491
- ...BaseEventFields,
16492
- kind: literal("motion"),
16493
- regionCount: number(),
16494
- /** Heavy JSON array omitted in slim projection. */
16495
- regions: array(object({
16496
- bbox: BoundingBoxSchema,
16497
- pixelCount: number(),
16498
- intensity: number()
16499
- })).readonly().optional(),
16500
- /** Omitted in slim projection. */
16501
- frameWidth: number().optional(),
16502
- /** Omitted in slim projection. */
16503
- frameHeight: number().optional(),
16504
- /** Populated by B5 (recording playback URL for this event). */
16505
- mediaUrl: string().optional()
16506
- });
16386
+ image: _instanceof(Uint8Array).optional(),
16387
+ referenceImage: string().optional(),
16388
+ deviceId: number().optional(),
16389
+ sessionId: string().optional(),
16390
+ /**
16391
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16392
+ * reference-image, and detail-subtree calls. 'frame' is the live
16393
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16394
+ * (inputClasses ≠ null) are skipped and served per-track via
16395
+ * pipelineRunner.runDetailSubtree (two-plane design).
16396
+ */
16397
+ plane: _enum(["full", "frame"]).optional(),
16398
+ /**
16399
+ * Inference-device selector (Phase 2 multi-device). Format
16400
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16401
+ * Omitted ⇒ the runner's default device (current single-engine
16402
+ * behaviour). Selects WHICH device pool of the node runs the call.
16403
+ */
16404
+ deviceKey: string().optional(),
16405
+ /**
16406
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16407
+ * when the parent crop was resolved from the frame's retained NATIVE
16408
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16409
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16410
+ * resolution from that surface — the SAME quality path faces already
16411
+ * had — instead of the downscaled parent tile. `handle` keys the native
16412
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16413
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16414
+ * the executor's crop-normalized child ROI back into frame-normalized
16415
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16416
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16417
+ * (today's behaviour on the fallback path).
16418
+ */
16419
+ nativeCropRef: NativeCropRefSchema.optional()
16420
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16421
+ engine: PipelineEngineChoiceSchema.optional(),
16422
+ steps: array(PipelineStepInputSchema).min(1),
16423
+ frames: array(FrameInputSchema).min(1).max(255),
16424
+ deviceId: number().optional(),
16425
+ sessionId: string().optional(),
16426
+ /**
16427
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16428
+ * the batch to the Python pool's bench preprocess cache
16429
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16430
+ * preprocessed ONCE and every later inference is a pure-inference cache
16431
+ * hit — the sustained-throughput run measures inference, not
16432
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16433
+ * full preprocess every call, correct). Fresh per sustained run;
16434
+ * released via `uncacheFrame`.
16435
+ */
16436
+ frameId: number().int().nonnegative().optional(),
16437
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16438
+ deviceKey: string().optional()
16439
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16440
+ data: _instanceof(Uint8Array),
16441
+ width: number().int().positive(),
16442
+ height: number().int().positive(),
16443
+ format: _enum([
16444
+ "rgb",
16445
+ "bgr",
16446
+ "gray"
16447
+ ])
16448
+ }), object({
16449
+ frameId: number(),
16450
+ width: number(),
16451
+ height: number()
16452
+ }), { kind: "mutation" }), method(object({
16453
+ stepId: string(),
16454
+ frameId: number().int()
16455
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16456
+ batchMode: string(),
16457
+ windowMs: number(),
16458
+ maxBatchSize: number(),
16459
+ concurrency: number()
16460
+ })), method(_void(), array(object({
16461
+ engineKey: string(),
16462
+ engine: PipelineEngineChoiceSchema,
16463
+ modelsLoaded: array(string()).readonly(),
16464
+ inUseByCameras: array(number()).readonly(),
16465
+ /**
16466
+ * Origin of this resident factory.
16467
+ * - `runtime` — main camera-serving engine (no idle TTL).
16468
+ * - `warm-override` — benchmark/test override held in the warm
16469
+ * cache; auto-disposed after the idle TTL.
16470
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16471
+ * multi-device, keyed by `deviceKey`) resolved
16472
+ * via `resolveDeviceFactory`. Runs alongside the
16473
+ * `runtime` engine on a DIFFERENT accelerator
16474
+ * (NPU / iGPU / Coral) — this is how the
16475
+ * Engines tab shows all pools running at once.
16476
+ */
16477
+ kind: _enum([
16478
+ "runtime",
16479
+ "warm-override",
16480
+ "device-pool"
16481
+ ]),
16482
+ /** Native pid of the underlying Python pool (null when no pool). */
16483
+ poolPid: number().nullable(),
16484
+ /** ms since this factory was last used (null when not warm-tracked). */
16485
+ idleMs: number().nullable(),
16486
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16487
+ idleTtlMs: number().nullable()
16488
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16489
+ kind: "mutation",
16490
+ auth: "admin"
16491
+ }), method(object({
16492
+ engine: PipelineEngineChoiceSchema,
16493
+ force: boolean().optional()
16494
+ }), object({
16495
+ success: boolean(),
16496
+ reason: string().optional()
16497
+ }), {
16498
+ kind: "mutation",
16499
+ auth: "admin"
16500
+ }), 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({
16501
+ addonId: string(),
16502
+ modelId: string(),
16503
+ filename: string().optional(),
16504
+ settings: record(string(), unknown()).optional()
16505
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16507
16506
  /**
16508
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16509
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16510
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16511
- * tracking, per-kind persistence) but stay distinguishable so consumers
16512
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16513
- * Absent on legacy rows treat as `pipeline`.
16507
+ * Per-stage gating mode applied to the zones a rule references.
16508
+ *
16509
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16510
+ * When at least one `include` rule fires for a stage, only entities
16511
+ * inside one of those zones pass that stage.
16512
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16513
+ * Entities inside one of those zones are dropped at that stage.
16514
+ *
16515
+ * `monitor`-style observation (count without filtering) is not a rule
16516
+ * mode — zones without any matching rule are observed naturally by
16517
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16518
+ * count, not filter" use case needs no rule at all.
16514
16519
  */
16515
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16520
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16516
16521
  /**
16517
- * The confirmed zone crossing that produced an object event. Present ONLY on
16518
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16519
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16520
- * appearance event carry none, so a rule asking for a direction fails closed
16521
- * on them.
16522
+ * Per-consumer rule that references existing zones (geometry) and
16523
+ * defines how a specific pipeline stage should treat them. Each
16524
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16525
+ * settings:
16522
16526
  *
16523
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16524
- * into its own event, so a frame in which a track enters A while leaving B
16525
- * produces two events with two directions — never one ambiguous row.
16527
+ * - `addon-motion-wasm` `motionZoneRules: ZoneRule[]` (motion stage)
16528
+ * - `addon-detection-pipeline` `detectionZoneRules: ZoneRule[]` (detection stage)
16529
+ * - future: notification rules, audio gating, etc.
16526
16530
  *
16527
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16528
- * membership the box has NOW, and by definition it no longer contains the zone
16529
- * that was just left. Without the id here, a zone-scoped rule could never match
16530
- * the exit it asked for.
16531
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16532
+ * express "ignore motion in ALL of {garden, street}" with a single
16533
+ * rule. `classFilter` narrows the rule to specific object classes
16534
+ * "drop person detections in the street, but keep cars" is one
16535
+ * `exclude` rule with `classFilter: ['person']`.
16536
+ *
16537
+ * `enabled` is a soft toggle — the operator can keep the rule
16538
+ * configured but inert without deleting it.
16531
16539
  */
16532
- var ZoneCrossingSchema = object({
16533
- direction: _enum(["enter", "exit"]),
16534
- /** Admin zone id crossed. */
16535
- zoneId: string(),
16536
- /** Zone display name at crossing time (falls back to the id). */
16537
- zoneName: string().optional()
16538
- });
16539
- var ObjectEventSchema = object({
16540
- ...BaseEventFields,
16541
- kind: literal("object"),
16542
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16543
- source: DetectionSourceSchema.optional(),
16540
+ var ZoneRuleSchema = object({
16541
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16542
+ id: string(),
16543
+ /** Optional human-readable label rendered in the rule editor. */
16544
+ name: string().optional(),
16545
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16546
+ * listed zones (OR-set: a detection in any one of them counts).
16547
+ * At least one zone id required — a rule with no targets is a
16548
+ * configuration mistake and the form validator rejects it. */
16549
+ zoneIds: array(string()).min(1).readonly(),
16550
+ mode: ZoneRuleModeEnum,
16544
16551
  /**
16545
- * Inference-frame id shared by every object event emitted from the SAME frame
16546
- * the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16547
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16548
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16549
- * Optional for backward-compat with pre-existing rows / the slim projection
16550
- * includes it (it is light). Absent on rows written before this field.
16551
- */
16552
- frameId: string().optional(),
16553
- /** Omitted in slim projection. */
16554
- trackId: string().optional(),
16555
- className: string(),
16556
- ...TieredLabelFields,
16557
- /** Omitted in slim projection. */
16558
- confidence: number().optional(),
16559
- /** Heavy JSON — omitted in slim projection. */
16560
- bbox: BoundingBoxSchema.optional(),
16561
- /** Heavy JSON — omitted in slim projection. */
16562
- zones: array(string()).readonly().optional(),
16563
- /** Omitted in slim projection. */
16564
- state: TrackStateSchema.optional(),
16552
+ * Class names this rule applies to. Empty / undefined rule
16553
+ * applies to every class. Class strings match the `macroClass`
16554
+ * field on detections (e.g. `person`, `car`, `dog`).
16555
+ */
16556
+ classFilter: array(string()).readonly().optional(),
16565
16557
  /**
16566
- * The zone crossing this event IS, when it is one. Absent on every other
16567
- * event kind (movement state, appearance, package) see
16568
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16558
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16559
+ * required to consider an entity "in the zone". Defaults to the
16560
+ * consumer's stage default when omitted. Kept for back-compat with
16561
+ * existing per-rule overrides; new operators pick the value via
16562
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16563
+ * set, the lower-level engine reads it as a 0–1 fraction.
16569
16564
  */
16570
- zoneCrossing: ZoneCrossingSchema.optional(),
16571
- /** Detection-frame dimensions in pixels — let consumers normalize the
16572
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
16573
- frameWidth: number().optional(),
16574
- frameHeight: number().optional(),
16575
- /** MediaStore key for the crop attached to this event (if any). */
16576
- mediaKey: string().optional(),
16577
- /** Design B: MediaStore key of the track's native-resolution key frame (the
16578
- * best-detection full frame). Resolve via the event-media data-plane
16579
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
16580
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
16581
- * sources — consumers fall back to `mediaKey` (the tight crop). */
16582
- keyFrameMediaKey: string().optional(),
16583
- /** Populated by B5 (recording playback URL for this event). */
16584
- mediaUrl: string().optional(),
16585
- /** The parent track's key-event importance [0,1], propagated to every object
16586
- * event of the track (so an event row can be sorted by importance without a
16587
- * track join). Absent on legacy rows / before the track was scored. */
16588
- importance: number().optional()
16589
- });
16590
- var AudioEventSchema = object({
16591
- ...BaseEventFields,
16592
- kind: literal("audio"),
16593
- rms: number(),
16594
- dbfs: number(),
16595
- classification: object({
16596
- className: string(),
16597
- originalClass: string().optional(),
16598
- score: number()
16599
- }).optional(),
16600
- /** Populated by B5 (recording playback URL for this event). */
16601
- mediaUrl: string().optional()
16602
- });
16603
- var MediaFileKindEnum = _enum([
16604
- "crop",
16605
- "thumbnail",
16606
- "snapshot",
16607
- "firstFrame",
16608
- "lastFrame",
16609
- "fullFrame",
16610
- "fullFrameBoxed",
16611
- "faceCrop",
16612
- "plateCrop",
16613
- "keyFrame",
16614
- "keyFrameSmall",
16615
- "thumbnailSmall"
16616
- ]);
16617
- var MediaFileSchema = object({
16618
- key: string(),
16619
- kind: MediaFileKindEnum,
16620
- base64: string(),
16621
- sizeBytes: number(),
16622
- timestamp: number()
16565
+ overlapThreshold: number().min(0).max(1).optional(),
16566
+ /**
16567
+ * Operator-friendly version of `overlapThreshold` the percentage
16568
+ * of the detection's bbox that must lie inside the zone for the
16569
+ * rule to match. Documented default is 85%; the engine substitutes
16570
+ * that when the field is omitted (kept optional so existing rules
16571
+ * stored without it stay valid).
16572
+ *
16573
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16574
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16575
+ * field exposed in the UI. Internally both feed the same gate.
16576
+ */
16577
+ bboxInclusionPct: number().min(0).max(100).optional(),
16578
+ /**
16579
+ * When `true` and a detection has a segmentation mask, use the
16580
+ * mask for overlap instead of the bbox. Detection-stage only;
16581
+ * motion rules ignore this field.
16582
+ */
16583
+ preferMask: boolean().optional(),
16584
+ /**
16585
+ * Soft-toggle: `false` disables the rule without deleting it.
16586
+ * Defaults to `true` so operators creating a rule via the UI
16587
+ * see it active immediately.
16588
+ */
16589
+ enabled: boolean().default(true)
16623
16590
  });
16591
+ array(ZoneRuleSchema).readonly();
16624
16592
  /**
16625
- * One media row WITHOUT its bytes.
16593
+ * Zone pure geometry + identity. NO filtering behaviour.
16626
16594
  *
16627
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
16628
- * 140 s track), and a client that renders tiles from the media data plane needs
16629
- * to know only WHAT EXISTS the bytes then arrive per tile, lazily, over HTTP
16630
- * with an immutable cache, instead of all at once inside a tRPC response that
16631
- * blocks the whole view.
16595
+ * Zones describe **where** in the frame the operator wants to flag
16596
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16597
+ * each pipeline stage uses them. Splitting the two means a single
16598
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16599
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16600
+ * — without three duplicated polygons.
16632
16601
  *
16633
- * `sizeBytes` is carried because it is what lets a client decide between the
16634
- * stored blob and a `?variant=thumb` rendering without fetching either.
16602
+ * Owned by the orchestrator addon (provider) and mirrored into the
16603
+ * `zones` device-state slice on every mutation. Consumers
16604
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16605
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16606
+ * mirror with `onChanged`).
16607
+ *
16608
+ * Coordinates are normalised fractions of the frame (0–1) so zones
16609
+ * survive resolution changes and stream profile switches.
16610
+ *
16611
+ * `kind` discriminates between full polygons (closed regions used
16612
+ * for intrusion / occupancy filters) and tripwires (open 2-point
16613
+ * line segments used for cross events). Onboard / firmware-reported
16614
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
16615
+ * task list.
16635
16616
  */
16636
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
16617
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
16618
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
16619
+ var PolygonPointSchema = object({
16620
+ x: number(),
16621
+ y: number()
16622
+ });
16623
+ /** A camera detection zone — pure geometry/identity. */
16624
+ var ZoneSchema = object({
16625
+ id: string(),
16626
+ name: string(),
16627
+ kind: ZoneKindEnum.default("polygon"),
16628
+ /** Polygon vertices, fraction of frame (0–1). */
16629
+ polygon: array(PolygonPointSchema).readonly(),
16630
+ /** Visual color for UI rendering. */
16631
+ color: string().default("#3b82f6")
16632
+ });
16633
+ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
16634
+ deviceId: number(),
16635
+ zone: ZoneSchema
16636
+ }), _void(), {
16637
+ kind: "mutation",
16638
+ auth: "admin"
16639
+ }), method(object({
16640
+ deviceId: number(),
16641
+ zoneId: string()
16642
+ }), _void(), {
16643
+ kind: "mutation",
16644
+ auth: "admin"
16645
+ }), method(object({
16646
+ deviceId: number(),
16647
+ zone: ZoneSchema
16648
+ }), _void(), {
16649
+ kind: "mutation",
16650
+ auth: "admin"
16651
+ }), object({ zones: array(ZoneSchema).readonly() });
16637
16652
  /**
16638
- * The MACRO tier of an annotation — a CLOSED set.
16653
+ * pipeline-analytics device-scoped wrapper cap. Refines raw
16654
+ * per-frame detections emitted by the pipeline runner into tracked
16655
+ * objects, per-kind event collections (motion / object / audio), and
16656
+ * persisted media. Owns the post-detection domain end-to-end:
16639
16657
  *
16640
- * This is what the exported detector predicts, so a typo here is a new class
16641
- * with one example in it. `label` and `subLabel` are open strings by contrast:
16642
- * the whole point of the page is teaching the model things it does not know
16643
- * yet, and constraining that vocabulary would make it useless.
16658
+ * runner emits PipelineInferenceResult
16659
+ * (event bus)
16660
+ * pipeline-analytics subscriber
16661
+ * SORT tracker + zone engine + state analyzer + event emitter
16662
+ * → three DB collections (one per kind), one FS media tree, one
16663
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
16664
+ * DetectionEvent on bus)
16644
16665
  *
16645
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
16646
- * `subLabel` is one of these values, in any casing, because once `person`
16647
- * exists in both tiers "every person box" stops being answerable without
16648
- * knowing every string anyone ever typed — and the damage is retroactive.
16666
+ * Pure subscriber model. No `processFrame` cap method the runner
16667
+ * already publishes the raw frame on the bus. The cap surface is
16668
+ * only QUERIES + per-device settings, bound on/off via
16669
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
16670
+ * every camera with a detection pipeline wants its raw detections
16671
+ * refined; operators opt out per-device via BindingsTab when needed.
16672
+ *
16673
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16674
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
16649
16675
  */
16650
- var RetrainMacroClassSchema = _enum([
16676
+ var TrackStateSchema = _enum([
16677
+ "new",
16678
+ "entered",
16679
+ "left",
16680
+ "moving",
16681
+ "idle"
16682
+ ]);
16683
+ var EventKindSchema = _enum([
16684
+ "motion",
16685
+ "object",
16686
+ "audio"
16687
+ ]);
16688
+ /**
16689
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
16690
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16691
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
16692
+ */
16693
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16694
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
16695
+ var EventKindIconSchema = _enum([
16696
+ "motion",
16697
+ "audio",
16651
16698
  "person",
16652
16699
  "vehicle",
16653
16700
  "animal",
16701
+ "door",
16702
+ "pir",
16703
+ "smoke",
16704
+ "water",
16705
+ "button",
16654
16706
  "package",
16655
- "face",
16656
- "plate"
16707
+ "generic"
16657
16708
  ]);
16658
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
16659
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
16660
- /** Did a human draw this box, or did the assist propose it? */
16661
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
16662
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
16663
- var RetrainBboxSchema = object({
16664
- x: number(),
16665
- y: number(),
16666
- w: number(),
16667
- h: number()
16668
- });
16669
- /**
16670
- * One annotated subject.
16671
- *
16672
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
16673
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
16674
- * derived from it at export and never stored storing them is how one feature
16675
- * space ends up holding two crops of the same subject (D52).
16676
- */
16677
- var RetrainAnnotationSchema = object({
16678
- id: string(),
16679
- trackId: string(),
16680
- deviceId: number(),
16681
- /** The COPY in retrain storage — never the source track's media key. */
16682
- mediaKey: string(),
16683
- bbox: RetrainBboxSchema,
16684
- macroClass: RetrainMacroClassSchema,
16685
- label: string().optional(),
16686
- subLabel: string().optional(),
16687
- kind: RetrainAnnotationKindSchema,
16688
- source: RetrainAnnotationSourceSchema,
16689
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
16690
- assistModelId: string().optional(),
16691
- assistScore: number().optional(),
16692
- exportedInBatch: string().optional(),
16693
- createdAt: number()
16694
- });
16695
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
16696
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
16697
- id: true,
16698
- trackId: true,
16699
- deviceId: true,
16700
- mediaKey: true,
16701
- createdAt: true,
16702
- exportedInBatch: true
16709
+ var EventKindCategorySchema = _enum([
16710
+ "motion",
16711
+ "audio",
16712
+ "detection",
16713
+ "sensor",
16714
+ "control",
16715
+ "custom",
16716
+ "package"
16717
+ ]);
16718
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16719
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16720
+ var EventKindDescriptorSchema = object({
16721
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16722
+ kind: string(),
16723
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16724
+ labelKey: string(),
16725
+ /** English fallback label (kept for clients that don't translate). */
16726
+ label: string(),
16727
+ /** Hex color for timeline/legend rendering. */
16728
+ color: string(),
16729
+ /** Dictionary id → lucide component on the UI side. */
16730
+ iconId: string(),
16731
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16732
+ icon: EventKindIconSchema,
16733
+ category: EventKindCategorySchema,
16734
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16735
+ parentKind: string().nullable(),
16736
+ /** Derived from `parentKind`, explicit for the client tree. */
16737
+ level: EventKindLevelSchema,
16738
+ /** Which cap + device contributes this kind. For built-ins the camera
16739
+ * itself; for sensor kinds the LINKED source device. */
16740
+ source: object({
16741
+ capName: string(),
16742
+ deviceId: number()
16743
+ })
16703
16744
  });
16704
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
16705
- var RetrainTrackSchema = object({
16706
- trackId: string(),
16745
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16746
+ var EventKindsForDeviceSchema = object({
16707
16747
  deviceId: number(),
16708
- className: string(),
16709
- label: string().optional(),
16710
- firstSeen: number(),
16711
- lastSeen: number(),
16712
- /** How many frames the dataset already holds from this track. */
16713
- frameCount: number().int(),
16714
- /** How many subjects have been annotated on those frames. `0` with
16715
- * `frameCount: 0` is exactly "staging, still to work". */
16716
- annotationCount: number().int()
16717
- });
16718
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
16719
- var RetrainFrameCandidateSchema = object({
16720
- mediaKey: string(),
16721
- kind: MediaFileKindEnum,
16722
- timestamp: number(),
16723
- sizeBytes: number().int(),
16724
- /** A copy of this original already exists — selecting it is free and cannot
16725
- * fail, whatever became of the original. */
16726
- copied: boolean()
16748
+ kinds: array(EventKindDescriptorSchema).readonly()
16727
16749
  });
16728
- /** A frame the dataset OWNS: bytes copied at selection time. */
16729
- var RetrainFrameSchema = object({
16730
- frameId: string(),
16750
+ var SensorEventSchema = object({
16751
+ id: string(),
16752
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
16753
+ * yields N rows, one per camera). */
16731
16754
  deviceId: number(),
16732
- trackId: string(),
16733
- /** Provenance only. It may already point at nothing — that is expected. */
16734
- sourceMediaKey: string(),
16735
- sourceKind: MediaFileKindEnum,
16736
- sizeBytes: number().int(),
16737
- width: number().int(),
16738
- height: number().int(),
16739
- copiedAt: number()
16755
+ /** The linked sensor device whose state changed. */
16756
+ sourceDeviceId: number(),
16757
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
16758
+ kind: string(),
16759
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
16760
+ value: record(string(), unknown()).nullable(),
16761
+ timestamp: number()
16740
16762
  });
16741
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
16742
- var RetrainCopyRefusalSchema = _enum([
16743
- "source-missing",
16744
- "unreadable-image",
16745
- "write-failed"
16746
- ]);
16747
- var RetrainFrameSelectionSchema = object({
16748
- copied: array(RetrainFrameSchema).readonly(),
16749
- refused: array(object({
16750
- sourceMediaKey: string(),
16751
- reason: RetrainCopyRefusalSchema
16752
- })).readonly()
16763
+ var TrackPositionSchema = object({
16764
+ x: number(),
16765
+ y: number(),
16766
+ timestamp: number(),
16767
+ bbox: BoundingBoxSchema
16753
16768
  });
16754
- var RetrainFrameListSchema = object({
16755
- candidates: array(RetrainFrameCandidateSchema).readonly(),
16756
- copies: array(RetrainFrameSchema).readonly(),
16757
- /** What the page pre-selects the native key frame when one survives. */
16758
- autoPickMediaKey: string().optional()
16769
+ var TrackSnapshotSchema = object({
16770
+ timestamp: number(),
16771
+ position: TrackPositionSchema,
16772
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16773
+ mediaKey: string()
16759
16774
  });
16760
- /** What the operator asked the assist to look for. */
16761
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
16762
- kind: literal("package"),
16763
- zone: RetrainBboxSchema.optional()
16764
- }), object({
16765
- kind: literal("objects"),
16766
- modelId: string(),
16767
- minScore: number().optional()
16768
- })]);
16769
16775
  /**
16770
- * The assist's answer a discriminated union, because "the model saw nothing"
16771
- * and "this node cannot run that model" lead to different next moves and a
16772
- * nullable result cannot tell them apart.
16776
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16777
+ * divided by the track's detection-frame dims), computed at persist time.
16778
+ * Absent when the frame dims were unknown when the track was persisted
16779
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16773
16780
  */
16774
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
16775
- kind: literal("proposed"),
16776
- modelId: string(),
16777
- stepId: string(),
16778
- minScore: number(),
16779
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
16780
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
16781
- /** Returned by the runner but removed by the threshold. */
16782
- belowThreshold: number().int()
16783
- }), object({
16784
- kind: literal("refused"),
16785
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
16786
- reason: string(),
16787
- detail: string().optional()
16788
- })]);
16789
- /** The outcome of a lifecycle move owned by the retrain page. */
16790
- var RetrainTransitionResultSchema = object({
16791
- trackId: string(),
16792
- /** Where the track ended up, whatever happened. */
16793
- retrainStatus: RetrainStatusSchema,
16794
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
16795
- changed: boolean(),
16796
- reason: _enum([
16797
- "unknown-track",
16798
- "no-frames-copied",
16799
- "not-staging",
16800
- "not-trained",
16801
- "unchanged"
16802
- ]).optional()
16803
- });
16804
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
16805
- var MAX_EVENT_QUERY_LIMIT = 5e3;
16806
- var DeviceEventQueryInput = object({
16807
- deviceId: number(),
16808
- since: number().optional(),
16809
- until: number().optional(),
16810
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
16811
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
16812
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
16813
- * exact behaviour. Callers may omit this field — the store defaults to
16814
- * `full` when not provided. */
16815
- projection: _enum(["full", "slim"]).optional()
16816
- });
16817
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
16818
- var RecentTracksQueryInput = object({
16819
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
16820
- deviceIds: array(number()),
16821
- /** Window lower bound on `lastSeen` (inclusive). */
16822
- since: number().optional(),
16823
- /** Window upper bound on `lastSeen` (inclusive). */
16824
- until: number().optional(),
16825
- /** Page size. Default 200, max 1000. */
16826
- limit: number().int().min(1).max(1e3).default(200),
16827
- /** Opaque continuation cursor from a previous page's `nextCursor`.
16828
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16829
- cursor: string().optional(),
16830
- /** See {@link TrackProjectionSchema}. Default `full`. */
16831
- projection: TrackProjectionSchema.optional(),
16832
- /** Include stationary-promoted rows (parked objects). Default false: the
16833
- * feed lists passages; parking records live on the stationary registry. */
16834
- includeStationary: boolean().optional()
16781
+ var TrackEnvelopeSchema = object({
16782
+ minX: number(),
16783
+ minY: number(),
16784
+ maxX: number(),
16785
+ maxY: number()
16835
16786
  });
16836
- var RecentTracksPageSchema = object({
16837
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
16838
- tracks: array(TrackSchema).readonly(),
16839
- /** Cursor for the next page, or null when this page is the last. */
16840
- nextCursor: string().nullable()
16841
- });
16842
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
16843
- var LIST_GROUPS_MAX_LIMIT = 100;
16844
- var AnalyticsGroupRecordSchema = object({
16845
- id: string(),
16846
- deviceId: number().int(),
16847
- openedAt: number().int(),
16848
- closedAt: number().int(),
16849
- timestamp: number().int(),
16850
- memberCount: number().int(),
16851
- memberTrackIds: array(string()).readonly(),
16852
- className: string(),
16853
- classes: array(string()).readonly(),
16854
- /** Relative event-media path, or null when the group has no picture yet. */
16855
- mediaUrl: string().nullable(),
16856
- singleton: boolean()
16857
- });
16858
- var AnalyticsGroupMemberSchema = object({
16859
- trackId: string(),
16860
- deviceId: number().int(),
16861
- className: string(),
16862
- firstSeen: number().int(),
16863
- lastSeen: number().int(),
16864
- mediaUrl: string().nullable()
16865
- });
16866
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
16867
- var ListGroupsQueryInput = object({
16868
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
16869
- deviceIds: array(number()),
16870
- /** Window lower bound on `closedAt` (inclusive). */
16871
- since: number().optional(),
16872
- /** Window upper bound on `openedAt` (inclusive). */
16873
- until: number().optional(),
16874
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
16875
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
16876
- cursor: string().optional()
16877
- });
16878
- var ListGroupsPageSchema = object({
16879
- groups: array(AnalyticsGroupRecordSchema).readonly(),
16880
- nextCursor: string().nullable()
16881
- });
16882
- var KeyEventQueryInput = object({
16883
- deviceId: number(),
16884
- /** Window lower bound (track firstSeen ≥ since). */
16885
- since: number(),
16886
- /** Window upper bound (track firstSeen ≤ until). */
16887
- until: number(),
16888
- limit: number().int().min(1).max(200).default(50),
16889
- /** Drop tracks scoring below this importance. */
16890
- minImportance: number().min(0).max(1).optional(),
16891
- /** Restrict to a single class (e.g. 'person'). */
16892
- classFilter: string().optional()
16893
- });
16894
- var KeyEventSchema = object({
16895
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
16896
- id: string(),
16897
- trackId: string(),
16898
- /** Track start time (firstSeen). */
16899
- timestamp: number(),
16900
- className: string(),
16901
- ...TieredLabelFields,
16902
- importance: number(),
16903
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
16904
- bestEventId: string(),
16905
- /** Track lifetime in ms (lastSeen - firstSeen). */
16906
- windowMs: number().optional(),
16907
- ...TrackFlagFields,
16908
- ...TrackRetrainFields
16909
- });
16910
- object({
16911
- trackId: string(),
16912
- className: string(),
16913
- confidence: number(),
16914
- bbox: BoundingBoxSchema,
16915
- zones: array(string()).readonly(),
16916
- state: TrackStateSchema
16917
- });
16918
- var OverlayDetectionSchema = looseObject({
16919
- id: string(),
16920
- kind: _enum(["first-level", "detail"]),
16921
- macroClass: string(),
16922
- score: number(),
16923
- bbox: object({
16924
- x: number(),
16925
- y: number(),
16926
- width: number(),
16927
- height: number()
16928
- }),
16929
- labels: array(looseObject({
16930
- label: string(),
16931
- score: number()
16932
- })).readonly(),
16933
- parentId: string().optional()
16934
- });
16935
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
16936
- var SearchObjectEventsInput = object({
16937
- text: string(),
16938
- deviceId: number().optional(),
16939
- since: number().optional(),
16940
- until: number().optional(),
16941
- classFilter: string().optional(),
16942
- limit: number().default(50),
16943
- minScore: number().min(0).max(1).default(.2)
16944
- });
16945
- var TrackCascadeCountsSchema = object({
16946
- /** Persisted track roots deleted (authoritative). */
16947
- tracks: number().int(),
16948
- /** Object events removed with their tracks (best-effort; see note above). */
16949
- events: number().int(),
16950
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
16951
- media: number().int(),
16952
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
16953
- faces: number().int(),
16954
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
16955
- plates: number().int(),
16956
- /** Per-track CLIP search vectors removed (best-effort). */
16957
- embeddings: number().int(),
16958
- /** Group membership + group rows removed with their last member (best-effort). */
16959
- groups: number().int()
16960
- });
16961
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
16962
- var DiskReconcileCountsSchema = object({
16963
- mediaDropped: number().int(),
16964
- tracks: number().int(),
16965
- events: number().int()
16966
- });
16967
- /** Event-store footprint for one camera. */
16968
- var EventStoreDeviceFootprintSchema = object({
16969
- deviceId: number(),
16970
- /** Persisted event rows (motion + object + audio) for the camera. */
16971
- rows: number().int(),
16972
- /** Event-owned media bytes on disk for the camera. */
16973
- bytes: number().int()
16974
- });
16975
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16976
- var EventStoreFootprintSchema = object({
16977
- totalRows: number().int(),
16978
- totalBytes: number().int(),
16979
- devices: array(EventStoreDeviceFootprintSchema).readonly()
16980
- });
16981
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
16982
- var EventPruneCountsSchema = object({
16983
- motion: number().int(),
16984
- object: number().int(),
16985
- audio: number().int()
16787
+ /**
16788
+ * Row projection for track list queries. `full` (default) returns the
16789
+ * complete Track including the frame-rate `positions[]` history and the
16790
+ * `snapshots[]` references megabytes across a page of tracks. `slim`
16791
+ * keeps every scalar the list surfaces actually render (ids, class(es),
16792
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16793
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16794
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16795
+ * `getTrack`. Mirrors the event-store `projection` convention
16796
+ * (`getObjectEvents` et al.).
16797
+ */
16798
+ var TrackProjectionSchema = _enum(["full", "slim"]);
16799
+ /**
16800
+ * One audio-classification label heard on the track's camera while the
16801
+ * track was alive, aggregated per label. An "episode" is one persisted
16802
+ * audio event (the confident-classification path: score ≥ the device's
16803
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16804
+ * one 32 ms inference chunk, so counts stay human-scaled.
16805
+ */
16806
+ var TrackAudioLabelSchema = object({
16807
+ label: string(),
16808
+ /** Highest classification score observed across the label's episodes. */
16809
+ peakScore: number(),
16810
+ /** Number of coalesced audio-event episodes carrying this label. */
16811
+ count: number(),
16812
+ firstAt: number(),
16813
+ lastAt: number()
16986
16814
  });
16987
16815
  /**
16988
- * Re-embed stored tracks from their key frames.
16816
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16817
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16818
+ * no positions, a single snapshot, and no bbox trajectory at all:
16989
16819
  *
16990
- * The reason this is an operator-callable method and not a migration script:
16991
- * every knob that decides what a vector MEANS encoder model, crop margin,
16992
- * squaring is only changeable if the existing vectors can be regenerated.
16993
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
16994
- * symptom is a quality regression with no visible cause.
16820
+ * - `sensor` a linked sensor/control device state change.
16821
+ * - `audio` an audio event on the camera itself that was anomalous for
16822
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
16823
+ *
16824
+ * The spatial subsystems (tracker association, occupancy count, re-id /
16825
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
16826
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16827
+ * check silently readmits every source added after it was written.
16995
16828
  */
16996
- var RebuildObjectEmbeddingsInput = object({
16997
- /** Restrict to one camera. Omit for the whole fleet. */
16998
- deviceId: number().optional(),
16999
- since: number().optional(),
17000
- until: number().optional(),
17001
- /** Stop after this many tracks; the result reports whether more remain. */
17002
- maxTracks: number().int().positive().optional(),
17003
- /**
17004
- * Run every embedding on THIS node instead of round-robining the fleet.
17005
- *
17006
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17007
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17008
- * calling it that would pin the rebuild REQUEST itself to that node — the
17009
- * rebuild orchestration lives on the hub, and only the per-track step runs
17010
- * remotely. This field is data; the per-track pin is applied inside.
17011
- *
17012
- * Absent ⇒ round-robin over every online node whose runner can serve the
17013
- * pinned model.
17014
- */
17015
- executeOnNodeId: string().optional(),
17016
- /**
17017
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17018
- * run flat out.
17019
- *
17020
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17021
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17022
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17023
- * force is logged at start and finish so a deliberately slow pass reads
17024
- * differently from a stalled one.
17025
- */
17026
- pacingMs: number().int().nonnegative().optional()
17027
- });
16829
+ var TrackSourceSchema = _enum([
16830
+ "pipeline",
16831
+ "sensor",
16832
+ "audio"
16833
+ ]);
17028
16834
  /**
17029
- * Result of emptying the CLIP index.
16835
+ * Where a track sits in the RETRAIN lifecycle (D81).
17030
16836
  *
17031
- * The clean slate before a policy change: a new crop margin or encoder model
17032
- * leaves two feature spaces in one index whose cosine scores are not
17033
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17034
- * means the same thing.
16837
+ * - `none` never marked, or un-marked. Evictable.
16838
+ * - `staging` the operator wants this track as training material and has not
16839
+ * finished with it. **This is the only state retention holds**: the track and
16840
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
16841
+ * the device's age window.
16842
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
16843
+ * were COPIED into the retrain dataset at selection time, so the dataset no
16844
+ * longer depends on the track's media and the track becomes EVICTABLE again.
16845
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16846
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
16847
+ *
16848
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16849
+ * the store's filter language has only positive equality and `whereIn` — no
16850
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16851
+ * would make the entire pre-column history immortal in one deploy.
17035
16852
  */
17036
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
16853
+ var RetrainStatusSchema = _enum([
16854
+ "none",
16855
+ "staging",
16856
+ "trained"
16857
+ ]);
17037
16858
  /**
17038
- * Acknowledgement that a rebuild STARTED.
16859
+ * Per-track OPERATOR flags set by hand from the admin UI or the viewer, never
16860
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16861
+ * so the two surfaces cannot drift.
17039
16862
  *
17040
- * The pass costs ~1s per track 45 minutes for a 2,600-track fleet so it
17041
- * runs detached and this returns immediately. Waiting for it made the client
17042
- * time out while the work carried on server-side, which is the worst of both:
17043
- * no result and no way to know it was still going. Poll
17044
- * `getObjectEmbeddingRebuildStatus` for progress.
16863
+ * **Absent false.** A track that has never been touched omits the field; an
16864
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
16865
+ * columns existed read as absent, and a consumer that needs a boolean should say
16866
+ * `flag === true`, not `flag !== false`.
16867
+ *
16868
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16869
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16870
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16871
+ * `trained` track reports `false` while refusing both writes. The boolean is
16872
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
16873
+ * "never marked" from "already trained" must read `retrainStatus`.
16874
+ *
16875
+ * `debug` does NOT pin; it is attention, not durability.
16876
+ *
16877
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16878
+ * A favourited track is skipped by retention the same way `staging` is, but
16879
+ * it does not enter `none|staging|trained` and has no staging budget.
17045
16880
  */
17046
- var RebuildObjectEmbeddingsResultSchema = object({
17047
- started: boolean(),
17048
- /** True when a pass was already running; the new request is ignored. */
17049
- alreadyRunning: boolean()
17050
- });
17051
- var RebuildStatusSchema = object({
17052
- running: boolean(),
17053
- scanned: number(),
17054
- rebuilt: number(),
17055
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17056
- missingKeyFrame: number(),
17057
- /** Tracks with no usable detection box. */
17058
- missingBbox: number(),
17059
- /**
17060
- * Tracks an executing node REFUSED rather than broke on an unreadable key
17061
- * frame, a step that threw. Separate from `failed` because the remedy is
17062
- * different, and because a whole camera silently contributing zero vectors
17063
- * is the shape of failure a rebuild must never hide.
17064
- */
17065
- notRunnable: number(),
16881
+ var TrackFlagFields = {
16882
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
16883
+ * `'staging'`. */
16884
+ markForTrain: boolean().optional(),
16885
+ /** Operator marked this track for diagnostic attention. */
16886
+ debug: boolean().optional(),
16887
+ /** Operator favourited this track. Pins it against pruning. */
16888
+ favourited: boolean().optional()
16889
+ };
16890
+ /**
16891
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16892
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16893
+ * write patch, and the status is not something the toggle sets — it is what the
16894
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16895
+ * always present on a persisted row (the column default materialises `'none'`).
16896
+ */
16897
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16898
+ /**
16899
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16900
+ * one flag can never clear the other — the toggles are independent and are
16901
+ * driven from three surfaces that do not know about each other.
16902
+ */
16903
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
16904
+ /**
16905
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
16906
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
16907
+ * mutation result without a re-fetch.
16908
+ */
16909
+ var TrackFlagsSchema = object({
16910
+ trackId: string(),
16911
+ markForTrain: boolean(),
16912
+ debug: boolean(),
16913
+ favourited: boolean(),
16914
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
16915
+ * a track row) because this shape is only ever produced by the write body,
16916
+ * which always knows it — and a surface that has just written needs to render
16917
+ * `trained` without a re-fetch. */
16918
+ retrainStatus: RetrainStatusSchema
16919
+ });
16920
+ union([literal(1), literal(2)]);
16921
+ /**
16922
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
16923
+ * the step and model that produced it — which is what makes the write rule
16924
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16925
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16926
+ *
16927
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16928
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16929
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
16930
+ * that value has no provenance, and the write rule lets ANY properly-attributed
16931
+ * write of the same tier replace it regardless of score.
16932
+ */
16933
+ var LabelAttributionSchema = object({
16934
+ stepId: string(),
16935
+ modelId: string().optional(),
16936
+ decidedAt: number(),
17066
16937
  /**
17067
- * The pass stopped because NO node could serve the pinned model.
16938
+ * The GALLERY id behind a recognised tier-2 label a face-gallery
16939
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17068
16940
  *
17069
- * Distinct from `notRunnable` on purpose: that one says "this track was
17070
- * refused", this one says "the cluster cannot do this work at all" — every
17071
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17072
- * pinned model for its engine format, or dropped out. The remedy is a model /
17073
- * engine change, not a per-camera one. Non-zero here always comes with
17074
- * `complete: false`.
16941
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
16942
+ * notification rule authored on "Gianluca" stopped matching the moment the
16943
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
16944
+ * the thing that does not move, so it is what a rule matches on
16945
+ * (`NcConditions.identities`) and the text is what a human is shown.
16946
+ *
16947
+ * Absent when the label names no gallery row — a plate the OCR read but no
16948
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17075
16949
  */
17076
- noCapableNode: number(),
17077
- failed: number(),
17078
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17079
- complete: boolean().nullable(),
17080
- startedAtMs: number().nullable(),
17081
- finishedAtMs: number().nullable(),
17082
- /** Present when the pass ended by throwing. */
17083
- error: string().nullable()
16950
+ identityId: string().optional()
17084
16951
  });
17085
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17086
- deviceId: number(),
17087
- trackId: string()
17088
- }), TrackSchema.nullable()), method(object({
17089
- deviceId: number(),
17090
- since: number().optional(),
17091
- until: number().optional(),
17092
- limit: number().optional(),
17093
- /** Spatial filter — only tracks whose trajectory intersects the zone
17094
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17095
- * envelope columns, then precisely tested per position. Tracks with
17096
- * an unknown envelope (no frame dims at persist time) always match. */
17097
- zone: TrackZoneFilterSchema.optional(),
17098
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17099
- * compatible omitting the field keeps today's exact behaviour). */
17100
- projection: TrackProjectionSchema.optional(),
17101
- /** Include stationary-promoted rows (parked objects handed to the
17102
- * stationary registry). Default false: the timeline lists passages,
17103
- * not parking records (operator decision, 2026-08-15). */
17104
- includeStationary: boolean().optional()
17105
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17106
- deviceId: number(),
17107
- groupId: string().min(1)
17108
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17109
- kind: "mutation",
17110
- auth: "admin"
17111
- }), 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({
17112
- deviceId: number(),
17113
- since: number().optional(),
17114
- until: number().optional(),
17115
- kinds: array(string()).optional(),
17116
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17117
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17118
- deviceId: number(),
17119
- since: number(),
17120
- until: number(),
17121
- bucketMs: number().int().positive()
17122
- }), array(object({
17123
- bucketStart: number(),
17124
- motion: number().int(),
17125
- object: number().int(),
17126
- audio: number().int()
17127
- })).readonly()), method(object({
17128
- deviceId: number(),
17129
- cutoffMs: number()
17130
- }), object({
17131
- motion: number().int(),
17132
- object: number().int(),
17133
- audio: number().int()
17134
- }), {
17135
- kind: "mutation",
17136
- auth: "admin"
17137
- }), method(object({
17138
- deviceId: number(),
17139
- cutoffMs: number()
17140
- }), TrackCascadeCountsSchema, {
17141
- kind: "mutation",
17142
- auth: "admin"
17143
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17144
- kind: "mutation",
17145
- auth: "admin"
17146
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17147
- kind: "mutation",
17148
- auth: "admin"
17149
- }), method(object({
17150
- deviceId: number(),
17151
- trackIds: array(string()).min(1)
17152
- }), object({
17153
- deleted: number().int(),
17154
- failed: array(string()).readonly()
17155
- }), {
17156
- kind: "mutation",
17157
- auth: "admin"
17158
- }), method(object({
17159
- /** Log/audit scope only — the trackId is globally unique on its own. */
16952
+ /**
16953
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16954
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16955
+ * track and its events always answer the same question the same way.
16956
+ *
16957
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
16958
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16959
+ * is tier 2, and each carries its own score + attribution.
16960
+ *
16961
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16962
+ * finest thing known. Before 4g the single `label` column held the finest
16963
+ * value, so a consumer that has not been updated reads the tier-1 slot and
16964
+ * shows nothing on a species-only row; that is why the migration puts every
16965
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16966
+ * and why the read surfaces were changed in the same train.
16967
+ *
16968
+ * **Writing it.** The slots are independent, which is the whole point: a
16969
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16970
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
16971
+ * higher score wins. One rule, one implementation — see
16972
+ * `pipeline/label-tier.ts` in addon-post-analysis.
16973
+ */
16974
+ var TieredLabelFields = {
16975
+ /** Tier 1 the sub-class. See {@link LabelTierSchema}. */
16976
+ label: string().optional(),
16977
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
16978
+ labelScore: number().optional(),
16979
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16980
+ labelMeta: LabelAttributionSchema.optional(),
16981
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16982
+ subLabel: string().optional(),
16983
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
16984
+ subLabelScore: number().optional(),
16985
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16986
+ subLabelMeta: LabelAttributionSchema.optional()
16987
+ };
16988
+ /** Per-camera slice of a training-export estimate. */
16989
+ var TrainingExportDeviceTotalsSchema = object({
17160
16990
  deviceId: number(),
16991
+ tracks: number().int(),
16992
+ files: number().int(),
16993
+ bytes: number().int()
16994
+ });
16995
+ /**
16996
+ * What a training export WOULD contain. Computed from media index rows only —
16997
+ * no blob is read to produce this.
16998
+ */
16999
+ var TrainingExportSummarySchema = object({
17000
+ generatedAt: number(),
17001
+ trackCount: number().int(),
17002
+ fileCount: number().int(),
17003
+ byteCount: number().int(),
17004
+ /** More marked tracks exist than a single pass carries. */
17005
+ truncated: boolean(),
17006
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17007
+ });
17008
+ var TrackSchema = object({
17161
17009
  trackId: string(),
17162
- flags: TrackFlagsPatchSchema
17163
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17164
- kind: "query",
17165
- auth: "admin"
17166
- }), method(object({
17167
- olderThanMs: number(),
17168
- reason: OpsLogReasonSchema.optional()
17169
- }), EventPruneCountsSchema, {
17170
- kind: "mutation",
17171
- auth: "admin"
17172
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17173
- kind: "mutation",
17174
- auth: "admin"
17175
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17176
- kind: "mutation",
17177
- auth: "admin"
17178
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17179
- kind: "mutation",
17180
- auth: "admin"
17181
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17182
- kind: "mutation",
17183
- auth: "admin"
17184
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17185
- kind: "mutation",
17186
- auth: "admin"
17187
- }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17188
- kind: "mutation",
17189
- auth: "admin"
17190
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17191
- kind: "query",
17192
- auth: "admin"
17193
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17194
- kind: "query",
17195
- auth: "admin"
17196
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17197
- kind: "query",
17198
- auth: "admin"
17199
- }), method(object({
17200
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17201
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17202
- * route it at one camera's owner, and "every camera" would stop being
17203
- * expressible at all. */
17204
- deviceIds: array(number()).optional(),
17205
- limit: number().int().min(1).max(500).optional()
17206
- }), array(RetrainTrackSchema).readonly(), {
17207
- kind: "query",
17208
- auth: "admin"
17209
- }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17210
- kind: "query",
17211
- auth: "admin"
17212
- }), method(object({
17213
17010
  deviceId: number(),
17214
- trackId: string(),
17215
- mediaKeys: array(string()).min(1)
17216
- }), RetrainFrameSelectionSchema, {
17217
- kind: "mutation",
17218
- auth: "admin"
17219
- }), method(object({
17011
+ className: string(),
17012
+ ...TieredLabelFields,
17013
+ producingDeviceName: string().optional(),
17014
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17015
+ source: TrackSourceSchema.optional(),
17016
+ firstSeen: number(),
17017
+ lastSeen: number(),
17018
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17019
+ positions: array(TrackPositionSchema).readonly(),
17020
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17021
+ * saveThumbnails policy). */
17022
+ snapshots: array(TrackSnapshotSchema).readonly(),
17023
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17024
+ zonesVisited: array(string()).readonly(),
17025
+ /**
17026
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17027
+ * `zones` capability.
17028
+ *
17029
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17030
+ * and no card can render — so every free-text search surface was structurally
17031
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17032
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17033
+ * derivation and costs the clients no extra call (the `zones` cap is
17034
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17035
+ * surface built to avoid exactly that).
17036
+ *
17037
+ * Resolved, never invented: a zone deleted since the track was written has no
17038
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17039
+ * two are not positionally aligned. Absent when the track visited no zone, or
17040
+ * when the zone catalogue could not be read.
17041
+ */
17042
+ zoneNames: array(string()).readonly().optional(),
17043
+ /** Deduplicated set of detector classes observed for this track over its
17044
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17045
+ * legacy rows written before class accumulation shipped. */
17046
+ classes: array(string()).readonly().optional(),
17047
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17048
+ totalDistance: number(),
17049
+ state: TrackStateSchema,
17050
+ active: boolean(),
17051
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17052
+ * track expiry, recomputed on late label). Absent on legacy rows written
17053
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17054
+ importance: number().optional(),
17055
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17056
+ * "best" frame). Absent when the track produced no object events. */
17057
+ bestEventId: string().optional(),
17058
+ /** Tag of the importance sub-signal that dominated the score
17059
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17060
+ importanceReason: string().optional(),
17061
+ /** Audio-classification labels heard on the camera during the track's
17062
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17063
+ * Absent on legacy rows / tracks with no confident audio. */
17064
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17065
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17066
+ * Populated from the persisted envelope columns on historical reads;
17067
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17068
+ envelope: TrackEnvelopeSchema.optional(),
17069
+ /**
17070
+ * A face DETECTOR found a face on this track — nothing more. It says the
17071
+ * detail plane produced a `face` detail; it does NOT say the face was
17072
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17073
+ * enabled. Set once and never cleared.
17074
+ *
17075
+ * **This exists so "face present but not recognised" is expressible.** A
17076
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17077
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17078
+ * and a track with no face at all were byte-identical on the wire and no
17079
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17080
+ * === undefined`.
17081
+ *
17082
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17083
+ * and so does every server that predates the field — a consumer must test
17084
+ * `=== true` and render nothing otherwise, never infer "no face".
17085
+ */
17086
+ hasFace: boolean().optional(),
17087
+ /**
17088
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17089
+ * face an operator could ASSIGN to an identity.
17090
+ *
17091
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17092
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17093
+ * branch, before every gate, and means no more than "a face detector produced
17094
+ * a face detail". This one is stamped at the single moment the gallery row
17095
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17096
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17097
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17098
+ * the crop-store drop. Everything between the detector and that insert can
17099
+ * legitimately refuse the face, so a flag written any earlier promises the
17100
+ * operator something to assign and delivers nothing.
17101
+ *
17102
+ * **Independent of recognition.** A face collected but never auto-matched is
17103
+ * still assignable — it is in fact the face an operator most wants to reach —
17104
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17105
+ * `subLabel`; this says only that the raw material exists.
17106
+ *
17107
+ * **Set once, never cleared.** A track that produced a gallery row produced
17108
+ * one; deleting the row later is the gallery's business, not this flag's.
17109
+ *
17110
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17111
+ * before the column omits it, and so does every server that predates the
17112
+ * field. A consumer must test `=== true` and render nothing otherwise —
17113
+ * never infer "no assignable face".
17114
+ */
17115
+ hasEmbeddedFace: boolean().optional(),
17116
+ /**
17117
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17118
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17119
+ * so the passage is tracked once and as a VEHICLE.
17120
+ *
17121
+ * It exists because the fold's record was dishonest. D34 and the code both
17122
+ * said "the person is not lost — it is reported so both entities stay on the
17123
+ * record"; in fact the pair went into a per-processor RAM field behind an
17124
+ * accessor nobody called, and every durable surface said `vehicle`, full
17125
+ * stop. This is the composition note that makes the row true.
17126
+ *
17127
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17128
+ * person" is not an answer to "what is this" — both label tiers would refuse
17129
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17130
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17131
+ * and a `person` rule still does not fire for someone cycling past.
17132
+ *
17133
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17134
+ * the column, and every hub that predates the field, omits it. Test
17135
+ * `=== true` and render nothing otherwise — never infer "no rider".
17136
+ */
17137
+ hasRider: boolean().optional(),
17138
+ ...TrackFlagFields,
17139
+ ...TrackRetrainFields
17140
+ });
17141
+ var BaseEventFields = {
17142
+ id: string(),
17220
17143
  deviceId: number(),
17221
- trackId: string(),
17222
- frameId: string()
17223
- }), object({
17224
- removed: boolean(),
17225
- removedAnnotations: number().int()
17226
- }), {
17227
- kind: "mutation",
17228
- auth: "admin"
17229
- }), method(object({ frameId: string() }), object({
17144
+ timestamp: number()
17145
+ };
17146
+ var MotionEventSchema = object({
17147
+ ...BaseEventFields,
17148
+ kind: literal("motion"),
17149
+ regionCount: number(),
17150
+ /** Heavy JSON array — omitted in slim projection. */
17151
+ regions: array(object({
17152
+ bbox: BoundingBoxSchema,
17153
+ pixelCount: number(),
17154
+ intensity: number()
17155
+ })).readonly().optional(),
17156
+ /** Omitted in slim projection. */
17157
+ frameWidth: number().optional(),
17158
+ /** Omitted in slim projection. */
17159
+ frameHeight: number().optional(),
17160
+ /** Populated by B5 (recording playback URL for this event). */
17161
+ mediaUrl: string().optional()
17162
+ });
17163
+ /**
17164
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17165
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17166
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17167
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17168
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17169
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17170
+ */
17171
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17172
+ /**
17173
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17174
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17175
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17176
+ * appearance event carry none, so a rule asking for a direction fails closed
17177
+ * on them.
17178
+ *
17179
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17180
+ * into its own event, so a frame in which a track enters A while leaving B
17181
+ * produces two events with two directions — never one ambiguous row.
17182
+ *
17183
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17184
+ * membership the box has NOW, and by definition it no longer contains the zone
17185
+ * that was just left. Without the id here, a zone-scoped rule could never match
17186
+ * the exit it asked for.
17187
+ */
17188
+ var ZoneCrossingSchema = object({
17189
+ direction: _enum(["enter", "exit"]),
17190
+ /** Admin zone id crossed. */
17191
+ zoneId: string(),
17192
+ /** Zone display name at crossing time (falls back to the id). */
17193
+ zoneName: string().optional()
17194
+ });
17195
+ var ObjectEventSchema = object({
17196
+ ...BaseEventFields,
17197
+ kind: literal("object"),
17198
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17199
+ source: DetectionSourceSchema.optional(),
17200
+ /**
17201
+ * Inference-frame id shared by every object event emitted from the SAME frame
17202
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17203
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17204
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17205
+ * Optional for backward-compat with pre-existing rows / the slim projection
17206
+ * includes it (it is light). Absent on rows written before this field.
17207
+ */
17208
+ frameId: string().optional(),
17209
+ /** Omitted in slim projection. */
17210
+ trackId: string().optional(),
17211
+ className: string(),
17212
+ ...TieredLabelFields,
17213
+ /** Omitted in slim projection. */
17214
+ confidence: number().optional(),
17215
+ /** Heavy JSON — omitted in slim projection. */
17216
+ bbox: BoundingBoxSchema.optional(),
17217
+ /** Heavy JSON — omitted in slim projection. */
17218
+ zones: array(string()).readonly().optional(),
17219
+ /** Omitted in slim projection. */
17220
+ state: TrackStateSchema.optional(),
17221
+ /**
17222
+ * The zone crossing this event IS, when it is one. Absent on every other
17223
+ * event kind (movement state, appearance, package) — see
17224
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17225
+ */
17226
+ zoneCrossing: ZoneCrossingSchema.optional(),
17227
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17228
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17229
+ frameWidth: number().optional(),
17230
+ frameHeight: number().optional(),
17231
+ /** MediaStore key for the crop attached to this event (if any). */
17232
+ mediaKey: string().optional(),
17233
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17234
+ * best-detection full frame). Resolve via the event-media data-plane
17235
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17236
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17237
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17238
+ keyFrameMediaKey: string().optional(),
17239
+ /** Populated by B5 (recording playback URL for this event). */
17240
+ mediaUrl: string().optional(),
17241
+ /** The parent track's key-event importance [0,1], propagated to every object
17242
+ * event of the track (so an event row can be sorted by importance without a
17243
+ * track join). Absent on legacy rows / before the track was scored. */
17244
+ importance: number().optional()
17245
+ });
17246
+ var AudioEventSchema = object({
17247
+ ...BaseEventFields,
17248
+ kind: literal("audio"),
17249
+ rms: number(),
17250
+ dbfs: number(),
17251
+ classification: object({
17252
+ className: string(),
17253
+ originalClass: string().optional(),
17254
+ score: number()
17255
+ }).optional(),
17256
+ /** Populated by B5 (recording playback URL for this event). */
17257
+ mediaUrl: string().optional()
17258
+ });
17259
+ var MediaFileKindEnum = _enum([
17260
+ "crop",
17261
+ "thumbnail",
17262
+ "snapshot",
17263
+ "firstFrame",
17264
+ "lastFrame",
17265
+ "fullFrame",
17266
+ "fullFrameBoxed",
17267
+ "faceCrop",
17268
+ "plateCrop",
17269
+ "keyFrame",
17270
+ "keyFrameSmall",
17271
+ "thumbnailSmall"
17272
+ ]);
17273
+ var MediaFileSchema = object({
17274
+ key: string(),
17275
+ kind: MediaFileKindEnum,
17230
17276
  base64: string(),
17231
- width: number().int(),
17232
- height: number().int()
17233
- }), {
17234
- kind: "query",
17235
- auth: "admin"
17236
- }), method(object({
17237
- deviceId: number(),
17238
- trackId: string(),
17239
- frameId: string(),
17240
- subject: RetrainAssistSubjectSchema,
17241
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17242
- nodeId: string().optional()
17243
- }), RetrainAssistResultSchema, {
17244
- kind: "mutation",
17245
- auth: "admin"
17246
- }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17247
- kind: "query",
17248
- auth: "admin"
17249
- }), method(object({
17250
- deviceId: number(),
17251
- trackId: string(),
17252
- frameId: string(),
17253
- annotations: array(RetrainAnnotationDraftSchema)
17254
- }), array(RetrainAnnotationSchema).readonly(), {
17255
- kind: "mutation",
17256
- auth: "admin"
17257
- }), method(object({
17258
- deviceId: number(),
17259
- trackId: string()
17260
- }), RetrainTransitionResultSchema, {
17261
- kind: "mutation",
17262
- auth: "admin"
17263
- }), method(object({
17264
- deviceId: number(),
17265
- trackId: string()
17266
- }), RetrainTransitionResultSchema, {
17267
- kind: "mutation",
17268
- auth: "admin"
17269
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17270
- kind: "query",
17271
- auth: "admin"
17272
- }), method(object({
17273
- eventId: string(),
17274
- kind: MediaFileKindEnum.optional(),
17275
- deviceId: number()
17276
- }), array(MediaFileSchema).readonly()), method(object({
17277
- trackId: string(),
17278
- kinds: array(MediaFileKindEnum).optional(),
17279
- deviceId: number()
17280
- }), array(MediaFileSchema).readonly()), method(object({
17277
+ sizeBytes: number(),
17278
+ timestamp: number()
17279
+ });
17280
+ /**
17281
+ * One media row WITHOUT its bytes.
17282
+ *
17283
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17284
+ * 140 s track), and a client that renders tiles from the media data plane needs
17285
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17286
+ * with an immutable cache, instead of all at once inside a tRPC response that
17287
+ * blocks the whole view.
17288
+ *
17289
+ * `sizeBytes` is carried because it is what lets a client decide between the
17290
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17291
+ */
17292
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17293
+ /**
17294
+ * The MACRO tier of an annotation — a CLOSED set.
17295
+ *
17296
+ * This is what the exported detector predicts, so a typo here is a new class
17297
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17298
+ * the whole point of the page is teaching the model things it does not know
17299
+ * yet, and constraining that vocabulary would make it useless.
17300
+ *
17301
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17302
+ * `subLabel` is one of these values, in any casing, because once `person`
17303
+ * exists in both tiers "every person box" stops being answerable without
17304
+ * knowing every string anyone ever typed — and the damage is retroactive.
17305
+ */
17306
+ var RetrainMacroClassSchema = _enum([
17307
+ "person",
17308
+ "vehicle",
17309
+ "animal",
17310
+ "package",
17311
+ "face",
17312
+ "plate"
17313
+ ]);
17314
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17315
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17316
+ /** Did a human draw this box, or did the assist propose it? */
17317
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17318
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17319
+ var RetrainBboxSchema = object({
17320
+ x: number(),
17321
+ y: number(),
17322
+ w: number(),
17323
+ h: number()
17324
+ });
17325
+ /**
17326
+ * One annotated subject.
17327
+ *
17328
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17329
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17330
+ * derived from it at export and never stored — storing them is how one feature
17331
+ * space ends up holding two crops of the same subject (D52).
17332
+ */
17333
+ var RetrainAnnotationSchema = object({
17334
+ id: string(),
17281
17335
  trackId: string(),
17282
- deviceId: number()
17283
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17284
- kind: "mutation",
17285
- auth: "admin"
17286
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17287
- kind: "mutation",
17288
- auth: "admin"
17289
- }), method(object({}), RebuildStatusSchema), object({
17290
- deviceId: number(),
17291
- timestamp: number(),
17292
- frameWidth: number(),
17293
- frameHeight: number(),
17294
- detections: array(OverlayDetectionSchema).readonly()
17295
- }), object({
17296
17336
  deviceId: number(),
17337
+ /** The COPY in retrain storage — never the source track's media key. */
17338
+ mediaKey: string(),
17339
+ bbox: RetrainBboxSchema,
17340
+ macroClass: RetrainMacroClassSchema,
17341
+ label: string().optional(),
17342
+ subLabel: string().optional(),
17343
+ kind: RetrainAnnotationKindSchema,
17344
+ source: RetrainAnnotationSourceSchema,
17345
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17346
+ assistModelId: string().optional(),
17347
+ assistScore: number().optional(),
17348
+ exportedInBatch: string().optional(),
17349
+ createdAt: number()
17350
+ });
17351
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17352
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17353
+ id: true,
17354
+ trackId: true,
17355
+ deviceId: true,
17356
+ mediaKey: true,
17357
+ createdAt: true,
17358
+ exportedInBatch: true
17359
+ });
17360
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17361
+ var RetrainTrackSchema = object({
17297
17362
  trackId: string(),
17298
- className: string()
17299
- }), object({
17300
17363
  deviceId: number(),
17301
- trackId: string(),
17302
17364
  className: string(),
17303
- durationMs: number()
17304
- }), object({
17365
+ label: string().optional(),
17366
+ firstSeen: number(),
17367
+ lastSeen: number(),
17368
+ /** How many frames the dataset already holds from this track. */
17369
+ frameCount: number().int(),
17370
+ /** How many subjects have been annotated on those frames. `0` with
17371
+ * `frameCount: 0` is exactly "staging, still to work". */
17372
+ annotationCount: number().int()
17373
+ });
17374
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17375
+ var RetrainFrameCandidateSchema = object({
17376
+ mediaKey: string(),
17377
+ kind: MediaFileKindEnum,
17378
+ timestamp: number(),
17379
+ sizeBytes: number().int(),
17380
+ /** A copy of this original already exists — selecting it is free and cannot
17381
+ * fail, whatever became of the original. */
17382
+ copied: boolean()
17383
+ });
17384
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17385
+ var RetrainFrameSchema = object({
17386
+ frameId: string(),
17305
17387
  deviceId: number(),
17306
- kind: EventKindSchema,
17307
- eventId: string(),
17308
- timestamp: number()
17388
+ trackId: string(),
17389
+ /** Provenance only. It may already point at nothing — that is expected. */
17390
+ sourceMediaKey: string(),
17391
+ sourceKind: MediaFileKindEnum,
17392
+ sizeBytes: number().int(),
17393
+ width: number().int(),
17394
+ height: number().int(),
17395
+ copiedAt: number()
17396
+ });
17397
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17398
+ var RetrainCopyRefusalSchema = _enum([
17399
+ "source-missing",
17400
+ "unreadable-image",
17401
+ "write-failed"
17402
+ ]);
17403
+ var RetrainFrameSelectionSchema = object({
17404
+ copied: array(RetrainFrameSchema).readonly(),
17405
+ refused: array(object({
17406
+ sourceMediaKey: string(),
17407
+ reason: RetrainCopyRefusalSchema
17408
+ })).readonly()
17309
17409
  });
17410
+ var RetrainFrameListSchema = object({
17411
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17412
+ copies: array(RetrainFrameSchema).readonly(),
17413
+ /** What the page pre-selects — the native key frame when one survives. */
17414
+ autoPickMediaKey: string().optional()
17415
+ });
17416
+ /** What the operator asked the assist to look for. */
17417
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17418
+ kind: literal("package"),
17419
+ zone: RetrainBboxSchema.optional()
17420
+ }), object({
17421
+ kind: literal("objects"),
17422
+ modelId: string(),
17423
+ minScore: number().optional()
17424
+ })]);
17310
17425
  /**
17311
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17312
- * within the frame, so the executor can re-cut a leaf child ROI at native
17313
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17426
+ * The assist's answer a discriminated union, because "the model saw nothing"
17427
+ * and "this node cannot run that model" lead to different next moves and a
17428
+ * nullable result cannot tell them apart.
17314
17429
  */
17315
- var NativeCropRefSchema = object({
17316
- /** Handle keying the retained native surface (node-pinned to its owner). */
17317
- handle: FrameHandleSchema,
17318
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17319
- cropFrameSpace: object({
17320
- x: number(),
17321
- y: number(),
17322
- w: number(),
17323
- h: number()
17324
- })
17430
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17431
+ kind: literal("proposed"),
17432
+ modelId: string(),
17433
+ stepId: string(),
17434
+ minScore: number(),
17435
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17436
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17437
+ /** Returned by the runner but removed by the threshold. */
17438
+ belowThreshold: number().int()
17439
+ }), object({
17440
+ kind: literal("refused"),
17441
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17442
+ reason: string(),
17443
+ detail: string().optional()
17444
+ })]);
17445
+ /** The outcome of a lifecycle move owned by the retrain page. */
17446
+ var RetrainTransitionResultSchema = object({
17447
+ trackId: string(),
17448
+ /** Where the track ended up, whatever happened. */
17449
+ retrainStatus: RetrainStatusSchema,
17450
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17451
+ changed: boolean(),
17452
+ reason: _enum([
17453
+ "unknown-track",
17454
+ "no-frames-copied",
17455
+ "not-staging",
17456
+ "not-trained",
17457
+ "unchanged"
17458
+ ]).optional()
17325
17459
  });
17326
- object({
17327
- crop: object({
17328
- left: number(),
17329
- top: number(),
17330
- width: number().positive(),
17331
- height: number().positive()
17332
- }).optional(),
17333
- content: object({
17334
- width: number().int().positive(),
17335
- height: number().int().positive()
17336
- }),
17337
- fit: _enum(["stretch", "contain"]),
17338
- format: _enum([
17339
- "rgb",
17340
- "gray",
17341
- "jpeg"
17342
- ])
17460
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17461
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17462
+ var DeviceEventQueryInput = object({
17463
+ deviceId: number(),
17464
+ since: number().optional(),
17465
+ until: number().optional(),
17466
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17467
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17468
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17469
+ * exact behaviour. Callers may omit this field — the store defaults to
17470
+ * `full` when not provided. */
17471
+ projection: _enum(["full", "slim"]).optional()
17343
17472
  });
17344
- var FrameRefSchema = object({
17345
- registryId: string().min(1),
17346
- id: string().min(1),
17347
- width: number().int().positive(),
17348
- height: number().int().positive(),
17349
- format: _enum(["rgb", "gray"]),
17350
- timestamp: number(),
17351
- capturedAt: number().optional()
17473
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
17474
+ var RecentTracksQueryInput = object({
17475
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17476
+ deviceIds: array(number()),
17477
+ /** Window lower bound on `lastSeen` (inclusive). */
17478
+ since: number().optional(),
17479
+ /** Window upper bound on `lastSeen` (inclusive). */
17480
+ until: number().optional(),
17481
+ /** Page size. Default 200, max 1000. */
17482
+ limit: number().int().min(1).max(1e3).default(200),
17483
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17484
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17485
+ cursor: string().optional(),
17486
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17487
+ projection: TrackProjectionSchema.optional(),
17488
+ /** Include stationary-promoted rows (parked objects). Default false: the
17489
+ * feed lists passages; parking records live on the stationary registry. */
17490
+ includeStationary: boolean().optional()
17352
17491
  });
17353
- var ModelFormatSchema$1 = _enum([
17354
- "onnx",
17355
- "coreml",
17356
- "openvino",
17357
- "tflite",
17358
- "pt",
17359
- "gguf"
17360
- ]);
17361
- var PipelineSlotSchema = _enum([
17362
- "detector",
17363
- "cropper",
17364
- "classifier",
17365
- "refiner",
17366
- "audio-classifier"
17367
- ]);
17368
- var PipelineEngineChoiceSchema = object({
17369
- runtime: _enum(["node", "python"]),
17370
- backend: string(),
17371
- format: ModelFormatSchema$1,
17372
- device: string().optional()
17492
+ var RecentTracksPageSchema = object({
17493
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17494
+ tracks: array(TrackSchema).readonly(),
17495
+ /** Cursor for the next page, or null when this page is the last. */
17496
+ nextCursor: string().nullable()
17497
+ });
17498
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17499
+ var LIST_GROUPS_MAX_LIMIT = 100;
17500
+ var AnalyticsGroupRecordSchema = object({
17501
+ id: string(),
17502
+ deviceId: number().int(),
17503
+ openedAt: number().int(),
17504
+ closedAt: number().int(),
17505
+ timestamp: number().int(),
17506
+ memberCount: number().int(),
17507
+ memberTrackIds: array(string()).readonly(),
17508
+ className: string(),
17509
+ classes: array(string()).readonly(),
17510
+ /** Relative event-media path, or null when the group has no picture yet. */
17511
+ mediaUrl: string().nullable(),
17512
+ singleton: boolean()
17373
17513
  });
17374
- var AvailableEngineSchema = object({
17375
- engine: PipelineEngineChoiceSchema,
17376
- devices: array(object({
17377
- id: string(),
17378
- label: string(),
17379
- description: string().optional()
17380
- })).readonly(),
17381
- defaultDevice: string()
17514
+ var AnalyticsGroupMemberSchema = object({
17515
+ trackId: string(),
17516
+ deviceId: number().int(),
17517
+ className: string(),
17518
+ firstSeen: number().int(),
17519
+ lastSeen: number().int(),
17520
+ mediaUrl: string().nullable()
17382
17521
  });
17383
- var PipelineDefaultStepSchema = lazy(() => object({
17384
- addonId: string(),
17385
- addonName: string(),
17386
- slot: PipelineSlotSchema,
17387
- inputClasses: array(string()).readonly(),
17388
- outputClasses: array(string()).readonly(),
17389
- enabled: boolean(),
17390
- modelId: string(),
17391
- children: array(PipelineDefaultStepSchema).readonly(),
17392
- group: string().optional(),
17393
- settings: record(string(), unknown()).optional()
17394
- }));
17395
- var PipelineTemplateStepSchema = lazy(() => object({
17396
- addonId: string(),
17397
- enabled: boolean(),
17398
- modelId: string(),
17399
- children: array(PipelineTemplateStepSchema).readonly(),
17400
- settings: record(string(), unknown()).optional()
17401
- }));
17402
- var PipelineTemplateSchema$1 = object({
17403
- id: string(),
17404
- name: string(),
17405
- createdAt: string(),
17406
- updatedAt: string(),
17407
- engine: PipelineEngineChoiceSchema,
17408
- steps: array(PipelineTemplateStepSchema).readonly()
17522
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17523
+ var ListGroupsQueryInput = object({
17524
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17525
+ deviceIds: array(number()),
17526
+ /** Window lower bound on `closedAt` (inclusive). */
17527
+ since: number().optional(),
17528
+ /** Window upper bound on `openedAt` (inclusive). */
17529
+ until: number().optional(),
17530
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17531
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17532
+ cursor: string().optional()
17409
17533
  });
17410
- var PipelineModelOptionSchema = object({
17411
- id: string(),
17412
- name: string(),
17413
- formats: record(string(), object({
17414
- downloaded: boolean(),
17415
- sizeMB: number()
17416
- })),
17417
- group: ModelVariantGroupSchema.optional(),
17418
- legacy: boolean().optional(),
17419
- provider: ModelProviderIdSchema.optional()
17534
+ var ListGroupsPageSchema = object({
17535
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17536
+ nextCursor: string().nullable()
17420
17537
  });
17421
- var ConfigFieldBridge = custom();
17422
- var PipelineAddonSchemaSchema = object({
17423
- id: string(),
17424
- name: string(),
17425
- slot: PipelineSlotSchema,
17426
- inputClasses: array(string()).readonly(),
17427
- outputClasses: array(string()).readonly(),
17428
- childSlots: array(PipelineSlotSchema).readonly(),
17429
- models: array(PipelineModelOptionSchema).readonly(),
17430
- defaultModelId: string(),
17431
- defaultModelIdByFormat: record(string(), string()).optional(),
17432
- enabledByDefault: boolean().optional(),
17433
- backfillIntoExistingOverrides: boolean().optional(),
17434
- defaultConfidence: number(),
17435
- group: string().optional(),
17436
- configSchema: array(ConfigFieldBridge).readonly().optional()
17538
+ var KeyEventQueryInput = object({
17539
+ deviceId: number(),
17540
+ /** Window lower bound (track firstSeen ≥ since). */
17541
+ since: number(),
17542
+ /** Window upper bound (track firstSeen ≤ until). */
17543
+ until: number(),
17544
+ limit: number().int().min(1).max(200).default(50),
17545
+ /** Drop tracks scoring below this importance. */
17546
+ minImportance: number().min(0).max(1).optional(),
17547
+ /** Restrict to a single class (e.g. 'person'). */
17548
+ classFilter: string().optional()
17437
17549
  });
17438
- var PipelineSlotSchemaSchema = object({
17439
- id: PipelineSlotSchema,
17440
- label: string(),
17441
- priority: number(),
17442
- parentSlot: PipelineSlotSchema.nullable(),
17443
- addons: array(PipelineAddonSchemaSchema).readonly()
17550
+ var KeyEventSchema = object({
17551
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17552
+ id: string(),
17553
+ trackId: string(),
17554
+ /** Track start time (firstSeen). */
17555
+ timestamp: number(),
17556
+ className: string(),
17557
+ ...TieredLabelFields,
17558
+ importance: number(),
17559
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17560
+ bestEventId: string(),
17561
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17562
+ windowMs: number().optional(),
17563
+ ...TrackFlagFields,
17564
+ ...TrackRetrainFields
17444
17565
  });
17445
- var PipelineSchemaSchema = object({
17446
- availableEngines: array(AvailableEngineSchema).readonly(),
17447
- selectedEngine: PipelineEngineChoiceSchema,
17448
- slots: array(PipelineSlotSchemaSchema).readonly()
17566
+ object({
17567
+ trackId: string(),
17568
+ className: string(),
17569
+ confidence: number(),
17570
+ bbox: BoundingBoxSchema,
17571
+ zones: array(string()).readonly(),
17572
+ state: TrackStateSchema
17449
17573
  });
17450
- var EngineProvisioningSchema = object({
17451
- runtimeId: _enum([
17452
- "onnx",
17453
- "openvino",
17454
- "coreml",
17455
- "edgetpu"
17456
- ]).nullable(),
17457
- device: string().nullable(),
17458
- state: _enum([
17459
- "idle",
17460
- "installing",
17461
- "verifying",
17462
- "ready",
17463
- "failed"
17464
- ]),
17465
- progress: number().optional(),
17466
- error: string().optional(),
17467
- nextRetryAt: number().optional(),
17468
- /**
17469
- * Gate A (config-correctness gate at engine change): human-readable
17470
- * config issues surfaced EAGERLY when the node's engine changes — model
17471
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17472
- * has a <format> build"). Additive/optional: informational only, never
17473
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17474
- * Absent/empty when the node-default tree resolves cleanly.
17475
- */
17476
- configIssues: array(string()).optional()
17574
+ var OverlayDetectionSchema = looseObject({
17575
+ id: string(),
17576
+ kind: _enum(["first-level", "detail"]),
17577
+ macroClass: string(),
17578
+ score: number(),
17579
+ bbox: object({
17580
+ x: number(),
17581
+ y: number(),
17582
+ width: number(),
17583
+ height: number()
17584
+ }),
17585
+ labels: array(looseObject({
17586
+ label: string(),
17587
+ score: number()
17588
+ })).readonly(),
17589
+ parentId: string().optional()
17477
17590
  });
17478
- var PipelineStepInputSchema = lazy(() => object({
17479
- addonId: string(),
17480
- modelId: string().optional(),
17481
- enabled: boolean().default(true),
17482
- children: array(PipelineStepInputSchema).optional(),
17483
- settings: record(string(), unknown()).optional(),
17484
- jumpDeviceKey: string().optional()
17485
- }));
17486
- var ModelSubstitutionSchema = object({
17487
- addonId: string(),
17488
- chosen: string(),
17489
- running: string(),
17490
- format: string()
17591
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17592
+ var SearchObjectEventsInput = object({
17593
+ text: string(),
17594
+ deviceId: number().optional(),
17595
+ since: number().optional(),
17596
+ until: number().optional(),
17597
+ classFilter: string().optional(),
17598
+ limit: number().default(50),
17599
+ minScore: number().min(0).max(1).default(.2)
17491
17600
  });
17492
- var PipelineValidationIssueSchema = object({
17493
- addonId: string(),
17494
- kind: _enum(["unknown-addon", "no-format-build"]),
17495
- detail: string()
17601
+ var TrackCascadeCountsSchema = object({
17602
+ /** Persisted track roots deleted (authoritative). */
17603
+ tracks: number().int(),
17604
+ /** Object events removed with their tracks (best-effort; see note above). */
17605
+ events: number().int(),
17606
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17607
+ media: number().int(),
17608
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
17609
+ faces: number().int(),
17610
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17611
+ plates: number().int(),
17612
+ /** Per-track CLIP search vectors removed (best-effort). */
17613
+ embeddings: number().int(),
17614
+ /** Group membership + group rows removed with their last member (best-effort). */
17615
+ groups: number().int()
17496
17616
  });
17497
- var PipelineValidationResultSchema = object({
17498
- ok: boolean(),
17499
- issues: array(PipelineValidationIssueSchema).readonly(),
17500
- substitutions: array(ModelSubstitutionSchema).readonly(),
17501
- /** The node's `currentEngine.format` this validation ran against. */
17502
- format: string()
17617
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17618
+ var DiskReconcileCountsSchema = object({
17619
+ mediaDropped: number().int(),
17620
+ tracks: number().int(),
17621
+ events: number().int()
17503
17622
  });
17504
- var ReferenceImageEntrySchema = object({
17505
- filename: string(),
17506
- stepIds: array(string()).readonly().optional()
17623
+ /** Event-store footprint for one camera. */
17624
+ var EventStoreDeviceFootprintSchema = object({
17625
+ deviceId: number(),
17626
+ /** Persisted event rows (motion + object + audio) for the camera. */
17627
+ rows: number().int(),
17628
+ /** Event-owned media bytes on disk for the camera. */
17629
+ bytes: number().int()
17507
17630
  });
17508
- var ReferenceImageBodySchema = object({
17509
- base64: string(),
17510
- filename: string()
17631
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17632
+ var EventStoreFootprintSchema = object({
17633
+ totalRows: number().int(),
17634
+ totalBytes: number().int(),
17635
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
17511
17636
  });
17512
- var ReferenceAudioEntrySchema = object({
17513
- filename: string(),
17514
- sizeKb: number()
17637
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
17638
+ var EventPruneCountsSchema = object({
17639
+ motion: number().int(),
17640
+ object: number().int(),
17641
+ audio: number().int()
17515
17642
  });
17516
- var ReferenceAudioBodySchema = object({ base64: string() });
17517
- var AudioBackendSchema = object({
17518
- id: string(),
17519
- name: string(),
17520
- description: string(),
17521
- available: boolean(),
17643
+ /**
17644
+ * Re-embed stored tracks from their key frames.
17645
+ *
17646
+ * The reason this is an operator-callable method and not a migration script:
17647
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
17648
+ * squaring — is only changeable if the existing vectors can be regenerated.
17649
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
17650
+ * symptom is a quality regression with no visible cause.
17651
+ */
17652
+ var RebuildObjectEmbeddingsInput = object({
17653
+ /** Restrict to one camera. Omit for the whole fleet. */
17654
+ deviceId: number().optional(),
17655
+ since: number().optional(),
17656
+ until: number().optional(),
17657
+ /** Stop after this many tracks; the result reports whether more remain. */
17658
+ maxTracks: number().int().positive().optional(),
17522
17659
  /**
17523
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17524
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17525
- * the benchmark UI to populate the `enabledMicroClasses` filter
17526
- * specific to the selected backend without a separate fetch.
17660
+ * Run every embedding on THIS node instead of round-robining the fleet.
17661
+ *
17662
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17663
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17664
+ * calling it that would pin the rebuild REQUEST itself to that node — the
17665
+ * rebuild orchestration lives on the hub, and only the per-track step runs
17666
+ * remotely. This field is data; the per-track pin is applied inside.
17667
+ *
17668
+ * Absent ⇒ round-robin over every online node whose runner can serve the
17669
+ * pinned model.
17527
17670
  */
17528
- rawLabels: array(string()).readonly().optional()
17529
- });
17530
- var AudioCapabilitiesSchema = object({
17531
- activeBackend: string(),
17532
- availableBackends: array(AudioBackendSchema).readonly(),
17533
- sampleRate: number(),
17534
- chunkDurationMs: number()
17535
- });
17536
- var DownloadModelResultSchema = object({
17537
- filePath: string(),
17538
- sizeMB: number(),
17539
- durationMs: number()
17671
+ executeOnNodeId: string().optional(),
17672
+ /**
17673
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17674
+ * run flat out.
17675
+ *
17676
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
17677
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17678
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17679
+ * force is logged at start and finish so a deliberately slow pass reads
17680
+ * differently from a stalled one.
17681
+ */
17682
+ pacingMs: number().int().nonnegative().optional()
17540
17683
  });
17541
17684
  /**
17542
- * Wrapper carrying a single test run's result. Replaces the legacy
17543
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17544
- * canonical `AudioResult` from the Phase 6 output rework: one
17545
- * `AudioDetection` per class above `minScore`, top-N candidates in
17546
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17547
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17548
- * benchmark UI can still report a clean failure when the classifier
17549
- * cap isn't available.
17685
+ * Result of emptying the CLIP index.
17686
+ *
17687
+ * The clean slate before a policy change: a new crop margin or encoder model
17688
+ * leaves two feature spaces in one index whose cosine scores are not
17689
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
17690
+ * means the same thing.
17550
17691
  */
17551
- var AudioTestResultSchema = object({
17552
- success: boolean(),
17553
- error: string().optional(),
17554
- frame: custom().optional()
17692
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17693
+ /**
17694
+ * Acknowledgement that a rebuild STARTED.
17695
+ *
17696
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
17697
+ * runs detached and this returns immediately. Waiting for it made the client
17698
+ * time out while the work carried on server-side, which is the worst of both:
17699
+ * no result and no way to know it was still going. Poll
17700
+ * `getObjectEmbeddingRebuildStatus` for progress.
17701
+ */
17702
+ var RebuildObjectEmbeddingsResultSchema = object({
17703
+ started: boolean(),
17704
+ /** True when a pass was already running; the new request is ignored. */
17705
+ alreadyRunning: boolean()
17555
17706
  });
17556
- var PipelineConfigBridge = custom();
17557
- var ConfigUISchemaBridge = custom();
17558
- var ConfigUISchemaNullableBridge = custom();
17559
- var InferenceCapabilitiesBridge = custom();
17560
- var ModelAvailabilityListBridge = custom();
17561
- var PipelineRunResultBridge = custom();
17562
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
17563
- modelId: string(),
17564
- settings: record(string(), unknown()).readonly()
17565
- }))), method(object({ steps: record(string(), object({
17566
- modelId: string(),
17567
- settings: record(string(), unknown()).readonly()
17568
- })) }), object({ success: literal(true) }), {
17707
+ var RebuildStatusSchema = object({
17708
+ running: boolean(),
17709
+ scanned: number(),
17710
+ rebuilt: number(),
17711
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
17712
+ missingKeyFrame: number(),
17713
+ /** Tracks with no usable detection box. */
17714
+ missingBbox: number(),
17715
+ /**
17716
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
17717
+ * frame, a step that threw. Separate from `failed` because the remedy is
17718
+ * different, and because a whole camera silently contributing zero vectors
17719
+ * is the shape of failure a rebuild must never hide.
17720
+ */
17721
+ notRunnable: number(),
17722
+ /**
17723
+ * The pass stopped because NO node could serve the pinned model.
17724
+ *
17725
+ * Distinct from `notRunnable` on purpose: that one says "this track was
17726
+ * refused", this one says "the cluster cannot do this work at all" — every
17727
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
17728
+ * pinned model for its engine format, or dropped out. The remedy is a model /
17729
+ * engine change, not a per-camera one. Non-zero here always comes with
17730
+ * `complete: false`.
17731
+ */
17732
+ noCapableNode: number(),
17733
+ failed: number(),
17734
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
17735
+ complete: boolean().nullable(),
17736
+ startedAtMs: number().nullable(),
17737
+ finishedAtMs: number().nullable(),
17738
+ /** Present when the pass ended by throwing. */
17739
+ error: string().nullable()
17740
+ });
17741
+ var ReplayFrameInputSchema = object({
17742
+ timestamp: number(),
17743
+ frame: PipelineRunResultBridge
17744
+ });
17745
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
17746
+ className: string(),
17747
+ firstSeenMs: number(),
17748
+ lastSeenMs: number(),
17749
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
17750
+ * frame — a representative box for the diff's `(className, window, IoU)`
17751
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
17752
+ * trajectory production's `Track.positions` keeps. */
17753
+ bbox: BoundingBoxSchema,
17754
+ /** How many of the input frames this track matched a real detection on
17755
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
17756
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
17757
+ framesMatched: number().int()
17758
+ })).readonly() });
17759
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17760
+ deviceId: number(),
17761
+ trackId: string()
17762
+ }), TrackSchema.nullable()), method(object({
17763
+ deviceId: number(),
17764
+ since: number().optional(),
17765
+ until: number().optional(),
17766
+ limit: number().optional(),
17767
+ /** Spatial filter — only tracks whose trajectory intersects the zone
17768
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17769
+ * envelope columns, then precisely tested per position. Tracks with
17770
+ * an unknown envelope (no frame dims at persist time) always match. */
17771
+ zone: TrackZoneFilterSchema.optional(),
17772
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
17773
+ * compatible — omitting the field keeps today's exact behaviour). */
17774
+ projection: TrackProjectionSchema.optional(),
17775
+ /** Include stationary-promoted rows (parked objects handed to the
17776
+ * stationary registry). Default false: the timeline lists passages,
17777
+ * not parking records (operator decision, 2026-08-15). */
17778
+ includeStationary: boolean().optional()
17779
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17780
+ deviceId: number(),
17781
+ groupId: string().min(1)
17782
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17783
+ kind: "mutation",
17784
+ auth: "admin"
17785
+ }), 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({
17786
+ deviceId: number(),
17787
+ since: number().optional(),
17788
+ until: number().optional(),
17789
+ kinds: array(string()).optional(),
17790
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17791
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17792
+ deviceId: number(),
17793
+ since: number(),
17794
+ until: number(),
17795
+ bucketMs: number().int().positive()
17796
+ }), array(object({
17797
+ bucketStart: number(),
17798
+ motion: number().int(),
17799
+ object: number().int(),
17800
+ audio: number().int()
17801
+ })).readonly()), method(object({
17802
+ deviceId: number(),
17803
+ cutoffMs: number()
17804
+ }), object({
17805
+ motion: number().int(),
17806
+ object: number().int(),
17807
+ audio: number().int()
17808
+ }), {
17809
+ kind: "mutation",
17810
+ auth: "admin"
17811
+ }), method(object({
17812
+ deviceId: number(),
17813
+ cutoffMs: number()
17814
+ }), TrackCascadeCountsSchema, {
17815
+ kind: "mutation",
17816
+ auth: "admin"
17817
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17818
+ kind: "mutation",
17819
+ auth: "admin"
17820
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17821
+ kind: "mutation",
17822
+ auth: "admin"
17823
+ }), method(object({
17824
+ deviceId: number(),
17825
+ trackIds: array(string()).min(1)
17826
+ }), object({
17827
+ deleted: number().int(),
17828
+ failed: array(string()).readonly()
17829
+ }), {
17830
+ kind: "mutation",
17831
+ auth: "admin"
17832
+ }), method(object({
17833
+ /** Log/audit scope only — the trackId is globally unique on its own. */
17834
+ deviceId: number(),
17835
+ trackId: string(),
17836
+ flags: TrackFlagsPatchSchema
17837
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17838
+ kind: "query",
17839
+ auth: "admin"
17840
+ }), method(object({
17841
+ olderThanMs: number(),
17842
+ reason: OpsLogReasonSchema.optional()
17843
+ }), EventPruneCountsSchema, {
17844
+ kind: "mutation",
17845
+ auth: "admin"
17846
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17847
+ kind: "mutation",
17848
+ auth: "admin"
17849
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17850
+ kind: "mutation",
17851
+ auth: "admin"
17852
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17853
+ kind: "mutation",
17854
+ auth: "admin"
17855
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17856
+ kind: "mutation",
17857
+ auth: "admin"
17858
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
17859
+ kind: "mutation",
17860
+ auth: "admin"
17861
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17862
+ kind: "mutation",
17863
+ auth: "admin"
17864
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
17865
+ kind: "mutation",
17866
+ auth: "admin"
17867
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
17868
+ kind: "query",
17869
+ auth: "admin"
17870
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17871
+ kind: "mutation",
17872
+ auth: "admin"
17873
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17874
+ kind: "query",
17875
+ auth: "admin"
17876
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17877
+ kind: "query",
17878
+ auth: "admin"
17879
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17880
+ kind: "query",
17881
+ auth: "admin"
17882
+ }), method(object({
17883
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17884
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
17885
+ * route it at one camera's owner, and "every camera" would stop being
17886
+ * expressible at all. */
17887
+ deviceIds: array(number()).optional(),
17888
+ limit: number().int().min(1).max(500).optional()
17889
+ }), array(RetrainTrackSchema).readonly(), {
17890
+ kind: "query",
17891
+ auth: "admin"
17892
+ }), method(object({ trackId: string() }), RetrainFrameListSchema, {
17893
+ kind: "query",
17894
+ auth: "admin"
17895
+ }), method(object({
17896
+ deviceId: number(),
17897
+ trackId: string(),
17898
+ mediaKeys: array(string()).min(1)
17899
+ }), RetrainFrameSelectionSchema, {
17569
17900
  kind: "mutation",
17570
17901
  auth: "admin"
17571
- }), method(object({ nodeId: string() }), object({
17572
- success: literal(true),
17573
- clearedDevices: number()
17902
+ }), method(object({
17903
+ deviceId: number(),
17904
+ trackId: string(),
17905
+ frameId: string()
17906
+ }), object({
17907
+ removed: boolean(),
17908
+ removedAnnotations: number().int()
17574
17909
  }), {
17575
17910
  kind: "mutation",
17576
17911
  auth: "admin"
17577
- }), 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({
17578
- name: string(),
17579
- steps: array(PipelineTemplateStepSchema).readonly(),
17580
- engine: PipelineEngineChoiceSchema
17581
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
17582
- id: string(),
17583
- name: string().optional(),
17584
- steps: array(PipelineTemplateStepSchema).readonly().optional()
17585
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
17586
- addonId: string(),
17587
- modelId: string(),
17588
- format: ModelFormatSchema$1
17589
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
17590
- addonId: string(),
17591
- modelId: string(),
17592
- format: ModelFormatSchema$1
17593
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
17594
- engine: PipelineEngineChoiceSchema.optional(),
17595
- steps: array(PipelineStepInputSchema).min(1),
17596
- frame: FrameInputSchema.optional(),
17597
- /**
17598
- * Process-local lazy frame. Valid only when caller and provider resolve
17599
- * in the same execution-group process; split/cross-node callers use
17600
- * `frame`/`image` inline compatibility instead.
17601
- */
17602
- frameRef: FrameRefSchema.optional(),
17603
- /**
17604
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
17605
- * the decoded pixels live in. One more member of the one-of
17606
- * frame/frameHandle/image/imageBase64/referenceImage group.
17607
- */
17608
- frameHandle: FrameHandleSchema.optional(),
17609
- imageBase64: string().optional(),
17610
- /**
17611
- * Binary JPEG bytes — preferred over `imageBase64` on internal
17612
- * hops (hub → forked worker via Moleculer MsgPack) because it
17613
- * skips the 33% base64 overhead + the per-call base64 decode on
17614
- * the detection-pipeline worker. Callers can pass either; exactly
17615
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
17616
- */
17617
- image: _instanceof(Uint8Array).optional(),
17618
- referenceImage: string().optional(),
17619
- deviceId: number().optional(),
17620
- sessionId: string().optional(),
17621
- /**
17622
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
17623
- * reference-image, and detail-subtree calls. 'frame' is the live
17624
- * per-frame dispatch: ONLY root-plane steps run; crop children
17625
- * (inputClasses ≠ null) are skipped and served per-track via
17626
- * pipelineRunner.runDetailSubtree (two-plane design).
17627
- */
17628
- plane: _enum(["full", "frame"]).optional(),
17629
- /**
17630
- * Inference-device selector (Phase 2 multi-device). Format
17631
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
17632
- * Omitted ⇒ the runner's default device (current single-engine
17633
- * behaviour). Selects WHICH device pool of the node runs the call.
17634
- */
17635
- deviceKey: string().optional(),
17636
- /**
17637
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
17638
- * when the parent crop was resolved from the frame's retained NATIVE
17639
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
17640
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
17641
- * resolution from that surface — the SAME quality path faces already
17642
- * had — instead of the downscaled parent tile. `handle` keys the native
17643
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
17644
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
17645
- * the executor's crop-normalized child ROI back into frame-normalized
17646
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
17647
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
17648
- * (today's behaviour on the fallback path).
17649
- */
17650
- nativeCropRef: NativeCropRefSchema.optional()
17651
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
17652
- engine: PipelineEngineChoiceSchema.optional(),
17653
- steps: array(PipelineStepInputSchema).min(1),
17654
- frames: array(FrameInputSchema).min(1).max(255),
17655
- deviceId: number().optional(),
17656
- sessionId: string().optional(),
17657
- /**
17658
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
17659
- * the batch to the Python pool's bench preprocess cache
17660
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
17661
- * preprocessed ONCE and every later inference is a pure-inference cache
17662
- * hit — the sustained-throughput run measures inference, not
17663
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
17664
- * full preprocess every call, correct). Fresh per sustained run;
17665
- * released via `uncacheFrame`.
17666
- */
17667
- frameId: number().int().nonnegative().optional(),
17668
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
17669
- deviceKey: string().optional()
17670
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
17671
- data: _instanceof(Uint8Array),
17672
- width: number().int().positive(),
17673
- height: number().int().positive(),
17674
- format: _enum([
17675
- "rgb",
17676
- "bgr",
17677
- "gray"
17678
- ])
17679
- }), object({
17680
- frameId: number(),
17681
- width: number(),
17682
- height: number()
17683
- }), { kind: "mutation" }), method(object({
17684
- stepId: string(),
17685
- frameId: number().int()
17686
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
17687
- batchMode: string(),
17688
- windowMs: number(),
17689
- maxBatchSize: number(),
17690
- concurrency: number()
17691
- })), method(_void(), array(object({
17692
- engineKey: string(),
17693
- engine: PipelineEngineChoiceSchema,
17694
- modelsLoaded: array(string()).readonly(),
17695
- inUseByCameras: array(number()).readonly(),
17696
- /**
17697
- * Origin of this resident factory.
17698
- * - `runtime` — main camera-serving engine (no idle TTL).
17699
- * - `warm-override` — benchmark/test override held in the warm
17700
- * cache; auto-disposed after the idle TTL.
17701
- * - `device-pool` — a concurrent per-device pool (Phase 2
17702
- * multi-device, keyed by `deviceKey`) resolved
17703
- * via `resolveDeviceFactory`. Runs alongside the
17704
- * `runtime` engine on a DIFFERENT accelerator
17705
- * (NPU / iGPU / Coral) — this is how the
17706
- * Engines tab shows all pools running at once.
17707
- */
17708
- kind: _enum([
17709
- "runtime",
17710
- "warm-override",
17711
- "device-pool"
17712
- ]),
17713
- /** Native pid of the underlying Python pool (null when no pool). */
17714
- poolPid: number().nullable(),
17715
- /** ms since this factory was last used (null when not warm-tracked). */
17716
- idleMs: number().nullable(),
17717
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17718
- idleTtlMs: number().nullable()
17719
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
17912
+ }), method(object({ frameId: string() }), object({
17913
+ base64: string(),
17914
+ width: number().int(),
17915
+ height: number().int()
17916
+ }), {
17917
+ kind: "query",
17918
+ auth: "admin"
17919
+ }), method(object({
17920
+ deviceId: number(),
17921
+ trackId: string(),
17922
+ frameId: string(),
17923
+ subject: RetrainAssistSubjectSchema,
17924
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17925
+ nodeId: string().optional()
17926
+ }), RetrainAssistResultSchema, {
17720
17927
  kind: "mutation",
17721
17928
  auth: "admin"
17722
17929
  }), method(object({
17723
- engine: PipelineEngineChoiceSchema,
17724
- force: boolean().optional()
17725
- }), object({
17726
- success: boolean(),
17727
- reason: string().optional()
17728
- }), {
17930
+ deviceId: number(),
17931
+ source: DetectionSourceSchema,
17932
+ zones: array(ZoneSchema).readonly().optional(),
17933
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
17934
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
17935
+ frames: array(ReplayFrameInputSchema).min(1)
17936
+ }), RunReplayFrameProcessorResultSchema, {
17729
17937
  kind: "mutation",
17730
17938
  auth: "admin"
17731
- }), 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({
17732
- addonId: string(),
17733
- modelId: string(),
17734
- filename: string().optional(),
17735
- settings: record(string(), unknown()).optional()
17736
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
17939
+ }), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
17940
+ kind: "query",
17941
+ auth: "admin"
17942
+ }), method(object({
17943
+ deviceId: number(),
17944
+ trackId: string(),
17945
+ frameId: string(),
17946
+ annotations: array(RetrainAnnotationDraftSchema)
17947
+ }), array(RetrainAnnotationSchema).readonly(), {
17948
+ kind: "mutation",
17949
+ auth: "admin"
17950
+ }), method(object({
17951
+ deviceId: number(),
17952
+ trackId: string()
17953
+ }), RetrainTransitionResultSchema, {
17954
+ kind: "mutation",
17955
+ auth: "admin"
17956
+ }), method(object({
17957
+ deviceId: number(),
17958
+ trackId: string()
17959
+ }), RetrainTransitionResultSchema, {
17960
+ kind: "mutation",
17961
+ auth: "admin"
17962
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
17963
+ kind: "query",
17964
+ auth: "admin"
17965
+ }), method(object({
17966
+ eventId: string(),
17967
+ kind: MediaFileKindEnum.optional(),
17968
+ deviceId: number()
17969
+ }), array(MediaFileSchema).readonly()), method(object({
17970
+ trackId: string(),
17971
+ kinds: array(MediaFileKindEnum).optional(),
17972
+ deviceId: number()
17973
+ }), array(MediaFileSchema).readonly()), method(object({
17974
+ trackId: string(),
17975
+ deviceId: number()
17976
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17977
+ kind: "mutation",
17978
+ auth: "admin"
17979
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17980
+ kind: "mutation",
17981
+ auth: "admin"
17982
+ }), method(object({}), RebuildStatusSchema), object({
17983
+ deviceId: number(),
17984
+ timestamp: number(),
17985
+ frameWidth: number(),
17986
+ frameHeight: number(),
17987
+ detections: array(OverlayDetectionSchema).readonly()
17988
+ }), object({
17989
+ deviceId: number(),
17990
+ trackId: string(),
17991
+ className: string()
17992
+ }), object({
17993
+ deviceId: number(),
17994
+ trackId: string(),
17995
+ className: string(),
17996
+ durationMs: number()
17997
+ }), object({
17998
+ deviceId: number(),
17999
+ kind: EventKindSchema,
18000
+ eventId: string(),
18001
+ timestamp: number()
18002
+ });
17737
18003
  object({
17738
18004
  activeCameras: number(),
17739
18005
  throttledCameras: number(),
@@ -17759,66 +18025,6 @@ var CameraMetricsSchema = object({
17759
18025
  });
17760
18026
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
17761
18027
  /**
17762
- * Zone — pure geometry + identity. NO filtering behaviour.
17763
- *
17764
- * Zones describe **where** in the frame the operator wants to flag
17765
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
17766
- * each pipeline stage uses them. Splitting the two means a single
17767
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
17768
- * a detection-include rule on `['car']`, and an occupancy aggregate
17769
- * — without three duplicated polygons.
17770
- *
17771
- * Owned by the orchestrator addon (provider) and mirrored into the
17772
- * `zones` device-state slice on every mutation. Consumers
17773
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
17774
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
17775
- * mirror with `onChanged`).
17776
- *
17777
- * Coordinates are normalised fractions of the frame (0–1) so zones
17778
- * survive resolution changes and stream profile switches.
17779
- *
17780
- * `kind` discriminates between full polygons (closed regions used
17781
- * for intrusion / occupancy filters) and tripwires (open 2-point
17782
- * line segments used for cross events). Onboard / firmware-reported
17783
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17784
- * task list.
17785
- */
17786
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
17787
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17788
- var PolygonPointSchema = object({
17789
- x: number(),
17790
- y: number()
17791
- });
17792
- /** A camera detection zone — pure geometry/identity. */
17793
- var ZoneSchema = object({
17794
- id: string(),
17795
- name: string(),
17796
- kind: ZoneKindEnum.default("polygon"),
17797
- /** Polygon vertices, fraction of frame (0–1). */
17798
- polygon: array(PolygonPointSchema).readonly(),
17799
- /** Visual color for UI rendering. */
17800
- color: string().default("#3b82f6")
17801
- });
17802
- DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
17803
- deviceId: number(),
17804
- zone: ZoneSchema
17805
- }), _void(), {
17806
- kind: "mutation",
17807
- auth: "admin"
17808
- }), method(object({
17809
- deviceId: number(),
17810
- zoneId: string()
17811
- }), _void(), {
17812
- kind: "mutation",
17813
- auth: "admin"
17814
- }), method(object({
17815
- deviceId: number(),
17816
- zone: ZoneSchema
17817
- }), _void(), {
17818
- kind: "mutation",
17819
- auth: "admin"
17820
- }), object({ zones: array(ZoneSchema).readonly() });
17821
- /**
17822
18028
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
17823
18029
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
17824
18030
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -19506,7 +19712,7 @@ method(object({
19506
19712
  * linking rather than produce an eternal token.
19507
19713
  */
19508
19714
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19509
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
19715
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19510
19716
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19511
19717
  providerId: string().min(1),
19512
19718
  displayName: string().min(1),
@@ -19601,10 +19807,13 @@ var EvictResultSchema = object({
19601
19807
  /** True when the provider has nothing left it is willing to drop on this location. */
19602
19808
  exhausted: boolean()
19603
19809
  });
19604
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
19810
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19605
19811
  locationId: string(),
19606
19812
  targetBytes: number().int().positive()
19607
- }), EvictResultSchema, { kind: "mutation" });
19813
+ }), EvictResultSchema, {
19814
+ kind: "mutation",
19815
+ auth: "admin"
19816
+ });
19608
19817
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19609
19818
  kind: "mutation",
19610
19819
  auth: "admin"
@@ -19664,26 +19873,50 @@ var ReadChunkInputSchema = object({
19664
19873
  length: number()
19665
19874
  });
19666
19875
  var EndDownloadInputSchema = object({ downloadId: string() });
19667
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19876
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19668
19877
  location: StorageLocationSchema,
19669
19878
  relativePath: string()
19670
- }), string()), method(object({
19879
+ }), string(), { auth: "admin" }), method(object({
19671
19880
  location: StorageLocationSchema,
19672
19881
  relativePath: string(),
19673
19882
  data: _instanceof(Uint8Array)
19674
- }), _void(), { kind: "mutation" }), method(object({
19883
+ }), _void(), {
19884
+ kind: "mutation",
19885
+ auth: "admin"
19886
+ }), method(object({
19675
19887
  location: StorageLocationSchema,
19676
19888
  relativePath: string()
19677
- }), _instanceof(Uint8Array)), method(object({
19889
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19678
19890
  location: StorageLocationSchema,
19679
19891
  relativePath: string()
19680
- }), boolean()), method(object({
19892
+ }), boolean(), { auth: "admin" }), method(object({
19681
19893
  location: StorageLocationSchema,
19682
19894
  prefix: string().optional()
19683
- }), array(string()).readonly()), method(object({
19895
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19684
19896
  location: StorageLocationSchema,
19685
19897
  relativePath: string()
19686
- }), _void(), { kind: "mutation" }), method(object({ location: StorageLocationSchema }), number().nullable()), method(BeginUploadInputSchema, BeginUploadResultSchema, { kind: "mutation" }), method(WriteChunkInputSchema, _void(), { kind: "mutation" }), method(FinalizeUploadInputSchema, _void(), { kind: "mutation" }), method(AbortUploadInputSchema, _void(), { kind: "mutation" }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, { kind: "mutation" }), method(ReadChunkInputSchema, _instanceof(Uint8Array)), method(EndDownloadInputSchema, _void(), { kind: "mutation" });
19898
+ }), _void(), {
19899
+ kind: "mutation",
19900
+ auth: "admin"
19901
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
19902
+ kind: "mutation",
19903
+ auth: "admin"
19904
+ }), method(WriteChunkInputSchema, _void(), {
19905
+ kind: "mutation",
19906
+ auth: "admin"
19907
+ }), method(FinalizeUploadInputSchema, _void(), {
19908
+ kind: "mutation",
19909
+ auth: "admin"
19910
+ }), method(AbortUploadInputSchema, _void(), {
19911
+ kind: "mutation",
19912
+ auth: "admin"
19913
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
19914
+ kind: "mutation",
19915
+ auth: "admin"
19916
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
19917
+ kind: "mutation",
19918
+ auth: "admin"
19919
+ });
19687
19920
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19688
19921
  var ProfileSettingsSchemaBridge = unknown().nullable();
19689
19922
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -19941,7 +20174,8 @@ method(object({
19941
20174
  access: "create"
19942
20175
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
19943
20176
  kind: "mutation",
19944
- access: "view"
20177
+ access: "view",
20178
+ auth: "admin"
19945
20179
  }), method(object({
19946
20180
  /** Required — the user the assertion belongs to (verified). */
19947
20181
  userId: string(),
@@ -19949,10 +20183,12 @@ method(object({
19949
20183
  response: record(string(), unknown())
19950
20184
  }), object({ verified: boolean() }), {
19951
20185
  kind: "mutation",
19952
- access: "view"
20186
+ access: "view",
20187
+ auth: "admin"
19953
20188
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
19954
20189
  kind: "mutation",
19955
- access: "view"
20190
+ access: "view",
20191
+ auth: "admin"
19956
20192
  }), method(object({
19957
20193
  /** AuthenticationResponseJSON from the browser. */
19958
20194
  response: record(string(), unknown()) }), object({
@@ -19960,7 +20196,8 @@ response: record(string(), unknown()) }), object({
19960
20196
  userId: string().nullable()
19961
20197
  }), {
19962
20198
  kind: "mutation",
19963
- access: "view"
20199
+ access: "view",
20200
+ auth: "admin"
19964
20201
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
19965
20202
  userId: string(),
19966
20203
  credentialId: string()
@@ -20132,7 +20369,19 @@ var VectorStatsResultSchema = object({
20132
20369
  /** False when the backend ranks approximately. */
20133
20370
  exact: boolean()
20134
20371
  });
20135
- 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);
20372
+ method(VectorDeclareIndexInputSchema, _void(), {
20373
+ kind: "mutation",
20374
+ auth: "admin"
20375
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20376
+ kind: "mutation",
20377
+ auth: "admin"
20378
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20379
+ kind: "mutation",
20380
+ auth: "admin"
20381
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20382
+ kind: "mutation",
20383
+ auth: "admin"
20384
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20136
20385
  var ClipSchema = object({
20137
20386
  /** Opaque, provider-namespaced id. The default provider encodes the time
20138
20387
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -21855,7 +22104,27 @@ var MediaFileLiteSchema$1 = object({
21855
22104
  sizeBytes: number(),
21856
22105
  timestamp: number()
21857
22106
  });
21858
- method(_void(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
22107
+ method(object({
22108
+ /**
22109
+ * Inline {@link IdentitySchema.coverBase64} on every row.
22110
+ *
22111
+ * Default `false`, the same inversion `listRecentFaces` and
22112
+ * `listPlates` took on 2026-08-25 (see `include-crops-default.ts` for
22113
+ * why the burden belongs on the caller that WANTS the bytes). Measured
22114
+ * on the live hub the same day: four identities cost 40,979 B with the
22115
+ * covers inline, ~10 KB of base64 per row, on a query this UI mounts
22116
+ * four times and the viewer holds at `staleTime: 30_000`.
22117
+ *
22118
+ * Nothing loses its avatar: `coverMediaKey` is already on every row and
22119
+ * the `event-media` plane serves that key `immutable` with an ETag.
22120
+ *
22121
+ * **This is an INPUT field, so it does not reach the addon until the
22122
+ * next train** — the hub router validates cap inputs against its own
22123
+ * compiled Zod and strips a key it does not know. Until then the
22124
+ * provider sees `undefined`, which resolves to `false`: the cheap shape
22125
+ * is what ships, and the opt-in becomes reachable when the train lands.
22126
+ */
22127
+ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly()), method(object({ name: string().min(1) }), IdentitySchema, {
21859
22128
  kind: "mutation",
21860
22129
  auth: "admin"
21861
22130
  }), method(object({
@@ -24002,8 +24271,10 @@ var PlateInfoSchema = object({
24002
24271
  keyFrameMediaKey: string().optional(),
24003
24272
  base64: string().optional(),
24004
24273
  /**
24005
- * Same crop as a data-plane URL. `getPlateByTrack` returns this and
24006
- * never inlines JPEG; `listPlates` still inlines for the admin-ui.
24274
+ * Same crop as a data-plane URL, always present when the plate has a stored
24275
+ * crop. `getPlateByTrack` returns this and never inlines JPEG; `listPlates`
24276
+ * and `searchPlates` inline the crop only when their `includeCrops` input is
24277
+ * left at its `true` default.
24007
24278
  */
24008
24279
  cropUrl: string().optional()
24009
24280
  });
@@ -24023,14 +24294,34 @@ var PlateClusterSchema = object({
24023
24294
  });
24024
24295
  method(object({
24025
24296
  deviceId: number().int().optional(),
24026
- limit: number().int().positive().optional()
24297
+ limit: number().int().positive().optional(),
24298
+ /**
24299
+ * Inline the base64 crop on every row. Default `true` — the existing
24300
+ * behaviour, kept so no caller breaks.
24301
+ *
24302
+ * Set `false` once the caller renders {@link PlateInfo.cropUrl}.
24303
+ * Measured on the live hub at the 500 rows the Plates view asks for:
24304
+ * 879,403 B and 27.7 s with the crops inline, against a few KiB of
24305
+ * metadata without them — and the browser then caches the images.
24306
+ *
24307
+ * This is the plate twin of `faceGallery.listRecentFaces`'s option;
24308
+ * plates were the one gallery list left without it.
24309
+ *
24310
+ * **This is an INPUT field, so it does not reach the addon until the
24311
+ * next train.** The hub router validates cap inputs against its own
24312
+ * compiled Zod and strips a key it does not know. Until the train
24313
+ * ships, sending `false` is harmless and keeps the crops inline.
24314
+ */
24315
+ includeCrops: boolean().optional()
24027
24316
  }).optional(), array(PlateInfoSchema).readonly()), method(object({
24028
24317
  deviceId: number().int(),
24029
24318
  trackId: string()
24030
24319
  }), PlateInfoSchema.nullable()), method(object({ plateId: string() }), array(MediaFileLiteSchema).readonly()), method(object({
24031
24320
  text: string().min(1),
24032
24321
  maxDistance: number().int().min(0).optional(),
24033
- limit: number().int().positive().optional()
24322
+ limit: number().int().positive().optional(),
24323
+ /** See `listPlates.includeCrops`. Default `true`. */
24324
+ includeCrops: boolean().optional()
24034
24325
  }), array(PlateInfoSchema).readonly()), method(object({
24035
24326
  maxDistance: number().int().min(0).optional(),
24036
24327
  minClusterSize: number().int().min(2).optional(),
@@ -24044,7 +24335,13 @@ method(object({
24044
24335
  }), method(object({ plateId: string() }), _void(), {
24045
24336
  kind: "mutation",
24046
24337
  auth: "admin"
24047
- }), method(_void(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24338
+ }), method(object({
24339
+ /** Inline {@link VehicleSchema.coverBase64} on every row. Default
24340
+ * `false` — the vehicle twin of `faceGallery.listIdentities`'s
24341
+ * option; `coverMediaKey` + the `event-media` plane carry the picture.
24342
+ * INPUT field: stripped by the hub router until the train ships, which
24343
+ * resolves to `false` and is exactly the intended default. */
24344
+ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly()), method(object({ name: string().min(1) }), VehicleSchema, {
24048
24345
  kind: "mutation",
24049
24346
  auth: "admin"
24050
24347
  }), method(object({
@@ -25309,92 +25606,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
25309
25606
  kind: "mutation",
25310
25607
  auth: "admin"
25311
25608
  });
25312
- /**
25313
- * Per-stage gating mode applied to the zones a rule references.
25314
- *
25315
- * - `include`: the rule contributes to a **whitelist** for its stage.
25316
- * When at least one `include` rule fires for a stage, only entities
25317
- * inside one of those zones pass that stage.
25318
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
25319
- * Entities inside one of those zones are dropped at that stage.
25320
- *
25321
- * `monitor`-style observation (count without filtering) is not a rule
25322
- * mode — zones without any matching rule are observed naturally by
25323
- * `zone-analytics` (live snapshot + history), so an "I just want to
25324
- * count, not filter" use case needs no rule at all.
25325
- */
25326
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
25327
- /**
25328
- * Per-consumer rule that references existing zones (geometry) and
25329
- * defines how a specific pipeline stage should treat them. Each
25330
- * consumer addon owns its own `ZoneRule[]` array in its per-device
25331
- * settings:
25332
- *
25333
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
25334
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
25335
- * - future: notification rules, audio gating, etc.
25336
- *
25337
- * One rule applies to N zones (`zoneIds[]`) so the operator can
25338
- * express "ignore motion in ALL of {garden, street}" with a single
25339
- * rule. `classFilter` narrows the rule to specific object classes —
25340
- * "drop person detections in the street, but keep cars" is one
25341
- * `exclude` rule with `classFilter: ['person']`.
25342
- *
25343
- * `enabled` is a soft toggle — the operator can keep the rule
25344
- * configured but inert without deleting it.
25345
- */
25346
- var ZoneRuleSchema = object({
25347
- /** Stable rule id — survives edits, used by the UI for diffing. */
25348
- id: string(),
25349
- /** Optional human-readable label rendered in the rule editor. */
25350
- name: string().optional(),
25351
- /** Zones this rule targets. The rule's `mode` applies to ALL
25352
- * listed zones (OR-set: a detection in any one of them counts).
25353
- * At least one zone id required — a rule with no targets is a
25354
- * configuration mistake and the form validator rejects it. */
25355
- zoneIds: array(string()).min(1).readonly(),
25356
- mode: ZoneRuleModeEnum,
25357
- /**
25358
- * Class names this rule applies to. Empty / undefined ⇒ rule
25359
- * applies to every class. Class strings match the `macroClass`
25360
- * field on detections (e.g. `person`, `car`, `dog`).
25361
- */
25362
- classFilter: array(string()).readonly().optional(),
25363
- /**
25364
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
25365
- * required to consider an entity "in the zone". Defaults to the
25366
- * consumer's stage default when omitted. Kept for back-compat with
25367
- * existing per-rule overrides; new operators pick the value via
25368
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
25369
- * set, the lower-level engine reads it as a 0–1 fraction.
25370
- */
25371
- overlapThreshold: number().min(0).max(1).optional(),
25372
- /**
25373
- * Operator-friendly version of `overlapThreshold` — the percentage
25374
- * of the detection's bbox that must lie inside the zone for the
25375
- * rule to match. Documented default is 85%; the engine substitutes
25376
- * that when the field is omitted (kept optional so existing rules
25377
- * stored without it stay valid).
25378
- *
25379
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
25380
- * rule, the engine prefers `bboxInclusionPct` because it's the
25381
- * field exposed in the UI. Internally both feed the same gate.
25382
- */
25383
- bboxInclusionPct: number().min(0).max(100).optional(),
25384
- /**
25385
- * When `true` and a detection has a segmentation mask, use the
25386
- * mask for overlap instead of the bbox. Detection-stage only;
25387
- * motion rules ignore this field.
25388
- */
25389
- preferMask: boolean().optional(),
25390
- /**
25391
- * Soft-toggle: `false` disables the rule without deleting it.
25392
- * Defaults to `true` so operators creating a rule via the UI
25393
- * see it active immediately.
25394
- */
25395
- enabled: boolean().default(true)
25396
- });
25397
- array(ZoneRuleSchema).readonly();
25398
25609
  object({
25399
25610
  /** Whether the script is currently executing. */
25400
25611
  isRunning: boolean(),
@@ -29421,6 +29632,12 @@ Object.freeze({
29421
29632
  addonId: null,
29422
29633
  access: "create"
29423
29634
  },
29635
+ "pipelineAnalytics.cancelRelocateMedia": {
29636
+ capName: "pipeline-analytics",
29637
+ capScope: "device",
29638
+ addonId: null,
29639
+ access: "create"
29640
+ },
29424
29641
  "pipelineAnalytics.cancelStorageMigrationMove": {
29425
29642
  capName: "pipeline-analytics",
29426
29643
  capScope: "device",
@@ -29595,6 +29812,12 @@ Object.freeze({
29595
29812
  addonId: null,
29596
29813
  access: "view"
29597
29814
  },
29815
+ "pipelineAnalytics.listRelocateMediaJobs": {
29816
+ capName: "pipeline-analytics",
29817
+ capScope: "device",
29818
+ addonId: null,
29819
+ access: "view"
29820
+ },
29598
29821
  "pipelineAnalytics.listRetrainAnnotations": {
29599
29822
  capName: "pipeline-analytics",
29600
29823
  capScope: "device",
@@ -29673,6 +29896,12 @@ Object.freeze({
29673
29896
  addonId: null,
29674
29897
  access: "create"
29675
29898
  },
29899
+ "pipelineAnalytics.relocateMedia": {
29900
+ capName: "pipeline-analytics",
29901
+ capScope: "device",
29902
+ addonId: null,
29903
+ access: "create"
29904
+ },
29676
29905
  "pipelineAnalytics.restageRetrainTrack": {
29677
29906
  capName: "pipeline-analytics",
29678
29907
  capScope: "device",
@@ -29685,6 +29914,12 @@ Object.freeze({
29685
29914
  addonId: null,
29686
29915
  access: "create"
29687
29916
  },
29917
+ "pipelineAnalytics.runReplayFrameProcessor": {
29918
+ capName: "pipeline-analytics",
29919
+ capScope: "device",
29920
+ addonId: null,
29921
+ access: "create"
29922
+ },
29688
29923
  "pipelineAnalytics.saveRetrainAnnotations": {
29689
29924
  capName: "pipeline-analytics",
29690
29925
  capScope: "device",
@@ -29817,6 +30052,12 @@ Object.freeze({
29817
30052
  addonId: null,
29818
30053
  access: "view"
29819
30054
  },
30055
+ "pipelineExecutor.getInferenceDeviceHealth": {
30056
+ capName: "pipeline-executor",
30057
+ capScope: "system",
30058
+ addonId: null,
30059
+ access: "view"
30060
+ },
29820
30061
  "pipelineExecutor.getOrchestratorConfigSchema": {
29821
30062
  capName: "pipeline-executor",
29822
30063
  capScope: "system",
@@ -29889,6 +30130,12 @@ Object.freeze({
29889
30130
  addonId: null,
29890
30131
  access: "view"
29891
30132
  },
30133
+ "pipelineExecutor.rearmInferenceDevice": {
30134
+ capName: "pipeline-executor",
30135
+ capScope: "system",
30136
+ addonId: null,
30137
+ access: "create"
30138
+ },
29892
30139
  "pipelineExecutor.runAudioTest": {
29893
30140
  capName: "pipeline-executor",
29894
30141
  capScope: "system",
@@ -33137,6 +33384,11 @@ Object.freeze({
33137
33384
  form: "single",
33138
33385
  optional: false
33139
33386
  }],
33387
+ "pipelineAnalytics.runReplayFrameProcessor": [{
33388
+ name: "deviceId",
33389
+ form: "single",
33390
+ optional: false
33391
+ }],
33140
33392
  "pipelineAnalytics.saveRetrainAnnotations": [{
33141
33393
  name: "deviceId",
33142
33394
  form: "single",
@@ -34298,7 +34550,7 @@ var AgentUIAddon = class extends BaseAddon {
34298
34550
  capability: adminUiCapability,
34299
34551
  provider: {
34300
34552
  getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
34301
- getVersion: async () => ({ version: "1.2.29" })
34553
+ getVersion: async () => ({ version: "1.2.31" })
34302
34554
  }
34303
34555
  }];
34304
34556
  }