@camstack/server 1.2.761 → 1.2.762

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 (87) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/core/cap-providers.js +39 -8
  3. package/dist/api/core/integration-role.js +6 -3
  4. package/package.json +19 -16
  5. package/system/dist/{agent-https-YFeT_9qF.js → agent-https-BHpDnJr0.js} +1 -1
  6. package/system/dist/{agent-https-D1B_fvIx.mjs → agent-https-UksJdbes.mjs} +1 -1
  7. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  8. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  9. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  10. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  11. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  12. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  13. package/system/dist/builtins/autotrack/index.js +1 -1
  14. package/system/dist/builtins/autotrack/index.mjs +1 -1
  15. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  16. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  17. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  18. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  19. package/system/dist/builtins/camera-grid/index.js +1 -1
  20. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  21. package/system/dist/builtins/composer/composer.addon.js +3 -3
  22. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  23. package/system/dist/builtins/console-logging/index.js +1 -1
  24. package/system/dist/builtins/console-logging/index.mjs +1 -1
  25. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  27. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  28. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  29. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  30. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  31. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  32. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  33. package/system/dist/builtins/keychain/index.js +3 -3
  34. package/system/dist/builtins/keychain/index.mjs +3 -3
  35. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  36. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  37. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  38. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  39. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  40. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  41. package/system/dist/builtins/loki-logging/index.js +2 -1
  42. package/system/dist/builtins/loki-logging/index.mjs +2 -1
  43. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  44. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  45. package/system/dist/builtins/platform-probe/index.js +1 -1
  46. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  47. package/system/dist/builtins/record-entries/index.js +1 -1
  48. package/system/dist/builtins/record-entries/index.mjs +1 -1
  49. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  50. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  51. package/system/dist/builtins/snapshot/index.js +1 -1
  52. package/system/dist/builtins/snapshot/index.mjs +1 -1
  53. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  54. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  55. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  56. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  57. package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +6 -0
  58. package/system/dist/builtins/sqlite-storage/integration-rows-ports.d.ts +16 -0
  59. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  60. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  61. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  62. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  63. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  64. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  65. package/system/dist/builtins/winston-logging/index.js +1 -1
  66. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  67. package/system/dist/{capture-engine-C6myWpTr.mjs → capture-engine-Btq9LseJ.mjs} +1 -1
  68. package/system/dist/{capture-engine-JrgzDAeI.js → capture-engine-DgcmHuIi.js} +1 -1
  69. package/system/dist/{composition-sources-53ryTB8m.js → composition-sources-DrGLoV8D.js} +1 -1
  70. package/system/dist/{composition-sources-BJleLIBr.mjs → composition-sources-xyPI-9ja.mjs} +1 -1
  71. package/system/dist/{constants-DW74hDp7.mjs → constants-B8q9KsGq.mjs} +1 -1
  72. package/system/dist/{constants-nY2QXQK5.js → constants-BiE3GU1C.js} +1 -1
  73. package/system/dist/{device-ca-CzGQ4dJn.js → device-ca-Bel2vDyJ.js} +1 -1
  74. package/system/dist/{device-ca-BUTX2AaQ.mjs → device-ca-D5U9i2AO.mjs} +1 -1
  75. package/system/dist/{dist-Cyida7ne.js → dist-B6-AUY2T.js} +117 -14
  76. package/system/dist/{dist-Cu6VwGZZ.mjs → dist-Dd_vXorK.mjs} +117 -14
  77. package/system/dist/file-host-worker.js +1 -1
  78. package/system/dist/file-host-worker.mjs +1 -1
  79. package/system/dist/{hub-mdns-ciao-CXAFrkV0.js → hub-mdns-ciao-DV7bwoub.js} +2 -2
  80. package/system/dist/{hub-mdns-ciao-scMSbV7j.mjs → hub-mdns-ciao-Dz9w_pd0.mjs} +2 -2
  81. package/system/dist/index.js +25 -7
  82. package/system/dist/index.mjs +25 -7
  83. package/system/dist/{restore-archive-jWL53_V-.mjs → restore-archive-BcdcInFR.mjs} +1 -1
  84. package/system/dist/{restore-archive-pn_Y6UG7.js → restore-archive-BcstsRhG.js} +1 -1
  85. package/system/dist/{wal-maintenance-By_dPC7l.mjs → wal-maintenance-Ctp8Q-y7.mjs} +0 -0
  86. package/system/dist/{wal-maintenance-CODI9DuS.js → wal-maintenance-CzjpuF7n.js} +0 -0
  87. package/system/package.json +1 -1
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  const require_log_read_filter = require("../../log-read-filter-Bi066jwU.js");
8
8
  let zod = require("zod");
