@camstack/addon-export-google 0.1.129 → 0.1.131

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.
@@ -74,7 +74,7 @@ function createApiDeviceGateway(deps) {
74
74
  };
75
75
  }
76
76
  //#endregion
77
- //#region ../types/dist/event-category-BmPm98n0.mjs
77
+ //#region ../types/dist/event-category-78tcBemo.mjs
78
78
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
79
79
  EventCategory["SystemBoot"] = "system.boot";
80
80
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -195,6 +195,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
195
195
  */
196
196
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
197
197
  /**
198
+ * An addon is RUNNING although its installed package is below what the
199
+ * running server requires (`camstack.requires.addons` of the server, or the
200
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
201
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
202
+ * operator alert per node and package. The addon is never held back for it.
203
+ *
204
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
205
+ */
206
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
207
+ /**
208
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
209
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
210
+ *
211
+ * Payload: `{ packageName, addonId, nodeId }`.
212
+ */
213
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
214
+ /**
198
215
  * Monitor scheduled the next retry for a failed addon. Transient —
199
216
  * surfaced to the UI for live-updating the "next retry in Ns"
200
217
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -305,7 +322,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
305
322
  EventCategory["ProcessRestarted"] = "process.restarted";
306
323
  /**
307
324
  * The SET of storage locations changed — one was created, edited, enabled,
308
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
325
+ * disabled or deleted through the location instances or the forced-delete action.
309
326
  *
310
327
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
311
328
  * it must also converge on its own periodic path, because a dropped event
@@ -860,7 +877,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
860
877
  return EventCategory;
861
878
  }({});
862
879
  //#endregion
863
- //#region ../types/dist/device-type-D1fH5kaC.mjs
880
+ //#region ../types/dist/device-type-DxCT0krO.mjs
864
881
  /**
865
882
  import { errMsg } from '@camstack/types'
866
883
  * Extract a human-readable message from an unknown error value.
@@ -1022,6 +1039,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1022
1039
  * filters that want "all devices with on-motion behaviour".
1023
1040
  */
1024
1041
  DeviceFeature["MotionTrigger"] = "motion-trigger";
1042
+ /**
1043
+ * Device can be run for a chosen time and then stopped. Mirrors the
1044
+ * `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
1045
+ * a driver, so the flag is derived from the device's bindings
1046
+ * (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
1047
+ */
1048
+ DeviceFeature["TimedRun"] = "timed-run";
1025
1049
  /** Light supports rgb-triplet color via `color` cap. */
1026
1050
  DeviceFeature["LightColorRgb"] = "light-color-rgb";
1027
1051
  /** Light supports HSV color via `color` cap. */
@@ -6056,7 +6080,7 @@ var ZodIssueCode = {
6056
6080
  var ZodFirstPartyTypeKind;
6057
6081
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6058
6082
  //#endregion
6059
- //#region ../types/dist/sleep-D7ZKm4nb.mjs
6083
+ //#region ../types/dist/sleep-7El4r5Bl.mjs
6060
6084
  /**
6061
6085
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6062
6086
  * window to float samples (D455).
@@ -6420,6 +6444,59 @@ Object.fromEntries([
6420
6444
  function isValuelessField(field) {
6421
6445
  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";
6422
6446
  }
6447
+ /**
6448
+ * Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
6449
+ * `key → { value, default }`, recursing through `group` and `sub-tabs`
6450
+ * layout fields. Keeping `value` and `default` SEPARATE (rather than
6451
+ * pre-resolving) lets callers both read the effective value AND detect
6452
+ * overrides (`value` differs from `default`). Structural over `unknown`;
6453
+ * malformed input yields an empty map, never throws.
6454
+ */
6455
+ function collectHydratedFieldEntries(schema) {
6456
+ const out = /* @__PURE__ */ new Map();
6457
+ if (typeof schema !== "object" || schema === null) return out;
6458
+ const sections = schema.sections;
6459
+ if (!Array.isArray(sections)) return out;
6460
+ for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
6461
+ return out;
6462
+ }
6463
+ /** Recursive field walker for {@link collectHydratedFieldEntries}. */
6464
+ function collectFieldEntriesInto(fields, into) {
6465
+ if (!Array.isArray(fields)) return;
6466
+ for (const field of fields) {
6467
+ if (typeof field !== "object" || field === null) continue;
6468
+ const type = field.type;
6469
+ if (type === "group") {
6470
+ collectFieldEntriesInto(field.fields, into);
6471
+ continue;
6472
+ }
6473
+ if (type === "sub-tabs") {
6474
+ const tabs = field.tabs;
6475
+ if (Array.isArray(tabs)) {
6476
+ for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
6477
+ }
6478
+ continue;
6479
+ }
6480
+ const key = field.key;
6481
+ if (typeof key !== "string" || key.length === 0) continue;
6482
+ if (!("value" in field)) continue;
6483
+ into.set(key, {
6484
+ value: field.value,
6485
+ default: field.default
6486
+ });
6487
+ }
6488
+ }
6489
+ /**
6490
+ * Flatten a hydrated settings payload into `key → EFFECTIVE value`
6491
+ * (`value ?? default`). The read-side inverse of `hydrateSchema` for the
6492
+ * common "just give me the resolved values" case. Built on
6493
+ * {@link collectHydratedFieldEntries}.
6494
+ */
6495
+ function collectHydratedFieldValues(schema) {
6496
+ const out = /* @__PURE__ */ new Map();
6497
+ for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
6498
+ return out;
6499
+ }
6423
6500
  function hydrateSchema(schema, values, options = {}) {
6424
6501
  return {
6425
6502
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
@@ -7304,17 +7381,35 @@ var RecordIntegrationInstances = class {
7304
7381
  ...kind !== void 0 ? { kind } : {}
7305
7382
  });
7306
7383
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7384
+ const initial = this.hooks.initialBody(name, kind);
7385
+ const patch = this.patchOf(values ?? {});
7386
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7387
+ kind,
7388
+ body: {
7389
+ ...initial,
7390
+ ...patch
7391
+ }
7392
+ }));
7307
7393
  await this.handle.put({
7308
7394
  id: minted,
7309
- data: this.hooks.initialBody(name, kind)
7395
+ data: initial
7310
7396
  }, { ifRev: 0 });
7311
- const patch = this.patchOf(values ?? {});
7312
7397
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7313
7398
  await this.hooks.onChanged?.(minted, "created");
7314
7399
  return { id: minted };
7315
7400
  };
7316
7401
  updateInstance = async ({ id, name, values }) => {
7317
7402
  const patch = this.patchOf(values);
7403
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7404
+ const stored = await this.handle.get(id);
7405
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7406
+ kind: void 0,
7407
+ body: {
7408
+ ...stored.data,
7409
+ ...patch
7410
+ }
7411
+ }));
7412
+ }
7318
7413
  if (name !== void 0) patch[this.nameField] = name;
7319
7414
  await this.handle.patch(id, patch);
7320
7415
  await this.hooks.onChanged?.(id, "updated");
@@ -7625,6 +7720,21 @@ var SCOPED_SETTINGS_SCOPES = [
7625
7720
  "device-defaults",
7626
7721
  "node"
7627
7722
  ];
7723
+ /** The one refusal of a key a scope did not declare. */
7724
+ function assertDeclaredKeys(keys, declared) {
7725
+ const undeclared = keys.filter((key) => !declared.has(key));
7726
+ if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
7727
+ }
7728
+ /** Build the handle over an addon's scoped read, write and unset. */
7729
+ function createScopedSettings(deps) {
7730
+ return {
7731
+ async get() {
7732
+ return deps.schema.parse(await deps.read());
7733
+ },
7734
+ patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
7735
+ unset: (keys) => deps.unset(keys)
7736
+ };
7737
+ }
7628
7738
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7629
7739
  var KeychainWriteRefusedError = class extends Error {
7630
7740
  fieldPath;
@@ -8200,7 +8310,16 @@ function createHandle(raw, opts) {
8200
8310
  return blob;
8201
8311
  }
8202
8312
  },
8203
- writeAddonStore: writeAddon
8313
+ writeAddonStore: writeAddon,
8314
+ removeClearedKeys: (keys) => serialize("addon", async () => {
8315
+ const stored = await readStoredAddonBlob(raw);
8316
+ index.seen("addon", stored);
8317
+ const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
8318
+ if (removable.length === 0) return;
8319
+ const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
8320
+ await raw.writeAddonStore(patch);
8321
+ index.wrote("addon", patch);
8322
+ })
8204
8323
  };
8205
8324
  }
8206
8325
  /** The context the addon sees, plus the private raw view and write outcome. */
