@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.
@@ -5,7 +5,7 @@ import "node:fs";
5
5
  import "node:path";
6
6
  import "node:child_process";
7
7
  import "node:zlib";
8
- //#region ../types/dist/event-category-BmPm98n0.mjs
8
+ //#region ../types/dist/event-category-78tcBemo.mjs
9
9
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
10
10
  EventCategory["SystemBoot"] = "system.boot";
11
11
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -126,6 +126,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
126
126
  */
127
127
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
128
128
  /**
129
+ * An addon is RUNNING although its installed package is below what the
130
+ * running server requires (`camstack.requires.addons` of the server, or the
131
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
132
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
133
+ * operator alert per node and package. The addon is never held back for it.
134
+ *
135
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
136
+ */
137
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
138
+ /**
139
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
140
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
141
+ *
142
+ * Payload: `{ packageName, addonId, nodeId }`.
143
+ */
144
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
145
+ /**
129
146
  * Monitor scheduled the next retry for a failed addon. Transient —
130
147
  * surfaced to the UI for live-updating the "next retry in Ns"
131
148
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -236,7 +253,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
236
253
  EventCategory["ProcessRestarted"] = "process.restarted";
237
254
  /**
238
255
  * The SET of storage locations changed — one was created, edited, enabled,
239
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
256
+ * disabled or deleted through the location instances or the forced-delete action.
240
257
  *
241
258
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
242
259
  * it must also converge on its own periodic path, because a dropped event
@@ -5987,7 +6004,7 @@ var ZodIssueCode = {
5987
6004
  var ZodFirstPartyTypeKind;
5988
6005
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5989
6006
  //#endregion
5990
- //#region ../types/dist/sleep-D7ZKm4nb.mjs
6007
+ //#region ../types/dist/sleep-CQP-REJp.mjs
5991
6008
  /**
5992
6009
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5993
6010
  * window to float samples (D455).
@@ -6351,6 +6368,59 @@ Object.fromEntries([
6351
6368
  function isValuelessField(field) {
6352
6369
  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";
6353
6370
  }
6371
+ /**
6372
+ * Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
6373
+ * `key → { value, default }`, recursing through `group` and `sub-tabs`
6374
+ * layout fields. Keeping `value` and `default` SEPARATE (rather than
6375
+ * pre-resolving) lets callers both read the effective value AND detect
6376
+ * overrides (`value` differs from `default`). Structural over `unknown`;
6377
+ * malformed input yields an empty map, never throws.
6378
+ */
6379
+ function collectHydratedFieldEntries(schema) {
6380
+ const out = /* @__PURE__ */ new Map();
6381
+ if (typeof schema !== "object" || schema === null) return out;
6382
+ const sections = schema.sections;
6383
+ if (!Array.isArray(sections)) return out;
6384
+ for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
6385
+ return out;
6386
+ }
6387
+ /** Recursive field walker for {@link collectHydratedFieldEntries}. */
6388
+ function collectFieldEntriesInto(fields, into) {
6389
+ if (!Array.isArray(fields)) return;
6390
+ for (const field of fields) {
6391
+ if (typeof field !== "object" || field === null) continue;
6392
+ const type = field.type;
6393
+ if (type === "group") {
6394
+ collectFieldEntriesInto(field.fields, into);
6395
+ continue;
6396
+ }
6397
+ if (type === "sub-tabs") {
6398
+ const tabs = field.tabs;
6399
+ if (Array.isArray(tabs)) {
6400
+ for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
6401
+ }
6402
+ continue;
6403
+ }
6404
+ const key = field.key;
6405
+ if (typeof key !== "string" || key.length === 0) continue;
6406
+ if (!("value" in field)) continue;
6407
+ into.set(key, {
6408
+ value: field.value,
6409
+ default: field.default
6410
+ });
6411
+ }
6412
+ }
6413
+ /**
6414
+ * Flatten a hydrated settings payload into `key → EFFECTIVE value`
6415
+ * (`value ?? default`). The read-side inverse of `hydrateSchema` for the
6416
+ * common "just give me the resolved values" case. Built on
6417
+ * {@link collectHydratedFieldEntries}.
6418
+ */
6419
+ function collectHydratedFieldValues(schema) {
6420
+ const out = /* @__PURE__ */ new Map();
6421
+ for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
6422
+ return out;
6423
+ }
6354
6424
  function hydrateSchema(schema, values, options = {}) {
6355
6425
  return {
6356
6426
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
@@ -7235,17 +7305,35 @@ var RecordIntegrationInstances = class {
7235
7305
  ...kind !== void 0 ? { kind } : {}
7236
7306
  });
7237
7307
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7308
+ const initial = this.hooks.initialBody(name, kind);
7309
+ const patch = this.patchOf(values ?? {});
7310
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7311
+ kind,
7312
+ body: {
7313
+ ...initial,
7314
+ ...patch
7315
+ }
7316
+ }));
7238
7317
  await this.handle.put({
7239
7318
  id: minted,
7240
- data: this.hooks.initialBody(name, kind)
7319
+ data: initial
7241
7320
  }, { ifRev: 0 });
7242
- const patch = this.patchOf(values ?? {});
7243
7321
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7244
7322
  await this.hooks.onChanged?.(minted, "created");
7245
7323
  return { id: minted };
7246
7324
  };
7247
7325
  updateInstance = async ({ id, name, values }) => {
7248
7326
  const patch = this.patchOf(values);
7327
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7328
+ const stored = await this.handle.get(id);
7329
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7330
+ kind: void 0,
7331
+ body: {
7332
+ ...stored.data,
7333
+ ...patch
7334
+ }
7335
+ }));
7336
+ }
7249
7337
  if (name !== void 0) patch[this.nameField] = name;
7250
7338
  await this.handle.patch(id, patch);
