@camstack/server 1.2.760 → 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 (100) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/dist/agent/main.js +1 -0
  3. package/dist/api/core/cap-providers.js +39 -8
  4. package/dist/api/core/integration-role.js +6 -3
  5. package/dist/api/trpc/generated-cap-mounts.js +1 -0
  6. package/dist/api/trpc/generated-cap-routers.js +27 -12
  7. package/dist/core/addon/addon-registry.service.js +1 -0
  8. package/package.json +19 -8
  9. package/system/dist/addon-runner.js +1 -0
  10. package/system/dist/addon-runner.mjs +1 -0
  11. package/system/dist/{agent-https-DXDFMq90.js → agent-https-BHpDnJr0.js} +1 -1
  12. package/system/dist/{agent-https-Bafgj4ni.mjs → agent-https-UksJdbes.mjs} +1 -1
  13. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  14. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  15. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  16. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  17. package/system/dist/builtins/alerts/alerts.addon.js +7 -1
  18. package/system/dist/builtins/alerts/alerts.addon.mjs +7 -1
  19. package/system/dist/builtins/autotrack/index.js +1 -1
  20. package/system/dist/builtins/autotrack/index.mjs +1 -1
  21. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  22. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  23. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  24. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  25. package/system/dist/builtins/camera-grid/index.js +1 -1
  26. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  27. package/system/dist/builtins/composer/composer.addon.js +3 -3
  28. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  29. package/system/dist/builtins/console-logging/index.js +1 -1
  30. package/system/dist/builtins/console-logging/index.mjs +1 -1
  31. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  32. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  33. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  34. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  35. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  36. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  37. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  38. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  39. package/system/dist/builtins/keychain/index.js +3 -3
  40. package/system/dist/builtins/keychain/index.mjs +3 -3
  41. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  42. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  43. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  44. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  45. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  46. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  47. package/system/dist/builtins/loki-logging/index.js +2 -1
  48. package/system/dist/builtins/loki-logging/index.mjs +2 -1
  49. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  50. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  51. package/system/dist/builtins/platform-probe/index.js +1 -1
  52. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  53. package/system/dist/builtins/record-entries/index.js +1 -1
  54. package/system/dist/builtins/record-entries/index.mjs +1 -1
  55. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  56. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  57. package/system/dist/builtins/snapshot/index.js +1 -1
  58. package/system/dist/builtins/snapshot/index.mjs +1 -1
  59. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  60. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  61. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  62. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  63. package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +6 -0
  64. package/system/dist/builtins/sqlite-storage/integration-rows-ports.d.ts +16 -0
  65. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  66. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  67. package/system/dist/builtins/storage-orchestrator/location-store.d.ts +8 -0
  68. package/system/dist/builtins/storage-orchestrator/migrations/index.d.ts +10 -0
  69. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +22 -0
  70. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +260 -19
  71. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +260 -19
  72. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +54 -21
  73. package/system/dist/builtins/storage-orchestrator/storage-writability-monitor.d.ts +36 -0
  74. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  75. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  76. package/system/dist/builtins/winston-logging/index.js +1 -1
  77. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  78. package/system/dist/{capture-engine-WttiBMdu.mjs → capture-engine-Btq9LseJ.mjs} +1 -1
  79. package/system/dist/{capture-engine-CInzGJAh.js → capture-engine-DgcmHuIi.js} +1 -1
  80. package/system/dist/{composition-sources-DQHH_g-A.js → composition-sources-DrGLoV8D.js} +1 -1
  81. package/system/dist/{composition-sources-A4LM38lT.mjs → composition-sources-xyPI-9ja.mjs} +1 -1
  82. package/system/dist/{constants-BAG_5cF6.mjs → constants-B8q9KsGq.mjs} +1 -1
  83. package/system/dist/{constants-hAbcGGDs.js → constants-BiE3GU1C.js} +1 -1
  84. package/system/dist/{device-ca-lLGjDsFP.js → device-ca-Bel2vDyJ.js} +1 -1
  85. package/system/dist/{device-ca-CCIaKs70.mjs → device-ca-D5U9i2AO.mjs} +1 -1
  86. package/system/dist/{dist-CiwLP3-C.js → dist-B6-AUY2T.js} +166 -24
  87. package/system/dist/{dist-BIJD_nvZ.mjs → dist-Dd_vXorK.mjs} +166 -24
  88. package/system/dist/file-host-worker.js +1 -1
  89. package/system/dist/file-host-worker.mjs +1 -1
  90. package/system/dist/{hub-mdns-ciao-CLlDILdC.js → hub-mdns-ciao-DV7bwoub.js} +2 -2
  91. package/system/dist/{hub-mdns-ciao-CXsUIWw_.mjs → hub-mdns-ciao-Dz9w_pd0.mjs} +2 -2
  92. package/system/dist/index.js +54 -7
  93. package/system/dist/index.mjs +54 -7
  94. package/system/dist/kernel/addon-loader.d.ts +13 -1
  95. package/system/dist/kernel/moleculer/addon-context-factory.d.ts +3 -1
  96. package/system/dist/{restore-archive-Dx9r-ndj.mjs → restore-archive-BcdcInFR.mjs} +1 -1
  97. package/system/dist/{restore-archive-CN1BA_o6.js → restore-archive-BcstsRhG.js} +1 -1
  98. package/system/dist/{wal-maintenance-B7wMSexc.mjs → wal-maintenance-Ctp8Q-y7.mjs} +0 -0
  99. package/system/dist/{wal-maintenance-CecPWej8.js → wal-maintenance-CzjpuF7n.js} +0 -0
  100. package/system/package.json +1 -1
