@camstack/server 1.2.941 → 1.2.942

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 (154) hide show
  1. package/CHANGELOG.md +14 -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 +27 -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-identity-index.d.ts +2 -2
  51. package/system/dist/builtins/device-manager/device-manager.addon.js +177 -479
  52. package/system/dist/builtins/device-manager/device-manager.addon.mjs +169 -471
  53. package/system/dist/builtins/device-manager/device-state-mirror.d.ts +0 -5
  54. package/system/dist/builtins/device-manager/identity-link-reconciler.d.ts +5 -0
  55. package/system/dist/builtins/device-manager/transitions/command-recorder.d.ts +38 -0
  56. package/system/dist/builtins/device-manager/transitions/transitions-wiring.d.ts +8 -9
  57. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  58. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  59. package/system/dist/builtins/keychain/index.js +2 -2
  60. package/system/dist/builtins/keychain/index.mjs +2 -2
  61. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +2 -2
  62. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +2 -2
  63. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  64. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  65. package/system/dist/builtins/local-network/address-book.d.ts +3 -1
  66. package/system/dist/builtins/local-network/local-network.addon.d.ts +26 -1
  67. package/system/dist/builtins/local-network/local-network.addon.js +66 -11
  68. package/system/dist/builtins/local-network/local-network.addon.mjs +66 -11
  69. package/system/dist/builtins/loki-logging/index.js +1 -1
  70. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  71. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  72. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  73. package/system/dist/builtins/platform-probe/index.js +1 -1
  74. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  75. package/system/dist/builtins/record-entries/index.js +1 -1
  76. package/system/dist/builtins/record-entries/index.mjs +1 -1
  77. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  78. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  79. package/system/dist/builtins/snapshot/index.js +4 -4
  80. package/system/dist/builtins/snapshot/index.mjs +4 -4
  81. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  82. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  83. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  84. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  85. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  86. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  87. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  88. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  89. package/system/dist/builtins/system-config/system-config.addon.js +1 -1
  90. package/system/dist/builtins/system-config/system-config.addon.mjs +1 -1
  91. package/system/dist/builtins/winston-logging/index.js +1 -1
  92. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  93. package/system/dist/{capture-engine-CUZ3W0oZ.mjs → capture-engine-B2MmoNND.mjs} +1 -1
  94. package/system/dist/{capture-engine-mtDXEBAq.js → capture-engine-D_1IJmMs.js} +1 -1
  95. package/system/dist/command-catalog-C29hVOOg.js +210 -0
  96. package/system/dist/command-catalog-xAeqxbZk.mjs +169 -0
  97. package/system/dist/{error.cap-DCwbIGEF.mjs → compile-OBMHlqD-.mjs} +97 -100
  98. package/system/dist/{error.cap-BxLEHP6z.js → compile-SpeAhaZ6.js} +107 -116
  99. package/system/dist/{composition-sources-B56CU8hi.mjs → composition-sources-C327LGFn.mjs} +2 -2
  100. package/system/dist/{composition-sources-D_Bfwji0.js → composition-sources-Do5qM6EB.js} +17 -17
  101. package/system/dist/{core-blocks.cap-xt5_fK5Z.js → core-blocks.cap-CdTGUKtr.js} +194 -10110
  102. package/system/dist/{core-blocks.cap-DDECcMeI.mjs → core-blocks.cap-DLkEfV5b.mjs} +54 -9910
  103. package/system/dist/{device-kind-BJ2pfsjw.mjs → device-kind-C37Ra2wd.mjs} +4 -2
  104. package/system/dist/{device-kind-CsSiv_YF.js → device-kind-FMhJg8uC.js} +4 -2
  105. package/system/dist/{device-manager.cap-DyHOIh5T.js → device-manager.cap-DJs8izI6.js} +13 -4
  106. package/system/dist/{device-manager.cap-DIBK62-r.mjs → device-manager.cap-eYrj1Ezp.mjs} +13 -4
  107. package/system/dist/{device-provider.cap-BKUGJSo0.js → device-provider.cap-CNlYBQ5D.js} +1 -1
  108. package/system/dist/{device-provider.cap-DU6HMUXH.mjs → device-provider.cap-D8mJllVM.mjs} +1 -1
  109. package/system/dist/{device-row-store-O4mNbp5q.js → device-row-store-C0P2H18h.js} +2 -2
  110. package/system/dist/{device-row-store-C-_R-h1Z.mjs → device-row-store-CTocYKqC.mjs} +2 -2
  111. package/system/dist/{device-type-CbQsnFdC.js → device-type-Cnc0NiSX.js} +13 -0
  112. package/system/dist/{device-type-DgEvK3ch.mjs → device-type-TUGqGmaI.mjs} +13 -0
  113. package/system/dist/error.cap-BuKbL3Ac.js +125 -0
  114. package/system/dist/error.cap-CU1FB6uE.mjs +102 -0
  115. package/system/dist/file-host-worker.js +1 -1
  116. package/system/dist/file-host-worker.mjs +1 -1
  117. package/system/dist/{history-catalog-BwTeQ4Mr.mjs → history-catalog-A_dzXNpv.mjs} +98 -3
  118. package/system/dist/{history-catalog-BKRarIL_.js → history-catalog-CiTMP3-E.js} +98 -3
  119. package/system/dist/index.js +28 -6
  120. package/system/dist/index.mjs +28 -6
  121. package/system/dist/kernel/addon-version-policy.d.ts +10 -0
  122. package/system/dist/{legacy-integration-rows-door-B1nzxxr5.js → legacy-integration-rows-door-CdqYAj-o.js} +1 -1
  123. package/system/dist/{legacy-integration-rows-door-nTvo_6jQ.mjs → legacy-integration-rows-door-LSgpClpX.mjs} +1 -1
  124. package/system/dist/{low-power-sleep.cap-B6mz6ojP.js → low-power-sleep.cap-BJWyAuUQ.js} +1 -1
  125. package/system/dist/{low-power-sleep.cap-C3Vi8Vxj.mjs → low-power-sleep.cap-D9Orx3LS.mjs} +1 -1
  126. package/system/dist/migrations/hub/2026-11-22-device-transitions-commands-only.d.ts +10 -0
  127. package/system/dist/{network-access.cap-BEN_uRVb.js → network-access.cap-CTQ2WQoi.js} +38 -12
  128. package/system/dist/{network-access.cap-Dy8FNNVs.mjs → network-access.cap-Dx5K0I5i.mjs} +33 -13
  129. package/system/dist/{notification-rules.cap-Drwz-A4n.js → notification-rules.cap-BJKUjizS.js} +45 -9
  130. package/system/dist/{notification-rules.cap-0vVvsxQ1.mjs → notification-rules.cap-BUIuYPlQ.mjs} +45 -9
  131. package/system/dist/{notification-targets-DR-D-vIt.mjs → notification-targets-4bGYH5J7.mjs} +2 -2
  132. package/system/dist/{notification-targets-Cc_3OBH9.js → notification-targets-DMW7xgR2.js} +2 -2
  133. package/system/dist/{prefix-walk-CCO_VZVo.js → prefix-walk-BFnw8NBu.js} +5 -5
  134. package/system/dist/{prefix-walk-BhT0ZoKl.mjs → prefix-walk-Mtij0NNT.mjs} +2 -2
  135. package/system/dist/{ptz-autotrack.cap-DOz0xL0O.js → ptz-autotrack.cap-B9eyZU8w.js} +1 -1
  136. package/system/dist/{ptz-autotrack.cap-CDF6FeTK.mjs → ptz-autotrack.cap-Dw2k-po9.mjs} +1 -1
  137. package/system/dist/{recording-archive.cap-RHAN45fa.mjs → recording-archive.cap-CTlm86R8.mjs} +1 -1
  138. package/system/dist/{recording-archive.cap-BPJ7kvnd.js → recording-archive.cap-Wo-hEZhz.js} +1 -1
  139. package/system/dist/{rename-composition-block-DWUkrazx.mjs → rename-composition-block-Cdh-dRmY.mjs} +395 -20
  140. package/system/dist/{rename-composition-block-CH2vRIW7.js → rename-composition-block-D9Uc1AF7.js} +406 -31
  141. package/system/dist/{retention-CUOVI1p7.mjs → retention-CQs8QR1B.mjs} +33 -3
  142. package/system/dist/{device-transitions.cap-DCXP3zwY.mjs → retention-source.cap-550kkyp5.mjs} +98 -21
  143. package/system/dist/{device-transitions.cap-zOGvAIHz.js → retention-source.cap-C6Hy0hlM.js} +103 -20
  144. package/system/dist/{retention-BcOSL6b9.js → retention-xcjk_k1w.js} +33 -3
  145. package/system/dist/{snapshot.cap-Cis6JRwn.js → snapshot.cap-CHm29hBs.js} +1 -1
  146. package/system/dist/{snapshot.cap-BkfHpJVO.mjs → snapshot.cap-CO68YvJU.mjs} +1 -1
  147. package/system/dist/{stream-catalog.cap-D8Y-uXcy.js → stream-catalog.cap-CjEQFknc.js} +2 -2
  148. package/system/dist/{stream-catalog.cap-D1Hy19Yc.mjs → stream-catalog.cap-DVniDdRD.mjs} +2 -2
  149. package/system/dist/{user-management.cap-Ctd4c_im.mjs → user-management.cap-4IEUCSdL.mjs} +2 -2
  150. package/system/dist/{user-management.cap-DyVb68rY.js → user-management.cap-DV9Jfsj3.js} +2 -2
  151. package/system/dist/{wal-maintenance-CjpslZUL.mjs → wal-maintenance-Bey5ChBb.mjs} +0 -0
  152. package/system/dist/{wal-maintenance-DKTXQ7UF.js → wal-maintenance-BgYiAy5b.js} +0 -0
  153. package/system/package.json +4 -1
  154. package/system/dist/builtins/device-manager/transitions/transition-correlator.d.ts +0 -81