7251
7339
  await this.hooks.onChanged?.(id, "updated");
@@ -7556,6 +7644,21 @@ var SCOPED_SETTINGS_SCOPES = [
7556
7644
  "device-defaults",
7557
7645
  "node"
7558
7646
  ];
7647
+ /** The one refusal of a key a scope did not declare. */
7648
+ function assertDeclaredKeys(keys, declared) {
7649
+ const undeclared = keys.filter((key) => !declared.has(key));
7650
+ if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
7651
+ }
7652
+ /** Build the handle over an addon's scoped read, write and unset. */
7653
+ function createScopedSettings(deps) {
7654
+ return {
7655
+ async get() {
7656
+ return deps.schema.parse(await deps.read());
7657
+ },
7658
+ patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
7659
+ unset: (keys) => deps.unset(keys)
7660
+ };
7661
+ }
7559
7662
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7560
7663
  var KeychainWriteRefusedError = class extends Error {
7561
7664
  fieldPath;
@@ -8131,7 +8234,16 @@ function createHandle(raw, opts) {
8131
8234
  return blob;
8132
8235
  }
8133
8236
  },
8134
- writeAddonStore: writeAddon
8237
+ writeAddonStore: writeAddon,
8238
+ removeClearedKeys: (keys) => serialize("addon", async () => {
8239
+ const stored = await readStoredAddonBlob(raw);
8240
+ index.seen("addon", stored);
8241
+ const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
8242
+ if (removable.length === 0) return;
8243
+ const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
8244
+ await raw.writeAddonStore(patch);
8245
+ index.wrote("addon", patch);
8246
+ })
8135
8247
  };
8136
8248
  }
8137
8249
  /** The context the addon sees, plus the private raw view and write outcome. */
@@ -8676,6 +8788,151 @@ var BaseAddon = class {
8676
8788
  }
8677
8789
  }
8678
8790
  /**
8791
+ * Hook: values layered over the stored ones when the FORM of one scope is served
8792
+ * ({@link getScopedSettings}) — a preview that derives dependent options without writing.
8793
+ * Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
8794
+ */
8795
+ async scopedSettingsOverlay(_scope, _cap, _nodeId) {
8796
+ return null;
8797
+ }
8798
+ /**
8799
+ * Hook: a write of one scope changed stored values (not called when the store reports no change,
8800
+ * e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
8801
+ */
8802
+ async onScopedSettingsChanged(_scope, _cap, _keys) {}
8803
+ /** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
8804
+ clusterSettings(cap, schema) {
8805
+ return this.scopedHandle("cluster", cap, schema);
8806
+ }
8807
+ /** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
8808
+ deviceDefaults(cap, schema) {
8809
+ return this.scopedHandle("device-defaults", cap, schema);
8810
+ }
8811
+ /**
8812
+ * Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
8813
+ * with no row yields the schema defaults — never a bare-key fallback.
8814
+ */
8815
+ nodeSettings(cap, schema, nodeId) {
8816
+ return this.scopedHandle("node", cap, schema, nodeId);
8817
+ }
8818
+ /**
8819
+ * {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
8820
+ * settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
8821
+ * central delete. `nodeId` omitted ⇒ the local node.
8822
+ */
8823
+ nodeState(key, schema, fallback, nodeId) {
8824
+ this._declaredStateKeys.add(key);
8825
+ return createDurableState({
8826
+ key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
8827
+ schema,
8828
+ fallback,
8829
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
8830
+ write: async (patch) => {
8831
+ await this._ctx?.settings?.writeAddonStore(patch);
8832
+ },
8833
+ onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
8834
+ addonId: this._ctx?.id,
8835
+ key: k,
8836
+ error: String(e)
8837
+ } })
8838
+ });
8839
+ }
8840
+ /** The loaded schema `cap` declares for `scope`, or `null`. */
8841
+ async declaredScopedSchema(scope, cap) {
8842
+ await this.loadScopedSchemas(cap);
8843
+ return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
8844
+ }
8845
+ async requireScopedSchema(scope, cap) {
8846
+ const schema = await this.declaredScopedSchema(scope, cap);
8847
+ if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
8848
+ return schema;
8849
+ }
8850
+ scopedKeys(schema) {
8851
+ return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
8852
+ }
8853
+ /** `store` narrowed to the keys `schema` declares. */
8854
+ narrowToScope(store, schema) {
8855
+ const keys = this.scopedKeys(schema);
8856
+ return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
8857
+ }
8858
+ scopedHandle(scope, cap, schema, nodeId) {
8859
+ return createScopedSettings({
8860
+ schema,
8861
+ read: async () => {
8862
+ const declared = await this.requireScopedSchema(scope, cap);
8863
+ const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
8864
+ const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
8865
+ return {
8866
+ ...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
8867
+ ...stored
8868
+ };
8869
+ },
8870
+ write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
8871
+ unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
8872
+ });
8873
+ }
8874
+ /** The one write path of the scoped API: declared keys only, then the global patch. */
8875
+ async writeScoped(scope, cap, patch, nodeId) {
8876
+ assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8877
+ if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
8878
+ }
8879
+ /**
8880
+ * Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
8881
+ * value is released exactly as there — and the emptied row is then removed; every other key is
8882
+ * removed by an `undefined` patch (which a secret transform would read as "keep").
8883
+ */
8884
+ async unsetScoped(scope, cap, keys, nodeId) {
8885
+ assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8886
+ const target = scope === "node" ? nodeId : void 0;
8887
+ const tree = this.addonSecretTree();
8888
+ const secretKeys = keys.filter((key) => tree.has(key));
8889
+ const plainKeys = keys.filter((key) => !tree.has(key));
8890
+ let changed = false;
8891
+ if (plainKeys.length > 0) {
8892
+ const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
8893
+ changed = await this.applyGlobalPatch(patch, target, cap) || changed;
8894
+ }
8895
+ if (secretKeys.length > 0) {
8896
+ await this.clearSecretKeys(secretKeys, target, cap);
8897
+ const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
8898
+ const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
8899
+ if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
8900
+ else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
8901
+ changed = true;
8902
+ }
8903
+ if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
8904
+ }
8905
+ /**
8906
+ * The hydrated form of one scope of one capability's settings (any
8907
+ * {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
8908
+ */
8909
+ async getScopedSettings(scope, cap, nodeId) {
8910
+ const schema = await this.declaredScopedSchema(scope, cap);
8911
+ if (schema === null) return null;
8912
+ const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
8913
+ const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
8914
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
8915
+ }
8916
+ /** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
8917
+ async updateScopedSettings(scope, cap, patch, nodeId) {
8918
+ this._operatorWriteDepth++;
8919
+ try {
8920
+ await this.writeScoped(scope, cap, patch, nodeId);
8921
+ } finally {
8922
+ this._operatorWriteDepth--;
8923
+ }
8924
+ }
8925
+ /**
8926
+ * The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
8927
+ * its value. `null` when the capability declares nothing for the scope.
8928
+ */
8929
+ async readScopedValues(scope, cap, nodeId) {
8930
+ const schema = await this.declaredScopedSchema(scope, cap);
8931
+ if (schema === null) return null;
8932
+ const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
8933
+ return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
8934
+ }
8935
+ /**
8679
8936
  * What the create wizard and the integration edit page render for one instance: the addon's
8680
8937
  * per-instance schema when it declares one, else its global schema (what they always showed).
8681
8938
  */
