@camstack/types 1.2.109 → 1.2.111

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 (55) hide show
  1. package/dist/addon.js +1 -1
  2. package/dist/addon.mjs +1 -1
  3. package/dist/capabilities/addons.cap.d.ts +9 -9
  4. package/dist/capabilities/broker.cap.d.ts +4 -4
  5. package/dist/capabilities/camera-streams.cap.d.ts +5 -5
  6. package/dist/capabilities/climate-control.cap.d.ts +8 -8
  7. package/dist/capabilities/core-blocks.cap.d.ts +16 -16
  8. package/dist/capabilities/day-night.cap.d.ts +8 -8
  9. package/dist/capabilities/decoder.cap.d.ts +13 -13
  10. package/dist/capabilities/device-manager.cap.d.ts +5 -5
  11. package/dist/capabilities/face-gallery.cap.d.ts +1 -1
  12. package/dist/capabilities/image-settings.cap.d.ts +16 -16
  13. package/dist/capabilities/llm-runtime.cap.d.ts +3 -3
  14. package/dist/capabilities/llm.cap.d.ts +4 -4
  15. package/dist/capabilities/media-player.cap.d.ts +9 -9
  16. package/dist/capabilities/metrics-provider.cap.d.ts +2 -2
  17. package/dist/capabilities/model-convert.cap.d.ts +3 -3
  18. package/dist/capabilities/motion-detection.cap.d.ts +4 -4
  19. package/dist/capabilities/notification-output.cap.d.ts +9 -9
  20. package/dist/capabilities/notification-rules.cap.d.ts +10 -10
  21. package/dist/capabilities/oauth-integration.cap.d.ts +2 -2
  22. package/dist/capabilities/osd-manager.cap.d.ts +2 -2
  23. package/dist/capabilities/pipeline-analytics.cap.d.ts +191 -54
  24. package/dist/capabilities/pipeline-executor.cap.d.ts +117 -19
  25. package/dist/capabilities/pipeline-orchestrator.cap.d.ts +21 -21
  26. package/dist/capabilities/pipeline-runner.cap.d.ts +6 -6
  27. package/dist/capabilities/platform-probe.cap.d.ts +2 -2
  28. package/dist/capabilities/recording-export.cap.d.ts +7 -7
  29. package/dist/capabilities/recording.cap.d.ts +7 -7
  30. package/dist/capabilities/schemas/detection-shared.d.ts +4 -4
  31. package/dist/capabilities/schemas/orchestrator-metrics.d.ts +2 -2
  32. package/dist/capabilities/schemas/streaming-shared.d.ts +11 -11
  33. package/dist/capabilities/sso-bridge.cap.d.ts +3 -3
  34. package/dist/capabilities/storage-migration.cap.d.ts +4 -4
  35. package/dist/capabilities/storage.cap.d.ts +2 -2
  36. package/dist/capabilities/stream-broker.cap.d.ts +50 -50
  37. package/dist/capabilities/user-management.cap.d.ts +20 -20
  38. package/dist/capabilities/vacuum-control.cap.d.ts +26 -26
  39. package/dist/capabilities/webrtc-session.cap.d.ts +4 -4
  40. package/dist/generated/addon-api.d.ts +50 -8
  41. package/dist/generated/method-access-map.d.ts +1 -1
  42. package/dist/generated/method-device-selectors.d.ts +1 -1
  43. package/dist/generated/system-proxy.d.ts +1 -1
  44. package/dist/index.js +2140 -1951
  45. package/dist/index.mjs +2140 -1951
  46. package/dist/interfaces/adoption-job.d.ts +2 -2
  47. package/dist/interfaces/relocate.d.ts +10 -10
  48. package/dist/interfaces/stream-broker.d.ts +2 -2
  49. package/dist/lifecycle/job.d.ts +8 -8
  50. package/dist/{sleep-BJTBu5cu.js → sleep-BCRrMlni.js} +4 -0
  51. package/dist/{sleep-Dj1DG9Od.mjs → sleep-DJlqY62B.mjs} +4 -0
  52. package/dist/types/frame-view.d.ts +10 -24
  53. package/dist/types/labels.d.ts +30 -1
  54. package/dist/types/models.d.ts +4 -4
  55. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as EventCategory } from "./event-category-CIa_iT6b.mjs";
