@camstack/addon-provider-hikvision 1.2.185 → 1.2.186

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/addon.js +1820 -1865
  3. package/dist/addon.mjs +1820 -1865
  4. package/package.json +2 -2
package/dist/addon.mjs CHANGED
@@ -7,7 +7,7 @@ import "node:zlib";
7
7
  import { connect } from "node:net";
8
8
  import { Agent, createServer, request } from "node:http";
9
9
  import { Agent as Agent$1, request as request$1 } from "node:https";
10
- //#region ../types/dist/event-category-BmPm98n0.mjs
10
+ //#region ../types/dist/event-category-78tcBemo.mjs
11
11
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
12
12
  EventCategory["SystemBoot"] = "system.boot";
13
13
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -128,6 +128,23 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
128
128
  */
129
129
  EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
130
130
  /**
131
+ * An addon is RUNNING although its installed package is below what the
132
+ * running server requires (`camstack.requires.addons` of the server, or the
133
+ * addon's own `requires.server`). Raised once per streak by the unsupported-
134
+ * addon tracker, on the hub and on agents; AlertCenter turns it into one
135
+ * operator alert per node and package. The addon is never held back for it.
136
+ *
137
+ * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
138
+ */
139
+ EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
140
+ /**
141
+ * The package of an {@link AddonUnsupportedVersion} alert reached a supported
142
+ * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
143
+ *
144
+ * Payload: `{ packageName, addonId, nodeId }`.
145
+ */
146
+ EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
147
+ /**
131
148
  * Monitor scheduled the next retry for a failed addon. Transient —
132
149
  * surfaced to the UI for live-updating the "next retry in Ns"
133
150
  * countdown on the Addons page row, NOT persisted as an alert.
@@ -238,7 +255,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
238
255
  EventCategory["ProcessRestarted"] = "process.restarted";
239
256
  /**
240
257
  * The SET of storage locations changed — one was created, edited, enabled,
241
- * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
258
+ * disabled or deleted through the location instances or the forced-delete action.
242
259
  *
243
260
  * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
244
261
  * it must also converge on its own periodic path, because a dropped event
@@ -793,7 +810,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
793
810
  return EventCategory;
794
811
  }({});
795
812
  //#endregion
796
- //#region ../types/dist/device-type-D1fH5kaC.mjs
813
+ //#region ../types/dist/device-type-DxCT0krO.mjs
797
814
  /**
798
815
  import { errMsg } from '@camstack/types'
799
816
  * Extract a human-readable message from an unknown error value.
@@ -955,6 +972,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
955
972
  * filters that want "all devices with on-motion behaviour".
956
973
  */
957
974
  DeviceFeature["MotionTrigger"] = "motion-trigger";
975
+ /**
976
+ * Device can be run for a chosen time and then stopped. Mirrors the
977
+ * `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
978
+ * a driver, so the flag is derived from the device's bindings
979
+ * (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
980
+ */
981
+ DeviceFeature["TimedRun"] = "timed-run";
958
982
  /** Light supports rgb-triplet color via `color` cap. */
959
983
  DeviceFeature["LightColorRgb"] = "light-color-rgb";
960
984
  /** Light supports HSV color via `color` cap. */
