@camstack/addon-admin-ui 1.2.99 → 1.2.101

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