@camstack/addon-post-analysis 1.1.13 → 1.1.15

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.
@@ -4649,7 +4649,7 @@ function _instanceof(cls, params = {}) {
4649
4649
  return inst;
4650
4650
  }
4651
4651
  //#endregion
4652
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4652
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4653
4653
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4654
4654
  EventCategory["SystemBoot"] = "system.boot";
4655
4655
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5462,6 +5462,100 @@ function createDurableState(deps) {
5462
5462
  };
5463
5463
  }
5464
5464
  /**
5465
+ * Per-node scoping for the shared addon-settings blob.
5466
+ *
5467
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5468
+ * hub-routed — the hub instance answers for every node), so fields whose
5469
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5470
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5471
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5472
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5473
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5474
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5475
+ *
5476
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5477
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5478
+ * schema and routes reads/writes through these helpers.
5479
+ *
5480
+ * ## No bare-key fallback — deliberate
5481
+ *
5482
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5483
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5484
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5485
+ * the store is invisible to every node, hub included, so one node's
5486
+ * selection can never leak onto another. (This generalizes the
5487
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5488
+ * arbitrary set of per-node field keys.)
5489
+ *
5490
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5491
+ * LEAF module: import it via its deep path, never from the root barrel.
5492
+ */
5493
+ /**
5494
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5495
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5496
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5497
+ * `undefined` / `null` / empty falls back to `'hub'`.
5498
+ */
5499
+ function normalizeNodeId(raw) {
5500
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5501
+ const slashIdx = raw.indexOf("/");
5502
+ if (slashIdx < 0) return raw;
5503
+ const bare = raw.slice(0, slashIdx);
5504
+ return bare === "" ? "hub" : bare;
5505
+ }
5506
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5507
+ function nodeScopedKey(base, nodeId) {
5508
+ return `${base}@${normalizeNodeId(nodeId)}`;
5509
+ }
5510
+ /**
5511
+ * Read a node's value for a per-node field from the raw shared store:
5512
+ * the node-scoped key when present, otherwise `undefined`.
5513
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5514
+ * schema `default` win on `undefined`.
5515
+ */
5516
+ function readNodeValue(store, base, nodeId) {
5517
+ return store[nodeScopedKey(base, nodeId)];
5518
+ }
5519
+ /**
5520
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5521
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5522
+ * the write path so a save for one node never clobbers another node's value
5523
+ * (and the bare key is never written). Returns a new object — the input
5524
+ * patch is not mutated.
5525
+ */
5526
+ function scopePatch(patch, perNodeKeys, nodeId) {
5527
+ const out = {};
5528
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5529
+ return out;
5530
+ }
5531
+ /**
5532
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5533
+ * UI schema (whose field keys are bare) hydrates from that node's own
5534
+ * values:
5535
+ *
5536
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5537
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5538
+ * legacy key must never hydrate any node — no bare fallback).
5539
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5540
+ * each bare perNode key; when the node has no scoped key the bare key is
5541
+ * left ABSENT so the field's schema `default` wins.
5542
+ *
5543
+ * Returns a new object — the input store is not mutated.
5544
+ */
5545
+ function projectStore(store, perNodeKeys, nodeId) {
5546
+ const out = {};
5547
+ for (const [key, value] of Object.entries(store)) {
5548
+ if (key.includes("@")) continue;
5549
+ if (perNodeKeys.has(key)) continue;
5550
+ out[key] = value;
5551
+ }
5552
+ for (const base of perNodeKeys) {
5553
+ const value = readNodeValue(store, base, nodeId);
5554
+ if (value !== void 0) out[base] = value;
5555
+ }
5556
+ return out;
5557
+ }
5558
+ /**
5465
5559
  * Base class for CamStack addons. Eliminates settings boilerplate:
5466
5560
  *
5467
5561
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5629,23 +5723,63 @@ var BaseAddon = class {
5629
5723
  deviceSettingsSchema() {
5630
5724
  return null;
5631
5725
  }
5632
- async getGlobalSettings(overlay, cap, _nodeId) {
5726
+ async getGlobalSettings(overlay, cap, nodeId) {
5633
5727
  const schema = this.globalSettingsSchema(cap);
5634
5728
  if (!schema) return { sections: [] };
5635
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5729
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5636
5730
  return hydrateSchema(schema, overlay ? {
5637
- ...raw,
5731
+ ...projected,
5638
5732
  ...overlay
5639
- } : raw);
5733
+ } : projected);
5640
5734
  }
5641
- async updateGlobalSettings(patch, _nodeId) {
5642
- await this._ctx?.settings?.writeAddonStore(patch);
5735
+ /**
5736
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5737
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5738
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5739
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5740
+ * A no-op passthrough when the schema declares no `perNode` field.
5741
+ *
5742
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5743
+ * the store for custom option logic (option narrowing, value snapping) to
5744
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5745
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5746
+ */
5747
+ async resolveGlobalStore(nodeId, cap) {
5748
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5749
+ const keys = this.perNodeKeys(cap);
5750
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5751
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5752
+ }
5753
+ async updateGlobalSettings(patch, nodeId) {
5754
+ const keys = this.perNodeKeys();
5755
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5756
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5757
+ const barePatch = patch;
5758
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5759
+ await this._ctx?.settings?.writeAddonStore(scoped);
5760
+ if (target !== localNode) return;
5643
5761
  await this.resolveConfig();
5644
5762
  await this.onConfigChanged();
5645
5763
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5646
5764
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5647
5765
  }
5648
5766
  /**
5767
+ * The set of field keys the global settings schema declares `perNode: true`
5768
+ * — derived once per `cap` argument and memoized (schemas are static
5769
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5770
+ * settings API behaves exactly like the legacy node-agnostic one.
5771
+ */
5772
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5773
+ perNodeKeys(cap) {
5774
+ const cacheKey = cap ?? "";
5775
+ const cached = this._perNodeKeysCache.get(cacheKey);
5776
+ if (cached) return cached;
5777
+ const schema = this.globalSettingsSchema(cap);
5778
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5779
+ this._perNodeKeysCache.set(cacheKey, keys);
5780
+ return keys;
5781
+ }
5782
+ /**
5649
5783
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5650
5784
  * schedule an addon restart for the next tick. Deferred via
5651
5785
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5798,12 +5932,19 @@ var BaseAddon = class {
5798
5932
  * The merge is shallow: each key in `defaults` is checked against the store.
5799
5933
  * Only keys present in defaults are read — the store can contain extra keys
5800
5934
  * (e.g. from older versions) without polluting the typed config.
5935
+ *
5936
+ * Keys the global settings schema declares `perNode: true` resolve from
5937
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5938
+ * from the bare key — so a per-node field resolves to this node's own
5939
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5801
5940
  */
5802
5941
  async resolveConfig() {
5803
5942
  const stored = await this.readAddonStoreWithRetry();
5943
+ const perNode = this.perNodeKeys();
5944
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5804
5945
  const resolved = { ...this.defaults };
5805
5946
  for (const key of Object.keys(this.defaults)) {
5806
- const storedValue = stored[key];
5947
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5807
5948
  if (storedValue !== void 0 && storedValue !== null) {
5808
5949
  const defaultType = typeof this.defaults[key];
5809
5950
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5887,6 +6028,27 @@ var BaseAddon = class {
5887
6028
  }
5888
6029
  };
5889
6030
  /**
6031
+ * Collect the keys of every field marked `perNode: true`, recursing into
6032
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6033
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6034
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6035
+ */
6036
+ function collectPerNodeFieldKeys(fields) {
6037
+ const collected = [];
6038
+ for (const field of fields) {
6039
+ if (field.type === "group") {
6040
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6041
+ continue;
6042
+ }
6043
+ if (field.type === "sub-tabs") {
6044
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6045
+ continue;
6046
+ }
6047
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6048
+ }
6049
+ return collected;
6050
+ }
6051
+ /**
5890
6052
  * Normalize an `ICamstackAddon.initialize()` return value into the
5891
6053
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5892
6054
  * envelopes pass through; void stays void.
@@ -5911,6 +6073,7 @@ var CamStreamKindSchema = _enum([
5911
6073
  "pull-rtsp",
5912
6074
  "pull-rtmp",
5913
6075
  "pull-http",
6076
+ "pull-flv",
5914
6077
  "pull-rfc4571",
5915
6078
  "push-annexb",
5916
6079
  "derived"
@@ -6298,6 +6461,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6298
6461
  /** Single still-image entity (HA `image.*`). Read-only display of an
6299
6462
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6300
6463
  DeviceType["Image"] = "image";
6464
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6465
+ * level, battery, desiccant life, feeding state and manual-feed /
6466
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6467
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6468
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6469
+ * integrations sharing the same food/desiccant/hopper surface. */
6470
+ DeviceType["PetFeeder"] = "pet-feeder";
6301
6471
  return DeviceType;
6302
6472
  }({});
6303
6473
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -6832,6 +7002,25 @@ var ConvertResultSchema = object({
6832
7002
  })).readonly()
6833
7003
  });
