@camstack/server 1.2.945 → 1.2.946

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 (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +9 -11
  3. package/system/dist/builtins/alerts/alerts.addon.js +2 -2
  4. package/system/dist/builtins/alerts/alerts.addon.mjs +2 -2
  5. package/system/dist/builtins/camera-grid/index.js +1 -1
  6. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  7. package/system/dist/builtins/composer/composer.addon.js +4 -4
  8. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  9. package/system/dist/builtins/core-blocks/core-blocks.addon.js +67 -22
  10. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +67 -22
  11. package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +19 -2
  12. package/system/dist/builtins/device-manager/device-manager.addon.js +8 -7
  13. package/system/dist/builtins/device-manager/device-manager.addon.mjs +8 -7
  14. package/system/dist/builtins/local-auth/local-auth.addon.js +1 -1
  15. package/system/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  16. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  17. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  18. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  19. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  20. package/system/dist/{compile-SpeAhaZ6.js → compile-BpAtMSvc.js} +1 -1
  21. package/system/dist/{compile-OBMHlqD-.mjs → compile-DPGk4aRg.mjs} +1 -1
  22. package/system/dist/{composition-sources-DubMf_ii.mjs → composition-sources-D5bWS3nC.mjs} +2 -2
  23. package/system/dist/{composition-sources-D1nPv7dJ.js → composition-sources-hmri4Cu4.js} +2 -2
  24. package/system/dist/{core-blocks.cap-DEYCvF9J.js → core-blocks.cap-9xvotd_3.js} +2 -2
  25. package/system/dist/{core-blocks.cap-sW5HLDlB.mjs → core-blocks.cap-C6REo0Dd.mjs} +2 -2
  26. package/system/dist/{device-kind-C37Ra2wd.mjs → device-kind-B6G_HfgC.mjs} +19 -2
  27. package/system/dist/{device-kind-FMhJg8uC.js → device-kind-B7ESmha7.js} +24 -1
  28. package/system/dist/file-host-worker.js +1 -1
  29. package/system/dist/file-host-worker.mjs +1 -1
  30. package/system/dist/index.js +3 -3
  31. package/system/dist/index.mjs +3 -3
  32. package/system/dist/{named-entity-store-O_hi1y_o.js → named-entity-store-CzJ28TsK.js} +2 -2
  33. package/system/dist/{named-entity-store-Cq2oVrN5.mjs → named-entity-store-DJxyweoS.mjs} +2 -2
  34. package/system/dist/{record-kinds-BV8Gcpsx.js → record-kinds-DP2-HG3W.js} +1 -1
  35. package/system/dist/{record-kinds-BD2xv4Pd.mjs → record-kinds-WosKAa-D.mjs} +1 -1
  36. package/system/dist/{rename-composition-block-C60O0P16.js → rename-composition-block--abG_xyW.js} +27 -35
  37. package/system/dist/{rename-composition-block-DcX3vkwS.mjs → rename-composition-block-kmkoIx0R.mjs} +27 -35
  38. package/system/dist/{user-management.cap-4IEUCSdL.mjs → user-management.cap-C3eqqVdz.mjs} +1 -1
  39. package/system/dist/{user-management.cap-DV9Jfsj3.js → user-management.cap-D4r3UKtG.js} +1 -1
  40. package/system/dist/{wal-maintenance-CkPfVApC.js → wal-maintenance-CZKvoKfx.js} +0 -0
  41. package/system/dist/{wal-maintenance-u84_1sVl.mjs → wal-maintenance-WLoThDXX.mjs} +0 -0
  42. package/system/package.json +1 -1
@@ -6,23 +6,23 @@ const require_chunk = require("../../chunk-Cek0wNdY.js");
6
6
  const require_stream_catalog_cap = require("../../stream-catalog.cap-7WPsugOy.js");
7
7
  const require_base_addon = require("../../base-addon-BG7p06Hb.js");
8
8
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
9
- const require_rename_composition_block = require("../../rename-composition-block-C60O0P16.js");
9
+ const require_rename_composition_block = require("../../rename-composition-block--abG_xyW.js");
10
10
  const require_camstack_error = require("../../camstack-error-DJ-TUAi1.js");
11
11
  const require_capability_definition = require("../../capability-definition-BEVd01Xj.js");
12
12
  const require_zod_secret = require("../../zod-secret-DS7mj1bk.js");
13
13
  const require_device_manager_cap = require("../../device-manager.cap-B9qVf7ag.js");
14
14
  const require_device_identifiers = require("../../device-identifiers-BQg9EQi1.js");
15
- const require_record_kinds = require("../../record-kinds-BV8Gcpsx.js");
15
+ const require_record_kinds = require("../../record-kinds-DP2-HG3W.js");
16
16
  const require_migration = require("../../migration-CHPdAdNh.js");
17
17
  const require_tag = require("../../tag-BLraBqvp.js");
18
18
  const require_device_type = require("../../device-type-Cnc0NiSX.js");
19
- const require_device_kind = require("../../device-kind-FMhJg8uC.js");
20
- const require_core_blocks_cap = require("../../core-blocks.cap-DEYCvF9J.js");
19
+ const require_device_kind = require("../../device-kind-B7ESmha7.js");
20
+ const require_core_blocks_cap = require("../../core-blocks.cap-9xvotd_3.js");
21
21
  const require_action_index = require("../../action-index-Bcnb-jyg.js");
22
22
  const require_addon_settings_cap = require("../../addon-settings.cap-nZVHPo3X.js");
23
- require("../../compile-SpeAhaZ6.js");
23
+ require("../../compile-BpAtMSvc.js");
24
24
  const require_source_info = require("../../source-info-DtWf4k2j.js");
25
- const require_named_entity_store = require("../../named-entity-store-O_hi1y_o.js");
25
+ const require_named_entity_store = require("../../named-entity-store-CzJ28TsK.js");
26
26
  const require_command_catalog = require("../../command-catalog-A_ONlLfF.js");
27
27
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
28
28
  const require_log_redactor = require("../../log-redactor-BhIEMaG9.js");
@@ -14898,6 +14898,7 @@ async function resolveBindingsForDevice(deps, deviceId, row, pass) {
14898
14898
  else if (deps.capabilityRegistry) {
14899
14899
  const skippedForType = [];
14900
14900
  const skippedSystem = [];
14901
+ const hasBound = (companion) => entries.some((entry) => entry.capName === companion) || deps.capabilityRegistry?.getNativeAddonId(companion, deviceId) != null || resolveRemote(companion) !== null;
14901
14902
  for (const capName of deps.capabilityRegistry.getCapsWithDefaultWrapper()) {
14902
14903
  if (seenCaps.has(capName)) continue;
14903
14904
  const definition = deps.capabilityRegistry.getDefinition(capName);
@@ -14905,7 +14906,7 @@ async function resolveBindingsForDevice(deps, deviceId, row, pass) {
14905
14906
  skippedSystem.push(capName);
14906
14907
  continue;
14907
14908
  }
14908
- if (!capAppliesToDeviceType(definition, deviceType, deviceRole)) {
14909
+ if (!require_device_kind.capAdmitsDevice(definition, deviceType, deviceRole, hasBound)) {
14909
14910
  skippedForType.push(capName);
14910
14911
  continue;
14911
14912
  }
@@ -1,23 +1,23 @@
1
1
  import { E as deviceStatusCapability, T as DeviceStatusSchema } from "../../stream-catalog.cap-CzwRDaqT.mjs";
2
2
  import { b as EventCategory$1, f as defineAddonMigrations, g as WELL_KNOWN_TAB_MAP, n as secretTreeFromPaths, o as resolveSecretMarkers, s as transformSecretWrite, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
3
3
  import { B as SECRET_CLEAR, G as isSecretMarkerLike, H as isSecretClear, K as makeSecretMarker, W as isSecretMarker, X as isKeychainStoredField, Z as errMsg$1, b as buildSecretRef, q as toSecretFieldView, w as parseSecretRef } from "../../scoped-settings-DVWUIP7Z.mjs";
4
- import { Jn as ExportNameRefusedError, _n as deviceStateCapability, b as workloadTransition, c as kebabToCamel, fn as PUSH_CONFIRM_WINDOW_MS, g as WorkloadStateSchema, gn as FieldClaimSchema, h as WORKLOAD_TRANSITION_CATEGORY, hn as FieldClaimModeSchema, m as ALL_CAPABILITY_DEFINITIONS, mn as effectiveRefreshIntervalMs, n as renameCompositionBlock, pn as commandBurstOffsets, t as composedBlockIdOf, v as isWorkloadSettled, vn as deviceExtensionCapability, y as workloadCapability, yn as EXTENSION_SLOTS } from "../../rename-composition-block-DcX3vkwS.mjs";
4
+ import { Jn as ExportNameRefusedError, _n as deviceStateCapability, b as workloadTransition, c as kebabToCamel, fn as PUSH_CONFIRM_WINDOW_MS, g as WorkloadStateSchema, gn as FieldClaimSchema, h as WORKLOAD_TRANSITION_CATEGORY, hn as FieldClaimModeSchema, m as ALL_CAPABILITY_DEFINITIONS, mn as effectiveRefreshIntervalMs, n as renameCompositionBlock, pn as commandBurstOffsets, t as composedBlockIdOf, v as isWorkloadSettled, vn as deviceExtensionCapability, y as workloadCapability, yn as EXTENSION_SLOTS } from "../../rename-composition-block-kmkoIx0R.mjs";
5
5
  import { t as userError } from "../../camstack-error-viZYfcj9.mjs";
6
6
  import { a as expandCapMethods$1, s as isDeviceConfigCap } from "../../capability-definition-C1TLUVJR.mjs";
7
7
  import { t as collectZodSecretPaths$1 } from "../../zod-secret-zY4nM61M.mjs";
8
8
  import { C as generateDeviceAlias, S as checkDeviceAlias, _ as DEVICE_TEMPLATE_MAX_LENGTH, a as deviceManagerCapability, b as DEVICE_TEMPLATE_VALUES_CAP, d as ZoneBodySchema, g as DEVICE_TEMPLATE_FILTERS, h as identityLinkSidesRefusal, m as identityLinkId, s as RoomBodySchema, v as DEVICE_TEMPLATE_MAX_OUTPUT, x as resolveTemplateRef } from "../../device-manager.cap-CV4KGp3e.mjs";
9
9
  import { a as isEmptyIdentifiers, c as sameIdentifiers, i as identifierStrength, l as CAMERA_SWITCH_ORDER, o as mergeIdentifiers, r as DeviceIdentifiersSchema, t as DEVICE_IDENTIFIER_KEYS } from "../../device-identifiers-iSuQCKmK.mjs";
10
- import { a as deviceRowBackendOf, c as recordUpsertEdit, i as DeviceRowStore, n as DEVICE_ROWS_COLLECTION, o as MigrationRefusedError, r as DEVICE_ROWS_FLEET_LIMIT, t as deviceManagerRecordKinds } from "../../record-kinds-BD2xv4Pd.mjs";
10
+ import { a as deviceRowBackendOf, c as recordUpsertEdit, i as DeviceRowStore, n as DEVICE_ROWS_COLLECTION, o as MigrationRefusedError, r as DEVICE_ROWS_FLEET_LIMIT, t as deviceManagerRecordKinds } from "../../record-kinds-WosKAa-D.mjs";
11
11
  import { u as preconditionOf } from "../../migration-BvbfW9g-.mjs";
12
12
  import { f as canonicalIconKey, s as normalizeTags, u as tagKey } from "../../tag-DU8pm9Bi.mjs";
13
13
  import { n as DeviceRole, r as DeviceType$1, t as DeviceFeature } from "../../device-type-TUGqGmaI.mjs";
14
- import { n as capAppliesToDeviceKind } from "../../device-kind-C37Ra2wd.mjs";
15
- import { $ as CAP_RUNTIME_FIELD_UNITS, Xt as enumerateItemArrayFields, Zt as enumerateSchemaFields } from "../../core-blocks.cap-sW5HLDlB.mjs";
14
+ import { n as capAdmitsDevice, r as capAppliesToDeviceKind } from "../../device-kind-B6G_HfgC.mjs";
15
+ import { $ as CAP_RUNTIME_FIELD_UNITS, Xt as enumerateItemArrayFields, Zt as enumerateSchemaFields } from "../../core-blocks.cap-C6REo0Dd.mjs";
16
16
  import { c as CAP_VOCABULARY_BY_NAME, o as vocabActionIdFor } from "../../action-index-DwPHO2nz.mjs";
17
17
  import { u as locationIconKey } from "../../addon-settings.cap-CHpmuaQG.mjs";
18
- import "../../compile-OBMHlqD-.mjs";
18
+ import "../../compile-DPGk4aRg.mjs";
19
19
  import { a as normalizeUnit, r as extractSourceInfoFromMetadata } from "../../source-info-DGB7SdB_.mjs";
20
- import { a as loadPrefixed, c as roomIdFromKey, d as ConditionMirror, i as createWriteLock, l as tagIdFromKey, n as EntityNotFoundError, r as NamedEntityStore, s as entityNameKey, t as EntityNameTakenError, u as zoneIdFromKey } from "../../named-entity-store-Cq2oVrN5.mjs";
20
+ import { a as loadPrefixed, c as roomIdFromKey, d as ConditionMirror, i as createWriteLock, l as tagIdFromKey, n as EntityNotFoundError, r as NamedEntityStore, s as entityNameKey, t as EntityNameTakenError, u as zoneIdFromKey } from "../../named-entity-store-DJxyweoS.mjs";
21
21
  import { a as effectConditionHolds, i as commandHoldMs, n as commandEffect, o as isCommand$1, r as commandEffects, s as resolveSideEffect } from "../../command-catalog-CZDlLhxO.mjs";
22
22
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
23
23
  import { a as redactLogText, i as redactLogMeta, n as isSecretArgumentKey } from "../../log-redactor-XLDrPzOi.mjs";
@@ -14892,6 +14892,7 @@ async function resolveBindingsForDevice(deps, deviceId, row, pass) {
14892
14892
  else if (deps.capabilityRegistry) {
14893
14893
  const skippedForType = [];
14894
14894
  const skippedSystem = [];
14895
+ const hasBound = (companion) => entries.some((entry) => entry.capName === companion) || deps.capabilityRegistry?.getNativeAddonId(companion, deviceId) != null || resolveRemote(companion) !== null;
14895
14896
  for (const capName of deps.capabilityRegistry.getCapsWithDefaultWrapper()) {
14896
14897
  if (seenCaps.has(capName)) continue;
14897
14898
  const definition = deps.capabilityRegistry.getDefinition(capName);
@@ -14899,7 +14900,7 @@ async function resolveBindingsForDevice(deps, deviceId, row, pass) {
14899
14900
  skippedSystem.push(capName);
14900
14901
  continue;
14901
14902
  }
14902
- if (!capAppliesToDeviceType(definition, deviceType, deviceRole)) {
14903
+ if (!capAdmitsDevice(definition, deviceType, deviceRole, hasBound)) {
14903
14904
  skippedForType.push(capName);
14904
14905
  continue;
14905
14906
  }
@@ -7,7 +7,7 @@ const require_base_addon = require("../../base-addon-BG7p06Hb.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_camstack_error = require("../../camstack-error-DJ-TUAi1.js");
9
9
  const require_record_kind = require("../../record-kind-DoBfYHCs.js");
10
- const require_user_management_cap = require("../../user-management.cap-DV9Jfsj3.js");
10
+ const require_user_management_cap = require("../../user-management.cap-D4r3UKtG.js");
11
11
  const require_device_certificate = require("../../device-certificate-CguVACQO.js");
12
12
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
13
13
  const require_ms$1 = require("../../ms-LB3giGoU.js");
@@ -3,7 +3,7 @@ import { t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
3
3
  import { K as makeSecretMarker, W as isSecretMarker } from "../../scoped-settings-DVWUIP7Z.mjs";
4
4
  import { t as userError } from "../../camstack-error-viZYfcj9.mjs";
5
5
  import { s as defineRecordKinds } from "../../record-kind-ub6NXqfh.mjs";
6
- import { a as authProviderCapability, c as TokenScopeSchema, i as deviceCredentialsCapability, l as UserRecordSchema, n as SsoBridgeClaimsSchema, o as MethodAccessSchema, s as ScopedTokenSchema, t as userManagementCapability, u as ViewerTokenScopeSchema } from "../../user-management.cap-4IEUCSdL.mjs";
6
+ import { a as authProviderCapability, c as TokenScopeSchema, i as deviceCredentialsCapability, l as UserRecordSchema, n as SsoBridgeClaimsSchema, o as MethodAccessSchema, s as ScopedTokenSchema, t as userManagementCapability, u as ViewerTokenScopeSchema } from "../../user-management.cap-C3eqqVdz.mjs";
7
7
  import { c as buildDeviceEnrollmentLink, l as buildDeviceSignatureMessage, n as DEVICE_NONCE_TTL_MS, t as DEVICE_ENROLLMENT_TTL_MS, u as formatDeviceRevoker } from "../../device-certificate-Cddm4Idn.mjs";
8
8
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
9
9
  import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_wal_maintenance = require("../../wal-maintenance-CkPfVApC.js");
6
+ const require_wal_maintenance = require("../../wal-maintenance-CZKvoKfx.js");
7
7
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
8
8
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
9
9
  //#region src/builtins/sqlite-storage/config-store.ts
@@ -1,4 +1,4 @@
1
- import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-u84_1sVl.mjs";
1
+ import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-WLoThDXX.mjs";
2
2
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
@@ -6,7 +6,7 @@ const require_chunk = require("../../chunk-Cek0wNdY.js");
6
6
  const require_base_addon = require("../../base-addon-BG7p06Hb.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_record_kind = require("../../record-kind-DoBfYHCs.js");
9
- const require_wal_maintenance = require("../../wal-maintenance-CkPfVApC.js");
9
+ const require_wal_maintenance = require("../../wal-maintenance-CZKvoKfx.js");
10
10
  const require_settings_store_cap = require("../../settings-store.cap-BhOIBtO4.js");
11
11
  const require_migration = require("../../migration-CHPdAdNh.js");
12
12
  const require_database_snapshot_cap = require("../../database-snapshot.cap-BNS5c60M.js");
@@ -1,7 +1,7 @@
1
1
  import { b as EventCategory, i as collectSecretMarkerRefs, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
2
2
  import { A as NoCallerError, C as normalizeSecretOwner, E as DeclarationRefusedError, L as TransactRefusedError, Z as errMsg$1, k as InvalidRecordError, v as RECORD_SWEEP_INTERVAL_MS, z as UnknownRecordKindError } from "../../scoped-settings-DVWUIP7Z.mjs";
3
3
  import { n as RecordKindDeclarationSchema } from "../../record-kind-ub6NXqfh.mjs";
4
- import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-u84_1sVl.mjs";
4
+ import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-WLoThDXX.mjs";
5
5
  import { i as DATA_STORE_DATABASES } from "../../settings-store.cap-CaDSOqgK.mjs";
6
6
  import { c as catalogueIssues, l as orderMigrations, r as MigrationMetaSchema } from "../../migration-BvbfW9g-.mjs";
7
7
  import { a as databaseSnapshotCapability, i as DATABASE_SNAPSHOT_TIMEOUT_MS, n as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, r as DATABASE_SNAPSHOT_SUFFIX } from "../../database-snapshot.cap-a3lSf4hl.mjs";
@@ -1,7 +1,7 @@
1
1
  const require_capability_definition = require("./capability-definition-BEVd01Xj.js");
2
2
  const require_quantity = require("./quantity-lY1KiTSZ.js");
3
3
  const require_device_type = require("./device-type-Cnc0NiSX.js");
4
- const require_device_kind = require("./device-kind-FMhJg8uC.js");
4
+ const require_device_kind = require("./device-kind-B7ESmha7.js");
5
5
  const require_history_catalog = require("./history-catalog-CiTMP3-E.js");
6
6
  let zod = require("zod");
7
7
  //#region ../types/dist/esm/catalogs/sensor-active-state.mjs
@@ -1,7 +1,7 @@
1
1
  import { c as method } from "./capability-definition-C1TLUVJR.mjs";
2
2
  import { n as baseUnitOf } from "./quantity-D3g5SxsZ.mjs";
3
3
  import { n as DeviceRole, r as DeviceType, t as DeviceFeature } from "./device-type-TUGqGmaI.mjs";
4
- import { t as canonicalStoredDeviceType } from "./device-kind-C37Ra2wd.mjs";
4
+ import { t as canonicalStoredDeviceType } from "./device-kind-B6G_HfgC.mjs";
5
5
  import { a as wattMillisecondsToKwh, i as historyFieldsFor } from "./history-catalog-A_dzXNpv.mjs";
6
6
  import { z } from "zod";
7
7
  //#region ../types/dist/esm/catalogs/sensor-active-state.mjs
@@ -1,6 +1,6 @@
1
1
  import { Z as errMsg } from "./scoped-settings-DVWUIP7Z.mjs";
2
- import { Q as CAP_CUSTOMIZE_CATALOG } from "./core-blocks.cap-sW5HLDlB.mjs";
3
- import { A as compositionSourceKey, a as isIdentifier, c as signedToken, i as dwellExpr, l as unsignedToken, o as linearExpr, r as constantExpr, s as overrideExpr } from "./compile-OBMHlqD-.mjs";
2
+ import { Q as CAP_CUSTOMIZE_CATALOG } from "./core-blocks.cap-C6REo0Dd.mjs";
3
+ import { A as compositionSourceKey, a as isIdentifier, c as signedToken, i as dwellExpr, l as unsignedToken, o as linearExpr, r as constantExpr, s as overrideExpr } from "./compile-DPGk4aRg.mjs";
4
4
  //#region ../types/dist/esm/composition/customize/field-source.mjs
5
5
  function fromRead(source, cap, fieldPath) {
6
6
  return {
@@ -1,6 +1,6 @@
1
1
  const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
2
- const require_core_blocks_cap = require("./core-blocks.cap-DEYCvF9J.js");
3
- const require_compile = require("./compile-SpeAhaZ6.js");
2
+ const require_core_blocks_cap = require("./core-blocks.cap-9xvotd_3.js");
3
+ const require_compile = require("./compile-BpAtMSvc.js");
4
4
  //#region ../types/dist/esm/composition/customize/field-source.mjs
5
5
  function fromRead(source, cap, fieldPath) {
6
6
  return {
@@ -5,10 +5,10 @@ const require_system_reasons = require("./system-reasons-Be_k1W8g.js");
5
5
  const require_quantity = require("./quantity-lY1KiTSZ.js");
6
6
  const require_tag = require("./tag-BLraBqvp.js");
7
7
  const require_device_type = require("./device-type-Cnc0NiSX.js");
8
- const require_device_kind = require("./device-kind-FMhJg8uC.js");
8
+ const require_device_kind = require("./device-kind-B7ESmha7.js");
9
9
  const require_action_index = require("./action-index-Bcnb-jyg.js");
10
10
  const require_addon_settings_cap = require("./addon-settings.cap-nZVHPo3X.js");
11
- const require_compile = require("./compile-SpeAhaZ6.js");
11
+ const require_compile = require("./compile-BpAtMSvc.js");
12
12
  const require_time_window = require("./time-window-B6UhCArd.js");
13
13
  const require_source_info = require("./source-info-DtWf4k2j.js");
14
14
  const require_l10n = require("./l10n-CGMvp7NF.js");
@@ -5,10 +5,10 @@ import { t as NOT_A_DEVICE } from "./system-reasons-CYj4qwyS.mjs";
5
5
  import { a as readingMeta, i as isReadingQuantity, n as baseUnitOf, t as ReadingQuantitySchema } from "./quantity-D3g5SxsZ.mjs";
6
6
  import { a as TagsFieldSchema, n as TagIdsFieldSchema } from "./tag-DU8pm9Bi.mjs";
7
7
  import { r as DeviceType } from "./device-type-TUGqGmaI.mjs";
8
- import { i as isSwitchLight, t as canonicalStoredDeviceType } from "./device-kind-C37Ra2wd.mjs";
8
+ import { a as isSwitchLight, t as canonicalStoredDeviceType } from "./device-kind-B6G_HfgC.mjs";
9
9
  import { a as findVocabAction, n as actionEffect } from "./action-index-DwPHO2nz.mjs";
10
10
  import { a as tryConvertUnit, n as SettingsSchemaWithValuesSchema, o as unitDimension, r as SettingsUpdateResultSchema, t as SettingsPatchSchema, u as locationIconKey } from "./addon-settings.cap-CHpmuaQG.mjs";
11
- import { A as compositionSourceKey, B as CompositionSourceRefSchema, D as compositionItemFieldPath, E as compositionFeatureEnabled, F as COMPOSED_DEVICE_STABLE_ID_PREFIX, M as featureSources, N as fieldReads, O as compositionReadKey, P as isForwardInputRef, S as CompositionSchema, _ as refused, b as CompositionFieldReadSchema, dt as compileExpressionSafe, ft as EXPRESSION_IDENTIFIER_RE, g as problem, h as compositionFieldAt, j as featureFieldEntries, m as groupTemplate, mt as EXPRESSION_BUILTINS, n as sameHelperBody, pt as MAX_EXPRESSION_SOURCE_LENGTH, t as compileHelper, ut as validateExpressionSource, v as COMPOSER_ADDON_ID, w as composedDeviceRef, x as CompositionFieldSourceSchema, y as COMPOSITION_ITEM_ARRAY_PATH } from "./compile-OBMHlqD-.mjs";
11
+ import { A as compositionSourceKey, B as CompositionSourceRefSchema, D as compositionItemFieldPath, E as compositionFeatureEnabled, F as COMPOSED_DEVICE_STABLE_ID_PREFIX, M as featureSources, N as fieldReads, O as compositionReadKey, P as isForwardInputRef, S as CompositionSchema, _ as refused, b as CompositionFieldReadSchema, dt as compileExpressionSafe, ft as EXPRESSION_IDENTIFIER_RE, g as problem, h as compositionFieldAt, j as featureFieldEntries, m as groupTemplate, mt as EXPRESSION_BUILTINS, n as sameHelperBody, pt as MAX_EXPRESSION_SOURCE_LENGTH, t as compileHelper, ut as validateExpressionSource, v as COMPOSER_ADDON_ID, w as composedDeviceRef, x as CompositionFieldSourceSchema, y as COMPOSITION_ITEM_ARRAY_PATH } from "./compile-DPGk4aRg.mjs";
12
12
  import { c as WeekdayKeySchema, m as validateTimeSpecForSite, n as TimeWindowSchema, o as refineTimeWindow, r as expandTimeWindowPreset, s as TimeSpecSchema, t as TimeWindowObjectSchema } from "./time-window-BnUBULgu.mjs";
13
13
  import { a as normalizeUnit } from "./source-info-DGB7SdB_.mjs";
14
14
  import { t } from "./l10n-Bu6aUvSY.mjs";
@@ -62,7 +62,8 @@ function isSwitchLight(type, role) {
62
62
  *
63
63
  * Fails open where the old type-only gate did: no `deviceTypes` (or an empty
64
64
  * list) applies to every device, and an unknown type never filters (a failed
65
- * meta read must not destroy work, D49). A type the cap's `deviceRoles` names
65
+ * meta read must not destroy work, D49). A cap that declares `bindsWhenDeviceHas`
66
+ * does NOT use this gate: `capAdmitsDevice` does, and it never fails open. A type the cap's `deviceRoles` names
66
67
  * is offered only to the roles listed there; an unknown role is NOT one of
67
68
  * them, so a `switch` whose role could not be read is not a heater.
68
69
  */
@@ -76,5 +77,21 @@ function capAppliesToDeviceKind(gate, deviceType, role) {
76
77
  if (roles === void 0) return true;
77
78
  return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
78
79
  }
80
+ /**
81
+ * Is a capability offered on this device, by its kind OR by a cap it has (D1097)?
82
+ *
83
+ * Without `bindsWhenDeviceHas` this is exactly {@link capAppliesToDeviceKind}. With
84
+ * it, a device that has one of the named caps is admitted whatever its type, and
85
+ * otherwise only a KNOWN type that `deviceTypes` names is: the fail-open of an
86
+ * unresolved type does not apply, because "has a switch" is the rule and an
87
+ * unresolved type must not conjure a cap onto a device that has none.
88
+ */
89
+ function capAdmitsDevice(gate, deviceType, role, hasCap) {
90
+ const companions = gate?.bindsWhenDeviceHas;
91
+ if (companions === void 0 || companions.length === 0) return capAppliesToDeviceKind(gate, deviceType, role);
92
+ if (companions.some(hasCap)) return true;
93
+ if (deviceType === void 0 || (gate?.deviceTypes?.length ?? 0) === 0) return false;
94
+ return capAppliesToDeviceKind(gate, deviceType, role);
95
+ }
79
96
  //#endregion
80
- export { isSwitchLight as i, capAppliesToDeviceKind as n, isAirConditioner as r, canonicalStoredDeviceType as t };
97
+ export { isSwitchLight as a, isAirConditioner as i, capAdmitsDevice as n, capAppliesToDeviceKind as r, canonicalStoredDeviceType as t };
@@ -62,7 +62,8 @@ function isSwitchLight(type, role) {
62
62
  *
63
63
  * Fails open where the old type-only gate did: no `deviceTypes` (or an empty
64
64
  * list) applies to every device, and an unknown type never filters (a failed
65
- * meta read must not destroy work, D49). A type the cap's `deviceRoles` names
65
+ * meta read must not destroy work, D49). A cap that declares `bindsWhenDeviceHas`
66
+ * does NOT use this gate: `capAdmitsDevice` does, and it never fails open. A type the cap's `deviceRoles` names
66
67
  * is offered only to the roles listed there; an unknown role is NOT one of
67
68
  * them, so a `switch` whose role could not be read is not a heater.
68
69
  */
@@ -76,6 +77,22 @@ function capAppliesToDeviceKind(gate, deviceType, role) {
76
77
  if (roles === void 0) return true;
77
78
  return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
78
79
  }
80
+ /**
81
+ * Is a capability offered on this device, by its kind OR by a cap it has (D1097)?
82
+ *
83
+ * Without `bindsWhenDeviceHas` this is exactly {@link capAppliesToDeviceKind}. With
84
+ * it, a device that has one of the named caps is admitted whatever its type, and
85
+ * otherwise only a KNOWN type that `deviceTypes` names is: the fail-open of an
86
+ * unresolved type does not apply, because "has a switch" is the rule and an
87
+ * unresolved type must not conjure a cap onto a device that has none.
88
+ */
89
+ function capAdmitsDevice(gate, deviceType, role, hasCap) {
90
+ const companions = gate?.bindsWhenDeviceHas;
91
+ if (companions === void 0 || companions.length === 0) return capAppliesToDeviceKind(gate, deviceType, role);
92
+ if (companions.some(hasCap)) return true;
93
+ if (deviceType === void 0 || (gate?.deviceTypes?.length ?? 0) === 0) return false;
94
+ return capAppliesToDeviceKind(gate, deviceType, role);
95
+ }
79
96
  //#endregion
80
97
  Object.defineProperty(exports, "canonicalStoredDeviceType", {
81
98
  enumerable: true,
@@ -83,6 +100,12 @@ Object.defineProperty(exports, "canonicalStoredDeviceType", {
83
100
  return canonicalStoredDeviceType;
84
101
  }
85
102
  });
103
+ Object.defineProperty(exports, "capAdmitsDevice", {
104
+ enumerable: true,
105
+ get: function() {
106
+ return capAdmitsDevice;
107
+ }
108
+ });
86
109
  Object.defineProperty(exports, "capAppliesToDeviceKind", {
87
110
  enumerable: true,
88
111
  get: function() {
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-CkPfVApC.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-CZKvoKfx.js");
3
3
  let node_worker_threads = require("node:worker_threads");
4
4
  //#region src/builtins/sqlite-storage/file-host-worker.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-u84_1sVl.mjs";
1
+ import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-WLoThDXX.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**
@@ -2,14 +2,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
3
  const require_base_addon = require("./base-addon-BG7p06Hb.js");
4
4
  const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
5
- const require_rename_composition_block = require("./rename-composition-block-C60O0P16.js");
5
+ const require_rename_composition_block = require("./rename-composition-block--abG_xyW.js");
6
6
  const require_camstack_error = require("./camstack-error-DJ-TUAi1.js");
7
7
  const require_capability_definition = require("./capability-definition-BEVd01Xj.js");
8
8
  const require_record_kind = require("./record-kind-DoBfYHCs.js");
9
- const require_wal_maintenance = require("./wal-maintenance-CkPfVApC.js");
9
+ const require_wal_maintenance = require("./wal-maintenance-CZKvoKfx.js");
10
10
  const require_device_certificate = require("./device-certificate-CguVACQO.js");
11
11
  const require_addon_settings_cap = require("./addon-settings.cap-nZVHPo3X.js");
12
- const require_named_entity_store = require("./named-entity-store-O_hi1y_o.js");
12
+ const require_named_entity_store = require("./named-entity-store-CzJ28TsK.js");
13
13
  const require_network_access_cap = require("./network-access.cap-CTQ2WQoi.js");
14
14
  const require_constants = require("./constants-C860Y6U4.js");
15
15
  const require_addon_id = require("./addon-id-Di0lNJ89.js");
@@ -1,14 +1,14 @@
1
1
  import { i as __require } from "./chunk-CNf5ZN-e.mjs";
2
2
  import { b as EventCategory$1, i as collectSecretMarkerRefs, p as createEvent$1 } from "./base-addon-BcVoYZbC.mjs";
3
3
  import { Z as errMsg$1 } from "./scoped-settings-DVWUIP7Z.mjs";
4
- import { Un as lifecycleJobSchema, a as isCollectionArrayMethod, c as kebabToCamel$1, d as objectInputDeclaresRequiredDeviceId, dr as compareVersions, f as procedureAuthKey, fr as describeUnmet, i as isArrayOutputSchema, l as looseSchema, m as ALL_CAPABILITY_DEFINITIONS, o as isObjectInput, p as resolveMethodAuth, pr as unmetRequirements, r as extractNestedAddonId, s as isVoidInput, u as objectInputDeclaresAddonId, ur as PackageRequiresSchema } from "./rename-composition-block-DcX3vkwS.mjs";
4
+ import { Un as lifecycleJobSchema, a as isCollectionArrayMethod, c as kebabToCamel$1, d as objectInputDeclaresRequiredDeviceId, dr as compareVersions, f as procedureAuthKey, fr as describeUnmet, i as isArrayOutputSchema, l as looseSchema, m as ALL_CAPABILITY_DEFINITIONS, o as isObjectInput, p as resolveMethodAuth, pr as unmetRequirements, r as extractNestedAddonId, s as isVoidInput, u as objectInputDeclaresAddonId, ur as PackageRequiresSchema } from "./rename-composition-block-kmkoIx0R.mjs";
5
5
  import { t as userError } from "./camstack-error-viZYfcj9.mjs";
6
6
  import { a as expandCapMethods, n as DEVICE_STATUS_METHOD, t as DEVICE_SETTINGS_CONTRIBUTION_METHODS, u as resolveCapMount } from "./capability-definition-C1TLUVJR.mjs";
7
7
  import { s as defineRecordKinds } from "./record-kind-ub6NXqfh.mjs";
8
- import { D as RecordsEngine, J as asNumber, X as parseJsonObject, Y as asString$1, Z as parseJsonUnknown, l as SqliteSettingsBackend, q as asJsonObject$1 } from "./wal-maintenance-u84_1sVl.mjs";
8
+ import { D as RecordsEngine, J as asNumber, X as parseJsonObject, Y as asString$1, Z as parseJsonUnknown, l as SqliteSettingsBackend, q as asJsonObject$1 } from "./wal-maintenance-WLoThDXX.mjs";
9
9
  import { f as AppPageLangSchema } from "./device-certificate-Cddm4Idn.mjs";
10
10
  import { i as addonSettingsCapability } from "./addon-settings.cap-CHpmuaQG.mjs";
11
- import { a as loadPrefixed } from "./named-entity-store-Cq2oVrN5.mjs";
11
+ import { a as loadPrefixed } from "./named-entity-store-DJxyweoS.mjs";
12
12
  import { a as AGENT_MDNS_TXT_KEYS, i as AGENT_MDNS_SERVICE_TYPE } from "./network-access.cap-Dx5K0I5i.mjs";
13
13
  import { t as RUNTIME_DEFAULTS } from "./constants-DCLpoF4L.mjs";
14
14
  import { t as bareAddonId } from "./addon-id-CVg1_r5E.mjs";
@@ -1,5 +1,5 @@
1
- const require_core_blocks_cap = require("./core-blocks.cap-DEYCvF9J.js");
2
- const require_compile = require("./compile-SpeAhaZ6.js");
1
+ const require_core_blocks_cap = require("./core-blocks.cap-9xvotd_3.js");
2
+ const require_compile = require("./compile-BpAtMSvc.js");
3
3
  const require_time_window = require("./time-window-B6UhCArd.js");
4
4
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
5
5
  const require_prefix_range = require("./prefix-range-D_KueXbQ.js");
@@ -1,5 +1,5 @@
1
- import { Ft as forEachLeaf, Ht as faultMatches, Lt as isEventLeaf, Pt as eventLeafIdAt, Rt as compareValues, Ut as readFault, Vt as describeWantedFaults, Wt as anySubjectMatches, qt as isQuantityValue, zt as describeHoldMs } from "./core-blocks.cap-sW5HLDlB.mjs";
2
- import { lt as toExpressionValue, st as evaluateExpressionSource } from "./compile-OBMHlqD-.mjs";
1
+ import { Ft as forEachLeaf, Ht as faultMatches, Lt as isEventLeaf, Pt as eventLeafIdAt, Rt as compareValues, Ut as readFault, Vt as describeWantedFaults, Wt as anySubjectMatches, qt as isQuantityValue, zt as describeHoldMs } from "./core-blocks.cap-C6REo0Dd.mjs";
2
+ import { lt as toExpressionValue, st as evaluateExpressionSource } from "./compile-DPGk4aRg.mjs";
3
3
  import { a as judgeTimeWindow } from "./time-window-BnUBULgu.mjs";
4
4
  import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
5
5
  import { t as prefixRange } from "./prefix-range-Dl0znowN.mjs";
@@ -3,7 +3,7 @@ const require_record_kind = require("./record-kind-DoBfYHCs.js");
3
3
  const require_device_manager_cap = require("./device-manager.cap-B9qVf7ag.js");
4
4
  const require_device_identifiers = require("./device-identifiers-BQg9EQi1.js");
5
5
  const require_migration = require("./migration-CHPdAdNh.js");
6
- const require_device_kind = require("./device-kind-FMhJg8uC.js");
6
+ const require_device_kind = require("./device-kind-B7ESmha7.js");
7
7
  //#region ../types/dist/esm/records/records-access.mjs
8
8
  function isRecord(value) {
9
9
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -3,7 +3,7 @@ import { s as defineRecordKinds } from "./record-kind-ub6NXqfh.mjs";
3
3
  import { d as ZoneBodySchema, n as DeviceTombstoneSchema, o as DiscoveryProposalBodySchema, p as IdentityLinkBodySchema, s as RoomBodySchema } from "./device-manager.cap-CV4KGp3e.mjs";
4
4
  import { n as DeviceIdentifierKeySchema, r as DeviceIdentifiersSchema } from "./device-identifiers-iSuQCKmK.mjs";
5
5
  import { u as preconditionOf } from "./migration-BvbfW9g-.mjs";
6
- import { t as canonicalStoredDeviceType } from "./device-kind-C37Ra2wd.mjs";
6
+ import { t as canonicalStoredDeviceType } from "./device-kind-B6G_HfgC.mjs";
7
7
  //#region ../types/dist/esm/records/records-access.mjs
8
8
  function isRecord(value) {
9
9
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -16,13 +16,13 @@ const require_relocate = require("./relocate-CdVQAk-w.js");
16
16
  const require_storage_migration_cap = require("./storage-migration.cap-CDOhpCQw.js");
17
17
  const require_tag = require("./tag-BLraBqvp.js");
18
18
  const require_platform_probe_cap = require("./platform-probe.cap-C0N9CugQ.js");
19
- const require_user_management_cap = require("./user-management.cap-DV9Jfsj3.js");
19
+ const require_user_management_cap = require("./user-management.cap-D4r3UKtG.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_core_blocks_cap = require("./core-blocks.cap-DEYCvF9J.js");
22
+ const require_core_blocks_cap = require("./core-blocks.cap-9xvotd_3.js");
23
23
  const require_action_index = require("./action-index-Bcnb-jyg.js");
24
24
  const require_addon_settings_cap = require("./addon-settings.cap-nZVHPo3X.js");
25
- const require_compile = require("./compile-SpeAhaZ6.js");
25
+ const require_compile = require("./compile-BpAtMSvc.js");
26
26
  const require_source_info = require("./source-info-DtWf4k2j.js");
27
27
  const require_l10n = require("./l10n-CGMvp7NF.js");
28
28
  const require_addon_pages_cap = require("./addon-pages.cap-B3gHFDYW.js");
@@ -12497,42 +12497,34 @@ function switchRunLimitOf(deviceType, role) {
12497
12497
  * boot a deadline already past sends the off once (a failed off is logged, never
12498
12498
  * retried in a loop - D49); a future one is re-armed.
12499
12499
  *
12500
- * What a device may be run for, and for how long at most, is per device type
12501
- * and role ({@link timedRunLimitOf}): the maximum is a safety bound, not a preference,
12502
- * so a request above it is REFUSED with a typed reason, never clamped.
12500
+ * It is offered on EVERY device that has a `switch` (and on a pet fountain, which
12501
+ * switches its pump): the binding rule is `bindsWhenDeviceHas: ['switch']` (D1097).
12502
+ * What a device may be run for, and for how long at most, is the one table of
12503
+ * `switchRunLimitOf` by device type and role ({@link timedRunLimitOf}): the maximum
12504
+ * is a safety bound, not a preference, so a request above it is REFUSED with a
12505
+ * typed reason, never clamped.
12503
12506
  */
12504
12507
  var TimedRunUnitSchema = /* @__PURE__ */ zod.z.enum(["s", "min"]);
12505
- /** A plug-in heater (switch + `switch-heater`): up to 3 h, in minutes. */
12506
- var TIMED_RUN_HEATER_LIMIT = {
12507
- actuator: "switch",
12508
- maxSeconds: SWITCH_RUN_HEATER_LIMIT.maxSeconds,
12509
- unit: "min",
12510
- quickRunDefault: SWITCH_RUN_HEATER_LIMIT.quickRunSeconds / 60
12511
- };
12512
- /** A pet fountain's pump: up to 5 min, in seconds. */
12513
- var TIMED_RUN_PET_FOUNTAIN_LIMIT = {
12514
- actuator: "pet-fountain",
12515
- maxSeconds: SWITCH_RUN_PET_FOUNTAIN_LIMIT.maxSeconds,
12516
- unit: "s",
12517
- quickRunDefault: SWITCH_RUN_PET_FOUNTAIN_LIMIT.quickRunSeconds
12518
- };
12519
12508
  /**
12520
- * The device types `timed-run` may be offered on. A `switch` is narrowed by
12521
- * role ({@link TIMED_RUN_DEVICE_ROLES}): only a plug-in heater runs on a timer.
12522
- */
12523
- var TIMED_RUN_DEVICE_TYPES = [require_device_type.DeviceType.Switch, require_device_type.DeviceType.PetFountain];
12524
- /** The roles that make a device of these types timed-run-able (D1033). */
12525
- var TIMED_RUN_DEVICE_ROLES = { [require_device_type.DeviceType.Switch]: [require_device_type.DeviceRole.SwitchHeater] };
12526
- /**
12527
- * The longest run of a device, by its type AND role (D1033): a `switch` is a
12528
- * heater only with role `switch-heater`, a pet fountain always is what it is.
12529
- * `null` - the device is not offered `timed-run`.
12509
+ * The timed-run limit of ANY device the cap is bound to: the numbers come from
12510
+ * the one table (`switchRunLimitOf`), the unit and the actuator from the type.
12511
+ * A pet fountain runs its pump and thinks in seconds; every other device is
12512
+ * switched through `switch.setState` and thinks in minutes.
12530
12513
  */
12531
12514
  function timedRunLimitOf(deviceType, role) {
12532
12515
  const limit = switchRunLimitOf(deviceType, role);
12533
- if (deviceType === require_device_type.DeviceType.PetFountain && limit === SWITCH_RUN_PET_FOUNTAIN_LIMIT) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
12534
- if (deviceType === require_device_type.DeviceType.Switch && role === require_device_type.DeviceRole.SwitchHeater && limit === SWITCH_RUN_HEATER_LIMIT) return TIMED_RUN_HEATER_LIMIT;
12535
- return null;
12516
+ if (deviceType === require_device_type.DeviceType.PetFountain) return {
12517
+ actuator: "pet-fountain",
12518
+ maxSeconds: limit.maxSeconds,
12519
+ unit: "s",
12520
+ quickRunDefault: limit.quickRunSeconds
12521
+ };
12522
+ return {
12523
+ actuator: "switch",
12524
+ maxSeconds: limit.maxSeconds,
12525
+ unit: "min",
12526
+ quickRunDefault: limit.quickRunSeconds / 60
12527
+ };
12536
12528
  }
12537
12529
  var MS_PER_SECOND = 1e3;
12538
12530
  var MS_PER_MINUTE = 6e4;
@@ -12613,8 +12605,8 @@ var timedRunCapability = {
12613
12605
  mode: "singleton",
12614
12606
  kind: "wrapper",
12615
12607
  defaultActive: true,
12616
- deviceTypes: TIMED_RUN_DEVICE_TYPES,
12617
- deviceRoles: TIMED_RUN_DEVICE_ROLES,
12608
+ deviceTypes: [require_device_type.DeviceType.PetFountain],
12609
+ bindsWhenDeviceHas: ["switch"],
12618
12610
  deviceConfig: { ui: {
12619
12611
  kind: "derived-form",
12620
12612
  builderId: "timed-run",