@camstack/server 1.2.943 → 1.2.944

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 (157) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/closure-pins.json +350 -0
  3. package/dist/api/core/auth-sessions.procedures.js +18 -0
  4. package/dist/api/core/auth.router.js +19 -6
  5. package/dist/api/server-upload.js +17 -1
  6. package/dist/api/trpc/generated-cap-routers.js +83 -0
  7. package/dist/auth/native-return.js +9 -3
  8. package/dist/auth/sso-routes.js +5 -1
  9. package/dist/core/addon/instance-lifecycle.js +4 -1
  10. package/dist/core/auth/handoff-code.service.js +35 -1
  11. package/dist/server-root/index.js +313 -70
  12. package/package.json +21 -11
  13. package/system/dist/{action-index-B1fgpQBt.mjs → action-index-DpYmsOKh.mjs} +1 -1
  14. package/system/dist/{action-index-B_cLRwXJ.js → action-index-Dz9rd1qa.js} +1 -1
  15. package/system/dist/{addon-settings.cap-CZ4MC7ha.mjs → addon-settings.cap-CHpmuaQG.mjs} +1 -1
  16. package/system/dist/{addon-settings.cap-DrLdMFIe.js → addon-settings.cap-nZVHPo3X.js} +1 -1
  17. package/system/dist/{alert-episode-Be--PngO.mjs → alert-episode-D-1VUUkZ.mjs} +1 -1
  18. package/system/dist/{alert-episode-Bqktmt-i.js → alert-episode-DaQ3prSe.js} +1 -1
  19. package/system/dist/{base-addon-CRsXtYFG.js → base-addon-BG7p06Hb.js} +136 -15
  20. package/system/dist/{base-addon-BcS6r1cT.mjs → base-addon-BcVoYZbC.mjs} +136 -15
  21. package/system/dist/{base-device-DAdWzDOl.js → base-device-DeSNiwZ4.js} +4 -4
  22. package/system/dist/{base-device-DJXF5eDN.mjs → base-device-w_MD0Bf4.mjs} +4 -4
  23. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  24. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  25. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  26. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  27. package/system/dist/builtins/alerts/alerts.addon.js +3 -3
  28. package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
  29. package/system/dist/builtins/autotrack/index.js +1 -1
  30. package/system/dist/builtins/autotrack/index.mjs +1 -1
  31. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  32. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  33. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  34. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  35. package/system/dist/builtins/camera-grid/index.js +3 -3
  36. package/system/dist/builtins/camera-grid/index.mjs +3 -3
  37. package/system/dist/builtins/composer/composer.addon.js +7 -7
  38. package/system/dist/builtins/composer/composer.addon.mjs +7 -7
  39. package/system/dist/builtins/console-logging/index.js +1 -1
  40. package/system/dist/builtins/console-logging/index.mjs +1 -1
  41. package/system/dist/builtins/core-blocks/actions-store.d.ts +2 -0
  42. package/system/dist/builtins/core-blocks/block-supervisor.d.ts +16 -4
  43. package/system/dist/builtins/core-blocks/core-block-store.d.ts +2 -0
  44. package/system/dist/builtins/core-blocks/core-blocks.addon.js +1018 -323
  45. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +986 -291
  46. package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -2
  47. package/system/dist/builtins/core-blocks/migrations/tag-ids.d.ts +42 -0
  48. package/system/dist/builtins/core-blocks/migrations/tags-as-records.d.ts +47 -0
  49. package/system/dist/builtins/core-blocks/record-kinds.d.ts +12 -1
  50. package/system/dist/builtins/core-blocks/runs-api.d.ts +3 -1
  51. package/system/dist/builtins/core-blocks/runs-ledger.d.ts +3 -1
  52. package/system/dist/builtins/core-blocks/scheduler/scheduler-store.d.ts +2 -0
  53. package/system/dist/builtins/core-blocks/tags-service.d.ts +52 -27
  54. package/system/dist/builtins/core-blocks/tags-wiring.d.ts +2 -0
  55. package/system/dist/builtins/core-notifier/core-notifier.addon.js +76 -67
  56. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +76 -67
  57. package/system/dist/builtins/device-history/device-history.addon.js +4 -4
  58. package/system/dist/builtins/device-history/device-history.addon.mjs +4 -4
  59. package/system/dist/builtins/device-manager/device-manager.addon.js +1602 -760
  60. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1588 -746
  61. package/system/dist/builtins/device-manager/device-meta-actions.d.ts +13 -136
  62. package/system/dist/builtins/device-manager/device-meta-types.d.ts +5 -1
  63. package/system/dist/builtins/device-manager/device-provider-context.d.ts +9 -0
  64. package/system/dist/builtins/device-manager/device-row-store.d.ts +21 -4
  65. package/system/dist/builtins/device-manager/device-search.d.ts +6 -0
  66. package/system/dist/builtins/device-manager/location-alignment.d.ts +9 -2
  67. package/system/dist/builtins/device-manager/migrate-device.d.ts +7 -2
  68. package/system/dist/builtins/device-manager/migrate-hardware-state.d.ts +132 -1
  69. package/system/dist/builtins/device-manager/migrations/device-tag-ids.d.ts +25 -0
  70. package/system/dist/builtins/device-manager/migrations/index.d.ts +16 -0
  71. package/system/dist/builtins/device-manager/migrations/orphan-children.d.ts +33 -0
  72. package/system/dist/builtins/device-manager/migrations/ports.d.ts +17 -0
  73. package/system/dist/builtins/device-manager/migrations/rooms-as-records.d.ts +52 -0
  74. package/system/dist/builtins/device-manager/record-kinds.d.ts +3 -1
  75. package/system/dist/builtins/device-manager/removal-cleanup.d.ts +7 -0
  76. package/system/dist/builtins/device-manager/room-actions.d.ts +27 -0
  77. package/system/dist/builtins/device-manager/room-store.d.ts +19 -0
  78. package/system/dist/builtins/device-manager/tag-names.d.ts +32 -0
  79. package/system/dist/builtins/device-manager/wireable-enum-catalog.d.ts +18 -0
  80. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  81. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  82. package/system/dist/builtins/keychain/index.js +2 -2
  83. package/system/dist/builtins/keychain/index.mjs +2 -2
  84. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  85. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  86. package/system/dist/builtins/local-auth/local-auth.addon.js +1 -1
  87. package/system/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  88. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  89. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  90. package/system/dist/builtins/loki-logging/index.js +2 -2
  91. package/system/dist/builtins/loki-logging/index.mjs +2 -2
  92. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  93. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  94. package/system/dist/builtins/platform-probe/index.js +1 -1
  95. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  96. package/system/dist/builtins/record-entries/index.js +1 -1
  97. package/system/dist/builtins/record-entries/index.mjs +1 -1
  98. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  99. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  100. package/system/dist/builtins/snapshot/index.js +1 -1
  101. package/system/dist/builtins/snapshot/index.mjs +1 -1
  102. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  103. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  104. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  105. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  106. package/system/dist/builtins/sqlite-storage/migrations/migration-engine.d.ts +3 -1
  107. package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +1 -0
  108. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +15 -10
  109. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +15 -10
  110. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  111. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  112. package/system/dist/builtins/system-config/system-config.addon.js +1 -1
  113. package/system/dist/builtins/system-config/system-config.addon.mjs +1 -1
  114. package/system/dist/builtins/winston-logging/index.js +2 -2
  115. package/system/dist/builtins/winston-logging/index.mjs +2 -2
  116. package/system/dist/{command-catalog-C29hVOOg.js → command-catalog-CI0tu1Nt.js} +1 -1
  117. package/system/dist/{command-catalog-xAeqxbZk.mjs → command-catalog-zwlIA3T5.mjs} +1 -1
  118. package/system/dist/{composition-sources-C327LGFn.mjs → composition-sources-CXxXfh1z.mjs} +1 -1
  119. package/system/dist/{composition-sources-Do5qM6EB.js → composition-sources-DNgSItK-.js} +1 -1
  120. package/system/dist/{core-blocks.cap-CdTGUKtr.js → core-blocks.cap-BHEok4VO.js} +125 -373
  121. package/system/dist/{core-blocks.cap-DLkEfV5b.mjs → core-blocks.cap-CPgZRcpj.mjs} +109 -327
  122. package/system/dist/{device-manager.cap-DJs8izI6.js → device-manager.cap-B9qVf7ag.js} +163 -22
  123. package/system/dist/{device-manager.cap-eYrj1Ezp.mjs → device-manager.cap-CV4KGp3e.mjs} +134 -17
  124. package/system/dist/{error.cap-CU1FB6uE.mjs → error.cap-B8l7L8e4.mjs} +7 -1
  125. package/system/dist/{error.cap-BuKbL3Ac.js → error.cap-BqlvgBJd.js} +7 -1
  126. package/system/dist/file-host-worker.js +1 -1
  127. package/system/dist/file-host-worker.mjs +1 -1
  128. package/system/dist/index.js +7 -7
  129. package/system/dist/index.mjs +6 -6
  130. package/system/dist/{legacy-integration-rows-door-CdqYAj-o.js → legacy-integration-rows-door-BK8eoGlF.js} +1 -1
  131. package/system/dist/{legacy-integration-rows-door-LSgpClpX.mjs → legacy-integration-rows-door-CwzC5XNk.mjs} +1 -1
  132. package/system/dist/{migration-DGAc6ywR.mjs → migration-BvbfW9g-.mjs} +6 -0
  133. package/system/dist/{migration-BOQlFZCN.js → migration-CHPdAdNh.js} +6 -0
  134. package/system/dist/{prefix-walk-BFnw8NBu.js → named-entity-store-DFwLij9c.js} +244 -90
  135. package/system/dist/{prefix-walk-Mtij0NNT.mjs → named-entity-store-DOnyyFFf.mjs} +195 -89
  136. package/system/dist/{notification-rules.cap-BUIuYPlQ.mjs → notification-rules.cap-ClvK6QT1.mjs} +10 -5
  137. package/system/dist/{notification-rules.cap-BJKUjizS.js → notification-rules.cap-uSLoe2pA.js} +10 -5
  138. package/system/dist/{notification-targets-DMW7xgR2.js → notification-targets-ChqpBbtR.js} +2 -2
  139. package/system/dist/{notification-targets-4bGYH5J7.mjs → notification-targets-DUA6-F2t.mjs} +2 -2
  140. package/system/dist/{device-row-store-CTocYKqC.mjs → record-kinds-BD2xv4Pd.mjs} +222 -93
  141. package/system/dist/{device-row-store-C0P2H18h.js → record-kinds-BV8Gcpsx.js} +246 -93
  142. package/system/dist/records/named-entity-store.d.ts +60 -0
  143. package/system/dist/{rename-composition-block-Cdh-dRmY.mjs → rename-composition-block-C3QQ9UUE.mjs} +134 -33
  144. package/system/dist/{rename-composition-block-D9Uc1AF7.js → rename-composition-block-Cx3X8QSm.js} +134 -33
  145. package/system/dist/{retention-source.cap-C6Hy0hlM.js → retention-source.cap-A-TMhU5O.js} +1 -1
  146. package/system/dist/{retention-source.cap-550kkyp5.mjs → retention-source.cap-Ct07pM30.mjs} +1 -1
  147. package/system/dist/{storage-admin.cap-Ci4QbL6P.mjs → storage-admin.cap-C54s9_B9.mjs} +8 -2
  148. package/system/dist/{storage-admin.cap-DqW1ol4j.js → storage-admin.cap-DSPHi7ut.js} +8 -2
  149. package/system/dist/{stream-catalog.cap-CjEQFknc.js → stream-catalog.cap-7WPsugOy.js} +1 -1
  150. package/system/dist/{stream-catalog.cap-DVniDdRD.mjs → stream-catalog.cap-CzwRDaqT.mjs} +1 -1
  151. package/system/dist/{tag-BxLazvVb.js → tag-BLraBqvp.js} +12 -0
  152. package/system/dist/{tag-uZBAq6ox.mjs → tag-DU8pm9Bi.mjs} +7 -1
  153. package/system/dist/time-window-B6UhCArd.js +679 -0
  154. package/system/dist/time-window-BnUBULgu.mjs +578 -0
  155. package/system/dist/{wal-maintenance-BgYiAy5b.js → wal-maintenance-CkPfVApC.js} +0 -0
  156. package/system/dist/{wal-maintenance-Bey5ChBb.mjs → wal-maintenance-u84_1sVl.mjs} +0 -0
  157. package/system/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import { a as CamStreamResolutionSchema, c as DerivedSourceRefSchema, d as ProfileRtspEntrySchema, f as ProfileSlotSchema, g as SubscribeAudioChunksResultSchema, h as SubscribeAudioChunksInputSchema, i as CamStreamKindSchema, l as FrameHandleSchema, n as BrokerStatsSchema, o as CameraStreamSchema, p as ProfileSlotStatusSchema, r as CamProfileSchema, s as DecodedAudioChunkSchema, u as PreviewDerivedEncodeResultSchema } from "./streaming-shared-B8cXatuU.mjs";