6834
7004
  /**
7005
+ * THE canonical event-clip pad: the time window a single-timestamp analytics
7006
+ * event expands to when joined with footage (clip window = `[timestamp - preMs,
7007
+ * timestamp + postMs]`). Matches the admin-ui clip window (−5s/+10s).
7008
+ *
7009
+ * Every consumer derives from this ONE constant so event↔footage boundaries
7010
+ * agree everywhere (C1):
7011
+ * - the `videoclips` default provider (addon-post-analysis) pads its clip
7012
+ * windows with it;
7013
+ * - the recorder's ephemeral in-RAM `EventMap` markers (addon-pipeline) pad
7014
+ * their `startMs/endMs` with it.
7015
+ *
7016
+ * NOTE: this is a UI/JOIN convention, NOT the `events`-band keep/discard gate —
7017
+ * that uses the per-device `preBufferSec`/`postBufferSec` config.
7018
+ */
7019
+ var EVENT_PAD_MS = {
7020
+ preMs: 5e3,
7021
+ postMs: 1e4
7022
+ };
7023
+ /**
6835
7024
  * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6836
7025
  * Named `RecordingWeekday` to avoid collision with the string-union
6837
7026
  * `Weekday` exported from `interfaces/timezones.ts`.
@@ -7475,6 +7664,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7475
7664
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7476
7665
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7477
7666
  /**
7667
+ * Error types for the safe expression engine. Two distinct classes so callers
7668
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7669
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7670
+ */
7671
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7672
+ * the failure is anchored to a character (author-facing inline feedback). */
7673
+ var ExpressionParseError = class extends Error {
7674
+ position;
7675
+ constructor(message, position) {
7676
+ super(message);
7677
+ this.name = "ExpressionParseError";
7678
+ this.position = position;
7679
+ }
7680
+ };
7681
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7682
+ * result, unknown builtin, step-budget exceeded). */
7683
+ var ExpressionEvalError = class extends Error {
7684
+ constructor(message) {
7685
+ super(message);
7686
+ this.name = "ExpressionEvalError";
7687
+ }
7688
+ };
7689
+ /**
7690
+ * Resource-bound constants for the safe expression engine.
7691
+ *
7692
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7693
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7694
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7695
+ * work a single author-supplied expression can request, so a hostile or
7696
+ * accidental pathological string can never spend unbounded CPU/memory.
7697
+ */
7698
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7699
+ * rejected without allocation. */
7700
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7701
+ /** A legal binding / identifier name. */
7702
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7703
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7704
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7705
+ var RESERVED_BINDING_NAMES = new Set([
7706
+ "now",
7707
+ "true",
7708
+ "false",
7709
+ "null"
7710
+ ]);
7711
+ /**
7712
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7713
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7714
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7715
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7716
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7717
+ * is a parse error with a source position, so member access / assignment /
7718
+ * template literals are lexically impossible.
7719
+ */
7720
+ var KEYWORDS = new Set([
7721
+ "true",
7722
+ "false",
7723
+ "null"
7724
+ ]);
7725
+ function isDigit(ch) {
7726
+ return ch >= "0" && ch <= "9";
7727
+ }
7728
+ function isIdentStart(ch) {
7729
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7730
+ }
7731
+ function isIdentPart(ch) {
7732
+ return isIdentStart(ch) || isDigit(ch);
7733
+ }
7734
+ function isWhitespace(ch) {
7735
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7736
+ }
7737
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7738
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7739
+ * string. */
7740
+ function tokenize(source) {
7741
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7742
+ const tokens = [];
7743
+ let i = 0;
7744
+ const n = source.length;
7745
+ while (i < n) {
7746
+ const ch = source[i];
7747
+ if (isWhitespace(ch)) {
7748
+ i += 1;
7749
+ continue;
7750
+ }
7751
+ if (isDigit(ch)) {
7752
+ const start = i;
7753
+ while (i < n && isDigit(source[i])) i += 1;
7754
+ if (i < n && source[i] === ".") {
7755
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7756
+ i += 1;
7757
+ while (i < n && isDigit(source[i])) i += 1;
7758
+ }
7759
+ const text = source.slice(start, i);
7760
+ const value = Number(text);
7761
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7762
+ tokens.push({
7763
+ type: "number",
7764
+ value,
7765
+ pos: start
7766
+ });
7767
+ continue;
7768
+ }
7769
+ if (ch === "'" || ch === "\"") {
7770
+ const quote = ch;
7771
+ const start = i;
7772
+ i += 1;
7773
+ let out = "";
7774
+ let closed = false;
7775
+ while (i < n) {
7776
+ const c = source[i];
7777
+ if (c === "\\") {
7778
+ const next = i + 1 < n ? source[i + 1] : "";
7779
+ if (next === "\\" || next === "'" || next === "\"") {
7780
+ out += next;
7781
+ i += 2;
7782
+ continue;
7783
+ }
7784
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7785
+ }
7786
+ if (c === quote) {
7787
+ closed = true;
7788
+ i += 1;
7789
+ break;
7790
+ }
7791
+ out += c;
7792
+ i += 1;
7793
+ }
7794
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7795
+ tokens.push({
7796
+ type: "string",
7797
+ value: out,
7798
+ pos: start
7799
+ });
7800
+ continue;
7801
+ }
7802
+ if (isIdentStart(ch)) {
7803
+ const start = i;
7804
+ while (i < n && isIdentPart(source[i])) i += 1;
7805
+ const text = source.slice(start, i);
7806
+ if (KEYWORDS.has(text)) tokens.push({
7807
+ type: "keyword",
7808
+ keyword: keywordOf(text),
7809
+ pos: start
7810
+ });
7811
+ else tokens.push({
7812
+ type: "identifier",
7813
+ name: text,
7814
+ pos: start
7815
+ });
7816
+ continue;
7817
+ }
7818
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7819
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7820
+ tokens.push({
7821
+ type: "punct",
7822
+ punct: two,
7823
+ pos: i
7824
+ });
7825
+ i += 2;
7826
+ continue;
7827
+ }
7828
+ if (isSinglePunct(ch)) {
7829
+ tokens.push({
7830
+ type: "punct",
7831
+ punct: ch,
7832
+ pos: i
7833
+ });
7834
+ i += 1;
7835
+ continue;
7836
+ }
7837
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7838
+ }
7839
+ tokens.push({
7840
+ type: "eof",
7841
+ pos: n
7842
+ });
7843
+ return tokens;
7844
+ }
7845
+ function keywordOf(text) {
7846
+ if (text === "true") return "true";
7847
+ if (text === "false") return "false";
7848
+ return "null";
7849
+ }
7850
+ function isSinglePunct(ch) {
7851
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7852
+ }
7853
+ /**
7854
+ * Frozen, null-prototype builtin function table for the expression engine
7855
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7856
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7857
+ * own-property check against it.
7858
+ *
7859
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7860
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7861
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7862
+ * (there is no `Object.prototype` in the chain), so those names are not
7863
+ * callable — they are simply "unknown function" at parse time.
7864
+ *
7865
+ * Every numeric argument is validated as a finite number and every numeric
7866
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7867
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7868
+ * closed rather than emitting a garbage value.
7869
+ */
7870
+ function asFiniteNumber(value, name, index) {
7871
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7872
+ return value;
7873
+ }
7874
+ function asString$1(value, name, index) {
7875
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7876
+ return value;
7877
+ }
7878
+ function finiteResult(value, name) {
7879
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7880
+ return value;
7881
+ }
7882
+ function allFiniteNumbers(args, name) {
7883
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7884
+ }
7885
+ var INF = Number.POSITIVE_INFINITY;
7886
+ var table = {
7887
+ min: {
7888
+ minArgs: 1,
7889
+ maxArgs: INF,
7890
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7891
+ },
7892
+ max: {
7893
+ minArgs: 1,
7894
+ maxArgs: INF,
7895
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7896
+ },
7897
+ abs: {
7898
+ minArgs: 1,
7899
+ maxArgs: 1,
7900
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7901
+ },
7902
+ floor: {
7903
+ minArgs: 1,
7904
+ maxArgs: 1,
7905
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7906
+ },
7907
+ ceil: {
7908
+ minArgs: 1,
7909
+ maxArgs: 1,
7910
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7911
+ },
7912
+ sqrt: {
7913
+ minArgs: 1,
7914
+ maxArgs: 1,
7915
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7916
+ },
7917
+ round: {
7918
+ minArgs: 1,
7919
+ maxArgs: 2,
7920
+ apply: (args) => {
7921
+ const x = asFiniteNumber(args[0], "round", 0);
7922
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7923
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7924
+ const factor = 10 ** digits;
7925
+ return finiteResult(Math.round(x * factor) / factor, "round");
7926
+ }
7927
+ },
7928
+ pow: {
7929
+ minArgs: 2,
7930
+ maxArgs: 2,
7931
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7932
+ },
7933
+ clamp: {
7934
+ minArgs: 3,
7935
+ maxArgs: 3,
7936
+ apply: (args) => {
7937
+ const x = asFiniteNumber(args[0], "clamp", 0);
7938
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7939
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7940
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7941
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7942
+ }
7943
+ },
7944
+ avg: {
7945
+ minArgs: 1,
7946
+ maxArgs: INF,
7947
+ apply: (args) => {
7948
+ const nums = allFiniteNumbers(args, "avg");
7949
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7950
+ }
7951
+ },
7952
+ sum: {
7953
+ minArgs: 1,
7954
+ maxArgs: INF,
7955
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7956
+ },
7957
+ coalesce: {
7958
+ minArgs: 1,
7959
+ maxArgs: INF,
7960
+ apply: (args) => {
7961
+ for (const a of args) if (a !== null) return a;
7962
+ return null;
7963
+ }
7964
+ },
7965
+ age: {
7966
+ minArgs: 2,
7967
+ maxArgs: 2,
7968
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7969
+ },
7970
+ convert: {
7971
+ minArgs: 3,
7972
+ maxArgs: 3,
7973
+ apply: (args, hooks) => {
7974
+ const x = asFiniteNumber(args[0], "convert", 0);
7975
+ const from = asString$1(args[1], "convert", 1).trim();
7976
+ const to = asString$1(args[2], "convert", 2).trim();
7977
+ if (hooks.convert) {
7978
+ const out = hooks.convert(x, from, to);
7979
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7980
+ return finiteResult(out, "convert");
7981
+ }
7982
+ if (from === to) return x;
7983
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7984
+ }
7985
+ }
7986
+ };
7987
+ Object.freeze(Object.assign(Object.create(null), table));
7988
+ /** The set of valid builtin names — used by the parser to reject unknown
7989
+ * callees at parse time (immediate author feedback). */
7990
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7991
+ /**
7992
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7993
+ *
7994
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7995
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7996
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7997
+ * string validated against the builtin table at parse time, so an unknown
7998
+ * function is rejected immediately (author feedback) and a persisted expression
7999
+ * that references a since-removed builtin degrades at read.
8000
+ *
8001
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
8002
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
8003
+ */
8004
+ /** Binary/logical operator precedence (higher binds tighter). */
8005
+ var BINARY_PRECEDENCE = {
8006
+ "||": 1,
8007
+ "&&": 2,
8008
+ "==": 3,
8009
+ "!=": 3,
8010
+ "<": 4,
8011
+ "<=": 4,
8012
+ ">": 4,
8013
+ ">=": 4,
8014
+ "+": 5,
8015
+ "-": 5,
8016
+ "*": 6,
8017
+ "/": 6,
8018
+ "%": 6
8019
+ };
8020
+ function isLogicalOp(op) {
8021
+ return op === "&&" || op === "||";
8022
+ }
8023
+ function isBinaryOp(op) {
8024
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
8025
+ }
8026
+ var Parser = class {
8027
+ tokens;
8028
+ pos = 0;
8029
+ nodeCount = 0;
8030
+ identifiers = /* @__PURE__ */ new Set();
8031
+ callees = /* @__PURE__ */ new Set();
8032
+ constructor(tokens) {
8033
+ this.tokens = tokens;
8034
+ }
8035
+ parse() {
8036
+ const ast = this.parseTernary();
8037
+ const tok = this.peek();
8038
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8039
+ return {
8040
+ ast,
8041
+ identifiers: this.identifiers,
8042
+ callees: this.callees,
8043
+ nodeCount: this.nodeCount
8044
+ };
8045
+ }
8046
+ peek() {
8047
+ return this.tokens[this.pos];
8048
+ }
8049
+ next() {
8050
+ return this.tokens[this.pos++];
8051
+ }
8052
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8053
+ expectPunct(punct) {
8054
+ const tok = this.peek();
8055
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8056
+ this.pos += 1;
8057
+ }
8058
+ matchPunct(punct) {
8059
+ const tok = this.peek();
8060
+ if (tok.type === "punct" && tok.punct === punct) {
8061
+ this.pos += 1;
8062
+ return true;
8063
+ }
8064
+ return false;
8065
+ }
8066
+ countNode() {
8067
+ this.nodeCount += 1;
8068
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8069
+ }
8070
+ parseTernary() {
8071
+ const test = this.parseBinary(1);
8072
+ if (this.matchPunct("?")) {
8073
+ const consequent = this.parseTernary();
8074
+ this.expectPunct(":");
8075
+ const alternate = this.parseTernary();
8076
+ this.countNode();
8077
+ return {
8078
+ kind: "conditional",
8079
+ test,
8080
+ consequent,
8081
+ alternate
8082
+ };
8083
+ }
8084
+ return test;
8085
+ }
8086
+ parseBinary(minPrec) {
8087
+ let left = this.parseUnary();
8088
+ for (;;) {
8089
+ const tok = this.peek();
8090
+ if (tok.type !== "punct") break;
8091
+ const prec = BINARY_PRECEDENCE[tok.punct];
8092
+ if (prec === void 0 || prec < minPrec) break;
8093
+ const op = tok.punct;
8094
+ this.pos += 1;
8095
+ const right = this.parseBinary(prec + 1);
8096
+ this.countNode();
8097
+ if (isLogicalOp(op)) left = {
8098
+ kind: "logical",
8099
+ op,
8100
+ left,
8101
+ right
8102
+ };
8103
+ else if (isBinaryOp(op)) left = {
8104
+ kind: "binary",
8105
+ op,
8106
+ left,
8107
+ right
8108
+ };
8109
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8110
+ }
8111
+ return left;
8112
+ }
8113
+ parseUnary() {
8114
+ const tok = this.peek();
8115
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8116
+ const op = tok.punct;
8117
+ this.pos += 1;
8118
+ const operand = this.parseUnary();
8119
+ this.countNode();
8120
+ return {
8121
+ kind: "unary",
8122
+ op,
8123
+ operand
8124
+ };
8125
+ }
8126
+ return this.parsePrimary();
8127
+ }
8128
+ parsePrimary() {
8129
+ const tok = this.next();
8130
+ switch (tok.type) {
8131
+ case "number":
8132
+ this.countNode();
8133
+ return {
8134
+ kind: "literal",
8135
+ value: tok.value
8136
+ };
8137
+ case "string":
8138
+ this.countNode();
8139
+ return {
8140
+ kind: "literal",
8141
+ value: tok.value
8142
+ };
8143
+ case "keyword":
8144
+ this.countNode();
8145
+ return {
8146
+ kind: "literal",
8147
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8148
+ };
8149
+ case "identifier": {
8150
+ const nextTok = this.peek();
8151
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8152
+ this.identifiers.add(tok.name);
8153
+ this.countNode();
8154
+ return {
8155
+ kind: "identifier",
8156
+ name: tok.name
8157
+ };
8158
+ }
8159
+ case "punct":
8160
+ if (tok.punct === "(") {
8161
+ const inner = this.parseTernary();
8162
+ this.expectPunct(")");
8163
+ return inner;
8164
+ }
8165
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8166
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8167
+ }
8168
+ }
8169
+ parseCall(callee, pos) {
8170
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8171
+ this.expectPunct("(");
8172
+ const args = [];
8173
+ if (!this.matchPunct(")")) for (;;) {
8174
+ args.push(this.parseTernary());
8175
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8176
+ if (this.matchPunct(",")) continue;
8177
+ this.expectPunct(")");
8178
+ break;
8179
+ }
8180
+ this.callees.add(callee);
8181
+ this.countNode();
8182
+ return {
8183
+ kind: "call",
8184
+ callee,
8185
+ args
8186
+ };
8187
+ }
8188
+ };
8189
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8190
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8191
+ function parseExpression(source) {
8192
+ return new Parser(tokenize(source)).parse();
8193
+ }
8194
+ Object.freeze({});
8195
+ /**
8196
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8197
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8198
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8199
+ * one per read on a hot resolve path.
8200
+ *
8201
+ * The cache is a module-level singleton: entries are pure, content-addressed
8202
+ * ASTs keyed by the raw source string, so sharing one instance across all
8203
+ * callers is safe and maximises hit rate.
8204
+ */
8205
+ var cache = /* @__PURE__ */ new Map();
8206
+ function getCached(source) {
8207
+ const hit = cache.get(source);
8208
+ if (hit !== void 0) {
8209
+ cache.delete(source);
8210
+ cache.set(source, hit);
8211
+ return hit;
8212
+ }
8213
+ let result;
8214
+ try {
8215
+ result = {
8216
+ ok: true,
8217
+ parsed: parseExpression(source)
8218
+ };
8219
+ } catch (err) {
8220
+ result = {
8221
+ ok: false,
8222
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8223
+ };
8224
+ }
8225
+ cache.set(source, result);
8226
+ if (cache.size > 256) {
8227
+ const oldest = cache.keys().next().value;
8228
+ if (oldest !== void 0) cache.delete(oldest);
8229
+ }
8230
+ return result;
8231
+ }
8232
+ /** Compile `source`, returning a discriminated result instead of throwing.
8233
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8234
+ function compileExpressionSafe(source) {
8235
+ return getCached(source);
8236
+ }
8237
+ /**
8238
+ * Author-time validation. Returns `null` when the source is valid, else a
8239
+ * human-readable error message. Checks: the expression compiles; binding count
8240
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8241
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8242
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8243
+ */
8244
+ function validateExpressionSource(src) {
8245
+ const names = Object.keys(src.bindings);
8246
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8247
+ for (const name of names) {
8248
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8249
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8250
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8251
+ }
8252
+ const compiled = compileExpressionSafe(src.expr);
8253
+ if (!compiled.ok) return compiled.error;
8254
+ const bound = new Set(names);
8255
+ for (const id of compiled.parsed.identifiers) {
8256
+ if (id === "now") continue;
8257
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8258
+ }
8259
+ return null;
8260
+ }
8261
+ /**
7478
8262
  * Accessory device helpers — shared across drivers.
7479
8263
  *
7480
8264
  * Many vendor-specific drivers register accessory child devices on
@@ -9406,7 +10190,8 @@ var MotionAnalysisResultSchema = object({
9406
10190
  });
9407
10191
  method(object({
9408
10192
  deviceId: number(),
9409
- frame: FrameInputSchema
10193
+ frame: FrameInputSchema.optional(),
10194
+ frameHandle: FrameHandleSchema.optional()
9410
10195
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9411
10196
  deviceId: number(),
9412
10197
  detected: boolean(),
@@ -9653,6 +10438,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9653
10438
  engine: PipelineEngineChoiceSchema.optional(),
9654
10439
  steps: array(PipelineStepInputSchema).min(1),
9655
10440
  frame: FrameInputSchema.optional(),
10441
+ /**
10442
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10443
+ * the decoded pixels live in. One more member of the one-of
10444
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10445
+ */
10446
+ frameHandle: FrameHandleSchema.optional(),
9656
10447
  imageBase64: string().optional(),
