@camstack/server 1.2.941 → 1.2.943

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 (155) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/api/trpc/generated-cap-mounts.js +19 -1
  3. package/dist/api/trpc/generated-cap-routers.js +676 -596
  4. package/package.json +13 -11
  5. package/system/dist/action-index-B1fgpQBt.mjs +9925 -0
  6. package/system/dist/action-index-B_cLRwXJ.js +9972 -0
  7. package/system/dist/alert-episode-Be--PngO.mjs +64 -0
  8. package/system/dist/alert-episode-Bqktmt-i.js +93 -0
  9. package/system/dist/{base-addon-Md14i7pe.mjs → base-addon-BcS6r1cT.mjs} +20 -7
  10. package/system/dist/{base-addon-DD5dIfcZ.js → base-addon-CRsXtYFG.js} +20 -7
  11. package/system/dist/{base-device-CH8rfD9j.js → base-device-DAdWzDOl.js} +138 -34
  12. package/system/dist/{base-device-BcGO6LTT.mjs → base-device-DJXF5eDN.mjs} +138 -34
  13. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  14. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  15. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  16. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  17. package/system/dist/builtins/alerts/alert-episode-policy.d.ts +9 -5
  18. package/system/dist/builtins/alerts/alerts.addon.js +30 -80
  19. package/system/dist/builtins/alerts/alerts.addon.mjs +18 -68
  20. package/system/dist/builtins/autotrack/index.js +2 -2
  21. package/system/dist/builtins/autotrack/index.mjs +2 -2
  22. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  23. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  24. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  25. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  26. package/system/dist/builtins/camera-grid/index.js +9 -9
  27. package/system/dist/builtins/camera-grid/index.mjs +6 -6
  28. package/system/dist/builtins/composer/composer.addon.js +99 -99
  29. package/system/dist/builtins/composer/composer.addon.mjs +11 -11
  30. package/system/dist/builtins/console-logging/index.js +1 -1
  31. package/system/dist/builtins/console-logging/index.mjs +1 -1
  32. package/system/dist/builtins/core-blocks/automation-template-instances.d.ts +14 -1
  33. package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +6 -0
  34. package/system/dist/builtins/core-blocks/core-blocks.addon.js +296 -193
  35. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +237 -134
  36. package/system/dist/builtins/core-blocks/link-contributions.d.ts +2 -0
  37. package/system/dist/builtins/core-notifier/core-notifier.addon.js +91 -18
  38. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +91 -18
  39. package/system/dist/builtins/core-notifier/group-notification-output.d.ts +8 -16
  40. package/system/dist/builtins/device-history/device-history.addon.d.ts +8 -0
  41. package/system/dist/builtins/device-history/device-history.addon.js +580 -60
  42. package/system/dist/builtins/device-history/device-history.addon.mjs +569 -49
  43. package/system/dist/builtins/device-history/retention/device-raw-overrides.d.ts +16 -0
  44. package/system/dist/builtins/device-history/retention/retention-knobs.d.ts +14 -0
  45. package/system/dist/builtins/device-history/retention/retention.d.ts +21 -1
  46. package/system/dist/builtins/device-history/transitions/change-coalescing.d.ts +48 -0
  47. package/system/dist/builtins/device-history/transitions/derived-changes.d.ts +49 -0
  48. package/system/dist/builtins/device-history/transitions/history-change-port.d.ts +20 -0
  49. package/system/dist/builtins/device-history/transitions/transitions-service.d.ts +18 -3
  50. package/system/dist/builtins/device-manager/device-config-secrets.d.ts +14 -0
  51. package/system/dist/builtins/device-manager/device-identity-index.d.ts +2 -2
  52. package/system/dist/builtins/device-manager/device-manager.addon.js +226 -479
  53. package/system/dist/builtins/device-manager/device-manager.addon.mjs +218 -471
  54. package/system/dist/builtins/device-manager/device-state-mirror.d.ts +0 -5
  55. package/system/dist/builtins/device-manager/identity-link-reconciler.d.ts +5 -0
  56. package/system/dist/builtins/device-manager/transitions/command-recorder.d.ts +38 -0
  57. package/system/dist/builtins/device-manager/transitions/transitions-wiring.d.ts +8 -9
  58. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  59. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  60. package/system/dist/builtins/keychain/index.js +2 -2
  61. package/system/dist/builtins/keychain/index.mjs +2 -2
  62. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +2 -2
  63. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +2 -2
  64. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  65. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  66. package/system/dist/builtins/local-network/address-book.d.ts +3 -1
  67. package/system/dist/builtins/local-network/local-network.addon.d.ts +26 -1
  68. package/system/dist/builtins/local-network/local-network.addon.js +66 -11
  69. package/system/dist/builtins/local-network/local-network.addon.mjs +66 -11
  70. package/system/dist/builtins/loki-logging/index.js +1 -1
  71. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  72. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  73. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  74. package/system/dist/builtins/platform-probe/index.js +1 -1
  75. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  76. package/system/dist/builtins/record-entries/index.js +1 -1
  77. package/system/dist/builtins/record-entries/index.mjs +1 -1
  78. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  79. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  80. package/system/dist/builtins/snapshot/index.js +4 -4
  81. package/system/dist/builtins/snapshot/index.mjs +4 -4
  82. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  83. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  84. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  85. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  86. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  87. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  88. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  89. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  90. package/system/dist/builtins/system-config/system-config.addon.js +1 -1
  91. package/system/dist/builtins/system-config/system-config.addon.mjs +1 -1
  92. package/system/dist/builtins/winston-logging/index.js +1 -1
  93. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  94. package/system/dist/{capture-engine-CUZ3W0oZ.mjs → capture-engine-B2MmoNND.mjs} +1 -1
  95. package/system/dist/{capture-engine-mtDXEBAq.js → capture-engine-D_1IJmMs.js} +1 -1
  96. package/system/dist/command-catalog-C29hVOOg.js +210 -0
  97. package/system/dist/command-catalog-xAeqxbZk.mjs +169 -0
  98. package/system/dist/{error.cap-DCwbIGEF.mjs → compile-OBMHlqD-.mjs} +97 -100
  99. package/system/dist/{error.cap-BxLEHP6z.js → compile-SpeAhaZ6.js} +107 -116
  100. package/system/dist/{composition-sources-B56CU8hi.mjs → composition-sources-C327LGFn.mjs} +2 -2
  101. package/system/dist/{composition-sources-D_Bfwji0.js → composition-sources-Do5qM6EB.js} +17 -17
  102. package/system/dist/{core-blocks.cap-xt5_fK5Z.js → core-blocks.cap-CdTGUKtr.js} +194 -10110
  103. package/system/dist/{core-blocks.cap-DDECcMeI.mjs → core-blocks.cap-DLkEfV5b.mjs} +54 -9910
  104. package/system/dist/{device-kind-BJ2pfsjw.mjs → device-kind-C37Ra2wd.mjs} +4 -2
  105. package/system/dist/{device-kind-CsSiv_YF.js → device-kind-FMhJg8uC.js} +4 -2
  106. package/system/dist/{device-manager.cap-DyHOIh5T.js → device-manager.cap-DJs8izI6.js} +13 -4
  107. package/system/dist/{device-manager.cap-DIBK62-r.mjs → device-manager.cap-eYrj1Ezp.mjs} +13 -4
  108. package/system/dist/{device-provider.cap-BKUGJSo0.js → device-provider.cap-CNlYBQ5D.js} +1 -1
  109. package/system/dist/{device-provider.cap-DU6HMUXH.mjs → device-provider.cap-D8mJllVM.mjs} +1 -1
  110. package/system/dist/{device-row-store-O4mNbp5q.js → device-row-store-C0P2H18h.js} +2 -2
  111. package/system/dist/{device-row-store-C-_R-h1Z.mjs → device-row-store-CTocYKqC.mjs} +2 -2
  112. package/system/dist/{device-type-CbQsnFdC.js → device-type-Cnc0NiSX.js} +13 -0
  113. package/system/dist/{device-type-DgEvK3ch.mjs → device-type-TUGqGmaI.mjs} +13 -0
  114. package/system/dist/error.cap-BuKbL3Ac.js +125 -0
  115. package/system/dist/error.cap-CU1FB6uE.mjs +102 -0
  116. package/system/dist/file-host-worker.js +1 -1
  117. package/system/dist/file-host-worker.mjs +1 -1
  118. package/system/dist/{history-catalog-BwTeQ4Mr.mjs → history-catalog-A_dzXNpv.mjs} +98 -3
  119. package/system/dist/{history-catalog-BKRarIL_.js → history-catalog-CiTMP3-E.js} +98 -3
  120. package/system/dist/index.js +28 -6
  121. package/system/dist/index.mjs +28 -6
  122. package/system/dist/kernel/addon-version-policy.d.ts +10 -0
  123. package/system/dist/{legacy-integration-rows-door-B1nzxxr5.js → legacy-integration-rows-door-CdqYAj-o.js} +1 -1
  124. package/system/dist/{legacy-integration-rows-door-nTvo_6jQ.mjs → legacy-integration-rows-door-LSgpClpX.mjs} +1 -1
  125. package/system/dist/{low-power-sleep.cap-B6mz6ojP.js → low-power-sleep.cap-BJWyAuUQ.js} +1 -1
  126. package/system/dist/{low-power-sleep.cap-C3Vi8Vxj.mjs → low-power-sleep.cap-D9Orx3LS.mjs} +1 -1
  127. package/system/dist/migrations/hub/2026-11-22-device-transitions-commands-only.d.ts +10 -0
  128. package/system/dist/{network-access.cap-BEN_uRVb.js → network-access.cap-CTQ2WQoi.js} +38 -12
  129. package/system/dist/{network-access.cap-Dy8FNNVs.mjs → network-access.cap-Dx5K0I5i.mjs} +33 -13
  130. package/system/dist/{notification-rules.cap-Drwz-A4n.js → notification-rules.cap-BJKUjizS.js} +45 -9
  131. package/system/dist/{notification-rules.cap-0vVvsxQ1.mjs → notification-rules.cap-BUIuYPlQ.mjs} +45 -9
  132. package/system/dist/{notification-targets-DR-D-vIt.mjs → notification-targets-4bGYH5J7.mjs} +2 -2
  133. package/system/dist/{notification-targets-Cc_3OBH9.js → notification-targets-DMW7xgR2.js} +2 -2
  134. package/system/dist/{prefix-walk-CCO_VZVo.js → prefix-walk-BFnw8NBu.js} +5 -5
  135. package/system/dist/{prefix-walk-BhT0ZoKl.mjs → prefix-walk-Mtij0NNT.mjs} +2 -2
  136. package/system/dist/{ptz-autotrack.cap-DOz0xL0O.js → ptz-autotrack.cap-B9eyZU8w.js} +1 -1
  137. package/system/dist/{ptz-autotrack.cap-CDF6FeTK.mjs → ptz-autotrack.cap-Dw2k-po9.mjs} +1 -1
  138. package/system/dist/{recording-archive.cap-RHAN45fa.mjs → recording-archive.cap-CTlm86R8.mjs} +1 -1
  139. package/system/dist/{recording-archive.cap-BPJ7kvnd.js → recording-archive.cap-Wo-hEZhz.js} +1 -1
  140. package/system/dist/{rename-composition-block-DWUkrazx.mjs → rename-composition-block-Cdh-dRmY.mjs} +395 -20
  141. package/system/dist/{rename-composition-block-CH2vRIW7.js → rename-composition-block-D9Uc1AF7.js} +406 -31
  142. package/system/dist/{retention-CUOVI1p7.mjs → retention-CQs8QR1B.mjs} +33 -3
  143. package/system/dist/{device-transitions.cap-DCXP3zwY.mjs → retention-source.cap-550kkyp5.mjs} +98 -21
  144. package/system/dist/{device-transitions.cap-zOGvAIHz.js → retention-source.cap-C6Hy0hlM.js} +103 -20
  145. package/system/dist/{retention-BcOSL6b9.js → retention-xcjk_k1w.js} +33 -3
  146. package/system/dist/{snapshot.cap-Cis6JRwn.js → snapshot.cap-CHm29hBs.js} +1 -1
  147. package/system/dist/{snapshot.cap-BkfHpJVO.mjs → snapshot.cap-CO68YvJU.mjs} +1 -1
  148. package/system/dist/{stream-catalog.cap-D8Y-uXcy.js → stream-catalog.cap-CjEQFknc.js} +2 -2
  149. package/system/dist/{stream-catalog.cap-D1Hy19Yc.mjs → stream-catalog.cap-DVniDdRD.mjs} +2 -2
  150. package/system/dist/{user-management.cap-Ctd4c_im.mjs → user-management.cap-4IEUCSdL.mjs} +2 -2
  151. package/system/dist/{user-management.cap-DyVb68rY.js → user-management.cap-DV9Jfsj3.js} +2 -2
  152. package/system/dist/{wal-maintenance-CjpslZUL.mjs → wal-maintenance-Bey5ChBb.mjs} +0 -0
  153. package/system/dist/{wal-maintenance-DKTXQ7UF.js → wal-maintenance-BgYiAy5b.js} +0 -0
  154. package/system/package.json +4 -1
  155. package/system/dist/builtins/device-manager/transitions/transition-correlator.d.ts +0 -81
