@camstack/addon-export-alexa 1.2.186 → 1.2.188

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.
@@ -34,7 +34,7 @@ let node_path = require("node:path");
34
34
  node_path = __toESM(node_path, 1);
35
35
  require("node:child_process");
36
36
  require("node:zlib");
37
- //#region ../types/dist/event-category-BmPm98n0.mjs
37
+ //#region ../types/dist/event-category-78tcBemo.mjs
38
38
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
39
39
  EventCategory["SystemBoot"] = "system.boot";
40
40
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -155,6 +155,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
155
155
  */
156
156
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
157
157
  /**
158
+ * An addon is RUNNING although its installed package is below what the
159
+ * running server requires (`camstack.requires.addons` of the server, or the
160
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
161
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
162
+ * operator alert per node and package. The addon is never held back for it.
163
+ *
164
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
165
+ */
166
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
167
+ /**
168
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
169
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
170
+ *
171
+ * Payload: `{ packageName, addonId, nodeId }`.
172
+ */
173
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
174
+ /**
158
175
  * Monitor scheduled the next retry for a failed addon. Transient —
159
176
  * surfaced to the UI for live-updating the "next retry in Ns"
160
177
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -265,7 +282,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
265
282
  EventCategory["ProcessRestarted"] = "process.restarted";
266
283
  /**
267
284
  * The SET of storage locations changed — one was created, edited, enabled,
268
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
285
+ * disabled or deleted through the location instances or the forced-delete action.
269
286
  *
270
287
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
271
288
  * it must also converge on its own periodic path, because a dropped event
@@ -6016,7 +6033,7 @@ var ZodIssueCode = {
6016
6033
  var ZodFirstPartyTypeKind;
6017
6034
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6018
6035
  //#endregion
6019
- //#region ../types/dist/sleep-D7ZKm4nb.mjs
6036
+ //#region ../types/dist/sleep-CQP-REJp.mjs
6020
6037
  /**
6021
6038
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6022
6039
  * window to float samples (D455).
@@ -6380,6 +6397,59 @@ Object.fromEntries([
6380
6397
  function isValuelessField(field) {
6381
6398
  return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button" || field.type === "account-sign-in" || field.type === "secret-presence";
6382
6399
  }
6400
+ /**
6401
+ * Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
6402
+ * `key → { value, default }`, recursing through `group` and `sub-tabs`
6403
+ * layout fields. Keeping `value` and `default` SEPARATE (rather than
6404
+ * pre-resolving) lets callers both read the effective value AND detect
6405
+ * overrides (`value` differs from `default`). Structural over `unknown`;
6406
+ * malformed input yields an empty map, never throws.
6407
+ */
6408
+ function collectHydratedFieldEntries(schema) {
6409
+ const out = /* @__PURE__ */ new Map();
6410
+ if (typeof schema !== "object" || schema === null) return out;
6411
+ const sections = schema.sections;
6412
+ if (!Array.isArray(sections)) return out;
6413
+ for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
6414
+ return out;
6415
+ }
6416
+ /** Recursive field walker for {@link collectHydratedFieldEntries}. */
6417
+ function collectFieldEntriesInto(fields, into) {
6418
+ if (!Array.isArray(fields)) return;
6419
+ for (const field of fields) {
6420
+ if (typeof field !== "object" || field === null) continue;
6421
+ const type = field.type;
6422
+ if (type === "group") {
6423
+ collectFieldEntriesInto(field.fields, into);
6424
+ continue;
6425
+ }
6426
+ if (type === "sub-tabs") {
6427
+ const tabs = field.tabs;
6428
+ if (Array.isArray(tabs)) {
6429
+ for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
6430
+ }
6431
+ continue;
6432
+ }
6433
+ const key = field.key;
6434
+ if (typeof key !== "string" || key.length === 0) continue;
6435
+ if (!("value" in field)) continue;
6436
+ into.set(key, {
6437
+ value: field.value,
6438
+ default: field.default
6439
+ });
6440
+ }
6441
+ }
6442
+ /**
6443
+ * Flatten a hydrated settings payload into `key → EFFECTIVE value`
6444
+ * (`value ?? default`). The read-side inverse of `hydrateSchema` for the
6445
+ * common "just give me the resolved values" case. Built on
6446
+ * {@link collectHydratedFieldEntries}.
6447
+ */
6448
+ function collectHydratedFieldValues(schema) {
6449
+ const out = /* @__PURE__ */ new Map();
6450
+ for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
6451
+ return out;
6452
+ }
6383
6453
  function hydrateSchema(schema, values, options = {}) {
6384
6454
  return {
6385
6455
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
@@ -7264,17 +7334,35 @@ var RecordIntegrationInstances = class {
7264
7334
  ...kind !== void 0 ? { kind } : {}
7265
7335
  });
7266
7336
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7337
+ const initial = this.hooks.initialBody(name, kind);
7338
+ const patch = this.patchOf(values ?? {});
7339
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7340
+ kind,
7341
+ body: {
7342
+ ...initial,
7343
+ ...patch
7344
+ }
7345
+ }));
7267
7346
  await this.handle.put({
7268
7347
  id: minted,
7269
- data: this.hooks.initialBody(name, kind)
7348
+ data: initial
7270
7349
  }, { ifRev: 0 });
7271
- const patch = this.patchOf(values ?? {});
7272
7350
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7273
7351
  await this.hooks.onChanged?.(minted, "created");
7274
7352
  return { id: minted };
7275
7353
  };
7276
7354
  updateInstance = async ({ id, name, values }) => {
7277
7355
  const patch = this.patchOf(values);
7356
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7357
+ const stored = await this.handle.get(id);
7358
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7359
+ kind: void 0,
7360
+ body: {
7361
+ ...stored.data,
7362
+ ...patch
7363
+ }
7364
+ }));
7365
+ }
7278
7366
  if (name !== void 0) patch[this.nameField] = name;