2
- import { A as AudioClassifyOutcomeSchema, C as CameraSensorsStatusSchema, D as cameraGridLayoutCapability, E as deviceStatusCapability, F as PeerBytesTicketSchema, M as BoundingBoxSchema, N as FrameInputSchema, O as AudioChunkInputSchema, P as ClipModelMetaSchema, S as CameraSensorsConfigSchema, _ as PipelineStepInputSchema, a as RunnerLocalLoadSchema, b as CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS, c as NodeBenchmarkCandidatesSchema, d as NodeBenchmarkResultViewSchema, f as NodeBenchmarkStatusSchema, g as PipelineRunResultBridge, h as CameraMetricsSchema, i as motionCapability, j as AudioLevelSchema, k as AudioClassificationLabelSchema, l as NodeBenchmarkPlanSchema, m as zonesCapability, o as pipelineRunnerCapability, p as NodeDecodeProfileSchema, s as ListNodeBenchmarkResultsInputSchema, t as streamCatalogCapability, u as NodeBenchmarkPreflightSchema, v as RetrainExportLayoutSchema, w as featureProbeCapability, x as motionDetectionCapability, y as pipelineAnalyticsCapability } from "./stream-catalog.cap-DVniDdRD.mjs";
3
- import { b as EventCategory } from "./base-addon-BcS6r1cT.mjs";
2
+ import { A as AudioClassifyOutcomeSchema, C as CameraSensorsStatusSchema, D as cameraGridLayoutCapability, E as deviceStatusCapability, F as PeerBytesTicketSchema, M as BoundingBoxSchema, N as FrameInputSchema, O as AudioChunkInputSchema, P as ClipModelMetaSchema, S as CameraSensorsConfigSchema, _ as PipelineStepInputSchema, a as RunnerLocalLoadSchema, b as CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS, c as NodeBenchmarkCandidatesSchema, d as NodeBenchmarkResultViewSchema, f as NodeBenchmarkStatusSchema, g as PipelineRunResultBridge, h as CameraMetricsSchema, i as motionCapability, j as AudioLevelSchema, k as AudioClassificationLabelSchema, l as NodeBenchmarkPlanSchema, m as zonesCapability, o as pipelineRunnerCapability, p as NodeDecodeProfileSchema, s as ListNodeBenchmarkResultsInputSchema, t as streamCatalogCapability, u as NodeBenchmarkPreflightSchema, v as RetrainExportLayoutSchema, w as featureProbeCapability, x as motionDetectionCapability, y as pipelineAnalyticsCapability } from "./stream-catalog.cap-CzwRDaqT.mjs";
3
+ import { b as EventCategory } from "./base-addon-BcVoYZbC.mjs";
4
4
  import { Z as errMsg } from "./scoped-settings-DVWUIP7Z.mjs";
5
5
  import { a as expandCapMethods, c as method, i as event, l as optionalMethod } from "./capability-definition-C1TLUVJR.mjs";
6
- import { a as notificationRulesCapability, c as alarmPanelCapability, f as notificationOutputCapability, n as NcConditionsSchema, r as NcScheduleSchema, t as NcConditionDescriptorSchema } from "./notification-rules.cap-BUIuYPlQ.mjs";
7
- import { a as deviceManagerCapability, b as ResyncResultSchema, i as LinkedDevicesSlotValueSchema, r as LINKED_DEVICES_SLOT, x as deviceAdoptionCapability } from "./device-manager.cap-eYrj1Ezp.mjs";
6
+ import { a as notificationRulesCapability, c as alarmPanelCapability, f as notificationOutputCapability, n as NcConditionsSchema, r as NcScheduleSchema, t as NcConditionDescriptorSchema } from "./notification-rules.cap-ClvK6QT1.mjs";
7
+ import { T as deviceAdoptionCapability, a as deviceManagerCapability, i as LinkedDevicesSlotValueSchema, l as TagPatchSchema, r as LINKED_DEVICES_SLOT, u as TagRecordSchema, w as ResyncResultSchema } from "./device-manager.cap-CV4KGp3e.mjs";
8
8
  import { d as CameraSwitchIdSchema, u as CameraSwitchGroupSchema } from "./device-identifiers-iSuQCKmK.mjs";
9
- import { a as deviceRemovalHookCapability, i as deviceRunsCapability, n as deviceTransitionsCapability, s as deviceHistoryCapability, t as retentionSourceCapability } from "./retention-source.cap-550kkyp5.mjs";
9
+ import { a as deviceRemovalHookCapability, i as deviceRunsCapability, n as deviceTransitionsCapability, s as deviceHistoryCapability, t as retentionSourceCapability } from "./retention-source.cap-Ct07pM30.mjs";
10
10
  import { t as NOT_A_DEVICE } from "./system-reasons-CYj4qwyS.mjs";
11
11
  import { f as settingsStoreCapability } from "./settings-store.cap-CaDSOqgK.mjs";
12
12
  import { a as readingMeta, n as baseUnitOf, t as ReadingQuantitySchema } from "./quantity-D3g5SxsZ.mjs";
@@ -14,14 +14,14 @@ import { r as LabelDefinitionSchema, t as DetectionCatalogClassMapSchema } from
14
14
  import { a as RecordingStorageModeSchema, i as recordingCapability, n as recordingArchiveCapability } from "./recording-archive.cap-CTlm86R8.mjs";
15
15
  import { y as StorageMigrationLeaseInputSchema } from "./relocate-CoZZTui1.mjs";
16
16
  import { n as storageCapability, t as storageMigrationCapability } from "./storage-migration.cap-Ciw84XPm.mjs";
17
- import { i as TagsFieldSchema, n as TagNameSchema, t as TagColorIdSchema, u as IconKeySchema } from "./tag-uZBAq6ox.mjs";
17
+ import { a as TagsFieldSchema, d as IconKeySchema, n as TagIdsFieldSchema, r as TagNameSchema, t as TagColorIdSchema } from "./tag-DU8pm9Bi.mjs";
18
18
  import { r as MODEL_FORMATS, t as platformProbeCapability } from "./platform-probe.cap-DzZ7xUfS.mjs";
19
19
  import { a as authProviderCapability, c as TokenScopeSchema, i as deviceCredentialsCapability, r as ssoBridgeCapability, t as userManagementCapability } from "./user-management.cap-4IEUCSdL.mjs";
20
20
  import { n as DeviceRole, r as DeviceType } from "./device-type-TUGqGmaI.mjs";
21
21
  import { d as AppLoginPathSchema } from "./device-certificate-Cddm4Idn.mjs";
22
- import { a as findVocabAction, s as vocabCall } from "./action-index-B1fgpQBt.mjs";
23
- import { i as addonSettingsCapability, o as unitDimension, s as unitsForDimension } from "./addon-settings.cap-CZ4MC7ha.mjs";
24
- import { A as MediaPlayerStatusSchema, At as TemplateTimeWindowValueSchema, B as isRemoteCustomKey, Dt as TemplateActionValueSchema, F as irSourceProblem, G as IrNativeFormatSchema, Gt as convertQuantityInput, H as isRemoteWidgetRole, I as remoteSourceSteps, Jt as paramMetaOf, K as IrTimingsSchema, Kt as isQuantityValue, M as REMOTE_STEP_DELAY_MAX_MS, Mt as EVENT_LEAF_ID_RE, N as RemoteSourceSchema, Ot as TemplateEntriesValueSchema, R as RemoteRoleSchema, V as isRemoteRole, W as IrNativeCodeSchema, Wt as QuantityUnitError, Xt as enumerateSchemaFields, Yt as enumerateItemArrayFields, Zt as unwrapSchema, an as EventVocabularyEntrySchema, bt as AutomationRecipeSchema, c as coreBlocksCapability, dt as SchedulerConflictSchema, et as CompositionBlockStateSchema, gt as SchedulerStatusSchema, ht as SchedulerSchema, it as AutomationRunTraceSchema, j as mediaPlayerCapability, jt as AutomationWhenSchema, kt as TemplateEventValueSchema, mt as SchedulerPreviewSchema, pt as SchedulerInputSchema, q as TransmitSettingsSchema, qt as paramMeta, rt as AutomationRunOutcomeSchema, tt as CompositionRunStatusSchema, ut as LOCAL_DATE_PATTERN, vt as ActionStepSchema, w as powerSourceCapability, yt as AutomationBranchStepSchema, z as customKeyOfRole } from "./core-blocks.cap-DLkEfV5b.mjs";
22
+ import { $t as EventVocabularyEntrySchema, A as MediaPlayerStatusSchema, At as TemplateEventValueSchema, B as isRemoteCustomKey, Dt as TemplateActionValueSchema, F as irSourceProblem, G as IrNativeFormatSchema, Gt as QuantityUnitError, H as isRemoteWidgetRole, I as remoteSourceSteps, Jt as paramMeta, K as IrTimingsSchema, Kt as convertQuantityInput, M as REMOTE_STEP_DELAY_MAX_MS, Mt as AutomationWhenSchema, N as RemoteSourceSchema, Nt as EVENT_LEAF_ID_RE, Ot as TemplateDeviceStateValueSchema, Qt as unwrapSchema, R as RemoteRoleSchema, V as isRemoteRole, W as IrNativeCodeSchema, Xt as enumerateItemArrayFields, Yt as paramMetaOf, Zt as enumerateSchemaFields, bt as AutomationRecipeSchema, c as coreBlocksCapability, dt as SchedulerConflictSchema, et as CompositionBlockStateSchema, gt as SchedulerStatusSchema, ht as SchedulerSchema, it as AutomationRunTraceSchema, j as mediaPlayerCapability, jt as TemplateTimeWindowValueSchema, kt as TemplateEntriesValueSchema, mt as SchedulerPreviewSchema, pt as SchedulerInputSchema, q as TransmitSettingsSchema, qt as isQuantityValue, rt as AutomationRunOutcomeSchema, tt as CompositionRunStatusSchema, ut as LOCAL_DATE_PATTERN, vt as ActionStepSchema, w as powerSourceCapability, yt as AutomationBranchStepSchema, z as customKeyOfRole } from "./core-blocks.cap-CPgZRcpj.mjs";
23
+ import { a as findVocabAction, s as vocabCall } from "./action-index-DpYmsOKh.mjs";
24
+ import { i as addonSettingsCapability, o as unitDimension, s as unitsForDimension } from "./addon-settings.cap-CHpmuaQG.mjs";
25
25
  import { F as COMPOSED_DEVICE_STABLE_ID_PREFIX, S as CompositionSchema, it as alertsCapability, v as COMPOSER_ADDON_ID } from "./compile-OBMHlqD-.mjs";
26
26
  import { a as normalizeUnit } from "./source-info-DGB7SdB_.mjs";
27
27
  import { t } from "./l10n-Bu6aUvSY.mjs";
