@camstack/server 1.2.891 → 1.2.893

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 (118) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/api/trpc/generated-cap-mounts.js +2 -1
  3. package/dist/api/trpc/generated-cap-routers.js +204 -39
  4. package/dist/core/addon/addon-registry.service.js +47 -0
  5. package/dist/core/addon/retire-undeclared-fixed-integrations.js +57 -0
  6. package/package.json +14 -15
  7. package/system/dist/addon-runner.js +25 -9
  8. package/system/dist/addon-runner.mjs +25 -9
  9. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  10. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  11. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  12. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  13. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  14. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  15. package/system/dist/builtins/autotrack/index.js +1 -1
  16. package/system/dist/builtins/autotrack/index.mjs +1 -1
  17. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  18. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  19. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  20. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  21. package/system/dist/builtins/camera-grid/addon.d.ts +65 -41
  22. package/system/dist/builtins/camera-grid/grid-blocks.d.ts +51 -0
  23. package/system/dist/builtins/camera-grid/grid-camera-device.d.ts +4 -3
  24. package/system/dist/builtins/camera-grid/grid-layout-native-provider.d.ts +3 -1
  25. package/system/dist/builtins/camera-grid/grid-plan.d.ts +3 -3
  26. package/system/dist/builtins/camera-grid/index.d.ts +2 -6
  27. package/system/dist/builtins/camera-grid/index.js +431 -727
  28. package/system/dist/builtins/camera-grid/index.mjs +428 -719
  29. package/system/dist/builtins/composer/composed-device.d.ts +12 -2
  30. package/system/dist/builtins/composer/composer.addon.js +28 -10
  31. package/system/dist/builtins/composer/composer.addon.mjs +28 -10
  32. package/system/dist/builtins/composer/composition-declarations.d.ts +3 -1
  33. package/system/dist/builtins/console-logging/index.js +1 -1
  34. package/system/dist/builtins/console-logging/index.mjs +1 -1
  35. package/system/dist/builtins/core-blocks/core-blocks.addon.js +174 -39
  36. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +175 -40
  37. package/system/dist/builtins/core-blocks/hero-layout-service.d.ts +19 -1
  38. package/system/dist/builtins/core-blocks/power-source-devices.d.ts +9 -0
  39. package/system/dist/builtins/core-blocks/power-source-service.d.ts +39 -2
  40. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  41. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  42. package/system/dist/builtins/device-manager/device-identifiers-action.d.ts +9 -0
  43. package/system/dist/builtins/device-manager/device-identity-index.d.ts +73 -0
  44. package/system/dist/builtins/device-manager/device-manager.addon.js +401 -14
  45. package/system/dist/builtins/device-manager/device-manager.addon.mjs +401 -14
  46. package/system/dist/builtins/device-manager/device-meta-types.d.ts +5 -1
  47. package/system/dist/builtins/device-manager/device-row-store.d.ts +7 -3
  48. package/system/dist/builtins/device-manager/device-state-mirror.d.ts +7 -0
  49. package/system/dist/builtins/device-manager/workload-transition.d.ts +23 -0
  50. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  51. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  52. package/system/dist/builtins/keychain/index.js +4 -4
  53. package/system/dist/builtins/keychain/index.mjs +4 -4
  54. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  55. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  56. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  57. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  58. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  59. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  60. package/system/dist/builtins/loki-logging/index.js +1 -1
  61. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  62. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  63. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  64. package/system/dist/builtins/platform-probe/index.js +1 -1
  65. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  66. package/system/dist/builtins/record-entries/index.js +1 -1
  67. package/system/dist/builtins/record-entries/index.mjs +1 -1
  68. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  69. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  70. package/system/dist/builtins/snapshot/index.js +1 -1
  71. package/system/dist/builtins/snapshot/index.mjs +1 -1
  72. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  73. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  74. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  75. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  76. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  77. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  78. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  79. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  80. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  81. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  82. package/system/dist/builtins/winston-logging/index.js +1 -1
  83. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  84. package/system/dist/{capture-engine-nmelnj-Y.mjs → capture-engine-CIVKm_jN.mjs} +1 -1
  85. package/system/dist/{capture-engine-DXz37Mjg.js → capture-engine-mZ2J-GD6.js} +1 -1
  86. package/system/dist/{composition-sources-BLn3cU74.js → composition-sources-CGP5ZUYo.js} +1 -1
  87. package/system/dist/{composition-sources-uphZtYtN.mjs → composition-sources-bJP8_Z2o.mjs} +1 -1
  88. package/system/dist/{constants-BAaGwvKn.js → constants-BD8oSQro.js} +1 -1
  89. package/system/dist/{constants-DWU46D02.mjs → constants-w-6vvTPp.mjs} +1 -1
  90. package/system/dist/{device-ca-jbH_rqZh.js → device-ca-CXxnQaff.js} +1 -1
  91. package/system/dist/{device-ca-CK6mLB2w.mjs → device-ca-DE_oetBE.mjs} +1 -1
  92. package/system/dist/{dist-m5beNMze.js → dist-B2-Uflhy.js} +2573 -443
  93. package/system/dist/{dist-Dgq9nuvh.mjs → dist-Be8yFd71.mjs} +2460 -444
  94. package/system/dist/file-host-worker.js +1 -1
  95. package/system/dist/file-host-worker.mjs +1 -1
  96. package/system/dist/{hub-identity-CKCA89XP.js → hub-identity-BjYvJU_v.js} +1 -1
  97. package/system/dist/{hub-identity-DlBBoHJC.mjs → hub-identity-C3g7b58L.mjs} +1 -1
  98. package/system/dist/{hub-mdns-ciao-CqcCGPdi.js → hub-mdns-ciao-BRfv9GfW.js} +2 -2
  99. package/system/dist/{hub-mdns-ciao-B8uFW-RG.mjs → hub-mdns-ciao-v6X_SbWl.mjs} +2 -2
  100. package/system/dist/index.js +33 -19
  101. package/system/dist/index.mjs +33 -19
  102. package/system/dist/kernel/moleculer/child-cap-dispatch.d.ts +3 -6
  103. package/system/dist/kernel/moleculer/switch-toggle.d.ts +7 -2
  104. package/system/dist/{legacy-integration-rows-door-Co0gj1Lm.js → legacy-integration-rows-door-B0q34gh3.js} +1 -1
  105. package/system/dist/{legacy-integration-rows-door-HI4nmSe_.mjs → legacy-integration-rows-door-DG35DG06.mjs} +1 -1
  106. package/system/dist/{rename-composition-block-UeVUYCwx.js → rename-composition-block-DNte3Cs9.js} +1 -1
  107. package/system/dist/{rename-composition-block-BthBMrXA.mjs → rename-composition-block-LEbZ4oZE.mjs} +1 -1
  108. package/system/dist/{restore-archive-P-ICnU58.mjs → restore-archive--4ENkU5f.mjs} +1 -1
  109. package/system/dist/{restore-archive-CJLsfBwK.js → restore-archive-DpFPheMK.js} +1 -1
  110. package/system/dist/{wal-maintenance-CUtwx-2Z.js → wal-maintenance-BWUJktqT.js} +0 -0
  111. package/system/dist/{wal-maintenance-qWjb7_f2.mjs → wal-maintenance-DQVDhuVJ.mjs} +0 -0
  112. package/system/package.json +2 -5
  113. package/system/dist/builtins/camera-grid/grid-camera-declarations.d.ts +0 -59
  114. package/system/dist/builtins/camera-grid/grid-instances.d.ts +0 -40
  115. package/system/dist/builtins/camera-grid/grid-record-kinds.d.ts +0 -31
  116. package/system/dist/builtins/camera-grid/migrations/__fixtures__/seed.d.ts +0 -13
  117. package/system/dist/builtins/camera-grid/migrations/camera-grids-to-records.d.ts +0 -26
  118. package/system/dist/builtins/camera-grid/migrations/index.d.ts +0 -6
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-CUtwx-2Z.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-BWUJktqT.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-qWjb7_f2.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-DQVDhuVJ.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-m5beNMze.js");
2
+ const require_dist = require("./dist-B2-Uflhy.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
4
  let zod = require("zod");
5
5
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { Yc as defineRecordKinds } from "./dist-Dgq9nuvh.mjs";
1
+ import { ml as defineRecordKinds } from "./dist-Be8yFd71.mjs";
2
2
  import { C as backdatedNotBefore, S as withUtcTimeEncoding, _ as NameConstraints, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, g as GeneralSubtrees, h as GeneralSubtree, i as Extension, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension, v as GeneralName, x as AsnConvert } from "./x509.es-BRiJgOvu.mjs";
3
3
  import { z } from "zod";
4
4
  import { X509Certificate, createHash, createPrivateKey, randomBytes, webcrypto } from "node:crypto";
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-m5beNMze.js");
2
+ const require_dist = require("./dist-B2-Uflhy.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
- const require_hub_identity = require("./hub-identity-CKCA89XP.js");
4
+ const require_hub_identity = require("./hub-identity-BjYvJU_v.js");
5
5
  let node_crypto = require("node:crypto");
6
6
  let _camstack_types_node = require("@camstack/types/node");
7
7
  let node_fs = require("node:fs");
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
2
- import { zl as userError } from "./dist-Dgq9nuvh.mjs";
2
+ import { iu as userError } from "./dist-Be8yFd71.mjs";
3
3
  import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
4
- import { A as evaluateExistingCert, C as localCaCommonName, F as isConstrainedCa, L as permitsIdentity, S as loadCa, b as generateCa, j as reasonRequiresNewCa, w as collectCertIdentity, x as issueLeaf, z as readNameConstraints } from "./hub-identity-DlBBoHJC.mjs";
4
+ import { A as evaluateExistingCert, C as localCaCommonName, F as isConstrainedCa, L as permitsIdentity, S as loadCa, b as generateCa, j as reasonRequiresNewCa, w as collectCertIdentity, x as issueLeaf, z as readNameConstraints } from "./hub-identity-C3g7b58L.mjs";
5
5
  import { X509Certificate, createPrivateKey } from "node:crypto";
6
6
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
7
7
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-m5beNMze.js");
4
- const require_device_ca = require("./device-ca-jbH_rqZh.js");
3
+ const require_dist = require("./dist-B2-Uflhy.js");
4
+ const require_device_ca = require("./device-ca-CXxnQaff.js");
5
5
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
6
6
  const require_log_redactor = require("./log-redactor-BhIEMaG9.js");
7
7
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
@@ -28,22 +28,22 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
28
28
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
29
29
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
30
30
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
31
- const require_wal_maintenance = require("./wal-maintenance-CUtwx-2Z.js");
32
- const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-Co0gj1Lm.js");
31
+ const require_wal_maintenance = require("./wal-maintenance-BWUJktqT.js");
32
+ const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-B0q34gh3.js");
33
33
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
34
34
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
35
35
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
36
36
  require("./builtins/storage-orchestrator/index.js");
37
- const require_hub_identity = require("./hub-identity-CKCA89XP.js");
38
- const require_constants = require("./constants-BAaGwvKn.js");
37
+ const require_hub_identity = require("./hub-identity-BjYvJU_v.js");
38
+ const require_constants = require("./constants-BD8oSQro.js");
39
39
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
40
40
  require("./builtins/system-config/index.js");
41
41
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
42
42
  const require_custom_action_registry = require("./custom-action-registry-CmWpSeMS.js");
43
- const require_hub_mdns_ciao = require("./hub-mdns-ciao-CqcCGPdi.js");
43
+ const require_hub_mdns_ciao = require("./hub-mdns-ciao-BRfv9GfW.js");
44
44
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
45
45
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
46
- const require_restore_archive = require("./restore-archive-CJLsfBwK.js");
46
+ const require_restore_archive = require("./restore-archive-DpFPheMK.js");
47
47
  const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
48
48
  let zod = require("zod");
49
49
  let node_crypto = require("node:crypto");
@@ -13732,13 +13732,14 @@ function recordsTransportOf(api) {
13732
13732
  //#region src/kernel/moleculer/switch-toggle.ts
13733
13733
  var REFUSAL_TEXT = {
13734
13734
  "no-slice": "switch has no state slice",
13735
- stale: "switch state is unknown"
13735
+ stale: "switch state is unknown",
13736
+ "not-settable": "switch only reports its state and cannot be set"
13736
13737
  };
13737
13738
  var SwitchToggleRefusedError = class extends Error {
13738
13739
  reason;
13739
13740
  deviceId;
13740
13741
  constructor(reason, deviceId) {
13741
- super(`device ${deviceId}: ${REFUSAL_TEXT[reason]}; refusing to guess on or off`);
13742
+ super(reason === "not-settable" ? `device ${deviceId}: ${REFUSAL_TEXT[reason]}` : `device ${deviceId}: ${REFUSAL_TEXT[reason]}; refusing to guess on or off`);
13742
13743
  this.name = "SwitchToggleRefusedError";
13743
13744
  this.reason = reason;
13744
13745
  this.deviceId = deviceId;
@@ -13774,8 +13775,29 @@ function refuse$1(read, deviceId, reason) {
13774
13775
  });
13775
13776
  throw new SwitchToggleRefusedError(reason, deviceId);
13776
13777
  }
13778
+ function isGetOptions(fn) {
13779
+ return typeof fn === "function";
13780
+ }
13781
+ /**
13782
+ * What the provider's own `getOptions` answered; `undefined` when it has none, or when the read
13783
+ * failed — logged, and the toggle then acts as a plain switch would (unknown is not "cannot").
13784
+ */
13785
+ async function optionsOf(provider, read, deviceId) {
13786
+ const getOptions = Reflect.get(provider, "getOptions");
13787
+ if (!isGetOptions(getOptions)) return void 0;
13788
+ try {
13789
+ return await getOptions.call(provider, { deviceId });
13790
+ } catch (err) {
13791
+ read.logger.warn("switch.toggle: getOptions failed; toggling as a plain on/off switch", {
13792
+ tags: { deviceId },
13793
+ meta: { error: err instanceof Error ? err.message : String(err) }
13794
+ });
13795
+ return;
13796
+ }
13797
+ }
13777
13798
  async function runToggle(provider, setState, read, input) {
13778
13799
  const deviceId = typeof input?.deviceId === "number" ? input.deviceId : read.deviceId;
13800
+ if ((0, _camstack_types_addon.switchRefusesSetState)(await optionsOf(provider, read, deviceId))) refuse$1(read, deviceId, "not-settable");
13779
13801
  const state = classifySwitchOn(deviceId === read.deviceId ? read.readSlice() : void 0);
13780
13802
  if (!state.known) refuse$1(read, deviceId, state.reason);
13781
13803
  await setState.call(provider, {
@@ -25539,14 +25561,6 @@ var LifecycleJobEngine = class {
25539
25561
  }
25540
25562
  };
25541
25563
  //#endregion
25542
- //#region src/kernel/moleculer/child-cap-dispatch.ts
25543
- /**
25544
- * Prefix the hub matches to turn a child-side "declared optional, not served"
25545
- * into a `NOT_IMPLEMENTED`. A prefix rather than an error subclass because the
25546
- * error crosses a UDS boundary as a plain message.
25547
- */
25548
- var CAP_METHOD_NOT_IMPLEMENTED = "CAP_METHOD_NOT_IMPLEMENTED";
25549
- //#endregion
25550
25564
  //#region src/i18n/en.json
25551
25565
  var en_default = {
25552
25566
  "auth.invalid-credentials": "Invalid credentials",
@@ -26230,7 +26244,7 @@ exports.BackupKeyMismatchError = require_restore_archive.BackupKeyMismatchError;
26230
26244
  exports.BackupKeyRequiredError = require_restore_archive.BackupKeyRequiredError;
26231
26245
  exports.CAP_ACTION_OVERFLOW_LABEL = CAP_ACTION_OVERFLOW_LABEL;
26232
26246
  exports.CAP_ACTION_UNLABELLED = CAP_ACTION_UNLABELLED;
26233
- exports.CAP_METHOD_NOT_IMPLEMENTED = CAP_METHOD_NOT_IMPLEMENTED;
26247
+ exports.CAP_METHOD_NOT_IMPLEMENTED = _camstack_types_addon.CAP_METHOD_NOT_IMPLEMENTED;
26234
26248
  exports.CA_COMMON_NAME = require_hub_identity.CA_COMMON_NAME;
26235
26249
  exports.CA_VALIDITY_DAYS = require_hub_identity.CA_VALIDITY_DAYS;
26236
26250
  exports.CORE_CAP_SERVICE_NAME = CORE_CAP_SERVICE_NAME;
@@ -1,6 +1,6 @@
1
1
  import { i as __require } from "./chunk-CNf5ZN-e.mjs";
2
- import { $c as expandCapMethods, A as CatalogFileSchema, Aa as procedureAuthKey, At as LOG_LEVEL_RANK, Bc as collectSecretMarkerRefs, Bi as lifecycleJobSchema, C as CATALOG_LANGS, Cl as parseJsonObject, Ei as isCollectionArrayMethod, El as readinessKey, Fi as kebabToCamel$1, Hl as withoutCallerStamp, Ji as looseSchema, Mc as asNumber, Mi as isObjectInput, Nc as asString$1, Ol as resolveCapMount, On as addonSettingsCapability, Pi as isVoidInput, Qs as DEVICE_STATUS_METHOD, Rn as bareAddonId, Ro as supportedRuntimes, Ut as PackageRequiresSchema, Wc as createEvent$1, Xc as emitDownForOwnedCaps, Xo as unmetRequirements, Xs as DATAPLANE_SECRET_HEADER$1, Yc as defineRecordKinds, Yl as EventCategory$1, Ys as CALLER_STAMPED_CAPABILITIES$1, Zr as extractNestedAddonId, Zs as DEVICE_SETTINGS_CONTRIBUTION_METHODS, a as AGENT_MDNS_SERVICE_TYPE, bi as isAddonInstanceId, fa as objectInputDeclaresAddonId, gc as ReadinessTimeoutError, go as scopesAllowDeviceCap, hc as ReadinessRegistry, ho as scopesAllowAddon, jc as asJsonObject$1, jl as scopeKey, jr as describeUnmet, jt as METHOD_ACCESS_MAP, ko as splitTranslationRef, mc as RUNTIME_DEFAULTS, o as AGENT_MDNS_TXT_KEYS, ol as isDebugChannelName, pa as objectInputDeclaresRequiredDeviceId, qi as logLevelAtMost, ql as errMsg$1, ro as resolveMethodAuth, s as ALL_CAPABILITY_DEFINITIONS, sr as compareVersions, tl as getDebugInterest, wi as isArrayOutputSchema, wl as parseJsonUnknown, yi as interpolate, zl as userError } from "./dist-Dgq9nuvh.mjs";
3
- import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-CK6mLB2w.mjs";
2
+ import { $o as supportedRuntimes, A as CatalogFileSchema, Ao as scopesAllowDeviceCap, C as CATALOG_LANGS, Ea as objectInputDeclaresRequiredDeviceId, Fc as ReadinessTimeoutError, Fi as isCollectionArrayMethod, Gl as readinessKey, Hi as isObjectInput, Hl as parseJsonObject, Ki as kebabToCamel$1, Kt as PackageRequiresSchema, Nc as RUNTIME_DEFAULTS, Ni as isArrayOutputSchema, Nt as LOG_LEVEL_RANK, Oi as interpolate, Pc as ReadinessRegistry, Pn as addonSettingsCapability, Pt as METHOD_ACCESS_MAP, Qc as asString$1, Qi as lifecycleJobSchema, Rr as describeUnmet, Ta as objectInputDeclaresAddonId, Tl as isDebugChannelName, Ua as procedureAuthKey, Ul as parseJsonUnknown, Wi as isVoidInput, Wn as bareAddonId, Wo as splitTranslationRef, Xc as asJsonObject$1, Xl as scopeKey, Zc as asNumber, _c as DEVICE_STATUS_METHOD, a as AGENT_MDNS_SERVICE_TYPE, aa as logLevelAtMost, al as collectSecretMarkerRefs, bl as getDebugInterest, fs as unmetRequirements, fu as errMsg$1, gc as DEVICE_SETTINGS_CONTRIBUTION_METHODS, go as resolveMethodAuth, hc as DATAPLANE_SECRET_HEADER$1, hl as emitDownForOwnedCaps, ii as extractNestedAddonId, iu as userError, ki as isAddonInstanceId, ko as scopesAllowAddon, ll as createEvent$1, mc as CALLER_STAMPED_CAPABILITIES$1, ml as defineRecordKinds, mu as EventCategory$1, o as AGENT_MDNS_TXT_KEYS, oa as looseSchema, pr as compareVersions, ql as resolveCapMount, s as ALL_CAPABILITY_DEFINITIONS, su as withoutCallerStamp, vl as expandCapMethods } from "./dist-Be8yFd71.mjs";
3
+ import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-DE_oetBE.mjs";
4
4
  import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
5
5
  import { a as redactLogText, i as redactLogMeta, r as redactLogEntry, t as isCredentialKeyName } from "./log-redactor-XLDrPzOi.mjs";
6
6
  import { AlertCenterAddon, n as lastCauseAfterChunk, r as readRunnerDisplayName, t as CRASH_BREAKER_ERROR_PREFIX } from "./builtins/alerts/alerts.addon.mjs";
@@ -27,22 +27,22 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
27
27
  import NativeMetricsAddon, { a as NativeMetricsProvider, i as parseProcStatusRss, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
28
28
  import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
29
29
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
30
- import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-qWjb7_f2.mjs";
31
- import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-HI4nmSe_.mjs";
30
+ import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-DQVDhuVJ.mjs";
31
+ import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-DG35DG06.mjs";
32
32
  import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
33
33
  import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
34
34
  import { StorageOrchestratorAddon, a as createHubCapForwardService, i as HUB_CAP_FWD_SERVICE, o as stripForwardedCaller, r as HUB_CAP_FWD_ACTION, s as buildStorageLocationRegistry, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
35
35
  import "./builtins/storage-orchestrator/index.mjs";
36
- import { A as evaluateExistingCert, B as AGENT_HTTPS_NAMES_COLLECTION, C as localCaCommonName, D as LEAF_RENEWAL_WINDOW_DAYS, E as CA_VALIDITY_DAYS, F as isConstrainedCa, H as AgentHttpsNames, I as isLocalOnlyHostname, L as permitsIdentity, M as PERMITTED_DNS_SUFFIXES, N as PERMITTED_IP_RANGES, O as MAX_LEAF_VALIDITY_DAYS, P as buildNameConstraintSet, R as permitsName, T as systemHostFacts, U as getProcessAgentHttpsNames, V as AGENT_HTTPS_NAMES_COLUMNS, W as setProcessAgentHttpsNames, _ as pemDigest, a as AgentHttpsInstallError, c as certificateNames, d as describeHttpsLeaf, f as installAgentHttps, g as loadAgentHttps, h as issueAgentHttpsLeaf, i as loadOrCreateHubId, k as SERVER_AUTH_OID, l as collectAgentNames, m as isPrivateAddress, n as HUB_IDENTITY_RELATIVE, o as acceptAgentSans, p as isContainerBridgeAddress, r as isAnnouncedHubId, s as agentHttpsPaths, t as HUB_IDENTITY_FILE, u as createAgentHttpsRequest, v as pinnedHttpsCaFingerprint, w as collectCertIdentity, y as CA_COMMON_NAME, z as readNameConstraints } from "./hub-identity-DlBBoHJC.mjs";
37
- import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-DWU46D02.mjs";
36
+ import { A as evaluateExistingCert, B as AGENT_HTTPS_NAMES_COLLECTION, C as localCaCommonName, D as LEAF_RENEWAL_WINDOW_DAYS, E as CA_VALIDITY_DAYS, F as isConstrainedCa, H as AgentHttpsNames, I as isLocalOnlyHostname, L as permitsIdentity, M as PERMITTED_DNS_SUFFIXES, N as PERMITTED_IP_RANGES, O as MAX_LEAF_VALIDITY_DAYS, P as buildNameConstraintSet, R as permitsName, T as systemHostFacts, U as getProcessAgentHttpsNames, V as AGENT_HTTPS_NAMES_COLUMNS, W as setProcessAgentHttpsNames, _ as pemDigest, a as AgentHttpsInstallError, c as certificateNames, d as describeHttpsLeaf, f as installAgentHttps, g as loadAgentHttps, h as issueAgentHttpsLeaf, i as loadOrCreateHubId, k as SERVER_AUTH_OID, l as collectAgentNames, m as isPrivateAddress, n as HUB_IDENTITY_RELATIVE, o as acceptAgentSans, p as isContainerBridgeAddress, r as isAnnouncedHubId, s as agentHttpsPaths, t as HUB_IDENTITY_FILE, u as createAgentHttpsRequest, v as pinnedHttpsCaFingerprint, w as collectCertIdentity, y as CA_COMMON_NAME, z as readNameConstraints } from "./hub-identity-C3g7b58L.mjs";
37
+ import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-w-6vvTPp.mjs";
38
38
  import { $ as getProcessMeshCaState, A as emitProcessNodeRegistered, At as readCidrSetting, B as getProcessMeshTlsListenerState, C as verifyMembershipAnswer, Ct as isInsecureOrigin, D as ServiceBroker, Dt as createCidrMatcher, E as Errors, Et as readOriginSetting, F as onProcessNodeRegistered, G as MeshCertificateRegistry, H as setProcessMeshTlsListenerState, I as setProcessMeshHandshakeReporter, J as getProcessMeshCertificateRegistry, K as RENEWAL_ABANDONED, L as setProcessMeshPeerTransportLookup, M as getProcessNodeMeshTransport, N as getProcessPeerLeaf, O as setProcessMeshTlsEnabler, Ot as normalizeIp, P as isProcessVerifiedMeshPeer, Q as MeshCaKeeper, R as renewMeshCertificate, S as signMembershipProof, St as OPAQUE_ORIGIN, SystemConfigAddon, T as TlsTcpTransporter, Tt as parseOriginList, U as MESH_NODE_CERTIFICATES_COLLECTION, V as openMeshTlsWhenRevocationsLoaded, W as MESH_NODE_CERTIFICATES_COLUMNS, X as MeshCrl, Y as setProcessMeshCertificateRegistry, Z as processMeshCrl, _ as keyFingerprintShort, _t as isAllowedAgentDashboardReturnTo, a as dialableHubHost, at as generateMeshCa, b as MEMBERSHIP_PATHS, bt as verifyAgentUiUnlockTicket, c as PAIRING_MAX_CODE_ATTEMPTS, ct as issueMeshLeafForNode, d as PAIRING_PIN_DIGITS, dt as AGENT_DASHBOARD_ORIGINS_FIELD, et as requireProcessMeshCa, f as PAIRING_PROTOCOL, ft as AGENT_UI_UNLOCK_TTL_MS, g as describeCsr, gt as UnlockTicketJtiStore, h as computePairingSas, ht as AGENT_UI_UNLOCK_VERSION, i as AgentPairing, it as exportMeshPrivateKeyPem, j as getProcessMeshHandshakeReporter, k as dropProcessPeer, kt as parseCidrList, l as PAIRING_MAX_SESSIONS, lt as issueMeshLeafFromCsr, m as computePairingCommitment, mt as AGENT_UI_UNLOCK_USE, n as HubPairing, nt as caFingerprintCompact, o as hubHostFromMeshAddress, ot as generateMeshKeyPair, p as PAIRING_TTL_MS, pt as AGENT_UI_UNLOCK_TYP, q as describeMeshLeaf, r as PairingHttpError, rt as createMeshCsrPem, s as PAIRING_CODE_DIGITS, st as isValidAgentNodeId, tt as caFingerprint, u as PAIRING_PATHS, ut as loadMeshCa, v as signPairingProof, vt as mintAgentUiUnlockTicket, w as MESH_TLS_PORT_HELLO_FIELD, wt as normalizeOrigin, x as MembershipResponder, xt as InvalidCorsOriginError, y as verifyPairingProof, yt as parseAgentDashboardOrigins, z as revokeMeshCertificate } from "./builtins/system-config/system-config.addon.mjs";
39
39
  import "./builtins/system-config/index.mjs";
40
40
  import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
41
41
  import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-B9zFBNVa.mjs";
42
- import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-B8uFW-RG.mjs";
42
+ import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-v6X_SbWl.mjs";
43
43
  import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
44
44
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
45
- import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-P-ICnU58.mjs";
45
+ import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive--4ENkU5f.mjs";
46
46
  import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-DBlgWB8k.mjs";
47
47
  import { z } from "zod";
48
48
  import * as crypto$1 from "node:crypto";
@@ -53,7 +53,7 @@ import * as fs$1 from "node:fs";
53
53
  import { accessSync, constants, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
54
54
  import * as path$1 from "node:path";
55
55
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
56
- import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, CAP_METHOD_TIMEOUTS_MS, COLLECTION_ARRAY_METHODS, COMPOSED_DEVICE_STABLE_ID_PREFIX, CommandOriginClaimSchema, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, MIGRATION_API_VERSION, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry as ReadinessRegistry$1, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, commandOrigin, createDebugEmitter, createDeviceProxy, createEvent, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods as expandCapMethods$1, isCommand, readCommandOrigin, readErrorI18n, readNodePin, resolveDeviceSettings, scopeKey as scopeKey$1, sleep, withCapInputDefaults } from "@camstack/types/addon";
56
+ import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, CAP_METHOD_NOT_IMPLEMENTED, CAP_METHOD_TIMEOUTS_MS, COLLECTION_ARRAY_METHODS, COMPOSED_DEVICE_STABLE_ID_PREFIX, CommandOriginClaimSchema, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, MIGRATION_API_VERSION, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry as ReadinessRegistry$1, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, commandOrigin, createDebugEmitter, createDeviceProxy, createEvent, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods as expandCapMethods$1, isCommand, readCommandOrigin, readErrorI18n, readNodePin, resolveDeviceSettings, scopeKey as scopeKey$1, sleep, switchRefusesSetState, withCapInputDefaults } from "@camstack/types/addon";
57
57
  import { mkdir, rm, stat, unlink } from "node:fs/promises";
58
58
  import * as util from "node:util";
59
59
  import { promisify } from "node:util";
@@ -13728,13 +13728,14 @@ function recordsTransportOf(api) {
13728
13728
  //#region src/kernel/moleculer/switch-toggle.ts
13729
13729
  var REFUSAL_TEXT = {
13730
13730
  "no-slice": "switch has no state slice",
13731
- stale: "switch state is unknown"
13731
+ stale: "switch state is unknown",
13732
+ "not-settable": "switch only reports its state and cannot be set"
13732
13733
  };
13733
13734
  var SwitchToggleRefusedError = class extends Error {
13734
13735
  reason;
13735
13736
  deviceId;
13736
13737
  constructor(reason, deviceId) {
13737
- super(`device ${deviceId}: ${REFUSAL_TEXT[reason]}; refusing to guess on or off`);
13738
+ super(reason === "not-settable" ? `device ${deviceId}: ${REFUSAL_TEXT[reason]}` : `device ${deviceId}: ${REFUSAL_TEXT[reason]}; refusing to guess on or off`);
13738
13739
  this.name = "SwitchToggleRefusedError";
13739
13740
  this.reason = reason;
13740
13741
  this.deviceId = deviceId;
@@ -13770,8 +13771,29 @@ function refuse$1(read, deviceId, reason) {
13770
13771
  });
13771
13772
  throw new SwitchToggleRefusedError(reason, deviceId);
13772
13773
  }
13774
+ function isGetOptions(fn) {
13775
+ return typeof fn === "function";
13776
+ }
13777
+ /**
13778
+ * What the provider's own `getOptions` answered; `undefined` when it has none, or when the read
13779
+ * failed — logged, and the toggle then acts as a plain switch would (unknown is not "cannot").
13780
+ */
13781
+ async function optionsOf(provider, read, deviceId) {
13782
+ const getOptions = Reflect.get(provider, "getOptions");
13783
+ if (!isGetOptions(getOptions)) return void 0;
13784
+ try {
13785
+ return await getOptions.call(provider, { deviceId });
13786
+ } catch (err) {
13787
+ read.logger.warn("switch.toggle: getOptions failed; toggling as a plain on/off switch", {
13788
+ tags: { deviceId },
13789
+ meta: { error: err instanceof Error ? err.message : String(err) }
13790
+ });
13791
+ return;
13792
+ }
13793
+ }
13773
13794
  async function runToggle(provider, setState, read, input) {
13774
13795
  const deviceId = typeof input?.deviceId === "number" ? input.deviceId : read.deviceId;
13796
+ if (switchRefusesSetState(await optionsOf(provider, read, deviceId))) refuse$1(read, deviceId, "not-settable");
13775
13797
  const state = classifySwitchOn(deviceId === read.deviceId ? read.readSlice() : void 0);
13776
13798
  if (!state.known) refuse$1(read, deviceId, state.reason);
13777
13799
  await setState.call(provider, {
@@ -25535,14 +25557,6 @@ var LifecycleJobEngine = class {
25535
25557
  }
25536
25558
  };
25537
25559
  //#endregion
25538
- //#region src/kernel/moleculer/child-cap-dispatch.ts
25539
- /**
25540
- * Prefix the hub matches to turn a child-side "declared optional, not served"
25541
- * into a `NOT_IMPLEMENTED`. A prefix rather than an error subclass because the
25542
- * error crosses a UDS boundary as a plain message.
25543
- */
25544
- var CAP_METHOD_NOT_IMPLEMENTED = "CAP_METHOD_NOT_IMPLEMENTED";
25545
- //#endregion
25546
25560
  //#region src/i18n/en.json
25547
25561
  var en_default = {
25548
25562
  "auth.invalid-credentials": "Invalid credentials",
@@ -1,3 +1,4 @@
1
+ import { CAP_METHOD_NOT_IMPLEMENTED } from "@camstack/types/addon";
1
2
  import type { CapCallInput } from "../transport/child-cap-protocol.js";
2
3
  /**
3
4
  * Injected lookups that the dispatcher uses to resolve cap providers. A provider
@@ -44,12 +45,8 @@ export interface ChildCapDispatchDeps {
44
45
  */
45
46
  isProviderOptionalMethod(capName: string, method: string): boolean;
46
47
  }
47
- /**
48
- * Prefix the hub matches to turn a child-side "declared optional, not served"
49
- * into a `NOT_IMPLEMENTED`. A prefix rather than an error subclass because the
50
- * error crosses a UDS boundary as a plain message.
51
- */
52
- export declare const CAP_METHOD_NOT_IMPLEMENTED = "CAP_METHOD_NOT_IMPLEMENTED";
48
+ /** The prefix lives in `@camstack/types` so an addon can recognise it too. */
49
+ export { CAP_METHOD_NOT_IMPLEMENTED };
53
50
  /**
54
51
  * Creates a unified dispatcher that routes a {@link CapCallInput} to either a
55
52
  * device-scoped or singleton provider, then invokes the requested method.
@@ -7,10 +7,15 @@
7
7
  * provider's `setState` with the opposite `on`. A missing slice, or a slice
8
8
  * whose `on` is not a boolean (`null` is "never reported"), is unknown:
9
9
  * the call refuses and logs the device. It does not guess off.
10
+ *
11
+ * A switch whose `getOptions` ANSWERED `supportsSetState: false` (it only
12
+ * reports, D1058) cannot be toggled: the call refuses as `not-settable`
13
+ * before reading any state. A provider without `getOptions`, or a read that
14
+ * failed, toggles as before (D315).
10
15
  */
11
16
  import type { IScopedLogger } from "@camstack/types";
12
- /** Why a toggle will not act. Both are unknown; neither is off. */
13
- export type SwitchToggleRefusal = "no-slice" | "stale";
17
+ /** Why a toggle will not act: the state is unknown, or the switch cannot be set. */
18
+ export type SwitchToggleRefusal = "no-slice" | "stale" | "not-settable";
14
19
  export type SwitchOn = {
15
20
  readonly known: true;
16
21
  readonly on: boolean;
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-m5beNMze.js");
1
+ const require_dist = require("./dist-B2-Uflhy.js");
2
2
  //#region src/builtins/sqlite-storage/migrations/legacy-integration-rows-door.ts
3
3
  /**
4
4
  * Migration-only door for the leftover integration rows (planning#416).
@@ -1,4 +1,4 @@
1
- import { Bc as collectSecretMarkerRefs } from "./dist-Dgq9nuvh.mjs";
1
+ import { al as collectSecretMarkerRefs } from "./dist-Be8yFd71.mjs";
2
2
  //#region src/builtins/sqlite-storage/migrations/legacy-integration-rows-door.ts
3
3
  /**
4
4
  * Migration-only door for the leftover integration rows (planning#416).
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-m5beNMze.js");
1
+ const require_dist = require("./dist-B2-Uflhy.js");
2
2
  //#region src/builtins/core-blocks/rename-composition-block.ts
3
3
  /**
4
4
  * An operator rename of a composed device writes the composition block's
@@ -1,4 +1,4 @@
1
- import { Ul as COMPOSED_DEVICE_STABLE_ID_PREFIX, ql as errMsg } from "./dist-Dgq9nuvh.mjs";
1
+ import { cu as COMPOSED_DEVICE_STABLE_ID_PREFIX, fu as errMsg } from "./dist-Be8yFd71.mjs";
2
2
  //#region src/builtins/core-blocks/rename-composition-block.ts
3
3
  /**
4
4
  * An operator rename of a composed device writes the composition block's
@@ -1,4 +1,4 @@
1
- import { I as DATABASE_SNAPSHOT_SUFFIX, Yc as defineRecordKinds, et as DataStoreDatabaseSchema } from "./dist-Dgq9nuvh.mjs";
1
+ import { I as DATABASE_SNAPSHOT_SUFFIX, ml as defineRecordKinds, tt as DataStoreDatabaseSchema } from "./dist-Be8yFd71.mjs";
2
2
  import { z } from "zod";
3
3
  import { createCipheriv, createDecipheriv, createHash, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes } from "node:crypto";
4
4
  import { Buffer as Buffer$1 } from "buffer";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-m5beNMze.js");
2
+ const require_dist = require("./dist-B2-Uflhy.js");
3
3
  let zod = require("zod");
4
4
  let node_crypto = require("node:crypto");
5
5
  let buffer = require("buffer");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.891",
3
+ "version": "1.2.893",
4
4
  "description": "CamStack builtins — shipped inside @camstack/server (generated, do not edit)",
5
5
  "license": "MIT",
6
6
  "camstack": {
@@ -525,7 +525,7 @@
525
525
  "name": "Camera Grids",
526
526
  "icon": "assets/camera-grid/icon.svg",
527
527
  "color": "#7c3aed",
528
- "description": "Composite cameras: several cameras composed into one fixed picture and emitted as an ordinary camera — recorded, played back and bound like any other. The composition runs only while something is consuming it; object detection is switched off on a new grid because the cameras it is composed from are already analysed. Runs in its OWN process (`execution.isolate`): it spawns an ffmpeg per live composition and relays its bytes, and neither belongs on the event loop that serves the API.",
528
+ "description": "Composite cameras: the engine behind the Camera grid block — several cameras composed into one fixed picture and emitted as an ordinary camera — recorded, played back and bound like any other. The composition runs only while something is consuming it; object detection is switched off on a new grid because the cameras it is composed from are already analysed. Runs in its OWN process (`execution.isolate`): it spawns an ffmpeg per live composition and relays its bytes, and neither belongs on the event loop that serves the API.",
529
529
  "entry": "./dist/builtins/camera-grid/index.js",
530
530
  "instanceMode": "unique",
531
531
  "execution": {
@@ -537,9 +537,6 @@
537
537
  {
538
538
  "name": "camera-grid-layout"
539
539
  },
540
- {
541
- "name": "integration-instances"
542
- },
543
540
  {
544
541
  "name": "motion"
545
542
  }
@@ -1,59 +0,0 @@
1
- import type { GridInstance } from "./grid-instances.js";
2
- /**
3
- * The stable id is `camera-grid-<instance uuid>` and NOTHING else.
4
- *
5
- * A stable id is permanent the instant it is minted: bindings, grid layouts in
6
- * other addons, recording rows, the timeline and this addon's own tombstones
7
- * all reference it, and a device whose stable id changes is a NEW camera with
8
- * an empty history. So it may only be derived from something that itself never
9
- * changes.
10
- *
11
- * The instance uuid is the only such thing here. Deriving it from the NAME
12
- * would rename-break every reference; deriving it from the CELLS would mint a
13
- * new camera every time the operator drags a rectangle — which is the entire
14
- * activity this addon exists for. Terminal learned the same lesson from the
15
- * other end: its original one-camera-per-node id is permanent, and its profile
16
- * migration had to ENRICH that row rather than mint a replacement.
17
- */
18
- export declare function newGridCameraStableId(instanceId: string): string;
19
- /** The config a declared grid camera device carries. */
20
- export interface GridCameraConfig {
21
- readonly instanceId: string;
22
- /** `DeviceDeclaration.config` is an open record; this keeps the named type assignable. */
23
- readonly [key: string]: unknown;
24
- }
25
- export interface GridCameraDeclaration {
26
- readonly stableId: string;
27
- readonly name: string;
28
- readonly config: GridCameraConfig;
29
- }
30
- export interface ExistingGridCameraRow {
31
- readonly id: number;
32
- readonly stableId: string;
33
- readonly integrationId?: string | null;
34
- readonly config: Readonly<Record<string, unknown>>;
35
- }
36
- /**
37
- * Explicit persisted instances only. A grid camera exists because an operator
38
- * created a grid, never because some source camera happens to exist.
39
- *
40
- * A grid with NO cells is declared like any other: creation is name-only and
41
- * the layout is authored afterwards in the camera's own device details, so
42
- * "no cells yet" is the normal first state, not an invalid row.
43
- */
44
- export declare function buildGridCameraDeclarations(instances: readonly GridInstance[]): readonly GridCameraDeclaration[];
45
- /**
46
- * The rows `DeclaredDevices` is allowed to consider — every live declaration
47
- * plus ONE bounded batch of orphans.
48
- *
49
- * Two guards, both copied from Terminal because both were paid for there:
50
- *
51
- * 1. **An unknown integration id yields an EMPTY index.** `null`/`undefined`
52
- * means "the integration lookup has not answered", which is not the same
53
- * fact as "this addon owns no rows" — and only the second one may drive a
54
- * withdrawal.
55
- * 2. **The orphan batch is bounded and deterministically ordered.** The generic
56
- * sweep refuses an over-limit set outright; selecting a batch here drains a
57
- * large historical orphan set across passes without weakening that guard.
58
- */
59
- export declare function gridCameraReconciliationIndex(rows: readonly ExistingGridCameraRow[], integrationId: string | null | undefined, declarations: readonly GridCameraDeclaration[], managedStableIds?: ReadonlySet<string>): readonly ExistingGridCameraRow[];
@@ -1,40 +0,0 @@
1
- /**
2
- * The operator-written grid rows.
3
- *
4
- * Shape follows `readTerminalInstances`: a grid is a persisted row that
5
- * DECLARES a camera, and the declaration reconcile turns rows into devices.
6
- *
7
- * Config is operator-writable, so a malformed or duplicate row is IGNORED
8
- * rather than allowed to make the reconcile destructive. One bad row must never
9
- * delete every camera this addon declares — that failure mode is why the
10
- * Terminal addon reads its rows the same way.
11
- */
12
- import { z } from "zod";
13
- type NormalizedRect = {
14
- x: number;
15
- y: number;
16
- width: number;
17
- height: number;
18
- };
19
- export type GridCellConfig = {
20
- deviceId: number;
21
- source: NormalizedRect;
22
- cell: NormalizedRect;
23
- };
24
- /**
25
- * One source camera, the part of its picture taken, and where that part lands
26
- * on the composite's canvas. Both rectangles are NORMALIZED so a source that
27
- * changes resolution does not silently start cutting the wrong region.
28
- */
29
- export declare const GridCellSchema: z.ZodType<GridCellConfig>;
30
- export type GridInstance = {
31
- id: string;
32
- cameraStableId: string;
33
- name: string;
34
- enabled: boolean;
35
- fps: number;
36
- publishedProfiles: Array<"high" | "mid" | "low">;
37
- cells: GridCellConfig[];
38
- };
39
- export declare function readGridInstances(raw: readonly Record<string, unknown>[], onInvalid?: (message: string) => void): readonly GridInstance[];
40
- export {};
@@ -1,31 +0,0 @@
1
- /**
2
- * A camera grid as a record (D1013): one `camera-grid` row per grid, owned by the `camera-grid`
3
- * builtin, listed and edited through `integration-instances` on the Camera grids page. The layout
4
- * (cells, frame rate, published profiles) is authored in the camera's own device details and
5
- * saved onto the same record.
6
- *
7
- * The record id IS the grid id the old settings list carried (a uuid), so the camera
8
- * `camera-grid-<id>` and everything that names it keeps its stable identity. `cameraStableId` is
9
- * stored only where it is not derivable from the id.
10
- */
11
- import { type DefinedRecordKind } from "@camstack/types";
12
- import { z } from "zod";
13
- import { type GridCellConfig } from "./grid-instances.js";
14
- export type GridBody = {
15
- readonly name: string;
16
- /** Absent means `camera-grid-<id>`. */
17
- readonly cameraStableId?: string | undefined;
18
- readonly fps: number;
19
- readonly publishedProfiles: readonly ("high" | "mid" | "low")[];
20
- readonly cells: readonly GridCellConfig[];
21
- /** The grid's own switch (D1013). Absent means on. */
22
- readonly enabled?: boolean | undefined;
23
- };
24
- /** Checked against the interface by its annotation: a drifted field fails the typecheck. */
25
- export declare const GridBodySchema: z.ZodType<GridBody>;
26
- export declare const CAMERA_GRID_KIND_NAME = "camera-grid";
27
- export declare const cameraGridKind: DefinedRecordKind<z.ZodType<GridBody>>;
28
- /** The body a new grid starts with: a name only, no cells, so it declares a camera and emits nothing. */
29
- export declare function initialGridBody(name: string): GridBody;
30
- /** The row `readGridInstances` parses, from a record. */
31
- export declare function rawGridOfRecord(id: string, body: GridBody): Record<string, unknown>;
@@ -1,13 +0,0 @@
1
- /**
2
- * The legacy data the camera-grid catalogue meets on a node that last ran a release which kept its
3
- * grids in the addon settings (`cameraGrids`): written by hand, in the shape that release stored
4
- * it (including the `width`/`height` rows carried before the canvas was derived), with a MARK in a
5
- * field a migration that re-built a row would drop (`cells[0].source.x`). The replay and the
6
- * real-SQLite spec both seed from here.
7
- */
8
- import type Database from "better-sqlite3";
9
- export declare const GRID_SEED_ADDON = "camera-grid";
10
- /** A laid-out grid with an old canvas size, and a name-only grid that is switched off. */
11
- export declare const GRID_SEED_ROWS: readonly Record<string, unknown>[];
12
- /** Write the legacy list the way the settings writer stored it: one `<addonId>.<key>` row. */
13
- export declare function seedGridLegacySettings(db: Database.Database): void;
@@ -1,26 +0,0 @@
1
- import { type MigrationApiV1, type MigrationProcedureResult } from "@camstack/types";
2
- import { type GridBody } from "../grid-record-kinds.js";
3
- export declare const LEGACY_GRIDS_KEY = "cameraGrids";
4
- export interface GridMigrationPorts {
5
- /** The legacy list as stored; `absent` when the key was never written. */
6
- readLegacy(): Promise<{
7
- readonly kind: "absent";
8
- } | {
9
- readonly kind: "present";
10
- readonly value: unknown;
11
- }>;
12
- /** The ids that already have a record. */
13
- listIds(): Promise<ReadonlySet<string>>;
14
- /** Create the record; never replaces one. */
15
- putRecord(id: string, body: GridBody): Promise<void>;
16
- /** The record as stored; `null` when there is none. */
17
- readRecord(id: string): Promise<GridBody | null>;
18
- /** Delete the legacy key. Called only once every row has a record that reads back equal. */
19
- dropLegacyKey(): Promise<void>;
20
- /** Rewrite the legacy key to hold only these raw rows (the ones that could not be converted). */
21
- keepLegacyRows(rows: readonly unknown[]): Promise<void>;
22
- /** A row that was not copied, by id and reason (never a value). */
23
- warn(message: string): void;
24
- }
25
- export declare function copyGridsToRecords(ports: GridMigrationPorts): Promise<MigrationProcedureResult>;
26
- export declare function gridPortsOver(api: MigrationApiV1): GridMigrationPorts;
@@ -1,6 +0,0 @@
1
- import type { AddonMigration } from "@camstack/types";
2
- import { type GridMigrationPorts } from "./camera-grids-to-records.js";
3
- export { gridPortsOver, LEGACY_GRIDS_KEY, type GridMigrationPorts } from "./camera-grids-to-records.js";
4
- export declare const GRIDS_TO_RECORDS_ID = "camera-grid/2026-11-07-grids-to-records";
5
- /** The `camera-grid` catalogue (D987): offered to the engine when the addon initialises. */
6
- export declare const ADDON_MIGRATIONS: readonly AddonMigration<GridMigrationPorts>[];