2
- import { $ as DecodedFrameSchema, A as event, B as ReadinessRegistry, C as DeviceFeature, Ct as isEvent, D as DEFAULT_RUNTIME_STATE_DURABILITY, Dt as collectHydratedFieldValues, E as adminUiCapability, Et as collectHydratedFieldEntries, F as systemMethod, G as BrokerStatsSchema, H as emitDownForOwnedCaps, I as CAP_NODE_PIN_CONTEXT_KEY, J as CamProfileSchema, K as BrokerStatusSchema, L as nodePin, M as isDeviceConfigCap, N as method, O as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Ot as hydrateSchema, P as resolveCapMount, Q as DecodedAudioChunkSchema, R as readNodePin, S as ChargingStatus, St as emitReadiness, T as DeviceType, Tt as WELL_KNOWN_TAB_MAP, U as readinessKey, V as ReadinessTimeoutError, W as scopeKey, X as CamStreamResolutionSchema, Y as CamStreamKindSchema, Z as CameraStreamSchema, _ as createMirrorSource, _t as DisposerChain, a as asJsonObject, at as ProfileSlotStatusSchema, b as deviceOpsCapability, bt as createDurableState, c as parseJsonArray, ct as SubscribeAudioChunksInputSchema, d as BOOT_RECOVERY_BACKOFF_MS, dt as SubscribeFramesResultSchema, et as EncodedPacketSchema, f as DEVICE_SCOPED_CAPS, ft as makeProfileBrokerId, g as createLazyTrpcSource, gt as DATAPLANE_SECRET_HEADER, h as createEventBusSliceSource, ht as selectAssignedProfileSlots, i as asJsonArray, it as ProfileSlotSchema, j as expandCapMethods, k as DEVICE_STATUS_METHOD, kt as resolveHydratedFieldValue, l as parseJsonObject, lt as SubscribeAudioChunksResultSchema, m as createDeviceProxy, mt as parseProfileBrokerId, n as sleepCancellable, nt as FrameHandleSchema, o as asNumber, ot as StreamSourceEntrySchema, p as isDeviceScopedCap, pt as makeSourceBrokerId, q as CAM_PROFILE_ORDER, r as asBoolean, rt as ProfileRtspEntrySchema, s as asString, st as StreamSourceSchema, t as sleep, tt as FrameHandleFormatSchema, u as parseJsonUnknown, ut as SubscribeFramesInputSchema, v as createSliceHandle, vt as BaseAddon, w as DeviceRole, wt as WELL_KNOWN_TABS, x as viewerUiCapability, xt as createEvent, y as RawStateResultSchema, yt as normalizeAddonInitResult, z as toNodeId } from "./sleep-Dj1DG9Od.mjs";
2
+ import { $ as DecodedFrameSchema, A as event, B as ReadinessRegistry, C as DeviceFeature, Ct as isEvent, D as DEFAULT_RUNTIME_STATE_DURABILITY, Dt as collectHydratedFieldValues, E as adminUiCapability, Et as collectHydratedFieldEntries, F as systemMethod, G as BrokerStatsSchema, H as emitDownForOwnedCaps, I as CAP_NODE_PIN_CONTEXT_KEY, J as CamProfileSchema, K as BrokerStatusSchema, L as nodePin, M as isDeviceConfigCap, N as method, O as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Ot as hydrateSchema, P as resolveCapMount, Q as DecodedAudioChunkSchema, R as readNodePin, S as ChargingStatus, St as emitReadiness, T as DeviceType, Tt as WELL_KNOWN_TAB_MAP, U as readinessKey, V as ReadinessTimeoutError, W as scopeKey, X as CamStreamResolutionSchema, Y as CamStreamKindSchema, Z as CameraStreamSchema, _ as createMirrorSource, _t as DisposerChain, a as asJsonObject, at as ProfileSlotStatusSchema, b as deviceOpsCapability, bt as createDurableState, c as parseJsonArray, ct as SubscribeAudioChunksInputSchema, d as BOOT_RECOVERY_BACKOFF_MS, dt as SubscribeFramesResultSchema, et as EncodedPacketSchema, f as DEVICE_SCOPED_CAPS, ft as makeProfileBrokerId, g as createLazyTrpcSource, gt as DATAPLANE_SECRET_HEADER, h as createEventBusSliceSource, ht as selectAssignedProfileSlots, i as asJsonArray, it as ProfileSlotSchema, j as expandCapMethods, k as DEVICE_STATUS_METHOD, kt as resolveHydratedFieldValue, l as parseJsonObject, lt as SubscribeAudioChunksResultSchema, m as createDeviceProxy, mt as parseProfileBrokerId, n as sleepCancellable, nt as FrameHandleSchema, o as asNumber, ot as StreamSourceEntrySchema, p as isDeviceScopedCap, pt as makeSourceBrokerId, q as CAM_PROFILE_ORDER, r as asBoolean, rt as ProfileRtspEntrySchema, s as asString, st as StreamSourceSchema, t as sleep, tt as FrameHandleFormatSchema, u as parseJsonUnknown, ut as SubscribeFramesInputSchema, v as createSliceHandle, vt as BaseAddon, w as DeviceRole, wt as WELL_KNOWN_TABS, x as viewerUiCapability, xt as createEvent, y as RawStateResultSchema, yt as normalizeAddonInitResult, z as toNodeId } from "./sleep-DJlqY62B.mjs";
3
3
  import { a as buildAudioArgs, c as buildVideoArgs, d as logBannerArgs, f as pickVideoEncoder, i as audioPlanFromEncodeProfile, l as invocationFromEncodeProfile, n as Fmp4BoxSplitter, o as buildFfmpegArgs, r as AUDIO_PRESETS, s as buildInputArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-rO1sRmEK.mjs";
4
4
  import { EventSourceType } from "./enums.mjs";
5
5
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
@@ -2285,7 +2285,26 @@ var CLASS_MAP_MACRO_TARGETS = [
2285
2285
  "animal",
2286
2286
  "package"
2287
2287
  ];
2288
- var ClassMapDefinitionSchema = z.object({
2288
+ /**
2289
+ * Wire schema for a per-model CATALOG classMap override
2290
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
2291
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
2292
+ * detection pipeline executor actually routes.
2293
+ *
2294
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
2295
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
2296
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
2297
+ * enum) — the two used to share the name `ClassMapDefinition`/
2298
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
2299
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
2300
+ * are not: it is two different concepts colliding on a name. Keep this type
2301
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
2302
+ * would either narrow every `ClassMapDefinition` consumer to the four
2303
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
2304
+ * schema exists for (see the "rejects a classMap whose target is not a
2305
+ * detection macro" test in `model-catalog-schema.test.ts`).
2306
+ */
2307
+ var DetectionCatalogClassMapSchema = z.object({
2289
2308
  mapping: z.record(z.string(), z.enum(CLASS_MAP_MACRO_TARGETS)),
2290
2309
  preserveOriginal: z.boolean()
2291
2310
  });
@@ -2657,7 +2676,7 @@ var ModelCatalogEntrySchema = z.object({
2657
2676
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
2658
2677
  * labels already ARE the CamStack macros (Scrypted identity map).
2659
2678
  */
2660
- classMap: ClassMapDefinitionSchema.optional()
2679
+ classMap: DetectionCatalogClassMapSchema.optional()
2661
2680
  });
2662
2681
  var ConvertTargetSchema = z.discriminatedUnion("format", [z.object({
2663
2682
  format: z.literal("openvino"),
@@ -2687,7 +2706,7 @@ var ModelConvertMetadataSchema = z.object({
2687
2706
  "segmentation"
2688
2707
  ]),
2689
2708
  faceAlignment: z.boolean().optional(),
2690
- classMap: ClassMapDefinitionSchema.optional()
2709
+ classMap: DetectionCatalogClassMapSchema.optional()
2691
2710
  });
2692
2711
  var ConvertArtifactSchema = z.object({
2693
2712
  format: z.enum(MODEL_FORMATS),
@@ -14773,373 +14792,1208 @@ var oauthIntegrationCapability = {
14773
14792
  getDescriptor: method(z.void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
14774
14793
  };
14775
14794
  //#endregion
14776
- //#region src/capabilities/pipeline-analytics.cap.ts
14795
+ //#region src/capabilities/pipeline-executor.cap.ts
14777
14796
  /**
14778
- * pipeline-analytics device-scoped wrapper cap. Refines raw
14779
- * per-frame detections emitted by the pipeline runner into tracked
14780
- * objects, per-kind event collections (motion / object / audio), and
14781
- * persisted media. Owns the post-detection domain end-to-end:
14782
- *
14783
- * runner emits PipelineInferenceResult
14784
- * ↓ (event bus)
14785
- * pipeline-analytics subscriber
14786
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
14787
- * → three DB collections (one per kind), one FS media tree, one
14788
- * unified event emitter (FrameTracked + TrackStarted/Ended +
14789
- * DetectionEvent on bus)
14790
- *
14791
- * Pure subscriber model. No `processFrame` cap method — the runner
14792
- * already publishes the raw frame on the bus. The cap surface is
14793
- * only QUERIES + per-device settings, bound on/off via
14794
- * `device-manager.setWrapperActive`. `defaultActive: true` because
14795
- * every camera with a detection pipeline wants its raw detections
14796
- * refined; operators opt out per-device via BindingsTab when needed.
14797
- *
14798
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
14799
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
14797
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
14798
+ * within the frame, so the executor can re-cut a leaf child ROI at native
14799
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
14800
14800
  */
14801
- var TrackStateSchema = z.enum([
14802
- "new",
14803
- "entered",
14804
- "left",
14805
- "moving",
14806
- "idle"
14807
- ]);
14808
- var EventKindSchema = z.enum([
14809
- "motion",
14810
- "object",
14811
- "audio"
14812
- ]);
14801
+ var NativeCropRefSchema = z.object({
14802
+ /** Handle keying the retained native surface (node-pinned to its owner). */
14803
+ handle: FrameHandleSchema,
14804
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
14805
+ cropFrameSpace: z.object({
14806
+ x: z.number(),
14807
+ y: z.number(),
14808
+ w: z.number(),
14809
+ h: z.number()
14810
+ })
14811
+ });
14812
+ z.object({
14813
+ crop: z.object({
14814
+ left: z.number(),
14815
+ top: z.number(),
14816
+ width: z.number().positive(),
14817
+ height: z.number().positive()
14818
+ }).optional(),
14819
+ content: z.object({
14820
+ width: z.number().int().positive(),
14821
+ height: z.number().int().positive()
14822
+ }),
14823
+ fit: z.enum(["stretch", "contain"]),
14824
+ format: z.enum([
14825
+ "rgb",
14826
+ "gray",
14827
+ "jpeg"
14828
+ ])
14829
+ });
14813
14830
  /**
14814
- * Spatial filter for `listTracks` the rect + polygon variants of the shared
14815
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
14816
- * of the camera frame (top-left origin), matching the drawing-plane editor.
14831
+ * Process-local frame identity. It is serializable so it can ride an in-process
14832
+ * capability call, but `registryId` deliberately prevents resolution in any
14833
+ * other process or execution group.
14817
14834
  */
14818
- var TrackZoneFilterSchema = z.discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
14819
- /** Closed icon vocabulary so clients render a known glyph per kind. */
14820
- var EventKindIconSchema = z.enum([
14821
- "motion",
14822
- "audio",
14823
- "person",
14824
- "vehicle",
14825
- "animal",
14826
- "door",
14827
- "pir",
14828
- "smoke",
14829
- "water",
14830
- "button",
14831
- "package",
14832
- "generic"
14835
+ var FrameRefSchema = z.object({
14836
+ registryId: z.string().min(1),
14837
+ id: z.string().min(1),
14838
+ width: z.number().int().positive(),
14839
+ height: z.number().int().positive(),
14840
+ format: z.enum(["rgb", "gray"]),
14841
+ timestamp: z.number(),
14842
+ capturedAt: z.number().optional()
14843
+ });
14844
+ var ModelFormatSchema$1 = z.enum([
14845
+ "onnx",
14846
+ "coreml",
14847
+ "openvino",
14848
+ "tflite",
14849
+ "pt",
14850
+ "gguf"
14833
14851
  ]);
14834
- var EventKindCategorySchema = z.enum([
14835
- "motion",
14836
- "audio",
14837
- "detection",
14838
- "sensor",
14839
- "control",
14840
- "custom",
14841
- "package"
14852
+ var PipelineSlotSchema = z.enum([
14853
+ "detector",
14854
+ "cropper",
14855
+ "classifier",
14856
+ "refiner",
14857
+ "audio-classifier"
14842
14858
  ]);
14843
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
14844
- var EventKindLevelSchema = z.enum(["macro", "sub"]);
14845
- var EventKindDescriptorSchema = z.object({
14846
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
14847
- kind: z.string(),
14848
- /** i18n key resolved on the UI side; `label` is the English fallback. */
14849
- labelKey: z.string(),
14850
- /** English fallback label (kept for clients that don't translate). */
14859
+ var PipelineEngineChoiceSchema = z.object({
14860
+ runtime: z.enum(["node", "python"]),
14861
+ backend: z.string(),
14862
+ format: ModelFormatSchema$1,
14863
+ device: z.string().optional()
14864
+ });
14865
+ var EngineDeviceInfoSchema = z.object({
14866
+ id: z.string(),
14851
14867
  label: z.string(),
14852
- /** Hex color for timeline/legend rendering. */
14853
- color: z.string(),
14854
- /** Dictionary id → lucide component on the UI side. */
14855
- iconId: z.string(),
14856
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
14857
- icon: EventKindIconSchema,
14858
- category: EventKindCategorySchema,
14859
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
14860
- parentKind: z.string().nullable(),
14861
- /** Derived from `parentKind`, explicit for the client tree. */
14862
- level: EventKindLevelSchema,
14863
- /** Which cap + device contributes this kind. For built-ins the camera
14864
- * itself; for sensor kinds the LINKED source device. */
14865
- source: z.object({
14866
- capName: z.string(),
14867
- deviceId: z.number()
14868
- })
14868
+ description: z.string().optional()
14869
14869
  });
14870
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
14871
- var EventKindsForDeviceSchema = z.object({
14872
- deviceId: z.number(),
14873
- kinds: z.array(EventKindDescriptorSchema).readonly()
14870
+ var AvailableEngineSchema = z.object({
14871
+ engine: PipelineEngineChoiceSchema,
14872
+ devices: z.array(EngineDeviceInfoSchema).readonly(),
14873
+ defaultDevice: z.string()
14874
14874
  });
14875
- var SensorEventSchema = z.object({
14875
+ var PipelineDefaultStepSchema = z.lazy(() => z.object({
14876
+ addonId: z.string(),
14877
+ addonName: z.string(),
14878
+ slot: PipelineSlotSchema,
14879
+ inputClasses: z.array(z.string()).readonly(),
14880
+ outputClasses: z.array(z.string()).readonly(),
14881
+ enabled: z.boolean(),
14882
+ modelId: z.string(),
14883
+ children: z.array(PipelineDefaultStepSchema).readonly(),
14884
+ group: z.string().optional(),
14885
+ settings: z.record(z.string(), z.unknown()).optional()
14886
+ }));
14887
+ var PipelineTemplateStepSchema = z.lazy(() => z.object({
14888
+ addonId: z.string(),
14889
+ enabled: z.boolean(),
14890
+ modelId: z.string(),
14891
+ children: z.array(PipelineTemplateStepSchema).readonly(),
14892
+ settings: z.record(z.string(), z.unknown()).optional()
14893
+ }));
14894
+ var PipelineTemplateSchema$1 = z.object({
14876
14895
  id: z.string(),
14877
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
14878
- * yields N rows, one per camera). */
14879
- deviceId: z.number(),
14880
- /** The linked sensor device whose state changed. */
14881
- sourceDeviceId: z.number(),
14882
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
14883
- kind: z.string(),
14884
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
14885
- value: z.record(z.string(), z.unknown()).nullable(),
14886
- timestamp: z.number()
14887
- });
14888
- var TrackPositionSchema = z.object({
14889
- x: z.number(),
14890
- y: z.number(),
14891
- timestamp: z.number(),
14892
- bbox: BoundingBoxSchema
14896
+ name: z.string(),
14897
+ createdAt: z.string(),
14898
+ updatedAt: z.string(),
14899
+ engine: PipelineEngineChoiceSchema,
14900
+ steps: z.array(PipelineTemplateStepSchema).readonly()
14893
14901
  });
14894
- var TrackSnapshotSchema = z.object({
14895
- timestamp: z.number(),
14896
- position: TrackPositionSchema,
14897
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
14898
- mediaKey: z.string()
14902
+ var PipelineModelOptionSchema = z.object({
14903
+ id: z.string(),
14904
+ name: z.string(),
14905
+ formats: z.record(z.string(), z.object({
14906
+ downloaded: z.boolean(),
14907
+ sizeMB: z.number()
14908
+ })),
14909
+ group: ModelVariantGroupSchema.optional(),
14910
+ legacy: z.boolean().optional(),
14911
+ provider: ModelProviderIdSchema.optional()
14899
14912
  });
14900
- /**
14901
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
14902
- * divided by the track's detection-frame dims), computed at persist time.
14903
- * Absent when the frame dims were unknown when the track was persisted
14904
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
14905
- */
14906
- var TrackEnvelopeSchema = z.object({
14907
- minX: z.number(),
14908
- minY: z.number(),
14909
- maxX: z.number(),
14910
- maxY: z.number()
14913
+ var ConfigFieldBridge = z.custom();
14914
+ var PipelineAddonSchemaSchema = z.object({
14915
+ id: z.string(),
14916
+ name: z.string(),
14917
+ slot: PipelineSlotSchema,
14918
+ inputClasses: z.array(z.string()).readonly(),
14919
+ outputClasses: z.array(z.string()).readonly(),
14920
+ childSlots: z.array(PipelineSlotSchema).readonly(),
14921
+ models: z.array(PipelineModelOptionSchema).readonly(),
14922
+ defaultModelId: z.string(),
14923
+ defaultModelIdByFormat: z.record(z.string(), z.string()).optional(),
14924
+ enabledByDefault: z.boolean().optional(),
14925
+ backfillIntoExistingOverrides: z.boolean().optional(),
14926
+ defaultConfidence: z.number(),
14927
+ group: z.string().optional(),
14928
+ configSchema: z.array(ConfigFieldBridge).readonly().optional()
14911
14929
  });
14912
- /**
14913
- * Row projection for track list queries. `full` (default) returns the
14914
- * complete Track including the frame-rate `positions[]` history and the
14915
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
14916
- * keeps every scalar the list surfaces actually render (ids, class(es),
14917
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
14918
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
14919
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
14920
- * `getTrack`. Mirrors the event-store `projection` convention
14921
- * (`getObjectEvents` et al.).
14922
- */
14923
- var TrackProjectionSchema = z.enum(["full", "slim"]);
14924
- /**
14925
- * One audio-classification label heard on the track's camera while the
14926
- * track was alive, aggregated per label. An "episode" is one persisted
14927
- * audio event (the confident-classification path: score ≥ the device's
14928
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
14929
- * one 32 ms inference chunk, so counts stay human-scaled.
14930
- */
14931
- var TrackAudioLabelSchema = z.object({
14930
+ var PipelineSlotSchemaSchema = z.object({
14931
+ id: PipelineSlotSchema,
14932
14932
  label: z.string(),
14933
- /** Highest classification score observed across the label's episodes. */
14934
- peakScore: z.number(),
14935
- /** Number of coalesced audio-event episodes carrying this label. */
14936
- count: z.number(),
14937
- firstAt: z.number(),
14938
- lastAt: z.number()
14933
+ priority: z.number(),
14934
+ parentSlot: PipelineSlotSchema.nullable(),
14935
+ addons: z.array(PipelineAddonSchemaSchema).readonly()
14936
+ });
14937
+ var PipelineSchemaSchema = z.object({
14938
+ availableEngines: z.array(AvailableEngineSchema).readonly(),
14939
+ selectedEngine: PipelineEngineChoiceSchema,
14940
+ slots: z.array(PipelineSlotSchemaSchema).readonly()
14941
+ });
14942
+ var EngineProvisioningSchema = z.object({
14943
+ runtimeId: z.enum([
14944
+ "onnx",
14945
+ "openvino",
14946
+ "coreml",
14947
+ "edgetpu"
14948
+ ]).nullable(),
14949
+ device: z.string().nullable(),
14950
+ state: z.enum([
14951
+ "idle",
14952
+ "installing",
14953
+ "verifying",
14954
+ "ready",
14955
+ "failed"
14956
+ ]),
14957
+ progress: z.number().optional(),
14958
+ error: z.string().optional(),
14959
+ nextRetryAt: z.number().optional(),
14960
+ /**
14961
+ * Gate A (config-correctness gate at engine change): human-readable
14962
+ * config issues surfaced EAGERLY when the node's engine changes — model
14963
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
14964
+ * has a <format> build"). Additive/optional: informational only, never
14965
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
14966
+ * Absent/empty when the node-default tree resolves cleanly.
14967
+ */
14968
+ configIssues: z.array(z.string()).optional()
14969
+ });
14970
+ var PipelineStepInputSchema = z.lazy(() => z.object({
14971
+ addonId: z.string(),
14972
+ modelId: z.string().optional(),
14973
+ enabled: z.boolean().default(true),
14974
+ children: z.array(PipelineStepInputSchema).optional(),
14975
+ settings: z.record(z.string(), z.unknown()).optional(),
14976
+ jumpDeviceKey: z.string().optional()
14977
+ }));
14978
+ var ModelSubstitutionSchema = z.object({
14979
+ addonId: z.string(),
14980
+ chosen: z.string(),
14981
+ running: z.string(),
14982
+ format: z.string()
14983
+ });
14984
+ var PipelineValidationIssueSchema = z.object({
14985
+ addonId: z.string(),
14986
+ kind: z.enum(["unknown-addon", "no-format-build"]),
14987
+ detail: z.string()
14988
+ });
14989
+ var PipelineValidationResultSchema = z.object({
14990
+ ok: z.boolean(),
14991
+ issues: z.array(PipelineValidationIssueSchema).readonly(),
14992
+ substitutions: z.array(ModelSubstitutionSchema).readonly(),
14993
+ /** The node's `currentEngine.format` this validation ran against. */
14994
+ format: z.string()
14995
+ });
14996
+ var ReferenceImageEntrySchema = z.object({
14997
+ filename: z.string(),
14998
+ stepIds: z.array(z.string()).readonly().optional()
14999
+ });
15000
+ var ReferenceImageBodySchema = z.object({
15001
+ base64: z.string(),
15002
+ filename: z.string()
15003
+ });
15004
+ var ReferenceAudioEntrySchema = z.object({
15005
+ filename: z.string(),
15006
+ sizeKb: z.number()
15007
+ });
15008
+ var ReferenceAudioBodySchema = z.object({ base64: z.string() });
15009
+ var AudioBackendSchema = z.object({
15010
+ id: z.string(),
15011
+ name: z.string(),
15012
+ description: z.string(),
15013
+ available: z.boolean(),
15014
+ /**
15015
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
15016
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
15017
+ * the benchmark UI to populate the `enabledMicroClasses` filter
15018
+ * specific to the selected backend without a separate fetch.
15019
+ */
15020
+ rawLabels: z.array(z.string()).readonly().optional()
15021
+ });
15022
+ var AudioCapabilitiesSchema = z.object({
15023
+ activeBackend: z.string(),
15024
+ availableBackends: z.array(AudioBackendSchema).readonly(),
15025
+ sampleRate: z.number(),
15026
+ chunkDurationMs: z.number()
15027
+ });
15028
+ var DownloadModelResultSchema = z.object({
15029
+ filePath: z.string(),
15030
+ sizeMB: z.number(),
15031
+ durationMs: z.number()
14939
15032
  });
14940
15033
  /**
14941
- * How a track was produced. `pipeline` (default / absent) = the spatial
14942
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
14943
- * no positions, a single snapshot, and no bbox trajectory at all:
14944
- *
14945
- * - `sensor` a linked sensor/control device state change.
14946
- * - `audio` an audio event on the camera itself that was anomalous for
14947
- * THAT camera, loud, and heard while nothing visual was happening (D62).
14948
- *
14949
- * The spatial subsystems (tracker association, occupancy count, re-id /
14950
- * embedding, resurrection) MUST skip every synthetic source. Test for that
14951
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
14952
- * check silently readmits every source added after it was written.
14953
- */
14954
- var TrackSourceSchema = z.enum([
14955
- "pipeline",
14956
- "sensor",
14957
- "audio"
14958
- ]);
14959
- /**
14960
- * Where a track sits in the RETRAIN lifecycle (D81).
14961
- *
14962
- * - `none` — never marked, or un-marked. Evictable.
14963
- * - `staging` — the operator wants this track as training material and has not
14964
- * finished with it. **This is the only state retention holds**: the track and
14965
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
14966
- * the device's age window.
14967
- * - `trained` — the retrain page has taken what it needed. The frames it chose
14968
- * were COPIED into the retrain dataset at selection time, so the dataset no
14969
- * longer depends on the track's media and the track becomes EVICTABLE again.
14970
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
14971
- * a deliberate action of the retrain page, not a side effect of a checkbox.
14972
- *
14973
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
14974
- * the store's filter language has only positive equality and `whereIn` — no
14975
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
14976
- * would make the entire pre-column history immortal in one deploy.
14977
- */
14978
- var RetrainStatusSchema = z.enum([
14979
- "none",
14980
- "staging",
14981
- "trained"
14982
- ]);
14983
- /**
14984
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
14985
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
14986
- * so the two surfaces cannot drift.
14987
- *
14988
- * **Absent ≠ false.** A track that has never been touched omits the field; an
14989
- * explicitly un-flagged track carries `false`. Legacy rows written before the
14990
- * columns existed read as absent, and a consumer that needs a boolean should say
14991
- * `flag === true`, not `flag !== false`.
14992
- *
14993
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
14994
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
14995
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
14996
- * `trained` track reports `false` while refusing both writes. The boolean is
14997
- * kept because three surfaces drive a toggle off it; anything that needs to tell
14998
- * "never marked" from "already trained" must read `retrainStatus`.
14999
- *
15000
- * `debug` does NOT pin; it is attention, not durability.
15001
- *
15002
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
15003
- * A favourited track is skipped by retention the same way `staging` is, but
15004
- * it does not enter `none|staging|trained` and has no staging budget.
15005
- */
15006
- var TrackFlagFields = {
15007
- /** Operator marked this track as training material — i.e. `retrainStatus` is
15008
- * `'staging'`. */
15009
- markForTrain: z.boolean().optional(),
15010
- /** Operator marked this track for diagnostic attention. */
15011
- debug: z.boolean().optional(),
15012
- /** Operator favourited this track. Pins it against pruning. */
15013
- favourited: z.boolean().optional()
15014
- };
15015
- /**
15016
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
15017
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
15018
- * write patch, and the status is not something the toggle sets — it is what the
15019
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
15020
- * always present on a persisted row (the column default materialises `'none'`).
15021
- */
15022
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
15023
- /**
15024
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
15025
- * one flag can never clear the other — the toggles are independent and are
15026
- * driven from three surfaces that do not know about each other.
15027
- */
15028
- var TrackFlagsPatchSchema = z.object(TrackFlagFields);
15029
- /**
15030
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
15031
- * collapses to `false`) so a caller can drive a toggle's checked state off the
15032
- * mutation result without a re-fetch.
15034
+ * Wrapper carrying a single test run's result. Replaces the legacy
15035
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
15036
+ * canonical `AudioResult` from the Phase 6 output rework: one
15037
+ * `AudioDetection` per class above `minScore`, top-N candidates in
15038
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
15039
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
15040
+ * benchmark UI can still report a clean failure when the classifier
15041
+ * cap isn't available.
15033
15042
  */
15034
- var TrackFlagsSchema = z.object({
15035
- trackId: z.string(),
15036
- markForTrain: z.boolean(),
15037
- debug: z.boolean(),
15038
- favourited: z.boolean(),
15039
- /** The lifecycle state the boolean was derived from. Required here (unlike on
15040
- * a track row) because this shape is only ever produced by the write body,
15041
- * which always knows it — and a surface that has just written needs to render
15042
- * `trained` without a re-fetch. */
15043
- retrainStatus: RetrainStatusSchema
15043
+ var AudioTestResultSchema = z.object({
15044
+ success: z.boolean(),
15045
+ error: z.string().optional(),
15046
+ frame: z.custom().optional()
15044
15047
  });
15048
+ var PipelineConfigBridge = z.custom();
15049
+ var ConfigUISchemaBridge = z.custom();
15050
+ var ConfigUISchemaNullableBridge = z.custom();
15051
+ var InferenceCapabilitiesBridge = z.custom();
15052
+ var ModelAvailabilityListBridge = z.custom();
15053
+ var PipelineRunResultBridge = z.custom();
15045
15054
  /**
15046
- * WHICH tier a label occupies. The slot a label lands in is DECLARED by the
15047
- * step that produced it (`StepDefinition.labelTier`), never inferred from the
15048
- * text or the step's name.
15055
+ * Pipeline executor detection engine + configuration + inference API.
15049
15056
  *
15050
- * - `1` a SUB-CLASS: finer than the macro class, still a taxonomy token.
15051
- * `animal-type` (`dog`, `bird`), `vehicle-type` (`van`), and the root
15052
- * detector's own raw class when it is finer than the macro it maps to.
15053
- * - `2` — an INSTANCE: the finest thing said about this subject.
15054
- * `species` (`Turdus migratorius`), `identity` (`Alice`), `plate-text`.
15057
+ * Merged from: pipeline-executor, pipeline-config, inference, detection-config.
15058
+ * Implemented by the detection-pipeline addon.
15055
15059
  *
15056
- * The macro class itself (`person`, `vehicle`, `animal`, `package`, `face`,
15057
- * `plate`, `audio`) is NOT a tier it is `className`, and a macro token
15058
- * offered for either label slot is refused (2026-08-07 rule; the refusal is
15059
- * logged as `label tier collapse refused`).
15060
+ * Per-device surface (DeviceSettingsContribution + the "is detection
15061
+ * enabled for this camera?" toggle) lives on the paired
15062
+ * `detection-pipeline` cap (device-scoped, singleton, wrapper
15063
+ * defaultActive) same split pattern used by stream-broker /
15064
+ * camera-streams and audio-analyzer / audio-analysis.
15060
15065
  */
15061
- var LabelTierSchema = z.union([z.literal(1), z.literal(2)]);
15062
- /**
15063
- * WHO decided a label, and when. Carried per tier so a value can be traced to
15064
- * the step and model that produced it — which is what makes the write rule
15065
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
15066
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
15066
+ var pipelineExecutorCapability = {
15067
+ name: "pipeline-executor",
15068
+ scope: "system",
15069
+ mode: "singleton",
15070
+ methods: {
15071
+ getAvailableEngines: method(z.void(), z.array(PipelineEngineChoiceSchema)),
15072
+ getSelectedEngine: method(z.void(), PipelineEngineChoiceSchema),
15073
+ getDefaultSteps: method(PipelineEngineChoiceSchema, z.array(PipelineDefaultStepSchema)),
15074
+ /**
15075
+ * Per-node detection-engine provisioning snapshot. Returns the live
15076
+ * state of the lazy runtime-provisioning machine on `nodeId`
15077
+ * (idle / installing / verifying / ready / failed). The UI pairs this
15078
+ * one-shot query with the `pipeline.engine-provisioning` live event
15079
+ * (emitted on every transition) to drive a per-node "engine ready?"
15080
+ * indicator without polling. Phase 2.
15081
+ */
15082
+ getEngineProvisioning: method(z.object({ nodeId: z.string() }), EngineProvisioningSchema),
15083
+ getVideoPipelineSteps: method(z.void(), z.record(z.string(), z.object({
15084
+ modelId: z.string(),
15085
+ settings: z.record(z.string(), z.unknown()).readonly()
15086
+ }))),
15087
+ setVideoPipelineSteps: method(z.object({ steps: z.record(z.string(), z.object({
15088
+ modelId: z.string(),
15089
+ settings: z.record(z.string(), z.unknown()).readonly()
15090
+ })) }), z.object({ success: z.literal(true) }), {
15091
+ kind: "mutation",
15092
+ auth: "admin"
15093
+ }),
15094
+ /**
15095
+ * Clear THIS node's executor-side PER-DEVICE settings stores (the
15096
+ * per-camera step overrides the object-detection root reads via
15097
+ * `applyDeviceOverridesToTree`). `nodeId` is the ROUTING key — the
15098
+ * generated cap-router strips it (default `nodeIdMode: 'routing'`) and
15099
+ * dispatches to that node, so the provider method runs ON the target
15100
+ * node and receives no `nodeId`.
15101
+ *
15102
+ * This is the slimmed executor leg of the orchestrator's
15103
+ * `resetNodePipelineDefaults` flow (which owns the real reset: node
15104
+ * addonDefaults pins + per-camera orchestrator overrides). The legacy
15105
+ * `resetToDefault` — which reset a persisted global step-tree seed
15106
+ * nothing in the live per-camera path read — was removed together with
15107
+ * that seed.
15108
+ */
15109
+ clearDeviceOverrides: method(z.object({ nodeId: z.string() }), z.object({
15110
+ success: z.literal(true),
15111
+ clearedDevices: z.number()
15112
+ }), {
15113
+ kind: "mutation",
15114
+ auth: "admin"
15115
+ }),
15116
+ /**
15117
+ * Which of THIS node's inference devices the executor currently refuses,
15118
+ * and why. `nodeId` is the ROUTING key (stripped by the generated router).
15119
+ *
15120
+ * The channel that did not exist. Pool health was known only inside the
15121
+ * detection addon and was an input to no routing decision anywhere: the
15122
+ * per-dispatch capability gate is keyed on model FORMAT and so can never
15123
+ * separate `openvino:gpu` from `openvino:npu`, and the orchestrator's live
15124
+ * eligibility probe (`platformProbe.getCapabilities`) answers about
15125
+ * HARDWARE — which was present throughout. So when the hub's `openvino:gpu`
15126
+ * Python worker was SIGABRT'd by the Intel GPU plugin on 2026-08-25, the
15127
+ * balancer went on handing that dead pool cameras by rotation for 31 hours:
15128
+ * ~370 000 `PoolWorker[w0]: not initialized` lines, every frame lost.
15129
+ *
15130
+ * Read semantics the caller depends on, and which the provider guarantees:
15131
+ * this is a synchronous read of in-memory state. It never probes hardware,
15132
+ * never spawns a pool and never throws — an EMPTY `unhealthy` means "asked,
15133
+ * nothing is refused", which is what re-admits a device. A read that FAILS
15134
+ * (node offline, version skew) must therefore be distinguishable from an
15135
+ * empty answer, and it is: it rejects.
15136
+ */
15137
+ getInferenceDeviceHealth: method(z.object({ nodeId: z.string() }), z.object({ unhealthy: z.array(z.object({
15138
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
15139
+ deviceKey: z.string(),
15140
+ /**
15141
+ * `failed` — the per-device restart budget is exhausted; no pool
15142
+ * will be spawned until an operator re-arms it or the runner
15143
+ * respawns. `backoff` — under budget, waiting out the backoff (or
15144
+ * a cached pool observed dead and not yet condemned).
15145
+ */
15146
+ state: z.enum(["failed", "backoff"]),
15147
+ /** Epoch ms of the death that produced this state. */
15148
+ since: z.number(),
15149
+ /** Pool deaths inside the current window. */
15150
+ deaths: z.number(),
15151
+ /** The last death's message. */
15152
+ lastError: z.string()
15153
+ })).readonly() })),
15154
+ /**
15155
+ * Re-arm a terminally `failed` inference device on `nodeId`: forget its
15156
+ * restart budget so the next dispatch builds a fresh pool.
15157
+ *
15158
+ * The terminal state is deliberate (the abort it bounds is deterministic —
15159
+ * an automatic probation would just respawn Python forever, more slowly),
15160
+ * and a terminal state an operator cannot leave is a silent fault. This is
15161
+ * the way out. `rearmed:false` means there was nothing to forget.
15162
+ */
15163
+ rearmInferenceDevice: method(z.object({
15164
+ nodeId: z.string(),
15165
+ deviceKey: z.string()
15166
+ }), z.object({ rearmed: z.boolean() }), {
15167
+ kind: "mutation",
15168
+ auth: "admin"
15169
+ }),
15170
+ getSchema: method(z.void(), PipelineSchemaSchema),
15171
+ getGlobalSteps: method(z.void(), z.array(PipelineDefaultStepSchema).readonly().nullable()),
15172
+ getGlobalPipelineConfig: method(z.void(), PipelineConfigBridge),
15173
+ getOrchestratorConfigSchema: method(z.void(), ConfigUISchemaBridge),
15174
+ /**
15175
+ * Gate B (pre-init config-correctness gate). PURE COMPUTE against this
15176
+ * node's `currentEngine.format` — resolves `steps` the same way the
15177
+ * runtime dispatch path would, and reports what WOULD happen without
15178
+ * touching any node-global state. Called by the orchestrator at attach
15179
+ * time (`attachOn`), node-pinned to the TARGET node, so config problems
15180
+ * surface BEFORE `pipelineRunner.attachCamera` rather than at the first
15181
+ * per-frame resolve. `ok` is false iff `issues` is non-empty (both
15182
+ * `unknown-addon` and `no-format-build` are HARD issues); `substitutions`
15183
+ * is informational (a degraded-but-loadable model swap) and never
15184
+ * affects `ok`. Never throws.
15185
+ */
15186
+ validatePipeline: method(z.object({ steps: z.array(PipelineStepInputSchema) }), PipelineValidationResultSchema),
15187
+ listTemplates: method(z.void(), z.array(PipelineTemplateSchema$1).readonly()),
15188
+ saveTemplate: method(z.object({
15189
+ name: z.string(),
15190
+ steps: z.array(PipelineTemplateStepSchema).readonly(),
15191
+ engine: PipelineEngineChoiceSchema
15192
+ }), PipelineTemplateSchema$1, { kind: "mutation" }),
15193
+ updateTemplate: method(z.object({
15194
+ id: z.string(),
15195
+ name: z.string().optional(),
15196
+ steps: z.array(PipelineTemplateStepSchema).readonly().optional()
15197
+ }), PipelineTemplateSchema$1, { kind: "mutation" }),
15198
+ deleteTemplate: method(z.object({ id: z.string() }), z.void(), { kind: "mutation" }),
15199
+ getCapabilities: method(z.void(), InferenceCapabilitiesBridge),
15200
+ getAddonModels: method(z.object({ addonId: z.string() }), ModelAvailabilityListBridge),
15201
+ downloadModel: method(z.object({
15202
+ addonId: z.string(),
15203
+ modelId: z.string(),
15204
+ format: ModelFormatSchema$1
15205
+ }), DownloadModelResultSchema, { kind: "mutation" }),
15206
+ deleteModel: method(z.object({
15207
+ addonId: z.string(),
15208
+ modelId: z.string(),
15209
+ format: ModelFormatSchema$1
15210
+ }), z.object({ success: z.literal(true) }), { kind: "mutation" }),
15211
+ /**
15212
+ * Stateless single-frame execution. Callers (runner, benchmark) pass
15213
+ * the complete `engine` + `steps` tree; the executor holds no state
15214
+ * about cameras or saved pipelines.
15215
+ *
15216
+ * `engine` is optional during the migration window to preserve the
15217
+ * legacy call shape used by existing benchmark code; once all
15218
+ * callers pass it explicitly we make it required.
15219
+ *
15220
+ * Exactly one of `frame`, `frameRef`, `frameHandle`, `imageBase64`,
15221
+ * `referenceImage` must be provided:
15222
+ * - `frame`: runtime dispatch path (runner → decoded broker frame).
15223
+ * Carries the raw buffer, dimensions, and format; the executor
15224
+ * uses it directly without base64 round-tripping.
15225
+ * - `frameHandle` (CB5): a zero-pixel shm `FrameHandle` for the SAME
15226
+ * decoded frame. Both runner and executor are hub-local processes
15227
+ * sharing `/dev/shm`, so the executor maps the named segment and
15228
+ * reads the pixels back zero-copy — eliminating the ~1.2MB
15229
+ * re-serialisation over UDS/MsgPack the `frame` path pays per call.
15230
+ * High-risk: the FrameRing is a latest-wins seqlock with no
15231
+ * refcount, so a recycled slot yields a null read; the executor
15232
+ * then degrades to an empty result and the runner ships pixels via
15233
+ * `frame` as the fallback (queue-depth gated on the runner side).
15234
+ * - `imageBase64`: one-shot test path (benchmark ImageTab).
15235
+ * - `referenceImage`: named file from the reference-image store.
15236
+ */
15237
+ runPipeline: method(z.object({
15238
+ engine: PipelineEngineChoiceSchema.optional(),
15239
+ steps: z.array(PipelineStepInputSchema).min(1),
15240
+ frame: FrameInputSchema.optional(),
15241
+ /**
15242
+ * Process-local lazy frame. Valid only when caller and provider resolve
15243
+ * in the same execution-group process; split/cross-node callers use
15244
+ * `frame`/`image` inline compatibility instead.
15245
+ */
15246
+ frameRef: FrameRefSchema.optional(),
15247
+ /**
15248
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
15249
+ * the decoded pixels live in. One more member of the one-of
15250
+ * frame/frameHandle/image/imageBase64/referenceImage group.
15251
+ */
15252
+ frameHandle: FrameHandleSchema.optional(),
15253
+ imageBase64: z.string().optional(),
15254
+ /**
15255
+ * Binary JPEG bytes — preferred over `imageBase64` on internal
15256
+ * hops (hub → forked worker via Moleculer MsgPack) because it
15257
+ * skips the 33% base64 overhead + the per-call base64 decode on
15258
+ * the detection-pipeline worker. Callers can pass either; exactly
15259
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
15260
+ */
15261
+ image: z.instanceof(Uint8Array).optional(),
15262
+ referenceImage: z.string().optional(),
15263
+ deviceId: z.number().optional(),
15264
+ sessionId: z.string().optional(),
15265
+ /**
15266
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
15267
+ * reference-image, and detail-subtree calls. 'frame' is the live
15268
+ * per-frame dispatch: ONLY root-plane steps run; crop children
15269
+ * (inputClasses ≠ null) are skipped and served per-track via
15270
+ * pipelineRunner.runDetailSubtree (two-plane design).
15271
+ */
15272
+ plane: z.enum(["full", "frame"]).optional(),
15273
+ /**
15274
+ * Inference-device selector (Phase 2 multi-device). Format
15275
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
15276
+ * Omitted ⇒ the runner's default device (current single-engine
15277
+ * behaviour). Selects WHICH device pool of the node runs the call.
15278
+ */
15279
+ deviceKey: z.string().optional(),
15280
+ /**
15281
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
15282
+ * when the parent crop was resolved from the frame's retained NATIVE
15283
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
15284
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
15285
+ * resolution from that surface — the SAME quality path faces already
15286
+ * had — instead of the downscaled parent tile. `handle` keys the native
15287
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
15288
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
15289
+ * the executor's crop-normalized child ROI back into frame-normalized
15290
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
15291
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
15292
+ * (today's behaviour on the fallback path).
15293
+ */
15294
+ nativeCropRef: NativeCropRefSchema.optional()
15295
+ }), PipelineRunResultBridge, { kind: "mutation" }),
15296
+ /**
15297
+ * Batched run — N raw frames packed into one cap call. The provider
15298
+ * routes the batch through `SharedInferencePool.inferBatch`
15299
+ * (`MSG_INFER_BATCH = 0x03`) so the IPC framing and JSON response
15300
+ * envelope cost is amortised N:1 vs N concurrent `runPipeline`
15301
+ * calls. Single root step + uniform model assumed; trees with crop
15302
+ * children fall back to sequential execution.
15303
+ *
15304
+ * Used by `scripts/bench-batch-style.mts` for batch benchmarking —
15305
+ * N frames in one call to amortise per-call IPC overhead.
15306
+ */
15307
+ runPipelineBatch: method(z.object({
15308
+ engine: PipelineEngineChoiceSchema.optional(),
15309
+ steps: z.array(PipelineStepInputSchema).min(1),
15310
+ frames: z.array(FrameInputSchema).min(1).max(255),
15311
+ deviceId: z.number().optional(),
15312
+ sessionId: z.string().optional(),
15313
+ /**
15314
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
15315
+ * the batch to the Python pool's bench preprocess cache
15316
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
15317
+ * preprocessed ONCE and every later inference is a pure-inference cache
15318
+ * hit — the sustained-throughput run measures inference, not
15319
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
15320
+ * full preprocess every call, correct). Fresh per sustained run;
15321
+ * released via `uncacheFrame`.
15322
+ */
15323
+ frameId: z.number().int().nonnegative().optional(),
15324
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
15325
+ deviceKey: z.string().optional()
15326
+ }), z.object({ results: z.array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }),
15327
+ /**
15328
+ * Cache a raw frame inside the Python inference pool's memory.
15329
+ * Returns a numeric `frameId` that `inferCached` references —
15330
+ * subsequent calls send only 5 bytes through the pipe instead of
15331
+ * 1.2MB raw data, eliminating the pipe transfer bottleneck.
15332
+ */
15333
+ cacheFrameInPool: method(z.object({
15334
+ data: z.instanceof(Uint8Array),
15335
+ width: z.number().int().positive(),
15336
+ height: z.number().int().positive(),
15337
+ format: z.enum([
15338
+ "rgb",
15339
+ "bgr",
15340
+ "gray"
15341
+ ])
15342
+ }), z.object({
15343
+ frameId: z.number(),
15344
+ width: z.number(),
15345
+ height: z.number()
15346
+ }), { kind: "mutation" }),
15347
+ /**
15348
+ * Run inference on a previously cached frame. Sends only 5 bytes
15349
+ * (model_idx + frameId) through the IPC pipe — eliminates the
15350
+ * ~35ms per-call overhead of transferring 1.2MB raw data.
15351
+ */
15352
+ inferCached: method(z.object({
15353
+ stepId: z.string(),
15354
+ frameId: z.number().int()
15355
+ }), z.record(z.string(), z.unknown()), { kind: "mutation" }),
15356
+ /**
15357
+ * Release a cached frame from the Python pool's memory.
15358
+ */
15359
+ uncacheFrame: method(z.object({ frameId: z.number().int() }), z.void(), { kind: "mutation" }),
15360
+ /** Returns the effective pool tuning (resolved from user overrides + backend defaults). */
15361
+ getEffectiveTuning: method(z.void(), z.object({
15362
+ batchMode: z.string(),
15363
+ windowMs: z.number(),
15364
+ maxBatchSize: z.number(),
15365
+ concurrency: z.number()
15366
+ })),
15367
+ /**
15368
+ * List every EngineFactory currently loaded in this executor's RAM,
15369
+ * with the models resident and a coarse "in use" marker derived from
15370
+ * ongoing inference activity. Used by the Pipeline page Engines tab.
15371
+ */
15372
+ listLoadedEngines: method(z.void(), z.array(z.object({
15373
+ engineKey: z.string(),
15374
+ engine: PipelineEngineChoiceSchema,
15375
+ modelsLoaded: z.array(z.string()).readonly(),
15376
+ inUseByCameras: z.array(z.number()).readonly(),
15377
+ /**
15378
+ * Origin of this resident factory.
15379
+ * - `runtime` — main camera-serving engine (no idle TTL).
15380
+ * - `warm-override` — benchmark/test override held in the warm
15381
+ * cache; auto-disposed after the idle TTL.
15382
+ * - `device-pool` — a concurrent per-device pool (Phase 2
15383
+ * multi-device, keyed by `deviceKey`) resolved
15384
+ * via `resolveDeviceFactory`. Runs alongside the
15385
+ * `runtime` engine on a DIFFERENT accelerator
15386
+ * (NPU / iGPU / Coral) — this is how the
15387
+ * Engines tab shows all pools running at once.
15388
+ */
15389
+ kind: z.enum([
15390
+ "runtime",
15391
+ "warm-override",
15392
+ "device-pool"
15393
+ ]),
15394
+ /** Native pid of the underlying Python pool (null when no pool). */
15395
+ poolPid: z.number().nullable(),
15396
+ /** ms since this factory was last used (null when not warm-tracked). */
15397
+ idleMs: z.number().nullable(),
15398
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
15399
+ idleTtlMs: z.number().nullable()
15400
+ })).readonly()),
15401
+ /** Warm up an engine without running a frame. No-op if already loaded. */
15402
+ spinEngine: method(z.object({ engine: PipelineEngineChoiceSchema }), z.object({ success: z.literal(true) }), {
15403
+ kind: "mutation",
15404
+ auth: "admin"
15405
+ }),
15406
+ /**
15407
+ * Unload an engine from RAM. `force:true` unloads even when cameras
15408
+ * are actively using it (they re-spin on next frame). Default is
15409
+ * gated — returns `{success:false, reason}` when in use.
15410
+ */
15411
+ killEngine: method(z.object({
15412
+ engine: PipelineEngineChoiceSchema,
15413
+ force: z.boolean().optional()
15414
+ }), z.object({
15415
+ success: z.boolean(),
15416
+ reason: z.string().optional()
15417
+ }), {
15418
+ kind: "mutation",
15419
+ auth: "admin"
15420
+ }),
15421
+ listReferenceImages: method(z.void(), z.array(ReferenceImageEntrySchema).readonly()),
15422
+ getReferenceImage: method(z.object({ filename: z.string() }), ReferenceImageBodySchema.nullable()),
15423
+ getReferenceAudioFiles: method(z.void(), z.array(ReferenceAudioEntrySchema).readonly()),
15424
+ getReferenceAudio: method(z.object({ filename: z.string() }), ReferenceAudioBodySchema.nullable()),
15425
+ getAudioCapabilities: method(z.void(), AudioCapabilitiesSchema),
15426
+ runAudioTest: method(z.object({
15427
+ addonId: z.string(),
15428
+ modelId: z.string(),
15429
+ filename: z.string().optional(),
15430
+ settings: z.record(z.string(), z.unknown()).optional()
15431
+ }), AudioTestResultSchema, { kind: "mutation" }),
15432
+ getDetectionConfigSchema: method(z.void(), ConfigUISchemaNullableBridge)
15433
+ }
15434
+ };
15435
+ //#endregion
15436
+ //#region src/capabilities/schemas/zone-rule.ts
15437
+ /**
15438
+ * Per-stage gating mode applied to the zones a rule references.
15067
15439
  *
15068
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
15069
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
15070
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
15071
- * that value has no provenance, and the write rule lets ANY properly-attributed
15072
- * write of the same tier replace it regardless of score.
15440
+ * - `include`: the rule contributes to a **whitelist** for its stage.
15441
+ * When at least one `include` rule fires for a stage, only entities
15442
+ * inside one of those zones pass that stage.
15443
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
15444
+ * Entities inside one of those zones are dropped at that stage.
15445
+ *
15446
+ * `monitor`-style observation (count without filtering) is not a rule
15447
+ * mode — zones without any matching rule are observed naturally by
15448
+ * `zone-analytics` (live snapshot + history), so an "I just want to
15449
+ * count, not filter" use case needs no rule at all.
15073
15450
  */
15074
- var LabelAttributionSchema = z.object({
15075
- stepId: z.string(),
15076
- modelId: z.string().optional(),
15077
- decidedAt: z.number(),
15451
+ var ZoneRuleModeEnum = z.enum(["include", "exclude"]);
15452
+ /**
15453
+ * Per-consumer rule that references existing zones (geometry) and
15454
+ * defines how a specific pipeline stage should treat them. Each
15455
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
15456
+ * settings:
15457
+ *
15458
+ * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
15459
+ * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
15460
+ * - future: notification rules, audio gating, etc.
15461
+ *
15462
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
15463
+ * express "ignore motion in ALL of {garden, street}" with a single
15464
+ * rule. `classFilter` narrows the rule to specific object classes —
15465
+ * "drop person detections in the street, but keep cars" is one
15466
+ * `exclude` rule with `classFilter: ['person']`.
15467
+ *
15468
+ * `enabled` is a soft toggle — the operator can keep the rule
15469
+ * configured but inert without deleting it.
15470
+ */
15471
+ var ZoneRuleSchema = z.object({
15472
+ /** Stable rule id — survives edits, used by the UI for diffing. */
15473
+ id: z.string(),
15474
+ /** Optional human-readable label rendered in the rule editor. */
15475
+ name: z.string().optional(),
15476
+ /** Zones this rule targets. The rule's `mode` applies to ALL
15477
+ * listed zones (OR-set: a detection in any one of them counts).
15478
+ * At least one zone id required — a rule with no targets is a
15479
+ * configuration mistake and the form validator rejects it. */
15480
+ zoneIds: z.array(z.string()).min(1).readonly(),
15481
+ mode: ZoneRuleModeEnum,
15078
15482
  /**
15079
- * The GALLERY id behind a recognised tier-2 label a face-gallery
15080
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
15081
- *
15082
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
15083
- * notification rule authored on "Gianluca" stopped matching the moment the
15084
- * operator fixed the spelling in the gallery, and nothing said so. The id is
15085
- * the thing that does not move, so it is what a rule matches on
15086
- * (`NcConditions.identities`) and the text is what a human is shown.
15483
+ * Class names this rule applies to. Empty / undefined rule
15484
+ * applies to every class. Class strings match the `macroClass`
15485
+ * field on detections (e.g. `person`, `car`, `dog`).
15486
+ */
15487
+ classFilter: z.array(z.string()).readonly().optional(),
15488
+ /**
15489
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
15490
+ * required to consider an entity "in the zone". Defaults to the
15491
+ * consumer's stage default when omitted. Kept for back-compat with
15492
+ * existing per-rule overrides; new operators pick the value via
15493
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
15494
+ * set, the lower-level engine reads it as a 0–1 fraction.
15495
+ */
15496
+ overlapThreshold: z.number().min(0).max(1).optional(),
15497
+ /**
15498
+ * Operator-friendly version of `overlapThreshold` — the percentage
15499
+ * of the detection's bbox that must lie inside the zone for the
15500
+ * rule to match. Documented default is 85%; the engine substitutes
15501
+ * that when the field is omitted (kept optional so existing rules
15502
+ * stored without it stay valid).
15087
15503
  *
15088
- * Absent when the label names no gallery row a plate the OCR read but no
15089
- * vehicle claims, a sub-class, a species, any tier-1 value.
15504
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
15505
+ * rule, the engine prefers `bboxInclusionPct` because it's the
15506
+ * field exposed in the UI. Internally both feed the same gate.
15090
15507
  */
15091
- identityId: z.string().optional()
15508
+ bboxInclusionPct: z.number().min(0).max(100).optional(),
15509
+ /**
15510
+ * When `true` and a detection has a segmentation mask, use the
15511
+ * mask for overlap instead of the bbox. Detection-stage only;
15512
+ * motion rules ignore this field.
15513
+ */
15514
+ preferMask: z.boolean().optional(),
15515
+ /**
15516
+ * Soft-toggle: `false` disables the rule without deleting it.
15517
+ * Defaults to `true` so operators creating a rule via the UI
15518
+ * see it active immediately.
15519
+ */
15520
+ enabled: z.boolean().default(true)
15092
15521
  });
15093
15522
  /**
15094
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
15095
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
15096
- * track and its events always answer the same question the same way.
15523
+ * Convenience array schema used by addon device-settings
15524
+ * contributions and runtime payloads (e.g. `RunnerCameraConfig`).
15525
+ */
15526
+ var ZoneRulesArraySchema = z.array(ZoneRuleSchema).readonly();
15527
+ //#endregion
15528
+ //#region src/capabilities/zones.cap.ts
15529
+ /**
15530
+ * Zone — pure geometry + identity. NO filtering behaviour.
15097
15531
  *
15098
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
15099
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
15100
- * is tier 2, and each carries its own score + attribution.
15532
+ * Zones describe **where** in the frame the operator wants to flag
15533
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
15534
+ * each pipeline stage uses them. Splitting the two means a single
15535
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
15536
+ * a detection-include rule on `['car']`, and an occupancy aggregate
15537
+ * — without three duplicated polygons.
15101
15538
  *
15102
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
15103
- * finest thing known. Before 4g the single `label` column held the finest
15104
- * value, so a consumer that has not been updated reads the tier-1 slot and
15105
- * shows nothing on a species-only row; that is why the migration puts every
15106
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
15107
- * and why the read surfaces were changed in the same train.
15539
+ * Owned by the orchestrator addon (provider) and mirrored into the
15540
+ * `zones` device-state slice on every mutation. Consumers
15541
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
15542
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
15543
+ * mirror with `onChanged`).
15108
15544
  *
15109
- * **Writing it.** The slots are independent, which is the whole point: a
15110
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
15111
- * migratorius`), so fineness cannot regress by construction. Within a tier the
15112
- * higher score wins. One rule, one implementation — see
15113
- * `pipeline/label-tier.ts` in addon-post-analysis.
15545
+ * Coordinates are normalised fractions of the frame (0–1) so zones
15546
+ * survive resolution changes and stream profile switches.
15547
+ *
15548
+ * `kind` discriminates between full polygons (closed regions used
15549
+ * for intrusion / occupancy filters) and tripwires (open 2-point
15550
+ * line segments used for cross events). Onboard / firmware-reported
15551
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
15552
+ * task list.
15114
15553
  */
15115
- var TieredLabelFields = {
15116
- /** Tier 1 the sub-class. See {@link LabelTierSchema}. */
15117
- label: z.string().optional(),
15118
- /** Confidence of the tier-1 value, as reported by the deciding step. */
15119
- labelScore: z.number().optional(),
15120
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
15121
- labelMeta: LabelAttributionSchema.optional(),
15122
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
15123
- subLabel: z.string().optional(),
15124
- /** Confidence of the tier-2 value, as reported by the deciding step. */
15125
- subLabelScore: z.number().optional(),
15126
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
15127
- subLabelMeta: LabelAttributionSchema.optional()
15128
- };
15129
- /** Per-camera slice of a training-export estimate. */
15130
- var TrainingExportDeviceTotalsSchema = z.object({
15131
- deviceId: z.number(),
15132
- tracks: z.number().int(),
15133
- files: z.number().int(),
15134
- bytes: z.number().int()
15554
+ var ZoneKindEnum = z.enum(["polygon", "tripwire"]);
15555
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
15556
+ var PolygonPointSchema = z.object({
15557
+ x: z.number(),
15558
+ y: z.number()
15135
15559
  });
15136
- /**
15137
- * What a training export WOULD contain. Computed from media index rows only —
15138
- * no blob is read to produce this.
15139
- */
15140
- var TrainingExportSummarySchema = z.object({
15141
- generatedAt: z.number(),
15142
- trackCount: z.number().int(),
15560
+ /** A camera detection zone — pure geometry/identity. */
15561
+ var ZoneSchema = z.object({
15562
+ id: z.string(),
15563
+ name: z.string(),
15564
+ kind: ZoneKindEnum.default("polygon"),
15565
+ /** Polygon vertices, fraction of frame (0–1). */
15566
+ polygon: z.array(PolygonPointSchema).readonly(),
15567
+ /** Visual color for UI rendering. */
15568
+ color: z.string().default("#3b82f6")
15569
+ });
15570
+ /**
15571
+ * Zones capability — per-camera CRUD over polygon detection zones.
15572
+ *
15573
+ * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
15574
+ * to per-device settings and mirrors into the `zones` device-state
15575
+ * slice on every mutation, so downstream consumers can subscribe via
15576
+ * `dev.state.zones.onChanged`.
15577
+ *
15578
+ * The cap surface only handles geometry + identity; filtering
15579
+ * behaviour (per-class, include/exclude, threshold) lives in the
15580
+ * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
15581
+ * `capabilities/schemas/zone-rule.js`.
15582
+ */
15583
+ var zonesCapability = {
15584
+ name: "zones",
15585
+ scope: "device",
15586
+ mode: "singleton",
15587
+ deviceTypes: [DeviceType.Camera],
15588
+ methods: {
15589
+ listZones: method(z.object({ deviceId: z.number() }), z.array(ZoneSchema).readonly()),
15590
+ addZone: method(z.object({
15591
+ deviceId: z.number(),
15592
+ zone: ZoneSchema
15593
+ }), z.void(), {
15594
+ kind: "mutation",
15595
+ auth: "admin"
15596
+ }),
15597
+ removeZone: method(z.object({
15598
+ deviceId: z.number(),
15599
+ zoneId: z.string()
15600
+ }), z.void(), {
15601
+ kind: "mutation",
15602
+ auth: "admin"
15603
+ }),
15604
+ updateZone: method(z.object({
15605
+ deviceId: z.number(),
15606
+ zone: ZoneSchema
15607
+ }), z.void(), {
15608
+ kind: "mutation",
15609
+ auth: "admin"
15610
+ })
15611
+ },
15612
+ /**
15613
+ * Runtime-state slice — the live zone catalogue mirrored by the
15614
+ * orchestrator on every CRUD mutation. Consumers read via
15615
+ * `device.state.zones.value` / `.watch(...)` without round-tripping
15616
+ * the cap, and the codegen DeviceProxy auto-wires the reactive
15617
+ * handle. Slice shape is `{ zones: Zone[] }` so future extensions
15618
+ * (e.g. zone groupings) can sit alongside the polygon list.
15619
+ */
15620
+ runtimeState: z.object({ zones: z.array(ZoneSchema).readonly() }),
15621
+ /**
15622
+ * Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
15623
+ *
15624
+ * See `RuntimeStateDurability`. Enforced by
15625
+ * `scripts/check-runtime-state-durability.ts`.
15626
+ */
15627
+ durability: "restored"
15628
+ };
15629
+ //#endregion
15630
+ //#region src/capabilities/pipeline-analytics.cap.ts
15631
+ /**
15632
+ * pipeline-analytics — device-scoped wrapper cap. Refines raw
15633
+ * per-frame detections emitted by the pipeline runner into tracked
15634
+ * objects, per-kind event collections (motion / object / audio), and
15635
+ * persisted media. Owns the post-detection domain end-to-end:
15636
+ *
15637
+ * runner emits PipelineInferenceResult
15638
+ * ↓ (event bus)
15639
+ * pipeline-analytics subscriber
15640
+ * ↓ SORT tracker + zone engine + state analyzer + event emitter
15641
+ * → three DB collections (one per kind), one FS media tree, one
15642
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
15643
+ * DetectionEvent on bus)
15644
+ *
15645
+ * Pure subscriber model. No `processFrame` cap method — the runner
15646
+ * already publishes the raw frame on the bus. The cap surface is
15647
+ * only QUERIES + per-device settings, bound on/off via
15648
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
15649
+ * every camera with a detection pipeline wants its raw detections
15650
+ * refined; operators opt out per-device via BindingsTab when needed.
15651
+ *
15652
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
15653
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
15654
+ */
15655
+ var TrackStateSchema = z.enum([
15656
+ "new",
15657
+ "entered",
15658
+ "left",
15659
+ "moving",
15660
+ "idle"
15661
+ ]);
15662
+ var EventKindSchema = z.enum([
15663
+ "motion",
15664
+ "object",
15665
+ "audio"
15666
+ ]);
15667
+ /**
15668
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
15669
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
15670
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
15671
+ */
15672
+ var TrackZoneFilterSchema = z.discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
15673
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
15674
+ var EventKindIconSchema = z.enum([
15675
+ "motion",
15676
+ "audio",
15677
+ "person",
15678
+ "vehicle",
15679
+ "animal",
15680
+ "door",
15681
+ "pir",
15682
+ "smoke",
15683
+ "water",
15684
+ "button",
15685
+ "package",
15686
+ "generic"
15687
+ ]);
15688
+ var EventKindCategorySchema = z.enum([
15689
+ "motion",
15690
+ "audio",
15691
+ "detection",
15692
+ "sensor",
15693
+ "control",
15694
+ "custom",
15695
+ "package"
15696
+ ]);
15697
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
15698
+ var EventKindLevelSchema = z.enum(["macro", "sub"]);
15699
+ var EventKindDescriptorSchema = z.object({
15700
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15701
+ kind: z.string(),
15702
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
15703
+ labelKey: z.string(),
15704
+ /** English fallback label (kept for clients that don't translate). */
15705
+ label: z.string(),
15706
+ /** Hex color for timeline/legend rendering. */
15707
+ color: z.string(),
15708
+ /** Dictionary id → lucide component on the UI side. */
15709
+ iconId: z.string(),
15710
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15711
+ icon: EventKindIconSchema,
15712
+ category: EventKindCategorySchema,
15713
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
15714
+ parentKind: z.string().nullable(),
15715
+ /** Derived from `parentKind`, explicit for the client tree. */
15716
+ level: EventKindLevelSchema,
15717
+ /** Which cap + device contributes this kind. For built-ins the camera
15718
+ * itself; for sensor kinds the LINKED source device. */
15719
+ source: z.object({
15720
+ capName: z.string(),
15721
+ deviceId: z.number()
15722
+ })
15723
+ });
15724
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
15725
+ var EventKindsForDeviceSchema = z.object({
15726
+ deviceId: z.number(),
15727
+ kinds: z.array(EventKindDescriptorSchema).readonly()
15728
+ });
15729
+ var SensorEventSchema = z.object({
15730
+ id: z.string(),
15731
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
15732
+ * yields N rows, one per camera). */
15733
+ deviceId: z.number(),
15734
+ /** The linked sensor device whose state changed. */
15735
+ sourceDeviceId: z.number(),
15736
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
15737
+ kind: z.string(),
15738
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
15739
+ value: z.record(z.string(), z.unknown()).nullable(),
15740
+ timestamp: z.number()
15741
+ });
15742
+ var TrackPositionSchema = z.object({
15743
+ x: z.number(),
15744
+ y: z.number(),
15745
+ timestamp: z.number(),
15746
+ bbox: BoundingBoxSchema
15747
+ });
15748
+ var TrackSnapshotSchema = z.object({
15749
+ timestamp: z.number(),
15750
+ position: TrackPositionSchema,
15751
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
15752
+ mediaKey: z.string()
15753
+ });
15754
+ /**
15755
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
15756
+ * divided by the track's detection-frame dims), computed at persist time.
15757
+ * Absent when the frame dims were unknown when the track was persisted
15758
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
15759
+ */
15760
+ var TrackEnvelopeSchema = z.object({
15761
+ minX: z.number(),
15762
+ minY: z.number(),
15763
+ maxX: z.number(),
15764
+ maxY: z.number()
15765
+ });
15766
+ /**
15767
+ * Row projection for track list queries. `full` (default) returns the
15768
+ * complete Track including the frame-rate `positions[]` history and the
15769
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
15770
+ * keeps every scalar the list surfaces actually render (ids, class(es),
15771
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
15772
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
15773
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
15774
+ * `getTrack`. Mirrors the event-store `projection` convention
15775
+ * (`getObjectEvents` et al.).
15776
+ */
15777
+ var TrackProjectionSchema = z.enum(["full", "slim"]);
15778
+ /**
15779
+ * One audio-classification label heard on the track's camera while the
15780
+ * track was alive, aggregated per label. An "episode" is one persisted
15781
+ * audio event (the confident-classification path: score ≥ the device's
15782
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
15783
+ * one 32 ms inference chunk, so counts stay human-scaled.
15784
+ */
15785
+ var TrackAudioLabelSchema = z.object({
15786
+ label: z.string(),
15787
+ /** Highest classification score observed across the label's episodes. */
15788
+ peakScore: z.number(),
15789
+ /** Number of coalesced audio-event episodes carrying this label. */
15790
+ count: z.number(),
15791
+ firstAt: z.number(),
15792
+ lastAt: z.number()
15793
+ });
15794
+ /**
15795
+ * How a track was produced. `pipeline` (default / absent) = the spatial
15796
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
15797
+ * no positions, a single snapshot, and no bbox trajectory at all:
15798
+ *
15799
+ * - `sensor` — a linked sensor/control device state change.
15800
+ * - `audio` — an audio event on the camera itself that was anomalous for
15801
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
15802
+ *
15803
+ * The spatial subsystems (tracker association, occupancy count, re-id /
15804
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
15805
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
15806
+ * check silently readmits every source added after it was written.
15807
+ */
15808
+ var TrackSourceSchema = z.enum([
15809
+ "pipeline",
15810
+ "sensor",
15811
+ "audio"
15812
+ ]);
15813
+ /**
15814
+ * Where a track sits in the RETRAIN lifecycle (D81).
15815
+ *
15816
+ * - `none` — never marked, or un-marked. Evictable.
15817
+ * - `staging` — the operator wants this track as training material and has not
15818
+ * finished with it. **This is the only state retention holds**: the track and
15819
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
15820
+ * the device's age window.
15821
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
15822
+ * were COPIED into the retrain dataset at selection time, so the dataset no
15823
+ * longer depends on the track's media and the track becomes EVICTABLE again.
15824
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
15825
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
15826
+ *
15827
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
15828
+ * the store's filter language has only positive equality and `whereIn` — no
15829
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
15830
+ * would make the entire pre-column history immortal in one deploy.
15831
+ */
15832
+ var RetrainStatusSchema = z.enum([
15833
+ "none",
15834
+ "staging",
15835
+ "trained"
15836
+ ]);
15837
+ /**
15838
+ * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
15839
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
15840
+ * so the two surfaces cannot drift.
15841
+ *
15842
+ * **Absent ≠ false.** A track that has never been touched omits the field; an
15843
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
15844
+ * columns existed read as absent, and a consumer that needs a boolean should say
15845
+ * `flag === true`, not `flag !== false`.
15846
+ *
15847
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
15848
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
15849
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
15850
+ * `trained` track reports `false` while refusing both writes. The boolean is
15851
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
15852
+ * "never marked" from "already trained" must read `retrainStatus`.
15853
+ *
15854
+ * `debug` does NOT pin; it is attention, not durability.
15855
+ *
15856
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
15857
+ * A favourited track is skipped by retention the same way `staging` is, but
15858
+ * it does not enter `none|staging|trained` and has no staging budget.
15859
+ */
15860
+ var TrackFlagFields = {
15861
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
15862
+ * `'staging'`. */
15863
+ markForTrain: z.boolean().optional(),
15864
+ /** Operator marked this track for diagnostic attention. */
15865
+ debug: z.boolean().optional(),
15866
+ /** Operator favourited this track. Pins it against pruning. */
15867
+ favourited: z.boolean().optional()
15868
+ };
15869
+ /**
15870
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
15871
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
15872
+ * write patch, and the status is not something the toggle sets — it is what the
15873
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
15874
+ * always present on a persisted row (the column default materialises `'none'`).
15875
+ */
15876
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
15877
+ /**
15878
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
15879
+ * one flag can never clear the other — the toggles are independent and are
15880
+ * driven from three surfaces that do not know about each other.
15881
+ */
15882
+ var TrackFlagsPatchSchema = z.object(TrackFlagFields);
15883
+ /**
15884
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
15885
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
15886
+ * mutation result without a re-fetch.
15887
+ */
15888
+ var TrackFlagsSchema = z.object({
15889
+ trackId: z.string(),
15890
+ markForTrain: z.boolean(),
15891
+ debug: z.boolean(),
15892
+ favourited: z.boolean(),
15893
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
15894
+ * a track row) because this shape is only ever produced by the write body,
15895
+ * which always knows it — and a surface that has just written needs to render
15896
+ * `trained` without a re-fetch. */
15897
+ retrainStatus: RetrainStatusSchema
15898
+ });
15899
+ /**
15900
+ * WHICH tier a label occupies. The slot a label lands in is DECLARED by the
15901
+ * step that produced it (`StepDefinition.labelTier`), never inferred from the
15902
+ * text or the step's name.
15903
+ *
15904
+ * - `1` — a SUB-CLASS: finer than the macro class, still a taxonomy token.
15905
+ * `animal-type` (`dog`, `bird`), `vehicle-type` (`van`), and the root
15906
+ * detector's own raw class when it is finer than the macro it maps to.
15907
+ * - `2` — an INSTANCE: the finest thing said about this subject.
15908
+ * `species` (`Turdus migratorius`), `identity` (`Alice`), `plate-text`.
15909
+ *
15910
+ * The macro class itself (`person`, `vehicle`, `animal`, `package`, `face`,
15911
+ * `plate`, `audio`) is NOT a tier — it is `className`, and a macro token
15912
+ * offered for either label slot is refused (2026-08-07 rule; the refusal is
15913
+ * logged as `label tier collapse refused`).
15914
+ */
15915
+ var LabelTierSchema = z.union([z.literal(1), z.literal(2)]);
15916
+ /**
15917
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
15918
+ * the step and model that produced it — which is what makes the write rule
15919
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
15920
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
15921
+ *
15922
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
15923
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
15924
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
15925
+ * that value has no provenance, and the write rule lets ANY properly-attributed
15926
+ * write of the same tier replace it regardless of score.
15927
+ */
15928
+ var LabelAttributionSchema = z.object({
15929
+ stepId: z.string(),
15930
+ modelId: z.string().optional(),
15931
+ decidedAt: z.number(),
15932
+ /**
15933
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
15934
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
15935
+ *
15936
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
15937
+ * notification rule authored on "Gianluca" stopped matching the moment the
15938
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
15939
+ * the thing that does not move, so it is what a rule matches on
15940
+ * (`NcConditions.identities`) and the text is what a human is shown.
15941
+ *
15942
+ * Absent when the label names no gallery row — a plate the OCR read but no
15943
+ * vehicle claims, a sub-class, a species, any tier-1 value.
15944
+ */
15945
+ identityId: z.string().optional()
15946
+ });
15947
+ /**
15948
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
15949
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
15950
+ * track and its events always answer the same question the same way.
15951
+ *
15952
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
15953
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
15954
+ * is tier 2, and each carries its own score + attribution.
15955
+ *
15956
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
15957
+ * finest thing known. Before 4g the single `label` column held the finest
15958
+ * value, so a consumer that has not been updated reads the tier-1 slot and
15959
+ * shows nothing on a species-only row; that is why the migration puts every
15960
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
15961
+ * and why the read surfaces were changed in the same train.
15962
+ *
15963
+ * **Writing it.** The slots are independent, which is the whole point: a
15964
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
15965
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
15966
+ * higher score wins. One rule, one implementation — see
15967
+ * `pipeline/label-tier.ts` in addon-post-analysis.
15968
+ */
15969
+ var TieredLabelFields = {
15970
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
15971
+ label: z.string().optional(),
15972
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
15973
+ labelScore: z.number().optional(),
15974
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
15975
+ labelMeta: LabelAttributionSchema.optional(),
15976
+ /** Tier 2 — the instance. See {@link LabelTierSchema}. */
15977
+ subLabel: z.string().optional(),
15978
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
15979
+ subLabelScore: z.number().optional(),
15980
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
15981
+ subLabelMeta: LabelAttributionSchema.optional()
15982
+ };
15983
+ /** Per-camera slice of a training-export estimate. */
15984
+ var TrainingExportDeviceTotalsSchema = z.object({
15985
+ deviceId: z.number(),
15986
+ tracks: z.number().int(),
15987
+ files: z.number().int(),
15988
+ bytes: z.number().int()
15989
+ });
15990
+ /**
15991
+ * What a training export WOULD contain. Computed from media index rows only —
15992
+ * no blob is read to produce this.
15993
+ */
15994
+ var TrainingExportSummarySchema = z.object({
15995
+ generatedAt: z.number(),
15996
+ trackCount: z.number().int(),
15143
15997
  fileCount: z.number().int(),
15144
15998
  byteCount: z.number().int(),
15145
15999
  /** More marked tracks exist than a single pass carries. */
@@ -15617,1489 +16471,975 @@ var DeviceEventQueryInput = z.object({
15617
16471
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
15618
16472
  * exact behaviour. Callers may omit this field — the store defaults to
15619
16473
  * `full` when not provided. */
15620
- projection: z.enum(["full", "slim"]).optional()
15621
- });
15622
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: z.string().optional() });
15623
- var RecentTracksQueryInput = z.object({
15624
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
15625
- deviceIds: z.array(z.number()),
15626
- /** Window lower bound on `lastSeen` (inclusive). */
15627
- since: z.number().optional(),
15628
- /** Window upper bound on `lastSeen` (inclusive). */
15629
- until: z.number().optional(),
15630
- /** Page size. Default 200, max 1000. */
15631
- limit: z.number().int().min(1).max(1e3).default(200),
15632
- /** Opaque continuation cursor from a previous page's `nextCursor`.
15633
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
15634
- cursor: z.string().optional(),
15635
- /** See {@link TrackProjectionSchema}. Default `full`. */
15636
- projection: TrackProjectionSchema.optional(),
15637
- /** Include stationary-promoted rows (parked objects). Default false: the
15638
- * feed lists passages; parking records live on the stationary registry. */
15639
- includeStationary: z.boolean().optional()
15640
- });
15641
- var RecentTracksPageSchema = z.object({
15642
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
15643
- tracks: z.array(TrackSchema).readonly(),
15644
- /** Cursor for the next page, or null when this page is the last. */
15645
- nextCursor: z.string().nullable()
15646
- });
15647
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
15648
- var LIST_GROUPS_MAX_LIMIT = 100;
15649
- var AnalyticsGroupRecordSchema = z.object({
15650
- id: z.string(),
15651
- deviceId: z.number().int(),
15652
- openedAt: z.number().int(),
15653
- closedAt: z.number().int(),
15654
- timestamp: z.number().int(),
15655
- memberCount: z.number().int(),
15656
- memberTrackIds: z.array(z.string()).readonly(),
15657
- className: z.string(),
15658
- classes: z.array(z.string()).readonly(),
15659
- /** Relative event-media path, or null when the group has no picture yet. */
15660
- mediaUrl: z.string().nullable(),
15661
- singleton: z.boolean()
15662
- });
15663
- var AnalyticsGroupMemberSchema = z.object({
15664
- trackId: z.string(),
15665
- deviceId: z.number().int(),
15666
- className: z.string(),
15667
- firstSeen: z.number().int(),
15668
- lastSeen: z.number().int(),
15669
- mediaUrl: z.string().nullable()
15670
- });
15671
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: z.array(AnalyticsGroupMemberSchema).readonly() });
15672
- var ListGroupsQueryInput = z.object({
15673
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
15674
- deviceIds: z.array(z.number()),
15675
- /** Window lower bound on `closedAt` (inclusive). */
15676
- since: z.number().optional(),
15677
- /** Window upper bound on `openedAt` (inclusive). */
15678
- until: z.number().optional(),
15679
- limit: z.number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
15680
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
15681
- cursor: z.string().optional()
15682
- });
15683
- var ListGroupsPageSchema = z.object({
15684
- groups: z.array(AnalyticsGroupRecordSchema).readonly(),
15685
- nextCursor: z.string().nullable()
15686
- });
15687
- var KeyEventQueryInput = z.object({
15688
- deviceId: z.number(),
15689
- /** Window lower bound (track firstSeen ≥ since). */
15690
- since: z.number(),
15691
- /** Window upper bound (track firstSeen ≤ until). */
15692
- until: z.number(),
15693
- limit: z.number().int().min(1).max(200).default(50),
15694
- /** Drop tracks scoring below this importance. */
15695
- minImportance: z.number().min(0).max(1).optional(),
15696
- /** Restrict to a single class (e.g. 'person'). */
15697
- classFilter: z.string().optional()
15698
- });
15699
- var KeyEventSchema = z.object({
15700
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
15701
- id: z.string(),
15702
- trackId: z.string(),
15703
- /** Track start time (firstSeen). */
15704
- timestamp: z.number(),
15705
- className: z.string(),
15706
- ...TieredLabelFields,
15707
- importance: z.number(),
15708
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
15709
- bestEventId: z.string(),
15710
- /** Track lifetime in ms (lastSeen - firstSeen). */
15711
- windowMs: z.number().optional(),
15712
- ...TrackFlagFields,
15713
- ...TrackRetrainFields
15714
- });
15715
- var TrackedDetectionSchema = z.object({
15716
- trackId: z.string(),
15717
- className: z.string(),
15718
- confidence: z.number(),
15719
- bbox: BoundingBoxSchema,
15720
- zones: z.array(z.string()).readonly(),
15721
- state: TrackStateSchema
15722
- });
15723
- var OverlayDetectionSchema = z.looseObject({
15724
- id: z.string(),
15725
- kind: z.enum(["first-level", "detail"]),
15726
- macroClass: z.string(),
15727
- score: z.number(),
15728
- bbox: z.object({
15729
- x: z.number(),
15730
- y: z.number(),
15731
- width: z.number(),
15732
- height: z.number()
15733
- }),
15734
- labels: z.array(z.looseObject({
15735
- label: z.string(),
15736
- score: z.number()
15737
- })).readonly(),
15738
- parentId: z.string().optional()
15739
- });
15740
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: z.number() });
15741
- var SearchObjectEventsInput = z.object({
15742
- text: z.string(),
15743
- deviceId: z.number().optional(),
15744
- since: z.number().optional(),
15745
- until: z.number().optional(),
15746
- classFilter: z.string().optional(),
15747
- limit: z.number().default(50),
15748
- minScore: z.number().min(0).max(1).default(.2)
15749
- });
15750
- var TrackCascadeCountsSchema = z.object({
15751
- /** Persisted track roots deleted (authoritative). */
15752
- tracks: z.number().int(),
15753
- /** Object events removed with their tracks (best-effort; see note above). */
15754
- events: z.number().int(),
15755
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
15756
- media: z.number().int(),
15757
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
15758
- faces: z.number().int(),
15759
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
15760
- plates: z.number().int(),
15761
- /** Per-track CLIP search vectors removed (best-effort). */
15762
- embeddings: z.number().int(),
15763
- /** Group membership + group rows removed with their last member (best-effort). */
15764
- groups: z.number().int()
15765
- });
15766
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
15767
- var DiskReconcileCountsSchema = z.object({
15768
- mediaDropped: z.number().int(),
15769
- tracks: z.number().int(),
15770
- events: z.number().int()
15771
- });
15772
- /** Event-store footprint for one camera. */
15773
- var EventStoreDeviceFootprintSchema = z.object({
15774
- deviceId: z.number(),
15775
- /** Persisted event rows (motion + object + audio) for the camera. */
15776
- rows: z.number().int(),
15777
- /** Event-owned media bytes on disk for the camera. */
15778
- bytes: z.number().int()
15779
- });
15780
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
15781
- var EventStoreFootprintSchema = z.object({
15782
- totalRows: z.number().int(),
15783
- totalBytes: z.number().int(),
15784
- devices: z.array(EventStoreDeviceFootprintSchema).readonly()
15785
- });
15786
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
15787
- var EventPruneCountsSchema = z.object({
15788
- motion: z.number().int(),
15789
- object: z.number().int(),
15790
- audio: z.number().int()
15791
- });
15792
- /**
15793
- * Re-embed stored tracks from their key frames.
15794
- *
15795
- * The reason this is an operator-callable method and not a migration script:
15796
- * every knob that decides what a vector MEANS — encoder model, crop margin,
15797
- * squaring — is only changeable if the existing vectors can be regenerated.
15798
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
15799
- * symptom is a quality regression with no visible cause.
15800
- */
15801
- var RebuildObjectEmbeddingsInput = z.object({
15802
- /** Restrict to one camera. Omit for the whole fleet. */
15803
- deviceId: z.number().optional(),
15804
- since: z.number().optional(),
15805
- until: z.number().optional(),
15806
- /** Stop after this many tracks; the result reports whether more remain. */
15807
- maxTracks: z.number().int().positive().optional(),
15808
- /**
15809
- * Run every embedding on THIS node instead of round-robining the fleet.
15810
- *
15811
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
15812
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
15813
- * calling it that would pin the rebuild REQUEST itself to that node — the
15814
- * rebuild orchestration lives on the hub, and only the per-track step runs
15815
- * remotely. This field is data; the per-track pin is applied inside.
15816
- *
15817
- * Absent ⇒ round-robin over every online node whose runner can serve the
15818
- * pinned model.
15819
- */
15820
- executeOnNodeId: z.string().optional(),
15821
- /**
15822
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
15823
- * run flat out.
15824
- *
15825
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
15826
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
15827
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
15828
- * force is logged at start and finish so a deliberately slow pass reads
15829
- * differently from a stalled one.
15830
- */
15831
- pacingMs: z.number().int().nonnegative().optional()
15832
- });
15833
- /**
15834
- * Result of emptying the CLIP index.
15835
- *
15836
- * The clean slate before a policy change: a new crop margin or encoder model
15837
- * leaves two feature spaces in one index whose cosine scores are not
15838
- * comparable, so wiping and rebuilding is the only way to be sure every vector
15839
- * means the same thing.
15840
- */
15841
- var WipeObjectEmbeddingsResultSchema = z.object({ deleted: z.number() });
15842
- /**
15843
- * Acknowledgement that a rebuild STARTED.
15844
- *
15845
- * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
15846
- * runs detached and this returns immediately. Waiting for it made the client
15847
- * time out while the work carried on server-side, which is the worst of both:
15848
- * no result and no way to know it was still going. Poll
15849
- * `getObjectEmbeddingRebuildStatus` for progress.
15850
- */
15851
- var RebuildObjectEmbeddingsResultSchema = z.object({
15852
- started: z.boolean(),
15853
- /** True when a pass was already running; the new request is ignored. */
15854
- alreadyRunning: z.boolean()
15855
- });
15856
- var RebuildStatusSchema = z.object({
15857
- running: z.boolean(),
15858
- scanned: z.number(),
15859
- rebuilt: z.number(),
15860
- /** Tracks whose key frame is gone — nothing to re-embed from. */
15861
- missingKeyFrame: z.number(),
15862
- /** Tracks with no usable detection box. */
15863
- missingBbox: z.number(),
15864
- /**
15865
- * Tracks an executing node REFUSED rather than broke on — an unreadable key
15866
- * frame, a step that threw. Separate from `failed` because the remedy is
15867
- * different, and because a whole camera silently contributing zero vectors
15868
- * is the shape of failure a rebuild must never hide.
15869
- */
15870
- notRunnable: z.number(),
15871
- /**
15872
- * The pass stopped because NO node could serve the pinned model.
15873
- *
15874
- * Distinct from `notRunnable` on purpose: that one says "this track was
15875
- * refused", this one says "the cluster cannot do this work at all" — every
15876
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
15877
- * pinned model for its engine format, or dropped out. The remedy is a model /
15878
- * engine change, not a per-camera one. Non-zero here always comes with
15879
- * `complete: false`.
15880
- */
15881
- noCapableNode: z.number(),
15882
- failed: z.number(),
15883
- /** Set once a pass ends: true only when EVERYTHING was covered. */
15884
- complete: z.boolean().nullable(),
15885
- startedAtMs: z.number().nullable(),
15886
- finishedAtMs: z.number().nullable(),
15887
- /** Present when the pass ended by throwing. */
15888
- error: z.string().nullable()
15889
- });
15890
- var pipelineAnalyticsCapability = {
15891
- name: "pipeline-analytics",
15892
- scope: "device",
15893
- mode: "singleton",
15894
- kind: "wrapper",
15895
- defaultActive: true,
15896
- deviceTypes: [DeviceType.Camera],
15897
- exposesDeviceSettings: true,
15898
- methods: {
15899
- getActiveTracks: method(z.object({ deviceId: z.number() }), z.array(TrackSchema).readonly()),
15900
- getTrack: method(z.object({
15901
- deviceId: z.number(),
15902
- trackId: z.string()
15903
- }), TrackSchema.nullable()),
15904
- /** Historical completed tracks for a device. Queried from the
15905
- * persisted `pipeline-analytics:tracks` collection; active tracks
15906
- * still in RAM are not included. */
15907
- listTracks: method(z.object({
15908
- deviceId: z.number(),
15909
- since: z.number().optional(),
15910
- until: z.number().optional(),
15911
- limit: z.number().optional(),
15912
- /** Spatial filter — only tracks whose trajectory intersects the zone
15913
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
15914
- * envelope columns, then precisely tested per position. Tracks with
15915
- * an unknown envelope (no frame dims at persist time) always match. */
15916
- zone: TrackZoneFilterSchema.optional(),
15917
- /** See {@link TrackProjectionSchema}. Default `full` (backward
15918
- * compatible — omitting the field keeps today's exact behaviour). */
15919
- projection: TrackProjectionSchema.optional(),
15920
- /** Include stationary-promoted rows (parked objects handed to the
15921
- * stationary registry). Default false: the timeline lists passages,
15922
- * not parking records (operator decision, 2026-08-15). */
15923
- includeStationary: z.boolean().optional()
15924
- }), z.array(TrackSchema).readonly()),
15925
- /**
15926
- * Batched cluster-wide track listing — ONE call for the events page /
15927
- * reel first paint instead of a per-camera `listTracks` fan-out. Merges
15928
- * the persisted completed tracks of every requested device, sorted by
15929
- * `lastSeen` DESC with a stable (lastSeen, trackId) cursor. Per-device
15930
- * indexed pages (`idx_tracks_device_lastSeen`) are k-way merged
15931
- * provider-side; `projection: 'slim'` drops the heavy `positions[]` /
15932
- * `snapshots[]` JSON (returned as empty arrays). Active in-RAM tracks
15933
- * are not included (same contract as `listTracks`).
15934
- */
15935
- listRecentTracks: method(RecentTracksQueryInput, RecentTracksPageSchema),
15936
- /**
15937
- * Batched co-moving group listing — the Groups feed. Same merge/cursor
15938
- * contract as {@link listRecentTracks}. A group is a sealed partition of
15939
- * one session; `getGroup` is the detail with members.
15940
- */
15941
- listGroups: method(ListGroupsQueryInput, ListGroupsPageSchema),
15942
- getGroup: method(z.object({
15943
- deviceId: z.number(),
15944
- groupId: z.string().min(1)
15945
- }), AnalyticsGroupDetailSchema.nullable()),
15946
- clearTracks: method(z.object({ deviceId: z.number() }), z.void(), {
15947
- kind: "mutation",
15948
- auth: "admin"
15949
- }),
15950
- getMotionEvents: method(DeviceEventQueryInput, z.array(MotionEventSchema).readonly()),
15951
- getObjectEvents: method(ObjectEventQueryInput, z.array(ObjectEventSchema).readonly()),
15952
- getAudioEvents: method(DeviceEventQueryInput, z.array(AudioEventSchema).readonly()),
15953
- /**
15954
- * Every event kind the device can produce: built-ins (motion + audio),
15955
- * detection classes actually observed for the device (from the track
15956
- * history), and sensor kinds contributed by LINKED devices (resolved via
15957
- * `device-manager.getLinkedDevices`, mapped through `EVENT_KIND_BY_CAP`).
15958
- */
15959
- listEventKinds: method(z.object({ deviceId: z.number() }), z.array(EventKindDescriptorSchema).readonly()),
15960
- /**
15961
- * The same answer for many cameras in ONE call.
15962
- *
15963
- * `listEventKinds` is the slowest per-device query on the hub — measured
15964
- * at ~100 ms against 6-11 ms for its neighbours — because composing it
15965
- * costs a `getCameraStatus`, a `getLinkedDevices` and one `getBindings`
15966
- * per linked device. The viewer asks for it once per camera at first
15967
- * paint, so twelve cameras paid twelve of those round-trips on top of the
15968
- * per-camera cost.
15969
- *
15970
- * Batched, the camera statuses come from ONE `getCameraStatuses` instead
15971
- * of N, and the per-device composition runs concurrently.
15972
- *
15973
- * Per-device rather than pre-merged on purpose: a caller that renders one
15974
- * camera's lanes needs to know WHICH camera a kind came from, and merging
15975
- * is three lines the caller can do. `listEventKinds` stays for
15976
- * single-device callers.
15977
- */
15978
- listEventKindsBatch: method(z.object({ deviceIds: z.array(z.number()).min(1).max(200) }), z.array(EventKindsForDeviceSchema).readonly()),
15979
- /**
15980
- * Sensor-event history for a camera: state changes of LINKED sensor
15981
- * devices, attributed to the camera at ingest time (one row per linked
15982
- * camera). Mirrors `getAudioEvents` query semantics; `kinds` narrows to
15983
- * a kind subset.
15984
- */
15985
- getSensorEvents: method(z.object({
15986
- deviceId: z.number(),
15987
- since: z.number().optional(),
15988
- until: z.number().optional(),
15989
- kinds: z.array(z.string()).optional(),
15990
- limit: z.number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
15991
- }), z.array(SensorEventSchema).readonly()),
15992
- /**
15993
- * Importance-ranked highlights for a device+window. Queries completed
15994
- * tracks by (deviceId, firstSeen ∈ [since,until]), scores each (or reuses
15995
- * the persisted score), filters by minImportance/classFilter, orders by
15996
- * importance desc, and returns up to `limit` compact key events mapped to
15997
- * each track's best event. Legacy tracks lacking a persisted score are
15998
- * scored on-read (no write). Degrades to `[]` on error.
15999
- */
16000
- getKeyEvents: method(KeyEventQueryInput, z.array(KeyEventSchema).readonly()),
16001
- /** Server-side bucketed event counts for the 24-hour timeline.
16002
- * Returns one entry per non-empty bucket; empty buckets are omitted. */
16003
- getEventDensity: method(z.object({
16004
- deviceId: z.number(),
16005
- since: z.number(),
16006
- until: z.number(),
16007
- bucketMs: z.number().int().positive()
16008
- }), z.array(z.object({
16009
- bucketStart: z.number(),
16010
- motion: z.number().int(),
16011
- object: z.number().int(),
16012
- audio: z.number().int()
16013
- })).readonly()),
16014
- /**
16015
- * @deprecated Prefer `pruneTracksBefore` — the track is the ROOT of the
16016
- * analytics model and retention must cascade from it (design §5.1). This
16017
- * event-only prune leaves orphaned tracks/faces/plates/embeddings behind.
16018
- * Retained as a compat shim for the Phase-B3 recorder orchestration caller,
16019
- * which prunes events to keep history aligned with available footage and
16020
- * reads the per-kind counts. Delete all events (motion + object + audio)
16021
- * for the given device older than `cutoffMs` (exclusive) + their thumbnails
16022
- * in lockstep; returns per-kind deleted counts.
16023
- */
16024
- pruneEventsBefore: method(z.object({
16025
- deviceId: z.number(),
16026
- cutoffMs: z.number()
16027
- }), z.object({
16028
- motion: z.number().int(),
16029
- object: z.number().int(),
16030
- audio: z.number().int()
16031
- }), {
16032
- kind: "mutation",
16033
- auth: "admin"
16034
- }),
16035
- /**
16036
- * Track-centric retention entry point (design §5.1). Selects every
16037
- * persisted track for the device whose `lastSeen < cutoffMs` (paged) and
16038
- * runs the extensible whole-track deletion cascade (design §3): object
16039
- * events + their media, track/face/plate-owned media, unassigned face
16040
- * reads, per-track CLIP embeddings, then the track root LAST. ENROLLED
16041
- * (assigned) faces/plates and `ownerKind:'identity'` media are exempt —
16042
- * the durable matching gallery always persists. Fires the per-track
16043
- * live-state cleanup so a pruned track can't linger in dispatch/overlay
16044
- * state. Returns per-family deleted counts (`tracks` authoritative).
16045
- *
16046
- * Replaces `pruneEventsBefore` as the correct time-based retention prune.
16047
- */
16048
- pruneTracksBefore: method(z.object({
16049
- deviceId: z.number(),
16050
- cutoffMs: z.number()
16051
- }), TrackCascadeCountsSchema, {
16052
- kind: "mutation",
16053
- auth: "admin"
16054
- }),
16055
- /**
16056
- * Operator "clean slate" for a device (design §5.3): prune EVERY track for
16057
- * the device via the same cascade as `pruneTracksBefore` with `cutoffMs =
16058
- * now`. One call per device — no client-side track enumeration. Enrolled
16059
- * gallery + identity media are exempt (design §4). Returns per-family
16060
- * deleted counts.
16061
- */
16062
- wipeAllAnalytics: method(z.object({ deviceId: z.number() }), TrackCascadeCountsSchema, {
16063
- kind: "mutation",
16064
- auth: "admin"
16065
- }),
16066
- /**
16067
- * Disk-wins reconcile for one camera. Drops media index rows whose blobs
16068
- * are gone, then cascades tracks (including favourited and staging) that
16069
- * have no remaining files. Enrolled identity/vehicle/scene media is never
16070
- * probed. Trackless motion/audio events with no remaining file are dropped,
16071
- * including snapshot-less rows.
16072
- */
16073
- reconcileFromDisk: method(z.object({ deviceId: z.number() }), DiskReconcileCountsSchema, {
16074
- kind: "mutation",
16075
- auth: "admin"
16076
- }),
16077
- /**
16078
- * Delete whole tracks (object events) by id for the given device,
16079
- * cascading their media in lockstep. Returns the number of tracks
16080
- * actually deleted plus the ids that could not be removed.
16081
- *
16082
- * Operator-driven from the DI Events page (batch delete). Routes through
16083
- * the same widened track-deletion cascade (design §5.2).
16084
- */
16085
- deleteTracks: method(z.object({
16086
- deviceId: z.number(),
16087
- trackIds: z.array(z.string()).min(1)
16088
- }), z.object({
16089
- deleted: z.number().int(),
16090
- failed: z.array(z.string()).readonly()
16091
- }), {
16092
- kind: "mutation",
16093
- auth: "admin"
16094
- }),
16095
- /**
16096
- * Set the per-track operator flags (`markForTrain`, `debug`, `favourited`) on ONE track.
16097
- * The patch is PARTIAL — an omitted key is left untouched — because the
16098
- * three surfaces that write it (admin Events grid, viewer track detail,
16099
- * viewer cluster detail) each own one toggle and must not clobber the other.
16100
- *
16101
- * Writes the track ROW: `markForTrain`/`debug` are per-TRACK state, so they
16102
- * live where `label` and `importance` live, not in any per-device settings
16103
- * store. Updates the in-RAM active track too, so a flag set on a live track
16104
- * survives its expiry-time persist.
16105
- *
16106
- * `auth: 'protected'` (the default), NOT `admin`: the viewer is an
16107
- * authenticated non-admin surface and two of the three call sites are
16108
- * there. The note that used to sit here said to revisit this the day a flag
16109
- * gained an effect that costs storage, and D81 is that day — `markForTrain`
16110
- * now pins. It STAYS protected, and the reason is that the alternative
16111
- * makes the feature pointless: marking a track is something you do while
16112
- * looking at it, on the surface you were already looking at it on, and that
16113
- * surface is the viewer. What the storage cost gets instead is a BOUND — a
16114
- * per-device pin budget enforced in the body, refusing a new pin past the
16115
- * limit while always allowing un-marking. `deleteTracks` next door is still
16116
- * admin, because destroying evidence and preserving it are not symmetric.
16117
- *
16118
- * `markForTrain` writes the retrain LIFECYCLE, not a boolean column: `true`
16119
- * is `none → staging`, `false` is `staging → none`. A track already
16120
- * `trained` refuses BOTH — its frames are copies inside the retrain dataset
16121
- * and re-staging it from a generic toggle is how the same material gets
16122
- * annotated twice under two ground truths. Returning a trained track to
16123
- * staging is a deliberate action of the retrain page, which is also the only
16124
- * thing that produces `trained` in the first place.
16125
- *
16126
- * Returns the RESOLVED state of both flags (absent → `false`) plus the
16127
- * `retrainStatus` they were derived from, so a caller can drive its toggle
16128
- * — and render a `trained` badge — without a re-fetch. Rejects an unknown
16129
- * track, a new staging mark on a device already holding its full budget, and
16130
- * any `markForTrain` write against a trained track.
16131
- */
16132
- setTrackFlags: method(z.object({
16133
- /** Log/audit scope only — the trackId is globally unique on its own. */
16134
- deviceId: z.number(),
16135
- trackId: z.string(),
16136
- flags: TrackFlagsPatchSchema
16137
- }), TrackFlagsSchema, { kind: "mutation" }),
16138
- /**
16139
- * Durable event-store footprint for the management UI: event rows
16140
- * (motion + object + audio) counted per camera + total, plus the
16141
- * event-owned media bytes on disk per camera + total. Stat/count-based,
16142
- * computed on demand.
16143
- */
16144
- getEventStoreFootprint: method(z.object({}), EventStoreFootprintSchema, {
16145
- kind: "query",
16146
- auth: "admin"
16147
- }),
16148
- /**
16149
- * Cluster-wide prune of events older than `olderThanMs` (exclusive) across
16150
- * every camera, deleting each event's media in lockstep. Logged to the
16151
- * events ops-log with `reason` (default `'retention'`). Returns the summed
16152
- * per-kind deleted counts.
16153
- */
16154
- pruneEvents: method(z.object({
16155
- olderThanMs: z.number(),
16156
- reason: OpsLogReasonSchema.optional()
16157
- }), EventPruneCountsSchema, {
16158
- kind: "mutation",
16159
- auth: "admin"
16160
- }),
16161
- /**
16162
- * Manually delete EVERY event (motion + object + audio) for one camera and
16163
- * its event-owned media in lockstep. Logged to the events ops-log as
16164
- * `op:'manual-delete', reason:'manual'`. Destructive — the admin UI guards
16165
- * it behind a confirm.
16166
- */
16167
- deleteDeviceEvents: method(z.object({ deviceId: z.number() }), EventPruneCountsSchema, {
16168
- kind: "mutation",
16169
- auth: "admin"
16170
- }),
16171
- /** The events ops-log rows (newest-first), optionally scoped to one camera.
16172
- * Backed by a declared pipeline-analytics SQLite collection. */
16173
- /** Internal migration-participant lease. It drains active MediaStore
16174
- * writes and refuses new ones without changing analytics bindings. */
16175
- pauseForStorageMigration: method(StorageMigrationLeaseInputSchema, z.object({ paused: z.literal(true) }), {
16176
- kind: "mutation",
16177
- auth: "admin"
16178
- }),
16179
- resumeForStorageMigration: method(StorageMigrationLeaseInputSchema, z.object({ resumed: z.literal(true) }), {
16180
- kind: "mutation",
16181
- auth: "admin"
16182
- }),
16183
- /** Drops cached location roots after the storage coordinator repoints a
16184
- * default so future event-media writes use the new root. */
16185
- refreshStorageLocationsForMigration: method(StorageMigrationLeaseInputSchema, z.object({ refreshed: z.literal(true) }), {
16186
- kind: "mutation",
16187
- auth: "admin"
16188
- }),
16189
- startStorageMigrationMove: method(StorageMigrationMediaMoveInputSchema, z.object({ jobId: z.string() }), {
16190
- kind: "mutation",
16191
- auth: "admin"
16192
- }),
16193
- getStorageMigrationMoveStatus: method(z.object({ jobId: z.string() }), RelocateJobSchema.nullable(), { auth: "admin" }),
16194
- cancelStorageMigrationMove: method(z.object({ jobId: z.string() }), z.object({ cancelled: z.boolean() }), {
16195
- kind: "mutation",
16196
- auth: "admin"
16197
- }),
16198
- listOpsLog: method(OpsLogQueryInputSchema, z.array(OpsLogEntrySchema).readonly(), {
16199
- kind: "query",
16200
- auth: "admin"
16201
- }),
16202
- /**
16203
- * The CHEAP QUESTION, asked before any media moves: how big is the dataset
16204
- * the marked (`markForTrain`) tracks would produce?
16205
- *
16206
- * Answered from media INDEX rows only — key, kind, size, timestamp — so it
16207
- * costs ~2 KB of reads per track and no blob reads at all. The measured harm
16208
- * behind D56 was a bulk pass that read and base64'd every blob a track owned
16209
- * before deciding anything, taking hub-main to 82 s busy out of 120; an
16210
- * export is that same I/O shape, so it inherits the same discipline: know
16211
- * the size, then decide.
16212
- *
16213
- * `truncated` reports that more marked tracks exist than one pass carries.
16214
- * Empty `deviceIds` ⇒ every device that has marked tracks.
16215
- */
16216
- getTrainingExportSummary: method(z.object({ deviceIds: z.array(z.number()).optional() }), TrainingExportSummarySchema, {
16217
- kind: "query",
16218
- auth: "admin"
16219
- }),
16220
- /**
16221
- * Where to download the dataset archive.
16222
- *
16223
- * The BYTES do not come back through this cap — they come from the returned
16224
- * data-plane URL, which streams a tar built entry by entry. A multi-gigabyte
16225
- * archive base64'd through a unary RPC envelope would be held whole in
16226
- * memory twice on a hub this repo has already OOM'd once (D9/D18 are the
16227
- * same lesson about frames). `getDownloadUrl` on `recordingExport` is the
16228
- * precedent, and this follows it deliberately.
16229
- *
16230
- * The archive contains a `manifest.json` FIRST, then the stored media
16231
- * VERBATIM under `tracks/<deviceId>/<trackId>/…`. No crop is derived and no
16232
- * model is run: a training set's pixels must be the pixels the pipeline saw.
16233
- */
16234
- getTrainingExportUrl: method(z.object({ deviceIds: z.array(z.number()).optional() }), z.object({ url: z.string() }), {
16235
- kind: "query",
16236
- auth: "admin"
16237
- }),
16238
- /**
16239
- * The staging worklist for one camera, or for every camera that has one.
16240
- *
16241
- * Fetched ON DEMAND, over the staging set only — the page never scans
16242
- * history, because making the working set small is the entire purpose of
16243
- * the mark. Each row carries how many frames the dataset already holds from
16244
- * the track and how many subjects were annotated on them, so
16245
- * `frameCount: 0` reads as "still to work" without a second call per track.
16246
- *
16247
- * `auth: 'admin'`, unlike the viewer-level mark itself: marking a track is
16248
- * curation you do while looking at it, but building the training set the
16249
- * fleet's models are fine-tuned on is not.
16250
- */
16251
- listRetrainStaging: method(z.object({
16252
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
16253
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
16254
- * route it at one camera's owner, and "every camera" would stop being
16255
- * expressible at all. */
16256
- deviceIds: z.array(z.number()).optional(),
16257
- limit: z.number().int().min(1).max(500).optional()
16258
- }), z.array(RetrainTrackSchema).readonly(), {
16259
- kind: "query",
16260
- auth: "admin"
16261
- }),
16262
- /**
16263
- * What a track can contribute, and what it already has.
16264
- *
16265
- * `candidates` are the track's whole, unannotated frames — index rows only,
16266
- * so this is cheap. `copies` are the frames already inside the dataset, and
16267
- * a candidate whose copy exists is marked `copied: true`: selecting it again
16268
- * is free and CANNOT fail, whatever became of the original.
16269
- *
16270
- * A crop, a thumbnail and `fullFrameBoxed` are never candidates. The last
16271
- * one matters most: it has the model's own rectangle burned into the pixels,
16272
- * and a detector trained on it learns to find a green line.
16273
- */
16274
- listRetrainFrames: method(z.object({ trackId: z.string() }), RetrainFrameListSchema, {
16275
- kind: "query",
16276
- auth: "admin"
16277
- }),
16278
- /**
16279
- * COPY-ON-SELECT — the write that makes `trained` safe to evict.
16280
- *
16281
- * Selecting a frame copies its bytes into retrain storage immediately: not
16282
- * a reference, not a lease. Once the copy exists the dataset no longer
16283
- * depends on the track's media, which is exactly what lets D81 hand a
16284
- * `trained` track back to retention.
16285
- *
16286
- * The order inside is load-bearing and is pinned by a test: an EXISTING
16287
- * copy is returned without touching the source, so an original that
16288
- * evaporated blocks the selection of THAT ORIGINAL and never the copy
16289
- * already taken. Every refusal comes back named — a dropped selection is
16290
- * never silent, on the wire or in the log.
16291
- */
16292
- selectRetrainFrames: method(z.object({
16293
- deviceId: z.number(),
16294
- trackId: z.string(),
16295
- mediaKeys: z.array(z.string()).min(1)
16296
- }), RetrainFrameSelectionSchema, {
16297
- kind: "mutation",
16298
- auth: "admin"
16299
- }),
16300
- /** Un-select a frame: its annotations go first, then the copy and its blob.
16301
- * Deliberately destructive and deliberately explicit — it is the only way
16302
- * a frame leaves the dataset before export. */
16303
- deselectRetrainFrame: method(z.object({
16304
- deviceId: z.number(),
16305
- trackId: z.string(),
16306
- frameId: z.string()
16307
- }), z.object({
16308
- removed: z.boolean(),
16309
- removedAnnotations: z.number().int()
16310
- }), {
16311
- kind: "mutation",
16312
- auth: "admin"
16313
- }),
16314
- /**
16315
- * The pixels of ONE copied frame, base64.
16316
- *
16317
- * Through the cap rather than a data plane because it is genuinely one
16318
- * frame at a time, on demand, at human speed — the shape D9/D18 permit
16319
- * (what they forbid is frames crossing a boundary at frame RATE). The
16320
- * annotation canvas needs the image and its exact dimensions in the same
16321
- * answer: a canvas that places a normalised box against a size it guessed
16322
- * draws every box in the wrong place.
16323
- */
16324
- getRetrainFrameImage: method(z.object({ frameId: z.string() }), z.object({
16325
- base64: z.string(),
16326
- width: z.number().int(),
16327
- height: z.number().int()
16328
- }), {
16329
- kind: "query",
16330
- auth: "admin"
16331
- }),
16332
- /**
16333
- * Ask the pipeline what it sees, as a PROPOSAL.
16334
- *
16335
- * Runs through `pipelineRunner.runStatelessStep` on the COPIED frame, and
16336
- * every box comes back as a draft with `source: 'assist'` plus the model and
16337
- * score that produced it. The operator confirms, edits, adds and deletes;
16338
- * nothing is stored until `saveRetrainAnnotations`.
16339
- *
16340
- * For packages the request is `rfdetr-package` on the ZONE CROP at 0.35 —
16341
- * never the whole frame, where a package detector at that threshold proposes
16342
- * furniture. A package request with no zone is REFUSED rather than widened,
16343
- * because the silent widening would look like a bad model for as long as
16344
- * nobody checked which rectangle it ran on.
16345
- */
16346
- proposeRetrainAnnotations: method(z.object({
16347
- deviceId: z.number(),
16348
- trackId: z.string(),
16349
- frameId: z.string(),
16350
- subject: RetrainAssistSubjectSchema,
16351
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
16352
- nodeId: z.string().optional()
16353
- }), RetrainAssistResultSchema, {
16354
- kind: "mutation",
16355
- auth: "admin"
16356
- }),
16357
- /** Every annotation on a track, oldest first. */
16358
- listRetrainAnnotations: method(z.object({ trackId: z.string() }), z.array(RetrainAnnotationSchema).readonly(), {
16359
- kind: "query",
16360
- auth: "admin"
16361
- }),
16362
- /**
16363
- * Replace EVERY annotation on one frame with the supplied set.
16364
- *
16365
- * Whole-frame replacement, not per-box upsert: the unit of ground truth is
16366
- * the frame, and "the operator deleted a box" must be the same durable
16367
- * outcome as "the operator never drew it". A per-box patch would let a frame
16368
- * keep a box the operator removed on a surface that only knew about the
16369
- * boxes it sent.
16370
- *
16371
- * Refuses a macro class typed into `label` or `subLabel` — the tiers are
16372
- * separate and the guard is at the WRITE, because a mixed taxonomy cannot
16373
- * be un-mixed by reading it.
16374
- */
16375
- saveRetrainAnnotations: method(z.object({
16376
- deviceId: z.number(),
16377
- trackId: z.string(),
16378
- frameId: z.string(),
16379
- annotations: z.array(RetrainAnnotationDraftSchema)
16380
- }), z.array(RetrainAnnotationSchema).readonly(), {
16381
- kind: "mutation",
16382
- auth: "admin"
16383
- }),
16384
- /**
16385
- * Finish with a track: `staging → trained`. **The only writer of that
16386
- * state** — D81 shipped the column with it deliberately unreachable.
16387
- *
16388
- * Refuses a track the dataset holds no copies from. `trained` un-pins the
16389
- * track's media, so completing without a copy is a delete order for material
16390
- * nothing ever extracted anything from; that refusal IS the safety argument
16391
- * of D81, expressed as a precondition.
16392
- */
16393
- completeRetrainTrack: method(z.object({
16394
- deviceId: z.number(),
16395
- trackId: z.string()
16396
- }), RetrainTransitionResultSchema, {
16397
- kind: "mutation",
16398
- auth: "admin"
16399
- }),
16400
- /**
16401
- * The deliberate return: `trained → staging`, for the rare case.
16402
- *
16403
- * The generic `setTrackFlags` toggle refuses this in both directions by
16404
- * design (D81) — re-staging from a checkbox is how the same material gets
16405
- * annotated twice under two ground truths. Doing it here means the operator
16406
- * is looking at the annotations that already exist while they decide, and
16407
- * those annotations are LEFT ALONE: "put this back" must not be a
16408
- * destructive act wearing a navigational name.
16409
- */
16410
- restageRetrainTrack: method(z.object({
16411
- deviceId: z.number(),
16412
- trackId: z.string()
16413
- }), RetrainTransitionResultSchema, {
16414
- kind: "mutation",
16415
- auth: "admin"
16416
- }),
16417
- /**
16418
- * Where to download the ANNOTATED dataset.
16419
- *
16420
- * The sibling of `getTrainingExportUrl` and deliberately not the same
16421
- * archive: that one streams a marked track's stored media verbatim, this one
16422
- * streams the retrain COPIES plus an `annotations.json` carrying, for every
16423
- * subject, the canonical full-frame box AND the geometry derived for each
16424
- * model shape (letterboxed root / zone-cropped package / subject-cropped
16425
- * classifier). Derived at export, never stored — one box in, three shapes
16426
- * out, so two crops of the same subject can never end up in one feature
16427
- * space (D52).
16428
- */
16429
- getRetrainExportUrl: method(z.object({ deviceIds: z.array(z.number()).optional() }), z.object({ url: z.string() }), {
16430
- kind: "query",
16431
- auth: "admin"
16432
- }),
16433
- getEventMedia: method(z.object({
16434
- eventId: z.string(),
16435
- kind: MediaFileKindEnum.optional(),
16436
- deviceId: z.number()
16437
- }), z.array(MediaFileSchema).readonly()),
16438
- /** All media rows owned by a track. `kinds` narrows to a kind subset so a
16439
- * client can fetch the SMALL display variants on open and pull the
16440
- * multi-MB native variants only on demand (mirrors `getEventMedia.kind`).
16441
- * Absent ⇒ every kind (back-compat). */
16442
- getTrackMedia: method(z.object({
16443
- trackId: z.string(),
16444
- kinds: z.array(MediaFileKindEnum).optional(),
16445
- deviceId: z.number()
16446
- }), z.array(MediaFileSchema).readonly()),
16447
- /**
16448
- * What media a track HAS, without any of it.
16449
- *
16450
- * The detail view needs the shape of a track's media to build its strip —
16451
- * which kinds exist, in what order, at what size — and then wants each tile
16452
- * fetched as an image, not as base64 inside this response. Measured: the
16453
- * full `getTrackMedia` is 5.3-7.7 MB and blocks the view; this manifest is
16454
- * ~2 KB.
16455
- *
16456
- * It also restores a fact a `kinds` filter destroys: filtering
16457
- * `getTrackMedia` drops whole ROWS, taking `kind` and `sizeBytes` with
16458
- * them, so a client that fetched only the small variants could no longer
16459
- * tell a full-resolution variant existed — and the affordance that opens it
16460
- * would silently disappear.
16461
- */
16462
- listTrackMedia: method(z.object({
16463
- trackId: z.string(),
16464
- deviceId: z.number()
16465
- }), z.array(MediaFileInfoSchema).readonly()),
16466
- /**
16467
- * Search object events by text query using CLIP cosine similarity.
16468
- * Encodes `text` via the `embedding-encoder` cap, queries the
16469
- * `ObjectEmbeddingStore` with optional prefilters, ranks all matching
16470
- * embeddings by cosine similarity, and joins winners to their
16471
- * ObjectEvents by trackId. Returns up to `limit` events scored ≥
16472
- * `minScore`, sorted descending by score.
16473
- */
16474
- searchObjectEvents: method(SearchObjectEventsInput, z.array(ScoredObjectEventSchema).readonly()),
16475
- wipeObjectEmbeddings: method(z.object({}), WipeObjectEmbeddingsResultSchema, {
16476
- kind: "mutation",
16477
- auth: "admin"
16478
- }),
16479
- rebuildObjectEmbeddings: method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
16480
- kind: "mutation",
16481
- auth: "admin"
16482
- }),
16483
- getObjectEmbeddingRebuildStatus: method(z.object({}), RebuildStatusSchema)
16484
- },
16485
- events: {
16486
- /**
16487
- * Enriched frame emitted after refinement — the live-overlay source of
16488
- * truth (two-plane re-injection). Carries the frame's detections in the
16489
- * `ObjectDetection` wire shape: first-level roots (with track info +
16490
- * enrichment labels) plus synthesized `kind:'detail'` face/plate entries
16491
- * re-projected from per-track detail state, so stream overlays render
16492
- * boxes + recognized names without querying full Track state.
16493
- */
16494
- onFrameTracked: { data: z.object({
16495
- deviceId: z.number(),
16496
- timestamp: z.number(),
16497
- frameWidth: z.number(),
16498
- frameHeight: z.number(),
16499
- detections: z.array(OverlayDetectionSchema).readonly()
16500
- }) },
16501
- /** Track entered active state (first-seen). */
16502
- onTrackStarted: { data: z.object({
16503
- deviceId: z.number(),
16504
- trackId: z.string(),
16505
- className: z.string()
16506
- }) },
16507
- /** Track expired (TTL reached after last detection). */
16508
- onTrackEnded: { data: z.object({
16509
- deviceId: z.number(),
16510
- trackId: z.string(),
16511
- className: z.string(),
16512
- durationMs: z.number()
16513
- }) },
16514
- /** Canonical "something happened at device X" event, per-kind. */
16515
- onDetectionEvent: { data: z.object({
16516
- deviceId: z.number(),
16517
- kind: EventKindSchema,
16518
- eventId: z.string(),
16519
- timestamp: z.number()
16520
- }) }
16521
- }
16522
- };
16523
- //#endregion
16524
- //#region src/capabilities/pipeline-executor.cap.ts
16525
- /**
16526
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
16527
- * within the frame, so the executor can re-cut a leaf child ROI at native
16528
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16529
- */
16530
- var NativeCropRefSchema = z.object({
16531
- /** Handle keying the retained native surface (node-pinned to its owner). */
16532
- handle: FrameHandleSchema,
16533
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16534
- cropFrameSpace: z.object({
16535
- x: z.number(),
16536
- y: z.number(),
16537
- w: z.number(),
16538
- h: z.number()
16539
- })
16540
- });
16541
- z.object({
16542
- crop: z.object({
16543
- left: z.number(),
16544
- top: z.number(),
16545
- width: z.number().positive(),
16546
- height: z.number().positive()
16547
- }).optional(),
16548
- content: z.object({
16549
- width: z.number().int().positive(),
16550
- height: z.number().int().positive()
16551
- }),
16552
- fit: z.enum(["stretch", "contain"]),
16553
- format: z.enum([
16554
- "rgb",
16555
- "gray",
16556
- "jpeg"
16557
- ])
16558
- });
16559
- var FrameRefSchema = z.object({
16560
- registryId: z.string().min(1),
16561
- id: z.string().min(1),
16562
- width: z.number().int().positive(),
16563
- height: z.number().int().positive(),
16564
- format: z.enum(["rgb", "gray"]),
16565
- timestamp: z.number(),
16566
- capturedAt: z.number().optional()
16567
- });
16568
- var ModelFormatSchema$1 = z.enum([
16569
- "onnx",
16570
- "coreml",
16571
- "openvino",
16572
- "tflite",
16573
- "pt",
16574
- "gguf"
16575
- ]);
16576
- var PipelineSlotSchema = z.enum([
16577
- "detector",
16578
- "cropper",
16579
- "classifier",
16580
- "refiner",
16581
- "audio-classifier"
16582
- ]);
16583
- var PipelineEngineChoiceSchema = z.object({
16584
- runtime: z.enum(["node", "python"]),
16585
- backend: z.string(),
16586
- format: ModelFormatSchema$1,
16587
- device: z.string().optional()
16588
- });
16589
- var EngineDeviceInfoSchema = z.object({
16590
- id: z.string(),
16591
- label: z.string(),
16592
- description: z.string().optional()
16474
+ projection: z.enum(["full", "slim"]).optional()
16593
16475
  });
16594
- var AvailableEngineSchema = z.object({
16595
- engine: PipelineEngineChoiceSchema,
16596
- devices: z.array(EngineDeviceInfoSchema).readonly(),
16597
- defaultDevice: z.string()
16476
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: z.string().optional() });
16477
+ var RecentTracksQueryInput = z.object({
16478
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
16479
+ deviceIds: z.array(z.number()),
16480
+ /** Window lower bound on `lastSeen` (inclusive). */
16481
+ since: z.number().optional(),
16482
+ /** Window upper bound on `lastSeen` (inclusive). */
16483
+ until: z.number().optional(),
16484
+ /** Page size. Default 200, max 1000. */
16485
+ limit: z.number().int().min(1).max(1e3).default(200),
16486
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
16487
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16488
+ cursor: z.string().optional(),
16489
+ /** See {@link TrackProjectionSchema}. Default `full`. */
16490
+ projection: TrackProjectionSchema.optional(),
16491
+ /** Include stationary-promoted rows (parked objects). Default false: the
16492
+ * feed lists passages; parking records live on the stationary registry. */
16493
+ includeStationary: z.boolean().optional()
16598
16494
  });
16599
- var PipelineDefaultStepSchema = z.lazy(() => z.object({
16600
- addonId: z.string(),
16601
- addonName: z.string(),
16602
- slot: PipelineSlotSchema,
16603
- inputClasses: z.array(z.string()).readonly(),
16604
- outputClasses: z.array(z.string()).readonly(),
16605
- enabled: z.boolean(),
16606
- modelId: z.string(),
16607
- children: z.array(PipelineDefaultStepSchema).readonly(),
16608
- group: z.string().optional(),
16609
- settings: z.record(z.string(), z.unknown()).optional()
16610
- }));
16611
- var PipelineTemplateStepSchema = z.lazy(() => z.object({
16612
- addonId: z.string(),
16613
- enabled: z.boolean(),
16614
- modelId: z.string(),
16615
- children: z.array(PipelineTemplateStepSchema).readonly(),
16616
- settings: z.record(z.string(), z.unknown()).optional()
16617
- }));
16618
- var PipelineTemplateSchema$1 = z.object({
16619
- id: z.string(),
16620
- name: z.string(),
16621
- createdAt: z.string(),
16622
- updatedAt: z.string(),
16623
- engine: PipelineEngineChoiceSchema,
16624
- steps: z.array(PipelineTemplateStepSchema).readonly()
16495
+ var RecentTracksPageSchema = z.object({
16496
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
16497
+ tracks: z.array(TrackSchema).readonly(),
16498
+ /** Cursor for the next page, or null when this page is the last. */
16499
+ nextCursor: z.string().nullable()
16625
16500
  });
16626
- var PipelineModelOptionSchema = z.object({
16501
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
16502
+ var LIST_GROUPS_MAX_LIMIT = 100;
16503
+ var AnalyticsGroupRecordSchema = z.object({
16627
16504
  id: z.string(),
16628
- name: z.string(),
16629
- formats: z.record(z.string(), z.object({
16630
- downloaded: z.boolean(),
16631
- sizeMB: z.number()
16632
- })),
16633
- group: ModelVariantGroupSchema.optional(),
16634
- legacy: z.boolean().optional(),
16635
- provider: ModelProviderIdSchema.optional()
16505
+ deviceId: z.number().int(),
16506
+ openedAt: z.number().int(),
16507
+ closedAt: z.number().int(),
16508
+ timestamp: z.number().int(),
16509
+ memberCount: z.number().int(),
16510
+ memberTrackIds: z.array(z.string()).readonly(),
16511
+ className: z.string(),
16512
+ classes: z.array(z.string()).readonly(),
16513
+ /** Relative event-media path, or null when the group has no picture yet. */
16514
+ mediaUrl: z.string().nullable(),
16515
+ singleton: z.boolean()
16636
16516
  });
16637
- var ConfigFieldBridge = z.custom();
16638
- var PipelineAddonSchemaSchema = z.object({
16639
- id: z.string(),
16640
- name: z.string(),
16641
- slot: PipelineSlotSchema,
16642
- inputClasses: z.array(z.string()).readonly(),
16643
- outputClasses: z.array(z.string()).readonly(),
16644
- childSlots: z.array(PipelineSlotSchema).readonly(),
16645
- models: z.array(PipelineModelOptionSchema).readonly(),
16646
- defaultModelId: z.string(),
16647
- defaultModelIdByFormat: z.record(z.string(), z.string()).optional(),
16648
- enabledByDefault: z.boolean().optional(),
16649
- backfillIntoExistingOverrides: z.boolean().optional(),
16650
- defaultConfidence: z.number(),
16651
- group: z.string().optional(),
16652
- configSchema: z.array(ConfigFieldBridge).readonly().optional()
16517
+ var AnalyticsGroupMemberSchema = z.object({
16518
+ trackId: z.string(),
16519
+ deviceId: z.number().int(),
16520
+ className: z.string(),
16521
+ firstSeen: z.number().int(),
16522
+ lastSeen: z.number().int(),
16523
+ mediaUrl: z.string().nullable()
16653
16524
  });
16654
- var PipelineSlotSchemaSchema = z.object({
16655
- id: PipelineSlotSchema,
16656
- label: z.string(),
16657
- priority: z.number(),
16658
- parentSlot: PipelineSlotSchema.nullable(),
16659
- addons: z.array(PipelineAddonSchemaSchema).readonly()
16525
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: z.array(AnalyticsGroupMemberSchema).readonly() });
16526
+ var ListGroupsQueryInput = z.object({
16527
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
16528
+ deviceIds: z.array(z.number()),
16529
+ /** Window lower bound on `closedAt` (inclusive). */
16530
+ since: z.number().optional(),
16531
+ /** Window upper bound on `openedAt` (inclusive). */
16532
+ until: z.number().optional(),
16533
+ limit: z.number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
16534
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
16535
+ cursor: z.string().optional()
16660
16536
  });
16661
- var PipelineSchemaSchema = z.object({
16662
- availableEngines: z.array(AvailableEngineSchema).readonly(),
16663
- selectedEngine: PipelineEngineChoiceSchema,
16664
- slots: z.array(PipelineSlotSchemaSchema).readonly()
16537
+ var ListGroupsPageSchema = z.object({
16538
+ groups: z.array(AnalyticsGroupRecordSchema).readonly(),
16539
+ nextCursor: z.string().nullable()
16665
16540
  });
16666
- var EngineProvisioningSchema = z.object({
16667
- runtimeId: z.enum([
16668
- "onnx",
16669
- "openvino",
16670
- "coreml",
16671
- "edgetpu"
16672
- ]).nullable(),
16673
- device: z.string().nullable(),
16674
- state: z.enum([
16675
- "idle",
16676
- "installing",
16677
- "verifying",
16678
- "ready",
16679
- "failed"
16680
- ]),
16681
- progress: z.number().optional(),
16682
- error: z.string().optional(),
16683
- nextRetryAt: z.number().optional(),
16684
- /**
16685
- * Gate A (config-correctness gate at engine change): human-readable
16686
- * config issues surfaced EAGERLY when the node's engine changes — model
16687
- * substitutions ("chose X, running Y") and zero-build steps ("no model
16688
- * has a <format> build"). Additive/optional: informational only, never
16689
- * enforced here — `assertEngineReady` (readiness) still gates inference.
16690
- * Absent/empty when the node-default tree resolves cleanly.
16691
- */
16692
- configIssues: z.array(z.string()).optional()
16541
+ var KeyEventQueryInput = z.object({
16542
+ deviceId: z.number(),
16543
+ /** Window lower bound (track firstSeen ≥ since). */
16544
+ since: z.number(),
16545
+ /** Window upper bound (track firstSeen ≤ until). */
16546
+ until: z.number(),
16547
+ limit: z.number().int().min(1).max(200).default(50),
16548
+ /** Drop tracks scoring below this importance. */
16549
+ minImportance: z.number().min(0).max(1).optional(),
16550
+ /** Restrict to a single class (e.g. 'person'). */
16551
+ classFilter: z.string().optional()
16693
16552
  });
16694
- var PipelineStepInputSchema = z.lazy(() => z.object({
16695
- addonId: z.string(),
16696
- modelId: z.string().optional(),
16697
- enabled: z.boolean().default(true),
16698
- children: z.array(PipelineStepInputSchema).optional(),
16699
- settings: z.record(z.string(), z.unknown()).optional(),
16700
- jumpDeviceKey: z.string().optional()
16701
- }));
16702
- var ModelSubstitutionSchema = z.object({
16703
- addonId: z.string(),
16704
- chosen: z.string(),
16705
- running: z.string(),
16706
- format: z.string()
16553
+ var KeyEventSchema = z.object({
16554
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
16555
+ id: z.string(),
16556
+ trackId: z.string(),
16557
+ /** Track start time (firstSeen). */
16558
+ timestamp: z.number(),
16559
+ className: z.string(),
16560
+ ...TieredLabelFields,
16561
+ importance: z.number(),
16562
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
16563
+ bestEventId: z.string(),
16564
+ /** Track lifetime in ms (lastSeen - firstSeen). */
16565
+ windowMs: z.number().optional(),
16566
+ ...TrackFlagFields,
16567
+ ...TrackRetrainFields
16707
16568
  });
16708
- var PipelineValidationIssueSchema = z.object({
16709
- addonId: z.string(),
16710
- kind: z.enum(["unknown-addon", "no-format-build"]),
16711
- detail: z.string()
16569
+ var TrackedDetectionSchema = z.object({
16570
+ trackId: z.string(),
16571
+ className: z.string(),
16572
+ confidence: z.number(),
16573
+ bbox: BoundingBoxSchema,
16574
+ zones: z.array(z.string()).readonly(),
16575
+ state: TrackStateSchema
16712
16576
  });
16713
- var PipelineValidationResultSchema = z.object({
16714
- ok: z.boolean(),
16715
- issues: z.array(PipelineValidationIssueSchema).readonly(),
16716
- substitutions: z.array(ModelSubstitutionSchema).readonly(),
16717
- /** The node's `currentEngine.format` this validation ran against. */
16718
- format: z.string()
16577
+ var OverlayDetectionSchema = z.looseObject({
16578
+ id: z.string(),
16579
+ kind: z.enum(["first-level", "detail"]),
16580
+ macroClass: z.string(),
16581
+ score: z.number(),
16582
+ bbox: z.object({
16583
+ x: z.number(),
16584
+ y: z.number(),
16585
+ width: z.number(),
16586
+ height: z.number()
16587
+ }),
16588
+ labels: z.array(z.looseObject({
16589
+ label: z.string(),
16590
+ score: z.number()
16591
+ })).readonly(),
16592
+ parentId: z.string().optional()
16719
16593
  });
16720
- var ReferenceImageEntrySchema = z.object({
16721
- filename: z.string(),
16722
- stepIds: z.array(z.string()).readonly().optional()
16594
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: z.number() });
16595
+ var SearchObjectEventsInput = z.object({
16596
+ text: z.string(),
16597
+ deviceId: z.number().optional(),
16598
+ since: z.number().optional(),
16599
+ until: z.number().optional(),
16600
+ classFilter: z.string().optional(),
16601
+ limit: z.number().default(50),
16602
+ minScore: z.number().min(0).max(1).default(.2)
16723
16603
  });
16724
- var ReferenceImageBodySchema = z.object({
16725
- base64: z.string(),
16726
- filename: z.string()
16604
+ var TrackCascadeCountsSchema = z.object({
16605
+ /** Persisted track roots deleted (authoritative). */
16606
+ tracks: z.number().int(),
16607
+ /** Object events removed with their tracks (best-effort; see note above). */
16608
+ events: z.number().int(),
16609
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
16610
+ media: z.number().int(),
16611
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
16612
+ faces: z.number().int(),
16613
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
16614
+ plates: z.number().int(),
16615
+ /** Per-track CLIP search vectors removed (best-effort). */
16616
+ embeddings: z.number().int(),
16617
+ /** Group membership + group rows removed with their last member (best-effort). */
16618
+ groups: z.number().int()
16727
16619
  });
16728
- var ReferenceAudioEntrySchema = z.object({
16729
- filename: z.string(),
16730
- sizeKb: z.number()
16620
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
16621
+ var DiskReconcileCountsSchema = z.object({
16622
+ mediaDropped: z.number().int(),
16623
+ tracks: z.number().int(),
16624
+ events: z.number().int()
16731
16625
  });
16732
- var ReferenceAudioBodySchema = z.object({ base64: z.string() });
16733
- var AudioBackendSchema = z.object({
16734
- id: z.string(),
16735
- name: z.string(),
16736
- description: z.string(),
16737
- available: z.boolean(),
16738
- /**
16739
- * Raw classifier labels this backend can emit (e.g. YAMNet's
16740
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16741
- * the benchmark UI to populate the `enabledMicroClasses` filter
16742
- * specific to the selected backend without a separate fetch.
16743
- */
16744
- rawLabels: z.array(z.string()).readonly().optional()
16626
+ /** Event-store footprint for one camera. */
16627
+ var EventStoreDeviceFootprintSchema = z.object({
16628
+ deviceId: z.number(),
16629
+ /** Persisted event rows (motion + object + audio) for the camera. */
16630
+ rows: z.number().int(),
16631
+ /** Event-owned media bytes on disk for the camera. */
16632
+ bytes: z.number().int()
16745
16633
  });
16746
- var AudioCapabilitiesSchema = z.object({
16747
- activeBackend: z.string(),
16748
- availableBackends: z.array(AudioBackendSchema).readonly(),
16749
- sampleRate: z.number(),
16750
- chunkDurationMs: z.number()
16634
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
16635
+ var EventStoreFootprintSchema = z.object({
16636
+ totalRows: z.number().int(),
16637
+ totalBytes: z.number().int(),
16638
+ devices: z.array(EventStoreDeviceFootprintSchema).readonly()
16751
16639
  });
16752
- var DownloadModelResultSchema = z.object({
16753
- filePath: z.string(),
16754
- sizeMB: z.number(),
16755
- durationMs: z.number()
16640
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
16641
+ var EventPruneCountsSchema = z.object({
16642
+ motion: z.number().int(),
16643
+ object: z.number().int(),
16644
+ audio: z.number().int()
16756
16645
  });
16757
16646
  /**
16758
- * Wrapper carrying a single test run's result. Replaces the legacy
16759
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16760
- * canonical `AudioResult` from the Phase 6 output rework: one
16761
- * `AudioDetection` per class above `minScore`, top-N candidates in
16762
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
16763
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16764
- * benchmark UI can still report a clean failure when the classifier
16765
- * cap isn't available.
16647
+ * Re-embed stored tracks from their key frames.
16648
+ *
16649
+ * The reason this is an operator-callable method and not a migration script:
16650
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
16651
+ * squaring is only changeable if the existing vectors can be regenerated.
16652
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
16653
+ * symptom is a quality regression with no visible cause.
16766
16654
  */
16767
- var AudioTestResultSchema = z.object({
16768
- success: z.boolean(),
16769
- error: z.string().optional(),
16770
- frame: z.custom().optional()
16655
+ var RebuildObjectEmbeddingsInput = z.object({
16656
+ /** Restrict to one camera. Omit for the whole fleet. */
16657
+ deviceId: z.number().optional(),
16658
+ since: z.number().optional(),
16659
+ until: z.number().optional(),
16660
+ /** Stop after this many tracks; the result reports whether more remain. */
16661
+ maxTracks: z.number().int().positive().optional(),
16662
+ /**
16663
+ * Run every embedding on THIS node instead of round-robining the fleet.
16664
+ *
16665
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
16666
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
16667
+ * calling it that would pin the rebuild REQUEST itself to that node — the
16668
+ * rebuild orchestration lives on the hub, and only the per-track step runs
16669
+ * remotely. This field is data; the per-track pin is applied inside.
16670
+ *
16671
+ * Absent ⇒ round-robin over every online node whose runner can serve the
16672
+ * pinned model.
16673
+ */
16674
+ executeOnNodeId: z.string().optional(),
16675
+ /**
16676
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
16677
+ * run flat out.
16678
+ *
16679
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
16680
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
16681
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
16682
+ * force is logged at start and finish so a deliberately slow pass reads
16683
+ * differently from a stalled one.
16684
+ */
16685
+ pacingMs: z.number().int().nonnegative().optional()
16771
16686
  });
16772
- var PipelineConfigBridge = z.custom();
16773
- var ConfigUISchemaBridge = z.custom();
16774
- var ConfigUISchemaNullableBridge = z.custom();
16775
- var InferenceCapabilitiesBridge = z.custom();
16776
- var ModelAvailabilityListBridge = z.custom();
16777
- var PipelineRunResultBridge = z.custom();
16778
16687
  /**
16779
- * Pipeline executor detection engine + configuration + inference API.
16688
+ * Result of emptying the CLIP index.
16780
16689
  *
16781
- * Merged from: pipeline-executor, pipeline-config, inference, detection-config.
16782
- * Implemented by the detection-pipeline addon.
16690
+ * The clean slate before a policy change: a new crop margin or encoder model
16691
+ * leaves two feature spaces in one index whose cosine scores are not
16692
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
16693
+ * means the same thing.
16694
+ */
16695
+ var WipeObjectEmbeddingsResultSchema = z.object({ deleted: z.number() });
16696
+ /**
16697
+ * Acknowledgement that a rebuild STARTED.
16783
16698
  *
16784
- * Per-device surface (DeviceSettingsContribution + the "is detection
16785
- * enabled for this camera?" toggle) lives on the paired
16786
- * `detection-pipeline` cap (device-scoped, singleton, wrapper
16787
- * defaultActive) same split pattern used by stream-broker /
16788
- * camera-streams and audio-analyzer / audio-analysis.
16699
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
16700
+ * runs detached and this returns immediately. Waiting for it made the client
16701
+ * time out while the work carried on server-side, which is the worst of both:
16702
+ * no result and no way to know it was still going. Poll
16703
+ * `getObjectEmbeddingRebuildStatus` for progress.
16789
16704
  */
16790
- var pipelineExecutorCapability = {
16791
- name: "pipeline-executor",
16792
- scope: "system",
16705
+ var RebuildObjectEmbeddingsResultSchema = z.object({
16706
+ started: z.boolean(),
16707
+ /** True when a pass was already running; the new request is ignored. */
16708
+ alreadyRunning: z.boolean()
16709
+ });
16710
+ var RebuildStatusSchema = z.object({
16711
+ running: z.boolean(),
16712
+ scanned: z.number(),
16713
+ rebuilt: z.number(),
16714
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
16715
+ missingKeyFrame: z.number(),
16716
+ /** Tracks with no usable detection box. */
16717
+ missingBbox: z.number(),
16718
+ /**
16719
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
16720
+ * frame, a step that threw. Separate from `failed` because the remedy is
16721
+ * different, and because a whole camera silently contributing zero vectors
16722
+ * is the shape of failure a rebuild must never hide.
16723
+ */
16724
+ notRunnable: z.number(),
16725
+ /**
16726
+ * The pass stopped because NO node could serve the pinned model.
16727
+ *
16728
+ * Distinct from `notRunnable` on purpose: that one says "this track was
16729
+ * refused", this one says "the cluster cannot do this work at all" — every
16730
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
16731
+ * pinned model for its engine format, or dropped out. The remedy is a model /
16732
+ * engine change, not a per-camera one. Non-zero here always comes with
16733
+ * `complete: false`.
16734
+ */
16735
+ noCapableNode: z.number(),
16736
+ failed: z.number(),
16737
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
16738
+ complete: z.boolean().nullable(),
16739
+ startedAtMs: z.number().nullable(),
16740
+ finishedAtMs: z.number().nullable(),
16741
+ /** Present when the pass ended by throwing. */
16742
+ error: z.string().nullable()
16743
+ });
16744
+ var ReplayFrameInputSchema = z.object({
16745
+ timestamp: z.number(),
16746
+ frame: PipelineRunResultBridge
16747
+ });
16748
+ var ReplayTrackSchema = z.object({
16749
+ className: z.string(),
16750
+ firstSeenMs: z.number(),
16751
+ lastSeenMs: z.number(),
16752
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
16753
+ * frame — a representative box for the diff's `(className, window, IoU)`
16754
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
16755
+ * trajectory production's `Track.positions` keeps. */
16756
+ bbox: BoundingBoxSchema,
16757
+ /** How many of the input frames this track matched a real detection on
16758
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
16759
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
16760
+ framesMatched: z.number().int()
16761
+ });
16762
+ var RunReplayFrameProcessorResultSchema = z.object({ tracks: z.array(ReplayTrackSchema).readonly() });
16763
+ var pipelineAnalyticsCapability = {
16764
+ name: "pipeline-analytics",
16765
+ scope: "device",
16793
16766
  mode: "singleton",
16767
+ kind: "wrapper",
16768
+ defaultActive: true,
16769
+ deviceTypes: [DeviceType.Camera],
16770
+ exposesDeviceSettings: true,
16794
16771
  methods: {
16795
- getAvailableEngines: method(z.void(), z.array(PipelineEngineChoiceSchema)),
16796
- getSelectedEngine: method(z.void(), PipelineEngineChoiceSchema),
16797
- getDefaultSteps: method(PipelineEngineChoiceSchema, z.array(PipelineDefaultStepSchema)),
16772
+ getActiveTracks: method(z.object({ deviceId: z.number() }), z.array(TrackSchema).readonly()),
16773
+ getTrack: method(z.object({
16774
+ deviceId: z.number(),
16775
+ trackId: z.string()
16776
+ }), TrackSchema.nullable()),
16777
+ /** Historical completed tracks for a device. Queried from the
16778
+ * persisted `pipeline-analytics:tracks` collection; active tracks
16779
+ * still in RAM are not included. */
16780
+ listTracks: method(z.object({
16781
+ deviceId: z.number(),
16782
+ since: z.number().optional(),
16783
+ until: z.number().optional(),
16784
+ limit: z.number().optional(),
16785
+ /** Spatial filter — only tracks whose trajectory intersects the zone
16786
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
16787
+ * envelope columns, then precisely tested per position. Tracks with
16788
+ * an unknown envelope (no frame dims at persist time) always match. */
16789
+ zone: TrackZoneFilterSchema.optional(),
16790
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
16791
+ * compatible — omitting the field keeps today's exact behaviour). */
16792
+ projection: TrackProjectionSchema.optional(),
16793
+ /** Include stationary-promoted rows (parked objects handed to the
16794
+ * stationary registry). Default false: the timeline lists passages,
16795
+ * not parking records (operator decision, 2026-08-15). */
16796
+ includeStationary: z.boolean().optional()
16797
+ }), z.array(TrackSchema).readonly()),
16798
+ /**
16799
+ * Batched cluster-wide track listing — ONE call for the events page /
16800
+ * reel first paint instead of a per-camera `listTracks` fan-out. Merges
16801
+ * the persisted completed tracks of every requested device, sorted by
16802
+ * `lastSeen` DESC with a stable (lastSeen, trackId) cursor. Per-device
16803
+ * indexed pages (`idx_tracks_device_lastSeen`) are k-way merged
16804
+ * provider-side; `projection: 'slim'` drops the heavy `positions[]` /
16805
+ * `snapshots[]` JSON (returned as empty arrays). Active in-RAM tracks
16806
+ * are not included (same contract as `listTracks`).
16807
+ */
16808
+ listRecentTracks: method(RecentTracksQueryInput, RecentTracksPageSchema),
16809
+ /**
16810
+ * Batched co-moving group listing — the Groups feed. Same merge/cursor
16811
+ * contract as {@link listRecentTracks}. A group is a sealed partition of
16812
+ * one session; `getGroup` is the detail with members.
16813
+ */
16814
+ listGroups: method(ListGroupsQueryInput, ListGroupsPageSchema),
16815
+ getGroup: method(z.object({
16816
+ deviceId: z.number(),
16817
+ groupId: z.string().min(1)
16818
+ }), AnalyticsGroupDetailSchema.nullable()),
16819
+ clearTracks: method(z.object({ deviceId: z.number() }), z.void(), {
16820
+ kind: "mutation",
16821
+ auth: "admin"
16822
+ }),
16823
+ getMotionEvents: method(DeviceEventQueryInput, z.array(MotionEventSchema).readonly()),
16824
+ getObjectEvents: method(ObjectEventQueryInput, z.array(ObjectEventSchema).readonly()),
16825
+ getAudioEvents: method(DeviceEventQueryInput, z.array(AudioEventSchema).readonly()),
16826
+ /**
16827
+ * Every event kind the device can produce: built-ins (motion + audio),
16828
+ * detection classes actually observed for the device (from the track
16829
+ * history), and sensor kinds contributed by LINKED devices (resolved via
16830
+ * `device-manager.getLinkedDevices`, mapped through `EVENT_KIND_BY_CAP`).
16831
+ */
16832
+ listEventKinds: method(z.object({ deviceId: z.number() }), z.array(EventKindDescriptorSchema).readonly()),
16833
+ /**
16834
+ * The same answer for many cameras in ONE call.
16835
+ *
16836
+ * `listEventKinds` is the slowest per-device query on the hub — measured
16837
+ * at ~100 ms against 6-11 ms for its neighbours — because composing it
16838
+ * costs a `getCameraStatus`, a `getLinkedDevices` and one `getBindings`
16839
+ * per linked device. The viewer asks for it once per camera at first
16840
+ * paint, so twelve cameras paid twelve of those round-trips on top of the
16841
+ * per-camera cost.
16842
+ *
16843
+ * Batched, the camera statuses come from ONE `getCameraStatuses` instead
16844
+ * of N, and the per-device composition runs concurrently.
16845
+ *
16846
+ * Per-device rather than pre-merged on purpose: a caller that renders one
16847
+ * camera's lanes needs to know WHICH camera a kind came from, and merging
16848
+ * is three lines the caller can do. `listEventKinds` stays for
16849
+ * single-device callers.
16850
+ */
16851
+ listEventKindsBatch: method(z.object({ deviceIds: z.array(z.number()).min(1).max(200) }), z.array(EventKindsForDeviceSchema).readonly()),
16798
16852
  /**
16799
- * Per-node detection-engine provisioning snapshot. Returns the live
16800
- * state of the lazy runtime-provisioning machine on `nodeId`
16801
- * (idle / installing / verifying / ready / failed). The UI pairs this
16802
- * one-shot query with the `pipeline.engine-provisioning` live event
16803
- * (emitted on every transition) to drive a per-node "engine ready?"
16804
- * indicator without polling. Phase 2.
16853
+ * Sensor-event history for a camera: state changes of LINKED sensor
16854
+ * devices, attributed to the camera at ingest time (one row per linked
16855
+ * camera). Mirrors `getAudioEvents` query semantics; `kinds` narrows to
16856
+ * a kind subset.
16805
16857
  */
16806
- getEngineProvisioning: method(z.object({ nodeId: z.string() }), EngineProvisioningSchema),
16807
- getVideoPipelineSteps: method(z.void(), z.record(z.string(), z.object({
16808
- modelId: z.string(),
16809
- settings: z.record(z.string(), z.unknown()).readonly()
16810
- }))),
16811
- setVideoPipelineSteps: method(z.object({ steps: z.record(z.string(), z.object({
16812
- modelId: z.string(),
16813
- settings: z.record(z.string(), z.unknown()).readonly()
16814
- })) }), z.object({ success: z.literal(true) }), {
16858
+ getSensorEvents: method(z.object({
16859
+ deviceId: z.number(),
16860
+ since: z.number().optional(),
16861
+ until: z.number().optional(),
16862
+ kinds: z.array(z.string()).optional(),
16863
+ limit: z.number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
16864
+ }), z.array(SensorEventSchema).readonly()),
16865
+ /**
16866
+ * Importance-ranked highlights for a device+window. Queries completed
16867
+ * tracks by (deviceId, firstSeen ∈ [since,until]), scores each (or reuses
16868
+ * the persisted score), filters by minImportance/classFilter, orders by
16869
+ * importance desc, and returns up to `limit` compact key events mapped to
16870
+ * each track's best event. Legacy tracks lacking a persisted score are
16871
+ * scored on-read (no write). Degrades to `[]` on error.
16872
+ */
16873
+ getKeyEvents: method(KeyEventQueryInput, z.array(KeyEventSchema).readonly()),
16874
+ /** Server-side bucketed event counts for the 24-hour timeline.
16875
+ * Returns one entry per non-empty bucket; empty buckets are omitted. */
16876
+ getEventDensity: method(z.object({
16877
+ deviceId: z.number(),
16878
+ since: z.number(),
16879
+ until: z.number(),
16880
+ bucketMs: z.number().int().positive()
16881
+ }), z.array(z.object({
16882
+ bucketStart: z.number(),
16883
+ motion: z.number().int(),
16884
+ object: z.number().int(),
16885
+ audio: z.number().int()
16886
+ })).readonly()),
16887
+ /**
16888
+ * @deprecated Prefer `pruneTracksBefore` — the track is the ROOT of the
16889
+ * analytics model and retention must cascade from it (design §5.1). This
16890
+ * event-only prune leaves orphaned tracks/faces/plates/embeddings behind.
16891
+ * Retained as a compat shim for the Phase-B3 recorder orchestration caller,
16892
+ * which prunes events to keep history aligned with available footage and
16893
+ * reads the per-kind counts. Delete all events (motion + object + audio)
16894
+ * for the given device older than `cutoffMs` (exclusive) + their thumbnails
16895
+ * in lockstep; returns per-kind deleted counts.
16896
+ */
16897
+ pruneEventsBefore: method(z.object({
16898
+ deviceId: z.number(),
16899
+ cutoffMs: z.number()
16900
+ }), z.object({
16901
+ motion: z.number().int(),
16902
+ object: z.number().int(),
16903
+ audio: z.number().int()
16904
+ }), {
16815
16905
  kind: "mutation",
16816
16906
  auth: "admin"
16817
16907
  }),
16818
16908
  /**
16819
- * Clear THIS node's executor-side PER-DEVICE settings stores (the
16820
- * per-camera step overrides the object-detection root reads via
16821
- * `applyDeviceOverridesToTree`). `nodeId` is the ROUTING key the
16822
- * generated cap-router strips it (default `nodeIdMode: 'routing'`) and
16823
- * dispatches to that node, so the provider method runs ON the target
16824
- * node and receives no `nodeId`.
16909
+ * Track-centric retention entry point (design §5.1). Selects every
16910
+ * persisted track for the device whose `lastSeen < cutoffMs` (paged) and
16911
+ * runs the extensible whole-track deletion cascade (design §3): object
16912
+ * events + their media, track/face/plate-owned media, unassigned face
16913
+ * reads, per-track CLIP embeddings, then the track root LAST. ENROLLED
16914
+ * (assigned) faces/plates and `ownerKind:'identity'` media are exempt —
16915
+ * the durable matching gallery always persists. Fires the per-track
16916
+ * live-state cleanup so a pruned track can't linger in dispatch/overlay
16917
+ * state. Returns per-family deleted counts (`tracks` authoritative).
16825
16918
  *
16826
- * This is the slimmed executor leg of the orchestrator's
16827
- * `resetNodePipelineDefaults` flow (which owns the real reset: node
16828
- * addonDefaults pins + per-camera orchestrator overrides). The legacy
16829
- * `resetToDefault` — which reset a persisted global step-tree seed
16830
- * nothing in the live per-camera path read — was removed together with
16831
- * that seed.
16919
+ * Replaces `pruneEventsBefore` as the correct time-based retention prune.
16832
16920
  */
16833
- clearDeviceOverrides: method(z.object({ nodeId: z.string() }), z.object({
16834
- success: z.literal(true),
16835
- clearedDevices: z.number()
16921
+ pruneTracksBefore: method(z.object({
16922
+ deviceId: z.number(),
16923
+ cutoffMs: z.number()
16924
+ }), TrackCascadeCountsSchema, {
16925
+ kind: "mutation",
16926
+ auth: "admin"
16927
+ }),
16928
+ /**
16929
+ * Operator "clean slate" for a device (design §5.3): prune EVERY track for
16930
+ * the device via the same cascade as `pruneTracksBefore` with `cutoffMs =
16931
+ * now`. One call per device — no client-side track enumeration. Enrolled
16932
+ * gallery + identity media are exempt (design §4). Returns per-family
16933
+ * deleted counts.
16934
+ */
16935
+ wipeAllAnalytics: method(z.object({ deviceId: z.number() }), TrackCascadeCountsSchema, {
16936
+ kind: "mutation",
16937
+ auth: "admin"
16938
+ }),
16939
+ /**
16940
+ * Disk-wins reconcile for one camera. Drops media index rows whose blobs
16941
+ * are gone, then cascades tracks (including favourited and staging) that
16942
+ * have no remaining files. Enrolled identity/vehicle/scene media is never
16943
+ * probed. Trackless motion/audio events with no remaining file are dropped,
16944
+ * including snapshot-less rows.
16945
+ */
16946
+ reconcileFromDisk: method(z.object({ deviceId: z.number() }), DiskReconcileCountsSchema, {
16947
+ kind: "mutation",
16948
+ auth: "admin"
16949
+ }),
16950
+ /**
16951
+ * Delete whole tracks (object events) by id for the given device,
16952
+ * cascading their media in lockstep. Returns the number of tracks
16953
+ * actually deleted plus the ids that could not be removed.
16954
+ *
16955
+ * Operator-driven from the DI Events page (batch delete). Routes through
16956
+ * the same widened track-deletion cascade (design §5.2).
16957
+ */
16958
+ deleteTracks: method(z.object({
16959
+ deviceId: z.number(),
16960
+ trackIds: z.array(z.string()).min(1)
16961
+ }), z.object({
16962
+ deleted: z.number().int(),
16963
+ failed: z.array(z.string()).readonly()
16836
16964
  }), {
16837
16965
  kind: "mutation",
16838
16966
  auth: "admin"
16839
16967
  }),
16840
- getSchema: method(z.void(), PipelineSchemaSchema),
16841
- getGlobalSteps: method(z.void(), z.array(PipelineDefaultStepSchema).readonly().nullable()),
16842
- getGlobalPipelineConfig: method(z.void(), PipelineConfigBridge),
16843
- getOrchestratorConfigSchema: method(z.void(), ConfigUISchemaBridge),
16844
16968
  /**
16845
- * Gate B (pre-init config-correctness gate). PURE COMPUTE against this
16846
- * node's `currentEngine.format`resolves `steps` the same way the
16847
- * runtime dispatch path would, and reports what WOULD happen without
16848
- * touching any node-global state. Called by the orchestrator at attach
16849
- * time (`attachOn`), node-pinned to the TARGET node, so config problems
16850
- * surface BEFORE `pipelineRunner.attachCamera` rather than at the first
16851
- * per-frame resolve. `ok` is false iff `issues` is non-empty (both
16852
- * `unknown-addon` and `no-format-build` are HARD issues); `substitutions`
16853
- * is informational (a degraded-but-loadable model swap) and never
16854
- * affects `ok`. Never throws.
16969
+ * Set the per-track operator flags (`markForTrain`, `debug`, `favourited`) on ONE track.
16970
+ * The patch is PARTIAL an omitted key is left untouched — because the
16971
+ * three surfaces that write it (admin Events grid, viewer track detail,
16972
+ * viewer cluster detail) each own one toggle and must not clobber the other.
16973
+ *
16974
+ * Writes the track ROW: `markForTrain`/`debug` are per-TRACK state, so they
16975
+ * live where `label` and `importance` live, not in any per-device settings
16976
+ * store. Updates the in-RAM active track too, so a flag set on a live track
16977
+ * survives its expiry-time persist.
16978
+ *
16979
+ * `auth: 'protected'` (the default), NOT `admin`: the viewer is an
16980
+ * authenticated non-admin surface and two of the three call sites are
16981
+ * there. The note that used to sit here said to revisit this the day a flag
16982
+ * gained an effect that costs storage, and D81 is that day — `markForTrain`
16983
+ * now pins. It STAYS protected, and the reason is that the alternative
16984
+ * makes the feature pointless: marking a track is something you do while
16985
+ * looking at it, on the surface you were already looking at it on, and that
16986
+ * surface is the viewer. What the storage cost gets instead is a BOUND — a
16987
+ * per-device pin budget enforced in the body, refusing a new pin past the
16988
+ * limit while always allowing un-marking. `deleteTracks` next door is still
16989
+ * admin, because destroying evidence and preserving it are not symmetric.
16990
+ *
16991
+ * `markForTrain` writes the retrain LIFECYCLE, not a boolean column: `true`
16992
+ * is `none → staging`, `false` is `staging → none`. A track already
16993
+ * `trained` refuses BOTH — its frames are copies inside the retrain dataset
16994
+ * and re-staging it from a generic toggle is how the same material gets
16995
+ * annotated twice under two ground truths. Returning a trained track to
16996
+ * staging is a deliberate action of the retrain page, which is also the only
16997
+ * thing that produces `trained` in the first place.
16998
+ *
16999
+ * Returns the RESOLVED state of both flags (absent → `false`) plus the
17000
+ * `retrainStatus` they were derived from, so a caller can drive its toggle
17001
+ * — and render a `trained` badge — without a re-fetch. Rejects an unknown
17002
+ * track, a new staging mark on a device already holding its full budget, and
17003
+ * any `markForTrain` write against a trained track.
16855
17004
  */
16856
- validatePipeline: method(z.object({ steps: z.array(PipelineStepInputSchema) }), PipelineValidationResultSchema),
16857
- listTemplates: method(z.void(), z.array(PipelineTemplateSchema$1).readonly()),
16858
- saveTemplate: method(z.object({
16859
- name: z.string(),
16860
- steps: z.array(PipelineTemplateStepSchema).readonly(),
16861
- engine: PipelineEngineChoiceSchema
16862
- }), PipelineTemplateSchema$1, { kind: "mutation" }),
16863
- updateTemplate: method(z.object({
16864
- id: z.string(),
16865
- name: z.string().optional(),
16866
- steps: z.array(PipelineTemplateStepSchema).readonly().optional()
16867
- }), PipelineTemplateSchema$1, { kind: "mutation" }),
16868
- deleteTemplate: method(z.object({ id: z.string() }), z.void(), { kind: "mutation" }),
16869
- getCapabilities: method(z.void(), InferenceCapabilitiesBridge),
16870
- getAddonModels: method(z.object({ addonId: z.string() }), ModelAvailabilityListBridge),
16871
- downloadModel: method(z.object({
16872
- addonId: z.string(),
16873
- modelId: z.string(),
16874
- format: ModelFormatSchema$1
16875
- }), DownloadModelResultSchema, { kind: "mutation" }),
16876
- deleteModel: method(z.object({
16877
- addonId: z.string(),
16878
- modelId: z.string(),
16879
- format: ModelFormatSchema$1
16880
- }), z.object({ success: z.literal(true) }), { kind: "mutation" }),
17005
+ setTrackFlags: method(z.object({
17006
+ /** Log/audit scope only — the trackId is globally unique on its own. */
17007
+ deviceId: z.number(),
17008
+ trackId: z.string(),
17009
+ flags: TrackFlagsPatchSchema
17010
+ }), TrackFlagsSchema, { kind: "mutation" }),
16881
17011
  /**
16882
- * Stateless single-frame execution. Callers (runner, benchmark) pass
16883
- * the complete `engine` + `steps` tree; the executor holds no state
16884
- * about cameras or saved pipelines.
17012
+ * Durable event-store footprint for the management UI: event rows
17013
+ * (motion + object + audio) counted per camera + total, plus the
17014
+ * event-owned media bytes on disk per camera + total. Stat/count-based,
17015
+ * computed on demand.
17016
+ */
17017
+ getEventStoreFootprint: method(z.object({}), EventStoreFootprintSchema, {
17018
+ kind: "query",
17019
+ auth: "admin"
17020
+ }),
17021
+ /**
17022
+ * Cluster-wide prune of events older than `olderThanMs` (exclusive) across
17023
+ * every camera, deleting each event's media in lockstep. Logged to the
17024
+ * events ops-log with `reason` (default `'retention'`). Returns the summed
17025
+ * per-kind deleted counts.
17026
+ */
17027
+ pruneEvents: method(z.object({
17028
+ olderThanMs: z.number(),
17029
+ reason: OpsLogReasonSchema.optional()
17030
+ }), EventPruneCountsSchema, {
17031
+ kind: "mutation",
17032
+ auth: "admin"
17033
+ }),
17034
+ /**
17035
+ * Manually delete EVERY event (motion + object + audio) for one camera and
17036
+ * its event-owned media in lockstep. Logged to the events ops-log as
17037
+ * `op:'manual-delete', reason:'manual'`. Destructive — the admin UI guards
17038
+ * it behind a confirm.
17039
+ */
17040
+ deleteDeviceEvents: method(z.object({ deviceId: z.number() }), EventPruneCountsSchema, {
17041
+ kind: "mutation",
17042
+ auth: "admin"
17043
+ }),
17044
+ /** The events ops-log rows (newest-first), optionally scoped to one camera.
17045
+ * Backed by a declared pipeline-analytics SQLite collection. */
17046
+ /** Internal migration-participant lease. It drains active MediaStore
17047
+ * writes and refuses new ones without changing analytics bindings. */
17048
+ pauseForStorageMigration: method(StorageMigrationLeaseInputSchema, z.object({ paused: z.literal(true) }), {
17049
+ kind: "mutation",
17050
+ auth: "admin"
17051
+ }),
17052
+ resumeForStorageMigration: method(StorageMigrationLeaseInputSchema, z.object({ resumed: z.literal(true) }), {
17053
+ kind: "mutation",
17054
+ auth: "admin"
17055
+ }),
17056
+ /** Drops cached location roots after the storage coordinator repoints a
17057
+ * default so future event-media writes use the new root. */
17058
+ refreshStorageLocationsForMigration: method(StorageMigrationLeaseInputSchema, z.object({ refreshed: z.literal(true) }), {
17059
+ kind: "mutation",
17060
+ auth: "admin"
17061
+ }),
17062
+ startStorageMigrationMove: method(StorageMigrationMediaMoveInputSchema, z.object({ jobId: z.string() }), {
17063
+ kind: "mutation",
17064
+ auth: "admin"
17065
+ }),
17066
+ getStorageMigrationMoveStatus: method(z.object({ jobId: z.string() }), RelocateJobSchema.nullable(), { auth: "admin" }),
17067
+ cancelStorageMigrationMove: method(z.object({ jobId: z.string() }), z.object({ cancelled: z.boolean() }), {
17068
+ kind: "mutation",
17069
+ auth: "admin"
17070
+ }),
17071
+ /**
17072
+ * Moves event media between locations — the OPERATOR's mover, without the
17073
+ * coordinator's lease. Twin of `recording.relocateFootage`: the same
17074
+ * engine the lease-gated coordinated migration uses
17075
+ * (`startStorageMigrationMove`), armable in the background and WITHOUT
17076
+ * pausing anything. Exists because `eventMedia` was the only storage
17077
+ * class whose only move path went through the recorder's global pause.
17078
+ */
17079
+ relocateMedia: method(RelocateMediaInputSchema, z.object({ jobId: z.string() }), {
17080
+ kind: "mutation",
17081
+ auth: "admin"
17082
+ }),
17083
+ /** Every relocate job this addon knows about, newest first (in RAM: the
17084
+ * move is resumable, so a lost list costs nothing but the display). */
17085
+ listRelocateMediaJobs: method(z.object({}), z.array(RelocateJobSchema).readonly(), {
17086
+ kind: "query",
17087
+ auth: "admin"
17088
+ }),
17089
+ /** Cancel a running or queued relocate job. */
17090
+ cancelRelocateMedia: method(z.object({ jobId: z.string() }), z.object({ cancelled: z.boolean() }), {
17091
+ kind: "mutation",
17092
+ auth: "admin"
17093
+ }),
17094
+ listOpsLog: method(OpsLogQueryInputSchema, z.array(OpsLogEntrySchema).readonly(), {
17095
+ kind: "query",
17096
+ auth: "admin"
17097
+ }),
17098
+ /**
17099
+ * The CHEAP QUESTION, asked before any media moves: how big is the dataset
17100
+ * the marked (`markForTrain`) tracks would produce?
16885
17101
  *
16886
- * `engine` is optional during the migration window to preserve the
16887
- * legacy call shape used by existing benchmark code; once all
16888
- * callers pass it explicitly we make it required.
17102
+ * Answered from media INDEX rows only key, kind, size, timestamp — so it
17103
+ * costs ~2 KB of reads per track and no blob reads at all. The measured harm
17104
+ * behind D56 was a bulk pass that read and base64'd every blob a track owned
17105
+ * before deciding anything, taking hub-main to 82 s busy out of 120; an
17106
+ * export is that same I/O shape, so it inherits the same discipline: know
17107
+ * the size, then decide.
16889
17108
  *
16890
- * Exactly one of `frame`, `frameRef`, `frameHandle`, `imageBase64`,
16891
- * `referenceImage` must be provided:
16892
- * - `frame`: runtime dispatch path (runner → decoded broker frame).
16893
- * Carries the raw buffer, dimensions, and format; the executor
16894
- * uses it directly without base64 round-tripping.
16895
- * - `frameHandle` (CB5): a zero-pixel shm `FrameHandle` for the SAME
16896
- * decoded frame. Both runner and executor are hub-local processes
16897
- * sharing `/dev/shm`, so the executor maps the named segment and
16898
- * reads the pixels back zero-copy — eliminating the ~1.2MB
16899
- * re-serialisation over UDS/MsgPack the `frame` path pays per call.
16900
- * High-risk: the FrameRing is a latest-wins seqlock with no
16901
- * refcount, so a recycled slot yields a null read; the executor
16902
- * then degrades to an empty result and the runner ships pixels via
16903
- * `frame` as the fallback (queue-depth gated on the runner side).
16904
- * - `imageBase64`: one-shot test path (benchmark ImageTab).
16905
- * - `referenceImage`: named file from the reference-image store.
17109
+ * `truncated` reports that more marked tracks exist than one pass carries.
17110
+ * Empty `deviceIds` every device that has marked tracks.
16906
17111
  */
16907
- runPipeline: method(z.object({
16908
- engine: PipelineEngineChoiceSchema.optional(),
16909
- steps: z.array(PipelineStepInputSchema).min(1),
16910
- frame: FrameInputSchema.optional(),
16911
- /**
16912
- * Process-local lazy frame. Valid only when caller and provider resolve
16913
- * in the same execution-group process; split/cross-node callers use
16914
- * `frame`/`image` inline compatibility instead.
16915
- */
16916
- frameRef: FrameRefSchema.optional(),
16917
- /**
16918
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
16919
- * the decoded pixels live in. One more member of the one-of
16920
- * frame/frameHandle/image/imageBase64/referenceImage group.
16921
- */
16922
- frameHandle: FrameHandleSchema.optional(),
16923
- imageBase64: z.string().optional(),
16924
- /**
16925
- * Binary JPEG bytes — preferred over `imageBase64` on internal
16926
- * hops (hub → forked worker via Moleculer MsgPack) because it
16927
- * skips the 33% base64 overhead + the per-call base64 decode on
16928
- * the detection-pipeline worker. Callers can pass either; exactly
16929
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16930
- */
16931
- image: z.instanceof(Uint8Array).optional(),
16932
- referenceImage: z.string().optional(),
16933
- deviceId: z.number().optional(),
16934
- sessionId: z.string().optional(),
16935
- /**
16936
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
16937
- * reference-image, and detail-subtree calls. 'frame' is the live
16938
- * per-frame dispatch: ONLY root-plane steps run; crop children
16939
- * (inputClasses ≠ null) are skipped and served per-track via
16940
- * pipelineRunner.runDetailSubtree (two-plane design).
16941
- */
16942
- plane: z.enum(["full", "frame"]).optional(),
16943
- /**
16944
- * Inference-device selector (Phase 2 multi-device). Format
16945
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16946
- * Omitted ⇒ the runner's default device (current single-engine
16947
- * behaviour). Selects WHICH device pool of the node runs the call.
16948
- */
16949
- deviceKey: z.string().optional(),
16950
- /**
16951
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16952
- * when the parent crop was resolved from the frame's retained NATIVE
16953
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16954
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16955
- * resolution from that surface — the SAME quality path faces already
16956
- * had — instead of the downscaled parent tile. `handle` keys the native
16957
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16958
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16959
- * the executor's crop-normalized child ROI back into frame-normalized
16960
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16961
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16962
- * (today's behaviour on the fallback path).
16963
- */
16964
- nativeCropRef: NativeCropRefSchema.optional()
16965
- }), PipelineRunResultBridge, { kind: "mutation" }),
17112
+ getTrainingExportSummary: method(z.object({ deviceIds: z.array(z.number()).optional() }), TrainingExportSummarySchema, {
17113
+ kind: "query",
17114
+ auth: "admin"
17115
+ }),
16966
17116
  /**
16967
- * Batched run N raw frames packed into one cap call. The provider
16968
- * routes the batch through `SharedInferencePool.inferBatch`
16969
- * (`MSG_INFER_BATCH = 0x03`) so the IPC framing and JSON response
16970
- * envelope cost is amortised N:1 vs N concurrent `runPipeline`
16971
- * calls. Single root step + uniform model assumed; trees with crop
16972
- * children fall back to sequential execution.
17117
+ * Where to download the dataset archive.
17118
+ *
17119
+ * The BYTES do not come back through this cap — they come from the returned
17120
+ * data-plane URL, which streams a tar built entry by entry. A multi-gigabyte
17121
+ * archive base64'd through a unary RPC envelope would be held whole in
17122
+ * memory twice on a hub this repo has already OOM'd once (D9/D18 are the
17123
+ * same lesson about frames). `getDownloadUrl` on `recordingExport` is the
17124
+ * precedent, and this follows it deliberately.
17125
+ *
17126
+ * The archive contains a `manifest.json` FIRST, then the stored media
17127
+ * VERBATIM under `tracks/<deviceId>/<trackId>/…`. No crop is derived and no
17128
+ * model is run: a training set's pixels must be the pixels the pipeline saw.
17129
+ */
17130
+ getTrainingExportUrl: method(z.object({ deviceIds: z.array(z.number()).optional() }), z.object({ url: z.string() }), {
17131
+ kind: "query",
17132
+ auth: "admin"
17133
+ }),
17134
+ /**
17135
+ * The staging worklist for one camera, or for every camera that has one.
17136
+ *
17137
+ * Fetched ON DEMAND, over the staging set only — the page never scans
17138
+ * history, because making the working set small is the entire purpose of
17139
+ * the mark. Each row carries how many frames the dataset already holds from
17140
+ * the track and how many subjects were annotated on them, so
17141
+ * `frameCount: 0` reads as "still to work" without a second call per track.
17142
+ *
17143
+ * `auth: 'admin'`, unlike the viewer-level mark itself: marking a track is
17144
+ * curation you do while looking at it, but building the training set the
17145
+ * fleet's models are fine-tuned on is not.
17146
+ */
17147
+ listRetrainStaging: method(z.object({
17148
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17149
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
17150
+ * route it at one camera's owner, and "every camera" would stop being
17151
+ * expressible at all. */
17152
+ deviceIds: z.array(z.number()).optional(),
17153
+ limit: z.number().int().min(1).max(500).optional()
17154
+ }), z.array(RetrainTrackSchema).readonly(), {
17155
+ kind: "query",
17156
+ auth: "admin"
17157
+ }),
17158
+ /**
17159
+ * What a track can contribute, and what it already has.
17160
+ *
17161
+ * `candidates` are the track's whole, unannotated frames — index rows only,
17162
+ * so this is cheap. `copies` are the frames already inside the dataset, and
17163
+ * a candidate whose copy exists is marked `copied: true`: selecting it again
17164
+ * is free and CANNOT fail, whatever became of the original.
17165
+ *
17166
+ * A crop, a thumbnail and `fullFrameBoxed` are never candidates. The last
17167
+ * one matters most: it has the model's own rectangle burned into the pixels,
17168
+ * and a detector trained on it learns to find a green line.
17169
+ */
17170
+ listRetrainFrames: method(z.object({ trackId: z.string() }), RetrainFrameListSchema, {
17171
+ kind: "query",
17172
+ auth: "admin"
17173
+ }),
17174
+ /**
17175
+ * COPY-ON-SELECT — the write that makes `trained` safe to evict.
17176
+ *
17177
+ * Selecting a frame copies its bytes into retrain storage immediately: not
17178
+ * a reference, not a lease. Once the copy exists the dataset no longer
17179
+ * depends on the track's media, which is exactly what lets D81 hand a
17180
+ * `trained` track back to retention.
17181
+ *
17182
+ * The order inside is load-bearing and is pinned by a test: an EXISTING
17183
+ * copy is returned without touching the source, so an original that
17184
+ * evaporated blocks the selection of THAT ORIGINAL and never the copy
17185
+ * already taken. Every refusal comes back named — a dropped selection is
17186
+ * never silent, on the wire or in the log.
17187
+ */
17188
+ selectRetrainFrames: method(z.object({
17189
+ deviceId: z.number(),
17190
+ trackId: z.string(),
17191
+ mediaKeys: z.array(z.string()).min(1)
17192
+ }), RetrainFrameSelectionSchema, {
17193
+ kind: "mutation",
17194
+ auth: "admin"
17195
+ }),
17196
+ /** Un-select a frame: its annotations go first, then the copy and its blob.
17197
+ * Deliberately destructive and deliberately explicit — it is the only way
17198
+ * a frame leaves the dataset before export. */
17199
+ deselectRetrainFrame: method(z.object({
17200
+ deviceId: z.number(),
17201
+ trackId: z.string(),
17202
+ frameId: z.string()
17203
+ }), z.object({
17204
+ removed: z.boolean(),
17205
+ removedAnnotations: z.number().int()
17206
+ }), {
17207
+ kind: "mutation",
17208
+ auth: "admin"
17209
+ }),
17210
+ /**
17211
+ * The pixels of ONE copied frame, base64.
17212
+ *
17213
+ * Through the cap rather than a data plane because it is genuinely one
17214
+ * frame at a time, on demand, at human speed — the shape D9/D18 permit
17215
+ * (what they forbid is frames crossing a boundary at frame RATE). The
17216
+ * annotation canvas needs the image and its exact dimensions in the same
17217
+ * answer: a canvas that places a normalised box against a size it guessed
17218
+ * draws every box in the wrong place.
17219
+ */
17220
+ getRetrainFrameImage: method(z.object({ frameId: z.string() }), z.object({
17221
+ base64: z.string(),
17222
+ width: z.number().int(),
17223
+ height: z.number().int()
17224
+ }), {
17225
+ kind: "query",
17226
+ auth: "admin"
17227
+ }),
17228
+ /**
17229
+ * Ask the pipeline what it sees, as a PROPOSAL.
17230
+ *
17231
+ * Runs through `pipelineRunner.runStatelessStep` on the COPIED frame, and
17232
+ * every box comes back as a draft with `source: 'assist'` plus the model and
17233
+ * score that produced it. The operator confirms, edits, adds and deletes;
17234
+ * nothing is stored until `saveRetrainAnnotations`.
16973
17235
  *
16974
- * Used by `scripts/bench-batch-style.mts` for batch benchmarking
16975
- * N frames in one call to amortise per-call IPC overhead.
17236
+ * For packages the request is `rfdetr-package` on the ZONE CROP at 0.35
17237
+ * never the whole frame, where a package detector at that threshold proposes
17238
+ * furniture. A package request with no zone is REFUSED rather than widened,
17239
+ * because the silent widening would look like a bad model for as long as
17240
+ * nobody checked which rectangle it ran on.
16976
17241
  */
16977
- runPipelineBatch: method(z.object({
16978
- engine: PipelineEngineChoiceSchema.optional(),
16979
- steps: z.array(PipelineStepInputSchema).min(1),
16980
- frames: z.array(FrameInputSchema).min(1).max(255),
16981
- deviceId: z.number().optional(),
16982
- sessionId: z.string().optional(),
16983
- /**
16984
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16985
- * the batch to the Python pool's bench preprocess cache
16986
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16987
- * preprocessed ONCE and every later inference is a pure-inference cache
16988
- * hit — the sustained-throughput run measures inference, not
16989
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
16990
- * full preprocess every call, correct). Fresh per sustained run;
16991
- * released via `uncacheFrame`.
16992
- */
16993
- frameId: z.number().int().nonnegative().optional(),
16994
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16995
- deviceKey: z.string().optional()
16996
- }), z.object({ results: z.array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }),
17242
+ proposeRetrainAnnotations: method(z.object({
17243
+ deviceId: z.number(),
17244
+ trackId: z.string(),
17245
+ frameId: z.string(),
17246
+ subject: RetrainAssistSubjectSchema,
17247
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17248
+ nodeId: z.string().optional()
17249
+ }), RetrainAssistResultSchema, {
17250
+ kind: "mutation",
17251
+ auth: "admin"
17252
+ }),
16997
17253
  /**
16998
- * Cache a raw frame inside the Python inference pool's memory.
16999
- * Returns a numeric `frameId` that `inferCached` references
17000
- * subsequent calls send only 5 bytes through the pipe instead of
17001
- * 1.2MB raw data, eliminating the pipe transfer bottleneck.
17254
+ * The FrameProcessor pass of a replay run see the `Replay` section
17255
+ * above this capability's definition for why this is not the
17256
+ * `processFrame` method this file's header says pipeline-analytics does
17257
+ * not have.
17258
+ *
17259
+ * Constructs a FRESH `FrameProcessor` for `(deviceId, source)`, feeds it
17260
+ * `frames` IN THE ORDER GIVEN (the caller is responsible for time
17261
+ * ordering — this method does not sort), and returns the tracks it
17262
+ * produced. Zero persistence: no `TrackStore`, no event bus, no media
17263
+ * capture. `zones` / `detectionRules` are the run's OWN zone set —
17264
+ * typically the camera's real zones plus an ephemeral overlay
17265
+ * (`addon-benchmark`'s `replay-plan.ts`), never read from or written to
17266
+ * the `zones` capability by this method itself.
17002
17267
  */
17003
- cacheFrameInPool: method(z.object({
17004
- data: z.instanceof(Uint8Array),
17005
- width: z.number().int().positive(),
17006
- height: z.number().int().positive(),
17007
- format: z.enum([
17008
- "rgb",
17009
- "bgr",
17010
- "gray"
17011
- ])
17012
- }), z.object({
17013
- frameId: z.number(),
17014
- width: z.number(),
17015
- height: z.number()
17016
- }), { kind: "mutation" }),
17268
+ runReplayFrameProcessor: method(z.object({
17269
+ deviceId: z.number(),
17270
+ source: DetectionSourceSchema,
17271
+ zones: z.array(ZoneSchema).readonly().optional(),
17272
+ detectionRules: z.array(ZoneRuleSchema).readonly().optional(),
17273
+ zoneMembershipMinOverlap: z.number().min(0).max(1).optional(),
17274
+ frames: z.array(ReplayFrameInputSchema).min(1)
17275
+ }), RunReplayFrameProcessorResultSchema, {
17276
+ kind: "mutation",
17277
+ auth: "admin"
17278
+ }),
17279
+ /** Every annotation on a track, oldest first. */
17280
+ listRetrainAnnotations: method(z.object({ trackId: z.string() }), z.array(RetrainAnnotationSchema).readonly(), {
17281
+ kind: "query",
17282
+ auth: "admin"
17283
+ }),
17017
17284
  /**
17018
- * Run inference on a previously cached frame. Sends only 5 bytes
17019
- * (model_idx + frameId) through the IPC pipe — eliminates the
17020
- * ~35ms per-call overhead of transferring 1.2MB raw data.
17285
+ * Replace EVERY annotation on one frame with the supplied set.
17286
+ *
17287
+ * Whole-frame replacement, not per-box upsert: the unit of ground truth is
17288
+ * the frame, and "the operator deleted a box" must be the same durable
17289
+ * outcome as "the operator never drew it". A per-box patch would let a frame
17290
+ * keep a box the operator removed on a surface that only knew about the
17291
+ * boxes it sent.
17292
+ *
17293
+ * Refuses a macro class typed into `label` or `subLabel` — the tiers are
17294
+ * separate and the guard is at the WRITE, because a mixed taxonomy cannot
17295
+ * be un-mixed by reading it.
17021
17296
  */
17022
- inferCached: method(z.object({
17023
- stepId: z.string(),
17024
- frameId: z.number().int()
17025
- }), z.record(z.string(), z.unknown()), { kind: "mutation" }),
17297
+ saveRetrainAnnotations: method(z.object({
17298
+ deviceId: z.number(),
17299
+ trackId: z.string(),
17300
+ frameId: z.string(),
17301
+ annotations: z.array(RetrainAnnotationDraftSchema)
17302
+ }), z.array(RetrainAnnotationSchema).readonly(), {
17303
+ kind: "mutation",
17304
+ auth: "admin"
17305
+ }),
17026
17306
  /**
17027
- * Release a cached frame from the Python pool's memory.
17307
+ * Finish with a track: `staging trained`. **The only writer of that
17308
+ * state** — D81 shipped the column with it deliberately unreachable.
17309
+ *
17310
+ * Refuses a track the dataset holds no copies from. `trained` un-pins the
17311
+ * track's media, so completing without a copy is a delete order for material
17312
+ * nothing ever extracted anything from; that refusal IS the safety argument
17313
+ * of D81, expressed as a precondition.
17028
17314
  */
17029
- uncacheFrame: method(z.object({ frameId: z.number().int() }), z.void(), { kind: "mutation" }),
17030
- /** Returns the effective pool tuning (resolved from user overrides + backend defaults). */
17031
- getEffectiveTuning: method(z.void(), z.object({
17032
- batchMode: z.string(),
17033
- windowMs: z.number(),
17034
- maxBatchSize: z.number(),
17035
- concurrency: z.number()
17036
- })),
17315
+ completeRetrainTrack: method(z.object({
17316
+ deviceId: z.number(),
17317
+ trackId: z.string()
17318
+ }), RetrainTransitionResultSchema, {
17319
+ kind: "mutation",
17320
+ auth: "admin"
17321
+ }),
17037
17322
  /**
17038
- * List every EngineFactory currently loaded in this executor's RAM,
17039
- * with the models resident and a coarse "in use" marker derived from
17040
- * ongoing inference activity. Used by the Pipeline page Engines tab.
17323
+ * The deliberate return: `trained staging`, for the rare case.
17324
+ *
17325
+ * The generic `setTrackFlags` toggle refuses this in both directions by
17326
+ * design (D81) — re-staging from a checkbox is how the same material gets
17327
+ * annotated twice under two ground truths. Doing it here means the operator
17328
+ * is looking at the annotations that already exist while they decide, and
17329
+ * those annotations are LEFT ALONE: "put this back" must not be a
17330
+ * destructive act wearing a navigational name.
17041
17331
  */
17042
- listLoadedEngines: method(z.void(), z.array(z.object({
17043
- engineKey: z.string(),
17044
- engine: PipelineEngineChoiceSchema,
17045
- modelsLoaded: z.array(z.string()).readonly(),
17046
- inUseByCameras: z.array(z.number()).readonly(),
17047
- /**
17048
- * Origin of this resident factory.
17049
- * - `runtime` — main camera-serving engine (no idle TTL).
17050
- * - `warm-override` — benchmark/test override held in the warm
17051
- * cache; auto-disposed after the idle TTL.
17052
- * - `device-pool` — a concurrent per-device pool (Phase 2
17053
- * multi-device, keyed by `deviceKey`) resolved
17054
- * via `resolveDeviceFactory`. Runs alongside the
17055
- * `runtime` engine on a DIFFERENT accelerator
17056
- * (NPU / iGPU / Coral) — this is how the
17057
- * Engines tab shows all pools running at once.
17058
- */
17059
- kind: z.enum([
17060
- "runtime",
17061
- "warm-override",
17062
- "device-pool"
17063
- ]),
17064
- /** Native pid of the underlying Python pool (null when no pool). */
17065
- poolPid: z.number().nullable(),
17066
- /** ms since this factory was last used (null when not warm-tracked). */
17067
- idleMs: z.number().nullable(),
17068
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
17069
- idleTtlMs: z.number().nullable()
17070
- })).readonly()),
17071
- /** Warm up an engine without running a frame. No-op if already loaded. */
17072
- spinEngine: method(z.object({ engine: PipelineEngineChoiceSchema }), z.object({ success: z.literal(true) }), {
17332
+ restageRetrainTrack: method(z.object({
17333
+ deviceId: z.number(),
17334
+ trackId: z.string()
17335
+ }), RetrainTransitionResultSchema, {
17073
17336
  kind: "mutation",
17074
17337
  auth: "admin"
17075
17338
  }),
17076
17339
  /**
17077
- * Unload an engine from RAM. `force:true` unloads even when cameras
17078
- * are actively using it (they re-spin on next frame). Default is
17079
- * gated returns `{success:false, reason}` when in use.
17340
+ * Where to download the ANNOTATED dataset.
17341
+ *
17342
+ * The sibling of `getTrainingExportUrl` and deliberately not the same
17343
+ * archive: that one streams a marked track's stored media verbatim, this one
17344
+ * streams the retrain COPIES plus an `annotations.json` carrying, for every
17345
+ * subject, the canonical full-frame box AND the geometry derived for each
17346
+ * model shape (letterboxed root / zone-cropped package / subject-cropped
17347
+ * classifier). Derived at export, never stored — one box in, three shapes
17348
+ * out, so two crops of the same subject can never end up in one feature
17349
+ * space (D52).
17080
17350
  */
17081
- killEngine: method(z.object({
17082
- engine: PipelineEngineChoiceSchema,
17083
- force: z.boolean().optional()
17084
- }), z.object({
17085
- success: z.boolean(),
17086
- reason: z.string().optional()
17087
- }), {
17351
+ getRetrainExportUrl: method(z.object({ deviceIds: z.array(z.number()).optional() }), z.object({ url: z.string() }), {
17352
+ kind: "query",
17353
+ auth: "admin"
17354
+ }),
17355
+ getEventMedia: method(z.object({
17356
+ eventId: z.string(),
17357
+ kind: MediaFileKindEnum.optional(),
17358
+ deviceId: z.number()
17359
+ }), z.array(MediaFileSchema).readonly()),
17360
+ /** All media rows owned by a track. `kinds` narrows to a kind subset so a
17361
+ * client can fetch the SMALL display variants on open and pull the
17362
+ * multi-MB native variants only on demand (mirrors `getEventMedia.kind`).
17363
+ * Absent ⇒ every kind (back-compat). */
17364
+ getTrackMedia: method(z.object({
17365
+ trackId: z.string(),
17366
+ kinds: z.array(MediaFileKindEnum).optional(),
17367
+ deviceId: z.number()
17368
+ }), z.array(MediaFileSchema).readonly()),
17369
+ /**
17370
+ * What media a track HAS, without any of it.
17371
+ *
17372
+ * The detail view needs the shape of a track's media to build its strip —
17373
+ * which kinds exist, in what order, at what size — and then wants each tile
17374
+ * fetched as an image, not as base64 inside this response. Measured: the
17375
+ * full `getTrackMedia` is 5.3-7.7 MB and blocks the view; this manifest is
17376
+ * ~2 KB.
17377
+ *
17378
+ * It also restores a fact a `kinds` filter destroys: filtering
17379
+ * `getTrackMedia` drops whole ROWS, taking `kind` and `sizeBytes` with
17380
+ * them, so a client that fetched only the small variants could no longer
17381
+ * tell a full-resolution variant existed — and the affordance that opens it
17382
+ * would silently disappear.
17383
+ */
17384
+ listTrackMedia: method(z.object({
17385
+ trackId: z.string(),
17386
+ deviceId: z.number()
17387
+ }), z.array(MediaFileInfoSchema).readonly()),
17388
+ /**
17389
+ * Search object events by text query using CLIP cosine similarity.
17390
+ * Encodes `text` via the `embedding-encoder` cap, queries the
17391
+ * `ObjectEmbeddingStore` with optional prefilters, ranks all matching
17392
+ * embeddings by cosine similarity, and joins winners to their
17393
+ * ObjectEvents by trackId. Returns up to `limit` events scored ≥
17394
+ * `minScore`, sorted descending by score.
17395
+ */
17396
+ searchObjectEvents: method(SearchObjectEventsInput, z.array(ScoredObjectEventSchema).readonly()),
17397
+ wipeObjectEmbeddings: method(z.object({}), WipeObjectEmbeddingsResultSchema, {
17088
17398
  kind: "mutation",
17089
17399
  auth: "admin"
17090
17400
  }),
17091
- listReferenceImages: method(z.void(), z.array(ReferenceImageEntrySchema).readonly()),
17092
- getReferenceImage: method(z.object({ filename: z.string() }), ReferenceImageBodySchema.nullable()),
17093
- getReferenceAudioFiles: method(z.void(), z.array(ReferenceAudioEntrySchema).readonly()),
17094
- getReferenceAudio: method(z.object({ filename: z.string() }), ReferenceAudioBodySchema.nullable()),
17095
- getAudioCapabilities: method(z.void(), AudioCapabilitiesSchema),
17096
- runAudioTest: method(z.object({
17097
- addonId: z.string(),
17098
- modelId: z.string(),
17099
- filename: z.string().optional(),
17100
- settings: z.record(z.string(), z.unknown()).optional()
17101
- }), AudioTestResultSchema, { kind: "mutation" }),
17102
- getDetectionConfigSchema: method(z.void(), ConfigUISchemaNullableBridge)
17401
+ rebuildObjectEmbeddings: method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17402
+ kind: "mutation",
17403
+ auth: "admin"
17404
+ }),
17405
+ getObjectEmbeddingRebuildStatus: method(z.object({}), RebuildStatusSchema)
17406
+ },
17407
+ events: {
17408
+ /**
17409
+ * Enriched frame emitted after refinement — the live-overlay source of
17410
+ * truth (two-plane re-injection). Carries the frame's detections in the
17411
+ * `ObjectDetection` wire shape: first-level roots (with track info +
17412
+ * enrichment labels) plus synthesized `kind:'detail'` face/plate entries
17413
+ * re-projected from per-track detail state, so stream overlays render
17414
+ * boxes + recognized names without querying full Track state.
17415
+ */
17416
+ onFrameTracked: { data: z.object({
17417
+ deviceId: z.number(),
17418
+ timestamp: z.number(),
17419
+ frameWidth: z.number(),
17420
+ frameHeight: z.number(),
17421
+ detections: z.array(OverlayDetectionSchema).readonly()
17422
+ }) },
17423
+ /** Track entered active state (first-seen). */
17424
+ onTrackStarted: { data: z.object({
17425
+ deviceId: z.number(),
17426
+ trackId: z.string(),
17427
+ className: z.string()
17428
+ }) },
17429
+ /** Track expired (TTL reached after last detection). */
17430
+ onTrackEnded: { data: z.object({
17431
+ deviceId: z.number(),
17432
+ trackId: z.string(),
17433
+ className: z.string(),
17434
+ durationMs: z.number()
17435
+ }) },
17436
+ /** Canonical "something happened at device X" event, per-kind. */
17437
+ onDetectionEvent: { data: z.object({
17438
+ deviceId: z.number(),
17439
+ kind: EventKindSchema,
17440
+ eventId: z.string(),
17441
+ timestamp: z.number()
17442
+ }) }
17103
17443
  }
17104
17444
  };
17105
17445
  //#endregion
@@ -17130,108 +17470,6 @@ var CameraMetricsSchema = z.object({
17130
17470
  });
17131
17471
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: z.number() });
17132
17472
  //#endregion
17133
- //#region src/capabilities/zones.cap.ts
17134
- /**
17135
- * Zone — pure geometry + identity. NO filtering behaviour.
17136
- *
17137
- * Zones describe **where** in the frame the operator wants to flag
17138
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
17139
- * each pipeline stage uses them. Splitting the two means a single
17140
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
17141
- * a detection-include rule on `['car']`, and an occupancy aggregate
17142
- * — without three duplicated polygons.
17143
- *
17144
- * Owned by the orchestrator addon (provider) and mirrored into the
17145
- * `zones` device-state slice on every mutation. Consumers
17146
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
17147
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
17148
- * mirror with `onChanged`).
17149
- *
17150
- * Coordinates are normalised fractions of the frame (0–1) so zones
17151
- * survive resolution changes and stream profile switches.
17152
- *
17153
- * `kind` discriminates between full polygons (closed regions used
17154
- * for intrusion / occupancy filters) and tripwires (open 2-point
17155
- * line segments used for cross events). Onboard / firmware-reported
17156
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17157
- * task list.
17158
- */
17159
- var ZoneKindEnum = z.enum(["polygon", "tripwire"]);
17160
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17161
- var PolygonPointSchema = z.object({
17162
- x: z.number(),
17163
- y: z.number()
17164
- });
17165
- /** A camera detection zone — pure geometry/identity. */
17166
- var ZoneSchema = z.object({
17167
- id: z.string(),
17168
- name: z.string(),
17169
- kind: ZoneKindEnum.default("polygon"),
17170
- /** Polygon vertices, fraction of frame (0–1). */
17171
- polygon: z.array(PolygonPointSchema).readonly(),
17172
- /** Visual color for UI rendering. */
17173
- color: z.string().default("#3b82f6")
17174
- });
17175
- /**
17176
- * Zones capability — per-camera CRUD over polygon detection zones.
17177
- *
17178
- * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
17179
- * to per-device settings and mirrors into the `zones` device-state
17180
- * slice on every mutation, so downstream consumers can subscribe via
17181
- * `dev.state.zones.onChanged`.
17182
- *
17183
- * The cap surface only handles geometry + identity; filtering
17184
- * behaviour (per-class, include/exclude, threshold) lives in the
17185
- * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
17186
- * `capabilities/schemas/zone-rule.js`.
17187
- */
17188
- var zonesCapability = {
17189
- name: "zones",
17190
- scope: "device",
17191
- mode: "singleton",
17192
- deviceTypes: [DeviceType.Camera],
17193
- methods: {
17194
- listZones: method(z.object({ deviceId: z.number() }), z.array(ZoneSchema).readonly()),
17195
- addZone: method(z.object({
17196
- deviceId: z.number(),
17197
- zone: ZoneSchema
17198
- }), z.void(), {
17199
- kind: "mutation",
17200
- auth: "admin"
17201
- }),
17202
- removeZone: method(z.object({
17203
- deviceId: z.number(),
17204
- zoneId: z.string()
17205
- }), z.void(), {
17206
- kind: "mutation",
17207
- auth: "admin"
17208
- }),
17209
- updateZone: method(z.object({
17210
- deviceId: z.number(),
17211
- zone: ZoneSchema
17212
- }), z.void(), {
17213
- kind: "mutation",
17214
- auth: "admin"
17215
- })
17216
- },
17217
- /**
17218
- * Runtime-state slice — the live zone catalogue mirrored by the
17219
- * orchestrator on every CRUD mutation. Consumers read via
17220
- * `device.state.zones.value` / `.watch(...)` without round-tripping
17221
- * the cap, and the codegen DeviceProxy auto-wires the reactive
17222
- * handle. Slice shape is `{ zones: Zone[] }` so future extensions
17223
- * (e.g. zone groupings) can sit alongside the polygon list.
17224
- */
17225
- runtimeState: z.object({ zones: z.array(ZoneSchema).readonly() }),
17226
- /**
17227
- * Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
17228
- *
17229
- * See `RuntimeStateDurability`. Enforced by
17230
- * `scripts/check-runtime-state-durability.ts`.
17231
- */
17232
- durability: "restored"
17233
- };
17234
- //#endregion
17235
17473
  //#region src/capabilities/pipeline-runner.cap.ts
17236
17474
  /**
17237
17475
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
@@ -29156,98 +29394,6 @@ var sceneMonitorCapability = {
29156
29394
  durability: "session"
29157
29395
  };
29158
29396
  //#endregion
29159
- //#region src/capabilities/schemas/zone-rule.ts
29160
- /**
29161
- * Per-stage gating mode applied to the zones a rule references.
29162
- *
29163
- * - `include`: the rule contributes to a **whitelist** for its stage.
29164
- * When at least one `include` rule fires for a stage, only entities
29165
- * inside one of those zones pass that stage.
29166
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
29167
- * Entities inside one of those zones are dropped at that stage.
29168
- *
29169
- * `monitor`-style observation (count without filtering) is not a rule
29170
- * mode — zones without any matching rule are observed naturally by
29171
- * `zone-analytics` (live snapshot + history), so an "I just want to
29172
- * count, not filter" use case needs no rule at all.
29173
- */
29174
- var ZoneRuleModeEnum = z.enum(["include", "exclude"]);
29175
- /**
29176
- * Per-consumer rule that references existing zones (geometry) and
29177
- * defines how a specific pipeline stage should treat them. Each
29178
- * consumer addon owns its own `ZoneRule[]` array in its per-device
29179
- * settings:
29180
- *
29181
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
29182
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
29183
- * - future: notification rules, audio gating, etc.
29184
- *
29185
- * One rule applies to N zones (`zoneIds[]`) so the operator can
29186
- * express "ignore motion in ALL of {garden, street}" with a single
29187
- * rule. `classFilter` narrows the rule to specific object classes —
29188
- * "drop person detections in the street, but keep cars" is one
29189
- * `exclude` rule with `classFilter: ['person']`.
29190
- *
29191
- * `enabled` is a soft toggle — the operator can keep the rule
29192
- * configured but inert without deleting it.
29193
- */
29194
- var ZoneRuleSchema = z.object({
29195
- /** Stable rule id — survives edits, used by the UI for diffing. */
29196
- id: z.string(),
29197
- /** Optional human-readable label rendered in the rule editor. */
29198
- name: z.string().optional(),
29199
- /** Zones this rule targets. The rule's `mode` applies to ALL
29200
- * listed zones (OR-set: a detection in any one of them counts).
29201
- * At least one zone id required — a rule with no targets is a
29202
- * configuration mistake and the form validator rejects it. */
29203
- zoneIds: z.array(z.string()).min(1).readonly(),
29204
- mode: ZoneRuleModeEnum,
29205
- /**
29206
- * Class names this rule applies to. Empty / undefined ⇒ rule
29207
- * applies to every class. Class strings match the `macroClass`
29208
- * field on detections (e.g. `person`, `car`, `dog`).
29209
- */
29210
- classFilter: z.array(z.string()).readonly().optional(),
29211
- /**
29212
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
29213
- * required to consider an entity "in the zone". Defaults to the
29214
- * consumer's stage default when omitted. Kept for back-compat with
29215
- * existing per-rule overrides; new operators pick the value via
29216
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
29217
- * set, the lower-level engine reads it as a 0–1 fraction.
29218
- */
29219
- overlapThreshold: z.number().min(0).max(1).optional(),
29220
- /**
29221
- * Operator-friendly version of `overlapThreshold` — the percentage
29222
- * of the detection's bbox that must lie inside the zone for the
29223
- * rule to match. Documented default is 85%; the engine substitutes
29224
- * that when the field is omitted (kept optional so existing rules
29225
- * stored without it stay valid).
29226
- *
29227
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
29228
- * rule, the engine prefers `bboxInclusionPct` because it's the
29229
- * field exposed in the UI. Internally both feed the same gate.
29230
- */
29231
- bboxInclusionPct: z.number().min(0).max(100).optional(),
29232
- /**
29233
- * When `true` and a detection has a segmentation mask, use the
29234
- * mask for overlap instead of the bbox. Detection-stage only;
29235
- * motion rules ignore this field.
29236
- */
29237
- preferMask: z.boolean().optional(),
29238
- /**
29239
- * Soft-toggle: `false` disables the rule without deleting it.
29240
- * Defaults to `true` so operators creating a rule via the UI
29241
- * see it active immediately.
29242
- */
29243
- enabled: z.boolean().default(true)
29244
- });
29245
- /**
29246
- * Convenience array schema — used by addon device-settings
29247
- * contributions and runtime payloads (e.g. `RunnerCameraConfig`).
29248
- */
29249
- var ZoneRulesArraySchema = z.array(ZoneRuleSchema).readonly();
29250
- //#endregion
29251
29397
  //#region src/capabilities/script-runner.cap.ts
29252
29398
  /**
29253
29399
  * Script-runner cap. Models HA `script.*` entities on
@@ -38119,6 +38265,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38119
38265
  addonId: null,
38120
38266
  access: "create"
38121
38267
  },
38268
+ "pipelineAnalytics.cancelRelocateMedia": {
38269
+ capName: "pipeline-analytics",
38270
+ capScope: "device",
38271
+ addonId: null,
38272
+ access: "create"
38273
+ },
38122
38274
  "pipelineAnalytics.cancelStorageMigrationMove": {
38123
38275
  capName: "pipeline-analytics",
38124
38276
  capScope: "device",
@@ -38293,6 +38445,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38293
38445
  addonId: null,
38294
38446
  access: "view"
38295
38447
  },
38448
+ "pipelineAnalytics.listRelocateMediaJobs": {
38449
+ capName: "pipeline-analytics",
38450
+ capScope: "device",
38451
+ addonId: null,
38452
+ access: "view"
38453
+ },
38296
38454
  "pipelineAnalytics.listRetrainAnnotations": {
38297
38455
  capName: "pipeline-analytics",
38298
38456
  capScope: "device",
@@ -38371,6 +38529,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38371
38529
  addonId: null,
38372
38530
  access: "create"
38373
38531
  },
38532
+ "pipelineAnalytics.relocateMedia": {
38533
+ capName: "pipeline-analytics",
38534
+ capScope: "device",
38535
+ addonId: null,
38536
+ access: "create"
38537
+ },
38374
38538
  "pipelineAnalytics.restageRetrainTrack": {
38375
38539
  capName: "pipeline-analytics",
38376
38540
  capScope: "device",
@@ -38383,6 +38547,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38383
38547
  addonId: null,
38384
38548
  access: "create"
38385
38549
  },
38550
+ "pipelineAnalytics.runReplayFrameProcessor": {
38551
+ capName: "pipeline-analytics",
38552
+ capScope: "device",
38553
+ addonId: null,
38554
+ access: "create"
38555
+ },
38386
38556
  "pipelineAnalytics.saveRetrainAnnotations": {
38387
38557
  capName: "pipeline-analytics",
38388
38558
  capScope: "device",
@@ -38515,6 +38685,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38515
38685
  addonId: null,
38516
38686
  access: "view"
38517
38687
  },
38688
+ "pipelineExecutor.getInferenceDeviceHealth": {
38689
+ capName: "pipeline-executor",
38690
+ capScope: "system",
38691
+ addonId: null,
38692
+ access: "view"
38693
+ },
38518
38694
  "pipelineExecutor.getOrchestratorConfigSchema": {
38519
38695
  capName: "pipeline-executor",
38520
38696
  capScope: "system",
@@ -38587,6 +38763,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
38587
38763
  addonId: null,
38588
38764
  access: "view"
38589
38765
  },
38766
+ "pipelineExecutor.rearmInferenceDevice": {
38767
+ capName: "pipeline-executor",
38768
+ capScope: "system",
38769
+ addonId: null,
38770
+ access: "create"
38771
+ },
38590
38772
  "pipelineExecutor.runAudioTest": {
38591
38773
  capName: "pipeline-executor",
38592
38774
  capScope: "system",
@@ -42092,6 +42274,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
42092
42274
  form: "single",
42093
42275
  optional: false
42094
42276
  }],
42277
+ "pipelineAnalytics.runReplayFrameProcessor": [{
42278
+ name: "deviceId",
42279
+ form: "single",
42280
+ optional: false
42281
+ }],
42095
42282
  "pipelineAnalytics.saveRetrainAnnotations": [{
42096
42283
  name: "deviceId",
42097
42284
  form: "single",
@@ -43715,6 +43902,8 @@ function createSystemProxy(api) {
43715
43902
  getVideoPipelineSteps: (input) => dispatch("pipelineExecutor", "getVideoPipelineSteps", "query", input),
43716
43903
  setVideoPipelineSteps: (input) => dispatch("pipelineExecutor", "setVideoPipelineSteps", "mutation", input),
43717
43904
  clearDeviceOverrides: (input) => dispatch("pipelineExecutor", "clearDeviceOverrides", "mutation", input),
43905
+ getInferenceDeviceHealth: (input) => dispatch("pipelineExecutor", "getInferenceDeviceHealth", "query", input),
43906
+ rearmInferenceDevice: (input) => dispatch("pipelineExecutor", "rearmInferenceDevice", "mutation", input),
43718
43907
  getSchema: (input) => dispatch("pipelineExecutor", "getSchema", "query", input),
43719
43908
  getGlobalSteps: (input) => dispatch("pipelineExecutor", "getGlobalSteps", "query", input),
43720
43909
  getGlobalPipelineConfig: (input) => dispatch("pipelineExecutor", "getGlobalPipelineConfig", "query", input),
@@ -47862,4 +48051,4 @@ function enumerateInferenceDevices(hw) {
47862
48051
  return out;
47863
48052
  }
47864
48053
  //#endregion
47865
- export { ACCESSORY_LABEL, ACCESS_ROLES, ALEXA_EGRESS_PROFILE, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, AUDIO_ANALYSIS_CAP_NAME, AUDIO_BACKEND_CHOICES, AUDIO_MACRO_LABELS, AUDIO_PRESETS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionCandidateResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, AdoptionJobSchema, AdoptionJobStateSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, AdoptionOutcomeSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, AnalyticsGroupDetailSchema, AnalyticsGroupMemberSchema, AnalyticsGroupRecordSchema, ApiKeyRecordSchema, ApiKeySummarySchema, ArchiveEntrySchema, ArchiveManifestSchema, AttachmentMediaTypeSchema, AttachmentSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationActionSchema, AutomationConditionOperatorSchema, AutomationConditionSchema, AutomationControlStatusSchema, AutomationRecipeSchema, AutomationTriggerSchema, AvailableIntegrationTypeSchema, BACKEND_TO_FORMAT, BASE_LIVE_EGRESS_PROFILE, BATTERY_DEVICE_PROFILE, BATTERY_UNREACHABLE_AFTER_MS, BOOT_RECOVERY_BACKOFF_MS, BacklightModeSchema, BackupDestinationInfoSchema, BackupEntrySchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, CAMERA_SWITCH_CATALOG, CAMERA_SWITCH_ORDER, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, CLASS_MAP_MACRO_TARGETS, CLUSTER_MODEL_SCOPED_STEPS, CLUSTER_MODEL_SECTION_ID, CLUSTER_STEP_SETTING_FIELDS, COCO_80_LABELS, COCO_TO_MACRO, CONNECTION_TEST_TIMEOUT_MS, CORE_BLOCKS_ADDON_ID, CORE_BLOCK_ADDON_PREFIX, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusDegradationReasonSchema, CameraStatusDegradationSchema, CameraStatusSchema, CameraStatusStageSchema, CameraStreamSchema, CameraSwitchAuthoritySchema, CameraSwitchGroupSchema, CameraSwitchIdSchema, CameraSwitchSchema, CameraSwitchUnavailableReasonSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClassMapDefinitionSchema, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipPlaybackSchema, ClipSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectionTestDescriptorSchema, ConnectionTestInputSchema, ConnectionTestOutcomeSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, ConvertArtifactSchema, ConvertResultSchema, ConvertTargetSchema, CoreBlockCompileResultSchema, CoreBlockInputSchema, CoreBlockPlacementSchema, CoreBlockSchema, CoreBlockStatusSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, CustomModelDescriptorSchema, DATAPLANE_SECRET_HEADER, DECLARED_DEVICE_SWEEP_LIMIT, DECLARED_INTEGRATION_FIXED_KEY, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_CLUSTER_STEP_MODELS, DEFAULT_CLUSTER_STEP_SETTINGS, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_DETAIL_CROP_CONVENTION, DEFAULT_EVENTS_BAND_BUFFER_SEC, DEFAULT_EVENT_COLOR, DEFAULT_FEATURES, DEFAULT_MIN_LANDMARK_FACE_SIZE_PX, DEFAULT_NATIVE_LEASE_SETTINGS, DEFAULT_POOL_MEMORY_POLICY, DEFAULT_RECORDING_PROFILES, DEFAULT_RETENTION, DEFAULT_RUNTIME_STATE_DURABILITY, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, DETECTION_MACRO_CLASSES, DETECTION_PIPELINE_CAP_NAME, DEVICE_BACKEND_TO_FORMAT, DEVICE_CAP_NAMES, DEVICE_PROFILES, DEVICE_SCOPED_CAPS, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATE_READERS, DEVICE_STATUS_METHOD, DEVICE_TYPE_CONTROL_KIND, DEVICE_TYPE_INFO, EngineInfoSchema as DataStoreEngineInfoSchema, DayNightModeSchema, DayNightOptionsSchema, DayNightSettingsPatchSchema, DayNightStatusSchema, DeclaredDevices, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetailCropConventionSchema, DetectionSourceSchema, DeviceCodeSeveritySchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceNetworkStatsSchema, DeviceRole, DeviceRuntimeState, DeviceSelectorSchema, DeviceStatusSchema, DeviceType, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DiscoveredTargetSchema, DiskReconcileJobSchema, DisposerChain, DoorbellPressEventSchema, DoorbellStatusSchema, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_PAD_MS, EVENT_TAXONOMY, EXPORT_DENSE_MAX_RANGES, EXPRESSION_BUILTINS, EXPRESSION_BUILTIN_NAMES, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, EgressEncodeSchema, EgressRateControlSchema, EgressTranscodeRequestSchema, EgressTranscodeSchema, ElementConfigStore, EmbeddingInfoSchema, EmbeddingResultSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventEmitterStatusSchema, EventFireSchema, EventItemSchema, EventKindCategorySchema, EventKindDescriptorSchema, EventKindIconSchema, EventKindSchema, EventKindsForDeviceSchema, EventMediaArtifactSchema, EventMediaCoverageSchema, EventMediaKindSchema, EventMediaProductionSchema, EventSourceType, ExportBytesSchema, ExportDenseRangeSchema, ExportDenseSchema, ExportDownloadSchema, ExportOptionsSchema, ExportRecordSchema, ExportSetupFieldSchema, ExportSetupSchema, ExportSpeedSchema, ExportStateSchema, ExportTimelapseSchema, ExposedDeviceSchema, ExposureModeSchema, ExpressionBindingSourceSchema, ExpressionEvalError, ExpressionFieldBindingSchema, ExpressionGlobalBindingSchema, ExpressionLiteralBindingSchema, ExpressionParseError, ExpressionSourceSchema, FULL_IMAGE_BBOX, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, Fmp4BoxSplitter, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, FrameLazyCountersSchema, FrameLazyMetricsSchema, GasStatusSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, HAP_AUDIO_BASE, HAP_AUDIO_BITRATE_KBPS, HAP_AUDIO_VBV_KBITS, HAP_KEYFRAME_INTERVAL_SEC, HF_BASE_URL, HF_REPO, HWACCEL_OPTIONS, HealthStatusSchema, HfModelResolutionSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, INFERENCE_DEVICE_EXCLUSION_REASONS, ImageContractSchema, ImageContractStateSchema, ImageRotateSchema, ImageSettingsOptionsSchema, ImageSettingsPatchSchema, ImageSettingsStatusSchema, ImageStatusSchema, InferenceDeviceExclusionReasonSchema, IngestOwnerSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, KeyEventSchema, LOG_LEVEL_RANK, LabelAttributionSchema, LabelDefinitionSchema, LabelTierSchema, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LinkedDeviceSchema, LinkedDevicesModeSchema, ListGroupsPageSchema, ListGroupsQueryInput, LlmDefaultSchema, LlmDefaultSelectorSchema, LlmDownloadProgressSchema, LlmErrorCodeSchema, LlmGenerateBaseInputSchema, LlmGenerateErrSchema, LlmGenerateOkSchema, LlmGenerateResultSchema, LlmImageSchema, LlmNodeModelSchema, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, LlmRetryPolicySchema, LlmRuntimeCompleteInputSchema, LlmRuntimeDiskUsageSchema, LlmRuntimeNodeSchema, LlmRuntimeStatusSchema, LlmTimeoutDefaults, LlmUsageRollupSchema, LlmUsageSchema, LocateSegmentResultSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, LoginMethodContributionSchema, LoginStageEnum, MACRO_LABELS, MAX_CLIP_EVENT_IDS, MAX_CLIP_LABELS, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, METHOD_ACCESS_MAP, METHOD_DEVICE_SELECTORS, MODEL_FORMATS, MODEL_PROVIDER_IDS, MOTION_TRIGGER_FEATURE, ManagedModelCatalogEntrySchema, ManagedModelExtraFileSchema, ManagedModelRefSchema, ManagedRuntimeConfigSchema, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileInfoSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, ModelCatalogEntrySchema, ModelConvertInputSchema, ModelConvertMetadataSchema, ModelDistributeInputSchema, ModelDistributeResultSchema, ModelExtraFileSchema, ModelFormatEntrySchema, ModelFormatsSchema, ModelProviderIdSchema, ModelSubstitutionSchema, ModelVariantGroupSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, MutationFilterSchema, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, NC_ALARM_SYSTEM_EVENT_KINDS, NC_AUDIO_CONFIRM_HITS_DEFAULT, NC_AUDIO_CONFIRM_HITS_MAX, NC_AUDIO_CONFIRM_HITS_MIN, NC_AUDIO_CONFIRM_WINDOW_MAX_SEC, NC_AUDIO_CONFIRM_WINDOW_MIN_SEC, NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT, NC_AUDIO_DBFS_FLOOR, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, NC_AUDIO_SEED, NC_AUTHORABLE_SYSTEM_EVENT_KINDS, NC_BASE_CONDITION_KEYS, NC_CONDITION_CATALOG, NC_CONFIRM_DEFAULT_MAX_IMAGE_PX, NC_CONFIRM_DEFAULT_TIMEOUT_MS, NC_CONFIRM_MAX_TIMEOUT_MS, NC_CONFIRM_MIN_TIMEOUT_MS, NC_DEFAULT_SNOOZE_MINUTES, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_OCCUPANCY_DEFAULTS, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_RULE_SECTIONS, NC_SNOOZE_MAX_MINUTES, NC_SYSTEM_DELIVERY, NC_SYSTEM_EVENT_FILTER_KEYS, NC_TAXONOMY, NativeCropBboxSchema, NativeCropRefSchema, NativeCropResultSchema, NativeDetectionSchema, NativeLeaseAdmissionSchema, NativeLeaseSettingsSchema, NativeObjectClassEnum, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionStatusSchema, NcAlarmConfigSchema, NcAlarmModeCoverageSchema, NcAlarmSettingsPatchSchema, NcAlarmSettingsSchema, NcAlarmSkipReasonSchema, NcAlarmSkippedDeviceSchema, NcAudioConditionSchema, NcConditionDescriptorSchema, NcConditionsSchema, NcConfirmExpectSchema, NcConfirmSchema, NcCrossingSchema, NcDeliverySchema, NcDeviceStateConditionSchema, NcHistoryEntrySchema, NcHistoryFilterSchema, NcHistoryRecordKindSchema, NcHistoryStatusSchema, NcHistorySubjectSchema, NcMediaFrameSchema, NcMediaPolicySchema, NcOccupancyConditionSchema, NcPlateMatcherSchema, NcRuleActionSchema, NcRuleActionSequenceSchema, NcRuleActionsSchema, NcRuleInputSchema, NcRuleNotificationButtonSchema, NcRulePatchSchema, NcRuleSchema, NcRuleTargetSchema, NcSceneConditionSchema, NcScheduleSchema, NcScheduleWindowSchema, NcSnoozeInputSchema, NcSnoozeSchema, NcSnoozeScopeSchema, NcSnoozeSuppressedSchema, NcSystemEventConditionSchema, NcSystemEventKindSchema, NcTaxonomyEntrySchema, NcTaxonomySchema, NcTestResultSchema, NcThrottleGranularitySchema, NcThrottleSchema, NcZoneConditionSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NotificationActionIconSchema, NotificationActionSchema, NotificationFormatSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OPERATOR_WRITTEN_STALE_MS, OPS_LOG_DEFAULT_LIMIT, OPS_LOG_RING_DEFAULT_MAX, OauthIntegrationDescriptorSchema, ObjectEventSchema, OpsLogDomainSchema, OpsLogEntrySchema, OpsLogOpSchema, OpsLogQueryInputSchema, OpsLogReasonSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdRenderOutcomeEnum, OsdRenderResultSchema, OsdSlotBindingSchema, OsdSlotViewSchema, OsdSourceOptionSchema, OsdSourceSchema, OsdSourceValueTypeEnum, OsdStatusSchema, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PRIVACY_MASK_CAP_NAME, PROVIDER_KIND_CAP_NAMES, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, PasskeyLoginMethodSchema, PasskeySummarySchema, PcmSampleFormatSchema, PerScopeBreakdownSchema, PetFeederStatusSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, PlaceholderReasonSchema, PolygonPointSchema, PoolMemoryWatchdog, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzMoveCommandSchema, PtzOptionsSchema, PtzPositionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, RATE_CONTROL_RELAXED, RATE_CONTROL_TIGHT, REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHABILITY_PROBE_TIMEOUT_MS, RECOGNITION_TYPES, RECORDING_EXPORT_MAX_READ_BYTES, RESERVED_BINDING_NAMES, RESTORED_CAP_NAMES, RUNTIME_DEFAULTS, RUNTIME_STATE_POLICY, RUNTIME_STATE_REFRESH_MISS_COOLDOWN_MS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadGopBytesResultSchema, ReadSegmentBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RecentTracksPageSchema, RecentTracksQueryInput, RecordingAvailabilitySchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingRangeSchema, RecordingRebalanceInputSchema, RecordingRebalanceMoveSchema, RecordingRebalancePlanSchema, RecordingRebalanceSkipReasonSchema, RecordingRebalanceSkipSchema, RecordingRetentionSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RedirectLoginMethodSchema, RelocateFootageClassSchema, RelocateFootageInputSchema, RelocateJobSchema, RelocateJobStateSchema, RelocateMediaInputSchema, RenderedAsSchema, ReportMotionInputSchema, RetrainAnnotationDraftSchema, RetrainAnnotationKindSchema, RetrainAnnotationSchema, RetrainAnnotationSourceSchema, RetrainAssistResultSchema, RetrainAssistSubjectSchema, RetrainCopyRefusalSchema, RetrainFrameCandidateSchema, RetrainFrameListSchema, RetrainFrameSchema, RetrainFrameSelectionSchema, RetrainMacroClassSchema, RetrainStatusSchema, RetrainTrackSchema, RetrainTransitionResultSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerFrameSourceSchema, RunnerInferenceDeviceSchema, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCENE_CONDITIONS, SCENE_CONFIRM_DEFAULT_MAX_IMAGE_PX, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS, SCENE_DEFAULT_ANCHOR_THRESHOLD, SCENE_DEFAULT_CHECK_INTERVAL_SEC, SCENE_DEFAULT_OBSERVATION_SPACING_SEC, SCENE_DEFAULT_QUIET_SECONDS, SCENE_DEFAULT_UNCOVERED_POLICY, SCENE_DIVERGED, SCENE_RESET_RECAPTURES, SCOPE_PRESETS, SENSOR_FEATURES, SENSOR_MAP, SOURCE_INFO_METADATA_KEY, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SYSTEM_CAP_NAMES, SYSTEM_SCOPE_DEVICE_METHODS, SceneCheckSchema, SceneConditionSchema, SceneConfirmSchema, SceneMonitorSchema, SceneMonitorStateSchema, SceneMonitorStatusSchema, SceneReferenceSchema, SceneUnavailableSchema, SceneUncoveredPolicySchema, SceneVerdictSchema, ScopedTokenSchema, ScopedTokenSummarySchema, ScoredObjectEventSchema, ScriptRunnerStatusSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SendResultSchema, SensorEventSchema, ServerBootModeSchema, ServerPackageStatusSchema, ServerRollbackInfoSchema, ServerUpdateActionResultSchema, ServerUpdateCheckResultSchema, ServerUpdateStateSchema, SetSiteLocationInputSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, StationaryObjectSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, StorageMigrationClassSchema, StorageMigrationDestinationsSchema, StorageMigrationFootageMoveInputSchema, StorageMigrationInputSchema, StorageMigrationJobSchema, StorageMigrationLeaseInputSchema, StorageMigrationMediaMoveInputSchema, StorageMigrationMoveSchema, StorageMigrationParticipantSchema, StorageMigrationPhaseSchema, StorageMigrationPlanSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TAXONOMY_COLORS, TIMELAPSE_DENSE_FLOOR_SEC, TIMEZONES, TRANSCODE_DOWN_MAX_BITRATE_KBPS, TRANSCODE_DOWN_MAX_HEIGHT, TamperStatusSchema, TankStatusSchema, TargetKindCapsSchema, TargetKindLevelSchema, TargetKindSchema, TargetSchema, TemperatureSensorStatusSchema, TerminalInstanceInfoSchema, TerminalLegacyCameraSchema, TerminalOutputBatchSchema, TerminalOutputEventSchema, TerminalProfileInfoSchema, TerminalSessionInfoSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, TestConnectionStatusEnum, TestResultSchema, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackCascadeCountsSchema, TrackEnvelopeSchema, TrackFlagsPatchSchema, TrackFlagsSchema, TrackProjectionSchema, TrackSchema, TrackSourceSchema, TrackStateSchema, TrackZoneFilterSchema, TrackedDetectionSchema, TrainingExportDeviceTotalsSchema, TrainingExportSummarySchema, TurnServerSchema, UNIT_TABLE, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UnitConversionError, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VISIT_MERGE_GAP_MS, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VectorDeclareIndexInputSchema, VectorDeleteByFilterInputSchema, VectorDeleteInputSchema, VectorDeleteResultSchema, VectorFilterSchema, VectorGetInputSchema, VectorGetResultSchema, VectorItemSchema, VectorMatchSchema, VectorMetadataSchema, VectorMetricSchema, VectorQueryInputSchema, VectorQueryResultSchema, VectorStatsInputSchema, VectorStatsResultSchema, VectorUpsertInputSchema, VectorUpsertResultSchema, VibrationStatusSchema, VideoEncodeSchema, WEBRTC_EGRESS_PROFILE, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WhiteBalanceModeSchema, WidgetHostEnum, WidgetLoginMethodSchema, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, YAMNET_TO_MACRO, ZoneCrossingDirectionSchema, ZoneCrossingSchema, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, asBoolean, asJsonArray, asJsonObject, asNumber, asString, assertTimelapseCadences, audioAnalysisCapability, audioAnalyzerCapability, audioCodecCapability, audioIsFailClosed, audioKindId, audioLabelChoices, audioMetricsCapability, audioModeOf, audioOrDefaults, audioPlanFromEncodeProfile, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, bareAddonId, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildAudioArgs, buildEventKindDescriptor, buildFfmpegArgs, buildInputArgs, buildModelVariantGroups, buildNcTaxonomy, buildRoleScopes, buildStreamParamsConfigSchema, buildVideoArgs, buttonCapability, cameraCredentialsCapability, cameraPipelineConfigCapability, cameraStreamsCapability, canConvertUnit, canonicalEgressPlan, carbonMonoxideCapability, cellsToRects, classifyBearerPrincipal, classifyStream, classifyStreams, climateControlCapability, clusterModelSettingKey, clusterStepSettingFieldsFor, clusterStepSettingKey, collectHydratedFieldEntries, collectHydratedFieldValues, colorCapability, colorForKind, commitWatchdogRestart, compileExpression, compileExpressionSafe, composeSwitchedOff, conditionDepth, conditionExclusionReason, conditionVisibleForKind, connectionTestCapability, connectivityCapability, consumablesCapability, contactCapability, controlCapability, convertUnit, coreBlockAddonId, coreBlockIdFromAddonId, coreBlocksCapability, cosineSimilarity, countConditionLeaves, coverCapability, createDeviceProxy, createDurableState, createEvent, createEventBusSliceSource, createExpressionScope, createHwAccelCache, createLazyTrpcSource, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, customModelRegistryCapability, dataStoreProviderCapability, dayNightCapability, declarationOwnerNodeId, decodeVectorBase64, decoderCapability, defaultDeliveryForSection, defaultDeviceFor, defineCustomActions, deriveBatteryPresence, deriveCameraSwitches, deriveDetailCropRect, deriveRecordingMode, describeModelVariant, detectAccessRole, detectionPipelineCapability, deviceAdoptionCapability, deviceBackendToFormat, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceSelectorMatches, deviceStateCapability, deviceStatusCapability, doorbellCapability, droppedConditionsForKind, egressTranscodeSharingKey, egressTransportFromRequest, embeddingEncoderCapability, emitDownForOwnedCaps, emitReadiness, encodeProfileFromStreamShape, encodeVectorBase64, enumSensorCapability, enumerateInferenceDevices, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateAst, evaluateExpressionSource, evaluatePoolMemory, evaluateZoneRules, event, eventEmitterCapability, eventsCapability, expandCapMethods, extractNestedAddonId, extractSourceInfoFromMetadata, faceGalleryCapability, fanControlCapability, featureProbeCapability, filesystemBrowseCapability, findTimezone, floodCapability, formatForBackend, formatForRuntime, gasCapability, generateAutomationBlock, getAudioMacroClassIds, getByPath, getCapsByProviderKind, getTaxonomyEntry, hasMotionTrigger, hfModelUrl, htmlToText, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, imageSettingsCapability, inferModelProvider, initialPoolMemoryState, integrationsCapability, intercomCapability, invocationFromEncodeProfile, isAgentOnlyPlacement, isArrayOutputSchema, isAudioLabelSelected, isAudioRule, isBaseConditionKey, isBatteryPresenceFault, isClusterScopedStep, isCollectionArrayMethod, isDeployableToAgent, isDetectionMacroClass, isDeviceConfigCap, isDeviceScopedCap, isEvent, isIsolatedBuiltin, isNode, isObjectInput, isOccupancyRule, isRestoredCap, isSameAddonId, isScheduleActive, isSoftwareDecode, isSystemDelivery, isVoidInput, jobKindSchema, kebabToCamel, knownValues, lawnMowerControlCapability, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, llmCapability, llmRuntimeCapability, localNetworkCapability, locationSimilarity, lockControlCapability, logBannerArgs, logDestinationCapability, logLevelAtMost, loginMethodCapability, looseSchema, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, markdownToHtmlLite, markdownToText, maskUrlCredentials, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, methodAccessForHttpMethod, metricsProviderCapability, modelConvertCapability, modelDistributorCapability, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, networkAccessCapability, networkQualityCapability, nodePin, nodesCapability, normalizeAddonInitResult, normalizeAudioLabel, normalizeTokenScopes, normalizeUnit, notificationOutputCapability, notificationRulesCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, objectInputDeclaresAddonId, osdCapability, osdManagerCapability, overlayClusterStepSettings, parseCameraStreamConfig, parseExpression, parseJsonArray, parseJsonObject, parseJsonUnknown, parseProcStatus, parseProfileBrokerId, parseRuleSection, parseStreamParamsFormPatch, patchAudio, petFeederCapability, pickAccessoryControl, pickClusterStepModels, pickClusterStepSettings, pickDetailCropConvention, pickNativeLeaseOverride, pickPreferredRtspEntry, pickRestartCandidate, pickVideoEncoder, pickerForCondition, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, plateGalleryCapability, platformProbeCapability, poolMemoryThreshold, powerMeterCapability, prepareNotification, presenceCapability, pressureSensorCapability, principalMayReachAddon, privacyMaskCapability, procedureAuthKey, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, readClusterStepModels, readClusterStepSettings, readDetailCropConvention, readDeviceStateFrom, readNativeLeaseOverride, readNodePin, readTimelapseGeneratedAt, readinessKey, rebootCapability, recordingCapability, recordingExportCapability, rectsToCells, requiresPython, resetPoolBaseline, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveAddonRuntime, resolveCapMount, resolveClusterStepModelId, resolveDetectionRuntime, resolveDeviceControlKind, resolveDeviceProfile, resolveEgressDecodeHwAccel, resolveFormat, resolveHydratedFieldValue, resolveMethodAuth, resolveModelFormat, resolveMutate, resolvePoolMemoryPolicy, resolveRecordingProfiles, resolveRunnerId, resolveVariantModelId, resolveViewableDeviceIds, roleSpec, ruleEditorSectionsForKind, ruleKindOf, ruleKindSpec, ruleMatchesSection, ruleSection, ruleSectionOf, ruleSeedForSection, runInferenceStep, runtimeDevices, runtimeStatePolicyFor, sceneMonitorCapability, scopeInherits, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, scoreRuntimes, scriptRunnerCapability, selectAssignedProfileSlots, serverManagementCapability, setByPath, settingsStoreCapability, sleep, sleepCancellable, smokeCapability, smtpProviderCapability, snapshotCapability, ssoBridgeCapability, startReachabilityPoll, stateVocabularyFor, storageCapability, storageEvictableCapability, storageMigrationCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, subKindsOf, summarisePrivacyAudio, summarizeEffectiveScope, supportedRuntimes, switchCapability, switchedOffIds, synthesizeSourceInfo, systemCapability, systemEventFilterApplies, systemEventFilterAppliesToAnyKind, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, terminalSessionCapability, textToHtml, toDeviceSummary, toExpressionValue, toNodeId, toStreamSourceEntry, toastCapability, toggleAudioLabel, tokenize, transcodeBody, tryConvertUnit, turnProviderCapability, unitDimension, unitsForDimension, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, validateExpressionSource, validateRecipeBounds, valveCapability, vectorDimFromBase64, vectorStoreCapability, vibrationCapability, videoclipsCapability, viewerUiCapability, waterHeaterCapability, weatherCapability, webrtcClientHintsSchema, webrtcSessionCapability, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };
48054
+ export { ACCESSORY_LABEL, ACCESS_ROLES, ALEXA_EGRESS_PROFILE, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, AUDIO_ANALYSIS_CAP_NAME, AUDIO_BACKEND_CHOICES, AUDIO_MACRO_LABELS, AUDIO_PRESETS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionCandidateResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, AdoptionJobSchema, AdoptionJobStateSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, AdoptionOutcomeSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, AnalyticsGroupDetailSchema, AnalyticsGroupMemberSchema, AnalyticsGroupRecordSchema, ApiKeyRecordSchema, ApiKeySummarySchema, ArchiveEntrySchema, ArchiveManifestSchema, AttachmentMediaTypeSchema, AttachmentSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationActionSchema, AutomationConditionOperatorSchema, AutomationConditionSchema, AutomationControlStatusSchema, AutomationRecipeSchema, AutomationTriggerSchema, AvailableIntegrationTypeSchema, BACKEND_TO_FORMAT, BASE_LIVE_EGRESS_PROFILE, BATTERY_DEVICE_PROFILE, BATTERY_UNREACHABLE_AFTER_MS, BOOT_RECOVERY_BACKOFF_MS, BacklightModeSchema, BackupDestinationInfoSchema, BackupEntrySchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, CAMERA_SWITCH_CATALOG, CAMERA_SWITCH_ORDER, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, CLASS_MAP_MACRO_TARGETS, CLUSTER_MODEL_SCOPED_STEPS, CLUSTER_MODEL_SECTION_ID, CLUSTER_STEP_SETTING_FIELDS, COCO_80_LABELS, COCO_TO_MACRO, CONNECTION_TEST_TIMEOUT_MS, CORE_BLOCKS_ADDON_ID, CORE_BLOCK_ADDON_PREFIX, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusDegradationReasonSchema, CameraStatusDegradationSchema, CameraStatusSchema, CameraStatusStageSchema, CameraStreamSchema, CameraSwitchAuthoritySchema, CameraSwitchGroupSchema, CameraSwitchIdSchema, CameraSwitchSchema, CameraSwitchUnavailableReasonSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipPlaybackSchema, ClipSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectionTestDescriptorSchema, ConnectionTestInputSchema, ConnectionTestOutcomeSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, ConvertArtifactSchema, ConvertResultSchema, ConvertTargetSchema, CoreBlockCompileResultSchema, CoreBlockInputSchema, CoreBlockPlacementSchema, CoreBlockSchema, CoreBlockStatusSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, CustomModelDescriptorSchema, DATAPLANE_SECRET_HEADER, DECLARED_DEVICE_SWEEP_LIMIT, DECLARED_INTEGRATION_FIXED_KEY, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_CLUSTER_STEP_MODELS, DEFAULT_CLUSTER_STEP_SETTINGS, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_DETAIL_CROP_CONVENTION, DEFAULT_EVENTS_BAND_BUFFER_SEC, DEFAULT_EVENT_COLOR, DEFAULT_FEATURES, DEFAULT_MIN_LANDMARK_FACE_SIZE_PX, DEFAULT_NATIVE_LEASE_SETTINGS, DEFAULT_POOL_MEMORY_POLICY, DEFAULT_RECORDING_PROFILES, DEFAULT_RETENTION, DEFAULT_RUNTIME_STATE_DURABILITY, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, DETECTION_MACRO_CLASSES, DETECTION_PIPELINE_CAP_NAME, DEVICE_BACKEND_TO_FORMAT, DEVICE_CAP_NAMES, DEVICE_PROFILES, DEVICE_SCOPED_CAPS, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATE_READERS, DEVICE_STATUS_METHOD, DEVICE_TYPE_CONTROL_KIND, DEVICE_TYPE_INFO, EngineInfoSchema as DataStoreEngineInfoSchema, DayNightModeSchema, DayNightOptionsSchema, DayNightSettingsPatchSchema, DayNightStatusSchema, DeclaredDevices, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetailCropConventionSchema, DetectionCatalogClassMapSchema, DetectionSourceSchema, DeviceCodeSeveritySchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceNetworkStatsSchema, DeviceRole, DeviceRuntimeState, DeviceSelectorSchema, DeviceStatusSchema, DeviceType, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DiscoveredTargetSchema, DiskReconcileJobSchema, DisposerChain, DoorbellPressEventSchema, DoorbellStatusSchema, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_PAD_MS, EVENT_TAXONOMY, EXPORT_DENSE_MAX_RANGES, EXPRESSION_BUILTINS, EXPRESSION_BUILTIN_NAMES, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, EgressEncodeSchema, EgressRateControlSchema, EgressTranscodeRequestSchema, EgressTranscodeSchema, ElementConfigStore, EmbeddingInfoSchema, EmbeddingResultSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventEmitterStatusSchema, EventFireSchema, EventItemSchema, EventKindCategorySchema, EventKindDescriptorSchema, EventKindIconSchema, EventKindSchema, EventKindsForDeviceSchema, EventMediaArtifactSchema, EventMediaCoverageSchema, EventMediaKindSchema, EventMediaProductionSchema, EventSourceType, ExportBytesSchema, ExportDenseRangeSchema, ExportDenseSchema, ExportDownloadSchema, ExportOptionsSchema, ExportRecordSchema, ExportSetupFieldSchema, ExportSetupSchema, ExportSpeedSchema, ExportStateSchema, ExportTimelapseSchema, ExposedDeviceSchema, ExposureModeSchema, ExpressionBindingSourceSchema, ExpressionEvalError, ExpressionFieldBindingSchema, ExpressionGlobalBindingSchema, ExpressionLiteralBindingSchema, ExpressionParseError, ExpressionSourceSchema, FULL_IMAGE_BBOX, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, Fmp4BoxSplitter, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, FrameLazyCountersSchema, FrameLazyMetricsSchema, GasStatusSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, HAP_AUDIO_BASE, HAP_AUDIO_BITRATE_KBPS, HAP_AUDIO_VBV_KBITS, HAP_KEYFRAME_INTERVAL_SEC, HF_BASE_URL, HF_REPO, HWACCEL_OPTIONS, HealthStatusSchema, HfModelResolutionSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, INFERENCE_DEVICE_EXCLUSION_REASONS, ImageContractSchema, ImageContractStateSchema, ImageRotateSchema, ImageSettingsOptionsSchema, ImageSettingsPatchSchema, ImageSettingsStatusSchema, ImageStatusSchema, InferenceDeviceExclusionReasonSchema, IngestOwnerSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, KeyEventSchema, LOG_LEVEL_RANK, LabelAttributionSchema, LabelDefinitionSchema, LabelTierSchema, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LinkedDeviceSchema, LinkedDevicesModeSchema, ListGroupsPageSchema, ListGroupsQueryInput, LlmDefaultSchema, LlmDefaultSelectorSchema, LlmDownloadProgressSchema, LlmErrorCodeSchema, LlmGenerateBaseInputSchema, LlmGenerateErrSchema, LlmGenerateOkSchema, LlmGenerateResultSchema, LlmImageSchema, LlmNodeModelSchema, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, LlmRetryPolicySchema, LlmRuntimeCompleteInputSchema, LlmRuntimeDiskUsageSchema, LlmRuntimeNodeSchema, LlmRuntimeStatusSchema, LlmTimeoutDefaults, LlmUsageRollupSchema, LlmUsageSchema, LocateSegmentResultSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, LoginMethodContributionSchema, LoginStageEnum, MACRO_LABELS, MAX_CLIP_EVENT_IDS, MAX_CLIP_LABELS, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, METHOD_ACCESS_MAP, METHOD_DEVICE_SELECTORS, MODEL_FORMATS, MODEL_PROVIDER_IDS, MOTION_TRIGGER_FEATURE, ManagedModelCatalogEntrySchema, ManagedModelExtraFileSchema, ManagedModelRefSchema, ManagedRuntimeConfigSchema, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileInfoSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, ModelCatalogEntrySchema, ModelConvertInputSchema, ModelConvertMetadataSchema, ModelDistributeInputSchema, ModelDistributeResultSchema, ModelExtraFileSchema, ModelFormatEntrySchema, ModelFormatsSchema, ModelProviderIdSchema, ModelSubstitutionSchema, ModelVariantGroupSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, MutationFilterSchema, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, NC_ALARM_SYSTEM_EVENT_KINDS, NC_AUDIO_CONFIRM_HITS_DEFAULT, NC_AUDIO_CONFIRM_HITS_MAX, NC_AUDIO_CONFIRM_HITS_MIN, NC_AUDIO_CONFIRM_WINDOW_MAX_SEC, NC_AUDIO_CONFIRM_WINDOW_MIN_SEC, NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT, NC_AUDIO_DBFS_FLOOR, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, NC_AUDIO_SEED, NC_AUTHORABLE_SYSTEM_EVENT_KINDS, NC_BASE_CONDITION_KEYS, NC_CONDITION_CATALOG, NC_CONFIRM_DEFAULT_MAX_IMAGE_PX, NC_CONFIRM_DEFAULT_TIMEOUT_MS, NC_CONFIRM_MAX_TIMEOUT_MS, NC_CONFIRM_MIN_TIMEOUT_MS, NC_DEFAULT_SNOOZE_MINUTES, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_OCCUPANCY_DEFAULTS, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_RULE_SECTIONS, NC_SNOOZE_MAX_MINUTES, NC_SYSTEM_DELIVERY, NC_SYSTEM_EVENT_FILTER_KEYS, NC_TAXONOMY, NativeCropBboxSchema, NativeCropRefSchema, NativeCropResultSchema, NativeDetectionSchema, NativeLeaseAdmissionSchema, NativeLeaseSettingsSchema, NativeObjectClassEnum, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionStatusSchema, NcAlarmConfigSchema, NcAlarmModeCoverageSchema, NcAlarmSettingsPatchSchema, NcAlarmSettingsSchema, NcAlarmSkipReasonSchema, NcAlarmSkippedDeviceSchema, NcAudioConditionSchema, NcConditionDescriptorSchema, NcConditionsSchema, NcConfirmExpectSchema, NcConfirmSchema, NcCrossingSchema, NcDeliverySchema, NcDeviceStateConditionSchema, NcHistoryEntrySchema, NcHistoryFilterSchema, NcHistoryRecordKindSchema, NcHistoryStatusSchema, NcHistorySubjectSchema, NcMediaFrameSchema, NcMediaPolicySchema, NcOccupancyConditionSchema, NcPlateMatcherSchema, NcRuleActionSchema, NcRuleActionSequenceSchema, NcRuleActionsSchema, NcRuleInputSchema, NcRuleNotificationButtonSchema, NcRulePatchSchema, NcRuleSchema, NcRuleTargetSchema, NcSceneConditionSchema, NcScheduleSchema, NcScheduleWindowSchema, NcSnoozeInputSchema, NcSnoozeSchema, NcSnoozeScopeSchema, NcSnoozeSuppressedSchema, NcSystemEventConditionSchema, NcSystemEventKindSchema, NcTaxonomyEntrySchema, NcTaxonomySchema, NcTestResultSchema, NcThrottleGranularitySchema, NcThrottleSchema, NcZoneConditionSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NotificationActionIconSchema, NotificationActionSchema, NotificationFormatSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OPERATOR_WRITTEN_STALE_MS, OPS_LOG_DEFAULT_LIMIT, OPS_LOG_RING_DEFAULT_MAX, OauthIntegrationDescriptorSchema, ObjectEventSchema, OpsLogDomainSchema, OpsLogEntrySchema, OpsLogOpSchema, OpsLogQueryInputSchema, OpsLogReasonSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdRenderOutcomeEnum, OsdRenderResultSchema, OsdSlotBindingSchema, OsdSlotViewSchema, OsdSourceOptionSchema, OsdSourceSchema, OsdSourceValueTypeEnum, OsdStatusSchema, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PRIVACY_MASK_CAP_NAME, PROVIDER_KIND_CAP_NAMES, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, PasskeyLoginMethodSchema, PasskeySummarySchema, PcmSampleFormatSchema, PerScopeBreakdownSchema, PetFeederStatusSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, PlaceholderReasonSchema, PolygonPointSchema, PoolMemoryWatchdog, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzMoveCommandSchema, PtzOptionsSchema, PtzPositionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, RATE_CONTROL_RELAXED, RATE_CONTROL_TIGHT, REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHABILITY_PROBE_TIMEOUT_MS, RECOGNITION_TYPES, RECORDING_EXPORT_MAX_READ_BYTES, RESERVED_BINDING_NAMES, RESTORED_CAP_NAMES, RUNTIME_DEFAULTS, RUNTIME_STATE_POLICY, RUNTIME_STATE_REFRESH_MISS_COOLDOWN_MS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadGopBytesResultSchema, ReadSegmentBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RecentTracksPageSchema, RecentTracksQueryInput, RecordingAvailabilitySchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingRangeSchema, RecordingRebalanceInputSchema, RecordingRebalanceMoveSchema, RecordingRebalancePlanSchema, RecordingRebalanceSkipReasonSchema, RecordingRebalanceSkipSchema, RecordingRetentionSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RedirectLoginMethodSchema, RelocateFootageClassSchema, RelocateFootageInputSchema, RelocateJobSchema, RelocateJobStateSchema, RelocateMediaInputSchema, RenderedAsSchema, ReportMotionInputSchema, RetrainAnnotationDraftSchema, RetrainAnnotationKindSchema, RetrainAnnotationSchema, RetrainAnnotationSourceSchema, RetrainAssistResultSchema, RetrainAssistSubjectSchema, RetrainCopyRefusalSchema, RetrainFrameCandidateSchema, RetrainFrameListSchema, RetrainFrameSchema, RetrainFrameSelectionSchema, RetrainMacroClassSchema, RetrainStatusSchema, RetrainTrackSchema, RetrainTransitionResultSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerFrameSourceSchema, RunnerInferenceDeviceSchema, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCENE_CONDITIONS, SCENE_CONFIRM_DEFAULT_MAX_IMAGE_PX, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS, SCENE_DEFAULT_ANCHOR_THRESHOLD, SCENE_DEFAULT_CHECK_INTERVAL_SEC, SCENE_DEFAULT_OBSERVATION_SPACING_SEC, SCENE_DEFAULT_QUIET_SECONDS, SCENE_DEFAULT_UNCOVERED_POLICY, SCENE_DIVERGED, SCENE_RESET_RECAPTURES, SCOPE_PRESETS, SENSOR_FEATURES, SENSOR_MAP, SOURCE_INFO_METADATA_KEY, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SYSTEM_CAP_NAMES, SYSTEM_SCOPE_DEVICE_METHODS, SceneCheckSchema, SceneConditionSchema, SceneConfirmSchema, SceneMonitorSchema, SceneMonitorStateSchema, SceneMonitorStatusSchema, SceneReferenceSchema, SceneUnavailableSchema, SceneUncoveredPolicySchema, SceneVerdictSchema, ScopedTokenSchema, ScopedTokenSummarySchema, ScoredObjectEventSchema, ScriptRunnerStatusSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SendResultSchema, SensorEventSchema, ServerBootModeSchema, ServerPackageStatusSchema, ServerRollbackInfoSchema, ServerUpdateActionResultSchema, ServerUpdateCheckResultSchema, ServerUpdateStateSchema, SetSiteLocationInputSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, StationaryObjectSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, StorageMigrationClassSchema, StorageMigrationDestinationsSchema, StorageMigrationFootageMoveInputSchema, StorageMigrationInputSchema, StorageMigrationJobSchema, StorageMigrationLeaseInputSchema, StorageMigrationMediaMoveInputSchema, StorageMigrationMoveSchema, StorageMigrationParticipantSchema, StorageMigrationPhaseSchema, StorageMigrationPlanSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TAXONOMY_COLORS, TIMELAPSE_DENSE_FLOOR_SEC, TIMEZONES, TRANSCODE_DOWN_MAX_BITRATE_KBPS, TRANSCODE_DOWN_MAX_HEIGHT, TamperStatusSchema, TankStatusSchema, TargetKindCapsSchema, TargetKindLevelSchema, TargetKindSchema, TargetSchema, TemperatureSensorStatusSchema, TerminalInstanceInfoSchema, TerminalLegacyCameraSchema, TerminalOutputBatchSchema, TerminalOutputEventSchema, TerminalProfileInfoSchema, TerminalSessionInfoSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, TestConnectionStatusEnum, TestResultSchema, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackCascadeCountsSchema, TrackEnvelopeSchema, TrackFlagsPatchSchema, TrackFlagsSchema, TrackProjectionSchema, TrackSchema, TrackSourceSchema, TrackStateSchema, TrackZoneFilterSchema, TrackedDetectionSchema, TrainingExportDeviceTotalsSchema, TrainingExportSummarySchema, TurnServerSchema, UNIT_TABLE, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UnitConversionError, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VISIT_MERGE_GAP_MS, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VectorDeclareIndexInputSchema, VectorDeleteByFilterInputSchema, VectorDeleteInputSchema, VectorDeleteResultSchema, VectorFilterSchema, VectorGetInputSchema, VectorGetResultSchema, VectorItemSchema, VectorMatchSchema, VectorMetadataSchema, VectorMetricSchema, VectorQueryInputSchema, VectorQueryResultSchema, VectorStatsInputSchema, VectorStatsResultSchema, VectorUpsertInputSchema, VectorUpsertResultSchema, VibrationStatusSchema, VideoEncodeSchema, WEBRTC_EGRESS_PROFILE, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WhiteBalanceModeSchema, WidgetHostEnum, WidgetLoginMethodSchema, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, YAMNET_TO_MACRO, ZoneCrossingDirectionSchema, ZoneCrossingSchema, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, asBoolean, asJsonArray, asJsonObject, asNumber, asString, assertTimelapseCadences, audioAnalysisCapability, audioAnalyzerCapability, audioCodecCapability, audioIsFailClosed, audioKindId, audioLabelChoices, audioMetricsCapability, audioModeOf, audioOrDefaults, audioPlanFromEncodeProfile, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, bareAddonId, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildAudioArgs, buildEventKindDescriptor, buildFfmpegArgs, buildInputArgs, buildModelVariantGroups, buildNcTaxonomy, buildRoleScopes, buildStreamParamsConfigSchema, buildVideoArgs, buttonCapability, cameraCredentialsCapability, cameraPipelineConfigCapability, cameraStreamsCapability, canConvertUnit, canonicalEgressPlan, carbonMonoxideCapability, cellsToRects, classifyBearerPrincipal, classifyStream, classifyStreams, climateControlCapability, clusterModelSettingKey, clusterStepSettingFieldsFor, clusterStepSettingKey, collectHydratedFieldEntries, collectHydratedFieldValues, colorCapability, colorForKind, commitWatchdogRestart, compileExpression, compileExpressionSafe, composeSwitchedOff, conditionDepth, conditionExclusionReason, conditionVisibleForKind, connectionTestCapability, connectivityCapability, consumablesCapability, contactCapability, controlCapability, convertUnit, coreBlockAddonId, coreBlockIdFromAddonId, coreBlocksCapability, cosineSimilarity, countConditionLeaves, coverCapability, createDeviceProxy, createDurableState, createEvent, createEventBusSliceSource, createExpressionScope, createHwAccelCache, createLazyTrpcSource, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, customModelRegistryCapability, dataStoreProviderCapability, dayNightCapability, declarationOwnerNodeId, decodeVectorBase64, decoderCapability, defaultDeliveryForSection, defaultDeviceFor, defineCustomActions, deriveBatteryPresence, deriveCameraSwitches, deriveDetailCropRect, deriveRecordingMode, describeModelVariant, detectAccessRole, detectionPipelineCapability, deviceAdoptionCapability, deviceBackendToFormat, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceSelectorMatches, deviceStateCapability, deviceStatusCapability, doorbellCapability, droppedConditionsForKind, egressTranscodeSharingKey, egressTransportFromRequest, embeddingEncoderCapability, emitDownForOwnedCaps, emitReadiness, encodeProfileFromStreamShape, encodeVectorBase64, enumSensorCapability, enumerateInferenceDevices, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateAst, evaluateExpressionSource, evaluatePoolMemory, evaluateZoneRules, event, eventEmitterCapability, eventsCapability, expandCapMethods, extractNestedAddonId, extractSourceInfoFromMetadata, faceGalleryCapability, fanControlCapability, featureProbeCapability, filesystemBrowseCapability, findTimezone, floodCapability, formatForBackend, formatForRuntime, gasCapability, generateAutomationBlock, getAudioMacroClassIds, getByPath, getCapsByProviderKind, getTaxonomyEntry, hasMotionTrigger, hfModelUrl, htmlToText, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, imageSettingsCapability, inferModelProvider, initialPoolMemoryState, integrationsCapability, intercomCapability, invocationFromEncodeProfile, isAgentOnlyPlacement, isArrayOutputSchema, isAudioLabelSelected, isAudioRule, isBaseConditionKey, isBatteryPresenceFault, isClusterScopedStep, isCollectionArrayMethod, isDeployableToAgent, isDetectionMacroClass, isDeviceConfigCap, isDeviceScopedCap, isEvent, isIsolatedBuiltin, isNode, isObjectInput, isOccupancyRule, isRestoredCap, isSameAddonId, isScheduleActive, isSoftwareDecode, isSystemDelivery, isVoidInput, jobKindSchema, kebabToCamel, knownValues, lawnMowerControlCapability, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, llmCapability, llmRuntimeCapability, localNetworkCapability, locationSimilarity, lockControlCapability, logBannerArgs, logDestinationCapability, logLevelAtMost, loginMethodCapability, looseSchema, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, markdownToHtmlLite, markdownToText, maskUrlCredentials, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, methodAccessForHttpMethod, metricsProviderCapability, modelConvertCapability, modelDistributorCapability, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, networkAccessCapability, networkQualityCapability, nodePin, nodesCapability, normalizeAddonInitResult, normalizeAudioLabel, normalizeTokenScopes, normalizeUnit, notificationOutputCapability, notificationRulesCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, objectInputDeclaresAddonId, osdCapability, osdManagerCapability, overlayClusterStepSettings, parseCameraStreamConfig, parseExpression, parseJsonArray, parseJsonObject, parseJsonUnknown, parseProcStatus, parseProfileBrokerId, parseRuleSection, parseStreamParamsFormPatch, patchAudio, petFeederCapability, pickAccessoryControl, pickClusterStepModels, pickClusterStepSettings, pickDetailCropConvention, pickNativeLeaseOverride, pickPreferredRtspEntry, pickRestartCandidate, pickVideoEncoder, pickerForCondition, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, plateGalleryCapability, platformProbeCapability, poolMemoryThreshold, powerMeterCapability, prepareNotification, presenceCapability, pressureSensorCapability, principalMayReachAddon, privacyMaskCapability, procedureAuthKey, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, readClusterStepModels, readClusterStepSettings, readDetailCropConvention, readDeviceStateFrom, readNativeLeaseOverride, readNodePin, readTimelapseGeneratedAt, readinessKey, rebootCapability, recordingCapability, recordingExportCapability, rectsToCells, requiresPython, resetPoolBaseline, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveAddonRuntime, resolveCapMount, resolveClusterStepModelId, resolveDetectionRuntime, resolveDeviceControlKind, resolveDeviceProfile, resolveEgressDecodeHwAccel, resolveFormat, resolveHydratedFieldValue, resolveMethodAuth, resolveModelFormat, resolveMutate, resolvePoolMemoryPolicy, resolveRecordingProfiles, resolveRunnerId, resolveVariantModelId, resolveViewableDeviceIds, roleSpec, ruleEditorSectionsForKind, ruleKindOf, ruleKindSpec, ruleMatchesSection, ruleSection, ruleSectionOf, ruleSeedForSection, runInferenceStep, runtimeDevices, runtimeStatePolicyFor, sceneMonitorCapability, scopeInherits, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, scoreRuntimes, scriptRunnerCapability, selectAssignedProfileSlots, serverManagementCapability, setByPath, settingsStoreCapability, sleep, sleepCancellable, smokeCapability, smtpProviderCapability, snapshotCapability, ssoBridgeCapability, startReachabilityPoll, stateVocabularyFor, storageCapability, storageEvictableCapability, storageMigrationCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, subKindsOf, summarisePrivacyAudio, summarizeEffectiveScope, supportedRuntimes, switchCapability, switchedOffIds, synthesizeSourceInfo, systemCapability, systemEventFilterApplies, systemEventFilterAppliesToAnyKind, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, terminalSessionCapability, textToHtml, toDeviceSummary, toExpressionValue, toNodeId, toStreamSourceEntry, toastCapability, toggleAudioLabel, tokenize, transcodeBody, tryConvertUnit, turnProviderCapability, unitDimension, unitsForDimension, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, validateExpressionSource, validateRecipeBounds, valveCapability, vectorDimFromBase64, vectorStoreCapability, vibrationCapability, videoclipsCapability, viewerUiCapability, waterHeaterCapability, weatherCapability, webrtcClientHintsSchema, webrtcSessionCapability, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };