@camstack/addon-smtp-nodemailer 1.1.13 → 1.1.14

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.
@@ -4665,7 +4665,7 @@ function _instanceof(cls, params = {}) {
4665
4665
  return inst;
4666
4666
  }
4667
4667
  //#endregion
4668
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4668
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4669
4669
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4670
4670
  EventCategory["SystemBoot"] = "system.boot";
4671
4671
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5478,6 +5478,100 @@ function createDurableState(deps) {
5478
5478
  };
5479
5479
  }
5480
5480
  /**
5481
+ * Per-node scoping for the shared addon-settings blob.
5482
+ *
5483
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5484
+ * hub-routed — the hub instance answers for every node), so fields whose
5485
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5486
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5487
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5488
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5489
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5490
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5491
+ *
5492
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5493
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5494
+ * schema and routes reads/writes through these helpers.
5495
+ *
5496
+ * ## No bare-key fallback — deliberate
5497
+ *
5498
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5499
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5500
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5501
+ * the store is invisible to every node, hub included, so one node's
5502
+ * selection can never leak onto another. (This generalizes the
5503
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5504
+ * arbitrary set of per-node field keys.)
5505
+ *
5506
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5507
+ * LEAF module: import it via its deep path, never from the root barrel.
5508
+ */
5509
+ /**
5510
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5511
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5512
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5513
+ * `undefined` / `null` / empty falls back to `'hub'`.
5514
+ */
5515
+ function normalizeNodeId(raw) {
5516
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5517
+ const slashIdx = raw.indexOf("/");
5518
+ if (slashIdx < 0) return raw;
5519
+ const bare = raw.slice(0, slashIdx);
5520
+ return bare === "" ? "hub" : bare;
5521
+ }
5522
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5523
+ function nodeScopedKey(base, nodeId) {
5524
+ return `${base}@${normalizeNodeId(nodeId)}`;
5525
+ }
5526
+ /**
5527
+ * Read a node's value for a per-node field from the raw shared store:
5528
+ * the node-scoped key when present, otherwise `undefined`.
5529
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5530
+ * schema `default` win on `undefined`.
5531
+ */
5532
+ function readNodeValue(store, base, nodeId) {
5533
+ return store[nodeScopedKey(base, nodeId)];
5534
+ }
5535
+ /**
5536
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5537
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5538
+ * the write path so a save for one node never clobbers another node's value
5539
+ * (and the bare key is never written). Returns a new object — the input
5540
+ * patch is not mutated.
5541
+ */
5542
+ function scopePatch(patch, perNodeKeys, nodeId) {
5543
+ const out = {};
5544
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5545
+ return out;
5546
+ }
5547
+ /**
5548
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5549
+ * UI schema (whose field keys are bare) hydrates from that node's own
5550
+ * values:
5551
+ *
5552
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5553
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5554
+ * legacy key must never hydrate any node — no bare fallback).
5555
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5556
+ * each bare perNode key; when the node has no scoped key the bare key is
5557
+ * left ABSENT so the field's schema `default` wins.
5558
+ *
5559
+ * Returns a new object — the input store is not mutated.
5560
+ */
5561
+ function projectStore(store, perNodeKeys, nodeId) {
5562
+ const out = {};
5563
+ for (const [key, value] of Object.entries(store)) {
5564
+ if (key.includes("@")) continue;
5565
+ if (perNodeKeys.has(key)) continue;
5566
+ out[key] = value;
5567
+ }
5568
+ for (const base of perNodeKeys) {
5569
+ const value = readNodeValue(store, base, nodeId);
5570
+ if (value !== void 0) out[base] = value;
5571
+ }
5572
+ return out;
5573
+ }
5574
+ /**
5481
5575
  * Base class for CamStack addons. Eliminates settings boilerplate:
5482
5576
  *
5483
5577
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5645,23 +5739,63 @@ var BaseAddon = class {
5645
5739
  deviceSettingsSchema() {
5646
5740
  return null;
5647
5741
  }
5648
- async getGlobalSettings(overlay, cap, _nodeId) {
5742
+ async getGlobalSettings(overlay, cap, nodeId) {
5649
5743
  const schema = this.globalSettingsSchema(cap);
5650
5744
  if (!schema) return { sections: [] };
5651
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5745
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5652
5746
  return hydrateSchema(schema, overlay ? {
5653
- ...raw,
5747
+ ...projected,
5654
5748
  ...overlay
5655
- } : raw);
5749
+ } : projected);
5656
5750
  }
5657
- async updateGlobalSettings(patch, _nodeId) {
5658
- await this._ctx?.settings?.writeAddonStore(patch);
5751
+ /**
5752
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5753
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5754
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5755
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5756
+ * A no-op passthrough when the schema declares no `perNode` field.
5757
+ *
5758
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5759
+ * the store for custom option logic (option narrowing, value snapping) to
5760
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5761
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5762
+ */
5763
+ async resolveGlobalStore(nodeId, cap) {
5764
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5765
+ const keys = this.perNodeKeys(cap);
5766
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5767
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5768
+ }
5769
+ async updateGlobalSettings(patch, nodeId) {
5770
+ const keys = this.perNodeKeys();
5771
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5772
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5773
+ const barePatch = patch;
5774
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5775
+ await this._ctx?.settings?.writeAddonStore(scoped);
5776
+ if (target !== localNode) return;
5659
5777
  await this.resolveConfig();
5660
5778
  await this.onConfigChanged();
5661
5779
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5662
5780
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5663
5781
  }
5664
5782
  /**
5783
+ * The set of field keys the global settings schema declares `perNode: true`
5784
+ * — derived once per `cap` argument and memoized (schemas are static
5785
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5786
+ * settings API behaves exactly like the legacy node-agnostic one.
5787
+ */
5788
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5789
+ perNodeKeys(cap) {
5790
+ const cacheKey = cap ?? "";
5791
+ const cached = this._perNodeKeysCache.get(cacheKey);
5792
+ if (cached) return cached;
5793
+ const schema = this.globalSettingsSchema(cap);
5794
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5795
+ this._perNodeKeysCache.set(cacheKey, keys);
5796
+ return keys;
5797
+ }
5798
+ /**
5665
5799
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5666
5800
  * schedule an addon restart for the next tick. Deferred via
5667
5801
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5814,12 +5948,19 @@ var BaseAddon = class {
5814
5948
  * The merge is shallow: each key in `defaults` is checked against the store.
5815
5949
  * Only keys present in defaults are read — the store can contain extra keys
5816
5950
  * (e.g. from older versions) without polluting the typed config.
5951
+ *
5952
+ * Keys the global settings schema declares `perNode: true` resolve from
5953
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5954
+ * from the bare key — so a per-node field resolves to this node's own
5955
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5817
5956
  */
5818
5957
  async resolveConfig() {
5819
5958
  const stored = await this.readAddonStoreWithRetry();
5959
+ const perNode = this.perNodeKeys();
5960
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5820
5961
  const resolved = { ...this.defaults };
5821
5962
  for (const key of Object.keys(this.defaults)) {
5822
- const storedValue = stored[key];
5963
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5823
5964
  if (storedValue !== void 0 && storedValue !== null) {
5824
5965
  const defaultType = typeof this.defaults[key];
5825
5966
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5903,6 +6044,27 @@ var BaseAddon = class {
5903
6044
  }
5904
6045
  };
5905
6046
  /**
6047
+ * Collect the keys of every field marked `perNode: true`, recursing into
6048
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6049
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6050
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6051
+ */
6052
+ function collectPerNodeFieldKeys(fields) {
6053
+ const collected = [];
6054
+ for (const field of fields) {
6055
+ if (field.type === "group") {
6056
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6057
+ continue;
6058
+ }
6059
+ if (field.type === "sub-tabs") {
6060
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6061
+ continue;
6062
+ }
6063
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6064
+ }
6065
+ return collected;
6066
+ }
6067
+ /**
5906
6068
  * Normalize an `ICamstackAddon.initialize()` return value into the
5907
6069
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5908
6070
  * envelopes pass through; void stays void.
@@ -5927,6 +6089,7 @@ var CamStreamKindSchema = _enum([
5927
6089
  "pull-rtsp",
5928
6090
  "pull-rtmp",
5929
6091
  "pull-http",
6092
+ "pull-flv",
5930
6093
  "pull-rfc4571",
5931
6094
  "push-annexb",
5932
6095
  "derived"
@@ -6309,6 +6472,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6309
6472
  /** Single still-image entity (HA `image.*`). Read-only display of an
6310
6473
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6311
6474
  DeviceType["Image"] = "image";
6475
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6476
+ * level, battery, desiccant life, feeding state and manual-feed /
6477
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6478
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6479
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6480
+ * integrations sharing the same food/desiccant/hopper surface. */
6481
+ DeviceType["PetFeeder"] = "pet-feeder";
6312
6482
  return DeviceType;
6313
6483
  }({});
6314
6484
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7457,6 +7627,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7457
7627
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7458
7628
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7459
7629
  /**
7630
+ * Error types for the safe expression engine. Two distinct classes so callers
7631
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7632
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7633
+ */
7634
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7635
+ * the failure is anchored to a character (author-facing inline feedback). */
7636
+ var ExpressionParseError = class extends Error {
7637
+ position;
7638
+ constructor(message, position) {
7639
+ super(message);
7640
+ this.name = "ExpressionParseError";
7641
+ this.position = position;
7642
+ }
7643
+ };
7644
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7645
+ * result, unknown builtin, step-budget exceeded). */
7646
+ var ExpressionEvalError = class extends Error {
7647
+ constructor(message) {
7648
+ super(message);
7649
+ this.name = "ExpressionEvalError";
7650
+ }
7651
+ };
7652
+ /**
7653
+ * Resource-bound constants for the safe expression engine.
7654
+ *
7655
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7656
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7657
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7658
+ * work a single author-supplied expression can request, so a hostile or
7659
+ * accidental pathological string can never spend unbounded CPU/memory.
7660
+ */
7661
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7662
+ * rejected without allocation. */
7663
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7664
+ /** A legal binding / identifier name. */
7665
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7666
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7667
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7668
+ var RESERVED_BINDING_NAMES = new Set([
7669
+ "now",
7670
+ "true",
7671
+ "false",
7672
+ "null"
7673
+ ]);
7674
+ /**
7675
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7676
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7677
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7678
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7679
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7680
+ * is a parse error with a source position, so member access / assignment /
7681
+ * template literals are lexically impossible.
7682
+ */
7683
+ var KEYWORDS = new Set([
7684
+ "true",
7685
+ "false",
7686
+ "null"
7687
+ ]);
7688
+ function isDigit(ch) {
7689
+ return ch >= "0" && ch <= "9";
7690
+ }
7691
+ function isIdentStart(ch) {
7692
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7693
+ }
7694
+ function isIdentPart(ch) {
7695
+ return isIdentStart(ch) || isDigit(ch);
7696
+ }
7697
+ function isWhitespace(ch) {
7698
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7699
+ }
7700
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7701
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7702
+ * string. */
7703
+ function tokenize(source) {
7704
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7705
+ const tokens = [];
7706
+ let i = 0;
7707
+ const n = source.length;
7708
+ while (i < n) {
7709
+ const ch = source[i];
7710
+ if (isWhitespace(ch)) {
7711
+ i += 1;
7712
+ continue;
7713
+ }
7714
+ if (isDigit(ch)) {
7715
+ const start = i;
7716
+ while (i < n && isDigit(source[i])) i += 1;
7717
+ if (i < n && source[i] === ".") {
7718
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7719
+ i += 1;
7720
+ while (i < n && isDigit(source[i])) i += 1;
7721
+ }
7722
+ const text = source.slice(start, i);
7723
+ const value = Number(text);
7724
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7725
+ tokens.push({
7726
+ type: "number",
7727
+ value,
7728
+ pos: start
7729
+ });
7730
+ continue;
7731
+ }
7732
+ if (ch === "'" || ch === "\"") {
7733
+ const quote = ch;
7734
+ const start = i;
7735
+ i += 1;
7736
+ let out = "";
7737
+ let closed = false;
7738
+ while (i < n) {
7739
+ const c = source[i];
7740
+ if (c === "\\") {
7741
+ const next = i + 1 < n ? source[i + 1] : "";
7742
+ if (next === "\\" || next === "'" || next === "\"") {
7743
+ out += next;
7744
+ i += 2;
7745
+ continue;
7746
+ }
7747
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7748
+ }
7749
+ if (c === quote) {
7750
+ closed = true;
7751
+ i += 1;
7752
+ break;
7753
+ }
7754
+ out += c;
7755
+ i += 1;
7756
+ }
7757
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7758
+ tokens.push({
7759
+ type: "string",
7760
+ value: out,
7761
+ pos: start
7762
+ });
7763
+ continue;
7764
+ }
7765
+ if (isIdentStart(ch)) {
7766
+ const start = i;
7767
+ while (i < n && isIdentPart(source[i])) i += 1;
7768
+ const text = source.slice(start, i);
7769
+ if (KEYWORDS.has(text)) tokens.push({
7770
+ type: "keyword",
7771
+ keyword: keywordOf(text),
7772
+ pos: start
7773
+ });
7774
+ else tokens.push({
7775
+ type: "identifier",
7776
+ name: text,
7777
+ pos: start
7778
+ });
7779
+ continue;
7780
+ }
7781
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7782
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7783
+ tokens.push({
7784
+ type: "punct",
7785
+ punct: two,
7786
+ pos: i
7787
+ });
7788
+ i += 2;
7789
+ continue;
7790
+ }
7791
+ if (isSinglePunct(ch)) {
7792
+ tokens.push({
7793
+ type: "punct",
7794
+ punct: ch,
7795
+ pos: i
7796
+ });
7797
+ i += 1;
7798
+ continue;
7799
+ }
7800
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7801
+ }
7802
+ tokens.push({
7803
+ type: "eof",
7804
+ pos: n
7805
+ });
7806
+ return tokens;
7807
+ }
7808
+ function keywordOf(text) {
7809
+ if (text === "true") return "true";
7810
+ if (text === "false") return "false";
7811
+ return "null";
7812
+ }
7813
+ function isSinglePunct(ch) {
7814
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7815
+ }
7816
+ /**
7817
+ * Frozen, null-prototype builtin function table for the expression engine
7818
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7819
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7820
+ * own-property check against it.
7821
+ *
7822
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7823
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7824
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7825
+ * (there is no `Object.prototype` in the chain), so those names are not
7826
+ * callable — they are simply "unknown function" at parse time.
7827
+ *
7828
+ * Every numeric argument is validated as a finite number and every numeric
7829
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7830
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7831
+ * closed rather than emitting a garbage value.
7832
+ */
7833
+ function asFiniteNumber(value, name, index) {
7834
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7835
+ return value;
7836
+ }
7837
+ function asString$1(value, name, index) {
7838
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7839
+ return value;
7840
+ }
7841
+ function finiteResult(value, name) {
7842
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7843
+ return value;
7844
+ }
7845
+ function allFiniteNumbers(args, name) {
7846
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7847
+ }
7848
+ var INF = Number.POSITIVE_INFINITY;
7849
+ var table = {
7850
+ min: {
7851
+ minArgs: 1,
7852
+ maxArgs: INF,
7853
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7854
+ },
7855
+ max: {
7856
+ minArgs: 1,
7857
+ maxArgs: INF,
7858
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7859
+ },
7860
+ abs: {
7861
+ minArgs: 1,
7862
+ maxArgs: 1,
7863
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7864
+ },
7865
+ floor: {
7866
+ minArgs: 1,
7867
+ maxArgs: 1,
7868
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7869
+ },
7870
+ ceil: {
7871
+ minArgs: 1,
7872
+ maxArgs: 1,
7873
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7874
+ },
7875
+ sqrt: {
7876
+ minArgs: 1,
7877
+ maxArgs: 1,
7878
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7879
+ },
7880
+ round: {
7881
+ minArgs: 1,
7882
+ maxArgs: 2,
7883
+ apply: (args) => {
7884
+ const x = asFiniteNumber(args[0], "round", 0);
7885
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7886
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7887
+ const factor = 10 ** digits;
7888
+ return finiteResult(Math.round(x * factor) / factor, "round");
7889
+ }
7890
+ },
7891
+ pow: {
7892
+ minArgs: 2,
7893
+ maxArgs: 2,
7894
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7895
+ },
7896
+ clamp: {
7897
+ minArgs: 3,
7898
+ maxArgs: 3,
7899
+ apply: (args) => {
7900
+ const x = asFiniteNumber(args[0], "clamp", 0);
7901
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7902
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7903
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7904
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7905
+ }
7906
+ },
7907
+ avg: {
7908
+ minArgs: 1,
7909
+ maxArgs: INF,
7910
+ apply: (args) => {
7911
+ const nums = allFiniteNumbers(args, "avg");
7912
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7913
+ }
7914
+ },
7915
+ sum: {
7916
+ minArgs: 1,
7917
+ maxArgs: INF,
7918
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7919
+ },
7920
+ coalesce: {
7921
+ minArgs: 1,
7922
+ maxArgs: INF,
7923
+ apply: (args) => {
7924
+ for (const a of args) if (a !== null) return a;
7925
+ return null;
7926
+ }
7927
+ },
7928
+ age: {
7929
+ minArgs: 2,
7930
+ maxArgs: 2,
7931
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7932
+ },
7933
+ convert: {
7934
+ minArgs: 3,
7935
+ maxArgs: 3,
7936
+ apply: (args, hooks) => {
7937
+ const x = asFiniteNumber(args[0], "convert", 0);
7938
+ const from = asString$1(args[1], "convert", 1).trim();
7939
+ const to = asString$1(args[2], "convert", 2).trim();
7940
+ if (hooks.convert) {
7941
+ const out = hooks.convert(x, from, to);
7942
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7943
+ return finiteResult(out, "convert");
7944
+ }
7945
+ if (from === to) return x;
7946
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7947
+ }
7948
+ }
7949
+ };
7950
+ Object.freeze(Object.assign(Object.create(null), table));
7951
+ /** The set of valid builtin names — used by the parser to reject unknown
7952
+ * callees at parse time (immediate author feedback). */
7953
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7954
+ /**
7955
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7956
+ *
7957
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7958
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7959
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7960
+ * string validated against the builtin table at parse time, so an unknown
7961
+ * function is rejected immediately (author feedback) and a persisted expression
7962
+ * that references a since-removed builtin degrades at read.
7963
+ *
7964
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7965
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7966
+ */
7967
+ /** Binary/logical operator precedence (higher binds tighter). */
7968
+ var BINARY_PRECEDENCE = {
7969
+ "||": 1,
7970
+ "&&": 2,
7971
+ "==": 3,
7972
+ "!=": 3,
7973
+ "<": 4,
7974
+ "<=": 4,
7975
+ ">": 4,
7976
+ ">=": 4,
7977
+ "+": 5,
7978
+ "-": 5,
7979
+ "*": 6,
7980
+ "/": 6,
7981
+ "%": 6
7982
+ };
7983
+ function isLogicalOp(op) {
7984
+ return op === "&&" || op === "||";
7985
+ }
7986
+ function isBinaryOp(op) {
7987
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
7988
+ }
7989
+ var Parser = class {
7990
+ tokens;
7991
+ pos = 0;
7992
+ nodeCount = 0;
7993
+ identifiers = /* @__PURE__ */ new Set();
7994
+ callees = /* @__PURE__ */ new Set();
7995
+ constructor(tokens) {
7996
+ this.tokens = tokens;
7997
+ }
7998
+ parse() {
7999
+ const ast = this.parseTernary();
8000
+ const tok = this.peek();
8001
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8002
+ return {
8003
+ ast,
8004
+ identifiers: this.identifiers,
8005
+ callees: this.callees,
8006
+ nodeCount: this.nodeCount
8007
+ };
8008
+ }
8009
+ peek() {
8010
+ return this.tokens[this.pos];
8011
+ }
8012
+ next() {
8013
+ return this.tokens[this.pos++];
8014
+ }
8015
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8016
+ expectPunct(punct) {
8017
+ const tok = this.peek();
8018
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8019
+ this.pos += 1;
8020
+ }
8021
+ matchPunct(punct) {
8022
+ const tok = this.peek();
8023
+ if (tok.type === "punct" && tok.punct === punct) {
8024
+ this.pos += 1;
8025
+ return true;
8026
+ }
8027
+ return false;
8028
+ }
8029
+ countNode() {
8030
+ this.nodeCount += 1;
8031
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8032
+ }
8033
+ parseTernary() {
8034
+ const test = this.parseBinary(1);
8035
+ if (this.matchPunct("?")) {
8036
+ const consequent = this.parseTernary();
8037
+ this.expectPunct(":");
8038
+ const alternate = this.parseTernary();
8039
+ this.countNode();
8040
+ return {
8041
+ kind: "conditional",
8042
+ test,
8043
+ consequent,
8044
+ alternate
8045
+ };
8046
+ }
8047
+ return test;
8048
+ }
8049
+ parseBinary(minPrec) {
8050
+ let left = this.parseUnary();
8051
+ for (;;) {
8052
+ const tok = this.peek();
8053
+ if (tok.type !== "punct") break;
8054
+ const prec = BINARY_PRECEDENCE[tok.punct];
8055
+ if (prec === void 0 || prec < minPrec) break;
8056
+ const op = tok.punct;
8057
+ this.pos += 1;
8058
+ const right = this.parseBinary(prec + 1);
8059
+ this.countNode();
8060
+ if (isLogicalOp(op)) left = {
8061
+ kind: "logical",
8062
+ op,
8063
+ left,
8064
+ right
8065
+ };
8066
+ else if (isBinaryOp(op)) left = {
8067
+ kind: "binary",
8068
+ op,
8069
+ left,
8070
+ right
8071
+ };
8072
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8073
+ }
8074
+ return left;
8075
+ }
8076
+ parseUnary() {
8077
+ const tok = this.peek();
8078
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8079
+ const op = tok.punct;
8080
+ this.pos += 1;
8081
+ const operand = this.parseUnary();
8082
+ this.countNode();
8083
+ return {
8084
+ kind: "unary",
8085
+ op,
8086
+ operand
8087
+ };
8088
+ }
8089
+ return this.parsePrimary();
8090
+ }
8091
+ parsePrimary() {
8092
+ const tok = this.next();
8093
+ switch (tok.type) {
8094
+ case "number":
8095
+ this.countNode();
8096
+ return {
8097
+ kind: "literal",
8098
+ value: tok.value
8099
+ };
8100
+ case "string":
8101
+ this.countNode();
8102
+ return {
8103
+ kind: "literal",
8104
+ value: tok.value
8105
+ };
8106
+ case "keyword":
8107
+ this.countNode();
8108
+ return {
8109
+ kind: "literal",
8110
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8111
+ };
8112
+ case "identifier": {
8113
+ const nextTok = this.peek();
8114
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8115
+ this.identifiers.add(tok.name);
8116
+ this.countNode();
8117
+ return {
8118
+ kind: "identifier",
8119
+ name: tok.name
8120
+ };
8121
+ }
8122
+ case "punct":
8123
+ if (tok.punct === "(") {
8124
+ const inner = this.parseTernary();
8125
+ this.expectPunct(")");
8126
+ return inner;
8127
+ }
8128
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8129
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8130
+ }
8131
+ }
8132
+ parseCall(callee, pos) {
8133
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8134
+ this.expectPunct("(");
8135
+ const args = [];
8136
+ if (!this.matchPunct(")")) for (;;) {
8137
+ args.push(this.parseTernary());
8138
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8139
+ if (this.matchPunct(",")) continue;
8140
+ this.expectPunct(")");
8141
+ break;
8142
+ }
8143
+ this.callees.add(callee);
8144
+ this.countNode();
8145
+ return {
8146
+ kind: "call",
8147
+ callee,
8148
+ args
8149
+ };
8150
+ }
8151
+ };
8152
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8153
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8154
+ function parseExpression(source) {
8155
+ return new Parser(tokenize(source)).parse();
8156
+ }
8157
+ Object.freeze({});
8158
+ /**
8159
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8160
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8161
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8162
+ * one per read on a hot resolve path.
8163
+ *
8164
+ * The cache is a module-level singleton: entries are pure, content-addressed
8165
+ * ASTs keyed by the raw source string, so sharing one instance across all
8166
+ * callers is safe and maximises hit rate.
8167
+ */
8168
+ var cache = /* @__PURE__ */ new Map();
8169
+ function getCached(source) {
8170
+ const hit = cache.get(source);
8171
+ if (hit !== void 0) {
8172
+ cache.delete(source);
8173
+ cache.set(source, hit);
8174
+ return hit;
8175
+ }
8176
+ let result;
8177
+ try {
8178
+ result = {
8179
+ ok: true,
8180
+ parsed: parseExpression(source)
8181
+ };
8182
+ } catch (err) {
8183
+ result = {
8184
+ ok: false,
8185
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8186
+ };
8187
+ }
8188
+ cache.set(source, result);
8189
+ if (cache.size > 256) {
8190
+ const oldest = cache.keys().next().value;
8191
+ if (oldest !== void 0) cache.delete(oldest);
8192
+ }
8193
+ return result;
8194
+ }
8195
+ /** Compile `source`, returning a discriminated result instead of throwing.
8196
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8197
+ function compileExpressionSafe(source) {
8198
+ return getCached(source);
8199
+ }
8200
+ /**
8201
+ * Author-time validation. Returns `null` when the source is valid, else a
8202
+ * human-readable error message. Checks: the expression compiles; binding count
8203
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8204
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8205
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8206
+ */
8207
+ function validateExpressionSource(src) {
8208
+ const names = Object.keys(src.bindings);
8209
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8210
+ for (const name of names) {
8211
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8212
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8213
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8214
+ }
8215
+ const compiled = compileExpressionSafe(src.expr);
8216
+ if (!compiled.ok) return compiled.error;
8217
+ const bound = new Set(names);
8218
+ for (const id of compiled.parsed.identifiers) {
8219
+ if (id === "now") continue;
8220
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8221
+ }
8222
+ return null;
8223
+ }
8224
+ /**
7460
8225
  * Accessory device helpers — shared across drivers.
7461
8226
  *
7462
8227
  * Many vendor-specific drivers register accessory child devices on
@@ -9359,7 +10124,8 @@ var MotionAnalysisResultSchema = object({
9359
10124
  });
9360
10125
  method(object({
9361
10126
  deviceId: number(),
9362
- frame: FrameInputSchema
10127
+ frame: FrameInputSchema.optional(),
10128
+ frameHandle: FrameHandleSchema.optional()
9363
10129
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9364
10130
  deviceId: number(),
9365
10131
  detected: boolean(),
@@ -9606,6 +10372,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9606
10372
  engine: PipelineEngineChoiceSchema.optional(),
9607
10373
  steps: array(PipelineStepInputSchema).min(1),
9608
10374
  frame: FrameInputSchema.optional(),
10375
+ /**
10376
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10377
+ * the decoded pixels live in. One more member of the one-of
10378
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10379
+ */
10380
+ frameHandle: FrameHandleSchema.optional(),
9609
10381
  imageBase64: string().optional(),
9610
10382
  /**
9611
10383
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9815,6 +10587,31 @@ var ReportMotionInputSchema = object({
9815
10587
  regions: array(MotionRegionSchema).readonly().optional()
9816
10588
  });
9817
10589
  /**
10590
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10591
+ * restream-owner model — P2c).
10592
+ *
10593
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10594
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10595
+ * `frameSource` key) parses to this, so the field is additive with zero
10596
+ * behavior change.
10597
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10598
+ * The runner acquires the owner's COMPRESSED passthrough restream
10599
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10600
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10601
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10602
+ * node-local; only H.264/H.265 packets cross the wire.
10603
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10604
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10605
+ * dials for the owner's restream.
10606
+ */
10607
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10608
+ kind: literal("remote-restream"),
10609
+ /** The camera's source-owner node (slice 1: always the hub). */
10610
+ ownerNodeId: string(),
10611
+ /** Operator override for the owner host the runner dials. */
10612
+ hubHostnameOverride: string().optional()
10613
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10614
+ /**
9818
10615
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9819
10616
  * specific runner instance via `attachCamera`. Carries everything the
9820
10617
  * runner needs to subscribe to the local broker and execute inference.
@@ -9912,7 +10709,15 @@ var RunnerCameraConfigSchema = object({
9912
10709
  */
9913
10710
  onboardMotionDrivesAnalyzer: boolean().default(true),
9914
10711
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9915
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10712
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10713
+ /**
10714
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10715
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10716
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10717
+ * camera's detect node differs from its source-owner (P2d, gated by the
10718
+ * `remoteSourcingNodes` rollout setting).
10719
+ */
10720
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9916
10721
  });
9917
10722
  motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
9918
10723
  /**
@@ -10277,6 +11082,113 @@ object({
10277
11082
  lastFetchedAt: number()
10278
11083
  });
10279
11084
  DeviceType.Sensor;
11085
+ /**
11086
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11087
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11088
+ * `on_batteries` (running on battery backup). `null` until first reported.
11089
+ */
11090
+ var PetFeederDeviceStatusSchema = _enum([
11091
+ "normal",
11092
+ "offline",
11093
+ "on_batteries"
11094
+ ]);
11095
+ var gramsPortion = number().int().min(4).max(200);
11096
+ object({
11097
+ /** Food currently in the bowl (grams). Null when the device has not
11098
+ * reported a reading yet. On dual-hopper models this is the combined
11099
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11100
+ foodLevel: number().nullable(),
11101
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11102
+ * single-hopper models. */
11103
+ food1: number().nullable(),
11104
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11105
+ * single-hopper models. */
11106
+ food2: number().nullable(),
11107
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11108
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11109
+ * below the feeder's low threshold. */
11110
+ lowFood: boolean(),
11111
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11112
+ * device has no battery reading. */
11113
+ batteryPower: number().min(0).max(100).nullable(),
11114
+ /** Days of desiccant life remaining. Null when the model has no
11115
+ * desiccant sensor. */
11116
+ desiccantLeftDays: number().nullable(),
11117
+ /** True while a feed is in progress. */
11118
+ feeding: boolean(),
11119
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11120
+ * Null until the device has reported a status. */
11121
+ status: PetFeederDeviceStatusSchema.nullable(),
11122
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11123
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11124
+ * with `errorCode` for consumers that want the raw integer. */
11125
+ error: string().nullable(),
11126
+ /** Raw device error code (0 / null = no error). */
11127
+ errorCode: number().nullable(),
11128
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11129
+ isDualHopper: boolean(),
11130
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11131
+ childLock: boolean(),
11132
+ /** Front indicator-light setting. */
11133
+ indicatorLight: boolean(),
11134
+ /** Play a chime when dispensing. */
11135
+ feedSound: boolean(),
11136
+ /** Speaker / prompt volume level (device-scaled integer). */
11137
+ volume: number(),
11138
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11139
+ lastFetchedAt: number()
11140
+ });
11141
+ DeviceType.PetFeeder, method(object({
11142
+ deviceId: number().int().nonnegative(),
11143
+ grams: gramsPortion.optional(),
11144
+ hopper1: gramsPortion.optional(),
11145
+ hopper2: gramsPortion.optional()
11146
+ }), _void(), {
11147
+ kind: "mutation",
11148
+ auth: "admin"
11149
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11150
+ kind: "mutation",
11151
+ auth: "admin"
11152
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11153
+ kind: "mutation",
11154
+ auth: "admin"
11155
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11156
+ kind: "mutation",
11157
+ auth: "admin"
11158
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11159
+ kind: "mutation",
11160
+ auth: "admin"
11161
+ }), method(object({
11162
+ deviceId: number().int().nonnegative(),
11163
+ soundId: number().int().nonnegative()
11164
+ }), _void(), {
11165
+ kind: "mutation",
11166
+ auth: "admin"
11167
+ }), method(object({
11168
+ deviceId: number().int().nonnegative(),
11169
+ on: boolean()
11170
+ }), _void(), {
11171
+ kind: "mutation",
11172
+ auth: "admin"
11173
+ }), method(object({
11174
+ deviceId: number().int().nonnegative(),
11175
+ on: boolean()
11176
+ }), _void(), {
11177
+ kind: "mutation",
11178
+ auth: "admin"
11179
+ }), method(object({
11180
+ deviceId: number().int().nonnegative(),
11181
+ on: boolean()
11182
+ }), _void(), {
11183
+ kind: "mutation",
11184
+ auth: "admin"
11185
+ }), method(object({
11186
+ deviceId: number().int().nonnegative(),
11187
+ level: number().int().nonnegative()
11188
+ }), _void(), {
11189
+ kind: "mutation",
11190
+ auth: "admin"
11191
+ });
10280
11192
  object({
10281
11193
  /** Instantaneous power draw in watts. */
10282
11194
  watts: number().optional(),
@@ -12104,10 +13016,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12104
13016
  url: string()
12105
13017
  }), _void()), method(object({
12106
13018
  sessionId: string(),
12107
- maxCount: number().default(1)
13019
+ maxCount: number().default(1),
13020
+ waitMs: number().optional()
12108
13021
  }), array(DecodedFrameSchema)), method(object({
12109
13022
  sessionId: string(),
12110
- maxCount: number().default(1)
13023
+ maxCount: number().default(1),
13024
+ waitMs: number().optional()
12111
13025
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12112
13026
  sessionId: string(),
12113
13027
  config: DecoderSessionConfigSchema.partial()
@@ -12394,14 +13308,63 @@ var ChildLayoutEntrySchema = object({
12394
13308
  collapsed: boolean().optional()
12395
13309
  });
12396
13310
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12397
- * `device-management.ts`. */
13311
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13312
+ * accessory's status field (`kind` optional/absent for wire compat); a
13313
+ * LITERAL source carries a per-device constant (no sibling is read); a
13314
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13315
+ * source device's full re-sync-stable `stableId`. */
13316
+ var DeviceLinkFieldSourceSchema = object({
13317
+ kind: literal("field").optional(),
13318
+ sourceKey: string(),
13319
+ cap: string(),
13320
+ fieldPath: string()
13321
+ });
13322
+ var DeviceLinkLiteralSourceSchema = object({
13323
+ kind: literal("literal"),
13324
+ value: union([
13325
+ string(),
13326
+ number(),
13327
+ boolean(),
13328
+ _null()
13329
+ ])
13330
+ });
13331
+ var DeviceLinkGlobalSourceSchema = object({
13332
+ kind: literal("global"),
13333
+ sourceStableId: string(),
13334
+ cap: string(),
13335
+ fieldPath: string()
13336
+ });
13337
+ /** Expression source (Stage X): compute the target field from N named bindings
13338
+ * via the safe expression engine. Bindings are field | literal | global — never
13339
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13340
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13341
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13342
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13343
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13344
+ var DeviceLinkExpressionSourceSchema = object({
13345
+ kind: literal("expression"),
13346
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13347
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13348
+ DeviceLinkFieldSourceSchema,
13349
+ DeviceLinkLiteralSourceSchema,
13350
+ DeviceLinkGlobalSourceSchema
13351
+ ]))
13352
+ }).superRefine((src, ctx) => {
13353
+ const err = validateExpressionSource(src);
13354
+ if (err !== null) ctx.addIssue({
13355
+ code: "custom",
13356
+ message: err,
13357
+ path: ["expr"]
13358
+ });
13359
+ });
12398
13360
  var DeviceLinkSchema = object({
12399
13361
  id: string(),
12400
- source: object({
12401
- sourceKey: string(),
12402
- cap: string(),
12403
- fieldPath: string()
12404
- }),
13362
+ source: union([
13363
+ DeviceLinkFieldSourceSchema,
13364
+ DeviceLinkLiteralSourceSchema,
13365
+ DeviceLinkGlobalSourceSchema,
13366
+ DeviceLinkExpressionSourceSchema
13367
+ ]),
12405
13368
  target: object({
12406
13369
  cap: string(),
12407
13370
  fieldPath: string(),
@@ -12430,6 +13393,31 @@ var DeviceLinkSchema = object({
12430
13393
  })
12431
13394
  ]).optional()
12432
13395
  });
13396
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13397
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13398
+ var DeviceCapDisplayOverrideSchema = object({
13399
+ unit: string().min(1).optional(),
13400
+ precision: number().int().min(0).max(10).optional()
13401
+ });
13402
+ /** Cap-wire shape of an operator-authored per-device display override —
13403
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13404
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13405
+ var DeviceDisplayOverrideSchema = object({
13406
+ icon: string().min(1).optional(),
13407
+ label: string().min(1).optional(),
13408
+ unit: string().min(1).optional(),
13409
+ precision: number().int().min(0).max(10).optional(),
13410
+ hidden: boolean().optional(),
13411
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13412
+ });
13413
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13414
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13415
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13416
+ var RoleDisplayDefaultSchema = object({
13417
+ unit: string().min(1).optional(),
13418
+ precision: number().int().min(0).max(10).optional(),
13419
+ icon: string().min(1).optional()
13420
+ });
12433
13421
  /**
12434
13422
  * Serializable projection of a live IDevice.
12435
13423
  * Returned by listAll, getDevice, getChildren.
@@ -12485,7 +13473,9 @@ var DeviceInfoSchema = object({
12485
13473
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12486
13474
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12487
13475
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12488
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13476
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13477
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13478
+ display: DeviceDisplayOverrideSchema.optional()
12489
13479
  });
12490
13480
  var ConfigEntrySchema = object({
12491
13481
  key: string(),
@@ -12550,7 +13540,9 @@ var DeviceMetaSchema = object({
12550
13540
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12551
13541
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12552
13542
  * Optional: only present for accessory children that carry a known role. */
12553
- role: string().nullable().optional()
13543
+ role: string().nullable().optional(),
13544
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13545
+ display: DeviceDisplayOverrideSchema.optional()
12554
13546
  });
12555
13547
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12556
13548
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12644,7 +13636,19 @@ method(object({
12644
13636
  }), _void(), {
12645
13637
  kind: "mutation",
12646
13638
  auth: "admin"
12647
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13639
+ }), method(object({
13640
+ deviceId: number(),
13641
+ display: DeviceDisplayOverrideSchema.nullable()
13642
+ }), _void(), {
13643
+ kind: "mutation",
13644
+ auth: "admin"
13645
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13646
+ kind: "mutation",
13647
+ auth: "admin"
13648
+ }), method(object({
13649
+ deviceId: number(),
13650
+ includeSynthesizable: boolean().optional()
13651
+ }), object({ caps: array(object({
12648
13652
  cap: string(),
12649
13653
  fields: array(object({
12650
13654
  path: string(),
@@ -12654,8 +13658,13 @@ method(object({
12654
13658
  "boolean",
12655
13659
  "enum"
12656
13660
  ]),
12657
- enumValues: array(string()).optional()
12658
- })).readonly()
13661
+ enumValues: array(string()).optional(),
13662
+ item: boolean().optional()
13663
+ })).readonly(),
13664
+ itemArray: object({
13665
+ path: string(),
13666
+ keyField: string()
13667
+ }).optional()
12659
13668
  })).readonly() }), { kind: "query" }), method(object({
12660
13669
  deviceId: number(),
12661
13670
  role: string().nullable()
@@ -12725,7 +13734,11 @@ method(object({
12725
13734
  deviceId: number(),
12726
13735
  entries: array(object({
12727
13736
  capName: string(),
12728
- kind: _enum(["native", "wrapped"]),
13737
+ kind: _enum([
13738
+ "native",
13739
+ "wrapped",
13740
+ "linked"
13741
+ ]),
12729
13742
  providerAddonId: string(),
12730
13743
  providerNodeId: string(),
12731
13744
  nativeAddonId: string()
@@ -12734,7 +13747,11 @@ method(object({
12734
13747
  deviceId: number(),
12735
13748
  entries: array(object({
12736
13749
  capName: string(),
12737
- kind: _enum(["native", "wrapped"]),
13750
+ kind: _enum([
13751
+ "native",
13752
+ "wrapped",
13753
+ "linked"
13754
+ ]),
12738
13755
  providerAddonId: string(),
12739
13756
  providerNodeId: string(),
12740
13757
  nativeAddonId: string()
@@ -13224,7 +14241,7 @@ var AddBrokerInputSchema = object({
13224
14241
  });
13225
14242
  var AddBrokerResultSchema = object({ id: string() });
13226
14243
  var IdInputSchema = object({ id: string() });
13227
- var TestResultSchema = discriminatedUnion("ok", [object({
14244
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13228
14245
  ok: literal(true),
13229
14246
  latencyMs: number()
13230
14247
  }), object({
@@ -13247,7 +14264,7 @@ var StatusSchema = object({
13247
14264
  brokerCount: number(),
13248
14265
  embeddedRunning: boolean()
13249
14266
  });
13250
- method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
14267
+ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
13251
14268
  var NetworkEndpointSchema = object({
13252
14269
  url: string(),
13253
14270
  hostname: string(),
@@ -13281,23 +14298,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13281
14298
  sourcePort: number().optional()
13282
14299
  });
13283
14300
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13284
- method(object({
13285
- title: string(),
14301
+ /**
14302
+ * notification-output — canonical, capability-gated notification delivery.
14303
+ *
14304
+ * Apprise-derived model (see
14305
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14306
+ * callers emit ONE canonical `Notification`; each provider declares a
14307
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14308
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14309
+ * message to what the kind supports — callers never special-case a service.
14310
+ *
14311
+ * DESIGN DECISIONS (locked):
14312
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14313
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14314
+ * cap. Rationale: the admin UI needs one uniform surface across the
14315
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14316
+ * alternative would fork the UI per addon and cannot host the
14317
+ * discovery→adopt flow.
14318
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14319
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14320
+ * registered provider (notifiers addon + HA addon) so one catalog is
14321
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14322
+ * `addonId` the generated collection router extracts from the call input.
14323
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14324
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14325
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14326
+ * base64 fallback needed.
14327
+ *
14328
+ * TODO (deferred, closed-set change — separate decision): add
14329
+ * `providerKind: 'notify'` so notification providers surface on the unified
14330
+ * admin "Integrations" page.
14331
+ */
14332
+ /**
14333
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14334
+ * adapter picks what it supports and the degrade engine filters the rest.
14335
+ */
14336
+ var AttachmentMediaTypeSchema = _enum([
14337
+ "image",
14338
+ "video",
14339
+ "gif",
14340
+ "audio",
14341
+ "icon"
14342
+ ]);
14343
+ /**
14344
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14345
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14346
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14347
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14348
+ */
14349
+ var AttachmentSchema = object({
14350
+ mediaType: AttachmentMediaTypeSchema,
14351
+ url: string().optional(),
14352
+ bytes: _instanceof(Uint8Array).optional(),
14353
+ mime: string().optional(),
14354
+ name: string().optional()
14355
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14356
+ var NotificationFormatSchema = _enum([
14357
+ "text",
14358
+ "markdown",
14359
+ "html"
14360
+ ]);
14361
+ /** A single tap-through action button. */
14362
+ var NotificationActionSchema = object({
14363
+ id: string(),
14364
+ label: string(),
14365
+ url: string().optional()
14366
+ });
14367
+ /**
14368
+ * The canonical notification. `body` is the only hard field (Apprise model).
14369
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14370
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14371
+ * the adapter maps this ordinal onto its native level. `level?` is an
14372
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14373
+ * `priority` for that one target.
14374
+ */
14375
+ var NotificationSchema = object({
13286
14376
  body: string(),
13287
- imageUrl: string().optional(),
14377
+ title: string().optional(),
14378
+ format: NotificationFormatSchema.default("text"),
14379
+ priority: number().int().min(1).max(5).default(3),
14380
+ level: string().optional(),
14381
+ attachments: array(AttachmentSchema).optional(),
14382
+ clickUrl: string().optional(),
14383
+ actions: array(NotificationActionSchema).optional(),
14384
+ sound: string().optional(),
14385
+ ttl: number().optional(),
14386
+ tag: string().optional(),
13288
14387
  deviceId: number().optional(),
13289
14388
  eventId: string().optional(),
13290
- priority: _enum([
13291
- "low",
13292
- "normal",
13293
- "high",
13294
- "critical"
13295
- ]).default("normal"),
13296
14389
  metadata: record(string(), unknown()).optional()
13297
- }), _void(), { kind: "mutation" }), method(_void(), object({
14390
+ });
14391
+ /** One declared native severity/priority level for a kind. */
14392
+ var TargetKindLevelSchema = object({
14393
+ id: string(),
14394
+ label: string(),
14395
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14396
+ ordinal: number().int().min(1).max(5).nullable(),
14397
+ flags: object({
14398
+ critical: boolean().optional(),
14399
+ silent: boolean().optional(),
14400
+ noPush: boolean().optional()
14401
+ }).optional(),
14402
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14403
+ requires: array(string()).optional(),
14404
+ description: string().optional()
14405
+ });
14406
+ /** The full capability block consulted before dispatch. */
14407
+ var TargetKindCapsSchema = object({
14408
+ attachments: object({
14409
+ mediaTypes: array(AttachmentMediaTypeSchema),
14410
+ mode: _enum([
14411
+ "url",
14412
+ "bytes",
14413
+ "both"
14414
+ ]),
14415
+ max: number().int().nonnegative(),
14416
+ maxBytes: number().int().positive().optional()
14417
+ }),
14418
+ /** Max action buttons (0 = none). */
14419
+ actions: number().int().nonnegative(),
14420
+ levels: array(TargetKindLevelSchema),
14421
+ format: array(NotificationFormatSchema),
14422
+ clickUrl: boolean(),
14423
+ sound: boolean(),
14424
+ ttl: boolean(),
14425
+ bodyMaxLen: number().int().positive()
14426
+ });
14427
+ /**
14428
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14429
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14430
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14431
+ * the union is large and not meant for runtime validation here; the exported
14432
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14433
+ */
14434
+ var ConfigSchemaPassthrough = unknown();
14435
+ var TargetKindSchema = object({
14436
+ kind: string(),
14437
+ label: string(),
14438
+ icon: string(),
14439
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14440
+ addonId: string(),
14441
+ configSchema: ConfigSchemaPassthrough,
14442
+ supportsDiscovery: boolean(),
14443
+ caps: TargetKindCapsSchema
14444
+ });
14445
+ /**
14446
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14447
+ * (return a presence marker only) when serving `listTargets` — never
14448
+ * round-trip a stored secret to the UI.
14449
+ */
14450
+ var TargetSchema = object({
14451
+ id: string(),
14452
+ name: string(),
14453
+ kind: string(),
14454
+ addonId: string(),
14455
+ enabled: boolean(),
14456
+ config: record(string(), unknown())
14457
+ });
14458
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14459
+ var DiscoveredTargetSchema = object({
14460
+ kind: string(),
14461
+ suggestedName: string(),
14462
+ config: record(string(), unknown())
14463
+ });
14464
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14465
+ var RenderedAsSchema = object({
14466
+ level: string(),
14467
+ format: NotificationFormatSchema,
14468
+ attachmentsSent: number().int().nonnegative(),
14469
+ actionsSent: number().int().nonnegative(),
14470
+ truncated: boolean(),
14471
+ dropped: array(string())
14472
+ });
14473
+ var SendResultSchema = object({
13298
14474
  success: boolean(),
13299
- error: string().optional()
13300
- }), { kind: "mutation" });
14475
+ error: string().optional(),
14476
+ renderedAs: RenderedAsSchema.optional()
14477
+ });
14478
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14479
+ var TestResultSchema = SendResultSchema;
14480
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14481
+ kind: string(),
14482
+ config: record(string(), unknown()).optional()
14483
+ }), array(DiscoveredTargetSchema)), method(object({
14484
+ targetId: string(),
14485
+ notification: NotificationSchema
14486
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14487
+ targetId: string(),
14488
+ sample: NotificationSchema.optional()
14489
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14490
+ targetId: string(),
14491
+ enabled: boolean()
14492
+ }), _void(), { kind: "mutation" });
13301
14493
  /**
13302
14494
  * Zod schemas for persisted record types.
13303
14495
  *
@@ -16332,7 +17524,10 @@ var HwAccelBackendInputSchema = _enum([
16332
17524
  "webgpu",
16333
17525
  "none"
16334
17526
  ]).nullable().optional();
16335
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17527
+ var HwAccelResolutionSchema = object({
17528
+ preferred: array(string()).readonly(),
17529
+ rationale: string()
17530
+ });
16336
17531
  var HardwareEncoderIdSchema = _enum([
16337
17532
  "h264_videotoolbox",
16338
17533
  "hevc_videotoolbox",
@@ -16437,10 +17632,7 @@ var ResolvedInferenceConfigSchema = object({
16437
17632
  format: ModelFormatSchema,
16438
17633
  reason: string()
16439
17634
  });
16440
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16441
- prefer: HwAccelBackendInputSchema,
16442
- nodeId: string().optional()
16443
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
17635
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16444
17636
  kind: "mutation",
16445
17637
  auth: "admin"
16446
17638
  }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
@@ -16499,6 +17691,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16499
17691
  kind: "mutation",
16500
17692
  auth: "admin"
16501
17693
  });
17694
+ /**
17695
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17696
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17697
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17698
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17699
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17700
+ * annotations that are not exposed here and must not be treated as an event
17701
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17702
+ * (`interfaces/recording-config.ts`).
17703
+ */
16502
17704
  var RecordingStatusSchema = object({
16503
17705
  deviceId: number(),
16504
17706
  enabled: boolean(),
@@ -18135,6 +19337,12 @@ Object.freeze({
18135
19337
  addonId: null,
18136
19338
  access: "view"
18137
19339
  },
19340
+ "deviceManager.getRoleDisplayDefaults": {
19341
+ capName: "device-manager",
19342
+ capScope: "system",
19343
+ addonId: null,
19344
+ access: "view"
19345
+ },
18138
19346
  "deviceManager.getSettingsSchema": {
18139
19347
  capName: "device-manager",
18140
19348
  capScope: "system",
@@ -18285,6 +19493,12 @@ Object.freeze({
18285
19493
  addonId: null,
18286
19494
  access: "create"
18287
19495
  },
19496
+ "deviceManager.setDisplay": {
19497
+ capName: "device-manager",
19498
+ capScope: "system",
19499
+ addonId: null,
19500
+ access: "create"
19501
+ },
18288
19502
  "deviceManager.setIntegrationId": {
18289
19503
  capName: "device-manager",
18290
19504
  capScope: "system",
@@ -18327,6 +19541,12 @@ Object.freeze({
18327
19541
  addonId: null,
18328
19542
  access: "create"
18329
19543
  },
19544
+ "deviceManager.setRoleDisplayDefaults": {
19545
+ capName: "device-manager",
19546
+ capScope: "system",
19547
+ addonId: null,
19548
+ access: "create"
19549
+ },
18330
19550
  "deviceManager.setStreamProfileMap": {
18331
19551
  capName: "device-manager",
18332
19552
  capScope: "system",
@@ -19305,13 +20525,49 @@ Object.freeze({
19305
20525
  addonId: null,
19306
20526
  access: "create"
19307
20527
  },
20528
+ "notificationOutput.deleteTarget": {
20529
+ capName: "notification-output",
20530
+ capScope: "system",
20531
+ addonId: null,
20532
+ access: "delete"
20533
+ },
20534
+ "notificationOutput.discoverTargets": {
20535
+ capName: "notification-output",
20536
+ capScope: "system",
20537
+ addonId: null,
20538
+ access: "view"
20539
+ },
20540
+ "notificationOutput.listTargetKinds": {
20541
+ capName: "notification-output",
20542
+ capScope: "system",
20543
+ addonId: null,
20544
+ access: "view"
20545
+ },
20546
+ "notificationOutput.listTargets": {
20547
+ capName: "notification-output",
20548
+ capScope: "system",
20549
+ addonId: null,
20550
+ access: "view"
20551
+ },
19308
20552
  "notificationOutput.send": {
19309
20553
  capName: "notification-output",
19310
20554
  capScope: "system",
19311
20555
  addonId: null,
19312
20556
  access: "create"
19313
20557
  },
19314
- "notificationOutput.sendTest": {
20558
+ "notificationOutput.setTargetEnabled": {
20559
+ capName: "notification-output",
20560
+ capScope: "system",
20561
+ addonId: null,
20562
+ access: "create"
20563
+ },
20564
+ "notificationOutput.testTarget": {
20565
+ capName: "notification-output",
20566
+ capScope: "system",
20567
+ addonId: null,
20568
+ access: "create"
20569
+ },
20570
+ "notificationOutput.upsertTarget": {
19315
20571
  capName: "notification-output",
19316
20572
  capScope: "system",
19317
20573
  addonId: null,
@@ -19341,6 +20597,66 @@ Object.freeze({
19341
20597
  addonId: null,
19342
20598
  access: "create"
19343
20599
  },
20600
+ "petFeeder.callPet": {
20601
+ capName: "pet-feeder",
20602
+ capScope: "device",
20603
+ addonId: null,
20604
+ access: "create"
20605
+ },
20606
+ "petFeeder.cancelFeed": {
20607
+ capName: "pet-feeder",
20608
+ capScope: "device",
20609
+ addonId: null,
20610
+ access: "create"
20611
+ },
20612
+ "petFeeder.feed": {
20613
+ capName: "pet-feeder",
20614
+ capScope: "device",
20615
+ addonId: null,
20616
+ access: "create"
20617
+ },
20618
+ "petFeeder.markFoodReplenished": {
20619
+ capName: "pet-feeder",
20620
+ capScope: "device",
20621
+ addonId: null,
20622
+ access: "create"
20623
+ },
20624
+ "petFeeder.playSound": {
20625
+ capName: "pet-feeder",
20626
+ capScope: "device",
20627
+ addonId: null,
20628
+ access: "create"
20629
+ },
20630
+ "petFeeder.resetDesiccant": {
20631
+ capName: "pet-feeder",
20632
+ capScope: "device",
20633
+ addonId: null,
20634
+ access: "delete"
20635
+ },
20636
+ "petFeeder.setChildLock": {
20637
+ capName: "pet-feeder",
20638
+ capScope: "device",
20639
+ addonId: null,
20640
+ access: "create"
20641
+ },
20642
+ "petFeeder.setFeedSound": {
20643
+ capName: "pet-feeder",
20644
+ capScope: "device",
20645
+ addonId: null,
20646
+ access: "create"
20647
+ },
20648
+ "petFeeder.setIndicatorLight": {
20649
+ capName: "pet-feeder",
20650
+ capScope: "device",
20651
+ addonId: null,
20652
+ access: "create"
20653
+ },
20654
+ "petFeeder.setVolume": {
20655
+ capName: "pet-feeder",
20656
+ capScope: "device",
20657
+ addonId: null,
20658
+ access: "create"
20659
+ },
19344
20660
  "pipelineAnalytics.clearTracks": {
19345
20661
  capName: "pipeline-analytics",
19346
20662
  capScope: "device",