7279
7367
  await this.handle.patch(id, patch);
7280
7368
  await this.hooks.onChanged?.(id, "updated");
@@ -7585,6 +7673,21 @@ var SCOPED_SETTINGS_SCOPES = [
7585
7673
  "device-defaults",
7586
7674
  "node"
7587
7675
  ];
7676
+ /** The one refusal of a key a scope did not declare. */
7677
+ function assertDeclaredKeys(keys, declared) {
7678
+ const undeclared = keys.filter((key) => !declared.has(key));
7679
+ if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
7680
+ }
7681
+ /** Build the handle over an addon's scoped read, write and unset. */
7682
+ function createScopedSettings(deps) {
7683
+ return {
7684
+ async get() {
7685
+ return deps.schema.parse(await deps.read());
7686
+ },
7687
+ patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
7688
+ unset: (keys) => deps.unset(keys)
7689
+ };
7690
+ }
7588
7691
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7589
7692
  var KeychainWriteRefusedError = class extends Error {
7590
7693
  fieldPath;
@@ -8160,7 +8263,16 @@ function createHandle(raw, opts) {
8160
8263
  return blob;
8161
8264
  }
8162
8265
  },
8163
- writeAddonStore: writeAddon
8266
+ writeAddonStore: writeAddon,
8267
+ removeClearedKeys: (keys) => serialize("addon", async () => {
8268
+ const stored = await readStoredAddonBlob(raw);
8269
+ index.seen("addon", stored);
8270
+ const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
8271
+ if (removable.length === 0) return;
8272
+ const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
8273
+ await raw.writeAddonStore(patch);
8274
+ index.wrote("addon", patch);
8275
+ })
8164
8276
  };
8165
8277
  }
8166
8278
  /** The context the addon sees, plus the private raw view and write outcome. */
@@ -8705,6 +8817,151 @@ var BaseAddon = class {
8705
8817
  }
8706
8818
  }
8707
8819
  /**
8820
+ * Hook: values layered over the stored ones when the FORM of one scope is served
8821
+ * ({@link getScopedSettings}) — a preview that derives dependent options without writing.
8822
+ * Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
8823
+ */
8824
+ async scopedSettingsOverlay(_scope, _cap, _nodeId) {
8825
+ return null;
8826
+ }
8827
+ /**
8828
+ * Hook: a write of one scope changed stored values (not called when the store reports no change,
8829
+ * e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
8830
+ */
8831
+ async onScopedSettingsChanged(_scope, _cap, _keys) {}
8832
+ /** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
8833
+ clusterSettings(cap, schema) {
8834
+ return this.scopedHandle("cluster", cap, schema);
8835
+ }
8836
+ /** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
8837
+ deviceDefaults(cap, schema) {
8838
+ return this.scopedHandle("device-defaults", cap, schema);
8839
+ }
8840
+ /**
8841
+ * Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
8842
+ * with no row yields the schema defaults — never a bare-key fallback.
8843
+ */
8844
+ nodeSettings(cap, schema, nodeId) {
8845
+ return this.scopedHandle("node", cap, schema, nodeId);
8846
+ }
8847
+ /**
8848
+ * {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
8849
+ * settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
8850
+ * central delete. `nodeId` omitted ⇒ the local node.
8851
+ */
8852
+ nodeState(key, schema, fallback, nodeId) {
8853
+ this._declaredStateKeys.add(key);
8854
+ return createDurableState({
8855
+ key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
8856
+ schema,
8857
+ fallback,
8858
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
8859
+ write: async (patch) => {
8860
+ await this._ctx?.settings?.writeAddonStore(patch);
8861
+ },
8862
+ onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
8863
+ addonId: this._ctx?.id,
8864
+ key: k,
8865
+ error: String(e)
8866
+ } })
8867
+ });
8868
+ }
8869
+ /** The loaded schema `cap` declares for `scope`, or `null`. */
8870
+ async declaredScopedSchema(scope, cap) {
8871
+ await this.loadScopedSchemas(cap);
8872
+ return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
8873
+ }
8874
+ async requireScopedSchema(scope, cap) {
8875
+ const schema = await this.declaredScopedSchema(scope, cap);
8876
+ if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
8877
+ return schema;
8878
+ }
8879
+ scopedKeys(schema) {
8880
+ return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
8881
+ }
8882
+ /** `store` narrowed to the keys `schema` declares. */
8883
+ narrowToScope(store, schema) {
8884
+ const keys = this.scopedKeys(schema);
8885
+ return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
8886
+ }
8887
+ scopedHandle(scope, cap, schema, nodeId) {
8888
+ return createScopedSettings({
8889
+ schema,
8890
+ read: async () => {
8891
+ const declared = await this.requireScopedSchema(scope, cap);
8892
+ const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
8893
+ const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
8894
+ return {
8895
+ ...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
8896
+ ...stored
8897
+ };
8898
+ },
8899
+ write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
8900
+ unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
8901
+ });
8902
+ }
8903
+ /** The one write path of the scoped API: declared keys only, then the global patch. */
8904
+ async writeScoped(scope, cap, patch, nodeId) {
8905
+ assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8906
+ if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
8907
+ }
8908
+ /**
8909
+ * Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
8910
+ * value is released exactly as there — and the emptied row is then removed; every other key is
8911
+ * removed by an `undefined` patch (which a secret transform would read as "keep").
8912
+ */
8913
+ async unsetScoped(scope, cap, keys, nodeId) {
8914
+ assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8915
+ const target = scope === "node" ? nodeId : void 0;
8916
+ const tree = this.addonSecretTree();
8917
+ const secretKeys = keys.filter((key) => tree.has(key));
8918
+ const plainKeys = keys.filter((key) => !tree.has(key));
8919
+ let changed = false;
8920
+ if (plainKeys.length > 0) {
8921
+ const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
8922
+ changed = await this.applyGlobalPatch(patch, target, cap) || changed;
8923
+ }
8924
+ if (secretKeys.length > 0) {
8925
+ await this.clearSecretKeys(secretKeys, target, cap);
8926
+ const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
8927
+ const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
8928
+ if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
8929
+ else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
8930
+ changed = true;
8931
+ }
8932
+ if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
8933
+ }
8934
+ /**
8935
+ * The hydrated form of one scope of one capability's settings (any
8936
+ * {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
8937
+ */
8938
+ async getScopedSettings(scope, cap, nodeId) {
8939
+ const schema = await this.declaredScopedSchema(scope, cap);
8940
+ if (schema === null) return null;
8941
+ const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
8942
+ const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
8943
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
8944
+ }
8945
+ /** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
8946
+ async updateScopedSettings(scope, cap, patch, nodeId) {
8947
+ this._operatorWriteDepth++;
8948
+ try {
8949
+ await this.writeScoped(scope, cap, patch, nodeId);
8950
+ } finally {
8951
+ this._operatorWriteDepth--;
8952
+ }
8953
+ }
8954
+ /**
8955
+ * The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
8956
+ * its value. `null` when the capability declares nothing for the scope.
8957
+ */
8958
+ async readScopedValues(scope, cap, nodeId) {
8959
+ const schema = await this.declaredScopedSchema(scope, cap);
8960
+ if (schema === null) return null;
8961
+ const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
8962
+ return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
8963
+ }
8964
+ /**
8708
8965
  * What the create wizard and the integration edit page render for one instance: the addon's
8709
8966
  * per-instance schema when it declares one, else its global schema (what they always showed).
8710
8967
  */