@@ -1,9 +1,8 @@
1
1
  import { c as method } from "./capability-definition-C1TLUVJR.mjs";
2
2
  import { n as baseUnitOf } from "./quantity-D3g5SxsZ.mjs";
3
- import { n as DeviceRole, r as DeviceType, t as DeviceFeature } from "./device-type-DgEvK3ch.mjs";
4
- import { t as canonicalStoredDeviceType } from "./device-kind-BJ2pfsjw.mjs";
5
- import { t } from "./l10n-Bu6aUvSY.mjs";
6
- import { a as wattMillisecondsToKwh, i as historyFieldsFor } from "./history-catalog-BwTeQ4Mr.mjs";
3
+ import { n as DeviceRole, r as DeviceType, t as DeviceFeature } from "./device-type-TUGqGmaI.mjs";
4
+ import { t as canonicalStoredDeviceType } from "./device-kind-C37Ra2wd.mjs";
5
+ import { a as wattMillisecondsToKwh, i as historyFieldsFor } from "./history-catalog-A_dzXNpv.mjs";
7
6
  import { z } from "zod";
8
7
  //#region ../types/dist/esm/catalogs/sensor-active-state.mjs
9
8
  /**
@@ -1183,6 +1182,99 @@ function evaluateExpressionSource(expr, bindingValues, now, opts) {
1183
1182
  }
1184
1183
  }
1185
1184
  //#endregion
1185
+ //#region ../types/dist/esm/capabilities/alerts.cap.mjs
1186
+ /**
1187
+ * Alerts capability — collection-based internal alert system.
1188
+ *
1189
+ * Multiple providers can register. Each provider filters by EventBus category
1190
+ * and creates/updates alerts. The built-in Alert Center addon persists alerts
1191
+ * in the DB and serves them to the admin UI.
1192
+ */
1193
+ var AlertSeveritySchema = /* @__PURE__ */ z.enum([
1194
+ "info",
1195
+ "success",
1196
+ "warning",
1197
+ "error",
1198
+ "critical"
1199
+ ]);
1200
+ /**
1201
+ * An action that RUNS something instead of going somewhere: the admin UI calls
1202
+ * the addon's custom action (`addons.custom`) with exactly these fields. The
1203
+ * producer owns the meaning; the UI knows nothing about the addon or the kind.
1204
+ */
1205
+ var AlertActionInvokeSchema = /* @__PURE__ */ z.object({
1206
+ addonId: /* @__PURE__ */ z.string().min(1),
1207
+ action: /* @__PURE__ */ z.string().min(1),
1208
+ input: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown()).optional()
1209
+ });
1210
+ /** An action has `href` (a link) OR `invoke` (a button that runs a custom action). */
1211
+ var AlertActionSchema = /* @__PURE__ */ z.object({
1212
+ label: /* @__PURE__ */ z.string(),
1213
+ href: /* @__PURE__ */ z.string().optional(),
1214
+ invoke: /* @__PURE__ */ AlertActionInvokeSchema.optional(),
1215
+ /**
1216
+ * How `href` is followed. Absent / `app`: an admin-ui route (client-side).
1217
+ * `server`: a route the HUB serves (an addon HTTP route such as an OAuth
1218
+ * start) — the browser must leave the SPA with a full navigation, because
1219
+ * the SPA has no such route and would bounce to the home page.
1220
+ */
1221
+ navigation: /* @__PURE__ */ z.enum(["app", "server"]).optional()
1222
+ });
1223
+ var AlertStatusSchema = /* @__PURE__ */ z.enum([
1224
+ "active",
1225
+ "in-progress",
1226
+ "completed",
1227
+ "failed",
1228
+ "dismissed"
1229
+ ]);
1230
+ var AlertSourceSchema = /* @__PURE__ */ z.object({
1231
+ type: /* @__PURE__ */ z.string(),
1232
+ id: /* @__PURE__ */ z.string()
1233
+ });
1234
+ var AlertSchema = /* @__PURE__ */ z.object({
1235
+ id: /* @__PURE__ */ z.string(),
1236
+ category: /* @__PURE__ */ z.string(),
1237
+ severity: AlertSeveritySchema,
1238
+ title: /* @__PURE__ */ z.string(),
1239
+ message: /* @__PURE__ */ z.string(),
1240
+ action: /* @__PURE__ */ AlertActionSchema.optional(),
1241
+ status: AlertStatusSchema,
1242
+ progress: /* @__PURE__ */ z.number().optional(),
1243
+ read: /* @__PURE__ */ z.boolean(),
1244
+ createdAt: /* @__PURE__ */ z.number(),
1245
+ updatedAt: /* @__PURE__ */ z.number(),
1246
+ source: /* @__PURE__ */ AlertSourceSchema.optional(),
1247
+ metadata: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.unknown()).optional()
1248
+ });
1249
+ var alertsCapability = {
1250
+ name: "alerts",
1251
+ scope: "system",
1252
+ mode: "singleton",
1253
+ methods: {
1254
+ /** Raise a new alert. */
1255
+ emit: /* @__PURE__ */ method(AlertSchema, /* @__PURE__ */ z.void(), { kind: "mutation" }),
1256
+ /** Change fields of an existing alert. */
1257
+ update: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
1258
+ alertId: /* @__PURE__ */ z.string(),
1259
+ patch: /* @__PURE__ */ AlertSchema.partial()
1260
+ }), /* @__PURE__ */ z.void(), { kind: "mutation" }),
1261
+ /** List alerts, optionally only unread ones. */
1262
+ list: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
1263
+ unreadOnly: /* @__PURE__ */ z.boolean().optional(),
1264
+ limit: /* @__PURE__ */ z.number().optional()
1265
+ }).optional(), /* @__PURE__ */ z.array(AlertSchema).readonly()),
1266
+ /** How many alerts are unread. */
1267
+ getUnreadCount: /* @__PURE__ */ method(/* @__PURE__ */ z.void(), /* @__PURE__ */ z.number()),
1268
+ /** Mark one alert as read. */
1269
+ markRead: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ alertId: /* @__PURE__ */ z.string() }), /* @__PURE__ */ z.void(), { kind: "mutation" }),
1270
+ /** Mark every alert as read. */
1271
+ markAllRead: /* @__PURE__ */ method(/* @__PURE__ */ z.void(), /* @__PURE__ */ z.void(), { kind: "mutation" }),
1272
+ /** Dismiss one alert. */
1273
+ dismiss: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ alertId: /* @__PURE__ */ z.string() }), /* @__PURE__ */ z.void(), { kind: "mutation" })
1274
+ },
1275
+ vocabulary: { notOperatorFacing: "the alert centre — read and acknowledged on its own page" }
1276
+ };
1277
+ //#endregion
1186
1278
  //#region ../types/dist/esm/composition/helpers/history-math.mjs