@@ -31,9 +31,9 @@ import { a as databaseSnapshotCapability } from "./database-snapshot.cap-a3lSf4h
31
31
  import { n as backupCapability, t as storageOccupancyCapability } from "./storage-occupancy.cap-B-wbMPmx.mjs";
32
32
  import { n as calendarsCapability, r as calendarSourceCapability } from "./calendars.cap-DQc6Q6qS.mjs";
33
33
  import { r as HISTORY_PRIMARY } from "./history-catalog-A_dzXNpv.mjs";
34
- import { i as dataStoreProviderCapability, n as migrationsCapability, t as storageAdminCapability } from "./storage-admin.cap-Ci4QbL6P.mjs";
34
+ import { i as dataStoreProviderCapability, n as migrationsCapability, t as storageAdminCapability } from "./storage-admin.cap-C54s9_B9.mjs";
35
35
  import { o as deviceProviderCapability } from "./device-provider.cap-D8mJllVM.mjs";
36
- import { i as errorCapability } from "./error.cap-CU1FB6uE.mjs";
36
+ import { i as errorCapability } from "./error.cap-B8l7L8e4.mjs";
37
37
  import { n as filesystemBrowseCapability, t as storageProviderCapability } from "./storage-provider.cap-CnN9ULbc.mjs";
38
38
  import { n as integrationsCapability, t as integrationInstancesCapability } from "./integration-instances.cap-BWttO42A.mjs";
39
39
  import { a as keychainCapability, i as keychainAdminCapability } from "./keychain-admin.cap-DOvL8TMG.mjs";
@@ -1074,7 +1074,12 @@ var eventEmitterCapability = {
1074
1074
  } },
1075
1075
  status: {
1076
1076
  schema: EventEmitterStatusSchema,
1077
- kind: "push"
1077
+ kind: "push",
1078
+ fieldEnums: { "lastEvent.eventType": {
1079
+ from: "status",
1080
+ listKey: "vocabulary",
1081
+ valueKey: "id"
1082
+ } }
1078
1083
  },
1079
1084
  runtimeState: EventEmitterStatusSchema,
1080
1085
  /**
@@ -1240,6 +1245,8 @@ var ActionEntrySchema = /* @__PURE__ */ z.object({
1240
1245
  minDelaySec: /* @__PURE__ */ ActionMinDelaySecSchema.optional(),
1241
1246
  /** Internal only: operator tags (D1054). Absent = no tags. */
1242
1247
  tags: /* @__PURE__ */ TagsFieldSchema.optional(),
1248
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
1249
+ tagIds: /* @__PURE__ */ TagIdsFieldSchema.optional(),
1243
1250
  status: ActionStatusSchema
1244
1251
  }).superRefine((entry, ctx) => {
1245
1252
  if (entry.source === "internal") {
@@ -1272,7 +1279,9 @@ var ActionInputSchema$1 = /* @__PURE__ */ z.object({
1272
1279
  steps: /* @__PURE__ */ z.array(ActionStepSchema).min(1).max(50),
1273
1280
  variables: /* @__PURE__ */ z.array(ActionVariableSchema).max(20).optional(),
1274
1281
  minDelaySec: /* @__PURE__ */ ActionMinDelaySecSchema.optional(),
1275
- tags: /* @__PURE__ */ TagsFieldSchema.optional()
1282
+ tags: /* @__PURE__ */ TagsFieldSchema.optional(),
1283
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
1284
+ tagIds: /* @__PURE__ */ TagIdsFieldSchema.optional()
1276
1285
  });
1277
1286
  /** Who started a run. Absent = the operator pressed it. */
1278
1287
  var ActionRunOriginSchema = /* @__PURE__ */ z.object({
@@ -3894,6 +3903,16 @@ var BatteryStatusSchema = /* @__PURE__ */ z.object({
3894
3903
  */
3895
3904
  lastFullRefreshAt: /* @__PURE__ */ z.number().optional(),
3896
3905
  /**
3906
+ * The scheduled refresh's attempt bookkeeping for the window it last tried
3907
+ * (window index, attempts spent, ms epoch of the last attempt; `0` = none).
3908
+ * Persisted beside `lastFullRefreshAt` so a restart neither forgets a wake
3909
+ * the window already spent nor repeats it (#666). Written only by the
3910
+ * provider's refresh controller.
3911
+ */
3912
+ refreshAttemptWindow: /* @__PURE__ */ z.number().optional(),
3913
+ refreshAttempts: /* @__PURE__ */ z.number().optional(),
3914
+ refreshLastAttemptAt: /* @__PURE__ */ z.number().optional(),
3915
+ /**
3897
3916
  * True when the source is a BINARY low-battery indicator (HA
3898
3917
  * `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
3899
3918
  * charge level — `level` is then a coarse stand-in (100 = normal,
@@ -12421,6 +12440,44 @@ var heatingValveCapability = {
12421
12440
  }
12422
12441
  };
12423
12442
  //#endregion
12443
+ //#region ../types/dist/esm/device/switch-run-limits.mjs
12444
+ /**
12445
+ * How long a switch-like device may be kept on, by its type AND role: the ONE
12446
+ * table (D1033 timed run, D1092 "on for").
12447
+ *
12448
+ * The maximum is a safety bound, not a preference. A request above it is
12449
+ * refused where it is made (timed run, a saved "on for") and clamped where it
12450
+ * is armed, so nothing a stored value says can hold a device on longer.
12451
+ */
12452
+ var MINUTE = 60;
12453
+ /** A plug-in heater (switch + `switch-heater`): up to 3 h. */
12454
+ var SWITCH_RUN_HEATER_LIMIT = {
12455
+ maxSeconds: 180 * MINUTE,
12456
+ quickRunSeconds: 30 * MINUTE
12457
+ };
12458
+ /** A pet fountain's pump: up to 5 min. */
12459
+ var SWITCH_RUN_PET_FOUNTAIN_LIMIT = {
12460
+ maxSeconds: 300,
12461
+ quickRunSeconds: 60
12462
+ };
12463
+ /** A siren: up to 10 min, a one-tap run of 1 min. */
12464
+ var SWITCH_RUN_SIREN_LIMIT = {
12465
+ maxSeconds: 10 * MINUTE,
12466
+ quickRunSeconds: MINUTE
12467
+ };
12468
+ /** Every other switch: up to 24 h, a one-tap run of 15 min. */
12469
+ var SWITCH_RUN_DEFAULT_LIMIT = {
12470
+ maxSeconds: 1440 * MINUTE,
12471
+ quickRunSeconds: 15 * MINUTE
12472
+ };
12473
+ /** The limit of a device by type and role; the default when nothing narrower applies. */
12474
+ function switchRunLimitOf(deviceType, role) {
12475
+ if (deviceType === DeviceType.PetFountain) return SWITCH_RUN_PET_FOUNTAIN_LIMIT;
12476
+ if (role === DeviceRole.SwitchHeater) return SWITCH_RUN_HEATER_LIMIT;
12477
+ if (role === DeviceRole.Siren) return SWITCH_RUN_SIREN_LIMIT;
12478
+ return SWITCH_RUN_DEFAULT_LIMIT;
12479
+ }
12480
+ //#endregion
12424
12481
  //#region ../types/dist/esm/capabilities/timed-run.cap.mjs
12425
12482
  /**
12426
12483
  * timed-run - run a device for a chosen time, then stop it (D993).
@@ -12444,16 +12501,16 @@ var TimedRunUnitSchema = /* @__PURE__ */ z.enum(["s", "min"]);
12444
12501
  /** A plug-in heater (switch + `switch-heater`): up to 3 h, in minutes. */
12445
12502
  var TIMED_RUN_HEATER_LIMIT = {
12446
12503
  actuator: "switch",
12447
- maxSeconds: 10800,
12504
+ maxSeconds: SWITCH_RUN_HEATER_LIMIT.maxSeconds,
12448
12505
  unit: "min",
12449
- quickRunDefault: 30
12506
+ quickRunDefault: SWITCH_RUN_HEATER_LIMIT.quickRunSeconds / 60
12450
12507
  };
12451
12508
  /** A pet fountain's pump: up to 5 min, in seconds. */
12452
12509
  var TIMED_RUN_PET_FOUNTAIN_LIMIT = {
12453
12510
  actuator: "pet-fountain",
12454
- maxSeconds: 300,
12511
+ maxSeconds: SWITCH_RUN_PET_FOUNTAIN_LIMIT.maxSeconds,
12455
12512
  unit: "s",
12456
- quickRunDefault: 60
12513
+ quickRunDefault: SWITCH_RUN_PET_FOUNTAIN_LIMIT.quickRunSeconds
12457
12514
  };
12458
12515
  /**
12459
12516
  * The device types `timed-run` may be offered on. A `switch` is narrowed by
@@ -12468,8 +12525,9 @@ var TIMED_RUN_DEVICE_ROLES = { [DeviceType.Switch]: [DeviceRole.SwitchHeater] };
12468
12525
  * `null` - the device is not offered `timed-run`.
12469
12526
  */
12470
12527
  function timedRunLimitOf(deviceType, role) {
12471
- if (deviceType === DeviceType.PetFountain) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
12472
- if (deviceType === DeviceType.Switch && role === DeviceRole.SwitchHeater) return TIMED_RUN_HEATER_LIMIT;
12528
+ const limit = switchRunLimitOf(deviceType, role);
12529
+ if (deviceType === DeviceType.PetFountain && limit === SWITCH_RUN_PET_FOUNTAIN_LIMIT) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
12530
+ if (deviceType === DeviceType.Switch && role === DeviceRole.SwitchHeater && limit === SWITCH_RUN_HEATER_LIMIT) return TIMED_RUN_HEATER_LIMIT;
12473
12531
  return null;
12474
12532
  }
12475
12533
  var MS_PER_SECOND = 1e3;
@@ -29007,6 +29065,30 @@ var tagsCapability = {
29007
29065
  scope: "system",
29008
29066
  mode: "singleton",
29009
29067
  methods: {
29068
+ /** Create the tag named `name`, or return the one that has it (trimmed,
29069
+ * case-insensitive). A new tag gets a random id (D1089). */
29070
+ ensureTag: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ name: TagNameSchema }), TagRecordSchema, {
29071
+ kind: "mutation",
29072
+ auth: "admin"
29073
+ }),
29074
+ /** Every tag record, sorted by `order` then name. */
29075
+ listTags: /* @__PURE__ */ method(/* @__PURE__ */ z.object({}), /* @__PURE__ */ z.array(TagRecordSchema), { auth: "protected" }),
29076
+ /** ONE write to ONE record: rename, restyle, describe. No owner is rewritten
29077
+ * and none has to be reachable. A rename onto another tag's name is refused
29078
+ * (`tag-name-taken`). */
29079
+ updateTag: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
29080
+ id: /* @__PURE__ */ z.string().min(1),
29081
+ patch: TagPatchSchema
29082
+ }), TagRecordSchema, {
29083
+ kind: "mutation",
29084
+ auth: "admin"
29085
+ }),
29086
+ /** Delete a tag and clear it from every owner (the one fan-out that remains).
29087
+ * Refused while an owner cannot be read, naming it. */
29088
+ deleteTag: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ id: /* @__PURE__ */ z.string().min(1) }), /* @__PURE__ */ z.object({ updated: TagUsageCountsSchema }), {
29089
+ kind: "mutation",
29090
+ auth: "admin"
29091
+ }),
29010
29092
  /**
29011
29093
  * Every tag: styled or in use, with how many records of each kind carry it.
29012
29094
  * An unreachable owner degrades that kind's count to `null`; the call still
@@ -29239,6 +29321,11 @@ var TimeWindowInputSchema = /* @__PURE__ */ z.object({
29239
29321
  kind: /* @__PURE__ */ z.literal("time-window"),
29240
29322
  ...inputBase
29241
29323
  });