@@ -1171,7 +1171,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1171
1171
  return DeviceRole;
1172
1172
  }({});
1173
1173
  //#endregion
1174
- //#region ../types/dist/sleep-BSQ0OgQT.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));
@@ -4567,7 +4591,7 @@ function defineRecordKinds(specs) {
4567
4591
  retention: spec.retention,
4568
4592
  deviceRemoval: spec.deviceRemoval,
4569
4593
  maxDataBytes: spec.maxDataBytes,
4570
- secretPaths: [...secretPaths],
4594
+ secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
4571
4595
  secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
4572
4596
  transactFamily: spec.transactFamily,
4573
4597
  entry: spec.entry === void 0 ? void 0 : {
@@ -4615,6 +4639,7 @@ function defineEntryKind(name, spec) {
4615
4639
  ...spec.database === void 0 ? {} : { database: spec.database },
4616
4640
  ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
4617
4641
  ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
4642
+ ...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
4618
4643
  entry: {
4619
4644
  title: spec.title,
4620
4645
  ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
@@ -11032,11 +11057,49 @@ var IntegrationInstanceRefSchema = z.object({
11032
11057
  ]),
11033
11058
  candidateStableId: z.string().optional()
11034
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
+ */
11035
11073
  /** The most instances one addon lists (an integrations page, not a table). */
11036
11074
  var INSTANCES_LIST_MAX = 1e3;
11037
11075
  /** The keys of the kind's secret fields that sit at the top level of the body. */
11038
11076
  function topLevelSecretKeys(paths) {
11039
- 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 = 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;
11040
11103
  }
11041
11104
  var RecordIntegrationInstances = class {
11042
11105
  records;
@@ -11044,14 +11107,20 @@ var RecordIntegrationInstances = class {
11044
11107
  hooks;
11045
11108
  handle;
11046
11109
  secretKeys;
11110
+ secretMaps;
11047
11111
  nameField;
11112
+ /** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
11113
+ registryOwnsEnabled;
11048
11114
  constructor(records, kind, hooks) {
11049
11115
  this.records = records;
11050
11116
  this.kind = kind;
11051
11117
  this.hooks = hooks;
11052
11118
  this.handle = records.kind(kind);
11053
11119
  this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
11120
+ this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
11054
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"`);
11055
11124
  }
11056
11125
  /**
11057
11126
  * One instance read for the addon's own runtime; null when absent. When the keychain is
@@ -11097,12 +11166,12 @@ var RecordIntegrationInstances = class {
11097
11166
  const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
11098
11167
  const rawName = record.data[this.nameField];
11099
11168
  const kind = this.hooks.kindOf?.(record.data);
11100
- const health = this.hooks.health?.(record.data);
11169
+ const health = this.hooks.health?.(record.data, record.id);
11101
11170
  return {
11102
11171
  id: record.id,
11103
11172
  name: typeof rawName === "string" ? rawName : record.id,
11104
11173
  configured: this.hooks.configured(record.data),
11105
- enabled: record.data.enabled !== false,
11174
+ ...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
11106
11175
  formValues: shown,
11107
11176
  ...kind !== void 0 ? { kind } : {},
11108
11177
  ...health?.status !== void 0 ? { status: health.status } : {},
@@ -11132,32 +11201,36 @@ var RecordIntegrationInstances = class {
11132
11201
  id: minted,
11133
11202
  data: this.hooks.initialBody(name, kind)
11134
11203
  }, { ifRev: 0 });
11135
- await this.hooks.onChanged?.(minted);
11204
+ await this.hooks.onChanged?.(minted, "created");
11136
11205
  return { id: minted };
11137
11206
  };
11138
11207
  updateInstance = async ({ id, name, values }) => {
11139
11208
  const patch = {};
11140
11209
  for (const [key, value] of Object.entries(values)) {
11141
11210
  if (value === void 0) continue;
11142
- 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;
11143
11215
  else if (isSecretClear(value)) patch[key] = null;
11144
11216
  else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
11145
11217
  }
11146
11218
  if (name !== void 0) patch[this.nameField] = name;
11147
11219
  await this.handle.patch(id, patch);
11148
- await this.hooks.onChanged?.(id);
11220
+ await this.hooks.onChanged?.(id, "updated");
11149
11221
  return { ok: true };
11150
11222
  };
11151
11223
  /** The switch lives in the record body; the addon is told so it applies it (D996). */
11152
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`);
11153
11226
  await this.handle.patch(id, { enabled });
11154
- await this.hooks.onChanged?.(id);
11227
+ await this.hooks.onChanged?.(id, "enabled");
11155
11228
  return { ok: true };
11156
11229
  };
11157
11230
  /** The row and its keychain refs go together (the records door). */
11158
11231
  deleteInstance = async ({ id }) => {
11159
11232
  await this.handle.delete(id);
11160
- await this.hooks.onChanged?.(id);
11233
+ await this.hooks.onChanged?.(id, "deleted");
11161
11234
  return { ok: true };
11162
11235
  };
11163
11236
  testInstance = async (input) => {
@@ -56335,7 +56408,27 @@ var deviceCredentialsCapability = {
56335
56408
  * exposes only the COMMON surface: link state, supported device
56336
56409
  * kinds (so the UI can filter the device picker), and per-device
56337
56410
  * expose/unexpose.
56338
- */
56411
+ *
56412
+ * INSTANCES. One export addon can serve several independent targets (a
56413
+ * HomeKit bridge, a Home Assistant broker). `listInstances` names them.
56414
+ * `instanceId` on a READ is optional: absent = the whole addon (linked if any
56415
+ * enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
56416
+ * default instance's); present = that instance; an id the provider does not
56417
+ * serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
56418
+ * never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
56419
+ * change always names the target it changes. A single-instance provider
56420
+ * accepts an absent id on a read or its own id, and refuses any other.
56421
+ */
56422
+ /** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
56423
+ var InstanceIdSchema$1 = z.string().min(1);
56424
+ var InstancePinSchema = z.object({ instanceId: InstanceIdSchema$1.optional() });
56425
+ /** One independent export target of an addon. */
56426
+ var ExportInstanceSchema = z.object({
56427
+ instanceId: InstanceIdSchema$1,
56428
+ name: z.string(),
56429
+ enabled: z.boolean(),
56430
+ kind: z.string().optional()
56431
+ });
56339
56432
  var LinkStateSchema = z.enum([
56340
56433
  "unlinked",
56341
56434
  "linked",
@@ -56386,10 +56479,14 @@ var ExposedDeviceSchema = z.object({
56386
56479
  capabilities: z.array(z.string()).optional()
56387
56480
  });
56388
56481
  var ExposeInputSchema = z.object({
56482
+ instanceId: InstanceIdSchema$1,
56389
56483
  deviceId: z.string(),
56390
56484
  capabilities: z.array(z.string()).optional()
56391
56485
  });
56392
- var UnexposeInputSchema = z.object({ deviceId: z.string() });
56486
+ var UnexposeInputSchema = z.object({
56487
+ instanceId: InstanceIdSchema$1,
56488
+ deviceId: z.string()
56489
+ });
56393
56490
  /**
56394
56491
  * What an exporter may expose besides devices (D968). An action and a
56395
56492
  * notification target are LIST ENTRIES, never devices (D954): they enter an
@@ -56418,8 +56515,14 @@ var ExposedEntitySchema = z.object({
56418
56515
  entity: ExportEntityRefSchema,
56419
56516
  exposedAs: z.string().optional()
56420
56517
  });
56421
- var ExposeEntityInputSchema = z.object({ entity: ExportEntityRefSchema });
56422
- var UnexposeEntityInputSchema = z.object({ entity: ExportEntityRefSchema });
56518
+ var ExposeEntityInputSchema = z.object({
56519
+ instanceId: InstanceIdSchema$1,
56520
+ entity: ExportEntityRefSchema
56521
+ });
56522
+ var UnexposeEntityInputSchema = z.object({
56523
+ instanceId: InstanceIdSchema$1,
56524
+ entity: ExportEntityRefSchema
56525
+ });
56423
56526
  var deviceExportCapability = {
56424
56527
  name: "device-export",
56425
56528
  scope: "system",
@@ -56439,9 +56542,10 @@ var deviceExportCapability = {
56439
56542
  */
56440
56543
  exposesDeviceSettings: true,
56441
56544
  methods: {
56442
- getStatus: method(z.void(), DeviceExportStatusSchema),
56443
- listSupportedDeviceKinds: method(z.void(), z.array(DeviceKindSchema)),
56444
- listExposedDevices: method(z.void(), z.array(ExposedDeviceSchema)),
56545
+ getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
56546
+ listInstances: method(z.void(), z.array(ExportInstanceSchema)),
56547
+ listSupportedDeviceKinds: method(InstancePinSchema, z.array(DeviceKindSchema)),
56548
+ listExposedDevices: method(InstancePinSchema, z.array(ExposedDeviceSchema)),
56445
56549
  exposeDevice: method(ExposeInputSchema, z.void(), {
56446
56550
  kind: "mutation",
56447
56551
  auth: "admin"
@@ -56451,7 +56555,7 @@ var deviceExportCapability = {
56451
56555
  auth: "admin"
56452
56556
  }),
56453
56557
  listSupportedEntityKinds: optionalMethod(z.void(), z.array(ExportEntityKindSchema)),
56454
- listExposedEntities: optionalMethod(z.void(), z.array(ExposedEntitySchema)),
56558
+ listExposedEntities: optionalMethod(InstancePinSchema, z.array(ExposedEntitySchema)),
56455
56559
  exposeEntity: optionalMethod(ExposeEntityInputSchema, z.void(), {
56456
56560
  kind: "mutation",
56457
56561
  auth: "admin"
@@ -62101,7 +62205,37 @@ var IntegrationInstanceKindSchema = z.object({
62101
62205
  /** Relative hub path to disconnect that account. */
62102
62206
  disconnectPath: z.string().min(1).optional()
62103
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 = 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 = z.object({
62227
+ mode: z.enum([
62228
+ "none",
62229
+ "lan",
62230
+ "account"
62231
+ ]),
62232
+ scopedToInstance: z.boolean()
62233
+ });
62104
62234
  var IntegrationInstanceDescriptionSchema = 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(),
62105
62239
  /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
62106
62240
  instanceMode: IntegrationInstanceModeSchema,
62107
62241
  /** What the instance is, for the UI (`destination`, `relay`, `account`). */
@@ -62141,10 +62275,11 @@ var IntegrationInstanceSchema = z.object({
62141
62275
  /** The addon's own rule (an URL is present, a client id is present...). */
62142
62276
  configured: z.boolean(),
62143
62277
  /**
62144
- * The instance's own on/off switch (D996): always present, derived from the record body
62145
- * (`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.
62146
62281
  */
62147
- enabled: z.boolean(),
62282
+ enabled: z.boolean().optional(),
62148
62283
  /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
62149
62284
  kind: z.string().optional(),
62150
62285
  /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
@@ -97035,6 +97170,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
97035
97170
  access: "view",
97036
97171
  role: "admin"
97037
97172
  },
97173
+ "deviceExport.listInstances": {
97174
+ capName: "device-export",
97175
+ capScope: "system",
97176
+ addonId: null,
97177
+ access: "view",
97178
+ role: "admin"
97179
+ },
97038
97180
  "deviceExport.listSupportedDeviceKinds": {
97039
97181
  capName: "device-export",
97040
97182
  capScope: "system",
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-CecPWej8.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-CzjpuF7n.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-B7wMSexc.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-Ctp8Q-y7.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,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-CiwLP3-C.js");
2
+ const require_dist = require("./dist-B6-AUY2T.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
- const require_agent_https = require("./agent-https-DXDFMq90.js");
4
+ const require_agent_https = require("./agent-https-BHpDnJr0.js");
5
5
  let node_crypto = require("node:crypto");
6
6
  let _camstack_types_node = require("@camstack/types/node");
7
7
  let node_fs_promises = require("node:fs/promises");
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
2
- import { ac as userError } from "./dist-BIJD_nvZ.mjs";
2
+ import { ac as userError } from "./dist-Dd_vXorK.mjs";
3
3
  import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
4
- import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-Bafgj4ni.mjs";
4
+ import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-UksJdbes.mjs";
5
5
  import { X509Certificate, createPrivateKey } from "node:crypto";
6
6
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
7
7
  import { mkdir, writeFile } from "node:fs/promises";
@@ -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-CiwLP3-C.js");
4
- const require_device_ca = require("./device-ca-lLGjDsFP.js");
3
+ const require_dist = require("./dist-B6-AUY2T.js");
4
+ const require_device_ca = require("./device-ca-Bel2vDyJ.js");
5
5
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
6
6
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
7
7
  require("./builtins/alerts/index.js");
@@ -26,21 +26,21 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
26
26
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
27
27
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
28
28
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
29
- const require_wal_maintenance = require("./wal-maintenance-CecPWej8.js");
29
+ const require_wal_maintenance = require("./wal-maintenance-CzjpuF7n.js");
30
30
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
31
31
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
32
32
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
33
33
  require("./builtins/storage-orchestrator/index.js");
34
- const require_agent_https = require("./agent-https-DXDFMq90.js");
35
- const require_constants = require("./constants-hAbcGGDs.js");
34
+ const require_agent_https = require("./agent-https-BHpDnJr0.js");
35
+ const require_constants = require("./constants-BiE3GU1C.js");
36
36
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
37
37
  require("./builtins/system-config/index.js");
38
38
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
39
39
  const require_custom_action_registry = require("./custom-action-registry-JuMHGKEc.js");
40
- const require_hub_mdns_ciao = require("./hub-mdns-ciao-CLlDILdC.js");
40
+ const require_hub_mdns_ciao = require("./hub-mdns-ciao-DV7bwoub.js");
41
41
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
42
42
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
43
- const require_restore_archive = require("./restore-archive-CN1BA_o6.js");
43
+ const require_restore_archive = require("./restore-archive-BcstsRhG.js");
44
44
  const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
45
45
  let zod = require("zod");
46
46
  let node_crypto = require("node:crypto");
@@ -6129,6 +6129,24 @@ var IntegrationRegistry = class IntegrationRegistry {
6129
6129
  for (const row of rows) result[String(row.data["key"])] = deserializeSetting(row.data["value"], String(row.data["value_type"]));
6130
6130
  return result;
6131
6131
  }
6132
+ /**
6133
+ * Delete every legacy setting row of an integration and answer the keychain refs the rows
6134
+ * carried, so the caller (the rows-to-record migration) releases them after the rows are gone.
6135
+ * The integration itself stays.
6136
+ */
6137
+ async clearIntegrationSettings(integrationId) {
6138
+ const refs = require_dist.collectSecretMarkerRefs(await this.getIntegrationSettings(integrationId));
6139
+ const kind = this.recordStores?.settings;
6140
+ if (kind !== void 0) {
6141
+ for (const row of await (0, import_read_all_rows.readAllRows)(kind)) if (row.data.integrationId === integrationId) await kind.delete(row.id);
6142
+ return refs;
6143
+ }
6144
+ await this.store.deleteWhere({
6145
+ collection: INTEGRATION_SETTINGS,
6146
+ filter: { where: { integration_id: integrationId } }
6147
+ });
6148
+ return refs;
6149
+ }
6132
6150
  async setIntegrationSetting(integrationId, key, value) {
6133
6151
  const s = serializeSetting(value);
6134
6152
  const rowId = `${integrationId}:${key}`;
@@ -6937,6 +6955,7 @@ var AddonLoader = class {
6937
6955
  packageName,
6938
6956
  addonDir,
6939
6957
  addonId: declaration.id,
6958
+ declaration,
6940
6959
  error,
6941
6960
  timestamp: Date.now()
6942
6961
  });
@@ -7026,6 +7045,33 @@ var AddonLoader = class {
7026
7045
  listStorageLocationDeclarations() {
7027
7046
  return extractStorageLocationDeclarations(this.addons.values());
7028
7047
  }
7048
+ /**
7049
+ * Every addon that declares storage locations, loaded or not. A failed load
7050
+ * keeps the declarations its manifest carried; a package that could not be
7051
+ * read at all is listed with `addonId: null` and no declarations (unknown).
7052
+ */
7053
+ listStorageLocationDeclarers() {
7054
+ const result = [];
7055
+ for (const [addonId, addon] of this.addons) {
7056
+ const declared = addon.declaration.storageLocations;
7057
+ if (declared !== void 0 && declared.length > 0) result.push({
7058
+ addonId,
7059
+ packageName: addon.packageName,
7060
+ loaded: true,
7061
+ declarations: [...declared]
7062
+ });
7063
+ }
7064
+ for (const failure of this.loadFailures) {
7065
+ if (failure.addonId !== void 0 && this.addons.has(failure.addonId)) continue;
7066
+ result.push({
7067
+ addonId: failure.addonId ?? null,
7068
+ packageName: failure.packageName,
7069
+ loaded: false,
7070
+ declarations: failure.declaration?.storageLocations ?? []
7071
+ });
7072
+ }
7073
+ return result;
7074
+ }
7029
7075
  /** Check if an addon is registered */
7030
7076
  hasAddon(addonId) {
7031
7077
  return this.addons.has(addonId);
@@ -24280,6 +24326,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
24280
24326
  storage: options?.storageProvider ?? void 0,
24281
24327
  capabilityRegistry: options?.capabilityRegistry,
24282
24328
  ...options?.listStorageLocationDeclarations ? { listStorageLocationDeclarations: options.listStorageLocationDeclarations } : {},
24329
+ ...options?.listStorageLocationDeclarers ? { listStorageLocationDeclarers: options.listStorageLocationDeclarers } : {},
24283
24330
  readinessRegistry: readinessRegistry(),
24284
24331
  deviceRegistry: workerDeviceRegistry,
24285
24332
  devices: createBrokerDeviceManagerApi({
@@ -1,6 +1,6 @@
1
1
  import { i as __require } from "./chunk-CNf5ZN-e.mjs";
2
- import { Ci as objectInputDeclaresRequiredDeviceId, Do as DATAPLANE_SECRET_HEADER$1, E as CatalogFileSchema, Ea as supportedRuntimes, Eo as CALLER_STAMPED_CAPABILITIES$1, Go as ReadinessRegistry, Gr as isVoidInput, Gs as parseJsonUnknown, Ii as procedureAuthKey, Ko as ReadinessTimeoutError, Kr as kebabToCamel$1, Lr as isArrayOutputSchema, Nr as interpolate, Oo as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Os as isDebugChannelName, Qi as resolveMethodAuth, Rr as isCollectionArrayMethod, Si as objectInputDeclaresAddonId, Ss as expandCapMethods, Ur as isObjectInput, Wo as RUNTIME_DEFAULTS, Ws as parseJsonObject, Ys as resolveCapMount, Zr as lifecycleJobSchema, Zs as scopeKey, a as AGENT_MDNS_TXT_KEYS, ac as userError, ai as looseSchema, as as asNumber, bs as emitDownForOwnedCaps, bt as METHOD_ACCESS_MAP, ca as scopesAllowDeviceCap, dc as EventCategory$1, i as AGENT_MDNS_SERVICE_TYPE, ii as logLevelAtMost, is as asJsonObject$1, ko as DEVICE_STATUS_METHOD, ln as addonSettingsCapability, ms as createEvent$1, o as ALL_CAPABILITY_DEFINITIONS, oc as withoutCallerStamp, os as asString$1, qs as readinessKey, sa as scopesAllowAddon, uc as errMsg$1, va as splitTranslationRef, vn as bareAddonId, vt as LOG_LEVEL_RANK, ws as getDebugInterest, y as CATALOG_LANGS, yr as extractNestedAddonId, ys as defineRecordKinds } from "./dist-BIJD_nvZ.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-CCIaKs70.mjs";
2
+ import { Ci as objectInputDeclaresRequiredDeviceId, Do as DATAPLANE_SECRET_HEADER$1, E as CatalogFileSchema, Ea as supportedRuntimes, Eo as CALLER_STAMPED_CAPABILITIES$1, Go as ReadinessRegistry, Gr as isVoidInput, Gs as parseJsonUnknown, Ii as procedureAuthKey, Ko as ReadinessTimeoutError, Kr as kebabToCamel$1, Lr as isArrayOutputSchema, Nr as interpolate, Oo as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Os as isDebugChannelName, Qi as resolveMethodAuth, Rr as isCollectionArrayMethod, Si as objectInputDeclaresAddonId, Ss as expandCapMethods, Ur as isObjectInput, Wo as RUNTIME_DEFAULTS, Ws as parseJsonObject, Ys as resolveCapMount, Zr as lifecycleJobSchema, Zs as scopeKey, a as AGENT_MDNS_TXT_KEYS, ac as userError, ai as looseSchema, as as asNumber, bs as emitDownForOwnedCaps, bt as METHOD_ACCESS_MAP, ca as scopesAllowDeviceCap, dc as EventCategory$1, fs as collectSecretMarkerRefs, i as AGENT_MDNS_SERVICE_TYPE, ii as logLevelAtMost, is as asJsonObject$1, ko as DEVICE_STATUS_METHOD, ln as addonSettingsCapability, ms as createEvent$1, o as ALL_CAPABILITY_DEFINITIONS, oc as withoutCallerStamp, os as asString$1, qs as readinessKey, sa as scopesAllowAddon, uc as errMsg$1, va as splitTranslationRef, vn as bareAddonId, vt as LOG_LEVEL_RANK, ws as getDebugInterest, y as CATALOG_LANGS, yr as extractNestedAddonId, ys as defineRecordKinds } from "./dist-Dd_vXorK.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-D5U9i2AO.mjs";
4
4
  import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
5
5
  import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
6
6
  import "./builtins/alerts/index.mjs";
@@ -25,21 +25,21 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
25
25
  import NativeMetricsAddon, { a as NativeMetricsProvider, i as parseProcStatusRss, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
26
26
  import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
27
27
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
28
- import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-B7wMSexc.mjs";
28
+ import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-Ctp8Q-y7.mjs";
29
29
  import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
30
30
  import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
31
31
  import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapForwardService, l as STORAGE_DRAIN_STATE_LEGACY, n as HUB_CAP_FWD_ACTION, o as buildStorageLocationRegistry, r as HUB_CAP_FWD_SERVICE, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
32
32
  import "./builtins/storage-orchestrator/index.mjs";
33
- import { A as buildNameConstraintSet, B as setProcessAgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, F as readNameConstraints, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, N as permitsIdentity, O as PERMITTED_DNS_SUFFIXES, P as permitsName, R as AgentHttpsNames, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as issueAgentHttpsLeaf, f as loadAgentHttps, h as CA_COMMON_NAME, i as certificateNames, j as isConstrainedCa, k as PERMITTED_IP_RANGES, l as isContainerBridgeAddress, m as pinnedHttpsCaFingerprint, n as acceptAgentSans, o as createAgentHttpsRequest, p as pemDigest, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isPrivateAddress, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts, y as localCaCommonName, z as getProcessAgentHttpsNames } from "./agent-https-Bafgj4ni.mjs";
34
- 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-BAG_5cF6.mjs";
33
+ import { A as buildNameConstraintSet, B as setProcessAgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, F as readNameConstraints, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, N as permitsIdentity, O as PERMITTED_DNS_SUFFIXES, P as permitsName, R as AgentHttpsNames, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as issueAgentHttpsLeaf, f as loadAgentHttps, h as CA_COMMON_NAME, i as certificateNames, j as isConstrainedCa, k as PERMITTED_IP_RANGES, l as isContainerBridgeAddress, m as pinnedHttpsCaFingerprint, n as acceptAgentSans, o as createAgentHttpsRequest, p as pemDigest, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isPrivateAddress, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts, y as localCaCommonName, z as getProcessAgentHttpsNames } from "./agent-https-UksJdbes.mjs";
34
+ 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-B8q9KsGq.mjs";
35
35
  import { $ as caFingerprintCompact, A as getProcessNodeMeshTransport, B as MESH_NODE_CERTIFICATES_COLLECTION, C as MESH_TLS_PORT_HELLO_FIELD, Ct as readOriginSetting, D as setProcessMeshTlsEnabler, Dt as readCidrSetting, E as ServiceBroker, Et as parseCidrList, F as renewMeshCertificate, G as getProcessMeshCertificateRegistry, H as MeshCertificateRegistry, I as revokeMeshCertificate, J as processMeshCrl, K as setProcessMeshCertificateRegistry, L as getProcessMeshTlsListenerState, M as isProcessVerifiedMeshPeer, N as onProcessNodeRegistered, O as dropProcessPeer, P as setProcessMeshPeerTransportLookup, Q as caFingerprint, R as openMeshTlsWhenRevocationsLoaded, S as verifyMembershipAnswer, St as parseOriginList, SystemConfigAddon, T as Errors, Tt as normalizeIp, U as RENEWAL_ABANDONED, V as MESH_NODE_CERTIFICATES_COLUMNS, W as describeMeshLeaf, X as getProcessMeshCaState, Y as MeshCaKeeper, Z as requireProcessMeshCa, _ as signPairingProof, _t as verifyAgentUiUnlockTicket, a as hubHostFromMeshAddress, at as issueMeshLeafForNode, b as MembershipResponder, bt as isInsecureOrigin, c as PAIRING_MAX_SESSIONS, ct as AGENT_DASHBOARD_ORIGINS_FIELD, d as PAIRING_PROTOCOL, dt as AGENT_UI_UNLOCK_USE, et as createMeshCsrPem, f as PAIRING_TTL_MS, ft as AGENT_UI_UNLOCK_VERSION, g as keyFingerprintShort, gt as parseAgentDashboardOrigins, h as describeCsr, ht as mintAgentUiUnlockTicket, i as AgentPairing, it as isValidAgentNodeId, j as getProcessPeerLeaf, k as emitProcessNodeRegistered, l as PAIRING_PATHS, lt as AGENT_UI_UNLOCK_TTL_MS, m as computePairingSas, mt as isAllowedAgentDashboardReturnTo, n as HubPairing, nt as generateMeshCa, o as PAIRING_CODE_DIGITS, ot as issueMeshLeafFromCsr, p as computePairingCommitment, pt as UnlockTicketJtiStore, q as MeshCrl, r as PairingHttpError, rt as generateMeshKeyPair, s as PAIRING_MAX_CODE_ATTEMPTS, st as loadMeshCa, tt as exportMeshPrivateKeyPem, u as PAIRING_PIN_DIGITS, ut as AGENT_UI_UNLOCK_TYP, v as verifyPairingProof, vt as InvalidCorsOriginError, w as TlsTcpTransporter, wt as createCidrMatcher, x as signMembershipProof, xt as normalizeOrigin, y as MEMBERSHIP_PATHS, yt as OPAQUE_ORIGIN, z as setProcessMeshTlsListenerState } from "./builtins/system-config/system-config.addon.mjs";
36
36
  import "./builtins/system-config/index.mjs";
37
37
  import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
38
38
  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-oHl1xltx.mjs";
39
- 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-CXsUIWw_.mjs";
39
+ 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-Dz9w_pd0.mjs";
40
40
  import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
41
41
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
42
- 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-Dx9r-ndj.mjs";
42
+ 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-BcdcInFR.mjs";
43
43
  import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-DBlgWB8k.mjs";
44
44
  import { z } from "zod";
45
45
  import * as crypto$1 from "node:crypto";
@@ -6126,6 +6126,24 @@ var IntegrationRegistry = class IntegrationRegistry {
6126
6126
  for (const row of rows) result[String(row.data["key"])] = deserializeSetting(row.data["value"], String(row.data["value_type"]));
6127
6127
  return result;
6128
6128
  }
6129
+ /**
6130
+ * Delete every legacy setting row of an integration and answer the keychain refs the rows
6131
+ * carried, so the caller (the rows-to-record migration) releases them after the rows are gone.
6132
+ * The integration itself stays.
6133
+ */
6134
+ async clearIntegrationSettings(integrationId) {
6135
+ const refs = collectSecretMarkerRefs(await this.getIntegrationSettings(integrationId));
6136
+ const kind = this.recordStores?.settings;
6137
+ if (kind !== void 0) {
6138
+ for (const row of await (0, import_read_all_rows.readAllRows)(kind)) if (row.data.integrationId === integrationId) await kind.delete(row.id);
6139
+ return refs;
6140
+ }
6141
+ await this.store.deleteWhere({
6142
+ collection: INTEGRATION_SETTINGS,
6143
+ filter: { where: { integration_id: integrationId } }
6144
+ });
6145
+ return refs;
6146
+ }
6129
6147
  async setIntegrationSetting(integrationId, key, value) {
6130
6148
  const s = serializeSetting(value);
6131
6149
  const rowId = `${integrationId}:${key}`;
@@ -6934,6 +6952,7 @@ var AddonLoader = class {
6934
6952
  packageName,
6935
6953
  addonDir,
6936
6954
  addonId: declaration.id,
6955
+ declaration,
6937
6956
  error,
6938
6957
  timestamp: Date.now()
6939
6958
  });
@@ -7023,6 +7042,33 @@ var AddonLoader = class {
7023
7042
  listStorageLocationDeclarations() {
7024
7043
  return extractStorageLocationDeclarations(this.addons.values());
7025
7044
  }
7045
+ /**
7046
+ * Every addon that declares storage locations, loaded or not. A failed load
7047
+ * keeps the declarations its manifest carried; a package that could not be
7048
+ * read at all is listed with `addonId: null` and no declarations (unknown).
7049
+ */
7050
+ listStorageLocationDeclarers() {
7051
+ const result = [];
7052
+ for (const [addonId, addon] of this.addons) {
7053
+ const declared = addon.declaration.storageLocations;
7054
+ if (declared !== void 0 && declared.length > 0) result.push({
7055
+ addonId,
7056
+ packageName: addon.packageName,
7057
+ loaded: true,
7058
+ declarations: [...declared]
7059
+ });
7060
+ }
7061
+ for (const failure of this.loadFailures) {
7062
+ if (failure.addonId !== void 0 && this.addons.has(failure.addonId)) continue;
7063
+ result.push({
7064
+ addonId: failure.addonId ?? null,
7065
+ packageName: failure.packageName,
7066
+ loaded: false,
7067
+ declarations: failure.declaration?.storageLocations ?? []
7068
+ });
7069
+ }
7070
+ return result;
7071
+ }
7026
7072
  /** Check if an addon is registered */
7027
7073
  hasAddon(addonId) {
7028
7074
  return this.addons.has(addonId);
@@ -24277,6 +24323,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
24277
24323
  storage: options?.storageProvider ?? void 0,
24278
24324
  capabilityRegistry: options?.capabilityRegistry,
24279
24325
  ...options?.listStorageLocationDeclarations ? { listStorageLocationDeclarations: options.listStorageLocationDeclarations } : {},
24326
+ ...options?.listStorageLocationDeclarers ? { listStorageLocationDeclarers: options.listStorageLocationDeclarers } : {},
24280
24327
  readinessRegistry: readinessRegistry(),
24281
24328
  deviceRegistry: workerDeviceRegistry,
24282
24329
  devices: createBrokerDeviceManagerApi({