@@ -8330,7 +8449,7 @@ function boundOf(list) {
8330
8449
  * Base class for CamStack addons. Eliminates settings boilerplate:
8331
8450
  *
8332
8451
  * - Typed `config` property with automatic resolution from store + defaults
8333
- * - `getGlobalSettings()` / `updateGlobalSettings()` auto-implemented
8452
+ * - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
8334
8453
  * - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
8335
8454
  * - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
8336
8455
  * - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
@@ -8340,7 +8459,7 @@ function boundOf(list) {
8340
8459
  * Subclasses override:
8341
8460
  * - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
8342
8461
  * - `onShutdown()` — cleanup
8343
- * - `globalSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
8462
+ * - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
8344
8463
  *
8345
8464
  * @example
8346
8465
  * ```ts
@@ -8354,7 +8473,7 @@ function boundOf(list) {
8354
8473
  * super({ maxRetries: 3, endpoint: 'http://localhost' })
8355
8474
  * }
8356
8475
  *
8357
- * protected globalSettingsSchema() {
8476
+ * protected clusterSettingsSchema() {
8358
8477
  * return this.schema({
8359
8478
  * sections: [{
8360
8479
  * id: 'main', title: 'Settings',
@@ -8397,7 +8516,7 @@ var BaseAddon = class {
8397
8516
  defaults;
8398
8517
  /**
8399
8518
  * Hidden-state paths that hold secrets (D787) — values the addon writes
8400
- * itself (`updateGlobalSettings`, `state()`) that no form field declares.
8519
+ * itself (`state()`, the scoped writers) that no form field declares.
8401
8520
  * Stored in the keychain exactly like a `password` field. Syntax:
8402
8521
  * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
8403
8522
  * (`key[<id field>]` addresses array items by id, never by index).
@@ -8407,7 +8526,7 @@ var BaseAddon = class {
8407
8526
  /**
8408
8527
  * D986 M4: the scoped schemas this addon declared, resolved once per capability
8409
8528
  * (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
8410
- * see them. Empty until loaded: the readers then fall back to {@link globalSettingsSchema}.
8529
+ * see them. Empty until loaded.
8411
8530
  */
8412
8531
  _scopedByCap = /* @__PURE__ */ new Map();
8413
8532
  _nodeKeysByCap = /* @__PURE__ */ new Map();
@@ -8593,7 +8712,7 @@ var BaseAddon = class {
8593
8712
  /** Addon-specific cleanup. Override if needed. */
8594
8713
  async onShutdown() {}
8595
8714
  /**
8596
- * Called after config is resolved during updateGlobalSettings/updateAddonSettings.
8715
+ * Called after config is resolved during a settings write.
8597
8716
  * Override to react to config changes (e.g. restart a sampler, reconnect a service).
8598
8717
  * Not called during initialize() — use onInitialize() for initial setup.
8599
8718
  */
@@ -8622,82 +8741,12 @@ var BaseAddon = class {
8622
8741
  scopedSettingsCapabilities() {
8623
8742
  return [];
8624
8743
  }
8625
- /** Override to provide global-level settings UI schema. */
8626
- globalSettingsSchema(_cap) {
8627
- return null;
8628
- }
8629
8744
  /** Override to provide device-level settings UI schema. */
8630
8745
  deviceSettingsSchema() {
8631
8746
  return null;
8632
8747
  }
8633
8748
  /**
8634
- * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
8635
- * ARE the configuration of its integration.
8636
- *
8637
- * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
8638
- * operator should find on the addon's integration page (System →
8639
- * Integrations → <name>) rather than only in the cluster-wide list of every
8640
- * addon. Empty (the default) means the addon has no integration-level
8641
- * settings and no such surface is offered — this is opt-in, because whether
8642
- * an addon's configuration IS its integration's configuration depends on the
8643
- * nature of the integration.
8644
- *
8645
- * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
8646
- * the ONE global schema, in the ONE addon store, written by the ONE
8647
- * `updateGlobalSettings` path. There is deliberately no
8648
- * `updateIntegrationSettings`: a second write path is how a surface acquires
8649
- * a second store key, and this repo has shipped that twice (`btmPath@hub`,
8650
- * D266). Selecting sections cannot introduce a key that selecting cannot.
8651
- *
8652
- * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
8653
- * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
8654
- * removed with the reason recorded at
8655
- * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
8656
- * determined by WHICH schema it lives in, not by a field-level marker."* A
8657
- * marker sprinkled across sections also has to borrow a field that already
8658
- * means something else; borrowing `section.tab` put the literal word
8659
- * "integration" into an operator-facing tab bar, because `tab` means "how to
8660
- * GROUP this visually" and cannot also mean "where this lives" (D269
8661
- * supersedes D268). One declaration, in one place, next to the schema whose
8662
- * ids it names.
8663
- */
8664
- integrationSettingSections() {
8665
- return [];
8666
- }
8667
- async getGlobalSettings(overlay, cap, nodeId) {
8668
- await this.loadScopedSchemas(cap);
8669
- const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
8670
- if (!schema) return { sections: [] };
8671
- const projected = await this.readRawProjectedStore(nodeId, cap);
8672
- return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
8673
- }
8674
- /**
8675
- * The integration-level view of this addon's settings: exactly the sections
8676
- * named by {@link integrationSettingSections}, hydrated from the SAME store
8677
- * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
8678
- *
8679
- * Returns `null` when the addon declared nothing — an addon that opts out has
8680
- * no integration settings surface at all, rather than an empty one that reads
8681
- * as a failed load.
8682
- *
8683
- * Three properties hold BY CONSTRUCTION, which is why they are here in core
8684
- * and not in whichever UI happens to render this:
8685
- *
8686
- * 1. **One key.** The payload is a SUBSET of the global schema, so a field
8687
- * shown here is the same field, with the same bare key, that the addon's
8688
- * own page shows. There is no integration-specific writer — callers save
8689
- * through `updateGlobalSettings` — so a second store key is unreachable,
8690
- * not merely discouraged.
8691
- * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
8692
- * is `<key>@<nodeId>` and an integration is not a node; whichever node
8693
- * such a field silently picked would be a wrong answer for the operator
8694
- * who opened the page (D266).
8695
- * 3. **No silent typo.** A declared id that names no section throws. The
8696
- * alternative — skip it — turns a rename into a surface that quietly
8697
- * empties, which looks exactly like an addon with nothing to configure.
8698
- */
8699
- /**
8700
- * The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
8749
+ * The form schema of ONE integration instance, or `null` to use the scoped form.
8701
8750
  *
8702
8751
  * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
8703
8752
  * needs its connection fields, the default integration the addon's own sections. It is the
@@ -8745,37 +8794,178 @@ var BaseAddon = class {
8745
8794
  }
8746
8795
  }
8747
8796
  /**
8797
+ * Hook: values layered over the stored ones when the FORM of one scope is served
8798
+ * ({@link getScopedSettings}) — a preview that derives dependent options without writing.
8799
+ * Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
8800
+ */
8801
+ async scopedSettingsOverlay(_scope, _cap, _nodeId) {
8802
+ return null;
8803
+ }
8804
+ /**
8805
+ * Hook: a write of one scope changed stored values (not called when the store reports no change,
8806
+ * e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
8807
+ */
8808
+ async onScopedSettingsChanged(_scope, _cap, _keys) {}
8809
+ /** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
8810
+ clusterSettings(cap, schema) {
8811
+ return this.scopedHandle("cluster", cap, schema);
8812
+ }
8813
+ /** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
8814
+ deviceDefaults(cap, schema) {
8815
+ return this.scopedHandle("device-defaults", cap, schema);
8816
+ }
8817
+ /**
8818
+ * Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
8819
+ * with no row yields the schema defaults — never a bare-key fallback.
8820
+ */
8821
+ nodeSettings(cap, schema, nodeId) {
8822
+ return this.scopedHandle("node", cap, schema, nodeId);
8823
+ }
8824
+ /**
8825
+ * {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
8826
+ * settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
8827
+ * central delete. `nodeId` omitted ⇒ the local node.
8828
+ */
8829
+ nodeState(key, schema, fallback, nodeId) {
8830
+ this._declaredStateKeys.add(key);
8831
+ return createDurableState({
8832
+ key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
8833
+ schema,
8834
+ fallback,
8835
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
8836
+ write: async (patch) => {
8837
+ await this._ctx?.settings?.writeAddonStore(patch);
8838
+ },
8839
+ onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
8840
+ addonId: this._ctx?.id,
8841
+ key: k,
8842
+ error: String(e)
8843
+ } })
8844
+ });
8845
+ }
8846
+ /** The loaded schema `cap` declares for `scope`, or `null`. */
8847
+ async declaredScopedSchema(scope, cap) {
8848
+ await this.loadScopedSchemas(cap);
8849
+ return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
8850
+ }
8851
+ async requireScopedSchema(scope, cap) {
8852
+ const schema = await this.declaredScopedSchema(scope, cap);
8853
+ if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
8854
+ return schema;
8855
+ }
8856
+ scopedKeys(schema) {
8857
+ return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
8858
+ }
8859
+ /** `store` narrowed to the keys `schema` declares. */
8860
+ narrowToScope(store, schema) {
8861
+ const keys = this.scopedKeys(schema);
8862
+ return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
8863
+ }
8864
+ scopedHandle(scope, cap, schema, nodeId) {
8865
+ return createScopedSettings({
8866
+ schema,
8867
+ read: async () => {
8868
+ const declared = await this.requireScopedSchema(scope, cap);
8869
+ const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
8870
+ const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
8871
+ return {
8872
+ ...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
8873
+ ...stored
8874
+ };
8875
+ },
8876
+ write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
8877
+ unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
8878
+ });
8879
+ }
8880
+ /** The one write path of the scoped API: declared keys only, then the global patch. */
8881
+ async writeScoped(scope, cap, patch, nodeId) {
8882
+ assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8883
+ if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
8884
+ }
8885
+ /**
8886
+ * Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
8887
+ * value is released exactly as there — and the emptied row is then removed; every other key is
8888
+ * removed by an `undefined` patch (which a secret transform would read as "keep").
8889
+ */
8890
+ async unsetScoped(scope, cap, keys, nodeId) {
8891
+ assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8892
+ const target = scope === "node" ? nodeId : void 0;
8893
+ const tree = this.addonSecretTree();
8894
+ const secretKeys = keys.filter((key) => tree.has(key));
8895
+ const plainKeys = keys.filter((key) => !tree.has(key));
8896
+ let changed = false;
8897
+ if (plainKeys.length > 0) {
8898
+ const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
8899
+ changed = await this.applyGlobalPatch(patch, target, cap) || changed;
8900
+ }
8901
+ if (secretKeys.length > 0) {
8902
+ await this.clearSecretKeys(secretKeys, target, cap);
8903
+ const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
8904
+ const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
8905
+ if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
8906
+ else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
8907
+ changed = true;
8908
+ }
8909
+ if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
8910
+ }
8911
+ /**
8912
+ * The hydrated form of one scope of one capability's settings (any
8913
+ * {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
8914
+ */
8915
+ async getScopedSettings(scope, cap, nodeId) {
8916
+ const schema = await this.declaredScopedSchema(scope, cap);
8917
+ if (schema === null) return null;
8918
+ const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
8919
+ const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
8920
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
8921
+ }
8922
+ /**
8923
+ * The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
8924
+ * in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
8925
+ * nothing.
8926
+ */
8927
+ async listScopedSettings() {
8928
+ await this.loadScopedSchemas();
8929
+ return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
8930
+ cap,
8931
+ scope: entry.scope,
8932
+ sectionIds: entry.schema.sections.map((section) => section.id)
8933
+ })));
8934
+ }
8935
+ /** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
8936
+ async updateScopedSettings(scope, cap, patch, nodeId) {
8937
+ this._operatorWriteDepth++;
8938
+ try {
8939
+ await this.writeScoped(scope, cap, patch, nodeId);
8940
+ } finally {
8941
+ this._operatorWriteDepth--;
8942
+ }
8943
+ }
8944
+ /**
8945
+ * The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
8946
+ * its value. `null` when the capability declares nothing for the scope.
8947
+ */
8948
+ async readScopedValues(scope, cap, nodeId) {
8949
+ const schema = await this.declaredScopedSchema(scope, cap);
8950
+ if (schema === null) return null;
8951
+ const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
8952
+ return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
8953
+ }
8954
+ /**
8748
8955
  * What the create wizard and the integration edit page render for one instance: the addon's
8749
8956
  * per-instance schema when it declares one, else its global schema (what they always showed).
8750
8957
  */
8751
8958
  async getIntegrationFormSchema(instance, nodeId) {
8752
8959
  const scoped = await this.integrationFormSchema(instance);
8753
- if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
8960
+ if (scoped === null) return this.scopedForm(nodeId);
8754
8961
  return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
8755
8962
  }
8756
- async getIntegrationSettings(nodeId) {
8757
- const declared = this.integrationSettingSections();
8758
- if (declared.length === 0) return null;
8759
- const schema = this.globalSettingsSchema();
8760
- if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
8761
- const byId = new Map(schema.sections.map((section) => [section.id, section]));
8762
- const sections = [];
8763
- for (const id of declared) {
8764
- const section = byId.get(id);
8765
- if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
8766
- const fields = dropPerNodeFields(section.fields);
8767
- if (fields.length === 0) continue;
8768
- sections.push({
8769
- ...section,
8770
- fields
8771
- });
8772
- }
8773
- if (sections.length === 0) return null;
8774
- const projected = await this.readRawProjectedStore(nodeId);
8775
- return hydrateSchema({
8776
- ...schema,
8777
- sections
8778
- }, projected, { inlineSecretsAsViews: true });
8963
+ /** The form of the scoped schemas this addon declared, hydrated from its store. */
8964
+ async scopedForm(nodeId) {
8965
+ await this.loadScopedSchemas();
8966
+ const schema = this.scopedFormSchema();
8967
+ if (!schema) return { sections: [] };
8968
+ return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
8779
8969
  }
8780
8970
  /**
8781
8971
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -8784,8 +8974,8 @@ var BaseAddon = class {
8784
8974
  * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
8785
8975
  * A no-op passthrough when the schema declares no `perNode` field.
8786
8976
  *
8787
- * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
8788
- * the store for custom option logic (option narrowing, value snapping) to
8977
+ * This is the sanctioned way for an addon that needs
8978
+ * the store for custom logic (option narrowing, value snapping) to
8789
8979
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
8790
8980
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
8791
8981
  *
@@ -8837,7 +9027,7 @@ var BaseAddon = class {
8837
9027
  }
8838
9028
  /**
8839
9029
  * Whether ONE global key of this addon's store was written, read three-way
8840
- * (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
9030
+ * (D651). For a question a hydrated view cannot answer: a hydrated form
8841
9031
  * reports `value ?? default`, so "the operator chose the default" and "nobody
8842
9032
  * chose" look the same, and a failed read looks like both. A `perNode` key is
8843
9033
  * not supported here: its stored name is scoped.
@@ -8871,7 +9061,7 @@ var BaseAddon = class {
8871
9061
  }
8872
9062
  /**
8873
9063
  * The OPERATOR's write — a settings form or an admin API call, dispatched by
8874
- * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
9064
+ * the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
8875
9065
  * the operator sends is stored as sent even when it equals a pre-keychain
8876
9066
  * inline value: the operator re-entering a password is a change, an addon
8877
9067
  * writing back what it read is not (D787).
@@ -8884,9 +9074,6 @@ var BaseAddon = class {
8884
9074
  this._operatorWriteDepth--;
8885
9075
  }
8886
9076
  }
8887
- async updateGlobalSettings(patch, nodeId) {
8888
- await this.applyGlobalPatch(patch, nodeId);
8889
- }
8890
9077
  /**
8891
9078
  * REMOVE stored secrets — their keychain values and their markers (D787).
8892
9079
  *
@@ -8896,6 +9083,9 @@ var BaseAddon = class {
8896
9083
  * a keychain (an older kernel) it writes `''`, as such code always did.
8897
9084
  */
8898
9085
  async clearSecrets(keys, nodeId) {
9086
+ await this.clearSecretKeys(keys, nodeId);
9087
+ }
9088
+ async clearSecretKeys(keys, nodeId, cap) {
8899
9089
  const tree = this.addonSecretTree();
8900
9090
  const keychain = this._ctx?.secrets !== void 0;
8901
9091
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
@@ -8908,25 +9098,26 @@ var BaseAddon = class {
8908
9098
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8909
9099
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8910
9100
  }
8911
- await this.applyGlobalPatch(patch, nodeId);
9101
+ await this.applyGlobalPatch(patch, nodeId, cap);
8912
9102
  }
8913
- async applyGlobalPatch(barePatch, nodeId) {
8914
- await this.loadScopedSchemas();
8915
- const keys = this.perNodeKeys();
9103
+ /** Resolves `true` when the write changed stored values. */
9104
+ async applyGlobalPatch(barePatch, nodeId, cap) {
9105
+ await this.loadScopedSchemas(cap);
9106
+ const keys = this.perNodeKeys(cap);
8916
9107
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
8917
9108
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
8918
9109
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
8919
9110
  const handle = this._secretSettings;
8920
9111
  if (handle !== null) {
8921
9112
  const { changed } = await handle.writeAddonStore(scoped);
8922
- if (!changed) return;
9113
+ if (!changed) return false;
8923
9114
  } else await this._ctx?.settings?.writeAddonStore(scoped);
8924
- if (target !== localNode) return;
9115
+ if (target !== localNode) return true;
8925
9116
  await this.resolveConfig();
8926
9117
  await this.onConfigChanged();
8927
9118
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
8928
- const legacy = this.globalSettingsSchema();
8929
- this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
9119
+ this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
9120
+ return true;
8930
9121
  }
8931
9122
  /**
8932
9123
  * The set of field keys the global settings schema declares `perNode: true`
@@ -8963,10 +9154,7 @@ var BaseAddon = class {
8963
9154
  this._nodeKeysByCap = /* @__PURE__ */ new Map();
8964
9155
  this._addonSecretTree = null;
8965
9156
  }
8966
- /**
8967
- * The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
8968
- * sections of its scoped schemas, so dropping the old hook does not blank the form.
8969
- */
9157
+ /** The form of an addon's scoped schemas: their sections, each shown once. */
8970
9158
  scopedFormSchema(cap) {
8971
9159
  const byId = /* @__PURE__ */ new Map();
8972
9160
  for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
@@ -8978,8 +9166,7 @@ var BaseAddon = class {
8978
9166
  return [...this._scopedByCap.values()].flat();
8979
9167
  }
8980
9168
  /**
8981
- * The field keys that are stored per node: every field of a {@link nodeSettingsSchema}, plus
8982
- * the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
9169
+ * The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
8983
9170
  * per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
8984
9171
  * per-node code path is bypassed and the settings API behaves like the node-agnostic one.
8985
9172
  * Call {@link loadScopedSchemas} first (the async seams do).
@@ -8988,8 +9175,7 @@ var BaseAddon = class {
8988
9175
  const cacheKey = cap ?? "";
8989
9176
  const cached = this._nodeKeysByCap.get(cacheKey);
8990
9177
  if (cached) return cached;
8991
- const legacy = this.globalSettingsSchema(cap);
8992
- const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
9178
+ const keys = /* @__PURE__ */ new Set();
8993
9179
  for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
8994
9180
  if (scope !== "node") continue;
8995
9181
  for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
@@ -9207,8 +9393,6 @@ var BaseAddon = class {
9207
9393
  }
9208
9394
  declaredKeySet() {
9209
9395
  const keys = new Set(Object.keys(this.defaults));
9210
- const schema = this.globalSettingsSchema();
9211
- if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
9212
9396
  for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
9213
9397
  for (const key of this._declaredStateKeys) keys.add(key);
9214
9398
  for (const path of this.secretStatePaths) {
@@ -9306,7 +9490,7 @@ var BaseAddon = class {
9306
9490
  /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
9307
9491
  addonSecretTree() {
9308
9492
  if (this._addonSecretTree === null) {
9309
- const tree = new Map(secretTreeFromSchema(this.globalSettingsSchema()));
9493
+ const tree = /* @__PURE__ */ new Map();
9310
9494
  for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
9311
9495
  this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
9312
9496
  }
@@ -9518,47 +9702,6 @@ function classifyStoreError(err) {
9518
9702
  if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
9519
9703
  return "permanent";
9520
9704
  }
9521
- /**
9522
- * Collect the keys of every field marked `perNode: true`, recursing into
9523
- * layout containers (`group` fields and `sub-tabs` tabs) the same way
9524
- * `hydrateSchema` does. Valueless structural fields (separator/info/…)
9525
- * don't declare `perNode` and are excluded by the `in` narrowing.
9526
- */
9527
- /**
9528
- * The same fields with every `perNode: true` one removed, recursing into layout
9529
- * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
9530
- * with no child is dropped rather than rendered empty.
9531
- *
9532
- * Used by `getIntegrationSettings`: an integration is not a node, so a field
9533
- * whose store key is `<key>@<nodeId>` has no node to belong to there.
9534
- */
9535
- function dropPerNodeFields(fields) {
9536
- const kept = [];
9537
- for (const field of fields) {
9538
- if (field.type === "group") {
9539
- const inner = dropPerNodeFields(field.fields);
9540
- if (inner.length > 0) kept.push({
9541
- ...field,
9542
- fields: inner
9543
- });
9544
- continue;
9545
- }
9546
- if (field.type === "sub-tabs") {
9547
- const tabs = field.tabs.map((tab) => ({
9548
- ...tab,
9549
- fields: dropPerNodeFields(tab.fields)
9550
- })).filter((tab) => tab.fields.length > 0);
9551
- if (tabs.length > 0) kept.push({
9552
- ...field,
9553
- tabs
9554
- });
9555
- continue;
9556
- }
9557
- if ("perNode" in field && field.perNode === true) continue;
9558
- kept.push(field);
9559
- }
9560
- return kept;
9561
- }
9562
9705
  /** The keys of the value-holding fields, recursing into layout containers. */
9563
9706
  function collectValueFieldKeys(fields) {
9564
9707
  const collected = [];
@@ -9591,21 +9734,6 @@ function collectFieldKeys(fields) {
9591
9734
  }
9592
9735
  return collected;
9593
9736
  }
9594
- function collectPerNodeFieldKeys(fields) {
9595
- const collected = [];
9596
- for (const field of fields) {
9597
- if (field.type === "group") {
9598
- collected.push(...collectPerNodeFieldKeys(field.fields));
9599
- continue;
9600
- }
9601
- if (field.type === "sub-tabs") {
9602
- for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
9603
- continue;
9604
- }
9605
- if ("perNode" in field && field.perNode === true) collected.push(field.key);
9606
- }
9607
- return collected;
9608
- }
9609
9737
  /**
9610
9738
  * Normalize an `ICamstackAddon.initialize()` return value into the
9611
9739
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
@@ -10641,7 +10769,6 @@ var CAP_NAMES = Object.freeze([
10641
10769
  "notifier",
10642
10770
  "numeric-sensor",
10643
10771
  "oauth-integration",
10644
- "oidc-connections",
10645
10772
  "osd",
10646
10773
  "osd-manager",
10647
10774
  "pet-feeder",
@@ -12348,13 +12475,25 @@ Object.freeze({
12348
12475
  "path": "temperature",
12349
12476
  "valueType": "number"
12350
12477
  }],
12351
- "timed-run": [{
12352
- "path": "activeUntil",
12353
- "valueType": "number"
12354
- }, {
12355
- "path": "requestedBy",
12356
- "valueType": "string"
12357
- }],
12478
+ "timed-run": [
12479
+ {
12480
+ "path": "activeUntil",
12481
+ "valueType": "number"
12482
+ },
12483
+ {
12484
+ "path": "requestedBy",
12485
+ "valueType": "string"
12486
+ },
12487
+ {
12488
+ "path": "quickRun.duration",
12489
+ "valueType": "number"
12490
+ },
12491
+ {
12492
+ "path": "quickRun.unit",
12493
+ "valueType": "enum",
12494
+ "enumValues": ["s", "min"]
12495
+ }
12496
+ ],
12358
12497
  "update": [
12359
12498
  {
12360
12499
  "path": "currentVersion",
@@ -12533,8 +12672,7 @@ Object.freeze({
12533
12672
  "device-provider": { "reloadDevice": 18e4 },
12534
12673
  "llm": {
12535
12674
  "generate": 6e5,
12536
- "generateVision": 6e5,
12537
- "testProfile": 6e5
12675
+ "generateVision": 6e5
12538
12676
  },
12539
12677
  "llm-runtime": {
12540
12678
  "complete": 6e5,
@@ -12579,7 +12717,7 @@ object({
12579
12717
  params: record(string(), union([string(), number()])).optional()
12580
12718
  });
12581
12719
  //#endregion
12582
- //#region ../types/dist/composition-BmBHuDTQ.mjs
12720
+ //#region ../types/dist/composition-Bx0JvKUU.mjs
12583
12721
  /**
12584
12722
  * The ffmpeg build every CamStack node downloads, per platform and arch.
12585
12723
  *
@@ -13741,6 +13879,387 @@ var NodeColorIdSchema = _enum([
13741
13879
  "node-h"
13742
13880
  ]);
13743
13881
  //#endregion
13882
+ //#region ../types/dist/convert-BAzH15HU.mjs
13883
+ /**
13884
+ * Frozen unit → spec table. `•` in the doc marks each dimension's canonical
13885
+ * unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
13886
+ * `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
13887
+ * decimals). K derives from `°C = K − 273.15`.
13888
+ */
13889
+ var UNIT_TABLE = {
13890
+ "°C": {
13891
+ dimension: "temperature",
13892
+ factor: 1,
13893
+ offset: 0
13894
+ },
13895
+ "°F": {
13896
+ dimension: "temperature",
13897
+ factor: 5 / 9,
13898
+ offset: -160 / 9
13899
+ },
13900
+ K: {
13901
+ dimension: "temperature",
13902
+ factor: 1,
13903
+ offset: -273.15
13904
+ },
13905
+ hPa: {
13906
+ dimension: "pressure",
13907
+ factor: 1,
13908
+ offset: 0
13909
+ },
13910
+ kPa: {
13911
+ dimension: "pressure",
13912
+ factor: 10,
13913
+ offset: 0
13914
+ },
13915
+ Pa: {
13916
+ dimension: "pressure",
13917
+ factor: .01,
13918
+ offset: 0
13919
+ },
13920
+ mbar: {
13921
+ dimension: "pressure",
13922
+ factor: 1,
13923
+ offset: 0
13924
+ },
13925
+ bar: {
13926
+ dimension: "pressure",
13927
+ factor: 1e3,
13928
+ offset: 0
13929
+ },
13930
+ inHg: {
13931
+ dimension: "pressure",
13932
+ factor: 33.8639,
13933
+ offset: 0
13934
+ },
13935
+ mmHg: {
13936
+ dimension: "pressure",
13937
+ factor: 1.33322,
13938
+ offset: 0
13939
+ },
13940
+ psi: {
13941
+ dimension: "pressure",
13942
+ factor: 68.9476,
13943
+ offset: 0
13944
+ },
13945
+ "m/s": {
13946
+ dimension: "speed",
13947
+ factor: 1,
13948
+ offset: 0
13949
+ },
13950
+ "km/h": {
13951
+ dimension: "speed",
13952
+ factor: 1 / 3.6,
13953
+ offset: 0
13954
+ },
13955
+ mph: {
13956
+ dimension: "speed",
13957
+ factor: .44704,
13958
+ offset: 0
13959
+ },
13960
+ kn: {
13961
+ dimension: "speed",
13962
+ factor: .514444,
13963
+ offset: 0
13964
+ },
13965
+ "mm/h": {
13966
+ dimension: "precipitation-rate",
13967
+ factor: 1,
13968
+ offset: 0
13969
+ },
13970
+ "in/h": {
13971
+ dimension: "precipitation-rate",
13972
+ factor: 25.4,
13973
+ offset: 0
13974
+ },
13975
+ m: {
13976
+ dimension: "length",
13977
+ factor: 1,
13978
+ offset: 0
13979
+ },
13980
+ mm: {
13981
+ dimension: "length",
13982
+ factor: .001,
13983
+ offset: 0
13984
+ },
13985
+ cm: {
13986
+ dimension: "length",
13987
+ factor: .01,
13988
+ offset: 0
13989
+ },
13990
+ km: {
13991
+ dimension: "length",
13992
+ factor: 1e3,
13993
+ offset: 0
13994
+ },
13995
+ in: {
13996
+ dimension: "length",
13997
+ factor: .0254,
13998
+ offset: 0
13999
+ },
14000
+ ft: {
14001
+ dimension: "length",
14002
+ factor: .3048,
14003
+ offset: 0
14004
+ },
14005
+ mi: {
14006
+ dimension: "length",
14007
+ factor: 1609.344,
14008
+ offset: 0
14009
+ },
14010
+ "m²": {
14011
+ dimension: "area",
14012
+ factor: 1,
14013
+ offset: 0
14014
+ },
14015
+ lx: {
14016
+ dimension: "illuminance",
14017
+ factor: 1,
14018
+ offset: 0
14019
+ },
14020
+ "W/m²": {
14021
+ dimension: "irradiance",
14022
+ factor: 1,
14023
+ offset: 0
14024
+ },
14025
+ W: {
14026
+ dimension: "power",
14027
+ factor: 1,
14028
+ offset: 0
14029
+ },
14030
+ kW: {
14031
+ dimension: "power",
14032
+ factor: 1e3,
14033
+ offset: 0
14034
+ },
14035
+ VA: {
14036
+ dimension: "apparent-power",
14037
+ factor: 1,
14038
+ offset: 0
14039
+ },
14040
+ Wh: {
14041
+ dimension: "energy",
14042
+ factor: 1,
14043
+ offset: 0
14044
+ },
14045
+ kWh: {
14046
+ dimension: "energy",
14047
+ factor: 1e3,
14048
+ offset: 0
14049
+ },
14050
+ MWh: {
14051
+ dimension: "energy",
14052
+ factor: 1e6,
14053
+ offset: 0
14054
+ },
14055
+ V: {
14056
+ dimension: "voltage",
14057
+ factor: 1,
14058
+ offset: 0
14059
+ },
14060
+ mV: {
14061
+ dimension: "voltage",
14062
+ factor: .001,
14063
+ offset: 0
14064
+ },
14065
+ A: {
14066
+ dimension: "current",
14067
+ factor: 1,
14068
+ offset: 0
14069
+ },
14070
+ mA: {
14071
+ dimension: "current",
14072
+ factor: .001,
14073
+ offset: 0
14074
+ },
14075
+ ppm: {
14076
+ dimension: "concentration-volume",
14077
+ factor: 1,
14078
+ offset: 0
14079
+ },
14080
+ ppb: {
14081
+ dimension: "concentration-volume",
14082
+ factor: .001,
14083
+ offset: 0
14084
+ },
14085
+ "µg/m³": {
14086
+ dimension: "concentration-mass",
14087
+ factor: 1,
14088
+ offset: 0
14089
+ },
14090
+ "mg/m³": {
14091
+ dimension: "concentration-mass",
14092
+ factor: 1e3,
14093
+ offset: 0
14094
+ },
14095
+ kg: {
14096
+ dimension: "mass",
14097
+ factor: 1,
14098
+ offset: 0
14099
+ },
14100
+ g: {
14101
+ dimension: "mass",
14102
+ factor: .001,
14103
+ offset: 0
14104
+ },
14105
+ lb: {
14106
+ dimension: "mass",
14107
+ factor: .453592,
14108
+ offset: 0
14109
+ },
14110
+ oz: {
14111
+ dimension: "mass",
14112
+ factor: .0283495,
14113
+ offset: 0
14114
+ },
14115
+ "%": {
14116
+ dimension: "percentage",
14117
+ factor: 1,
14118
+ offset: 0
14119
+ },
14120
+ L: {
14121
+ dimension: "volume",
14122
+ factor: 1,
14123
+ offset: 0
14124
+ },
14125
+ mL: {
14126
+ dimension: "volume",
14127
+ factor: .001,
14128
+ offset: 0
14129
+ },
14130
+ gal: {
14131
+ dimension: "volume",
14132
+ factor: 3.785411784,
14133
+ offset: 0
14134
+ },
14135
+ s: {
14136
+ dimension: "duration",
14137
+ factor: 1,
14138
+ offset: 0
14139
+ },
14140
+ ms: {
14141
+ dimension: "duration",
14142
+ factor: .001,
14143
+ offset: 0
14144
+ },
14145
+ min: {
14146
+ dimension: "duration",
14147
+ factor: 60,
14148
+ offset: 0
14149
+ },
14150
+ h: {
14151
+ dimension: "duration",
14152
+ factor: 3600,
14153
+ offset: 0
14154
+ },
14155
+ d: {
14156
+ dimension: "duration",
14157
+ factor: 86400,
14158
+ offset: 0
14159
+ },
14160
+ B: {
14161
+ dimension: "information",
14162
+ factor: 1,
14163
+ offset: 0
14164
+ },
14165
+ KiB: {
14166
+ dimension: "information",
14167
+ factor: 1024,
14168
+ offset: 0
14169
+ },
14170
+ MiB: {
14171
+ dimension: "information",
14172
+ factor: 1024 ** 2,
14173
+ offset: 0
14174
+ },
14175
+ GiB: {
14176
+ dimension: "information",
14177
+ factor: 1024 ** 3,
14178
+ offset: 0
14179
+ },
14180
+ TiB: {
14181
+ dimension: "information",
14182
+ factor: 1024 ** 4,
14183
+ offset: 0
14184
+ },
14185
+ kB: {
14186
+ dimension: "information",
14187
+ factor: 1e3,
14188
+ offset: 0
14189
+ },
14190
+ MB: {
14191
+ dimension: "information",
14192
+ factor: 1e6,
14193
+ offset: 0
14194
+ },
14195
+ GB: {
14196
+ dimension: "information",
14197
+ factor: 1e9,
14198
+ offset: 0
14199
+ },
14200
+ "°": {
14201
+ dimension: "angle",
14202
+ factor: 1,
14203
+ offset: 0
14204
+ },
14205
+ dBFS: {
14206
+ dimension: "sound-level",
14207
+ factor: 1,
14208
+ offset: 0
14209
+ },
14210
+ dBm: {
14211
+ dimension: "signal-level",
14212
+ factor: 1,
14213
+ offset: 0
14214
+ },
14215
+ mired: {
14216
+ dimension: "colour-temperature",
14217
+ factor: 1,
14218
+ offset: 0
14219
+ },
14220
+ kbps: {
14221
+ dimension: "bitrate",
14222
+ factor: 1,
14223
+ offset: 0
14224
+ },
14225
+ Mbps: {
14226
+ dimension: "bitrate",
14227
+ factor: 1e3,
14228
+ offset: 0
14229
+ },
14230
+ fps: {
14231
+ dimension: "rate",
14232
+ factor: 1,
14233
+ offset: 0
14234
+ }
14235
+ };
14236
+ /** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
14237
+ function specFor(unit) {
14238
+ return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
14239
+ }
14240
+ /** Value in `spec`'s unit → its dimension's canonical unit. */
14241
+ function toCanonical(value, spec) {
14242
+ return value * spec.factor + spec.offset;
14243
+ }
14244
+ /** Canonical-unit value → the unit described by `spec`. */
14245
+ function fromCanonical(canonical, spec) {
14246
+ return (canonical - spec.offset) / spec.factor;
14247
+ }
14248
+ /**
14249
+ * Graceful variant for the render path: returns the converted value, or
14250
+ * `undefined` when the conversion is refused (unknown unit / cross-dimension).
14251
+ * Never throws — a render caller falls back to the raw value + source unit.
14252
+ */
14253
+ function tryConvertUnit(value, from, to) {
14254
+ if (from === to) return value;
14255
+ const fromSpec = specFor(from);
14256
+ if (!fromSpec) return void 0;
14257
+ const toSpec = specFor(to);
14258
+ if (!toSpec) return void 0;
14259
+ if (fromSpec.dimension !== toSpec.dimension) return void 0;
14260
+ return fromCanonical(toCanonical(value, fromSpec), toSpec);
14261
+ }
14262
+ //#endregion
13744
14263
  //#region ../types/dist/index.mjs
13745
14264
  var SMTP_INBOUND_DEFAULT_PORT = 2525;
13746
14265
  var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
@@ -14054,17 +14573,18 @@ function buildCapturingReply(envelope) {
14054
14573
  * message to what the kind supports — callers never special-case a service.
14055
14574
  *
14056
14575
  * DESIGN DECISIONS (locked):
14057
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14058
- * `setTargetEnabled`), each provider persisting via the `settings-store`
14059
- * cap. Rationale: the admin UI needs one uniform surface across the
14060
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14061
- * alternative would fork the UI per addon and cannot host the
14062
- * discovery→adopt flow.
14063
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14064
- * the generated cap-mount auto-`concatCollection`-fans them across every
14065
- * registered provider (notifiers addon + HA addon) so one catalog is
14066
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14067
- * `addonId` the generated collection router extracts from the call input.
14576
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14577
+ * providers serve their targets as `integration-instances` records, one
14578
+ * record kind per target kind, and the admin lists, adds, edits, switches
14579
+ * and deletes them through that cap. This cap keeps what an instance cannot
14580
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14581
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14582
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14583
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14584
+ * cap-mount auto-`concatCollection`-fans them across every registered
14585
+ * provider so one catalog is routable. `send` / `testTarget` /
14586
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14587
+ * collection router extracts from the call input.
14068
14588
  * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14069
14589
  * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14070
14590
  * `storage` / `storage-provider` / `recording` caps over the same path. No
@@ -14309,7 +14829,7 @@ var TargetKindCapsSchema = object({
14309
14829
  * the union is large and not meant for runtime validation here; the exported
14310
14830
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14311
14831
  */
14312
- var ConfigSchemaPassthrough$4 = unknown();
14832
+ var ConfigSchemaPassthrough$3 = unknown();
14313
14833
  var TargetKindSchema = object({
14314
14834
  kind: string(),
14315
14835
  label: string(),
@@ -14346,7 +14866,7 @@ var TargetKindSchema = object({
14346
14866
  * its raster path, which is the safe default for an unknown image.
14347
14867
  */
14348
14868
  iconMediaType: string().optional(),
14349
- configSchema: ConfigSchemaPassthrough$4,
14869
+ configSchema: ConfigSchemaPassthrough$3,
14350
14870
  /**
14351
14871
  * The config keys that decide WHERE this kind's secrets are sent (server,
14352
14872
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -14368,9 +14888,11 @@ var TargetKindSchema = object({
14368
14888
  caps: TargetKindCapsSchema
14369
14889
  });
14370
14890
  /**
14371
- * A persisted target. `config` holds secrets; providers REDACT secret fields
14372
- * (return a presence marker only) when serving `listTargets` — never
14373
- * round-trip a stored secret to the UI.
14891
+ * A target as a provider's own code sees it (the notification-center bridge, the
14892
+ * send path): the flat record body split into the name, the switch and the
14893
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14894
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14895
+ * secret to the UI.
14374
14896
  */
14375
14897
  var TargetSchema = object({
14376
14898
  id: string(),
@@ -14413,13 +14935,13 @@ var ProbeTargetConfigResultSchema = object({
14413
14935
  stateInstance: string().optional(),
14414
14936
  error: string().optional()
14415
14937
  });
14416
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14938
+ method(object({}), array(TargetKindSchema)), method(object({
14417
14939
  kind: string(),
14418
14940
  config: record(string(), unknown()).optional(),
14419
14941
  /**
14420
14942
  * When editing / duplicating, the blank password field never round-trips
14421
14943
  * the stored token. Pass the source target id so the provider can restore
14422
- * secrets server-side before dialling (same merge as upsert).
14944
+ * secrets server-side before dialling.
14423
14945
  */
14424
14946
  targetId: string().optional()
14425
14947
  }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
@@ -14442,27 +14964,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
14442
14964
  }), TestResultSchema, {
14443
14965
  kind: "mutation",
14444
14966
  auth: "admin"
14445
- }), method(object({
14446
- target: TargetSchema,
14447
- /**
14448
- * Duplicate flow: create a NEW target id while copying secrets from an
14449
- * existing row. The UI never holds the stored token; blank / redacted
14450
- * password fields are restored from this source (D634 still applies if
14451
- * destinations diverge without a re-typed secret).
14452
- */
14453
- cloneSecretsFrom: string().optional()
14454
- }), TargetSchema, {
14455
- kind: "mutation",
14456
- auth: "admin"
14457
- }), method(object({ targetId: string() }), _void(), {
14458
- kind: "mutation",
14459
- auth: "admin"
14460
- }), method(object({
14461
- targetId: string(),
14462
- enabled: boolean()
14463
- }), _void(), {
14464
- kind: "mutation",
14465
- auth: "admin"
14466
14967
  });
14467
14968
  looseObject({
14468
14969
  name: string().min(1),
@@ -22737,7 +23238,6 @@ var SYSTEM_CAP_VOCABULARY = {
22737
23238
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
22738
23239
  "notification-rules": system("notification rules — authored on their own page"),
22739
23240
  "oauth-integration": system(IDENTITY),
22740
- "oidc-connections": system(IDENTITY),
22741
23241
  "osd-manager": system(PIPELINE),
22742
23242
  "pipeline-executor": system(PIPELINE),
22743
23243
  "pipeline-orchestrator": system(PIPELINE),
@@ -42758,6 +43258,7 @@ var ExpressionBindingSourceSchema = union([
42758
43258
  object({
42759
43259
  kind: literal("global"),
42760
43260
  sourceStableId: string(),
43261
+ addonId: string().optional(),
42761
43262
  cap: string(),
42762
43263
  fieldPath: string()
42763
43264
  })
@@ -42824,385 +43325,6 @@ var SourceInfoSchema = object({
42824
43325
  raw: record(string(), unknown()).optional()
42825
43326
  });
42826
43327
  /**
42827
- * Frozen unit → spec table. `•` in the doc marks each dimension's canonical
42828
- * unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
42829
- * `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
42830
- * decimals). K derives from `°C = K − 273.15`.
42831
- */
42832
- var UNIT_TABLE = {
42833
- "°C": {
42834
- dimension: "temperature",
42835
- factor: 1,
42836
- offset: 0
42837
- },
42838
- "°F": {
42839
- dimension: "temperature",
42840
- factor: 5 / 9,
42841
- offset: -160 / 9
42842
- },
42843
- K: {
42844
- dimension: "temperature",
42845
- factor: 1,
42846
- offset: -273.15
42847
- },
42848
- hPa: {
42849
- dimension: "pressure",
42850
- factor: 1,
42851
- offset: 0
42852
- },
42853
- kPa: {
42854
- dimension: "pressure",
42855
- factor: 10,
42856
- offset: 0
42857
- },
42858
- Pa: {
42859
- dimension: "pressure",
42860
- factor: .01,
42861
- offset: 0
42862
- },
42863
- mbar: {
42864
- dimension: "pressure",
42865
- factor: 1,
42866
- offset: 0
42867
- },
42868
- bar: {
42869
- dimension: "pressure",
42870
- factor: 1e3,
42871
- offset: 0
42872
- },
42873
- inHg: {
42874
- dimension: "pressure",
42875
- factor: 33.8639,
42876
- offset: 0
42877
- },
42878
- mmHg: {
42879
- dimension: "pressure",
42880
- factor: 1.33322,
42881
- offset: 0
42882
- },
42883
- psi: {
42884
- dimension: "pressure",
42885
- factor: 68.9476,
42886
- offset: 0
42887
- },
42888
- "m/s": {
42889
- dimension: "speed",
42890
- factor: 1,
42891
- offset: 0
42892
- },
42893
- "km/h": {
42894
- dimension: "speed",
42895
- factor: 1 / 3.6,
42896
- offset: 0
42897
- },
42898
- mph: {
42899
- dimension: "speed",
42900
- factor: .44704,
42901
- offset: 0
42902
- },
42903
- kn: {
42904
- dimension: "speed",
42905
- factor: .514444,
42906
- offset: 0
42907
- },
42908
- "mm/h": {
42909
- dimension: "precipitation-rate",
42910
- factor: 1,
42911
- offset: 0
42912
- },
42913
- "in/h": {
42914
- dimension: "precipitation-rate",
42915
- factor: 25.4,
42916
- offset: 0
42917
- },
42918
- m: {
42919
- dimension: "length",
42920
- factor: 1,
42921
- offset: 0
42922
- },
42923
- mm: {
42924
- dimension: "length",
42925
- factor: .001,
42926
- offset: 0
42927
- },
42928
- cm: {
42929
- dimension: "length",
42930
- factor: .01,
42931
- offset: 0
42932
- },
42933
- km: {
42934
- dimension: "length",
42935
- factor: 1e3,
42936
- offset: 0
42937
- },
42938
- in: {
42939
- dimension: "length",
42940
- factor: .0254,
42941
- offset: 0
42942
- },
42943
- ft: {
42944
- dimension: "length",
42945
- factor: .3048,
42946
- offset: 0
42947
- },
42948
- mi: {
42949
- dimension: "length",
42950
- factor: 1609.344,
42951
- offset: 0
42952
- },
42953
- "m²": {
42954
- dimension: "area",
42955
- factor: 1,
42956
- offset: 0
42957
- },
42958
- lx: {
42959
- dimension: "illuminance",
42960
- factor: 1,
42961
- offset: 0
42962
- },
42963
- "W/m²": {
42964
- dimension: "irradiance",
42965
- factor: 1,
42966
- offset: 0
42967
- },
42968
- W: {
42969
- dimension: "power",
42970
- factor: 1,
42971
- offset: 0
42972
- },
42973
- kW: {
42974
- dimension: "power",
42975
- factor: 1e3,
42976
- offset: 0
42977
- },
42978
- VA: {
42979
- dimension: "apparent-power",
42980
- factor: 1,
42981
- offset: 0
42982
- },
42983
- Wh: {
42984
- dimension: "energy",
42985
- factor: 1,
42986
- offset: 0
42987
- },
42988
- kWh: {
42989
- dimension: "energy",
42990
- factor: 1e3,
42991
- offset: 0
42992
- },
42993
- MWh: {
42994
- dimension: "energy",
42995
- factor: 1e6,
42996
- offset: 0
42997
- },
42998
- V: {
42999
- dimension: "voltage",
43000
- factor: 1,
43001
- offset: 0
43002
- },
43003
- mV: {
43004
- dimension: "voltage",
43005
- factor: .001,
43006
- offset: 0
43007
- },
43008
- A: {
43009
- dimension: "current",
43010
- factor: 1,
43011
- offset: 0
43012
- },
43013
- mA: {
43014
- dimension: "current",
43015
- factor: .001,
43016
- offset: 0
43017
- },
43018
- ppm: {
43019
- dimension: "concentration-volume",
43020
- factor: 1,
43021
- offset: 0
43022
- },
43023
- ppb: {
43024
- dimension: "concentration-volume",
43025
- factor: .001,
43026
- offset: 0
43027
- },
43028
- "µg/m³": {
43029
- dimension: "concentration-mass",
43030
- factor: 1,
43031
- offset: 0
43032
- },
43033
- "mg/m³": {
43034
- dimension: "concentration-mass",
43035
- factor: 1e3,
43036
- offset: 0
43037
- },
43038
- kg: {
43039
- dimension: "mass",
43040
- factor: 1,
43041
- offset: 0
43042
- },
43043
- g: {
43044
- dimension: "mass",
43045
- factor: .001,
43046
- offset: 0
43047
- },
43048
- lb: {
43049
- dimension: "mass",
43050
- factor: .453592,
43051
- offset: 0
43052
- },
43053
- oz: {
43054
- dimension: "mass",
43055
- factor: .0283495,
43056
- offset: 0
43057
- },
43058
- "%": {
43059
- dimension: "percentage",
43060
- factor: 1,
43061
- offset: 0
43062
- },
43063
- L: {
43064
- dimension: "volume",
43065
- factor: 1,
43066
- offset: 0
43067
- },
43068
- mL: {
43069
- dimension: "volume",
43070
- factor: .001,
43071
- offset: 0
43072
- },
43073
- gal: {
43074
- dimension: "volume",
43075
- factor: 3.785411784,
43076
- offset: 0
43077
- },
43078
- s: {
43079
- dimension: "duration",
43080
- factor: 1,
43081
- offset: 0
43082
- },
43083
- ms: {
43084
- dimension: "duration",
43085
- factor: .001,
43086
- offset: 0
43087
- },
43088
- min: {
43089
- dimension: "duration",
43090
- factor: 60,
43091
- offset: 0
43092
- },
43093
- h: {
43094
- dimension: "duration",
43095
- factor: 3600,
43096
- offset: 0
43097
- },
43098
- d: {
43099
- dimension: "duration",
43100
- factor: 86400,
43101
- offset: 0
43102
- },
43103
- B: {
43104
- dimension: "information",
43105
- factor: 1,
43106
- offset: 0
43107
- },
43108
- KiB: {
43109
- dimension: "information",
43110
- factor: 1024,
43111
- offset: 0
43112
- },
43113
- MiB: {
43114
- dimension: "information",
43115
- factor: 1024 ** 2,
43116
- offset: 0
43117
- },
43118
- GiB: {
43119
- dimension: "information",
43120
- factor: 1024 ** 3,
43121
- offset: 0
43122
- },
43123
- TiB: {
43124
- dimension: "information",
43125
- factor: 1024 ** 4,
43126
- offset: 0
43127
- },
43128
- kB: {
43129
- dimension: "information",
43130
- factor: 1e3,
43131
- offset: 0
43132
- },
43133
- MB: {
43134
- dimension: "information",
43135
- factor: 1e6,
43136
- offset: 0
43137
- },
43138
- GB: {
43139
- dimension: "information",
43140
- factor: 1e9,
43141
- offset: 0
43142
- },
43143
- "°": {
43144
- dimension: "angle",
43145
- factor: 1,
43146
- offset: 0
43147
- },
43148
- dBFS: {
43149
- dimension: "sound-level",
43150
- factor: 1,
43151
- offset: 0
43152
- },
43153
- dBm: {
43154
- dimension: "signal-level",
43155
- factor: 1,
43156
- offset: 0
43157
- },
43158
- mired: {
43159
- dimension: "colour-temperature",
43160
- factor: 1,
43161
- offset: 0
43162
- },
43163
- kbps: {
43164
- dimension: "bitrate",
43165
- factor: 1,
43166
- offset: 0
43167
- },
43168
- Mbps: {
43169
- dimension: "bitrate",
43170
- factor: 1e3,
43171
- offset: 0
43172
- },
43173
- fps: {
43174
- dimension: "rate",
43175
- factor: 1,
43176
- offset: 0
43177
- }
43178
- };
43179
- /** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
43180
- function specFor(unit) {
43181
- return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
43182
- }
43183
- /** Value in `spec`'s unit → its dimension's canonical unit. */
43184
- function toCanonical(value, spec) {
43185
- return value * spec.factor + spec.offset;
43186
- }
43187
- /** Canonical-unit value → the unit described by `spec`. */
43188
- function fromCanonical(canonical, spec) {
43189
- return (canonical - spec.offset) / spec.factor;
43190
- }
43191
- /**
43192
- * Graceful variant for the render path: returns the converted value, or
43193
- * `undefined` when the conversion is refused (unknown unit / cross-dimension).
43194
- * Never throws — a render caller falls back to the raw value + source unit.
43195
- */
43196
- function tryConvertUnit(value, from, to) {
43197
- if (from === to) return value;
43198
- const fromSpec = specFor(from);
43199
- if (!fromSpec) return void 0;
43200
- const toSpec = specFor(to);
43201
- if (!toSpec) return void 0;
43202
- if (fromSpec.dimension !== toSpec.dimension) return void 0;
43203
- return fromCanonical(toCanonical(value, fromSpec), toSpec);
43204
- }
43205
- /**
43206
43328
  * A number a person types for a physical quantity — the input side of the
43207
43329
  * value + unit contract (D972).
43208
43330
  *
@@ -44981,15 +45103,28 @@ var SettingsSchemaWithValuesSchema = object({
44981
45103
  });
44982
45104
  /** Patch object — keys are field names, values are the new field values. */
44983
45105
  var SettingsPatchSchema = record(string(), unknown());
45106
+ /** The scope of a scoped-settings call (D986): where the capability declared the values. */
45107
+ var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
45108
+ /** One scoped schema an addon serves: its capability, scope and section ids. */
45109
+ var ScopedSettingsDeclarationSchema = object({
45110
+ cap: string(),
45111
+ scope: ScopedSettingsScopeSchema,
45112
+ sectionIds: array(string())
45113
+ });
44984
45114
  /** Standard success response for update operations. */
44985
45115
  var SettingsUpdateResultSchema = object({ success: literal(true) });
44986
45116
  method(object({
44987
45117
  addonId: string(),
44988
- nodeId: string().optional(),
44989
- overlay: record(string(), unknown()).optional(),
44990
- cap: string().optional()
45118
+ cap: string(),
45119
+ scope: ScopedSettingsScopeSchema,
45120
+ nodeId: string().optional()
44991
45121
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
44992
45122
  addonId: string(),
45123
+ nodeId: string().optional()
45124
+ }), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
45125
+ addonId: string(),
45126
+ cap: string(),
45127
+ scope: ScopedSettingsScopeSchema,
44993
45128
  nodeId: string().optional(),
44994
45129
  patch: SettingsPatchSchema
44995
45130
  }), SettingsUpdateResultSchema, {
@@ -44997,8 +45132,10 @@ method(object({
44997
45132
  auth: "admin"
44998
45133
  }), method(object({
44999
45134
  addonId: string(),
45135
+ cap: string(),
45136
+ scope: ScopedSettingsScopeSchema,
45000
45137
  nodeId: string().optional()
45001
- }), SettingsSchemaWithValuesSchema.nullable()), method(object({
45138
+ }), record(string(), unknown()).nullable()), method(object({
45002
45139
  addonId: string(),
45003
45140
  nodeId: string().optional(),
45004
45141
  instance: IntegrationInstanceRefSchema
@@ -46338,7 +46475,7 @@ var BackupDestinationInfoSchema = object({
46338
46475
  id: string(),
46339
46476
  /**
46340
46477
  * Manifest id of the owning addon. The Settings button on the
46341
- * destination card opens that addon's `globalSettingsSchema` panel.
46478
+ * destination card opens that addon's scoped settings panel.
46342
46479
  */
46343
46480
  addonId: string(),
46344
46481
  /** Operator-toggled enable flag from the destination-policy table. */
@@ -50841,6 +50978,7 @@ var deviceExportCapability = {
50841
50978
  })
50842
50979
  }
50843
50980
  };
50981
+ var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
50844
50982
  /**
50845
50983
  * A SITE ZONE — a named part of the property that several locations belong to.
50846
50984
  *
@@ -51234,6 +51372,12 @@ var DeviceInfoSchema = object({
51234
51372
  addonId: string(),
51235
51373
  type: _enum(DeviceType),
51236
51374
  name: string(),
51375
+ /** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
51376
+ * entity_id style. Generated once from the name at first registration, unique
51377
+ * cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
51378
+ * Optional: a record produced by an older build omits it until the boot
51379
+ * backfill has run. */
51380
+ alias: DeviceAliasSchema.optional(),
51237
51381
  /** Operator-organisational location label. `null` when unset. */
51238
51382
  location: string().nullable(),
51239
51383
  /** Soft-disabled flag. */
@@ -51553,6 +51697,25 @@ method(object({
51553
51697
  }), _void(), {
51554
51698
  kind: "mutation",
51555
51699
  auth: "admin"
51700
+ }), method(object({
51701
+ deviceId: number(),
51702
+ alias: string()
51703
+ }), discriminatedUnion("ok", [object({
51704
+ ok: literal(true),
51705
+ alias: DeviceAliasSchema
51706
+ }), object({
51707
+ ok: literal(false),
51708
+ reason: _enum([
51709
+ "empty",
51710
+ "too-long",
51711
+ "grammar",
51712
+ "reserved",
51713
+ "taken"
51714
+ ]),
51715
+ takenBy: number().optional()
51716
+ })]), {
51717
+ kind: "mutation",
51718
+ auth: "admin"
51556
51719
  }), method(object({
51557
51720
  deviceId: number(),
51558
51721
  location: string().nullable()
@@ -54578,7 +54741,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54578
54741
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
54579
54742
  * clears it.
54580
54743
  */
54581
- var ConfigSchemaPassthrough$3 = custom();
54744
+ var ConfigSchemaPassthrough$2 = custom();
54582
54745
  var IntegrationInstanceIdSchema = string().min(1);
54583
54746
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54584
54747
  /**
@@ -54624,7 +54787,16 @@ var IntegrationInstanceKindSchema = object({
54624
54787
  /** Relative hub path to start an interactive account link of an instance of this kind. */
54625
54788
  connectPath: string().min(1).optional(),
54626
54789
  /** Relative hub path to disconnect that account. */
54627
- disconnectPath: string().min(1).optional()
54790
+ disconnectPath: string().min(1).optional(),
54791
+ /**
54792
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
54793
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
54794
+ * `connection` widgets write connection values, `model` widgets own the model choice.
54795
+ */
54796
+ widgets: array(object({
54797
+ id: string().min(1),
54798
+ placement: _enum(["connection", "model"])
54799
+ })).optional()
54628
54800
  });
54629
54801
  /**
54630
54802
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -54729,7 +54901,7 @@ var integrationInstancesCapability = {
54729
54901
  id: IntegrationInstanceIdSchema.nullable(),
54730
54902
  /** The kind of the create form (`id: null`) of a provider with several. */
54731
54903
  kind: string().min(1).optional()
54732
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
54904
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
54733
54905
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
54734
54906
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
54735
54907
  /**
@@ -55680,12 +55852,12 @@ var LlmModelInfoSchema = object({
55680
55852
  });
55681
55853
  /**
55682
55854
  * The provider-specific part of a profile, validated by the provider that owns
55683
- * the kind (`upsertProfile` refuses what it does not accept). A field its
55855
+ * the kind (saving an instance refuses what it does not accept). A field its
55684
55856
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
55685
55857
  * keychain, never in the row, and reads back as the redaction marker.
55686
55858
  */
55687
55859
  var LlmProviderConfigSchema = record(string(), unknown());
55688
- var LlmProfileSchema = object({
55860
+ object({
55689
55861
  id: string(),
55690
55862
  name: string(),
55691
55863
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -55779,8 +55951,8 @@ var LlmProviderWidgetSchema = object({
55779
55951
  /** ConfigUISchema tree passed through untyped on the wire (the
55780
55952
  * notification-output `ConfigSchemaPassthrough` precedent at
55781
55953
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
55782
- var ConfigSchemaPassthrough$2 = unknown();
55783
- var LlmProfileKindDescriptorSchema = object({
55954
+ var ConfigSchemaPassthrough$1 = unknown();
55955
+ object({
55784
55956
  kind: LlmProfileKindSchema,
55785
55957
  label: string(),
55786
55958
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -55788,9 +55960,9 @@ var LlmProfileKindDescriptorSchema = object({
55788
55960
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
55789
55961
  addonId: string(),
55790
55962
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
55791
- connectionSchema: ConfigSchemaPassthrough$2,
55963
+ connectionSchema: ConfigSchemaPassthrough$1,
55792
55964
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
55793
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
55965
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
55794
55966
  /** The kind's defaults; a model from `listModels` may override any of them. */
55795
55967
  features: LlmModelFeaturesSchema,
55796
55968
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -55919,20 +56091,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
55919
56091
  }), method(object({
55920
56092
  addonId: string().optional(),
55921
56093
  requestId: string()
55922
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
55923
- kind: "mutation",
55924
- auth: "admin"
55925
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
55926
- kind: "mutation",
55927
- auth: "admin"
55928
- }), method(ProfileRefInputSchema, _void(), {
55929
- kind: "mutation",
55930
- auth: "admin"
55931
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
55932
- kind: "mutation",
55933
- auth: "admin",
55934
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
55935
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56094
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
55936
56095
  kind: "mutation",
55937
56096
  auth: "admin"
55938
56097
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -56927,20 +57086,7 @@ method(_void(), MeshStatusSchema), method(object({
56927
57086
  /** Optional hostname override the host should advertise once joined. */
56928
57087
  hostname: string().optional() }), object({
56929
57088
  /** Authentication URL the operator should open in a browser. */
56930
- 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({
56931
- /** Optional auth key — when provided, probes the key validity
56932
- * against the provider's API. Omit when already joined to
56933
- * just ping the daemon. */
56934
- authKey: string().optional() }), object({
56935
- ok: boolean(),
56936
- /** Provider-side identifier resolved by the probe (tailnet
56937
- * name for Tailscale, network id for ZeroTier, etc.). */
56938
- tenant: string().optional(),
56939
- /** Daemon binary version, when reachable. */
56940
- daemonVersion: string().optional(),
56941
- /** Human-readable error when `ok: false`. */
56942
- error: string().optional()
56943
- }), { kind: "mutation" });
57089
+ 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() }));
56944
57090
  object({
56945
57091
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
56946
57092
  lastFetchedAt: number()
@@ -64301,6 +64447,11 @@ var NcScheduleSchema = object({
64301
64447
  * as a STATE SUMMARY at the end of each window of `schedule`.
64302
64448
  */
64303
64449
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
64450
+ _enum([
64451
+ "activation",
64452
+ "deactivation",
64453
+ "schedule"
64454
+ ]);
64304
64455
  /**
64305
64456
  * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
64306
64457
  * every section; `section` = one notification per section with something to
@@ -64317,11 +64468,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
64317
64468
  * midnight crossing); the send time is each window's END. Refused on the
64318
64469
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
64319
64470
  */
64320
- var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
64321
- mode: literal("summary"),
64322
- schedule: NcScheduleSchema,
64323
- split: NcStateSummarySplitSchema.optional()
64324
- })]);
64471
+ var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
64472
+ object({ mode: literal("instant") }),
64473
+ object({
64474
+ mode: literal("summary"),
64475
+ schedule: NcScheduleSchema,
64476
+ split: NcStateSummarySplitSchema.optional()
64477
+ }),
64478
+ object({
64479
+ mode: literal("modes"),
64480
+ /** The bad edge, and every kind that has a single edge. */
64481
+ onActivation: boolean(),
64482
+ /** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
64483
+ onDeactivation: boolean(),
64484
+ /** A state summary at the end of each window; absent = no summary. */
64485
+ onSchedule: object({
64486
+ schedule: NcScheduleSchema,
64487
+ grouping: NcStateSummarySplitSchema
64488
+ }).optional()
64489
+ })
64490
+ ]);
64325
64491
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
64326
64492
  var NcPlateMatcherSchema = object({
64327
64493
  /**
@@ -66614,61 +66780,6 @@ var oauthIntegrationCapability = {
66614
66780
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
66615
66781
  };
66616
66782
  /**
66617
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
66618
- *
66619
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
66620
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
66621
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
66622
- * immutable after create.
66623
- */
66624
- var ConfigSchemaPassthrough$1 = unknown();
66625
- var OidcConnectionSchema = object({
66626
- id: string().min(1),
66627
- displayName: string(),
66628
- icon: string(),
66629
- issuerUrl: string(),
66630
- clientId: string(),
66631
- /** Client id + secret present — never the secret value. */
66632
- configured: boolean(),
66633
- /**
66634
- * Values for the connection form schema. `clientSecret` is a keychain
66635
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
66636
- */
66637
- formValues: record(string(), unknown()).optional()
66638
- });
66639
- /**
66640
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
66641
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
66642
- */
66643
- var OidcConnectionUpdateInputSchema = object({
66644
- id: string().min(1),
66645
- displayName: string().min(1),
66646
- icon: string().optional(),
66647
- issuerUrl: string().optional(),
66648
- clientId: string().optional(),
66649
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
66650
- redirectUri: string().optional(),
66651
- scopes: string().optional(),
66652
- usernameClaim: _enum([
66653
- "preferred_username",
66654
- "email",
66655
- "sub"
66656
- ]).optional()
66657
- });
66658
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
66659
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
66660
- displayName: string().min(1)
66661
- }), object({ id: string() }), {
66662
- kind: "mutation",
66663
- auth: "admin"
66664
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
66665
- kind: "mutation",
66666
- auth: "admin"
66667
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
66668
- kind: "mutation",
66669
- auth: "admin"
66670
- });
66671
- /**
66672
66783
  * Generic on-screen-display (video overlay) cap. Each camera exposes
66673
66784
  * a firmware-defined list of overlays (channel name, timestamp,
66674
66785
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -72841,21 +72952,6 @@ method(object({
72841
72952
  */
72842
72953
  ttlSec: union([number().int().positive(), literal("never")]).optional()
72843
72954
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
72844
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
72845
- providerId: string().min(1),
72846
- displayName: string().min(1),
72847
- configSchema: unknown(),
72848
- nodeLocal: boolean(),
72849
- shouldSaveDiskSpace: literal(true),
72850
- minFreePercent: number().min(0).max(100)
72851
- }), object({
72852
- providerId: string().min(1),
72853
- displayName: string().min(1),
72854
- configSchema: unknown(),
72855
- nodeLocal: boolean(),
72856
- shouldSaveDiskSpace: literal(false),
72857
- minFreePercent: literal(null)
72858
- })]);
72859
72955
  method(object({
72860
72956
  location: StorageLocationRefSchema,
72861
72957
  relativePath: string()
@@ -72917,42 +73013,7 @@ method(object({
72917
73013
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
72918
73014
  kind: "mutation",
72919
73015
  auth: "admin"
72920
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
72921
- createdAt: true,
72922
- updatedAt: true
72923
- }), StorageLocationSchema, {
72924
- kind: "mutation",
72925
- auth: "admin"
72926
- }), method(object({
72927
- id: string(),
72928
- force: boolean().optional()
72929
- }), _void(), {
72930
- kind: "mutation",
72931
- auth: "admin"
72932
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
72933
- ok: boolean(),
72934
- error: string().optional()
72935
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
72936
- providerId: string(),
72937
- /**
72938
- * The location this config is an UNSAVED edit of, when there is one.
72939
- *
72940
- * `listLocations` replaces every declared secret with the redaction
72941
- * sentinel, so the edit modal's form state holds the sentinel for any
72942
- * credential the operator did not retype — and posting that here
72943
- * without a way to resolve it makes the provider try to authenticate
72944
- * as `__camstack_redacted__` and report the operator's own working
72945
- * password as wrong. Given this id, the orchestrator restores each
72946
- * sentinel from the stored config (same rule as `upsertLocation`)
72947
- * before dispatching. Omitted by the "Add location" wizard, where
72948
- * every value was typed just now and nothing is stored yet.
72949
- */
72950
- locationId: string().optional(),
72951
- config: record(string(), unknown())
72952
- }), object({
72953
- ok: boolean(),
72954
- error: string().optional()
72955
- }), { auth: "admin" });
73016
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
72956
73017
  /** One table of the settings database. */
72957
73018
  var StorageTableSchema = object({
72958
73019
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -74190,7 +74251,7 @@ var TerminalInstanceInfoSchema = object({
74190
74251
  /**
74191
74252
  * False while the node the instance is bound to is not in the cluster
74192
74253
  * topology (forgotten, renamed, re-paired). The instance is kept; the
74193
- * operator re-points it with `updateInstance({ targetNodeId })`.
74254
+ * operator re-points it on the Terminal page.
74194
74255
  */
74195
74256
  nodeInCluster: boolean(),
74196
74257
  profileId: string(),
@@ -74228,41 +74289,7 @@ var TerminalOutputBatchSchema = object({
74228
74289
  snapshot: string().optional(),
74229
74290
  events: array(TerminalOutputEventSchema).readonly()
74230
74291
  });
74231
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalInstanceInfoSchema).readonly(), { auth: "admin" }), method(object({
74232
- targetNodeId: string().min(1),
74233
- profileId: string().min(1),
74234
- name: string().trim().min(1).max(160).optional(),
74235
- executable: string().max(1024).optional(),
74236
- args: array(string().max(2048)).max(64).optional(),
74237
- cwd: string().max(1024).optional(),
74238
- environment: array(string().max(4096)).max(64).optional(),
74239
- profileSettings: ProfileSettingsBagSchema.optional()
74240
- }), TerminalInstanceInfoSchema, {
74241
- kind: "mutation",
74242
- auth: "admin"
74243
- }), method(object({
74244
- instanceId: string().min(1),
74245
- /** Re-point the instance to another node; the profile must exist there. */
74246
- targetNodeId: string().min(1).max(256).optional(),
74247
- name: string().trim().min(1).max(160).optional(),
74248
- executable: string().max(1024).optional(),
74249
- args: array(string().max(2048)).max(64).optional(),
74250
- cwd: string().max(1024).optional(),
74251
- environment: array(string().max(4096)).max(64).optional(),
74252
- profileSettings: ProfileSettingsBagSchema.optional()
74253
- }), TerminalInstanceInfoSchema, {
74254
- kind: "mutation",
74255
- auth: "admin"
74256
- }), method(object({ instanceId: string().min(1) }), _void(), {
74257
- kind: "mutation",
74258
- auth: "admin"
74259
- }), method(object({
74260
- instanceId: string().min(1),
74261
- enabled: boolean()
74262
- }), TerminalInstanceInfoSchema, {
74263
- kind: "mutation",
74264
- auth: "admin"
74265
- }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
74292
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
74266
74293
  stableId: string().min(1),
74267
74294
  name: string().trim().min(1).max(160).optional()
74268
74295
  }), TerminalInstanceInfoSchema, {
@@ -74331,6 +74358,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
74331
74358
  _enum(["switch", "pet-fountain"]);
74332
74359
  DeviceType.Heater, DeviceType.PetFountain;
74333
74360
  DeviceType.Heater, DeviceType.PetFountain;
74361
+ /** One duration, as the one-tap run asks for it. */
74362
+ var TimedRunQuickRunSchema = object({
74363
+ duration: number().positive().finite(),
74364
+ unit: TimedRunUnitSchema
74365
+ });
74334
74366
  /** Why a request was not carried out. Typed, so a caller can say it in words. */
74335
74367
  var TimedRunRefusalSchema = _enum([
74336
74368
  "unsupported-device",
@@ -74351,9 +74383,30 @@ object({
74351
74383
  activeUntil: number().nullable(),
74352
74384
  /** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
74353
74385
  requestedBy: string().nullable(),
74386
+ /**
74387
+ * The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
74388
+ * the device is gone or its type has no timed run; a status from before this field
74389
+ * existed has none, and a surface falls back to the type's default.
74390
+ */
74391
+ quickRun: TimedRunQuickRunSchema.nullable(),
74354
74392
  lastFetchedAt: number()
74355
74393
  });
74356
- method(object({
74394
+ /** What the settings form needs: the unit, the bounds and the type's default. */
74395
+ var TimedRunOptionsSchema = object({
74396
+ unit: TimedRunUnitSchema,
74397
+ /** The longest run, in `unit`. */
74398
+ maxDuration: number(),
74399
+ defaultDuration: number()
74400
+ });
74401
+ /** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
74402
+ var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
74403
+ method(object({ deviceId: number().int() }), TimedRunOptionsSchema), method(object({
74404
+ deviceId: number().int(),
74405
+ settings: TimedRunSettingsPatchSchema
74406
+ }), _void(), {
74407
+ kind: "mutation",
74408
+ auth: "admin"
74409
+ }), method(object({
74357
74410
  deviceId: number().int(),
74358
74411
  duration: number().positive().finite(),
74359
74412
  unit: TimedRunUnitSchema
@@ -77059,21 +77112,28 @@ Object.freeze({
77059
77112
  access: "view",
77060
77113
  role: "admin"
77061
77114
  },
77062
- "addonSettings.getGlobalSettings": {
77115
+ "addonSettings.getIntegrationFormSchema": {
77116
+ capName: "addon-settings",
77117
+ capScope: "system",
77118
+ addonId: null,
77119
+ access: "view",
77120
+ role: "admin"
77121
+ },
77122
+ "addonSettings.getScopedSettings": {
77063
77123
  capName: "addon-settings",
77064
77124
  capScope: "system",
77065
77125
  addonId: null,
77066
77126
  access: "view",
77067
77127
  role: "admin"
77068
77128
  },
77069
- "addonSettings.getIntegrationFormSchema": {
77129
+ "addonSettings.listScopedSettings": {
77070
77130
  capName: "addon-settings",
77071
77131
  capScope: "system",
77072
77132
  addonId: null,
77073
77133
  access: "view",
77074
77134
  role: "admin"
77075
77135
  },
77076
- "addonSettings.getIntegrationSettings": {
77136
+ "addonSettings.readScopedValues": {
77077
77137
  capName: "addon-settings",
77078
77138
  capScope: "system",
77079
77139
  addonId: null,
@@ -77094,7 +77154,7 @@ Object.freeze({
77094
77154
  access: "create",
77095
77155
  role: "admin"
77096
77156
  },
77097
- "addonSettings.updateGlobalSettings": {
77157
+ "addonSettings.updateScopedSettings": {
77098
77158
  capName: "addon-settings",
77099
77159
  capScope: "system",
77100
77160
  addonId: null,
@@ -79264,6 +79324,13 @@ Object.freeze({
79264
79324
  access: "create",
79265
79325
  role: "admin"
79266
79326
  },
79327
+ "deviceManager.setAlias": {
79328
+ capName: "device-manager",
79329
+ capScope: "system",
79330
+ addonId: null,
79331
+ access: "create",
79332
+ role: "admin"
79333
+ },
79267
79334
  "deviceManager.setChildLayout": {
79268
79335
  capName: "device-manager",
79269
79336
  capScope: "system",
@@ -80552,13 +80619,6 @@ Object.freeze({
80552
80619
  access: "delete",
80553
80620
  role: "admin"
80554
80621
  },
80555
- "llm.deleteProfile": {
80556
- capName: "llm",
80557
- capScope: "system",
80558
- addonId: null,
80559
- access: "delete",
80560
- role: "admin"
80561
- },
80562
80622
  "llm.generate": {
80563
80623
  capName: "llm",
80564
80624
  capScope: "system",
@@ -80622,20 +80682,6 @@ Object.freeze({
80622
80682
  access: "view",
80623
80683
  role: "admin"
80624
80684
  },
80625
- "llm.listProfileKinds": {
80626
- capName: "llm",
80627
- capScope: "system",
80628
- addonId: null,
80629
- access: "view",
80630
- role: "admin"
80631
- },
80632
- "llm.listProfiles": {
80633
- capName: "llm",
80634
- capScope: "system",
80635
- addonId: null,
80636
- access: "view",
80637
- role: "admin"
80638
- },
80639
80685
  "llm.listRuntimeNodes": {
80640
80686
  capName: "llm",
80641
80687
  capScope: "system",
@@ -80643,13 +80689,6 @@ Object.freeze({
80643
80689
  access: "view",
80644
80690
  role: "admin"
80645
80691
  },
80646
- "llm.migrateRawSecrets": {
80647
- capName: "llm",
80648
- capScope: "system",
80649
- addonId: null,
80650
- access: "create",
80651
- role: "admin"
80652
- },
80653
80692
  "llm.resolveModelRef": {
80654
80693
  capName: "llm",
80655
80694
  capScope: "system",
@@ -80678,20 +80717,6 @@ Object.freeze({
80678
80717
  access: "create",
80679
80718
  role: "admin"
80680
80719
  },
80681
- "llm.testProfile": {
80682
- capName: "llm",
80683
- capScope: "system",
80684
- addonId: null,
80685
- access: "create",
80686
- role: "admin"
80687
- },
80688
- "llm.upsertProfile": {
80689
- capName: "llm",
80690
- capScope: "system",
80691
- addonId: null,
80692
- access: "create",
80693
- role: "admin"
80694
- },
80695
80720
  "llmRuntime.appleAvailability": {
80696
80721
  capName: "llm-runtime",
80697
80722
  capScope: "system",
@@ -81196,13 +81221,6 @@ Object.freeze({
81196
81221
  access: "create",
81197
81222
  role: "admin"
81198
81223
  },
81199
- "meshNetwork.testConnection": {
81200
- capName: "mesh-network",
81201
- capScope: "system",
81202
- addonId: null,
81203
- access: "create",
81204
- role: "admin"
81205
- },
81206
81224
  "meter.getStatus": {
81207
81225
  capName: "meter",
81208
81226
  capScope: "device",
@@ -81861,13 +81879,6 @@ Object.freeze({
81861
81879
  access: "create",
81862
81880
  role: "admin"
81863
81881
  },
81864
- "notificationOutput.deleteTarget": {
81865
- capName: "notification-output",
81866
- capScope: "system",
81867
- addonId: null,
81868
- access: "delete",
81869
- role: "admin"
81870
- },
81871
81882
  "notificationOutput.discoverTargets": {
81872
81883
  capName: "notification-output",
81873
81884
  capScope: "system",
@@ -81875,13 +81886,6 @@ Object.freeze({
81875
81886
  access: "view",
81876
81887
  role: "admin"
81877
81888
  },
81878
- "notificationOutput.getTarget": {
81879
- capName: "notification-output",
81880
- capScope: "system",
81881
- addonId: null,
81882
- access: "view",
81883
- role: "admin"
81884
- },
81885
81889
  "notificationOutput.listTargetKinds": {
81886
81890
  capName: "notification-output",
81887
81891
  capScope: "system",
@@ -81889,13 +81893,6 @@ Object.freeze({
81889
81893
  access: "view",
81890
81894
  role: "admin"
81891
81895
  },
81892
- "notificationOutput.listTargets": {
81893
- capName: "notification-output",
81894
- capScope: "system",
81895
- addonId: null,
81896
- access: "view",
81897
- role: "admin"
81898
- },
81899
81896
  "notificationOutput.probeTargetConfig": {
81900
81897
  capName: "notification-output",
81901
81898
  capScope: "system",
@@ -81910,13 +81907,6 @@ Object.freeze({
81910
81907
  access: "create",
81911
81908
  role: "admin"
81912
81909
  },
81913
- "notificationOutput.setTargetEnabled": {
81914
- capName: "notification-output",
81915
- capScope: "system",
81916
- addonId: null,
81917
- access: "create",
81918
- role: "admin"
81919
- },
81920
81910
  "notificationOutput.testTarget": {
81921
81911
  capName: "notification-output",
81922
81912
  capScope: "system",
@@ -81924,13 +81914,6 @@ Object.freeze({
81924
81914
  access: "create",
81925
81915
  role: "admin"
81926
81916
  },
81927
- "notificationOutput.upsertTarget": {
81928
- capName: "notification-output",
81929
- capScope: "system",
81930
- addonId: null,
81931
- access: "create",
81932
- role: "admin"
81933
- },
81934
81917
  "notificationRules.activateAlarmProfile": {
81935
81918
  capName: "notification-rules",
81936
81919
  capScope: "system",
@@ -82190,41 +82173,6 @@ Object.freeze({
82190
82173
  access: "view",
82191
82174
  role: "admin"
82192
82175
  },
82193
- "oidcConnections.connectionFormSchema": {
82194
- capName: "oidc-connections",
82195
- capScope: "system",
82196
- addonId: null,
82197
- access: "view",
82198
- role: "admin"
82199
- },
82200
- "oidcConnections.createConnection": {
82201
- capName: "oidc-connections",
82202
- capScope: "system",
82203
- addonId: null,
82204
- access: "create",
82205
- role: "admin"
82206
- },
82207
- "oidcConnections.deleteConnection": {
82208
- capName: "oidc-connections",
82209
- capScope: "system",
82210
- addonId: null,
82211
- access: "delete",
82212
- role: "admin"
82213
- },
82214
- "oidcConnections.listConnections": {
82215
- capName: "oidc-connections",
82216
- capScope: "system",
82217
- addonId: null,
82218
- access: "view",
82219
- role: "admin"
82220
- },
82221
- "oidcConnections.updateConnection": {
82222
- capName: "oidc-connections",
82223
- capScope: "system",
82224
- addonId: null,
82225
- access: "create",
82226
- role: "admin"
82227
- },
82228
82176
  "osd.getStatus": {
82229
82177
  capName: "osd",
82230
82178
  capScope: "device",
@@ -85256,13 +85204,6 @@ Object.freeze({
85256
85204
  access: "delete",
85257
85205
  role: "admin"
85258
85206
  },
85259
- "storage.deleteLocation": {
85260
- capName: "storage",
85261
- capScope: "system",
85262
- addonId: null,
85263
- access: "delete",
85264
- role: "admin"
85265
- },
85266
85207
  "storage.endDownload": {
85267
85208
  capName: "storage",
85268
85209
  capScope: "system",
@@ -85319,13 +85260,6 @@ Object.freeze({
85319
85260
  access: "view",
85320
85261
  role: "admin"
85321
85262
  },
85322
- "storage.listProviders": {
85323
- capName: "storage",
85324
- capScope: "system",
85325
- addonId: null,
85326
- access: "view",
85327
- role: "admin"
85328
- },
85329
85263
  "storage.read": {
85330
85264
  capName: "storage",
85331
85265
  capScope: "system",
@@ -85347,27 +85281,6 @@ Object.freeze({
85347
85281
  access: "view",
85348
85282
  role: "admin"
85349
85283
  },
85350
- "storage.testConfig": {
85351
- capName: "storage",
85352
- capScope: "system",
85353
- addonId: null,
85354
- access: "view",
85355
- role: "admin"
85356
- },
85357
- "storage.testLocation": {
85358
- capName: "storage",
85359
- capScope: "system",
85360
- addonId: null,
85361
- access: "view",
85362
- role: "admin"
85363
- },
85364
- "storage.upsertLocation": {
85365
- capName: "storage",
85366
- capScope: "system",
85367
- addonId: null,
85368
- access: "create",
85369
- role: "admin"
85370
- },
85371
85284
  "storage.write": {
85372
85285
  capName: "storage",
85373
85286
  capScope: "system",
@@ -86145,27 +86058,6 @@ Object.freeze({
86145
86058
  access: "create",
86146
86059
  role: "admin"
86147
86060
  },
86148
- "terminalSession.createInstance": {
86149
- capName: "terminal-session",
86150
- capScope: "system",
86151
- addonId: null,
86152
- access: "create",
86153
- role: "admin"
86154
- },
86155
- "terminalSession.deleteInstance": {
86156
- capName: "terminal-session",
86157
- capScope: "system",
86158
- addonId: null,
86159
- access: "delete",
86160
- role: "admin"
86161
- },
86162
- "terminalSession.listInstances": {
86163
- capName: "terminal-session",
86164
- capScope: "system",
86165
- addonId: null,
86166
- access: "view",
86167
- role: "admin"
86168
- },
86169
86061
  "terminalSession.listLegacyCameras": {
86170
86062
  capName: "terminal-session",
86171
86063
  capScope: "system",
@@ -86208,20 +86100,6 @@ Object.freeze({
86208
86100
  access: "create",
86209
86101
  role: "admin"
86210
86102
  },
86211
- "terminalSession.setInstanceEnabled": {
86212
- capName: "terminal-session",
86213
- capScope: "system",
86214
- addonId: null,
86215
- access: "create",
86216
- role: "admin"
86217
- },
86218
- "terminalSession.updateInstance": {
86219
- capName: "terminal-session",
86220
- capScope: "system",
86221
- addonId: null,
86222
- access: "create",
86223
- role: "admin"
86224
- },
86225
86103
  "terminalSession.writeInput": {
86226
86104
  capName: "terminal-session",
86227
86105
  capScope: "system",
@@ -86236,6 +86114,13 @@ Object.freeze({
86236
86114
  access: "create",
86237
86115
  role: "viewer"
86238
86116
  },
86117
+ "timedRun.getOptions": {
86118
+ capName: "timed-run",
86119
+ capScope: "device",
86120
+ addonId: null,
86121
+ access: "view",
86122
+ role: "viewer"
86123
+ },
86239
86124
  "timedRun.getStatus": {
86240
86125
  capName: "timed-run",
86241
86126
  capScope: "device",
@@ -86250,6 +86135,13 @@ Object.freeze({
86250
86135
  access: "create",
86251
86136
  role: "viewer"
86252
86137
  },
86138
+ "timedRun.setSettings": {
86139
+ capName: "timed-run",
86140
+ capScope: "device",
86141
+ addonId: null,
86142
+ access: "create",
86143
+ role: "admin"
86144
+ },
86253
86145
  "toast.onToast": {
86254
86146
  capName: "toast",
86255
86147
  capScope: "system",
@@ -87205,6 +87097,7 @@ function applianceExport(ecosystem, deviceType) {
87205
87097
  if (!isPlugApplianceType(deviceType)) return null;
87206
87098
  return APPLIANCE_EXPORT[ecosystem][deviceType];
87207
87099
  }
87100
+ string().min(1).max(4096);
87208
87101
  Object.freeze({
87209
87102
  "accessories.getStatus": [{
87210
87103
  name: "deviceId",
@@ -87888,6 +87781,11 @@ Object.freeze({
87888
87781
  form: "single",
87889
87782
  optional: false
87890
87783
  }],
87784
+ "deviceManager.setAlias": [{
87785
+ name: "deviceId",
87786
+ form: "single",
87787
+ optional: false
87788
+ }],
87891
87789
  "deviceManager.setChildLayout": [{
87892
87790
  name: "deviceId",
87893
87791
  form: "single",
@@ -89952,6 +89850,11 @@ Object.freeze({
89952
89850
  form: "single",
89953
89851
  optional: false
89954
89852
  }],
89853
+ "timedRun.getOptions": [{
89854
+ name: "deviceId",
89855
+ form: "single",
89856
+ optional: false
89857
+ }],
89955
89858
  "timedRun.getStatus": [{
89956
89859
  name: "deviceId",
89957
89860
  form: "single",
@@ -89962,6 +89865,11 @@ Object.freeze({
89962
89865
  form: "single",
89963
89866
  optional: false
89964
89867
  }],
89868
+ "timedRun.setSettings": [{
89869
+ name: "deviceId",
89870
+ form: "single",
89871
+ optional: false
89872
+ }],
89965
89873
  "update.getStatus": [{
89966
89874
  name: "deviceId",
89967
89875
  form: "single",
@@ -90824,6 +90732,7 @@ var STATE_SUMMARY_VARS = [
90824
90732
  [...RULE_TEXT],
90825
90733
  [...RULE_TEXT],
90826
90734
  [...RULE_TEXT],
90735
+ [...RULE_TEXT],
90827
90736
  [...RULE_BODY_ONLY],
90828
90737
  [...RULE_TEXT],
90829
90738
  ([...RULE_TEXT], [...DEVICE_EVENTS]),