29324
+ /** A limit on the state of a device (a derived "is night"); only a `gate` binding reads it. */
29325
+ var DeviceStateInputSchema = /* @__PURE__ */ z.object({
29326
+ kind: /* @__PURE__ */ z.literal("device-state"),
29327
+ ...inputBase
29328
+ });
29242
29329
  /**
29243
29330
  * A list of automation elements, verbatim: `trigger` entries are event leaves
29244
29331
  * of a `when` tree (`device-fired`), `step` entries are steps of a branch
@@ -29262,7 +29349,8 @@ var TemplateScalarInputSchema = /* @__PURE__ */ z.discriminatedUnion("kind", [
29262
29349
  TextInputSchema,
29263
29350
  SelectInputSchema,
29264
29351
  BooleanInputSchema,
29265
- TimeWindowInputSchema
29352
+ TimeWindowInputSchema,
29353
+ DeviceStateInputSchema
29266
29354
  ]);
29267
29355
  var groupBase = {
29268
29356
  kind: /* @__PURE__ */ z.literal("group"),
@@ -29348,10 +29436,10 @@ var TemplateRowsBindingSchema = /* @__PURE__ */ z.object({
29348
29436
  item: /* @__PURE__ */ z.unknown(),
29349
29437
  bindings: /* @__PURE__ */ z.array(TemplateRowItemBindingSchema).max(40)
29350
29438
  });
29351
- /** Wraps the condition tree at `path` as `all[time-is, <tree>]` when the input has a value. */
29439
+ /** Wraps the condition tree at `path` as `all[time-is | device-is, <tree>]` when the input has a value. */
29352
29440
  var TemplateGateBindingSchema = /* @__PURE__ */ z.object({
29353
29441
  kind: /* @__PURE__ */ z.literal("gate"),
29354
- /** A top-level `time-window` input. */
29442
+ /** A top-level `time-window` or `device-state` input. */
29355
29443
  input: inputKey,
29356
29444
  path: TemplatePathSchema
29357
29445
  });
@@ -29378,7 +29466,7 @@ function levelProblems(inputs, path, inRow = false) {
29378
29466
  issues.push(...levelProblems(input.inputs, path, true));
29379
29467
  continue;
29380
29468
  }
29381
- if (input.kind === "time-window" && inRow) issues.push({
29469
+ if ((input.kind === "time-window" || input.kind === "device-state") && inRow) issues.push({
29382
29470
  message: `time window "${input.key}" limits the whole automation: it is not a row input`,
29383
29471
  path
29384
29472
  });
@@ -29470,9 +29558,9 @@ function bindingProblems(payload, ctx) {
29470
29558
  path: ["bindings", index]
29471
29559
  });
29472
29560
  }
29473
- if (binding.kind === "gate" !== (input.kind === "time-window")) ctx.addIssue({
29561
+ if (binding.kind === "gate" !== (input.kind === "time-window" || input.kind === "device-state")) ctx.addIssue({
29474
29562
  code: "custom",
29475
- message: `a gate reads a time window and a time window is bound with a gate: "${input.key}" is ${input.kind}`,
29563
+ message: `a gate reads a time window or a device state, and those are bound with a gate: "${input.key}" is ${input.kind}`,
29476
29564
  path: ["bindings", index]
29477
29565
  });
29478
29566
  if (binding.kind === "rows") {
@@ -29526,6 +29614,10 @@ function valueProblem(input, value) {
29526
29614
  const parsed = TemplateTimeWindowValueSchema.safeParse(value);
29527
29615
  return parsed.success ? null : parsed.error.issues[0]?.message ?? "pick a time window";
29528
29616
  }
29617
+ case "device-state": {
29618
+ const parsed = TemplateDeviceStateValueSchema.safeParse(value);
29619
+ return parsed.success ? null : parsed.error.issues[0]?.message ?? "pick a device state";
29620
+ }
29529
29621
  case "entries": return entriesProblem(input, value);
29530
29622
  }
29531
29623
  }
@@ -29692,14 +29784,17 @@ function writeValue(root, binding, input, value) {
29692
29784
  }
29693
29785
  }
29694
29786
  /** The tree at the path, under an `all` beside the window. */
29695
- function writeGate(root, binding, value) {
29696
- const window = TemplateTimeWindowValueSchema.parse(value);
29787
+ function writeGate(root, binding, inputKind, value) {
29788
+ const leaf = inputKind === "device-state" ? {
29789
+ kind: "device-is",
29790
+ ...TemplateDeviceStateValueSchema.parse(value)
29791
+ } : {
29792
+ kind: "time-is",
29793
+ ...TemplateTimeWindowValueSchema.parse(value)
29794
+ };
29697
29795
  return setAt(root, binding.path, {
29698
29796
  kind: "all",
29699
- children: [{
29700
- kind: "time-is",
29701
- ...window
29702
- }, getAt(root, binding.path)]
29797
+ children: [leaf, getAt(root, binding.path)]
29703
29798
  });
29704
29799
  }
29705
29800
  /** The name a row is known by: `buttons-0`, and `buttons-0-events-1` for a nested row. */
@@ -29811,7 +29906,11 @@ function expandAutomationTemplate(payload, values) {
29811
29906
  if (list.success) body = appendAt(body, binding.path, list.data, input.key);
29812
29907
  continue;
29813
29908
  }
29814
- body = binding.kind === "gate" ? writeGate(body, binding, value) : writeValue(body, binding, input, value);
29909
+ if (binding.kind === "gate") {
29910
+ if (input.kind === "time-window" || input.kind === "device-state") body = writeGate(body, binding, input.kind, value);
29911
+ continue;
29912
+ }
29913
+ body = writeValue(body, binding, input, value);
29815
29914
  }
29816
29915
  } catch (error) {
29817
29916
  if (!(error instanceof PathError)) throw error;
@@ -29924,7 +30023,9 @@ var TemplateRecordSchema = /* @__PURE__ */ z.object({
29924
30023
  /** Shipped with CamStack (`builtin:` ids): listed beside the operator's, never updated or deleted. */
29925
30024
  builtIn: /* @__PURE__ */ z.literal(true).optional(),
29926
30025
  /** Operator tags (D1054). Absent = no tags. */
29927
- tags: /* @__PURE__ */ TagsFieldSchema.optional()
30026
+ tags: /* @__PURE__ */ TagsFieldSchema.optional(),
30027
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
30028
+ tagIds: /* @__PURE__ */ TagIdsFieldSchema.optional()
29928
30029
  });
29929
30030
  var TemplateWriteResultSchema = /* @__PURE__ */ z.discriminatedUnion("status", [/* @__PURE__ */ z.object({
29930
30031
  status: /* @__PURE__ */ z.literal("saved"),
@@ -1,12 +1,12 @@
1
1
  const require_streaming_shared = require("./streaming-shared-DQwFZOSi.js");
2
- const require_stream_catalog_cap = require("./stream-catalog.cap-CjEQFknc.js");
3
- const require_base_addon = require("./base-addon-CRsXtYFG.js");
2
+ const require_stream_catalog_cap = require("./stream-catalog.cap-7WPsugOy.js");
3
+ const require_base_addon = require("./base-addon-BG7p06Hb.js");
4
4
  const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
5
5
  const require_capability_definition = require("./capability-definition-BEVd01Xj.js");
6
- const require_notification_rules_cap = require("./notification-rules.cap-BJKUjizS.js");
7
- const require_device_manager_cap = require("./device-manager.cap-DJs8izI6.js");
6
+ const require_notification_rules_cap = require("./notification-rules.cap-uSLoe2pA.js");
7
+ const require_device_manager_cap = require("./device-manager.cap-B9qVf7ag.js");
8
8
  const require_device_identifiers = require("./device-identifiers-BQg9EQi1.js");
9
- const require_retention_source_cap = require("./retention-source.cap-C6Hy0hlM.js");
9
+ const require_retention_source_cap = require("./retention-source.cap-A-TMhU5O.js");
10
10
  const require_system_reasons = require("./system-reasons-Be_k1W8g.js");
11
11
  const require_settings_store_cap = require("./settings-store.cap-BhOIBtO4.js");
12
12
  const require_quantity = require("./quantity-lY1KiTSZ.js");
@@ -14,14 +14,14 @@ const require_labels = require("./labels-DX5S8deC.js");
14
14
  const require_recording_archive_cap = require("./recording-archive.cap-Wo-hEZhz.js");
15
15
  const require_relocate = require("./relocate-CdVQAk-w.js");
16
16
  const require_storage_migration_cap = require("./storage-migration.cap-CDOhpCQw.js");
17
- const require_tag = require("./tag-BxLazvVb.js");
17
+ const require_tag = require("./tag-BLraBqvp.js");
18
18
  const require_platform_probe_cap = require("./platform-probe.cap-C0N9CugQ.js");
19
19
  const require_user_management_cap = require("./user-management.cap-DV9Jfsj3.js");
20
20
  const require_device_type = require("./device-type-Cnc0NiSX.js");
21
21
  const require_device_certificate = require("./device-certificate-CguVACQO.js");
22
- const require_action_index = require("./action-index-B_cLRwXJ.js");
23
- const require_addon_settings_cap = require("./addon-settings.cap-DrLdMFIe.js");
24
- const require_core_blocks_cap = require("./core-blocks.cap-CdTGUKtr.js");
22
+ const require_core_blocks_cap = require("./core-blocks.cap-BHEok4VO.js");
23
+ const require_action_index = require("./action-index-Dz9rd1qa.js");
24
+ const require_addon_settings_cap = require("./addon-settings.cap-nZVHPo3X.js");
25
25
  const require_compile = require("./compile-SpeAhaZ6.js");
26
26
  const require_source_info = require("./source-info-DtWf4k2j.js");
27
27
  const require_l10n = require("./l10n-CGMvp7NF.js");
@@ -31,9 +31,9 @@ const require_database_snapshot_cap = require("./database-snapshot.cap-BNS5c60M.
31
31
  const require_storage_occupancy_cap = require("./storage-occupancy.cap-B-Z8f8TZ.js");
32
32
  const require_calendars_cap = require("./calendars.cap-CGeOtL7Q.js");
33
33
  const require_history_catalog = require("./history-catalog-CiTMP3-E.js");
34
- const require_storage_admin_cap = require("./storage-admin.cap-DqW1ol4j.js");
34
+ const require_storage_admin_cap = require("./storage-admin.cap-DSPHi7ut.js");
35
35
  const require_device_provider_cap = require("./device-provider.cap-CNlYBQ5D.js");
36
- const require_error_cap = require("./error.cap-BuKbL3Ac.js");
36
+ const require_error_cap = require("./error.cap-BqlvgBJd.js");
37
37
  const require_storage_provider_cap = require("./storage-provider.cap-B3Hm_BGM.js");
38
38
  const require_integration_instances_cap = require("./integration-instances.cap-DSieF1w3.js");
39
39
  const require_keychain_admin_cap = require("./keychain-admin.cap-DcRCRWtu.js");
@@ -1074,7 +1074,12 @@ var eventEmitterCapability = {
1074
1074
  } },
1075
1075
  status: {
1076
1076
  schema: EventEmitterStatusSchema,
1077
- kind: "push"
1077
+ kind: "push",
1078
+ fieldEnums: { "lastEvent.eventType": {
1079
+ from: "status",
1080
+ listKey: "vocabulary",
1081
+ valueKey: "id"
1082
+ } }
1078
1083
  },
1079
1084
  runtimeState: EventEmitterStatusSchema,
1080
1085
  /**
@@ -1240,6 +1245,8 @@ var ActionEntrySchema = /* @__PURE__ */ zod.z.object({
1240
1245
  minDelaySec: /* @__PURE__ */ ActionMinDelaySecSchema.optional(),
1241
1246
  /** Internal only: operator tags (D1054). Absent = no tags. */
1242
1247
  tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
1248
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
1249
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional(),
1243
1250
  status: ActionStatusSchema
1244
1251
  }).superRefine((entry, ctx) => {
1245
1252
  if (entry.source === "internal") {
@@ -1272,7 +1279,9 @@ var ActionInputSchema$1 = /* @__PURE__ */ zod.z.object({
1272
1279
  steps: /* @__PURE__ */ zod.z.array(require_core_blocks_cap.ActionStepSchema).min(1).max(50),
1273
1280
  variables: /* @__PURE__ */ zod.z.array(ActionVariableSchema).max(20).optional(),
1274
1281
  minDelaySec: /* @__PURE__ */ ActionMinDelaySecSchema.optional(),
1275
- tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional()
1282
+ tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
1283
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
1284
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional()
1276
1285
  });
1277
1286
  /** Who started a run. Absent = the operator pressed it. */
1278
1287
  var ActionRunOriginSchema = /* @__PURE__ */ zod.z.object({
@@ -3894,6 +3903,16 @@ var BatteryStatusSchema = /* @__PURE__ */ zod.z.object({
3894
3903
  */
3895
3904
  lastFullRefreshAt: /* @__PURE__ */ zod.z.number().optional(),
3896
3905
  /**
3906
+ * The scheduled refresh's attempt bookkeeping for the window it last tried
3907
+ * (window index, attempts spent, ms epoch of the last attempt; `0` = none).
3908
+ * Persisted beside `lastFullRefreshAt` so a restart neither forgets a wake
3909
+ * the window already spent nor repeats it (#666). Written only by the
3910
+ * provider's refresh controller.
3911
+ */
3912
+ refreshAttemptWindow: /* @__PURE__ */ zod.z.number().optional(),
3913
+ refreshAttempts: /* @__PURE__ */ zod.z.number().optional(),
3914
+ refreshLastAttemptAt: /* @__PURE__ */ zod.z.number().optional(),
3915
+ /**
3897
3916
  * True when the source is a BINARY low-battery indicator (HA
3898
3917
  * `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
3899
3918
  * charge level — `level` is then a coarse stand-in (100 = normal,
@@ -12424,6 +12443,44 @@ var heatingValveCapability = {
12424
12443
  }
12425
12444
  };
12426
12445
  //#endregion
12446
+ //#region ../types/dist/esm/device/switch-run-limits.mjs
12447
+ /**
12448
+ * How long a switch-like device may be kept on, by its type AND role: the ONE
12449
+ * table (D1033 timed run, D1092 "on for").
12450
+ *
12451
+ * The maximum is a safety bound, not a preference. A request above it is
12452
+ * refused where it is made (timed run, a saved "on for") and clamped where it
12453
+ * is armed, so nothing a stored value says can hold a device on longer.
12454
+ */
12455
+ var MINUTE = 60;
12456
+ /** A plug-in heater (switch + `switch-heater`): up to 3 h. */
12457
+ var SWITCH_RUN_HEATER_LIMIT = {
12458
+ maxSeconds: 180 * MINUTE,
12459
+ quickRunSeconds: 30 * MINUTE
12460
+ };
12461
+ /** A pet fountain's pump: up to 5 min. */
12462
+ var SWITCH_RUN_PET_FOUNTAIN_LIMIT = {
12463
+ maxSeconds: 300,
12464
+ quickRunSeconds: 60
12465
+ };
12466
+ /** A siren: up to 10 min, a one-tap run of 1 min. */
12467
+ var SWITCH_RUN_SIREN_LIMIT = {
12468
+ maxSeconds: 10 * MINUTE,
12469
+ quickRunSeconds: MINUTE
12470
+ };
12471
+ /** Every other switch: up to 24 h, a one-tap run of 15 min. */
12472
+ var SWITCH_RUN_DEFAULT_LIMIT = {
12473
+ maxSeconds: 1440 * MINUTE,
12474
+ quickRunSeconds: 15 * MINUTE
12475
+ };
12476
+ /** The limit of a device by type and role; the default when nothing narrower applies. */
12477
+ function switchRunLimitOf(deviceType, role) {
12478
+ if (deviceType === require_device_type.DeviceType.PetFountain) return SWITCH_RUN_PET_FOUNTAIN_LIMIT;
12479
+ if (role === require_device_type.DeviceRole.SwitchHeater) return SWITCH_RUN_HEATER_LIMIT;
12480
+ if (role === require_device_type.DeviceRole.Siren) return SWITCH_RUN_SIREN_LIMIT;
12481
+ return SWITCH_RUN_DEFAULT_LIMIT;
12482
+ }
12483
+ //#endregion
12427
12484
  //#region ../types/dist/esm/capabilities/timed-run.cap.mjs
12428
12485
  /**
12429
12486
  * timed-run - run a device for a chosen time, then stop it (D993).
@@ -12447,16 +12504,16 @@ var TimedRunUnitSchema = /* @__PURE__ */ zod.z.enum(["s", "min"]);
12447
12504
  /** A plug-in heater (switch + `switch-heater`): up to 3 h, in minutes. */
12448
12505
  var TIMED_RUN_HEATER_LIMIT = {
12449
12506
  actuator: "switch",
12450
- maxSeconds: 10800,
12507
+ maxSeconds: SWITCH_RUN_HEATER_LIMIT.maxSeconds,
12451
12508
  unit: "min",
12452
- quickRunDefault: 30
12509
+ quickRunDefault: SWITCH_RUN_HEATER_LIMIT.quickRunSeconds / 60
12453
12510
  };
12454
12511
  /** A pet fountain's pump: up to 5 min, in seconds. */
12455
12512
  var TIMED_RUN_PET_FOUNTAIN_LIMIT = {
12456
12513
  actuator: "pet-fountain",
12457
- maxSeconds: 300,
12514
+ maxSeconds: SWITCH_RUN_PET_FOUNTAIN_LIMIT.maxSeconds,
12458
12515
  unit: "s",
12459
- quickRunDefault: 60
12516
+ quickRunDefault: SWITCH_RUN_PET_FOUNTAIN_LIMIT.quickRunSeconds
12460
12517
  };
12461
12518
  /**
12462
12519
  * The device types `timed-run` may be offered on. A `switch` is narrowed by
@@ -12471,8 +12528,9 @@ var TIMED_RUN_DEVICE_ROLES = { [require_device_type.DeviceType.Switch]: [require
12471
12528
  * `null` - the device is not offered `timed-run`.
12472
12529
  */
12473
12530
  function timedRunLimitOf(deviceType, role) {
12474
- if (deviceType === require_device_type.DeviceType.PetFountain) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
12475
- if (deviceType === require_device_type.DeviceType.Switch && role === require_device_type.DeviceRole.SwitchHeater) return TIMED_RUN_HEATER_LIMIT;
12531
+ const limit = switchRunLimitOf(deviceType, role);
12532
+ if (deviceType === require_device_type.DeviceType.PetFountain && limit === SWITCH_RUN_PET_FOUNTAIN_LIMIT) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
12533
+ if (deviceType === require_device_type.DeviceType.Switch && role === require_device_type.DeviceRole.SwitchHeater && limit === SWITCH_RUN_HEATER_LIMIT) return TIMED_RUN_HEATER_LIMIT;
12476
12534
  return null;
12477
12535
  }
12478
12536
  var MS_PER_SECOND = 1e3;
@@ -29107,6 +29165,30 @@ var tagsCapability = {
29107
29165
  scope: "system",
29108
29166
  mode: "singleton",
29109
29167
  methods: {
29168
+ /** Create the tag named `name`, or return the one that has it (trimmed,
29169
+ * case-insensitive). A new tag gets a random id (D1089). */
29170
+ ensureTag: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ name: require_tag.TagNameSchema }), require_device_manager_cap.TagRecordSchema, {
29171
+ kind: "mutation",
29172
+ auth: "admin"
29173
+ }),
29174
+ /** Every tag record, sorted by `order` then name. */
29175
+ listTags: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.array(require_device_manager_cap.TagRecordSchema), { auth: "protected" }),
29176
+ /** ONE write to ONE record: rename, restyle, describe. No owner is rewritten
29177
+ * and none has to be reachable. A rename onto another tag's name is refused
29178
+ * (`tag-name-taken`). */
29179
+ updateTag: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
29180
+ id: /* @__PURE__ */ zod.z.string().min(1),
29181
+ patch: require_device_manager_cap.TagPatchSchema
29182
+ }), require_device_manager_cap.TagRecordSchema, {
29183
+ kind: "mutation",
29184
+ auth: "admin"
29185
+ }),
29186
+ /** Delete a tag and clear it from every owner (the one fan-out that remains).
29187
+ * Refused while an owner cannot be read, naming it. */
29188
+ deleteTag: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ id: /* @__PURE__ */ zod.z.string().min(1) }), /* @__PURE__ */ zod.z.object({ updated: TagUsageCountsSchema }), {
29189
+ kind: "mutation",
29190
+ auth: "admin"
29191
+ }),
29110
29192
  /**
29111
29193
  * Every tag: styled or in use, with how many records of each kind carry it.
29112
29194
  * An unreachable owner degrades that kind's count to `null`; the call still
@@ -29339,6 +29421,11 @@ var TimeWindowInputSchema = /* @__PURE__ */ zod.z.object({
29339
29421
  kind: /* @__PURE__ */ zod.z.literal("time-window"),
29340
29422
  ...inputBase
29341
29423
  });
29424
+ /** A limit on the state of a device (a derived "is night"); only a `gate` binding reads it. */
29425
+ var DeviceStateInputSchema = /* @__PURE__ */ zod.z.object({
29426
+ kind: /* @__PURE__ */ zod.z.literal("device-state"),
29427
+ ...inputBase
29428
+ });
29342
29429
  /**
29343
29430
  * A list of automation elements, verbatim: `trigger` entries are event leaves
29344
29431
  * of a `when` tree (`device-fired`), `step` entries are steps of a branch
@@ -29362,7 +29449,8 @@ var TemplateScalarInputSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind",
29362
29449
  TextInputSchema,
29363
29450
  SelectInputSchema,
29364
29451
  BooleanInputSchema,
29365
- TimeWindowInputSchema
29452
+ TimeWindowInputSchema,
29453
+ DeviceStateInputSchema
29366
29454
  ]);
29367
29455
  var groupBase = {
29368
29456
  kind: /* @__PURE__ */ zod.z.literal("group"),
@@ -29448,10 +29536,10 @@ var TemplateRowsBindingSchema = /* @__PURE__ */ zod.z.object({
29448
29536
  item: /* @__PURE__ */ zod.z.unknown(),
29449
29537
  bindings: /* @__PURE__ */ zod.z.array(TemplateRowItemBindingSchema).max(40)
29450
29538
  });
29451
- /** Wraps the condition tree at `path` as `all[time-is, <tree>]` when the input has a value. */
29539
+ /** Wraps the condition tree at `path` as `all[time-is | device-is, <tree>]` when the input has a value. */
29452
29540
  var TemplateGateBindingSchema = /* @__PURE__ */ zod.z.object({
29453
29541
  kind: /* @__PURE__ */ zod.z.literal("gate"),
29454
- /** A top-level `time-window` input. */
29542
+ /** A top-level `time-window` or `device-state` input. */
29455
29543
  input: inputKey,
29456
29544
  path: TemplatePathSchema
29457
29545
  });
@@ -29478,7 +29566,7 @@ function levelProblems(inputs, path, inRow = false) {
29478
29566
  issues.push(...levelProblems(input.inputs, path, true));
29479
29567
  continue;
29480
29568
  }
29481
- if (input.kind === "time-window" && inRow) issues.push({
29569
+ if ((input.kind === "time-window" || input.kind === "device-state") && inRow) issues.push({
29482
29570
  message: `time window "${input.key}" limits the whole automation: it is not a row input`,
29483
29571
  path
29484
29572
  });
@@ -29570,9 +29658,9 @@ function bindingProblems(payload, ctx) {
29570
29658
  path: ["bindings", index]
29571
29659
  });
29572
29660
  }
29573
- if (binding.kind === "gate" !== (input.kind === "time-window")) ctx.addIssue({
29661
+ if (binding.kind === "gate" !== (input.kind === "time-window" || input.kind === "device-state")) ctx.addIssue({
29574
29662
  code: "custom",
29575
- message: `a gate reads a time window and a time window is bound with a gate: "${input.key}" is ${input.kind}`,
29663
+ message: `a gate reads a time window or a device state, and those are bound with a gate: "${input.key}" is ${input.kind}`,
29576
29664
  path: ["bindings", index]
29577
29665
  });
29578
29666
  if (binding.kind === "rows") {
@@ -29626,6 +29714,10 @@ function valueProblem(input, value) {
29626
29714
  const parsed = require_core_blocks_cap.TemplateTimeWindowValueSchema.safeParse(value);
29627
29715
  return parsed.success ? null : parsed.error.issues[0]?.message ?? "pick a time window";
29628
29716
  }
29717
+ case "device-state": {
29718
+ const parsed = require_core_blocks_cap.TemplateDeviceStateValueSchema.safeParse(value);
29719
+ return parsed.success ? null : parsed.error.issues[0]?.message ?? "pick a device state";
29720
+ }
29629
29721
  case "entries": return entriesProblem(input, value);
29630
29722
  }
29631
29723
  }
@@ -29792,14 +29884,17 @@ function writeValue(root, binding, input, value) {
29792
29884
  }
29793
29885
  }
29794
29886
  /** The tree at the path, under an `all` beside the window. */
29795
- function writeGate(root, binding, value) {
29796
- const window = require_core_blocks_cap.TemplateTimeWindowValueSchema.parse(value);
29887
+ function writeGate(root, binding, inputKind, value) {
29888
+ const leaf = inputKind === "device-state" ? {
29889
+ kind: "device-is",
29890
+ ...require_core_blocks_cap.TemplateDeviceStateValueSchema.parse(value)
29891
+ } : {
29892
+ kind: "time-is",
29893
+ ...require_core_blocks_cap.TemplateTimeWindowValueSchema.parse(value)
29894
+ };
29797
29895
  return setAt(root, binding.path, {
29798
29896
  kind: "all",
29799
- children: [{
29800
- kind: "time-is",
29801
- ...window
29802
- }, getAt(root, binding.path)]
29897
+ children: [leaf, getAt(root, binding.path)]
29803
29898
  });
29804
29899
  }
29805
29900
  /** The name a row is known by: `buttons-0`, and `buttons-0-events-1` for a nested row. */
@@ -29911,7 +30006,11 @@ function expandAutomationTemplate(payload, values) {
29911
30006
  if (list.success) body = appendAt(body, binding.path, list.data, input.key);
29912
30007
  continue;
29913
30008
  }
29914
- body = binding.kind === "gate" ? writeGate(body, binding, value) : writeValue(body, binding, input, value);
30009
+ if (binding.kind === "gate") {
30010
+ if (input.kind === "time-window" || input.kind === "device-state") body = writeGate(body, binding, input.kind, value);
30011
+ continue;
30012
+ }
30013
+ body = writeValue(body, binding, input, value);
29915
30014
  }
29916
30015
  } catch (error) {
29917
30016
  if (!(error instanceof PathError)) throw error;
@@ -30024,7 +30123,9 @@ var TemplateRecordSchema = /* @__PURE__ */ zod.z.object({
30024
30123
  /** Shipped with CamStack (`builtin:` ids): listed beside the operator's, never updated or deleted. */
30025
30124
  builtIn: /* @__PURE__ */ zod.z.literal(true).optional(),
30026
30125
  /** Operator tags (D1054). Absent = no tags. */
30027
- tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional()
30126
+ tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
30127
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
30128
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional()
30028
30129
  });
30029
30130
  var TemplateWriteResultSchema = /* @__PURE__ */ zod.z.discriminatedUnion("status", [/* @__PURE__ */ zod.z.object({
30030
30131
  status: /* @__PURE__ */ zod.z.literal("saved"),