@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.
@@ -78,7 +78,7 @@ function createApiDeviceGateway(deps) {
78
78
  };
79
79
  }
80
80
  //#endregion
81
- //#region ../types/dist/event-category-BmPm98n0.mjs
81
+ //#region ../types/dist/event-category-78tcBemo.mjs
82
82
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
83
83
  EventCategory["SystemBoot"] = "system.boot";
84
84
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -199,6 +199,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
199
199
  */
200
200
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
201
201
  /**
202
+ * An addon is RUNNING although its installed package is below what the
203
+ * running server requires (`camstack.requires.addons` of the server, or the
204
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
205
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
206
+ * operator alert per node and package. The addon is never held back for it.
207
+ *
208
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
209
+ */
210
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
211
+ /**
212
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
213
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
214
+ *
215
+ * Payload: `{ packageName, addonId, nodeId }`.
216
+ */
217
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
218
+ /**
202
219
  * Monitor scheduled the next retry for a failed addon. Transient —
203
220
  * surfaced to the UI for live-updating the "next retry in Ns"
204
221
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -309,7 +326,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
309
326
  EventCategory["ProcessRestarted"] = "process.restarted";
310
327
  /**
311
328
  * The SET of storage locations changed — one was created, edited, enabled,
312
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
329
+ * disabled or deleted through the location instances or the forced-delete action.
313
330
  *
314
331
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
315
332
  * it must also converge on its own periodic path, because a dropped event
@@ -864,7 +881,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
864
881
  return EventCategory;
865
882
  }({});
866
883
  //#endregion
867
- //#region ../types/dist/device-type-D1fH5kaC.mjs
884
+ //#region ../types/dist/device-type-DxCT0krO.mjs
868
885
  /**
869
886
  import { errMsg } from '@camstack/types'
870
887
  * Extract a human-readable message from an unknown error value.
@@ -1026,6 +1043,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1026
1043
  * filters that want "all devices with on-motion behaviour".
1027
1044
  */
1028
1045
  DeviceFeature["MotionTrigger"] = "motion-trigger";
1046
+ /**
1047
+ * Device can be run for a chosen time and then stopped. Mirrors the
1048
+ * `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
1049
+ * a driver, so the flag is derived from the device's bindings
1050
+ * (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
1051
+ */
1052
+ DeviceFeature["TimedRun"] = "timed-run";
1029
1053
  /** Light supports rgb-triplet color via `color` cap. */
1030
1054
  DeviceFeature["LightColorRgb"] = "light-color-rgb";
1031
1055
  /** Light supports HSV color via `color` cap. */
@@ -6060,7 +6084,7 @@ var ZodIssueCode = {
6060
6084
  var ZodFirstPartyTypeKind;
6061
6085
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6062
6086
  //#endregion
6063
- //#region ../types/dist/sleep-D7ZKm4nb.mjs
6087
+ //#region ../types/dist/sleep-7El4r5Bl.mjs
6064
6088
  /**
6065
6089
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6066
6090
  * window to float samples (D455).
@@ -6424,6 +6448,59 @@ Object.fromEntries([
6424
6448
  function isValuelessField(field) {
6425
6449
  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";
6426
6450
  }
6451
+ /**
6452
+ * Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
6453
+ * `key → { value, default }`, recursing through `group` and `sub-tabs`
6454
+ * layout fields. Keeping `value` and `default` SEPARATE (rather than
6455
+ * pre-resolving) lets callers both read the effective value AND detect
6456
+ * overrides (`value` differs from `default`). Structural over `unknown`;
6457
+ * malformed input yields an empty map, never throws.
6458
+ */
6459
+ function collectHydratedFieldEntries(schema) {
6460
+ const out = /* @__PURE__ */ new Map();
6461
+ if (typeof schema !== "object" || schema === null) return out;
6462
+ const sections = schema.sections;
6463
+ if (!Array.isArray(sections)) return out;
6464
+ for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
6465
+ return out;
6466
+ }
6467
+ /** Recursive field walker for {@link collectHydratedFieldEntries}. */
6468
+ function collectFieldEntriesInto(fields, into) {
6469
+ if (!Array.isArray(fields)) return;
6470
+ for (const field of fields) {
6471
+ if (typeof field !== "object" || field === null) continue;
6472
+ const type = field.type;
6473
+ if (type === "group") {
6474
+ collectFieldEntriesInto(field.fields, into);
6475
+ continue;
6476
+ }
6477
+ if (type === "sub-tabs") {
6478
+ const tabs = field.tabs;
6479
+ if (Array.isArray(tabs)) {
6480
+ for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
6481
+ }
6482
+ continue;
6483
+ }
6484
+ const key = field.key;
6485
+ if (typeof key !== "string" || key.length === 0) continue;
6486
+ if (!("value" in field)) continue;
6487
+ into.set(key, {
6488
+ value: field.value,
6489
+ default: field.default
6490
+ });
6491
+ }
6492
+ }
6493
+ /**
6494
+ * Flatten a hydrated settings payload into `key → EFFECTIVE value`
6495
+ * (`value ?? default`). The read-side inverse of `hydrateSchema` for the
6496
+ * common "just give me the resolved values" case. Built on
6497
+ * {@link collectHydratedFieldEntries}.
6498
+ */
6499
+ function collectHydratedFieldValues(schema) {
6500
+ const out = /* @__PURE__ */ new Map();
6501
+ for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
6502
+ return out;
6503
+ }
6427
6504
  function hydrateSchema(schema, values, options = {}) {
6428
6505
  return {
6429
6506
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
@@ -7308,17 +7385,35 @@ var RecordIntegrationInstances = class {
7308
7385
  ...kind !== void 0 ? { kind } : {}
7309
7386
  });
7310
7387
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7388
+ const initial = this.hooks.initialBody(name, kind);
7389
+ const patch = this.patchOf(values ?? {});
7390
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7391
+ kind,
7392
+ body: {
7393
+ ...initial,
7394
+ ...patch
7395
+ }
7396
+ }));
7311
7397
  await this.handle.put({
7312
7398
  id: minted,
7313
- data: this.hooks.initialBody(name, kind)
7399
+ data: initial
7314
7400
  }, { ifRev: 0 });
7315
- const patch = this.patchOf(values ?? {});
7316
7401
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7317
7402
  await this.hooks.onChanged?.(minted, "created");
7318
7403
  return { id: minted };
7319
7404
  };
7320
7405
  updateInstance = async ({ id, name, values }) => {
7321
7406
  const patch = this.patchOf(values);
7407
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7408
+ const stored = await this.handle.get(id);
7409
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7410
+ kind: void 0,
7411
+ body: {
7412
+ ...stored.data,
7413
+ ...patch
7414
+ }
7415
+ }));
7416
+ }
7322
7417
  if (name !== void 0) patch[this.nameField] = name;
7323
7418
  await this.handle.patch(id, patch);
7324
7419
  await this.hooks.onChanged?.(id, "updated");
@@ -7629,6 +7724,21 @@ var SCOPED_SETTINGS_SCOPES = [
7629
7724
  "device-defaults",
7630
7725
  "node"
7631
7726
  ];
7727
+ /** The one refusal of a key a scope did not declare. */
7728
+ function assertDeclaredKeys(keys, declared) {
7729
+ const undeclared = keys.filter((key) => !declared.has(key));
7730
+ if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
7731
+ }
7732
+ /** Build the handle over an addon's scoped read, write and unset. */
7733
+ function createScopedSettings(deps) {
7734
+ return {
7735
+ async get() {
7736
+ return deps.schema.parse(await deps.read());
7737
+ },
7738
+ patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
7739
+ unset: (keys) => deps.unset(keys)
7740
+ };
7741
+ }
7632
7742
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7633
7743
  var KeychainWriteRefusedError = class extends Error {
7634
7744
  fieldPath;
@@ -8204,7 +8314,16 @@ function createHandle(raw, opts) {
8204
8314
  return blob;
8205
8315
  }
8206
8316
  },
8207
- writeAddonStore: writeAddon
8317
+ writeAddonStore: writeAddon,
8318
+ removeClearedKeys: (keys) => serialize("addon", async () => {
8319
+ const stored = await readStoredAddonBlob(raw);
8320
+ index.seen("addon", stored);
8321
+ const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
8322
+ if (removable.length === 0) return;
8323
+ const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
8324
+ await raw.writeAddonStore(patch);
8325
+ index.wrote("addon", patch);
8326
+ })
8208
8327
  };
8209
8328
  }
8210
8329
  /** The context the addon sees, plus the private raw view and write outcome. */