@@ -8827,6 +9084,9 @@ var BaseAddon = class {
8827
9084
  * a keychain (an older kernel) it writes `''`, as such code always did.
8828
9085
  */
8829
9086
  async clearSecrets(keys, nodeId) {
9087
+ await this.clearSecretKeys(keys, nodeId);
9088
+ }
9089
+ async clearSecretKeys(keys, nodeId, cap) {
8830
9090
  const tree = this.addonSecretTree();
8831
9091
  const keychain = this._ctx?.secrets !== void 0;
8832
9092
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
@@ -8839,25 +9099,27 @@ var BaseAddon = class {
8839
9099
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8840
9100
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8841
9101
  }
8842
- await this.applyGlobalPatch(patch, nodeId);
9102
+ await this.applyGlobalPatch(patch, nodeId, cap);
8843
9103
  }
8844
- async applyGlobalPatch(barePatch, nodeId) {
8845
- await this.loadScopedSchemas();
8846
- const keys = this.perNodeKeys();
9104
+ /** Resolves `true` when the write changed stored values. */
9105
+ async applyGlobalPatch(barePatch, nodeId, cap) {
9106
+ await this.loadScopedSchemas(cap);
9107
+ const keys = this.perNodeKeys(cap);
8847
9108
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
8848
9109
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
8849
9110
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
8850
9111
  const handle = this._secretSettings;
8851
9112
  if (handle !== null) {
8852
9113
  const { changed } = await handle.writeAddonStore(scoped);
8853
- if (!changed) return;
9114
+ if (!changed) return false;
8854
9115
  } else await this._ctx?.settings?.writeAddonStore(scoped);
8855
- if (target !== localNode) return;
9116
+ if (target !== localNode) return true;
8856
9117
  await this.resolveConfig();
8857
9118
  await this.onConfigChanged();
8858
9119
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
8859
9120
  const legacy = this.globalSettingsSchema();
8860
9121
  this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
9122
+ return true;
8861
9123
  }
8862
9124
  /**
8863
9125
  * The set of field keys the global settings schema declares `perNode: true`
@@ -10594,7 +10856,6 @@ var CAP_NAMES = Object.freeze([
10594
10856
  "notifier",
10595
10857
  "numeric-sensor",
10596
10858
  "oauth-integration",
10597
- "oidc-connections",
10598
10859
  "osd",
10599
10860
  "osd-manager",
10600
10861
  "pet-feeder",
@@ -12486,8 +12747,7 @@ Object.freeze({
12486
12747
  "device-provider": { "reloadDevice": 18e4 },
12487
12748
  "llm": {
12488
12749
  "generate": 6e5,
12489
- "generateVision": 6e5,
12490
- "testProfile": 6e5
12750
+ "generateVision": 6e5
12491
12751
  },
12492
12752
  "llm-runtime": {
12493
12753
  "complete": 6e5,
@@ -14007,17 +14267,18 @@ function buildCapturingReply(envelope) {
14007
14267
  * message to what the kind supports — callers never special-case a service.
14008
14268
  *
14009
14269
  * DESIGN DECISIONS (locked):
14010
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14011
- * `setTargetEnabled`), each provider persisting via the `settings-store`
14012
- * cap. Rationale: the admin UI needs one uniform surface across the
14013
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14014
- * alternative would fork the UI per addon and cannot host the
14015
- * discovery→adopt flow.
14016
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14017
- * the generated cap-mount auto-`concatCollection`-fans them across every
14018
- * registered provider (notifiers addon + HA addon) so one catalog is
14019
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14020
- * `addonId` the generated collection router extracts from the call input.
14270
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14271
+ * providers serve their targets as `integration-instances` records, one
14272
+ * record kind per target kind, and the admin lists, adds, edits, switches
14273
+ * and deletes them through that cap. This cap keeps what an instance cannot
14274
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14275
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14276
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14277
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14278
+ * cap-mount auto-`concatCollection`-fans them across every registered
14279
+ * provider so one catalog is routable. `send` / `testTarget` /
14280
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14281
+ * collection router extracts from the call input.
14021
14282
  * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14022
14283
  * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14023
14284
  * `storage` / `storage-provider` / `recording` caps over the same path. No
@@ -14262,7 +14523,7 @@ var TargetKindCapsSchema = object({
14262
14523
  * the union is large and not meant for runtime validation here; the exported
14263
14524
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14264
14525
  */
14265
- var ConfigSchemaPassthrough$4 = unknown();
14526
+ var ConfigSchemaPassthrough$3 = unknown();
14266
14527
  var TargetKindSchema = object({
14267
14528
  kind: string(),
14268
14529
  label: string(),
@@ -14299,7 +14560,7 @@ var TargetKindSchema = object({
14299
14560
  * its raster path, which is the safe default for an unknown image.
14300
14561
  */
14301
14562
  iconMediaType: string().optional(),
14302
- configSchema: ConfigSchemaPassthrough$4,
14563
+ configSchema: ConfigSchemaPassthrough$3,
14303
14564
  /**
14304
14565
  * The config keys that decide WHERE this kind's secrets are sent (server,
14305
14566
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -14321,9 +14582,11 @@ var TargetKindSchema = object({
14321
14582
  caps: TargetKindCapsSchema
14322
14583
  });
14323
14584
  /**
14324
- * A persisted target. `config` holds secrets; providers REDACT secret fields
14325
- * (return a presence marker only) when serving `listTargets` — never
14326
- * round-trip a stored secret to the UI.
14585
+ * A target as a provider's own code sees it (the notification-center bridge, the
14586
+ * send path): the flat record body split into the name, the switch and the
14587
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14588
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14589
+ * secret to the UI.
14327
14590
  */
14328
14591
  var TargetSchema = object({
14329
14592
  id: string(),
@@ -14366,13 +14629,13 @@ var ProbeTargetConfigResultSchema = object({
14366
14629
  stateInstance: string().optional(),
14367
14630
  error: string().optional()
14368
14631
  });
14369
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14632
+ method(object({}), array(TargetKindSchema)), method(object({
14370
14633
  kind: string(),
14371
14634
  config: record(string(), unknown()).optional(),
14372
14635
  /**
14373
14636
  * When editing / duplicating, the blank password field never round-trips
14374
14637
  * the stored token. Pass the source target id so the provider can restore
14375
- * secrets server-side before dialling (same merge as upsert).
14638
+ * secrets server-side before dialling.
14376
14639
  */
14377
14640
  targetId: string().optional()
14378
14641
  }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
@@ -14395,27 +14658,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
14395
14658
  }), TestResultSchema, {
14396
14659
  kind: "mutation",
14397
14660
  auth: "admin"
14398
- }), method(object({
14399
- target: TargetSchema,
14400
- /**
14401
- * Duplicate flow: create a NEW target id while copying secrets from an
14402
- * existing row. The UI never holds the stored token; blank / redacted
14403
- * password fields are restored from this source (D634 still applies if
14404
- * destinations diverge without a re-typed secret).
14405
- */
14406
- cloneSecretsFrom: string().optional()
14407
- }), TargetSchema, {
14408
- kind: "mutation",
14409
- auth: "admin"
14410
- }), method(object({ targetId: string() }), _void(), {
14411
- kind: "mutation",
14412
- auth: "admin"
14413
- }), method(object({
14414
- targetId: string(),
14415
- enabled: boolean()
14416
- }), _void(), {
14417
- kind: "mutation",
14418
- auth: "admin"
14419
14661
  });
14420
14662
  looseObject({
14421
14663
  name: string().min(1),
@@ -22853,7 +23095,6 @@ var SYSTEM_CAP_VOCABULARY = {
22853
23095
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
22854
23096
  "notification-rules": system("notification rules — authored on their own page"),
22855
23097
  "oauth-integration": system(IDENTITY),
22856
- "oidc-connections": system(IDENTITY),
22857
23098
  "osd-manager": system(PIPELINE),
22858
23099
  "pipeline-executor": system(PIPELINE),
22859
23100
  "pipeline-orchestrator": system(PIPELINE),
@@ -45097,6 +45338,8 @@ var SettingsSchemaWithValuesSchema = object({
45097
45338
  });
45098
45339
  /** Patch object — keys are field names, values are the new field values. */
45099
45340
  var SettingsPatchSchema = record(string(), unknown());
45341
+ /** The scope of a scoped-settings call (D986): where the capability declared the values. */
45342
+ var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
45100
45343
  /** Standard success response for update operations. */
45101
45344
  var SettingsUpdateResultSchema = object({ success: literal(true) });
45102
45345
  method(object({
@@ -45112,6 +45355,25 @@ method(object({
45112
45355
  kind: "mutation",
45113
45356
  auth: "admin"
45114
45357
  }), method(object({
45358
+ addonId: string(),
45359
+ cap: string(),
45360
+ scope: ScopedSettingsScopeSchema,
45361
+ nodeId: string().optional()
45362
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
45363
+ addonId: string(),
45364
+ cap: string(),
45365
+ scope: ScopedSettingsScopeSchema,
45366
+ nodeId: string().optional(),
45367
+ patch: SettingsPatchSchema
45368
+ }), SettingsUpdateResultSchema, {
45369
+ kind: "mutation",
45370
+ auth: "admin"
45371
+ }), method(object({
45372
+ addonId: string(),
45373
+ cap: string(),
45374
+ scope: ScopedSettingsScopeSchema,
45375
+ nodeId: string().optional()
45376
+ }), record(string(), unknown()).nullable()), method(object({
45115
45377
  addonId: string(),
45116
45378
  nodeId: string().optional()
45117
45379
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
@@ -54714,7 +54976,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54714
54976
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
54715
54977
  * clears it.
54716
54978
  */
54717
- var ConfigSchemaPassthrough$3 = custom();
54979
+ var ConfigSchemaPassthrough$2 = custom();
54718
54980
  var IntegrationInstanceIdSchema = string().min(1);
54719
54981
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54720
54982
  /**
@@ -54760,7 +55022,16 @@ var IntegrationInstanceKindSchema = object({
54760
55022
  /** Relative hub path to start an interactive account link of an instance of this kind. */
54761
55023
  connectPath: string().min(1).optional(),
54762
55024
  /** Relative hub path to disconnect that account. */
54763
- disconnectPath: string().min(1).optional()
55025
+ disconnectPath: string().min(1).optional(),
55026
+ /**
55027
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
55028
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
55029
+ * `connection` widgets write connection values, `model` widgets own the model choice.
55030
+ */
55031
+ widgets: array(object({
55032
+ id: string().min(1),
55033
+ placement: _enum(["connection", "model"])
55034
+ })).optional()
54764
55035
  });
54765
55036
  /**
54766
55037
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -54865,7 +55136,7 @@ var integrationInstancesCapability = {
54865
55136
  id: IntegrationInstanceIdSchema.nullable(),
54866
55137
  /** The kind of the create form (`id: null`) of a provider with several. */
54867
55138
  kind: string().min(1).optional()
54868
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
55139
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
54869
55140
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
54870
55141
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
54871
55142
  /**
@@ -55816,12 +56087,12 @@ var LlmModelInfoSchema = object({
55816
56087
  });
55817
56088
  /**
55818
56089
  * The provider-specific part of a profile, validated by the provider that owns
55819
- * the kind (`upsertProfile` refuses what it does not accept). A field its
56090
+ * the kind (saving an instance refuses what it does not accept). A field its
55820
56091
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
55821
56092
  * keychain, never in the row, and reads back as the redaction marker.
55822
56093
  */
55823
56094
  var LlmProviderConfigSchema = record(string(), unknown());
55824
- var LlmProfileSchema = object({
56095
+ object({
55825
56096
  id: string(),
55826
56097
  name: string(),
55827
56098
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -55915,8 +56186,8 @@ var LlmProviderWidgetSchema = object({
55915
56186
  /** ConfigUISchema tree passed through untyped on the wire (the
55916
56187
  * notification-output `ConfigSchemaPassthrough` precedent at
55917
56188
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
55918
- var ConfigSchemaPassthrough$2 = unknown();
55919
- var LlmProfileKindDescriptorSchema = object({
56189
+ var ConfigSchemaPassthrough$1 = unknown();
56190
+ object({
55920
56191
  kind: LlmProfileKindSchema,
55921
56192
  label: string(),
55922
56193
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -55924,9 +56195,9 @@ var LlmProfileKindDescriptorSchema = object({
55924
56195
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
55925
56196
  addonId: string(),
55926
56197
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
55927
- connectionSchema: ConfigSchemaPassthrough$2,
56198
+ connectionSchema: ConfigSchemaPassthrough$1,
55928
56199
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
55929
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
56200
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
55930
56201
  /** The kind's defaults; a model from `listModels` may override any of them. */
55931
56202
  features: LlmModelFeaturesSchema,
55932
56203
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -56055,20 +56326,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
56055
56326
  }), method(object({
56056
56327
  addonId: string().optional(),
56057
56328
  requestId: string()
56058
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
56059
- kind: "mutation",
56060
- auth: "admin"
56061
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
56062
- kind: "mutation",
56063
- auth: "admin"
56064
- }), method(ProfileRefInputSchema, _void(), {
56065
- kind: "mutation",
56066
- auth: "admin"
56067
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
56068
- kind: "mutation",
56069
- auth: "admin",
56070
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
56071
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56329
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56072
56330
  kind: "mutation",
56073
56331
  auth: "admin"
56074
56332
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -57063,20 +57321,7 @@ method(_void(), MeshStatusSchema), method(object({
57063
57321
  /** Optional hostname override the host should advertise once joined. */
57064
57322
  hostname: string().optional() }), object({
57065
57323
  /** Authentication URL the operator should open in a browser. */
57066
- 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({
57067
- /** Optional auth key — when provided, probes the key validity
57068
- * against the provider's API. Omit when already joined to
57069
- * just ping the daemon. */
57070
- authKey: string().optional() }), object({
57071
- ok: boolean(),
57072
- /** Provider-side identifier resolved by the probe (tailnet
57073
- * name for Tailscale, network id for ZeroTier, etc.). */
57074
- tenant: string().optional(),
57075
- /** Daemon binary version, when reachable. */
57076
- daemonVersion: string().optional(),
57077
- /** Human-readable error when `ok: false`. */
57078
- error: string().optional()
57079
- }), { kind: "mutation" });
57324
+ 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() }));
57080
57325
  object({
57081
57326
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
57082
57327
  lastFetchedAt: number()
@@ -66750,61 +66995,6 @@ var oauthIntegrationCapability = {
66750
66995
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
66751
66996
  };
66752
66997
  /**
66753
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
66754
- *
66755
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
66756
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
66757
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
66758
- * immutable after create.
66759
- */
66760
- var ConfigSchemaPassthrough$1 = unknown();
66761
- var OidcConnectionSchema = object({
66762
- id: string().min(1),
66763
- displayName: string(),
66764
- icon: string(),
66765
- issuerUrl: string(),
66766
- clientId: string(),
66767
- /** Client id + secret present — never the secret value. */
66768
- configured: boolean(),
66769
- /**
66770
- * Values for the connection form schema. `clientSecret` is a keychain
66771
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
66772
- */
66773
- formValues: record(string(), unknown()).optional()
66774
- });
66775
- /**
66776
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
66777
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
66778
- */
66779
- var OidcConnectionUpdateInputSchema = object({
66780
- id: string().min(1),
66781
- displayName: string().min(1),
66782
- icon: string().optional(),
66783
- issuerUrl: string().optional(),
66784
- clientId: string().optional(),
66785
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
66786
- redirectUri: string().optional(),
66787
- scopes: string().optional(),
66788
- usernameClaim: _enum([
66789
- "preferred_username",
66790
- "email",
66791
- "sub"
66792
- ]).optional()
66793
- });
66794
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
66795
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
66796
- displayName: string().min(1)
66797
- }), object({ id: string() }), {
66798
- kind: "mutation",
66799
- auth: "admin"
66800
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
66801
- kind: "mutation",
66802
- auth: "admin"
66803
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
66804
- kind: "mutation",
66805
- auth: "admin"
66806
- });
66807
- /**
66808
66998
  * Generic on-screen-display (video overlay) cap. Each camera exposes
66809
66999
  * a firmware-defined list of overlays (channel name, timestamp,
66810
67000
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -72977,21 +73167,6 @@ method(object({
72977
73167
  */
72978
73168
  ttlSec: union([number().int().positive(), literal("never")]).optional()
72979
73169
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
72980
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
72981
- providerId: string().min(1),
72982
- displayName: string().min(1),
72983
- configSchema: unknown(),
72984
- nodeLocal: boolean(),
72985
- shouldSaveDiskSpace: literal(true),
72986
- minFreePercent: number().min(0).max(100)
72987
- }), object({
72988
- providerId: string().min(1),
72989
- displayName: string().min(1),
72990
- configSchema: unknown(),
72991
- nodeLocal: boolean(),
72992
- shouldSaveDiskSpace: literal(false),
72993
- minFreePercent: literal(null)
72994
- })]);
72995
73170
  method(object({
72996
73171
  location: StorageLocationRefSchema,
72997
73172
  relativePath: string()
@@ -73053,42 +73228,7 @@ method(object({
73053
73228
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
73054
73229
  kind: "mutation",
73055
73230
  auth: "admin"
73056
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
73057
- createdAt: true,
73058
- updatedAt: true
73059
- }), StorageLocationSchema, {
73060
- kind: "mutation",
73061
- auth: "admin"
73062
- }), method(object({
73063
- id: string(),
73064
- force: boolean().optional()
73065
- }), _void(), {
73066
- kind: "mutation",
73067
- auth: "admin"
73068
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
73069
- ok: boolean(),
73070
- error: string().optional()
73071
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
73072
- providerId: string(),
73073
- /**
73074
- * The location this config is an UNSAVED edit of, when there is one.
73075
- *
73076
- * `listLocations` replaces every declared secret with the redaction
73077
- * sentinel, so the edit modal's form state holds the sentinel for any
73078
- * credential the operator did not retype — and posting that here
73079
- * without a way to resolve it makes the provider try to authenticate
73080
- * as `__camstack_redacted__` and report the operator's own working
73081
- * password as wrong. Given this id, the orchestrator restores each
73082
- * sentinel from the stored config (same rule as `upsertLocation`)
73083
- * before dispatching. Omitted by the "Add location" wizard, where
73084
- * every value was typed just now and nothing is stored yet.
73085
- */
73086
- locationId: string().optional(),
73087
- config: record(string(), unknown())
73088
- }), object({
73089
- ok: boolean(),
73090
- error: string().optional()
73091
- }), { auth: "admin" });
73231
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
73092
73232
  /** One table of the settings database. */
73093
73233
  var StorageTableSchema = object({
73094
73234
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -77228,6 +77368,20 @@ Object.freeze({
77228
77368
  access: "view",
77229
77369
  role: "admin"
77230
77370
  },
77371
+ "addonSettings.getScopedSettings": {
77372
+ capName: "addon-settings",
77373
+ capScope: "system",
77374
+ addonId: null,
77375
+ access: "view",
77376
+ role: "admin"
77377
+ },
77378
+ "addonSettings.readScopedValues": {
77379
+ capName: "addon-settings",
77380
+ capScope: "system",
77381
+ addonId: null,
77382
+ access: "view",
77383
+ role: "admin"
77384
+ },
77231
77385
  "addonSettings.unsetStoredSettingsKeys": {
77232
77386
  capName: "addon-settings",
77233
77387
  capScope: "system",
@@ -77249,6 +77403,13 @@ Object.freeze({
77249
77403
  access: "create",
77250
77404
  role: "admin"
77251
77405
  },
77406
+ "addonSettings.updateScopedSettings": {
77407
+ capName: "addon-settings",
77408
+ capScope: "system",
77409
+ addonId: null,
77410
+ access: "create",
77411
+ role: "admin"
77412
+ },
77252
77413
  "addonWidgets.listWidgets": {
77253
77414
  capName: "addon-widgets",
77254
77415
  capScope: "system",
@@ -80700,13 +80861,6 @@ Object.freeze({
80700
80861
  access: "delete",
80701
80862
  role: "admin"
80702
80863
  },
80703
- "llm.deleteProfile": {
80704
- capName: "llm",
80705
- capScope: "system",
80706
- addonId: null,
80707
- access: "delete",
80708
- role: "admin"
80709
- },
80710
80864
  "llm.generate": {
80711
80865
  capName: "llm",
80712
80866
  capScope: "system",
@@ -80770,20 +80924,6 @@ Object.freeze({
80770
80924
  access: "view",
80771
80925
  role: "admin"
80772
80926
  },
80773
- "llm.listProfileKinds": {
80774
- capName: "llm",
80775
- capScope: "system",
80776
- addonId: null,
80777
- access: "view",
80778
- role: "admin"
80779
- },
80780
- "llm.listProfiles": {
80781
- capName: "llm",
80782
- capScope: "system",
80783
- addonId: null,
80784
- access: "view",
80785
- role: "admin"
80786
- },
80787
80927
  "llm.listRuntimeNodes": {
80788
80928
  capName: "llm",
80789
80929
  capScope: "system",
@@ -80791,13 +80931,6 @@ Object.freeze({
80791
80931
  access: "view",
80792
80932
  role: "admin"
80793
80933
  },
80794
- "llm.migrateRawSecrets": {
80795
- capName: "llm",
80796
- capScope: "system",
80797
- addonId: null,
80798
- access: "create",
80799
- role: "admin"
80800
- },
80801
80934
  "llm.resolveModelRef": {
80802
80935
  capName: "llm",
80803
80936
  capScope: "system",
@@ -80826,20 +80959,6 @@ Object.freeze({
80826
80959
  access: "create",
80827
80960
  role: "admin"
80828
80961
  },
80829
- "llm.testProfile": {
80830
- capName: "llm",
80831
- capScope: "system",
80832
- addonId: null,
80833
- access: "create",
80834
- role: "admin"
80835
- },
80836
- "llm.upsertProfile": {
80837
- capName: "llm",
80838
- capScope: "system",
80839
- addonId: null,
80840
- access: "create",
80841
- role: "admin"
80842
- },
80843
80962
  "llmRuntime.appleAvailability": {
80844
80963
  capName: "llm-runtime",
80845
80964
  capScope: "system",
@@ -81344,13 +81463,6 @@ Object.freeze({
81344
81463
  access: "create",
81345
81464
  role: "admin"
81346
81465
  },
81347
- "meshNetwork.testConnection": {
81348
- capName: "mesh-network",
81349
- capScope: "system",
81350
- addonId: null,
81351
- access: "create",
81352
- role: "admin"
81353
- },
81354
81466
  "meter.getStatus": {
81355
81467
  capName: "meter",
81356
81468
  capScope: "device",
@@ -82009,13 +82121,6 @@ Object.freeze({
82009
82121
  access: "create",
82010
82122
  role: "admin"
82011
82123
  },
82012
- "notificationOutput.deleteTarget": {
82013
- capName: "notification-output",
82014
- capScope: "system",
82015
- addonId: null,
82016
- access: "delete",
82017
- role: "admin"
82018
- },
82019
82124
  "notificationOutput.discoverTargets": {
82020
82125
  capName: "notification-output",
82021
82126
  capScope: "system",
@@ -82023,13 +82128,6 @@ Object.freeze({
82023
82128
  access: "view",
82024
82129
  role: "admin"
82025
82130
  },
82026
- "notificationOutput.getTarget": {
82027
- capName: "notification-output",
82028
- capScope: "system",
82029
- addonId: null,
82030
- access: "view",
82031
- role: "admin"
82032
- },
82033
82131
  "notificationOutput.listTargetKinds": {
82034
82132
  capName: "notification-output",
82035
82133
  capScope: "system",
@@ -82037,13 +82135,6 @@ Object.freeze({
82037
82135
  access: "view",
82038
82136
  role: "admin"
82039
82137
  },
82040
- "notificationOutput.listTargets": {
82041
- capName: "notification-output",
82042
- capScope: "system",
82043
- addonId: null,
82044
- access: "view",
82045
- role: "admin"
82046
- },
82047
82138
  "notificationOutput.probeTargetConfig": {
82048
82139
  capName: "notification-output",
82049
82140
  capScope: "system",
@@ -82058,13 +82149,6 @@ Object.freeze({
82058
82149
  access: "create",
82059
82150
  role: "admin"
82060
82151
  },
82061
- "notificationOutput.setTargetEnabled": {
82062
- capName: "notification-output",
82063
- capScope: "system",
82064
- addonId: null,
82065
- access: "create",
82066
- role: "admin"
82067
- },
82068
82152
  "notificationOutput.testTarget": {
82069
82153
  capName: "notification-output",
82070
82154
  capScope: "system",
@@ -82072,13 +82156,6 @@ Object.freeze({
82072
82156
  access: "create",
82073
82157
  role: "admin"
82074
82158
  },
82075
- "notificationOutput.upsertTarget": {
82076
- capName: "notification-output",
82077
- capScope: "system",
82078
- addonId: null,
82079
- access: "create",
82080
- role: "admin"
82081
- },
82082
82159
  "notificationRules.activateAlarmProfile": {
82083
82160
  capName: "notification-rules",
82084
82161
  capScope: "system",
@@ -82338,41 +82415,6 @@ Object.freeze({
82338
82415
  access: "view",
82339
82416
  role: "admin"
82340
82417
  },
82341
- "oidcConnections.connectionFormSchema": {
82342
- capName: "oidc-connections",
82343
- capScope: "system",
82344
- addonId: null,
82345
- access: "view",
82346
- role: "admin"
82347
- },
82348
- "oidcConnections.createConnection": {
82349
- capName: "oidc-connections",
82350
- capScope: "system",
82351
- addonId: null,
82352
- access: "create",
82353
- role: "admin"
82354
- },
82355
- "oidcConnections.deleteConnection": {
82356
- capName: "oidc-connections",
82357
- capScope: "system",
82358
- addonId: null,
82359
- access: "delete",
82360
- role: "admin"
82361
- },
82362
- "oidcConnections.listConnections": {
82363
- capName: "oidc-connections",
82364
- capScope: "system",
82365
- addonId: null,
82366
- access: "view",
82367
- role: "admin"
82368
- },
82369
- "oidcConnections.updateConnection": {
82370
- capName: "oidc-connections",
82371
- capScope: "system",
82372
- addonId: null,
82373
- access: "create",
82374
- role: "admin"
82375
- },
82376
82418
  "osd.getStatus": {
82377
82419
  capName: "osd",
82378
82420
  capScope: "device",
@@ -85404,13 +85446,6 @@ Object.freeze({
85404
85446
  access: "delete",
85405
85447
  role: "admin"
85406
85448
  },
85407
- "storage.deleteLocation": {
85408
- capName: "storage",
85409
- capScope: "system",
85410
- addonId: null,
85411
- access: "delete",
85412
- role: "admin"
85413
- },
85414
85449
  "storage.endDownload": {
85415
85450
  capName: "storage",
85416
85451
  capScope: "system",
@@ -85467,13 +85502,6 @@ Object.freeze({
85467
85502
  access: "view",
85468
85503
  role: "admin"
85469
85504
  },
85470
- "storage.listProviders": {
85471
- capName: "storage",
85472
- capScope: "system",
85473
- addonId: null,
85474
- access: "view",
85475
- role: "admin"
85476
- },
85477
85505
  "storage.read": {
85478
85506
  capName: "storage",
85479
85507
  capScope: "system",
@@ -85495,27 +85523,6 @@ Object.freeze({
85495
85523
  access: "view",
85496
85524
  role: "admin"
85497
85525
  },
85498
- "storage.testConfig": {
85499
- capName: "storage",
85500
- capScope: "system",
85501
- addonId: null,
85502
- access: "view",
85503
- role: "admin"
85504
- },
85505
- "storage.testLocation": {
85506
- capName: "storage",
85507
- capScope: "system",
85508
- addonId: null,
85509
- access: "view",
85510
- role: "admin"
85511
- },
85512
- "storage.upsertLocation": {
85513
- capName: "storage",
85514
- capScope: "system",
85515
- addonId: null,
85516
- access: "create",
85517
- role: "admin"
85518
- },
85519
85526
  "storage.write": {
85520
85527
  capName: "storage",
85521
85528
  capScope: "system",
@@ -105745,6 +105752,11 @@ var ExportAlexaAddon = class extends BaseAddon {
105745
105752
  "tokens[userId].refreshToken",
105746
105753
  "tokens[userId].brokerCredential"
105747
105754
  ];
105755
+ /** The hidden HMAC key of snapshot URLs (store key `snapshotSigningKey`, a keychain secret). */
105756
+ snapshotSigningKeyState = this.state("snapshotSigningKey", string(), "");
105757
+ /** The legacy ledger keys, until the migrations have moved them to the `skill-links` record. */
105758
+ legacyLinkedAccounts = this.state("linkedAccounts", array(LinkedAccountSchema), []);
105759
+ legacyTokens = this.state("tokens", array(LwaTokenEntrySchema), []);
105748
105760
  snapshotStore = new SnapshotStore(() => this.config.snapshotSigningKey);
105749
105761
  publicEndpoint = createPublicEndpointReader(() => this.ctx.api.localNetwork.getAddresses.query());
105750
105762
  accessGateRef = null;
@@ -105789,18 +105801,7 @@ var ExportAlexaAddon = class extends BaseAddon {
105789
105801
  accessGate: this.requireGate(),
105790
105802
  settings: () => this.config,
105791
105803
  handles: this.requireHandles(),
105792
- legacyLedger: (instanceId) => instanceId === "export-alexa" ? {
105793
- read: () => ({
105794
- linkedAccounts: this.config.linkedAccounts,
105795
- tokens: this.config.tokens
105796
- }),
105797
- write: async (patch) => {
105798
- await this.updateGlobalSettings({
105799
- ...patch.linkedAccounts === void 0 ? {} : { linkedAccounts: patch.linkedAccounts },
105800
- ...patch.tokens === void 0 ? {} : { tokens: patch.tokens }
105801
- });
105802
- }
105803
- } : null,
105804
+ legacyLedger: (instanceId) => instanceId === "export-alexa" ? this.legacyLedgerPort() : null,
105804
105805
  linkedUserIdsElsewhere: async (instanceId) => {
105805
105806
  const users = /* @__PURE__ */ new Set();
105806
105807
  for (const [id, runtime] of this.runtimes) {
@@ -105816,6 +105817,26 @@ var ExportAlexaAddon = class extends BaseAddon {
105816
105817
  }
105817
105818
  };
105818
105819
  }
105820
+ /** The legacy ledger keys of the addon store, read from `config` and written through `state()`. */
105821
+ legacyLedgerPort() {
105822
+ return {
105823
+ read: () => ({
105824
+ linkedAccounts: this.config.linkedAccounts,
105825
+ tokens: this.config.tokens
105826
+ }),
105827
+ write: async (patch) => {
105828
+ if (patch.linkedAccounts !== void 0) await this.legacyLinkedAccounts.set([...patch.linkedAccounts]);
105829
+ if (patch.tokens !== void 0) await this.legacyTokens.set([...patch.tokens]);
105830
+ await this.resolveConfig();
105831
+ }
105832
+ };
105833
+ }
105834
+ /** The snapshot URL signing key (R2): generated once, hidden, rotated by nothing. */
105835
+ async ensureSnapshotSigningKey() {
105836
+ if (this.config.snapshotSigningKey) return;
105837
+ await this.snapshotSigningKeyState.set(generateIngressToken());
105838
+ await this.resolveConfig();
105839
+ }
105819
105840
  async onInitialize() {
105820
105841
  const records = this.ctx.records;
105821
105842
  if (records === void 0) throw new Error("export-alexa needs ctx.records — check execution.placement (hub-only)");
@@ -105865,7 +105886,7 @@ var ExportAlexaAddon = class extends BaseAddon {
105865
105886
  onChanged: (id, change) => this.onInstanceChanged(id, change)
105866
105887
  });
105867
105888
  await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, this.migrationPorts()));
105868
- if (!this.config.snapshotSigningKey) await this.updateGlobalSettings({ snapshotSigningKey: generateIngressToken() });
105889
+ await this.ensureSnapshotSigningKey();
105869
105890
  if (this.config.lwaClientSecret) {
105870
105891
  await this.clearSecrets(["lwaClientSecret"]);
105871
105892
  this.ctx.logger.warn("export-alexa: removed a stored LWA client secret — the hub no longer uses one; your skill Lambda holds it (D753)");