@camstack/server 1.2.826 → 1.2.827

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 (108) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/api/trpc/generated-cap-routers.js +257 -40
  3. package/dist/core/addon/addon-registry.service.js +3 -0
  4. package/package.json +41 -12
  5. package/system/dist/addon-runner.js +19 -2
  6. package/system/dist/addon-runner.mjs +19 -2
  7. package/system/dist/addon-utils.mjs +1 -1
  8. package/system/dist/{agent-https-BBO2OtNH.mjs → agent-https-BSxTUzKT.mjs} +1 -1
  9. package/system/dist/{agent-https-B2nqARmj.js → agent-https-BlLVD9hG.js} +1 -1
  10. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  11. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  12. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  13. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  14. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  15. package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
  16. package/system/dist/builtins/autotrack/index.js +1 -1
  17. package/system/dist/builtins/autotrack/index.mjs +1 -1
  18. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  19. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
  20. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  21. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  22. package/system/dist/builtins/camera-grid/index.js +1 -1
  23. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  24. package/system/dist/builtins/composer/composer.addon.js +4 -4
  25. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  26. package/system/dist/builtins/console-logging/index.js +1 -1
  27. package/system/dist/builtins/console-logging/index.mjs +1 -1
  28. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  29. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  30. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  31. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  32. package/system/dist/builtins/device-manager/device-bindings-store.d.ts +7 -4
  33. package/system/dist/builtins/device-manager/device-manager.addon.d.ts +2 -0
  34. package/system/dist/builtins/device-manager/device-manager.addon.js +269 -25
  35. package/system/dist/builtins/device-manager/device-manager.addon.mjs +269 -25
  36. package/system/dist/builtins/device-manager/device-meta-actions.d.ts +11 -1
  37. package/system/dist/builtins/device-manager/device-projection.d.ts +7 -0
  38. package/system/dist/builtins/device-manager/device-template/mirror-resolver.d.ts +2 -0
  39. package/system/dist/builtins/device-manager/device-template/template-filters.d.ts +13 -0
  40. package/system/dist/builtins/device-manager/device-template/template-host.d.ts +11 -3
  41. package/system/dist/builtins/device-manager/device-template-actions.d.ts +1 -0
  42. package/system/dist/builtins/device-manager/feature-deriver.d.ts +61 -0
  43. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  44. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  45. package/system/dist/builtins/keychain/index.js +4 -4
  46. package/system/dist/builtins/keychain/index.mjs +4 -4
  47. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  48. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  49. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  50. package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
  51. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  52. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  53. package/system/dist/builtins/loki-logging/index.js +1 -1
  54. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  55. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  56. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
  57. package/system/dist/builtins/platform-probe/index.js +1 -1
  58. package/system/dist/builtins/platform-probe/index.mjs +10 -10
  59. package/system/dist/builtins/record-entries/index.js +1 -1
  60. package/system/dist/builtins/record-entries/index.mjs +1 -1
  61. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  62. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  63. package/system/dist/builtins/snapshot/index.js +1 -1
  64. package/system/dist/builtins/snapshot/index.mjs +1 -1
  65. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  66. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  67. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  68. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  69. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  70. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  71. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  72. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  73. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  74. package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
  75. package/system/dist/builtins/winston-logging/index.js +1 -1
  76. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  77. package/system/dist/{capture-engine-DP4HbT3W.js → capture-engine-1A7HAX3x.js} +1 -1
  78. package/system/dist/{capture-engine-C-rHYVFq.mjs → capture-engine-B0yQx6hA.mjs} +1 -1
  79. package/system/dist/{composition-sources-CM9c_jAj.js → composition-sources-BzM19ASO.js} +1 -1
  80. package/system/dist/{composition-sources-CL9JFN4y.mjs → composition-sources-CyJ0d6Sc.mjs} +1 -1
  81. package/system/dist/{constants-DzGFnCKZ.mjs → constants-B_FLEjP_.mjs} +1 -1
  82. package/system/dist/{constants-jk7JccZ0.js → constants-DSO4ZEO3.js} +1 -1
  83. package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
  84. package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
  85. package/system/dist/{device-ca-DZ_OQiCc.mjs → device-ca-CveuNCHp.mjs} +1 -1
  86. package/system/dist/{device-ca-B7_R5WJh.js → device-ca-DLTDsonl.js} +1 -1
  87. package/system/dist/device-template-worker.js +61 -1
  88. package/system/dist/device-template-worker.mjs +61 -1
  89. package/system/dist/{dist-BgRMQHuL.mjs → dist-CIyyHwVx.mjs} +373 -175
  90. package/system/dist/{dist-BpTL3uNe.js → dist-DhbzVygm.js} +408 -174
  91. package/system/dist/file-host-worker.js +1 -1
  92. package/system/dist/file-host-worker.mjs +1 -1
  93. package/system/dist/{hub-mdns-ciao-DIcBingB.mjs → hub-mdns-ciao-CQdCUsrI.mjs} +2 -2
  94. package/system/dist/{hub-mdns-ciao-DPUaYAD3.js → hub-mdns-ciao-C_ITDs0-.js} +2 -2
  95. package/system/dist/index.js +26 -9
  96. package/system/dist/index.mjs +238 -221
  97. package/system/dist/kernel/moleculer/migration-api-facade.d.ts +3 -1
  98. package/system/dist/{legacy-integration-rows-door-DYNePgj4.js → legacy-integration-rows-door-D_tfRhsx.js} +1 -1
  99. package/system/dist/{legacy-integration-rows-door-1GnkpMgH.mjs → legacy-integration-rows-door-tX6Qktxd.mjs} +1 -1
  100. package/system/dist/{rename-composition-block-Cp0_nwAI.mjs → rename-composition-block-COaMxshT.mjs} +1 -1
  101. package/system/dist/{rename-composition-block-Dn2z4fnA.js → rename-composition-block-DNhbAonr.js} +1 -1
  102. package/system/dist/{restore-archive-DasubaYH.mjs → restore-archive-BMqp_hMT.mjs} +94 -94
  103. package/system/dist/{restore-archive-BGa5pdp9.js → restore-archive-Dbzuv5hK.js} +1 -1
  104. package/system/dist/{template-protocol-CTP4eAo_.js → template-protocol-DRZ4cm95.js} +4 -1
  105. package/system/dist/{template-protocol-BmMM5VBf.mjs → template-protocol-D_6uVHKs.mjs} +4 -1
  106. package/system/dist/{wal-maintenance-GWFxnSnE.js → wal-maintenance-CWODOTsa.js} +0 -0
  107. package/system/dist/{wal-maintenance-BLWLlVfF.mjs → wal-maintenance-ITsLGvFA.mjs} +0 -0
  108. package/system/package.json +1 -1
@@ -803,7 +803,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
803
803
  return EventCategory;
804
804
  }({});
805
805
  //#endregion
806
- //#region ../types/dist/composed-stable-id-DLcPInGv.mjs
806
+ //#region ../types/dist/composed-stable-id-jnvhwGoH.mjs
807
807
  /**
808
808
  import { errMsg } from '@camstack/types'
809
809
  * Extract a human-readable message from an unknown error value.
@@ -1091,6 +1091,10 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1091
1091
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
1092
1092
  * spots) — gates the Mow action + map selectors. */
1093
1093
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
1094
+ /** The device has a drive/navigation surface (`navigation` cap): a robot camera. */
1095
+ DeviceFeature["Navigation"] = "navigation";
1096
+ /** The device has a network-link reading (`network-link` cap). */
1097
+ DeviceFeature["NetworkLink"] = "network-link";
1094
1098
  return DeviceFeature;
1095
1099
  }({});
1096
1100
  /**
@@ -1221,7 +1225,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1221
1225
  */
