@camstack/addon-agent-ui 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.
package/dist/addon.js
CHANGED
|
@@ -4629,7 +4629,7 @@ function _instanceof(cls, params = {}) {
|
|
|
4629
4629
|
return inst;
|
|
4630
4630
|
}
|
|
4631
4631
|
//#endregion
|
|
4632
|
-
//#region ../types/dist/sleep-
|
|
4632
|
+
//#region ../types/dist/sleep-BiDFW0E7.mjs
|
|
4633
4633
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4634
4634
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4635
4635
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -5442,6 +5442,100 @@ function createDurableState(deps) {
|
|
|
5442
5442
|
};
|
|
5443
5443
|
}
|
|
5444
5444
|
/**
|
|
5445
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
5446
|
+
*
|
|
5447
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
5448
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
5449
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
5450
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
5451
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
5452
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
5453
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
5454
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
5455
|
+
*
|
|
5456
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
5457
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
5458
|
+
* schema and routes reads/writes through these helpers.
|
|
5459
|
+
*
|
|
5460
|
+
* ## No bare-key fallback — deliberate
|
|
5461
|
+
*
|
|
5462
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
5463
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
5464
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
5465
|
+
* the store is invisible to every node, hub included, so one node's
|
|
5466
|
+
* selection can never leak onto another. (This generalizes the
|
|
5467
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
5468
|
+
* arbitrary set of per-node field keys.)
|
|
5469
|
+
*
|
|
5470
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
5471
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
5472
|
+
*/
|
|
5473
|
+
/**
|
|
5474
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
5475
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
5476
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
5477
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
5478
|
+
*/
|
|
5479
|
+
function normalizeNodeId(raw) {
|
|
5480
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
5481
|
+
const slashIdx = raw.indexOf("/");
|
|
5482
|
+
if (slashIdx < 0) return raw;
|
|
5483
|
+
const bare = raw.slice(0, slashIdx);
|
|
5484
|
+
return bare === "" ? "hub" : bare;
|
|
5485
|
+
}
|
|
5486
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
5487
|
+
function nodeScopedKey(base, nodeId) {
|
|
5488
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
5489
|
+
}
|
|
5490
|
+
/**
|
|
5491
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
5492
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
5493
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
5494
|
+
* schema `default` win on `undefined`.
|
|
5495
|
+
*/
|
|
5496
|
+
function readNodeValue(store, base, nodeId) {
|
|
5497
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
5498
|
+
}
|
|
5499
|
+
/**
|
|
5500
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
5501
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
5502
|
+
* the write path so a save for one node never clobbers another node's value
|
|
5503
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
5504
|
+
* patch is not mutated.
|
|
5505
|
+
*/
|
|
5506
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
5507
|
+
const out = {};
|
|
5508
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
5509
|
+
return out;
|
|
5510
|
+
}
|
|
5511
|
+
/**
|
|
5512
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
5513
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
5514
|
+
* values:
|
|
5515
|
+
*
|
|
5516
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
5517
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
5518
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
5519
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
5520
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
5521
|
+
* left ABSENT so the field's schema `default` wins.
|
|
5522
|
+
*
|
|
5523
|
+
* Returns a new object — the input store is not mutated.
|
|
5524
|
+
*/
|
|
5525
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
5526
|
+
const out = {};
|
|
5527
|
+
for (const [key, value] of Object.entries(store)) {
|
|
5528
|
+
if (key.includes("@")) continue;
|
|
5529
|
+
if (perNodeKeys.has(key)) continue;
|
|
5530
|
+
out[key] = value;
|
|
5531
|
+
}
|
|
5532
|
+
for (const base of perNodeKeys) {
|
|
5533
|
+
const value = readNodeValue(store, base, nodeId);
|
|
5534
|
+
if (value !== void 0) out[base] = value;
|
|
5535
|
+
}
|
|
5536
|
+
return out;
|
|
5537
|
+
}
|
|
5538
|
+
/**
|
|
5445
5539
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5446
5540
|
*
|
|
5447
5541
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
@@ -5609,23 +5703,63 @@ var BaseAddon = class {
|
|
|
5609
5703
|
deviceSettingsSchema() {
|
|
5610
5704
|
return null;
|
|
5611
5705
|
}
|
|
5612
|
-
async getGlobalSettings(overlay, cap,
|
|
5706
|
+
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5613
5707
|
const schema = this.globalSettingsSchema(cap);
|
|
5614
5708
|
if (!schema) return { sections: [] };
|
|
5615
|
-
const
|
|
5709
|
+
const projected = await this.resolveGlobalStore(nodeId, cap);
|
|
5616
5710
|
return hydrateSchema(schema, overlay ? {
|
|
5617
|
-
...
|
|
5711
|
+
...projected,
|
|
5618
5712
|
...overlay
|
|
5619
|
-
} :
|
|
5713
|
+
} : projected);
|
|
5714
|
+
}
|
|
5715
|
+
/**
|
|
5716
|
+
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5717
|
+
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5718
|
+
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
5719
|
+
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
5720
|
+
* A no-op passthrough when the schema declares no `perNode` field.
|
|
5721
|
+
*
|
|
5722
|
+
* This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
|
|
5723
|
+
* the store for custom option logic (option narrowing, value snapping) to
|
|
5724
|
+
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
5725
|
+
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
5726
|
+
*/
|
|
5727
|
+
async resolveGlobalStore(nodeId, cap) {
|
|
5728
|
+
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
5729
|
+
const keys = this.perNodeKeys(cap);
|
|
5730
|
+
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5731
|
+
return keys.size > 0 ? projectStore(raw, keys, node) : raw;
|
|
5620
5732
|
}
|
|
5621
|
-
async updateGlobalSettings(patch,
|
|
5622
|
-
|
|
5733
|
+
async updateGlobalSettings(patch, nodeId) {
|
|
5734
|
+
const keys = this.perNodeKeys();
|
|
5735
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5736
|
+
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5737
|
+
const barePatch = patch;
|
|
5738
|
+
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
5739
|
+
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
5740
|
+
if (target !== localNode) return;
|
|
5623
5741
|
await this.resolveConfig();
|
|
5624
5742
|
await this.onConfigChanged();
|
|
5625
5743
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
5626
5744
|
this.maybeAutoRestart(patch, this.globalSettingsSchema());
|
|
5627
5745
|
}
|
|
5628
5746
|
/**
|
|
5747
|
+
* The set of field keys the global settings schema declares `perNode: true`
|
|
5748
|
+
* — derived once per `cap` argument and memoized (schemas are static
|
|
5749
|
+
* declarations). Empty set ⇒ every per-node code path is bypassed and the
|
|
5750
|
+
* settings API behaves exactly like the legacy node-agnostic one.
|
|
5751
|
+
*/
|
|
5752
|
+
_perNodeKeysCache = /* @__PURE__ */ new Map();
|
|
5753
|
+
perNodeKeys(cap) {
|
|
5754
|
+
const cacheKey = cap ?? "";
|
|
5755
|
+
const cached = this._perNodeKeysCache.get(cacheKey);
|
|
5756
|
+
if (cached) return cached;
|
|
5757
|
+
const schema = this.globalSettingsSchema(cap);
|
|
5758
|
+
const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
5759
|
+
this._perNodeKeysCache.set(cacheKey, keys);
|
|
5760
|
+
return keys;
|
|
5761
|
+
}
|
|
5762
|
+
/**
|
|
5629
5763
|
* If any field in `patch` is marked `requiresRestart` in `schema`,
|
|
5630
5764
|
* schedule an addon restart for the next tick. Deferred via
|
|
5631
5765
|
* `setImmediate` so the tRPC mutation that triggered the write has
|
|
@@ -5778,12 +5912,19 @@ var BaseAddon = class {
|
|
|
5778
5912
|
* The merge is shallow: each key in `defaults` is checked against the store.
|
|
5779
5913
|
* Only keys present in defaults are read — the store can contain extra keys
|
|
5780
5914
|
* (e.g. from older versions) without polluting the typed config.
|
|
5915
|
+
*
|
|
5916
|
+
* Keys the global settings schema declares `perNode: true` resolve from
|
|
5917
|
+
* THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
|
|
5918
|
+
* from the bare key — so a per-node field resolves to this node's own
|
|
5919
|
+
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
5781
5920
|
*/
|
|
5782
5921
|
async resolveConfig() {
|
|
5783
5922
|
const stored = await this.readAddonStoreWithRetry();
|
|
5923
|
+
const perNode = this.perNodeKeys();
|
|
5924
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5784
5925
|
const resolved = { ...this.defaults };
|
|
5785
5926
|
for (const key of Object.keys(this.defaults)) {
|
|
5786
|
-
const storedValue = stored[key];
|
|
5927
|
+
const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
|
|
5787
5928
|
if (storedValue !== void 0 && storedValue !== null) {
|
|
5788
5929
|
const defaultType = typeof this.defaults[key];
|
|
5789
5930
|
if (typeof storedValue === defaultType) resolved[key] = storedValue;
|
|
@@ -5867,6 +6008,27 @@ var BaseAddon = class {
|
|
|
5867
6008
|
}
|
|
5868
6009
|
};
|
|
5869
6010
|
/**
|
|
6011
|
+
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
6012
|
+
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
6013
|
+
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6014
|
+
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6015
|
+
*/
|
|
6016
|
+
function collectPerNodeFieldKeys(fields) {
|
|
6017
|
+
const collected = [];
|
|
6018
|
+
for (const field of fields) {
|
|
6019
|
+
if (field.type === "group") {
|
|
6020
|
+
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
6021
|
+
continue;
|
|
6022
|
+
}
|
|
6023
|
+
if (field.type === "sub-tabs") {
|
|
6024
|
+
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
6025
|
+
continue;
|
|
6026
|
+
}
|
|
6027
|
+
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
6028
|
+
}
|
|
6029
|
+
return collected;
|
|
6030
|
+
}
|
|
6031
|
+
/**
|
|
5870
6032
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
5871
6033
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
5872
6034
|
* envelopes pass through; void stays void.
|
|
@@ -5891,6 +6053,7 @@ var CamStreamKindSchema = _enum([
|
|
|
5891
6053
|
"pull-rtsp",
|
|
5892
6054
|
"pull-rtmp",
|
|
5893
6055
|
"pull-http",
|
|
6056
|
+
"pull-flv",
|
|
5894
6057
|
"pull-rfc4571",
|
|
5895
6058
|
"push-annexb",
|
|
5896
6059
|
"derived"
|
|
@@ -6273,6 +6436,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
6273
6436
|
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
6274
6437
|
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
6275
6438
|
DeviceType["Image"] = "image";
|
|
6439
|
+
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
6440
|
+
* level, battery, desiccant life, feeding state and manual-feed /
|
|
6441
|
+
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
6442
|
+
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
6443
|
+
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
6444
|
+
* integrations sharing the same food/desiccant/hopper surface. */
|
|
6445
|
+
DeviceType["PetFeeder"] = "pet-feeder";
|
|
6276
6446
|
return DeviceType;
|
|
6277
6447
|
}({});
|
|
6278
6448
|
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
@@ -7430,6 +7600,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7430
7600
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7431
7601
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7432
7602
|
/**
|
|
7603
|
+
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7604
|
+
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7605
|
+
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
7606
|
+
*/
|
|
7607
|
+
/** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
|
|
7608
|
+
* the failure is anchored to a character (author-facing inline feedback). */
|
|
7609
|
+
var ExpressionParseError = class extends Error {
|
|
7610
|
+
position;
|
|
7611
|
+
constructor(message, position) {
|
|
7612
|
+
super(message);
|
|
7613
|
+
this.name = "ExpressionParseError";
|
|
7614
|
+
this.position = position;
|
|
7615
|
+
}
|
|
7616
|
+
};
|
|
7617
|
+
/** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
|
|
7618
|
+
* result, unknown builtin, step-budget exceeded). */
|
|
7619
|
+
var ExpressionEvalError = class extends Error {
|
|
7620
|
+
constructor(message) {
|
|
7621
|
+
super(message);
|
|
7622
|
+
this.name = "ExpressionEvalError";
|
|
7623
|
+
}
|
|
7624
|
+
};
|
|
7625
|
+
/**
|
|
7626
|
+
* Resource-bound constants for the safe expression engine.
|
|
7627
|
+
*
|
|
7628
|
+
* Every bound is defense-in-depth: the grammar is non-Turing-complete (no
|
|
7629
|
+
* loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
|
|
7630
|
+
* O(nodeCount) by construction. These caps merely put a hard ceiling on the
|
|
7631
|
+
* work a single author-supplied expression can request, so a hostile or
|
|
7632
|
+
* accidental pathological string can never spend unbounded CPU/memory.
|
|
7633
|
+
*/
|
|
7634
|
+
/** Max source length (chars) — checked BEFORE tokenizing so a huge string is
|
|
7635
|
+
* rejected without allocation. */
|
|
7636
|
+
var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
|
|
7637
|
+
/** A legal binding / identifier name. */
|
|
7638
|
+
var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
7639
|
+
/** Binding names an author may NOT use: `now` is auto-injected; the literal
|
|
7640
|
+
* keywords lex as values, not identifiers, so binding to them is meaningless. */
|
|
7641
|
+
var RESERVED_BINDING_NAMES = new Set([
|
|
7642
|
+
"now",
|
|
7643
|
+
"true",
|
|
7644
|
+
"false",
|
|
7645
|
+
"null"
|
|
7646
|
+
]);
|
|
7647
|
+
/**
|
|
7648
|
+
* Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
|
|
7649
|
+
* zero-dependency. The grammar is deliberately boring: decimal numbers,
|
|
7650
|
+
* single/double-quoted strings with a tiny escape set, identifiers, the three
|
|
7651
|
+
* value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
|
|
7652
|
+
* outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
|
|
7653
|
+
* is a parse error with a source position, so member access / assignment /
|
|
7654
|
+
* template literals are lexically impossible.
|
|
7655
|
+
*/
|
|
7656
|
+
var KEYWORDS = new Set([
|
|
7657
|
+
"true",
|
|
7658
|
+
"false",
|
|
7659
|
+
"null"
|
|
7660
|
+
]);
|
|
7661
|
+
function isDigit(ch) {
|
|
7662
|
+
return ch >= "0" && ch <= "9";
|
|
7663
|
+
}
|
|
7664
|
+
function isIdentStart(ch) {
|
|
7665
|
+
return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
|
|
7666
|
+
}
|
|
7667
|
+
function isIdentPart(ch) {
|
|
7668
|
+
return isIdentStart(ch) || isDigit(ch);
|
|
7669
|
+
}
|
|
7670
|
+
function isWhitespace(ch) {
|
|
7671
|
+
return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
|
|
7672
|
+
}
|
|
7673
|
+
/** Tokenize `source` into a flat token list ending with a single `eof` token.
|
|
7674
|
+
* Throws `ExpressionParseError` on any illegal character or unterminated
|
|
7675
|
+
* string. */
|
|
7676
|
+
function tokenize(source) {
|
|
7677
|
+
if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
|
|
7678
|
+
const tokens = [];
|
|
7679
|
+
let i = 0;
|
|
7680
|
+
const n = source.length;
|
|
7681
|
+
while (i < n) {
|
|
7682
|
+
const ch = source[i];
|
|
7683
|
+
if (isWhitespace(ch)) {
|
|
7684
|
+
i += 1;
|
|
7685
|
+
continue;
|
|
7686
|
+
}
|
|
7687
|
+
if (isDigit(ch)) {
|
|
7688
|
+
const start = i;
|
|
7689
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7690
|
+
if (i < n && source[i] === ".") {
|
|
7691
|
+
if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
|
|
7692
|
+
i += 1;
|
|
7693
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7694
|
+
}
|
|
7695
|
+
const text = source.slice(start, i);
|
|
7696
|
+
const value = Number(text);
|
|
7697
|
+
if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
|
|
7698
|
+
tokens.push({
|
|
7699
|
+
type: "number",
|
|
7700
|
+
value,
|
|
7701
|
+
pos: start
|
|
7702
|
+
});
|
|
7703
|
+
continue;
|
|
7704
|
+
}
|
|
7705
|
+
if (ch === "'" || ch === "\"") {
|
|
7706
|
+
const quote = ch;
|
|
7707
|
+
const start = i;
|
|
7708
|
+
i += 1;
|
|
7709
|
+
let out = "";
|
|
7710
|
+
let closed = false;
|
|
7711
|
+
while (i < n) {
|
|
7712
|
+
const c = source[i];
|
|
7713
|
+
if (c === "\\") {
|
|
7714
|
+
const next = i + 1 < n ? source[i + 1] : "";
|
|
7715
|
+
if (next === "\\" || next === "'" || next === "\"") {
|
|
7716
|
+
out += next;
|
|
7717
|
+
i += 2;
|
|
7718
|
+
continue;
|
|
7719
|
+
}
|
|
7720
|
+
throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
|
|
7721
|
+
}
|
|
7722
|
+
if (c === quote) {
|
|
7723
|
+
closed = true;
|
|
7724
|
+
i += 1;
|
|
7725
|
+
break;
|
|
7726
|
+
}
|
|
7727
|
+
out += c;
|
|
7728
|
+
i += 1;
|
|
7729
|
+
}
|
|
7730
|
+
if (!closed) throw new ExpressionParseError("unterminated string literal", start);
|
|
7731
|
+
tokens.push({
|
|
7732
|
+
type: "string",
|
|
7733
|
+
value: out,
|
|
7734
|
+
pos: start
|
|
7735
|
+
});
|
|
7736
|
+
continue;
|
|
7737
|
+
}
|
|
7738
|
+
if (isIdentStart(ch)) {
|
|
7739
|
+
const start = i;
|
|
7740
|
+
while (i < n && isIdentPart(source[i])) i += 1;
|
|
7741
|
+
const text = source.slice(start, i);
|
|
7742
|
+
if (KEYWORDS.has(text)) tokens.push({
|
|
7743
|
+
type: "keyword",
|
|
7744
|
+
keyword: keywordOf(text),
|
|
7745
|
+
pos: start
|
|
7746
|
+
});
|
|
7747
|
+
else tokens.push({
|
|
7748
|
+
type: "identifier",
|
|
7749
|
+
name: text,
|
|
7750
|
+
pos: start
|
|
7751
|
+
});
|
|
7752
|
+
continue;
|
|
7753
|
+
}
|
|
7754
|
+
const two = i + 1 < n ? source.slice(i, i + 2) : "";
|
|
7755
|
+
if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
|
|
7756
|
+
tokens.push({
|
|
7757
|
+
type: "punct",
|
|
7758
|
+
punct: two,
|
|
7759
|
+
pos: i
|
|
7760
|
+
});
|
|
7761
|
+
i += 2;
|
|
7762
|
+
continue;
|
|
7763
|
+
}
|
|
7764
|
+
if (isSinglePunct(ch)) {
|
|
7765
|
+
tokens.push({
|
|
7766
|
+
type: "punct",
|
|
7767
|
+
punct: ch,
|
|
7768
|
+
pos: i
|
|
7769
|
+
});
|
|
7770
|
+
i += 1;
|
|
7771
|
+
continue;
|
|
7772
|
+
}
|
|
7773
|
+
throw new ExpressionParseError(`unexpected character '${ch}'`, i);
|
|
7774
|
+
}
|
|
7775
|
+
tokens.push({
|
|
7776
|
+
type: "eof",
|
|
7777
|
+
pos: n
|
|
7778
|
+
});
|
|
7779
|
+
return tokens;
|
|
7780
|
+
}
|
|
7781
|
+
function keywordOf(text) {
|
|
7782
|
+
if (text === "true") return "true";
|
|
7783
|
+
if (text === "false") return "false";
|
|
7784
|
+
return "null";
|
|
7785
|
+
}
|
|
7786
|
+
function isSinglePunct(ch) {
|
|
7787
|
+
return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
|
|
7788
|
+
}
|
|
7789
|
+
/**
|
|
7790
|
+
* Frozen, null-prototype builtin function table for the expression engine
|
|
7791
|
+
* (spec §4 rule 4). The table is the SOLE surface of callable functions: the
|
|
7792
|
+
* parser rejects any callee not in it, and the evaluator gates each call on an
|
|
7793
|
+
* own-property check against it.
|
|
7794
|
+
*
|
|
7795
|
+
* Because the object has a NULL prototype AND is `Object.freeze`d:
|
|
7796
|
+
* - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
|
|
7797
|
+
* - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
|
|
7798
|
+
* (there is no `Object.prototype` in the chain), so those names are not
|
|
7799
|
+
* callable — they are simply "unknown function" at parse time.
|
|
7800
|
+
*
|
|
7801
|
+
* Every numeric argument is validated as a finite number and every numeric
|
|
7802
|
+
* RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
|
|
7803
|
+
* (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
|
|
7804
|
+
* closed rather than emitting a garbage value.
|
|
7805
|
+
*/
|
|
7806
|
+
function asFiniteNumber(value, name, index) {
|
|
7807
|
+
if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
|
|
7808
|
+
return value;
|
|
7809
|
+
}
|
|
7810
|
+
function asString$1(value, name, index) {
|
|
7811
|
+
if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
|
|
7812
|
+
return value;
|
|
7813
|
+
}
|
|
7814
|
+
function finiteResult(value, name) {
|
|
7815
|
+
if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
|
|
7816
|
+
return value;
|
|
7817
|
+
}
|
|
7818
|
+
function allFiniteNumbers(args, name) {
|
|
7819
|
+
return args.map((a, idx) => asFiniteNumber(a, name, idx));
|
|
7820
|
+
}
|
|
7821
|
+
var INF = Number.POSITIVE_INFINITY;
|
|
7822
|
+
var table = {
|
|
7823
|
+
min: {
|
|
7824
|
+
minArgs: 1,
|
|
7825
|
+
maxArgs: INF,
|
|
7826
|
+
apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
|
|
7827
|
+
},
|
|
7828
|
+
max: {
|
|
7829
|
+
minArgs: 1,
|
|
7830
|
+
maxArgs: INF,
|
|
7831
|
+
apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
|
|
7832
|
+
},
|
|
7833
|
+
abs: {
|
|
7834
|
+
minArgs: 1,
|
|
7835
|
+
maxArgs: 1,
|
|
7836
|
+
apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
|
|
7837
|
+
},
|
|
7838
|
+
floor: {
|
|
7839
|
+
minArgs: 1,
|
|
7840
|
+
maxArgs: 1,
|
|
7841
|
+
apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
|
|
7842
|
+
},
|
|
7843
|
+
ceil: {
|
|
7844
|
+
minArgs: 1,
|
|
7845
|
+
maxArgs: 1,
|
|
7846
|
+
apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
|
|
7847
|
+
},
|
|
7848
|
+
sqrt: {
|
|
7849
|
+
minArgs: 1,
|
|
7850
|
+
maxArgs: 1,
|
|
7851
|
+
apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
|
|
7852
|
+
},
|
|
7853
|
+
round: {
|
|
7854
|
+
minArgs: 1,
|
|
7855
|
+
maxArgs: 2,
|
|
7856
|
+
apply: (args) => {
|
|
7857
|
+
const x = asFiniteNumber(args[0], "round", 0);
|
|
7858
|
+
const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
|
|
7859
|
+
if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
|
|
7860
|
+
const factor = 10 ** digits;
|
|
7861
|
+
return finiteResult(Math.round(x * factor) / factor, "round");
|
|
7862
|
+
}
|
|
7863
|
+
},
|
|
7864
|
+
pow: {
|
|
7865
|
+
minArgs: 2,
|
|
7866
|
+
maxArgs: 2,
|
|
7867
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
|
|
7868
|
+
},
|
|
7869
|
+
clamp: {
|
|
7870
|
+
minArgs: 3,
|
|
7871
|
+
maxArgs: 3,
|
|
7872
|
+
apply: (args) => {
|
|
7873
|
+
const x = asFiniteNumber(args[0], "clamp", 0);
|
|
7874
|
+
const lo = asFiniteNumber(args[1], "clamp", 1);
|
|
7875
|
+
const hi = asFiniteNumber(args[2], "clamp", 2);
|
|
7876
|
+
if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
|
|
7877
|
+
return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
|
|
7878
|
+
}
|
|
7879
|
+
},
|
|
7880
|
+
avg: {
|
|
7881
|
+
minArgs: 1,
|
|
7882
|
+
maxArgs: INF,
|
|
7883
|
+
apply: (args) => {
|
|
7884
|
+
const nums = allFiniteNumbers(args, "avg");
|
|
7885
|
+
return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
|
|
7886
|
+
}
|
|
7887
|
+
},
|
|
7888
|
+
sum: {
|
|
7889
|
+
minArgs: 1,
|
|
7890
|
+
maxArgs: INF,
|
|
7891
|
+
apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
|
|
7892
|
+
},
|
|
7893
|
+
coalesce: {
|
|
7894
|
+
minArgs: 1,
|
|
7895
|
+
maxArgs: INF,
|
|
7896
|
+
apply: (args) => {
|
|
7897
|
+
for (const a of args) if (a !== null) return a;
|
|
7898
|
+
return null;
|
|
7899
|
+
}
|
|
7900
|
+
},
|
|
7901
|
+
age: {
|
|
7902
|
+
minArgs: 2,
|
|
7903
|
+
maxArgs: 2,
|
|
7904
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
|
|
7905
|
+
},
|
|
7906
|
+
convert: {
|
|
7907
|
+
minArgs: 3,
|
|
7908
|
+
maxArgs: 3,
|
|
7909
|
+
apply: (args, hooks) => {
|
|
7910
|
+
const x = asFiniteNumber(args[0], "convert", 0);
|
|
7911
|
+
const from = asString$1(args[1], "convert", 1).trim();
|
|
7912
|
+
const to = asString$1(args[2], "convert", 2).trim();
|
|
7913
|
+
if (hooks.convert) {
|
|
7914
|
+
const out = hooks.convert(x, from, to);
|
|
7915
|
+
if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
|
|
7916
|
+
return finiteResult(out, "convert");
|
|
7917
|
+
}
|
|
7918
|
+
if (from === to) return x;
|
|
7919
|
+
throw new ExpressionEvalError("convert: unit conversion table not installed");
|
|
7920
|
+
}
|
|
7921
|
+
}
|
|
7922
|
+
};
|
|
7923
|
+
Object.freeze(Object.assign(Object.create(null), table));
|
|
7924
|
+
/** The set of valid builtin names — used by the parser to reject unknown
|
|
7925
|
+
* callees at parse time (immediate author feedback). */
|
|
7926
|
+
var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
|
|
7927
|
+
/**
|
|
7928
|
+
* Pratt (precedence-climbing) parser for the safe expression mini-language.
|
|
7929
|
+
*
|
|
7930
|
+
* Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
|
|
7931
|
+
* → relational → additive → multiplicative → unary `! -` → call / primary.
|
|
7932
|
+
* Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
|
|
7933
|
+
* string validated against the builtin table at parse time, so an unknown
|
|
7934
|
+
* function is rejected immediately (author feedback) and a persisted expression
|
|
7935
|
+
* that references a since-removed builtin degrades at read.
|
|
7936
|
+
*
|
|
7937
|
+
* A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
|
|
7938
|
+
* arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
|
|
7939
|
+
*/
|
|
7940
|
+
/** Binary/logical operator precedence (higher binds tighter). */
|
|
7941
|
+
var BINARY_PRECEDENCE = {
|
|
7942
|
+
"||": 1,
|
|
7943
|
+
"&&": 2,
|
|
7944
|
+
"==": 3,
|
|
7945
|
+
"!=": 3,
|
|
7946
|
+
"<": 4,
|
|
7947
|
+
"<=": 4,
|
|
7948
|
+
">": 4,
|
|
7949
|
+
">=": 4,
|
|
7950
|
+
"+": 5,
|
|
7951
|
+
"-": 5,
|
|
7952
|
+
"*": 6,
|
|
7953
|
+
"/": 6,
|
|
7954
|
+
"%": 6
|
|
7955
|
+
};
|
|
7956
|
+
function isLogicalOp(op) {
|
|
7957
|
+
return op === "&&" || op === "||";
|
|
7958
|
+
}
|
|
7959
|
+
function isBinaryOp(op) {
|
|
7960
|
+
return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
|
|
7961
|
+
}
|
|
7962
|
+
var Parser = class {
|
|
7963
|
+
tokens;
|
|
7964
|
+
pos = 0;
|
|
7965
|
+
nodeCount = 0;
|
|
7966
|
+
identifiers = /* @__PURE__ */ new Set();
|
|
7967
|
+
callees = /* @__PURE__ */ new Set();
|
|
7968
|
+
constructor(tokens) {
|
|
7969
|
+
this.tokens = tokens;
|
|
7970
|
+
}
|
|
7971
|
+
parse() {
|
|
7972
|
+
const ast = this.parseTernary();
|
|
7973
|
+
const tok = this.peek();
|
|
7974
|
+
if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
|
|
7975
|
+
return {
|
|
7976
|
+
ast,
|
|
7977
|
+
identifiers: this.identifiers,
|
|
7978
|
+
callees: this.callees,
|
|
7979
|
+
nodeCount: this.nodeCount
|
|
7980
|
+
};
|
|
7981
|
+
}
|
|
7982
|
+
peek() {
|
|
7983
|
+
return this.tokens[this.pos];
|
|
7984
|
+
}
|
|
7985
|
+
next() {
|
|
7986
|
+
return this.tokens[this.pos++];
|
|
7987
|
+
}
|
|
7988
|
+
/** Consume a punctuator token, erroring if the next token isn't it. */
|
|
7989
|
+
expectPunct(punct) {
|
|
7990
|
+
const tok = this.peek();
|
|
7991
|
+
if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
|
|
7992
|
+
this.pos += 1;
|
|
7993
|
+
}
|
|
7994
|
+
matchPunct(punct) {
|
|
7995
|
+
const tok = this.peek();
|
|
7996
|
+
if (tok.type === "punct" && tok.punct === punct) {
|
|
7997
|
+
this.pos += 1;
|
|
7998
|
+
return true;
|
|
7999
|
+
}
|
|
8000
|
+
return false;
|
|
8001
|
+
}
|
|
8002
|
+
countNode() {
|
|
8003
|
+
this.nodeCount += 1;
|
|
8004
|
+
if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
|
|
8005
|
+
}
|
|
8006
|
+
parseTernary() {
|
|
8007
|
+
const test = this.parseBinary(1);
|
|
8008
|
+
if (this.matchPunct("?")) {
|
|
8009
|
+
const consequent = this.parseTernary();
|
|
8010
|
+
this.expectPunct(":");
|
|
8011
|
+
const alternate = this.parseTernary();
|
|
8012
|
+
this.countNode();
|
|
8013
|
+
return {
|
|
8014
|
+
kind: "conditional",
|
|
8015
|
+
test,
|
|
8016
|
+
consequent,
|
|
8017
|
+
alternate
|
|
8018
|
+
};
|
|
8019
|
+
}
|
|
8020
|
+
return test;
|
|
8021
|
+
}
|
|
8022
|
+
parseBinary(minPrec) {
|
|
8023
|
+
let left = this.parseUnary();
|
|
8024
|
+
for (;;) {
|
|
8025
|
+
const tok = this.peek();
|
|
8026
|
+
if (tok.type !== "punct") break;
|
|
8027
|
+
const prec = BINARY_PRECEDENCE[tok.punct];
|
|
8028
|
+
if (prec === void 0 || prec < minPrec) break;
|
|
8029
|
+
const op = tok.punct;
|
|
8030
|
+
this.pos += 1;
|
|
8031
|
+
const right = this.parseBinary(prec + 1);
|
|
8032
|
+
this.countNode();
|
|
8033
|
+
if (isLogicalOp(op)) left = {
|
|
8034
|
+
kind: "logical",
|
|
8035
|
+
op,
|
|
8036
|
+
left,
|
|
8037
|
+
right
|
|
8038
|
+
};
|
|
8039
|
+
else if (isBinaryOp(op)) left = {
|
|
8040
|
+
kind: "binary",
|
|
8041
|
+
op,
|
|
8042
|
+
left,
|
|
8043
|
+
right
|
|
8044
|
+
};
|
|
8045
|
+
else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
|
|
8046
|
+
}
|
|
8047
|
+
return left;
|
|
8048
|
+
}
|
|
8049
|
+
parseUnary() {
|
|
8050
|
+
const tok = this.peek();
|
|
8051
|
+
if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
|
|
8052
|
+
const op = tok.punct;
|
|
8053
|
+
this.pos += 1;
|
|
8054
|
+
const operand = this.parseUnary();
|
|
8055
|
+
this.countNode();
|
|
8056
|
+
return {
|
|
8057
|
+
kind: "unary",
|
|
8058
|
+
op,
|
|
8059
|
+
operand
|
|
8060
|
+
};
|
|
8061
|
+
}
|
|
8062
|
+
return this.parsePrimary();
|
|
8063
|
+
}
|
|
8064
|
+
parsePrimary() {
|
|
8065
|
+
const tok = this.next();
|
|
8066
|
+
switch (tok.type) {
|
|
8067
|
+
case "number":
|
|
8068
|
+
this.countNode();
|
|
8069
|
+
return {
|
|
8070
|
+
kind: "literal",
|
|
8071
|
+
value: tok.value
|
|
8072
|
+
};
|
|
8073
|
+
case "string":
|
|
8074
|
+
this.countNode();
|
|
8075
|
+
return {
|
|
8076
|
+
kind: "literal",
|
|
8077
|
+
value: tok.value
|
|
8078
|
+
};
|
|
8079
|
+
case "keyword":
|
|
8080
|
+
this.countNode();
|
|
8081
|
+
return {
|
|
8082
|
+
kind: "literal",
|
|
8083
|
+
value: tok.keyword === "null" ? null : tok.keyword === "true"
|
|
8084
|
+
};
|
|
8085
|
+
case "identifier": {
|
|
8086
|
+
const nextTok = this.peek();
|
|
8087
|
+
if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
|
|
8088
|
+
this.identifiers.add(tok.name);
|
|
8089
|
+
this.countNode();
|
|
8090
|
+
return {
|
|
8091
|
+
kind: "identifier",
|
|
8092
|
+
name: tok.name
|
|
8093
|
+
};
|
|
8094
|
+
}
|
|
8095
|
+
case "punct":
|
|
8096
|
+
if (tok.punct === "(") {
|
|
8097
|
+
const inner = this.parseTernary();
|
|
8098
|
+
this.expectPunct(")");
|
|
8099
|
+
return inner;
|
|
8100
|
+
}
|
|
8101
|
+
throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
|
|
8102
|
+
case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
|
|
8103
|
+
}
|
|
8104
|
+
}
|
|
8105
|
+
parseCall(callee, pos) {
|
|
8106
|
+
if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
|
|
8107
|
+
this.expectPunct("(");
|
|
8108
|
+
const args = [];
|
|
8109
|
+
if (!this.matchPunct(")")) for (;;) {
|
|
8110
|
+
args.push(this.parseTernary());
|
|
8111
|
+
if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
|
|
8112
|
+
if (this.matchPunct(",")) continue;
|
|
8113
|
+
this.expectPunct(")");
|
|
8114
|
+
break;
|
|
8115
|
+
}
|
|
8116
|
+
this.callees.add(callee);
|
|
8117
|
+
this.countNode();
|
|
8118
|
+
return {
|
|
8119
|
+
kind: "call",
|
|
8120
|
+
callee,
|
|
8121
|
+
args
|
|
8122
|
+
};
|
|
8123
|
+
}
|
|
8124
|
+
};
|
|
8125
|
+
/** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
|
|
8126
|
+
* `ExpressionParseError` on any lexical or grammatical failure. */
|
|
8127
|
+
function parseExpression(source) {
|
|
8128
|
+
return new Parser(tokenize(source)).parse();
|
|
8129
|
+
}
|
|
8130
|
+
Object.freeze({});
|
|
8131
|
+
/**
|
|
8132
|
+
* LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
|
|
8133
|
+
* by expr"). The cache stores BOTH successes and failures (negative caching),
|
|
8134
|
+
* so a corrupt persisted string costs exactly one tokenize+parse total — not
|
|
8135
|
+
* one per read on a hot resolve path.
|
|
8136
|
+
*
|
|
8137
|
+
* The cache is a module-level singleton: entries are pure, content-addressed
|
|
8138
|
+
* ASTs keyed by the raw source string, so sharing one instance across all
|
|
8139
|
+
* callers is safe and maximises hit rate.
|
|
8140
|
+
*/
|
|
8141
|
+
var cache = /* @__PURE__ */ new Map();
|
|
8142
|
+
function getCached(source) {
|
|
8143
|
+
const hit = cache.get(source);
|
|
8144
|
+
if (hit !== void 0) {
|
|
8145
|
+
cache.delete(source);
|
|
8146
|
+
cache.set(source, hit);
|
|
8147
|
+
return hit;
|
|
8148
|
+
}
|
|
8149
|
+
let result;
|
|
8150
|
+
try {
|
|
8151
|
+
result = {
|
|
8152
|
+
ok: true,
|
|
8153
|
+
parsed: parseExpression(source)
|
|
8154
|
+
};
|
|
8155
|
+
} catch (err) {
|
|
8156
|
+
result = {
|
|
8157
|
+
ok: false,
|
|
8158
|
+
error: err instanceof ExpressionParseError ? err.message : String(err)
|
|
8159
|
+
};
|
|
8160
|
+
}
|
|
8161
|
+
cache.set(source, result);
|
|
8162
|
+
if (cache.size > 256) {
|
|
8163
|
+
const oldest = cache.keys().next().value;
|
|
8164
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
8165
|
+
}
|
|
8166
|
+
return result;
|
|
8167
|
+
}
|
|
8168
|
+
/** Compile `source`, returning a discriminated result instead of throwing.
|
|
8169
|
+
* Used by read paths that must degrade rather than raise. LRU/negative-cached. */
|
|
8170
|
+
function compileExpressionSafe(source) {
|
|
8171
|
+
return getCached(source);
|
|
8172
|
+
}
|
|
8173
|
+
/**
|
|
8174
|
+
* Author-time validation. Returns `null` when the source is valid, else a
|
|
8175
|
+
* human-readable error message. Checks: the expression compiles; binding count
|
|
8176
|
+
* is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
|
|
8177
|
+
* is not reserved (`now`/keywords) and does not shadow a builtin; and every
|
|
8178
|
+
* FREE identifier of the AST is covered by a binding or the injected `now`.
|
|
8179
|
+
*/
|
|
8180
|
+
function validateExpressionSource(src) {
|
|
8181
|
+
const names = Object.keys(src.bindings);
|
|
8182
|
+
if (names.length > 32) return `too many bindings (${names.length} > 32)`;
|
|
8183
|
+
for (const name of names) {
|
|
8184
|
+
if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
|
|
8185
|
+
if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
|
|
8186
|
+
if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
|
|
8187
|
+
}
|
|
8188
|
+
const compiled = compileExpressionSafe(src.expr);
|
|
8189
|
+
if (!compiled.ok) return compiled.error;
|
|
8190
|
+
const bound = new Set(names);
|
|
8191
|
+
for (const id of compiled.parsed.identifiers) {
|
|
8192
|
+
if (id === "now") continue;
|
|
8193
|
+
if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
|
|
8194
|
+
}
|
|
8195
|
+
return null;
|
|
8196
|
+
}
|
|
8197
|
+
/**
|
|
7433
8198
|
* Accessory device helpers — shared across drivers.
|
|
7434
8199
|
*
|
|
7435
8200
|
* Many vendor-specific drivers register accessory child devices on
|
|
@@ -9332,7 +10097,8 @@ var MotionAnalysisResultSchema = object({
|
|
|
9332
10097
|
});
|
|
9333
10098
|
method(object({
|
|
9334
10099
|
deviceId: number(),
|
|
9335
|
-
frame: FrameInputSchema
|
|
10100
|
+
frame: FrameInputSchema.optional(),
|
|
10101
|
+
frameHandle: FrameHandleSchema.optional()
|
|
9336
10102
|
}), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
|
|
9337
10103
|
deviceId: number(),
|
|
9338
10104
|
detected: boolean(),
|
|
@@ -9579,6 +10345,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
9579
10345
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
9580
10346
|
steps: array(PipelineStepInputSchema).min(1),
|
|
9581
10347
|
frame: FrameInputSchema.optional(),
|
|
10348
|
+
/**
|
|
10349
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
10350
|
+
* the decoded pixels live in. One more member of the one-of
|
|
10351
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
10352
|
+
*/
|
|
10353
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
9582
10354
|
imageBase64: string().optional(),
|
|
9583
10355
|
/**
|
|
9584
10356
|
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
@@ -9788,6 +10560,31 @@ var ReportMotionInputSchema = object({
|
|
|
9788
10560
|
regions: array(MotionRegionSchema).readonly().optional()
|
|
9789
10561
|
});
|
|
9790
10562
|
/**
|
|
10563
|
+
* Where a runner gets a camera's decoded frames (cross-node Phase 2,
|
|
10564
|
+
* restream-owner model — P2c).
|
|
10565
|
+
*
|
|
10566
|
+
* - `local-broker` (DEFAULT): today's path — subscribe to the co-located
|
|
10567
|
+
* stream-broker's shm frame plane. Every pre-P2c attach payload (no
|
|
10568
|
+
* `frameSource` key) parses to this, so the field is additive with zero
|
|
10569
|
+
* behavior change.
|
|
10570
|
+
* - `remote-restream`: the detect node is NOT the camera's source-owner.
|
|
10571
|
+
* The runner acquires the owner's COMPRESSED passthrough restream
|
|
10572
|
+
* (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
|
|
10573
|
+
* double-pull guard) and decodes LOCALLY via a satellite frame plane +
|
|
10574
|
+
* pull-mode decoder session pinned to its own node. The shm ring stays
|
|
10575
|
+
* node-local; only H.264/H.265 packets cross the wire.
|
|
10576
|
+
* `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
|
|
10577
|
+
* when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
|
|
10578
|
+
* dials for the owner's restream.
|
|
10579
|
+
*/
|
|
10580
|
+
var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
|
|
10581
|
+
kind: literal("remote-restream"),
|
|
10582
|
+
/** The camera's source-owner node (slice 1: always the hub). */
|
|
10583
|
+
ownerNodeId: string(),
|
|
10584
|
+
/** Operator override for the owner host the runner dials. */
|
|
10585
|
+
hubHostnameOverride: string().optional()
|
|
10586
|
+
})]).describe("Per-camera frame-source mode for the runner (P2c)");
|
|
10587
|
+
/**
|
|
9791
10588
|
* Camera assignment payload sent by `addon-pipeline-orchestrator` to a
|
|
9792
10589
|
* specific runner instance via `attachCamera`. Carries everything the
|
|
9793
10590
|
* runner needs to subscribe to the local broker and execute inference.
|
|
@@ -9885,7 +10682,15 @@ var RunnerCameraConfigSchema = object({
|
|
|
9885
10682
|
*/
|
|
9886
10683
|
onboardMotionDrivesAnalyzer: boolean().default(true),
|
|
9887
10684
|
occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
|
|
9888
|
-
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
|
|
10685
|
+
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
|
|
10686
|
+
/**
|
|
10687
|
+
* Where this runner gets the camera's decoded frames (P2c). Defaulted so
|
|
10688
|
+
* every existing payload behaves as `local-broker` — the pre-Phase-2 path.
|
|
10689
|
+
* Populated with `remote-restream` by the orchestrator ONLY when the
|
|
10690
|
+
* camera's detect node differs from its source-owner (P2d, gated by the
|
|
10691
|
+
* `remoteSourcingNodes` rollout setting).
|
|
10692
|
+
*/
|
|
10693
|
+
frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
|
|
9889
10694
|
});
|
|
9890
10695
|
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;
|
|
9891
10696
|
/**
|
|
@@ -10250,6 +11055,113 @@ object({
|
|
|
10250
11055
|
lastFetchedAt: number()
|
|
10251
11056
|
});
|
|
10252
11057
|
DeviceType.Sensor;
|
|
11058
|
+
/**
|
|
11059
|
+
* Feeder connectivity / power status — mirrors the HA petkit device-status
|
|
11060
|
+
* enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
|
|
11061
|
+
* `on_batteries` (running on battery backup). `null` until first reported.
|
|
11062
|
+
*/
|
|
11063
|
+
var PetFeederDeviceStatusSchema = _enum([
|
|
11064
|
+
"normal",
|
|
11065
|
+
"offline",
|
|
11066
|
+
"on_batteries"
|
|
11067
|
+
]);
|
|
11068
|
+
var gramsPortion = number().int().min(4).max(200);
|
|
11069
|
+
object({
|
|
11070
|
+
/** Food currently in the bowl (grams). Null when the device has not
|
|
11071
|
+
* reported a reading yet. On dual-hopper models this is the combined
|
|
11072
|
+
* bowl reading; per-hopper levels live in `food1`/`food2`. */
|
|
11073
|
+
foodLevel: number().nullable(),
|
|
11074
|
+
/** Hopper-1 food level (grams) on dual-hopper feeders; null on
|
|
11075
|
+
* single-hopper models. */
|
|
11076
|
+
food1: number().nullable(),
|
|
11077
|
+
/** Hopper-2 food level (grams) on dual-hopper feeders; null on
|
|
11078
|
+
* single-hopper models. */
|
|
11079
|
+
food2: number().nullable(),
|
|
11080
|
+
/** Derived low-food flag — mirrors the HA `food_level` binary_sensor
|
|
11081
|
+
* (`device_class: problem`, on = low). True when the bowl is empty /
|
|
11082
|
+
* below the feeder's low threshold. */
|
|
11083
|
+
lowFood: boolean(),
|
|
11084
|
+
/** Battery charge 0..100 (%). Null on mains-powered models or when the
|
|
11085
|
+
* device has no battery reading. */
|
|
11086
|
+
batteryPower: number().min(0).max(100).nullable(),
|
|
11087
|
+
/** Days of desiccant life remaining. Null when the model has no
|
|
11088
|
+
* desiccant sensor. */
|
|
11089
|
+
desiccantLeftDays: number().nullable(),
|
|
11090
|
+
/** True while a feed is in progress. */
|
|
11091
|
+
feeding: boolean(),
|
|
11092
|
+
/** Decoded connectivity / power status (HA petkit device-status enum).
|
|
11093
|
+
* Null until the device has reported a status. */
|
|
11094
|
+
status: PetFeederDeviceStatusSchema.nullable(),
|
|
11095
|
+
/** Decoded human-readable fault message. Null (or the device's `no_error`
|
|
11096
|
+
* sentinel) means healthy; a non-null string is an active fault. Pairs
|
|
11097
|
+
* with `errorCode` for consumers that want the raw integer. */
|
|
11098
|
+
error: string().nullable(),
|
|
11099
|
+
/** Raw device error code (0 / null = no error). */
|
|
11100
|
+
errorCode: number().nullable(),
|
|
11101
|
+
/** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
|
|
11102
|
+
isDualHopper: boolean(),
|
|
11103
|
+
/** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
|
|
11104
|
+
childLock: boolean(),
|
|
11105
|
+
/** Front indicator-light setting. */
|
|
11106
|
+
indicatorLight: boolean(),
|
|
11107
|
+
/** Play a chime when dispensing. */
|
|
11108
|
+
feedSound: boolean(),
|
|
11109
|
+
/** Speaker / prompt volume level (device-scaled integer). */
|
|
11110
|
+
volume: number(),
|
|
11111
|
+
/** Ms epoch when the slice was last refreshed from the cloud. */
|
|
11112
|
+
lastFetchedAt: number()
|
|
11113
|
+
});
|
|
11114
|
+
DeviceType.PetFeeder, method(object({
|
|
11115
|
+
deviceId: number().int().nonnegative(),
|
|
11116
|
+
grams: gramsPortion.optional(),
|
|
11117
|
+
hopper1: gramsPortion.optional(),
|
|
11118
|
+
hopper2: gramsPortion.optional()
|
|
11119
|
+
}), _void(), {
|
|
11120
|
+
kind: "mutation",
|
|
11121
|
+
auth: "admin"
|
|
11122
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11123
|
+
kind: "mutation",
|
|
11124
|
+
auth: "admin"
|
|
11125
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11126
|
+
kind: "mutation",
|
|
11127
|
+
auth: "admin"
|
|
11128
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11129
|
+
kind: "mutation",
|
|
11130
|
+
auth: "admin"
|
|
11131
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11132
|
+
kind: "mutation",
|
|
11133
|
+
auth: "admin"
|
|
11134
|
+
}), method(object({
|
|
11135
|
+
deviceId: number().int().nonnegative(),
|
|
11136
|
+
soundId: number().int().nonnegative()
|
|
11137
|
+
}), _void(), {
|
|
11138
|
+
kind: "mutation",
|
|
11139
|
+
auth: "admin"
|
|
11140
|
+
}), method(object({
|
|
11141
|
+
deviceId: number().int().nonnegative(),
|
|
11142
|
+
on: boolean()
|
|
11143
|
+
}), _void(), {
|
|
11144
|
+
kind: "mutation",
|
|
11145
|
+
auth: "admin"
|
|
11146
|
+
}), method(object({
|
|
11147
|
+
deviceId: number().int().nonnegative(),
|
|
11148
|
+
on: boolean()
|
|
11149
|
+
}), _void(), {
|
|
11150
|
+
kind: "mutation",
|
|
11151
|
+
auth: "admin"
|
|
11152
|
+
}), method(object({
|
|
11153
|
+
deviceId: number().int().nonnegative(),
|
|
11154
|
+
on: boolean()
|
|
11155
|
+
}), _void(), {
|
|
11156
|
+
kind: "mutation",
|
|
11157
|
+
auth: "admin"
|
|
11158
|
+
}), method(object({
|
|
11159
|
+
deviceId: number().int().nonnegative(),
|
|
11160
|
+
level: number().int().nonnegative()
|
|
11161
|
+
}), _void(), {
|
|
11162
|
+
kind: "mutation",
|
|
11163
|
+
auth: "admin"
|
|
11164
|
+
});
|
|
10253
11165
|
object({
|
|
10254
11166
|
/** Instantaneous power draw in watts. */
|
|
10255
11167
|
watts: number().optional(),
|
|
@@ -12077,10 +12989,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
|
|
|
12077
12989
|
url: string()
|
|
12078
12990
|
}), _void()), method(object({
|
|
12079
12991
|
sessionId: string(),
|
|
12080
|
-
maxCount: number().default(1)
|
|
12992
|
+
maxCount: number().default(1),
|
|
12993
|
+
waitMs: number().optional()
|
|
12081
12994
|
}), array(DecodedFrameSchema)), method(object({
|
|
12082
12995
|
sessionId: string(),
|
|
12083
|
-
maxCount: number().default(1)
|
|
12996
|
+
maxCount: number().default(1),
|
|
12997
|
+
waitMs: number().optional()
|
|
12084
12998
|
}), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
|
|
12085
12999
|
sessionId: string(),
|
|
12086
13000
|
config: DecoderSessionConfigSchema.partial()
|
|
@@ -12367,14 +13281,63 @@ var ChildLayoutEntrySchema = object({
|
|
|
12367
13281
|
collapsed: boolean().optional()
|
|
12368
13282
|
});
|
|
12369
13283
|
/** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
|
|
12370
|
-
* `device-management.ts`.
|
|
13284
|
+
* `device-management.ts`. Source is a union: a FIELD source copies a sibling
|
|
13285
|
+
* accessory's status field (`kind` optional/absent for wire compat); a
|
|
13286
|
+
* LITERAL source carries a per-device constant (no sibling is read); a
|
|
13287
|
+
* GLOBAL source (P2e) copies ANY device's status field, addressed by the
|
|
13288
|
+
* source device's full re-sync-stable `stableId`. */
|
|
13289
|
+
var DeviceLinkFieldSourceSchema = object({
|
|
13290
|
+
kind: literal("field").optional(),
|
|
13291
|
+
sourceKey: string(),
|
|
13292
|
+
cap: string(),
|
|
13293
|
+
fieldPath: string()
|
|
13294
|
+
});
|
|
13295
|
+
var DeviceLinkLiteralSourceSchema = object({
|
|
13296
|
+
kind: literal("literal"),
|
|
13297
|
+
value: union([
|
|
13298
|
+
string(),
|
|
13299
|
+
number(),
|
|
13300
|
+
boolean(),
|
|
13301
|
+
_null()
|
|
13302
|
+
])
|
|
13303
|
+
});
|
|
13304
|
+
var DeviceLinkGlobalSourceSchema = object({
|
|
13305
|
+
kind: literal("global"),
|
|
13306
|
+
sourceStableId: string(),
|
|
13307
|
+
cap: string(),
|
|
13308
|
+
fieldPath: string()
|
|
13309
|
+
});
|
|
13310
|
+
/** Expression source (Stage X): compute the target field from N named bindings
|
|
13311
|
+
* via the safe expression engine. Bindings are field | literal | global — never
|
|
13312
|
+
* another expression (no nesting). The `superRefine` runs the SAME author-time
|
|
13313
|
+
* validation as `validateExpressionSource` (compiles the expr, checks binding
|
|
13314
|
+
* names + identifier coverage) so every wire boundary that parses a DeviceLink
|
|
13315
|
+
* (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
|
|
13316
|
+
* Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
|
|
13317
|
+
var DeviceLinkExpressionSourceSchema = object({
|
|
13318
|
+
kind: literal("expression"),
|
|
13319
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
13320
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
|
|
13321
|
+
DeviceLinkFieldSourceSchema,
|
|
13322
|
+
DeviceLinkLiteralSourceSchema,
|
|
13323
|
+
DeviceLinkGlobalSourceSchema
|
|
13324
|
+
]))
|
|
13325
|
+
}).superRefine((src, ctx) => {
|
|
13326
|
+
const err = validateExpressionSource(src);
|
|
13327
|
+
if (err !== null) ctx.addIssue({
|
|
13328
|
+
code: "custom",
|
|
13329
|
+
message: err,
|
|
13330
|
+
path: ["expr"]
|
|
13331
|
+
});
|
|
13332
|
+
});
|
|
12371
13333
|
var DeviceLinkSchema = object({
|
|
12372
13334
|
id: string(),
|
|
12373
|
-
source:
|
|
12374
|
-
|
|
12375
|
-
|
|
12376
|
-
|
|
12377
|
-
|
|
13335
|
+
source: union([
|
|
13336
|
+
DeviceLinkFieldSourceSchema,
|
|
13337
|
+
DeviceLinkLiteralSourceSchema,
|
|
13338
|
+
DeviceLinkGlobalSourceSchema,
|
|
13339
|
+
DeviceLinkExpressionSourceSchema
|
|
13340
|
+
]),
|
|
12378
13341
|
target: object({
|
|
12379
13342
|
cap: string(),
|
|
12380
13343
|
fieldPath: string(),
|
|
@@ -12403,6 +13366,31 @@ var DeviceLinkSchema = object({
|
|
|
12403
13366
|
})
|
|
12404
13367
|
]).optional()
|
|
12405
13368
|
});
|
|
13369
|
+
/** Cap-wire shape of a per-cap display refinement — mirrors
|
|
13370
|
+
* `DeviceCapDisplayOverride` in `device-management.ts`. */
|
|
13371
|
+
var DeviceCapDisplayOverrideSchema = object({
|
|
13372
|
+
unit: string().min(1).optional(),
|
|
13373
|
+
precision: number().int().min(0).max(10).optional()
|
|
13374
|
+
});
|
|
13375
|
+
/** Cap-wire shape of an operator-authored per-device display override —
|
|
13376
|
+
* mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
|
|
13377
|
+
* bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
|
|
13378
|
+
var DeviceDisplayOverrideSchema = object({
|
|
13379
|
+
icon: string().min(1).optional(),
|
|
13380
|
+
label: string().min(1).optional(),
|
|
13381
|
+
unit: string().min(1).optional(),
|
|
13382
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13383
|
+
hidden: boolean().optional(),
|
|
13384
|
+
perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
|
|
13385
|
+
});
|
|
13386
|
+
/** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
|
|
13387
|
+
* in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
|
|
13388
|
+
* the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
|
|
13389
|
+
var RoleDisplayDefaultSchema = object({
|
|
13390
|
+
unit: string().min(1).optional(),
|
|
13391
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13392
|
+
icon: string().min(1).optional()
|
|
13393
|
+
});
|
|
12406
13394
|
/**
|
|
12407
13395
|
* Serializable projection of a live IDevice.
|
|
12408
13396
|
* Returned by listAll, getDevice, getChildren.
|
|
@@ -12458,7 +13446,9 @@ var DeviceInfoSchema = object({
|
|
|
12458
13446
|
* `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
|
|
12459
13447
|
childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
|
|
12460
13448
|
/** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
|
|
12461
|
-
deviceLinks: array(DeviceLinkSchema).readonly().optional()
|
|
13449
|
+
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
13450
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13451
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12462
13452
|
});
|
|
12463
13453
|
var ConfigEntrySchema = object({
|
|
12464
13454
|
key: string(),
|
|
@@ -12523,7 +13513,9 @@ var DeviceMetaSchema = object({
|
|
|
12523
13513
|
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
12524
13514
|
/** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
|
|
12525
13515
|
* Optional: only present for accessory children that carry a known role. */
|
|
12526
|
-
role: string().nullable().optional()
|
|
13516
|
+
role: string().nullable().optional(),
|
|
13517
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13518
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12527
13519
|
});
|
|
12528
13520
|
/** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
|
|
12529
13521
|
var ConfigUISchemaOutput = unknown().nullable();
|
|
@@ -12617,7 +13609,19 @@ method(object({
|
|
|
12617
13609
|
}), _void(), {
|
|
12618
13610
|
kind: "mutation",
|
|
12619
13611
|
auth: "admin"
|
|
12620
|
-
}), method(object({
|
|
13612
|
+
}), method(object({
|
|
13613
|
+
deviceId: number(),
|
|
13614
|
+
display: DeviceDisplayOverrideSchema.nullable()
|
|
13615
|
+
}), _void(), {
|
|
13616
|
+
kind: "mutation",
|
|
13617
|
+
auth: "admin"
|
|
13618
|
+
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
13619
|
+
kind: "mutation",
|
|
13620
|
+
auth: "admin"
|
|
13621
|
+
}), method(object({
|
|
13622
|
+
deviceId: number(),
|
|
13623
|
+
includeSynthesizable: boolean().optional()
|
|
13624
|
+
}), object({ caps: array(object({
|
|
12621
13625
|
cap: string(),
|
|
12622
13626
|
fields: array(object({
|
|
12623
13627
|
path: string(),
|
|
@@ -12627,8 +13631,13 @@ method(object({
|
|
|
12627
13631
|
"boolean",
|
|
12628
13632
|
"enum"
|
|
12629
13633
|
]),
|
|
12630
|
-
enumValues: array(string()).optional()
|
|
12631
|
-
|
|
13634
|
+
enumValues: array(string()).optional(),
|
|
13635
|
+
item: boolean().optional()
|
|
13636
|
+
})).readonly(),
|
|
13637
|
+
itemArray: object({
|
|
13638
|
+
path: string(),
|
|
13639
|
+
keyField: string()
|
|
13640
|
+
}).optional()
|
|
12632
13641
|
})).readonly() }), { kind: "query" }), method(object({
|
|
12633
13642
|
deviceId: number(),
|
|
12634
13643
|
role: string().nullable()
|
|
@@ -12698,7 +13707,11 @@ method(object({
|
|
|
12698
13707
|
deviceId: number(),
|
|
12699
13708
|
entries: array(object({
|
|
12700
13709
|
capName: string(),
|
|
12701
|
-
kind: _enum([
|
|
13710
|
+
kind: _enum([
|
|
13711
|
+
"native",
|
|
13712
|
+
"wrapped",
|
|
13713
|
+
"linked"
|
|
13714
|
+
]),
|
|
12702
13715
|
providerAddonId: string(),
|
|
12703
13716
|
providerNodeId: string(),
|
|
12704
13717
|
nativeAddonId: string()
|
|
@@ -12707,7 +13720,11 @@ method(object({
|
|
|
12707
13720
|
deviceId: number(),
|
|
12708
13721
|
entries: array(object({
|
|
12709
13722
|
capName: string(),
|
|
12710
|
-
kind: _enum([
|
|
13723
|
+
kind: _enum([
|
|
13724
|
+
"native",
|
|
13725
|
+
"wrapped",
|
|
13726
|
+
"linked"
|
|
13727
|
+
]),
|
|
12711
13728
|
providerAddonId: string(),
|
|
12712
13729
|
providerNodeId: string(),
|
|
12713
13730
|
nativeAddonId: string()
|
|
@@ -13197,7 +14214,7 @@ var AddBrokerInputSchema = object({
|
|
|
13197
14214
|
});
|
|
13198
14215
|
var AddBrokerResultSchema = object({ id: string() });
|
|
13199
14216
|
var IdInputSchema = object({ id: string() });
|
|
13200
|
-
var TestResultSchema = discriminatedUnion("ok", [object({
|
|
14217
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
13201
14218
|
ok: literal(true),
|
|
13202
14219
|
latencyMs: number()
|
|
13203
14220
|
}), object({
|
|
@@ -13220,7 +14237,7 @@ var StatusSchema = object({
|
|
|
13220
14237
|
brokerCount: number(),
|
|
13221
14238
|
embeddedRunning: boolean()
|
|
13222
14239
|
});
|
|
13223
|
-
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);
|
|
14240
|
+
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);
|
|
13224
14241
|
var NetworkEndpointSchema = object({
|
|
13225
14242
|
url: string(),
|
|
13226
14243
|
hostname: string(),
|
|
@@ -13254,23 +14271,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
|
13254
14271
|
sourcePort: number().optional()
|
|
13255
14272
|
});
|
|
13256
14273
|
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
13257
|
-
|
|
13258
|
-
|
|
14274
|
+
/**
|
|
14275
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14276
|
+
*
|
|
14277
|
+
* Apprise-derived model (see
|
|
14278
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14279
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14280
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14281
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14282
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14283
|
+
*
|
|
14284
|
+
* DESIGN DECISIONS (locked):
|
|
14285
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14286
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14287
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14288
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14289
|
+
* alternative would fork the UI per addon and cannot host the
|
|
14290
|
+
* discovery→adopt flow.
|
|
14291
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14292
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14293
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14294
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14295
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
14296
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14297
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14298
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14299
|
+
* base64 fallback needed.
|
|
14300
|
+
*
|
|
14301
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14302
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14303
|
+
* admin "Integrations" page.
|
|
14304
|
+
*/
|
|
14305
|
+
/**
|
|
14306
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14307
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14308
|
+
*/
|
|
14309
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14310
|
+
"image",
|
|
14311
|
+
"video",
|
|
14312
|
+
"gif",
|
|
14313
|
+
"audio",
|
|
14314
|
+
"icon"
|
|
14315
|
+
]);
|
|
14316
|
+
/**
|
|
14317
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14318
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14319
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14320
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14321
|
+
*/
|
|
14322
|
+
var AttachmentSchema = object({
|
|
14323
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14324
|
+
url: string().optional(),
|
|
14325
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14326
|
+
mime: string().optional(),
|
|
14327
|
+
name: string().optional()
|
|
14328
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14329
|
+
var NotificationFormatSchema = _enum([
|
|
14330
|
+
"text",
|
|
14331
|
+
"markdown",
|
|
14332
|
+
"html"
|
|
14333
|
+
]);
|
|
14334
|
+
/** A single tap-through action button. */
|
|
14335
|
+
var NotificationActionSchema = object({
|
|
14336
|
+
id: string(),
|
|
14337
|
+
label: string(),
|
|
14338
|
+
url: string().optional()
|
|
14339
|
+
});
|
|
14340
|
+
/**
|
|
14341
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14342
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14343
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14344
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14345
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14346
|
+
* `priority` for that one target.
|
|
14347
|
+
*/
|
|
14348
|
+
var NotificationSchema = object({
|
|
13259
14349
|
body: string(),
|
|
13260
|
-
|
|
14350
|
+
title: string().optional(),
|
|
14351
|
+
format: NotificationFormatSchema.default("text"),
|
|
14352
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14353
|
+
level: string().optional(),
|
|
14354
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14355
|
+
clickUrl: string().optional(),
|
|
14356
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14357
|
+
sound: string().optional(),
|
|
14358
|
+
ttl: number().optional(),
|
|
14359
|
+
tag: string().optional(),
|
|
13261
14360
|
deviceId: number().optional(),
|
|
13262
14361
|
eventId: string().optional(),
|
|
13263
|
-
priority: _enum([
|
|
13264
|
-
"low",
|
|
13265
|
-
"normal",
|
|
13266
|
-
"high",
|
|
13267
|
-
"critical"
|
|
13268
|
-
]).default("normal"),
|
|
13269
14362
|
metadata: record(string(), unknown()).optional()
|
|
13270
|
-
})
|
|
14363
|
+
});
|
|
14364
|
+
/** One declared native severity/priority level for a kind. */
|
|
14365
|
+
var TargetKindLevelSchema = object({
|
|
14366
|
+
id: string(),
|
|
14367
|
+
label: string(),
|
|
14368
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14369
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14370
|
+
flags: object({
|
|
14371
|
+
critical: boolean().optional(),
|
|
14372
|
+
silent: boolean().optional(),
|
|
14373
|
+
noPush: boolean().optional()
|
|
14374
|
+
}).optional(),
|
|
14375
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14376
|
+
requires: array(string()).optional(),
|
|
14377
|
+
description: string().optional()
|
|
14378
|
+
});
|
|
14379
|
+
/** The full capability block consulted before dispatch. */
|
|
14380
|
+
var TargetKindCapsSchema = object({
|
|
14381
|
+
attachments: object({
|
|
14382
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14383
|
+
mode: _enum([
|
|
14384
|
+
"url",
|
|
14385
|
+
"bytes",
|
|
14386
|
+
"both"
|
|
14387
|
+
]),
|
|
14388
|
+
max: number().int().nonnegative(),
|
|
14389
|
+
maxBytes: number().int().positive().optional()
|
|
14390
|
+
}),
|
|
14391
|
+
/** Max action buttons (0 = none). */
|
|
14392
|
+
actions: number().int().nonnegative(),
|
|
14393
|
+
levels: array(TargetKindLevelSchema),
|
|
14394
|
+
format: array(NotificationFormatSchema),
|
|
14395
|
+
clickUrl: boolean(),
|
|
14396
|
+
sound: boolean(),
|
|
14397
|
+
ttl: boolean(),
|
|
14398
|
+
bodyMaxLen: number().int().positive()
|
|
14399
|
+
});
|
|
14400
|
+
/**
|
|
14401
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14402
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14403
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14404
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14405
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14406
|
+
*/
|
|
14407
|
+
var ConfigSchemaPassthrough = unknown();
|
|
14408
|
+
var TargetKindSchema = object({
|
|
14409
|
+
kind: string(),
|
|
14410
|
+
label: string(),
|
|
14411
|
+
icon: string(),
|
|
14412
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14413
|
+
addonId: string(),
|
|
14414
|
+
configSchema: ConfigSchemaPassthrough,
|
|
14415
|
+
supportsDiscovery: boolean(),
|
|
14416
|
+
caps: TargetKindCapsSchema
|
|
14417
|
+
});
|
|
14418
|
+
/**
|
|
14419
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14420
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14421
|
+
* round-trip a stored secret to the UI.
|
|
14422
|
+
*/
|
|
14423
|
+
var TargetSchema = object({
|
|
14424
|
+
id: string(),
|
|
14425
|
+
name: string(),
|
|
14426
|
+
kind: string(),
|
|
14427
|
+
addonId: string(),
|
|
14428
|
+
enabled: boolean(),
|
|
14429
|
+
config: record(string(), unknown())
|
|
14430
|
+
});
|
|
14431
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14432
|
+
var DiscoveredTargetSchema = object({
|
|
14433
|
+
kind: string(),
|
|
14434
|
+
suggestedName: string(),
|
|
14435
|
+
config: record(string(), unknown())
|
|
14436
|
+
});
|
|
14437
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14438
|
+
var RenderedAsSchema = object({
|
|
14439
|
+
level: string(),
|
|
14440
|
+
format: NotificationFormatSchema,
|
|
14441
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14442
|
+
actionsSent: number().int().nonnegative(),
|
|
14443
|
+
truncated: boolean(),
|
|
14444
|
+
dropped: array(string())
|
|
14445
|
+
});
|
|
14446
|
+
var SendResultSchema = object({
|
|
13271
14447
|
success: boolean(),
|
|
13272
|
-
error: string().optional()
|
|
13273
|
-
|
|
14448
|
+
error: string().optional(),
|
|
14449
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14450
|
+
});
|
|
14451
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14452
|
+
var TestResultSchema = SendResultSchema;
|
|
14453
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
14454
|
+
kind: string(),
|
|
14455
|
+
config: record(string(), unknown()).optional()
|
|
14456
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
14457
|
+
targetId: string(),
|
|
14458
|
+
notification: NotificationSchema
|
|
14459
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
14460
|
+
targetId: string(),
|
|
14461
|
+
sample: NotificationSchema.optional()
|
|
14462
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
14463
|
+
targetId: string(),
|
|
14464
|
+
enabled: boolean()
|
|
14465
|
+
}), _void(), { kind: "mutation" });
|
|
13274
14466
|
/**
|
|
13275
14467
|
* Zod schemas for persisted record types.
|
|
13276
14468
|
*
|
|
@@ -16292,7 +17484,10 @@ var HwAccelBackendInputSchema = _enum([
|
|
|
16292
17484
|
"webgpu",
|
|
16293
17485
|
"none"
|
|
16294
17486
|
]).nullable().optional();
|
|
16295
|
-
var HwAccelResolutionSchema = object({
|
|
17487
|
+
var HwAccelResolutionSchema = object({
|
|
17488
|
+
preferred: array(string()).readonly(),
|
|
17489
|
+
rationale: string()
|
|
17490
|
+
});
|
|
16296
17491
|
var HardwareEncoderIdSchema = _enum([
|
|
16297
17492
|
"h264_videotoolbox",
|
|
16298
17493
|
"hevc_videotoolbox",
|
|
@@ -16397,10 +17592,7 @@ var ResolvedInferenceConfigSchema = object({
|
|
|
16397
17592
|
format: ModelFormatSchema,
|
|
16398
17593
|
reason: string()
|
|
16399
17594
|
});
|
|
16400
|
-
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
|
|
16401
|
-
prefer: HwAccelBackendInputSchema,
|
|
16402
|
-
nodeId: string().optional()
|
|
16403
|
-
}), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
17595
|
+
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
16404
17596
|
kind: "mutation",
|
|
16405
17597
|
auth: "admin"
|
|
16406
17598
|
}), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
|
|
@@ -16459,6 +17651,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
|
|
|
16459
17651
|
kind: "mutation",
|
|
16460
17652
|
auth: "admin"
|
|
16461
17653
|
});
|
|
17654
|
+
/**
|
|
17655
|
+
* `recording` cap — footage availability + HLS playback manifests + per-device
|
|
17656
|
+
* recording config. NOTE on events (source of truth, R5/C3): this cap carries
|
|
17657
|
+
* NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
|
|
17658
|
+
* events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
|
|
17659
|
+
* rows); the recorder's internal EventMap markers are ephemeral in-RAM
|
|
17660
|
+
* annotations that are not exposed here and must not be treated as an event
|
|
17661
|
+
* feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
|
|
17662
|
+
* (`interfaces/recording-config.ts`).
|
|
17663
|
+
*/
|
|
16462
17664
|
var RecordingStatusSchema = object({
|
|
16463
17665
|
deviceId: number(),
|
|
16464
17666
|
enabled: boolean(),
|
|
@@ -18095,6 +19297,12 @@ Object.freeze({
|
|
|
18095
19297
|
addonId: null,
|
|
18096
19298
|
access: "view"
|
|
18097
19299
|
},
|
|
19300
|
+
"deviceManager.getRoleDisplayDefaults": {
|
|
19301
|
+
capName: "device-manager",
|
|
19302
|
+
capScope: "system",
|
|
19303
|
+
addonId: null,
|
|
19304
|
+
access: "view"
|
|
19305
|
+
},
|
|
18098
19306
|
"deviceManager.getSettingsSchema": {
|
|
18099
19307
|
capName: "device-manager",
|
|
18100
19308
|
capScope: "system",
|
|
@@ -18245,6 +19453,12 @@ Object.freeze({
|
|
|
18245
19453
|
addonId: null,
|
|
18246
19454
|
access: "create"
|
|
18247
19455
|
},
|
|
19456
|
+
"deviceManager.setDisplay": {
|
|
19457
|
+
capName: "device-manager",
|
|
19458
|
+
capScope: "system",
|
|
19459
|
+
addonId: null,
|
|
19460
|
+
access: "create"
|
|
19461
|
+
},
|
|
18248
19462
|
"deviceManager.setIntegrationId": {
|
|
18249
19463
|
capName: "device-manager",
|
|
18250
19464
|
capScope: "system",
|
|
@@ -18287,6 +19501,12 @@ Object.freeze({
|
|
|
18287
19501
|
addonId: null,
|
|
18288
19502
|
access: "create"
|
|
18289
19503
|
},
|
|
19504
|
+
"deviceManager.setRoleDisplayDefaults": {
|
|
19505
|
+
capName: "device-manager",
|
|
19506
|
+
capScope: "system",
|
|
19507
|
+
addonId: null,
|
|
19508
|
+
access: "create"
|
|
19509
|
+
},
|
|
18290
19510
|
"deviceManager.setStreamProfileMap": {
|
|
18291
19511
|
capName: "device-manager",
|
|
18292
19512
|
capScope: "system",
|
|
@@ -19265,13 +20485,49 @@ Object.freeze({
|
|
|
19265
20485
|
addonId: null,
|
|
19266
20486
|
access: "create"
|
|
19267
20487
|
},
|
|
20488
|
+
"notificationOutput.deleteTarget": {
|
|
20489
|
+
capName: "notification-output",
|
|
20490
|
+
capScope: "system",
|
|
20491
|
+
addonId: null,
|
|
20492
|
+
access: "delete"
|
|
20493
|
+
},
|
|
20494
|
+
"notificationOutput.discoverTargets": {
|
|
20495
|
+
capName: "notification-output",
|
|
20496
|
+
capScope: "system",
|
|
20497
|
+
addonId: null,
|
|
20498
|
+
access: "view"
|
|
20499
|
+
},
|
|
20500
|
+
"notificationOutput.listTargetKinds": {
|
|
20501
|
+
capName: "notification-output",
|
|
20502
|
+
capScope: "system",
|
|
20503
|
+
addonId: null,
|
|
20504
|
+
access: "view"
|
|
20505
|
+
},
|
|
20506
|
+
"notificationOutput.listTargets": {
|
|
20507
|
+
capName: "notification-output",
|
|
20508
|
+
capScope: "system",
|
|
20509
|
+
addonId: null,
|
|
20510
|
+
access: "view"
|
|
20511
|
+
},
|
|
19268
20512
|
"notificationOutput.send": {
|
|
19269
20513
|
capName: "notification-output",
|
|
19270
20514
|
capScope: "system",
|
|
19271
20515
|
addonId: null,
|
|
19272
20516
|
access: "create"
|
|
19273
20517
|
},
|
|
19274
|
-
"notificationOutput.
|
|
20518
|
+
"notificationOutput.setTargetEnabled": {
|
|
20519
|
+
capName: "notification-output",
|
|
20520
|
+
capScope: "system",
|
|
20521
|
+
addonId: null,
|
|
20522
|
+
access: "create"
|
|
20523
|
+
},
|
|
20524
|
+
"notificationOutput.testTarget": {
|
|
20525
|
+
capName: "notification-output",
|
|
20526
|
+
capScope: "system",
|
|
20527
|
+
addonId: null,
|
|
20528
|
+
access: "create"
|
|
20529
|
+
},
|
|
20530
|
+
"notificationOutput.upsertTarget": {
|
|
19275
20531
|
capName: "notification-output",
|
|
19276
20532
|
capScope: "system",
|
|
19277
20533
|
addonId: null,
|
|
@@ -19301,6 +20557,66 @@ Object.freeze({
|
|
|
19301
20557
|
addonId: null,
|
|
19302
20558
|
access: "create"
|
|
19303
20559
|
},
|
|
20560
|
+
"petFeeder.callPet": {
|
|
20561
|
+
capName: "pet-feeder",
|
|
20562
|
+
capScope: "device",
|
|
20563
|
+
addonId: null,
|
|
20564
|
+
access: "create"
|
|
20565
|
+
},
|
|
20566
|
+
"petFeeder.cancelFeed": {
|
|
20567
|
+
capName: "pet-feeder",
|
|
20568
|
+
capScope: "device",
|
|
20569
|
+
addonId: null,
|
|
20570
|
+
access: "create"
|
|
20571
|
+
},
|
|
20572
|
+
"petFeeder.feed": {
|
|
20573
|
+
capName: "pet-feeder",
|
|
20574
|
+
capScope: "device",
|
|
20575
|
+
addonId: null,
|
|
20576
|
+
access: "create"
|
|
20577
|
+
},
|
|
20578
|
+
"petFeeder.markFoodReplenished": {
|
|
20579
|
+
capName: "pet-feeder",
|
|
20580
|
+
capScope: "device",
|
|
20581
|
+
addonId: null,
|
|
20582
|
+
access: "create"
|
|
20583
|
+
},
|
|
20584
|
+
"petFeeder.playSound": {
|
|
20585
|
+
capName: "pet-feeder",
|
|
20586
|
+
capScope: "device",
|
|
20587
|
+
addonId: null,
|
|
20588
|
+
access: "create"
|
|
20589
|
+
},
|
|
20590
|
+
"petFeeder.resetDesiccant": {
|
|
20591
|
+
capName: "pet-feeder",
|
|
20592
|
+
capScope: "device",
|
|
20593
|
+
addonId: null,
|
|
20594
|
+
access: "delete"
|
|
20595
|
+
},
|
|
20596
|
+
"petFeeder.setChildLock": {
|
|
20597
|
+
capName: "pet-feeder",
|
|
20598
|
+
capScope: "device",
|
|
20599
|
+
addonId: null,
|
|
20600
|
+
access: "create"
|
|
20601
|
+
},
|
|
20602
|
+
"petFeeder.setFeedSound": {
|
|
20603
|
+
capName: "pet-feeder",
|
|
20604
|
+
capScope: "device",
|
|
20605
|
+
addonId: null,
|
|
20606
|
+
access: "create"
|
|
20607
|
+
},
|
|
20608
|
+
"petFeeder.setIndicatorLight": {
|
|
20609
|
+
capName: "pet-feeder",
|
|
20610
|
+
capScope: "device",
|
|
20611
|
+
addonId: null,
|
|
20612
|
+
access: "create"
|
|
20613
|
+
},
|
|
20614
|
+
"petFeeder.setVolume": {
|
|
20615
|
+
capName: "pet-feeder",
|
|
20616
|
+
capScope: "device",
|
|
20617
|
+
addonId: null,
|
|
20618
|
+
access: "create"
|
|
20619
|
+
},
|
|
19304
20620
|
"pipelineAnalytics.clearTracks": {
|
|
19305
20621
|
capName: "pipeline-analytics",
|
|
19306
20622
|
capScope: "device",
|
|
@@ -21277,7 +22593,7 @@ var AgentUIAddon = class extends BaseAddon {
|
|
|
21277
22593
|
capability: adminUiCapability,
|
|
21278
22594
|
provider: {
|
|
21279
22595
|
getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
|
|
21280
|
-
getVersion: async () => ({ version: "1.1.
|
|
22596
|
+
getVersion: async () => ({ version: "1.1.15" })
|
|
21281
22597
|
}
|
|
21282
22598
|
}];
|
|
21283
22599
|
}
|