9657
10448
  /**
9658
10449
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9862,6 +10653,31 @@ var ReportMotionInputSchema = object({
9862
10653
  regions: array(MotionRegionSchema).readonly().optional()
9863
10654
  });
9864
10655
  /**
10656
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10657
+ * restream-owner model — P2c).
10658
+ *
10659
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10660
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10661
+ * `frameSource` key) parses to this, so the field is additive with zero
10662
+ * behavior change.
10663
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10664
+ * The runner acquires the owner's COMPRESSED passthrough restream
10665
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10666
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10667
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10668
+ * node-local; only H.264/H.265 packets cross the wire.
10669
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10670
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10671
+ * dials for the owner's restream.
10672
+ */
10673
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10674
+ kind: literal("remote-restream"),
10675
+ /** The camera's source-owner node (slice 1: always the hub). */
10676
+ ownerNodeId: string(),
10677
+ /** Operator override for the owner host the runner dials. */
10678
+ hubHostnameOverride: string().optional()
10679
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10680
+ /**
9865
10681
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9866
10682
  * specific runner instance via `attachCamera`. Carries everything the
9867
10683
  * runner needs to subscribe to the local broker and execute inference.
@@ -9959,7 +10775,15 @@ var RunnerCameraConfigSchema = object({
9959
10775
  */