@@ -1,4 +1,4 @@
1
- import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
1
+ import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
2
2
  import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
3
3
  import { t as metricsProviderCapability } from "../../metrics-provider.cap-01SwpLu5.mjs";
4
4
  import * as fs$1 from "node:fs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_platform_probe_cap = require("../../platform-probe.cap-C0N9CugQ.js");
9
9
  const require_coral_accelerators = require("../../coral-accelerators-7o8hqvcN.js");
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
- import { b as EventCategory, m as emitReadiness, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
2
+ import { b as EventCategory, m as emitReadiness, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
3
3
  import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
4
4
  import { n as parseAcceleratorFactsJson, t as platformProbeCapability } from "../../platform-probe.cap-DzZ7xUfS.mjs";
5
5
  import { a as enumerateInferenceDevices, i as describeNvidia, n as detectCoralAccelerator, o as scoreRuntimes, r as nodeCoralFs } from "../../coral-accelerators-BKcXP59c.mjs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_record_entries_cap = require("../../record-entries.cap-NYExLM0O.js");
9
9
  let zod = require("zod");
@@ -1,4 +1,4 @@
1
- import { t as BaseAddon, u as secretViewsOf } from "../../base-addon-Md14i7pe.mjs";
1
+ import { t as BaseAddon, u as secretViewsOf } from "../../base-addon-BcS6r1cT.mjs";
2
2
  import { k as InvalidRecordError, z as UnknownRecordKindError } from "../../scoped-settings-DVWUIP7Z.mjs";
3
3
  import { t as recordEntriesCapability } from "../../record-entries.cap-BINjYZ1Q.mjs";
4
4
  import { z } from "zod";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  let zod = require("zod");
8
8
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { b as EventCategory, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
1
+ import { b as EventCategory, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
4
4
  /**
@@ -3,12 +3,12 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_pinned_binary = require("../../pinned-binary-BOhOSNff.js");
9
- const require_device_type = require("../../device-type-CbQsnFdC.js");
10
- const require_low_power_sleep_cap = require("../../low-power-sleep.cap-B6mz6ojP.js");
11
- const require_snapshot_cap = require("../../snapshot.cap-Cis6JRwn.js");
9
+ const require_device_type = require("../../device-type-Cnc0NiSX.js");
10
+ const require_low_power_sleep_cap = require("../../low-power-sleep.cap-BJWyAuUQ.js");
11
+ const require_snapshot_cap = require("../../snapshot.cap-CHm29hBs.js");
12
12
  const require_cap_call_context = require("../../cap-call-context-Bd76CbOW.js");
13
13
  const require_addon_id = require("../../addon-id-Di0lNJ89.js");
14
14
  const require_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
@@ -1,9 +1,9 @@
1
- import { b as EventCategory, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
1
+ import { b as EventCategory, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
2
2
  import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
3
3
  import { t as memoizePinnedFfmpeg } from "../../pinned-binary-CrIRAi4G.mjs";
4
- import { r as DeviceType, t as DeviceFeature } from "../../device-type-DgEvK3ch.mjs";
5
- import { n as lowPowerSleepCapability, t as LowPowerSleepStatusSchema } from "../../low-power-sleep.cap-C3Vi8Vxj.mjs";
6
- import { t as snapshotCapability } from "../../snapshot.cap-BkfHpJVO.mjs";
4
+ import { r as DeviceType, t as DeviceFeature } from "../../device-type-TUGqGmaI.mjs";
5
+ import { n as lowPowerSleepCapability, t as LowPowerSleepStatusSchema } from "../../low-power-sleep.cap-D9Orx3LS.mjs";
6
+ import { t as snapshotCapability } from "../../snapshot.cap-CO68YvJU.mjs";
7
7
  import { n as nodePin } from "../../cap-call-context-DNwdgGSQ.mjs";
8
8
  import { t as bareAddonId } from "../../addon-id-CVg1_r5E.mjs";
9
9
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  const require_storage_provider_cap = require("../../storage-provider.cap-B3Hm_BGM.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
1
+ import { t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
2
2
  import { n as filesystemBrowseCapability, t as storageProviderCapability } from "../../storage-provider.cap-CnN9ULbc.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import * as fs$1 from "node:fs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_wal_maintenance = require("../../wal-maintenance-DKTXQ7UF.js");
6
+ const require_wal_maintenance = require("../../wal-maintenance-BgYiAy5b.js");
7
7
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
8
8
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
9
9
  //#region src/builtins/sqlite-storage/config-store.ts
@@ -1,4 +1,4 @@
1
- import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-CjpslZUL.mjs";
1
+ import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-Bey5ChBb.mjs";
2
2
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_record_kind = require("../../record-kind-DoBfYHCs.js");
9
- const require_wal_maintenance = require("../../wal-maintenance-DKTXQ7UF.js");
9
+ const require_wal_maintenance = require("../../wal-maintenance-BgYiAy5b.js");
10
10
  const require_settings_store_cap = require("../../settings-store.cap-BhOIBtO4.js");
11
11
  const require_migration = require("../../migration-BOQlFZCN.js");
12
12
  const require_database_snapshot_cap = require("../../database-snapshot.cap-BNS5c60M.js");
@@ -19,7 +19,7 @@ const require_addon_id = require("../../addon-id-Di0lNJ89.js");
19
19
  const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
20
20
  const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
21
21
  const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
22
- const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-B1nzxxr5.js");
22
+ const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-CdqYAj-o.js");
23
23
  let zod = require("zod");
24
24
  let node_crypto = require("node:crypto");
25
25
  let node_fs = require("node:fs");
@@ -1,7 +1,7 @@
1
- import { b as EventCategory, i as collectSecretMarkerRefs, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
1
+ import { b as EventCategory, i as collectSecretMarkerRefs, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
2
2
  import { A as NoCallerError, C as normalizeSecretOwner, E as DeclarationRefusedError, L as TransactRefusedError, Z as errMsg$1, k as InvalidRecordError, v as RECORD_SWEEP_INTERVAL_MS, z as UnknownRecordKindError } from "../../scoped-settings-DVWUIP7Z.mjs";
3
3
  import { n as RecordKindDeclarationSchema } from "../../record-kind-ub6NXqfh.mjs";
4
- import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-CjpslZUL.mjs";
4
+ import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-Bey5ChBb.mjs";
5
5
  import { i as DATA_STORE_DATABASES } from "../../settings-store.cap-CaDSOqgK.mjs";
6
6
  import { c as catalogueIssues, l as orderMigrations, r as MigrationMetaSchema } from "../../migration-DGAc6ywR.mjs";
7
7
  import { a as databaseSnapshotCapability, i as DATABASE_SNAPSHOT_TIMEOUT_MS, n as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, r as DATABASE_SNAPSHOT_SUFFIX } from "../../database-snapshot.cap-a3lSf4hl.mjs";
@@ -14,7 +14,7 @@ import { t as bareAddonId } from "../../addon-id-CVg1_r5E.mjs";
14
14
  import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-u6xQA6r7.mjs";
15
15
  import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
16
16
  import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
17
- import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-nTvo_6jQ.mjs";
17
+ import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-LSgpClpX.mjs";
18
18
  import { createRequire } from "node:module";
19
19
  import { z } from "zod";
20
20
  import { randomUUID } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_record_kind = require("../../record-kind-DoBfYHCs.js");
9
9
  const require_settings_store_cap = require("../../settings-store.cap-BhOIBtO4.js");
@@ -1,4 +1,4 @@
1
- import { b as EventCategory, c as normalizeNodeId, f as defineAddonMigrations, o as resolveSecretMarkers, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
1
+ import { b as EventCategory, c as normalizeNodeId, f as defineAddonMigrations, o as resolveSecretMarkers, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
2
2
  import { H as isSecretClear, J as REDACTED_SECRET, K as makeSecretMarker, U as isSecretFieldView, W as isSecretMarker, Y as collectSecretConfigKeys, b as buildSecretRef, o as recordSecretRef, q as toSecretFieldView, w as parseSecretRef } from "../../scoped-settings-DVWUIP7Z.mjs";
3
3
  import { s as defineRecordKinds } from "../../record-kind-ub6NXqfh.mjs";
4
4
  import { f as settingsStoreCapability } from "../../settings-store.cap-CaDSOqgK.mjs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_server_name = require("../../server-name-OALNvpqC.js");
9
9
  const require_custom_actions = require("../../custom-actions-D92NRi2c.js");
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { _ as hydrateSchema, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
2
+ import { _ as hydrateSchema, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
3
3
  import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
4
4
  import { n as ServerNameSchema, r as shortHostname } from "../../server-name-BIhLuHvX.mjs";
5
5
  import { n as defineCustomActions, t as customAction } from "../../custom-actions-BFUSalC9.mjs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
6
+ const require_base_addon = require("../../base-addon-CRsXtYFG.js");
7
7
  const require_migration = require("../../migration-BOQlFZCN.js");
8
8
  const require_log_destination_cap = require("../../log-destination.cap-BzTWMj-T.js");
9
9
  const require_formatter = require("../../formatter-xbxeV4GD.js");
@@ -1,4 +1,4 @@
1
- import { f as defineAddonMigrations, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
1
+ import { f as defineAddonMigrations, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
2
2
  import { u as preconditionOf } from "../../migration-DGAc6ywR.mjs";
3
3
  import { t as logDestinationCapability } from "../../log-destination.cap-QYMJPJwK.mjs";
4
4
  import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
@@ -1,5 +1,5 @@
1
1
  import { o as historyItemFieldPath, r as HISTORY_DEFAULT_MIN_INTERVAL_MS } from "./capability-definition-C1TLUVJR.mjs";
2
- import { r as DeviceType } from "./device-type-DgEvK3ch.mjs";
2
+ import { r as DeviceType } from "./device-type-TUGqGmaI.mjs";
3
3
  //#region src/builtins/shared/device-state-changed.ts
4
4
  /** Structural narrowing helper for untrusted bus payloads. */
5
5
  function isRecord$2(value) {
@@ -1,5 +1,5 @@
1
1
  const require_capability_definition = require("./capability-definition-BEVd01Xj.js");
2
- const require_device_type = require("./device-type-CbQsnFdC.js");
2
+ const require_device_type = require("./device-type-Cnc0NiSX.js");
3
3
  //#region src/builtins/shared/device-state-changed.ts
4
4
  /** Structural narrowing helper for untrusted bus payloads. */
5
5
  function isRecord$2(value) {
@@ -0,0 +1,210 @@
1
+ const require_action_index = require("./action-index-B_cLRwXJ.js");
2
+ //#region ../types/dist/esm/device/cap-vocabulary/command-catalog.mjs
3
+ /**
4
+ * The command catalogue (D1022): which cap methods are COMMANDS - the
5
+ * vocabulary actions (D920/D983) of a device-scope cap - and which status
6
+ * fields a command's effect or a boolean/enum state trigger names.
7
+ *
8
+ * Derived from the vocabulary, never kept as a second list: a method that
9
+ * becomes an action is a command with no other edit, and the spec beside this
10
+ * file fails when a device mutation is neither one nor excused. The audit in
11
+ * the hub mirror reads `auditedFields` so a slice write on a cap without any
12
+ * costs one map miss.
13
+ */
14
+ var commandKeys;
15
+ var fieldsByCap;
16
+ var NO_FIELDS = /* @__PURE__ */ new Set();
17
+ function commands() {
18
+ commandKeys ??= new Set(require_action_index.allVocabActions().map(({ cap, action }) => `${cap}.${action.method}`));
19
+ return commandKeys;
20
+ }
21
+ function buildAuditedFields() {
22
+ const byCap = /* @__PURE__ */ new Map();
23
+ const add = (cap, field) => {
24
+ const set = byCap.get(cap) ?? /* @__PURE__ */ new Set();
25
+ set.add(field);
26
+ byCap.set(cap, set);
27
+ };
28
+ for (const { cap, action } of require_action_index.allVocabActions()) {
29
+ if (action.effect !== void 0) add(cap, action.effect.field);
30
+ for (const side of action.sideEffects ?? []) add(cap, side.field);
31
+ }
32
+ for (const [cap, entry] of Object.entries(require_action_index.CAP_VOCABULARY_BY_NAME)) {
33
+ if (entry.scope !== "device") continue;
34
+ for (const trigger of entry.state ?? []) if (trigger.kind === "boolean" || trigger.kind === "enum") add(cap, trigger.field);
35
+ }
36
+ return byCap;
37
+ }
38
+ /** Is `cap.method` a vocabulary action of a device-scope cap? */
39
+ function isCommand(cap, method) {
40
+ return commands().has(`${cap}.${method}`);
41
+ }
42
+ /**
43
+ * The state the command `cap.method(args)` leads to, or `null` when it leads
44
+ * to none (toggle, press, stop), is not a command, or the argument carrying
45
+ * the value is missing.
46
+ */
47
+ function commandEffect(cap, method, args) {
48
+ const actionId = require_action_index.vocabActionIdFor(cap, method, args);
49
+ if (actionId === void 0) return null;
50
+ const effect = require_action_index.actionEffect(actionId, args);
51
+ return effect === null ? null : {
52
+ field: effect.field,
53
+ value: effect.value
54
+ };
55
+ }
56
+ /** The status fields of `cap` whose changes are recorded as transitions. */
57
+ function auditedFields(cap) {
58
+ fieldsByCap ??= buildAuditedFields();
59
+ return fieldsByCap.get(cap) ?? NO_FIELDS;
60
+ }
61
+ /** Does `slice` meet `when`? A field the slice lacks is in no list. */
62
+ function effectConditionHolds(when, slice) {
63
+ if (when === void 0) return true;
64
+ const raw = slice?.[when.field];
65
+ const value = typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" ? raw : void 0;
66
+ if ("in" in when) return value !== void 0 && when.in.includes(value);
67
+ return value === void 0 || !when.notIn.includes(value);
68
+ }
69
+ /** The step of the number open arg `key`, when the action offers one. */
70
+ function stepOf(openArgs, key) {
71
+ const offer = openArgs?.find((a) => a.key === key)?.offer;
72
+ return offer?.kind === "number" && offer.step !== void 0 && offer.step > 0 ? offer.step : void 0;
73
+ }
74
+ /**
75
+ * One side effect resolved against the args and the slice the command acts
76
+ * on: `null` when the arg carrying its value is missing, or a `negate` names a
77
+ * field the slice holds no boolean in. `openArgs` lends a copied number its
78
+ * step as the tolerance.
79
+ */
80
+ function resolveSideEffect(side, args, shown, openArgs) {
81
+ if ("value" in side) return {
82
+ field: side.field,
83
+ value: side.value
84
+ };
85
+ if ("negate" in side) {
86
+ const raw = shown?.[side.field];
87
+ return typeof raw === "boolean" ? {
88
+ field: side.field,
89
+ value: !raw
90
+ } : null;
91
+ }
92
+ const raw = args?.[side.fromArg];
93
+ if (typeof raw === "string" || typeof raw === "boolean") return {
94
+ field: side.field,
95
+ value: raw
96
+ };
97
+ if (typeof raw === "number") {
98
+ const scale = side.scale ?? 1;
99
+ const step = stepOf(openArgs, side.fromArg);
100
+ return step === void 0 ? {
101
+ field: side.field,
102
+ value: raw * scale
103
+ } : {
104
+ field: side.field,
105
+ value: raw * scale,
106
+ tolerance: step * scale
107
+ };
108
+ }
109
+ return null;
110
+ }
111
+ /**
112
+ * The hold limit the vocabulary declares for `cap.method(args)` (its action's
113
+ * `hold.holdMs`), or `undefined` for the default.
114
+ */
115
+ function commandHoldMs(cap, method, args) {
116
+ return holdFor(cap, method, args)?.holdMs;
117
+ }
118
+ /**
119
+ * The hold the vocabulary declares for `cap.method(args)`: the matched
120
+ * action's, or — when several actions share the method and the args cannot
121
+ * tell them apart (`petFeeder.feed` / `feedHoppers`) — the one they all
122
+ * declare alike. Different holds on such actions resolve to none.
123
+ */
124
+ function holdFor(cap, method, args) {
125
+ const actionId = require_action_index.vocabActionIdFor(cap, method, args);
126
+ if (actionId !== void 0) return require_action_index.findVocabAction(actionId)?.action.hold;
127
+ const holds = require_action_index.allVocabActions().filter(({ cap: c, action }) => c === cap && action.method === method).map(({ action }) => action.hold);
128
+ const first = holds[0];
129
+ if (first === void 0) return void 0;
130
+ const key = JSON.stringify(first);
131
+ return holds.every((h) => JSON.stringify(h) === key) ? first : void 0;
132
+ }
133
+ /**
134
+ * EVERY state the command `cap.method(args)` leads to (D1061): its `effect`
135
+ * first, then each side effect whose condition holds on `current` (the cap's
136
+ * slice the device reported when the command arrived). Empty when it leads to
137
+ * none. One field is named once — the first entry for it wins. A `negate`
138
+ * side effect flips what `shown` (the slice the person saw, held values
139
+ * included) holds, so a second toggle before the first is confirmed undoes it.
140
+ * An action that declares `hold.effects` is held as THOSE instead (a lock
141
+ * holds `locking`, not `locked`).
142
+ */
143
+ function commandEffects(cap, method, args, current, shown = current) {
144
+ const out = [];
145
+ const hold = holdFor(cap, method, args);
146
+ if (hold?.effects !== void 0) {
147
+ for (const entry of hold.effects) {
148
+ if (!effectConditionHolds(entry.when, current)) continue;
149
+ const resolved = resolveSideEffect(entry, args, shown);
150
+ if (resolved !== null && !out.some((e) => e.field === resolved.field)) out.push(resolved);
151
+ }
152
+ return out;
153
+ }
154
+ const actionId = require_action_index.vocabActionIdFor(cap, method, args);
155
+ if (actionId === void 0) return [];
156
+ const action = require_action_index.findVocabAction(actionId)?.action;
157
+ if (action?.effect !== void 0) {
158
+ const primary = resolveSideEffect(action.effect, args, shown, action.openArgs);
159
+ if (primary !== null) out.push(primary);
160
+ }
161
+ for (const side of action?.sideEffects ?? []) {
162
+ if (!effectConditionHolds(side.when, current)) continue;
163
+ const resolved = resolveSideEffect(side, args, shown, action?.openArgs);
164
+ if (resolved !== null && !out.some((e) => e.field === resolved.field)) out.push(resolved);
165
+ }
166
+ return out;
167
+ }
168
+ //#endregion
169
+ Object.defineProperty(exports, "auditedFields", {
170
+ enumerable: true,
171
+ get: function() {
172
+ return auditedFields;
173
+ }
174
+ });
175
+ Object.defineProperty(exports, "commandEffect", {
176
+ enumerable: true,
177
+ get: function() {
178
+ return commandEffect;
179
+ }
180
+ });
181
+ Object.defineProperty(exports, "commandEffects", {
182
+ enumerable: true,
183
+ get: function() {
184
+ return commandEffects;
185
+ }
186
+ });
187
+ Object.defineProperty(exports, "commandHoldMs", {
188
+ enumerable: true,
189
+ get: function() {
190
+ return commandHoldMs;
191
+ }
192
+ });
193
+ Object.defineProperty(exports, "effectConditionHolds", {
194
+ enumerable: true,
195
+ get: function() {
196
+ return effectConditionHolds;
197
+ }
198
+ });
199
+ Object.defineProperty(exports, "isCommand", {
200
+ enumerable: true,
201
+ get: function() {
202
+ return isCommand;
203
+ }
204
+ });
205
+ Object.defineProperty(exports, "resolveSideEffect", {
206
+ enumerable: true,
207
+ get: function() {
208
+ return resolveSideEffect;
209
+ }
210
+ });
@@ -0,0 +1,169 @@
1
+ import { a as findVocabAction, c as CAP_VOCABULARY_BY_NAME, n as actionEffect, o as vocabActionIdFor, r as allVocabActions } from "./action-index-B1fgpQBt.mjs";
2
+ //#region ../types/dist/esm/device/cap-vocabulary/command-catalog.mjs
3
+ /**
4
+ * The command catalogue (D1022): which cap methods are COMMANDS - the
5
+ * vocabulary actions (D920/D983) of a device-scope cap - and which status
6
+ * fields a command's effect or a boolean/enum state trigger names.
7
+ *
8
+ * Derived from the vocabulary, never kept as a second list: a method that
9
+ * becomes an action is a command with no other edit, and the spec beside this
10
+ * file fails when a device mutation is neither one nor excused. The audit in
11
+ * the hub mirror reads `auditedFields` so a slice write on a cap without any
12
+ * costs one map miss.
13
+ */
14
+ var commandKeys;
15
+ var fieldsByCap;
16
+ var NO_FIELDS = /* @__PURE__ */ new Set();
17
+ function commands() {
18
+ commandKeys ??= new Set(allVocabActions().map(({ cap, action }) => `${cap}.${action.method}`));
19
+ return commandKeys;
20
+ }
21
+ function buildAuditedFields() {
22
+ const byCap = /* @__PURE__ */ new Map();
23
+ const add = (cap, field) => {
24
+ const set = byCap.get(cap) ?? /* @__PURE__ */ new Set();
25
+ set.add(field);
26
+ byCap.set(cap, set);
27
+ };
28
+ for (const { cap, action } of allVocabActions()) {
29
+ if (action.effect !== void 0) add(cap, action.effect.field);
30
+ for (const side of action.sideEffects ?? []) add(cap, side.field);
31
+ }
32
+ for (const [cap, entry] of Object.entries(CAP_VOCABULARY_BY_NAME)) {
33
+ if (entry.scope !== "device") continue;
34
+ for (const trigger of entry.state ?? []) if (trigger.kind === "boolean" || trigger.kind === "enum") add(cap, trigger.field);
35
+ }
36
+ return byCap;
37
+ }
38
+ /** Is `cap.method` a vocabulary action of a device-scope cap? */
39
+ function isCommand(cap, method) {
40
+ return commands().has(`${cap}.${method}`);
41
+ }
42
+ /**
43
+ * The state the command `cap.method(args)` leads to, or `null` when it leads
44
+ * to none (toggle, press, stop), is not a command, or the argument carrying
45
+ * the value is missing.
46
+ */
47
+ function commandEffect(cap, method, args) {
48
+ const actionId = vocabActionIdFor(cap, method, args);
49
+ if (actionId === void 0) return null;
50
+ const effect = actionEffect(actionId, args);
51
+ return effect === null ? null : {
52
+ field: effect.field,
53
+ value: effect.value
54
+ };
55
+ }
56
+ /** The status fields of `cap` whose changes are recorded as transitions. */
57
+ function auditedFields(cap) {
58
+ fieldsByCap ??= buildAuditedFields();
59
+ return fieldsByCap.get(cap) ?? NO_FIELDS;
60
+ }
61
+ /** Does `slice` meet `when`? A field the slice lacks is in no list. */
62
+ function effectConditionHolds(when, slice) {
63
+ if (when === void 0) return true;
64
+ const raw = slice?.[when.field];
65
+ const value = typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" ? raw : void 0;
66
+ if ("in" in when) return value !== void 0 && when.in.includes(value);
67
+ return value === void 0 || !when.notIn.includes(value);
68
+ }
69
+ /** The step of the number open arg `key`, when the action offers one. */
70
+ function stepOf(openArgs, key) {
71
+ const offer = openArgs?.find((a) => a.key === key)?.offer;
72
+ return offer?.kind === "number" && offer.step !== void 0 && offer.step > 0 ? offer.step : void 0;
73
+ }
74
+ /**
75
+ * One side effect resolved against the args and the slice the command acts
76
+ * on: `null` when the arg carrying its value is missing, or a `negate` names a
77
+ * field the slice holds no boolean in. `openArgs` lends a copied number its
78
+ * step as the tolerance.
79
+ */
80
+ function resolveSideEffect(side, args, shown, openArgs) {
81
+ if ("value" in side) return {
82
+ field: side.field,
83
+ value: side.value
84
+ };
85
+ if ("negate" in side) {
86
+ const raw = shown?.[side.field];
87
+ return typeof raw === "boolean" ? {
88
+ field: side.field,
89
+ value: !raw
90
+ } : null;
91
+ }
92
+ const raw = args?.[side.fromArg];
93
+ if (typeof raw === "string" || typeof raw === "boolean") return {
94
+ field: side.field,
95
+ value: raw
96
+ };
97
+ if (typeof raw === "number") {
98
+ const scale = side.scale ?? 1;
99
+ const step = stepOf(openArgs, side.fromArg);
100
+ return step === void 0 ? {
101
+ field: side.field,
102
+ value: raw * scale
103
+ } : {
104
+ field: side.field,
105
+ value: raw * scale,
106
+ tolerance: step * scale
107
+ };
108
+ }
109
+ return null;
110
+ }
111
+ /**
112
+ * The hold limit the vocabulary declares for `cap.method(args)` (its action's
113
+ * `hold.holdMs`), or `undefined` for the default.
114
+ */
115
+ function commandHoldMs(cap, method, args) {
116
+ return holdFor(cap, method, args)?.holdMs;
117
+ }
118
+ /**
119
+ * The hold the vocabulary declares for `cap.method(args)`: the matched
120
+ * action's, or — when several actions share the method and the args cannot
121
+ * tell them apart (`petFeeder.feed` / `feedHoppers`) — the one they all
122
+ * declare alike. Different holds on such actions resolve to none.
123
+ */
124
+ function holdFor(cap, method, args) {
125
+ const actionId = vocabActionIdFor(cap, method, args);
126
+ if (actionId !== void 0) return findVocabAction(actionId)?.action.hold;
127
+ const holds = allVocabActions().filter(({ cap: c, action }) => c === cap && action.method === method).map(({ action }) => action.hold);
128
+ const first = holds[0];
129
+ if (first === void 0) return void 0;
130
+ const key = JSON.stringify(first);
131
+ return holds.every((h) => JSON.stringify(h) === key) ? first : void 0;
132
+ }
133
+ /**
134
+ * EVERY state the command `cap.method(args)` leads to (D1061): its `effect`
135
+ * first, then each side effect whose condition holds on `current` (the cap's
136
+ * slice the device reported when the command arrived). Empty when it leads to
137
+ * none. One field is named once — the first entry for it wins. A `negate`
138
+ * side effect flips what `shown` (the slice the person saw, held values
139
+ * included) holds, so a second toggle before the first is confirmed undoes it.
140
+ * An action that declares `hold.effects` is held as THOSE instead (a lock
141
+ * holds `locking`, not `locked`).
142
+ */
143
+ function commandEffects(cap, method, args, current, shown = current) {
144
+ const out = [];
145
+ const hold = holdFor(cap, method, args);
146
+ if (hold?.effects !== void 0) {
147
+ for (const entry of hold.effects) {
148
+ if (!effectConditionHolds(entry.when, current)) continue;
149
+ const resolved = resolveSideEffect(entry, args, shown);
150
+ if (resolved !== null && !out.some((e) => e.field === resolved.field)) out.push(resolved);
151
+ }
152
+ return out;
153
+ }
154
+ const actionId = vocabActionIdFor(cap, method, args);
155
+ if (actionId === void 0) return [];
156
+ const action = findVocabAction(actionId)?.action;
157
+ if (action?.effect !== void 0) {
158
+ const primary = resolveSideEffect(action.effect, args, shown, action.openArgs);
159
+ if (primary !== null) out.push(primary);
160
+ }
161
+ for (const side of action?.sideEffects ?? []) {
162
+ if (!effectConditionHolds(side.when, current)) continue;
163
+ const resolved = resolveSideEffect(side, args, shown, action?.openArgs);
164
+ if (resolved !== null && !out.some((e) => e.field === resolved.field)) out.push(resolved);
165
+ }
166
+ return out;
167
+ }
168
+ //#endregion
169
+ export { effectConditionHolds as a, commandHoldMs as i, commandEffect as n, isCommand as o, commandEffects as r, resolveSideEffect as s, auditedFields as t };