1187
1279
  /**
1188
1280
  * Statistics and integrals over a history read (D944).
@@ -3342,99 +3434,4 @@ function sameHelperBody(stored, compiled) {
3342
3434
  return JSON.stringify(stored.target) === JSON.stringify(compiled.target) && JSON.stringify(stored.features) === JSON.stringify(compiled.features);
3343
3435
  }
3344
3436
  //#endregion
3345
- //#region ../types/dist/esm/capabilities/error.cap.mjs
3346
- /** How loudly a fault wants the operator. Both tiers raise the attention event. */
3347
- var DeviceErrorSeveritySchema = /* @__PURE__ */ z.enum(["warning", "error"]);
3348
- /** One fault of a device that can raise several at once. */
3349
- var DeviceFaultSchema = /* @__PURE__ */ z.object({
3350
- /** The device's own code, as the vendor names it. */
3351
- code: /* @__PURE__ */ z.string(),
3352
- /** Already translated by the provider (it owns the vendor vocabulary). */
3353
- label: /* @__PURE__ */ z.string(),
3354
- severity: DeviceErrorSeveritySchema
3355
- });
3356
- /** One kind of fault a device CAN raise: the integration's own declared catalog entry. */
3357
- var DeviceFaultTypeSchema = DeviceFaultSchema;
3358
- /**
3359
- * The fault catalog of a device, declared by its integration at runtime (never a
3360
- * code enum). A fault outside the catalog is still published and still matches
3361
- * a rule that names no code.
3362
- */
3363
- var ListFaultTypesInputSchema = /* @__PURE__ */ z.object({ deviceId: /* @__PURE__ */ z.number().int().nonnegative() });
3364
- var FaultTypesSchema = /* @__PURE__ */ z.object({ types: /* @__PURE__ */ z.array(DeviceFaultTypeSchema) });
3365
- /**
3366
- * The fault a device reports right now. One slice per device.
3367
- *
3368
- * `active` is tri-state: `null` is "the provider has not read it yet" and is
3369
- * never drawn as "no fault" nor as a fault (D315, D393). The provider filters
3370
- * what is not a fault (a completion or reminder code) BEFORE it writes `true`.
3371
- *
3372
- * The cap's name is the key a template reads (`{{ alias.error.label }}`, D1021).
3373
- */
3374
- var ErrorStatusSchema = /* @__PURE__ */ z.object({
3375
- active: /* @__PURE__ */ z.boolean().nullable(),
3376
- /** The code of the principal fault; `null` when none (or unknown). */
3377
- code: /* @__PURE__ */ z.string().nullable(),
3378
- /** The principal fault's words, provider-translated; `null` when none. */
3379
- label: /* @__PURE__ */ z.string().nullable(),
3380
- severity: DeviceErrorSeveritySchema,
3381
- /** Ms epoch the current fault started; `null` when none or not known. */
3382
- since: /* @__PURE__ */ z.number().nullable(),
3383
- /** Every fault, for a device that raises several. The principal is the first. */
3384
- faults: /* @__PURE__ */ z.array(DeviceFaultSchema).optional(),
3385
- /** Ms epoch of the last read the provider made of the fault. */
3386
- lastFetchedAt: /* @__PURE__ */ z.number()
3387
- });
3388
- /** The slice before the provider has read anything: unknown, not "fine". */
3389
- var ERROR_STATUS_COLD = {
3390
- active: null,
3391
- code: null,
3392
- label: null,
3393
- severity: "error",
3394
- since: null,
3395
- lastFetchedAt: 0
3396
- };
3397
- var errorCapability = {
3398
- name: "error",
3399
- scope: "device",
3400
- deviceNative: true,
3401
- mode: "singleton",
3402
- methods: {
3403
- /** The fault codes this device's integration can raise; `[]` when it declares none. */
3404
- listFaultTypes: /* @__PURE__ */ method(ListFaultTypesInputSchema, FaultTypesSchema, {
3405
- kind: "query",
3406
- auth: "protected"
3407
- }) },
3408
- status: {
3409
- schema: ErrorStatusSchema,
3410
- kind: "push",
3411
- empty: ERROR_STATUS_COLD
3412
- },
3413
- runtimeState: ErrorStatusSchema,
3414
- /**
3415
- * Runtime-state durability: **restored** — the previous observation is what
3416
- * lets the first reading after a restart be a COMPARISON: a fault that was
3417
- * already open must not announce itself a second time.
3418
- *
3419
- * See `RuntimeStateDurability`. Enforced by
3420
- * `scripts/check-runtime-state-durability.ts`.
3421
- */
3422
- durability: "restored",
3423
- volatileStateFields: ["lastFetchedAt"],
3424
- /** The fault itself is carried by the attention alerts; no series is recorded. */
3425
- history: "none",
3426
- vocabulary: {
3427
- noun: /* @__PURE__ */ t("Fault", "Guasto"),
3428
- order: 5265,
3429
- state: [{
3430
- kind: "boolean",
3431
- field: "active",
3432
- label: /* @__PURE__ */ t("Fault", "Guasto"),
3433
- whenTrue: /* @__PURE__ */ t("When {device} reports a fault", "Quando {device} segnala un guasto"),
3434
- whenFalse: /* @__PURE__ */ t("When the fault of {device} clears", "Quando il guasto di {device} si risolve"),
3435
- icon: "triangle-alert"
3436
- }]
3437
- }
3438
- };
3439
- //#endregion
3440
- export { openStatistic as $, compositionItemFieldPath as A, helperMembers as B, CompositionFieldReadSchema as C, composedDeviceRef as D, canonicalStoredBlockTarget as E, featureSources as F, DEFAULT_HISTORY_RETENTION as G, isHistoryHelper as H, fieldReads as I, HOUR_MS as J, HISTORY_FAST_MS as K, isForwardInputRef as L, compositionSliceKey as M, compositionSourceKey as N, composedDeviceStableId as O, featureFieldEntries as P, openReset as Q, COMPOSED_DEVICE_STABLE_ID_PREFIX as R, COMPOSITION_ITEM_ARRAY_PATH as S, CompositionSchema as T, CompositionSourceRefSchema as U, isEngineHostedHelper as V, DAY_MS as W, historyRetentionFromSettings as X, MINUTE_MS as Y, nextLocalMidnight as Z, groupTemplate as _, evaluateCount as _t, sameHelperBody as a, integrateReading as at, refused as b, isIdentifier as c, evaluateExpressionSource as ct, signedToken as d, validateExpressionSource as dt, planResetTier as et, unsignedToken as f, compileExpressionSafe as ft, sharedColorModes as g, disarmRoseMemory as gt, runFanOut as h, EXPRESSION_BUILTINS as ht, compileHelper as i, evaluateStatistic as it, compositionReadKey as j, compositionFeatureEnabled as k, linearExpr as l, evaluateStatefulExpressionCall as lt, fanOutTargets as m, MAX_EXPRESSION_SOURCE_LENGTH as mt, ERROR_STATUS_COLD as n, statisticCadenceMs as nt, constantExpr as o, cloneStatefulExpressionMemory as ot, declaredSeriesKind as p, EXPRESSION_IDENTIFIER_RE as pt, HISTORY_SLOW_MS as q, errorCapability as r, evaluateDerivative as rt, dwellExpr as s, createStatefulExpressionMemory as st, DeviceFaultSchema as t, planStatisticTier as tt, overrideExpr as u, toExpressionValue as ut, compositionFieldAt as v, evaluateDwell as vt, CompositionFieldSourceSchema as w, COMPOSER_ADDON_ID as x, problem as y, HelperMemberSchema as z };
3437
+ export { statisticCadenceMs as $, compositionSourceKey as A, CompositionSourceRefSchema as B, canonicalStoredBlockTarget as C, compositionItemFieldPath as D, compositionFeatureEnabled as E, COMPOSED_DEVICE_STABLE_ID_PREFIX as F, HOUR_MS as G, DEFAULT_HISTORY_RETENTION as H, HelperMemberSchema as I, nextLocalMidnight as J, MINUTE_MS as K, helperMembers as L, featureSources as M, fieldReads as N, compositionReadKey as O, isForwardInputRef as P, planStatisticTier as Q, isEngineHostedHelper as R, CompositionSchema as S, composedDeviceStableId as T, HISTORY_FAST_MS as U, DAY_MS as V, HISTORY_SLOW_MS as W, openStatistic as X, openReset as Y, planResetTier as Z, refused as _, evaluateDwell as _t, isIdentifier as a, cloneStatefulExpressionMemory as at, CompositionFieldReadSchema as b, signedToken as c, evaluateStatefulExpressionCall as ct, fanOutTargets as d, compileExpressionSafe as dt, evaluateDerivative as et, runFanOut as f, EXPRESSION_IDENTIFIER_RE as ft, problem as g, evaluateCount as gt, compositionFieldAt as h, disarmRoseMemory as ht, dwellExpr as i, alertsCapability as it, featureFieldEntries as j, compositionSliceKey as k, unsignedToken as l, toExpressionValue as lt, groupTemplate as m, EXPRESSION_BUILTINS as mt, sameHelperBody as n, integrateReading as nt, linearExpr as o, createStatefulExpressionMemory as ot, sharedColorModes as p, MAX_EXPRESSION_SOURCE_LENGTH as pt, historyRetentionFromSettings as q, constantExpr as r, AlertSchema as rt, overrideExpr as s, evaluateExpressionSource as st, compileHelper as t, evaluateStatistic as tt, declaredSeriesKind as u, validateExpressionSource as ut, COMPOSER_ADDON_ID as v, composedDeviceRef as w, CompositionFieldSourceSchema as x, COMPOSITION_ITEM_ARRAY_PATH as y, isHistoryHelper as z };
@@ -1,9 +1,8 @@
1
1
  const require_capability_definition = require("./capability-definition-BEVd01Xj.js");