9960
10776
  onboardMotionDrivesAnalyzer: boolean().default(true),
9961
10777
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9962
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10778
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10779
+ /**
10780
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10781
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10782
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10783
+ * camera's detect node differs from its source-owner (P2d, gated by the
10784
+ * `remoteSourcingNodes` rollout setting).
10785
+ */
10786
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9963
10787
  });
9964
10788
  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;
9965
10789
  /**
@@ -10324,6 +11148,113 @@ object({
10324
11148
  lastFetchedAt: number()
10325
11149
  });
10326
11150
  DeviceType.Sensor;
11151
+ /**
11152
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11153
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11154
+ * `on_batteries` (running on battery backup). `null` until first reported.
11155
+ */
11156
+ var PetFeederDeviceStatusSchema = _enum([
11157
+ "normal",
11158
+ "offline",
11159
+ "on_batteries"
11160
+ ]);
11161
+ var gramsPortion = number().int().min(4).max(200);
11162
+ object({
11163
+ /** Food currently in the bowl (grams). Null when the device has not
11164
+ * reported a reading yet. On dual-hopper models this is the combined
11165
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11166
+ foodLevel: number().nullable(),
11167
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11168
+ * single-hopper models. */
11169
+ food1: number().nullable(),
11170
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11171
+ * single-hopper models. */
11172
+ food2: number().nullable(),
11173
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11174
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11175
+ * below the feeder's low threshold. */
11176
+ lowFood: boolean(),
11177
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11178
+ * device has no battery reading. */
11179
+ batteryPower: number().min(0).max(100).nullable(),
11180
+ /** Days of desiccant life remaining. Null when the model has no
11181
+ * desiccant sensor. */
11182
+ desiccantLeftDays: number().nullable(),
11183
+ /** True while a feed is in progress. */
11184
+ feeding: boolean(),
11185
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11186
+ * Null until the device has reported a status. */
11187
+ status: PetFeederDeviceStatusSchema.nullable(),
11188
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11189
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11190
+ * with `errorCode` for consumers that want the raw integer. */
11191
+ error: string().nullable(),
11192
+ /** Raw device error code (0 / null = no error). */
11193
+ errorCode: number().nullable(),
11194
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11195
+ isDualHopper: boolean(),
11196
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11197
+ childLock: boolean(),
11198
+ /** Front indicator-light setting. */
11199
+ indicatorLight: boolean(),
11200
+ /** Play a chime when dispensing. */
11201
+ feedSound: boolean(),
11202
+ /** Speaker / prompt volume level (device-scaled integer). */
11203
+ volume: number(),
11204
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11205
+ lastFetchedAt: number()
11206
+ });
11207
+ DeviceType.PetFeeder, method(object({
11208
+ deviceId: number().int().nonnegative(),
11209
+ grams: gramsPortion.optional(),
11210
+ hopper1: gramsPortion.optional(),
11211
+ hopper2: gramsPortion.optional()
11212
+ }), _void(), {
11213
+ kind: "mutation",
11214
+ auth: "admin"
11215
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11216
+ kind: "mutation",
11217
+ auth: "admin"
11218
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11219
+ kind: "mutation",
11220
+ auth: "admin"
11221
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11222
+ kind: "mutation",
11223
+ auth: "admin"
11224
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11225
+ kind: "mutation",
11226
+ auth: "admin"
11227
+ }), method(object({
11228
+ deviceId: number().int().nonnegative(),
11229
+ soundId: number().int().nonnegative()
11230
+ }), _void(), {
11231
+ kind: "mutation",
11232
+ auth: "admin"
11233
+ }), method(object({
11234
+ deviceId: number().int().nonnegative(),
11235
+ on: boolean()
11236
+ }), _void(), {
11237
+ kind: "mutation",
11238
+ auth: "admin"
11239
+ }), method(object({
11240
+ deviceId: number().int().nonnegative(),
11241
+ on: boolean()
11242
+ }), _void(), {
11243
+ kind: "mutation",
11244
+ auth: "admin"
11245
+ }), method(object({
11246
+ deviceId: number().int().nonnegative(),
11247
+ on: boolean()
11248
+ }), _void(), {
11249
+ kind: "mutation",
11250
+ auth: "admin"
11251
+ }), method(object({
11252
+ deviceId: number().int().nonnegative(),
11253
+ level: number().int().nonnegative()
11254
+ }), _void(), {
11255
+ kind: "mutation",
11256
+ auth: "admin"
11257
+ });
10327
11258
  object({
10328
11259
  /** Instantaneous power draw in watts. */
10329
11260
  watts: number().optional(),
@@ -12206,10 +13137,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12206
13137
  url: string()
12207
13138
  }), _void()), method(object({
12208
13139
  sessionId: string(),
12209
- maxCount: number().default(1)
13140
+ maxCount: number().default(1),
13141
+ waitMs: number().optional()
12210
13142
  }), array(DecodedFrameSchema)), method(object({
12211
13143
  sessionId: string(),
12212
- maxCount: number().default(1)
13144
+ maxCount: number().default(1),
13145
+ waitMs: number().optional()
12213
13146
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12214
13147
  sessionId: string(),
12215
13148
  config: DecoderSessionConfigSchema.partial()
@@ -12496,14 +13429,63 @@ var ChildLayoutEntrySchema = object({
12496
13429
  collapsed: boolean().optional()
12497
13430
  });
12498
13431
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12499
- * `device-management.ts`. */
13432
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13433
+ * accessory's status field (`kind` optional/absent for wire compat); a
13434
+ * LITERAL source carries a per-device constant (no sibling is read); a
13435
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13436
+ * source device's full re-sync-stable `stableId`. */
13437
+ var DeviceLinkFieldSourceSchema = object({
13438
+ kind: literal("field").optional(),
13439
+ sourceKey: string(),
13440
+ cap: string(),
13441
+ fieldPath: string()
13442
+ });
13443
+ var DeviceLinkLiteralSourceSchema = object({
13444
+ kind: literal("literal"),
13445
+ value: union([
13446
+ string(),
13447
+ number(),
13448
+ boolean(),
13449
+ _null()
13450
+ ])
13451
+ });
13452
+ var DeviceLinkGlobalSourceSchema = object({
13453
+ kind: literal("global"),
13454
+ sourceStableId: string(),
13455
+ cap: string(),
13456
+ fieldPath: string()
13457
+ });
13458
+ /** Expression source (Stage X): compute the target field from N named bindings
13459
+ * via the safe expression engine. Bindings are field | literal | global — never
13460
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13461
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13462
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13463
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13464
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13465
+ var DeviceLinkExpressionSourceSchema = object({
13466
+ kind: literal("expression"),
13467
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13468
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13469
+ DeviceLinkFieldSourceSchema,
13470
+ DeviceLinkLiteralSourceSchema,
13471
+ DeviceLinkGlobalSourceSchema
13472
+ ]))
13473
+ }).superRefine((src, ctx) => {
13474
+ const err = validateExpressionSource(src);
13475
+ if (err !== null) ctx.addIssue({
13476
+ code: "custom",
13477
+ message: err,
13478
+ path: ["expr"]
13479
+ });
13480
+ });
12500
13481
  var DeviceLinkSchema = object({
12501
13482
  id: string(),
12502
- source: object({
12503
- sourceKey: string(),
12504
- cap: string(),
12505
- fieldPath: string()
12506
- }),
13483
+ source: union([
13484
+ DeviceLinkFieldSourceSchema,
13485
+ DeviceLinkLiteralSourceSchema,
13486
+ DeviceLinkGlobalSourceSchema,
13487
+ DeviceLinkExpressionSourceSchema
13488
+ ]),
12507
13489
  target: object({
12508
13490
  cap: string(),
12509
13491
  fieldPath: string(),
@@ -12532,6 +13514,31 @@ var DeviceLinkSchema = object({
12532
13514
  })
12533
13515
  ]).optional()
12534
13516
  });
13517
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13518
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13519
+ var DeviceCapDisplayOverrideSchema = object({
13520
+ unit: string().min(1).optional(),
13521
+ precision: number().int().min(0).max(10).optional()
13522
+ });
13523
+ /** Cap-wire shape of an operator-authored per-device display override —
13524
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13525
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13526
+ var DeviceDisplayOverrideSchema = object({
13527
+ icon: string().min(1).optional(),
13528
+ label: string().min(1).optional(),
13529
+ unit: string().min(1).optional(),
13530
+ precision: number().int().min(0).max(10).optional(),
13531
+ hidden: boolean().optional(),
13532
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13533
+ });
13534
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13535
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13536
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13537
+ var RoleDisplayDefaultSchema = object({
13538
+ unit: string().min(1).optional(),
13539
+ precision: number().int().min(0).max(10).optional(),
13540
+ icon: string().min(1).optional()
13541
+ });
12535
13542
  /**
12536
13543
  * Serializable projection of a live IDevice.
12537
13544
  * Returned by listAll, getDevice, getChildren.
@@ -12587,7 +13594,9 @@ var DeviceInfoSchema = object({
12587
13594
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12588
13595
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12589
13596
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12590
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13597
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13598
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13599
+ display: DeviceDisplayOverrideSchema.optional()
12591
13600
  });
12592
13601
  var ConfigEntrySchema = object({
12593
13602
  key: string(),
@@ -12652,7 +13661,9 @@ var DeviceMetaSchema = object({
12652
13661
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12653
13662
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12654
13663
  * Optional: only present for accessory children that carry a known role. */
12655
- role: string().nullable().optional()
13664
+ role: string().nullable().optional(),
13665
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13666
+ display: DeviceDisplayOverrideSchema.optional()
12656
13667
  });
12657
13668
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12658
13669
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12746,7 +13757,19 @@ method(object({
12746
13757
  }), _void(), {
12747
13758
  kind: "mutation",
12748
13759
  auth: "admin"
12749
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13760
+ }), method(object({
13761
+ deviceId: number(),
13762
+ display: DeviceDisplayOverrideSchema.nullable()
13763
+ }), _void(), {
13764
+ kind: "mutation",
13765
+ auth: "admin"
13766
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13767
+ kind: "mutation",
13768
+ auth: "admin"
13769
+ }), method(object({
13770
+ deviceId: number(),
13771
+ includeSynthesizable: boolean().optional()
13772
+ }), object({ caps: array(object({
12750
13773
  cap: string(),
12751
13774
  fields: array(object({
12752
13775
  path: string(),
@@ -12756,8 +13779,13 @@ method(object({
12756
13779
  "boolean",
12757
13780
  "enum"
12758
13781
  ]),
12759
- enumValues: array(string()).optional()
12760
- })).readonly()
13782
+ enumValues: array(string()).optional(),
13783
+ item: boolean().optional()
13784
+ })).readonly(),
13785
+ itemArray: object({
13786
+ path: string(),
13787
+ keyField: string()
13788
+ }).optional()
12761
13789
  })).readonly() }), { kind: "query" }), method(object({
12762
13790
  deviceId: number(),
12763
13791
  role: string().nullable()
@@ -12827,7 +13855,11 @@ method(object({
12827
13855
  deviceId: number(),
12828
13856
  entries: array(object({
12829
13857
  capName: string(),
12830
- kind: _enum(["native", "wrapped"]),
13858
+ kind: _enum([
13859
+ "native",
13860
+ "wrapped",
13861
+ "linked"
13862
+ ]),
12831
13863
  providerAddonId: string(),
12832
13864
  providerNodeId: string(),
12833
13865
  nativeAddonId: string()
@@ -12836,7 +13868,11 @@ method(object({
12836
13868
  deviceId: number(),
12837
13869
  entries: array(object({
12838
13870
  capName: string(),
12839
- kind: _enum(["native", "wrapped"]),
13871
+ kind: _enum([
13872
+ "native",
13873
+ "wrapped",
13874
+ "linked"
13875
+ ]),
12840
13876
  providerAddonId: string(),
12841
13877
  providerNodeId: string(),
12842
13878
  nativeAddonId: string()
@@ -13336,7 +14372,7 @@ var AddBrokerInputSchema = object({
13336
14372
  });
13337
14373
  var AddBrokerResultSchema = object({ id: string() });
13338
14374
  var IdInputSchema = object({ id: string() });
13339
- var TestResultSchema = discriminatedUnion("ok", [object({
14375
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13340
14376
  ok: literal(true),
13341
14377
  latencyMs: number()
13342
14378
  }), object({
@@ -13359,7 +14395,7 @@ var StatusSchema = object({
13359
14395
  brokerCount: number(),
13360
14396
  embeddedRunning: boolean()
13361
14397
  });
13362
- 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);
14398
+ 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);
13363
14399
  var NetworkEndpointSchema = object({
13364
14400
  url: string(),
13365
14401
  hostname: string(),
@@ -13393,23 +14429,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13393
14429
  sourcePort: number().optional()
13394
14430
  });
13395
14431
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13396
- method(object({
13397
- title: string(),
14432
+ /**
14433
+ * notification-output — canonical, capability-gated notification delivery.
14434
+ *
14435
+ * Apprise-derived model (see
14436
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14437
+ * callers emit ONE canonical `Notification`; each provider declares a
14438
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14439
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14440
+ * message to what the kind supports — callers never special-case a service.
14441
+ *
14442
+ * DESIGN DECISIONS (locked):
14443
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14444
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14445
+ * cap. Rationale: the admin UI needs one uniform surface across the
14446
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14447
+ * alternative would fork the UI per addon and cannot host the
14448
+ * discovery→adopt flow.
14449
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14450
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14451
+ * registered provider (notifiers addon + HA addon) so one catalog is
14452
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14453
+ * `addonId` the generated collection router extracts from the call input.
14454
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14455
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14456
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14457
+ * base64 fallback needed.
14458
+ *
14459
+ * TODO (deferred, closed-set change — separate decision): add
14460
+ * `providerKind: 'notify'` so notification providers surface on the unified
14461
+ * admin "Integrations" page.
14462
+ */
14463
+ /**
14464
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14465
+ * adapter picks what it supports and the degrade engine filters the rest.
14466
+ */
14467
+ var AttachmentMediaTypeSchema = _enum([
14468
+ "image",
14469
+ "video",
14470
+ "gif",
14471
+ "audio",
14472
+ "icon"
14473
+ ]);
14474
+ /**
14475
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14476
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14477
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14478
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14479
+ */
14480
+ var AttachmentSchema = object({
14481
+ mediaType: AttachmentMediaTypeSchema,
14482
+ url: string().optional(),
14483
+ bytes: _instanceof(Uint8Array).optional(),
14484
+ mime: string().optional(),
14485
+ name: string().optional()
14486
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14487
+ var NotificationFormatSchema = _enum([
14488
+ "text",
14489
+ "markdown",
14490
+ "html"
14491
+ ]);
14492
+ /** A single tap-through action button. */
14493
+ var NotificationActionSchema = object({
14494
+ id: string(),
14495
+ label: string(),
14496
+ url: string().optional()
14497
+ });
14498
+ /**
14499
+ * The canonical notification. `body` is the only hard field (Apprise model).
14500
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14501
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14502
+ * the adapter maps this ordinal onto its native level. `level?` is an
14503
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14504
+ * `priority` for that one target.
14505
+ */
14506
+ var NotificationSchema = object({
13398
14507
  body: string(),
13399
- imageUrl: string().optional(),
14508
+ title: string().optional(),
14509
+ format: NotificationFormatSchema.default("text"),
14510
+ priority: number().int().min(1).max(5).default(3),
14511
+ level: string().optional(),
14512
+ attachments: array(AttachmentSchema).optional(),
14513
+ clickUrl: string().optional(),
14514
+ actions: array(NotificationActionSchema).optional(),
14515
+ sound: string().optional(),
14516
+ ttl: number().optional(),
14517
+ tag: string().optional(),
13400
14518
  deviceId: number().optional(),
13401
14519
  eventId: string().optional(),
13402
- priority: _enum([
13403
- "low",
13404
- "normal",
13405
- "high",
13406
- "critical"
13407
- ]).default("normal"),
13408
14520
  metadata: record(string(), unknown()).optional()
13409
- }), _void(), { kind: "mutation" }), method(_void(), object({
14521
+ });
14522
+ /** One declared native severity/priority level for a kind. */
14523
+ var TargetKindLevelSchema = object({
14524
+ id: string(),
14525
+ label: string(),
14526
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14527
+ ordinal: number().int().min(1).max(5).nullable(),
14528
+ flags: object({
14529
+ critical: boolean().optional(),
14530
+ silent: boolean().optional(),
14531
+ noPush: boolean().optional()
14532
+ }).optional(),
14533
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14534
+ requires: array(string()).optional(),
14535
+ description: string().optional()
14536
+ });
14537
+ /** The full capability block consulted before dispatch. */
14538
+ var TargetKindCapsSchema = object({
14539
+ attachments: object({
14540
+ mediaTypes: array(AttachmentMediaTypeSchema),
14541
+ mode: _enum([
14542
+ "url",
14543
+ "bytes",
14544
+ "both"
14545
+ ]),
14546
+ max: number().int().nonnegative(),
14547
+ maxBytes: number().int().positive().optional()
14548
+ }),
14549
+ /** Max action buttons (0 = none). */
14550
+ actions: number().int().nonnegative(),
14551
+ levels: array(TargetKindLevelSchema),
14552
+ format: array(NotificationFormatSchema),
14553
+ clickUrl: boolean(),
14554
+ sound: boolean(),
14555
+ ttl: boolean(),
14556
+ bodyMaxLen: number().int().positive()
14557
+ });
14558
+ /**
14559
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14560
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14561
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14562
+ * the union is large and not meant for runtime validation here; the exported
14563
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14564
+ */
14565
+ var ConfigSchemaPassthrough = unknown();
14566
+ var TargetKindSchema = object({
14567
+ kind: string(),
14568
+ label: string(),
14569
+ icon: string(),
14570
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14571
+ addonId: string(),
14572
+ configSchema: ConfigSchemaPassthrough,
14573
+ supportsDiscovery: boolean(),
14574
+ caps: TargetKindCapsSchema
14575
+ });
14576
+ /**
14577
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14578
+ * (return a presence marker only) when serving `listTargets` — never
14579
+ * round-trip a stored secret to the UI.
14580
+ */
14581
+ var TargetSchema = object({
14582
+ id: string(),
14583
+ name: string(),
14584
+ kind: string(),
14585
+ addonId: string(),
14586
+ enabled: boolean(),
14587
+ config: record(string(), unknown())
14588
+ });
14589
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14590
+ var DiscoveredTargetSchema = object({
14591
+ kind: string(),
14592
+ suggestedName: string(),
14593
+ config: record(string(), unknown())
14594
+ });
14595
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14596
+ var RenderedAsSchema = object({
14597
+ level: string(),
14598
+ format: NotificationFormatSchema,
14599
+ attachmentsSent: number().int().nonnegative(),
14600
+ actionsSent: number().int().nonnegative(),
14601
+ truncated: boolean(),
14602
+ dropped: array(string())
14603
+ });
14604
+ var SendResultSchema = object({
13410
14605
  success: boolean(),
13411
- error: string().optional()
13412
- }), { kind: "mutation" });
14606
+ error: string().optional(),
14607
+ renderedAs: RenderedAsSchema.optional()
14608
+ });
14609
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14610
+ var TestResultSchema = SendResultSchema;
14611
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14612
+ kind: string(),
14613
+ config: record(string(), unknown()).optional()
14614
+ }), array(DiscoveredTargetSchema)), method(object({
14615
+ targetId: string(),
14616
+ notification: NotificationSchema
14617
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14618
+ targetId: string(),
14619
+ sample: NotificationSchema.optional()
14620
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14621
+ targetId: string(),
14622
+ enabled: boolean()
14623
+ }), _void(), { kind: "mutation" });
13413
14624
  /**
13414
14625
  * Zod schemas for persisted record types.
13415
14626
  *
@@ -16549,7 +17760,10 @@ var HwAccelBackendInputSchema = _enum([
16549
17760
  "webgpu",
16550
17761
  "none"
16551
17762
  ]).nullable().optional();
16552
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17763
+ var HwAccelResolutionSchema = object({
17764
+ preferred: array(string()).readonly(),
17765
+ rationale: string()
17766
+ });
16553
17767
  var HardwareEncoderIdSchema = _enum([
16554
17768
  "h264_videotoolbox",
16555
17769
  "hevc_videotoolbox",
@@ -16654,10 +17868,7 @@ var ResolvedInferenceConfigSchema = object({
16654
17868
  format: ModelFormatSchema,
16655
17869
  reason: string()
16656
17870
  });
16657
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16658
- prefer: HwAccelBackendInputSchema,
16659
- nodeId: string().optional()
16660
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
17871
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16661
17872
  kind: "mutation",
16662
17873
  auth: "admin"
16663
17874
  }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
@@ -16716,6 +17927,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16716
17927
  kind: "mutation",
16717
17928
  auth: "admin"
16718
17929
  });
17930
+ /**
17931
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17932
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17933
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17934
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17935
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17936
+ * annotations that are not exposed here and must not be treated as an event
17937
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17938
+ * (`interfaces/recording-config.ts`).
17939
+ */
16719
17940
  var RecordingStatusSchema = object({
16720
17941
  deviceId: number(),
16721
17942
  enabled: boolean(),
@@ -18352,6 +19573,12 @@ Object.freeze({
18352
19573
  addonId: null,
18353
19574
  access: "view"
18354
19575
  },
19576
+ "deviceManager.getRoleDisplayDefaults": {
19577
+ capName: "device-manager",
19578
+ capScope: "system",
19579
+ addonId: null,
19580
+ access: "view"
19581
+ },
18355
19582
  "deviceManager.getSettingsSchema": {
18356
19583
  capName: "device-manager",
18357
19584
  capScope: "system",
@@ -18502,6 +19729,12 @@ Object.freeze({
18502
19729
  addonId: null,
18503
19730
  access: "create"
18504
19731
  },
19732
+ "deviceManager.setDisplay": {
19733
+ capName: "device-manager",
19734
+ capScope: "system",
19735
+ addonId: null,
19736
+ access: "create"
19737
+ },
18505
19738
  "deviceManager.setIntegrationId": {
18506
19739
  capName: "device-manager",
18507
19740
  capScope: "system",
@@ -18544,6 +19777,12 @@ Object.freeze({
18544
19777
  addonId: null,
18545
19778
  access: "create"
18546
19779
  },
19780
+ "deviceManager.setRoleDisplayDefaults": {
19781
+ capName: "device-manager",
19782
+ capScope: "system",
19783
+ addonId: null,
19784
+ access: "create"
19785
+ },
18547
19786
  "deviceManager.setStreamProfileMap": {
18548
19787
  capName: "device-manager",
18549
19788
  capScope: "system",
@@ -19522,13 +20761,49 @@ Object.freeze({
19522
20761
  addonId: null,
19523
20762
  access: "create"
19524
20763
  },
20764
+ "notificationOutput.deleteTarget": {
20765
+ capName: "notification-output",
20766
+ capScope: "system",
20767
+ addonId: null,
20768
+ access: "delete"
20769
+ },
20770
+ "notificationOutput.discoverTargets": {
20771
+ capName: "notification-output",
20772
+ capScope: "system",
20773
+ addonId: null,
20774
+ access: "view"
20775
+ },
20776
+ "notificationOutput.listTargetKinds": {
20777
+ capName: "notification-output",
20778
+ capScope: "system",
20779
+ addonId: null,
20780
+ access: "view"
20781
+ },
20782
+ "notificationOutput.listTargets": {
20783
+ capName: "notification-output",
20784
+ capScope: "system",
20785
+ addonId: null,
20786
+ access: "view"
20787
+ },
19525
20788
  "notificationOutput.send": {
19526
20789
  capName: "notification-output",
19527
20790
  capScope: "system",
19528
20791
  addonId: null,
19529
20792
  access: "create"
19530
20793
  },
19531
- "notificationOutput.sendTest": {
20794
+ "notificationOutput.setTargetEnabled": {
20795
+ capName: "notification-output",
20796
+ capScope: "system",
20797
+ addonId: null,
20798
+ access: "create"
20799
+ },
20800
+ "notificationOutput.testTarget": {
20801
+ capName: "notification-output",
20802
+ capScope: "system",
20803
+ addonId: null,
20804
+ access: "create"
20805
+ },
20806
+ "notificationOutput.upsertTarget": {
19532
20807
  capName: "notification-output",
19533
20808
  capScope: "system",
19534
20809
  addonId: null,
@@ -19558,6 +20833,66 @@ Object.freeze({
19558
20833
  addonId: null,
19559
20834
  access: "create"
19560
20835
  },
20836
+ "petFeeder.callPet": {
20837
+ capName: "pet-feeder",
20838
+ capScope: "device",
20839
+ addonId: null,
20840
+ access: "create"
20841
+ },
20842
+ "petFeeder.cancelFeed": {
20843
+ capName: "pet-feeder",
20844
+ capScope: "device",
20845
+ addonId: null,
20846
+ access: "create"
20847
+ },
20848
+ "petFeeder.feed": {
20849
+ capName: "pet-feeder",
20850
+ capScope: "device",
20851
+ addonId: null,
20852
+ access: "create"
20853
+ },
20854
+ "petFeeder.markFoodReplenished": {
20855
+ capName: "pet-feeder",
20856
+ capScope: "device",
20857
+ addonId: null,
20858
+ access: "create"
20859
+ },
20860
+ "petFeeder.playSound": {
20861
+ capName: "pet-feeder",
20862
+ capScope: "device",
20863
+ addonId: null,
20864
+ access: "create"
20865
+ },
20866
+ "petFeeder.resetDesiccant": {
20867
+ capName: "pet-feeder",
20868
+ capScope: "device",
20869
+ addonId: null,
20870
+ access: "delete"
20871
+ },
20872
+ "petFeeder.setChildLock": {
20873
+ capName: "pet-feeder",
20874
+ capScope: "device",
20875
+ addonId: null,
20876
+ access: "create"
20877
+ },
20878
+ "petFeeder.setFeedSound": {
20879
+ capName: "pet-feeder",
20880
+ capScope: "device",
20881
+ addonId: null,
20882
+ access: "create"
20883
+ },
20884
+ "petFeeder.setIndicatorLight": {
20885
+ capName: "pet-feeder",
20886
+ capScope: "device",
20887
+ addonId: null,
20888
+ access: "create"
20889
+ },
20890
+ "petFeeder.setVolume": {
20891
+ capName: "pet-feeder",
20892
+ capScope: "device",
20893
+ addonId: null,
20894
+ access: "create"
20895
+ },
19561
20896
  "pipelineAnalytics.clearTracks": {
19562
20897
  capName: "pipeline-analytics",
19563
20898
  capScope: "device",
@@ -21526,6 +22861,12 @@ Object.defineProperty(exports, "DeviceType", {
21526
22861
  return DeviceType;
21527
22862
  }
21528
22863
  });
22864
+ Object.defineProperty(exports, "EVENT_PAD_MS", {
22865
+ enumerable: true,
22866
+ get: function() {
22867
+ return EVENT_PAD_MS;
22868
+ }
22869
+ });
21529
22870
  Object.defineProperty(exports, "EventCategory", {
21530
22871
  enumerable: true,
21531
22872
  get: function() {