@@ -8334,7 +8453,7 @@ function boundOf(list) {
8334
8453
  * Base class for CamStack addons. Eliminates settings boilerplate:
8335
8454
  *
8336
8455
  * - Typed `config` property with automatic resolution from store + defaults
8337
- * - `getGlobalSettings()` / `updateGlobalSettings()` auto-implemented
8456
+ * - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
8338
8457
  * - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
8339
8458
  * - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
8340
8459
  * - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
@@ -8344,7 +8463,7 @@ function boundOf(list) {
8344
8463
  * Subclasses override:
8345
8464
  * - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
8346
8465
  * - `onShutdown()` — cleanup
8347
- * - `globalSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
8466
+ * - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
8348
8467
  *
8349
8468
  * @example
8350
8469
  * ```ts
@@ -8358,7 +8477,7 @@ function boundOf(list) {
8358
8477
  * super({ maxRetries: 3, endpoint: 'http://localhost' })
8359
8478
  * }
8360
8479
  *
8361
- * protected globalSettingsSchema() {
8480
+ * protected clusterSettingsSchema() {
8362
8481
  * return this.schema({
8363
8482
  * sections: [{
8364
8483
  * id: 'main', title: 'Settings',
@@ -8401,7 +8520,7 @@ var BaseAddon = class {
8401
8520
  defaults;
8402
8521
  /**
8403
8522
  * Hidden-state paths that hold secrets (D787) — values the addon writes
8404
- * itself (`updateGlobalSettings`, `state()`) that no form field declares.
8523
+ * itself (`state()`, the scoped writers) that no form field declares.
8405
8524
  * Stored in the keychain exactly like a `password` field. Syntax:
8406
8525
  * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
8407
8526
  * (`key[<id field>]` addresses array items by id, never by index).
@@ -8411,7 +8530,7 @@ var BaseAddon = class {
8411
8530
  /**
8412
8531
  * D986 M4: the scoped schemas this addon declared, resolved once per capability
8413
8532
  * (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
8414
- * see them. Empty until loaded: the readers then fall back to {@link globalSettingsSchema}.
8533
+ * see them. Empty until loaded.
8415
8534
  */
8416
8535
  _scopedByCap = /* @__PURE__ */ new Map();
8417
8536
  _nodeKeysByCap = /* @__PURE__ */ new Map();
@@ -8597,7 +8716,7 @@ var BaseAddon = class {
8597
8716
  /** Addon-specific cleanup. Override if needed. */
8598
8717
  async onShutdown() {}
8599
8718
  /**
8600
- * Called after config is resolved during updateGlobalSettings/updateAddonSettings.
8719
+ * Called after config is resolved during a settings write.
8601
8720
  * Override to react to config changes (e.g. restart a sampler, reconnect a service).
8602
8721
  * Not called during initialize() — use onInitialize() for initial setup.
8603
8722
  */
@@ -8626,82 +8745,12 @@ var BaseAddon = class {
8626
8745
  scopedSettingsCapabilities() {
8627
8746
  return [];
8628
8747
  }
8629
- /** Override to provide global-level settings UI schema. */
8630
- globalSettingsSchema(_cap) {
8631
- return null;
8632
- }
8633
8748
  /** Override to provide device-level settings UI schema. */
8634
8749
  deviceSettingsSchema() {
8635
8750
  return null;
8636
8751
  }
8637
8752
  /**
8638
- * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
8639
- * ARE the configuration of its integration.
8640
- *
8641
- * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
8642
- * operator should find on the addon's integration page (System →
8643
- * Integrations → <name>) rather than only in the cluster-wide list of every
8644
- * addon. Empty (the default) means the addon has no integration-level
8645
- * settings and no such surface is offered — this is opt-in, because whether
8646
- * an addon's configuration IS its integration's configuration depends on the
8647
- * nature of the integration.
8648
- *
8649
- * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
8650
- * the ONE global schema, in the ONE addon store, written by the ONE
8651
- * `updateGlobalSettings` path. There is deliberately no
8652
- * `updateIntegrationSettings`: a second write path is how a surface acquires
8653
- * a second store key, and this repo has shipped that twice (`btmPath@hub`,
8654
- * D266). Selecting sections cannot introduce a key that selecting cannot.
8655
- *
8656
- * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
8657
- * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
8658
- * removed with the reason recorded at
8659
- * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
8660
- * determined by WHICH schema it lives in, not by a field-level marker."* A
8661
- * marker sprinkled across sections also has to borrow a field that already
8662
- * means something else; borrowing `section.tab` put the literal word
8663
- * "integration" into an operator-facing tab bar, because `tab` means "how to
8664
- * GROUP this visually" and cannot also mean "where this lives" (D269
8665
- * supersedes D268). One declaration, in one place, next to the schema whose
8666
- * ids it names.
8667
- */
8668
- integrationSettingSections() {
8669
- return [];
8670
- }
8671
- async getGlobalSettings(overlay, cap, nodeId) {
8672
- await this.loadScopedSchemas(cap);
8673
- const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
8674
- if (!schema) return { sections: [] };
8675
- const projected = await this.readRawProjectedStore(nodeId, cap);
8676
- return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
8677
- }
8678
- /**
8679
- * The integration-level view of this addon's settings: exactly the sections
8680
- * named by {@link integrationSettingSections}, hydrated from the SAME store
8681
- * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
8682
- *
8683
- * Returns `null` when the addon declared nothing — an addon that opts out has
8684
- * no integration settings surface at all, rather than an empty one that reads
8685
- * as a failed load.
8686
- *
8687
- * Three properties hold BY CONSTRUCTION, which is why they are here in core
8688
- * and not in whichever UI happens to render this:
8689
- *
8690
- * 1. **One key.** The payload is a SUBSET of the global schema, so a field
8691
- * shown here is the same field, with the same bare key, that the addon's
8692
- * own page shows. There is no integration-specific writer — callers save
8693
- * through `updateGlobalSettings` — so a second store key is unreachable,
8694
- * not merely discouraged.
8695
- * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
8696
- * is `<key>@<nodeId>` and an integration is not a node; whichever node
8697
- * such a field silently picked would be a wrong answer for the operator
8698
- * who opened the page (D266).
8699
- * 3. **No silent typo.** A declared id that names no section throws. The
8700
- * alternative — skip it — turns a rename into a surface that quietly
8701
- * empties, which looks exactly like an addon with nothing to configure.
8702
- */
8703
- /**
8704
- * The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
8753
+ * The form schema of ONE integration instance, or `null` to use the scoped form.
8705
8754
  *
8706
8755
  * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
8707
8756
  * needs its connection fields, the default integration the addon's own sections. It is the
@@ -8749,37 +8798,178 @@ var BaseAddon = class {
8749
8798
  }
8750
8799
  }
8751
8800
  /**
8801
+ * Hook: values layered over the stored ones when the FORM of one scope is served
8802
+ * ({@link getScopedSettings}) — a preview that derives dependent options without writing.
8803
+ * Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
8804
+ */
8805
+ async scopedSettingsOverlay(_scope, _cap, _nodeId) {
8806
+ return null;
8807
+ }
8808
+ /**
8809
+ * Hook: a write of one scope changed stored values (not called when the store reports no change,
8810
+ * e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
8811
+ */
8812
+ async onScopedSettingsChanged(_scope, _cap, _keys) {}
8813
+ /** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
8814
+ clusterSettings(cap, schema) {
8815
+ return this.scopedHandle("cluster", cap, schema);
8816
+ }
8817
+ /** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
8818
+ deviceDefaults(cap, schema) {
8819
+ return this.scopedHandle("device-defaults", cap, schema);
8820
+ }
8821
+ /**
8822
+ * Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
8823
+ * with no row yields the schema defaults — never a bare-key fallback.
8824
+ */
8825
+ nodeSettings(cap, schema, nodeId) {
8826
+ return this.scopedHandle("node", cap, schema, nodeId);
8827
+ }
8828
+ /**
8829
+ * {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
8830
+ * settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
8831
+ * central delete. `nodeId` omitted ⇒ the local node.
8832
+ */
8833
+ nodeState(key, schema, fallback, nodeId) {
8834
+ this._declaredStateKeys.add(key);
8835
+ return createDurableState({
8836
+ key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
8837
+ schema,
8838
+ fallback,
8839
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
8840
+ write: async (patch) => {
8841
+ await this._ctx?.settings?.writeAddonStore(patch);
8842
+ },
8843
+ onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
8844
+ addonId: this._ctx?.id,
8845
+ key: k,
8846
+ error: String(e)
8847
+ } })
8848
+ });
8849
+ }
8850
+ /** The loaded schema `cap` declares for `scope`, or `null`. */
8851
+ async declaredScopedSchema(scope, cap) {
8852
+ await this.loadScopedSchemas(cap);
8853
+ return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
8854
+ }
8855
+ async requireScopedSchema(scope, cap) {
8856
+ const schema = await this.declaredScopedSchema(scope, cap);
8857
+ if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
8858
+ return schema;
8859
+ }
8860
+ scopedKeys(schema) {
8861
+ return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
8862
+ }
8863
+ /** `store` narrowed to the keys `schema` declares. */
8864
+ narrowToScope(store, schema) {
8865
+ const keys = this.scopedKeys(schema);
8866
+ return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
8867
+ }
8868
+ scopedHandle(scope, cap, schema, nodeId) {
8869
+ return createScopedSettings({
8870
+ schema,
8871
+ read: async () => {
8872
+ const declared = await this.requireScopedSchema(scope, cap);
8873
+ const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
8874
+ const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
8875
+ return {
8876
+ ...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
8877
+ ...stored
8878
+ };
8879
+ },
8880
+ write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
8881
+ unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
8882
+ });
8883
+ }
8884
+ /** The one write path of the scoped API: declared keys only, then the global patch. */
8885
+ async writeScoped(scope, cap, patch, nodeId) {
8886
+ assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8887
+ if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
8888
+ }
8889
+ /**
8890
+ * Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
8891
+ * value is released exactly as there — and the emptied row is then removed; every other key is
8892
+ * removed by an `undefined` patch (which a secret transform would read as "keep").
8893
+ */
8894
+ async unsetScoped(scope, cap, keys, nodeId) {
8895
+ assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8896
+ const target = scope === "node" ? nodeId : void 0;
8897
+ const tree = this.addonSecretTree();
8898
+ const secretKeys = keys.filter((key) => tree.has(key));
8899
+ const plainKeys = keys.filter((key) => !tree.has(key));
8900
+ let changed = false;
8901
+ if (plainKeys.length > 0) {
8902
+ const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
8903
+ changed = await this.applyGlobalPatch(patch, target, cap) || changed;
8904
+ }
8905
+ if (secretKeys.length > 0) {
8906
+ await this.clearSecretKeys(secretKeys, target, cap);
8907
+ const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
8908
+ const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
8909
+ if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
8910
+ else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
8911
+ changed = true;
8912
+ }
8913
+ if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
8914
+ }
8915
+ /**
8916
+ * The hydrated form of one scope of one capability's settings (any
8917
+ * {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
8918
+ */
8919
+ async getScopedSettings(scope, cap, nodeId) {
8920
+ const schema = await this.declaredScopedSchema(scope, cap);
8921
+ if (schema === null) return null;
8922
+ const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
8923
+ const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
8924
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
8925
+ }
8926
+ /**
8927
+ * The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
8928
+ * in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
8929
+ * nothing.
8930
+ */
8931
+ async listScopedSettings() {
8932
+ await this.loadScopedSchemas();
8933
+ return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
8934
+ cap,
8935
+ scope: entry.scope,
8936
+ sectionIds: entry.schema.sections.map((section) => section.id)
8937
+ })));
8938
+ }
8939
+ /** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
8940
+ async updateScopedSettings(scope, cap, patch, nodeId) {
8941
+ this._operatorWriteDepth++;
8942
+ try {
8943
+ await this.writeScoped(scope, cap, patch, nodeId);
8944
+ } finally {
8945
+ this._operatorWriteDepth--;
8946
+ }
8947
+ }
8948
+ /**
8949
+ * The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
8950
+ * its value. `null` when the capability declares nothing for the scope.
8951
+ */
8952
+ async readScopedValues(scope, cap, nodeId) {
8953
+ const schema = await this.declaredScopedSchema(scope, cap);
8954
+ if (schema === null) return null;
8955
+ const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
8956
+ return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
8957
+ }
8958
+ /**
8752
8959
  * What the create wizard and the integration edit page render for one instance: the addon's
8753
8960
  * per-instance schema when it declares one, else its global schema (what they always showed).
8754
8961
  */
8755
8962
  async getIntegrationFormSchema(instance, nodeId) {
8756
8963
  const scoped = await this.integrationFormSchema(instance);
8757
- if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
8964
+ if (scoped === null) return this.scopedForm(nodeId);
8758
8965
  return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
8759
8966
  }
8760
- async getIntegrationSettings(nodeId) {
8761
- const declared = this.integrationSettingSections();
8762
- if (declared.length === 0) return null;
8763
- const schema = this.globalSettingsSchema();
8764
- if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
8765
- const byId = new Map(schema.sections.map((section) => [section.id, section]));
8766
- const sections = [];
8767
- for (const id of declared) {
8768
- const section = byId.get(id);
8769
- if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
8770
- const fields = dropPerNodeFields(section.fields);
8771
- if (fields.length === 0) continue;
8772
- sections.push({
8773
- ...section,
8774
- fields
8775
- });
8776
- }
8777
- if (sections.length === 0) return null;
8778
- const projected = await this.readRawProjectedStore(nodeId);
8779
- return hydrateSchema({
8780
- ...schema,
8781
- sections
8782
- }, projected, { inlineSecretsAsViews: true });
8967
+ /** The form of the scoped schemas this addon declared, hydrated from its store. */
8968
+ async scopedForm(nodeId) {
8969
+ await this.loadScopedSchemas();
8970
+ const schema = this.scopedFormSchema();
8971
+ if (!schema) return { sections: [] };
8972
+ return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
8783
8973
  }
8784
8974
  /**
8785
8975
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -8788,8 +8978,8 @@ var BaseAddon = class {
8788
8978
  * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
8789
8979
  * A no-op passthrough when the schema declares no `perNode` field.
8790
8980
  *
8791
- * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
8792
- * the store for custom option logic (option narrowing, value snapping) to
8981
+ * This is the sanctioned way for an addon that needs
8982
+ * the store for custom logic (option narrowing, value snapping) to
8793
8983
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
8794
8984
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
8795
8985
  *
@@ -8841,7 +9031,7 @@ var BaseAddon = class {
8841
9031
  }
8842
9032
  /**
8843
9033
  * Whether ONE global key of this addon's store was written, read three-way
8844
- * (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
9034
+ * (D651). For a question a hydrated view cannot answer: a hydrated form
8845
9035
  * reports `value ?? default`, so "the operator chose the default" and "nobody
8846
9036
  * chose" look the same, and a failed read looks like both. A `perNode` key is
8847
9037
  * not supported here: its stored name is scoped.
@@ -8875,7 +9065,7 @@ var BaseAddon = class {
8875
9065
  }
8876
9066
  /**
8877
9067
  * The OPERATOR's write — a settings form or an admin API call, dispatched by
8878
- * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
9068
+ * the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
8879
9069
  * the operator sends is stored as sent even when it equals a pre-keychain
8880
9070
  * inline value: the operator re-entering a password is a change, an addon
8881
9071
  * writing back what it read is not (D787).
@@ -8888,9 +9078,6 @@ var BaseAddon = class {
8888
9078
  this._operatorWriteDepth--;
8889
9079
  }
8890
9080
  }
8891
- async updateGlobalSettings(patch, nodeId) {
8892
- await this.applyGlobalPatch(patch, nodeId);
8893
- }
8894
9081
  /**
8895
9082
  * REMOVE stored secrets — their keychain values and their markers (D787).
8896
9083
  *
@@ -8900,6 +9087,9 @@ var BaseAddon = class {
8900
9087
  * a keychain (an older kernel) it writes `''`, as such code always did.
8901
9088
  */
8902
9089
  async clearSecrets(keys, nodeId) {
9090
+ await this.clearSecretKeys(keys, nodeId);
9091
+ }
9092
+ async clearSecretKeys(keys, nodeId, cap) {
8903
9093
  const tree = this.addonSecretTree();
8904
9094
  const keychain = this._ctx?.secrets !== void 0;
8905
9095
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
@@ -8912,25 +9102,26 @@ var BaseAddon = class {
8912
9102
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8913
9103
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8914
9104
  }
8915
- await this.applyGlobalPatch(patch, nodeId);
9105
+ await this.applyGlobalPatch(patch, nodeId, cap);
8916
9106
  }
8917
- async applyGlobalPatch(barePatch, nodeId) {
8918
- await this.loadScopedSchemas();
8919
- const keys = this.perNodeKeys();
9107
+ /** Resolves `true` when the write changed stored values. */
9108
+ async applyGlobalPatch(barePatch, nodeId, cap) {
9109
+ await this.loadScopedSchemas(cap);
9110
+ const keys = this.perNodeKeys(cap);
8920
9111
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
8921
9112
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
8922
9113
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
8923
9114
  const handle = this._secretSettings;
8924
9115
  if (handle !== null) {
8925
9116
  const { changed } = await handle.writeAddonStore(scoped);
8926
- if (!changed) return;
9117
+ if (!changed) return false;
8927
9118
  } else await this._ctx?.settings?.writeAddonStore(scoped);
8928
- if (target !== localNode) return;
9119
+ if (target !== localNode) return true;
8929
9120
  await this.resolveConfig();
8930
9121
  await this.onConfigChanged();
8931
9122
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
8932
- const legacy = this.globalSettingsSchema();
8933
- this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
9123
+ this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
9124
+ return true;
8934
9125
  }
8935
9126
  /**
8936
9127
  * The set of field keys the global settings schema declares `perNode: true`
@@ -8967,10 +9158,7 @@ var BaseAddon = class {
8967
9158
  this._nodeKeysByCap = /* @__PURE__ */ new Map();
8968
9159
  this._addonSecretTree = null;
8969
9160
  }
8970
- /**
8971
- * The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
8972
- * sections of its scoped schemas, so dropping the old hook does not blank the form.
8973
- */
9161
+ /** The form of an addon's scoped schemas: their sections, each shown once. */
8974
9162
  scopedFormSchema(cap) {
8975
9163
  const byId = /* @__PURE__ */ new Map();
8976
9164
  for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
@@ -8982,8 +9170,7 @@ var BaseAddon = class {
8982
9170
  return [...this._scopedByCap.values()].flat();
8983
9171
  }
8984
9172
  /**
8985
- * The field keys that are stored per node: every field of a {@link nodeSettingsSchema}, plus
8986
- * the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
9173
+ * The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
8987
9174
  * per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
8988
9175
  * per-node code path is bypassed and the settings API behaves like the node-agnostic one.
8989
9176
  * Call {@link loadScopedSchemas} first (the async seams do).
@@ -8992,8 +9179,7 @@ var BaseAddon = class {
8992
9179
  const cacheKey = cap ?? "";
8993
9180
  const cached = this._nodeKeysByCap.get(cacheKey);
8994
9181
  if (cached) return cached;
8995
- const legacy = this.globalSettingsSchema(cap);
8996
- const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
9182
+ const keys = /* @__PURE__ */ new Set();
8997
9183
  for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
8998
9184
  if (scope !== "node") continue;
8999
9185
  for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
@@ -9211,8 +9397,6 @@ var BaseAddon = class {
9211
9397
  }
9212
9398
  declaredKeySet() {
9213
9399
  const keys = new Set(Object.keys(this.defaults));
9214
- const schema = this.globalSettingsSchema();
9215
- if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
9216
9400
  for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
9217
9401
  for (const key of this._declaredStateKeys) keys.add(key);
9218
9402
  for (const path of this.secretStatePaths) {
@@ -9310,7 +9494,7 @@ var BaseAddon = class {
9310
9494
  /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
9311
9495
  addonSecretTree() {
9312
9496
  if (this._addonSecretTree === null) {
9313
- const tree = new Map(secretTreeFromSchema(this.globalSettingsSchema()));
9497
+ const tree = /* @__PURE__ */ new Map();
9314
9498
  for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
9315
9499
  this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
9316
9500
  }
@@ -9522,47 +9706,6 @@ function classifyStoreError(err) {
9522
9706
  if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
9523
9707
  return "permanent";
9524
9708
  }
9525
- /**
9526
- * Collect the keys of every field marked `perNode: true`, recursing into
9527
- * layout containers (`group` fields and `sub-tabs` tabs) the same way
9528
- * `hydrateSchema` does. Valueless structural fields (separator/info/…)
9529
- * don't declare `perNode` and are excluded by the `in` narrowing.
9530
- */
9531
- /**
9532
- * The same fields with every `perNode: true` one removed, recursing into layout
9533
- * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
9534
- * with no child is dropped rather than rendered empty.
9535
- *
9536
- * Used by `getIntegrationSettings`: an integration is not a node, so a field
9537
- * whose store key is `<key>@<nodeId>` has no node to belong to there.
9538
- */
9539
- function dropPerNodeFields(fields) {
9540
- const kept = [];
9541
- for (const field of fields) {
9542
- if (field.type === "group") {
9543
- const inner = dropPerNodeFields(field.fields);
9544
- if (inner.length > 0) kept.push({
9545
- ...field,
9546
- fields: inner
9547
- });
9548
- continue;
9549
- }
9550
- if (field.type === "sub-tabs") {
9551
- const tabs = field.tabs.map((tab) => ({
9552
- ...tab,
9553
- fields: dropPerNodeFields(tab.fields)
9554
- })).filter((tab) => tab.fields.length > 0);
9555
- if (tabs.length > 0) kept.push({
9556
- ...field,
9557
- tabs
9558
- });
9559
- continue;
9560
- }
9561
- if ("perNode" in field && field.perNode === true) continue;
9562
- kept.push(field);
9563
- }
9564
- return kept;
9565
- }
9566
9709
  /** The keys of the value-holding fields, recursing into layout containers. */
9567
9710
  function collectValueFieldKeys(fields) {
9568
9711
  const collected = [];
@@ -9595,21 +9738,6 @@ function collectFieldKeys(fields) {
9595
9738
  }
9596
9739
  return collected;
9597
9740
  }
9598
- function collectPerNodeFieldKeys(fields) {
9599
- const collected = [];
9600
- for (const field of fields) {
9601
- if (field.type === "group") {
9602
- collected.push(...collectPerNodeFieldKeys(field.fields));
9603
- continue;
9604
- }
9605
- if (field.type === "sub-tabs") {
9606
- for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
9607
- continue;
9608
- }
9609
- if ("perNode" in field && field.perNode === true) collected.push(field.key);
9610
- }
9611
- return collected;
9612
- }
9613
9741
  /**
9614
9742
  * Normalize an `ICamstackAddon.initialize()` return value into the
9615
9743
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
@@ -10645,7 +10773,6 @@ var CAP_NAMES = Object.freeze([
10645
10773
  "notifier",
10646
10774
  "numeric-sensor",
10647
10775
  "oauth-integration",
10648
- "oidc-connections",
10649
10776
  "osd",
10650
10777
  "osd-manager",
10651
10778
  "pet-feeder",
@@ -12352,13 +12479,25 @@ Object.freeze({
12352
12479
  "path": "temperature",
12353
12480
  "valueType": "number"
12354
12481
  }],
12355
- "timed-run": [{
12356
- "path": "activeUntil",
12357
- "valueType": "number"
12358
- }, {
12359
- "path": "requestedBy",
12360
- "valueType": "string"
12361
- }],
12482
+ "timed-run": [
12483
+ {
12484
+ "path": "activeUntil",
12485
+ "valueType": "number"
12486
+ },
12487
+ {
12488
+ "path": "requestedBy",
12489
+ "valueType": "string"
12490
+ },
12491
+ {
12492
+ "path": "quickRun.duration",
12493
+ "valueType": "number"
12494
+ },
12495
+ {
12496
+ "path": "quickRun.unit",
12497
+ "valueType": "enum",
12498
+ "enumValues": ["s", "min"]
12499
+ }
12500
+ ],
12362
12501
  "update": [
12363
12502
  {
12364
12503
  "path": "currentVersion",
@@ -12537,8 +12676,7 @@ Object.freeze({
12537
12676
  "device-provider": { "reloadDevice": 18e4 },
12538
12677
  "llm": {
12539
12678
  "generate": 6e5,
12540
- "generateVision": 6e5,
12541
- "testProfile": 6e5
12679
+ "generateVision": 6e5
12542
12680
  },
12543
12681
  "llm-runtime": {
12544
12682
  "complete": 6e5,
@@ -12583,7 +12721,7 @@ object({
12583
12721
  params: record(string(), union([string(), number()])).optional()
12584
12722
  });
12585
12723
  //#endregion
12586
- //#region ../types/dist/composition-BmBHuDTQ.mjs
12724
+ //#region ../types/dist/composition-Bx0JvKUU.mjs
12587
12725
  /**
12588
12726
  * The ffmpeg build every CamStack node downloads, per platform and arch.
12589
12727
  *
@@ -13745,6 +13883,387 @@ var NodeColorIdSchema = _enum([
13745
13883
  "node-h"
13746
13884
  ]);
13747
13885
  //#endregion
13886
+ //#region ../types/dist/convert-BAzH15HU.mjs
13887
+ /**
13888
+ * Frozen unit → spec table. `•` in the doc marks each dimension's canonical
13889
+ * unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
13890
+ * `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
13891
+ * decimals). K derives from `°C = K − 273.15`.
13892
+ */
13893
+ var UNIT_TABLE = {
13894
+ "°C": {
13895
+ dimension: "temperature",
13896
+ factor: 1,
13897
+ offset: 0
13898
+ },
13899
+ "°F": {
13900
+ dimension: "temperature",
13901
+ factor: 5 / 9,
13902
+ offset: -160 / 9
13903
+ },
13904
+ K: {
13905
+ dimension: "temperature",
13906
+ factor: 1,
13907
+ offset: -273.15
13908
+ },
13909
+ hPa: {
13910
+ dimension: "pressure",
13911
+ factor: 1,
13912
+ offset: 0
13913
+ },
13914
+ kPa: {
13915
+ dimension: "pressure",
13916
+ factor: 10,
13917
+ offset: 0
13918
+ },
13919
+ Pa: {
13920
+ dimension: "pressure",
13921
+ factor: .01,
13922
+ offset: 0
13923
+ },
13924
+ mbar: {
13925
+ dimension: "pressure",
13926
+ factor: 1,
13927
+ offset: 0
13928
+ },
13929
+ bar: {
13930
+ dimension: "pressure",
13931
+ factor: 1e3,
13932
+ offset: 0
13933
+ },
13934
+ inHg: {
13935
+ dimension: "pressure",
13936
+ factor: 33.8639,
13937
+ offset: 0
13938
+ },
13939
+ mmHg: {
13940
+ dimension: "pressure",
13941
+ factor: 1.33322,
13942
+ offset: 0
13943
+ },
13944
+ psi: {
13945
+ dimension: "pressure",
13946
+ factor: 68.9476,
13947
+ offset: 0
13948
+ },
13949
+ "m/s": {
13950
+ dimension: "speed",
13951
+ factor: 1,
13952
+ offset: 0
13953
+ },
13954
+ "km/h": {
13955
+ dimension: "speed",
13956
+ factor: 1 / 3.6,
13957
+ offset: 0
13958
+ },
13959
+ mph: {
13960
+ dimension: "speed",
13961
+ factor: .44704,
13962
+ offset: 0
13963
+ },
13964
+ kn: {
13965
+ dimension: "speed",
13966
+ factor: .514444,
13967
+ offset: 0
13968
+ },
13969
+ "mm/h": {
13970
+ dimension: "precipitation-rate",
13971
+ factor: 1,
13972
+ offset: 0
13973
+ },
13974
+ "in/h": {
13975
+ dimension: "precipitation-rate",
13976
+ factor: 25.4,
13977
+ offset: 0
13978
+ },
13979
+ m: {
13980
+ dimension: "length",
13981
+ factor: 1,
13982
+ offset: 0
13983
+ },
13984
+ mm: {
13985
+ dimension: "length",
13986
+ factor: .001,
13987
+ offset: 0
13988
+ },
13989
+ cm: {
13990
+ dimension: "length",
13991
+ factor: .01,
13992
+ offset: 0
13993
+ },
13994
+ km: {
13995
+ dimension: "length",
13996
+ factor: 1e3,
13997
+ offset: 0
13998
+ },
13999
+ in: {
14000
+ dimension: "length",
14001
+ factor: .0254,
14002
+ offset: 0
14003
+ },
14004
+ ft: {
14005
+ dimension: "length",
14006
+ factor: .3048,
14007
+ offset: 0
14008
+ },
14009
+ mi: {
14010
+ dimension: "length",
14011
+ factor: 1609.344,
14012
+ offset: 0
14013
+ },
14014
+ "m²": {
14015
+ dimension: "area",
14016
+ factor: 1,
14017
+ offset: 0
14018
+ },
14019
+ lx: {
14020
+ dimension: "illuminance",
14021
+ factor: 1,
14022
+ offset: 0
14023
+ },
14024
+ "W/m²": {
14025
+ dimension: "irradiance",
14026
+ factor: 1,
14027
+ offset: 0
14028
+ },
14029
+ W: {
14030
+ dimension: "power",
14031
+ factor: 1,
14032
+ offset: 0
14033
+ },
14034
+ kW: {
14035
+ dimension: "power",
14036
+ factor: 1e3,
14037
+ offset: 0
14038
+ },
14039
+ VA: {
14040
+ dimension: "apparent-power",
14041
+ factor: 1,
14042
+ offset: 0
14043
+ },
14044
+ Wh: {
14045
+ dimension: "energy",
14046
+ factor: 1,
14047
+ offset: 0
14048
+ },
14049
+ kWh: {
14050
+ dimension: "energy",
14051
+ factor: 1e3,
14052
+ offset: 0
14053
+ },
14054
+ MWh: {
14055
+ dimension: "energy",
14056
+ factor: 1e6,
14057
+ offset: 0
14058
+ },
14059
+ V: {
14060
+ dimension: "voltage",
14061
+ factor: 1,
14062
+ offset: 0
14063
+ },
14064
+ mV: {
14065
+ dimension: "voltage",
14066
+ factor: .001,
14067
+ offset: 0
14068
+ },
14069
+ A: {
14070
+ dimension: "current",
14071
+ factor: 1,
14072
+ offset: 0
14073
+ },
14074
+ mA: {
14075
+ dimension: "current",
14076
+ factor: .001,
14077
+ offset: 0
14078
+ },
14079
+ ppm: {
14080
+ dimension: "concentration-volume",
14081
+ factor: 1,
14082
+ offset: 0
14083
+ },
14084
+ ppb: {
14085
+ dimension: "concentration-volume",
14086
+ factor: .001,
14087
+ offset: 0
14088
+ },
14089
+ "µg/m³": {
14090
+ dimension: "concentration-mass",
14091
+ factor: 1,
14092
+ offset: 0
14093
+ },
14094
+ "mg/m³": {
14095
+ dimension: "concentration-mass",
14096
+ factor: 1e3,
14097
+ offset: 0
14098
+ },
14099
+ kg: {
14100
+ dimension: "mass",
14101
+ factor: 1,
14102
+ offset: 0
14103
+ },
14104
+ g: {
14105
+ dimension: "mass",
14106
+ factor: .001,
14107
+ offset: 0
14108
+ },
14109
+ lb: {
14110
+ dimension: "mass",
14111
+ factor: .453592,
14112
+ offset: 0
14113
+ },
14114
+ oz: {
14115
+ dimension: "mass",
14116
+ factor: .0283495,
14117
+ offset: 0
14118
+ },
14119
+ "%": {
14120
+ dimension: "percentage",
14121
+ factor: 1,
14122
+ offset: 0
14123
+ },
14124
+ L: {
14125
+ dimension: "volume",
14126
+ factor: 1,
14127
+ offset: 0
14128
+ },
14129
+ mL: {
14130
+ dimension: "volume",
14131
+ factor: .001,
14132
+ offset: 0
14133
+ },
14134
+ gal: {
14135
+ dimension: "volume",
14136
+ factor: 3.785411784,
14137
+ offset: 0
14138
+ },
14139
+ s: {
14140
+ dimension: "duration",
14141
+ factor: 1,
14142
+ offset: 0
14143
+ },
14144
+ ms: {
14145
+ dimension: "duration",
14146
+ factor: .001,
14147
+ offset: 0
14148
+ },
14149
+ min: {
14150
+ dimension: "duration",
14151
+ factor: 60,
14152
+ offset: 0
14153
+ },
14154
+ h: {
14155
+ dimension: "duration",
14156
+ factor: 3600,
14157
+ offset: 0
14158
+ },
14159
+ d: {
14160
+ dimension: "duration",
14161
+ factor: 86400,
14162
+ offset: 0
14163
+ },
14164
+ B: {
14165
+ dimension: "information",
14166
+ factor: 1,
14167
+ offset: 0
14168
+ },
14169
+ KiB: {
14170
+ dimension: "information",
14171
+ factor: 1024,
14172
+ offset: 0
14173
+ },
14174
+ MiB: {
14175
+ dimension: "information",
14176
+ factor: 1024 ** 2,
14177
+ offset: 0
14178
+ },
14179
+ GiB: {
14180
+ dimension: "information",
14181
+ factor: 1024 ** 3,
14182
+ offset: 0
14183
+ },
14184
+ TiB: {
14185
+ dimension: "information",
14186
+ factor: 1024 ** 4,
14187
+ offset: 0
14188
+ },
14189
+ kB: {
14190
+ dimension: "information",
14191
+ factor: 1e3,
14192
+ offset: 0
14193
+ },
14194
+ MB: {
14195
+ dimension: "information",
14196
+ factor: 1e6,
14197
+ offset: 0
14198
+ },
14199
+ GB: {
14200
+ dimension: "information",
14201
+ factor: 1e9,
14202
+ offset: 0
14203
+ },
14204
+ "°": {
14205
+ dimension: "angle",
14206
+ factor: 1,
14207
+ offset: 0
14208
+ },
14209
+ dBFS: {
14210
+ dimension: "sound-level",
14211
+ factor: 1,
14212
+ offset: 0
14213
+ },
14214
+ dBm: {
14215
+ dimension: "signal-level",
14216
+ factor: 1,
14217
+ offset: 0
14218
+ },
14219
+ mired: {
14220
+ dimension: "colour-temperature",
14221
+ factor: 1,
14222
+ offset: 0
14223
+ },
14224
+ kbps: {
14225
+ dimension: "bitrate",
14226
+ factor: 1,
14227
+ offset: 0
14228
+ },
14229
+ Mbps: {
14230
+ dimension: "bitrate",
14231
+ factor: 1e3,
14232
+ offset: 0
14233
+ },
14234
+ fps: {
14235
+ dimension: "rate",
14236
+ factor: 1,
14237
+ offset: 0
14238
+ }
14239
+ };
14240
+ /** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
14241
+ function specFor(unit) {
14242
+ return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
14243
+ }
14244
+ /** Value in `spec`'s unit → its dimension's canonical unit. */
14245
+ function toCanonical(value, spec) {
14246
+ return value * spec.factor + spec.offset;
14247
+ }
14248
+ /** Canonical-unit value → the unit described by `spec`. */
14249
+ function fromCanonical(canonical, spec) {
14250
+ return (canonical - spec.offset) / spec.factor;
14251
+ }
14252
+ /**
14253
+ * Graceful variant for the render path: returns the converted value, or
14254
+ * `undefined` when the conversion is refused (unknown unit / cross-dimension).
14255
+ * Never throws — a render caller falls back to the raw value + source unit.
14256
+ */
14257
+ function tryConvertUnit(value, from, to) {
14258
+ if (from === to) return value;
14259
+ const fromSpec = specFor(from);
14260
+ if (!fromSpec) return void 0;
14261
+ const toSpec = specFor(to);
14262
+ if (!toSpec) return void 0;
14263
+ if (fromSpec.dimension !== toSpec.dimension) return void 0;
14264
+ return fromCanonical(toCanonical(value, fromSpec), toSpec);
14265
+ }
14266
+ //#endregion
13748
14267
  //#region ../types/dist/index.mjs
13749
14268
  var SMTP_INBOUND_DEFAULT_PORT = 2525;
13750
14269
  var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
@@ -14058,17 +14577,18 @@ function buildCapturingReply(envelope) {
14058
14577
  * message to what the kind supports — callers never special-case a service.
14059
14578
  *
14060
14579
  * DESIGN DECISIONS (locked):
14061
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14062
- * `setTargetEnabled`), each provider persisting via the `settings-store`
14063
- * cap. Rationale: the admin UI needs one uniform surface across the
14064
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14065
- * alternative would fork the UI per addon and cannot host the
14066
- * discovery→adopt flow.
14067
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14068
- * the generated cap-mount auto-`concatCollection`-fans them across every
14069
- * registered provider (notifiers addon + HA addon) so one catalog is
14070
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14071
- * `addonId` the generated collection router extracts from the call input.
14580
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14581
+ * providers serve their targets as `integration-instances` records, one
14582
+ * record kind per target kind, and the admin lists, adds, edits, switches
14583
+ * and deletes them through that cap. This cap keeps what an instance cannot
14584
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14585
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14586
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14587
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14588
+ * cap-mount auto-`concatCollection`-fans them across every registered
14589
+ * provider so one catalog is routable. `send` / `testTarget` /
14590
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14591
+ * collection router extracts from the call input.
14072
14592
  * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14073
14593
  * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14074
14594
  * `storage` / `storage-provider` / `recording` caps over the same path. No
@@ -14313,7 +14833,7 @@ var TargetKindCapsSchema = object({
14313
14833
  * the union is large and not meant for runtime validation here; the exported
14314
14834
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14315
14835
  */
14316
- var ConfigSchemaPassthrough$4 = unknown();
14836
+ var ConfigSchemaPassthrough$3 = unknown();
14317
14837
  var TargetKindSchema = object({
14318
14838
  kind: string(),
14319
14839
  label: string(),
@@ -14350,7 +14870,7 @@ var TargetKindSchema = object({
14350
14870
  * its raster path, which is the safe default for an unknown image.
14351
14871
  */
14352
14872
  iconMediaType: string().optional(),
14353
- configSchema: ConfigSchemaPassthrough$4,
14873
+ configSchema: ConfigSchemaPassthrough$3,
14354
14874
  /**
14355
14875
  * The config keys that decide WHERE this kind's secrets are sent (server,
14356
14876
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -14372,9 +14892,11 @@ var TargetKindSchema = object({
14372
14892
  caps: TargetKindCapsSchema
14373
14893
  });
14374
14894
  /**
14375
- * A persisted target. `config` holds secrets; providers REDACT secret fields
14376
- * (return a presence marker only) when serving `listTargets` — never
14377
- * round-trip a stored secret to the UI.
14895
+ * A target as a provider's own code sees it (the notification-center bridge, the
14896
+ * send path): the flat record body split into the name, the switch and the
14897
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14898
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14899
+ * secret to the UI.
14378
14900
  */
14379
14901
  var TargetSchema = object({
14380
14902
  id: string(),
@@ -14417,13 +14939,13 @@ var ProbeTargetConfigResultSchema = object({
14417
14939
  stateInstance: string().optional(),
14418
14940
  error: string().optional()
14419
14941
  });
14420
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14942
+ method(object({}), array(TargetKindSchema)), method(object({
14421
14943
  kind: string(),
14422
14944
  config: record(string(), unknown()).optional(),
14423
14945
  /**
14424
14946
  * When editing / duplicating, the blank password field never round-trips
14425
14947
  * the stored token. Pass the source target id so the provider can restore
14426
- * secrets server-side before dialling (same merge as upsert).
14948
+ * secrets server-side before dialling.
14427
14949
  */
14428
14950
  targetId: string().optional()
14429
14951
  }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
@@ -14446,27 +14968,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
14446
14968
  }), TestResultSchema, {
14447
14969
  kind: "mutation",
14448
14970
  auth: "admin"
14449
- }), method(object({
14450
- target: TargetSchema,
14451
- /**
14452
- * Duplicate flow: create a NEW target id while copying secrets from an
14453
- * existing row. The UI never holds the stored token; blank / redacted
14454
- * password fields are restored from this source (D634 still applies if
14455
- * destinations diverge without a re-typed secret).
14456
- */
14457
- cloneSecretsFrom: string().optional()
14458
- }), TargetSchema, {
14459
- kind: "mutation",
14460
- auth: "admin"
14461
- }), method(object({ targetId: string() }), _void(), {
14462
- kind: "mutation",
14463
- auth: "admin"
14464
- }), method(object({
14465
- targetId: string(),
14466
- enabled: boolean()
14467
- }), _void(), {
14468
- kind: "mutation",
14469
- auth: "admin"
14470
14971
  });
14471
14972
  looseObject({
14472
14973
  name: string().min(1),
@@ -22741,7 +23242,6 @@ var SYSTEM_CAP_VOCABULARY = {
22741
23242
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
22742
23243
  "notification-rules": system("notification rules — authored on their own page"),
22743
23244
  "oauth-integration": system(IDENTITY),
22744
- "oidc-connections": system(IDENTITY),
22745
23245
  "osd-manager": system(PIPELINE),
22746
23246
  "pipeline-executor": system(PIPELINE),
22747
23247
  "pipeline-orchestrator": system(PIPELINE),
@@ -42762,6 +43262,7 @@ var ExpressionBindingSourceSchema = union([
42762
43262
  object({
42763
43263
  kind: literal("global"),
42764
43264
  sourceStableId: string(),
43265
+ addonId: string().optional(),
42765
43266
  cap: string(),
42766
43267
  fieldPath: string()
42767
43268
  })
@@ -42828,385 +43329,6 @@ var SourceInfoSchema = object({
42828
43329
  raw: record(string(), unknown()).optional()
42829
43330
  });
42830
43331
  /**
42831
- * Frozen unit → spec table. `•` in the doc marks each dimension's canonical
42832
- * unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
42833
- * `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
42834
- * decimals). K derives from `°C = K − 273.15`.
42835
- */
42836
- var UNIT_TABLE = {
42837
- "°C": {
42838
- dimension: "temperature",
42839
- factor: 1,
42840
- offset: 0
42841
- },
42842
- "°F": {
42843
- dimension: "temperature",
42844
- factor: 5 / 9,
42845
- offset: -160 / 9
42846
- },
42847
- K: {
42848
- dimension: "temperature",
42849
- factor: 1,
42850
- offset: -273.15
42851
- },
42852
- hPa: {
42853
- dimension: "pressure",
42854
- factor: 1,
42855
- offset: 0
42856
- },
42857
- kPa: {
42858
- dimension: "pressure",
42859
- factor: 10,
42860
- offset: 0
42861
- },
42862
- Pa: {
42863
- dimension: "pressure",
42864
- factor: .01,
42865
- offset: 0
42866
- },
42867
- mbar: {
42868
- dimension: "pressure",
42869
- factor: 1,
42870
- offset: 0
42871
- },
42872
- bar: {
42873
- dimension: "pressure",
42874
- factor: 1e3,
42875
- offset: 0
42876
- },
42877
- inHg: {
42878
- dimension: "pressure",
42879
- factor: 33.8639,
42880
- offset: 0
42881
- },
42882
- mmHg: {
42883
- dimension: "pressure",
42884
- factor: 1.33322,
42885
- offset: 0
42886
- },
42887
- psi: {
42888
- dimension: "pressure",
42889
- factor: 68.9476,
42890
- offset: 0
42891
- },
42892
- "m/s": {
42893
- dimension: "speed",
42894
- factor: 1,
42895
- offset: 0
42896
- },
42897
- "km/h": {
42898
- dimension: "speed",
42899
- factor: 1 / 3.6,
42900
- offset: 0
42901
- },
42902
- mph: {
42903
- dimension: "speed",
42904
- factor: .44704,
42905
- offset: 0
42906
- },
42907
- kn: {
42908
- dimension: "speed",
42909
- factor: .514444,
42910
- offset: 0
42911
- },
42912
- "mm/h": {
42913
- dimension: "precipitation-rate",
42914
- factor: 1,
42915
- offset: 0
42916
- },
42917
- "in/h": {
42918
- dimension: "precipitation-rate",
42919
- factor: 25.4,
42920
- offset: 0
42921
- },
42922
- m: {
42923
- dimension: "length",
42924
- factor: 1,
42925
- offset: 0
42926
- },
42927
- mm: {
42928
- dimension: "length",
42929
- factor: .001,
42930
- offset: 0
42931
- },
42932
- cm: {
42933
- dimension: "length",
42934
- factor: .01,
42935
- offset: 0
42936
- },
42937
- km: {
42938
- dimension: "length",
42939
- factor: 1e3,
42940
- offset: 0
42941
- },
42942
- in: {
42943
- dimension: "length",
42944
- factor: .0254,
42945
- offset: 0
42946
- },
42947
- ft: {
42948
- dimension: "length",
42949
- factor: .3048,
42950
- offset: 0
42951
- },
42952
- mi: {
42953
- dimension: "length",
42954
- factor: 1609.344,
42955
- offset: 0
42956
- },
42957
- "m²": {
42958
- dimension: "area",
42959
- factor: 1,
42960
- offset: 0
42961
- },
42962
- lx: {
42963
- dimension: "illuminance",
42964
- factor: 1,
42965
- offset: 0
42966
- },
42967
- "W/m²": {
42968
- dimension: "irradiance",
42969
- factor: 1,
42970
- offset: 0
42971
- },
42972
- W: {
42973
- dimension: "power",
42974
- factor: 1,
42975
- offset: 0
42976
- },
42977
- kW: {
42978
- dimension: "power",
42979
- factor: 1e3,
42980
- offset: 0
42981
- },
42982
- VA: {
42983
- dimension: "apparent-power",
42984
- factor: 1,
42985
- offset: 0
42986
- },
42987
- Wh: {
42988
- dimension: "energy",
42989
- factor: 1,
42990
- offset: 0
42991
- },
42992
- kWh: {
42993
- dimension: "energy",
42994
- factor: 1e3,
42995
- offset: 0
42996
- },
42997
- MWh: {
42998
- dimension: "energy",
42999
- factor: 1e6,
43000
- offset: 0
43001
- },
43002
- V: {
43003
- dimension: "voltage",
43004
- factor: 1,
43005
- offset: 0
43006
- },
43007
- mV: {
43008
- dimension: "voltage",
43009
- factor: .001,
43010
- offset: 0
43011
- },
43012
- A: {
43013
- dimension: "current",
43014
- factor: 1,
43015
- offset: 0
43016
- },
43017
- mA: {
43018
- dimension: "current",
43019
- factor: .001,
43020
- offset: 0
43021
- },
43022
- ppm: {
43023
- dimension: "concentration-volume",
43024
- factor: 1,
43025
- offset: 0
43026
- },
43027
- ppb: {
43028
- dimension: "concentration-volume",
43029
- factor: .001,
43030
- offset: 0
43031
- },
43032
- "µg/m³": {
43033
- dimension: "concentration-mass",
43034
- factor: 1,
43035
- offset: 0
43036
- },
43037
- "mg/m³": {
43038
- dimension: "concentration-mass",
43039
- factor: 1e3,
43040
- offset: 0
43041
- },
43042
- kg: {
43043
- dimension: "mass",
43044
- factor: 1,
43045
- offset: 0
43046
- },
43047
- g: {
43048
- dimension: "mass",
43049
- factor: .001,
43050
- offset: 0
43051
- },
43052
- lb: {
43053
- dimension: "mass",
43054
- factor: .453592,
43055
- offset: 0
43056
- },
43057
- oz: {
43058
- dimension: "mass",
43059
- factor: .0283495,
43060
- offset: 0
43061
- },
43062
- "%": {
43063
- dimension: "percentage",
43064
- factor: 1,
43065
- offset: 0
43066
- },
43067
- L: {
43068
- dimension: "volume",
43069
- factor: 1,
43070
- offset: 0
43071
- },
43072
- mL: {
43073
- dimension: "volume",
43074
- factor: .001,
43075
- offset: 0
43076
- },
43077
- gal: {
43078
- dimension: "volume",
43079
- factor: 3.785411784,
43080
- offset: 0
43081
- },
43082
- s: {
43083
- dimension: "duration",
43084
- factor: 1,
43085
- offset: 0
43086
- },
43087
- ms: {
43088
- dimension: "duration",
43089
- factor: .001,
43090
- offset: 0
43091
- },
43092
- min: {
43093
- dimension: "duration",
43094
- factor: 60,
43095
- offset: 0
43096
- },
43097
- h: {
43098
- dimension: "duration",
43099
- factor: 3600,
43100
- offset: 0
43101
- },
43102
- d: {
43103
- dimension: "duration",
43104
- factor: 86400,
43105
- offset: 0
43106
- },
43107
- B: {
43108
- dimension: "information",
43109
- factor: 1,
43110
- offset: 0
43111
- },
43112
- KiB: {
43113
- dimension: "information",
43114
- factor: 1024,
43115
- offset: 0
43116
- },
43117
- MiB: {
43118
- dimension: "information",
43119
- factor: 1024 ** 2,
43120
- offset: 0
43121
- },
43122
- GiB: {
43123
- dimension: "information",
43124
- factor: 1024 ** 3,
43125
- offset: 0
43126
- },
43127
- TiB: {
43128
- dimension: "information",
43129
- factor: 1024 ** 4,
43130
- offset: 0
43131
- },
43132
- kB: {
43133
- dimension: "information",
43134
- factor: 1e3,
43135
- offset: 0
43136
- },
43137
- MB: {
43138
- dimension: "information",
43139
- factor: 1e6,
43140
- offset: 0
43141
- },
43142
- GB: {
43143
- dimension: "information",
43144
- factor: 1e9,
43145
- offset: 0
43146
- },
43147
- "°": {
43148
- dimension: "angle",
43149
- factor: 1,
43150
- offset: 0
43151
- },
43152
- dBFS: {
43153
- dimension: "sound-level",
43154
- factor: 1,
43155
- offset: 0
43156
- },
43157
- dBm: {
43158
- dimension: "signal-level",
43159
- factor: 1,
43160
- offset: 0
43161
- },
43162
- mired: {
43163
- dimension: "colour-temperature",
43164
- factor: 1,
43165
- offset: 0
43166
- },
43167
- kbps: {
43168
- dimension: "bitrate",
43169
- factor: 1,
43170
- offset: 0
43171
- },
43172
- Mbps: {
43173
- dimension: "bitrate",
43174
- factor: 1e3,
43175
- offset: 0
43176
- },
43177
- fps: {
43178
- dimension: "rate",
43179
- factor: 1,
43180
- offset: 0
43181
- }
43182
- };
43183
- /** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
43184
- function specFor(unit) {
43185
- return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
43186
- }
43187
- /** Value in `spec`'s unit → its dimension's canonical unit. */
43188
- function toCanonical(value, spec) {
43189
- return value * spec.factor + spec.offset;
43190
- }
43191
- /** Canonical-unit value → the unit described by `spec`. */
43192
- function fromCanonical(canonical, spec) {
43193
- return (canonical - spec.offset) / spec.factor;
43194
- }
43195
- /**
43196
- * Graceful variant for the render path: returns the converted value, or
43197
- * `undefined` when the conversion is refused (unknown unit / cross-dimension).
43198
- * Never throws — a render caller falls back to the raw value + source unit.
43199
- */
43200
- function tryConvertUnit(value, from, to) {
43201
- if (from === to) return value;
43202
- const fromSpec = specFor(from);
43203
- if (!fromSpec) return void 0;
43204
- const toSpec = specFor(to);
43205
- if (!toSpec) return void 0;
43206
- if (fromSpec.dimension !== toSpec.dimension) return void 0;
43207
- return fromCanonical(toCanonical(value, fromSpec), toSpec);
43208
- }
43209
- /**
43210
43332
  * A number a person types for a physical quantity — the input side of the
43211
43333
  * value + unit contract (D972).
43212
43334
  *
@@ -44985,15 +45107,28 @@ var SettingsSchemaWithValuesSchema = object({
44985
45107
  });
44986
45108
  /** Patch object — keys are field names, values are the new field values. */
44987
45109
  var SettingsPatchSchema = record(string(), unknown());
45110
+ /** The scope of a scoped-settings call (D986): where the capability declared the values. */
45111
+ var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
45112
+ /** One scoped schema an addon serves: its capability, scope and section ids. */
45113
+ var ScopedSettingsDeclarationSchema = object({
45114
+ cap: string(),
45115
+ scope: ScopedSettingsScopeSchema,
45116
+ sectionIds: array(string())
45117
+ });
44988
45118
  /** Standard success response for update operations. */
44989
45119
  var SettingsUpdateResultSchema = object({ success: literal(true) });
44990
45120
  method(object({
44991
45121
  addonId: string(),
44992
- nodeId: string().optional(),
44993
- overlay: record(string(), unknown()).optional(),
44994
- cap: string().optional()
45122
+ cap: string(),
45123
+ scope: ScopedSettingsScopeSchema,
45124
+ nodeId: string().optional()
44995
45125
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
44996
45126
  addonId: string(),
45127
+ nodeId: string().optional()
45128
+ }), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
45129
+ addonId: string(),
45130
+ cap: string(),
45131
+ scope: ScopedSettingsScopeSchema,
44997
45132
  nodeId: string().optional(),
44998
45133
  patch: SettingsPatchSchema
44999
45134
  }), SettingsUpdateResultSchema, {
@@ -45001,8 +45136,10 @@ method(object({
45001
45136
  auth: "admin"
45002
45137
  }), method(object({
45003
45138
  addonId: string(),
45139
+ cap: string(),
45140
+ scope: ScopedSettingsScopeSchema,
45004
45141
  nodeId: string().optional()
45005
- }), SettingsSchemaWithValuesSchema.nullable()), method(object({
45142
+ }), record(string(), unknown()).nullable()), method(object({
45006
45143
  addonId: string(),
45007
45144
  nodeId: string().optional(),
45008
45145
  instance: IntegrationInstanceRefSchema
@@ -46342,7 +46479,7 @@ var BackupDestinationInfoSchema = object({
46342
46479
  id: string(),
46343
46480
  /**
46344
46481
  * Manifest id of the owning addon. The Settings button on the
46345
- * destination card opens that addon's `globalSettingsSchema` panel.
46482
+ * destination card opens that addon's scoped settings panel.
46346
46483
  */
46347
46484
  addonId: string(),
46348
46485
  /** Operator-toggled enable flag from the destination-policy table. */
@@ -50845,6 +50982,7 @@ var deviceExportCapability = {
50845
50982
  })
50846
50983
  }
50847
50984
  };
50985
+ var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
50848
50986
  /**
50849
50987
  * A SITE ZONE — a named part of the property that several locations belong to.
50850
50988
  *
@@ -51238,6 +51376,12 @@ var DeviceInfoSchema = object({
51238
51376
  addonId: string(),
51239
51377
  type: _enum(DeviceType),
51240
51378
  name: string(),
51379
+ /** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
51380
+ * entity_id style. Generated once from the name at first registration, unique
51381
+ * cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
51382
+ * Optional: a record produced by an older build omits it until the boot
51383
+ * backfill has run. */
51384
+ alias: DeviceAliasSchema.optional(),
51241
51385
  /** Operator-organisational location label. `null` when unset. */
51242
51386
  location: string().nullable(),
51243
51387
  /** Soft-disabled flag. */
@@ -51557,6 +51701,25 @@ method(object({
51557
51701
  }), _void(), {
51558
51702
  kind: "mutation",
51559
51703
  auth: "admin"
51704
+ }), method(object({
51705
+ deviceId: number(),
51706
+ alias: string()
51707
+ }), discriminatedUnion("ok", [object({
51708
+ ok: literal(true),
51709
+ alias: DeviceAliasSchema
51710
+ }), object({
51711
+ ok: literal(false),
51712
+ reason: _enum([
51713
+ "empty",
51714
+ "too-long",
51715
+ "grammar",
51716
+ "reserved",
51717
+ "taken"
51718
+ ]),
51719
+ takenBy: number().optional()
51720
+ })]), {
51721
+ kind: "mutation",
51722
+ auth: "admin"
51560
51723
  }), method(object({
51561
51724
  deviceId: number(),
51562
51725
  location: string().nullable()
@@ -54582,7 +54745,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54582
54745
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
54583
54746
  * clears it.
54584
54747
  */
54585
- var ConfigSchemaPassthrough$3 = custom();
54748
+ var ConfigSchemaPassthrough$2 = custom();
54586
54749
  var IntegrationInstanceIdSchema = string().min(1);
54587
54750
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54588
54751
  /**
@@ -54628,7 +54791,16 @@ var IntegrationInstanceKindSchema = object({
54628
54791
  /** Relative hub path to start an interactive account link of an instance of this kind. */
54629
54792
  connectPath: string().min(1).optional(),
54630
54793
  /** Relative hub path to disconnect that account. */
54631
- disconnectPath: string().min(1).optional()
54794
+ disconnectPath: string().min(1).optional(),
54795
+ /**
54796
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
54797
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
54798
+ * `connection` widgets write connection values, `model` widgets own the model choice.
54799
+ */
54800
+ widgets: array(object({
54801
+ id: string().min(1),
54802
+ placement: _enum(["connection", "model"])
54803
+ })).optional()
54632
54804
  });
54633
54805
  /**
54634
54806
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -54733,7 +54905,7 @@ var integrationInstancesCapability = {
54733
54905
  id: IntegrationInstanceIdSchema.nullable(),
54734
54906
  /** The kind of the create form (`id: null`) of a provider with several. */
54735
54907
  kind: string().min(1).optional()
54736
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
54908
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
54737
54909
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
54738
54910
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
54739
54911
  /**
@@ -55684,12 +55856,12 @@ var LlmModelInfoSchema = object({
55684
55856
  });
55685
55857
  /**
55686
55858
  * The provider-specific part of a profile, validated by the provider that owns
55687
- * the kind (`upsertProfile` refuses what it does not accept). A field its
55859
+ * the kind (saving an instance refuses what it does not accept). A field its
55688
55860
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
55689
55861
  * keychain, never in the row, and reads back as the redaction marker.
55690
55862
  */
55691
55863
  var LlmProviderConfigSchema = record(string(), unknown());
55692
- var LlmProfileSchema = object({
55864
+ object({
55693
55865
  id: string(),
55694
55866
  name: string(),
55695
55867
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -55783,8 +55955,8 @@ var LlmProviderWidgetSchema = object({
55783
55955
  /** ConfigUISchema tree passed through untyped on the wire (the
55784
55956
  * notification-output `ConfigSchemaPassthrough` precedent at
55785
55957
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
55786
- var ConfigSchemaPassthrough$2 = unknown();
55787
- var LlmProfileKindDescriptorSchema = object({
55958
+ var ConfigSchemaPassthrough$1 = unknown();
55959
+ object({
55788
55960
  kind: LlmProfileKindSchema,
55789
55961
  label: string(),
55790
55962
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -55792,9 +55964,9 @@ var LlmProfileKindDescriptorSchema = object({
55792
55964
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
55793
55965
  addonId: string(),
55794
55966
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
55795
- connectionSchema: ConfigSchemaPassthrough$2,
55967
+ connectionSchema: ConfigSchemaPassthrough$1,
55796
55968
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
55797
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
55969
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
55798
55970
  /** The kind's defaults; a model from `listModels` may override any of them. */
55799
55971
  features: LlmModelFeaturesSchema,
55800
55972
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -55923,20 +56095,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
55923
56095
  }), method(object({
55924
56096
  addonId: string().optional(),
55925
56097
  requestId: string()
55926
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
55927
- kind: "mutation",
55928
- auth: "admin"
55929
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
55930
- kind: "mutation",
55931
- auth: "admin"
55932
- }), method(ProfileRefInputSchema, _void(), {
55933
- kind: "mutation",
55934
- auth: "admin"
55935
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
55936
- kind: "mutation",
55937
- auth: "admin",
55938
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
55939
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
56098
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
55940
56099
  kind: "mutation",
55941
56100
  auth: "admin"
55942
56101
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -56931,20 +57090,7 @@ method(_void(), MeshStatusSchema), method(object({
56931
57090
  /** Optional hostname override the host should advertise once joined. */
56932
57091
  hostname: string().optional() }), object({
56933
57092
  /** Authentication URL the operator should open in a browser. */
56934
- 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({
56935
- /** Optional auth key — when provided, probes the key validity
56936
- * against the provider's API. Omit when already joined to
56937
- * just ping the daemon. */
56938
- authKey: string().optional() }), object({
56939
- ok: boolean(),
56940
- /** Provider-side identifier resolved by the probe (tailnet
56941
- * name for Tailscale, network id for ZeroTier, etc.). */
56942
- tenant: string().optional(),
56943
- /** Daemon binary version, when reachable. */
56944
- daemonVersion: string().optional(),
56945
- /** Human-readable error when `ok: false`. */
56946
- error: string().optional()
56947
- }), { kind: "mutation" });
57093
+ 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() }));
56948
57094
  object({
56949
57095
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
56950
57096
  lastFetchedAt: number()
@@ -64305,6 +64451,11 @@ var NcScheduleSchema = object({
64305
64451
  * as a STATE SUMMARY at the end of each window of `schedule`.
64306
64452
  */
64307
64453
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
64454
+ _enum([
64455
+ "activation",
64456
+ "deactivation",
64457
+ "schedule"
64458
+ ]);
64308
64459
  /**
64309
64460
  * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
64310
64461
  * every section; `section` = one notification per section with something to
@@ -64321,11 +64472,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
64321
64472
  * midnight crossing); the send time is each window's END. Refused on the
64322
64473
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
64323
64474
  */
64324
- var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
64325
- mode: literal("summary"),
64326
- schedule: NcScheduleSchema,
64327
- split: NcStateSummarySplitSchema.optional()
64328
- })]);
64475
+ var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
64476
+ object({ mode: literal("instant") }),
64477
+ object({
64478
+ mode: literal("summary"),
64479
+ schedule: NcScheduleSchema,
64480
+ split: NcStateSummarySplitSchema.optional()
64481
+ }),
64482
+ object({
64483
+ mode: literal("modes"),
64484
+ /** The bad edge, and every kind that has a single edge. */
64485
+ onActivation: boolean(),
64486
+ /** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
64487
+ onDeactivation: boolean(),
64488
+ /** A state summary at the end of each window; absent = no summary. */
64489
+ onSchedule: object({
64490
+ schedule: NcScheduleSchema,
64491
+ grouping: NcStateSummarySplitSchema
64492
+ }).optional()
64493
+ })
64494
+ ]);
64329
64495
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
64330
64496
  var NcPlateMatcherSchema = object({
64331
64497
  /**
@@ -66618,61 +66784,6 @@ var oauthIntegrationCapability = {
66618
66784
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
66619
66785
  };
66620
66786
  /**
66621
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
66622
- *
66623
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
66624
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
66625
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
66626
- * immutable after create.
66627
- */
66628
- var ConfigSchemaPassthrough$1 = unknown();
66629
- var OidcConnectionSchema = object({
66630
- id: string().min(1),
66631
- displayName: string(),
66632
- icon: string(),
66633
- issuerUrl: string(),
66634
- clientId: string(),
66635
- /** Client id + secret present — never the secret value. */
66636
- configured: boolean(),
66637
- /**
66638
- * Values for the connection form schema. `clientSecret` is a keychain
66639
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
66640
- */
66641
- formValues: record(string(), unknown()).optional()
66642
- });
66643
- /**
66644
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
66645
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
66646
- */
66647
- var OidcConnectionUpdateInputSchema = object({
66648
- id: string().min(1),
66649
- displayName: string().min(1),
66650
- icon: string().optional(),
66651
- issuerUrl: string().optional(),
66652
- clientId: string().optional(),
66653
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
66654
- redirectUri: string().optional(),
66655
- scopes: string().optional(),
66656
- usernameClaim: _enum([
66657
- "preferred_username",
66658
- "email",
66659
- "sub"
66660
- ]).optional()
66661
- });
66662
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
66663
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
66664
- displayName: string().min(1)
66665
- }), object({ id: string() }), {
66666
- kind: "mutation",
66667
- auth: "admin"
66668
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
66669
- kind: "mutation",
66670
- auth: "admin"
66671
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
66672
- kind: "mutation",
66673
- auth: "admin"
66674
- });
66675
- /**
66676
66787
  * Generic on-screen-display (video overlay) cap. Each camera exposes
66677
66788
  * a firmware-defined list of overlays (channel name, timestamp,
66678
66789
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -72845,21 +72956,6 @@ method(object({
72845
72956
  */
72846
72957
  ttlSec: union([number().int().positive(), literal("never")]).optional()
72847
72958
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
72848
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
72849
- providerId: string().min(1),
72850
- displayName: string().min(1),
72851
- configSchema: unknown(),
72852
- nodeLocal: boolean(),
72853
- shouldSaveDiskSpace: literal(true),
72854
- minFreePercent: number().min(0).max(100)
72855
- }), object({
72856
- providerId: string().min(1),
72857
- displayName: string().min(1),
72858
- configSchema: unknown(),
72859
- nodeLocal: boolean(),
72860
- shouldSaveDiskSpace: literal(false),
72861
- minFreePercent: literal(null)
72862
- })]);
72863
72959
  method(object({
72864
72960
  location: StorageLocationRefSchema,
72865
72961
  relativePath: string()
@@ -72921,42 +73017,7 @@ method(object({
72921
73017
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
72922
73018
  kind: "mutation",
72923
73019
  auth: "admin"
72924
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
72925
- createdAt: true,
72926
- updatedAt: true
72927
- }), StorageLocationSchema, {
72928
- kind: "mutation",
72929
- auth: "admin"
72930
- }), method(object({
72931
- id: string(),
72932
- force: boolean().optional()
72933
- }), _void(), {
72934
- kind: "mutation",
72935
- auth: "admin"
72936
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
72937
- ok: boolean(),
72938
- error: string().optional()
72939
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
72940
- providerId: string(),
72941
- /**
72942
- * The location this config is an UNSAVED edit of, when there is one.
72943
- *
72944
- * `listLocations` replaces every declared secret with the redaction
72945
- * sentinel, so the edit modal's form state holds the sentinel for any
72946
- * credential the operator did not retype — and posting that here
72947
- * without a way to resolve it makes the provider try to authenticate
72948
- * as `__camstack_redacted__` and report the operator's own working
72949
- * password as wrong. Given this id, the orchestrator restores each
72950
- * sentinel from the stored config (same rule as `upsertLocation`)
72951
- * before dispatching. Omitted by the "Add location" wizard, where
72952
- * every value was typed just now and nothing is stored yet.
72953
- */
72954
- locationId: string().optional(),
72955
- config: record(string(), unknown())
72956
- }), object({
72957
- ok: boolean(),
72958
- error: string().optional()
72959
- }), { auth: "admin" });
73020
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
72960
73021
  /** One table of the settings database. */
72961
73022
  var StorageTableSchema = object({
72962
73023
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -74194,7 +74255,7 @@ var TerminalInstanceInfoSchema = object({
74194
74255
  /**
74195
74256
  * False while the node the instance is bound to is not in the cluster
74196
74257
  * topology (forgotten, renamed, re-paired). The instance is kept; the
74197
- * operator re-points it with `updateInstance({ targetNodeId })`.
74258
+ * operator re-points it on the Terminal page.
74198
74259
  */
74199
74260
  nodeInCluster: boolean(),
74200
74261
  profileId: string(),
@@ -74232,41 +74293,7 @@ var TerminalOutputBatchSchema = object({
74232
74293
  snapshot: string().optional(),
74233
74294
  events: array(TerminalOutputEventSchema).readonly()
74234
74295
  });
74235
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalInstanceInfoSchema).readonly(), { auth: "admin" }), method(object({
74236
- targetNodeId: string().min(1),
74237
- profileId: string().min(1),
74238
- name: string().trim().min(1).max(160).optional(),
74239
- executable: string().max(1024).optional(),
74240
- args: array(string().max(2048)).max(64).optional(),
74241
- cwd: string().max(1024).optional(),
74242
- environment: array(string().max(4096)).max(64).optional(),
74243
- profileSettings: ProfileSettingsBagSchema.optional()
74244
- }), TerminalInstanceInfoSchema, {
74245
- kind: "mutation",
74246
- auth: "admin"
74247
- }), method(object({
74248
- instanceId: string().min(1),
74249
- /** Re-point the instance to another node; the profile must exist there. */
74250
- targetNodeId: string().min(1).max(256).optional(),
74251
- name: string().trim().min(1).max(160).optional(),
74252
- executable: string().max(1024).optional(),
74253
- args: array(string().max(2048)).max(64).optional(),
74254
- cwd: string().max(1024).optional(),
74255
- environment: array(string().max(4096)).max(64).optional(),
74256
- profileSettings: ProfileSettingsBagSchema.optional()
74257
- }), TerminalInstanceInfoSchema, {
74258
- kind: "mutation",
74259
- auth: "admin"
74260
- }), method(object({ instanceId: string().min(1) }), _void(), {
74261
- kind: "mutation",
74262
- auth: "admin"
74263
- }), method(object({
74264
- instanceId: string().min(1),
74265
- enabled: boolean()
74266
- }), TerminalInstanceInfoSchema, {
74267
- kind: "mutation",
74268
- auth: "admin"
74269
- }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
74296
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
74270
74297
  stableId: string().min(1),
74271
74298
  name: string().trim().min(1).max(160).optional()
74272
74299
  }), TerminalInstanceInfoSchema, {
@@ -74335,6 +74362,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
74335
74362
  _enum(["switch", "pet-fountain"]);
74336
74363
  DeviceType.Heater, DeviceType.PetFountain;
74337
74364
  DeviceType.Heater, DeviceType.PetFountain;
74365
+ /** One duration, as the one-tap run asks for it. */
74366
+ var TimedRunQuickRunSchema = object({
74367
+ duration: number().positive().finite(),
74368
+ unit: TimedRunUnitSchema
74369
+ });
74338
74370
  /** Why a request was not carried out. Typed, so a caller can say it in words. */
74339
74371
  var TimedRunRefusalSchema = _enum([
74340
74372
  "unsupported-device",
@@ -74355,9 +74387,30 @@ object({
74355
74387
  activeUntil: number().nullable(),
74356
74388
  /** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
74357
74389
  requestedBy: string().nullable(),
74390
+ /**
74391
+ * The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
74392
+ * the device is gone or its type has no timed run; a status from before this field
74393
+ * existed has none, and a surface falls back to the type's default.
74394
+ */
74395
+ quickRun: TimedRunQuickRunSchema.nullable(),
74358
74396
  lastFetchedAt: number()
74359
74397
  });
74360
- method(object({
74398
+ /** What the settings form needs: the unit, the bounds and the type's default. */
74399
+ var TimedRunOptionsSchema = object({
74400
+ unit: TimedRunUnitSchema,
74401
+ /** The longest run, in `unit`. */
74402
+ maxDuration: number(),
74403
+ defaultDuration: number()
74404
+ });
74405
+ /** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
74406
+ var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
74407
+ method(object({ deviceId: number().int() }), TimedRunOptionsSchema), method(object({
74408
+ deviceId: number().int(),
74409
+ settings: TimedRunSettingsPatchSchema
74410
+ }), _void(), {
74411
+ kind: "mutation",
74412
+ auth: "admin"
74413
+ }), method(object({
74361
74414
  deviceId: number().int(),
74362
74415
  duration: number().positive().finite(),
74363
74416
  unit: TimedRunUnitSchema
@@ -77063,21 +77116,28 @@ Object.freeze({
77063
77116
  access: "view",
77064
77117
  role: "admin"
77065
77118
  },
77066
- "addonSettings.getGlobalSettings": {
77119
+ "addonSettings.getIntegrationFormSchema": {
77120
+ capName: "addon-settings",
77121
+ capScope: "system",
77122
+ addonId: null,
77123
+ access: "view",
77124
+ role: "admin"
77125
+ },
77126
+ "addonSettings.getScopedSettings": {
77067
77127
  capName: "addon-settings",
77068
77128
  capScope: "system",
77069
77129
  addonId: null,
77070
77130
  access: "view",
77071
77131
  role: "admin"
77072
77132
  },
77073
- "addonSettings.getIntegrationFormSchema": {
77133
+ "addonSettings.listScopedSettings": {
77074
77134
  capName: "addon-settings",
77075
77135
  capScope: "system",
77076
77136
  addonId: null,
77077
77137
  access: "view",
77078
77138
  role: "admin"
77079
77139
  },
77080
- "addonSettings.getIntegrationSettings": {
77140
+ "addonSettings.readScopedValues": {
77081
77141
  capName: "addon-settings",
77082
77142
  capScope: "system",
77083
77143
  addonId: null,
@@ -77098,7 +77158,7 @@ Object.freeze({
77098
77158
  access: "create",
77099
77159
  role: "admin"
77100
77160
  },
77101
- "addonSettings.updateGlobalSettings": {
77161
+ "addonSettings.updateScopedSettings": {
77102
77162
  capName: "addon-settings",
77103
77163
  capScope: "system",
77104
77164
  addonId: null,
@@ -79268,6 +79328,13 @@ Object.freeze({
79268
79328
  access: "create",
79269
79329
  role: "admin"
79270
79330
  },
79331
+ "deviceManager.setAlias": {
79332
+ capName: "device-manager",
79333
+ capScope: "system",
79334
+ addonId: null,
79335
+ access: "create",
79336
+ role: "admin"
79337
+ },
79271
79338
  "deviceManager.setChildLayout": {
79272
79339
  capName: "device-manager",
79273
79340
  capScope: "system",
@@ -80556,13 +80623,6 @@ Object.freeze({
80556
80623
  access: "delete",
80557
80624
  role: "admin"
80558
80625
  },
80559
- "llm.deleteProfile": {
80560
- capName: "llm",
80561
- capScope: "system",
80562
- addonId: null,
80563
- access: "delete",
80564
- role: "admin"
80565
- },
80566
80626
  "llm.generate": {
80567
80627
  capName: "llm",
80568
80628
  capScope: "system",
@@ -80626,20 +80686,6 @@ Object.freeze({
80626
80686
  access: "view",
80627
80687
  role: "admin"
80628
80688
  },
80629
- "llm.listProfileKinds": {
80630
- capName: "llm",
80631
- capScope: "system",
80632
- addonId: null,
80633
- access: "view",
80634
- role: "admin"
80635
- },
80636
- "llm.listProfiles": {
80637
- capName: "llm",
80638
- capScope: "system",
80639
- addonId: null,
80640
- access: "view",
80641
- role: "admin"
80642
- },
80643
80689
  "llm.listRuntimeNodes": {
80644
80690
  capName: "llm",
80645
80691
  capScope: "system",
@@ -80647,13 +80693,6 @@ Object.freeze({
80647
80693
  access: "view",
80648
80694
  role: "admin"
80649
80695
  },
80650
- "llm.migrateRawSecrets": {
80651
- capName: "llm",
80652
- capScope: "system",
80653
- addonId: null,
80654
- access: "create",
80655
- role: "admin"
80656
- },
80657
80696
  "llm.resolveModelRef": {
80658
80697
  capName: "llm",
80659
80698
  capScope: "system",
@@ -80682,20 +80721,6 @@ Object.freeze({
80682
80721
  access: "create",
80683
80722
  role: "admin"
80684
80723
  },
80685
- "llm.testProfile": {
80686
- capName: "llm",
80687
- capScope: "system",
80688
- addonId: null,
80689
- access: "create",
80690
- role: "admin"
80691
- },
80692
- "llm.upsertProfile": {
80693
- capName: "llm",
80694
- capScope: "system",
80695
- addonId: null,
80696
- access: "create",
80697
- role: "admin"
80698
- },
80699
80724
  "llmRuntime.appleAvailability": {
80700
80725
  capName: "llm-runtime",
80701
80726
  capScope: "system",
@@ -81200,13 +81225,6 @@ Object.freeze({
81200
81225
  access: "create",
81201
81226
  role: "admin"
81202
81227
  },
81203
- "meshNetwork.testConnection": {
81204
- capName: "mesh-network",
81205
- capScope: "system",
81206
- addonId: null,
81207
- access: "create",
81208
- role: "admin"
81209
- },
81210
81228
  "meter.getStatus": {
81211
81229
  capName: "meter",
81212
81230
  capScope: "device",
@@ -81865,13 +81883,6 @@ Object.freeze({
81865
81883
  access: "create",
81866
81884
  role: "admin"
81867
81885
  },
81868
- "notificationOutput.deleteTarget": {
81869
- capName: "notification-output",
81870
- capScope: "system",
81871
- addonId: null,
81872
- access: "delete",
81873
- role: "admin"
81874
- },
81875
81886
  "notificationOutput.discoverTargets": {
81876
81887
  capName: "notification-output",
81877
81888
  capScope: "system",
@@ -81879,13 +81890,6 @@ Object.freeze({
81879
81890
  access: "view",
81880
81891
  role: "admin"
81881
81892
  },
81882
- "notificationOutput.getTarget": {
81883
- capName: "notification-output",
81884
- capScope: "system",
81885
- addonId: null,
81886
- access: "view",
81887
- role: "admin"
81888
- },
81889
81893
  "notificationOutput.listTargetKinds": {
81890
81894
  capName: "notification-output",
81891
81895
  capScope: "system",
@@ -81893,13 +81897,6 @@ Object.freeze({
81893
81897
  access: "view",
81894
81898
  role: "admin"
81895
81899
  },
81896
- "notificationOutput.listTargets": {
81897
- capName: "notification-output",
81898
- capScope: "system",
81899
- addonId: null,
81900
- access: "view",
81901
- role: "admin"
81902
- },
81903
81900
  "notificationOutput.probeTargetConfig": {
81904
81901
  capName: "notification-output",
81905
81902
  capScope: "system",
@@ -81914,13 +81911,6 @@ Object.freeze({
81914
81911
  access: "create",
81915
81912
  role: "admin"
81916
81913
  },
81917
- "notificationOutput.setTargetEnabled": {
81918
- capName: "notification-output",
81919
- capScope: "system",
81920
- addonId: null,
81921
- access: "create",
81922
- role: "admin"
81923
- },
81924
81914
  "notificationOutput.testTarget": {
81925
81915
  capName: "notification-output",
81926
81916
  capScope: "system",
@@ -81928,13 +81918,6 @@ Object.freeze({
81928
81918
  access: "create",
81929
81919
  role: "admin"
81930
81920
  },
81931
- "notificationOutput.upsertTarget": {
81932
- capName: "notification-output",
81933
- capScope: "system",
81934
- addonId: null,
81935
- access: "create",
81936
- role: "admin"
81937
- },
81938
81921
  "notificationRules.activateAlarmProfile": {
81939
81922
  capName: "notification-rules",
81940
81923
  capScope: "system",
@@ -82194,41 +82177,6 @@ Object.freeze({
82194
82177
  access: "view",
82195
82178
  role: "admin"
82196
82179
  },
82197
- "oidcConnections.connectionFormSchema": {
82198
- capName: "oidc-connections",
82199
- capScope: "system",
82200
- addonId: null,
82201
- access: "view",
82202
- role: "admin"
82203
- },
82204
- "oidcConnections.createConnection": {
82205
- capName: "oidc-connections",
82206
- capScope: "system",
82207
- addonId: null,
82208
- access: "create",
82209
- role: "admin"
82210
- },
82211
- "oidcConnections.deleteConnection": {
82212
- capName: "oidc-connections",
82213
- capScope: "system",
82214
- addonId: null,
82215
- access: "delete",
82216
- role: "admin"
82217
- },
82218
- "oidcConnections.listConnections": {
82219
- capName: "oidc-connections",
82220
- capScope: "system",
82221
- addonId: null,
82222
- access: "view",
82223
- role: "admin"
82224
- },
82225
- "oidcConnections.updateConnection": {
82226
- capName: "oidc-connections",
82227
- capScope: "system",
82228
- addonId: null,
82229
- access: "create",
82230
- role: "admin"
82231
- },
82232
82180
  "osd.getStatus": {
82233
82181
  capName: "osd",
82234
82182
  capScope: "device",
@@ -85260,13 +85208,6 @@ Object.freeze({
85260
85208
  access: "delete",
85261
85209
  role: "admin"
85262
85210
  },
85263
- "storage.deleteLocation": {
85264
- capName: "storage",
85265
- capScope: "system",
85266
- addonId: null,
85267
- access: "delete",
85268
- role: "admin"
85269
- },
85270
85211
  "storage.endDownload": {
85271
85212
  capName: "storage",
85272
85213
  capScope: "system",
@@ -85323,13 +85264,6 @@ Object.freeze({
85323
85264
  access: "view",
85324
85265
  role: "admin"
85325
85266
  },
85326
- "storage.listProviders": {
85327
- capName: "storage",
85328
- capScope: "system",
85329
- addonId: null,
85330
- access: "view",
85331
- role: "admin"
85332
- },
85333
85267
  "storage.read": {
85334
85268
  capName: "storage",
85335
85269
  capScope: "system",
@@ -85351,27 +85285,6 @@ Object.freeze({
85351
85285
  access: "view",
85352
85286
  role: "admin"
85353
85287
  },
85354
- "storage.testConfig": {
85355
- capName: "storage",
85356
- capScope: "system",
85357
- addonId: null,
85358
- access: "view",
85359
- role: "admin"
85360
- },
85361
- "storage.testLocation": {
85362
- capName: "storage",
85363
- capScope: "system",
85364
- addonId: null,
85365
- access: "view",
85366
- role: "admin"
85367
- },
85368
- "storage.upsertLocation": {
85369
- capName: "storage",
85370
- capScope: "system",
85371
- addonId: null,
85372
- access: "create",
85373
- role: "admin"
85374
- },
85375
85288
  "storage.write": {
85376
85289
  capName: "storage",
85377
85290
  capScope: "system",
@@ -86149,27 +86062,6 @@ Object.freeze({
86149
86062
  access: "create",
86150
86063
  role: "admin"
86151
86064
  },
86152
- "terminalSession.createInstance": {
86153
- capName: "terminal-session",
86154
- capScope: "system",
86155
- addonId: null,
86156
- access: "create",
86157
- role: "admin"
86158
- },
86159
- "terminalSession.deleteInstance": {
86160
- capName: "terminal-session",
86161
- capScope: "system",
86162
- addonId: null,
86163
- access: "delete",
86164
- role: "admin"
86165
- },
86166
- "terminalSession.listInstances": {
86167
- capName: "terminal-session",
86168
- capScope: "system",
86169
- addonId: null,
86170
- access: "view",
86171
- role: "admin"
86172
- },
86173
86065
  "terminalSession.listLegacyCameras": {
86174
86066
  capName: "terminal-session",
86175
86067
  capScope: "system",
@@ -86212,20 +86104,6 @@ Object.freeze({
86212
86104
  access: "create",
86213
86105
  role: "admin"
86214
86106
  },
86215
- "terminalSession.setInstanceEnabled": {
86216
- capName: "terminal-session",
86217
- capScope: "system",
86218
- addonId: null,
86219
- access: "create",
86220
- role: "admin"
86221
- },
86222
- "terminalSession.updateInstance": {
86223
- capName: "terminal-session",
86224
- capScope: "system",
86225
- addonId: null,
86226
- access: "create",
86227
- role: "admin"
86228
- },
86229
86107
  "terminalSession.writeInput": {
86230
86108
  capName: "terminal-session",
86231
86109
  capScope: "system",
@@ -86240,6 +86118,13 @@ Object.freeze({
86240
86118
  access: "create",
86241
86119
  role: "viewer"
86242
86120
  },
86121
+ "timedRun.getOptions": {
86122
+ capName: "timed-run",
86123
+ capScope: "device",
86124
+ addonId: null,
86125
+ access: "view",
86126
+ role: "viewer"
86127
+ },
86243
86128
  "timedRun.getStatus": {
86244
86129
  capName: "timed-run",
86245
86130
  capScope: "device",
@@ -86254,6 +86139,13 @@ Object.freeze({
86254
86139
  access: "create",
86255
86140
  role: "viewer"
86256
86141
  },
86142
+ "timedRun.setSettings": {
86143
+ capName: "timed-run",
86144
+ capScope: "device",
86145
+ addonId: null,
86146
+ access: "create",
86147
+ role: "admin"
86148
+ },
86257
86149
  "toast.onToast": {
86258
86150
  capName: "toast",
86259
86151
  capScope: "system",
@@ -87209,6 +87101,7 @@ function applianceExport(ecosystem, deviceType) {
87209
87101
  if (!isPlugApplianceType(deviceType)) return null;
87210
87102
  return APPLIANCE_EXPORT[ecosystem][deviceType];
87211
87103
  }
87104
+ string().min(1).max(4096);
87212
87105
  Object.freeze({
87213
87106
  "accessories.getStatus": [{
87214
87107
  name: "deviceId",
@@ -87892,6 +87785,11 @@ Object.freeze({
87892
87785
  form: "single",
87893
87786
  optional: false
87894
87787
  }],
87788
+ "deviceManager.setAlias": [{
87789
+ name: "deviceId",
87790
+ form: "single",
87791
+ optional: false
87792
+ }],
87895
87793
  "deviceManager.setChildLayout": [{
87896
87794
  name: "deviceId",
87897
87795
  form: "single",
@@ -89956,6 +89854,11 @@ Object.freeze({
89956
89854
  form: "single",
89957
89855
  optional: false
89958
89856
  }],
89857
+ "timedRun.getOptions": [{
89858
+ name: "deviceId",
89859
+ form: "single",
89860
+ optional: false
89861
+ }],
89959
89862
  "timedRun.getStatus": [{
89960
89863
  name: "deviceId",
89961
89864
  form: "single",
@@ -89966,6 +89869,11 @@ Object.freeze({
89966
89869
  form: "single",
89967
89870
  optional: false
89968
89871
  }],
89872
+ "timedRun.setSettings": [{
89873
+ name: "deviceId",
89874
+ form: "single",
89875
+ optional: false
89876
+ }],
89969
89877
  "update.getStatus": [{
89970
89878
  name: "deviceId",
89971
89879
  form: "single",
@@ -90828,6 +90736,7 @@ var STATE_SUMMARY_VARS = [
90828
90736
  [...RULE_TEXT],
90829
90737
  [...RULE_TEXT],
90830
90738
  [...RULE_TEXT],
90739
+ [...RULE_TEXT],
90831
90740
  [...RULE_BODY_ONLY],
90832
90741
  [...RULE_TEXT],
90833
90742
  ([...RULE_TEXT], [...DEVICE_EVENTS]),