2
2
  const require_quantity = require("./quantity-lY1KiTSZ.js");
3
- const require_device_type = require("./device-type-CbQsnFdC.js");
4
- const require_device_kind = require("./device-kind-CsSiv_YF.js");
5
- const require_l10n = require("./l10n-CGMvp7NF.js");
6
- const require_history_catalog = require("./history-catalog-BKRarIL_.js");
3
+ const require_device_type = require("./device-type-Cnc0NiSX.js");
4
+ const require_device_kind = require("./device-kind-FMhJg8uC.js");
5
+ const require_history_catalog = require("./history-catalog-CiTMP3-E.js");
7
6
  let zod = require("zod");
8
7
  //#region ../types/dist/esm/catalogs/sensor-active-state.mjs
9
8
  /**
@@ -1183,6 +1182,99 @@ function evaluateExpressionSource(expr, bindingValues, now, opts) {
1183
1182
  }
1184
1183
  }
1185
1184
  //#endregion
1185
+ //#region ../types/dist/esm/capabilities/alerts.cap.mjs
1186
+ /**
1187
+ * Alerts capability — collection-based internal alert system.
1188
+ *
1189
+ * Multiple providers can register. Each provider filters by EventBus category
1190
+ * and creates/updates alerts. The built-in Alert Center addon persists alerts
1191
+ * in the DB and serves them to the admin UI.
1192
+ */
1193
+ var AlertSeveritySchema = /* @__PURE__ */ zod.z.enum([
1194
+ "info",
1195
+ "success",
1196
+ "warning",
1197
+ "error",
1198
+ "critical"
1199
+ ]);
1200
+ /**
1201
+ * An action that RUNS something instead of going somewhere: the admin UI calls
1202
+ * the addon's custom action (`addons.custom`) with exactly these fields. The
1203
+ * producer owns the meaning; the UI knows nothing about the addon or the kind.
1204
+ */
1205
+ var AlertActionInvokeSchema = /* @__PURE__ */ zod.z.object({
1206
+ addonId: /* @__PURE__ */ zod.z.string().min(1),
1207
+ action: /* @__PURE__ */ zod.z.string().min(1),
1208
+ input: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).optional()
1209
+ });
1210
+ /** An action has `href` (a link) OR `invoke` (a button that runs a custom action). */
1211
+ var AlertActionSchema = /* @__PURE__ */ zod.z.object({
1212
+ label: /* @__PURE__ */ zod.z.string(),
1213
+ href: /* @__PURE__ */ zod.z.string().optional(),
1214
+ invoke: /* @__PURE__ */ AlertActionInvokeSchema.optional(),
1215
+ /**
1216
+ * How `href` is followed. Absent / `app`: an admin-ui route (client-side).
1217
+ * `server`: a route the HUB serves (an addon HTTP route such as an OAuth
1218
+ * start) — the browser must leave the SPA with a full navigation, because
1219
+ * the SPA has no such route and would bounce to the home page.
1220
+ */
1221
+ navigation: /* @__PURE__ */ zod.z.enum(["app", "server"]).optional()
1222
+ });
1223
+ var AlertStatusSchema = /* @__PURE__ */ zod.z.enum([
1224
+ "active",
1225
+ "in-progress",
1226
+ "completed",
1227
+ "failed",
1228
+ "dismissed"
1229
+ ]);
1230
+ var AlertSourceSchema = /* @__PURE__ */ zod.z.object({
1231
+ type: /* @__PURE__ */ zod.z.string(),
1232
+ id: /* @__PURE__ */ zod.z.string()
1233
+ });
1234
+ var AlertSchema = /* @__PURE__ */ zod.z.object({
1235
+ id: /* @__PURE__ */ zod.z.string(),
1236
+ category: /* @__PURE__ */ zod.z.string(),
1237
+ severity: AlertSeveritySchema,
1238
+ title: /* @__PURE__ */ zod.z.string(),
1239
+ message: /* @__PURE__ */ zod.z.string(),
1240
+ action: /* @__PURE__ */ AlertActionSchema.optional(),
1241
+ status: AlertStatusSchema,
1242
+ progress: /* @__PURE__ */ zod.z.number().optional(),
1243
+ read: /* @__PURE__ */ zod.z.boolean(),
1244
+ createdAt: /* @__PURE__ */ zod.z.number(),
1245
+ updatedAt: /* @__PURE__ */ zod.z.number(),
1246
+ source: /* @__PURE__ */ AlertSourceSchema.optional(),
1247
+ metadata: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).optional()
1248
+ });
1249
+ var alertsCapability = {
1250
+ name: "alerts",
1251
+ scope: "system",
1252
+ mode: "singleton",
1253
+ methods: {
1254
+ /** Raise a new alert. */
1255
+ emit: /* @__PURE__ */ require_capability_definition.method(AlertSchema, /* @__PURE__ */ zod.z.void(), { kind: "mutation" }),
1256
+ /** Change fields of an existing alert. */
1257
+ update: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
1258
+ alertId: /* @__PURE__ */ zod.z.string(),
1259
+ patch: /* @__PURE__ */ AlertSchema.partial()
1260
+ }), /* @__PURE__ */ zod.z.void(), { kind: "mutation" }),
1261
+ /** List alerts, optionally only unread ones. */
1262
+ list: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
1263
+ unreadOnly: /* @__PURE__ */ zod.z.boolean().optional(),
1264
+ limit: /* @__PURE__ */ zod.z.number().optional()
1265
+ }).optional(), /* @__PURE__ */ zod.z.array(AlertSchema).readonly()),
1266
+ /** How many alerts are unread. */
1267
+ getUnreadCount: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.number()),
1268
+ /** Mark one alert as read. */
1269
+ markRead: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ alertId: /* @__PURE__ */ zod.z.string() }), /* @__PURE__ */ zod.z.void(), { kind: "mutation" }),
1270
+ /** Mark every alert as read. */
1271
+ markAllRead: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.void(), { kind: "mutation" }),
1272
+ /** Dismiss one alert. */
1273
+ dismiss: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ alertId: /* @__PURE__ */ zod.z.string() }), /* @__PURE__ */ zod.z.void(), { kind: "mutation" })
1274
+ },
1275
+ vocabulary: { notOperatorFacing: "the alert centre — read and acknowledged on its own page" }
1276
+ };
1277
+ //#endregion
1186
1278
  //#region ../types/dist/esm/composition/helpers/history-math.mjs