1222
1226
  var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
1223
1227
  //#endregion
1224
- //#region ../types/dist/sleep-VrfKAAGN.mjs
1228
+ //#region ../types/dist/sleep-Dz1P6--1.mjs
1225
1229
  /**
1226
1230
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1227
1231
  * window to float samples (D455).
@@ -13854,7 +13858,7 @@ function sleep(ms) {
13854
13858
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
13855
13859
  }
13856
13860
  //#endregion
13857
- //#region ../types/dist/composition-BFJq1Y88.mjs
13861
+ //#region ../types/dist/implemented-methods-OitwyO1Y.mjs
13858
13862
  var AUDIO_ENCODER_BY_CODEC = {
13859
13863
  opus: "libopus",
13860
13864
  aac: "aac",
@@ -16542,6 +16546,14 @@ function featureFieldEntries(feature, arrayPath = COMPOSITION_ITEM_ARRAY_PATH) {
16542
16546
  function featureSources(feature) {
16543
16547
  return featureFieldEntries(feature).map((e) => e.source);
16544
16548
  }
16549
+ /**
16550
+ * Which of a cap's methods a registered provider object serves. Sent with the
16551
+ * registration so the hub can tell "cap bound" from "cap bound AND this method
16552
+ * implemented". A method is implemented when the object has it as a function.
16553
+ */
16554
+ function implementedMethodsOf(methodNames, provider) {
16555
+ return methodNames.filter((name) => typeof Reflect.get(provider, name) === "function");
16556
+ }
16545
16557
  var NodeColorIdSchema = zod.z.enum([
16546
16558
  "node-a",
16547
16559
  "node-b",
@@ -17434,8 +17446,31 @@ var TargetKindAttachmentsCapsSchema = zod.z.object({
17434
17446
  max: zod.z.number().int().nonnegative(),
17435
17447
  maxBytes: zod.z.number().int().positive().optional()
17436
17448
  });
17449
+ /**
17450
+ * Which TEXT fields a kind delivers (#483). Alexa speaks a title and nothing
17451
+ * else; a push service shows both.
17452
+ *
17453
+ * `.optional()` on the caps block, never defaulted: absent = both, which is
17454
+ * what every kind declared before this field meant (D938's rule for a Zod
17455
+ * default on the addon cap path).
17456
+ */
17457
+ var TargetKindTextCapsSchema = zod.z.object({
17458
+ title: zod.z.boolean(),
17459
+ body: zod.z.boolean()
17460
+ });
17461
+ zod.z.enum([
17462
+ "title",
17463
+ "body",
17464
+ "attachments",
17465
+ "actions",
17466
+ "priority",
17467
+ "sound",
17468
+ "clickUrl"
17469
+ ]);
17437
17470
  /** The full capability block consulted before dispatch. */
17438
17471
  var TargetKindCapsSchema = zod.z.object({
17472
+ /** Text fields this kind delivers (#483). Absent = title AND body. */
17473
+ text: TargetKindTextCapsSchema.optional(),
17439
17474
  attachments: TargetKindAttachmentsCapsSchema,
17440
17475
  /** Max action buttons (0 = none). */
17441
17476
  actions: zod.z.number().int().nonnegative(),
@@ -51148,14 +51183,14 @@ var climateControlCapability = {
51148
51183
  kind: "mutation",
51149
51184
  auth: "protected"
51150
51185
  }),
51151
- setFanMode: method(zod.z.object({
51186
+ setFanMode: optionalMethod(zod.z.object({
51152
51187
  deviceId: zod.z.number().int().nonnegative(),
51153
51188
  fanMode: zod.z.string().min(1)
51154
51189
  }), zod.z.void(), {
51155
51190
  kind: "mutation",
51156
51191
  auth: "protected"
51157
51192
  }),
51158
- setPreset: method(zod.z.object({
51193
+ setPreset: optionalMethod(zod.z.object({
51159
51194
  deviceId: zod.z.number().int().nonnegative(),
51160
51195
  preset: zod.z.string().min(1)
51161
51196
  }), zod.z.void(), {
@@ -51169,7 +51204,7 @@ var climateControlCapability = {
51169
51204
  kind: "mutation",
51170
51205
  auth: "protected"
51171
51206
  }),
51172
- setTargetRange: method(zod.z.object({
51207
+ setTargetRange: optionalMethod(zod.z.object({
51173
51208
  deviceId: zod.z.number().int().nonnegative(),
51174
51209
  targetLow: zod.z.number(),
51175
51210
  targetHigh: zod.z.number()
@@ -51177,21 +51212,21 @@ var climateControlCapability = {
51177
51212
  kind: "mutation",
51178
51213
  auth: "protected"
51179
51214
  }),
51180
- setTargetHumidity: method(zod.z.object({
51215
+ setTargetHumidity: optionalMethod(zod.z.object({
51181
51216
  deviceId: zod.z.number().int().nonnegative(),
51182
51217
  targetHumidity: zod.z.number().min(0).max(100)
51183
51218
  }), zod.z.void(), {
51184
51219
  kind: "mutation",
51185
51220
  auth: "protected"
51186
51221
  }),
51187
- setSwingVertical: method(zod.z.object({
51222
+ setSwingVertical: optionalMethod(zod.z.object({
51188
51223
  deviceId: zod.z.number().int().nonnegative(),
51189
51224
  on: zod.z.boolean()
51190
51225
  }), zod.z.void(), {
51191
51226
  kind: "mutation",
51192
51227
  auth: "protected"
51193
51228
  }),
51194
- setSwingHorizontal: method(zod.z.object({
51229
+ setSwingHorizontal: optionalMethod(zod.z.object({
51195
51230
  deviceId: zod.z.number().int().nonnegative(),
51196
51231
  on: zod.z.boolean()
51197
51232
  }), zod.z.void(), {
@@ -52656,27 +52691,27 @@ var mediaPlayerCapability = {
52656
52691
  mode: "singleton",
52657
52692
  deviceTypes: [DeviceType.MediaPlayer],
52658
52693
  methods: {
52659
- turnOn: method(deviceOnly, zod.z.void(), {
52694
+ turnOn: optionalMethod(deviceOnly, zod.z.void(), {
52660
52695
  kind: "mutation",
52661
52696
  auth: "protected"
52662
52697
  }),
52663
- turnOff: method(deviceOnly, zod.z.void(), {
52698
+ turnOff: optionalMethod(deviceOnly, zod.z.void(), {
52664
52699
  kind: "mutation",
52665
52700
  auth: "protected"
52666
52701
  }),
52667
- volumeUp: method(stepInput, zod.z.void(), {
52702
+ volumeUp: optionalMethod(stepInput, zod.z.void(), {
52668
52703
  kind: "mutation",
52669
52704
  auth: "protected"
52670
52705
  }),
52671
- volumeDown: method(stepInput, zod.z.void(), {
52706
+ volumeDown: optionalMethod(stepInput, zod.z.void(), {
52672
52707
  kind: "mutation",
52673
52708
  auth: "protected"
52674
52709
  }),
52675
- channelUp: method(stepInput, zod.z.void(), {
52710
+ channelUp: optionalMethod(stepInput, zod.z.void(), {
52676
52711
  kind: "mutation",
52677
52712
  auth: "protected"
52678
52713
  }),
52679
- channelDown: method(stepInput, zod.z.void(), {
52714
+ channelDown: optionalMethod(stepInput, zod.z.void(), {
52680
52715
  kind: "mutation",
52681
52716
  auth: "protected"
52682
52717
  }),
@@ -52688,61 +52723,61 @@ var mediaPlayerCapability = {
52688
52723
  kind: "mutation",
52689
52724
  auth: "protected"
52690
52725
  }),
52691
- stop: method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
52726
+ stop: optionalMethod(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
52692
52727
  kind: "mutation",
52693
52728
  auth: "protected"
52694
52729
  }),
52695
- next: method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
52730
+ next: optionalMethod(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
52696
52731
  kind: "mutation",
52697
52732
  auth: "protected"
52698
52733
  }),
52699
- previous: method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
52734
+ previous: optionalMethod(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
52700
52735
  kind: "mutation",
52701
52736
  auth: "protected"
52702
52737
  }),
52703
- seek: method(zod.z.object({
52738
+ seek: optionalMethod(zod.z.object({
52704
52739
  deviceId: zod.z.number().int().nonnegative(),
52705
52740
  position: zod.z.number().int().nonnegative()
52706
52741
  }), zod.z.void(), {
52707
52742
  kind: "mutation",
52708
52743
  auth: "protected"
52709
52744
  }),
52710
- setVolume: method(zod.z.object({
52745
+ setVolume: optionalMethod(zod.z.object({
52711
52746
  deviceId: zod.z.number().int().nonnegative(),
52712
52747
  volumeLevel: zod.z.number().min(0).max(100)
52713
52748
  }), zod.z.void(), {
52714
52749
  kind: "mutation",
52715
52750
  auth: "protected"
52716
52751
  }),
52717
- setMute: method(zod.z.object({
52752
+ setMute: optionalMethod(zod.z.object({
52718
52753
  deviceId: zod.z.number().int().nonnegative(),
52719
52754
  muted: zod.z.boolean()
52720
52755
  }), zod.z.void(), {
52721
52756
  kind: "mutation",
52722
52757
  auth: "protected"
52723
52758
  }),
52724
- setShuffle: method(zod.z.object({
52759
+ setShuffle: optionalMethod(zod.z.object({
52725
52760
  deviceId: zod.z.number().int().nonnegative(),
52726
52761
  shuffle: zod.z.boolean()
52727
52762
  }), zod.z.void(), {
52728
52763
  kind: "mutation",
52729
52764
  auth: "protected"
52730
52765
  }),
52731
- setRepeat: method(zod.z.object({
52766
+ setRepeat: optionalMethod(zod.z.object({
52732
52767
  deviceId: zod.z.number().int().nonnegative(),
52733
52768
  repeat: MediaPlayerRepeatSchema
52734
52769
  }), zod.z.void(), {
52735
52770
  kind: "mutation",
52736
52771
  auth: "protected"
52737
52772
  }),
52738
- selectSource: method(zod.z.object({
52773
+ selectSource: optionalMethod(zod.z.object({
52739
52774
  deviceId: zod.z.number().int().nonnegative(),
52740
52775
  source: zod.z.string().min(1)
52741
52776
  }), zod.z.void(), {
52742
52777
  kind: "mutation",
52743
52778
  auth: "protected"
52744
52779
  }),
52745
- playMedia: method(zod.z.object({
52780
+ playMedia: optionalMethod(zod.z.object({
52746
52781
  deviceId: zod.z.number().int().nonnegative(),
52747
52782
  /** Media identifier / URL. */
52748
52783
  mediaId: zod.z.string().min(1),
@@ -56885,18 +56920,18 @@ var coverCapability = {
56885
56920
  kind: "mutation",
56886
56921
  auth: "protected"
56887
56922
  }),
56888
- stop: method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
56923
+ stop: optionalMethod(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
56889
56924
  kind: "mutation",
56890
56925
  auth: "protected"
56891
56926
  }),
56892
- setPosition: method(zod.z.object({
56927
+ setPosition: optionalMethod(zod.z.object({
56893
56928
  deviceId: zod.z.number().int().nonnegative(),
56894
56929
  position: zod.z.number().min(0).max(100)
56895
56930
  }), zod.z.void(), {
56896
56931
  kind: "mutation",
56897
56932
  auth: "protected"
56898
56933
  }),
56899
- setTiltPosition: method(zod.z.object({
56934
+ setTiltPosition: optionalMethod(zod.z.object({
56900
56935
  deviceId: zod.z.number().int().nonnegative(),
56901
56936
  tiltPosition: zod.z.number().min(0).max(100)
56902
56937
  }), zod.z.void(), {
@@ -58240,7 +58275,8 @@ var RESERVED_ALIASES = new Set([
58240
58275
  "extends",
58241
58276
  "block",
58242
58277
  "macro",
58243
- "now"
58278
+ "now",
58279
+ "camera"
58244
58280
  ]);
58245
58281
  var DeviceAliasSchema = zod.z.string().max(64).regex(DEVICE_ALIAS_PATTERN);
58246
58282
  function isReservedDeviceAlias(alias) {
@@ -58310,10 +58346,36 @@ function checkDeviceAlias(alias, isTaken) {
58310
58346
  var DEVICE_TEMPLATE_MAX_LENGTH = 4096;
58311
58347
  var DEVICE_TEMPLATE_MAX_OUTPUT = 4096;
58312
58348
  var DeviceTemplateSchema = zod.z.string().min(1).max(DEVICE_TEMPLATE_MAX_LENGTH);
58349
+ /**
58350
+ * The device a caller renders FOR, as a template name: `{{ camera.temperature }}`.
58351
+ * It resolves only when the call names `thisDevice`, so a template stays copyable
58352
+ * between devices. It shadows a device whose own alias is `camera`.
58353
+ */
58354
+ var DEVICE_TEMPLATE_THIS_ALIAS = "camera";
58355
+ /** One value a caller hands the renderer for `thisDevice`. */
58356
+ var DeviceTemplateValueSchema = zod.z.union([
58357
+ zod.z.string(),
58358
+ zod.z.number(),
58359
+ zod.z.boolean()
58360
+ ]);
58361
+ /**
58362
+ * The device a render is FOR (`camera` in the text) and the values the caller
58363
+ * knows about it that no capability carries, for example `lastPerson` and
58364
+ * `lastPlate`. `values` read as `camera.<name>`; a name a capability also carries
58365
+ * is `ambiguous` and is written `camera.values.<name>`.
58366
+ */
58367
+ var DeviceTemplateThisDeviceSchema = zod.z.object({
58368
+ deviceId: zod.z.number().int(),
58369
+ values: zod.z.record(zod.z.string().min(1).max(64), DeviceTemplateValueSchema).optional()
58370
+ });
58371
+ /** The synthetic slice `thisDevice.values` is exposed under. */
58372
+ var DEVICE_TEMPLATE_VALUES_CAP = "values";
58313
58373
  /** The filters a template may use. Anything else is refused at parse time. */
58314
58374
  var DEVICE_TEMPLATE_FILTERS = [
58315
58375
  "unit",
58316
58376
  "round",
58377
+ "trunc",
58378
+ "onoff",
58317
58379
  "default",
58318
58380
  "since",
58319
58381
  "ago",
@@ -58337,7 +58399,8 @@ var DEVICE_TEMPLATE_FILTERS = [
58337
58399
  "sum",
58338
58400
  "string",
58339
58401
  "list",
58340
- "truncate"
58402
+ "truncate",
58403
+ "time"
58341
58404
  ];
58342
58405
  var DeviceTemplateRefusalSchema = zod.z.object({
58343
58406
  reason: zod.z.enum([
@@ -59067,7 +59130,9 @@ var DeviceBindingsForDeviceSchema = zod.z.object({
59067
59130
  kind: zod.z.enum(["native", "wrapped"]),
59068
59131
  providerAddonId: zod.z.string(),
59069
59132
  providerNodeId: zod.z.string(),
59070
- nativeAddonId: zod.z.string()
59133
+ nativeAddonId: zod.z.string(),
59134
+ /** The cap's methods the native provider implements; absent = all. */
59135
+ implementedMethods: zod.z.array(zod.z.string()).optional()
59071
59136
  }))
59072
59137
  });
59073
59138
  /**
@@ -59385,7 +59450,9 @@ var deviceManagerCapability = {
59385
59450
  */
59386
59451
  renderDeviceTemplates: method(zod.z.object({
59387
59452
  templates: zod.z.array(DeviceTemplateSchema).max(64),
59388
- allowedDeviceIds: zod.z.array(zod.z.number().int()).optional()
59453
+ allowedDeviceIds: zod.z.array(zod.z.number().int()).optional(),
59454
+ /** The device `camera` names in the texts, and the values the caller knows of it. */
59455
+ thisDevice: DeviceTemplateThisDeviceSchema.optional()
59389
59456
  }), zod.z.object({ results: zod.z.array(DeviceTemplateRenderSchema) }), { auth: "admin" }),
59390
59457
  /**
59391
59458
  * Vet templates without rendering them: the syntax refusal, or the devices
@@ -59394,14 +59461,19 @@ var deviceManagerCapability = {
59394
59461
  */
59395
59462
  checkDeviceTemplates: method(zod.z.object({
59396
59463
  templates: zod.z.array(zod.z.string()).max(64),
59397
- allowedDeviceIds: zod.z.array(zod.z.number().int()).optional()
59464
+ allowedDeviceIds: zod.z.array(zod.z.number().int()).optional(),
59465
+ thisDevice: DeviceTemplateThisDeviceSchema.optional()
59398
59466
  }), zod.z.object({ results: zod.z.array(zod.z.discriminatedUnion("ok", [zod.z.object({
59399
59467
  ok: zod.z.literal(true),
59400
59468
  aliases: zod.z.array(zod.z.object({
59401
59469
  alias: zod.z.string(),
59402
59470
  deviceId: zod.z.number().int().nullable(),
59403
- allowed: zod.z.boolean()
59404
- }))
59471
+ allowed: zod.z.boolean(),
59472
+ /** The fields the text reads on this alias, as written (`temperature`, `cap.field`). */
59473
+ reads: zod.z.array(zod.z.string())
59474
+ })),
59475
+ /** Whether the text reads the clock (`now`): it changes every minute. */
59476
+ readsClock: zod.z.boolean()
59405
59477
  }), zod.z.object({
59406
59478
  ok: zod.z.literal(false),
59407
59479
  refusal: DeviceTemplateRefusalSchema
@@ -63099,28 +63171,28 @@ var fanControlCapability = {
63099
63171
  mode: "singleton",
63100
63172
  deviceTypes: [DeviceType.Fan],
63101
63173
  methods: {
63102
- setPercentage: method(zod.z.object({
63174
+ setPercentage: optionalMethod(zod.z.object({
63103
63175
  deviceId: zod.z.number().int().nonnegative(),
63104
63176
  speed: zod.z.number().min(0).max(100)
63105
63177
  }), zod.z.void(), {
63106
63178
  kind: "mutation",
63107
63179
  auth: "protected"
63108
63180
  }),
63109
- setPreset: method(zod.z.object({
63181
+ setPreset: optionalMethod(zod.z.object({
63110
63182
  deviceId: zod.z.number().int().nonnegative(),
63111
63183
  preset: zod.z.string().min(1)
63112
63184
  }), zod.z.void(), {
63113
63185
  kind: "mutation",
63114
63186
  auth: "protected"
63115
63187
  }),
63116
- setDirection: method(zod.z.object({
63188
+ setDirection: optionalMethod(zod.z.object({
63117
63189
  deviceId: zod.z.number().int().nonnegative(),
63118
63190
  direction: FanDirectionSchema
63119
63191
  }), zod.z.void(), {
63120
63192
  kind: "mutation",
63121
63193
  auth: "protected"
63122
63194
  }),
63123
- setOscillating: method(zod.z.object({
63195
+ setOscillating: optionalMethod(zod.z.object({
63124
63196
  deviceId: zod.z.number().int().nonnegative(),
63125
63197
  oscillating: zod.z.boolean()
63126
63198
  }), zod.z.void(), {
@@ -68333,7 +68405,7 @@ var lockControlCapability = {
68333
68405
  kind: "mutation",
68334
68406
  auth: "protected"
68335
68407
  }),
68336
- open: method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
68408
+ open: optionalMethod(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.void(), {
68337
68409
  kind: "mutation",
68338
68410
  auth: "protected"
68339
68411
  })
@@ -69844,6 +69916,16 @@ var MIGRATION_API_V1_METHODS = {
69844
69916
  output: zod.z.object({ removed: zod.z.array(zod.z.string()) }),
69845
69917
  behaviours: ["settings.deleteKeys.removes-only-the-named-keys"]
69846
69918
  },
69919
+ "deviceSettings.listIds": {
69920
+ input: zod.z.object({}),
69921
+ output: zod.z.object({ deviceIds: zod.z.array(zod.z.number().int()) }),
69922
+ behaviours: ["deviceSettings.listIds.names-only-the-addons-own-devices"]
69923
+ },
69924
+ "deviceSettings.read": {
69925
+ input: zod.z.object({ deviceIds: zod.z.array(zod.z.number().int()) }),
69926
+ output: zod.z.object({ blobs: zod.z.record(zod.z.string(), Rows) }),
69927
+ behaviours: ["deviceSettings.read.returns-only-the-addons-own-blobs"]
69928
+ },
69847
69929
  "secrets.resolve": {
69848
69930
  input: zod.z.object({ refs: zod.z.array(zod.z.string()) }),
69849
69931
  output: zod.z.object({ values: zod.z.record(zod.z.string(), zod.z.string().nullable()) }),
@@ -69890,6 +69972,11 @@ var MIGRATION_API_V1_METHODS = {
69890
69972
  }).nullable(),
69891
69973
  behaviours: ["devices.get.null-for-an-unknown-id", "devices.get.reports-link-and-config"]
69892
69974
  },
69975
+ "devices.aliases": {
69976
+ input: zod.z.object({ deviceIds: zod.z.array(zod.z.number().int()) }),
69977
+ output: zod.z.object({ aliases: zod.z.record(zod.z.string(), zod.z.string()) }),
69978
+ behaviours: ["devices.aliases.answers-for-the-named-ids-only"]
69979
+ },
69893
69980
  "devices.setIntegrationId": {
69894
69981
  input: zod.z.object({
69895
69982
  deviceId: zod.z.number().int(),
@@ -79017,6 +79104,16 @@ var NcRuleTargetSchema = zod.z.object({
79017
79104
  */
79018
79105
  params: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
79019
79106
  });
79107
+ var NcTargetOverrideSchema = zod.z.object({
79108
+ template: zod.z.object({
79109
+ title: zod.z.string().max(500).optional(),
79110
+ body: zod.z.string().max(2e3).optional()
79111
+ }).optional(),
79112
+ schedule: NcScheduleSchema.optional(),
79113
+ priority: zod.z.number().int().min(1).max(5).optional()
79114
+ });
79115
+ /** Per-target settings keyed by target id (#487). */
79116
+ var NcTargetOverridesSchema = zod.z.record(zod.z.string(), NcTargetOverrideSchema);
79020
79117
  /**
79021
79118
  * WHAT THE NOTIFICATION'S PICTURE IS (D897) — the ONE media choice of a rule.
79022
79119
  *
@@ -79298,6 +79395,13 @@ var NcRuleInputSchema = zod.z.object({
79298
79395
  * targets.
79299
79396
  */
79300
79397
  targetUsers: zod.z.array(zod.z.string()).optional(),
79398
+ /**
79399
+ * Per-target settings keyed by target id (#487): texts, schedule, priority.
79400
+ * Absent (and an absent entry) = the rule's own values. A patch that omits
79401
+ * the key keeps the stored map; a patch that names it REPLACES it whole —
79402
+ * `{}` empties it.
79403
+ */
79404
+ targetOverrides: NcTargetOverridesSchema.optional(),
79301
79405
  /** Absent = the kind's default picture (`resolveNcMediaImage`): the subject crop for a
79302
79406
  * detection, the clean scene for a sensor or a sound. Set explicitly on save (D897). */
79303
79407
  media: NcMediaPolicySchema.default({}),
@@ -81111,53 +81215,41 @@ setOverlay: method(zod.z.object({
81111
81215
  }
81112
81216
  }] }
81113
81217
  };
81114
- zod.z.enum([
81115
- "value",
81116
- "unit",
81117
- "full"
81118
- ]);
81119
- zod.z.enum([
81120
- "value+unit",
81121
- "value",
81122
- "unit"
81123
- ]);
81124
81218
  /**
81125
- * How the operator reached the leaf device. `deviceId` is ALWAYS the
81126
- * OSD-supported leaf that is read; `containerId` is set when the pick
81127
- * went through a container (gateway) first.
81219
+ * `osd-manager` — the ORCHESTRATOR over the device-scope `osd` cap.
81220
+ *
81221
+ * The `osd` cap is the firmware contract: it probes a camera's overlay
81222
+ * SLOTS and writes literal text into one. It has no idea WHERE that text
81223
+ * comes from, and it must not — a driver that grew a "show the temperature
81224
+ * here" feature would grow it once per vendor.
81225
+ *
81226
+ * This cap owns the other half: a per-(camera, slot) BINDING that says
81227
+ * which value feeds the slot, how it is formatted, and under which
81228
+ * conditions it is shown at all. Named TEMPLATES combine many device
81229
+ * fields into one overlay string (plugin catalog OSD Manager parity).
81128
81230
  */
81129
- var OsdTemplatePickSchema = zod.z.object({
81130
- containerId: zod.z.number().int().optional(),
81131
- deviceId: zod.z.number().int()
81132
- });
81133
81231
  /**
81134
- * One named binding inside a multi-device template: device path + unit
81135
- * selection + precision. The parser expands `{alias}`, `{alias.value}`,
81136
- * `{alias.unit}`, or `{alias.full}` from the same binding — there is no
81137
- * per-binding format lock.
81232
+ * The text of a named template: a device template (D1021) —
81233
+ * `{{ camera.temperature | round(1) }}`, `{{ now | time('HH:mm') }}`,
81234
+ * `{% if camera.motion %}MOTION{% endif %}` — rendered by the ONE hub renderer
81235
+ * (`device-manager.renderDeviceTemplates`), never by this addon.
81236
+ *
81237
+ * Two names belong to the render rather than to a device:
81238
+ * - `now` is the clock; `time('HH:mm')` prints it in the server's zone.
81239
+ * - `camera` is the camera the overlay is on, so one template serves every
81240
+ * camera. `camera.lastPerson` and `camera.lastPlate` are the most recent
81241
+ * recognition persisted for it (empty text until there is one, with
81242
+ * `| default('')`).
81138
81243
  */
81139
- var OsdTemplateBindingSchema = zod.z.object({
81140
- /** Token stem in the parser, e.g. `t` → `{t}` / `{t.value}`. Unique within the template. */
81141
- alias: zod.z.string().min(1).max(32).regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "alias must start with a letter"),
81142
- pick: OsdTemplatePickSchema,
81143
- capName: zod.z.string().min(1).max(64),
81144
- valuePath: zod.z.string().min(1).max(64),
81145
- /** Convert TO this unit at render (`tryConvertUnit`). Absent = source unit. */
81146
- displayUnit: zod.z.string().max(16).optional(),
81147
- maxDecimals: zod.z.number().int().min(0).max(4).default(1),
81148
- /** Raw value → display text (same shape as slot binding). Empty string hides. */
81149
- valueMap: zod.z.record(zod.z.string(), zod.z.string()).optional()
81150
- });
81244
+ var OSD_TEMPLATE_TEXT_MAX = 1024;
81151
81245
  /**
81152
- * A named template: bindings (alias → leaf field) + a parser that
81153
- * references `{alias}` / `{alias.value}` / `{alias.unit}` / `{alias.full}`.
81246
+ * A named template: the unit of reuse. A slot points at one by id; editing it
81247
+ * changes every slot that points at it, on every camera.
81154
81248
  */
81155
81249
  var OsdNamedTemplateSchema = zod.z.object({
81156
81250
  id: zod.z.string().min(1).max(64),
81157
81251
  name: zod.z.string().min(1).max(64),
81158
- bindings: zod.z.array(OsdTemplateBindingSchema).max(32).default([]),
81159
- /** Parser with alias placeholders, e.g. `{t.value} {t.unit} / {h}`. */
81160
- parser: zod.z.string().max(256).default("")
81252
+ text: zod.z.string().max(OSD_TEMPLATE_TEXT_MAX).default("")
81161
81253
  });
81162
81254
  /** Where a slot's value comes from. */
81163
81255
  var OsdSourceSchema = zod.z.discriminatedUnion("kind", [
@@ -81166,26 +81258,6 @@ var OsdSourceSchema = zod.z.discriminatedUnion("kind", [
81166
81258
  kind: zod.z.literal("static"),
81167
81259
  text: zod.z.string().max(64)
81168
81260
  }),
81169
- zod.z.object({
81170
- kind: zod.z.literal("clock"),
81171
- /** Token pattern: `YYYY MM DD HH mm ss`. Everything else is literal. */
81172
- pattern: zod.z.string().min(1).max(32).default("HH:mm"),
81173
- /** IANA zone. Omitted = the server's zone. */
81174
- timezone: zod.z.string().min(1).max(64).optional()
81175
- }),
81176
- zod.z.object({
81177
- kind: zod.z.literal("device-state"),
81178
- deviceId: zod.z.number().int().optional(),
81179
- capName: zod.z.string().min(1).max(64),
81180
- /** Dot path inside the slice, e.g. `detected`, `value`, `mode`. */
81181
- valuePath: zod.z.string().min(1).max(64),
81182
- /** Convert TO this unit at render. Absent = no conversion. */
81183
- displayUnit: zod.z.string().max(16).optional()
81184
- }),
81185
- zod.z.object({
81186
- kind: zod.z.literal("latest-recognition"),
81187
- recognition: zod.z.enum(["person", "plate"])
81188
- }),
81189
81261
  zod.z.object({
81190
81262
  kind: zod.z.literal("template"),
81191
81263
  templateId: zod.z.string().min(1).max(64)
@@ -81195,15 +81267,6 @@ var OsdSlotBindingSchema = zod.z.object({
81195
81267
  /** Off = the manager stops driving this slot. It does NOT clear it. */
81196
81268
  enabled: zod.z.boolean().default(true),
81197
81269
  source: OsdSourceSchema,
81198
- /** `${value}` and `${unit}` are substituted; every occurrence. */
81199
- template: zod.z.string().max(96).default("${value}"),
81200
- /**
81201
- * Decimal places for a numeric value. `0` yields an integer — the
81202
- * documented workaround for firmwares that reject `.` in overlay text.
81203
- */
81204
- maxDecimals: zod.z.number().int().min(0).max(4).default(1),
81205
- /** Raw value → display text, e.g. `{"true":"MOTION","false":""}`. */
81206
- valueMap: zod.z.record(zod.z.string(), zod.z.string()).optional(),
81207
81270
  /** Time windows in which the slot is shown. Absent = always. */
81208
81271
  schedule: NcScheduleSchema.optional(),
81209
81272
  /**
@@ -81245,26 +81308,16 @@ var OsdRenderResultSchema = zod.z.object({
81245
81308
  /** Why, whenever the outcome is not a plain write. Never silent. */
81246
81309
  reason: zod.z.string().optional()
81247
81310
  });
81248
- var OsdSourceValueTypeEnum = zod.z.enum([
81249
- "number",
81250
- "boolean",
81251
- "string",
81252
- "enum"
81253
- ]);
81254
81311
  /**
81255
- * One bindable value, derived from a cap's `runtimeState` schema — never
81256
- * hand-listed. The editor renders from this, so a cap that ships a new
81257
- * state field becomes bindable with no UI change.
81312
+ * A template rendered for one camera without being saved: what the editor
81313
+ * previews. `text` is what the overlay would carry; a refused render has a
81314
+ * `reason` and an empty text.
81258
81315
  */
81259
- var OsdSourceOptionSchema = zod.z.object({
81260
- deviceId: zod.z.number().int(),
81261
- deviceName: zod.z.string(),
81262
- capName: zod.z.string(),
81263
- valuePath: zod.z.string(),
81264
- label: zod.z.string(),
81265
- valueType: OsdSourceValueTypeEnum,
81266
- /** Present for `enum`; the editor offers these as `valueMap` keys. */
81267
- enumValues: zod.z.array(zod.z.string()).readonly().optional()
81316
+ var OsdTemplatePreviewSchema = zod.z.object({
81317
+ ok: zod.z.boolean(),
81318
+ text: zod.z.string(),
81319
+ /** The refusal, or `ref: reason` per value that printed `—`. */
81320
+ notes: zod.z.array(zod.z.string())
81268
81321
  });
81269
81322
  var osdManagerCapability = {
81270
81323
  name: "osd-manager",
@@ -81281,12 +81334,6 @@ var osdManagerCapability = {
81281
81334
  slots: zod.z.array(OsdSlotViewSchema)
81282
81335
  }), { auth: "admin" }),
81283
81336
  /**
81284
- * Every value bindable on this camera: its own state leaves first,
81285
- * then every other device's. Derived from the cap definitions, so it
81286
- * cannot drift from what the resolver can actually read.
81287
- */
81288
- getSourceCatalog: method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.object({ sources: zod.z.array(OsdSourceOptionSchema) }), { auth: "admin" }),
81289
- /**
81290
81337
  * The condition ids this gate can answer, alongside the FULL notification
81291
81338
  * condition catalog. Both, in one call, on purpose: an editor that showed
81292
81339
  * the catalog without the supported set would offer conditions that
@@ -81361,6 +81408,18 @@ var osdManagerCapability = {
81361
81408
  kind: "mutation",
81362
81409
  auth: "admin"
81363
81410
  }),
81411
+ /**
81412
+ * Render a template text for a camera without saving it, with the same
81413
+ * context a slot gets (`camera`, `now`, the recognitions). The editor's
81414
+ * preview; no side effects.
81415
+ */
81416
+ previewTemplate: method(zod.z.object({
81417
+ deviceId: zod.z.number().int(),
81418
+ text: zod.z.string().max(OSD_TEMPLATE_TEXT_MAX)
81419
+ }), OsdTemplatePreviewSchema, {
81420
+ kind: "mutation",
81421
+ auth: "admin"
81422
+ }),
81364
81423
  /** Force a render pass over one camera now, instead of at the next tick. */
81365
81424
  renderDevice: method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.object({ results: zod.z.array(OsdRenderResultSchema) }), {
81366
81425
  kind: "mutation",
@@ -81376,7 +81435,7 @@ var osdManagerCapability = {
81376
81435
  kind: "mutation",
81377
81436
  auth: "admin"
81378
81437
  }),
81379
- /** Drop a named template. Bindings that still reference it render unreadable. */
81438
+ /** Drop a named template. Slots that still point at it render unreadable and keep their last text. */
81380
81439
  deleteTemplate: method(zod.z.object({ templateId: zod.z.string().min(1).max(64) }), zod.z.object({ success: zod.z.literal(true) }), {
81381
81440
  kind: "mutation",
81382
81441
  auth: "admin"
@@ -93344,7 +93403,7 @@ var valveCapability = {
93344
93403
  kind: "mutation",
93345
93404
  auth: "protected"
93346
93405
  }),
93347
- setPosition: method(zod.z.object({
93406
+ setPosition: optionalMethod(zod.z.object({
93348
93407
  deviceId: zod.z.number().int().nonnegative(),
93349
93408
  position: zod.z.number().min(0).max(100)
93350
93409
  }), zod.z.void(), {
@@ -107955,13 +108014,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
107955
108014
  access: "create",
107956
108015
  role: "admin"
107957
108016
  },
107958
- "notificationRules.createSequence": {
107959
- capName: "notification-rules",
107960
- capScope: "system",
107961
- addonId: null,
107962
- access: "create",
107963
- role: "admin"
107964
- },
107965
108017
  "notificationRules.createSnooze": {
107966
108018
  capName: "notification-rules",
107967
108019
  capScope: "system",
@@ -107983,13 +108035,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
107983
108035
  access: "delete",
107984
108036
  role: "admin"
107985
108037
  },
107986
- "notificationRules.deleteSequence": {
107987
- capName: "notification-rules",
107988
- capScope: "system",
107989
- addonId: null,
107990
- access: "delete",
107991
- role: "admin"
107992
- },
107993
108038
  "notificationRules.getAlarmConfig": {
107994
108039
  capName: "notification-rules",
107995
108040
  capScope: "system",
@@ -108039,13 +108084,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
108039
108084
  access: "view",
108040
108085
  role: "admin"
108041
108086
  },
108042
- "notificationRules.getSequence": {
108043
- capName: "notification-rules",
108044
- capScope: "system",
108045
- addonId: null,
108046
- access: "view",
108047
- role: "admin"
108048
- },
108049
108087
  "notificationRules.getTemplateCatalog": {
108050
108088
  capName: "notification-rules",
108051
108089
  capScope: "system",
@@ -108067,13 +108105,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
108067
108105
  access: "view",
108068
108106
  role: "admin"
108069
108107
  },
108070
- "notificationRules.listSequences": {
108071
- capName: "notification-rules",
108072
- capScope: "system",
108073
- addonId: null,
108074
- access: "view",
108075
- role: "admin"
108076
- },
108077
108108
  "notificationRules.listSnoozes": {
108078
108109
  capName: "notification-rules",
108079
108110
  capScope: "system",
@@ -108144,13 +108175,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
108144
108175
  access: "create",
108145
108176
  role: "admin"
108146
108177
  },
108147
- "notificationRules.updateSequence": {
108148
- capName: "notification-rules",
108149
- capScope: "system",
108150
- addonId: null,
108151
- access: "create",
108152
- role: "admin"
108153
- },
108154
108178
  "notifier.cancel": {
108155
108179
  capName: "notifier",
108156
108180
  capScope: "device",
@@ -108235,21 +108259,21 @@ var METHOD_ACCESS_MAP = Object.freeze({
108235
108259
  access: "view",
108236
108260
  role: "admin"
108237
108261
  },
108238
- "osdManager.getSourceCatalog": {
108262
+ "osdManager.listTemplates": {
108239
108263
  capName: "osd-manager",
108240
108264
  capScope: "system",
108241
108265
  addonId: null,
108242
108266
  access: "view",
108243
108267
  role: "admin"
108244
108268
  },
108245
- "osdManager.listTemplates": {
108269
+ "osdManager.previewSlot": {
108246
108270
  capName: "osd-manager",
108247
108271
  capScope: "system",
108248
108272
  addonId: null,
108249
- access: "view",
108273
+ access: "create",
108250
108274
  role: "admin"
108251
108275
  },
108252
- "osdManager.previewSlot": {
108276
+ "osdManager.previewTemplate": {
108253
108277
  capName: "osd-manager",
108254
108278
  capScope: "system",
108255
108279
  addonId: null,
@@ -113039,6 +113063,180 @@ function projectAction(cap, action) {
113039
113063
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
113040
113064
  DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Heater, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
113041
113065
  DeviceFeature.BatteryOperated;
113066
+ function bound(cap, methods = [], authority = "reported") {
113067
+ return {
113068
+ kind: "cap",
113069
+ cap,
113070
+ methods,
113071
+ authority
113072
+ };
113073
+ }
113074
+ function derived(cap, methods = []) {
113075
+ return bound(cap, methods, "derived");
113076
+ }
113077
+ function reported(reason) {
113078
+ return {
113079
+ kind: "reported",
113080
+ reason
113081
+ };
113082
+ }
113083
+ var SLEEP_PENDING = "splits into a sleeping cap in a later phase of #459";
113084
+ var CAP_PENDING = "becomes a cap or is dropped in a later phase of #459";
113085
+ /** Exhaustive: a new `DeviceFeature` without a row does not compile. */
113086
+ var DEVICE_FEATURE_REQUIREMENTS = {
113087
+ [DeviceFeature.BatteryOperated]: reported(SLEEP_PENDING),
113088
+ [DeviceFeature.Rebootable]: derived("reboot", ["reboot"]),
113089
+ [DeviceFeature.Resyncable]: reported(CAP_PENDING),
113090
+ [DeviceFeature.NativeSnapshot]: reported(CAP_PENDING),
113091
+ [DeviceFeature.DoorbellButton]: derived("doorbell"),
113092
+ [DeviceFeature.TwoWayAudio]: derived("intercom", [
113093
+ "startTalkSession",
113094
+ "pushTalkAudio",
113095
+ "endTalkSession"
113096
+ ]),
113097
+ [DeviceFeature.PanTiltZoom]: derived("ptz"),
113098
+ [DeviceFeature.PtzAutotrack]: derived("ptz-autotrack"),
113099
+ [DeviceFeature.MotionTrigger]: derived("motion-trigger", ["setMotionTrigger"]),
113100
+ [DeviceFeature.TimedRun]: derived("timed-run", ["runFor"]),
113101
+ [DeviceFeature.Switch]: bound("switch", ["setState"]),
113102
+ [DeviceFeature.LightColorRgb]: reported(CAP_PENDING),
113103
+ [DeviceFeature.LightColorHsv]: reported(CAP_PENDING),
113104
+ [DeviceFeature.LightColorMired]: reported(CAP_PENDING),
113105
+ [DeviceFeature.ClimateDualSetpoint]: bound("climate-control", ["setTargetRange"]),
113106
+ [DeviceFeature.ClimateHumidity]: bound("climate-control", ["setTargetHumidity"]),
113107
+ [DeviceFeature.ClimateFanMode]: bound("climate-control", ["setFanMode"]),
113108
+ [DeviceFeature.ClimatePreset]: bound("climate-control", ["setPreset"]),
113109
+ [DeviceFeature.ClimateSwingVertical]: bound("climate-control", ["setSwingVertical"]),
113110
+ [DeviceFeature.ClimateSwingHorizontal]: bound("climate-control", ["setSwingHorizontal"]),
113111
+ [DeviceFeature.CoverPositionable]: bound("cover", ["setPosition"]),
113112
+ [DeviceFeature.CoverTilt]: bound("cover", ["setTiltPosition"]),
113113
+ [DeviceFeature.CoverStoppable]: bound("cover", ["stop"]),
113114
+ [DeviceFeature.ValvePositionable]: bound("valve", ["setPosition"]),
113115
+ [DeviceFeature.FanSpeed]: bound("fan-control", ["setPercentage"]),
113116
+ [DeviceFeature.FanPreset]: bound("fan-control", ["setPreset"]),
113117
+ [DeviceFeature.FanDirection]: bound("fan-control", ["setDirection"]),
113118
+ [DeviceFeature.FanOscillating]: bound("fan-control", ["setOscillating"]),
113119
+ [DeviceFeature.LockPinRequired]: reported(CAP_PENDING),
113120
+ [DeviceFeature.LockOpen]: bound("lock-control", ["open"]),
113121
+ [DeviceFeature.MediaPlayerSeek]: bound("media-player", ["seek"]),
113122
+ [DeviceFeature.MediaPlayerVolume]: bound("media-player", ["setVolume"]),
113123
+ [DeviceFeature.MediaPlayerMute]: bound("media-player", ["setMute"]),
113124
+ [DeviceFeature.MediaPlayerShuffle]: bound("media-player", ["setShuffle"]),
113125
+ [DeviceFeature.MediaPlayerRepeat]: bound("media-player", ["setRepeat"]),
113126
+ [DeviceFeature.MediaPlayerSelectSource]: bound("media-player", ["selectSource"]),
113127
+ [DeviceFeature.MediaPlayerPlayMedia]: bound("media-player", ["playMedia"]),
113128
+ [DeviceFeature.MediaPlayerNext]: bound("media-player", ["next"]),
113129
+ [DeviceFeature.MediaPlayerPrevious]: bound("media-player", ["previous"]),
113130
+ [DeviceFeature.MediaPlayerStop]: bound("media-player", ["stop"]),
113131
+ [DeviceFeature.MediaPlayerVolumeStep]: bound("media-player", ["volumeUp", "volumeDown"]),
113132
+ [DeviceFeature.MediaPlayerChannelStep]: bound("media-player", ["channelUp", "channelDown"]),
113133
+ [DeviceFeature.MediaPlayerPower]: bound("media-player", ["turnOn", "turnOff"]),
113134
+ [DeviceFeature.AlarmPinRequired]: reported(CAP_PENDING),
113135
+ [DeviceFeature.PresenceGps]: reported(CAP_PENDING),
113136
+ [DeviceFeature.NotifierImage]: reported(CAP_PENDING),
113137
+ [DeviceFeature.NotifierPriority]: reported(CAP_PENDING),
113138
+ [DeviceFeature.NotifierData]: reported(CAP_PENDING),
113139
+ [DeviceFeature.NotifierActions]: reported(CAP_PENDING),
113140
+ [DeviceFeature.NotifierRecipients]: reported(CAP_PENDING),
113141
+ [DeviceFeature.ScriptVariables]: reported(CAP_PENDING),
113142
+ [DeviceFeature.AutomationSkipCondition]: reported(CAP_PENDING),
113143
+ [DeviceFeature.VacuumHasMap]: reported(CAP_PENDING),
113144
+ [DeviceFeature.VacuumHasAi]: reported(CAP_PENDING),
113145
+ [DeviceFeature.MowerHasMap]: reported(CAP_PENDING),
113146
+ [DeviceFeature.MowerHasTargetedMowing]: reported(CAP_PENDING),
113147
+ [DeviceFeature.Navigation]: derived("navigation"),
113148
+ [DeviceFeature.NetworkLink]: derived("network-link")
113149
+ };
113150
+ var ALL_FEATURES = Object.values(DeviceFeature);
113151
+ function requirementOf(feature) {
113152
+ return DEVICE_FEATURE_REQUIREMENTS[feature];
113153
+ }
113154
+ /**
113155
+ * The provenance of every cap-backed feature, from one device's bindings. The
113156
+ * feature set the kernel persists and the "why is it missing" the device page
113157
+ * shows are the same computation.
113158
+ */
113159
+ function deriveFeatureProvenance(entries) {
113160
+ const out = [];
113161
+ for (const feature of ALL_FEATURES) {
113162
+ const req = requirementOf(feature);
113163
+ if (req.kind !== "cap") continue;
113164
+ const entry = entries.find((candidate) => candidate.capName === req.cap);
113165
+ if (entry === void 0) {
113166
+ out.push({
113167
+ feature,
113168
+ authority: req.authority,
113169
+ present: false,
113170
+ missing: {
113171
+ reason: "cap-not-bound",
113172
+ cap: req.cap
113173
+ }
113174
+ });
113175
+ continue;
113176
+ }
113177
+ const implemented = entry.implementedMethods;
113178
+ const lacking = implemented === void 0 ? [] : req.methods.filter((name) => !implemented.includes(name));
113179
+ if (lacking.length > 0) {
113180
+ out.push({
113181
+ feature,
113182
+ authority: req.authority,
113183
+ present: false,
113184
+ missing: {
113185
+ reason: "methods-not-implemented",
113186
+ cap: req.cap,
113187
+ methods: lacking
113188
+ }
113189
+ });
113190
+ continue;
113191
+ }
113192
+ out.push({
113193
+ feature,
113194
+ authority: req.authority,
113195
+ present: true,
113196
+ supplier: {
113197
+ cap: req.cap,
113198
+ providerAddonId: entry.providerAddonId,
113199
+ providerNodeId: entry.providerNodeId
113200
+ }
113201
+ });
113202
+ }
113203
+ return out;
113204
+ }
113205
+ function isDerivedAuthority(feature) {
113206
+ const req = requirementOf(feature);
113207
+ return req.kind === "cap" && req.authority === "derived";
113208
+ }
113209
+ var FEATURE_VALUES = new Set(ALL_FEATURES);
113210
+ function knownFeature(value) {
113211
+ return FEATURE_VALUES.has(value);
113212
+ }
113213
+ /** True when the kernel, not the driver, decides this feature. */
113214
+ function isKernelDerivedFeature(value) {
113215
+ return knownFeature(value) && isDerivedAuthority(value);
113216
+ }
113217
+ /**
113218
+ * The feature set to persist: the kernel's value for every `derived` feature,
113219
+ * plus the driver's own claim for the rest (`reported`). Unknown strings are
113220
+ * dropped.
113221
+ */
113222
+ function settleDeviceFeatures(entries, reportedByDriver) {
113223
+ const settled = /* @__PURE__ */ new Set();
113224
+ for (const item of deriveFeatureProvenance(entries)) if (item.present && item.authority === "derived") settled.add(item.feature);
113225
+ for (const value of reportedByDriver) if (knownFeature(value) && !isDerivedAuthority(value)) settled.add(value);
113226
+ return ALL_FEATURES.filter((feature) => settled.has(feature));
113227
+ }
113228
+ /**
113229
+ * What `registerDevice` stores. A driver re-registers after every probe with
113230
+ * its own idea of the features; the `derived` ones are the kernel's, so a
113231
+ * re-register keeps what the row already has for them. A first registration
113232
+ * (no row yet) takes the driver's list as a bootstrap until the kernel derives.
113233
+ */
113234
+ function reconcileReportedFeatures(stored, reported) {
113235
+ if (stored === void 0) return [...reported];
113236
+ const kept = stored.filter((value) => knownFeature(value) && isDerivedAuthority(value));
113237
+ const claimed = reported.filter((value) => !(knownFeature(value) && isDerivedAuthority(value)));
113238
+ return [...new Set([...claimed, ...kept])];
113239
+ }
113042
113240
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
113043
113241
  var HA_AS = "a power sensor (device_class power). Home Assistant has no laundry domain. running-state stays unexported until a null reading can be published as unavailable.";
113044
113242
  var HOMEKIT_REASON = "HomeKit has no laundry-appliance service. The export tab would pair an accessory with nothing on it: running-state is withheld until a null reading can be unavailable, and power is not a HomeKit service this export honours.";
@@ -114785,12 +114983,12 @@ Object.freeze({
114785
114983
  form: "single",
114786
114984
  optional: false
114787
114985
  }],
114788
- "osdManager.getSourceCatalog": [{
114986
+ "osdManager.previewSlot": [{
114789
114987
  name: "deviceId",
114790
114988
  form: "single",
114791
114989
  optional: false
114792
114990
  }],
114793
- "osdManager.previewSlot": [{
114991
+ "osdManager.previewTemplate": [{
114794
114992
  name: "deviceId",
114795
114993
  form: "single",
114796
114994
  optional: false
@@ -118816,6 +119014,18 @@ Object.defineProperty(exports, "DEVICE_TEMPLATE_MAX_OUTPUT", {
118816
119014
  return DEVICE_TEMPLATE_MAX_OUTPUT;
118817
119015
  }
118818
119016
  });
119017
+ Object.defineProperty(exports, "DEVICE_TEMPLATE_THIS_ALIAS", {
119018
+ enumerable: true,
119019
+ get: function() {
119020
+ return DEVICE_TEMPLATE_THIS_ALIAS;
119021
+ }
119022
+ });
119023
+ Object.defineProperty(exports, "DEVICE_TEMPLATE_VALUES_CAP", {
119024
+ enumerable: true,
119025
+ get: function() {
119026
+ return DEVICE_TEMPLATE_VALUES_CAP;
119027
+ }
119028
+ });
118819
119029
  Object.defineProperty(exports, "DEVICE_TOMBSTONE_RETENTION_MS", {
118820
119030
  enumerable: true,
118821
119031
  get: function() {
@@ -120292,6 +120502,12 @@ Object.defineProperty(exports, "hydrateSchema", {
120292
120502
  return hydrateSchema;
120293
120503
  }
120294
120504
  });
120505
+ Object.defineProperty(exports, "implementedMethodsOf", {
120506
+ enumerable: true,
120507
+ get: function() {
120508
+ return implementedMethodsOf;
120509
+ }
120510
+ });
120295
120511
  Object.defineProperty(exports, "integrateReading", {
120296
120512
  enumerable: true,
120297
120513
  get: function() {
@@ -120406,6 +120622,12 @@ Object.defineProperty(exports, "isInternalActionId", {
120406
120622
  return isInternalActionId;
120407
120623
  }
120408
120624
  });
120625
+ Object.defineProperty(exports, "isKernelDerivedFeature", {
120626
+ enumerable: true,
120627
+ get: function() {
120628
+ return isKernelDerivedFeature;
120629
+ }
120630
+ });
120409
120631
  Object.defineProperty(exports, "isKeychainStoredField", {
120410
120632
  enumerable: true,
120411
120633
  get: function() {
@@ -120880,6 +121102,12 @@ Object.defineProperty(exports, "readinessKey", {
120880
121102
  return readinessKey;
120881
121103
  }
120882
121104
  });
121105
+ Object.defineProperty(exports, "reconcileReportedFeatures", {
121106
+ enumerable: true,
121107
+ get: function() {
121108
+ return reconcileReportedFeatures;
121109
+ }
121110
+ });
120883
121111
  Object.defineProperty(exports, "recordEntriesCapability", {
120884
121112
  enumerable: true,
120885
121113
  get: function() {
@@ -121120,6 +121348,12 @@ Object.defineProperty(exports, "settingsStoreCapability", {
121120
121348
  return settingsStoreCapability;
121121
121349
  }
121122
121350
  });
121351
+ Object.defineProperty(exports, "settleDeviceFeatures", {
121352
+ enumerable: true,
121353
+ get: function() {
121354
+ return settleDeviceFeatures;
121355
+ }
121356
+ });
121123
121357
  Object.defineProperty(exports, "sharedActuatorFeatures", {
121124
121358
  enumerable: true,
121125
121359
  get: function() {