@camstack/addon-export-hap 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.
- package/dist/export-hap.addon.js +1361 -45
- package/dist/export-hap.addon.mjs +1361 -45
- package/package.json +1 -1
|
@@ -4639,7 +4639,7 @@ function _instanceof(cls, params = {}) {
|
|
|
4639
4639
|
return inst;
|
|
4640
4640
|
}
|
|
4641
4641
|
//#endregion
|
|
4642
|
-
//#region ../types/dist/sleep-
|
|
4642
|
+
//#region ../types/dist/sleep-BiDFW0E7.mjs
|
|
4643
4643
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4644
4644
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4645
4645
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -5452,6 +5452,100 @@ function createDurableState(deps) {
|
|
|
5452
5452
|
};
|
|
5453
5453
|
}
|
|
5454
5454
|
/**
|
|
5455
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
5456
|
+
*
|
|
5457
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
5458
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
5459
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
5460
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
5461
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
5462
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
5463
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
5464
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
5465
|
+
*
|
|
5466
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
5467
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
5468
|
+
* schema and routes reads/writes through these helpers.
|
|
5469
|
+
*
|
|
5470
|
+
* ## No bare-key fallback — deliberate
|
|
5471
|
+
*
|
|
5472
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
5473
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
5474
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
5475
|
+
* the store is invisible to every node, hub included, so one node's
|
|
5476
|
+
* selection can never leak onto another. (This generalizes the
|
|
5477
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
5478
|
+
* arbitrary set of per-node field keys.)
|
|
5479
|
+
*
|
|
5480
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
5481
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
5482
|
+
*/
|
|
5483
|
+
/**
|
|
5484
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
5485
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
5486
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
5487
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
5488
|
+
*/
|
|
5489
|
+
function normalizeNodeId(raw) {
|
|
5490
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
5491
|
+
const slashIdx = raw.indexOf("/");
|
|
5492
|
+
if (slashIdx < 0) return raw;
|
|
5493
|
+
const bare = raw.slice(0, slashIdx);
|
|
5494
|
+
return bare === "" ? "hub" : bare;
|
|
5495
|
+
}
|
|
5496
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
5497
|
+
function nodeScopedKey(base, nodeId) {
|
|
5498
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
5499
|
+
}
|
|
5500
|
+
/**
|
|
5501
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
5502
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
5503
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
5504
|
+
* schema `default` win on `undefined`.
|
|
5505
|
+
*/
|
|
5506
|
+
function readNodeValue(store, base, nodeId) {
|
|
5507
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
5508
|
+
}
|
|
5509
|
+
/**
|
|
5510
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
5511
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
5512
|
+
* the write path so a save for one node never clobbers another node's value
|
|
5513
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
5514
|
+
* patch is not mutated.
|
|
5515
|
+
*/
|
|
5516
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
5517
|
+
const out = {};
|
|
5518
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
5519
|
+
return out;
|
|
5520
|
+
}
|
|
5521
|
+
/**
|
|
5522
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
5523
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
5524
|
+
* values:
|
|
5525
|
+
*
|
|
5526
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
5527
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
5528
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
5529
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
5530
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
5531
|
+
* left ABSENT so the field's schema `default` wins.
|
|
5532
|
+
*
|
|
5533
|
+
* Returns a new object — the input store is not mutated.
|
|
5534
|
+
*/
|
|
5535
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
5536
|
+
const out = {};
|
|
5537
|
+
for (const [key, value] of Object.entries(store)) {
|
|
5538
|
+
if (key.includes("@")) continue;
|
|
5539
|
+
if (perNodeKeys.has(key)) continue;
|
|
5540
|
+
out[key] = value;
|
|
5541
|
+
}
|
|
5542
|
+
for (const base of perNodeKeys) {
|
|
5543
|
+
const value = readNodeValue(store, base, nodeId);
|
|
5544
|
+
if (value !== void 0) out[base] = value;
|
|
5545
|
+
}
|
|
5546
|
+
return out;
|
|
5547
|
+
}
|
|
5548
|
+
/**
|
|
5455
5549
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5456
5550
|
*
|
|
5457
5551
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
@@ -5619,23 +5713,63 @@ var BaseAddon = class {
|
|
|
5619
5713
|
deviceSettingsSchema() {
|
|
5620
5714
|
return null;
|
|
5621
5715
|
}
|
|
5622
|
-
async getGlobalSettings(overlay, cap,
|
|
5716
|
+
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5623
5717
|
const schema = this.globalSettingsSchema(cap);
|
|
5624
5718
|
if (!schema) return { sections: [] };
|
|
5625
|
-
const
|
|
5719
|
+
const projected = await this.resolveGlobalStore(nodeId, cap);
|
|
5626
5720
|
return hydrateSchema(schema, overlay ? {
|
|
5627
|
-
...
|
|
5721
|
+
...projected,
|
|
5628
5722
|
...overlay
|
|
5629
|
-
} :
|
|
5723
|
+
} : projected);
|
|
5630
5724
|
}
|
|
5631
|
-
|
|
5632
|
-
|
|
5725
|
+
/**
|
|
5726
|
+
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5727
|
+
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5728
|
+
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
5729
|
+
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
5730
|
+
* A no-op passthrough when the schema declares no `perNode` field.
|
|
5731
|
+
*
|
|
5732
|
+
* This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
|
|
5733
|
+
* the store for custom option logic (option narrowing, value snapping) to
|
|
5734
|
+
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
5735
|
+
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
5736
|
+
*/
|
|
5737
|
+
async resolveGlobalStore(nodeId, cap) {
|
|
5738
|
+
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
5739
|
+
const keys = this.perNodeKeys(cap);
|
|
5740
|
+
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5741
|
+
return keys.size > 0 ? projectStore(raw, keys, node) : raw;
|
|
5742
|
+
}
|
|
5743
|
+
async updateGlobalSettings(patch, nodeId) {
|
|
5744
|
+
const keys = this.perNodeKeys();
|
|
5745
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5746
|
+
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5747
|
+
const barePatch = patch;
|
|
5748
|
+
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
5749
|
+
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
5750
|
+
if (target !== localNode) return;
|
|
5633
5751
|
await this.resolveConfig();
|
|
5634
5752
|
await this.onConfigChanged();
|
|
5635
5753
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
5636
5754
|
this.maybeAutoRestart(patch, this.globalSettingsSchema());
|
|
5637
5755
|
}
|
|
5638
5756
|
/**
|
|
5757
|
+
* The set of field keys the global settings schema declares `perNode: true`
|
|
5758
|
+
* — derived once per `cap` argument and memoized (schemas are static
|
|
5759
|
+
* declarations). Empty set ⇒ every per-node code path is bypassed and the
|
|
5760
|
+
* settings API behaves exactly like the legacy node-agnostic one.
|
|
5761
|
+
*/
|
|
5762
|
+
_perNodeKeysCache = /* @__PURE__ */ new Map();
|
|
5763
|
+
perNodeKeys(cap) {
|
|
5764
|
+
const cacheKey = cap ?? "";
|
|
5765
|
+
const cached = this._perNodeKeysCache.get(cacheKey);
|
|
5766
|
+
if (cached) return cached;
|
|
5767
|
+
const schema = this.globalSettingsSchema(cap);
|
|
5768
|
+
const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
5769
|
+
this._perNodeKeysCache.set(cacheKey, keys);
|
|
5770
|
+
return keys;
|
|
5771
|
+
}
|
|
5772
|
+
/**
|
|
5639
5773
|
* If any field in `patch` is marked `requiresRestart` in `schema`,
|
|
5640
5774
|
* schedule an addon restart for the next tick. Deferred via
|
|
5641
5775
|
* `setImmediate` so the tRPC mutation that triggered the write has
|
|
@@ -5788,12 +5922,19 @@ var BaseAddon = class {
|
|
|
5788
5922
|
* The merge is shallow: each key in `defaults` is checked against the store.
|
|
5789
5923
|
* Only keys present in defaults are read — the store can contain extra keys
|
|
5790
5924
|
* (e.g. from older versions) without polluting the typed config.
|
|
5925
|
+
*
|
|
5926
|
+
* Keys the global settings schema declares `perNode: true` resolve from
|
|
5927
|
+
* THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
|
|
5928
|
+
* from the bare key — so a per-node field resolves to this node's own
|
|
5929
|
+
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
5791
5930
|
*/
|
|
5792
5931
|
async resolveConfig() {
|
|
5793
5932
|
const stored = await this.readAddonStoreWithRetry();
|
|
5933
|
+
const perNode = this.perNodeKeys();
|
|
5934
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5794
5935
|
const resolved = { ...this.defaults };
|
|
5795
5936
|
for (const key of Object.keys(this.defaults)) {
|
|
5796
|
-
const storedValue = stored[key];
|
|
5937
|
+
const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
|
|
5797
5938
|
if (storedValue !== void 0 && storedValue !== null) {
|
|
5798
5939
|
const defaultType = typeof this.defaults[key];
|
|
5799
5940
|
if (typeof storedValue === defaultType) resolved[key] = storedValue;
|
|
@@ -5877,6 +6018,27 @@ var BaseAddon = class {
|
|
|
5877
6018
|
}
|
|
5878
6019
|
};
|
|
5879
6020
|
/**
|
|
6021
|
+
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
6022
|
+
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
6023
|
+
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6024
|
+
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6025
|
+
*/
|
|
6026
|
+
function collectPerNodeFieldKeys(fields) {
|
|
6027
|
+
const collected = [];
|
|
6028
|
+
for (const field of fields) {
|
|
6029
|
+
if (field.type === "group") {
|
|
6030
|
+
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
6031
|
+
continue;
|
|
6032
|
+
}
|
|
6033
|
+
if (field.type === "sub-tabs") {
|
|
6034
|
+
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
6035
|
+
continue;
|
|
6036
|
+
}
|
|
6037
|
+
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
6038
|
+
}
|
|
6039
|
+
return collected;
|
|
6040
|
+
}
|
|
6041
|
+
/**
|
|
5880
6042
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
5881
6043
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
5882
6044
|
* envelopes pass through; void stays void.
|
|
@@ -5901,6 +6063,7 @@ var CamStreamKindSchema = _enum([
|
|
|
5901
6063
|
"pull-rtsp",
|
|
5902
6064
|
"pull-rtmp",
|
|
5903
6065
|
"pull-http",
|
|
6066
|
+
"pull-flv",
|
|
5904
6067
|
"pull-rfc4571",
|
|
5905
6068
|
"push-annexb",
|
|
5906
6069
|
"derived"
|
|
@@ -6283,6 +6446,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
6283
6446
|
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
6284
6447
|
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
6285
6448
|
DeviceType["Image"] = "image";
|
|
6449
|
+
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
6450
|
+
* level, battery, desiccant life, feeding state and manual-feed /
|
|
6451
|
+
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
6452
|
+
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
6453
|
+
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
6454
|
+
* integrations sharing the same food/desiccant/hopper surface. */
|
|
6455
|
+
DeviceType["PetFeeder"] = "pet-feeder";
|
|
6286
6456
|
return DeviceType;
|
|
6287
6457
|
}({});
|
|
6288
6458
|
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
@@ -7485,6 +7655,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7485
7655
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7486
7656
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7487
7657
|
/**
|
|
7658
|
+
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7659
|
+
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7660
|
+
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
7661
|
+
*/
|
|
7662
|
+
/** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
|
|
7663
|
+
* the failure is anchored to a character (author-facing inline feedback). */
|
|
7664
|
+
var ExpressionParseError = class extends Error {
|
|
7665
|
+
position;
|
|
7666
|
+
constructor(message, position) {
|
|
7667
|
+
super(message);
|
|
7668
|
+
this.name = "ExpressionParseError";
|
|
7669
|
+
this.position = position;
|
|
7670
|
+
}
|
|
7671
|
+
};
|
|
7672
|
+
/** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
|
|
7673
|
+
* result, unknown builtin, step-budget exceeded). */
|
|
7674
|
+
var ExpressionEvalError = class extends Error {
|
|
7675
|
+
constructor(message) {
|
|
7676
|
+
super(message);
|
|
7677
|
+
this.name = "ExpressionEvalError";
|
|
7678
|
+
}
|
|
7679
|
+
};
|
|
7680
|
+
/**
|
|
7681
|
+
* Resource-bound constants for the safe expression engine.
|
|
7682
|
+
*
|
|
7683
|
+
* Every bound is defense-in-depth: the grammar is non-Turing-complete (no
|
|
7684
|
+
* loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
|
|
7685
|
+
* O(nodeCount) by construction. These caps merely put a hard ceiling on the
|
|
7686
|
+
* work a single author-supplied expression can request, so a hostile or
|
|
7687
|
+
* accidental pathological string can never spend unbounded CPU/memory.
|
|
7688
|
+
*/
|
|
7689
|
+
/** Max source length (chars) — checked BEFORE tokenizing so a huge string is
|
|
7690
|
+
* rejected without allocation. */
|
|
7691
|
+
var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
|
|
7692
|
+
/** A legal binding / identifier name. */
|
|
7693
|
+
var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
7694
|
+
/** Binding names an author may NOT use: `now` is auto-injected; the literal
|
|
7695
|
+
* keywords lex as values, not identifiers, so binding to them is meaningless. */
|
|
7696
|
+
var RESERVED_BINDING_NAMES = new Set([
|
|
7697
|
+
"now",
|
|
7698
|
+
"true",
|
|
7699
|
+
"false",
|
|
7700
|
+
"null"
|
|
7701
|
+
]);
|
|
7702
|
+
/**
|
|
7703
|
+
* Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
|
|
7704
|
+
* zero-dependency. The grammar is deliberately boring: decimal numbers,
|
|
7705
|
+
* single/double-quoted strings with a tiny escape set, identifiers, the three
|
|
7706
|
+
* value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
|
|
7707
|
+
* outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
|
|
7708
|
+
* is a parse error with a source position, so member access / assignment /
|
|
7709
|
+
* template literals are lexically impossible.
|
|
7710
|
+
*/
|
|
7711
|
+
var KEYWORDS = new Set([
|
|
7712
|
+
"true",
|
|
7713
|
+
"false",
|
|
7714
|
+
"null"
|
|
7715
|
+
]);
|
|
7716
|
+
function isDigit(ch) {
|
|
7717
|
+
return ch >= "0" && ch <= "9";
|
|
7718
|
+
}
|
|
7719
|
+
function isIdentStart(ch) {
|
|
7720
|
+
return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
|
|
7721
|
+
}
|
|
7722
|
+
function isIdentPart(ch) {
|
|
7723
|
+
return isIdentStart(ch) || isDigit(ch);
|
|
7724
|
+
}
|
|
7725
|
+
function isWhitespace(ch) {
|
|
7726
|
+
return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
|
|
7727
|
+
}
|
|
7728
|
+
/** Tokenize `source` into a flat token list ending with a single `eof` token.
|
|
7729
|
+
* Throws `ExpressionParseError` on any illegal character or unterminated
|
|
7730
|
+
* string. */
|
|
7731
|
+
function tokenize(source) {
|
|
7732
|
+
if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
|
|
7733
|
+
const tokens = [];
|
|
7734
|
+
let i = 0;
|
|
7735
|
+
const n = source.length;
|
|
7736
|
+
while (i < n) {
|
|
7737
|
+
const ch = source[i];
|
|
7738
|
+
if (isWhitespace(ch)) {
|
|
7739
|
+
i += 1;
|
|
7740
|
+
continue;
|
|
7741
|
+
}
|
|
7742
|
+
if (isDigit(ch)) {
|
|
7743
|
+
const start = i;
|
|
7744
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7745
|
+
if (i < n && source[i] === ".") {
|
|
7746
|
+
if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
|
|
7747
|
+
i += 1;
|
|
7748
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7749
|
+
}
|
|
7750
|
+
const text = source.slice(start, i);
|
|
7751
|
+
const value = Number(text);
|
|
7752
|
+
if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
|
|
7753
|
+
tokens.push({
|
|
7754
|
+
type: "number",
|
|
7755
|
+
value,
|
|
7756
|
+
pos: start
|
|
7757
|
+
});
|
|
7758
|
+
continue;
|
|
7759
|
+
}
|
|
7760
|
+
if (ch === "'" || ch === "\"") {
|
|
7761
|
+
const quote = ch;
|
|
7762
|
+
const start = i;
|
|
7763
|
+
i += 1;
|
|
7764
|
+
let out = "";
|
|
7765
|
+
let closed = false;
|
|
7766
|
+
while (i < n) {
|
|
7767
|
+
const c = source[i];
|
|
7768
|
+
if (c === "\\") {
|
|
7769
|
+
const next = i + 1 < n ? source[i + 1] : "";
|
|
7770
|
+
if (next === "\\" || next === "'" || next === "\"") {
|
|
7771
|
+
out += next;
|
|
7772
|
+
i += 2;
|
|
7773
|
+
continue;
|
|
7774
|
+
}
|
|
7775
|
+
throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
|
|
7776
|
+
}
|
|
7777
|
+
if (c === quote) {
|
|
7778
|
+
closed = true;
|
|
7779
|
+
i += 1;
|
|
7780
|
+
break;
|
|
7781
|
+
}
|
|
7782
|
+
out += c;
|
|
7783
|
+
i += 1;
|
|
7784
|
+
}
|
|
7785
|
+
if (!closed) throw new ExpressionParseError("unterminated string literal", start);
|
|
7786
|
+
tokens.push({
|
|
7787
|
+
type: "string",
|
|
7788
|
+
value: out,
|
|
7789
|
+
pos: start
|
|
7790
|
+
});
|
|
7791
|
+
continue;
|
|
7792
|
+
}
|
|
7793
|
+
if (isIdentStart(ch)) {
|
|
7794
|
+
const start = i;
|
|
7795
|
+
while (i < n && isIdentPart(source[i])) i += 1;
|
|
7796
|
+
const text = source.slice(start, i);
|
|
7797
|
+
if (KEYWORDS.has(text)) tokens.push({
|
|
7798
|
+
type: "keyword",
|
|
7799
|
+
keyword: keywordOf(text),
|
|
7800
|
+
pos: start
|
|
7801
|
+
});
|
|
7802
|
+
else tokens.push({
|
|
7803
|
+
type: "identifier",
|
|
7804
|
+
name: text,
|
|
7805
|
+
pos: start
|
|
7806
|
+
});
|
|
7807
|
+
continue;
|
|
7808
|
+
}
|
|
7809
|
+
const two = i + 1 < n ? source.slice(i, i + 2) : "";
|
|
7810
|
+
if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
|
|
7811
|
+
tokens.push({
|
|
7812
|
+
type: "punct",
|
|
7813
|
+
punct: two,
|
|
7814
|
+
pos: i
|
|
7815
|
+
});
|
|
7816
|
+
i += 2;
|
|
7817
|
+
continue;
|
|
7818
|
+
}
|
|
7819
|
+
if (isSinglePunct(ch)) {
|
|
7820
|
+
tokens.push({
|
|
7821
|
+
type: "punct",
|
|
7822
|
+
punct: ch,
|
|
7823
|
+
pos: i
|
|
7824
|
+
});
|
|
7825
|
+
i += 1;
|
|
7826
|
+
continue;
|
|
7827
|
+
}
|
|
7828
|
+
throw new ExpressionParseError(`unexpected character '${ch}'`, i);
|
|
7829
|
+
}
|
|
7830
|
+
tokens.push({
|
|
7831
|
+
type: "eof",
|
|
7832
|
+
pos: n
|
|
7833
|
+
});
|
|
7834
|
+
return tokens;
|
|
7835
|
+
}
|
|
7836
|
+
function keywordOf(text) {
|
|
7837
|
+
if (text === "true") return "true";
|
|
7838
|
+
if (text === "false") return "false";
|
|
7839
|
+
return "null";
|
|
7840
|
+
}
|
|
7841
|
+
function isSinglePunct(ch) {
|
|
7842
|
+
return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
|
|
7843
|
+
}
|
|
7844
|
+
/**
|
|
7845
|
+
* Frozen, null-prototype builtin function table for the expression engine
|
|
7846
|
+
* (spec §4 rule 4). The table is the SOLE surface of callable functions: the
|
|
7847
|
+
* parser rejects any callee not in it, and the evaluator gates each call on an
|
|
7848
|
+
* own-property check against it.
|
|
7849
|
+
*
|
|
7850
|
+
* Because the object has a NULL prototype AND is `Object.freeze`d:
|
|
7851
|
+
* - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
|
|
7852
|
+
* - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
|
|
7853
|
+
* (there is no `Object.prototype` in the chain), so those names are not
|
|
7854
|
+
* callable — they are simply "unknown function" at parse time.
|
|
7855
|
+
*
|
|
7856
|
+
* Every numeric argument is validated as a finite number and every numeric
|
|
7857
|
+
* RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
|
|
7858
|
+
* (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
|
|
7859
|
+
* closed rather than emitting a garbage value.
|
|
7860
|
+
*/
|
|
7861
|
+
function asFiniteNumber(value, name, index) {
|
|
7862
|
+
if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
|
|
7863
|
+
return value;
|
|
7864
|
+
}
|
|
7865
|
+
function asString$1(value, name, index) {
|
|
7866
|
+
if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
|
|
7867
|
+
return value;
|
|
7868
|
+
}
|
|
7869
|
+
function finiteResult(value, name) {
|
|
7870
|
+
if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
|
|
7871
|
+
return value;
|
|
7872
|
+
}
|
|
7873
|
+
function allFiniteNumbers(args, name) {
|
|
7874
|
+
return args.map((a, idx) => asFiniteNumber(a, name, idx));
|
|
7875
|
+
}
|
|
7876
|
+
var INF = Number.POSITIVE_INFINITY;
|
|
7877
|
+
var table = {
|
|
7878
|
+
min: {
|
|
7879
|
+
minArgs: 1,
|
|
7880
|
+
maxArgs: INF,
|
|
7881
|
+
apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
|
|
7882
|
+
},
|
|
7883
|
+
max: {
|
|
7884
|
+
minArgs: 1,
|
|
7885
|
+
maxArgs: INF,
|
|
7886
|
+
apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
|
|
7887
|
+
},
|
|
7888
|
+
abs: {
|
|
7889
|
+
minArgs: 1,
|
|
7890
|
+
maxArgs: 1,
|
|
7891
|
+
apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
|
|
7892
|
+
},
|
|
7893
|
+
floor: {
|
|
7894
|
+
minArgs: 1,
|
|
7895
|
+
maxArgs: 1,
|
|
7896
|
+
apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
|
|
7897
|
+
},
|
|
7898
|
+
ceil: {
|
|
7899
|
+
minArgs: 1,
|
|
7900
|
+
maxArgs: 1,
|
|
7901
|
+
apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
|
|
7902
|
+
},
|
|
7903
|
+
sqrt: {
|
|
7904
|
+
minArgs: 1,
|
|
7905
|
+
maxArgs: 1,
|
|
7906
|
+
apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
|
|
7907
|
+
},
|
|
7908
|
+
round: {
|
|
7909
|
+
minArgs: 1,
|
|
7910
|
+
maxArgs: 2,
|
|
7911
|
+
apply: (args) => {
|
|
7912
|
+
const x = asFiniteNumber(args[0], "round", 0);
|
|
7913
|
+
const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
|
|
7914
|
+
if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
|
|
7915
|
+
const factor = 10 ** digits;
|
|
7916
|
+
return finiteResult(Math.round(x * factor) / factor, "round");
|
|
7917
|
+
}
|
|
7918
|
+
},
|
|
7919
|
+
pow: {
|
|
7920
|
+
minArgs: 2,
|
|
7921
|
+
maxArgs: 2,
|
|
7922
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
|
|
7923
|
+
},
|
|
7924
|
+
clamp: {
|
|
7925
|
+
minArgs: 3,
|
|
7926
|
+
maxArgs: 3,
|
|
7927
|
+
apply: (args) => {
|
|
7928
|
+
const x = asFiniteNumber(args[0], "clamp", 0);
|
|
7929
|
+
const lo = asFiniteNumber(args[1], "clamp", 1);
|
|
7930
|
+
const hi = asFiniteNumber(args[2], "clamp", 2);
|
|
7931
|
+
if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
|
|
7932
|
+
return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
|
|
7933
|
+
}
|
|
7934
|
+
},
|
|
7935
|
+
avg: {
|
|
7936
|
+
minArgs: 1,
|
|
7937
|
+
maxArgs: INF,
|
|
7938
|
+
apply: (args) => {
|
|
7939
|
+
const nums = allFiniteNumbers(args, "avg");
|
|
7940
|
+
return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
|
|
7941
|
+
}
|
|
7942
|
+
},
|
|
7943
|
+
sum: {
|
|
7944
|
+
minArgs: 1,
|
|
7945
|
+
maxArgs: INF,
|
|
7946
|
+
apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
|
|
7947
|
+
},
|
|
7948
|
+
coalesce: {
|
|
7949
|
+
minArgs: 1,
|
|
7950
|
+
maxArgs: INF,
|
|
7951
|
+
apply: (args) => {
|
|
7952
|
+
for (const a of args) if (a !== null) return a;
|
|
7953
|
+
return null;
|
|
7954
|
+
}
|
|
7955
|
+
},
|
|
7956
|
+
age: {
|
|
7957
|
+
minArgs: 2,
|
|
7958
|
+
maxArgs: 2,
|
|
7959
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
|
|
7960
|
+
},
|
|
7961
|
+
convert: {
|
|
7962
|
+
minArgs: 3,
|
|
7963
|
+
maxArgs: 3,
|
|
7964
|
+
apply: (args, hooks) => {
|
|
7965
|
+
const x = asFiniteNumber(args[0], "convert", 0);
|
|
7966
|
+
const from = asString$1(args[1], "convert", 1).trim();
|
|
7967
|
+
const to = asString$1(args[2], "convert", 2).trim();
|
|
7968
|
+
if (hooks.convert) {
|
|
7969
|
+
const out = hooks.convert(x, from, to);
|
|
7970
|
+
if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
|
|
7971
|
+
return finiteResult(out, "convert");
|
|
7972
|
+
}
|
|
7973
|
+
if (from === to) return x;
|
|
7974
|
+
throw new ExpressionEvalError("convert: unit conversion table not installed");
|
|
7975
|
+
}
|
|
7976
|
+
}
|
|
7977
|
+
};
|
|
7978
|
+
Object.freeze(Object.assign(Object.create(null), table));
|
|
7979
|
+
/** The set of valid builtin names — used by the parser to reject unknown
|
|
7980
|
+
* callees at parse time (immediate author feedback). */
|
|
7981
|
+
var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
|
|
7982
|
+
/**
|
|
7983
|
+
* Pratt (precedence-climbing) parser for the safe expression mini-language.
|
|
7984
|
+
*
|
|
7985
|
+
* Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
|
|
7986
|
+
* → relational → additive → multiplicative → unary `! -` → call / primary.
|
|
7987
|
+
* Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
|
|
7988
|
+
* string validated against the builtin table at parse time, so an unknown
|
|
7989
|
+
* function is rejected immediately (author feedback) and a persisted expression
|
|
7990
|
+
* that references a since-removed builtin degrades at read.
|
|
7991
|
+
*
|
|
7992
|
+
* A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
|
|
7993
|
+
* arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
|
|
7994
|
+
*/
|
|
7995
|
+
/** Binary/logical operator precedence (higher binds tighter). */
|
|
7996
|
+
var BINARY_PRECEDENCE = {
|
|
7997
|
+
"||": 1,
|
|
7998
|
+
"&&": 2,
|
|
7999
|
+
"==": 3,
|
|
8000
|
+
"!=": 3,
|
|
8001
|
+
"<": 4,
|
|
8002
|
+
"<=": 4,
|
|
8003
|
+
">": 4,
|
|
8004
|
+
">=": 4,
|
|
8005
|
+
"+": 5,
|
|
8006
|
+
"-": 5,
|
|
8007
|
+
"*": 6,
|
|
8008
|
+
"/": 6,
|
|
8009
|
+
"%": 6
|
|
8010
|
+
};
|
|
8011
|
+
function isLogicalOp(op) {
|
|
8012
|
+
return op === "&&" || op === "||";
|
|
8013
|
+
}
|
|
8014
|
+
function isBinaryOp(op) {
|
|
8015
|
+
return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
|
|
8016
|
+
}
|
|
8017
|
+
var Parser = class {
|
|
8018
|
+
tokens;
|
|
8019
|
+
pos = 0;
|
|
8020
|
+
nodeCount = 0;
|
|
8021
|
+
identifiers = /* @__PURE__ */ new Set();
|
|
8022
|
+
callees = /* @__PURE__ */ new Set();
|
|
8023
|
+
constructor(tokens) {
|
|
8024
|
+
this.tokens = tokens;
|
|
8025
|
+
}
|
|
8026
|
+
parse() {
|
|
8027
|
+
const ast = this.parseTernary();
|
|
8028
|
+
const tok = this.peek();
|
|
8029
|
+
if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
|
|
8030
|
+
return {
|
|
8031
|
+
ast,
|
|
8032
|
+
identifiers: this.identifiers,
|
|
8033
|
+
callees: this.callees,
|
|
8034
|
+
nodeCount: this.nodeCount
|
|
8035
|
+
};
|
|
8036
|
+
}
|
|
8037
|
+
peek() {
|
|
8038
|
+
return this.tokens[this.pos];
|
|
8039
|
+
}
|
|
8040
|
+
next() {
|
|
8041
|
+
return this.tokens[this.pos++];
|
|
8042
|
+
}
|
|
8043
|
+
/** Consume a punctuator token, erroring if the next token isn't it. */
|
|
8044
|
+
expectPunct(punct) {
|
|
8045
|
+
const tok = this.peek();
|
|
8046
|
+
if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
|
|
8047
|
+
this.pos += 1;
|
|
8048
|
+
}
|
|
8049
|
+
matchPunct(punct) {
|
|
8050
|
+
const tok = this.peek();
|
|
8051
|
+
if (tok.type === "punct" && tok.punct === punct) {
|
|
8052
|
+
this.pos += 1;
|
|
8053
|
+
return true;
|
|
8054
|
+
}
|
|
8055
|
+
return false;
|
|
8056
|
+
}
|
|
8057
|
+
countNode() {
|
|
8058
|
+
this.nodeCount += 1;
|
|
8059
|
+
if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
|
|
8060
|
+
}
|
|
8061
|
+
parseTernary() {
|
|
8062
|
+
const test = this.parseBinary(1);
|
|
8063
|
+
if (this.matchPunct("?")) {
|
|
8064
|
+
const consequent = this.parseTernary();
|
|
8065
|
+
this.expectPunct(":");
|
|
8066
|
+
const alternate = this.parseTernary();
|
|
8067
|
+
this.countNode();
|
|
8068
|
+
return {
|
|
8069
|
+
kind: "conditional",
|
|
8070
|
+
test,
|
|
8071
|
+
consequent,
|
|
8072
|
+
alternate
|
|
8073
|
+
};
|
|
8074
|
+
}
|
|
8075
|
+
return test;
|
|
8076
|
+
}
|
|
8077
|
+
parseBinary(minPrec) {
|
|
8078
|
+
let left = this.parseUnary();
|
|
8079
|
+
for (;;) {
|
|
8080
|
+
const tok = this.peek();
|
|
8081
|
+
if (tok.type !== "punct") break;
|
|
8082
|
+
const prec = BINARY_PRECEDENCE[tok.punct];
|
|
8083
|
+
if (prec === void 0 || prec < minPrec) break;
|
|
8084
|
+
const op = tok.punct;
|
|
8085
|
+
this.pos += 1;
|
|
8086
|
+
const right = this.parseBinary(prec + 1);
|
|
8087
|
+
this.countNode();
|
|
8088
|
+
if (isLogicalOp(op)) left = {
|
|
8089
|
+
kind: "logical",
|
|
8090
|
+
op,
|
|
8091
|
+
left,
|
|
8092
|
+
right
|
|
8093
|
+
};
|
|
8094
|
+
else if (isBinaryOp(op)) left = {
|
|
8095
|
+
kind: "binary",
|
|
8096
|
+
op,
|
|
8097
|
+
left,
|
|
8098
|
+
right
|
|
8099
|
+
};
|
|
8100
|
+
else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
|
|
8101
|
+
}
|
|
8102
|
+
return left;
|
|
8103
|
+
}
|
|
8104
|
+
parseUnary() {
|
|
8105
|
+
const tok = this.peek();
|
|
8106
|
+
if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
|
|
8107
|
+
const op = tok.punct;
|
|
8108
|
+
this.pos += 1;
|
|
8109
|
+
const operand = this.parseUnary();
|
|
8110
|
+
this.countNode();
|
|
8111
|
+
return {
|
|
8112
|
+
kind: "unary",
|
|
8113
|
+
op,
|
|
8114
|
+
operand
|
|
8115
|
+
};
|
|
8116
|
+
}
|
|
8117
|
+
return this.parsePrimary();
|
|
8118
|
+
}
|
|
8119
|
+
parsePrimary() {
|
|
8120
|
+
const tok = this.next();
|
|
8121
|
+
switch (tok.type) {
|
|
8122
|
+
case "number":
|
|
8123
|
+
this.countNode();
|
|
8124
|
+
return {
|
|
8125
|
+
kind: "literal",
|
|
8126
|
+
value: tok.value
|
|
8127
|
+
};
|
|
8128
|
+
case "string":
|
|
8129
|
+
this.countNode();
|
|
8130
|
+
return {
|
|
8131
|
+
kind: "literal",
|
|
8132
|
+
value: tok.value
|
|
8133
|
+
};
|
|
8134
|
+
case "keyword":
|
|
8135
|
+
this.countNode();
|
|
8136
|
+
return {
|
|
8137
|
+
kind: "literal",
|
|
8138
|
+
value: tok.keyword === "null" ? null : tok.keyword === "true"
|
|
8139
|
+
};
|
|
8140
|
+
case "identifier": {
|
|
8141
|
+
const nextTok = this.peek();
|
|
8142
|
+
if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
|
|
8143
|
+
this.identifiers.add(tok.name);
|
|
8144
|
+
this.countNode();
|
|
8145
|
+
return {
|
|
8146
|
+
kind: "identifier",
|
|
8147
|
+
name: tok.name
|
|
8148
|
+
};
|
|
8149
|
+
}
|
|
8150
|
+
case "punct":
|
|
8151
|
+
if (tok.punct === "(") {
|
|
8152
|
+
const inner = this.parseTernary();
|
|
8153
|
+
this.expectPunct(")");
|
|
8154
|
+
return inner;
|
|
8155
|
+
}
|
|
8156
|
+
throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
|
|
8157
|
+
case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
|
|
8158
|
+
}
|
|
8159
|
+
}
|
|
8160
|
+
parseCall(callee, pos) {
|
|
8161
|
+
if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
|
|
8162
|
+
this.expectPunct("(");
|
|
8163
|
+
const args = [];
|
|
8164
|
+
if (!this.matchPunct(")")) for (;;) {
|
|
8165
|
+
args.push(this.parseTernary());
|
|
8166
|
+
if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
|
|
8167
|
+
if (this.matchPunct(",")) continue;
|
|
8168
|
+
this.expectPunct(")");
|
|
8169
|
+
break;
|
|
8170
|
+
}
|
|
8171
|
+
this.callees.add(callee);
|
|
8172
|
+
this.countNode();
|
|
8173
|
+
return {
|
|
8174
|
+
kind: "call",
|
|
8175
|
+
callee,
|
|
8176
|
+
args
|
|
8177
|
+
};
|
|
8178
|
+
}
|
|
8179
|
+
};
|
|
8180
|
+
/** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
|
|
8181
|
+
* `ExpressionParseError` on any lexical or grammatical failure. */
|
|
8182
|
+
function parseExpression(source) {
|
|
8183
|
+
return new Parser(tokenize(source)).parse();
|
|
8184
|
+
}
|
|
8185
|
+
Object.freeze({});
|
|
8186
|
+
/**
|
|
8187
|
+
* LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
|
|
8188
|
+
* by expr"). The cache stores BOTH successes and failures (negative caching),
|
|
8189
|
+
* so a corrupt persisted string costs exactly one tokenize+parse total — not
|
|
8190
|
+
* one per read on a hot resolve path.
|
|
8191
|
+
*
|
|
8192
|
+
* The cache is a module-level singleton: entries are pure, content-addressed
|
|
8193
|
+
* ASTs keyed by the raw source string, so sharing one instance across all
|
|
8194
|
+
* callers is safe and maximises hit rate.
|
|
8195
|
+
*/
|
|
8196
|
+
var cache = /* @__PURE__ */ new Map();
|
|
8197
|
+
function getCached(source) {
|
|
8198
|
+
const hit = cache.get(source);
|
|
8199
|
+
if (hit !== void 0) {
|
|
8200
|
+
cache.delete(source);
|
|
8201
|
+
cache.set(source, hit);
|
|
8202
|
+
return hit;
|
|
8203
|
+
}
|
|
8204
|
+
let result;
|
|
8205
|
+
try {
|
|
8206
|
+
result = {
|
|
8207
|
+
ok: true,
|
|
8208
|
+
parsed: parseExpression(source)
|
|
8209
|
+
};
|
|
8210
|
+
} catch (err) {
|
|
8211
|
+
result = {
|
|
8212
|
+
ok: false,
|
|
8213
|
+
error: err instanceof ExpressionParseError ? err.message : String(err)
|
|
8214
|
+
};
|
|
8215
|
+
}
|
|
8216
|
+
cache.set(source, result);
|
|
8217
|
+
if (cache.size > 256) {
|
|
8218
|
+
const oldest = cache.keys().next().value;
|
|
8219
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
8220
|
+
}
|
|
8221
|
+
return result;
|
|
8222
|
+
}
|
|
8223
|
+
/** Compile `source`, returning a discriminated result instead of throwing.
|
|
8224
|
+
* Used by read paths that must degrade rather than raise. LRU/negative-cached. */
|
|
8225
|
+
function compileExpressionSafe(source) {
|
|
8226
|
+
return getCached(source);
|
|
8227
|
+
}
|
|
8228
|
+
/**
|
|
8229
|
+
* Author-time validation. Returns `null` when the source is valid, else a
|
|
8230
|
+
* human-readable error message. Checks: the expression compiles; binding count
|
|
8231
|
+
* is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
|
|
8232
|
+
* is not reserved (`now`/keywords) and does not shadow a builtin; and every
|
|
8233
|
+
* FREE identifier of the AST is covered by a binding or the injected `now`.
|
|
8234
|
+
*/
|
|
8235
|
+
function validateExpressionSource(src) {
|
|
8236
|
+
const names = Object.keys(src.bindings);
|
|
8237
|
+
if (names.length > 32) return `too many bindings (${names.length} > 32)`;
|
|
8238
|
+
for (const name of names) {
|
|
8239
|
+
if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
|
|
8240
|
+
if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
|
|
8241
|
+
if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
|
|
8242
|
+
}
|
|
8243
|
+
const compiled = compileExpressionSafe(src.expr);
|
|
8244
|
+
if (!compiled.ok) return compiled.error;
|
|
8245
|
+
const bound = new Set(names);
|
|
8246
|
+
for (const id of compiled.parsed.identifiers) {
|
|
8247
|
+
if (id === "now") continue;
|
|
8248
|
+
if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
|
|
8249
|
+
}
|
|
8250
|
+
return null;
|
|
8251
|
+
}
|
|
8252
|
+
/**
|
|
7488
8253
|
* Accessory device helpers — shared across drivers.
|
|
7489
8254
|
*
|
|
7490
8255
|
* Many vendor-specific drivers register accessory child devices on
|
|
@@ -9387,7 +10152,8 @@ var MotionAnalysisResultSchema = object({
|
|
|
9387
10152
|
});
|
|
9388
10153
|
method(object({
|
|
9389
10154
|
deviceId: number(),
|
|
9390
|
-
frame: FrameInputSchema
|
|
10155
|
+
frame: FrameInputSchema.optional(),
|
|
10156
|
+
frameHandle: FrameHandleSchema.optional()
|
|
9391
10157
|
}), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
|
|
9392
10158
|
deviceId: number(),
|
|
9393
10159
|
detected: boolean(),
|
|
@@ -9634,6 +10400,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
9634
10400
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
9635
10401
|
steps: array(PipelineStepInputSchema).min(1),
|
|
9636
10402
|
frame: FrameInputSchema.optional(),
|
|
10403
|
+
/**
|
|
10404
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
10405
|
+
* the decoded pixels live in. One more member of the one-of
|
|
10406
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
10407
|
+
*/
|
|
10408
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
9637
10409
|
imageBase64: string().optional(),
|
|
9638
10410
|
/**
|
|
9639
10411
|
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
@@ -9843,6 +10615,31 @@ var ReportMotionInputSchema = object({
|
|
|
9843
10615
|
regions: array(MotionRegionSchema).readonly().optional()
|
|
9844
10616
|
});
|
|
9845
10617
|
/**
|
|
10618
|
+
* Where a runner gets a camera's decoded frames (cross-node Phase 2,
|
|
10619
|
+
* restream-owner model — P2c).
|
|
10620
|
+
*
|
|
10621
|
+
* - `local-broker` (DEFAULT): today's path — subscribe to the co-located
|
|
10622
|
+
* stream-broker's shm frame plane. Every pre-P2c attach payload (no
|
|
10623
|
+
* `frameSource` key) parses to this, so the field is additive with zero
|
|
10624
|
+
* behavior change.
|
|
10625
|
+
* - `remote-restream`: the detect node is NOT the camera's source-owner.
|
|
10626
|
+
* The runner acquires the owner's COMPRESSED passthrough restream
|
|
10627
|
+
* (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
|
|
10628
|
+
* double-pull guard) and decodes LOCALLY via a satellite frame plane +
|
|
10629
|
+
* pull-mode decoder session pinned to its own node. The shm ring stays
|
|
10630
|
+
* node-local; only H.264/H.265 packets cross the wire.
|
|
10631
|
+
* `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
|
|
10632
|
+
* when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
|
|
10633
|
+
* dials for the owner's restream.
|
|
10634
|
+
*/
|
|
10635
|
+
var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
|
|
10636
|
+
kind: literal("remote-restream"),
|
|
10637
|
+
/** The camera's source-owner node (slice 1: always the hub). */
|
|
10638
|
+
ownerNodeId: string(),
|
|
10639
|
+
/** Operator override for the owner host the runner dials. */
|
|
10640
|
+
hubHostnameOverride: string().optional()
|
|
10641
|
+
})]).describe("Per-camera frame-source mode for the runner (P2c)");
|
|
10642
|
+
/**
|
|
9846
10643
|
* Camera assignment payload sent by `addon-pipeline-orchestrator` to a
|
|
9847
10644
|
* specific runner instance via `attachCamera`. Carries everything the
|
|
9848
10645
|
* runner needs to subscribe to the local broker and execute inference.
|
|
@@ -9940,7 +10737,15 @@ var RunnerCameraConfigSchema = object({
|
|
|
9940
10737
|
*/
|
|
9941
10738
|
onboardMotionDrivesAnalyzer: boolean().default(true),
|
|
9942
10739
|
occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
|
|
9943
|
-
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
|
|
10740
|
+
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
|
|
10741
|
+
/**
|
|
10742
|
+
* Where this runner gets the camera's decoded frames (P2c). Defaulted so
|
|
10743
|
+
* every existing payload behaves as `local-broker` — the pre-Phase-2 path.
|
|
10744
|
+
* Populated with `remote-restream` by the orchestrator ONLY when the
|
|
10745
|
+
* camera's detect node differs from its source-owner (P2d, gated by the
|
|
10746
|
+
* `remoteSourcingNodes` rollout setting).
|
|
10747
|
+
*/
|
|
10748
|
+
frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
|
|
9944
10749
|
});
|
|
9945
10750
|
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;
|
|
9946
10751
|
/**
|
|
@@ -10305,6 +11110,113 @@ object({
|
|
|
10305
11110
|
lastFetchedAt: number()
|
|
10306
11111
|
});
|
|
10307
11112
|
DeviceType.Sensor;
|
|
11113
|
+
/**
|
|
11114
|
+
* Feeder connectivity / power status — mirrors the HA petkit device-status
|
|
11115
|
+
* enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
|
|
11116
|
+
* `on_batteries` (running on battery backup). `null` until first reported.
|
|
11117
|
+
*/
|
|
11118
|
+
var PetFeederDeviceStatusSchema = _enum([
|
|
11119
|
+
"normal",
|
|
11120
|
+
"offline",
|
|
11121
|
+
"on_batteries"
|
|
11122
|
+
]);
|
|
11123
|
+
var gramsPortion = number().int().min(4).max(200);
|
|
11124
|
+
object({
|
|
11125
|
+
/** Food currently in the bowl (grams). Null when the device has not
|
|
11126
|
+
* reported a reading yet. On dual-hopper models this is the combined
|
|
11127
|
+
* bowl reading; per-hopper levels live in `food1`/`food2`. */
|
|
11128
|
+
foodLevel: number().nullable(),
|
|
11129
|
+
/** Hopper-1 food level (grams) on dual-hopper feeders; null on
|
|
11130
|
+
* single-hopper models. */
|
|
11131
|
+
food1: number().nullable(),
|
|
11132
|
+
/** Hopper-2 food level (grams) on dual-hopper feeders; null on
|
|
11133
|
+
* single-hopper models. */
|
|
11134
|
+
food2: number().nullable(),
|
|
11135
|
+
/** Derived low-food flag — mirrors the HA `food_level` binary_sensor
|
|
11136
|
+
* (`device_class: problem`, on = low). True when the bowl is empty /
|
|
11137
|
+
* below the feeder's low threshold. */
|
|
11138
|
+
lowFood: boolean(),
|
|
11139
|
+
/** Battery charge 0..100 (%). Null on mains-powered models or when the
|
|
11140
|
+
* device has no battery reading. */
|
|
11141
|
+
batteryPower: number().min(0).max(100).nullable(),
|
|
11142
|
+
/** Days of desiccant life remaining. Null when the model has no
|
|
11143
|
+
* desiccant sensor. */
|
|
11144
|
+
desiccantLeftDays: number().nullable(),
|
|
11145
|
+
/** True while a feed is in progress. */
|
|
11146
|
+
feeding: boolean(),
|
|
11147
|
+
/** Decoded connectivity / power status (HA petkit device-status enum).
|
|
11148
|
+
* Null until the device has reported a status. */
|
|
11149
|
+
status: PetFeederDeviceStatusSchema.nullable(),
|
|
11150
|
+
/** Decoded human-readable fault message. Null (or the device's `no_error`
|
|
11151
|
+
* sentinel) means healthy; a non-null string is an active fault. Pairs
|
|
11152
|
+
* with `errorCode` for consumers that want the raw integer. */
|
|
11153
|
+
error: string().nullable(),
|
|
11154
|
+
/** Raw device error code (0 / null = no error). */
|
|
11155
|
+
errorCode: number().nullable(),
|
|
11156
|
+
/** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
|
|
11157
|
+
isDualHopper: boolean(),
|
|
11158
|
+
/** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
|
|
11159
|
+
childLock: boolean(),
|
|
11160
|
+
/** Front indicator-light setting. */
|
|
11161
|
+
indicatorLight: boolean(),
|
|
11162
|
+
/** Play a chime when dispensing. */
|
|
11163
|
+
feedSound: boolean(),
|
|
11164
|
+
/** Speaker / prompt volume level (device-scaled integer). */
|
|
11165
|
+
volume: number(),
|
|
11166
|
+
/** Ms epoch when the slice was last refreshed from the cloud. */
|
|
11167
|
+
lastFetchedAt: number()
|
|
11168
|
+
});
|
|
11169
|
+
DeviceType.PetFeeder, method(object({
|
|
11170
|
+
deviceId: number().int().nonnegative(),
|
|
11171
|
+
grams: gramsPortion.optional(),
|
|
11172
|
+
hopper1: gramsPortion.optional(),
|
|
11173
|
+
hopper2: gramsPortion.optional()
|
|
11174
|
+
}), _void(), {
|
|
11175
|
+
kind: "mutation",
|
|
11176
|
+
auth: "admin"
|
|
11177
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11178
|
+
kind: "mutation",
|
|
11179
|
+
auth: "admin"
|
|
11180
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11181
|
+
kind: "mutation",
|
|
11182
|
+
auth: "admin"
|
|
11183
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11184
|
+
kind: "mutation",
|
|
11185
|
+
auth: "admin"
|
|
11186
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11187
|
+
kind: "mutation",
|
|
11188
|
+
auth: "admin"
|
|
11189
|
+
}), method(object({
|
|
11190
|
+
deviceId: number().int().nonnegative(),
|
|
11191
|
+
soundId: number().int().nonnegative()
|
|
11192
|
+
}), _void(), {
|
|
11193
|
+
kind: "mutation",
|
|
11194
|
+
auth: "admin"
|
|
11195
|
+
}), method(object({
|
|
11196
|
+
deviceId: number().int().nonnegative(),
|
|
11197
|
+
on: boolean()
|
|
11198
|
+
}), _void(), {
|
|
11199
|
+
kind: "mutation",
|
|
11200
|
+
auth: "admin"
|
|
11201
|
+
}), method(object({
|
|
11202
|
+
deviceId: number().int().nonnegative(),
|
|
11203
|
+
on: boolean()
|
|
11204
|
+
}), _void(), {
|
|
11205
|
+
kind: "mutation",
|
|
11206
|
+
auth: "admin"
|
|
11207
|
+
}), method(object({
|
|
11208
|
+
deviceId: number().int().nonnegative(),
|
|
11209
|
+
on: boolean()
|
|
11210
|
+
}), _void(), {
|
|
11211
|
+
kind: "mutation",
|
|
11212
|
+
auth: "admin"
|
|
11213
|
+
}), method(object({
|
|
11214
|
+
deviceId: number().int().nonnegative(),
|
|
11215
|
+
level: number().int().nonnegative()
|
|
11216
|
+
}), _void(), {
|
|
11217
|
+
kind: "mutation",
|
|
11218
|
+
auth: "admin"
|
|
11219
|
+
});
|
|
10308
11220
|
object({
|
|
10309
11221
|
/** Instantaneous power draw in watts. */
|
|
10310
11222
|
watts: number().optional(),
|
|
@@ -12132,10 +13044,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
|
|
|
12132
13044
|
url: string()
|
|
12133
13045
|
}), _void()), method(object({
|
|
12134
13046
|
sessionId: string(),
|
|
12135
|
-
maxCount: number().default(1)
|
|
13047
|
+
maxCount: number().default(1),
|
|
13048
|
+
waitMs: number().optional()
|
|
12136
13049
|
}), array(DecodedFrameSchema)), method(object({
|
|
12137
13050
|
sessionId: string(),
|
|
12138
|
-
maxCount: number().default(1)
|
|
13051
|
+
maxCount: number().default(1),
|
|
13052
|
+
waitMs: number().optional()
|
|
12139
13053
|
}), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
|
|
12140
13054
|
sessionId: string(),
|
|
12141
13055
|
config: DecoderSessionConfigSchema.partial()
|
|
@@ -12447,14 +13361,63 @@ var ChildLayoutEntrySchema = object({
|
|
|
12447
13361
|
collapsed: boolean().optional()
|
|
12448
13362
|
});
|
|
12449
13363
|
/** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
|
|
12450
|
-
* `device-management.ts`.
|
|
13364
|
+
* `device-management.ts`. Source is a union: a FIELD source copies a sibling
|
|
13365
|
+
* accessory's status field (`kind` optional/absent for wire compat); a
|
|
13366
|
+
* LITERAL source carries a per-device constant (no sibling is read); a
|
|
13367
|
+
* GLOBAL source (P2e) copies ANY device's status field, addressed by the
|
|
13368
|
+
* source device's full re-sync-stable `stableId`. */
|
|
13369
|
+
var DeviceLinkFieldSourceSchema = object({
|
|
13370
|
+
kind: literal("field").optional(),
|
|
13371
|
+
sourceKey: string(),
|
|
13372
|
+
cap: string(),
|
|
13373
|
+
fieldPath: string()
|
|
13374
|
+
});
|
|
13375
|
+
var DeviceLinkLiteralSourceSchema = object({
|
|
13376
|
+
kind: literal("literal"),
|
|
13377
|
+
value: union([
|
|
13378
|
+
string(),
|
|
13379
|
+
number(),
|
|
13380
|
+
boolean(),
|
|
13381
|
+
_null()
|
|
13382
|
+
])
|
|
13383
|
+
});
|
|
13384
|
+
var DeviceLinkGlobalSourceSchema = object({
|
|
13385
|
+
kind: literal("global"),
|
|
13386
|
+
sourceStableId: string(),
|
|
13387
|
+
cap: string(),
|
|
13388
|
+
fieldPath: string()
|
|
13389
|
+
});
|
|
13390
|
+
/** Expression source (Stage X): compute the target field from N named bindings
|
|
13391
|
+
* via the safe expression engine. Bindings are field | literal | global — never
|
|
13392
|
+
* another expression (no nesting). The `superRefine` runs the SAME author-time
|
|
13393
|
+
* validation as `validateExpressionSource` (compiles the expr, checks binding
|
|
13394
|
+
* names + identifier coverage) so every wire boundary that parses a DeviceLink
|
|
13395
|
+
* (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
|
|
13396
|
+
* Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
|
|
13397
|
+
var DeviceLinkExpressionSourceSchema = object({
|
|
13398
|
+
kind: literal("expression"),
|
|
13399
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
13400
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
|
|
13401
|
+
DeviceLinkFieldSourceSchema,
|
|
13402
|
+
DeviceLinkLiteralSourceSchema,
|
|
13403
|
+
DeviceLinkGlobalSourceSchema
|
|
13404
|
+
]))
|
|
13405
|
+
}).superRefine((src, ctx) => {
|
|
13406
|
+
const err = validateExpressionSource(src);
|
|
13407
|
+
if (err !== null) ctx.addIssue({
|
|
13408
|
+
code: "custom",
|
|
13409
|
+
message: err,
|
|
13410
|
+
path: ["expr"]
|
|
13411
|
+
});
|
|
13412
|
+
});
|
|
12451
13413
|
var DeviceLinkSchema = object({
|
|
12452
13414
|
id: string(),
|
|
12453
|
-
source:
|
|
12454
|
-
|
|
12455
|
-
|
|
12456
|
-
|
|
12457
|
-
|
|
13415
|
+
source: union([
|
|
13416
|
+
DeviceLinkFieldSourceSchema,
|
|
13417
|
+
DeviceLinkLiteralSourceSchema,
|
|
13418
|
+
DeviceLinkGlobalSourceSchema,
|
|
13419
|
+
DeviceLinkExpressionSourceSchema
|
|
13420
|
+
]),
|
|
12458
13421
|
target: object({
|
|
12459
13422
|
cap: string(),
|
|
12460
13423
|
fieldPath: string(),
|
|
@@ -12483,6 +13446,31 @@ var DeviceLinkSchema = object({
|
|
|
12483
13446
|
})
|
|
12484
13447
|
]).optional()
|
|
12485
13448
|
});
|
|
13449
|
+
/** Cap-wire shape of a per-cap display refinement — mirrors
|
|
13450
|
+
* `DeviceCapDisplayOverride` in `device-management.ts`. */
|
|
13451
|
+
var DeviceCapDisplayOverrideSchema = object({
|
|
13452
|
+
unit: string().min(1).optional(),
|
|
13453
|
+
precision: number().int().min(0).max(10).optional()
|
|
13454
|
+
});
|
|
13455
|
+
/** Cap-wire shape of an operator-authored per-device display override —
|
|
13456
|
+
* mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
|
|
13457
|
+
* bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
|
|
13458
|
+
var DeviceDisplayOverrideSchema = object({
|
|
13459
|
+
icon: string().min(1).optional(),
|
|
13460
|
+
label: string().min(1).optional(),
|
|
13461
|
+
unit: string().min(1).optional(),
|
|
13462
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13463
|
+
hidden: boolean().optional(),
|
|
13464
|
+
perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
|
|
13465
|
+
});
|
|
13466
|
+
/** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
|
|
13467
|
+
* in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
|
|
13468
|
+
* the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
|
|
13469
|
+
var RoleDisplayDefaultSchema = object({
|
|
13470
|
+
unit: string().min(1).optional(),
|
|
13471
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13472
|
+
icon: string().min(1).optional()
|
|
13473
|
+
});
|
|
12486
13474
|
/**
|
|
12487
13475
|
* Serializable projection of a live IDevice.
|
|
12488
13476
|
* Returned by listAll, getDevice, getChildren.
|
|
@@ -12538,7 +13526,9 @@ var DeviceInfoSchema = object({
|
|
|
12538
13526
|
* `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
|
|
12539
13527
|
childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
|
|
12540
13528
|
/** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
|
|
12541
|
-
deviceLinks: array(DeviceLinkSchema).readonly().optional()
|
|
13529
|
+
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
13530
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13531
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12542
13532
|
});
|
|
12543
13533
|
var ConfigEntrySchema = object({
|
|
12544
13534
|
key: string(),
|
|
@@ -12603,7 +13593,9 @@ var DeviceMetaSchema = object({
|
|
|
12603
13593
|
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
12604
13594
|
/** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
|
|
12605
13595
|
* Optional: only present for accessory children that carry a known role. */
|
|
12606
|
-
role: string().nullable().optional()
|
|
13596
|
+
role: string().nullable().optional(),
|
|
13597
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13598
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12607
13599
|
});
|
|
12608
13600
|
/** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
|
|
12609
13601
|
var ConfigUISchemaOutput = unknown().nullable();
|
|
@@ -12697,7 +13689,19 @@ method(object({
|
|
|
12697
13689
|
}), _void(), {
|
|
12698
13690
|
kind: "mutation",
|
|
12699
13691
|
auth: "admin"
|
|
12700
|
-
}), method(object({
|
|
13692
|
+
}), method(object({
|
|
13693
|
+
deviceId: number(),
|
|
13694
|
+
display: DeviceDisplayOverrideSchema.nullable()
|
|
13695
|
+
}), _void(), {
|
|
13696
|
+
kind: "mutation",
|
|
13697
|
+
auth: "admin"
|
|
13698
|
+
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
13699
|
+
kind: "mutation",
|
|
13700
|
+
auth: "admin"
|
|
13701
|
+
}), method(object({
|
|
13702
|
+
deviceId: number(),
|
|
13703
|
+
includeSynthesizable: boolean().optional()
|
|
13704
|
+
}), object({ caps: array(object({
|
|
12701
13705
|
cap: string(),
|
|
12702
13706
|
fields: array(object({
|
|
12703
13707
|
path: string(),
|
|
@@ -12707,8 +13711,13 @@ method(object({
|
|
|
12707
13711
|
"boolean",
|
|
12708
13712
|
"enum"
|
|
12709
13713
|
]),
|
|
12710
|
-
enumValues: array(string()).optional()
|
|
12711
|
-
|
|
13714
|
+
enumValues: array(string()).optional(),
|
|
13715
|
+
item: boolean().optional()
|
|
13716
|
+
})).readonly(),
|
|
13717
|
+
itemArray: object({
|
|
13718
|
+
path: string(),
|
|
13719
|
+
keyField: string()
|
|
13720
|
+
}).optional()
|
|
12712
13721
|
})).readonly() }), { kind: "query" }), method(object({
|
|
12713
13722
|
deviceId: number(),
|
|
12714
13723
|
role: string().nullable()
|
|
@@ -12778,7 +13787,11 @@ method(object({
|
|
|
12778
13787
|
deviceId: number(),
|
|
12779
13788
|
entries: array(object({
|
|
12780
13789
|
capName: string(),
|
|
12781
|
-
kind: _enum([
|
|
13790
|
+
kind: _enum([
|
|
13791
|
+
"native",
|
|
13792
|
+
"wrapped",
|
|
13793
|
+
"linked"
|
|
13794
|
+
]),
|
|
12782
13795
|
providerAddonId: string(),
|
|
12783
13796
|
providerNodeId: string(),
|
|
12784
13797
|
nativeAddonId: string()
|
|
@@ -12787,7 +13800,11 @@ method(object({
|
|
|
12787
13800
|
deviceId: number(),
|
|
12788
13801
|
entries: array(object({
|
|
12789
13802
|
capName: string(),
|
|
12790
|
-
kind: _enum([
|
|
13803
|
+
kind: _enum([
|
|
13804
|
+
"native",
|
|
13805
|
+
"wrapped",
|
|
13806
|
+
"linked"
|
|
13807
|
+
]),
|
|
12791
13808
|
providerAddonId: string(),
|
|
12792
13809
|
providerNodeId: string(),
|
|
12793
13810
|
nativeAddonId: string()
|
|
@@ -13277,7 +14294,7 @@ var AddBrokerInputSchema = object({
|
|
|
13277
14294
|
});
|
|
13278
14295
|
var AddBrokerResultSchema = object({ id: string() });
|
|
13279
14296
|
var IdInputSchema = object({ id: string() });
|
|
13280
|
-
var TestResultSchema = discriminatedUnion("ok", [object({
|
|
14297
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
13281
14298
|
ok: literal(true),
|
|
13282
14299
|
latencyMs: number()
|
|
13283
14300
|
}), object({
|
|
@@ -13300,7 +14317,7 @@ var StatusSchema = object({
|
|
|
13300
14317
|
brokerCount: number(),
|
|
13301
14318
|
embeddedRunning: boolean()
|
|
13302
14319
|
});
|
|
13303
|
-
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);
|
|
14320
|
+
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);
|
|
13304
14321
|
var NetworkEndpointSchema = object({
|
|
13305
14322
|
url: string(),
|
|
13306
14323
|
hostname: string(),
|
|
@@ -13334,23 +14351,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
|
13334
14351
|
sourcePort: number().optional()
|
|
13335
14352
|
});
|
|
13336
14353
|
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
13337
|
-
|
|
13338
|
-
|
|
14354
|
+
/**
|
|
14355
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14356
|
+
*
|
|
14357
|
+
* Apprise-derived model (see
|
|
14358
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14359
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14360
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14361
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14362
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14363
|
+
*
|
|
14364
|
+
* DESIGN DECISIONS (locked):
|
|
14365
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14366
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14367
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14368
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14369
|
+
* alternative would fork the UI per addon and cannot host the
|
|
14370
|
+
* discovery→adopt flow.
|
|
14371
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14372
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14373
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14374
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14375
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
14376
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14377
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14378
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14379
|
+
* base64 fallback needed.
|
|
14380
|
+
*
|
|
14381
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14382
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14383
|
+
* admin "Integrations" page.
|
|
14384
|
+
*/
|
|
14385
|
+
/**
|
|
14386
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14387
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14388
|
+
*/
|
|
14389
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14390
|
+
"image",
|
|
14391
|
+
"video",
|
|
14392
|
+
"gif",
|
|
14393
|
+
"audio",
|
|
14394
|
+
"icon"
|
|
14395
|
+
]);
|
|
14396
|
+
/**
|
|
14397
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14398
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14399
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14400
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14401
|
+
*/
|
|
14402
|
+
var AttachmentSchema = object({
|
|
14403
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14404
|
+
url: string().optional(),
|
|
14405
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14406
|
+
mime: string().optional(),
|
|
14407
|
+
name: string().optional()
|
|
14408
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14409
|
+
var NotificationFormatSchema = _enum([
|
|
14410
|
+
"text",
|
|
14411
|
+
"markdown",
|
|
14412
|
+
"html"
|
|
14413
|
+
]);
|
|
14414
|
+
/** A single tap-through action button. */
|
|
14415
|
+
var NotificationActionSchema = object({
|
|
14416
|
+
id: string(),
|
|
14417
|
+
label: string(),
|
|
14418
|
+
url: string().optional()
|
|
14419
|
+
});
|
|
14420
|
+
/**
|
|
14421
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14422
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14423
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14424
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14425
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14426
|
+
* `priority` for that one target.
|
|
14427
|
+
*/
|
|
14428
|
+
var NotificationSchema = object({
|
|
13339
14429
|
body: string(),
|
|
13340
|
-
|
|
14430
|
+
title: string().optional(),
|
|
14431
|
+
format: NotificationFormatSchema.default("text"),
|
|
14432
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14433
|
+
level: string().optional(),
|
|
14434
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14435
|
+
clickUrl: string().optional(),
|
|
14436
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14437
|
+
sound: string().optional(),
|
|
14438
|
+
ttl: number().optional(),
|
|
14439
|
+
tag: string().optional(),
|
|
13341
14440
|
deviceId: number().optional(),
|
|
13342
14441
|
eventId: string().optional(),
|
|
13343
|
-
priority: _enum([
|
|
13344
|
-
"low",
|
|
13345
|
-
"normal",
|
|
13346
|
-
"high",
|
|
13347
|
-
"critical"
|
|
13348
|
-
]).default("normal"),
|
|
13349
14442
|
metadata: record(string(), unknown()).optional()
|
|
13350
|
-
})
|
|
14443
|
+
});
|
|
14444
|
+
/** One declared native severity/priority level for a kind. */
|
|
14445
|
+
var TargetKindLevelSchema = object({
|
|
14446
|
+
id: string(),
|
|
14447
|
+
label: string(),
|
|
14448
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14449
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14450
|
+
flags: object({
|
|
14451
|
+
critical: boolean().optional(),
|
|
14452
|
+
silent: boolean().optional(),
|
|
14453
|
+
noPush: boolean().optional()
|
|
14454
|
+
}).optional(),
|
|
14455
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14456
|
+
requires: array(string()).optional(),
|
|
14457
|
+
description: string().optional()
|
|
14458
|
+
});
|
|
14459
|
+
/** The full capability block consulted before dispatch. */
|
|
14460
|
+
var TargetKindCapsSchema = object({
|
|
14461
|
+
attachments: object({
|
|
14462
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14463
|
+
mode: _enum([
|
|
14464
|
+
"url",
|
|
14465
|
+
"bytes",
|
|
14466
|
+
"both"
|
|
14467
|
+
]),
|
|
14468
|
+
max: number().int().nonnegative(),
|
|
14469
|
+
maxBytes: number().int().positive().optional()
|
|
14470
|
+
}),
|
|
14471
|
+
/** Max action buttons (0 = none). */
|
|
14472
|
+
actions: number().int().nonnegative(),
|
|
14473
|
+
levels: array(TargetKindLevelSchema),
|
|
14474
|
+
format: array(NotificationFormatSchema),
|
|
14475
|
+
clickUrl: boolean(),
|
|
14476
|
+
sound: boolean(),
|
|
14477
|
+
ttl: boolean(),
|
|
14478
|
+
bodyMaxLen: number().int().positive()
|
|
14479
|
+
});
|
|
14480
|
+
/**
|
|
14481
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14482
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14483
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14484
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14485
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14486
|
+
*/
|
|
14487
|
+
var ConfigSchemaPassthrough = unknown();
|
|
14488
|
+
var TargetKindSchema = object({
|
|
14489
|
+
kind: string(),
|
|
14490
|
+
label: string(),
|
|
14491
|
+
icon: string(),
|
|
14492
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14493
|
+
addonId: string(),
|
|
14494
|
+
configSchema: ConfigSchemaPassthrough,
|
|
14495
|
+
supportsDiscovery: boolean(),
|
|
14496
|
+
caps: TargetKindCapsSchema
|
|
14497
|
+
});
|
|
14498
|
+
/**
|
|
14499
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14500
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14501
|
+
* round-trip a stored secret to the UI.
|
|
14502
|
+
*/
|
|
14503
|
+
var TargetSchema = object({
|
|
14504
|
+
id: string(),
|
|
14505
|
+
name: string(),
|
|
14506
|
+
kind: string(),
|
|
14507
|
+
addonId: string(),
|
|
14508
|
+
enabled: boolean(),
|
|
14509
|
+
config: record(string(), unknown())
|
|
14510
|
+
});
|
|
14511
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14512
|
+
var DiscoveredTargetSchema = object({
|
|
14513
|
+
kind: string(),
|
|
14514
|
+
suggestedName: string(),
|
|
14515
|
+
config: record(string(), unknown())
|
|
14516
|
+
});
|
|
14517
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14518
|
+
var RenderedAsSchema = object({
|
|
14519
|
+
level: string(),
|
|
14520
|
+
format: NotificationFormatSchema,
|
|
14521
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14522
|
+
actionsSent: number().int().nonnegative(),
|
|
14523
|
+
truncated: boolean(),
|
|
14524
|
+
dropped: array(string())
|
|
14525
|
+
});
|
|
14526
|
+
var SendResultSchema = object({
|
|
13351
14527
|
success: boolean(),
|
|
13352
|
-
error: string().optional()
|
|
13353
|
-
|
|
14528
|
+
error: string().optional(),
|
|
14529
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14530
|
+
});
|
|
14531
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14532
|
+
var TestResultSchema = SendResultSchema;
|
|
14533
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
14534
|
+
kind: string(),
|
|
14535
|
+
config: record(string(), unknown()).optional()
|
|
14536
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
14537
|
+
targetId: string(),
|
|
14538
|
+
notification: NotificationSchema
|
|
14539
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
14540
|
+
targetId: string(),
|
|
14541
|
+
sample: NotificationSchema.optional()
|
|
14542
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
14543
|
+
targetId: string(),
|
|
14544
|
+
enabled: boolean()
|
|
14545
|
+
}), _void(), { kind: "mutation" });
|
|
13354
14546
|
/**
|
|
13355
14547
|
* Zod schemas for persisted record types.
|
|
13356
14548
|
*
|
|
@@ -16372,7 +17564,10 @@ var HwAccelBackendInputSchema = _enum([
|
|
|
16372
17564
|
"webgpu",
|
|
16373
17565
|
"none"
|
|
16374
17566
|
]).nullable().optional();
|
|
16375
|
-
var HwAccelResolutionSchema = object({
|
|
17567
|
+
var HwAccelResolutionSchema = object({
|
|
17568
|
+
preferred: array(string()).readonly(),
|
|
17569
|
+
rationale: string()
|
|
17570
|
+
});
|
|
16376
17571
|
var HardwareEncoderIdSchema = _enum([
|
|
16377
17572
|
"h264_videotoolbox",
|
|
16378
17573
|
"hevc_videotoolbox",
|
|
@@ -16477,10 +17672,7 @@ var ResolvedInferenceConfigSchema = object({
|
|
|
16477
17672
|
format: ModelFormatSchema,
|
|
16478
17673
|
reason: string()
|
|
16479
17674
|
});
|
|
16480
|
-
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
|
|
16481
|
-
prefer: HwAccelBackendInputSchema,
|
|
16482
|
-
nodeId: string().optional()
|
|
16483
|
-
}), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
17675
|
+
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
16484
17676
|
kind: "mutation",
|
|
16485
17677
|
auth: "admin"
|
|
16486
17678
|
}), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
|
|
@@ -16539,6 +17731,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
|
|
|
16539
17731
|
kind: "mutation",
|
|
16540
17732
|
auth: "admin"
|
|
16541
17733
|
});
|
|
17734
|
+
/**
|
|
17735
|
+
* `recording` cap — footage availability + HLS playback manifests + per-device
|
|
17736
|
+
* recording config. NOTE on events (source of truth, R5/C3): this cap carries
|
|
17737
|
+
* NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
|
|
17738
|
+
* events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
|
|
17739
|
+
* rows); the recorder's internal EventMap markers are ephemeral in-RAM
|
|
17740
|
+
* annotations that are not exposed here and must not be treated as an event
|
|
17741
|
+
* feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
|
|
17742
|
+
* (`interfaces/recording-config.ts`).
|
|
17743
|
+
*/
|
|
16542
17744
|
var RecordingStatusSchema = object({
|
|
16543
17745
|
deviceId: number(),
|
|
16544
17746
|
enabled: boolean(),
|
|
@@ -18175,6 +19377,12 @@ Object.freeze({
|
|
|
18175
19377
|
addonId: null,
|
|
18176
19378
|
access: "view"
|
|
18177
19379
|
},
|
|
19380
|
+
"deviceManager.getRoleDisplayDefaults": {
|
|
19381
|
+
capName: "device-manager",
|
|
19382
|
+
capScope: "system",
|
|
19383
|
+
addonId: null,
|
|
19384
|
+
access: "view"
|
|
19385
|
+
},
|
|
18178
19386
|
"deviceManager.getSettingsSchema": {
|
|
18179
19387
|
capName: "device-manager",
|
|
18180
19388
|
capScope: "system",
|
|
@@ -18325,6 +19533,12 @@ Object.freeze({
|
|
|
18325
19533
|
addonId: null,
|
|
18326
19534
|
access: "create"
|
|
18327
19535
|
},
|
|
19536
|
+
"deviceManager.setDisplay": {
|
|
19537
|
+
capName: "device-manager",
|
|
19538
|
+
capScope: "system",
|
|
19539
|
+
addonId: null,
|
|
19540
|
+
access: "create"
|
|
19541
|
+
},
|
|
18328
19542
|
"deviceManager.setIntegrationId": {
|
|
18329
19543
|
capName: "device-manager",
|
|
18330
19544
|
capScope: "system",
|
|
@@ -18367,6 +19581,12 @@ Object.freeze({
|
|
|
18367
19581
|
addonId: null,
|
|
18368
19582
|
access: "create"
|
|
18369
19583
|
},
|
|
19584
|
+
"deviceManager.setRoleDisplayDefaults": {
|
|
19585
|
+
capName: "device-manager",
|
|
19586
|
+
capScope: "system",
|
|
19587
|
+
addonId: null,
|
|
19588
|
+
access: "create"
|
|
19589
|
+
},
|
|
18370
19590
|
"deviceManager.setStreamProfileMap": {
|
|
18371
19591
|
capName: "device-manager",
|
|
18372
19592
|
capScope: "system",
|
|
@@ -19345,13 +20565,49 @@ Object.freeze({
|
|
|
19345
20565
|
addonId: null,
|
|
19346
20566
|
access: "create"
|
|
19347
20567
|
},
|
|
20568
|
+
"notificationOutput.deleteTarget": {
|
|
20569
|
+
capName: "notification-output",
|
|
20570
|
+
capScope: "system",
|
|
20571
|
+
addonId: null,
|
|
20572
|
+
access: "delete"
|
|
20573
|
+
},
|
|
20574
|
+
"notificationOutput.discoverTargets": {
|
|
20575
|
+
capName: "notification-output",
|
|
20576
|
+
capScope: "system",
|
|
20577
|
+
addonId: null,
|
|
20578
|
+
access: "view"
|
|
20579
|
+
},
|
|
20580
|
+
"notificationOutput.listTargetKinds": {
|
|
20581
|
+
capName: "notification-output",
|
|
20582
|
+
capScope: "system",
|
|
20583
|
+
addonId: null,
|
|
20584
|
+
access: "view"
|
|
20585
|
+
},
|
|
20586
|
+
"notificationOutput.listTargets": {
|
|
20587
|
+
capName: "notification-output",
|
|
20588
|
+
capScope: "system",
|
|
20589
|
+
addonId: null,
|
|
20590
|
+
access: "view"
|
|
20591
|
+
},
|
|
19348
20592
|
"notificationOutput.send": {
|
|
19349
20593
|
capName: "notification-output",
|
|
19350
20594
|
capScope: "system",
|
|
19351
20595
|
addonId: null,
|
|
19352
20596
|
access: "create"
|
|
19353
20597
|
},
|
|
19354
|
-
"notificationOutput.
|
|
20598
|
+
"notificationOutput.setTargetEnabled": {
|
|
20599
|
+
capName: "notification-output",
|
|
20600
|
+
capScope: "system",
|
|
20601
|
+
addonId: null,
|
|
20602
|
+
access: "create"
|
|
20603
|
+
},
|
|
20604
|
+
"notificationOutput.testTarget": {
|
|
20605
|
+
capName: "notification-output",
|
|
20606
|
+
capScope: "system",
|
|
20607
|
+
addonId: null,
|
|
20608
|
+
access: "create"
|
|
20609
|
+
},
|
|
20610
|
+
"notificationOutput.upsertTarget": {
|
|
19355
20611
|
capName: "notification-output",
|
|
19356
20612
|
capScope: "system",
|
|
19357
20613
|
addonId: null,
|
|
@@ -19381,6 +20637,66 @@ Object.freeze({
|
|
|
19381
20637
|
addonId: null,
|
|
19382
20638
|
access: "create"
|
|
19383
20639
|
},
|
|
20640
|
+
"petFeeder.callPet": {
|
|
20641
|
+
capName: "pet-feeder",
|
|
20642
|
+
capScope: "device",
|
|
20643
|
+
addonId: null,
|
|
20644
|
+
access: "create"
|
|
20645
|
+
},
|
|
20646
|
+
"petFeeder.cancelFeed": {
|
|
20647
|
+
capName: "pet-feeder",
|
|
20648
|
+
capScope: "device",
|
|
20649
|
+
addonId: null,
|
|
20650
|
+
access: "create"
|
|
20651
|
+
},
|
|
20652
|
+
"petFeeder.feed": {
|
|
20653
|
+
capName: "pet-feeder",
|
|
20654
|
+
capScope: "device",
|
|
20655
|
+
addonId: null,
|
|
20656
|
+
access: "create"
|
|
20657
|
+
},
|
|
20658
|
+
"petFeeder.markFoodReplenished": {
|
|
20659
|
+
capName: "pet-feeder",
|
|
20660
|
+
capScope: "device",
|
|
20661
|
+
addonId: null,
|
|
20662
|
+
access: "create"
|
|
20663
|
+
},
|
|
20664
|
+
"petFeeder.playSound": {
|
|
20665
|
+
capName: "pet-feeder",
|
|
20666
|
+
capScope: "device",
|
|
20667
|
+
addonId: null,
|
|
20668
|
+
access: "create"
|
|
20669
|
+
},
|
|
20670
|
+
"petFeeder.resetDesiccant": {
|
|
20671
|
+
capName: "pet-feeder",
|
|
20672
|
+
capScope: "device",
|
|
20673
|
+
addonId: null,
|
|
20674
|
+
access: "delete"
|
|
20675
|
+
},
|
|
20676
|
+
"petFeeder.setChildLock": {
|
|
20677
|
+
capName: "pet-feeder",
|
|
20678
|
+
capScope: "device",
|
|
20679
|
+
addonId: null,
|
|
20680
|
+
access: "create"
|
|
20681
|
+
},
|
|
20682
|
+
"petFeeder.setFeedSound": {
|
|
20683
|
+
capName: "pet-feeder",
|
|
20684
|
+
capScope: "device",
|
|
20685
|
+
addonId: null,
|
|
20686
|
+
access: "create"
|
|
20687
|
+
},
|
|
20688
|
+
"petFeeder.setIndicatorLight": {
|
|
20689
|
+
capName: "pet-feeder",
|
|
20690
|
+
capScope: "device",
|
|
20691
|
+
addonId: null,
|
|
20692
|
+
access: "create"
|
|
20693
|
+
},
|
|
20694
|
+
"petFeeder.setVolume": {
|
|
20695
|
+
capName: "pet-feeder",
|
|
20696
|
+
capScope: "device",
|
|
20697
|
+
addonId: null,
|
|
20698
|
+
access: "create"
|
|
20699
|
+
},
|
|
19384
20700
|
"pipelineAnalytics.clearTracks": {
|
|
19385
20701
|
capName: "pipeline-analytics",
|
|
19386
20702
|
capScope: "device",
|