9
9
  //#region src/builtins/loki-logging/loki-payload.ts
@@ -1081,6 +1081,7 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
1081
1081
  else await this.ensureDeclaredQuietly();
1082
1082
  this.instances = new require_dist.RecordIntegrationInstances(records, lokiDestinationsKind, {
1083
1083
  description: {
1084
+ role: "services",
1084
1085
  instanceMode: "multiple",
1085
1086
  kind: "destination",
1086
1087
  canTest: true
@@ -1,4 +1,4 @@
1
- import { Fs as isSecretMarker, Lt as RecordIntegrationInstances, Pi as preconditionOf, Ps as isSecretFieldView, Wr as isSameAddonId, Zo as RevConflictError, gs as defineAddonMigrations, jr as integrationInstancesCapability, ri as logDestinationCapability, vn as bareAddonId, vs as defineEntryKind, wo as BaseAddon } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { Fs as isSecretMarker, Lt as RecordIntegrationInstances, Pi as preconditionOf, Ps as isSecretFieldView, Wr as isSameAddonId, Zo as RevConflictError, gs as defineAddonMigrations, jr as integrationInstancesCapability, ri as logDestinationCapability, vn as bareAddonId, vs as defineEntryKind, wo as BaseAddon } from "../../dist-Dd_vXorK.mjs";
2
2
  import { n as compileLogFilter, o as lineMatches } from "../../log-read-filter-D7Ev3zm-.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/builtins/loki-logging/loki-payload.ts
@@ -1074,6 +1074,7 @@ var LokiLoggingAddon = class extends BaseAddon {
1074
1074
  else await this.ensureDeclaredQuietly();
1075
1075
  this.instances = new RecordIntegrationInstances(records, lokiDestinationsKind, {
1076
1076
  description: {
1077
+ role: "services",
1077
1078
  instanceMode: "multiple",
1078
1079
  kind: "destination",
1079
1080
  canTest: true
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  let node_fs_promises = require("node:fs/promises");
8
8
  let node_util = require("node:util");
9
9
  let node_os = require("node:os");
@@ -1,4 +1,4 @@
1
- import { It as ROOT_BUCKET_KEY, Tr as foldSnapshotByFunction, Vi as reducePoints, dc as EventCategory, fi as metricsProviderCapability, ms as createEvent, nn as UNATTRIBUTED_BUCKET_KEY, qi as resolveBucketMs, uc as errMsg, wo as BaseAddon } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { It as ROOT_BUCKET_KEY, Tr as foldSnapshotByFunction, Vi as reducePoints, dc as EventCategory, fi as metricsProviderCapability, ms as createEvent, nn as UNATTRIBUTED_BUCKET_KEY, qi as resolveBucketMs, uc as errMsg, wo as BaseAddon } from "../../dist-Dd_vXorK.mjs";
2
2
  import { access, readFile, readdir } from "node:fs/promises";
3
3
  import { promisify } from "node:util";
4
4
  import * as os$1 from "node:os";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  const require_coral_accelerators = require("../../coral-accelerators-BSVsBVzt.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_chunk.__toESM(node_path);
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Ei as parseAcceleratorFactsJson, dc as EventCategory, dr as enumerateInferenceDevices, ji as platformProbeCapability, la as scoreRuntimes, uc as errMsg, wo as BaseAddon, xs as emitReadiness } from "../../dist-Cu6VwGZZ.mjs";
2
+ import { Ei as parseAcceleratorFactsJson, dc as EventCategory, dr as enumerateInferenceDevices, ji as platformProbeCapability, la as scoreRuntimes, uc as errMsg, wo as BaseAddon, xs as emitReadiness } from "../../dist-Dd_vXorK.mjs";
3
3
  import { n as detectCoralAccelerator, r as nodeCoralFs } from "../../coral-accelerators-DBlgWB8k.mjs";
4
4
  import * as path$1 from "node:path";
5
5
  import { promisify } from "node:util";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  let zod = require("zod");
8
8
  let node_crypto = require("node:crypto");
9
9
  //#region src/builtins/record-entries/entries-service.ts
@@ -1,4 +1,4 @@
1
- import { Po as InvalidRecordError, ec as secretViewsOf, ns as UnknownRecordKindError, wo as BaseAddon, zi as recordEntriesCapability } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { Po as InvalidRecordError, ec as secretViewsOf, ns as UnknownRecordKindError, wo as BaseAddon, zi as recordEntriesCapability } from "../../dist-Dd_vXorK.mjs";
2
2
  import { z } from "zod";
3
3
  import { randomUUID } from "node:crypto";
4
4
  //#region src/builtins/record-entries/entries-service.ts
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
8
8
  /**
9
9
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -1,4 +1,4 @@
1
- import { dc as EventCategory, wo as BaseAddon } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { dc as EventCategory, wo as BaseAddon } from "../../dist-Dd_vXorK.mjs";
2
2
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
3
3
  /**
4
4
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  const require_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { Ta as streamQualityLabel, Vs as nodePin, _a as snapshotCapability, dc as EventCategory, h as BatteryStatusSchema, lc as DeviceType, sc as DeviceFeature, tr as deriveBatteryPresence, uc as errMsg, ui as memoizePinnedFfmpeg, vn as bareAddonId, wo as BaseAddon, yn as batteryCapability } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { Ta as streamQualityLabel, Vs as nodePin, _a as snapshotCapability, dc as EventCategory, h as BatteryStatusSchema, lc as DeviceType, sc as DeviceFeature, tr as deriveBatteryPresence, uc as errMsg, ui as memoizePinnedFfmpeg, vn as bareAddonId, wo as BaseAddon, yn as batteryCapability } from "../../dist-Dd_vXorK.mjs";
2
2
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Ca as storageProviderCapability, wo as BaseAddon, wr as filesystemBrowseCapability } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { Ca as storageProviderCapability, wo as BaseAddon, wr as filesystemBrowseCapability } from "../../dist-Dd_vXorK.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
6
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
7
- const require_wal_maintenance = require("../../wal-maintenance-CODI9DuS.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-CzjpuF7n.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
10
10
  var ConfigStore = class {
@@ -1,5 +1,5 @@
1
1
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
2
- 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-By_dPC7l.mjs";
2
+ 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-Ctp8Q-y7.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
5
5
  var ConfigStore = class {
@@ -28,6 +28,12 @@ export declare class IntegrationRegistry implements IIntegrationRegistry {
28
28
  }): boolean;
29
29
  deleteIntegration(id: string): Promise<boolean>;
30
30
  getIntegrationSettings(integrationId: string): Promise<Record<string, unknown>>;
31
+ /**
32
+ * Delete every legacy setting row of an integration and answer the keychain refs the rows
33
+ * carried, so the caller (the rows-to-record migration) releases them after the rows are gone.
34
+ * The integration itself stays.
35
+ */
36
+ clearIntegrationSettings(integrationId: string): Promise<readonly string[]>;
31
37
  setIntegrationSetting(integrationId: string, key: string, value: unknown): Promise<void>;
32
38
  setIntegrationSettings(integrationId: string, settings: Record<string, unknown>): Promise<void>;
33
39
  private mapIntegration;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The system-side ports of `moveIntegrationRowsToRecords` (planning#416): the legacy
3
+ * `integration_settings` rows are read through the registry and their secrets resolved through the
4
+ * integration's OWNER keychain door (never exposed further), and cleared together with their
5
+ * keychain values. The addon's own record kind is reached through its records handle.
6
+ */
7
+ import { type IntegrationRowsPorts, type RecordKindHandle, type RowsMigrationLog, type SecretsAccess } from "@camstack/types";
8
+ import type { IntegrationRegistry } from "./integration-registry.js";
9
+ export interface IntegrationRowsPortsDeps {
10
+ readonly registry: Pick<IntegrationRegistry, "listIntegrations" | "getIntegrationSettings" | "clearIntegrationSettings">;
11
+ /** The OWNER addon's keychain handle, or null when there is no keychain. */
12
+ readonly secrets: SecretsAccess | null;
13
+ readonly records: RecordKindHandle<Record<string, unknown>>;
14
+ readonly log: RowsMigrationLog;
15
+ }
16
+ export declare function integrationRowsPortsOver(deps: IntegrationRowsPortsDeps): IntegrationRowsPorts;
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
8
- const require_wal_maintenance = require("../../wal-maintenance-CODI9DuS.js");
8
+ const require_wal_maintenance = require("../../wal-maintenance-CzjpuF7n.js");
9
9
  const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
10
10
  const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
11
11
  let zod = require("zod");
@@ -1,6 +1,6 @@
1
- import { An as catalogueIssues, Ao as DeclarationRefusedError, Bi as recordsCapability, Fo as NoCallerError, M as DATABASE_SNAPSHOT_SUFFIX, N as DATABASE_SNAPSHOT_TIMEOUT_MS, P as DATA_STORE_DATABASES, Po as InvalidRecordError, Ti as orderMigrations, Tt as MigrationMetaSchema, Us as normalizeSecretOwner, Vo as RECORD_SWEEP_INTERVAL_MS, Wo as RUNTIME_DEFAULTS, Xn as databaseSnapshotCapability, Yn as dataStoreProviderCapability, _s as defineCustomActions, dc as EventCategory, es as TransactRefusedError, fs as collectSecretMarkerRefs, hs as customAction, j as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, ns as UnknownRecordKindError, pi as migrationsCapability, qo as RecordKindDeclarationSchema, ta as resolveRunnerId, uc as errMsg$1, vn as bareAddonId, wo as BaseAddon, ya as storageAdminCapability, za as vectorStoreCapability } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { An as catalogueIssues, Ao as DeclarationRefusedError, Bi as recordsCapability, Fo as NoCallerError, M as DATABASE_SNAPSHOT_SUFFIX, N as DATABASE_SNAPSHOT_TIMEOUT_MS, P as DATA_STORE_DATABASES, Po as InvalidRecordError, Ti as orderMigrations, Tt as MigrationMetaSchema, Us as normalizeSecretOwner, Vo as RECORD_SWEEP_INTERVAL_MS, Wo as RUNTIME_DEFAULTS, Xn as databaseSnapshotCapability, Yn as dataStoreProviderCapability, _s as defineCustomActions, dc as EventCategory, es as TransactRefusedError, fs as collectSecretMarkerRefs, hs as customAction, j as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, ns as UnknownRecordKindError, pi as migrationsCapability, qo as RecordKindDeclarationSchema, ta as resolveRunnerId, uc as errMsg$1, vn as bareAddonId, wo as BaseAddon, ya as storageAdminCapability, za as vectorStoreCapability } from "../../dist-Dd_vXorK.mjs";
2
2
  import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-u6xQA6r7.mjs";
3
- 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-By_dPC7l.mjs";
3
+ 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-Ctp8Q-y7.mjs";
4
4
  import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
5
5
  import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
6
6
  import { createRequire } from "node:module";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { Fs as isSecretMarker, Ha as withLocationMode, Ho as REDACTED_SECRET, Hr as isLocationEnabled, Hs as normalizeNodeId, Or as gbToBytes, Qs as secretTreeFromPaths, Qt as StorageMigrationJobSchema, Ws as parseJsonObject, Xr as legacyModeOf, Xs as resolveSecretMarkers, Xt as StorageLocationModeSchema, Yt as StorageCleanupJobSchema, Zi as resolveLocationMode, Zt as StorageLocationTypeSchema, ba as storageCapability, dc as EventCategory, gr as evictionPolicyOfLocation, gs as defineAddonMigrations, ic as transformSecretWrite, mi as modeMayWrite, oi as mayReadLocation, si as mayWriteToLocation, ua as settingsStoreCapability, us as collectSecretConfigKeys, wo as BaseAddon, xa as storageMigrationCapability, ys as defineRecordKinds, yt as LegacyStorageLocationDefaultSchema } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { Fs as isSecretMarker, Ha as withLocationMode, Ho as REDACTED_SECRET, Hr as isLocationEnabled, Hs as normalizeNodeId, Or as gbToBytes, Qs as secretTreeFromPaths, Qt as StorageMigrationJobSchema, Ws as parseJsonObject, Xr as legacyModeOf, Xs as resolveSecretMarkers, Xt as StorageLocationModeSchema, Yt as StorageCleanupJobSchema, Zi as resolveLocationMode, Zt as StorageLocationTypeSchema, ba as storageCapability, dc as EventCategory, gr as evictionPolicyOfLocation, gs as defineAddonMigrations, ic as transformSecretWrite, mi as modeMayWrite, oi as mayReadLocation, si as mayWriteToLocation, ua as settingsStoreCapability, us as collectSecretConfigKeys, wo as BaseAddon, xa as storageMigrationCapability, ys as defineRecordKinds, yt as LegacyStorageLocationDefaultSchema } from "../../dist-Dd_vXorK.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
8
8
  const require_x509_es = require("../../x509.es-WtnRNyYS.js");
9
- const require_agent_https = require("../../agent-https-YFeT_9qF.js");
10
- const require_constants$8 = require("../../constants-nY2QXQK5.js");
9
+ const require_agent_https = require("../../agent-https-BHpDnJr0.js");
10
+ const require_constants$8 = require("../../constants-BiE3GU1C.js");
11
11
  const require_src$1 = require("../../src-CnAqG6EF.js");
12
12
  let zod = require("zod");
13
13
  let node_crypto = require("node:crypto");
@@ -1,9 +1,9 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Ds as hydrateSchema, _s as defineCustomActions, hs as customAction, ma as shortHostname, qt as ServerNameSchema, uc as errMsg, wo as BaseAddon } from "../../dist-Cu6VwGZZ.mjs";
2
+ import { Ds as hydrateSchema, _s as defineCustomActions, hs as customAction, ma as shortHostname, qt as ServerNameSchema, uc as errMsg, wo as BaseAddon } from "../../dist-Dd_vXorK.mjs";
3
3
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
4
4
  import { C as backdatedNotBefore, S as withUtcTimeEncoding, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension } from "../../x509.es-BRiJgOvu.mjs";
5
- import { B as setProcessAgentHttpsNames, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, R as AgentHttpsNames, V as systemConfigRecordKinds, u as isPrivateAddress, z as getProcessAgentHttpsNames } from "../../agent-https-D1B_fvIx.mjs";
6
- import { a as MESH_CA_KEY_REF, c as SERVER_AUTH_OID, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID } from "../../constants-DW74hDp7.mjs";
5
+ import { B as setProcessAgentHttpsNames, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, R as AgentHttpsNames, V as systemConfigRecordKinds, u as isPrivateAddress, z as getProcessAgentHttpsNames } from "../../agent-https-UksJdbes.mjs";
6
+ import { a as MESH_CA_KEY_REF, c as SERVER_AUTH_OID, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID } from "../../constants-B8q9KsGq.mjs";
7
7
  import { t as require_src } from "../../src-hG4grMU4.mjs";
8
8
  import { z } from "zod";
9
9
  import { X509Certificate, createHash, createPrivateKey, randomBytes, randomInt, sign, timingSafeEqual, verify, webcrypto } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Cyida7ne.js");
6
+ const require_dist = require("../../dist-B6-AUY2T.js");
7
7
  const require_formatter = require("../../formatter-xbxeV4GD.js");
8
8
  const require_log_file_read_protocol = require("../../log-file-read-protocol-D0WcLbIV.js");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { ri as logDestinationCapability, wo as BaseAddon } from "../../dist-Cu6VwGZZ.mjs";
1
+ import { ri as logDestinationCapability, wo as BaseAddon } from "../../dist-Dd_vXorK.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
3
3
  import { a as LogFileIndexStore, i as serveRead, n as isFromReader, t as CancelBook } from "../../log-file-read-protocol-B7M3X3bT.mjs";
4
4
  import { createRequire } from "node:module";
@@ -1,4 +1,4 @@
1
- import { No as HISTORY_DEFAULT_MIN_INTERVAL_MS, Ts as historyItemFieldPath, lc as DeviceType } from "./dist-Cu6VwGZZ.mjs";
1
+ import { No as HISTORY_DEFAULT_MIN_INTERVAL_MS, Ts as historyItemFieldPath, lc as DeviceType } from "./dist-Dd_vXorK.mjs";
2
2
  //#region src/builtins/device-history/store/series-registry.ts
3
3
  function subjectIdOf(subject) {
4
4
  return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-Cyida7ne.js");
1
+ const require_dist = require("./dist-B6-AUY2T.js");
2
2
  //#region src/builtins/device-history/store/series-registry.ts
3
3
  function subjectIdOf(subject) {
4
4
  return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-Cyida7ne.js");
1
+ const require_dist = require("./dist-B6-AUY2T.js");
2
2
  //#region src/builtins/shared/device-state-changed.ts
3
3
  /** Structural narrowing helper for untrusted bus payloads. */
4
4
  function isRecord(value) {
@@ -1,4 +1,4 @@
1
- import { oo as compositionSourceKey, uc as errMsg } from "./dist-Cu6VwGZZ.mjs";
1
+ import { oo as compositionSourceKey, uc as errMsg } from "./dist-Dd_vXorK.mjs";
2
2
  //#region src/builtins/shared/device-state-changed.ts
3
3
  /** Structural narrowing helper for untrusted bus payloads. */
4
4
  function isRecord(value) {
@@ -1,4 +1,4 @@
1
- import { ls as buildSecretRef } from "./dist-Cu6VwGZZ.mjs";
1
+ import { ls as buildSecretRef } from "./dist-Dd_vXorK.mjs";
2
2
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
3
3
  var MESH_CA_KEY_REF = buildSecretRef({
4
4
  owner: "system",
@@ -1,5 +1,5 @@
1
1
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
2
- var MESH_CA_KEY_REF = require("./dist-Cyida7ne.js").buildSecretRef({
2
+ var MESH_CA_KEY_REF = require("./dist-B6-AUY2T.js").buildSecretRef({
3
3
  owner: "system",
4
4
  scope: { kind: "global" },
5
5
  fieldPath: "meshCaKey"
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-Cyida7ne.js");
1
+ const require_dist = require("./dist-B6-AUY2T.js");
2
2
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -1,4 +1,4 @@
1
- import { H as DEVICE_SAN_CREDENTIAL_PREFIX, U as DEVICE_SAN_USER_PREFIX, ls as buildSecretRef } from "./dist-Cu6VwGZZ.mjs";
1
+ import { H as DEVICE_SAN_CREDENTIAL_PREFIX, U as DEVICE_SAN_USER_PREFIX, ls as buildSecretRef } from "./dist-Dd_vXorK.mjs";
2
2
  import { C as backdatedNotBefore, S as withUtcTimeEncoding, a as KeyUsageFlags, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension } from "./x509.es-BRiJgOvu.mjs";
3
3
  import { X509Certificate, createPublicKey, randomBytes, verify, webcrypto } from "node:crypto";
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -1171,7 +1171,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1171
1171
  return DeviceRole;
1172
1172
  }({});
1173
1173
  //#endregion
1174
- //#region ../types/dist/sleep-BkzQdpzF.mjs
1174
+ //#region ../types/dist/sleep-BaWhXZFm.mjs
1175
1175
  /**
1176
1176
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1177
1177
  * window to float samples (D455).
@@ -4185,6 +4185,10 @@ var RECORD_SECRET_COLLECTION_PREFIX = "records:";
4185
4185
  * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
4186
4186
  * (`auth.accessToken`, `headers[].value`).
4187
4187
  *
4188
+ * `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
4189
+ * names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
4190
+ * key releases exactly that key's secret.
4191
+ *
4188
4192
  * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
4189
4193
  * `{ headers: 'name' }`), never by index, so reordering a list keeps every
4190
4194
  * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
@@ -4197,11 +4201,13 @@ function parseSecretPath(path) {
4197
4201
  if (path.length === 0) throw new InvalidRecordError("an empty secret path");
4198
4202
  return path.split(".").map((raw) => {
4199
4203
  const each = raw.endsWith("[]");
4200
- const key = each ? raw.slice(0, -2) : raw;
4204
+ const map = raw.endsWith("{}");
4205
+ const key = each || map ? raw.slice(0, -2) : raw;
4201
4206
  if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
4202
4207
  return {
4203
4208
  key,
4204
- each
4209
+ each,
4210
+ map
4205
4211
  };
4206
4212
  });
4207
4213
  }
@@ -4253,6 +4259,22 @@ function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arra
4253
4259
  [segment.key]: mapped
4254
4260
  };
4255
4261
  }
4262
+ if (segment.map) {
4263
+ if (!isRecord$4(child)) return node;
4264
+ const kept = Object.entries(child).map(([mapKey, value]) => {
4265
+ const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
4266
+ if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
4267
+ return [mapKey, visit({
4268
+ declared,
4269
+ concrete,
4270
+ value
4271
+ })];
4272
+ }).filter(([, value]) => value !== REMOVE_LEAF);
4273
+ return {
4274
+ ...node,
4275
+ [segment.key]: Object.fromEntries(kept)
4276
+ };
4277
+ }
4256
4278
  const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
4257
4279
  if (last) {
4258
4280
  const replacement = visit({
@@ -4410,7 +4432,8 @@ function isZodSecret(schema) {
4410
4432
  }
4411
4433
  /**
4412
4434
  * Every declared secret path in a config schema: dotted keys, `[]` for "each
4413
- * element of this array" (`connection.password`, `rows[].token`). A declared
4435
+ * element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
4436
+ * map" (`applianceSecrets{}`). A declared
4414
4437
  * object or array is reported as one path and not descended into — everything
4415
4438
  * under it is secret.
4416
4439
  */
@@ -4421,6 +4444,7 @@ function collectZodSecretPaths(schema, prefix = "") {
4421
4444
  const def = defOf(layer);
4422
4445
  if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
4423
4446
  else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
4447
+ else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
4424
4448
  else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
4425
4449
  else if (def.type === "intersection") {
4426
4450
  if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
@@ -11033,11 +11057,49 @@ var IntegrationInstanceRefSchema = zod.z.object({
11033
11057
  ]),
11034
11058
  candidateStableId: zod.z.string().optional()
11035
11059
  });
11060
+ /**
11061
+ * `RecordIntegrationInstances` - the `integration-instances` provider over ONE
11062
+ * entry kind, so an addon that holds a connection serves it in ~30 lines.
11063
+ *
11064
+ * Every instance is one record of the addon's own kind, keyed by the
11065
+ * `integrations` registry id. The records door does the secret work: a field the
11066
+ * kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
11067
+ * deleting the row deletes the secret, and one row's value is never another's.
11068
+ *
11069
+ * Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
11070
+ * token or the view the form was given KEEP the stored secret;
11071
+ * `{ $secretClear: true }` clears it; any other string replaces it.
11072
+ */
11036
11073
  /** The most instances one addon lists (an integrations page, not a table). */
11037
11074
  var INSTANCES_LIST_MAX = 1e3;
11038
11075
  /** The keys of the kind's secret fields that sit at the top level of the body. */
11039
11076
  function topLevelSecretKeys(paths) {
11040
- return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[")));
11077
+ return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
11078
+ }
11079
+ /** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
11080
+ function secretMapKeys(paths) {
11081
+ return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
11082
+ }
11083
+ /**
11084
+ * A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
11085
+ * view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
11086
+ * or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
11087
+ */
11088
+ function secretMapPatch(value) {
11089
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
11090
+ const out = {};
11091
+ for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
11092
+ else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
11093
+ return Object.keys(out).length > 0 ? out : null;
11094
+ }
11095
+ /** Does the kind's body schema carry an `enabled` field? */
11096
+ function declaresEnabled(kind) {
11097
+ const json = zod.z.toJSONSchema(kind.schema, {
11098
+ unrepresentable: "any",
11099
+ io: "input"
11100
+ });
11101
+ const properties = Reflect.get(json, "properties");
11102
+ return typeof properties === "object" && properties !== null && "enabled" in properties;
11041
11103
  }
11042
11104
  var RecordIntegrationInstances = class {
11043
11105
  records;
@@ -11045,14 +11107,20 @@ var RecordIntegrationInstances = class {
11045
11107
  hooks;
11046
11108
  handle;
11047
11109
  secretKeys;
11110
+ secretMaps;
11048
11111
  nameField;
11112
+ /** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
11113
+ registryOwnsEnabled;
11049
11114
  constructor(records, kind, hooks) {
11050
11115
  this.records = records;
11051
11116
  this.kind = kind;
11052
11117
  this.hooks = hooks;
11053
11118
  this.handle = records.kind(kind);
11054
11119
  this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
11120
+ this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
11055
11121
  this.nameField = kind.declaration.entry?.nameField ?? "name";
11122
+ this.registryOwnsEnabled = hooks.description.role === "devices";
11123
+ if (this.registryOwnsEnabled && declaresEnabled(kind)) throw new Error(`kind "${kind.name}": the integrations registry owns the on/off switch of a role "devices" addon, so the body must not declare "enabled"`);
11056
11124
  }
11057
11125
  /**
11058
11126
  * One instance read for the addon's own runtime; null when absent. When the keychain is
@@ -11103,7 +11171,7 @@ var RecordIntegrationInstances = class {
11103
11171
  id: record.id,
11104
11172
  name: typeof rawName === "string" ? rawName : record.id,
11105
11173
  configured: this.hooks.configured(record.data),
11106
- enabled: record.data.enabled !== false,
11174
+ ...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
11107
11175
  formValues: shown,
11108
11176
  ...kind !== void 0 ? { kind } : {},
11109
11177
  ...health?.status !== void 0 ? { status: health.status } : {},
@@ -11133,32 +11201,36 @@ var RecordIntegrationInstances = class {
11133
11201
  id: minted,
11134
11202
  data: this.hooks.initialBody(name, kind)
11135
11203
  }, { ifRev: 0 });
11136
- await this.hooks.onChanged?.(minted);
11204
+ await this.hooks.onChanged?.(minted, "created");
11137
11205
  return { id: minted };
11138
11206
  };
11139
11207
  updateInstance = async ({ id, name, values }) => {
11140
11208
  const patch = {};
11141
11209
  for (const [key, value] of Object.entries(values)) {
11142
11210
  if (value === void 0) continue;
11143
- if (!this.secretKeys.has(key)) patch[key] = value;
11211
+ if (this.secretMaps.has(key)) {
11212
+ const entries = secretMapPatch(value);
11213
+ if (entries !== null) patch[key] = entries;
11214
+ } else if (!this.secretKeys.has(key)) patch[key] = value;
11144
11215
  else if (isSecretClear(value)) patch[key] = null;
11145
11216
  else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
11146
11217
  }
11147
11218
  if (name !== void 0) patch[this.nameField] = name;
11148
11219
  await this.handle.patch(id, patch);
11149
- await this.hooks.onChanged?.(id);
11220
+ await this.hooks.onChanged?.(id, "updated");
11150
11221
  return { ok: true };
11151
11222
  };
11152
11223
  /** The switch lives in the record body; the addon is told so it applies it (D996). */
11153
11224
  setInstanceEnabled = async ({ id, enabled }) => {
11225
+ if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
11154
11226
  await this.handle.patch(id, { enabled });
11155
- await this.hooks.onChanged?.(id);
11227
+ await this.hooks.onChanged?.(id, "enabled");
11156
11228
  return { ok: true };
11157
11229
  };
11158
11230
  /** The row and its keychain refs go together (the records door). */
11159
11231
  deleteInstance = async ({ id }) => {
11160
11232
  await this.handle.delete(id);
11161
- await this.hooks.onChanged?.(id);
11233
+ await this.hooks.onChanged?.(id, "deleted");
11162
11234
  return { ok: true };
11163
11235
  };
11164
11236
  testInstance = async (input) => {
@@ -62133,7 +62205,37 @@ var IntegrationInstanceKindSchema = zod.z.object({
62133
62205
  /** Relative hub path to disconnect that account. */
62134
62206
  disconnectPath: zod.z.string().min(1).optional()
62135
62207
  });
62208
+ /**
62209
+ * What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
62210
+ * instance is an integration that brings devices (the registry owns its on/off switch);
62211
+ * `services`: a connection configured from the addon's own function page, never listed on
62212
+ * Integrations; `both`: a dual entry listed for its devices that also keeps service connections.
62213
+ * It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
62214
+ */
62215
+ var IntegrationInstanceRoleSchema = zod.z.enum([
62216
+ "devices",
62217
+ "services",
62218
+ "both"
62219
+ ]);
62220
+ /**
62221
+ * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
62222
+ * scans the network before any instance exists (the wizard offers the candidates); `account`: the
62223
+ * devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
62224
+ * instance and its candidates are claimed by it.
62225
+ */
62226
+ var IntegrationInstanceDiscoverySchema = zod.z.object({
62227
+ mode: zod.z.enum([
62228
+ "none",
62229
+ "lan",
62230
+ "account"
62231
+ ]),
62232
+ scopedToInstance: zod.z.boolean()
62233
+ });
62136
62234
  var IntegrationInstanceDescriptionSchema = zod.z.object({
62235
+ /** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
62236
+ role: IntegrationInstanceRoleSchema,
62237
+ /** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
62238
+ discovery: IntegrationInstanceDiscoverySchema.optional(),
62137
62239
  /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
62138
62240
  instanceMode: IntegrationInstanceModeSchema,
62139
62241
  /** What the instance is, for the UI (`destination`, `relay`, `account`). */
@@ -62173,10 +62275,11 @@ var IntegrationInstanceSchema = zod.z.object({
62173
62275
  /** The addon's own rule (an URL is present, a client id is present...). */
62174
62276
  configured: zod.z.boolean(),
62175
62277
  /**
62176
- * The instance's own on/off switch (D996): always present, derived from the record body
62177
- * (`enabled !== false`, so a row written before the field existed is on).
62278
+ * The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
62279
+ * so a row written before the field existed is on). Absent when the `integrations` registry
62280
+ * owns the switch (`describe().role` is `devices`): read it from the registry row.
62178
62281
  */
62179
- enabled: zod.z.boolean(),
62282
+ enabled: zod.z.boolean().optional(),
62180
62283
  /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
62181
62284
  kind: zod.z.string().optional(),
62182
62285
  /** Values for the instance form; a secret is a `SecretFieldView`, never text. */