@@ -8856,6 +9113,9 @@ var BaseAddon = class {
8856
9113
  * a keychain (an older kernel) it writes `''`, as such code always did.
8857
9114
  */
8858
9115
  async clearSecrets(keys, nodeId) {
9116
+ await this.clearSecretKeys(keys, nodeId);
9117
+ }
9118
+ async clearSecretKeys(keys, nodeId, cap) {
8859
9119
  const tree = this.addonSecretTree();
8860
9120
  const keychain = this._ctx?.secrets !== void 0;
8861
9121
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
@@ -8868,25 +9128,27 @@ var BaseAddon = class {
8868
9128
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8869
9129
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8870
9130
  }
8871
- await this.applyGlobalPatch(patch, nodeId);
9131
+ await this.applyGlobalPatch(patch, nodeId, cap);
8872
9132
  }
8873
- async applyGlobalPatch(barePatch, nodeId) {
8874
- await this.loadScopedSchemas();
8875
- const keys = this.perNodeKeys();
9133
+ /** Resolves `true` when the write changed stored values. */
9134
+ async applyGlobalPatch(barePatch, nodeId, cap) {
9135
+ await this.loadScopedSchemas(cap);
9136
+ const keys = this.perNodeKeys(cap);
8876
9137
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
8877
9138
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
8878
9139
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
8879
9140
  const handle = this._secretSettings;
8880
9141
  if (handle !== null) {
8881
9142
  const { changed } = await handle.writeAddonStore(scoped);
8882
- if (!changed) return;
9143
+ if (!changed) return false;
8883
9144
  } else await this._ctx?.settings?.writeAddonStore(scoped);
8884
- if (target !== localNode) return;
9145
+ if (target !== localNode) return true;
8885
9146
  await this.resolveConfig();
8886
9147
  await this.onConfigChanged();
8887
9148
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
8888
9149
  const legacy = this.globalSettingsSchema();
8889
9150
  this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
9151
+ return true;
8890
9152
  }
8891
9153
  /**
8892
9154
  * The set of field keys the global settings schema declares `perNode: true`
@@ -10623,7 +10885,6 @@ var CAP_NAMES = Object.freeze([
10623
10885
  "notifier",
10624
10886
  "numeric-sensor",
10625
10887
  "oauth-integration",
10626
- "oidc-connections",
10627
10888
  "osd",
10628
10889
  "osd-manager",
10629
10890
  "pet-feeder",
@@ -12515,8 +12776,7 @@ Object.freeze({
12515
12776
  "device-provider": { "reloadDevice": 18e4 },
12516
12777
  "llm": {
12517
12778
  "generate": 6e5,
12518
- "generateVision": 6e5,
12519
- "testProfile": 6e5
12779
+ "generateVision": 6e5
12520
12780
  },
12521
12781
  "llm-runtime": {
12522
12782
  "complete": 6e5,
@@ -14036,17 +14296,18 @@ function buildCapturingReply(envelope) {
14036
14296
  * message to what the kind supports — callers never special-case a service.
14037
14297
  *
14038
14298
  * DESIGN DECISIONS (locked):
14039
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14040
- * `setTargetEnabled`), each provider persisting via the `settings-store`
14041
- * cap. Rationale: the admin UI needs one uniform surface across the
14042
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14043
- * alternative would fork the UI per addon and cannot host the
14044
- * discovery→adopt flow.
14045
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14046
- * the generated cap-mount auto-`concatCollection`-fans them across every
14047
- * registered provider (notifiers addon + HA addon) so one catalog is
14048
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14049
- * `addonId` the generated collection router extracts from the call input.
14299
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14300
+ * providers serve their targets as `integration-instances` records, one
14301
+ * record kind per target kind, and the admin lists, adds, edits, switches
14302
+ * and deletes them through that cap. This cap keeps what an instance cannot
14303
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14304
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14305
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14306
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14307
+ * cap-mount auto-`concatCollection`-fans them across every registered
14308
+ * provider so one catalog is routable. `send` / `testTarget` /
14309
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14310
+ * collection router extracts from the call input.
14050
14311
  * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14051
14312
  * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14052
14313
  * `storage` / `storage-provider` / `recording` caps over the same path. No
@@ -14291,7 +14552,7 @@ var TargetKindCapsSchema = object({
14291
14552
  * the union is large and not meant for runtime validation here; the exported
14292
14553
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14293
14554
  */
14294
- var ConfigSchemaPassthrough$4 = unknown();
14555
+ var ConfigSchemaPassthrough$3 = unknown();
14295
14556
  var TargetKindSchema = object({
14296
14557
  kind: string(),
14297
14558
  label: string(),
@@ -14328,7 +14589,7 @@ var TargetKindSchema = object({
14328
14589
  * its raster path, which is the safe default for an unknown image.
14329
14590
  */
14330
14591
  iconMediaType: string().optional(),
14331
- configSchema: ConfigSchemaPassthrough$4,
14592
+ configSchema: ConfigSchemaPassthrough$3,
14332
14593
  /**
14333
14594
  * The config keys that decide WHERE this kind's secrets are sent (server,
14334
14595
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -14350,9 +14611,11 @@ var TargetKindSchema = object({
14350
14611
  caps: TargetKindCapsSchema
14351
14612
  });
14352
14613
  /**
14353
- * A persisted target. `config` holds secrets; providers REDACT secret fields
14354
- * (return a presence marker only) when serving `listTargets` — never
14355
- * round-trip a stored secret to the UI.
14614
+ * A target as a provider's own code sees it (the notification-center bridge, the
14615
+ * send path): the flat record body split into the name, the switch and the
14616
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14617
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14618
+ * secret to the UI.
14356
14619
  */
14357
14620
  var TargetSchema = object({
14358
14621
  id: string(),
@@ -14395,13 +14658,13 @@ var ProbeTargetConfigResultSchema = object({
14395
14658
  stateInstance: string().optional(),
14396
14659
  error: string().optional()
14397
14660
  });
14398
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14661
+ method(object({}), array(TargetKindSchema)), method(object({
14399
14662
  kind: string(),
14400
14663
  config: record(string(), unknown()).optional(),
14401
14664
  /**
14402
14665
  * When editing / duplicating, the blank password field never round-trips
14403
14666
  * the stored token. Pass the source target id so the provider can restore
14404
- * secrets server-side before dialling (same merge as upsert).
14667
+ * secrets server-side before dialling.
14405
14668
  */
14406
14669
  targetId: string().optional()
14407
14670
  }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
@@ -14424,27 +14687,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
14424
14687
  }), TestResultSchema, {
14425
14688
  kind: "mutation",
14426
14689
  auth: "admin"
14427
- }), method(object({
14428
- target: TargetSchema,
14429
- /**
14430
- * Duplicate flow: create a NEW target id while copying secrets from an
14431
- * existing row. The UI never holds the stored token; blank / redacted
14432
- * password fields are restored from this source (D634 still applies if
14433
- * destinations diverge without a re-typed secret).
14434
- */
14435
- cloneSecretsFrom: string().optional()
14436
- }), TargetSchema, {
14437
- kind: "mutation",
14438
- auth: "admin"
14439
- }), method(object({ targetId: string() }), _void(), {
14440
- kind: "mutation",
14441
- auth: "admin"
14442
- }), method(object({
14443
- targetId: string(),
14444
- enabled: boolean()
14445
- }), _void(), {
14446
- kind: "mutation",
14447
- auth: "admin"
14448
14690
  });
14449
14691
  looseObject({
14450
14692
  name: string().min(1),
@@ -22882,7 +23124,6 @@ var SYSTEM_CAP_VOCABULARY = {
22882
23124
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
22883
23125
  "notification-rules": system("notification rules — authored on their own page"),
22884
23126
  "oauth-integration": system(IDENTITY),
22885
- "oidc-connections": system(IDENTITY),
22886
23127
  "osd-manager": system(PIPELINE),
22887
23128
  "pipeline-executor": system(PIPELINE),
22888
23129
  "pipeline-orchestrator": system(PIPELINE),
@@ -45126,6 +45367,8 @@ var SettingsSchemaWithValuesSchema = object({
45126
45367
  });
45127
45368
  /** Patch object — keys are field names, values are the new field values. */
45128
45369
  var SettingsPatchSchema = record(string(), unknown());
45370
+ /** The scope of a scoped-settings call (D986): where the capability declared the values. */
45371
+ var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
45129
45372
  /** Standard success response for update operations. */
45130
45373
  var SettingsUpdateResultSchema = object({ success: literal(true) });
45131
45374
  method(object({
@@ -45141,6 +45384,25 @@ method(object({
45141
45384
  kind: "mutation",
45142
45385
  auth: "admin"
45143
45386
  }), method(object({
45387
+ addonId: string(),
45388
+ cap: string(),
45389
+ scope: ScopedSettingsScopeSchema,
45390
+ nodeId: string().optional()
45391
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
45392
+ addonId: string(),
45393
+ cap: string(),
45394
+ scope: ScopedSettingsScopeSchema,
45395
+ nodeId: string().optional(),
45396
+ patch: SettingsPatchSchema
45397
+ }), SettingsUpdateResultSchema, {
45398
+ kind: "mutation",
45399
+ auth: "admin"
45400
+ }), method(object({
45401
+ addonId: string(),
45402
+ cap: string(),
45403
+ scope: ScopedSettingsScopeSchema,
45404
+ nodeId: string().optional()
45405
+ }), record(string(), unknown()).nullable()), method(object({
45144
45406
  addonId: string(),
45145
45407
  nodeId: string().optional()
45146
45408
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
@@ -54743,7 +55005,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54743
55005
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
54744
55006
  * clears it.
54745
55007
  */
54746
- var ConfigSchemaPassthrough$3 = custom();
55008
+ var ConfigSchemaPassthrough$2 = custom();
54747
55009
  var IntegrationInstanceIdSchema = string().min(1);
54748
55010
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54749
55011
  /**
@@ -54789,7 +55051,16 @@ var IntegrationInstanceKindSchema = object({
54789
55051
  /** Relative hub path to start an interactive account link of an instance of this kind. */
54790
55052
  connectPath: string().min(1).optional(),
54791
55053
  /** Relative hub path to disconnect that account. */
54792
- disconnectPath: string().min(1).optional()
55054
+ disconnectPath: string().min(1).optional(),
55055
+ /**
55056
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
55057
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
55058
+ * `connection` widgets write connection values, `model` widgets own the model choice.
55059
+ */
55060
+ widgets: array(object({
55061
+ id: string().min(1),
55062
+ placement: _enum(["connection", "model"])
55063
+ })).optional()
54793
55064
  });
54794
55065
  /**
54795
55066
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -54894,7 +55165,7 @@ var integrationInstancesCapability = {
54894
55165
  id: IntegrationInstanceIdSchema.nullable(),
54895
55166
  /** The kind of the create form (`id: null`) of a provider with several. */
54896
55167
  kind: string().min(1).optional()
54897
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
55168
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
54898
55169
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
54899
55170
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
54900
55171
  /**
@@ -55845,12 +56116,12 @@ var LlmModelInfoSchema = object({
55845
56116
  });
55846
56117
  /**
55847
56118
  * The provider-specific part of a profile, validated by the provider that owns
55848
- * the kind (`upsertProfile` refuses what it does not accept). A field its
56119
+ * the kind (saving an instance refuses what it does not accept). A field its
55849
56120
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
55850
56121
  * keychain, never in the row, and reads back as the redaction marker.
55851
56122
  */
55852
56123
  var LlmProviderConfigSchema = record(string(), unknown());
55853
- var LlmProfileSchema = object({
56124
+ object({
55854
56125
  id: string(),
55855
56126
  name: string(),
55856
56127
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -55944,8 +56215,8 @@ var LlmProviderWidgetSchema = object({
55944
56215
  /** ConfigUISchema tree passed through untyped on the wire (the
55945
56216
  * notification-output `ConfigSchemaPassthrough` precedent at
55946
56217
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
55947
- var ConfigSchemaPassthrough$2 = unknown();
55948
- var LlmProfileKindDescriptorSchema = object({
56218
+ var ConfigSchemaPassthrough$1 = unknown();
56219
+ object({
55949
56220
  kind: LlmProfileKindSchema,
55950
56221
  label: string(),
55951
56222
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -55953,9 +56224,9 @@ var LlmProfileKindDescriptorSchema = object({
55953
56224
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
55954
56225
  addonId: string(),
55955
56226
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
55956
- connectionSchema: ConfigSchemaPassthrough$2,
56227
+ connectionSchema: ConfigSchemaPassthrough$1,
55957
56228
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
55958
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
56229
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
55959
56230
  /** The kind's defaults; a model from `listModels` may override any of them. */
55960
56231
  features: LlmModelFeaturesSchema,
55961
56232
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -56084,20 +56355,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
56084
56355
  }), method(object({
56085
56356
  addonId: string().optional(),
56086
56357
  requestId: string()
56087
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
56088
- kind: "mutation",
56089
- auth: "admin"
56090
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
56091
- kind: "mutation",
56092
- auth: "admin"
56093
- }), method(ProfileRefInputSchema, _void(), {
56094
- kind: "mutation",
56095
- auth: "admin"
56096
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
56097
- kind: "mutation",
56098
- auth: "admin",
56099
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
56100
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56358
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56101
56359
  kind: "mutation",
56102
56360
  auth: "admin"
56103
56361
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -57092,20 +57350,7 @@ method(_void(), MeshStatusSchema), method(object({
57092
57350
  /** Optional hostname override the host should advertise once joined. */
57093
57351
  hostname: string().optional() }), object({
57094
57352
  /** Authentication URL the operator should open in a browser. */
57095
- loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() })), method(object({
57096
- /** Optional auth key — when provided, probes the key validity
57097
- * against the provider's API. Omit when already joined to
57098
- * just ping the daemon. */
57099
- authKey: string().optional() }), object({
57100
- ok: boolean(),
57101
- /** Provider-side identifier resolved by the probe (tailnet
57102
- * name for Tailscale, network id for ZeroTier, etc.). */
57103
- tenant: string().optional(),
57104
- /** Daemon binary version, when reachable. */
57105
- daemonVersion: string().optional(),
57106
- /** Human-readable error when `ok: false`. */
57107
- error: string().optional()
57108
- }), { kind: "mutation" });
57353
+ loginUrl: string() }), { kind: "mutation" }), method(_void(), object({ left: literal(true) }), { kind: "mutation" }), method(_void(), object({ loggedOut: literal(true) }), { kind: "mutation" }), method(_void(), object({ peers: array(MeshPeerSchema).readonly() }));
57109
57354
  object({
57110
57355
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
57111
57356
  lastFetchedAt: number()
@@ -66779,61 +67024,6 @@ var oauthIntegrationCapability = {
66779
67024
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
66780
67025
  };
66781
67026
  /**
66782
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
66783
- *
66784
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
66785
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
66786
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
66787
- * immutable after create.
66788
- */
66789
- var ConfigSchemaPassthrough$1 = unknown();
66790
- var OidcConnectionSchema = object({
66791
- id: string().min(1),
66792
- displayName: string(),
66793
- icon: string(),
66794
- issuerUrl: string(),
66795
- clientId: string(),
66796
- /** Client id + secret present — never the secret value. */
66797
- configured: boolean(),
66798
- /**
66799
- * Values for the connection form schema. `clientSecret` is a keychain
66800
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
66801
- */
66802
- formValues: record(string(), unknown()).optional()
66803
- });
66804
- /**
66805
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
66806
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
66807
- */
66808
- var OidcConnectionUpdateInputSchema = object({
66809
- id: string().min(1),
66810
- displayName: string().min(1),
66811
- icon: string().optional(),
66812
- issuerUrl: string().optional(),
66813
- clientId: string().optional(),
66814
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
66815
- redirectUri: string().optional(),
66816
- scopes: string().optional(),
66817
- usernameClaim: _enum([
66818
- "preferred_username",
66819
- "email",
66820
- "sub"
66821
- ]).optional()
66822
- });
66823
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
66824
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
66825
- displayName: string().min(1)
66826
- }), object({ id: string() }), {
66827
- kind: "mutation",
66828
- auth: "admin"
66829
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
66830
- kind: "mutation",
66831
- auth: "admin"
66832
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
66833
- kind: "mutation",
66834
- auth: "admin"
66835
- });
66836
- /**
66837
67027
  * Generic on-screen-display (video overlay) cap. Each camera exposes
66838
67028
  * a firmware-defined list of overlays (channel name, timestamp,
66839
67029
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -73006,21 +73196,6 @@ method(object({
73006
73196
  */
73007
73197
  ttlSec: union([number().int().positive(), literal("never")]).optional()
73008
73198
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
73009
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
73010
- providerId: string().min(1),
73011
- displayName: string().min(1),
73012
- configSchema: unknown(),
73013
- nodeLocal: boolean(),
73014
- shouldSaveDiskSpace: literal(true),
73015
- minFreePercent: number().min(0).max(100)
73016
- }), object({
73017
- providerId: string().min(1),
73018
- displayName: string().min(1),
73019
- configSchema: unknown(),
73020
- nodeLocal: boolean(),
73021
- shouldSaveDiskSpace: literal(false),
73022
- minFreePercent: literal(null)
73023
- })]);
73024
73199
  method(object({
73025
73200
  location: StorageLocationRefSchema,
73026
73201
  relativePath: string()
@@ -73082,42 +73257,7 @@ method(object({
73082
73257
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
73083
73258
  kind: "mutation",
73084
73259
  auth: "admin"
73085
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
73086
- createdAt: true,
73087
- updatedAt: true
73088
- }), StorageLocationSchema, {
73089
- kind: "mutation",
73090
- auth: "admin"
73091
- }), method(object({
73092
- id: string(),
73093
- force: boolean().optional()
73094
- }), _void(), {
73095
- kind: "mutation",
73096
- auth: "admin"
73097
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
73098
- ok: boolean(),
73099
- error: string().optional()
73100
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
73101
- providerId: string(),
73102
- /**
73103
- * The location this config is an UNSAVED edit of, when there is one.
73104
- *
73105
- * `listLocations` replaces every declared secret with the redaction
73106
- * sentinel, so the edit modal's form state holds the sentinel for any
73107
- * credential the operator did not retype — and posting that here
73108
- * without a way to resolve it makes the provider try to authenticate
73109
- * as `__camstack_redacted__` and report the operator's own working
73110
- * password as wrong. Given this id, the orchestrator restores each
73111
- * sentinel from the stored config (same rule as `upsertLocation`)
73112
- * before dispatching. Omitted by the "Add location" wizard, where
73113
- * every value was typed just now and nothing is stored yet.
73114
- */
73115
- locationId: string().optional(),
73116
- config: record(string(), unknown())
73117
- }), object({
73118
- ok: boolean(),
73119
- error: string().optional()
73120
- }), { auth: "admin" });
73260
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
73121
73261
  /** One table of the settings database. */
73122
73262
  var StorageTableSchema = object({
73123
73263
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -77257,6 +77397,20 @@ Object.freeze({
77257
77397
  access: "view",
77258
77398
  role: "admin"
77259
77399
  },
77400
+ "addonSettings.getScopedSettings": {
77401
+ capName: "addon-settings",
77402
+ capScope: "system",
77403
+ addonId: null,
77404
+ access: "view",
77405
+ role: "admin"
77406
+ },
77407
+ "addonSettings.readScopedValues": {
77408
+ capName: "addon-settings",
77409
+ capScope: "system",
77410
+ addonId: null,
77411
+ access: "view",
77412
+ role: "admin"
77413
+ },
77260
77414
  "addonSettings.unsetStoredSettingsKeys": {
77261
77415
  capName: "addon-settings",
77262
77416
  capScope: "system",
@@ -77278,6 +77432,13 @@ Object.freeze({
77278
77432
  access: "create",
77279
77433
  role: "admin"
77280
77434
  },
77435
+ "addonSettings.updateScopedSettings": {
77436
+ capName: "addon-settings",
77437
+ capScope: "system",
77438
+ addonId: null,
77439
+ access: "create",
77440
+ role: "admin"
77441
+ },
77281
77442
  "addonWidgets.listWidgets": {
77282
77443
  capName: "addon-widgets",
77283
77444
  capScope: "system",
@@ -80729,13 +80890,6 @@ Object.freeze({
80729
80890
  access: "delete",
80730
80891
  role: "admin"
80731
80892
  },
80732
- "llm.deleteProfile": {
80733
- capName: "llm",
80734
- capScope: "system",
80735
- addonId: null,
80736
- access: "delete",
80737
- role: "admin"
80738
- },
80739
80893
  "llm.generate": {
80740
80894
  capName: "llm",
80741
80895
  capScope: "system",
@@ -80799,20 +80953,6 @@ Object.freeze({
80799
80953
  access: "view",
80800
80954
  role: "admin"
80801
80955
  },
80802
- "llm.listProfileKinds": {
80803
- capName: "llm",
80804
- capScope: "system",
80805
- addonId: null,
80806
- access: "view",
80807
- role: "admin"
80808
- },
80809
- "llm.listProfiles": {
80810
- capName: "llm",
80811
- capScope: "system",
80812
- addonId: null,
80813
- access: "view",
80814
- role: "admin"
80815
- },
80816
80956
  "llm.listRuntimeNodes": {
80817
80957
  capName: "llm",
80818
80958
  capScope: "system",
@@ -80820,13 +80960,6 @@ Object.freeze({
80820
80960
  access: "view",
80821
80961
  role: "admin"
80822
80962
  },
80823
- "llm.migrateRawSecrets": {
80824
- capName: "llm",
80825
- capScope: "system",
80826
- addonId: null,
80827
- access: "create",
80828
- role: "admin"
80829
- },
80830
80963
  "llm.resolveModelRef": {
80831
80964
  capName: "llm",
80832
80965
  capScope: "system",
@@ -80855,20 +80988,6 @@ Object.freeze({
80855
80988
  access: "create",
80856
80989
  role: "admin"
80857
80990
  },
80858
- "llm.testProfile": {
80859
- capName: "llm",
80860
- capScope: "system",
80861
- addonId: null,
80862
- access: "create",
80863
- role: "admin"
80864
- },
80865
- "llm.upsertProfile": {
80866
- capName: "llm",
80867
- capScope: "system",
80868
- addonId: null,
80869
- access: "create",
80870
- role: "admin"
80871
- },
80872
80991
  "llmRuntime.appleAvailability": {
80873
80992
  capName: "llm-runtime",
80874
80993
  capScope: "system",
@@ -81373,13 +81492,6 @@ Object.freeze({
81373
81492
  access: "create",
81374
81493
  role: "admin"
81375
81494
  },
81376
- "meshNetwork.testConnection": {
81377
- capName: "mesh-network",
81378
- capScope: "system",
81379
- addonId: null,
81380
- access: "create",
81381
- role: "admin"
81382
- },
81383
81495
  "meter.getStatus": {
81384
81496
  capName: "meter",
81385
81497
  capScope: "device",
@@ -82038,13 +82150,6 @@ Object.freeze({
82038
82150
  access: "create",
82039
82151
  role: "admin"
82040
82152
  },
82041
- "notificationOutput.deleteTarget": {
82042
- capName: "notification-output",
82043
- capScope: "system",
82044
- addonId: null,
82045
- access: "delete",
82046
- role: "admin"
82047
- },
82048
82153
  "notificationOutput.discoverTargets": {
82049
82154
  capName: "notification-output",
82050
82155
  capScope: "system",
@@ -82052,13 +82157,6 @@ Object.freeze({
82052
82157
  access: "view",
82053
82158
  role: "admin"
82054
82159
  },
82055
- "notificationOutput.getTarget": {
82056
- capName: "notification-output",
82057
- capScope: "system",
82058
- addonId: null,
82059
- access: "view",
82060
- role: "admin"
82061
- },
82062
82160
  "notificationOutput.listTargetKinds": {
82063
82161
  capName: "notification-output",
82064
82162
  capScope: "system",
@@ -82066,13 +82164,6 @@ Object.freeze({
82066
82164
  access: "view",
82067
82165
  role: "admin"
82068
82166
  },
82069
- "notificationOutput.listTargets": {
82070
- capName: "notification-output",
82071
- capScope: "system",
82072
- addonId: null,
82073
- access: "view",
82074
- role: "admin"
82075
- },
82076
82167
  "notificationOutput.probeTargetConfig": {
82077
82168
  capName: "notification-output",
82078
82169
  capScope: "system",
@@ -82087,13 +82178,6 @@ Object.freeze({
82087
82178
  access: "create",
82088
82179
  role: "admin"
82089
82180
  },
82090
- "notificationOutput.setTargetEnabled": {
82091
- capName: "notification-output",
82092
- capScope: "system",
82093
- addonId: null,
82094
- access: "create",
82095
- role: "admin"
82096
- },
82097
82181
  "notificationOutput.testTarget": {
82098
82182
  capName: "notification-output",
82099
82183
  capScope: "system",
@@ -82101,13 +82185,6 @@ Object.freeze({
82101
82185
  access: "create",
82102
82186
  role: "admin"
82103
82187
  },
82104
- "notificationOutput.upsertTarget": {
82105
- capName: "notification-output",
82106
- capScope: "system",
82107
- addonId: null,
82108
- access: "create",
82109
- role: "admin"
82110
- },
82111
82188
  "notificationRules.activateAlarmProfile": {
82112
82189
  capName: "notification-rules",
82113
82190
  capScope: "system",
@@ -82367,41 +82444,6 @@ Object.freeze({
82367
82444
  access: "view",
82368
82445
  role: "admin"
82369
82446
  },
82370
- "oidcConnections.connectionFormSchema": {
82371
- capName: "oidc-connections",
82372
- capScope: "system",
82373
- addonId: null,
82374
- access: "view",
82375
- role: "admin"
82376
- },
82377
- "oidcConnections.createConnection": {
82378
- capName: "oidc-connections",
82379
- capScope: "system",
82380
- addonId: null,
82381
- access: "create",
82382
- role: "admin"
82383
- },
82384
- "oidcConnections.deleteConnection": {
82385
- capName: "oidc-connections",
82386
- capScope: "system",
82387
- addonId: null,
82388
- access: "delete",
82389
- role: "admin"
82390
- },
82391
- "oidcConnections.listConnections": {
82392
- capName: "oidc-connections",
82393
- capScope: "system",
82394
- addonId: null,
82395
- access: "view",
82396
- role: "admin"
82397
- },
82398
- "oidcConnections.updateConnection": {
82399
- capName: "oidc-connections",
82400
- capScope: "system",
82401
- addonId: null,
82402
- access: "create",
82403
- role: "admin"
82404
- },
82405
82447
  "osd.getStatus": {
82406
82448
  capName: "osd",
82407
82449
  capScope: "device",
@@ -85433,13 +85475,6 @@ Object.freeze({
85433
85475
  access: "delete",
85434
85476
  role: "admin"
85435
85477
  },
85436
- "storage.deleteLocation": {
85437
- capName: "storage",
85438
- capScope: "system",
85439
- addonId: null,
85440
- access: "delete",
85441
- role: "admin"
85442
- },
85443
85478
  "storage.endDownload": {
85444
85479
  capName: "storage",
85445
85480
  capScope: "system",
@@ -85496,13 +85531,6 @@ Object.freeze({
85496
85531
  access: "view",
85497
85532
  role: "admin"
85498
85533
  },
85499
- "storage.listProviders": {
85500
- capName: "storage",
85501
- capScope: "system",
85502
- addonId: null,
85503
- access: "view",
85504
- role: "admin"
85505
- },
85506
85534
  "storage.read": {
85507
85535
  capName: "storage",
85508
85536
  capScope: "system",
@@ -85524,27 +85552,6 @@ Object.freeze({
85524
85552
  access: "view",
85525
85553
  role: "admin"
85526
85554
  },
85527
- "storage.testConfig": {
85528
- capName: "storage",
85529
- capScope: "system",
85530
- addonId: null,
85531
- access: "view",
85532
- role: "admin"
85533
- },
85534
- "storage.testLocation": {
85535
- capName: "storage",
85536
- capScope: "system",
85537
- addonId: null,
85538
- access: "view",
85539
- role: "admin"
85540
- },
85541
- "storage.upsertLocation": {
85542
- capName: "storage",
85543
- capScope: "system",
85544
- addonId: null,
85545
- access: "create",
85546
- role: "admin"
85547
- },
85548
85555
  "storage.write": {
85549
85556
  capName: "storage",
85550
85557
  capScope: "system",
@@ -105774,6 +105781,11 @@ var ExportAlexaAddon = class extends BaseAddon {
105774
105781
  "tokens[userId].refreshToken",
105775
105782
  "tokens[userId].brokerCredential"
105776
105783
  ];
105784
+ /** The hidden HMAC key of snapshot URLs (store key `snapshotSigningKey`, a keychain secret). */
105785
+ snapshotSigningKeyState = this.state("snapshotSigningKey", string(), "");
105786
+ /** The legacy ledger keys, until the migrations have moved them to the `skill-links` record. */
105787
+ legacyLinkedAccounts = this.state("linkedAccounts", array(LinkedAccountSchema), []);
105788
+ legacyTokens = this.state("tokens", array(LwaTokenEntrySchema), []);
105777
105789
  snapshotStore = new SnapshotStore(() => this.config.snapshotSigningKey);
105778
105790
  publicEndpoint = createPublicEndpointReader(() => this.ctx.api.localNetwork.getAddresses.query());
105779
105791
  accessGateRef = null;
@@ -105818,18 +105830,7 @@ var ExportAlexaAddon = class extends BaseAddon {
105818
105830
  accessGate: this.requireGate(),
105819
105831
  settings: () => this.config,
105820
105832
  handles: this.requireHandles(),
105821
- legacyLedger: (instanceId) => instanceId === "export-alexa" ? {
105822
- read: () => ({
105823
- linkedAccounts: this.config.linkedAccounts,
105824
- tokens: this.config.tokens
105825
- }),
105826
- write: async (patch) => {
105827
- await this.updateGlobalSettings({
105828
- ...patch.linkedAccounts === void 0 ? {} : { linkedAccounts: patch.linkedAccounts },
105829
- ...patch.tokens === void 0 ? {} : { tokens: patch.tokens }
105830
- });
105831
- }
105832
- } : null,
105833
+ legacyLedger: (instanceId) => instanceId === "export-alexa" ? this.legacyLedgerPort() : null,
105833
105834
  linkedUserIdsElsewhere: async (instanceId) => {
105834
105835
  const users = /* @__PURE__ */ new Set();
105835
105836
  for (const [id, runtime] of this.runtimes) {
@@ -105845,6 +105846,26 @@ var ExportAlexaAddon = class extends BaseAddon {
105845
105846
  }
105846
105847
  };
105847
105848
  }
105849
+ /** The legacy ledger keys of the addon store, read from `config` and written through `state()`. */
105850
+ legacyLedgerPort() {
105851
+ return {
105852
+ read: () => ({
105853
+ linkedAccounts: this.config.linkedAccounts,
105854
+ tokens: this.config.tokens
105855
+ }),
105856
+ write: async (patch) => {
105857
+ if (patch.linkedAccounts !== void 0) await this.legacyLinkedAccounts.set([...patch.linkedAccounts]);
105858
+ if (patch.tokens !== void 0) await this.legacyTokens.set([...patch.tokens]);
105859
+ await this.resolveConfig();
105860
+ }
105861
+ };
105862
+ }
105863
+ /** The snapshot URL signing key (R2): generated once, hidden, rotated by nothing. */
105864
+ async ensureSnapshotSigningKey() {
105865
+ if (this.config.snapshotSigningKey) return;
105866
+ await this.snapshotSigningKeyState.set(generateIngressToken());
105867
+ await this.resolveConfig();
105868
+ }
105848
105869
  async onInitialize() {
105849
105870
  const records = this.ctx.records;
105850
105871
  if (records === void 0) throw new Error("export-alexa needs ctx.records — check execution.placement (hub-only)");
@@ -105894,7 +105915,7 @@ var ExportAlexaAddon = class extends BaseAddon {
105894
105915
  onChanged: (id, change) => this.onInstanceChanged(id, change)
105895
105916
  });
105896
105917
  await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, this.migrationPorts()));
105897
- if (!this.config.snapshotSigningKey) await this.updateGlobalSettings({ snapshotSigningKey: generateIngressToken() });
105918
+ await this.ensureSnapshotSigningKey();
105898
105919
  if (this.config.lwaClientSecret) {
105899
105920
  await this.clearSecrets(["lwaClientSecret"]);
105900
105921
  this.ctx.logger.warn("export-alexa: removed a stored LWA client secret — the hub no longer uses one; your skill Lambda holds it (D753)");