1187
1279
  /**
1188
1280
  * Statistics and integrals over a history read (D944).
@@ -3342,101 +3434,12 @@ function sameHelperBody(stored, compiled) {
3342
3434
  return JSON.stringify(stored.target) === JSON.stringify(compiled.target) && JSON.stringify(stored.features) === JSON.stringify(compiled.features);
3343
3435
  }
3344
3436
  //#endregion
3345
- //#region ../types/dist/esm/capabilities/error.cap.mjs
3346
- /** How loudly a fault wants the operator. Both tiers raise the attention event. */
3347
- var DeviceErrorSeveritySchema = /* @__PURE__ */ zod.z.enum(["warning", "error"]);
3348
- /** One fault of a device that can raise several at once. */
3349
- var DeviceFaultSchema = /* @__PURE__ */ zod.z.object({
3350
- /** The device's own code, as the vendor names it. */
3351
- code: /* @__PURE__ */ zod.z.string(),
3352
- /** Already translated by the provider (it owns the vendor vocabulary). */
3353
- label: /* @__PURE__ */ zod.z.string(),
3354
- severity: DeviceErrorSeveritySchema
3355
- });
3356
- /** One kind of fault a device CAN raise: the integration's own declared catalog entry. */
3357
- var DeviceFaultTypeSchema = DeviceFaultSchema;
3358
- /**
3359
- * The fault catalog of a device, declared by its integration at runtime (never a
3360
- * code enum). A fault outside the catalog is still published and still matches
3361
- * a rule that names no code.
3362
- */
3363
- var ListFaultTypesInputSchema = /* @__PURE__ */ zod.z.object({ deviceId: /* @__PURE__ */ zod.z.number().int().nonnegative() });
3364
- var FaultTypesSchema = /* @__PURE__ */ zod.z.object({ types: /* @__PURE__ */ zod.z.array(DeviceFaultTypeSchema) });
3365
- /**
3366
- * The fault a device reports right now. One slice per device.
3367
- *
3368
- * `active` is tri-state: `null` is "the provider has not read it yet" and is
3369
- * never drawn as "no fault" nor as a fault (D315, D393). The provider filters
3370
- * what is not a fault (a completion or reminder code) BEFORE it writes `true`.
3371
- *
3372
- * The cap's name is the key a template reads (`{{ alias.error.label }}`, D1021).
3373
- */
3374
- var ErrorStatusSchema = /* @__PURE__ */ zod.z.object({
3375
- active: /* @__PURE__ */ zod.z.boolean().nullable(),
3376
- /** The code of the principal fault; `null` when none (or unknown). */
3377
- code: /* @__PURE__ */ zod.z.string().nullable(),
3378
- /** The principal fault's words, provider-translated; `null` when none. */
3379
- label: /* @__PURE__ */ zod.z.string().nullable(),
3380
- severity: DeviceErrorSeveritySchema,
3381
- /** Ms epoch the current fault started; `null` when none or not known. */
3382
- since: /* @__PURE__ */ zod.z.number().nullable(),
3383
- /** Every fault, for a device that raises several. The principal is the first. */
3384
- faults: /* @__PURE__ */ zod.z.array(DeviceFaultSchema).optional(),
3385
- /** Ms epoch of the last read the provider made of the fault. */
3386
- lastFetchedAt: /* @__PURE__ */ zod.z.number()
3387
- });
3388
- /** The slice before the provider has read anything: unknown, not "fine". */
3389
- var ERROR_STATUS_COLD = {
3390
- active: null,
3391
- code: null,
3392
- label: null,
3393
- severity: "error",
3394
- since: null,
3395
- lastFetchedAt: 0
3396
- };
3397
- var errorCapability = {
3398
- name: "error",
3399
- scope: "device",
3400
- deviceNative: true,
3401
- mode: "singleton",
3402
- methods: {
3403
- /** The fault codes this device's integration can raise; `[]` when it declares none. */
3404
- listFaultTypes: /* @__PURE__ */ require_capability_definition.method(ListFaultTypesInputSchema, FaultTypesSchema, {
3405
- kind: "query",
3406
- auth: "protected"
3407
- }) },
3408
- status: {
3409
- schema: ErrorStatusSchema,
3410
- kind: "push",
3411
- empty: ERROR_STATUS_COLD
3412
- },
3413
- runtimeState: ErrorStatusSchema,
3414
- /**
3415
- * Runtime-state durability: **restored** — the previous observation is what
3416
- * lets the first reading after a restart be a COMPARISON: a fault that was
3417
- * already open must not announce itself a second time.
3418
- *
3419
- * See `RuntimeStateDurability`. Enforced by
3420
- * `scripts/check-runtime-state-durability.ts`.
3421
- */
3422
- durability: "restored",
3423
- volatileStateFields: ["lastFetchedAt"],
3424
- /** The fault itself is carried by the attention alerts; no series is recorded. */
3425
- history: "none",
3426
- vocabulary: {
3427
- noun: /* @__PURE__ */ require_l10n.t("Fault", "Guasto"),
3428
- order: 5265,
3429
- state: [{
3430
- kind: "boolean",
3431
- field: "active",
3432
- label: /* @__PURE__ */ require_l10n.t("Fault", "Guasto"),
3433
- whenTrue: /* @__PURE__ */ require_l10n.t("When {device} reports a fault", "Quando {device} segnala un guasto"),
3434
- whenFalse: /* @__PURE__ */ require_l10n.t("When the fault of {device} clears", "Quando il guasto di {device} si risolve"),
3435
- icon: "triangle-alert"
3436
- }]
3437
+ Object.defineProperty(exports, "AlertSchema", {
3438
+ enumerable: true,
3439
+ get: function() {
3440
+ return AlertSchema;
3437
3441
  }
3438
- };
3439
- //#endregion
3442
+ });
3440
3443
  Object.defineProperty(exports, "COMPOSED_DEVICE_STABLE_ID_PREFIX", {
3441
3444
  enumerable: true,
3442
3445
  get: function() {
@@ -3491,18 +3494,6 @@ Object.defineProperty(exports, "DEFAULT_HISTORY_RETENTION", {
3491
3494
  return DEFAULT_HISTORY_RETENTION;
3492
3495
  }
3493
3496
  });
3494
- Object.defineProperty(exports, "DeviceFaultSchema", {
3495
- enumerable: true,
3496
- get: function() {
3497
- return DeviceFaultSchema;
3498
- }
3499
- });
3500
- Object.defineProperty(exports, "ERROR_STATUS_COLD", {
3501
- enumerable: true,
3502
- get: function() {
3503
- return ERROR_STATUS_COLD;
3504
- }
3505
- });
3506
3497
  Object.defineProperty(exports, "EXPRESSION_BUILTINS", {
3507
3498
  enumerable: true,
3508
3499
  get: function() {
@@ -3551,6 +3542,12 @@ Object.defineProperty(exports, "MINUTE_MS", {
3551
3542
  return MINUTE_MS;
3552
3543
  }
3553
3544
  });
3545
+ Object.defineProperty(exports, "alertsCapability", {
3546
+ enumerable: true,
3547
+ get: function() {
3548
+ return alertsCapability;
3549
+ }
3550
+ });
3554
3551
  Object.defineProperty(exports, "canonicalStoredBlockTarget", {
3555
3552
  enumerable: true,
3556
3553
  get: function() {
@@ -3653,12 +3650,6 @@ Object.defineProperty(exports, "dwellExpr", {
3653
3650
  return dwellExpr;
3654
3651
  }
3655
3652
  });
3656
- Object.defineProperty(exports, "errorCapability", {
3657
- enumerable: true,
3658
- get: function() {
3659
- return errorCapability;
3660
- }
3661
- });
3662
3653
  Object.defineProperty(exports, "evaluateCount", {
3663
3654
  enumerable: true,
3664
3655
  get: function() {
@@ -1,6 +1,6 @@
1
1
  import { Z as errMsg } from "./scoped-settings-DVWUIP7Z.mjs";
2
- import { Q as CAP_CUSTOMIZE_CATALOG } from "./core-blocks.cap-DDECcMeI.mjs";
3
- import { N as compositionSourceKey, c as isIdentifier, d as signedToken, f as unsignedToken, l as linearExpr, o as constantExpr, s as dwellExpr, u as overrideExpr } from "./error.cap-DCwbIGEF.mjs";
2
+ import { Q as CAP_CUSTOMIZE_CATALOG } from "./core-blocks.cap-DLkEfV5b.mjs";
3
+ import { A as compositionSourceKey, a as isIdentifier, c as signedToken, i as dwellExpr, l as unsignedToken, o as linearExpr, r as constantExpr, s as overrideExpr } from "./compile-OBMHlqD-.mjs";
4
4
  //#region ../types/dist/esm/composition/customize/field-source.mjs
5
5
  function fromRead(source, cap, fieldPath) {
6
6
  return {
@@ -1,6 +1,6 @@
1
1
  const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
2
- const require_core_blocks_cap = require("./core-blocks.cap-xt5_fK5Z.js");
3
- const require_error_cap = require("./error.cap-BxLEHP6z.js");
2
+ const require_core_blocks_cap = require("./core-blocks.cap-CdTGUKtr.js");
3
+ const require_compile = require("./compile-SpeAhaZ6.js");
4
4
  //#region ../types/dist/esm/composition/customize/field-source.mjs
5
5
  function fromRead(source, cap, fieldPath) {
6
6
  return {
@@ -54,7 +54,7 @@ function compileScalarOverride(input) {
54
54
  function compileOverride(input, path, rule) {
55
55
  if (input.sourceValueKind !== "boolean" || input.draft.transform.kind !== "identity") return fail("source-kind");
56
56
  const read = fromRead(refOf(input.draft), input.draft.source.cap, input.draft.source.fieldPath);
57
- const field = expression(require_error_cap.overrideExpr(rule.whenSourceTrue, rule.unlessNative), {
57
+ const field = expression(require_compile.overrideExpr(rule.whenSourceTrue, rule.unlessNative), {
58
58
  x: read,
59
59
  native: fromRead(input.device, input.draft.cap, path)
60
60
  });
@@ -132,25 +132,25 @@ function defaultThresholdSamples(cap, targetId, sourceCap) {
132
132
  return cap === "running-state" && targetId === "running" && sourceCap === "power-meter" ? 2 : 1;
133
133
  }
134
134
  function thresholdValue(transform, read, minSamples) {
135
- const threshold = require_error_cap.unsignedToken(transform.threshold);
135
+ const threshold = require_compile.unsignedToken(transform.threshold);
136
136
  if (threshold === null) return fail("threshold");
137
- const start = require_error_cap.unsignedToken(transform.startDwellMs);
138
- const stop = require_error_cap.unsignedToken(transform.stopDwellMs);
137
+ const start = require_compile.unsignedToken(transform.startDwellMs);
138
+ const stop = require_compile.unsignedToken(transform.stopDwellMs);
139
139
  if (start === null || stop === null) return fail("dwell");
140
140
  return {
141
141
  ok: true,
142
- value: expression(require_error_cap.dwellExpr(transform.comparison, threshold, start, stop, minSamples), { x: read })
142
+ value: expression(require_compile.dwellExpr(transform.comparison, threshold, start, stop, minSamples), { x: read })
143
143
  };
144
144
  }
145
145
  function linearValue(transform, read, valueKind) {
146
- const scale = require_error_cap.signedToken(transform.scale);
147
- const offset = require_error_cap.signedToken(transform.offset);
146
+ const scale = require_compile.signedToken(transform.scale);
147
+ const offset = require_compile.signedToken(transform.offset);
148
148
  if (scale === null || offset === null) return fail("scale");
149
149
  const clamps = clampTokens(transform.clampMin, transform.clampMax);
150
150
  if (!clamps.ok) return clamps;
151
151
  return {
152
152
  ok: true,
153
- value: expression(require_error_cap.linearExpr(valueKind === "string" ? "number(x)" : "x", scale, offset, clamps.value.min, clamps.value.max), { x: read })
153
+ value: expression(require_compile.linearExpr(valueKind === "string" ? "number(x)" : "x", scale, offset, clamps.value.min, clamps.value.max), { x: read })
154
154
  };
155
155
  }
156
156
  function clampTokens(clampMin, clampMax) {
@@ -162,8 +162,8 @@ function clampTokens(clampMin, clampMax) {
162
162
  }
163
163
  };
164
164
  if (clampMin === void 0 || clampMax === void 0) return fail("clamp");
165
- const min = require_error_cap.signedToken(clampMin);
166
- const max = require_error_cap.signedToken(clampMax);
165
+ const min = require_compile.signedToken(clampMin);
166
+ const max = require_compile.signedToken(clampMax);
167
167
  if (min === null || max === null || clampMin > clampMax) return fail("clamp");
168
168
  return {
169
169
  ok: true,
@@ -201,7 +201,7 @@ function companionIncluded(companion, apply) {
201
201
  }
202
202
  function companionField(input, path, companion, value) {
203
203
  if (companion.kind === "constant") {
204
- const expr = require_error_cap.constantExpr(companion.value);
204
+ const expr = require_compile.constantExpr(companion.value);
205
205
  if (expr === null) return fail("scale");
206
206
  return {
207
207
  ok: true,
@@ -219,12 +219,12 @@ function companionField(input, path, companion, value) {
219
219
  return transitionField(input, path, companion.sourceChangedAt, value);
220
220
  }
221
221
  function transitionField(input, path, sourceChangedAt, value) {
222
- if (sourceChangedAt === "prefer" && input.sourceValueKind === "boolean" && input.changedAtField !== null && require_error_cap.isIdentifier(input.changedAtField)) return {
222
+ if (sourceChangedAt === "prefer" && input.sourceValueKind === "boolean" && input.changedAtField !== null && require_compile.isIdentifier(input.changedAtField)) return {
223
223
  ok: true,
224
224
  value: fromRead(refOf(input.draft), input.draft.source.cap, input.changedAtField)
225
225
  };
226
226
  if (input.apply === "replace") return stampOfValue(value);
227
- if (!require_error_cap.isIdentifier(path)) return fail("transform");
227
+ if (!require_compile.isIdentifier(path)) return fail("transform");
228
228
  const bindings = { [path]: fromRead(input.device, input.draft.cap, path) };
229
229
  return {
230
230
  ok: true,
@@ -373,13 +373,13 @@ function describeTarget(lookup, bindings) {
373
373
  }
374
374
  async function describeCompositionSources(ports, sources, targets = [], unionReads = []) {
375
375
  const owners = await listOwners(ports, [...sources, ...targets]);
376
- const lookup = (ref) => [require_error_cap.compositionSourceKey(ref), rowOf(ref, owners.get(ref.addonId))];
376
+ const lookup = (ref) => [require_compile.compositionSourceKey(ref), rowOf(ref, owners.get(ref.addonId))];
377
377
  const sourceRows = sources.map(lookup);
378
378
  const targetRows = targets.map(lookup);
379
379
  const bindings = await readBindings(ports, [...sourceRows, ...targetRows].flatMap(([, l]) => l.kind === "row" ? [l.row.id] : []));
380
380
  const live = new Map(await Promise.all(sourceRows.flatMap(([key, l]) => {
381
381
  if (l.kind !== "row") return [];
382
- const reads = unionReads.filter((r) => require_error_cap.compositionSourceKey(r.source) === key);
382
+ const reads = unionReads.filter((r) => require_compile.compositionSourceKey(r.source) === key);
383
383
  return reads.length === 0 ? [] : [readLiveKinds(ports, l.row.id, reads).then((kinds) => [l.row.id, kinds])];
384
384
  })));
385
385
  return {