@@ -5989,7 +6013,7 @@ var ZodIssueCode = {
5989
6013
  var ZodFirstPartyTypeKind;
5990
6014
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5991
6015
  //#endregion
5992
- //#region ../types/dist/sleep-D7ZKm4nb.mjs
6016
+ //#region ../types/dist/sleep-CGPZyzB5.mjs
5993
6017
  /**
5994
6018
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5995
6019
  * window to float samples (D455).
@@ -6353,6 +6377,59 @@ Object.fromEntries([
6353
6377
  function isValuelessField(field) {
6354
6378
  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";
6355
6379
  }
6380
+ /**
6381
+ * Base collector: flatten a hydrated `ConfigUISchemaWithValues` into
6382
+ * `key → { value, default }`, recursing through `group` and `sub-tabs`
6383
+ * layout fields. Keeping `value` and `default` SEPARATE (rather than
6384
+ * pre-resolving) lets callers both read the effective value AND detect
6385
+ * overrides (`value` differs from `default`). Structural over `unknown`;
6386
+ * malformed input yields an empty map, never throws.
6387
+ */
6388
+ function collectHydratedFieldEntries(schema) {
6389
+ const out = /* @__PURE__ */ new Map();
6390
+ if (typeof schema !== "object" || schema === null) return out;
6391
+ const sections = schema.sections;
6392
+ if (!Array.isArray(sections)) return out;
6393
+ for (const section of sections) if (typeof section === "object" && section !== null) collectFieldEntriesInto(section.fields, out);
6394
+ return out;
6395
+ }
6396
+ /** Recursive field walker for {@link collectHydratedFieldEntries}. */
6397
+ function collectFieldEntriesInto(fields, into) {
6398
+ if (!Array.isArray(fields)) return;
6399
+ for (const field of fields) {
6400
+ if (typeof field !== "object" || field === null) continue;
6401
+ const type = field.type;
6402
+ if (type === "group") {
6403
+ collectFieldEntriesInto(field.fields, into);
6404
+ continue;
6405
+ }
6406
+ if (type === "sub-tabs") {
6407
+ const tabs = field.tabs;
6408
+ if (Array.isArray(tabs)) {
6409
+ for (const tab of tabs) if (typeof tab === "object" && tab !== null) collectFieldEntriesInto(tab.fields, into);
6410
+ }
6411
+ continue;
6412
+ }
6413
+ const key = field.key;
6414
+ if (typeof key !== "string" || key.length === 0) continue;
6415
+ if (!("value" in field)) continue;
6416
+ into.set(key, {
6417
+ value: field.value,
6418
+ default: field.default
6419
+ });
6420
+ }
6421
+ }
6422
+ /**
6423
+ * Flatten a hydrated settings payload into `key → EFFECTIVE value`
6424
+ * (`value ?? default`). The read-side inverse of `hydrateSchema` for the
6425
+ * common "just give me the resolved values" case. Built on
6426
+ * {@link collectHydratedFieldEntries}.
6427
+ */
6428
+ function collectHydratedFieldValues(schema) {
6429
+ const out = /* @__PURE__ */ new Map();
6430
+ for (const [key, entry] of collectHydratedFieldEntries(schema)) out.set(key, entry.value ?? entry.default);
6431
+ return out;
6432
+ }
6356
6433
  function hydrateSchema(schema, values, options = {}) {
6357
6434
  return {
6358
6435
  ...schema.tabs ? { tabs: [...schema.tabs] } : {},
@@ -7247,6 +7324,7 @@ var RecordIntegrationInstances = class {
7247
7324
  this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
7248
7325
  this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
7249
7326
  this.nameField = kind.declaration.entry?.nameField ?? "name";
7327
+ if (hooks.kindOf === void 0 && hooks.description.kinds.length !== 1) throw new Error(`record kind '${kind.name}': describe().kinds has ${hooks.description.kinds.length} entries, so kindOf is required to say which one an instance is`);
7250
7328
  }
7251
7329
  /**
7252
7330
  * One instance read for the addon's own runtime; null when absent. When the keychain is
@@ -7288,10 +7366,21 @@ var RecordIntegrationInstances = class {
7288
7366
  }
7289
7367
  return out;
7290
7368
  }
7369
+ /** The kind an instance body is of: the provider's `kindOf`, else its one declared kind. */
7370
+ kindOfBody(body) {
7371
+ if (this.hooks.kindOf !== void 0) {
7372
+ const id = this.hooks.kindOf(body);
7373
+ if (!this.hooks.description.kinds.some((declared) => declared.id === id)) throw new Error(`record kind '${this.kind.name}': kindOf returned '${id}', which describe().kinds does not declare (D1013)`);
7374
+ return id;
7375
+ }
7376
+ const only = this.hooks.description.kinds[0];
7377
+ if (only === void 0) throw new Error(`record kind '${this.kind.name}' declares no kinds`);
7378
+ return only.id;
7379
+ }
7291
7380
  viewOf(record) {
7292
7381
  const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
7293
7382
  const rawName = record.data[this.nameField];
7294
- const kind = this.hooks.kindOf?.(record.data);
7383
+ const kind = this.kindOfBody(record.data);
7295
7384
  const health = this.hooks.health?.(record.data, record.id);
7296
7385
  return {
7297
7386
  id: record.id,
@@ -7299,7 +7388,7 @@ var RecordIntegrationInstances = class {
7299
7388
  configured: this.hooks.configured(record.data),
7300
7389
  enabled: isInstanceEnabled(record.data),
7301
7390
  formValues: shown,
7302
- ...kind !== void 0 ? { kind } : {},
7391
+ kind,
7303
7392
  ...health?.status !== void 0 ? { status: health.status } : {},
7304
7393
  ...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
7305
7394
  };
@@ -7332,17 +7421,35 @@ var RecordIntegrationInstances = class {
7332
7421
  ...kind !== void 0 ? { kind } : {}
7333
7422
  });
7334
7423
  if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
7424
+ const initial = this.hooks.initialBody(name, kind);
7425
+ const patch = this.patchOf(values ?? {});
7426
+ if (Object.keys(patch).length > 0) Object.assign(patch, await this.hooks.validateWrite?.({
7427
+ kind,
7428
+ body: {
7429
+ ...initial,
7430
+ ...patch
7431
+ }
7432
+ }));
7335
7433
  await this.handle.put({
7336
7434
  id: minted,
7337
- data: this.hooks.initialBody(name, kind)
7435
+ data: initial
7338
7436
  }, { ifRev: 0 });
7339
- const patch = this.patchOf(values ?? {});
7340
7437
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7341
7438
  await this.hooks.onChanged?.(minted, "created");
7342
7439
  return { id: minted };
7343
7440
  };
7344
7441
  updateInstance = async ({ id, name, values }) => {
7345
7442
  const patch = this.patchOf(values);
7443
+ if (this.hooks.validateWrite !== void 0 && Object.keys(patch).length > 0) {
7444
+ const stored = await this.handle.get(id);
7445
+ if (stored !== null) Object.assign(patch, await this.hooks.validateWrite({
7446
+ kind: void 0,
7447
+ body: {
7448
+ ...stored.data,
7449
+ ...patch
7450
+ }
7451
+ }));
7452
+ }
7346
7453
  if (name !== void 0) patch[this.nameField] = name;
7347
7454
  await this.handle.patch(id, patch);
7348
7455
  await this.hooks.onChanged?.(id, "updated");
@@ -7653,6 +7760,21 @@ var SCOPED_SETTINGS_SCOPES = [
7653
7760
  "device-defaults",
7654
7761
  "node"
7655
7762
  ];
7763
+ /** The one refusal of a key a scope did not declare. */
7764
+ function assertDeclaredKeys(keys, declared) {
7765
+ const undeclared = keys.filter((key) => !declared.has(key));
7766
+ if (undeclared.length > 0) throw new Error(`scoped settings: [${undeclared.join(", ")}] not declared for this scope (declared: [${[...declared].join(", ")}])`);
7767
+ }
7768
+ /** Build the handle over an addon's scoped read, write and unset. */
7769
+ function createScopedSettings(deps) {
7770
+ return {
7771
+ async get() {
7772
+ return deps.schema.parse(await deps.read());
7773
+ },
7774
+ patch: (patch) => deps.write(Object.fromEntries(Object.entries(patch))),
7775
+ unset: (keys) => deps.unset(keys)
7776
+ };
7777
+ }
7656
7778
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
7657
7779
  var KeychainWriteRefusedError = class extends Error {
7658
7780
  fieldPath;
@@ -8228,7 +8350,16 @@ function createHandle(raw, opts) {
8228
8350
  return blob;
8229
8351
  }
8230
8352
  },
8231
- writeAddonStore: writeAddon
8353
+ writeAddonStore: writeAddon,
8354
+ removeClearedKeys: (keys) => serialize("addon", async () => {
8355
+ const stored = await readStoredAddonBlob(raw);
8356
+ index.seen("addon", stored);
8357
+ const removable = keys.filter((key) => collectSecretMarkerRefs(stored[key]).length === 0);
8358
+ if (removable.length === 0) return;
8359
+ const patch = Object.fromEntries(removable.map((key) => [key, void 0]));
8360
+ await raw.writeAddonStore(patch);
8361
+ index.wrote("addon", patch);
8362
+ })
8232
8363
  };
8233
8364
  }
8234
8365
  /** The context the addon sees, plus the private raw view and write outcome. */
@@ -8358,7 +8489,7 @@ function boundOf(list) {
8358
8489
  * Base class for CamStack addons. Eliminates settings boilerplate:
8359
8490
  *
8360
8491
  * - Typed `config` property with automatic resolution from store + defaults
8361
- * - `getGlobalSettings()` / `updateGlobalSettings()` auto-implemented
8492
+ * - the scoped settings API (`clusterSettings` / `nodeSettings` / `deviceDefaults`) auto-implemented
8362
8493
  * - `getAddonSettings()` / `updateAddonSettings()` auto-implemented
8363
8494
  * - `getDeviceSettings()` / `updateDeviceSettings()` auto-implemented
8364
8495
  * - `ctx` accessor for the AddonContext (no manual `this.ctxRef` storage)
@@ -8368,7 +8499,7 @@ function boundOf(list) {
8368
8499
  * Subclasses override:
8369
8500
  * - `onInitialize()` — addon-specific init logic, return ProviderRegistration[]
8370
8501
  * - `onShutdown()` — cleanup
8371
- * - `globalSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
8502
+ * - `clusterSettingsSchema()` / `nodeSettingsSchema()` / `deviceSettingsSchema()` — UI schemas
8372
8503
  *
8373
8504
  * @example
8374
8505
  * ```ts
@@ -8382,7 +8513,7 @@ function boundOf(list) {
8382
8513
  * super({ maxRetries: 3, endpoint: 'http://localhost' })
8383
8514
  * }
8384
8515
  *
8385
- * protected globalSettingsSchema() {
8516
+ * protected clusterSettingsSchema() {
8386
8517
  * return this.schema({
8387
8518
  * sections: [{
8388
8519
  * id: 'main', title: 'Settings',
@@ -8425,7 +8556,7 @@ var BaseAddon = class {
8425
8556
  defaults;
8426
8557
  /**
8427
8558
  * Hidden-state paths that hold secrets (D787) — values the addon writes
8428
- * itself (`updateGlobalSettings`, `state()`) that no form field declares.
8559
+ * itself (`state()`, the scoped writers) that no form field declares.
8429
8560
  * Stored in the keychain exactly like a `password` field. Syntax:
8430
8561
  * `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
8431
8562
  * (`key[<id field>]` addresses array items by id, never by index).
@@ -8435,7 +8566,7 @@ var BaseAddon = class {
8435
8566
  /**
8436
8567
  * D986 M4: the scoped schemas this addon declared, resolved once per capability
8437
8568
  * (`loadScopedSchemas`) so the sync readers (`perNodeKeys`, the secret tree, the restart check)
8438
- * see them. Empty until loaded: the readers then fall back to {@link globalSettingsSchema}.
8569
+ * see them. Empty until loaded.
8439
8570
  */
8440
8571
  _scopedByCap = /* @__PURE__ */ new Map();
8441
8572
  _nodeKeysByCap = /* @__PURE__ */ new Map();
@@ -8621,7 +8752,7 @@ var BaseAddon = class {
8621
8752
  /** Addon-specific cleanup. Override if needed. */
8622
8753
  async onShutdown() {}
8623
8754
  /**
8624
- * Called after config is resolved during updateGlobalSettings/updateAddonSettings.
8755
+ * Called after config is resolved during a settings write.
8625
8756
  * Override to react to config changes (e.g. restart a sampler, reconnect a service).
8626
8757
  * Not called during initialize() — use onInitialize() for initial setup.
8627
8758
  */
@@ -8650,82 +8781,12 @@ var BaseAddon = class {
8650
8781
  scopedSettingsCapabilities() {
8651
8782
  return [];
8652
8783
  }
8653
- /** Override to provide global-level settings UI schema. */
8654
- globalSettingsSchema(_cap) {
8655
- return null;
8656
- }
8657
8784
  /** Override to provide device-level settings UI schema. */
8658
8785
  deviceSettingsSchema() {
8659
8786
  return null;
8660
8787
  }
8661
8788
  /**
8662
- * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
8663
- * ARE the configuration of its integration.
8664
- *
8665
- * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
8666
- * operator should find on the addon's integration page (System →
8667
- * Integrations → <name>) rather than only in the cluster-wide list of every
8668
- * addon. Empty (the default) means the addon has no integration-level
8669
- * settings and no such surface is offered — this is opt-in, because whether
8670
- * an addon's configuration IS its integration's configuration depends on the
8671
- * nature of the integration.
8672
- *
8673
- * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
8674
- * the ONE global schema, in the ONE addon store, written by the ONE
8675
- * `updateGlobalSettings` path. There is deliberately no
8676
- * `updateIntegrationSettings`: a second write path is how a surface acquires
8677
- * a second store key, and this repo has shipped that twice (`btmPath@hub`,
8678
- * D266). Selecting sections cannot introduce a key that selecting cannot.
8679
- *
8680
- * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
8681
- * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
8682
- * removed with the reason recorded at
8683
- * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
8684
- * determined by WHICH schema it lives in, not by a field-level marker."* A
8685
- * marker sprinkled across sections also has to borrow a field that already
8686
- * means something else; borrowing `section.tab` put the literal word
8687
- * "integration" into an operator-facing tab bar, because `tab` means "how to
8688
- * GROUP this visually" and cannot also mean "where this lives" (D269
8689
- * supersedes D268). One declaration, in one place, next to the schema whose
8690
- * ids it names.
8691
- */
8692
- integrationSettingSections() {
8693
- return [];
8694
- }
8695
- async getGlobalSettings(overlay, cap, nodeId) {
8696
- await this.loadScopedSchemas(cap);
8697
- const schema = this.globalSettingsSchema(cap) ?? this.scopedFormSchema(cap);
8698
- if (!schema) return { sections: [] };
8699
- const projected = await this.readRawProjectedStore(nodeId, cap);
8700
- return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
8701
- }
8702
- /**
8703
- * The integration-level view of this addon's settings: exactly the sections
8704
- * named by {@link integrationSettingSections}, hydrated from the SAME store
8705
- * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
8706
- *
8707
- * Returns `null` when the addon declared nothing — an addon that opts out has
8708
- * no integration settings surface at all, rather than an empty one that reads
8709
- * as a failed load.
8710
- *
8711
- * Three properties hold BY CONSTRUCTION, which is why they are here in core
8712
- * and not in whichever UI happens to render this:
8713
- *
8714
- * 1. **One key.** The payload is a SUBSET of the global schema, so a field
8715
- * shown here is the same field, with the same bare key, that the addon's
8716
- * own page shows. There is no integration-specific writer — callers save
8717
- * through `updateGlobalSettings` — so a second store key is unreachable,
8718
- * not merely discouraged.
8719
- * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
8720
- * is `<key>@<nodeId>` and an integration is not a node; whichever node
8721
- * such a field silently picked would be a wrong answer for the operator
8722
- * who opened the page (D266).
8723
- * 3. **No silent typo.** A declared id that names no section throws. The
8724
- * alternative — skip it — turns a rename into a surface that quietly
8725
- * empties, which looks exactly like an addon with nothing to configure.
8726
- */
8727
- /**
8728
- * The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
8789
+ * The form schema of ONE integration instance, or `null` to use the scoped form.
8729
8790
  *
8730
8791
  * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
8731
8792
  * needs its connection fields, the default integration the addon's own sections. It is the
@@ -8773,37 +8834,178 @@ var BaseAddon = class {
8773
8834
  }
8774
8835
  }
8775
8836
  /**
8837
+ * Hook: values layered over the stored ones when the FORM of one scope is served
8838
+ * ({@link getScopedSettings}) — a preview that derives dependent options without writing.
8839
+ * Never applied to {@link ScopedSettings.get} or to a write. `null` ⇒ no overlay.
8840
+ */
8841
+ async scopedSettingsOverlay(_scope, _cap, _nodeId) {
8842
+ return null;
8843
+ }
8844
+ /**
8845
+ * Hook: a write of one scope changed stored values (not called when the store reports no change,
8846
+ * e.g. the write-back of a stored secret). `keys` are the bare field keys of the write, node keys included.
8847
+ */
8848
+ async onScopedSettingsChanged(_scope, _cap, _keys) {}
8849
+ /** Typed handle over the CLUSTER settings `cap` declares (`clusterSettingsSchema`). */
8850
+ clusterSettings(cap, schema) {
8851
+ return this.scopedHandle("cluster", cap, schema);
8852
+ }
8853
+ /** Typed handle over the fleet defaults of the per-device settings `cap` declares. */
8854
+ deviceDefaults(cap, schema) {
8855
+ return this.scopedHandle("device-defaults", cap, schema);
8856
+ }
8857
+ /**
8858
+ * Typed handle over the settings `cap` owns PER NODE. `nodeId` omitted ⇒ the local node. A node
8859
+ * with no row yields the schema defaults — never a bare-key fallback.
8860
+ */
8861
+ nodeSettings(cap, schema, nodeId) {
8862
+ return this.scopedHandle("node", cap, schema, nodeId);
8863
+ }
8864
+ /**
8865
+ * {@link state} for a value that is kept per node: stored under `<key>@<nodeId>`, and the
8866
+ * settings store carries `nodeId` in the row data (D986 §1), so a forgotten node's rows go in one
8867
+ * central delete. `nodeId` omitted ⇒ the local node.
8868
+ */
8869
+ nodeState(key, schema, fallback, nodeId) {
8870
+ this._declaredStateKeys.add(key);
8871
+ return createDurableState({
8872
+ key: nodeScopedKey(key, nodeId ?? this._ctx?.kernel?.localNodeId ?? ""),
8873
+ schema,
8874
+ fallback,
8875
+ read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
8876
+ write: async (patch) => {
8877
+ await this._ctx?.settings?.writeAddonStore(patch);
8878
+ },
8879
+ onParseError: (k, e) => this._ctx?.logger?.warn?.(`durable-state: stored "${k}" failed validation — using fallback`, { meta: {
8880
+ addonId: this._ctx?.id,
8881
+ key: k,
8882
+ error: String(e)
8883
+ } })
8884
+ });
8885
+ }
8886
+ /** The loaded schema `cap` declares for `scope`, or `null`. */
8887
+ async declaredScopedSchema(scope, cap) {
8888
+ await this.loadScopedSchemas(cap);
8889
+ return this.loadedScopedSchemas(cap).find((entry) => entry.scope === scope)?.schema ?? null;
8890
+ }
8891
+ async requireScopedSchema(scope, cap) {
8892
+ const schema = await this.declaredScopedSchema(scope, cap);
8893
+ if (schema === null) throw new Error(`${this.constructor.name}: cap "${cap}" declares no ${scope} settings`);
8894
+ return schema;
8895
+ }
8896
+ scopedKeys(schema) {
8897
+ return new Set(schema.sections.flatMap((section) => collectValueFieldKeys(section.fields)));
8898
+ }
8899
+ /** `store` narrowed to the keys `schema` declares. */
8900
+ narrowToScope(store, schema) {
8901
+ const keys = this.scopedKeys(schema);
8902
+ return Object.fromEntries(Object.entries(store).filter(([key]) => keys.has(key)));
8903
+ }
8904
+ scopedHandle(scope, cap, schema, nodeId) {
8905
+ return createScopedSettings({
8906
+ schema,
8907
+ read: async () => {
8908
+ const declared = await this.requireScopedSchema(scope, cap);
8909
+ const stored = this.narrowToScope(await this.resolveGlobalStore(nodeId, cap), declared);
8910
+ const effective = collectHydratedFieldValues(hydrateSchema(declared, stored));
8911
+ return {
8912
+ ...Object.fromEntries([...effective].filter(([, value]) => value !== void 0)),
8913
+ ...stored
8914
+ };
8915
+ },
8916
+ write: (patch) => this.writeScoped(scope, cap, patch, nodeId),
8917
+ unset: (keys) => this.unsetScoped(scope, cap, keys, nodeId)
8918
+ });
8919
+ }
8920
+ /** The one write path of the scoped API: declared keys only, then the global patch. */
8921
+ async writeScoped(scope, cap, patch, nodeId) {
8922
+ assertDeclaredKeys(Object.keys(patch), this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8923
+ if (await this.applyGlobalPatch(patch, scope === "node" ? nodeId : void 0, cap)) await this.onScopedSettingsChanged(scope, cap, Object.keys(patch));
8924
+ }
8925
+ /**
8926
+ * Remove declared keys of one scope. A secret goes through {@link clearSecrets} — its keychain
8927
+ * value is released exactly as there — and the emptied row is then removed; every other key is
8928
+ * removed by an `undefined` patch (which a secret transform would read as "keep").
8929
+ */
8930
+ async unsetScoped(scope, cap, keys, nodeId) {
8931
+ assertDeclaredKeys(keys, this.scopedKeys(await this.requireScopedSchema(scope, cap)));
8932
+ const target = scope === "node" ? nodeId : void 0;
8933
+ const tree = this.addonSecretTree();
8934
+ const secretKeys = keys.filter((key) => tree.has(key));
8935
+ const plainKeys = keys.filter((key) => !tree.has(key));
8936
+ let changed = false;
8937
+ if (plainKeys.length > 0) {
8938
+ const patch = Object.fromEntries(plainKeys.map((key) => [key, void 0]));
8939
+ changed = await this.applyGlobalPatch(patch, target, cap) || changed;
8940
+ }
8941
+ if (secretKeys.length > 0) {
8942
+ await this.clearSecretKeys(secretKeys, target, cap);
8943
+ const node = normalizeNodeId(target ?? this._ctx?.kernel?.localNodeId);
8944
+ const rows = secretKeys.map((key) => scope === "node" ? nodeScopedKey(key, node) : key);
8945
+ if (this._secretSettings !== null) await this._secretSettings.removeClearedKeys(rows);
8946
+ else await this._ctx?.settings?.writeAddonStore(Object.fromEntries(rows.map((row) => [row, void 0])));
8947
+ changed = true;
8948
+ }
8949
+ if (changed) await this.onScopedSettingsChanged(scope, cap, [...keys]);
8950
+ }
8951
+ /**
8952
+ * The hydrated form of one scope of one capability's settings (any
8953
+ * {@link scopedSettingsOverlay} applied), or `null` when the capability declares nothing there.
8954
+ */
8955
+ async getScopedSettings(scope, cap, nodeId) {
8956
+ const schema = await this.declaredScopedSchema(scope, cap);
8957
+ if (schema === null) return null;
8958
+ const stored = this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema);
8959
+ const overlay = await this.scopedSettingsOverlay(scope, cap, nodeId);
8960
+ return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(stored, overlay) : stored, { inlineSecretsAsViews: true });
8961
+ }
8962
+ /**
8963
+ * The scoped schemas this addon serves: one entry per loaded (capability, scope), capabilities
8964
+ * in declaration order, scopes in {@link SCOPED_SETTINGS_SCOPES} order. `[]` when it declares
8965
+ * nothing.
8966
+ */
8967
+ async listScopedSettings() {
8968
+ await this.loadScopedSchemas();
8969
+ return [...this._scopedByCap].flatMap(([cap, entries]) => entries.map((entry) => ({
8970
+ cap,
8971
+ scope: entry.scope,
8972
+ sectionIds: entry.schema.sections.map((section) => section.id)
8973
+ })));
8974
+ }
8975
+ /** The OPERATOR's write of declared keys of one scope (D787 secret semantics). */
8976
+ async updateScopedSettings(scope, cap, patch, nodeId) {
8977
+ this._operatorWriteDepth++;
8978
+ try {
8979
+ await this.writeScoped(scope, cap, patch, nodeId);
8980
+ } finally {
8981
+ this._operatorWriteDepth--;
8982
+ }
8983
+ }
8984
+ /**
8985
+ * The effective values (`stored ?? default`) of one scope, a secret as its `set` view — never
8986
+ * its value. `null` when the capability declares nothing for the scope.
8987
+ */
8988
+ async readScopedValues(scope, cap, nodeId) {
8989
+ const schema = await this.declaredScopedSchema(scope, cap);
8990
+ if (schema === null) return null;
8991
+ const form = hydrateSchema(schema, this.narrowToScope(await this.readRawProjectedStore(nodeId, cap), schema), { inlineSecretsAsViews: true });
8992
+ return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
8993
+ }
8994
+ /**
8776
8995
  * What the create wizard and the integration edit page render for one instance: the addon's
8777
8996
  * per-instance schema when it declares one, else its global schema (what they always showed).
8778
8997
  */
8779
8998
  async getIntegrationFormSchema(instance, nodeId) {
8780
8999
  const scoped = await this.integrationFormSchema(instance);
8781
- if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
9000
+ if (scoped === null) return this.scopedForm(nodeId);
8782
9001
  return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
8783
9002
  }
8784
- async getIntegrationSettings(nodeId) {
8785
- const declared = this.integrationSettingSections();
8786
- if (declared.length === 0) return null;
8787
- const schema = this.globalSettingsSchema();
8788
- if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
8789
- const byId = new Map(schema.sections.map((section) => [section.id, section]));
8790
- const sections = [];
8791
- for (const id of declared) {
8792
- const section = byId.get(id);
8793
- if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
8794
- const fields = dropPerNodeFields(section.fields);
8795
- if (fields.length === 0) continue;
8796
- sections.push({
8797
- ...section,
8798
- fields
8799
- });
8800
- }
8801
- if (sections.length === 0) return null;
8802
- const projected = await this.readRawProjectedStore(nodeId);
8803
- return hydrateSchema({
8804
- ...schema,
8805
- sections
8806
- }, projected, { inlineSecretsAsViews: true });
9003
+ /** The form of the scoped schemas this addon declared, hydrated from its store. */
9004
+ async scopedForm(nodeId) {
9005
+ await this.loadScopedSchemas();
9006
+ const schema = this.scopedFormSchema();
9007
+ if (!schema) return { sections: [] };
9008
+ return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
8807
9009
  }
8808
9010
  /**
8809
9011
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
@@ -8812,8 +9014,8 @@ var BaseAddon = class {
8812
9014
  * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
8813
9015
  * A no-op passthrough when the schema declares no `perNode` field.
8814
9016
  *
8815
- * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
8816
- * the store for custom option logic (option narrowing, value snapping) to
9017
+ * This is the sanctioned way for an addon that needs
9018
+ * the store for custom logic (option narrowing, value snapping) to
8817
9019
  * read it per-node — never `ctx.settings.readAddonStore()` directly.
8818
9020
  * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
8819
9021
  *
@@ -8865,7 +9067,7 @@ var BaseAddon = class {
8865
9067
  }
8866
9068
  /**
8867
9069
  * Whether ONE global key of this addon's store was written, read three-way
8868
- * (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
9070
+ * (D651). For a question a hydrated view cannot answer: a hydrated form
8869
9071
  * reports `value ?? default`, so "the operator chose the default" and "nobody
8870
9072
  * chose" look the same, and a failed read looks like both. A `perNode` key is
8871
9073
  * not supported here: its stored name is scoped.
@@ -8899,7 +9101,7 @@ var BaseAddon = class {
8899
9101
  }
8900
9102
  /**
8901
9103
  * The OPERATOR's write — a settings form or an admin API call, dispatched by
8902
- * the kernel. Identical to {@link updateGlobalSettings}, except that a secret
9104
+ * the kernel. The one in-process write of the addon blob that is not a scoped write; a secret
8903
9105
  * the operator sends is stored as sent even when it equals a pre-keychain
8904
9106
  * inline value: the operator re-entering a password is a change, an addon
8905
9107
  * writing back what it read is not (D787).
@@ -8912,9 +9114,6 @@ var BaseAddon = class {
8912
9114
  this._operatorWriteDepth--;
8913
9115
  }
8914
9116
  }
8915
- async updateGlobalSettings(patch, nodeId) {
8916
- await this.applyGlobalPatch(patch, nodeId);
8917
- }
8918
9117
  /**
8919
9118
  * REMOVE stored secrets — their keychain values and their markers (D787).
8920
9119
  *
@@ -8924,6 +9123,9 @@ var BaseAddon = class {
8924
9123
  * a keychain (an older kernel) it writes `''`, as such code always did.
8925
9124
  */
8926
9125
  async clearSecrets(keys, nodeId) {
9126
+ await this.clearSecretKeys(keys, nodeId);
9127
+ }
9128
+ async clearSecretKeys(keys, nodeId, cap) {
8927
9129
  const tree = this.addonSecretTree();
8928
9130
  const keychain = this._ctx?.secrets !== void 0;
8929
9131
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
@@ -8936,25 +9138,26 @@ var BaseAddon = class {
8936
9138
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8937
9139
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8938
9140
  }
8939
- await this.applyGlobalPatch(patch, nodeId);
9141
+ await this.applyGlobalPatch(patch, nodeId, cap);
8940
9142
  }
8941
- async applyGlobalPatch(barePatch, nodeId) {
8942
- await this.loadScopedSchemas();
8943
- const keys = this.perNodeKeys();
9143
+ /** Resolves `true` when the write changed stored values. */
9144
+ async applyGlobalPatch(barePatch, nodeId, cap) {
9145
+ await this.loadScopedSchemas(cap);
9146
+ const keys = this.perNodeKeys(cap);
8944
9147
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
8945
9148
  const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
8946
9149
  const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
8947
9150
  const handle = this._secretSettings;
8948
9151
  if (handle !== null) {
8949
9152
  const { changed } = await handle.writeAddonStore(scoped);
8950
- if (!changed) return;
9153
+ if (!changed) return false;
8951
9154
  } else await this._ctx?.settings?.writeAddonStore(scoped);
8952
- if (target !== localNode) return;
9155
+ if (target !== localNode) return true;
8953
9156
  await this.resolveConfig();
8954
9157
  await this.onConfigChanged();
8955
9158
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
8956
- const legacy = this.globalSettingsSchema();
8957
- this.maybeAutoRestart(Object.keys(barePatch), [...legacy === null ? [] : [legacy], ...this.loadedScopedSchemas().map((entry) => entry.schema)]);
9159
+ this.maybeAutoRestart(Object.keys(barePatch), this.loadedScopedSchemas().map((entry) => entry.schema));
9160
+ return true;
8958
9161
  }
8959
9162
  /**
8960
9163
  * The set of field keys the global settings schema declares `perNode: true`
@@ -8991,10 +9194,7 @@ var BaseAddon = class {
8991
9194
  this._nodeKeysByCap = /* @__PURE__ */ new Map();
8992
9195
  this._addonSecretTree = null;
8993
9196
  }
8994
- /**
8995
- * The form the settings API serves while an addon declares no {@link globalSettingsSchema}: the
8996
- * sections of its scoped schemas, so dropping the old hook does not blank the form.
8997
- */
9197
+ /** The form of an addon's scoped schemas: their sections, each shown once. */
8998
9198
  scopedFormSchema(cap) {
8999
9199
  const byId = /* @__PURE__ */ new Map();
9000
9200
  for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
@@ -9006,8 +9206,7 @@ var BaseAddon = class {
9006
9206
  return [...this._scopedByCap.values()].flat();
9007
9207
  }
9008
9208
  /**
9009
- * The field keys that are stored per node: every field of a {@link nodeSettingsSchema}, plus
9010
- * the fields the legacy {@link globalSettingsSchema} still marks `perNode: true`. Derived once
9209
+ * The field keys that are stored per node: every field of a {@link nodeSettingsSchema}. Derived once
9011
9210
  * per `cap` argument and memoized (schemas are static declarations). Empty set ⇒ every
9012
9211
  * per-node code path is bypassed and the settings API behaves like the node-agnostic one.
9013
9212
  * Call {@link loadScopedSchemas} first (the async seams do).
@@ -9016,8 +9215,7 @@ var BaseAddon = class {
9016
9215
  const cacheKey = cap ?? "";
9017
9216
  const cached = this._nodeKeysByCap.get(cacheKey);
9018
9217
  if (cached) return cached;
9019
- const legacy = this.globalSettingsSchema(cap);
9020
- const keys = new Set(legacy ? legacy.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
9218
+ const keys = /* @__PURE__ */ new Set();
9021
9219
  for (const { scope, schema } of this.loadedScopedSchemas(cap)) {
9022
9220
  if (scope !== "node") continue;
9023
9221
  for (const section of schema.sections) for (const key of collectValueFieldKeys(section.fields)) keys.add(key);
@@ -9235,8 +9433,6 @@ var BaseAddon = class {
9235
9433
  }
9236
9434
  declaredKeySet() {
9237
9435
  const keys = new Set(Object.keys(this.defaults));
9238
- const schema = this.globalSettingsSchema();
9239
- if (schema) for (const section of schema.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
9240
9436
  for (const { schema: scoped } of this.loadedScopedSchemas()) for (const section of scoped.sections) for (const key of collectFieldKeys(section.fields)) keys.add(key);
9241
9437
  for (const key of this._declaredStateKeys) keys.add(key);
9242
9438
  for (const path of this.secretStatePaths) {
@@ -9334,7 +9530,7 @@ var BaseAddon = class {
9334
9530
  /** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
9335
9531
  addonSecretTree() {
9336
9532
  if (this._addonSecretTree === null) {
9337
- const tree = new Map(secretTreeFromSchema(this.globalSettingsSchema()));
9533
+ const tree = /* @__PURE__ */ new Map();
9338
9534
  for (const { schema } of this.loadedScopedSchemas()) for (const [key, node] of secretTreeFromSchema(schema)) tree.set(key, node);
9339
9535
  this._addonSecretTree = mergeSecretStatePaths(tree, this.secretStatePaths);
9340
9536
  }
@@ -9546,47 +9742,6 @@ function classifyStoreError(err) {
9546
9742
  if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
9547
9743
  return "permanent";
9548
9744
  }
9549
- /**
9550
- * Collect the keys of every field marked `perNode: true`, recursing into
9551
- * layout containers (`group` fields and `sub-tabs` tabs) the same way
9552
- * `hydrateSchema` does. Valueless structural fields (separator/info/…)
9553
- * don't declare `perNode` and are excluded by the `in` narrowing.
9554
- */
9555
- /**
9556
- * The same fields with every `perNode: true` one removed, recursing into layout
9557
- * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
9558
- * with no child is dropped rather than rendered empty.
9559
- *
9560
- * Used by `getIntegrationSettings`: an integration is not a node, so a field
9561
- * whose store key is `<key>@<nodeId>` has no node to belong to there.
9562
- */
9563
- function dropPerNodeFields(fields) {
9564
- const kept = [];
9565
- for (const field of fields) {
9566
- if (field.type === "group") {
9567
- const inner = dropPerNodeFields(field.fields);
9568
- if (inner.length > 0) kept.push({
9569
- ...field,
9570
- fields: inner
9571
- });
9572
- continue;
9573
- }
9574
- if (field.type === "sub-tabs") {
9575
- const tabs = field.tabs.map((tab) => ({
9576
- ...tab,
9577
- fields: dropPerNodeFields(tab.fields)
9578
- })).filter((tab) => tab.fields.length > 0);
9579
- if (tabs.length > 0) kept.push({
9580
- ...field,
9581
- tabs
9582
- });
9583
- continue;
9584
- }
9585
- if ("perNode" in field && field.perNode === true) continue;
9586
- kept.push(field);
9587
- }
9588
- return kept;
9589
- }
9590
9745
  /** The keys of the value-holding fields, recursing into layout containers. */
9591
9746
  function collectValueFieldKeys(fields) {
9592
9747
  const collected = [];
@@ -9619,21 +9774,6 @@ function collectFieldKeys(fields) {
9619
9774
  }
9620
9775
  return collected;
9621
9776
  }
9622
- function collectPerNodeFieldKeys(fields) {
9623
- const collected = [];
9624
- for (const field of fields) {
9625
- if (field.type === "group") {
9626
- collected.push(...collectPerNodeFieldKeys(field.fields));
9627
- continue;
9628
- }
9629
- if (field.type === "sub-tabs") {
9630
- for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
9631
- continue;
9632
- }
9633
- if ("perNode" in field && field.perNode === true) collected.push(field.key);
9634
- }
9635
- return collected;
9636
- }
9637
9777
  /**
9638
9778
  * Normalize an `ICamstackAddon.initialize()` return value into the
9639
9779
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
@@ -10700,7 +10840,6 @@ var CAP_NAMES = Object.freeze([
10700
10840
  "notifier",
10701
10841
  "numeric-sensor",
10702
10842
  "oauth-integration",
10703
- "oidc-connections",
10704
10843
  "osd",
10705
10844
  "osd-manager",
10706
10845
  "pet-feeder",
@@ -12407,13 +12546,25 @@ Object.freeze({
12407
12546
  "path": "temperature",
12408
12547
  "valueType": "number"
12409
12548
  }],
12410
- "timed-run": [{
12411
- "path": "activeUntil",
12412
- "valueType": "number"
12413
- }, {
12414
- "path": "requestedBy",
12415
- "valueType": "string"
12416
- }],
12549
+ "timed-run": [
12550
+ {
12551
+ "path": "activeUntil",
12552
+ "valueType": "number"
12553
+ },
12554
+ {
12555
+ "path": "requestedBy",
12556
+ "valueType": "string"
12557
+ },
12558
+ {
12559
+ "path": "quickRun.duration",
12560
+ "valueType": "number"
12561
+ },
12562
+ {
12563
+ "path": "quickRun.unit",
12564
+ "valueType": "enum",
12565
+ "enumValues": ["s", "min"]
12566
+ }
12567
+ ],
12417
12568
  "update": [
12418
12569
  {
12419
12570
  "path": "currentVersion",
@@ -12592,8 +12743,7 @@ Object.freeze({
12592
12743
  "device-provider": { "reloadDevice": 18e4 },
12593
12744
  "llm": {
12594
12745
  "generate": 6e5,
12595
- "generateVision": 6e5,
12596
- "testProfile": 6e5
12746
+ "generateVision": 6e5
12597
12747
  },
12598
12748
  "llm-runtime": {
12599
12749
  "complete": 6e5,
@@ -12652,7 +12802,7 @@ function userError(code, params, englishFallback) {
12652
12802
  return new CamstackError(code, params, englishFallback);
12653
12803
  }
12654
12804
  //#endregion
12655
- //#region ../types/dist/composition-BmBHuDTQ.mjs
12805
+ //#region ../types/dist/composition-Bx0JvKUU.mjs
12656
12806
  /**
12657
12807
  * The ffmpeg build every CamStack node downloads, per platform and arch.
12658
12808
  *
@@ -13814,462 +13964,844 @@ var NodeColorIdSchema = _enum([
13814
13964
  "node-h"
13815
13965
  ]);
13816
13966
  //#endregion
13817
- //#region ../types/dist/index.mjs
13818
- var SMTP_INBOUND_DEFAULT_PORT = 2525;
13819
- var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
13820
- var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
13821
- /** The text excerpt a message carries on the bus. */
13822
- var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
13823
- var PortSchema = number().int().min(1).max(65535);
13824
- /** A recipient local-part: what stands before the `@`. */
13825
- var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
13826
- object({
13827
- port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
13828
- bindHost: string().min(1).default("0.0.0.0"),
13829
- domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
13830
- requireAuth: boolean().default(true),
13831
- username: string().default(""),
13832
- password: string().default("").meta({ secret: true }),
13833
- starttls: boolean().default(false),
13834
- maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
13835
- });
13836
- object({
13837
- host: string().min(1).nullable(),
13838
- hostReason: string().nullable(),
13839
- port: PortSchema,
13840
- domain: string().min(1),
13841
- requireAuth: boolean(),
13842
- username: string(),
13843
- password: string(),
13844
- starttls: boolean()
13845
- });
13846
- object({
13847
- recipients: array(SmtpRecipientSchema).min(1),
13848
- /**
13849
- * Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
13850
- * recipients (the way a consumer that restarted, or lost a device, declares its set again);
13851
- * a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
13852
- * Absent, the subscriber is anonymous and unique.
13853
- */
13854
- subscriberId: string().min(1).max(64).optional()
13855
- });
13856
- var SmtpInboundAttachmentSchema = object({
13857
- filename: string(),
13858
- contentType: string(),
13859
- bytes: number().int().nonnegative()
13860
- });
13861
- /** The payload of one `broker.message` (the key is the recipient local-part). */
13862
- var SmtpInboundMessageSchema = object({
13863
- /** Monotonic per mailbox; a gap tells a consumer it missed an event. */
13864
- seq: number().int().positive(),
13865
- messageId: string(),
13866
- receivedAt: number().int().nonnegative(),
13867
- from: string(),
13868
- to: string(),
13869
- subject: string(),
13870
- text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
13871
- attachments: array(SmtpInboundAttachmentSchema)
13872
- });
13873
- object({
13874
- /** The newest seq issued so far (0 before any mail). */
13875
- lastSeq: number().int().nonnegative(),
13876
- /** The oldest seq still retained; messages below it are gone. */
13877
- oldestSeq: number().int().nonnegative(),
13878
- messages: array(object({
13879
- key: string(),
13880
- message: SmtpInboundMessageSchema
13881
- }))
13882
- });
13883
- new Set([
13884
- "track",
13885
- "face",
13886
- "identity",
13887
- "plate",
13888
- "vehicle",
13889
- "scene",
13890
- "motion",
13891
- "object",
13892
- "audio",
13893
- "mosaic"
13894
- ]);
13895
- /**
13896
- * The owner types that are event tables, in the order the event-media resolver
13897
- * should consider them. Exported so a consumer asking "is this key an event?"
13898
- * does not re-spell the list and drift from it.
13899
- */
13900
- var EVENT_OWNER_TYPES = [
13901
- "motion",
13902
- "object",
13903
- "audio"
13904
- ];
13905
- /**
13906
- * The same list as a Zod enum, for the cap inputs that must NAME the table
13907
- * (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
13908
- * `(table, id)`).
13909
- *
13910
- * Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
13911
- * table would otherwise be accepted by the codec and refused at the door, with
13912
- * nothing failing until a caller asked.
13913
- */
13914
- var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
13915
- /** The same list as a Zod enum, for the cap input that carries it. */
13916
- var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
13917
- new Set(EVENT_OWNER_TYPES);
13918
- /**
13919
- * What a published package needs from the rest of the install (D989).
13920
- *
13921
- * One published framework package (`@camstack/server`) carries the kernel, the
13922
- * builtins and the capability contracts, so "which addon runs on which
13923
- * framework" is a question of version, and the answer is DECLARED by the
13924
- * package that knows it:
13925
- *
13926
- * - an addon says the oldest server it runs on (`requires.server: ">=X"`);
13927
- * - the server says the oldest addon it works with
13928
- * (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
13929
- * around it (`requires.wrapper: { desktop, image }`);
13930
- * - a wrapper (the desktop app, the container starter) says which server
13931
- * range it can host, and reports its own kind and version.
13932
- *
13933
- * The publish workflow STAMPS these after the version bump
13934
- * (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
13935
- *
13936
- * A requirement that cannot be checked is NOT met: a shell that reports no
13937
- * version counts as below the minimum, and an unreadable running version is
13938
- * named in the result (a failed read is never a pass).
13939
- */
13940
- /** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
13941
- var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
13942
- object({
13943
- /** The oldest `@camstack/server` this package runs on. */
13944
- server: MinVersionSchema.optional(),
13945
- /** The oldest installed version of each named addon package. */
13946
- addons: record(string(), MinVersionSchema).optional(),
13947
- /** The oldest shell around the server, per shell kind. */
13948
- wrapper: object({
13949
- desktop: MinVersionSchema.optional(),
13950
- image: MinVersionSchema.optional()
13951
- }).optional()
13952
- });
13953
- /** One unmet requirement; each names the versions on both sides. */
13954
- var UnmetRequirementSchema = discriminatedUnion("kind", [
13955
- object({
13956
- kind: literal("server-too-old"),
13957
- required: string(),
13958
- /** `null` — the running server version could not be read. */
13959
- running: string().nullable()
13960
- }),
13961
- object({
13962
- kind: literal("addon-too-old"),
13963
- packageName: string(),
13964
- required: string(),
13965
- /** `null` — the addon is not installed (or its version is unreadable). */
13966
- running: string().nullable()
13967
- }),
13968
- object({
13969
- kind: literal("wrapper-too-old"),
13970
- wrapper: _enum(["desktop", "image"]),
13971
- required: string(),
13972
- /** `null` — the wrapper reported no version. */
13973
- running: string().nullable()
13974
- })
13975
- ]);
13976
- var RequiredAddonUpdateSchema = object({
13977
- packageName: string(),
13978
- /** The minimum the target server declares. */
13979
- required: string(),
13980
- /** What this node has; `null` when the addon is not installed. */
13981
- installed: string().nullable()
13982
- });
13983
- /**
13984
- * Which integration instance a settings form is for. An addon that serves several instances
13985
- * (`instanceMode: multiple`) can show a different form per instance — an NVR integration
13986
- * needs its connection, the default integration needs the addon's own sections.
13987
- *
13988
- * - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
13989
- * setting up a NEW instance.
13990
- * - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
13991
- * - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
13992
- */
13993
- var IntegrationInstanceRefSchema = object({
13994
- integrationId: string().nullable(),
13995
- mode: _enum([
13996
- "standalone",
13997
- "account",
13998
- "broker"
13999
- ]),
14000
- candidateStableId: string().optional()
14001
- });
14002
- /**
14003
- * notification-output — canonical, capability-gated notification delivery.
14004
- *
14005
- * Apprise-derived model (see
14006
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14007
- * callers emit ONE canonical `Notification`; each provider declares a
14008
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
14009
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14010
- * message to what the kind supports — callers never special-case a service.
14011
- *
14012
- * DESIGN DECISIONS (locked):
14013
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14014
- * `setTargetEnabled`), each provider persisting via the `settings-store`
14015
- * cap. Rationale: the admin UI needs one uniform surface across the
14016
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14017
- * alternative would fork the UI per addon and cannot host the
14018
- * discovery→adopt flow.
14019
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14020
- * the generated cap-mount auto-`concatCollection`-fans them across every
14021
- * registered provider (notifiers addon + HA addon) so one catalog is
14022
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14023
- * `addonId` the generated collection router extracts from the call input.
14024
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14025
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14026
- * `storage` / `storage-provider` / `recording` caps over the same path. No
14027
- * base64 fallback needed.
14028
- *
14029
- * TODO (deferred, closed-set change — separate decision): add
14030
- * `providerKind: 'notify'` so notification providers surface on the unified
14031
- * admin "Integrations" page.
14032
- */
13967
+ //#region ../types/dist/convert-BAzH15HU.mjs
14033
13968
  /**
14034
- * Zentik-derived typed-media enum — the superset across every kind. Each
14035
- * adapter picks what it supports and the degrade engine filters the rest.
14036
- */
14037
- var AttachmentMediaTypeSchema = _enum([
14038
- "image",
14039
- "video",
14040
- "gif",
14041
- "audio",
14042
- "icon"
14043
- ]);
14044
- /**
14045
- * A single attachment. Exactly one of `url` (remote source, most adapters
14046
- * prefer this) or `bytes` (inline source; required for Pushover-style
14047
- * bytes-only kinds) MUST be present — the degrade engine expresses a
14048
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
14049
- */
14050
- var AttachmentSchema = object({
14051
- mediaType: AttachmentMediaTypeSchema,
14052
- url: string().optional(),
14053
- bytes: _instanceof(Uint8Array).optional(),
14054
- mime: string().optional(),
14055
- name: string().optional()
14056
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14057
- var NotificationFormatSchema = _enum([
14058
- "text",
14059
- "markdown",
14060
- "html"
14061
- ]);
14062
- /**
14063
- * The CLOSED icon vocabulary an action button may use.
14064
- *
14065
- * A closed set, not a free string, and that is the whole point: an arbitrary
14066
- * icon name is one that ntfy renders, zentik silently drops, and nobody
14067
- * notices — the same class of gap as a zone vocabulary nothing produced
14068
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14069
- * declares `actionIcons: false` and the degrade engine strips the field.
14070
- *
14071
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14072
- * renderer's icon set; "acknowledge" survives an adapter that draws it
14073
- * differently.
14074
- *
14075
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14076
- *
14077
- * These names are for US. **No adapter may forward one verbatim.** Each maps
14078
- * the whole set onto its own renderer's vocabulary through a
14079
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14080
- * fallback, so adding a member here fails every adapter's build until someone
14081
- * decides its glyph, which is the only place that decision can be made
14082
- * honestly.
14083
- *
14084
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14085
- * `disarm` straight through; iOS feeds that string to
14086
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14087
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
14088
- * mapping, and "the field is documented" is not "the value renders".
14089
- *
14090
- * Adding a member is TRAIN-BOUND. The enum lives in the published
14091
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14092
- * so an addon that emits a token the running hub does not know does not lose an
14093
- * icon — its whole `send` fails Zod validation and the notification never
14094
- * arrives. Never emit a new token from an addon before the train carrying it.
13969
+ * Frozen unit → spec table. `•` in the doc marks each dimension's canonical
13970
+ * unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
13971
+ * `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
13972
+ * decimals). K derives from `°C = K − 273.15`.
14095
13973
  */
14096
- var NotificationActionIconSchema = _enum([
14097
- "acknowledge",
14098
- "dismiss",
14099
- "silence",
14100
- "snooze",
14101
- "view",
14102
- "play",
14103
- "open",
14104
- "close",
14105
- "lock",
14106
- "unlock",
14107
- "arm",
14108
- "arm-home",
14109
- "arm-away",
14110
- "arm-night",
14111
- "disarm",
14112
- "light",
14113
- "alert",
14114
- "camera"
14115
- ]);
14116
- /** A single tap-through action button. */
14117
- var NotificationActionSchema = object({
14118
- id: string(),
14119
- label: string(),
14120
- url: string().optional(),
14121
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14122
- icon: NotificationActionIconSchema.optional(),
14123
- /**
14124
- * Renders in a warning style where the notifier supports it.
14125
- *
14126
- * A HINT, never a gate. The callback's authority is its token and nothing
14127
- * else — see `notification-center/action-token.ts` for what that does and
14128
- * does not buy.
14129
- */
14130
- destructive: boolean().optional(),
14131
- /**
14132
- * How the tap should REACH the url.
14133
- *
14134
- * `navigate` (absent, and every button authored before this field) opens it:
14135
- * the phone leaves the notification and shows whatever the callback returns.
14136
- * That is right for a button whose answer the operator wants to read.
14137
- *
14138
- * `background` fires it as a POST and stays put. It exists for the buttons
14139
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
14140
- * an answer to the notification, and being thrown into a browser tab to
14141
- * confirm it costs more attention than the notification did. A backend that
14142
- * cannot do a background call renders it as an ordinary link (the adapters
14143
- * fall back rather than dropping the button), so this is a preference, never
14144
- * a requirement.
14145
- */
14146
- mode: _enum(["navigate", "background"]).optional()
14147
- });
14148
- /** A delivery parameter value: what a notifier declared it takes. */
14149
- var DeliveryParamValueSchema = union([
14150
- string(),
14151
- number(),
14152
- boolean()
14153
- ]);
14154
- /**
14155
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
14156
- * addresses a target of that kind may set it; a kind that declares nothing is
14157
- * never handed one. The admin UI derives its control from this descriptor —
14158
- * no editor knows a service by name.
14159
- *
14160
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14161
- * run on the addon cap path).
14162
- */
14163
- var DeliveryParamSchema = object({
14164
- key: string().min(1),
14165
- label: string(),
14166
- /** i18n key of the label, resolved by the declaring addon's namespace. */
14167
- labelKey: string().optional(),
14168
- type: _enum([
14169
- "enum",
14170
- "number",
14171
- "boolean",
14172
- "string"
14173
- ]),
14174
- /** `enum` only: the closed set of accepted values. */
14175
- options: array(object({
14176
- value: string(),
14177
- label: string()
14178
- })).optional(),
14179
- /** `number` only. */
14180
- min: number().optional(),
14181
- max: number().optional(),
14182
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14183
- default: DeliveryParamValueSchema.optional()
14184
- });
13974
+ var UNIT_TABLE = {
13975
+ "°C": {
13976
+ dimension: "temperature",
13977
+ factor: 1,
13978
+ offset: 0
13979
+ },
13980
+ "°F": {
13981
+ dimension: "temperature",
13982
+ factor: 5 / 9,
13983
+ offset: -160 / 9
13984
+ },
13985
+ K: {
13986
+ dimension: "temperature",
13987
+ factor: 1,
13988
+ offset: -273.15
13989
+ },
13990
+ hPa: {
13991
+ dimension: "pressure",
13992
+ factor: 1,
13993
+ offset: 0
13994
+ },
13995
+ kPa: {
13996
+ dimension: "pressure",
13997
+ factor: 10,
13998
+ offset: 0
13999
+ },
14000
+ Pa: {
14001
+ dimension: "pressure",
14002
+ factor: .01,
14003
+ offset: 0
14004
+ },
14005
+ mbar: {
14006
+ dimension: "pressure",
14007
+ factor: 1,
14008
+ offset: 0
14009
+ },
14010
+ bar: {
14011
+ dimension: "pressure",
14012
+ factor: 1e3,
14013
+ offset: 0
14014
+ },
14015
+ inHg: {
14016
+ dimension: "pressure",
14017
+ factor: 33.8639,
14018
+ offset: 0
14019
+ },
14020
+ mmHg: {
14021
+ dimension: "pressure",
14022
+ factor: 1.33322,
14023
+ offset: 0
14024
+ },
14025
+ psi: {
14026
+ dimension: "pressure",
14027
+ factor: 68.9476,
14028
+ offset: 0
14029
+ },
14030
+ "m/s": {
14031
+ dimension: "speed",
14032
+ factor: 1,
14033
+ offset: 0
14034
+ },
14035
+ "km/h": {
14036
+ dimension: "speed",
14037
+ factor: 1 / 3.6,
14038
+ offset: 0
14039
+ },
14040
+ mph: {
14041
+ dimension: "speed",
14042
+ factor: .44704,
14043
+ offset: 0
14044
+ },
14045
+ kn: {
14046
+ dimension: "speed",
14047
+ factor: .514444,
14048
+ offset: 0
14049
+ },
14050
+ "mm/h": {
14051
+ dimension: "precipitation-rate",
14052
+ factor: 1,
14053
+ offset: 0
14054
+ },
14055
+ "in/h": {
14056
+ dimension: "precipitation-rate",
14057
+ factor: 25.4,
14058
+ offset: 0
14059
+ },
14060
+ m: {
14061
+ dimension: "length",
14062
+ factor: 1,
14063
+ offset: 0
14064
+ },
14065
+ mm: {
14066
+ dimension: "length",
14067
+ factor: .001,
14068
+ offset: 0
14069
+ },
14070
+ cm: {
14071
+ dimension: "length",
14072
+ factor: .01,
14073
+ offset: 0
14074
+ },
14075
+ km: {
14076
+ dimension: "length",
14077
+ factor: 1e3,
14078
+ offset: 0
14079
+ },
14080
+ in: {
14081
+ dimension: "length",
14082
+ factor: .0254,
14083
+ offset: 0
14084
+ },
14085
+ ft: {
14086
+ dimension: "length",
14087
+ factor: .3048,
14088
+ offset: 0
14089
+ },
14090
+ mi: {
14091
+ dimension: "length",
14092
+ factor: 1609.344,
14093
+ offset: 0
14094
+ },
14095
+ "m²": {
14096
+ dimension: "area",
14097
+ factor: 1,
14098
+ offset: 0
14099
+ },
14100
+ lx: {
14101
+ dimension: "illuminance",
14102
+ factor: 1,
14103
+ offset: 0
14104
+ },
14105
+ "W/m²": {
14106
+ dimension: "irradiance",
14107
+ factor: 1,
14108
+ offset: 0
14109
+ },
14110
+ W: {
14111
+ dimension: "power",
14112
+ factor: 1,
14113
+ offset: 0
14114
+ },
14115
+ kW: {
14116
+ dimension: "power",
14117
+ factor: 1e3,
14118
+ offset: 0
14119
+ },
14120
+ VA: {
14121
+ dimension: "apparent-power",
14122
+ factor: 1,
14123
+ offset: 0
14124
+ },
14125
+ Wh: {
14126
+ dimension: "energy",
14127
+ factor: 1,
14128
+ offset: 0
14129
+ },
14130
+ kWh: {
14131
+ dimension: "energy",
14132
+ factor: 1e3,
14133
+ offset: 0
14134
+ },
14135
+ MWh: {
14136
+ dimension: "energy",
14137
+ factor: 1e6,
14138
+ offset: 0
14139
+ },
14140
+ V: {
14141
+ dimension: "voltage",
14142
+ factor: 1,
14143
+ offset: 0
14144
+ },
14145
+ mV: {
14146
+ dimension: "voltage",
14147
+ factor: .001,
14148
+ offset: 0
14149
+ },
14150
+ A: {
14151
+ dimension: "current",
14152
+ factor: 1,
14153
+ offset: 0
14154
+ },
14155
+ mA: {
14156
+ dimension: "current",
14157
+ factor: .001,
14158
+ offset: 0
14159
+ },
14160
+ ppm: {
14161
+ dimension: "concentration-volume",
14162
+ factor: 1,
14163
+ offset: 0
14164
+ },
14165
+ ppb: {
14166
+ dimension: "concentration-volume",
14167
+ factor: .001,
14168
+ offset: 0
14169
+ },
14170
+ "µg/m³": {
14171
+ dimension: "concentration-mass",
14172
+ factor: 1,
14173
+ offset: 0
14174
+ },
14175
+ "mg/m³": {
14176
+ dimension: "concentration-mass",
14177
+ factor: 1e3,
14178
+ offset: 0
14179
+ },
14180
+ kg: {
14181
+ dimension: "mass",
14182
+ factor: 1,
14183
+ offset: 0
14184
+ },
14185
+ g: {
14186
+ dimension: "mass",
14187
+ factor: .001,
14188
+ offset: 0
14189
+ },
14190
+ lb: {
14191
+ dimension: "mass",
14192
+ factor: .453592,
14193
+ offset: 0
14194
+ },
14195
+ oz: {
14196
+ dimension: "mass",
14197
+ factor: .0283495,
14198
+ offset: 0
14199
+ },
14200
+ "%": {
14201
+ dimension: "percentage",
14202
+ factor: 1,
14203
+ offset: 0
14204
+ },
14205
+ L: {
14206
+ dimension: "volume",
14207
+ factor: 1,
14208
+ offset: 0
14209
+ },
14210
+ mL: {
14211
+ dimension: "volume",
14212
+ factor: .001,
14213
+ offset: 0
14214
+ },
14215
+ gal: {
14216
+ dimension: "volume",
14217
+ factor: 3.785411784,
14218
+ offset: 0
14219
+ },
14220
+ s: {
14221
+ dimension: "duration",
14222
+ factor: 1,
14223
+ offset: 0
14224
+ },
14225
+ ms: {
14226
+ dimension: "duration",
14227
+ factor: .001,
14228
+ offset: 0
14229
+ },
14230
+ min: {
14231
+ dimension: "duration",
14232
+ factor: 60,
14233
+ offset: 0
14234
+ },
14235
+ h: {
14236
+ dimension: "duration",
14237
+ factor: 3600,
14238
+ offset: 0
14239
+ },
14240
+ d: {
14241
+ dimension: "duration",
14242
+ factor: 86400,
14243
+ offset: 0
14244
+ },
14245
+ B: {
14246
+ dimension: "information",
14247
+ factor: 1,
14248
+ offset: 0
14249
+ },
14250
+ KiB: {
14251
+ dimension: "information",
14252
+ factor: 1024,
14253
+ offset: 0
14254
+ },
14255
+ MiB: {
14256
+ dimension: "information",
14257
+ factor: 1024 ** 2,
14258
+ offset: 0
14259
+ },
14260
+ GiB: {
14261
+ dimension: "information",
14262
+ factor: 1024 ** 3,
14263
+ offset: 0
14264
+ },
14265
+ TiB: {
14266
+ dimension: "information",
14267
+ factor: 1024 ** 4,
14268
+ offset: 0
14269
+ },
14270
+ kB: {
14271
+ dimension: "information",
14272
+ factor: 1e3,
14273
+ offset: 0
14274
+ },
14275
+ MB: {
14276
+ dimension: "information",
14277
+ factor: 1e6,
14278
+ offset: 0
14279
+ },
14280
+ GB: {
14281
+ dimension: "information",
14282
+ factor: 1e9,
14283
+ offset: 0
14284
+ },
14285
+ "°": {
14286
+ dimension: "angle",
14287
+ factor: 1,
14288
+ offset: 0
14289
+ },
14290
+ dBFS: {
14291
+ dimension: "sound-level",
14292
+ factor: 1,
14293
+ offset: 0
14294
+ },
14295
+ dBm: {
14296
+ dimension: "signal-level",
14297
+ factor: 1,
14298
+ offset: 0
14299
+ },
14300
+ mired: {
14301
+ dimension: "colour-temperature",
14302
+ factor: 1,
14303
+ offset: 0
14304
+ },
14305
+ kbps: {
14306
+ dimension: "bitrate",
14307
+ factor: 1,
14308
+ offset: 0
14309
+ },
14310
+ Mbps: {
14311
+ dimension: "bitrate",
14312
+ factor: 1e3,
14313
+ offset: 0
14314
+ },
14315
+ fps: {
14316
+ dimension: "rate",
14317
+ factor: 1,
14318
+ offset: 0
14319
+ }
14320
+ };
14321
+ /** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
14322
+ function specFor(unit) {
14323
+ return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
14324
+ }
14325
+ /** Value in `spec`'s unit → its dimension's canonical unit. */
14326
+ function toCanonical(value, spec) {
14327
+ return value * spec.factor + spec.offset;
14328
+ }
14329
+ /** Canonical-unit value → the unit described by `spec`. */
14330
+ function fromCanonical(canonical, spec) {
14331
+ return (canonical - spec.offset) / spec.factor;
14332
+ }
14185
14333
  /**
14186
- * The canonical notification. `body` is the only hard field (Apprise model).
14187
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14188
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14189
- * the adapter maps this ordinal onto its native level. `level?` is an
14190
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
14191
- * `priority` for that one target.
14334
+ * Graceful variant for the render path: returns the converted value, or
14335
+ * `undefined` when the conversion is refused (unknown unit / cross-dimension).
14336
+ * Never throws — a render caller falls back to the raw value + source unit.
14192
14337
  */
14193
- var NotificationSchema = object({
14194
- body: string(),
14195
- title: string().optional(),
14196
- format: NotificationFormatSchema.default("text"),
14197
- priority: number().int().min(1).max(5).default(3),
14198
- level: string().optional(),
14199
- attachments: array(AttachmentSchema).optional(),
14200
- clickUrl: string().optional(),
14201
- actions: array(NotificationActionSchema).optional(),
14202
- sound: string().optional(),
14203
- ttl: number().optional(),
14204
- tag: string().optional(),
14205
- deviceId: number().optional(),
14206
- eventId: string().optional(),
14207
- metadata: record(string(), unknown()).optional(),
14208
- /**
14209
- * Values for the parameters the target's kind DECLARES in
14210
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14211
- * declaration by the sender; a notifier reads only the keys it declared.
14212
- */
14213
- delivery: record(string(), DeliveryParamValueSchema).optional()
14338
+ function tryConvertUnit(value, from, to) {
14339
+ if (from === to) return value;
14340
+ const fromSpec = specFor(from);
14341
+ if (!fromSpec) return void 0;
14342
+ const toSpec = specFor(to);
14343
+ if (!toSpec) return void 0;
14344
+ if (fromSpec.dimension !== toSpec.dimension) return void 0;
14345
+ return fromCanonical(toCanonical(value, fromSpec), toSpec);
14346
+ }
14347
+ //#endregion
14348
+ //#region ../types/dist/index.mjs
14349
+ var SMTP_INBOUND_DEFAULT_PORT = 2525;
14350
+ var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
14351
+ var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
14352
+ /** The text excerpt a message carries on the bus. */
14353
+ var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
14354
+ var PortSchema = number().int().min(1).max(65535);
14355
+ /** A recipient local-part: what stands before the `@`. */
14356
+ var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
14357
+ object({
14358
+ port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
14359
+ bindHost: string().min(1).default("0.0.0.0"),
14360
+ domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
14361
+ requireAuth: boolean().default(true),
14362
+ username: string().default(""),
14363
+ password: string().default("").meta({ secret: true }),
14364
+ starttls: boolean().default(false),
14365
+ maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
14214
14366
  });
14215
- /** One declared native severity/priority level for a kind. */
14216
- var TargetKindLevelSchema = object({
14217
- id: string(),
14218
- label: string(),
14219
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14220
- ordinal: number().int().min(1).max(5).nullable(),
14221
- flags: object({
14222
- critical: boolean().optional(),
14223
- silent: boolean().optional(),
14224
- noPush: boolean().optional()
14225
- }).optional(),
14226
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14227
- requires: array(string()).optional(),
14228
- description: string().optional()
14367
+ object({
14368
+ host: string().min(1).nullable(),
14369
+ hostReason: string().nullable(),
14370
+ port: PortSchema,
14371
+ domain: string().min(1),
14372
+ requireAuth: boolean(),
14373
+ username: string(),
14374
+ password: string(),
14375
+ starttls: boolean()
14229
14376
  });
14230
- /** The full capability block consulted before dispatch. */
14231
- var TargetKindCapsSchema = object({
14232
- attachments: object({
14233
- mediaTypes: array(AttachmentMediaTypeSchema),
14234
- mode: _enum([
14235
- "url",
14236
- "bytes",
14237
- "both"
14238
- ]),
14239
- max: number().int().nonnegative(),
14240
- maxBytes: number().int().positive().optional()
14241
- }),
14242
- /** Max action buttons (0 = none). */
14243
- actions: number().int().nonnegative(),
14377
+ object({
14378
+ recipients: array(SmtpRecipientSchema).min(1),
14244
14379
  /**
14245
- * Whether this kind renders a per-action ICON.
14246
- *
14247
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14248
- * run on the addon cap path — three production failures in one day taught
14249
- * this repo that once. Absent is read as false by the degrade engine, which
14250
- * is the safe direction: an icon that is not rendered costs nothing, an icon
14251
- * assumed and dropped costs the operator's trust in the field.
14380
+ * Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
14381
+ * recipients (the way a consumer that restarted, or lost a device, declares its set again);
14382
+ * a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
14383
+ * Absent, the subscriber is anonymous and unique.
14252
14384
  */
14253
- actionIcons: boolean().optional(),
14254
- levels: array(TargetKindLevelSchema),
14255
- format: array(NotificationFormatSchema),
14256
- clickUrl: boolean(),
14257
- sound: boolean(),
14258
- ttl: boolean(),
14259
- bodyMaxLen: number().int().positive()
14385
+ subscriberId: string().min(1).max(64).optional()
14260
14386
  });
14261
- /**
14262
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14263
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14264
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14265
- * the union is large and not meant for runtime validation here; the exported
14266
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14267
- */
14268
- var ConfigSchemaPassthrough$4 = unknown();
14269
- var TargetKindSchema = object({
14270
- kind: string(),
14271
- label: string(),
14272
- icon: string(),
14387
+ var SmtpInboundAttachmentSchema = object({
14388
+ filename: string(),
14389
+ contentType: string(),
14390
+ bytes: number().int().nonnegative()
14391
+ });
14392
+ /** The payload of one `broker.message` (the key is the recipient local-part). */
14393
+ var SmtpInboundMessageSchema = object({
14394
+ /** Monotonic per mailbox; a gap tells a consumer it missed an event. */
14395
+ seq: number().int().positive(),
14396
+ messageId: string(),
14397
+ receivedAt: number().int().nonnegative(),
14398
+ from: string(),
14399
+ to: string(),
14400
+ subject: string(),
14401
+ text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
14402
+ attachments: array(SmtpInboundAttachmentSchema)
14403
+ });
14404
+ object({
14405
+ /** The newest seq issued so far (0 before any mail). */
14406
+ lastSeq: number().int().nonnegative(),
14407
+ /** The oldest seq still retained; messages below it are gone. */
14408
+ oldestSeq: number().int().nonnegative(),
14409
+ messages: array(object({
14410
+ key: string(),
14411
+ message: SmtpInboundMessageSchema
14412
+ }))
14413
+ });
14414
+ new Set([
14415
+ "track",
14416
+ "face",
14417
+ "identity",
14418
+ "plate",
14419
+ "vehicle",
14420
+ "scene",
14421
+ "motion",
14422
+ "object",
14423
+ "audio",
14424
+ "mosaic"
14425
+ ]);
14426
+ /**
14427
+ * The owner types that are event tables, in the order the event-media resolver
14428
+ * should consider them. Exported so a consumer asking "is this key an event?"
14429
+ * does not re-spell the list and drift from it.
14430
+ */
14431
+ var EVENT_OWNER_TYPES = [
14432
+ "motion",
14433
+ "object",
14434
+ "audio"
14435
+ ];
14436
+ /**
14437
+ * The same list as a Zod enum, for the cap inputs that must NAME the table
14438
+ * (D482: `getEventMedia` / `listEventMedia` take an owner, and an owner is
14439
+ * `(table, id)`).
14440
+ *
14441
+ * Built FROM {@link EVENT_OWNER_TYPES} rather than re-spelled: a fourth event
14442
+ * table would otherwise be accepted by the codec and refused at the door, with
14443
+ * nothing failing until a caller asked.
14444
+ */
14445
+ var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
14446
+ /** The same list as a Zod enum, for the cap input that carries it. */
14447
+ var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
14448
+ new Set(EVENT_OWNER_TYPES);
14449
+ /**
14450
+ * What a published package needs from the rest of the install (D989).
14451
+ *
14452
+ * One published framework package (`@camstack/server`) carries the kernel, the
14453
+ * builtins and the capability contracts, so "which addon runs on which
14454
+ * framework" is a question of version, and the answer is DECLARED by the
14455
+ * package that knows it:
14456
+ *
14457
+ * - an addon says the oldest server it runs on (`requires.server: ">=X"`);
14458
+ * - the server says the oldest addon it works with
14459
+ * (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
14460
+ * around it (`requires.wrapper: { desktop, image }`);
14461
+ * - a wrapper (the desktop app, the container starter) says which server
14462
+ * range it can host, and reports its own kind and version.
14463
+ *
14464
+ * The publish workflow STAMPS these after the version bump
14465
+ * (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
14466
+ *
14467
+ * A requirement that cannot be checked is NOT met: a shell that reports no
14468
+ * version counts as below the minimum, and an unreadable running version is
14469
+ * named in the result (a failed read is never a pass).
14470
+ */
14471
+ /** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
14472
+ var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
14473
+ object({
14474
+ /** The oldest `@camstack/server` this package runs on. */
14475
+ server: MinVersionSchema.optional(),
14476
+ /** The oldest installed version of each named addon package. */
14477
+ addons: record(string(), MinVersionSchema).optional(),
14478
+ /** The oldest shell around the server, per shell kind. */
14479
+ wrapper: object({
14480
+ desktop: MinVersionSchema.optional(),
14481
+ image: MinVersionSchema.optional()
14482
+ }).optional()
14483
+ });
14484
+ /** One unmet requirement; each names the versions on both sides. */
14485
+ var UnmetRequirementSchema = discriminatedUnion("kind", [
14486
+ object({
14487
+ kind: literal("server-too-old"),
14488
+ required: string(),
14489
+ /** `null` — the running server version could not be read. */
14490
+ running: string().nullable()
14491
+ }),
14492
+ object({
14493
+ kind: literal("addon-too-old"),
14494
+ packageName: string(),
14495
+ required: string(),
14496
+ /** `null` — the addon is not installed (or its version is unreadable). */
14497
+ running: string().nullable()
14498
+ }),
14499
+ object({
14500
+ kind: literal("wrapper-too-old"),
14501
+ wrapper: _enum(["desktop", "image"]),
14502
+ required: string(),
14503
+ /** `null` — the wrapper reported no version. */
14504
+ running: string().nullable()
14505
+ })
14506
+ ]);
14507
+ var RequiredAddonUpdateSchema = object({
14508
+ packageName: string(),
14509
+ /** The minimum the target server declares. */
14510
+ required: string(),
14511
+ /** What this node has; `null` when the addon is not installed. */
14512
+ installed: string().nullable()
14513
+ });
14514
+ /**
14515
+ * Which integration instance a settings form is for. An addon that serves several instances
14516
+ * (`instanceMode: multiple`) can show a different form per instance — an NVR integration
14517
+ * needs its connection, the default integration needs the addon's own sections.
14518
+ *
14519
+ * - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
14520
+ * setting up a NEW instance.
14521
+ * - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
14522
+ * - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
14523
+ */
14524
+ var IntegrationInstanceRefSchema = object({
14525
+ integrationId: string().nullable(),
14526
+ mode: _enum([
14527
+ "standalone",
14528
+ "account",
14529
+ "broker"
14530
+ ]),
14531
+ candidateStableId: string().optional()
14532
+ });
14533
+ /**
14534
+ * notification-output — canonical, capability-gated notification delivery.
14535
+ *
14536
+ * Apprise-derived model (see
14537
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14538
+ * callers emit ONE canonical `Notification`; each provider declares a
14539
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14540
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14541
+ * message to what the kind supports — callers never special-case a service.
14542
+ *
14543
+ * DESIGN DECISIONS (locked):
14544
+ * - A target is an INSTANCE of this function cap (epic #440, step 6): the
14545
+ * providers serve their targets as `integration-instances` records, one
14546
+ * record kind per target kind, and the admin lists, adds, edits, switches
14547
+ * and deletes them through that cap. This cap keeps what an instance cannot
14548
+ * say: the kind catalogue (`listTargetKinds`: capabilities, delivery
14549
+ * parameters, brand icon), dispatch (`send`, `testTarget`) and the form
14550
+ * helpers (`discoverTargets`, `probeTargetConfig`).
14551
+ * - `listTargetKinds` / `discoverTargets` return arrays → the generated
14552
+ * cap-mount auto-`concatCollection`-fans them across every registered
14553
+ * provider so one catalog is routable. `send` / `testTarget` /
14554
+ * `probeTargetConfig` route to ONE provider by the `addonId` the generated
14555
+ * collection router extracts from the call input.
14556
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14557
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14558
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14559
+ * base64 fallback needed.
14560
+ *
14561
+ * TODO (deferred, closed-set change — separate decision): add
14562
+ * `providerKind: 'notify'` so notification providers surface on the unified
14563
+ * admin "Integrations" page.
14564
+ */
14565
+ /**
14566
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14567
+ * adapter picks what it supports and the degrade engine filters the rest.
14568
+ */
14569
+ var AttachmentMediaTypeSchema = _enum([
14570
+ "image",
14571
+ "video",
14572
+ "gif",
14573
+ "audio",
14574
+ "icon"
14575
+ ]);
14576
+ /**
14577
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14578
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14579
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14580
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14581
+ */
14582
+ var AttachmentSchema = object({
14583
+ mediaType: AttachmentMediaTypeSchema,
14584
+ url: string().optional(),
14585
+ bytes: _instanceof(Uint8Array).optional(),
14586
+ mime: string().optional(),
14587
+ name: string().optional()
14588
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14589
+ var NotificationFormatSchema = _enum([
14590
+ "text",
14591
+ "markdown",
14592
+ "html"
14593
+ ]);
14594
+ /**
14595
+ * The CLOSED icon vocabulary an action button may use.
14596
+ *
14597
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14598
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14599
+ * notices — the same class of gap as a zone vocabulary nothing produced
14600
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14601
+ * declares `actionIcons: false` and the degrade engine strips the field.
14602
+ *
14603
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14604
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14605
+ * differently.
14606
+ *
14607
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14608
+ *
14609
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14610
+ * the whole set onto its own renderer's vocabulary through a
14611
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14612
+ * fallback, so adding a member here fails every adapter's build until someone
14613
+ * decides its glyph, which is the only place that decision can be made
14614
+ * honestly.
14615
+ *
14616
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14617
+ * `disarm` straight through; iOS feeds that string to
14618
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14619
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14620
+ * mapping, and "the field is documented" is not "the value renders".
14621
+ *
14622
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14623
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14624
+ * so an addon that emits a token the running hub does not know does not lose an
14625
+ * icon — its whole `send` fails Zod validation and the notification never
14626
+ * arrives. Never emit a new token from an addon before the train carrying it.
14627
+ */
14628
+ var NotificationActionIconSchema = _enum([
14629
+ "acknowledge",
14630
+ "dismiss",
14631
+ "silence",
14632
+ "snooze",
14633
+ "view",
14634
+ "play",
14635
+ "open",
14636
+ "close",
14637
+ "lock",
14638
+ "unlock",
14639
+ "arm",
14640
+ "arm-home",
14641
+ "arm-away",
14642
+ "arm-night",
14643
+ "disarm",
14644
+ "light",
14645
+ "alert",
14646
+ "camera"
14647
+ ]);
14648
+ /** A single tap-through action button. */
14649
+ var NotificationActionSchema = object({
14650
+ id: string(),
14651
+ label: string(),
14652
+ url: string().optional(),
14653
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14654
+ icon: NotificationActionIconSchema.optional(),
14655
+ /**
14656
+ * Renders in a warning style where the notifier supports it.
14657
+ *
14658
+ * A HINT, never a gate. The callback's authority is its token and nothing
14659
+ * else — see `notification-center/action-token.ts` for what that does and
14660
+ * does not buy.
14661
+ */
14662
+ destructive: boolean().optional(),
14663
+ /**
14664
+ * How the tap should REACH the url.
14665
+ *
14666
+ * `navigate` (absent, and every button authored before this field) opens it:
14667
+ * the phone leaves the notification and shows whatever the callback returns.
14668
+ * That is right for a button whose answer the operator wants to read.
14669
+ *
14670
+ * `background` fires it as a POST and stays put. It exists for the buttons
14671
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14672
+ * an answer to the notification, and being thrown into a browser tab to
14673
+ * confirm it costs more attention than the notification did. A backend that
14674
+ * cannot do a background call renders it as an ordinary link (the adapters
14675
+ * fall back rather than dropping the button), so this is a preference, never
14676
+ * a requirement.
14677
+ */
14678
+ mode: _enum(["navigate", "background"]).optional()
14679
+ });
14680
+ /** A delivery parameter value: what a notifier declared it takes. */
14681
+ var DeliveryParamValueSchema = union([
14682
+ string(),
14683
+ number(),
14684
+ boolean()
14685
+ ]);
14686
+ /**
14687
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14688
+ * addresses a target of that kind may set it; a kind that declares nothing is
14689
+ * never handed one. The admin UI derives its control from this descriptor —
14690
+ * no editor knows a service by name.
14691
+ *
14692
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14693
+ * run on the addon cap path).
14694
+ */
14695
+ var DeliveryParamSchema = object({
14696
+ key: string().min(1),
14697
+ label: string(),
14698
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14699
+ labelKey: string().optional(),
14700
+ type: _enum([
14701
+ "enum",
14702
+ "number",
14703
+ "boolean",
14704
+ "string"
14705
+ ]),
14706
+ /** `enum` only: the closed set of accepted values. */
14707
+ options: array(object({
14708
+ value: string(),
14709
+ label: string()
14710
+ })).optional(),
14711
+ /** `number` only. */
14712
+ min: number().optional(),
14713
+ max: number().optional(),
14714
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14715
+ default: DeliveryParamValueSchema.optional()
14716
+ });
14717
+ /**
14718
+ * The canonical notification. `body` is the only hard field (Apprise model).
14719
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14720
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14721
+ * the adapter maps this ordinal onto its native level. `level?` is an
14722
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14723
+ * `priority` for that one target.
14724
+ */
14725
+ var NotificationSchema = object({
14726
+ body: string(),
14727
+ title: string().optional(),
14728
+ format: NotificationFormatSchema.default("text"),
14729
+ priority: number().int().min(1).max(5).default(3),
14730
+ level: string().optional(),
14731
+ attachments: array(AttachmentSchema).optional(),
14732
+ clickUrl: string().optional(),
14733
+ actions: array(NotificationActionSchema).optional(),
14734
+ sound: string().optional(),
14735
+ ttl: number().optional(),
14736
+ tag: string().optional(),
14737
+ deviceId: number().optional(),
14738
+ eventId: string().optional(),
14739
+ metadata: record(string(), unknown()).optional(),
14740
+ /**
14741
+ * Values for the parameters the target's kind DECLARES in
14742
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14743
+ * declaration by the sender; a notifier reads only the keys it declared.
14744
+ */
14745
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14746
+ });
14747
+ /** One declared native severity/priority level for a kind. */
14748
+ var TargetKindLevelSchema = object({
14749
+ id: string(),
14750
+ label: string(),
14751
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14752
+ ordinal: number().int().min(1).max(5).nullable(),
14753
+ flags: object({
14754
+ critical: boolean().optional(),
14755
+ silent: boolean().optional(),
14756
+ noPush: boolean().optional()
14757
+ }).optional(),
14758
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14759
+ requires: array(string()).optional(),
14760
+ description: string().optional()
14761
+ });
14762
+ /** The full capability block consulted before dispatch. */
14763
+ var TargetKindCapsSchema = object({
14764
+ attachments: object({
14765
+ mediaTypes: array(AttachmentMediaTypeSchema),
14766
+ mode: _enum([
14767
+ "url",
14768
+ "bytes",
14769
+ "both"
14770
+ ]),
14771
+ max: number().int().nonnegative(),
14772
+ maxBytes: number().int().positive().optional()
14773
+ }),
14774
+ /** Max action buttons (0 = none). */
14775
+ actions: number().int().nonnegative(),
14776
+ /**
14777
+ * Whether this kind renders a per-action ICON.
14778
+ *
14779
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14780
+ * run on the addon cap path — three production failures in one day taught
14781
+ * this repo that once. Absent is read as false by the degrade engine, which
14782
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14783
+ * assumed and dropped costs the operator's trust in the field.
14784
+ */
14785
+ actionIcons: boolean().optional(),
14786
+ levels: array(TargetKindLevelSchema),
14787
+ format: array(NotificationFormatSchema),
14788
+ clickUrl: boolean(),
14789
+ sound: boolean(),
14790
+ ttl: boolean(),
14791
+ bodyMaxLen: number().int().positive()
14792
+ });
14793
+ /**
14794
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14795
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14796
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14797
+ * the union is large and not meant for runtime validation here; the exported
14798
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14799
+ */
14800
+ var ConfigSchemaPassthrough$3 = unknown();
14801
+ var TargetKindSchema = object({
14802
+ kind: string(),
14803
+ label: string(),
14804
+ icon: string(),
14273
14805
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
14274
14806
  addonId: string(),
14275
14807
  /**
@@ -14302,7 +14834,7 @@ var TargetKindSchema = object({
14302
14834
  * its raster path, which is the safe default for an unknown image.
14303
14835
  */
14304
14836
  iconMediaType: string().optional(),
14305
- configSchema: ConfigSchemaPassthrough$4,
14837
+ configSchema: ConfigSchemaPassthrough$3,
14306
14838
  /**
14307
14839
  * The config keys that decide WHERE this kind's secrets are sent (server,
14308
14840
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -14324,9 +14856,11 @@ var TargetKindSchema = object({
14324
14856
  caps: TargetKindCapsSchema
14325
14857
  });
14326
14858
  /**
14327
- * A persisted target. `config` holds secrets; providers REDACT secret fields
14328
- * (return a presence marker only) when serving `listTargets` — never
14329
- * round-trip a stored secret to the UI.
14859
+ * A target as a provider's own code sees it (the notification-center bridge, the
14860
+ * send path): the flat record body split into the name, the switch and the
14861
+ * kind's fields. `config` holds secrets; a reader that serves it to a client
14862
+ * REDACTS secret fields (a presence marker only) — never round-trip a stored
14863
+ * secret to the UI.
14330
14864
  */
14331
14865
  var TargetSchema = object({
14332
14866
  id: string(),
@@ -14369,13 +14903,13 @@ var ProbeTargetConfigResultSchema = object({
14369
14903
  stateInstance: string().optional(),
14370
14904
  error: string().optional()
14371
14905
  });
14372
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14906
+ method(object({}), array(TargetKindSchema)), method(object({
14373
14907
  kind: string(),
14374
14908
  config: record(string(), unknown()).optional(),
14375
14909
  /**
14376
14910
  * When editing / duplicating, the blank password field never round-trips
14377
14911
  * the stored token. Pass the source target id so the provider can restore
14378
- * secrets server-side before dialling (same merge as upsert).
14912
+ * secrets server-side before dialling.
14379
14913
  */
14380
14914
  targetId: string().optional()
14381
14915
  }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
@@ -14398,27 +14932,6 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
14398
14932
  }), TestResultSchema, {
14399
14933
  kind: "mutation",
14400
14934
  auth: "admin"
14401
- }), method(object({
14402
- target: TargetSchema,
14403
- /**
14404
- * Duplicate flow: create a NEW target id while copying secrets from an
14405
- * existing row. The UI never holds the stored token; blank / redacted
14406
- * password fields are restored from this source (D634 still applies if
14407
- * destinations diverge without a re-typed secret).
14408
- */
14409
- cloneSecretsFrom: string().optional()
14410
- }), TargetSchema, {
14411
- kind: "mutation",
14412
- auth: "admin"
14413
- }), method(object({ targetId: string() }), _void(), {
14414
- kind: "mutation",
14415
- auth: "admin"
14416
- }), method(object({
14417
- targetId: string(),
14418
- enabled: boolean()
14419
- }), _void(), {
14420
- kind: "mutation",
14421
- auth: "admin"
14422
14935
  });
14423
14936
  looseObject({
14424
14937
  name: string().min(1),
@@ -23319,7 +23832,6 @@ var SYSTEM_CAP_VOCABULARY = {
23319
23832
  "notification-output": system("notification delivery — reached through notifier devices and rules"),
23320
23833
  "notification-rules": system("notification rules — authored on their own page"),
23321
23834
  "oauth-integration": system(IDENTITY),
23322
- "oidc-connections": system(IDENTITY),
23323
23835
  "osd-manager": system(PIPELINE),
23324
23836
  "pipeline-executor": system(PIPELINE),
23325
23837
  "pipeline-orchestrator": system(PIPELINE),
@@ -43127,722 +43639,344 @@ var ICON_SYNONYMS = {
43127
43639
  "deposito",
43128
43640
  "cantina",
43129
43641
  "warehouse"
43130
- ],
43131
- "washing-machine": [
43132
- "lavatrice",
43133
- "lavastoviglie",
43134
- "asciugatrice"
43135
- ],
43136
- waves: [
43137
- "onde",
43138
- "acqua",
43139
- "vibrazione"
43140
- ],
43141
- "waves-ladder": [
43142
- "piscina",
43143
- "vasca",
43144
- "pool"
43145
- ],
43146
- wifi: ["rete", "segnale"],
43147
- "wifi-off": [
43148
- "wifi",
43149
- "assente",
43150
- "offline",
43151
- "disconnesso"
43152
- ],
43153
- wind: [
43154
- "vento",
43155
- "aria",
43156
- "gas",
43157
- "monossido",
43158
- "co"
43159
- ],
43160
- workflow: [
43161
- "automazione",
43162
- "flusso",
43163
- "scenario"
43164
- ],
43165
- wrench: [
43166
- "officina",
43167
- "manutenzione",
43168
- "attrezzi",
43169
- "utenze"
43170
- ],
43171
- zap: [
43172
- "energia",
43173
- "corrente",
43174
- "consumo",
43175
- "watt",
43176
- "elettricita"
43177
- ]
43178
- };
43179
- /**
43180
- * Spellings an operator may already have PERSISTED that no lucide package
43181
- * accepts any more, and the catalog key they draw. They resolve
43182
- * (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
43183
- * pre-catalog spelling of `gauge`.
43184
- */
43185
- var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
43186
- /**
43187
- * icon-catalog — THE icon vocabulary (D854).
43188
- *
43189
- * Every place that picks or stores an icon — a device's display override, a
43190
- * location, a site zone, a viewer accessory, an `icon` settings field — names
43191
- * it by a key of this catalog and nothing else. There is no curated subset and
43192
- * no second list: the catalog is every lucide icon that both surfaces can draw
43193
- * (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
43194
- * intersection computed by `scripts/generate-icon-catalog.ts` into the
43195
- * committed `icon-catalog.generated.ts`.
43196
- *
43197
- * Like the vocabularies it replaces, this module holds STRINGS only — no React,
43198
- * no lucide import, no glyph. Each surface owns its glyph table (the web one
43199
- * lives in `ui-library`, loaded lazily), and a test on each side pins that it
43200
- * covers {@link ICON_KEYS}.
43201
- *
43202
- * ## What is persisted
43203
- *
43204
- * The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
43205
- * package still accepts (`home` for `house`) and this repo's own legacy ones
43206
- * (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
43207
- * stale, but they are never OFFERED by search.
43208
- *
43209
- * ## Search
43210
- *
43211
- * Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
43212
- * the caller adds, and lucide's English tags — in that order of weight.
43213
- */
43214
- var KEY_SET$2 = new Set(ICON_KEYS);
43215
- new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
43216
- /** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
43217
- function isIconKey(value) {
43218
- return typeof value === "string" && KEY_SET$2.has(value);
43219
- }
43220
- /**
43221
- * Wire/storage schema for one icon key.
43222
- *
43223
- * Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
43224
- * into every cap router, type and API-reference row that carries an icon. The
43225
- * check is membership in the catalog and the type is {@link IconKey}.
43226
- */
43227
- var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
43228
- var ENTRIES = ICON_KEYS.map((key, index) => {
43229
- const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
43230
- const categories = categoryIndexes.flatMap((i) => {
43231
- const id = ICON_CATEGORY_IDS[i];
43232
- return id === void 0 ? [] : [id];
43233
- });
43234
- return {
43235
- key,
43236
- categories,
43237
- primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
43238
- tags,
43239
- synonyms: ICON_SYNONYMS[key] ?? []
43240
- };
43241
- });
43242
- new Map(ENTRIES.map((e) => [e.key, e]));
43243
- /** Categories a picker offers first: the ones this product's icons mostly live in. */
43244
- var LEADING_CATEGORIES = [
43245
- "devices",
43246
- "home",
43247
- "security",
43248
- "buildings",
43249
- "connectivity",
43250
- "multimedia",
43251
- "nature",
43252
- "weather",
43253
- "transportation",
43254
- "animals"
43255
- ];
43256
- var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
43257
- [...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
43258
- /**
43259
- * One (location, icon) assignment as it travels.
43260
- *
43261
- * `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
43262
- * operator's casing. The registry matches labels trimmed + case-insensitively
43263
- * everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
43264
- * case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
43265
- * map keyed on the displayed casing would orphan its entry on exactly that
43266
- * edit. Consumers join by keying their own label through `locationIconKey`.
43267
- */
43268
- var LocationIconAssignmentSchema = object({
43269
- locationKey: string(),
43270
- icon: IconKeySchema
43271
- });
43272
- /**
43273
- * One (location, description) assignment as it travels.
43274
- *
43275
- * Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
43276
- * reason: this lived for a while in the post-analysis addon's own settings,
43277
- * keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
43278
- * the Locations page carried the icon and silently orphaned the description —
43279
- * two authorities for one thing, joined by two different rules. Now both hang
43280
- * off the location itself, on `locationIconKey`.
43281
- */
43282
- var LocationDescriptionAssignmentSchema = object({
43283
- locationKey: string(),
43284
- description: string()
43285
- });
43286
- /**
43287
- * WHO an action step acts on (D983) — one target shape for every place that
43288
- * performs an action (automation steps, Action entries, notification
43289
- * sequences, scheduler points):
43290
- *
43291
- * - `devices` — device ids the operator picked, frozen at save time;
43292
- * - `domain` — every device that offers the step's VOCABULARY action,
43293
- * optionally narrowed to one device type and one room, resolved WHEN THE
43294
- * STEP RUNS (a device added later is included). The action always comes
43295
- * from the vocabulary (`cover.open`), never from a raw cap name, so a
43296
- * `domain` target needs an `actionId` (enforced on the step schema);
43297
- * - `var` — a `$var` resolved from the run's scope.
43298
- *
43299
- * {@link ActionTargetResolver} turns a target into device ids. It is pure
43300
- * (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
43301
- * a generated automation block share it.
43302
- *
43303
- * A room is the device's `location` label (`DeviceInfo.location`); two labels
43304
- * name the same room when `locationIconKey` agrees (trimmed, lower-cased).
43305
- */
43306
- var ActionTargetSchema = discriminatedUnion("kind", [
43307
- object({
43308
- kind: literal("devices"),
43309
- ids: array(number().int()).min(1)
43310
- }),
43311
- object({
43312
- kind: literal("domain"),
43313
- /** Narrow to one kind of device. */
43314
- deviceType: _enum(DeviceType).optional(),
43315
- /** Narrow to one room: the `location` label devices carry. */
43316
- roomId: string().min(1).optional()
43317
- }),
43318
- object({
43319
- kind: literal("var"),
43320
- name: string().min(1)
43321
- })
43322
- ]);
43323
- EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
43324
- var ExpressionBindingSourceSchema = union([
43325
- object({
43326
- kind: literal("field").optional(),
43327
- sourceKey: string(),
43328
- cap: string(),
43329
- fieldPath: string()
43330
- }),
43331
- object({
43332
- kind: literal("literal"),
43333
- value: union([
43334
- string(),
43335
- number(),
43336
- boolean(),
43337
- _null()
43338
- ])
43339
- }),
43340
- object({
43341
- kind: literal("global"),
43342
- sourceStableId: string(),
43343
- cap: string(),
43344
- fieldPath: string()
43345
- })
43346
- ]);
43347
- object({
43348
- expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
43349
- bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
43350
- }).superRefine((src, ctx) => {
43351
- const err = validateExpressionSource(src);
43352
- if (err !== null) ctx.addIssue({
43353
- code: "custom",
43354
- message: err,
43355
- path: ["expr"]
43356
- });
43357
- });
43358
- /**
43359
- * Identity envelope for a device's upstream-system metadata.
43360
- *
43361
- * Two jobs:
43362
- *
43363
- * 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
43364
- * uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
43365
- * WS-Discovery endpoint UUID, …). Provider code keeps a
43366
- * `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
43367
- * without round-tripping through `stableId` / `id` mappings.
43368
- *
43369
- * 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
43370
- * one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
43371
- * for vendors where MAC is the natural key). For systems where the
43372
- * live dispatch key can be renamed (HA `entity_id` can be edited),
43373
- * providers detect renames by matching `uniqueId` and patch `id`
43374
- * in-place so dispatch keeps working.
43375
- *
43376
- * **Display unit and precision are NOT stored here.** They are a read-time
43377
- * preference (D944). A polymorphic reading stores its `quantity` here once,
43378
- * at adopt, and a date/time value stores `dateTimeShape` the same way —
43379
- * neither is repeated on each sample. The `device_class` tag is an
43380
- * HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
43381
- * to derive the CamStack `DeviceRole`; it is never stored after that point.
43382
- *
43383
- * The `raw` escape hatch carries provider-specific attributes that don't
43384
- * fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
43385
- * details, …). Providers control what lands here.
43386
- */
43387
- var SourceInfoSchema = object({
43388
- /** Live dispatch key — mutable when the source system allows rename. */
43389
- id: string(),
43390
- /** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
43391
- system: string(),
43392
- /** Immutable upstream identifier when available (HA `unique_id`, … ).
43393
- * Used to detect rename when `id` changes. */
43394
- uniqueId: string().optional(),
43395
- /** Quantity of a polymorphic reading, written once at adopt (D944). */
43396
- quantity: ReadingQuantitySchema.optional(),
43397
- /** Date / time / datetime shape of a string reading, written once at adopt. */
43398
- dateTimeShape: _enum([
43399
- "date",
43400
- "time",
43401
- "datetime"
43402
- ]).optional(),
43403
- /** Provider-specific extras that don't fit the structured slots.
43404
- * Whitelist what goes here per provider — do NOT dump entire HA
43405
- * attribute blobs (would explode the meta JSON column). */
43406
- raw: record(string(), unknown()).optional()
43407
- });
43408
- /**
43409
- * Build the synthetic SourceInfo every existing provider falls back to
43410
- * when no upstream value has been persisted. Keeps non-migrated providers
43411
- * (Reolink / Hikvision / ONVIF / RTSP) functional without code
43412
- * changes — `id` reuses the CamStack stableId, `system` reuses the addon
43413
- * id. Real upstream identity replaces this once a provider migrates and
43414
- * calls `updateSourceInfo()` with concrete values.
43415
- */
43416
- function synthesizeSourceInfo(input) {
43417
- return {
43418
- id: input.stableId,
43419
- system: input.addonId
43420
- };
43421
- }
43422
- /**
43423
- * Shallow-merge a partial patch over a prior SourceInfo. `undefined`
43424
- * patch values are ignored (no field clobber); to clear a field
43425
- * explicitly, providers omit it from the patch and rebuild from scratch
43426
- * via `updateSourceInfo({})` cycles — uncommon enough that we don't
43427
- * bother with a `null`-means-delete sentinel.
43428
- *
43429
- * The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
43430
- * merges over existing `raw` keys instead of replacing the whole bag.
43431
- */
43432
- function mergeSourceInfo(prev, patch) {
43433
- const next = { ...prev };
43434
- for (const [k, v] of Object.entries(patch)) {
43435
- if (v === void 0) continue;
43436
- if (k === "raw" && typeof v === "object" && v !== null) {
43437
- next.raw = {
43438
- ...prev.raw,
43439
- ...v
43440
- };
43441
- continue;
43442
- }
43443
- next[k] = v;
43444
- }
43445
- return next;
43446
- }
43447
- /**
43448
- * Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
43449
- * blob is a free-form `Record<string, unknown>` shared with hardware-
43450
- * identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
43451
- * lives under a single nested key to keep it composable with those.
43452
- */
43453
- var SOURCE_INFO_METADATA_KEY = "sourceInfo";
43454
- /**
43455
- * Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
43456
- * with Zod. Returns `null` when the blob is missing or the nested
43457
- * `sourceInfo` key fails validation — callers fall back to the
43458
- * synthetic default in that case (see `synthesizeSourceInfo`).
43459
- */
43460
- function extractSourceInfoFromMetadata(metadata) {
43461
- if (!metadata) return null;
43462
- const raw = metadata[SOURCE_INFO_METADATA_KEY];
43463
- if (!raw) return null;
43464
- const parsed = SourceInfoSchema.safeParse(raw);
43465
- if (!parsed.success) return null;
43466
- return parsed.data;
43467
- }
43468
- /**
43469
- * Frozen unit → spec table. `•` in the doc marks each dimension's canonical
43470
- * unit (`factor: 1, offset: 0`). °F derives from `°C = (°F − 32) × 5/9` ⇒
43471
- * `factor = 5/9`, `offset = -160/9` (kept as exact expressions, not rounded
43472
- * decimals). K derives from `°C = K − 273.15`.
43473
- */
43474
- var UNIT_TABLE = {
43475
- "°C": {
43476
- dimension: "temperature",
43477
- factor: 1,
43478
- offset: 0
43479
- },
43480
- "°F": {
43481
- dimension: "temperature",
43482
- factor: 5 / 9,
43483
- offset: -160 / 9
43484
- },
43485
- K: {
43486
- dimension: "temperature",
43487
- factor: 1,
43488
- offset: -273.15
43489
- },
43490
- hPa: {
43491
- dimension: "pressure",
43492
- factor: 1,
43493
- offset: 0
43494
- },
43495
- kPa: {
43496
- dimension: "pressure",
43497
- factor: 10,
43498
- offset: 0
43499
- },
43500
- Pa: {
43501
- dimension: "pressure",
43502
- factor: .01,
43503
- offset: 0
43504
- },
43505
- mbar: {
43506
- dimension: "pressure",
43507
- factor: 1,
43508
- offset: 0
43509
- },
43510
- bar: {
43511
- dimension: "pressure",
43512
- factor: 1e3,
43513
- offset: 0
43514
- },
43515
- inHg: {
43516
- dimension: "pressure",
43517
- factor: 33.8639,
43518
- offset: 0
43519
- },
43520
- mmHg: {
43521
- dimension: "pressure",
43522
- factor: 1.33322,
43523
- offset: 0
43524
- },
43525
- psi: {
43526
- dimension: "pressure",
43527
- factor: 68.9476,
43528
- offset: 0
43529
- },
43530
- "m/s": {
43531
- dimension: "speed",
43532
- factor: 1,
43533
- offset: 0
43534
- },
43535
- "km/h": {
43536
- dimension: "speed",
43537
- factor: 1 / 3.6,
43538
- offset: 0
43539
- },
43540
- mph: {
43541
- dimension: "speed",
43542
- factor: .44704,
43543
- offset: 0
43544
- },
43545
- kn: {
43546
- dimension: "speed",
43547
- factor: .514444,
43548
- offset: 0
43549
- },
43550
- "mm/h": {
43551
- dimension: "precipitation-rate",
43552
- factor: 1,
43553
- offset: 0
43554
- },
43555
- "in/h": {
43556
- dimension: "precipitation-rate",
43557
- factor: 25.4,
43558
- offset: 0
43559
- },
43560
- m: {
43561
- dimension: "length",
43562
- factor: 1,
43563
- offset: 0
43564
- },
43565
- mm: {
43566
- dimension: "length",
43567
- factor: .001,
43568
- offset: 0
43569
- },
43570
- cm: {
43571
- dimension: "length",
43572
- factor: .01,
43573
- offset: 0
43574
- },
43575
- km: {
43576
- dimension: "length",
43577
- factor: 1e3,
43578
- offset: 0
43579
- },
43580
- in: {
43581
- dimension: "length",
43582
- factor: .0254,
43583
- offset: 0
43584
- },
43585
- ft: {
43586
- dimension: "length",
43587
- factor: .3048,
43588
- offset: 0
43589
- },
43590
- mi: {
43591
- dimension: "length",
43592
- factor: 1609.344,
43593
- offset: 0
43594
- },
43595
- "m²": {
43596
- dimension: "area",
43597
- factor: 1,
43598
- offset: 0
43599
- },
43600
- lx: {
43601
- dimension: "illuminance",
43602
- factor: 1,
43603
- offset: 0
43604
- },
43605
- "W/m²": {
43606
- dimension: "irradiance",
43607
- factor: 1,
43608
- offset: 0
43609
- },
43610
- W: {
43611
- dimension: "power",
43612
- factor: 1,
43613
- offset: 0
43614
- },
43615
- kW: {
43616
- dimension: "power",
43617
- factor: 1e3,
43618
- offset: 0
43619
- },
43620
- VA: {
43621
- dimension: "apparent-power",
43622
- factor: 1,
43623
- offset: 0
43624
- },
43625
- Wh: {
43626
- dimension: "energy",
43627
- factor: 1,
43628
- offset: 0
43629
- },
43630
- kWh: {
43631
- dimension: "energy",
43632
- factor: 1e3,
43633
- offset: 0
43634
- },
43635
- MWh: {
43636
- dimension: "energy",
43637
- factor: 1e6,
43638
- offset: 0
43639
- },
43640
- V: {
43641
- dimension: "voltage",
43642
- factor: 1,
43643
- offset: 0
43644
- },
43645
- mV: {
43646
- dimension: "voltage",
43647
- factor: .001,
43648
- offset: 0
43649
- },
43650
- A: {
43651
- dimension: "current",
43652
- factor: 1,
43653
- offset: 0
43654
- },
43655
- mA: {
43656
- dimension: "current",
43657
- factor: .001,
43658
- offset: 0
43659
- },
43660
- ppm: {
43661
- dimension: "concentration-volume",
43662
- factor: 1,
43663
- offset: 0
43664
- },
43665
- ppb: {
43666
- dimension: "concentration-volume",
43667
- factor: .001,
43668
- offset: 0
43669
- },
43670
- "µg/m³": {
43671
- dimension: "concentration-mass",
43672
- factor: 1,
43673
- offset: 0
43674
- },
43675
- "mg/m³": {
43676
- dimension: "concentration-mass",
43677
- factor: 1e3,
43678
- offset: 0
43679
- },
43680
- kg: {
43681
- dimension: "mass",
43682
- factor: 1,
43683
- offset: 0
43684
- },
43685
- g: {
43686
- dimension: "mass",
43687
- factor: .001,
43688
- offset: 0
43689
- },
43690
- lb: {
43691
- dimension: "mass",
43692
- factor: .453592,
43693
- offset: 0
43694
- },
43695
- oz: {
43696
- dimension: "mass",
43697
- factor: .0283495,
43698
- offset: 0
43699
- },
43700
- "%": {
43701
- dimension: "percentage",
43702
- factor: 1,
43703
- offset: 0
43704
- },
43705
- L: {
43706
- dimension: "volume",
43707
- factor: 1,
43708
- offset: 0
43709
- },
43710
- mL: {
43711
- dimension: "volume",
43712
- factor: .001,
43713
- offset: 0
43714
- },
43715
- gal: {
43716
- dimension: "volume",
43717
- factor: 3.785411784,
43718
- offset: 0
43719
- },
43720
- s: {
43721
- dimension: "duration",
43722
- factor: 1,
43723
- offset: 0
43724
- },
43725
- ms: {
43726
- dimension: "duration",
43727
- factor: .001,
43728
- offset: 0
43729
- },
43730
- min: {
43731
- dimension: "duration",
43732
- factor: 60,
43733
- offset: 0
43734
- },
43735
- h: {
43736
- dimension: "duration",
43737
- factor: 3600,
43738
- offset: 0
43739
- },
43740
- d: {
43741
- dimension: "duration",
43742
- factor: 86400,
43743
- offset: 0
43744
- },
43745
- B: {
43746
- dimension: "information",
43747
- factor: 1,
43748
- offset: 0
43749
- },
43750
- KiB: {
43751
- dimension: "information",
43752
- factor: 1024,
43753
- offset: 0
43754
- },
43755
- MiB: {
43756
- dimension: "information",
43757
- factor: 1024 ** 2,
43758
- offset: 0
43759
- },
43760
- GiB: {
43761
- dimension: "information",
43762
- factor: 1024 ** 3,
43763
- offset: 0
43764
- },
43765
- TiB: {
43766
- dimension: "information",
43767
- factor: 1024 ** 4,
43768
- offset: 0
43769
- },
43770
- kB: {
43771
- dimension: "information",
43772
- factor: 1e3,
43773
- offset: 0
43774
- },
43775
- MB: {
43776
- dimension: "information",
43777
- factor: 1e6,
43778
- offset: 0
43779
- },
43780
- GB: {
43781
- dimension: "information",
43782
- factor: 1e9,
43783
- offset: 0
43784
- },
43785
- "°": {
43786
- dimension: "angle",
43787
- factor: 1,
43788
- offset: 0
43789
- },
43790
- dBFS: {
43791
- dimension: "sound-level",
43792
- factor: 1,
43793
- offset: 0
43794
- },
43795
- dBm: {
43796
- dimension: "signal-level",
43797
- factor: 1,
43798
- offset: 0
43799
- },
43800
- mired: {
43801
- dimension: "colour-temperature",
43802
- factor: 1,
43803
- offset: 0
43804
- },
43805
- kbps: {
43806
- dimension: "bitrate",
43807
- factor: 1,
43808
- offset: 0
43809
- },
43810
- Mbps: {
43811
- dimension: "bitrate",
43812
- factor: 1e3,
43813
- offset: 0
43814
- },
43815
- fps: {
43816
- dimension: "rate",
43817
- factor: 1,
43818
- offset: 0
43819
- }
43642
+ ],
43643
+ "washing-machine": [
43644
+ "lavatrice",
43645
+ "lavastoviglie",
43646
+ "asciugatrice"
43647
+ ],
43648
+ waves: [
43649
+ "onde",
43650
+ "acqua",
43651
+ "vibrazione"
43652
+ ],
43653
+ "waves-ladder": [
43654
+ "piscina",
43655
+ "vasca",
43656
+ "pool"
43657
+ ],
43658
+ wifi: ["rete", "segnale"],
43659
+ "wifi-off": [
43660
+ "wifi",
43661
+ "assente",
43662
+ "offline",
43663
+ "disconnesso"
43664
+ ],
43665
+ wind: [
43666
+ "vento",
43667
+ "aria",
43668
+ "gas",
43669
+ "monossido",
43670
+ "co"
43671
+ ],
43672
+ workflow: [
43673
+ "automazione",
43674
+ "flusso",
43675
+ "scenario"
43676
+ ],
43677
+ wrench: [
43678
+ "officina",
43679
+ "manutenzione",
43680
+ "attrezzi",
43681
+ "utenze"
43682
+ ],
43683
+ zap: [
43684
+ "energia",
43685
+ "corrente",
43686
+ "consumo",
43687
+ "watt",
43688
+ "elettricita"
43689
+ ]
43820
43690
  };
43821
- /** Resolve a unit's `UnitSpec`, or `undefined` when the spelling is unknown. */
43822
- function specFor(unit) {
43823
- return Object.hasOwn(UNIT_TABLE, unit) ? UNIT_TABLE[unit] : void 0;
43691
+ /**
43692
+ * Spellings an operator may already have PERSISTED that no lucide package
43693
+ * accepts any more, and the catalog key they draw. They resolve
43694
+ * (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
43695
+ * pre-catalog spelling of `gauge`.
43696
+ */
43697
+ var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
43698
+ /**
43699
+ * icon-catalog — THE icon vocabulary (D854).
43700
+ *
43701
+ * Every place that picks or stores an icon — a device's display override, a
43702
+ * location, a site zone, a viewer accessory, an `icon` settings field — names
43703
+ * it by a key of this catalog and nothing else. There is no curated subset and
43704
+ * no second list: the catalog is every lucide icon that both surfaces can draw
43705
+ * (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
43706
+ * intersection computed by `scripts/generate-icon-catalog.ts` into the
43707
+ * committed `icon-catalog.generated.ts`.
43708
+ *
43709
+ * Like the vocabularies it replaces, this module holds STRINGS only — no React,
43710
+ * no lucide import, no glyph. Each surface owns its glyph table (the web one
43711
+ * lives in `ui-library`, loaded lazily), and a test on each side pins that it
43712
+ * covers {@link ICON_KEYS}.
43713
+ *
43714
+ * ## What is persisted
43715
+ *
43716
+ * The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
43717
+ * package still accepts (`home` for `house`) and this repo's own legacy ones
43718
+ * (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
43719
+ * stale, but they are never OFFERED by search.
43720
+ *
43721
+ * ## Search
43722
+ *
43723
+ * Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
43724
+ * the caller adds, and lucide's English tags — in that order of weight.
43725
+ */
43726
+ var KEY_SET$2 = new Set(ICON_KEYS);
43727
+ new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
43728
+ /** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
43729
+ function isIconKey(value) {
43730
+ return typeof value === "string" && KEY_SET$2.has(value);
43824
43731
  }
43825
- /** Value in `spec`'s unit → its dimension's canonical unit. */
43826
- function toCanonical(value, spec) {
43827
- return value * spec.factor + spec.offset;
43732
+ /**
43733
+ * Wire/storage schema for one icon key.
43734
+ *
43735
+ * Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
43736
+ * into every cap router, type and API-reference row that carries an icon. The
43737
+ * check is membership in the catalog and the type is {@link IconKey}.
43738
+ */
43739
+ var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
43740
+ var ENTRIES = ICON_KEYS.map((key, index) => {
43741
+ const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
43742
+ const categories = categoryIndexes.flatMap((i) => {
43743
+ const id = ICON_CATEGORY_IDS[i];
43744
+ return id === void 0 ? [] : [id];
43745
+ });
43746
+ return {
43747
+ key,
43748
+ categories,
43749
+ primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
43750
+ tags,
43751
+ synonyms: ICON_SYNONYMS[key] ?? []
43752
+ };
43753
+ });
43754
+ new Map(ENTRIES.map((e) => [e.key, e]));
43755
+ /** Categories a picker offers first: the ones this product's icons mostly live in. */
43756
+ var LEADING_CATEGORIES = [
43757
+ "devices",
43758
+ "home",
43759
+ "security",
43760
+ "buildings",
43761
+ "connectivity",
43762
+ "multimedia",
43763
+ "nature",
43764
+ "weather",
43765
+ "transportation",
43766
+ "animals"
43767
+ ];
43768
+ var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
43769
+ [...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
43770
+ /**
43771
+ * One (location, icon) assignment as it travels.
43772
+ *
43773
+ * `locationKey` is ALWAYS {@link locationIconKey} of the label — never the
43774
+ * operator's casing. The registry matches labels trimmed + case-insensitively
43775
+ * everywhere (`addLocation`, `removeLocation`, `renameLocation`), and a
43776
+ * case-only rename (`kitchen` → `Kitchen`) is a real edit this repo supports; a
43777
+ * map keyed on the displayed casing would orphan its entry on exactly that
43778
+ * edit. Consumers join by keying their own label through `locationIconKey`.
43779
+ */
43780
+ var LocationIconAssignmentSchema = object({
43781
+ locationKey: string(),
43782
+ icon: IconKeySchema
43783
+ });
43784
+ /**
43785
+ * One (location, description) assignment as it travels.
43786
+ *
43787
+ * Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
43788
+ * reason: this lived for a while in the post-analysis addon's own settings,
43789
+ * keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
43790
+ * the Locations page carried the icon and silently orphaned the description —
43791
+ * two authorities for one thing, joined by two different rules. Now both hang
43792
+ * off the location itself, on `locationIconKey`.
43793
+ */
43794
+ var LocationDescriptionAssignmentSchema = object({
43795
+ locationKey: string(),
43796
+ description: string()
43797
+ });
43798
+ /**
43799
+ * WHO an action step acts on (D983) — one target shape for every place that
43800
+ * performs an action (automation steps, Action entries, notification
43801
+ * sequences, scheduler points):
43802
+ *
43803
+ * - `devices` — device ids the operator picked, frozen at save time;
43804
+ * - `domain` — every device that offers the step's VOCABULARY action,
43805
+ * optionally narrowed to one device type and one room, resolved WHEN THE
43806
+ * STEP RUNS (a device added later is included). The action always comes
43807
+ * from the vocabulary (`cover.open`), never from a raw cap name, so a
43808
+ * `domain` target needs an `actionId` (enforced on the step schema);
43809
+ * - `var` — a `$var` resolved from the run's scope.
43810
+ *
43811
+ * {@link ActionTargetResolver} turns a target into device ids. It is pure
43812
+ * (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
43813
+ * a generated automation block share it.
43814
+ *
43815
+ * A room is the device's `location` label (`DeviceInfo.location`); two labels
43816
+ * name the same room when `locationIconKey` agrees (trimmed, lower-cased).
43817
+ */
43818
+ var ActionTargetSchema = discriminatedUnion("kind", [
43819
+ object({
43820
+ kind: literal("devices"),
43821
+ ids: array(number().int()).min(1)
43822
+ }),
43823
+ object({
43824
+ kind: literal("domain"),
43825
+ /** Narrow to one kind of device. */
43826
+ deviceType: _enum(DeviceType).optional(),
43827
+ /** Narrow to one room: the `location` label devices carry. */
43828
+ roomId: string().min(1).optional()
43829
+ }),
43830
+ object({
43831
+ kind: literal("var"),
43832
+ name: string().min(1)
43833
+ })
43834
+ ]);
43835
+ EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
43836
+ var ExpressionBindingSourceSchema = union([
43837
+ object({
43838
+ kind: literal("field").optional(),
43839
+ sourceKey: string(),
43840
+ cap: string(),
43841
+ fieldPath: string()
43842
+ }),
43843
+ object({
43844
+ kind: literal("literal"),
43845
+ value: union([
43846
+ string(),
43847
+ number(),
43848
+ boolean(),
43849
+ _null()
43850
+ ])
43851
+ }),
43852
+ object({
43853
+ kind: literal("global"),
43854
+ sourceStableId: string(),
43855
+ addonId: string().optional(),
43856
+ cap: string(),
43857
+ fieldPath: string()
43858
+ })
43859
+ ]);
43860
+ object({
43861
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
43862
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
43863
+ }).superRefine((src, ctx) => {
43864
+ const err = validateExpressionSource(src);
43865
+ if (err !== null) ctx.addIssue({
43866
+ code: "custom",
43867
+ message: err,
43868
+ path: ["expr"]
43869
+ });
43870
+ });
43871
+ /**
43872
+ * Identity envelope for a device's upstream-system metadata.
43873
+ *
43874
+ * Two jobs:
43875
+ *
43876
+ * 1. **Dispatch key.** `id` is the natural identifier the SOURCE system
43877
+ * uses to address this device (HA `entity_id`, Reolink MAC, ONVIF
43878
+ * WS-Discovery endpoint UUID, …). Provider code keeps a
43879
+ * `Map<sourceInfo.id, IDevice>` to route inbound push events in O(1)
43880
+ * without round-tripping through `stableId` / `id` mappings.
43881
+ *
43882
+ * 2. **Stability bridge.** `uniqueId` is the *immutable* upstream id when
43883
+ * one exists (HA `entity.unique_id`, Reolink MAC again — same as `id`
43884
+ * for vendors where MAC is the natural key). For systems where the
43885
+ * live dispatch key can be renamed (HA `entity_id` can be edited),
43886
+ * providers detect renames by matching `uniqueId` and patch `id`
43887
+ * in-place so dispatch keeps working.
43888
+ *
43889
+ * **Display unit and precision are NOT stored here.** They are a read-time
43890
+ * preference (D944). A polymorphic reading stores its `quantity` here once,
43891
+ * at adopt, and a date/time value stores `dateTimeShape` the same way —
43892
+ * neither is repeated on each sample. The `device_class` tag is an
43893
+ * HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
43894
+ * to derive the CamStack `DeviceRole`; it is never stored after that point.
43895
+ *
43896
+ * The `raw` escape hatch carries provider-specific attributes that don't
43897
+ * fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
43898
+ * details, …). Providers control what lands here.
43899
+ */
43900
+ var SourceInfoSchema = object({
43901
+ /** Live dispatch key — mutable when the source system allows rename. */
43902
+ id: string(),
43903
+ /** Source system tag — e.g. 'homeassistant' | 'reolink' | 'onvif'. */
43904
+ system: string(),
43905
+ /** Immutable upstream identifier when available (HA `unique_id`, … ).
43906
+ * Used to detect rename when `id` changes. */
43907
+ uniqueId: string().optional(),
43908
+ /** Quantity of a polymorphic reading, written once at adopt (D944). */
43909
+ quantity: ReadingQuantitySchema.optional(),
43910
+ /** Date / time / datetime shape of a string reading, written once at adopt. */
43911
+ dateTimeShape: _enum([
43912
+ "date",
43913
+ "time",
43914
+ "datetime"
43915
+ ]).optional(),
43916
+ /** Provider-specific extras that don't fit the structured slots.
43917
+ * Whitelist what goes here per provider — do NOT dump entire HA
43918
+ * attribute blobs (would explode the meta JSON column). */
43919
+ raw: record(string(), unknown()).optional()
43920
+ });
43921
+ /**
43922
+ * Build the synthetic SourceInfo every existing provider falls back to
43923
+ * when no upstream value has been persisted. Keeps non-migrated providers
43924
+ * (Reolink / Hikvision / ONVIF / RTSP) functional without code
43925
+ * changes — `id` reuses the CamStack stableId, `system` reuses the addon
43926
+ * id. Real upstream identity replaces this once a provider migrates and
43927
+ * calls `updateSourceInfo()` with concrete values.
43928
+ */
43929
+ function synthesizeSourceInfo(input) {
43930
+ return {
43931
+ id: input.stableId,
43932
+ system: input.addonId
43933
+ };
43828
43934
  }
43829
- /** Canonical-unit value → the unit described by `spec`. */
43830
- function fromCanonical(canonical, spec) {
43831
- return (canonical - spec.offset) / spec.factor;
43935
+ /**
43936
+ * Shallow-merge a partial patch over a prior SourceInfo. `undefined`
43937
+ * patch values are ignored (no field clobber); to clear a field
43938
+ * explicitly, providers omit it from the patch and rebuild from scratch
43939
+ * via `updateSourceInfo({})` cycles — uncommon enough that we don't
43940
+ * bother with a `null`-means-delete sentinel.
43941
+ *
43942
+ * The `raw` field is also shallow-merged: passing `raw: { foo: 1 }`
43943
+ * merges over existing `raw` keys instead of replacing the whole bag.
43944
+ */
43945
+ function mergeSourceInfo(prev, patch) {
43946
+ const next = { ...prev };
43947
+ for (const [k, v] of Object.entries(patch)) {
43948
+ if (v === void 0) continue;
43949
+ if (k === "raw" && typeof v === "object" && v !== null) {
43950
+ next.raw = {
43951
+ ...prev.raw,
43952
+ ...v
43953
+ };
43954
+ continue;
43955
+ }
43956
+ next[k] = v;
43957
+ }
43958
+ return next;
43832
43959
  }
43833
43960
  /**
43834
- * Graceful variant for the render path: returns the converted value, or
43835
- * `undefined` when the conversion is refused (unknown unit / cross-dimension).
43836
- * Never throws — a render caller falls back to the raw value + source unit.
43961
+ * Key under which `SourceInfo` lives inside `DeviceMeta.metadata`. The
43962
+ * blob is a free-form `Record<string, unknown>` shared with hardware-
43963
+ * identity fields (`manufacturer`, `model`, `firmware`, …); SourceInfo
43964
+ * lives under a single nested key to keep it composable with those.
43837
43965
  */
43838
- function tryConvertUnit(value, from, to) {
43839
- if (from === to) return value;
43840
- const fromSpec = specFor(from);
43841
- if (!fromSpec) return void 0;
43842
- const toSpec = specFor(to);
43843
- if (!toSpec) return void 0;
43844
- if (fromSpec.dimension !== toSpec.dimension) return void 0;
43845
- return fromCanonical(toCanonical(value, fromSpec), toSpec);
43966
+ var SOURCE_INFO_METADATA_KEY = "sourceInfo";
43967
+ /**
43968
+ * Extract a SourceInfo from a `DeviceMeta.metadata` blob, validating
43969
+ * with Zod. Returns `null` when the blob is missing or the nested
43970
+ * `sourceInfo` key fails validation — callers fall back to the
43971
+ * synthetic default in that case (see `synthesizeSourceInfo`).
43972
+ */
43973
+ function extractSourceInfoFromMetadata(metadata) {
43974
+ if (!metadata) return null;
43975
+ const raw = metadata[SOURCE_INFO_METADATA_KEY];
43976
+ if (!raw) return null;
43977
+ const parsed = SourceInfoSchema.safeParse(raw);
43978
+ if (!parsed.success) return null;
43979
+ return parsed.data;
43846
43980
  }
43847
43981
  /**
43848
43982
  * A number a person types for a physical quantity — the input side of the
@@ -45521,15 +45655,28 @@ var SettingsSchemaWithValuesSchema = object({
45521
45655
  });
45522
45656
  /** Patch object — keys are field names, values are the new field values. */
45523
45657
  var SettingsPatchSchema = record(string(), unknown());
45658
+ /** The scope of a scoped-settings call (D986): where the capability declared the values. */
45659
+ var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
45660
+ /** One scoped schema an addon serves: its capability, scope and section ids. */
45661
+ var ScopedSettingsDeclarationSchema = object({
45662
+ cap: string(),
45663
+ scope: ScopedSettingsScopeSchema,
45664
+ sectionIds: array(string())
45665
+ });
45524
45666
  /** Standard success response for update operations. */
45525
45667
  var SettingsUpdateResultSchema = object({ success: literal(true) });
45526
45668
  method(object({
45527
45669
  addonId: string(),
45528
- nodeId: string().optional(),
45529
- overlay: record(string(), unknown()).optional(),
45530
- cap: string().optional()
45670
+ cap: string(),
45671
+ scope: ScopedSettingsScopeSchema,
45672
+ nodeId: string().optional()
45531
45673
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
45532
45674
  addonId: string(),
45675
+ nodeId: string().optional()
45676
+ }), array(ScopedSettingsDeclarationSchema).nullable()), method(object({
45677
+ addonId: string(),
45678
+ cap: string(),
45679
+ scope: ScopedSettingsScopeSchema,
45533
45680
  nodeId: string().optional(),
45534
45681
  patch: SettingsPatchSchema
45535
45682
  }), SettingsUpdateResultSchema, {
@@ -45537,8 +45684,10 @@ method(object({
45537
45684
  auth: "admin"
45538
45685
  }), method(object({
45539
45686
  addonId: string(),
45687
+ cap: string(),
45688
+ scope: ScopedSettingsScopeSchema,
45540
45689
  nodeId: string().optional()
45541
- }), SettingsSchemaWithValuesSchema.nullable()), method(object({
45690
+ }), record(string(), unknown()).nullable()), method(object({
45542
45691
  addonId: string(),
45543
45692
  nodeId: string().optional(),
45544
45693
  instance: IntegrationInstanceRefSchema
@@ -47101,7 +47250,7 @@ var BackupDestinationInfoSchema = object({
47101
47250
  id: string(),
47102
47251
  /**
47103
47252
  * Manifest id of the owning addon. The Settings button on the
47104
- * destination card opens that addon's `globalSettingsSchema` panel.
47253
+ * destination card opens that addon's scoped settings panel.
47105
47254
  */
47106
47255
  addonId: string(),
47107
47256
  /** Operator-toggled enable flag from the destination-policy table. */
@@ -50515,7 +50664,7 @@ var mediaPlayerCapability = {
50515
50664
  isMuted: { kind: "boolean" }
50516
50665
  } }
50517
50666
  };
50518
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater;
50667
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.MediaPlayer;
50519
50668
  var NUMBER = {
50520
50669
  kind: "fixed",
50521
50670
  result: ["number"]
@@ -52537,6 +52686,7 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
52537
52686
  kind: "mutation",
52538
52687
  auth: "admin"
52539
52688
  });
52689
+ var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
52540
52690
  /**
52541
52691
  * A SITE ZONE — a named part of the property that several locations belong to.
52542
52692
  *
@@ -53023,6 +53173,12 @@ var DeviceInfoSchema = object({
53023
53173
  addonId: string(),
53024
53174
  type: _enum(DeviceType),
53025
53175
  name: string(),
53176
+ /** The name a value template uses for this device (`{{ stufa_veranda.temperature }}`),
53177
+ * entity_id style. Generated once from the name at first registration, unique
53178
+ * cluster-wide, editable through `setAlias`, NOT changed by a rename (D1021).
53179
+ * Optional: a record produced by an older build omits it until the boot
53180
+ * backfill has run. */
53181
+ alias: DeviceAliasSchema.optional(),
53026
53182
  /** Operator-organisational location label. `null` when unset. */
53027
53183
  location: string().nullable(),
53028
53184
  /** Soft-disabled flag. */
@@ -53342,6 +53498,25 @@ method(object({
53342
53498
  }), _void(), {
53343
53499
  kind: "mutation",
53344
53500
  auth: "admin"
53501
+ }), method(object({
53502
+ deviceId: number(),
53503
+ alias: string()
53504
+ }), discriminatedUnion("ok", [object({
53505
+ ok: literal(true),
53506
+ alias: DeviceAliasSchema
53507
+ }), object({
53508
+ ok: literal(false),
53509
+ reason: _enum([
53510
+ "empty",
53511
+ "too-long",
53512
+ "grammar",
53513
+ "reserved",
53514
+ "taken"
53515
+ ]),
53516
+ takenBy: number().optional()
53517
+ })]), {
53518
+ kind: "mutation",
53519
+ auth: "admin"
53345
53520
  }), method(object({
53346
53521
  deviceId: number(),
53347
53522
  location: string().nullable()
@@ -57070,7 +57245,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
57070
57245
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
57071
57246
  * clears it.
57072
57247
  */
57073
- var ConfigSchemaPassthrough$3 = custom();
57248
+ var ConfigSchemaPassthrough$2 = custom();
57074
57249
  var IntegrationInstanceIdSchema = string().min(1);
57075
57250
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
57076
57251
  /**
@@ -57116,7 +57291,16 @@ var IntegrationInstanceKindSchema = object({
57116
57291
  /** Relative hub path to start an interactive account link of an instance of this kind. */
57117
57292
  connectPath: string().min(1).optional(),
57118
57293
  /** Relative hub path to disconnect that account. */
57119
- disconnectPath: string().min(1).optional()
57294
+ disconnectPath: string().min(1).optional(),
57295
+ /**
57296
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
57297
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
57298
+ * `connection` widgets write connection values, `model` widgets own the model choice.
57299
+ */
57300
+ widgets: array(object({
57301
+ id: string().min(1),
57302
+ placement: _enum(["connection", "model"])
57303
+ })).optional()
57120
57304
  });
57121
57305
  /**
57122
57306
  * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
@@ -57157,10 +57341,11 @@ var IntegrationInstanceDescriptionSchema = object({
57157
57341
  /** True when `testInstance` really probes the remote. */
57158
57342
  canTest: boolean(),
57159
57343
  /**
57160
- * The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
57161
- * Add flow asks which first and sends it as `createInstance.kind`.
57344
+ * The kinds an instance can be of (D1013 rule 1), each naming its `functionCap`. One entry:
57345
+ * nothing to choose; more than one: the Add flow asks which first and sends it as
57346
+ * `createInstance.kind`. Never empty: every instance belongs to exactly one kind.
57162
57347
  */
57163
- kinds: array(IntegrationInstanceKindSchema).optional(),
57348
+ kinds: array(IntegrationInstanceKindSchema).min(1),
57164
57349
  /**
57165
57350
  * The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
57166
57351
  * devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
@@ -57196,8 +57381,8 @@ var IntegrationInstanceSchema = object({
57196
57381
  * the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
57197
57382
  */
57198
57383
  enabled: boolean().optional(),
57199
- /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
57200
- kind: string().optional(),
57384
+ /** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
57385
+ kind: string().min(1),
57201
57386
  /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
57202
57387
  formValues: record(string(), unknown()),
57203
57388
  status: IntegrationInstanceStatusSchema.optional(),
@@ -57221,7 +57406,7 @@ var integrationInstancesCapability = {
57221
57406
  id: IntegrationInstanceIdSchema.nullable(),
57222
57407
  /** The kind of the create form (`id: null`) of a provider with several. */
57223
57408
  kind: string().min(1).optional()
57224
- }), ConfigSchemaPassthrough$3, { auth: "admin" }),
57409
+ }), ConfigSchemaPassthrough$2, { auth: "admin" }),
57225
57410
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
57226
57411
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
57227
57412
  /**
@@ -58323,12 +58508,12 @@ var LlmModelInfoSchema = object({
58323
58508
  });
58324
58509
  /**
58325
58510
  * The provider-specific part of a profile, validated by the provider that owns
58326
- * the kind (`upsertProfile` refuses what it does not accept). A field its
58511
+ * the kind (saving an instance refuses what it does not accept). A field its
58327
58512
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
58328
58513
  * keychain, never in the row, and reads back as the redaction marker.
58329
58514
  */
58330
58515
  var LlmProviderConfigSchema = record(string(), unknown());
58331
- var LlmProfileSchema = object({
58516
+ object({
58332
58517
  id: string(),
58333
58518
  name: string(),
58334
58519
  /** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
@@ -58422,8 +58607,8 @@ var LlmProviderWidgetSchema = object({
58422
58607
  /** ConfigUISchema tree passed through untyped on the wire (the
58423
58608
  * notification-output `ConfigSchemaPassthrough` precedent at
58424
58609
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
58425
- var ConfigSchemaPassthrough$2 = unknown();
58426
- var LlmProfileKindDescriptorSchema = object({
58610
+ var ConfigSchemaPassthrough$1 = unknown();
58611
+ object({
58427
58612
  kind: LlmProfileKindSchema,
58428
58613
  label: string(),
58429
58614
  /** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
@@ -58431,9 +58616,9 @@ var LlmProfileKindDescriptorSchema = object({
58431
58616
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
58432
58617
  addonId: string(),
58433
58618
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
58434
- connectionSchema: ConfigSchemaPassthrough$2,
58619
+ connectionSchema: ConfigSchemaPassthrough$1,
58435
58620
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
58436
- advancedSchema: ConfigSchemaPassthrough$2.optional(),
58621
+ advancedSchema: ConfigSchemaPassthrough$1.optional(),
58437
58622
  /** The kind's defaults; a model from `listModels` may override any of them. */
58438
58623
  features: LlmModelFeaturesSchema,
58439
58624
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -58562,20 +58747,7 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
58562
58747
  }), method(object({
58563
58748
  addonId: string().optional(),
58564
58749
  requestId: string()
58565
- }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
58566
- kind: "mutation",
58567
- auth: "admin"
58568
- }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
58569
- kind: "mutation",
58570
- auth: "admin"
58571
- }), method(ProfileRefInputSchema, _void(), {
58572
- kind: "mutation",
58573
- auth: "admin"
58574
- }), method(ProfileRefInputSchema, LlmGenerateResultSchema, {
58575
- kind: "mutation",
58576
- auth: "admin",
58577
- timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
58578
- }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
58750
+ }), _void(), { kind: "mutation" }), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
58579
58751
  kind: "mutation",
58580
58752
  auth: "admin"
58581
58753
  }), method(object({}), array(LlmDefaultSchema)), method(object({
@@ -59638,20 +59810,7 @@ method(_void(), MeshStatusSchema), method(object({
59638
59810
  /** Optional hostname override the host should advertise once joined. */
59639
59811
  hostname: string().optional() }), object({
59640
59812
  /** Authentication URL the operator should open in a browser. */
59641
- 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({
59642
- /** Optional auth key — when provided, probes the key validity
59643
- * against the provider's API. Omit when already joined to
59644
- * just ping the daemon. */
59645
- authKey: string().optional() }), object({
59646
- ok: boolean(),
59647
- /** Provider-side identifier resolved by the probe (tailnet
59648
- * name for Tailscale, network id for ZeroTier, etc.). */
59649
- tenant: string().optional(),
59650
- /** Daemon binary version, when reachable. */
59651
- daemonVersion: string().optional(),
59652
- /** Human-readable error when `ok: false`. */
59653
- error: string().optional()
59654
- }), { kind: "mutation" });
59813
+ 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() }));
59655
59814
  /**
59656
59815
  * A monotonic total between resets (D944). Energy uses `power-meter.energy`
59657
59816
  * so dashboards keep one series; every other instantaneous reading lands here.
@@ -67478,6 +67637,11 @@ var NcScheduleSchema = object({
67478
67637
  * as a STATE SUMMARY at the end of each window of `schedule`.
67479
67638
  */
67480
67639
  var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
67640
+ _enum([
67641
+ "activation",
67642
+ "deactivation",
67643
+ "schedule"
67644
+ ]);
67481
67645
  /**
67482
67646
  * How a summary window is SENT (D698): `rule` (absent) = ONE notification with
67483
67647
  * every section; `section` = one notification per section with something to
@@ -67494,11 +67658,26 @@ var NcStateSummarySplitSchema = _enum(["rule", "section"]);
67494
67658
  * midnight crossing); the send time is each window's END. Refused on the
67495
67659
  * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
67496
67660
  */
67497
- var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
67498
- mode: literal("summary"),
67499
- schedule: NcScheduleSchema,
67500
- split: NcStateSummarySplitSchema.optional()
67501
- })]);
67661
+ var NcSystemEventDeliverySchema = discriminatedUnion("mode", [
67662
+ object({ mode: literal("instant") }),
67663
+ object({
67664
+ mode: literal("summary"),
67665
+ schedule: NcScheduleSchema,
67666
+ split: NcStateSummarySplitSchema.optional()
67667
+ }),
67668
+ object({
67669
+ mode: literal("modes"),
67670
+ /** The bad edge, and every kind that has a single edge. */
67671
+ onActivation: boolean(),
67672
+ /** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
67673
+ onDeactivation: boolean(),
67674
+ /** A state summary at the end of each window; absent = no summary. */
67675
+ onSchedule: object({
67676
+ schedule: NcScheduleSchema,
67677
+ grouping: NcStateSummarySplitSchema
67678
+ }).optional()
67679
+ })
67680
+ ]);
67502
67681
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
67503
67682
  var NcPlateMatcherSchema = object({
67504
67683
  /**
@@ -69858,61 +70037,6 @@ var OauthIntegrationDescriptorSchema = object({
69858
70037
  });
69859
70038
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
69860
70039
  /**
69861
- * `oidc-connections` — CRUD for IdP rows under `auth-oidc` (D828 sibling).
69862
- *
69863
- * One hub-only singleton (`auth-oidc`). The Settings UI is a DataTable +
69864
- * ItemFormDialog; there is no `editable-array` in `globalSettingsSchema`.
69865
- * Operator-chosen `id` is the URL slug (`/addon/auth-oidc/<id>/…`) and is
69866
- * immutable after create.
69867
- */
69868
- var ConfigSchemaPassthrough$1 = unknown();
69869
- var OidcConnectionSchema = object({
69870
- id: string().min(1),
69871
- displayName: string(),
69872
- icon: string(),
69873
- issuerUrl: string(),
69874
- clientId: string(),
69875
- /** Client id + secret present — never the secret value. */
69876
- configured: boolean(),
69877
- /**
69878
- * Values for the connection form schema. `clientSecret` is a keychain
69879
- * {@link SecretFieldView} or `null` / `''`, never plaintext (D789).
69880
- */
69881
- formValues: record(string(), unknown()).optional()
69882
- });
69883
- /**
69884
- * Patch one connection. Omitted or empty `clientSecret` keeps the stored
69885
- * secret (D787). `{ $secretClear: true }` clears it. `id` is never renamed.
69886
- */
69887
- var OidcConnectionUpdateInputSchema = object({
69888
- id: string().min(1),
69889
- displayName: string().min(1),
69890
- icon: string().optional(),
69891
- issuerUrl: string().optional(),
69892
- clientId: string().optional(),
69893
- clientSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
69894
- redirectUri: string().optional(),
69895
- scopes: string().optional(),
69896
- usernameClaim: _enum([
69897
- "preferred_username",
69898
- "email",
69899
- "sub"
69900
- ]).optional()
69901
- });
69902
- method(object({}), ConfigSchemaPassthrough$1, { auth: "admin" }), method(object({}), array(OidcConnectionSchema).readonly(), { auth: "admin" }), method(object({
69903
- id: string().min(1).regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "id must be a lowercase slug"),
69904
- displayName: string().min(1)
69905
- }), object({ id: string() }), {
69906
- kind: "mutation",
69907
- auth: "admin"
69908
- }), method(OidcConnectionUpdateInputSchema, object({ ok: literal(true) }), {
69909
- kind: "mutation",
69910
- auth: "admin"
69911
- }), method(object({ id: string().min(1) }), object({ ok: literal(true) }), {
69912
- kind: "mutation",
69913
- auth: "admin"
69914
- });
69915
- /**
69916
70040
  * Generic on-screen-display (video overlay) cap. Each camera exposes
69917
70041
  * a firmware-defined list of overlays (channel name, timestamp,
69918
70042
  * watermark, logo, …); the cap models them as a homogeneous array of
@@ -76233,6 +76357,16 @@ var RemoteLayoutComponentSchema = object({
76233
76357
  method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
76234
76358
  var RUNNING_POWER_START_DELAY_MS = 3e4;
76235
76359
  var RUNNING_POWER_STOP_DELAY_MS = 18e4;
76360
+ /**
76361
+ * Per-type overrides of the dwell defaults. A media player draws power the
76362
+ * moment it is on and stops drawing the moment it is off, so it needs neither
76363
+ * a long dwell nor a second sample. A type absent here keeps the global values.
76364
+ */
76365
+ var RUNNING_POWER_DEFAULTS_BY_TYPE = { [DeviceType.MediaPlayer]: {
76366
+ startDwellMs: 1e4,
76367
+ stopDwellMs: 1e4,
76368
+ minSamples: 1
76369
+ } };
76236
76370
  var RunningStateSourceSchema = _enum(["native", "assigned"]);
76237
76371
  var RunningStateStatusSchema = object({
76238
76372
  /** null = unknown — never coerced to false (D393). */
@@ -76250,93 +76384,27 @@ var RunningFlipEventDataSchema = object({
76250
76384
  phase: string().nullable()
76251
76385
  });
76252
76386
  var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
76253
- /** Generic Customize target for the running boolean (D936). */
76254
- var runningCustomize = {
76255
- version: 1,
76256
- overridable: [{
76257
- path: "running",
76258
- by: "running"
76259
- }],
76260
- targets: [{
76261
- id: "running",
76262
- cardinality: "scalar",
76263
- vocabulary: {
76264
- cap: "running-state",
76265
- stateField: "running"
76266
- },
76267
- deviceTypes: [
76268
- DeviceType.Washer,
76269
- DeviceType.Dryer,
76270
- DeviceType.Dishwasher,
76271
- DeviceType.Vacuum,
76272
- DeviceType.LawnMower,
76273
- DeviceType.MediaPlayer,
76274
- DeviceType.WaterHeater,
76275
- DeviceType.Humidifier,
76276
- DeviceType.Fan,
76277
- DeviceType.Climate,
76278
- DeviceType.Thermostat,
76279
- DeviceType.PetFeeder,
76280
- DeviceType.Heater
76281
- ],
76282
- apply: "add",
76283
- path: "running",
76284
- sources: [
76285
- {
76286
- kind: "switch",
76287
- transforms: [{ kind: "identity" }]
76288
- },
76289
- {
76290
- kind: "binary",
76291
- transforms: [{ kind: "identity" }, { kind: "invert" }]
76292
- },
76293
- {
76294
- kind: "numeric",
76295
- requiredUnit: "W",
76296
- transforms: [{
76297
- kind: "threshold",
76298
- comparisons: ["gte", "lte"],
76299
- comparison: "gte",
76300
- defaultThreshold: 5,
76301
- defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
76302
- defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
76303
- thresholdUnit: "W"
76304
- }]
76305
- }
76306
- ],
76307
- companions: [
76308
- {
76309
- kind: "constant",
76310
- path: "source",
76311
- value: "assigned",
76312
- when: "always"
76313
- },
76314
- {
76315
- kind: "constant",
76316
- path: "phase",
76317
- value: null,
76318
- when: "add"
76319
- },
76320
- {
76321
- kind: "clock",
76322
- path: "lastFetchedAt",
76323
- when: "always"
76324
- },
76325
- {
76326
- kind: "transition-time",
76327
- path: "since",
76328
- sourceChangedAt: "prefer"
76329
- }
76330
- ],
76331
- sourceReport: {
76332
- status: "assignment-status",
76333
- runtimeField: "source",
76334
- nativeValue: "native",
76335
- assignedValue: "assigned"
76336
- },
76337
- advancedExpression: true
76338
- }]
76339
- };
76387
+ /**
76388
+ * Customize offers "running" only where a job makes sense (D933): a cycle,
76389
+ * a clean, a mow, playback, or another appliance that is on and working.
76390
+ * The cap itself stays on every type — a camera can still report running
76391
+ * natively; it just has no card.
76392
+ */
76393
+ var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
76394
+ DeviceType.Washer,
76395
+ DeviceType.Dryer,
76396
+ DeviceType.Dishwasher,
76397
+ DeviceType.Vacuum,
76398
+ DeviceType.LawnMower,
76399
+ DeviceType.MediaPlayer,
76400
+ DeviceType.WaterHeater,
76401
+ DeviceType.Humidifier,
76402
+ DeviceType.Fan,
76403
+ DeviceType.Climate,
76404
+ DeviceType.Thermostat,
76405
+ DeviceType.PetFeeder,
76406
+ DeviceType.Heater
76407
+ ];
76340
76408
  var runningStateCapability = {
76341
76409
  name: "running-state",
76342
76410
  scope: "device",
@@ -76356,7 +76424,79 @@ var runningStateCapability = {
76356
76424
  durability: "restored",
76357
76425
  history: { fields: { running: { kind: "boolean" } } },
76358
76426
  volatileStateFields: ["lastFetchedAt"],
76359
- customize: runningCustomize
76427
+ customize: {
76428
+ version: 1,
76429
+ overridable: [{
76430
+ path: "running",
76431
+ by: "running"
76432
+ }],
76433
+ targets: [{
76434
+ id: "running",
76435
+ cardinality: "scalar",
76436
+ vocabulary: {
76437
+ cap: "running-state",
76438
+ stateField: "running"
76439
+ },
76440
+ deviceTypes: RUNNING_CUSTOMIZE_DEVICE_TYPES,
76441
+ apply: "add",
76442
+ path: "running",
76443
+ sources: [
76444
+ {
76445
+ kind: "switch",
76446
+ transforms: [{ kind: "identity" }]
76447
+ },
76448
+ {
76449
+ kind: "binary",
76450
+ transforms: [{ kind: "identity" }, { kind: "invert" }]
76451
+ },
76452
+ {
76453
+ kind: "numeric",
76454
+ requiredUnit: "W",
76455
+ transforms: [{
76456
+ kind: "threshold",
76457
+ comparisons: ["gte", "lte"],
76458
+ comparison: "gte",
76459
+ defaultThreshold: 5,
76460
+ defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
76461
+ defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
76462
+ deviceTypeDefaults: RUNNING_POWER_DEFAULTS_BY_TYPE,
76463
+ thresholdUnit: "W"
76464
+ }]
76465
+ }
76466
+ ],
76467
+ companions: [
76468
+ {
76469
+ kind: "constant",
76470
+ path: "source",
76471
+ value: "assigned",
76472
+ when: "always"
76473
+ },
76474
+ {
76475
+ kind: "constant",
76476
+ path: "phase",
76477
+ value: null,
76478
+ when: "add"
76479
+ },
76480
+ {
76481
+ kind: "clock",
76482
+ path: "lastFetchedAt",
76483
+ when: "always"
76484
+ },
76485
+ {
76486
+ kind: "transition-time",
76487
+ path: "since",
76488
+ sourceChangedAt: "prefer"
76489
+ }
76490
+ ],
76491
+ sourceReport: {
76492
+ status: "assignment-status",
76493
+ runtimeField: "source",
76494
+ nativeValue: "native",
76495
+ assignedValue: "assigned"
76496
+ },
76497
+ advancedExpression: true
76498
+ }]
76499
+ }
76360
76500
  };
76361
76501
  /**
76362
76502
  * scene-monitor — device-scoped reference-region state cap. An operator marks
@@ -77704,21 +77844,6 @@ method(object({
77704
77844
  */
77705
77845
  ttlSec: union([number().int().positive(), literal("never")]).optional()
77706
77846
  }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
77707
- var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
77708
- providerId: string().min(1),
77709
- displayName: string().min(1),
77710
- configSchema: unknown(),
77711
- nodeLocal: boolean(),
77712
- shouldSaveDiskSpace: literal(true),
77713
- minFreePercent: number().min(0).max(100)
77714
- }), object({
77715
- providerId: string().min(1),
77716
- displayName: string().min(1),
77717
- configSchema: unknown(),
77718
- nodeLocal: boolean(),
77719
- shouldSaveDiskSpace: literal(false),
77720
- minFreePercent: literal(null)
77721
- })]);
77722
77847
  method(object({
77723
77848
  location: StorageLocationRefSchema,
77724
77849
  relativePath: string()
@@ -77780,42 +77905,7 @@ method(object({
77780
77905
  }), _instanceof(Uint8Array), { auth: "admin" }), method(object({ downloadId: string() }), _void(), {
77781
77906
  kind: "mutation",
77782
77907
  auth: "admin"
77783
- }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
77784
- createdAt: true,
77785
- updatedAt: true
77786
- }), StorageLocationSchema, {
77787
- kind: "mutation",
77788
- auth: "admin"
77789
- }), method(object({
77790
- id: string(),
77791
- force: boolean().optional()
77792
- }), _void(), {
77793
- kind: "mutation",
77794
- auth: "admin"
77795
- }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
77796
- ok: boolean(),
77797
- error: string().optional()
77798
- }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
77799
- providerId: string(),
77800
- /**
77801
- * The location this config is an UNSAVED edit of, when there is one.
77802
- *
77803
- * `listLocations` replaces every declared secret with the redaction
77804
- * sentinel, so the edit modal's form state holds the sentinel for any
77805
- * credential the operator did not retype — and posting that here
77806
- * without a way to resolve it makes the provider try to authenticate
77807
- * as `__camstack_redacted__` and report the operator's own working
77808
- * password as wrong. Given this id, the orchestrator restores each
77809
- * sentinel from the stored config (same rule as `upsertLocation`)
77810
- * before dispatching. Omitted by the "Add location" wizard, where
77811
- * every value was typed just now and nothing is stored yet.
77812
- */
77813
- locationId: string().optional(),
77814
- config: record(string(), unknown())
77815
- }), object({
77816
- ok: boolean(),
77817
- error: string().optional()
77818
- }), { auth: "admin" });
77908
+ }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(_void(), array(StorageDrainProgressSchema).readonly());
77819
77909
  /** One table of the settings database. */
77820
77910
  var StorageTableSchema = object({
77821
77911
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -79337,7 +79427,7 @@ var TerminalInstanceInfoSchema = object({
79337
79427
  /**
79338
79428
  * False while the node the instance is bound to is not in the cluster
79339
79429
  * topology (forgotten, renamed, re-paired). The instance is kept; the
79340
- * operator re-points it with `updateInstance({ targetNodeId })`.
79430
+ * operator re-points it on the Terminal page.
79341
79431
  */
79342
79432
  nodeInCluster: boolean(),
79343
79433
  profileId: string(),
@@ -79375,41 +79465,7 @@ var TerminalOutputBatchSchema = object({
79375
79465
  snapshot: string().optional(),
79376
79466
  events: array(TerminalOutputEventSchema).readonly()
79377
79467
  });
79378
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalInstanceInfoSchema).readonly(), { auth: "admin" }), method(object({
79379
- targetNodeId: string().min(1),
79380
- profileId: string().min(1),
79381
- name: string().trim().min(1).max(160).optional(),
79382
- executable: string().max(1024).optional(),
79383
- args: array(string().max(2048)).max(64).optional(),
79384
- cwd: string().max(1024).optional(),
79385
- environment: array(string().max(4096)).max(64).optional(),
79386
- profileSettings: ProfileSettingsBagSchema.optional()
79387
- }), TerminalInstanceInfoSchema, {
79388
- kind: "mutation",
79389
- auth: "admin"
79390
- }), method(object({
79391
- instanceId: string().min(1),
79392
- /** Re-point the instance to another node; the profile must exist there. */
79393
- targetNodeId: string().min(1).max(256).optional(),
79394
- name: string().trim().min(1).max(160).optional(),
79395
- executable: string().max(1024).optional(),
79396
- args: array(string().max(2048)).max(64).optional(),
79397
- cwd: string().max(1024).optional(),
79398
- environment: array(string().max(4096)).max(64).optional(),
79399
- profileSettings: ProfileSettingsBagSchema.optional()
79400
- }), TerminalInstanceInfoSchema, {
79401
- kind: "mutation",
79402
- auth: "admin"
79403
- }), method(object({ instanceId: string().min(1) }), _void(), {
79404
- kind: "mutation",
79405
- auth: "admin"
79406
- }), method(object({
79407
- instanceId: string().min(1),
79408
- enabled: boolean()
79409
- }), TerminalInstanceInfoSchema, {
79410
- kind: "mutation",
79411
- auth: "admin"
79412
- }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
79468
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
79413
79469
  stableId: string().min(1),
79414
79470
  name: string().trim().min(1).max(160).optional()
79415
79471
  }), TerminalInstanceInfoSchema, {
@@ -79478,6 +79534,11 @@ var TimedRunUnitSchema = _enum(["s", "min"]);
79478
79534
  _enum(["switch", "pet-fountain"]);
79479
79535
  DeviceType.Heater, DeviceType.PetFountain;
79480
79536
  var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
79537
+ /** One duration, as the one-tap run asks for it. */
79538
+ var TimedRunQuickRunSchema = object({
79539
+ duration: number().positive().finite(),
79540
+ unit: TimedRunUnitSchema
79541
+ });
79481
79542
  /** Why a request was not carried out. Typed, so a caller can say it in words. */
79482
79543
  var TimedRunRefusalSchema = _enum([
79483
79544
  "unsupported-device",
@@ -79498,8 +79559,23 @@ var TimedRunStatusSchema = object({
79498
79559
  activeUntil: number().nullable(),
79499
79560
  /** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
79500
79561
  requestedBy: string().nullable(),
79562
+ /**
79563
+ * The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
79564
+ * the device is gone or its type has no timed run; a status from before this field
79565
+ * existed has none, and a surface falls back to the type's default.
79566
+ */
79567
+ quickRun: TimedRunQuickRunSchema.nullable(),
79501
79568
  lastFetchedAt: number()
79502
79569
  });
79570
+ /** What the settings form needs: the unit, the bounds and the type's default. */
79571
+ var TimedRunOptionsSchema = object({
79572
+ unit: TimedRunUnitSchema,
79573
+ /** The longest run, in `unit`. */
79574
+ maxDuration: number(),
79575
+ defaultDuration: number()
79576
+ });
79577
+ /** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
79578
+ var TimedRunSettingsPatchSchema = object({ quickRunDuration: number().positive().finite().nullable().optional() });
79503
79579
  var timedRunCapability = {
79504
79580
  name: "timed-run",
79505
79581
  scope: "device",
@@ -79507,7 +79583,24 @@ var timedRunCapability = {
79507
79583
  kind: "wrapper",
79508
79584
  defaultActive: true,
79509
79585
  deviceTypes: TIMED_RUN_DEVICE_TYPES,
79586
+ deviceConfig: { ui: {
79587
+ kind: "derived-form",
79588
+ builderId: "timed-run",
79589
+ tab: "general"
79590
+ } },
79510
79591
  methods: {
79592
+ getOptions: method(object({ deviceId: number().int() }), TimedRunOptionsSchema),
79593
+ /**
79594
+ * The one-tap run of this device. A duration above the type's maximum is
79595
+ * REFUSED (thrown), like `runFor`: the maximum is a safety bound.
79596
+ */
79597
+ setSettings: method(object({
79598
+ deviceId: number().int(),
79599
+ settings: TimedRunSettingsPatchSchema
79600
+ }), _void(), {
79601
+ kind: "mutation",
79602
+ auth: "admin"
79603
+ }),
79511
79604
  /**
79512
79605
  * Turn the device on and arm its off. A run already armed is replaced (the
79513
79606
  * new deadline wins). Refuses with a typed reason above the type's maximum.
@@ -84826,21 +84919,28 @@ Object.freeze({
84826
84919
  access: "view",
84827
84920
  role: "admin"
84828
84921
  },
84829
- "addonSettings.getGlobalSettings": {
84922
+ "addonSettings.getIntegrationFormSchema": {
84923
+ capName: "addon-settings",
84924
+ capScope: "system",
84925
+ addonId: null,
84926
+ access: "view",
84927
+ role: "admin"
84928
+ },
84929
+ "addonSettings.getScopedSettings": {
84830
84930
  capName: "addon-settings",
84831
84931
  capScope: "system",
84832
84932
  addonId: null,
84833
84933
  access: "view",
84834
84934
  role: "admin"
84835
84935
  },
84836
- "addonSettings.getIntegrationFormSchema": {
84936
+ "addonSettings.listScopedSettings": {
84837
84937
  capName: "addon-settings",
84838
84938
  capScope: "system",
84839
84939
  addonId: null,
84840
84940
  access: "view",
84841
84941
  role: "admin"
84842
84942
  },
84843
- "addonSettings.getIntegrationSettings": {
84943
+ "addonSettings.readScopedValues": {
84844
84944
  capName: "addon-settings",
84845
84945
  capScope: "system",
84846
84946
  addonId: null,
@@ -84861,7 +84961,7 @@ Object.freeze({
84861
84961
  access: "create",
84862
84962
  role: "admin"
84863
84963
  },
84864
- "addonSettings.updateGlobalSettings": {
84964
+ "addonSettings.updateScopedSettings": {
84865
84965
  capName: "addon-settings",
84866
84966
  capScope: "system",
84867
84967
  addonId: null,
@@ -87031,6 +87131,13 @@ Object.freeze({
87031
87131
  access: "create",
87032
87132
  role: "admin"
87033
87133
  },
87134
+ "deviceManager.setAlias": {
87135
+ capName: "device-manager",
87136
+ capScope: "system",
87137
+ addonId: null,
87138
+ access: "create",
87139
+ role: "admin"
87140
+ },
87034
87141
  "deviceManager.setChildLayout": {
87035
87142
  capName: "device-manager",
87036
87143
  capScope: "system",
@@ -88319,13 +88426,6 @@ Object.freeze({
88319
88426
  access: "delete",
88320
88427
  role: "admin"
88321
88428
  },
88322
- "llm.deleteProfile": {
88323
- capName: "llm",
88324
- capScope: "system",
88325
- addonId: null,
88326
- access: "delete",
88327
- role: "admin"
88328
- },
88329
88429
  "llm.generate": {
88330
88430
  capName: "llm",
88331
88431
  capScope: "system",
@@ -88389,20 +88489,6 @@ Object.freeze({
88389
88489
  access: "view",
88390
88490
  role: "admin"
88391
88491
  },
88392
- "llm.listProfileKinds": {
88393
- capName: "llm",
88394
- capScope: "system",
88395
- addonId: null,
88396
- access: "view",
88397
- role: "admin"
88398
- },
88399
- "llm.listProfiles": {
88400
- capName: "llm",
88401
- capScope: "system",
88402
- addonId: null,
88403
- access: "view",
88404
- role: "admin"
88405
- },
88406
88492
  "llm.listRuntimeNodes": {
88407
88493
  capName: "llm",
88408
88494
  capScope: "system",
@@ -88410,13 +88496,6 @@ Object.freeze({
88410
88496
  access: "view",
88411
88497
  role: "admin"
88412
88498
  },
88413
- "llm.migrateRawSecrets": {
88414
- capName: "llm",
88415
- capScope: "system",
88416
- addonId: null,
88417
- access: "create",
88418
- role: "admin"
88419
- },
88420
88499
  "llm.resolveModelRef": {
88421
88500
  capName: "llm",
88422
88501
  capScope: "system",
@@ -88445,20 +88524,6 @@ Object.freeze({
88445
88524
  access: "create",
88446
88525
  role: "admin"
88447
88526
  },
88448
- "llm.testProfile": {
88449
- capName: "llm",
88450
- capScope: "system",
88451
- addonId: null,
88452
- access: "create",
88453
- role: "admin"
88454
- },
88455
- "llm.upsertProfile": {
88456
- capName: "llm",
88457
- capScope: "system",
88458
- addonId: null,
88459
- access: "create",
88460
- role: "admin"
88461
- },
88462
88527
  "llmRuntime.appleAvailability": {
88463
88528
  capName: "llm-runtime",
88464
88529
  capScope: "system",
@@ -88963,13 +89028,6 @@ Object.freeze({
88963
89028
  access: "create",
88964
89029
  role: "admin"
88965
89030
  },
88966
- "meshNetwork.testConnection": {
88967
- capName: "mesh-network",
88968
- capScope: "system",
88969
- addonId: null,
88970
- access: "create",
88971
- role: "admin"
88972
- },
88973
89031
  "meter.getStatus": {
88974
89032
  capName: "meter",
88975
89033
  capScope: "device",
@@ -89628,13 +89686,6 @@ Object.freeze({
89628
89686
  access: "create",
89629
89687
  role: "admin"
89630
89688
  },
89631
- "notificationOutput.deleteTarget": {
89632
- capName: "notification-output",
89633
- capScope: "system",
89634
- addonId: null,
89635
- access: "delete",
89636
- role: "admin"
89637
- },
89638
89689
  "notificationOutput.discoverTargets": {
89639
89690
  capName: "notification-output",
89640
89691
  capScope: "system",
@@ -89642,13 +89693,6 @@ Object.freeze({
89642
89693
  access: "view",
89643
89694
  role: "admin"
89644
89695
  },
89645
- "notificationOutput.getTarget": {
89646
- capName: "notification-output",
89647
- capScope: "system",
89648
- addonId: null,
89649
- access: "view",
89650
- role: "admin"
89651
- },
89652
89696
  "notificationOutput.listTargetKinds": {
89653
89697
  capName: "notification-output",
89654
89698
  capScope: "system",
@@ -89656,13 +89700,6 @@ Object.freeze({
89656
89700
  access: "view",
89657
89701
  role: "admin"
89658
89702
  },
89659
- "notificationOutput.listTargets": {
89660
- capName: "notification-output",
89661
- capScope: "system",
89662
- addonId: null,
89663
- access: "view",
89664
- role: "admin"
89665
- },
89666
89703
  "notificationOutput.probeTargetConfig": {
89667
89704
  capName: "notification-output",
89668
89705
  capScope: "system",
@@ -89677,13 +89714,6 @@ Object.freeze({
89677
89714
  access: "create",
89678
89715
  role: "admin"
89679
89716
  },
89680
- "notificationOutput.setTargetEnabled": {
89681
- capName: "notification-output",
89682
- capScope: "system",
89683
- addonId: null,
89684
- access: "create",
89685
- role: "admin"
89686
- },
89687
89717
  "notificationOutput.testTarget": {
89688
89718
  capName: "notification-output",
89689
89719
  capScope: "system",
@@ -89691,13 +89721,6 @@ Object.freeze({
89691
89721
  access: "create",
89692
89722
  role: "admin"
89693
89723
  },
89694
- "notificationOutput.upsertTarget": {
89695
- capName: "notification-output",
89696
- capScope: "system",
89697
- addonId: null,
89698
- access: "create",
89699
- role: "admin"
89700
- },
89701
89724
  "notificationRules.activateAlarmProfile": {
89702
89725
  capName: "notification-rules",
89703
89726
  capScope: "system",
@@ -89957,41 +89980,6 @@ Object.freeze({
89957
89980
  access: "view",
89958
89981
  role: "admin"
89959
89982
  },
89960
- "oidcConnections.connectionFormSchema": {
89961
- capName: "oidc-connections",
89962
- capScope: "system",
89963
- addonId: null,
89964
- access: "view",
89965
- role: "admin"
89966
- },
89967
- "oidcConnections.createConnection": {
89968
- capName: "oidc-connections",
89969
- capScope: "system",
89970
- addonId: null,
89971
- access: "create",
89972
- role: "admin"
89973
- },
89974
- "oidcConnections.deleteConnection": {
89975
- capName: "oidc-connections",
89976
- capScope: "system",
89977
- addonId: null,
89978
- access: "delete",
89979
- role: "admin"
89980
- },
89981
- "oidcConnections.listConnections": {
89982
- capName: "oidc-connections",
89983
- capScope: "system",
89984
- addonId: null,
89985
- access: "view",
89986
- role: "admin"
89987
- },
89988
- "oidcConnections.updateConnection": {
89989
- capName: "oidc-connections",
89990
- capScope: "system",
89991
- addonId: null,
89992
- access: "create",
89993
- role: "admin"
89994
- },
89995
89983
  "osd.getStatus": {
89996
89984
  capName: "osd",
89997
89985
  capScope: "device",
@@ -93023,13 +93011,6 @@ Object.freeze({
93023
93011
  access: "delete",
93024
93012
  role: "admin"
93025
93013
  },
93026
- "storage.deleteLocation": {
93027
- capName: "storage",
93028
- capScope: "system",
93029
- addonId: null,
93030
- access: "delete",
93031
- role: "admin"
93032
- },
93033
93014
  "storage.endDownload": {
93034
93015
  capName: "storage",
93035
93016
  capScope: "system",
@@ -93086,13 +93067,6 @@ Object.freeze({
93086
93067
  access: "view",
93087
93068
  role: "admin"
93088
93069
  },
93089
- "storage.listProviders": {
93090
- capName: "storage",
93091
- capScope: "system",
93092
- addonId: null,
93093
- access: "view",
93094
- role: "admin"
93095
- },
93096
93070
  "storage.read": {
93097
93071
  capName: "storage",
93098
93072
  capScope: "system",
@@ -93114,27 +93088,6 @@ Object.freeze({
93114
93088
  access: "view",
93115
93089
  role: "admin"
93116
93090
  },
93117
- "storage.testConfig": {
93118
- capName: "storage",
93119
- capScope: "system",
93120
- addonId: null,
93121
- access: "view",
93122
- role: "admin"
93123
- },
93124
- "storage.testLocation": {
93125
- capName: "storage",
93126
- capScope: "system",
93127
- addonId: null,
93128
- access: "view",
93129
- role: "admin"
93130
- },
93131
- "storage.upsertLocation": {
93132
- capName: "storage",
93133
- capScope: "system",
93134
- addonId: null,
93135
- access: "create",
93136
- role: "admin"
93137
- },
93138
93091
  "storage.write": {
93139
93092
  capName: "storage",
93140
93093
  capScope: "system",
@@ -93912,27 +93865,6 @@ Object.freeze({
93912
93865
  access: "create",
93913
93866
  role: "admin"
93914
93867
  },
93915
- "terminalSession.createInstance": {
93916
- capName: "terminal-session",
93917
- capScope: "system",
93918
- addonId: null,
93919
- access: "create",
93920
- role: "admin"
93921
- },
93922
- "terminalSession.deleteInstance": {
93923
- capName: "terminal-session",
93924
- capScope: "system",
93925
- addonId: null,
93926
- access: "delete",
93927
- role: "admin"
93928
- },
93929
- "terminalSession.listInstances": {
93930
- capName: "terminal-session",
93931
- capScope: "system",
93932
- addonId: null,
93933
- access: "view",
93934
- role: "admin"
93935
- },
93936
93868
  "terminalSession.listLegacyCameras": {
93937
93869
  capName: "terminal-session",
93938
93870
  capScope: "system",
@@ -93975,20 +93907,6 @@ Object.freeze({
93975
93907
  access: "create",
93976
93908
  role: "admin"
93977
93909
  },
93978
- "terminalSession.setInstanceEnabled": {
93979
- capName: "terminal-session",
93980
- capScope: "system",
93981
- addonId: null,
93982
- access: "create",
93983
- role: "admin"
93984
- },
93985
- "terminalSession.updateInstance": {
93986
- capName: "terminal-session",
93987
- capScope: "system",
93988
- addonId: null,
93989
- access: "create",
93990
- role: "admin"
93991
- },
93992
93910
  "terminalSession.writeInput": {
93993
93911
  capName: "terminal-session",
93994
93912
  capScope: "system",
@@ -94003,6 +93921,13 @@ Object.freeze({
94003
93921
  access: "create",
94004
93922
  role: "viewer"
94005
93923
  },
93924
+ "timedRun.getOptions": {
93925
+ capName: "timed-run",
93926
+ capScope: "device",
93927
+ addonId: null,
93928
+ access: "view",
93929
+ role: "viewer"
93930
+ },
94006
93931
  "timedRun.getStatus": {
94007
93932
  capName: "timed-run",
94008
93933
  capScope: "device",
@@ -94017,6 +93942,13 @@ Object.freeze({
94017
93942
  access: "create",
94018
93943
  role: "viewer"
94019
93944
  },
93945
+ "timedRun.setSettings": {
93946
+ capName: "timed-run",
93947
+ capScope: "device",
93948
+ addonId: null,
93949
+ access: "create",
93950
+ role: "admin"
93951
+ },
94020
93952
  "toast.onToast": {
94021
93953
  capName: "toast",
94022
93954
  capScope: "system",
@@ -95165,6 +95097,7 @@ function createRuntimeStateBridge(params) {
95165
95097
  getStatus
95166
95098
  };
95167
95099
  }
95100
+ string().min(1).max(4096);
95168
95101
  Object.freeze({
95169
95102
  "accessories.getStatus": [{
95170
95103
  name: "deviceId",
@@ -95848,6 +95781,11 @@ Object.freeze({
95848
95781
  form: "single",
95849
95782
  optional: false
95850
95783
  }],
95784
+ "deviceManager.setAlias": [{
95785
+ name: "deviceId",
95786
+ form: "single",
95787
+ optional: false
95788
+ }],
95851
95789
  "deviceManager.setChildLayout": [{
95852
95790
  name: "deviceId",
95853
95791
  form: "single",
@@ -97912,6 +97850,11 @@ Object.freeze({
97912
97850
  form: "single",
97913
97851
  optional: false
97914
97852
  }],
97853
+ "timedRun.getOptions": [{
97854
+ name: "deviceId",
97855
+ form: "single",
97856
+ optional: false
97857
+ }],
97915
97858
  "timedRun.getStatus": [{
97916
97859
  name: "deviceId",
97917
97860
  form: "single",
@@ -97922,6 +97865,11 @@ Object.freeze({
97922
97865
  form: "single",
97923
97866
  optional: false
97924
97867
  }],
97868
+ "timedRun.setSettings": [{
97869
+ name: "deviceId",
97870
+ form: "single",
97871
+ optional: false
97872
+ }],
97925
97873
  "update.getStatus": [{
97926
97874
  name: "deviceId",
97927
97875
  form: "single",
@@ -98784,6 +98732,7 @@ var STATE_SUMMARY_VARS = [
98784
98732
  [...RULE_TEXT],
98785
98733
  [...RULE_TEXT],
98786
98734
  [...RULE_TEXT],
98735
+ [...RULE_TEXT],
98787
98736
  [...RULE_BODY_ONLY],
98788
98737
  [...RULE_TEXT],
98789
98738
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
@@ -113079,7 +113028,13 @@ function buildHikvisionInstances(records) {
113079
113028
  },
113080
113029
  instanceMode: "single",
113081
113030
  kind: "connection",
113082
- canTest: false
113031
+ canTest: false,
113032
+ kinds: [{
113033
+ id: "connection",
113034
+ label: "Hikvision",
113035
+ functionCap: "device-provider",
113036
+ role: "devices"
113037
+ }]
113083
113038
  },
113084
113039
  formSchema: () => ({ sections: [] }),
113085
113040
  initialBody: (name) => ({ name }),