@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,27 +1,28 @@
1
- import { r as MotionStatusSchema } from "../../stream-catalog.cap-D1Hy19Yc.mjs";
2
- import { _ as hydrateSchema, a as isSecretRefOwnedBy, b as EventCategory$1, f as defineAddonMigrations, i as collectSecretMarkerRefs, l as RecordIntegrationInstances, o as resolveSecretMarkers, r as secretTreeFromSchema, s as transformSecretWrite, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
1
+ import { r as MotionStatusSchema } from "../../stream-catalog.cap-DVniDdRD.mjs";
2
+ import { _ as hydrateSchema, a as isSecretRefOwnedBy, b as EventCategory$1, f as defineAddonMigrations, i as collectSecretMarkerRefs, l as RecordIntegrationInstances, o as resolveSecretMarkers, r as secretTreeFromSchema, s as transformSecretWrite, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
3
3
  import { W as isSecretMarker, Z as errMsg$1 } from "../../scoped-settings-DVWUIP7Z.mjs";
4
- import { $ as RemoteLayoutPayloadSchema, $n as unitsForQuantity, $t as FanPresetSchema, A as TemplateKindSchema, At as measurementFitsRole, B as SmokeStatusSchema, Bn as AutomationControlStatusSchema, Bt as timedRunRemaining, C as WaterHeaterStatusSchema, Cn as ContactStatusSchema, Ct as projectDeviceRow, D as VacuumControlStatusSchema, Dn as COMPOSER_RUNNER_ID, Dt as contactMeasurement, Et as resolveHeroSceneId, F as TamperStatusSchema, Fn as CarbonMonoxideStatusSchema, Ft as TimedRunStatusSchema, G as hasOwnRunningPowerDefaults, Gt as GroupStatusSchema, H as schedulersCapability, Hn as AirQualitySensorStatusSchema, Ht as HeatingValveStatusSchema, I as tagsCapability, In as BrightnessStatusSchema, It as timedRunCapability, J as REMOTE_MEDIA_COMMANDS, K as runningPowerDefaultsFor, Kn as actionWaitTotalMs, L as SWITCH_DEFAULT_OPTIONS, Lt as timedRunLimitOf, M as AutomationTemplatePayloadSchema, Mn as ClimateControlStatusSchema, Mt as temperatureMeasurement, N as reexpandAutomationInstance, Nt as textMeasurement, O as UpdateStatusSchema, Ot as emptyMeasurement, P as TemperatureSensorStatusSchema, Pt as NOT_REPORTED, Q as RemoteAssumedStateSchema, Qn as baseUnitForQuantity, Qt as FAN_CAPTURE_FIELDS, R as SwitchStatusSchema, Rn as BinaryStatusSchema, Rt as timedRunMaxIn, S as WeatherStatusSchema, Sn as ControlStatusSchema, St as ROW_READING_FACT_IDS, T as ValveStatusSchema, Tn as ConsumablesStatusSchema, Tt as REMOTE_OPEN_ACTION_ID, Ut as HeatPumpStatusSchema, V as ScriptRunnerStatusSchema, Vn as AmbientLightSensorStatusSchema, Vt as timedRunSeconds, W as RunningStateStatusSchema, Wn as actionsCapability, Wt as heatPumpInstantCop, X as EMPTY_REMOTE_ASSUMED_STATE, Xn as normalizeActionUnits, Xt as GasStatusSchema, Y as remoteCapability, Yn as capUnitResolver, Yt as GroupActiveSchema, Z as EMPTY_REMOTE_CONFIG, Zn as normalizeRecipeUnits, Zt as FloodStatusSchema, _ as WorkloadStatusSchema, _t as LawnMowerControlStatusSchema, an as SetOscillationAxisInputSchema, ar as addonIdOfActionId, bn as CoverStatusSchema, bt as HumidifierStatusSchema, c as kebabToCamel, cn as EnumSensorStatusSchema, cr as resolveActionVariables, dn as DishwasherStatusSchema, dt as NumericSensorStatusSchema, en as fanPresetsCapability, er as ActionError, et as readStoredRemoteConfig, ft as NetworkLinkStatusSchema, ht as LockControlStatusSchema, ir as INTERNAL_ACTION_PREFIX, it as PowerMeterStatusSchema, j as checkTemplatePayload, jt as powerMeasurement, k as templateCapability, kn as ColorStatusSchema, kt as humidityMeasurement, ln as DoorbellStatusSchema, lr as EventEmitterStatusSchema, lt as PetFeederStatusSchema, m as ALL_CAPABILITY_DEFINITIONS, mt as MeterStatusSchema, nn as FAN_OSCILLATION_AXIS_SETTABLE, nr as ActionVariableSchema, nt as PressureSensorStatusSchema, on as fanAxisPath, or as internalActionId, ot as PetFountainStatusSchema, pt as MotionTriggerStatusSchema, q as remoteLayoutComponentsCapability, qn as actionSourceCapability, qt as GroupCommandsSchema, rn as FanControlStatusSchema, rr as IDLE_ACTION_STATUS, rt as PresenceStatusSchema, sr as isInternalActionId, t as composedBlockIdOf, tn as FAN_OSCILLATION_AXES, tr as ActionMinDelaySecSchema, tt as PumpCycleStatusSchema, un as DoNotDisturbStatusSchema, vt as ImageStatusSchema, w as VibrationStatusSchema, wt as HERO_SCENE_ROW_IDS, x as WeatherStationStatusSchema, xt as heroLayoutCapability, yt as HumiditySensorStatusSchema, zn as BatteryStatusSchema, zt as timedRunQuickRun } from "../../rename-composition-block-DWUkrazx.mjs";
5
- import { r as listNotificationTargets } from "../../notification-targets-DR-D-vIt.mjs";
6
- import { i as NcTaggedRuleKindSchema, o as AlarmPanelStatusSchema, u as NotificationSchema } from "../../notification-rules.cap-0vVvsxQ1.mjs";
4
+ import { $ as RemoteLayoutPayloadSchema, $n as unitsForQuantity, $t as FanPresetSchema, A as TemplateKindSchema, At as measurementFitsRole, B as SmokeStatusSchema, Bn as AutomationControlStatusSchema, Bt as timedRunRemaining, C as WaterHeaterStatusSchema, Cn as ContactStatusSchema, Ct as projectDeviceRow, D as VacuumControlStatusSchema, Dn as COMPOSER_RUNNER_ID, Dt as contactMeasurement, Et as resolveHeroSceneId, F as TamperStatusSchema, Fn as CarbonMonoxideStatusSchema, Ft as TimedRunStatusSchema, G as hasOwnRunningPowerDefaults, Gt as GroupStatusSchema, H as schedulersCapability, Hn as AirQualitySensorStatusSchema, Ht as HeatingValveStatusSchema, I as tagsCapability, In as BrightnessStatusSchema, It as timedRunCapability, J as REMOTE_MEDIA_COMMANDS, K as runningPowerDefaultsFor, Kn as actionWaitTotalMs, L as SWITCH_DEFAULT_OPTIONS, Lt as timedRunLimitOf, M as AutomationTemplatePayloadSchema, Mn as ClimateControlStatusSchema, Mt as temperatureMeasurement, N as reexpandAutomationInstance, Nt as textMeasurement, O as UpdateStatusSchema, Ot as emptyMeasurement, P as TemperatureSensorStatusSchema, Pt as NOT_REPORTED, Q as RemoteAssumedStateSchema, Qn as baseUnitForQuantity, Qt as FAN_CAPTURE_FIELDS, R as SwitchStatusSchema, Rn as BinaryStatusSchema, Rt as timedRunMaxIn, S as WeatherStatusSchema, Sn as ControlStatusSchema, St as ROW_READING_FACT_IDS, T as ValveStatusSchema, Tn as ConsumablesStatusSchema, Tt as REMOTE_OPEN_ACTION_ID, Ut as HeatPumpStatusSchema, V as ScriptRunnerStatusSchema, Vn as AmbientLightSensorStatusSchema, Vt as timedRunSeconds, W as RunningStateStatusSchema, Wn as actionsCapability, Wt as heatPumpInstantCop, X as EMPTY_REMOTE_ASSUMED_STATE, Xn as normalizeActionUnits, Xt as GasStatusSchema, Y as remoteCapability, Yn as capUnitResolver, Yt as GroupActiveSchema, Z as EMPTY_REMOTE_CONFIG, Zn as normalizeRecipeUnits, Zt as FloodStatusSchema, _ as WorkloadStatusSchema, _t as LawnMowerControlStatusSchema, an as SetOscillationAxisInputSchema, ar as addonIdOfActionId, bn as CoverStatusSchema, bt as HumidifierStatusSchema, c as kebabToCamel, cn as EnumSensorStatusSchema, cr as resolveActionVariables, dn as DishwasherStatusSchema, dt as NumericSensorStatusSchema, en as fanPresetsCapability, er as ActionError, et as readStoredRemoteConfig, ft as NetworkLinkStatusSchema, ht as LockControlStatusSchema, ir as INTERNAL_ACTION_PREFIX, it as PowerMeterStatusSchema, j as checkTemplatePayload, jt as powerMeasurement, k as templateCapability, kn as ColorStatusSchema, kt as humidityMeasurement, ln as DoorbellStatusSchema, lr as EventEmitterStatusSchema, lt as PetFeederStatusSchema, m as ALL_CAPABILITY_DEFINITIONS, mt as MeterStatusSchema, nn as FAN_OSCILLATION_AXIS_SETTABLE, nr as ActionVariableSchema, nt as PressureSensorStatusSchema, on as fanAxisPath, or as internalActionId, ot as PetFountainStatusSchema, pt as MotionTriggerStatusSchema, q as remoteLayoutComponentsCapability, qn as actionSourceCapability, qt as GroupCommandsSchema, rn as FanControlStatusSchema, rr as IDLE_ACTION_STATUS, rt as PresenceStatusSchema, sr as isInternalActionId, t as composedBlockIdOf, tn as FAN_OSCILLATION_AXES, tr as ActionMinDelaySecSchema, tt as PumpCycleStatusSchema, un as DoNotDisturbStatusSchema, vt as ImageStatusSchema, w as VibrationStatusSchema, wt as HERO_SCENE_ROW_IDS, x as WeatherStationStatusSchema, xt as heroLayoutCapability, yt as HumiditySensorStatusSchema, zn as BatteryStatusSchema, zt as timedRunQuickRun } from "../../rename-composition-block-Cdh-dRmY.mjs";
5
+ import { r as listNotificationTargets } from "../../notification-targets-4bGYH5J7.mjs";
6
+ import { i as NcTaggedRuleKindSchema, o as AlarmPanelStatusSchema, u as NotificationSchema } from "../../notification-rules.cap-BUIuYPlQ.mjs";
7
7
  import { s as defineRecordKinds } from "../../record-kind-ub6NXqfh.mjs";
8
8
  import { n as entryBody, t as defineEntryKind } from "../../entry-kind-D9MuVJCK.mjs";
9
- import { s as IDENTITY_LINK_KINDS } from "../../device-manager.cap-DIBK62-r.mjs";
9
+ import { s as IDENTITY_LINK_KINDS } from "../../device-manager.cap-eYrj1Ezp.mjs";
10
10
  import { n as ruleFireOfClaim } from "../../command-origin-claim-D1Wy7Qld.mjs";
11
11
  import { n as baseUnitOf } from "../../quantity-D3g5SxsZ.mjs";
12
12
  import { a as defaultTagColorId, c as renameInTags, i as TagsFieldSchema, l as tagKey, n as TagNameSchema, o as normalizeTags, r as TagStyleSchema, s as removeFromTags } from "../../tag-uZBAq6ox.mjs";
13
- import { n as DeviceRole, r as DeviceType$1, t as DeviceFeature } from "../../device-type-DgEvK3ch.mjs";
14
- import { r as isAirConditioner, t as canonicalStoredDeviceType } from "../../device-kind-BJ2pfsjw.mjs";
15
- import { A as MediaPlayerStatusSchema, C as PowerSourceStateSchema, Ct as HTTP_TEXT_CAP, Dt as stepGuardOf, Et as stepConditionsOf, I as remoteSourceSteps, It as forEachLeaf, J as capLinkServedFields, Kt as QuantityUnitError, L as resolveRemoteSource, Lt as hasEventLeaves, Ot as validateRecipeBounds, P as findChannelSource, Q as CAP_CUSTOMIZE_CATALOG, Rt as isEventLeaf, S as PowerSourceInfoSchema, St as AutomationRecipeSchema, Tt as nestedStepsOf, U as toTimings, Vt as holdOf, X as expandCapLinks, Y as declaredCapLink, Z as projectCapLinkOf, _ as replacedFieldKeys, _n as vocabCall, _t as SchedulerSchema, a as coreBlockComposition, an as weekdayOfLocalDate, b as powerSourceActuatorConflicts, bt as ActionStepSchema, c as coreBlocksCapability, cn as ACTION_TARGET_INVALIDATION_EVENTS, ct as EMPTY_AUTOMATION_STATE, d as resolveCoreBlockFiles, dn as VocabActionError, dt as DEFAULT_HOLD_OVERRIDE, f as describeComposableCaps, fn as actionEffect, g as planComposition, gn as vocabActionIdFor, h as compositionUnionReads, hn as findVocabAction, i as coreBlockAddonId, in as siteFor, l as normalizeCoreBlockWrite, ln as ActionTargetResolver, lt as appendTrace, m as compositionSourceRefs, mn as assertDeviceOffers, mt as SchedulerError, n as CORE_BLOCK_ADDON_PREFIX, nn as nextOccurrence, o as coreBlockIdFromAddonId, on as zoneOnlySite, p as buildCapabilityLookup, r as CoreBlockSchema, rn as occurrenceOn, s as coreBlockSourceKind, st as AutomationStateDocSchema, t as CORE_BLOCKS_ADDON_ID, tn as localDateOf, u as resolveCoreBlockEntry, un as canonicalStoredStepTargets, ut as buildStepArgsTrace, v as topLevelFieldsOf, w as powerSourceCapability, wt as REPEAT_ITEM_VAR, x as powerSourceLinkOfComposition, y as validateComposition, yt as validateSchedulerInput, z as customKeyOfRole, zt as compareValues } from "../../core-blocks.cap-DDECcMeI.mjs";
16
- import { B as helperMembers, D as composedDeviceRef, E as canonicalStoredBlockTarget, N as compositionSourceKey, O as composedDeviceStableId, T as CompositionSchema, W as DAY_MS, X as historyRetentionFromSettings, k as compositionFeatureEnabled, vt as evaluateDwell, x as COMPOSER_ADDON_ID, z as HelperMemberSchema } from "../../error.cap-DCwbIGEF.mjs";
17
- import { a as evaluateWhenTree, c as nextTimeBoundaryInMs, i as collectWhenMirrorSources, l as stableIdMapOf, n as unwrapStoredValue, o as hasHoldLeaves, r as ConditionMirror, s as hasTimeLeaves, t as loadPrefixed } from "../../prefix-walk-BhT0ZoKl.mjs";
13
+ import { n as DeviceRole, r as DeviceType$1, t as DeviceFeature } from "../../device-type-TUGqGmaI.mjs";
14
+ import { r as isAirConditioner, t as canonicalStoredDeviceType } from "../../device-kind-C37Ra2wd.mjs";
15
+ import { a as findVocabAction, i as assertDeviceOffers, n as actionEffect, o as vocabActionIdFor, s as vocabCall, t as VocabActionError } from "../../action-index-B1fgpQBt.mjs";
16
+ import { $t as localDateOf, A as MediaPlayerStatusSchema, C as PowerSourceStateSchema, Ct as nestedStepsOf, Et as validateRecipeBounds, Ft as hasEventLeaves, I as remoteSourceSteps, It as isEventLeaf, J as capLinkServedFields, L as resolveRemoteSource, Lt as compareValues, P as findChannelSource, Pt as forEachLeaf, Q as CAP_CUSTOMIZE_CATALOG, S as PowerSourceInfoSchema, St as REPEAT_ITEM_VAR, Tt as stepGuardOf, U as toTimings, Wt as QuantityUnitError, X as expandCapLinks, Y as declaredCapLink, Z as projectCapLinkOf, _ as replacedFieldKeys, _t as validateSchedulerInput, a as coreBlockComposition, at as AutomationStateDocSchema, b as powerSourceActuatorConflicts, bt as AutomationRecipeSchema, c as coreBlocksCapability, cn as canonicalStoredStepTargets, ct as buildStepArgsTrace, d as resolveCoreBlockFiles, en as nextOccurrence, f as describeComposableCaps, ft as SchedulerError, g as planComposition, h as compositionUnionReads, ht as SchedulerSchema, i as coreBlockAddonId, in as zoneOnlySite, l as normalizeCoreBlockWrite, lt as DEFAULT_HOLD_OVERRIDE, m as compositionSourceRefs, n as CORE_BLOCK_ADDON_PREFIX, nn as siteFor, o as coreBlockIdFromAddonId, on as ACTION_TARGET_INVALIDATION_EVENTS, ot as EMPTY_AUTOMATION_STATE, p as buildCapabilityLookup, r as CoreBlockSchema, rn as weekdayOfLocalDate, s as coreBlockSourceKind, sn as ActionTargetResolver, st as appendTrace, t as CORE_BLOCKS_ADDON_ID, tn as occurrenceOn, u as resolveCoreBlockEntry, v as topLevelFieldsOf, vt as ActionStepSchema, w as powerSourceCapability, wt as stepConditionsOf, x as powerSourceLinkOfComposition, xt as HTTP_TEXT_CAP, y as validateComposition, z as customKeyOfRole, zt as holdOf } from "../../core-blocks.cap-DLkEfV5b.mjs";
17
+ import { A as compositionSourceKey, C as canonicalStoredBlockTarget, E as compositionFeatureEnabled, I as HelperMemberSchema, L as helperMembers, S as CompositionSchema, T as composedDeviceStableId, V as DAY_MS, _t as evaluateDwell, q as historyRetentionFromSettings, v as COMPOSER_ADDON_ID, w as composedDeviceRef } from "../../compile-OBMHlqD-.mjs";
18
+ import { a as evaluateWhenTree, c as nextTimeBoundaryInMs, i as collectWhenMirrorSources, l as stableIdMapOf, n as unwrapStoredValue, o as hasHoldLeaves, r as ConditionMirror, s as hasTimeLeaves, t as loadPrefixed } from "../../prefix-walk-Mtij0NNT.mjs";
18
19
  import { t } from "../../l10n-Bu6aUvSY.mjs";
19
20
  import { t as integrationInstancesCapability } from "../../integration-instances.cap-BWttO42A.mjs";
20
21
  import { t as commandOrigin$1 } from "../../cap-call-context-DNwdgGSQ.mjs";
21
- import { r as compileScalarOverride, t as describeCompositionSources } from "../../composition-sources-B56CU8hi.mjs";
22
+ import { r as compileScalarOverride, t as describeCompositionSources } from "../../composition-sources-C327LGFn.mjs";
22
23
  import { r as seedInstanceOnce, t as DeclaredDevices } from "../../declared-device-CKERA1Hi.mjs";
23
24
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
24
- import { i as capSeriesKey, m as parseConfirmedStateChanged, p as isRecord$1 } from "../../capture-engine-CUZ3W0oZ.mjs";
25
+ import { i as capSeriesKey, m as parseConfirmedStateChanged, p as isRecord$1 } from "../../capture-engine-B2MmoNND.mjs";
25
26
  import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
26
27
  import { n as readCurrentCommandOrigin } from "../../cap-call-scope-Bic6Ekfw.mjs";
27
28
  import { createRequire } from "node:module";
@@ -3468,6 +3469,24 @@ var BUILTIN_REMOTE_COMPONENTS = [
3468
3469
  }
3469
3470
  ];
3470
3471
  //#endregion
3472
+ //#region ../types/dist/esm/template/linked-trigger.mjs
3473
+ /**
3474
+ * The typed parameters of the `builtin:linked-trigger` automation template
3475
+ * (D1086): "this device is commanded when that device fires an event". An
3476
+ * instance is an ordinary automation made from the template, so the engine's
3477
+ * traces and run modes apply; the template only fixes the shape. The operator
3478
+ * reads and writes it from the COMMANDED device's Customize tab.
3479
+ *
3480
+ * Sources are events only: a device that fired (`device-fired`, optionally one
3481
+ * part, event, shared kind and payload predicates) or a device event of a
3482
+ * category. The action is a plain on, off or toggle of one capability of the
3483
+ * target. A linked trigger commands the target; it never claims the target's
3484
+ * state (that belongs to the target's own provider, D663).
3485
+ */
3486
+ var LINKED_TRIGGER_TEMPLATE_ID = "builtin:linked-trigger";
3487
+ /** The input key whose value is the commanded device: the read keys on it. */
3488
+ var LINKED_TRIGGER_TARGET_INPUT = "target";
3489
+ //#endregion
3471
3490
  //#region ../types/dist/esm/template/builtin-automation-templates.mjs
3472
3491
  /**
3473
3492
  * Automation templates shipped with CamStack (#527). They are read-only records
@@ -3477,102 +3496,9 @@ var BUILTIN_REMOTE_COMPONENTS = [
3477
3496
  * migration and nothing an operator saved is ever overwritten.
3478
3497
  */
3479
3498
  var BUILTIN_TEMPLATE_ID_PREFIX = "builtin:";
3480
- /** One choose branch per row, so the rows a group takes are the branches a choose takes. */
3481
- var BUTTON_ROWS_MAX = 6;
3482
- var ROW_ENTRIES_MAX = 10;
3483
- /** The optional limit both built-ins end with: no value, no limit. */
3499
+ /** The optional limit a built-in ends with: no value, no limit. */
3484
3500
  var ACTIVE_WINDOW_KEY = "active";
3485
- var activeWindowInput = {
3486
- kind: "time-window",
3487
- key: ACTIVE_WINDOW_KEY,
3488
- label: "Only when",
3489
- description: "Limit the automation to a time of day, to some days, or both.",
3490
- optional: true
3491
- };
3492
- /** Declared last: it moves the tree the other bindings write into one level down. */
3493
- var activeWindowGate = {
3494
- kind: "gate",
3495
- input: ACTIVE_WINDOW_KEY,
3496
- path: ["when"]
3497
- };
3498
3501
  var BUILTIN_AUTOMATION_TEMPLATES = [{
3499
- id: `${BUILTIN_TEMPLATE_ID_PREFIX}buttons-to-devices`,
3500
- name: "Buttons → devices",
3501
- payload: {
3502
- version: 1,
3503
- description: "Each button: when it sends an event, run one or more actions.",
3504
- body: {
3505
- when: {
3506
- kind: "any",
3507
- children: []
3508
- },
3509
- actions: [{
3510
- kind: "choose",
3511
- branches: []
3512
- }],
3513
- runMode: {
3514
- mode: "queued",
3515
- max: 5
3516
- }
3517
- },
3518
- inputs: [{
3519
- kind: "group",
3520
- key: "buttons",
3521
- label: "Buttons",
3522
- rowLabel: "button",
3523
- maxRows: BUTTON_ROWS_MAX,
3524
- inputs: [{
3525
- kind: "entries",
3526
- key: "when",
3527
- label: "When",
3528
- entry: "trigger",
3529
- allow: ["device-fired"],
3530
- maxItems: ROW_ENTRIES_MAX
3531
- }, {
3532
- kind: "entries",
3533
- key: "do",
3534
- label: "Actions",
3535
- entry: "step",
3536
- allow: ["command"],
3537
- maxItems: ROW_ENTRIES_MAX
3538
- }]
3539
- }, activeWindowInput],
3540
- bindings: [
3541
- {
3542
- kind: "entries",
3543
- input: "when",
3544
- in: "buttons",
3545
- path: ["when", "children"]
3546
- },
3547
- {
3548
- kind: "rows",
3549
- input: "buttons",
3550
- path: [
3551
- "actions",
3552
- 0,
3553
- "branches"
3554
- ],
3555
- item: {
3556
- if: {
3557
- kind: "triggered-by",
3558
- leafIds: []
3559
- },
3560
- steps: []
3561
- },
3562
- bindings: [{
3563
- kind: "row-ids",
3564
- input: "when",
3565
- path: ["if", "leafIds"]
3566
- }, {
3567
- kind: "entries",
3568
- input: "do",
3569
- path: ["steps"]
3570
- }]
3571
- },
3572
- activeWindowGate
3573
- ]
3574
- }
3575
- }, {
3576
3502
  id: `${BUILTIN_TEMPLATE_ID_PREFIX}motion-light`,
3577
3503
  name: "Motion → light, off after a delay",
3578
3504
  payload: {
@@ -3623,7 +3549,13 @@ var BUILTIN_AUTOMATION_TEMPLATES = [{
3623
3549
  max: 3600,
3624
3550
  default: 300
3625
3551
  },
3626
- activeWindowInput
3552
+ {
3553
+ kind: "time-window",
3554
+ key: ACTIVE_WINDOW_KEY,
3555
+ label: "Only when",
3556
+ description: "Limit the automation to a time of day, to some days, or both.",
3557
+ optional: true
3558
+ }
3627
3559
  ],
3628
3560
  bindings: [
3629
3561
  {
@@ -3660,7 +3592,72 @@ var BUILTIN_AUTOMATION_TEMPLATES = [{
3660
3592
  ],
3661
3593
  as: "target"
3662
3594
  },
3663
- activeWindowGate
3595
+ {
3596
+ kind: "gate",
3597
+ input: ACTIVE_WINDOW_KEY,
3598
+ path: ["when"]
3599
+ }
3600
+ ]
3601
+ }
3602
+ }, {
3603
+ id: LINKED_TRIGGER_TEMPLATE_ID,
3604
+ name: "Linked trigger",
3605
+ payload: {
3606
+ version: 1,
3607
+ description: "Commands one device (on, off or toggle) when a device fires an event.",
3608
+ body: {
3609
+ when: {
3610
+ kind: "any",
3611
+ children: []
3612
+ },
3613
+ actions: [{ kind: "command" }],
3614
+ runMode: {
3615
+ mode: "queued",
3616
+ max: 5
3617
+ }
3618
+ },
3619
+ inputs: [
3620
+ {
3621
+ kind: "device",
3622
+ key: LINKED_TRIGGER_TARGET_INPUT,
3623
+ label: "Device to command"
3624
+ },
3625
+ {
3626
+ kind: "action",
3627
+ key: "action",
3628
+ label: "Action",
3629
+ deviceInput: LINKED_TRIGGER_TARGET_INPUT
3630
+ },
3631
+ {
3632
+ kind: "entries",
3633
+ key: "when",
3634
+ label: "When",
3635
+ entry: "trigger",
3636
+ allow: ["device-fired", "device-event"],
3637
+ maxItems: 10
3638
+ }
3639
+ ],
3640
+ bindings: [
3641
+ {
3642
+ kind: "value",
3643
+ input: LINKED_TRIGGER_TARGET_INPUT,
3644
+ path: [
3645
+ "actions",
3646
+ 0,
3647
+ "target"
3648
+ ],
3649
+ as: "target"
3650
+ },
3651
+ {
3652
+ kind: "value",
3653
+ input: "action",
3654
+ path: ["actions", 0]
3655
+ },
3656
+ {
3657
+ kind: "entries",
3658
+ input: "when",
3659
+ path: ["when", "children"]
3660
+ }
3664
3661
  ]
3665
3662
  }
3666
3663
  }];
@@ -7074,6 +7071,7 @@ var HERO_LAYOUT_BY_TYPE = {
7074
7071
  [DeviceType$1.WaterHeater]: CLIMATE_LAYOUT,
7075
7072
  [DeviceType$1.HeatPump]: HEAT_PUMP_LAYOUT,
7076
7073
  [DeviceType$1.EnergySystem]: HERO_LAYOUT_DEFAULT,
7074
+ [DeviceType$1.Vehicle]: HERO_LAYOUT_DEFAULT,
7077
7075
  [DeviceType$1.Workload]: HERO_LAYOUT_DEFAULT,
7078
7076
  [DeviceType$1.Fan]: FAN_LAYOUT,
7079
7077
  [DeviceType$1.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
@@ -7801,6 +7799,7 @@ var HERO_LOOK_BY_TYPE = {
7801
7799
  [DeviceType$1.WaterHeater]: WATER_HEATER_LOOK,
7802
7800
  [DeviceType$1.HeatPump]: HEAT_PUMP_LOOK,
7803
7801
  [DeviceType$1.EnergySystem]: HERO_LOOK_DEFAULT,
7802
+ [DeviceType$1.Vehicle]: HERO_LOOK_DEFAULT,
7804
7803
  [DeviceType$1.Workload]: HERO_LOOK_DEFAULT,
7805
7804
  [DeviceType$1.Fan]: FAN_LOOK,
7806
7805
  [DeviceType$1.MediaPlayer]: MEDIA_PLAYER_LOOK,
@@ -7851,6 +7850,9 @@ var HERO_LOOK_BY_ROLE = {
7851
7850
  [DeviceRole.ClimateRadiator]: "inherit",
7852
7851
  [DeviceRole.ClimateHeater]: "inherit",
7853
7852
  [DeviceRole.ClimateHeatPumpCircuit]: "inherit",
7853
+ [DeviceRole.ClimateVehicle]: "inherit",
7854
+ [DeviceRole.LockVehicle]: "inherit",
7855
+ [DeviceRole.MediaPlayerTv]: "inherit",
7854
7856
  [DeviceRole.MotionSensor]: MOTION_LOOK,
7855
7857
  [DeviceRole.ContactSensor]: "inherit",
7856
7858
  [DeviceRole.LeakSensor]: LEAK_LOOK,
@@ -16405,6 +16407,7 @@ var TemplatesService = class {
16405
16407
  async reexpandBuiltinInstances() {
16406
16408
  if (this.deps.automations === void 0) return;
16407
16409
  for (const template of BUILTIN_AUTOMATION_TEMPLATES) await this.deps.automations.reexpand(template.id, template.payload);
16410
+ await this.deps.automations.flagRetired(BUILTIN_AUTOMATION_TEMPLATES.map((template) => template.id));
16408
16411
  }
16409
16412
  /** A changed automation template reaches every automation made from it. */
16410
16413
  async reexpandInstances(id, body) {
@@ -16713,6 +16716,7 @@ function buildRemoteRuntime(deps) {
16713
16716
  * longer matches `template.codeHash`) is never regenerated over: only its
16714
16717
  * literal is rewritten, to flag it `edited-by-hand`.
16715
16718
  */
16719
+ var RETIRED_DETAIL = "the built-in template this automation was made from is no longer shipped; it keeps running as it is, edit it as a free automation";
16716
16720
  var EDITED_BY_HAND_DETAIL = "the code was edited by hand, so the template no longer updates it; convert it to a free automation or create it again from the template";
16717
16721
  /** True when the block's code is still exactly what the generator wrote. */
16718
16722
  function isGeneratedCode(code, recipe) {
@@ -16738,6 +16742,34 @@ function flaggedAsEdited(code, recipe) {
16738
16742
  function errorText$1(error) {
16739
16743
  return error instanceof Error ? error.message : String(error);
16740
16744
  }
16745
+ /**
16746
+ * The automations made from `templateId`, optionally those about `deviceId`:
16747
+ * the device one of the template's own `device` inputs names (the commanded
16748
+ * device of a linked trigger, never an event source). A template this release
16749
+ * does not ship has no declared device inputs, so a device filter matches none.
16750
+ */
16751
+ function listTemplateInstances(blocks, templateId, deviceId) {
16752
+ const deviceKeys = builtinAutomationTemplate(templateId)?.payload.inputs.flatMap((input) => input.kind === "device" ? [input.key] : []) ?? [];
16753
+ return blocks.flatMap((block) => {
16754
+ const read = readRecipeLiteral(block.code);
16755
+ const link = read.status === "recipe" ? read.recipe.template : void 0;
16756
+ if (link === void 0 || link.templateId !== templateId) return [];
16757
+ if (deviceId !== void 0) {
16758
+ if (!deviceKeys.some((key) => {
16759
+ const value = link.values[key];
16760
+ return value === deviceId || Array.isArray(value) && value.some((v) => v === deviceId);
16761
+ })) return [];
16762
+ }
16763
+ return [{
16764
+ blockId: block.id,
16765
+ name: block.name,
16766
+ enabled: block.enabled,
16767
+ templateId,
16768
+ values: link.values,
16769
+ ...link.problems === void 0 ? {} : { problems: link.problems }
16770
+ }];
16771
+ });
16772
+ }
16741
16773
  function automationTemplateInstancesOver(deps) {
16742
16774
  const units = deps.units ?? capUnitResolver(ALL_CAPABILITY_DEFINITIONS);
16743
16775
  const instancesOf = (templateId) => deps.blocks().flatMap((block) => {
@@ -16753,6 +16785,43 @@ function automationTemplateInstancesOver(deps) {
16753
16785
  blockId: block.id,
16754
16786
  name: block.name
16755
16787
  })),
16788
+ flagRetired: async (shippedIds) => {
16789
+ let flagged = 0;
16790
+ for (const block of deps.blocks()) {
16791
+ const read = readRecipeLiteral(block.code);
16792
+ if (read.status !== "recipe") continue;
16793
+ const link = read.recipe.template;
16794
+ if (link === void 0 || !isBuiltinTemplateId(link.templateId)) continue;
16795
+ if (shippedIds.includes(link.templateId)) continue;
16796
+ if (link.problems?.some((p) => p.code === "missing-template") === true) continue;
16797
+ const code = replaceRecipeLiteral(block.code, {
16798
+ ...read.recipe,
16799
+ template: {
16800
+ ...link,
16801
+ problems: [{
16802
+ code: "missing-template",
16803
+ detail: RETIRED_DETAIL
16804
+ }]
16805
+ }
16806
+ });
16807
+ if (code === null) continue;
16808
+ try {
16809
+ await deps.saveCode(block.id, code);
16810
+ flagged += 1;
16811
+ deps.logger.warn("automation template: an instance of a retired built-in was flagged, it keeps running", { meta: {
16812
+ templateId: link.templateId,
16813
+ blockId: block.id
16814
+ } });
16815
+ } catch (error) {
16816
+ deps.logger.warn("automation template: a retired instance could not be flagged", { meta: {
16817
+ templateId: link.templateId,
16818
+ blockId: block.id,
16819
+ error: errorText$1(error)
16820
+ } });
16821
+ }
16822
+ }
16823
+ return flagged;
16824
+ },
16756
16825
  reexpand: async (templateId, payload) => {
16757
16826
  let updated = 0;
16758
16827
  let flagged = 0;
@@ -18313,7 +18382,8 @@ var LinkContributionReconciler = class {
18313
18382
  const stamped = composition.features.some((f) => fieldsFeature(f)?.contributedBy !== void 0);
18314
18383
  const host = composition.target.device;
18315
18384
  const key = compositionSourceKey(host);
18316
- if (stamped && !plans.has(key)) plans.set(key, {
18385
+ const leftEmpty = block.createdBy === "identity-links" && composition.features.length === 0;
18386
+ if ((stamped || leftEmpty) && !plans.has(key)) plans.set(key, {
18317
18387
  host,
18318
18388
  hostDeviceId: await this.hostIdOf(host, read.links),
18319
18389
  owed: []
@@ -18430,6 +18500,27 @@ var LinkContributionReconciler = class {
18430
18500
  features = features.map((f, i) => i === index ? refreshed : f);
18431
18501
  this.log("identity-link contribution refreshed", owed);
18432
18502
  }
18503
+ if (block !== null && features.length === 0 && block.createdBy === "identity-links") {
18504
+ const current = this.ports.blocks()?.find((b) => b.id === block.id);
18505
+ const now = current === void 0 ? null : coreBlockComposition(current);
18506
+ if (current === void 0 || now === null) return;
18507
+ if (JSON.stringify(now.features) !== JSON.stringify(before)) {
18508
+ this.ports.logger.info("identity-link customization kept — it gained content", { meta: {
18509
+ blockId: block.id,
18510
+ host: key
18511
+ } });
18512
+ return;
18513
+ }
18514
+ await this.ports.remove(current);
18515
+ this.ports.logger.info("identity-link customization removed — nothing is left in it", {
18516
+ ...plan.hostDeviceId === null ? {} : { tags: { deviceId: plan.hostDeviceId } },
18517
+ meta: {
18518
+ blockId: block.id,
18519
+ host: key
18520
+ }
18521
+ });
18522
+ return;
18523
+ }
18433
18524
  if (JSON.stringify(features) === JSON.stringify(before)) return;
18434
18525
  if (block === null || composition === null) {
18435
18526
  await this.ports.create(plan.host, features);
@@ -19663,30 +19754,7 @@ var CoreBlocksAddon = class extends BaseAddon {
19663
19754
  });
19664
19755
  throw new Error(linkRefusal);
19665
19756
  }
19666
- const composition = existing !== null && coreBlockComposition(existing) !== null;
19667
- await this.requireStore().delete(blockId);
19668
- await this.requirePrefs().delete(blockId);
19669
- await this.requireActions().ledger.delete(automationOwner(blockId));
19670
- if (composition && this.supervisor === null) {
19671
- this.ctx.logger.error("composition deleted but no supervisor can release its claims", { meta: { blockId } });
19672
- throw new Error(`core-blocks: "${blockId}" was deleted but no supervisor runs here — its claims were not released`);
19673
- }
19674
- if (composition && this.supervisor !== null) {
19675
- const unreleased = await this.supervisor.retireComposition(blockId);
19676
- if (unreleased.length > 0) {
19677
- for (const claim of unreleased) this.ctx.logger.error("composition deleted but its claim was not released", {
19678
- tags: { deviceId: claim.deviceId },
19679
- meta: {
19680
- blockId,
19681
- cap: claim.capName,
19682
- owner: claim.owner,
19683
- error: claim.error
19684
- }
19685
- });
19686
- const detail = unreleased.map((claim) => `${claim.capName} on device ${claim.deviceId}: ${claim.error}`).join("; ");
19687
- throw new Error(`core-blocks: "${blockId}" was deleted but its claims were not released — ${detail}`);
19688
- }
19689
- } else this.convergeSoon();
19757
+ await this.removeBlock(blockId, existing);
19690
19758
  return { success: true };
19691
19759
  },
19692
19760
  setEnabled: async ({ blockId, enabled }) => {
@@ -19753,6 +19821,7 @@ var CoreBlocksAddon = class extends BaseAddon {
19753
19821
  },
19754
19822
  ...this.requireActions().runsApi,
19755
19823
  ...this.sharedCompositionApi(),
19824
+ listTemplateInstances: async ({ templateId, deviceId }) => ({ instances: [...listTemplateInstances(this.requireStore().list(), templateId, deviceId)] }),
19756
19825
  getCapLinks: async ({ deviceId }) => this.sharedCapLinks().read(deviceId),
19757
19826
  migrateCapLinks: async ({ dryRun }) => this.sharedCapLinks().migrate(dryRun)
19758
19827
  };
@@ -19812,6 +19881,37 @@ var CoreBlocksAddon = class extends BaseAddon {
19812
19881
  })).find((r) => r.stableId === ref.stableId)?.id ?? null;
19813
19882
  }
19814
19883
  /**
19884
+ * Delete a block's records and release a composition's claims. The caller has already
19885
+ * judged whether the block may go (the operator's delete refuses a block that holds
19886
+ * link contributions; the link reconciler removes one it has just emptied).
19887
+ */
19888
+ async removeBlock(blockId, existing) {
19889
+ const composition = existing !== null && coreBlockComposition(existing) !== null;
19890
+ await this.requireStore().delete(blockId);
19891
+ await this.requirePrefs().delete(blockId);
19892
+ await this.requireActions().ledger.delete(automationOwner(blockId));
19893
+ if (composition && this.supervisor === null) {
19894
+ this.ctx.logger.error("composition deleted but no supervisor can release its claims", { meta: { blockId } });
19895
+ throw new Error(`core-blocks: "${blockId}" was deleted but no supervisor runs here — its claims were not released`);
19896
+ }
19897
+ if (composition && this.supervisor !== null) {
19898
+ const unreleased = await this.supervisor.retireComposition(blockId);
19899
+ if (unreleased.length > 0) {
19900
+ for (const claim of unreleased) this.ctx.logger.error("composition deleted but its claim was not released", {
19901
+ tags: { deviceId: claim.deviceId },
19902
+ meta: {
19903
+ blockId,
19904
+ cap: claim.capName,
19905
+ owner: claim.owner,
19906
+ error: claim.error
19907
+ }
19908
+ });
19909
+ const detail = unreleased.map((claim) => `${claim.capName} on device ${claim.deviceId}: ${claim.error}`).join("; ");
19910
+ throw new Error(`core-blocks: "${blockId}" was deleted but its claims were not released — ${detail}`);
19911
+ }
19912
+ } else this.convergeSoon();
19913
+ }
19914
+ /**
19815
19915
  * The Customize features identity links contribute (D1063). A pass runs on
19816
19916
  * every `identity-link.created` / `.lost`, once now, and — until a pass has
19817
19917
  * read the links (device-manager answers only once it has booted) — on each
@@ -19854,6 +19954,9 @@ var CoreBlocksAddon = class extends BaseAddon {
19854
19954
  caller
19855
19955
  });
19856
19956
  },
19957
+ remove: async (block) => {
19958
+ await this.removeBlock(block.id, block);
19959
+ },
19857
19960
  logger: this.ctx.logger.child("identity-links")
19858
19961
  });
19859
19962
  this.subscribe({ category: EventCategory$1.IdentityLinkCreated }, () => links.requestPass());
@@ -47,6 +47,8 @@ export interface LinkContributionPorts {
47
47
  readonly blocks: () => readonly CoreBlock[] | null;
48
48
  readonly create: (host: CompositionSourceRef, features: readonly CompositionFeature[]) => Promise<void>;
49
49
  readonly update: (block: CoreBlock, composition: Composition) => Promise<void>;
50
+ /** Delete a block this reconciler emptied: its row, settings and claims. */
51
+ readonly remove: (block: CoreBlock) => Promise<void>;
50
52
  readonly logger: IScopedLogger;
51
53
  }
52
54
  /** One contribution a linked link owes its host. */