@camstack/types 1.2.161 → 1.2.163

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/addon.js +14 -43
  2. package/dist/addon.mjs +14 -43
  3. package/dist/capabilities/alerts.cap.d.ts +5 -5
  4. package/dist/capabilities/index.d.ts +7 -5
  5. package/dist/capabilities/notifier.cap.d.ts +3 -3
  6. package/dist/capabilities/pet-feeder.cap.d.ts +4 -4
  7. package/dist/capabilities/snapshot.cap.d.ts +2 -2
  8. package/dist/capabilities/storage-occupancy.cap.d.ts +72 -0
  9. package/dist/capabilities/storage-provider.cap.d.ts +110 -11
  10. package/dist/capabilities/storage.cap.d.ts +43 -22
  11. package/dist/capabilities/stream-broker.cap.d.ts +1 -1
  12. package/dist/enums/event-category.d.ts +13 -0
  13. package/dist/enums.js +1 -1
  14. package/dist/enums.mjs +1 -1
  15. package/dist/{event-category-b8kBSOTT.js → event-category-BVo6ta6_.js} +13 -0
  16. package/dist/{event-category-zAv7pMUz.mjs → event-category-CnLqLOKs.mjs} +13 -0
  17. package/dist/generated/addon-api.d.ts +22 -7
  18. package/dist/generated/capability-router-map.d.ts +5 -2
  19. package/dist/generated/collection-array-methods.d.ts +1 -1
  20. package/dist/generated/method-access-map.d.ts +1 -1
  21. package/dist/generated/system-proxy.d.ts +1 -1
  22. package/dist/index.d.ts +17 -15
  23. package/dist/index.js +2049 -1702
  24. package/dist/index.mjs +2028 -1703
  25. package/dist/interfaces/event-bus.d.ts +19 -0
  26. package/dist/interfaces/storage-location-mode.d.ts +135 -0
  27. package/dist/interfaces/storage-location.d.ts +79 -4
  28. package/dist/node.d.ts +13 -11
  29. package/dist/node.js +935 -876
  30. package/dist/node.mjs +936 -879
  31. package/dist/{sleep-DDIFZGbc.js → sleep-BZtO-eFY.js} +1 -1
  32. package/dist/{sleep-Cfij6Jj9.mjs → sleep-Bd-Y4RUt.mjs} +1 -1
  33. package/dist/storage/physical-root.d.ts +25 -0
  34. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { t as EventCategory } from "./event-category-zAv7pMUz.mjs";
2
- import { $ as DecodedAudioChunkSchema, A as DEVICE_STATUS_METHOD, At as hydrateSchema, B as toNodeId, C as ChargingStatus, Ct as createEvent, D as adminUiCapability, Dt as WELL_KNOWN_TAB_MAP, E as DeviceType, Et as WELL_KNOWN_TABS, F as resolveCapMount, G as scopeKey, H as ReadinessTimeoutError, I as systemMethod, J as CAM_PROFILE_ORDER, K as BrokerStatsSchema, L as CAP_NODE_PIN_CONTEXT_KEY, M as expandCapMethods, N as isDeviceConfigCap, O as DEFAULT_RUNTIME_STATE_DURABILITY, Ot as collectHydratedFieldEntries, P as method, Q as CameraStreamSchema, R as nodePin, S as DEVICE_CHILDREN_BATCH_MAX, St as createDurableState, T as DeviceRole, Tt as isEvent, U as emitDownForOwnedCaps, V as ReadinessRegistry, W as readinessKey, X as CamStreamKindSchema, Y as CamProfileSchema, Z as CamStreamResolutionSchema, _ as createMirrorSource, _t as DATAPLANE_SECRET_HEADER, a as asJsonObject, at as ProfileSlotSchema, b as deviceOpsCapability, bt as BaseAddon, c as parseJsonArray, ct as StreamSourceSchema, d as BOOT_RECOVERY_BACKOFF_MS, dt as SubscribeFramesInputSchema, et as DecodedFrameSchema, f as DEVICE_SCOPED_CAPS, ft as SubscribeFramesResultSchema, g as createLazyTrpcSource, gt as selectAssignedProfileSlots, h as createEventBusSliceSource, ht as parseProfileBrokerId, i as asJsonArray, it as ProfileRtspEntrySchema, j as event, jt as resolveHydratedFieldValue, k as DEVICE_SETTINGS_CONTRIBUTION_METHODS, kt as collectHydratedFieldValues, l as parseJsonObject, lt as SubscribeAudioChunksInputSchema, m as createDeviceProxy, mt as makeSourceBrokerId, n as sleepCancellable, nt as FrameHandleFormatSchema, o as asNumber, ot as ProfileSlotStatusSchema, p as isDeviceScopedCap, pt as makeProfileBrokerId, q as BrokerStatusSchema, r as asBoolean, rt as FrameHandleSchema, s as asString, st as StreamSourceEntrySchema, t as sleep, tt as EncodedPacketSchema, u as parseJsonUnknown, ut as SubscribeAudioChunksResultSchema, v as createSliceHandle, vt as SHARE_VIEW_KINDS, w as DeviceFeature, wt as emitReadiness, x as viewerUiCapability, xt as normalizeAddonInitResult, y as RawStateResultSchema, yt as DisposerChain, z as readNodePin } from "./sleep-Cfij6Jj9.mjs";
1
+ import { t as EventCategory } from "./event-category-CnLqLOKs.mjs";
2
+ import { $ as DecodedAudioChunkSchema, A as DEVICE_STATUS_METHOD, At as hydrateSchema, B as toNodeId, C as ChargingStatus, Ct as createEvent, D as adminUiCapability, Dt as WELL_KNOWN_TAB_MAP, E as DeviceType, Et as WELL_KNOWN_TABS, F as resolveCapMount, G as scopeKey, H as ReadinessTimeoutError, I as systemMethod, J as CAM_PROFILE_ORDER, K as BrokerStatsSchema, L as CAP_NODE_PIN_CONTEXT_KEY, M as expandCapMethods, N as isDeviceConfigCap, O as DEFAULT_RUNTIME_STATE_DURABILITY, Ot as collectHydratedFieldEntries, P as method, Q as CameraStreamSchema, R as nodePin, S as DEVICE_CHILDREN_BATCH_MAX, St as createDurableState, T as DeviceRole, Tt as isEvent, U as emitDownForOwnedCaps, V as ReadinessRegistry, W as readinessKey, X as CamStreamKindSchema, Y as CamProfileSchema, Z as CamStreamResolutionSchema, _ as createMirrorSource, _t as DATAPLANE_SECRET_HEADER, a as asJsonObject, at as ProfileSlotSchema, b as deviceOpsCapability, bt as BaseAddon, c as parseJsonArray, ct as StreamSourceSchema, d as BOOT_RECOVERY_BACKOFF_MS, dt as SubscribeFramesInputSchema, et as DecodedFrameSchema, f as DEVICE_SCOPED_CAPS, ft as SubscribeFramesResultSchema, g as createLazyTrpcSource, gt as selectAssignedProfileSlots, h as createEventBusSliceSource, ht as parseProfileBrokerId, i as asJsonArray, it as ProfileRtspEntrySchema, j as event, jt as resolveHydratedFieldValue, k as DEVICE_SETTINGS_CONTRIBUTION_METHODS, kt as collectHydratedFieldValues, l as parseJsonObject, lt as SubscribeAudioChunksInputSchema, m as createDeviceProxy, mt as makeSourceBrokerId, n as sleepCancellable, nt as FrameHandleFormatSchema, o as asNumber, ot as ProfileSlotStatusSchema, p as isDeviceScopedCap, pt as makeProfileBrokerId, q as BrokerStatusSchema, r as asBoolean, rt as FrameHandleSchema, s as asString, st as StreamSourceEntrySchema, t as sleep, tt as EncodedPacketSchema, u as parseJsonUnknown, ut as SubscribeAudioChunksResultSchema, v as createSliceHandle, vt as SHARE_VIEW_KINDS, w as DeviceFeature, wt as emitReadiness, x as viewerUiCapability, xt as normalizeAddonInitResult, y as RawStateResultSchema, yt as DisposerChain, z as readNodePin } from "./sleep-Bd-Y4RUt.mjs";
3
3
  import { a as buildAudioArgs, c as buildVideoArgs, d as logBannerArgs, f as pickVideoEncoder, i as audioPlanFromEncodeProfile, l as invocationFromEncodeProfile, n as Fmp4BoxSplitter, o as buildFfmpegArgs, r as AUDIO_PRESETS, s as buildInputArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-rO1sRmEK.mjs";
4
4
  import { EventSourceType } from "./enums.mjs";
5
5
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
@@ -1431,378 +1431,6 @@ function logLevelAtMost(level, threshold) {
1431
1431
  return LOG_LEVEL_RANK[level] <= LOG_LEVEL_RANK[threshold];
1432
1432
  }
1433
1433
  //#endregion
1434
- //#region src/logging/log-channel.ts
1435
- /**
1436
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
1437
- * an addon declares its channels in.
1438
- *
1439
- * ## Two axes, deliberately separated
1440
- *
1441
- * - **DECLARATION** — which channels exist. Only the addon knows:
1442
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
1443
- * baichuan/handshake. A hand-wired central list rots at the first addition,
1444
- * and rots silently. So a channel is declared where it is consulted, and the
1445
- * `log-channels` capability enumerates the declarations.
1446
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
1447
- * thing: the logging settings document on the `system` cap. Two authorities
1448
- * over the values is the exact defect
1449
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
1450
- * remove; re-introducing it from the cure side would be grotesque.
1451
- *
1452
- * Nothing in this file reads a clock, an env var or a store. The registry is
1453
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
1454
- * the hot path with a value somebody actually read, and by
1455
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
1456
- * never reaches here, so it can neither disarm an armed channel nor arm a
1457
- * disarmed one (D49).
1458
- *
1459
- * ## The canonical call shape
1460
- *
1461
- * ```ts
1462
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
1463
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
1464
- * }
1465
- * ```
1466
- *
1467
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
1468
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
1469
- * object literal is never constructed because it lives inside the branch. It
1470
- * is the same shape already proven in production at `stream-broker.ts:1650`,
1471
- * and the same discipline `LoggingGate.allowsDestination` uses for the
1472
- * destination floor (measured at 1.93 ns/call when off).
1473
- *
1474
- * ## Why a channel emits at `info`
1475
- *
1476
- * `loki-logging.addon.ts` pins the destination default at `info` and
1477
- * `loki-destination.ts` drops everything below it, so a line emitted at
1478
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
1479
- * minutes. A diagnostic that cannot be read an hour later is worse than no
1480
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
1481
- * emits at the channel's declared level, whose schema floor is `info`.
1482
- */
1483
- /**
1484
- * The level a channel writes at once armed.
1485
- *
1486
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
1487
- * not leave the process for Loki, and the whole point of arming a channel is
1488
- * to read it later.
1489
- */
1490
- var LogChannelLevelSchema = z.enum([
1491
- "info",
1492
- "warn",
1493
- "error"
1494
- ]);
1495
- /**
1496
- * What an addon declares about one channel. No value, no state — a
1497
- * declaration is inert.
1498
- */
1499
- var LogChannelDescriptorSchema = z.object({
1500
- /**
1501
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
1502
- * the addon's short name so an operator reading a channel list can tell who
1503
- * owns it without a second lookup.
1504
- */
1505
- name: z.string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
1506
- /** One sentence: what the operator will SEE after arming it. */
1507
- description: z.string().min(1),
1508
- /** The level its lines are emitted at. Never below `info`. */
1509
- defaultLevel: LogChannelLevelSchema,
1510
- /**
1511
- * Whether this channel can be narrowed to a camera.
1512
- *
1513
- * `true` is a PROMISE with two halves, and both must hold: the gate is
1514
- * consulted with the numeric device id, AND every line the channel admits
1515
- * carries `tags: { deviceId }` with that same numeric id. The second half is
1516
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
1517
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
1518
- * the body is the only way to filter.
1519
- *
1520
- * A channel whose lines carry the device only in `meta` (or not at all) is
1521
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
1522
- * the operator narrows to one camera, sees nothing, and concludes the code
1523
- * path was never taken.
1524
- */
1525
- perDevice: z.boolean()
1526
- });
1527
- /**
1528
- * An armed window over one channel, as the document hands it to a mirror.
1529
- *
1530
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
1531
- * expires by itself, which is the one failure a boolean cannot avoid.
1532
- */
1533
- var LogChannelWindowSchema = z.object({
1534
- channel: z.string().min(1),
1535
- /** Epoch ms the window closes at. */
1536
- armedUntilMs: z.number(),
1537
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
1538
- deviceIds: z.array(z.number().int()).readonly().nullable()
1539
- });
1540
- /**
1541
- * The gate a hot path holds.
1542
- *
1543
- * Obtain it ONCE — at module scope or in a constructor — and keep the
1544
- * reference. Looking a channel up by name per line would put a Map lookup on
1545
- * the path this class exists to keep free.
1546
- */
1547
- var LogChannelGate = class {
1548
- descriptor;
1549
- /**
1550
- * HOT PATH GUARD. A plain data FIELD, and it must stay one.
1551
- *
1552
- * `log-channel.spec.ts` asserts the property descriptor has no getter and
1553
- * booby-traps the device set, so turning this into an accessor — or reading
1554
- * anything before it — fails the spec instead of taxing every line the
1555
- * process emits.
1556
- */
1557
- on = false;
1558
- /** `null` while armed for every camera. Never read while `on` is false. */
1559
- devices = null;
1560
- level;
1561
- closesAtMs = 0;
1562
- constructor(descriptor) {
1563
- this.descriptor = descriptor;
1564
- this.level = descriptor.defaultLevel;
1565
- }
1566
- /** Epoch ms this channel disarms itself at. 0 when disarmed. */
1567
- get armedUntilMs() {
1568
- return this.on ? this.closesAtMs : 0;
1569
- }
1570
- /**
1571
- * Does this channel want a line about `deviceId`?
1572
- *
1573
- * Call it only behind `gate.on &&`. On its own it is still correct — the
1574
- * guard is repeated inside — but the point of the prefix is that a disarmed
1575
- * channel must not pay the call at all.
1576
- */
1577
- wants(deviceId) {
1578
- if (!this.on) return false;
1579
- return this.devices === null || this.devices.has(deviceId);
1580
- }
1581
- /**
1582
- * Emit one line on this channel, at the channel's declared level.
1583
- *
1584
- * The channel name is added as `tags.logChannel` so LogQL can select the
1585
- * channel without matching on the message text, and whatever `tags` the
1586
- * caller passed — `deviceId` above all — is preserved.
1587
- */
1588
- log(logger, message, extras) {
1589
- if (!this.on) return;
1590
- const tags = {
1591
- ...extras.tags,
1592
- logChannel: this.descriptor.name
1593
- };
1594
- const line = {
1595
- ...extras,
1596
- tags
1597
- };
1598
- if (this.level === "error") logger.error(message, line);
1599
- else if (this.level === "warn") logger.warn(message, line);
1600
- else logger.info(message, line);
1601
- }
1602
- /**
1603
- * Arm (or RE-arm, restarting) this channel. Off the hot path only.
1604
- *
1605
- * An empty `deviceIds` list is treated as "every camera" rather than "no
1606
- * camera": a window that matches nothing is indistinguishable from a
1607
- * disarmed one, and the operator who asked for it would wait for lines that
1608
- * can never come.
1609
- */
1610
- arm(window) {
1611
- const ids = window.deviceIds;
1612
- this.devices = ids === null || ids.length === 0 ? null : new Set(ids);
1613
- this.closesAtMs = window.armedUntilMs;
1614
- this.on = true;
1615
- }
1616
- /** Disarm. Off the hot path only. */
1617
- disarm() {
1618
- this.on = false;
1619
- this.devices = null;
1620
- this.closesAtMs = 0;
1621
- }
1622
- };
1623
- /**
1624
- * Every channel this PROCESS declares, and the mirror of what is armed on it.
1625
- *
1626
- * One per process. A forked runner has its own, and it is refreshed through
1627
- * the `log-channels` capability by the hub that owns the document — the
1628
- * registry never reaches for a value itself.
1629
- */
1630
- var LogChannelRegistry = class {
1631
- gates = /* @__PURE__ */ new Map();
1632
- /**
1633
- * Declare a channel and get its gate.
1634
- *
1635
- * A duplicate name throws. Two declarations of one name is a programming
1636
- * error, not a merge: the operator would arm one and the other would stay
1637
- * dark, which is the dead-knob shape (D62) with an extra step.
1638
- */
1639
- declare(descriptor) {
1640
- const parsed = LogChannelDescriptorSchema.parse(descriptor);
1641
- if (this.gates.get(parsed.name) !== void 0) throw new Error(`log channel "${parsed.name}" is already declared in this process — two declarations of one name is a programming error, not a merge`);
1642
- const gate = new LogChannelGate(parsed);
1643
- this.gates.set(parsed.name, gate);
1644
- return gate;
1645
- }
1646
- /** The declarations, sorted by name so a list is stable to read and diff. */
1647
- list() {
1648
- return [...this.gates.values()].map((gate) => gate.descriptor).sort((a, b) => a.name.localeCompare(b.name));
1649
- }
1650
- /** The gate for a declared channel, or `undefined`. */
1651
- gate(name) {
1652
- return this.gates.get(name);
1653
- }
1654
- /**
1655
- * Apply the FULL set of armed windows. Off the hot path.
1656
- *
1657
- * Full, not incremental, and that is the whole design: the document is the
1658
- * authority, so a channel the document does not name is disarmed here. An
1659
- * incremental apply would let a disarm get lost in transit and leave a
1660
- * channel running that nobody can see is running.
1661
- *
1662
- * A window already past its deadline is ignored rather than armed — a
1663
- * restore that re-armed an expired window would make a forgotten diagnostic
1664
- * immortal across restarts.
1665
- *
1666
- * Returns the names it could not place, so the caller can log them: a
1667
- * channel named in the document that this process does not declare is
1668
- * either a typo or an addon that has not booted yet, and both deserve a
1669
- * line rather than silence.
1670
- */
1671
- apply(windows, nowMs) {
1672
- const wanted = /* @__PURE__ */ new Map();
1673
- const unknown = [];
1674
- for (const window of windows) {
1675
- if (window.armedUntilMs <= nowMs) continue;
1676
- if (!this.gates.has(window.channel)) {
1677
- unknown.push(window.channel);
1678
- continue;
1679
- }
1680
- wanted.set(window.channel, window);
1681
- }
1682
- for (const [name, gate] of this.gates) {
1683
- const window = wanted.get(name);
1684
- if (window === void 0) gate.disarm();
1685
- else gate.arm(window);
1686
- }
1687
- return unknown;
1688
- }
1689
- /**
1690
- * Disarm whatever has run out. Called on a timer, NEVER from a log path — a
1691
- * diagnostic that adds a `Date.now()` to the path it is measuring measures
1692
- * itself.
1693
- *
1694
- * Returns the names it closed, so the caller can write the one line that
1695
- * says a window ended and stops "it went quiet" from reading as "the branch
1696
- * was not taken".
1697
- */
1698
- tick(nowMs) {
1699
- const closed = [];
1700
- for (const [name, gate] of this.gates) if (gate.on && gate.armedUntilMs <= nowMs) {
1701
- gate.disarm();
1702
- closed.push(name);
1703
- }
1704
- return closed;
1705
- }
1706
- /** The channels armed right now, as the document would describe them. */
1707
- armed() {
1708
- const out = [];
1709
- for (const [name, gate] of this.gates) if (gate.on) out.push({
1710
- channel: name,
1711
- armedUntilMs: gate.armedUntilMs,
1712
- deviceIds: null
1713
- });
1714
- return out;
1715
- }
1716
- };
1717
- //#endregion
1718
- //#region src/logging/log-channel.singleton.ts
1719
- /**
1720
- * Process-wide holder for the {@link LogChannelRegistry}.
1721
- *
1722
- * Three call sites that never meet need the SAME instance: the hot paths that
1723
- * declare a gate at module scope, the `log-channels` provider that enumerates
1724
- * the declarations for the hub, and the same provider applying the windows the
1725
- * document hands down. A registry built inside any one of them would be
1726
- * refreshed and collected — the shape of a knob that never does anything.
1727
- *
1728
- * Same idiom as `logging-gate.singleton.ts` and
1729
- * `http-request-census.singleton.ts`.
1730
- */
1731
- var instance = null;
1732
- /** The process-wide log channel registry. Created empty on first use. */
1733
- function getLogChannelRegistry() {
1734
- instance ??= new LogChannelRegistry();
1735
- return instance;
1736
- }
1737
- /**
1738
- * Declare a channel on the process-wide registry and get its gate.
1739
- *
1740
- * The one call an addon makes. Keep the returned gate in a module-scope
1741
- * `const`: looking a channel up by name per line would put a Map lookup on
1742
- * exactly the path this mechanism exists to keep free.
1743
- *
1744
- * `scripts/check-log-channel-gated.ts` reads these call sites. It pairs the
1745
- * declared name with the binding it is assigned to and refuses to let a
1746
- * channel ship that no `<binding>.on` anywhere consults — a declared channel
1747
- * nobody reads is a knob the operator turns with nothing happening, forever,
1748
- * and without a line. That is D62, and this repo has now shipped it three
1749
- * times (`audioThresholdDbfs`, the HA entities with no source, the second
1750
- * per-camera switch that wrote a store nobody read).
1751
- */
1752
- function declareLogChannel(descriptor) {
1753
- return getLogChannelRegistry().declare(descriptor);
1754
- }
1755
- /** Test-only: drop the instance so a spec starts from an empty registry. */
1756
- function __resetLogChannelRegistryForTests() {
1757
- instance = null;
1758
- }
1759
- //#endregion
1760
- //#region src/logging/log-channel-provider.ts
1761
- /**
1762
- * How often expiry is noticed. Coarse on purpose: the cost of a channel
1763
- * running a few seconds past its deadline is a few extra lines, and the cost
1764
- * of a tight timer in every addon process is paid forever.
1765
- */
1766
- var LOG_CHANNEL_TICK_MS = 5e3;
1767
- /**
1768
- * Build the `log-channels` provider for this process.
1769
- *
1770
- * `logger` is used ONLY off the hot path — for the arm/expiry lines — so a
1771
- * channel that is never armed costs this module nothing but a timer.
1772
- */
1773
- function createLogChannelsProvider(logger, options = {}) {
1774
- const registry = getLogChannelRegistry();
1775
- const now = options.now ?? Date.now;
1776
- const tickMs = options.tickMs ?? 5e3;
1777
- const timer = setInterval(() => {
1778
- const closed = registry.tick(now());
1779
- for (const name of closed) logger.info("log channel window closed", {
1780
- tags: { logChannel: name },
1781
- meta: { channel: name }
1782
- });
1783
- }, tickMs);
1784
- timer.unref?.();
1785
- return {
1786
- list: () => registry.list(),
1787
- apply: (input) => {
1788
- const unknown = registry.apply(input.windows, now());
1789
- const armed = registry.armed();
1790
- logger.info("log channels applied", { meta: {
1791
- armed: armed.map((window) => window.channel),
1792
- unknown,
1793
- declared: registry.list().length
1794
- } });
1795
- return {
1796
- armed: armed.length,
1797
- unknown
1798
- };
1799
- },
1800
- stop: () => {
1801
- clearInterval(timer);
1802
- }
1803
- };
1804
- }
1805
- //#endregion
1806
1434
  //#region src/interfaces/ops-log.ts
1807
1435
  /**
1808
1436
  * Ops-log — the durable, append-only operations audit shared by the
@@ -3014,6 +2642,158 @@ var RECOGNITION_TYPES = [
3014
2642
  "custom"
3015
2643
  ];
3016
2644
  //#endregion
2645
+ //#region src/interfaces/storage-location-mode.ts
2646
+ /**
2647
+ * The storage-location STATE MODEL (D385) — one typed state, one policy module.
2648
+ *
2649
+ * A location's state used to be split across two authorities: the typed
2650
+ * `enabled` field (THE write switch since D383) and an untyped `config.readOnly`
2651
+ * key. They did not mean the same thing — `enabled: false` was still evicted
2652
+ * under disk pressure while `config.readOnly` was deliberately excluded — and
2653
+ * neither name said which. Every consumer re-derived the difference, and the
2654
+ * three questions that actually matter were answered in six places.
2655
+ *
2656
+ * This module is the ONLY place in the repo allowed to interpret the state. It
2657
+ * answers three questions and nothing else:
2658
+ *
2659
+ * - may this location be WRITTEN to? {@link modeMayWrite}
2660
+ * - may this location be READ? {@link modeMayRead}
2661
+ * - what is its eviction policy? {@link evictionPolicyForMode}
2662
+ *
2663
+ * | mode | write | read | eviction |
2664
+ * | ---------- | ----- | ---- | ------------------------------ |
2665
+ * | `active` | yes | yes | `normal` (pressure + usage cap) |
2666
+ * | `readonly` | no | yes | `never` |
2667
+ * | `drain` | no | yes | `drain` (paced, until empty) |
2668
+ * | `disabled` | no | no | `never` |
2669
+ *
2670
+ * `scripts/check-storage-location-mode-single-owner.ts` fails the build when
2671
+ * anything outside this module reads `config['readOnly']` or compares `enabled`
2672
+ * directly. A rule nothing checks has already been broken somewhere.
2673
+ */
2674
+ var STORAGE_LOCATION_MODES = [
2675
+ "active",
2676
+ "readonly",
2677
+ "drain",
2678
+ "disabled"
2679
+ ];
2680
+ /**
2681
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
2682
+ * alias below is `z.infer<>` of it, never a second spelling.
2683
+ */
2684
+ var StorageLocationModeSchema = z.enum(STORAGE_LOCATION_MODES);
2685
+ /**
2686
+ * What disk-pressure and usage-cap relief may do to a location.
2687
+ *
2688
+ * - `normal` — the existing behaviour: free-percent guard plus `maxUsedGb`.
2689
+ * - `never` — excluded entirely. A retiring disk the operator is copying off
2690
+ * must not race the relocate mover, and a disabled one is not the
2691
+ * system's to erase.
2692
+ * - `drain` — a monotonically descending effective usage cap, paced to what
2693
+ * the ACTIVE locations of the same class gained (D386). This is
2694
+ * the only policy that shrinks a location the system is not
2695
+ * writing to.
2696
+ */
2697
+ var StorageEvictionPolicySchema = z.enum([
2698
+ "normal",
2699
+ "never",
2700
+ "drain"
2701
+ ]);
2702
+ /**
2703
+ * The legacy untyped drain key. Named ONCE, here, so the guard has exactly one
2704
+ * sanctioned reader and the string never appears anywhere else.
2705
+ */
2706
+ var LEGACY_READ_ONLY_CONFIG_KEY = "readOnly";
2707
+ /** Is this mode a write target? Only `active` is. */
2708
+ function modeMayWrite(mode) {
2709
+ return mode === "active";
2710
+ }
2711
+ /** May this mode be read (playback, timeline, scrub, relocate source)? */
2712
+ function modeMayRead(mode) {
2713
+ return mode !== "disabled";
2714
+ }
2715
+ /** What eviction may do here. See {@link StorageEvictionPolicy}. */
2716
+ function evictionPolicyForMode(mode) {
2717
+ switch (mode) {
2718
+ case "active": return "normal";
2719
+ case "drain": return "drain";
2720
+ case "readonly":
2721
+ case "disabled": return "never";
2722
+ }
2723
+ }
2724
+ /**
2725
+ * The mode a LEGACY row implies, or `null` when it implies nothing — the row is
2726
+ * already stamped, or it carried neither flag.
2727
+ *
2728
+ * Both legacy flags fold to `readonly`, which is the CONSERVATIVE direction: a
2729
+ * state change must never start deleting footage on its own, and it must never
2730
+ * make footage that was still being served disappear. `enabled: false` used to
2731
+ * leave the location evictable under pressure; folding it to `readonly` stops
2732
+ * that, which is a strictly safer answer than the one it replaces.
2733
+ */
2734
+ function legacyModeOf(location) {
2735
+ if (location.mode !== void 0) return null;
2736
+ if (location.config["readOnly"] === true) return "readonly";
2737
+ if (location.enabled === false) return "readonly";
2738
+ return null;
2739
+ }
2740
+ /**
2741
+ * The state of a location, stamped or folded. THE one interpretation: a row
2742
+ * that predates D385 is never ambiguous, and a stamped `mode` always wins over
2743
+ * whatever the legacy pair still says.
2744
+ */
2745
+ function resolveLocationMode(location) {
2746
+ return (isStorageLocationMode(location.mode) ? location.mode : void 0) ?? legacyModeOf(location) ?? "active";
2747
+ }
2748
+ /** Is this one of the four states? The stamped value crosses a wire, and a
2749
+ * value nobody defined must not be rendered as if it were a state. */
2750
+ function isStorageLocationMode(value) {
2751
+ return STORAGE_LOCATION_MODES.some((mode) => mode === value);
2752
+ }
2753
+ /** May this location be written to? */
2754
+ function mayWriteToLocation(location) {
2755
+ return modeMayWrite(resolveLocationMode(location));
2756
+ }
2757
+ /** May this location be read? A `disabled` one may not — and that is an
2758
+ * operator CHOICE, which callers must report as unavailable rather than as an
2759
+ * unknown-location fault. */
2760
+ function mayReadLocation(location) {
2761
+ return modeMayRead(resolveLocationMode(location));
2762
+ }
2763
+ /** What eviction may do to this location. */
2764
+ function evictionPolicyOfLocation(location) {
2765
+ return evictionPolicyForMode(resolveLocationMode(location));
2766
+ }
2767
+ /**
2768
+ * The config blob with the retired drain key removed. Returns the SAME object
2769
+ * when there was nothing to strip, so a caller can tell "changed" from
2770
+ * "unchanged" by identity and skip a pointless persist.
2771
+ */
2772
+ function strippedOfLegacyReadOnly(config) {
2773
+ if (!("readOnly" in config)) return config;
2774
+ const next = { ...config };
2775
+ delete next[LEGACY_READ_ONLY_CONFIG_KEY];
2776
+ return next;
2777
+ }
2778
+ /**
2779
+ * Set a location's mode, and with it everything that must agree with it.
2780
+ *
2781
+ * `enabled` stays readable for one release as a DERIVED value (`mode ===
2782
+ * 'active'`) so consumers that have not moved yet keep working, and the legacy
2783
+ * `config.readOnly` key is DELETED. This function is the only way to write
2784
+ * either, which is what makes it impossible for the two to disagree.
2785
+ *
2786
+ * Returns a new object — the input is never mutated.
2787
+ */
2788
+ function withLocationMode(location, mode) {
2789
+ return {
2790
+ ...location,
2791
+ mode,
2792
+ enabled: modeMayWrite(mode),
2793
+ config: strippedOfLegacyReadOnly(location.config)
2794
+ };
2795
+ }
2796
+ //#endregion
3017
2797
  //#region src/interfaces/storage-location.ts
3018
2798
  /**
3019
2799
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -3040,8 +2820,11 @@ var StorageLocationTypeSchema = z.string().regex(/^[a-z][a-zA-Z0-9-]*$/);
3040
2820
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
3041
2821
  *
3042
2822
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
3043
- * The default location for a type uses `id === <type>:default` by
3044
- * convention (the bare type ref like `'backups'` resolves to it).
2823
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
2824
+ * There is no default location any more (D383): `enabled` is the whole write
2825
+ * model, and a bare type ref resolves to the sole location of the type, or —
2826
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
2827
+ * slug is `default`.
3045
2828
  *
3046
2829
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
3047
2830
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -3062,23 +2845,37 @@ var StorageLocationSchema = z.object({
3062
2845
  * flag at upsert time, not here (the schema is provider-agnostic).
3063
2846
  */
3064
2847
  nodeId: z.string().optional(),
3065
- isDefault: z.boolean().default(false),
3066
2848
  isSystem: z.boolean().default(false),
3067
2849
  /**
3068
- * Operator opt-in: whether consumers that BALANCE across several locations
3069
- * of a type may write here. Recordings reads it today; event media and
3070
- * backups are the next consumers, which is why the flag lives on the
3071
- * location rather than in any one addon's store — nothing has to be
3072
- * extended to add the next consumer.
2850
+ * THE write switch, and the only one (D383). `enabled: true` means every
2851
+ * consumer that chooses a write target for this type may write here, and all
2852
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
2853
+ * still read, still played back, still age-swept, still drained, never
2854
+ * written.
3073
2855
  *
3074
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
3075
- * flag existed reads back with no flag and keeps working exactly as before;
3076
- * that is the whole compat story, and it is why no migration ships with it.
3077
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
3078
- * disk must not silently start writing to it); the default of a type is
3079
- * always stamped `true`.
2856
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
2857
+ * stored" on an update and "born inert unless it is the first location of its
2858
+ * type" on a create. On a PERSISTED row absence is legacy and it means
2859
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
2860
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
2861
+ * stops existing rather than being re-derived on every read.
3080
2862
  */
3081
2863
  enabled: z.boolean().optional(),
2864
+ /**
2865
+ * THE state of this location (D385), and the only authority on what may be
2866
+ * written, read or evicted here. Interpreted in exactly one place —
2867
+ * `storage-location-mode.ts` — which also folds the legacy
2868
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
2869
+ * ambiguous.
2870
+ *
2871
+ * OPTIONAL only for the wire and for rows written before D385: absence is
2872
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
2873
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
2874
+ * re-derived on every read. `enabled` survives one release as a DERIVED
2875
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
2876
+ * either, so the two cannot disagree.
2877
+ */
2878
+ mode: StorageLocationModeSchema.optional(),
3082
2879
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
3083
2880
  * for node-local locations it can reach) — never persisted, absent when the
3084
2881
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -3086,13 +2883,83 @@ var StorageLocationSchema = z.object({
3086
2883
  totalBytes: z.number(),
3087
2884
  availableBytes: z.number()
3088
2885
  }).nullable().optional(),
2886
+ /**
2887
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
2888
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
2889
+ * never persisted, never a filesystem walk.
2890
+ *
2891
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
2892
+ * location yet — nobody stores here, the owning addon is down, or the first
2893
+ * refresh has not completed. A UI must omit the segment rather than draw it
2894
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
2895
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
2896
+ * be spelled out loud instead of appearing by accident.
2897
+ *
2898
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
2899
+ * about the whole figure rather than about its freshest part.
2900
+ */
2901
+ owned: z.object({
2902
+ bytes: z.number().int().nonnegative(),
2903
+ measuredAtMs: z.number().int().nonnegative()
2904
+ }).optional(),
3089
2905
  createdAt: z.number(),
3090
2906
  updatedAt: z.number()
3091
2907
  });
3092
2908
  /**
2909
+ * The retired `isDefault` key, DECLARED rather than dropped.
2910
+ *
2911
+ * A key removed from a non-strict `z.object` is stripped in silence (D380,
2912
+ * D381): a reader that still needs the old value gets `undefined` and cannot
2913
+ * tell "absent" from "never sent". The one reader that legitimately needs it —
2914
+ * the location store's boot migration, which turns the old default flag into
2915
+ * the `enabled` write set — parses THIS schema against the raw row instead, so
2916
+ * the migration is explicit and the live schema stays clean. Nothing else in
2917
+ * the repo may read it; `scripts/check-no-storage-default.ts` enforces that.
2918
+ */
2919
+ var LegacyStorageLocationDefaultSchema = z.object({ isDefault: z.boolean().optional() });
2920
+ function isLocationEnabled(location) {
2921
+ return mayWriteToLocation({
2922
+ ...location,
2923
+ config: location.config ?? {}
2924
+ });
2925
+ }
2926
+ /**
2927
+ * Bytes in one GB, for every storage figure an operator types.
2928
+ *
2929
+ * BINARY (1024³), everywhere. The repo had both: the orchestrator's
2930
+ * `maxUsedGb` → bytes conversion used 1024³ while the recorder's placement
2931
+ * headroom used 10⁹ for the SAME stored key, so a location with a cap set was
2932
+ * silently 7.4% off depending on which side of the pipe asked. The persisted
2933
+ * values were entered against the binary unit and the admin UI reads it, so
2934
+ * that is the one that stays. Every GB knob — `maxUsedGb`, `minFreeGb` —
2935
+ * converts through {@link gbToBytes} and nowhere else.
2936
+ */
2937
+ var STORAGE_BYTES_PER_GB = 1024 ** 3;
2938
+ /** GB → bytes, binary. Fractional GB is admitted and floored. */
2939
+ function gbToBytes(gb) {
2940
+ return Math.floor(gb * STORAGE_BYTES_PER_GB);
2941
+ }
2942
+ /**
2943
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
2944
+ *
2945
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
2946
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
2947
+ * drain with no observed growth has no honest ETA, and inventing one is how an
2948
+ * operator learns not to believe the screen.
2949
+ */
2950
+ var StorageDrainProgressSchema = z.object({
2951
+ locationId: z.string(),
2952
+ startedAtMs: z.number(),
2953
+ startBytes: z.number(),
2954
+ bytesRemaining: z.number(),
2955
+ drained: z.boolean(),
2956
+ estimatedEmptyAtMs: z.number().nullable()
2957
+ });
2958
+ /**
3093
2959
  * Reference accepted by consumer-facing `api.storage.*` calls.
3094
2960
  * Either:
3095
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
2961
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
2962
+ * (transitionally, the `<type>:default`-slugged row when several exist)
3096
2963
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
3097
2964
  *
3098
2965
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -3456,358 +3323,535 @@ function findTimezone(id) {
3456
3323
  return TIMEZONES.find((tz) => tz.id === id);
3457
3324
  }
3458
3325
  //#endregion
3459
- //#region src/stream-selection.ts
3460
- function pickPreferredRtspEntry(entries, pref, deviceId, options = {}) {
3461
- if (entries.length === 0) return null;
3462
- const prefix = `${deviceId}/`;
3463
- const toPicked = (e) => ({
3464
- brokerId: e.brokerId,
3465
- profileId: e.brokerId.startsWith(prefix) ? e.brokerId.slice(prefix.length) : e.brokerId,
3466
- url: e.url,
3467
- mutedUrl: e.mutedUrl,
3468
- enabled: e.enabled,
3469
- ...e.codec !== void 0 ? { codec: e.codec } : {},
3470
- ...e.resolution !== void 0 ? { resolution: e.resolution } : {}
3471
- });
3472
- if (pref !== "auto") {
3473
- const match = entries.find((e) => e.enabled && e.url.length > 0 && (e.profile === pref || e.brokerId === `${prefix}${pref}`));
3474
- if (match) return toPicked(match);
3475
- }
3476
- const eligible = entries.filter((e) => e.enabled && e.url.length > 0);
3477
- if (eligible.length === 0) return null;
3478
- const target = options.targetResolution;
3479
- if (target) {
3480
- const withRes = eligible.filter((e) => e.resolution !== void 0);
3481
- if (withRes.length > 0) {
3482
- const picked = pickClosestResolution(withRes, target);
3483
- if (picked) return toPicked(picked);
3484
- }
3485
- }
3486
- return toPicked(eligible[0]);
3487
- }
3488
- /**
3489
- * Pick the entry whose `resolution` is closest to `target`. Prefer
3490
- * entries ≥ target (downscale is cheap at the consumer; upscale is
3491
- * lossy). Among the rest pick the LARGEST still ≤ target so the
3492
- * consumer gets the best feasible quality. "Closeness" is the
3493
- * `width × height` pixel delta.
3494
- */
3495
- function pickClosestResolution(entries, target) {
3496
- const targetPixels = target.width * target.height;
3497
- let bestAbove;
3498
- let bestBelow;
3499
- for (const e of entries) {
3500
- if (e.resolution === void 0) continue;
3501
- const pixels = e.resolution.width * e.resolution.height;
3502
- if (pixels >= targetPixels) {
3503
- if (!bestAbove || pixels < bestAbove.pixels) bestAbove = {
3504
- entry: e,
3505
- pixels
3506
- };
3507
- } else if (!bestBelow || pixels > bestBelow.pixels) bestBelow = {
3508
- entry: e,
3509
- pixels
3510
- };
3511
- }
3512
- return bestAbove?.entry ?? bestBelow?.entry;
3513
- }
3514
- //#endregion
3515
- //#region src/metrics/load-series-fold.ts
3516
- /** Bucket key for rows no addon owns. Stable, so its series is continuous. */
3517
- var UNATTRIBUTED_BUCKET_KEY = "__unattributed__";
3518
- var ROOT_BUCKET_KEY = "__root__";
3519
- function bucketFor(row) {
3520
- if (row.addonId !== null) return {
3521
- key: row.addonId,
3522
- kind: "addon"
3523
- };
3524
- if (row.classification === "root") return {
3525
- key: ROOT_BUCKET_KEY,
3526
- kind: "root"
3527
- };
3528
- return {
3529
- key: UNATTRIBUTED_BUCKET_KEY,
3530
- kind: "unattributed"
3531
- };
3532
- }
3533
- /** Round to one decimal — the precision both producers already emit at. */
3534
- function deci(value) {
3535
- return Math.round(value * 10) / 10;
3536
- }
3537
- /**
3538
- * Fold one snapshot into one point per function.
3539
- *
3540
- * Produces a ONE-SAMPLE point: `min === max` on every field, `samples === 1`.
3541
- * That is what lets a live event and a reduced server bucket sit in the same
3542
- * series without the consumer knowing which is which.
3543
- */
3544
- function foldSnapshotByFunction(rows, atMs) {
3545
- const acc = /* @__PURE__ */ new Map();
3546
- for (const row of rows) {
3547
- const { key, kind } = bucketFor(row);
3548
- const cur = acc.get(key) ?? {
3549
- kind,
3550
- main: 0,
3551
- gc: 0,
3552
- lifetime: 0,
3553
- memory: 0,
3554
- count: 0,
3555
- splitKnown: true
3556
- };
3557
- const known = row.cpuMainPercent !== null && row.cpuGcPercent !== null;
3558
- acc.set(key, {
3559
- kind: cur.kind,
3560
- main: cur.main + (row.cpuMainPercent ?? 0),
3561
- gc: cur.gc + (row.cpuGcPercent ?? 0),
3562
- lifetime: cur.lifetime + row.cpuPercent,
3563
- memory: cur.memory + row.memoryRssBytes,
3564
- count: cur.count + 1,
3565
- splitKnown: cur.splitKnown && known
3566
- });
3567
- }
3568
- return [...acc.entries()].map(([key, a]) => {
3569
- const main = a.splitKnown ? deci(a.main) : null;
3570
- const gc = a.splitKnown ? deci(a.gc) : null;
3571
- const lifetime = deci(a.lifetime);
3572
- return {
3573
- key,
3574
- kind: a.kind,
3575
- point: {
3576
- atMs,
3577
- samples: 1,
3578
- cpuMainPercent: main,
3579
- cpuMainPercentMin: main,
3580
- cpuGcPercent: gc,
3581
- cpuGcPercentMin: gc,
3582
- cpuLifetimePercent: lifetime,
3583
- cpuLifetimePercentMin: lifetime,
3584
- memoryRssBytes: a.memory,
3585
- memoryRssBytesMin: a.memory,
3586
- processCount: a.count,
3587
- processCountMin: a.count
3588
- }
3589
- };
3590
- });
3591
- }
3592
- /** The narrower of two bounds, treating `null` (UNKNOWN) as absorbing. */
3593
- function minNullable(a, b) {
3594
- if (a === null || b === null) return null;
3595
- return a < b ? a : b;
3596
- }
3597
- function maxNullable(a, b) {
3598
- if (a === null || b === null) return null;
3599
- return a > b ? a : b;
3600
- }
3601
- /** Merge `next` into `held`, keeping the widest [min, max] of each field. */
3602
- function mergePoints(held, next, atMs) {
3603
- return {
3604
- atMs,
3605
- samples: held.samples + next.samples,
3606
- cpuMainPercent: maxNullable(held.cpuMainPercent, next.cpuMainPercent),
3607
- cpuMainPercentMin: minNullable(held.cpuMainPercentMin, next.cpuMainPercentMin),
3608
- cpuGcPercent: maxNullable(held.cpuGcPercent, next.cpuGcPercent),
3609
- cpuGcPercentMin: minNullable(held.cpuGcPercentMin, next.cpuGcPercentMin),
3610
- cpuLifetimePercent: Math.max(held.cpuLifetimePercent, next.cpuLifetimePercent),
3611
- cpuLifetimePercentMin: Math.min(held.cpuLifetimePercentMin, next.cpuLifetimePercentMin),
3612
- memoryRssBytes: Math.max(held.memoryRssBytes, next.memoryRssBytes),
3613
- memoryRssBytesMin: Math.min(held.memoryRssBytesMin, next.memoryRssBytesMin),
3614
- processCount: Math.max(held.processCount, next.processCount),
3615
- processCountMin: Math.min(held.processCountMin, next.processCountMin)
3616
- };
3617
- }
3618
- /**
3619
- * The bucket width that brings `spanMs` down to at most `maxPoints` points,
3620
- * snapped up to a whole multiple of the sampling cadence.
3621
- *
3622
- * Returns `cadenceMs` (no reduction) when the span already fits. A caller that
3623
- * asks for a `maxPoints` of 0 or less gets no reduction rather than an
3624
- * infinite bucket — a nonsensical request must not produce a plausible chart.
3625
- */
3626
- function resolveBucketMs(spanMs, cadenceMs, maxPoints) {
3627
- if (maxPoints <= 0 || cadenceMs <= 0 || spanMs <= 0) return Math.max(cadenceMs, 1);
3628
- const wanted = spanMs / maxPoints;
3629
- if (wanted <= cadenceMs) return cadenceMs;
3630
- return Math.ceil(wanted / cadenceMs) * cadenceMs;
3631
- }
3632
- /**
3633
- * Reduce one function's points into buckets of `bucketMs`, preserving the
3634
- * extremes.
3635
- *
3636
- * Points are expected oldest-first and are returned oldest-first. A bucket
3637
- * with no samples is ABSENT — not zero, not interpolated, not the previous
3638
- * value held over.
3639
- */
3640
- function reducePoints(points, bucketMs, origin) {
3641
- if (bucketMs <= 0 || points.length === 0) return points;
3642
- const buckets = /* @__PURE__ */ new Map();
3643
- for (const point of points) {
3644
- const start = origin + Math.floor((point.atMs - origin) / bucketMs) * bucketMs;
3645
- const held = buckets.get(start);
3646
- buckets.set(start, held === void 0 ? {
3647
- ...point,
3648
- atMs: start
3649
- } : mergePoints(held, point, start));
3650
- }
3651
- return [...buckets.values()].toSorted((a, b) => a.atMs - b.atMs);
3652
- }
3653
- //#endregion
3654
- //#region src/metrics/failure-counters.ts
3326
+ //#region src/logging/log-channel.ts
3655
3327
  /**
3656
- * `FailureCounters` — the per-camera counter every "how often does this camera
3657
- * lose work, and why" question is answered from.
3658
- *
3659
- * ## Why a primitive and not four counters
3660
- *
3661
- * Four open failure modes were being triaged on 2026-08-28 and every one of
3662
- * them was measured the same way: grep a log line, count it, and then guess at
3663
- * the denominator. The guess is the defect. `enrichment crop native miss` read
3664
- * as "35x worse than yesterday" and turned out to be **flat all day** the
3665
- * moment it was divided by the successes on the same path — 0.25 misses per
3666
- * landed capture, 0.08–0.33 across twelve hours, no trend. The count moved
3667
- * because the traffic moved.
3668
- *
3669
- * So the unit here is not a counter. It is a **ratio with its denominator
3670
- * attached**: {@link FailureCounterSample.attempts} is incremented on every
3671
- * try, {@link FailureCounterSample.succeeded} on the ones that landed, and the
3672
- * reasons partition the rest. A consumer can always divide; it can never
3673
- * un-divide a bare count.
3674
- *
3675
- * ## Per camera, always
3328
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
3329
+ * an addon declares its channels in.
3676
3330
  *
3677
- * The key is the numeric `deviceId` — the same value every log line in this
3678
- * repo carries as `tags.deviceId`. There is no fleet-total mode and no
3679
- * device-less bucket, because the question is always "why is 617 worse than
3680
- * 615?" and a fleet total cannot answer it. A caller that cannot name the
3681
- * camera must not note anything: an unnamed per-camera count is
3682
- * indistinguishable from a shared one, which is how one camera's failures
3683
- * quietly become everybody's.
3331
+ * ## Two axes, deliberately separated
3684
3332
  *
3685
- * ## Cumulative, never drained
3333
+ * - **DECLARATION** — which channels exist. Only the addon knows:
3334
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
3335
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
3336
+ * and rots silently. So a channel is declared where it is consulted, and the
3337
+ * `log-channels` capability enumerates the declarations.
3338
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
3339
+ * thing: the logging settings document on the `system` cap. Two authorities
3340
+ * over the values is the exact defect
3341
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
3342
+ * remove; re-introducing it from the cure side would be grotesque.
3686
3343
  *
3687
- * A read NEVER resets anything. `load-contribution.cap.ts` already argued this
3688
- * for CPU seconds and the argument carries over verbatim: *"a rate needs a
3689
- * window, a window needs a sampler, and a new per-node sampler is the defect
3690
- * half of `docs/architecture/load-ledger.md` documents. A counter can be
3691
- * differenced by whoever already keeps a history; a rate cannot be
3692
- * un-averaged."* A draining read has a second failure this surface cannot
3693
- * afford — two consumers polling it would each destroy half of the other's
3694
- * numbers, silently.
3344
+ * Nothing in this file reads a clock, an env var or a store. The registry is
3345
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
3346
+ * the hot path with a value somebody actually read, and by
3347
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
3348
+ * never reaches here, so it can neither disarm an armed channel nor arm a
3349
+ * disarmed one (D49).
3695
3350
  *
3696
- * {@link FailureCounterSample.sinceMs} is the incarnation marker: it is when
3697
- * this counter started, and a consumer differencing two reads must drop the
3698
- * interval when it changes, because the counter restarted from zero in a new
3699
- * process.
3351
+ * ## The canonical call shape
3700
3352
  *
3701
- * ## Bounded, and the bound is the point
3353
+ * ```ts
3354
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
3355
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
3356
+ * }
3357
+ * ```
3702
3358
  *
3703
- * This lives in the memory of a process that is already the subject of an RSS
3704
- * budget, so both dimensions are capped: {@link MAX_KEYS} counters and
3705
- * {@link MAX_REASONS_PER_KEY} distinct reasons within one. Past the reason cap
3706
- * the counts are folded into {@link OVERFLOW_REASON} rather than dropped —
3707
- * losing them would make `attempts - succeeded` stop equalling the reason
3708
- * total, and the ratio the whole surface exists to publish would quietly stop
3709
- * adding up. Past the key cap a new key is refused and
3710
- * {@link FailureCounters.keysRefused} says so, so the omission is visible
3711
- * instead of silent.
3359
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
3360
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
3361
+ * object literal is never constructed because it lives inside the branch. It
3362
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
3363
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
3364
+ * destination floor (measured at 1.93 ns/call when off).
3712
3365
  *
3713
- * ## No timers, no IO, no logging
3366
+ * ## Why a channel emits at `info`
3714
3367
  *
3715
- * Pure. It is read on whatever beat the caller already has. A telemetry
3716
- * primitive that schedules its own work is a second sampler, and this repo has
3717
- * paid for one of those already (`docs/architecture/load-ledger.md`).
3368
+ * `loki-logging.addon.ts` pins the destination default at `info` and
3369
+ * `loki-destination.ts` drops everything below it, so a line emitted at
3370
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
3371
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
3372
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
3373
+ * emits at the channel's declared level, whose schema floor is `info`.
3718
3374
  */
3719
- /** Distinct reason strings kept per counter before folding. */
3720
- var MAX_REASONS_PER_KEY = 16;
3721
3375
  /**
3722
- * Distinct (device, family, variant) counters one instance will hold.
3376
+ * The level a channel writes at once armed.
3723
3377
  *
3724
- * A large fleet x the handful of families any single addon reports, with
3725
- * slack. At ~200 B per counter this is a ~100 KB ceiling on a process that
3726
- * already declares an RSS budget in the gigabytes.
3378
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
3379
+ * not leave the process for Loki, and the whole point of arming a channel is
3380
+ * to read it later.
3727
3381
  */
3728
- var MAX_KEYS = 1024;
3382
+ var LogChannelLevelSchema = z.enum([
3383
+ "info",
3384
+ "warn",
3385
+ "error"
3386
+ ]);
3729
3387
  /**
3730
- * Where reasons past {@link MAX_REASONS_PER_KEY} go.
3388
+ * What an addon declares about one channel. No value, no state — a
3389
+ * declaration is inert.
3390
+ */
3391
+ var LogChannelDescriptorSchema = z.object({
3392
+ /**
3393
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
3394
+ * the addon's short name so an operator reading a channel list can tell who
3395
+ * owns it without a second lookup.
3396
+ */
3397
+ name: z.string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
3398
+ /** One sentence: what the operator will SEE after arming it. */
3399
+ description: z.string().min(1),
3400
+ /** The level its lines are emitted at. Never below `info`. */
3401
+ defaultLevel: LogChannelLevelSchema,
3402
+ /**
3403
+ * Whether this channel can be narrowed to a camera.
3404
+ *
3405
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
3406
+ * consulted with the numeric device id, AND every line the channel admits
3407
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
3408
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
3409
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
3410
+ * the body is the only way to filter.
3411
+ *
3412
+ * A channel whose lines carry the device only in `meta` (or not at all) is
3413
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
3414
+ * the operator narrows to one camera, sees nothing, and concludes the code
3415
+ * path was never taken.
3416
+ */
3417
+ perDevice: z.boolean()
3418
+ });
3419
+ /**
3420
+ * An armed window over one channel, as the document hands it to a mirror.
3731
3421
  *
3732
- * They are FOLDED, never dropped: `attempts - succeeded` must always equal the
3733
- * sum of the reason counts, or the ratio stops adding up.
3422
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
3423
+ * expires by itself, which is the one failure a boolean cannot avoid.
3734
3424
  */
3735
- var OVERFLOW_REASON = "other";
3736
- /** `deviceId` + `family` + optional `variant`, flattened into the map key. */
3737
- function counterKey(deviceId, family, variant) {
3738
- return variant === void 0 ? `${deviceId}${family}` : `${deviceId}${family}${variant}`;
3739
- }
3425
+ var LogChannelWindowSchema = z.object({
3426
+ channel: z.string().min(1),
3427
+ /** Epoch ms the window closes at. */
3428
+ armedUntilMs: z.number(),
3429
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
3430
+ deviceIds: z.array(z.number().int()).readonly().nullable()
3431
+ });
3740
3432
  /**
3741
- * A bounded set of per-camera, cumulative failure counters.
3433
+ * The gate a hot path holds.
3742
3434
  *
3743
- * One instance per contributing subsystem. `note` is O(1) and allocation-free
3744
- * on the steady path; `snapshot` reads without mutating anything.
3435
+ * Obtain it ONCE — at module scope or in a constructor — and keep the
3436
+ * reference. Looking a channel up by name per line would put a Map lookup on
3437
+ * the path this class exists to keep free.
3745
3438
  */
3746
- var FailureCounters = class {
3747
- maxKeys;
3748
- maxReasons;
3749
- counters = /* @__PURE__ */ new Map();
3750
- refused = 0;
3751
- constructor(maxKeys = MAX_KEYS, maxReasons = 16) {
3752
- this.maxKeys = maxKeys;
3753
- this.maxReasons = maxReasons;
3754
- }
3439
+ var LogChannelGate = class {
3440
+ descriptor;
3755
3441
  /**
3756
- * Counters refused because {@link MAX_KEYS} was already held.
3442
+ * HOT PATH GUARD. A plain data FIELD, and it must stay one.
3757
3443
  *
3758
- * Cumulative for the life of the instance: a bound that bit is a fact about
3759
- * the deployment, and a surface that hid it would under-report a fleet
3760
- * precisely when the fleet got large enough to matter.
3444
+ * `log-channel.spec.ts` asserts the property descriptor has no getter and
3445
+ * booby-traps the device set, so turning this into an accessor — or reading
3446
+ * anything before it — fails the spec instead of taxing every line the
3447
+ * process emits.
3761
3448
  */
3762
- get keysRefused() {
3763
- return this.refused;
3449
+ on = false;
3450
+ /** `null` while armed for every camera. Never read while `on` is false. */
3451
+ devices = null;
3452
+ level;
3453
+ closesAtMs = 0;
3454
+ constructor(descriptor) {
3455
+ this.descriptor = descriptor;
3456
+ this.level = descriptor.defaultLevel;
3764
3457
  }
3765
- /** Counters currently held. */
3766
- get size() {
3767
- return this.counters.size;
3458
+ /** Epoch ms this channel disarms itself at. 0 when disarmed. */
3459
+ get armedUntilMs() {
3460
+ return this.on ? this.closesAtMs : 0;
3768
3461
  }
3769
3462
  /**
3770
- * Fold one observation in.
3463
+ * Does this channel want a line about `deviceId`?
3771
3464
  *
3772
- * A non-positive or non-integer `deviceId` is REFUSED rather than bucketed:
3773
- * see the module docblock — an entry that cannot name its camera is worse
3774
- * than no entry.
3465
+ * Call it only behind `gate.on &&`. On its own it is still correct — the
3466
+ * guard is repeated inside — but the point of the prefix is that a disarmed
3467
+ * channel must not pay the call at all.
3775
3468
  */
3776
- note(observation, nowMs) {
3777
- if (!Number.isInteger(observation.deviceId) || observation.deviceId <= 0) return;
3778
- const key = counterKey(observation.deviceId, observation.family, observation.variant);
3779
- let counter = this.counters.get(key);
3780
- if (counter === void 0) {
3781
- if (this.counters.size >= this.maxKeys) {
3782
- this.refused += 1;
3783
- return;
3784
- }
3785
- counter = {
3786
- deviceId: observation.deviceId,
3787
- family: observation.family,
3788
- variant: observation.variant,
3789
- sinceMs: nowMs,
3790
- attempts: 0,
3791
- succeeded: 0,
3792
- reasons: /* @__PURE__ */ new Map()
3793
- };
3794
- this.counters.set(key, counter);
3795
- }
3796
- counter.attempts += 1;
3797
- if (observation.reason === void 0) {
3798
- counter.succeeded += 1;
3799
- return;
3800
- }
3801
- const reason = counter.reasons.has(observation.reason) || counter.reasons.size < this.maxReasons ? observation.reason : OVERFLOW_REASON;
3802
- counter.reasons.set(reason, (counter.reasons.get(reason) ?? 0) + 1);
3469
+ wants(deviceId) {
3470
+ if (!this.on) return false;
3471
+ return this.devices === null || this.devices.has(deviceId);
3803
3472
  }
3804
- /** Read every counter. Never mutates — see the module docblock. */
3805
- snapshot(nowMs) {
3806
- const out = [];
3807
- for (const counter of this.counters.values()) out.push({
3808
- deviceId: counter.deviceId,
3809
- family: counter.family,
3810
- ...counter.variant !== void 0 ? { variant: counter.variant } : {},
3473
+ /**
3474
+ * Emit one line on this channel, at the channel's declared level.
3475
+ *
3476
+ * The channel name is added as `tags.logChannel` so LogQL can select the
3477
+ * channel without matching on the message text, and whatever `tags` the
3478
+ * caller passed — `deviceId` above all — is preserved.
3479
+ */
3480
+ log(logger, message, extras) {
3481
+ if (!this.on) return;
3482
+ const tags = {
3483
+ ...extras.tags,
3484
+ logChannel: this.descriptor.name
3485
+ };
3486
+ const line = {
3487
+ ...extras,
3488
+ tags
3489
+ };
3490
+ if (this.level === "error") logger.error(message, line);
3491
+ else if (this.level === "warn") logger.warn(message, line);
3492
+ else logger.info(message, line);
3493
+ }
3494
+ /**
3495
+ * Arm (or RE-arm, restarting) this channel. Off the hot path only.
3496
+ *
3497
+ * An empty `deviceIds` list is treated as "every camera" rather than "no
3498
+ * camera": a window that matches nothing is indistinguishable from a
3499
+ * disarmed one, and the operator who asked for it would wait for lines that
3500
+ * can never come.
3501
+ */
3502
+ arm(window) {
3503
+ const ids = window.deviceIds;
3504
+ this.devices = ids === null || ids.length === 0 ? null : new Set(ids);
3505
+ this.closesAtMs = window.armedUntilMs;
3506
+ this.on = true;
3507
+ }
3508
+ /** Disarm. Off the hot path only. */
3509
+ disarm() {
3510
+ this.on = false;
3511
+ this.devices = null;
3512
+ this.closesAtMs = 0;
3513
+ }
3514
+ };
3515
+ /**
3516
+ * Every channel this PROCESS declares, and the mirror of what is armed on it.
3517
+ *
3518
+ * One per process. A forked runner has its own, and it is refreshed through
3519
+ * the `log-channels` capability by the hub that owns the document — the
3520
+ * registry never reaches for a value itself.
3521
+ */
3522
+ var LogChannelRegistry = class {
3523
+ gates = /* @__PURE__ */ new Map();
3524
+ /**
3525
+ * Declare a channel and get its gate.
3526
+ *
3527
+ * A duplicate name throws. Two declarations of one name is a programming
3528
+ * error, not a merge: the operator would arm one and the other would stay
3529
+ * dark, which is the dead-knob shape (D62) with an extra step.
3530
+ */
3531
+ declare(descriptor) {
3532
+ const parsed = LogChannelDescriptorSchema.parse(descriptor);
3533
+ if (this.gates.get(parsed.name) !== void 0) throw new Error(`log channel "${parsed.name}" is already declared in this process — two declarations of one name is a programming error, not a merge`);
3534
+ const gate = new LogChannelGate(parsed);
3535
+ this.gates.set(parsed.name, gate);
3536
+ return gate;
3537
+ }
3538
+ /** The declarations, sorted by name so a list is stable to read and diff. */
3539
+ list() {
3540
+ return [...this.gates.values()].map((gate) => gate.descriptor).sort((a, b) => a.name.localeCompare(b.name));
3541
+ }
3542
+ /** The gate for a declared channel, or `undefined`. */
3543
+ gate(name) {
3544
+ return this.gates.get(name);
3545
+ }
3546
+ /**
3547
+ * Apply the FULL set of armed windows. Off the hot path.
3548
+ *
3549
+ * Full, not incremental, and that is the whole design: the document is the
3550
+ * authority, so a channel the document does not name is disarmed here. An
3551
+ * incremental apply would let a disarm get lost in transit and leave a
3552
+ * channel running that nobody can see is running.
3553
+ *
3554
+ * A window already past its deadline is ignored rather than armed — a
3555
+ * restore that re-armed an expired window would make a forgotten diagnostic
3556
+ * immortal across restarts.
3557
+ *
3558
+ * Returns the names it could not place, so the caller can log them: a
3559
+ * channel named in the document that this process does not declare is
3560
+ * either a typo or an addon that has not booted yet, and both deserve a
3561
+ * line rather than silence.
3562
+ */
3563
+ apply(windows, nowMs) {
3564
+ const wanted = /* @__PURE__ */ new Map();
3565
+ const unknown = [];
3566
+ for (const window of windows) {
3567
+ if (window.armedUntilMs <= nowMs) continue;
3568
+ if (!this.gates.has(window.channel)) {
3569
+ unknown.push(window.channel);
3570
+ continue;
3571
+ }
3572
+ wanted.set(window.channel, window);
3573
+ }
3574
+ for (const [name, gate] of this.gates) {
3575
+ const window = wanted.get(name);
3576
+ if (window === void 0) gate.disarm();
3577
+ else gate.arm(window);
3578
+ }
3579
+ return unknown;
3580
+ }
3581
+ /**
3582
+ * Disarm whatever has run out. Called on a timer, NEVER from a log path — a
3583
+ * diagnostic that adds a `Date.now()` to the path it is measuring measures
3584
+ * itself.
3585
+ *
3586
+ * Returns the names it closed, so the caller can write the one line that
3587
+ * says a window ended and stops "it went quiet" from reading as "the branch
3588
+ * was not taken".
3589
+ */
3590
+ tick(nowMs) {
3591
+ const closed = [];
3592
+ for (const [name, gate] of this.gates) if (gate.on && gate.armedUntilMs <= nowMs) {
3593
+ gate.disarm();
3594
+ closed.push(name);
3595
+ }
3596
+ return closed;
3597
+ }
3598
+ /** The channels armed right now, as the document would describe them. */
3599
+ armed() {
3600
+ const out = [];
3601
+ for (const [name, gate] of this.gates) if (gate.on) out.push({
3602
+ channel: name,
3603
+ armedUntilMs: gate.armedUntilMs,
3604
+ deviceIds: null
3605
+ });
3606
+ return out;
3607
+ }
3608
+ };
3609
+ //#endregion
3610
+ //#region src/logging/log-channel.singleton.ts
3611
+ /**
3612
+ * Process-wide holder for the {@link LogChannelRegistry}.
3613
+ *
3614
+ * Three call sites that never meet need the SAME instance: the hot paths that
3615
+ * declare a gate at module scope, the `log-channels` provider that enumerates
3616
+ * the declarations for the hub, and the same provider applying the windows the
3617
+ * document hands down. A registry built inside any one of them would be
3618
+ * refreshed and collected — the shape of a knob that never does anything.
3619
+ *
3620
+ * Same idiom as `logging-gate.singleton.ts` and
3621
+ * `http-request-census.singleton.ts`.
3622
+ */
3623
+ var instance = null;
3624
+ /** The process-wide log channel registry. Created empty on first use. */
3625
+ function getLogChannelRegistry() {
3626
+ instance ??= new LogChannelRegistry();
3627
+ return instance;
3628
+ }
3629
+ /**
3630
+ * Declare a channel on the process-wide registry and get its gate.
3631
+ *
3632
+ * The one call an addon makes. Keep the returned gate in a module-scope
3633
+ * `const`: looking a channel up by name per line would put a Map lookup on
3634
+ * exactly the path this mechanism exists to keep free.
3635
+ *
3636
+ * `scripts/check-log-channel-gated.ts` reads these call sites. It pairs the
3637
+ * declared name with the binding it is assigned to and refuses to let a
3638
+ * channel ship that no `<binding>.on` anywhere consults — a declared channel
3639
+ * nobody reads is a knob the operator turns with nothing happening, forever,
3640
+ * and without a line. That is D62, and this repo has now shipped it three
3641
+ * times (`audioThresholdDbfs`, the HA entities with no source, the second
3642
+ * per-camera switch that wrote a store nobody read).
3643
+ */
3644
+ function declareLogChannel(descriptor) {
3645
+ return getLogChannelRegistry().declare(descriptor);
3646
+ }
3647
+ /** Test-only: drop the instance so a spec starts from an empty registry. */
3648
+ function __resetLogChannelRegistryForTests() {
3649
+ instance = null;
3650
+ }
3651
+ //#endregion
3652
+ //#region src/logging/log-channel-provider.ts
3653
+ /**
3654
+ * How often expiry is noticed. Coarse on purpose: the cost of a channel
3655
+ * running a few seconds past its deadline is a few extra lines, and the cost
3656
+ * of a tight timer in every addon process is paid forever.
3657
+ */
3658
+ var LOG_CHANNEL_TICK_MS = 5e3;
3659
+ /**
3660
+ * Build the `log-channels` provider for this process.
3661
+ *
3662
+ * `logger` is used ONLY off the hot path — for the arm/expiry lines — so a
3663
+ * channel that is never armed costs this module nothing but a timer.
3664
+ */
3665
+ function createLogChannelsProvider(logger, options = {}) {
3666
+ const registry = getLogChannelRegistry();
3667
+ const now = options.now ?? Date.now;
3668
+ const tickMs = options.tickMs ?? 5e3;
3669
+ const timer = setInterval(() => {
3670
+ const closed = registry.tick(now());
3671
+ for (const name of closed) logger.info("log channel window closed", {
3672
+ tags: { logChannel: name },
3673
+ meta: { channel: name }
3674
+ });
3675
+ }, tickMs);
3676
+ timer.unref?.();
3677
+ return {
3678
+ list: () => registry.list(),
3679
+ apply: (input) => {
3680
+ const unknown = registry.apply(input.windows, now());
3681
+ const armed = registry.armed();
3682
+ logger.info("log channels applied", { meta: {
3683
+ armed: armed.map((window) => window.channel),
3684
+ unknown,
3685
+ declared: registry.list().length
3686
+ } });
3687
+ return {
3688
+ armed: armed.length,
3689
+ unknown
3690
+ };
3691
+ },
3692
+ stop: () => {
3693
+ clearInterval(timer);
3694
+ }
3695
+ };
3696
+ }
3697
+ //#endregion
3698
+ //#region src/metrics/failure-counters.ts
3699
+ /**
3700
+ * `FailureCounters` — the per-camera counter every "how often does this camera
3701
+ * lose work, and why" question is answered from.
3702
+ *
3703
+ * ## Why a primitive and not four counters
3704
+ *
3705
+ * Four open failure modes were being triaged on 2026-08-28 and every one of
3706
+ * them was measured the same way: grep a log line, count it, and then guess at
3707
+ * the denominator. The guess is the defect. `enrichment crop native miss` read
3708
+ * as "35x worse than yesterday" and turned out to be **flat all day** the
3709
+ * moment it was divided by the successes on the same path — 0.25 misses per
3710
+ * landed capture, 0.08–0.33 across twelve hours, no trend. The count moved
3711
+ * because the traffic moved.
3712
+ *
3713
+ * So the unit here is not a counter. It is a **ratio with its denominator
3714
+ * attached**: {@link FailureCounterSample.attempts} is incremented on every
3715
+ * try, {@link FailureCounterSample.succeeded} on the ones that landed, and the
3716
+ * reasons partition the rest. A consumer can always divide; it can never
3717
+ * un-divide a bare count.
3718
+ *
3719
+ * ## Per camera, always
3720
+ *
3721
+ * The key is the numeric `deviceId` — the same value every log line in this
3722
+ * repo carries as `tags.deviceId`. There is no fleet-total mode and no
3723
+ * device-less bucket, because the question is always "why is 617 worse than
3724
+ * 615?" and a fleet total cannot answer it. A caller that cannot name the
3725
+ * camera must not note anything: an unnamed per-camera count is
3726
+ * indistinguishable from a shared one, which is how one camera's failures
3727
+ * quietly become everybody's.
3728
+ *
3729
+ * ## Cumulative, never drained
3730
+ *
3731
+ * A read NEVER resets anything. `load-contribution.cap.ts` already argued this
3732
+ * for CPU seconds and the argument carries over verbatim: *"a rate needs a
3733
+ * window, a window needs a sampler, and a new per-node sampler is the defect
3734
+ * half of `docs/architecture/load-ledger.md` documents. A counter can be
3735
+ * differenced by whoever already keeps a history; a rate cannot be
3736
+ * un-averaged."* A draining read has a second failure this surface cannot
3737
+ * afford — two consumers polling it would each destroy half of the other's
3738
+ * numbers, silently.
3739
+ *
3740
+ * {@link FailureCounterSample.sinceMs} is the incarnation marker: it is when
3741
+ * this counter started, and a consumer differencing two reads must drop the
3742
+ * interval when it changes, because the counter restarted from zero in a new
3743
+ * process.
3744
+ *
3745
+ * ## Bounded, and the bound is the point
3746
+ *
3747
+ * This lives in the memory of a process that is already the subject of an RSS
3748
+ * budget, so both dimensions are capped: {@link MAX_KEYS} counters and
3749
+ * {@link MAX_REASONS_PER_KEY} distinct reasons within one. Past the reason cap
3750
+ * the counts are folded into {@link OVERFLOW_REASON} rather than dropped —
3751
+ * losing them would make `attempts - succeeded` stop equalling the reason
3752
+ * total, and the ratio the whole surface exists to publish would quietly stop
3753
+ * adding up. Past the key cap a new key is refused and
3754
+ * {@link FailureCounters.keysRefused} says so, so the omission is visible
3755
+ * instead of silent.
3756
+ *
3757
+ * ## No timers, no IO, no logging
3758
+ *
3759
+ * Pure. It is read on whatever beat the caller already has. A telemetry
3760
+ * primitive that schedules its own work is a second sampler, and this repo has
3761
+ * paid for one of those already (`docs/architecture/load-ledger.md`).
3762
+ */
3763
+ /** Distinct reason strings kept per counter before folding. */
3764
+ var MAX_REASONS_PER_KEY = 16;
3765
+ /**
3766
+ * Distinct (device, family, variant) counters one instance will hold.
3767
+ *
3768
+ * A large fleet x the handful of families any single addon reports, with
3769
+ * slack. At ~200 B per counter this is a ~100 KB ceiling on a process that
3770
+ * already declares an RSS budget in the gigabytes.
3771
+ */
3772
+ var MAX_KEYS = 1024;
3773
+ /**
3774
+ * Where reasons past {@link MAX_REASONS_PER_KEY} go.
3775
+ *
3776
+ * They are FOLDED, never dropped: `attempts - succeeded` must always equal the
3777
+ * sum of the reason counts, or the ratio stops adding up.
3778
+ */
3779
+ var OVERFLOW_REASON = "other";
3780
+ /** `deviceId` + `family` + optional `variant`, flattened into the map key. */
3781
+ function counterKey(deviceId, family, variant) {
3782
+ return variant === void 0 ? `${deviceId}${family}` : `${deviceId}${family}${variant}`;
3783
+ }
3784
+ /**
3785
+ * A bounded set of per-camera, cumulative failure counters.
3786
+ *
3787
+ * One instance per contributing subsystem. `note` is O(1) and allocation-free
3788
+ * on the steady path; `snapshot` reads without mutating anything.
3789
+ */
3790
+ var FailureCounters = class {
3791
+ maxKeys;
3792
+ maxReasons;
3793
+ counters = /* @__PURE__ */ new Map();
3794
+ refused = 0;
3795
+ constructor(maxKeys = MAX_KEYS, maxReasons = 16) {
3796
+ this.maxKeys = maxKeys;
3797
+ this.maxReasons = maxReasons;
3798
+ }
3799
+ /**
3800
+ * Counters refused because {@link MAX_KEYS} was already held.
3801
+ *
3802
+ * Cumulative for the life of the instance: a bound that bit is a fact about
3803
+ * the deployment, and a surface that hid it would under-report a fleet
3804
+ * precisely when the fleet got large enough to matter.
3805
+ */
3806
+ get keysRefused() {
3807
+ return this.refused;
3808
+ }
3809
+ /** Counters currently held. */
3810
+ get size() {
3811
+ return this.counters.size;
3812
+ }
3813
+ /**
3814
+ * Fold one observation in.
3815
+ *
3816
+ * A non-positive or non-integer `deviceId` is REFUSED rather than bucketed:
3817
+ * see the module docblock — an entry that cannot name its camera is worse
3818
+ * than no entry.
3819
+ */
3820
+ note(observation, nowMs) {
3821
+ if (!Number.isInteger(observation.deviceId) || observation.deviceId <= 0) return;
3822
+ const key = counterKey(observation.deviceId, observation.family, observation.variant);
3823
+ let counter = this.counters.get(key);
3824
+ if (counter === void 0) {
3825
+ if (this.counters.size >= this.maxKeys) {
3826
+ this.refused += 1;
3827
+ return;
3828
+ }
3829
+ counter = {
3830
+ deviceId: observation.deviceId,
3831
+ family: observation.family,
3832
+ variant: observation.variant,
3833
+ sinceMs: nowMs,
3834
+ attempts: 0,
3835
+ succeeded: 0,
3836
+ reasons: /* @__PURE__ */ new Map()
3837
+ };
3838
+ this.counters.set(key, counter);
3839
+ }
3840
+ counter.attempts += 1;
3841
+ if (observation.reason === void 0) {
3842
+ counter.succeeded += 1;
3843
+ return;
3844
+ }
3845
+ const reason = counter.reasons.has(observation.reason) || counter.reasons.size < this.maxReasons ? observation.reason : OVERFLOW_REASON;
3846
+ counter.reasons.set(reason, (counter.reasons.get(reason) ?? 0) + 1);
3847
+ }
3848
+ /** Read every counter. Never mutates — see the module docblock. */
3849
+ snapshot(nowMs) {
3850
+ const out = [];
3851
+ for (const counter of this.counters.values()) out.push({
3852
+ deviceId: counter.deviceId,
3853
+ family: counter.family,
3854
+ ...counter.variant !== void 0 ? { variant: counter.variant } : {},
3811
3855
  sinceMs: counter.sinceMs,
3812
3856
  atMs: nowMs,
3813
3857
  attempts: counter.attempts,
@@ -3835,64 +3879,259 @@ function failureRate(sample) {
3835
3879
  return (sample.attempts - sample.succeeded) / sample.attempts;
3836
3880
  }
3837
3881
  //#endregion
3838
- //#region src/types/model-variant-groups.ts
3839
- var FORMAT_KEYS = [
3840
- "onnx",
3841
- "coreml",
3842
- "openvino",
3843
- "tflite",
3844
- "pt"
3845
- ];
3846
- /**
3847
- * Display spelling of a family. Uppercasing the id is wrong for any family
3848
- * whose name is not all-caps — it rendered `yolov9` as "YOLOV9", a word the
3849
- * product uses nowhere else (the catalog, the docs and the model files all say
3850
- * "YOLOv9").
3851
- */
3852
- var FAMILY_LABEL = {
3853
- yolo26: "YOLO26",
3854
- yolov9: "YOLOv9"
3855
- };
3856
- function familyLabel(family) {
3857
- return FAMILY_LABEL[family] ?? family.toUpperCase();
3882
+ //#region src/metrics/load-series-fold.ts
3883
+ /** Bucket key for rows no addon owns. Stable, so its series is continuous. */
3884
+ var UNATTRIBUTED_BUCKET_KEY = "__unattributed__";
3885
+ var ROOT_BUCKET_KEY = "__root__";
3886
+ function bucketFor(row) {
3887
+ if (row.addonId !== null) return {
3888
+ key: row.addonId,
3889
+ kind: "addon"
3890
+ };
3891
+ if (row.classification === "root") return {
3892
+ key: ROOT_BUCKET_KEY,
3893
+ kind: "root"
3894
+ };
3895
+ return {
3896
+ key: UNATTRIBUTED_BUCKET_KEY,
3897
+ kind: "unattributed"
3898
+ };
3899
+ }
3900
+ /** Round to one decimal — the precision both producers already emit at. */
3901
+ function deci(value) {
3902
+ return Math.round(value * 10) / 10;
3858
3903
  }
3859
- /** `@640`, `@320×320`, `@ 256` — a resolution stated inside a model name. */
3860
- var RESOLUTION_IN_NAME = /\s*@\s*\d+\s*(?:[x×]\s*\d+)?/gi;
3861
3904
  /**
3862
- * Strip a leading family label AND any stated resolution from a base model name
3863
- * → clean tier label.
3905
+ * Fold one snapshot into one point per function.
3864
3906
  *
3865
- * The resolution strip is not cosmetic. The tier is chosen BEFORE the
3866
- * resolution chip, and a family whose builds all state their input (our yolov9
3867
- * ships only 320 and 640, no resolution-less build) made the tier inherit its
3868
- * base entry's name verbatim: the ladder read "Tiny @640 / Small @640 / …" and
3869
- * kept saying 640 while the operator had 320 selected below it.
3907
+ * Produces a ONE-SAMPLE point: `min === max` on every field, `samples === 1`.
3908
+ * That is what lets a live event and a reduced server bucket sit in the same
3909
+ * series without the consumer knowing which is which.
3870
3910
  */
3871
- function tierLabel(family, baseName) {
3872
- const fl = familyLabel(family);
3873
- const stripped = baseName.replace(new RegExp(`^${fl}\\s+`, "i"), "").replace(RESOLUTION_IN_NAME, "").trim();
3874
- return stripped.length > 0 ? stripped : baseName;
3875
- }
3876
- function variantLabel(precision, optimization) {
3877
- const parts = [];
3878
- if (optimization === "fast") parts.push("Fast");
3879
- parts.push(precision === "int8" ? "Int8" : "Standard");
3880
- return parts.join(" · ");
3911
+ function foldSnapshotByFunction(rows, atMs) {
3912
+ const acc = /* @__PURE__ */ new Map();
3913
+ for (const row of rows) {
3914
+ const { key, kind } = bucketFor(row);
3915
+ const cur = acc.get(key) ?? {
3916
+ kind,
3917
+ main: 0,
3918
+ gc: 0,
3919
+ lifetime: 0,
3920
+ memory: 0,
3921
+ count: 0,
3922
+ splitKnown: true
3923
+ };
3924
+ const known = row.cpuMainPercent !== null && row.cpuGcPercent !== null;
3925
+ acc.set(key, {
3926
+ kind: cur.kind,
3927
+ main: cur.main + (row.cpuMainPercent ?? 0),
3928
+ gc: cur.gc + (row.cpuGcPercent ?? 0),
3929
+ lifetime: cur.lifetime + row.cpuPercent,
3930
+ memory: cur.memory + row.memoryRssBytes,
3931
+ count: cur.count + 1,
3932
+ splitKnown: cur.splitKnown && known
3933
+ });
3934
+ }
3935
+ return [...acc.entries()].map(([key, a]) => {
3936
+ const main = a.splitKnown ? deci(a.main) : null;
3937
+ const gc = a.splitKnown ? deci(a.gc) : null;
3938
+ const lifetime = deci(a.lifetime);
3939
+ return {
3940
+ key,
3941
+ kind: a.kind,
3942
+ point: {
3943
+ atMs,
3944
+ samples: 1,
3945
+ cpuMainPercent: main,
3946
+ cpuMainPercentMin: main,
3947
+ cpuGcPercent: gc,
3948
+ cpuGcPercentMin: gc,
3949
+ cpuLifetimePercent: lifetime,
3950
+ cpuLifetimePercentMin: lifetime,
3951
+ memoryRssBytes: a.memory,
3952
+ memoryRssBytesMin: a.memory,
3953
+ processCount: a.count,
3954
+ processCountMin: a.count
3955
+ }
3956
+ };
3957
+ });
3881
3958
  }
3882
- function entryFormats(entry) {
3883
- return FORMAT_KEYS.filter((f) => entry.formats[f] !== void 0);
3959
+ /** The narrower of two bounds, treating `null` (UNKNOWN) as absorbing. */
3960
+ function minNullable(a, b) {
3961
+ if (a === null || b === null) return null;
3962
+ return a < b ? a : b;
3884
3963
  }
3885
- function smallestSizeMB(entry) {
3886
- const sizes = FORMAT_KEYS.map((f) => entry.formats[f]?.sizeMB).filter((n) => typeof n === "number");
3887
- return sizes.length > 0 ? Math.min(...sizes) : 0;
3964
+ function maxNullable(a, b) {
3965
+ if (a === null || b === null) return null;
3966
+ return a > b ? a : b;
3888
3967
  }
3889
- var TIER_ORDER = [
3890
- "t",
3891
- "n",
3892
- "s",
3893
- "m",
3894
- "c",
3895
- "l",
3968
+ /** Merge `next` into `held`, keeping the widest [min, max] of each field. */
3969
+ function mergePoints(held, next, atMs) {
3970
+ return {
3971
+ atMs,
3972
+ samples: held.samples + next.samples,
3973
+ cpuMainPercent: maxNullable(held.cpuMainPercent, next.cpuMainPercent),
3974
+ cpuMainPercentMin: minNullable(held.cpuMainPercentMin, next.cpuMainPercentMin),
3975
+ cpuGcPercent: maxNullable(held.cpuGcPercent, next.cpuGcPercent),
3976
+ cpuGcPercentMin: minNullable(held.cpuGcPercentMin, next.cpuGcPercentMin),
3977
+ cpuLifetimePercent: Math.max(held.cpuLifetimePercent, next.cpuLifetimePercent),
3978
+ cpuLifetimePercentMin: Math.min(held.cpuLifetimePercentMin, next.cpuLifetimePercentMin),
3979
+ memoryRssBytes: Math.max(held.memoryRssBytes, next.memoryRssBytes),
3980
+ memoryRssBytesMin: Math.min(held.memoryRssBytesMin, next.memoryRssBytesMin),
3981
+ processCount: Math.max(held.processCount, next.processCount),
3982
+ processCountMin: Math.min(held.processCountMin, next.processCountMin)
3983
+ };
3984
+ }
3985
+ /**
3986
+ * The bucket width that brings `spanMs` down to at most `maxPoints` points,
3987
+ * snapped up to a whole multiple of the sampling cadence.
3988
+ *
3989
+ * Returns `cadenceMs` (no reduction) when the span already fits. A caller that
3990
+ * asks for a `maxPoints` of 0 or less gets no reduction rather than an
3991
+ * infinite bucket — a nonsensical request must not produce a plausible chart.
3992
+ */
3993
+ function resolveBucketMs(spanMs, cadenceMs, maxPoints) {
3994
+ if (maxPoints <= 0 || cadenceMs <= 0 || spanMs <= 0) return Math.max(cadenceMs, 1);
3995
+ const wanted = spanMs / maxPoints;
3996
+ if (wanted <= cadenceMs) return cadenceMs;
3997
+ return Math.ceil(wanted / cadenceMs) * cadenceMs;
3998
+ }
3999
+ /**
4000
+ * Reduce one function's points into buckets of `bucketMs`, preserving the
4001
+ * extremes.
4002
+ *
4003
+ * Points are expected oldest-first and are returned oldest-first. A bucket
4004
+ * with no samples is ABSENT — not zero, not interpolated, not the previous
4005
+ * value held over.
4006
+ */
4007
+ function reducePoints(points, bucketMs, origin) {
4008
+ if (bucketMs <= 0 || points.length === 0) return points;
4009
+ const buckets = /* @__PURE__ */ new Map();
4010
+ for (const point of points) {
4011
+ const start = origin + Math.floor((point.atMs - origin) / bucketMs) * bucketMs;
4012
+ const held = buckets.get(start);
4013
+ buckets.set(start, held === void 0 ? {
4014
+ ...point,
4015
+ atMs: start
4016
+ } : mergePoints(held, point, start));
4017
+ }
4018
+ return [...buckets.values()].toSorted((a, b) => a.atMs - b.atMs);
4019
+ }
4020
+ //#endregion
4021
+ //#region src/stream-selection.ts
4022
+ function pickPreferredRtspEntry(entries, pref, deviceId, options = {}) {
4023
+ if (entries.length === 0) return null;
4024
+ const prefix = `${deviceId}/`;
4025
+ const toPicked = (e) => ({
4026
+ brokerId: e.brokerId,
4027
+ profileId: e.brokerId.startsWith(prefix) ? e.brokerId.slice(prefix.length) : e.brokerId,
4028
+ url: e.url,
4029
+ mutedUrl: e.mutedUrl,
4030
+ enabled: e.enabled,
4031
+ ...e.codec !== void 0 ? { codec: e.codec } : {},
4032
+ ...e.resolution !== void 0 ? { resolution: e.resolution } : {}
4033
+ });
4034
+ if (pref !== "auto") {
4035
+ const match = entries.find((e) => e.enabled && e.url.length > 0 && (e.profile === pref || e.brokerId === `${prefix}${pref}`));
4036
+ if (match) return toPicked(match);
4037
+ }
4038
+ const eligible = entries.filter((e) => e.enabled && e.url.length > 0);
4039
+ if (eligible.length === 0) return null;
4040
+ const target = options.targetResolution;
4041
+ if (target) {
4042
+ const withRes = eligible.filter((e) => e.resolution !== void 0);
4043
+ if (withRes.length > 0) {
4044
+ const picked = pickClosestResolution(withRes, target);
4045
+ if (picked) return toPicked(picked);
4046
+ }
4047
+ }
4048
+ return toPicked(eligible[0]);
4049
+ }
4050
+ /**
4051
+ * Pick the entry whose `resolution` is closest to `target`. Prefer
4052
+ * entries ≥ target (downscale is cheap at the consumer; upscale is
4053
+ * lossy). Among the rest pick the LARGEST still ≤ target so the
4054
+ * consumer gets the best feasible quality. "Closeness" is the
4055
+ * `width × height` pixel delta.
4056
+ */
4057
+ function pickClosestResolution(entries, target) {
4058
+ const targetPixels = target.width * target.height;
4059
+ let bestAbove;
4060
+ let bestBelow;
4061
+ for (const e of entries) {
4062
+ if (e.resolution === void 0) continue;
4063
+ const pixels = e.resolution.width * e.resolution.height;
4064
+ if (pixels >= targetPixels) {
4065
+ if (!bestAbove || pixels < bestAbove.pixels) bestAbove = {
4066
+ entry: e,
4067
+ pixels
4068
+ };
4069
+ } else if (!bestBelow || pixels > bestBelow.pixels) bestBelow = {
4070
+ entry: e,
4071
+ pixels
4072
+ };
4073
+ }
4074
+ return bestAbove?.entry ?? bestBelow?.entry;
4075
+ }
4076
+ //#endregion
4077
+ //#region src/types/model-variant-groups.ts
4078
+ var FORMAT_KEYS = [
4079
+ "onnx",
4080
+ "coreml",
4081
+ "openvino",
4082
+ "tflite",
4083
+ "pt"
4084
+ ];
4085
+ /**
4086
+ * Display spelling of a family. Uppercasing the id is wrong for any family
4087
+ * whose name is not all-caps — it rendered `yolov9` as "YOLOV9", a word the
4088
+ * product uses nowhere else (the catalog, the docs and the model files all say
4089
+ * "YOLOv9").
4090
+ */
4091
+ var FAMILY_LABEL = {
4092
+ yolo26: "YOLO26",
4093
+ yolov9: "YOLOv9"
4094
+ };
4095
+ function familyLabel(family) {
4096
+ return FAMILY_LABEL[family] ?? family.toUpperCase();
4097
+ }
4098
+ /** `@640`, `@320×320`, `@ 256` — a resolution stated inside a model name. */
4099
+ var RESOLUTION_IN_NAME = /\s*@\s*\d+\s*(?:[x×]\s*\d+)?/gi;
4100
+ /**
4101
+ * Strip a leading family label AND any stated resolution from a base model name
4102
+ * → clean tier label.
4103
+ *
4104
+ * The resolution strip is not cosmetic. The tier is chosen BEFORE the
4105
+ * resolution chip, and a family whose builds all state their input (our yolov9
4106
+ * ships only 320 and 640, no resolution-less build) made the tier inherit its
4107
+ * base entry's name verbatim: the ladder read "Tiny @640 / Small @640 / …" and
4108
+ * kept saying 640 while the operator had 320 selected below it.
4109
+ */
4110
+ function tierLabel(family, baseName) {
4111
+ const fl = familyLabel(family);
4112
+ const stripped = baseName.replace(new RegExp(`^${fl}\\s+`, "i"), "").replace(RESOLUTION_IN_NAME, "").trim();
4113
+ return stripped.length > 0 ? stripped : baseName;
4114
+ }
4115
+ function variantLabel(precision, optimization) {
4116
+ const parts = [];
4117
+ if (optimization === "fast") parts.push("Fast");
4118
+ parts.push(precision === "int8" ? "Int8" : "Standard");
4119
+ return parts.join(" · ");
4120
+ }
4121
+ function entryFormats(entry) {
4122
+ return FORMAT_KEYS.filter((f) => entry.formats[f] !== void 0);
4123
+ }
4124
+ function smallestSizeMB(entry) {
4125
+ const sizes = FORMAT_KEYS.map((f) => entry.formats[f]?.sizeMB).filter((n) => typeof n === "number");
4126
+ return sizes.length > 0 ? Math.min(...sizes) : 0;
4127
+ }
4128
+ var TIER_ORDER = [
4129
+ "t",
4130
+ "n",
4131
+ "s",
4132
+ "m",
4133
+ "c",
4134
+ "l",
3896
4135
  "x"
3897
4136
  ];
3898
4137
  var PRECISION_ORDER = ["fp32", "int8"];
@@ -23147,7 +23386,6 @@ var storageCapability = {
23147
23386
  }), z.instanceof(Uint8Array)),
23148
23387
  endDownload: method(z.object({ downloadId: z.string() }), z.void(), { kind: "mutation" }),
23149
23388
  listLocations: method(z.object({ type: StorageLocationTypeSchema.optional() }), z.array(StorageLocationSchema).readonly()),
23150
- getDefaultLocation: method(z.object({ type: StorageLocationTypeSchema }), StorageLocationSchema.nullable()),
23151
23389
  listLocationDeclarations: method(z.void(), z.array(StorageLocationDeclarationSchema).readonly()),
23152
23390
  upsertLocation: method(StorageLocationSchema.omit({
23153
23391
  createdAt: true,
@@ -23177,6 +23415,12 @@ var storageCapability = {
23177
23415
  kind: "mutation",
23178
23416
  auth: "admin"
23179
23417
  }),
23418
+ /**
23419
+ * How far each draining location has got (D386). A pure READ of what the
23420
+ * last pressure sweep computed — it starts no work, and a location that is
23421
+ * not draining simply does not appear.
23422
+ */
23423
+ listDrainProgress: method(z.void(), z.array(StorageDrainProgressSchema).readonly()),
23180
23424
  testLocation: method(z.object({ id: z.string() }), z.object({
23181
23425
  ok: z.boolean(),
23182
23426
  error: z.string().optional()
@@ -23329,6 +23573,73 @@ var storageMigrationCapability = {
23329
23573
  }
23330
23574
  };
23331
23575
  //#endregion
23576
+ //#region src/capabilities/storage-occupancy.cap.ts
23577
+ /**
23578
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
23579
+ * location (D388).
23580
+ *
23581
+ * ## Why this is not `storage-evictable`
23582
+ *
23583
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
23584
+ * not, in two ways that both matter and both bite hardest on the locations an
23585
+ * operator most wants a figure for:
23586
+ *
23587
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
23588
+ * and `recordingsLow:default` deliberately share one root and evict as one
23589
+ * oldest-first pool, so both answer with the SAME combined total. As an
23590
+ * occupancy figure that double-counts the disk.
23591
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
23592
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
23593
+ * is retiring and staring at.
23594
+ *
23595
+ * So this is its own contract with its own quantity, and the quantity is
23596
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
23597
+ * would ever be willing to delete it. A provider that can only answer
23598
+ * "evictable" must not register here — a number that silently means different
23599
+ * things per class is worse than no number.
23600
+ *
23601
+ * ## Absence is an answer
23602
+ *
23603
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
23604
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
23605
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
23606
+ * consuming side has to be written out loud instead of appearing by accident.
23607
+ *
23608
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
23609
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
23610
+ */
23611
+ /** One provider's occupancy answer for one location. */
23612
+ var StorageOccupancyReportSchema = z.object({
23613
+ locationId: z.string(),
23614
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
23615
+ * not net of what it is willing to delete. */
23616
+ ownedBytes: z.number().int().nonnegative(),
23617
+ /** When the provider last actually measured this. The orchestrator carries it
23618
+ * through so a UI can say how old the figure is instead of implying "now". */
23619
+ measuredAtMs: z.number().int().nonnegative()
23620
+ });
23621
+ var storageOccupancyCapability = {
23622
+ name: "storage-occupancy",
23623
+ scope: "system",
23624
+ mode: "collection",
23625
+ internal: true,
23626
+ methods: {
23627
+ /**
23628
+ * Occupancy for the given locations, in ONE round trip.
23629
+ *
23630
+ * A provider answers only for the locations it actually holds bytes on and
23631
+ * OMITS the rest — an omitted location is "I hold nothing measurable here",
23632
+ * which the orchestrator merges as a contribution of nothing rather than as
23633
+ * a claim that the location is empty. Only a location no provider reports
23634
+ * at all stays unknown.
23635
+ *
23636
+ * This must be CHEAP and must never walk a filesystem: it is on the admin
23637
+ * UI's `listLocations` path. The owner keeps its own figure fresh (D224) and
23638
+ * answers from what it already has.
23639
+ */
23640
+ getOccupancy: method(z.object({ locationIds: z.array(z.string()).readonly() }), z.array(StorageOccupancyReportSchema).readonly(), { auth: "admin" }) }
23641
+ };
23642
+ //#endregion
23332
23643
  //#region src/capabilities/storage-provider.cap.ts
23333
23644
  var ProviderInfoSchema = z.discriminatedUnion("shouldSaveDiskSpace", [z.object({
23334
23645
  providerId: z.string().min(1),
@@ -25745,125 +26056,6 @@ onStatusChanged: { data: z.object({
25745
26056
  volatileStateFields: ["lastUpdated"]
25746
26057
  };
25747
26058
  //#endregion
25748
- //#region src/capabilities/network-link.cap.ts
25749
- /**
25750
- * How a device reaches the network, and how well.
25751
- *
25752
- * NOT `connectivity`: that cap is an UPSTREAM system's binary view of whether
25753
- * an entity is reachable (a Home Assistant `binary_sensor` with
25754
- * `device_class: connectivity`). This one is the device's OWN link — the
25755
- * medium it is on and the signal it sees — the way `battery` is the device's
25756
- * own charge.
25757
- *
25758
- * `'wifi'`, `'ethernet'` and `'cellular'` are links the firmware actually
25759
- * reported. `'unknown'` is the ABSENCE of an answer — the provider has
25760
- * registered the capability but has not read the link yet (D315: unknown is
25761
- * not empty). Consumers skip it rather than draw a wire or a bar.
25762
- */
25763
- var NETWORK_LINK_TYPES = [
25764
- "wifi",
25765
- "ethernet",
25766
- "cellular",
25767
- "unknown"
25768
- ];
25769
- /**
25770
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
25771
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
25772
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
25773
- * one Home Assistant projection.
25774
- */
25775
- var NetworkLinkStatusSchema = z.object({
25776
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
25777
- type: z.enum(NETWORK_LINK_TYPES),
25778
- /**
25779
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
25780
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
25781
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
25782
- * one whose reading has not landed must not be drawn at 0 %. Consumers
25783
- * SKIP a null rather than coerce it.
25784
- */
25785
- signalPercent: z.number().min(0).max(100).nullable(),
25786
- /** Raw received signal strength in dBm, when the firmware reports one. */
25787
- rssiDbm: z.number().optional(),
25788
- /** Network name of a wireless link, when the firmware reports it. */
25789
- ssid: z.string().optional(),
25790
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
25791
- lastUpdated: z.number()
25792
- });
25793
- /** The slice a provider seeds before its first read: nothing is known yet. */
25794
- var NETWORK_LINK_UNKNOWN = {
25795
- type: "unknown",
25796
- signalPercent: null,
25797
- lastUpdated: 0
25798
- };
25799
- /**
25800
- * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
25801
- * Out-of-range or non-finite input is not a reading: `null`.
25802
- */
25803
- function signalPercentFromBars(bars, maxBars) {
25804
- if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
25805
- if (bars < 0 || bars > maxBars) return null;
25806
- return Math.round(bars / maxBars * 100);
25807
- }
25808
- /**
25809
- * Normalise an RSSI in dBm to 0..100 on the usual wifi scale: -100 dBm and
25810
- * below is 0 %, -50 dBm and above is 100 %, linear between. Non-finite or
25811
- * positive input is not an RSSI: `null`.
25812
- */
25813
- function signalPercentFromRssi(rssiDbm) {
25814
- if (rssiDbm === void 0 || !Number.isFinite(rssiDbm) || rssiDbm > 0) return null;
25815
- return Math.round((Math.min(-50, Math.max(-100, rssiDbm)) + 100) * 2);
25816
- }
25817
- var networkLinkCapability = {
25818
- name: "network-link",
25819
- scope: "device",
25820
- deviceNative: true,
25821
- mode: "singleton",
25822
- deviceTypes: [
25823
- DeviceType.Camera,
25824
- DeviceType.Sensor,
25825
- DeviceType.Button,
25826
- DeviceType.Switch,
25827
- DeviceType.Light,
25828
- DeviceType.Lock,
25829
- DeviceType.Siren
25830
- ],
25831
- methods: {},
25832
- events: {
25833
- /**
25834
- * Emitted whenever the cached status changes (a link switch, a signal
25835
- * reading that moved). Mirrored on the parent chain by the
25836
- * DeviceEventPropagator like `battery.onStatusChanged`.
25837
- */
25838
- onStatusChanged: { data: z.object({
25839
- deviceId: z.number(),
25840
- status: NetworkLinkStatusSchema
25841
- }) } },
25842
- status: {
25843
- schema: NetworkLinkStatusSchema,
25844
- kind: "push",
25845
- empty: NETWORK_LINK_UNKNOWN
25846
- },
25847
- /**
25848
- * Runtime-state slice — every provider stores the same shape under
25849
- * `device.runtimeState['network-link']`, read once by the badge and the
25850
- * Home Assistant projector regardless of the driver.
25851
- */
25852
- runtimeState: NetworkLinkStatusSchema,
25853
- /**
25854
- * Runtime-state durability: **restored** — a link reading is slow to
25855
- * change and a sleeping battery camera may not report for hours; the
25856
- * restored slice is what the badge shows until the next read.
25857
- *
25858
- * See `RuntimeStateDurability`. Enforced by
25859
- * `scripts/check-runtime-state-durability.ts`.
25860
- */
25861
- durability: "restored",
25862
- /** Clock fields: written, but excluded from the compare that decides
25863
- * whether persisting is worth a SQLite commit. */
25864
- volatileStateFields: ["lastUpdated"]
25865
- };
25866
- //#endregion
25867
26059
  //#region src/capabilities/binary.cap.ts
25868
26060
  /**
25869
26061
  * Generic boolean sensor — last-resort fallback when no domain-
@@ -29561,308 +29753,852 @@ var MotionStatusSchema = z.object({
29561
29753
  autoClearAfterMs: z.number().nullable()
29562
29754
  });
29563
29755
  /**
29564
- * Payload of `motion.onMotionChanged` event + the corresponding bus
29565
- * event `EventCategory.MotionOnMotionChanged`. Single source of truth
29566
- * — both the cap event surface and the bus payload type alias to this
29567
- * schema.
29756
+ * Payload of `motion.onMotionChanged` event + the corresponding bus
29757
+ * event `EventCategory.MotionOnMotionChanged`. Single source of truth
29758
+ * — both the cap event surface and the bus payload type alias to this
29759
+ * schema.
29760
+ */
29761
+ var MotionOnMotionChangedDataSchema = z.object({
29762
+ deviceId: z.number(),
29763
+ detected: z.boolean(),
29764
+ timestamp: z.number(),
29765
+ source: MotionSourceEnum,
29766
+ regions: z.array(MotionRegionSchema).readonly().optional()
29767
+ });
29768
+ var motionCapability = {
29769
+ name: "motion",
29770
+ scope: "device",
29771
+ mode: "singleton",
29772
+ /**
29773
+ * Providers register per-device natives via `ctx.registerNativeCap`
29774
+ * (Hikvision/Reolink/Amcrest/Wyze/HA/Homematic/Alexa/Matter) — there is
29775
+ * NO system singleton provider. Without this flag `resolveCapMount`
29776
+ * derived `{ kind: 'singleton' }`, so `motion.getStatus`/`isDetected`
29777
+ * resolved via `registry.getSingleton('motion')` (always null) and every
29778
+ * call 412'd "provider not available" while bindings listed a live
29779
+ * `motion` native (2026-08-02). The flag routes the router through
29780
+ * `requireDeviceScoped` → `getProviderForDevice`, like `motion-trigger`,
29781
+ * `snapshot` and every other per-device native cap.
29782
+ */
29783
+ deviceNative: true,
29784
+ deviceTypes: [DeviceType.Camera, DeviceType.Sensor],
29785
+ methods: {
29786
+ /**
29787
+ * Pull the current motion state synchronously. Convenience shortcut
29788
+ * for consumers that don't need the full status object; equivalent
29789
+ * to `getStatus()?.detected ?? false`. Will likely be folded into
29790
+ * `getStatus` once the auto-injected status surface lands in every
29791
+ * consumer.
29792
+ */
29793
+ isDetected: method(z.object({ deviceId: z.number() }), z.boolean()) },
29794
+ events: {
29795
+ /**
29796
+ * Fires every time the runner transitions a camera between
29797
+ * `watching` and `active` phases. `source` carries which motion
29798
+ * path drove the transition; `regions` is populated only for
29799
+ * `source: 'analyzer'` (frame-diff regions from the ML motion
29800
+ * detector) — onboard sources don't carry per-frame regions
29801
+ * here (camera-provided zones / AI metadata live in dedicated
29802
+ * channels: `detection.camera-native`, future zone capability).
29803
+ *
29804
+ * Consumers that want all motion pushes (even with `detected`
29805
+ * unchanged) should subscribe to the status subscription via
29806
+ * `device-manager.subscribeDeviceStatusAggregate` instead.
29807
+ */
29808
+ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
29809
+ status: {
29810
+ schema: MotionStatusSchema,
29811
+ kind: "push"
29812
+ },
29813
+ /**
29814
+ * Runtime-state slice — the last observed motion snapshot, mirrored
29815
+ * by the kernel and readable cross-process via
29816
+ * `device.state.motion.value`. Reads never invoke the provider, so
29817
+ * UIs and other addons can poll the cached state safely.
29818
+ */
29819
+ runtimeState: MotionStatusSchema,
29820
+ /**
29821
+ * Runtime-state durability: **session** — self-clearing by construction (`autoClearAfterMs`); a restored `detected: true` is a frozen event, and the next frame re-publishes the real one.
29822
+ *
29823
+ * See `RuntimeStateDurability`. Enforced by
29824
+ * `scripts/check-runtime-state-durability.ts`.
29825
+ */
29826
+ durability: "session"
29827
+ };
29828
+ //#endregion
29829
+ //#region src/capabilities/motion-trigger.cap.ts
29830
+ /**
29831
+ * Motion-trigger toggle for accessory devices.
29832
+ *
29833
+ * "Motion trigger" means: when the parent camera detects motion, the
29834
+ * accessory activates automatically. The cap exposes a single boolean
29835
+ * — `enabled` — that drivers map to the vendor-specific firmware
29836
+ * action (Reolink: `setSirenOnMotion`, `setFloodlightOnMotion`; ONVIF
29837
+ * relay: schedule binding; …).
29838
+ *
29839
+ * The accessory still has its own `switch` cap for direct on/off; this
29840
+ * cap is independent. Toggling motion-trigger on does NOT necessarily
29841
+ * toggle the switch on — it just instructs the firmware to flip the
29842
+ * switch when motion fires.
29843
+ *
29844
+ * Driver-specific knobs (motion duration window, brightness while
29845
+ * triggered, schedule windows) live in the device's
29846
+ * `getSettingsUISchema()` instead of bloating this cap — same
29847
+ * principle as `switch` and `brightness` keeping their surface
29848
+ * minimal.
29849
+ */
29850
+ var MotionTriggerStatusSchema = z.object({
29851
+ enabled: z.boolean(),
29852
+ /** Ms epoch of the last operator-driven change. */
29853
+ lastChangedAt: z.number()
29854
+ });
29855
+ /**
29856
+ * Persistent slice mirrored across restarts. The provider writes here
29857
+ * on every successful firmware fetch / setMotionTrigger push; the cap
29858
+ * router and admin-ui hero read straight from this snapshot via
29859
+ * `device.state.motionTrigger.value` instead of re-issuing a firmware
29860
+ * round-trip on every UI mount. `lastFetchedAt` lets the framework
29861
+ * helper (`createRuntimeStateBridge`) stale-check before deciding
29862
+ * whether to refresh from the camera.
29863
+ */
29864
+ var MotionTriggerRuntimeStateSchema = MotionTriggerStatusSchema.extend({
29865
+ /** Ms epoch of the last successful camera fetch (0 = never). */
29866
+ lastFetchedAt: z.number() });
29867
+ var motionTriggerCapability = {
29868
+ name: "motion-trigger",
29869
+ scope: "device",
29870
+ deviceNative: true,
29871
+ mode: "singleton",
29872
+ deviceTypes: [
29873
+ DeviceType.Light,
29874
+ DeviceType.Siren,
29875
+ DeviceType.Switch
29876
+ ],
29877
+ methods: { setMotionTrigger: method(z.object({
29878
+ deviceId: z.number().int().nonnegative(),
29879
+ enabled: z.boolean()
29880
+ }), z.void(), {
29881
+ kind: "mutation",
29882
+ auth: "admin"
29883
+ }) },
29884
+ events: { onMotionTriggerChanged: { data: z.object({
29885
+ deviceId: z.number(),
29886
+ enabled: z.boolean(),
29887
+ lastChangedAt: z.number()
29888
+ }) } },
29889
+ status: {
29890
+ schema: MotionTriggerStatusSchema,
29891
+ kind: "command-driven"
29892
+ },
29893
+ runtimeState: MotionTriggerRuntimeStateSchema,
29894
+ /**
29895
+ * Runtime-state durability: **session** — the authority for motion-trigger enablement is the provider's own config; the slice is a mirror of it, re-published on connect.
29896
+ *
29897
+ * See `RuntimeStateDurability`. Enforced by
29898
+ * `scripts/check-runtime-state-durability.ts`.
29899
+ */
29900
+ durability: "session"
29901
+ };
29902
+ //#endregion
29903
+ //#region src/capabilities/motion-zones.cap.ts
29904
+ /**
29905
+ * Motion-zones share the same MaskShape vocabulary as privacy-mask — the
29906
+ * on-camera motion-detection mask is a single `grid` region (a row-major
29907
+ * boolean cell lattice the camera's onboard VMD evaluates). Composing it as
29908
+ * a region keeps one drawing-plane model across all geometry caps.
29909
+ */
29910
+ /** A motion-zone region — exactly one boolean cell grid today. */
29911
+ var MotionZoneRegionSchema = z.object({
29912
+ id: z.number(),
29913
+ enabled: z.boolean(),
29914
+ shape: MaskGridShapeSchema
29915
+ });
29916
+ /** Current on-camera motion-detection state — master enable + sensitivity +
29917
+ * the grid region(s). */
29918
+ var MotionZoneStatusSchema = z.object({
29919
+ enabled: z.boolean(),
29920
+ sensitivity: z.number(),
29921
+ /** Grid region(s). Today exactly one `grid` shape. */
29922
+ regions: z.array(MotionZoneRegionSchema),
29923
+ lastFetchedAt: z.number()
29924
+ });
29925
+ /** Per-camera availability — grid dims are fixed per camera model; the UI
29926
+ * sizes its editor from `grid`. */
29927
+ var MotionZoneOptionsSchema = z.object({
29928
+ maxRegions: z.number(),
29929
+ supportedShapes: z.array(MaskShapeKindSchema),
29930
+ grid: MaskGridDimsSchema,
29931
+ sensitivity: z.object({
29932
+ min: z.number(),
29933
+ max: z.number(),
29934
+ step: z.number()
29935
+ })
29936
+ });
29937
+ /** Partial change — every field optional. */
29938
+ var MotionZonePatchSchema = z.object({
29939
+ enabled: z.boolean().optional(),
29940
+ sensitivity: z.number().optional(),
29941
+ regions: z.array(MotionZoneRegionSchema).optional()
29942
+ });
29943
+ var motionZonesCapability = {
29944
+ name: "motion-zones",
29945
+ scope: "device",
29946
+ deviceNative: true,
29947
+ mode: "singleton",
29948
+ deviceTypes: [DeviceType.Camera],
29949
+ deviceConfig: { ui: {
29950
+ kind: "widget",
29951
+ widgetId: "host/motion-zones-grid",
29952
+ tab: "motion",
29953
+ label: "Motion Zones"
29954
+ } },
29955
+ methods: {
29956
+ getOptions: method(z.object({ deviceId: z.number() }), MotionZoneOptionsSchema),
29957
+ setZone: method(z.object({
29958
+ deviceId: z.number(),
29959
+ patch: MotionZonePatchSchema
29960
+ }), z.void(), {
29961
+ kind: "mutation",
29962
+ auth: "admin"
29963
+ })
29964
+ },
29965
+ status: {
29966
+ schema: MotionZoneStatusSchema,
29967
+ kind: "poll"
29968
+ },
29969
+ runtimeState: MotionZoneStatusSchema,
29970
+ /**
29971
+ * Runtime-state durability: **restored** — the 14 KB polygon list is the single largest slice on the fleet and has not changed since the operator drew it. Highest value per byte in the table.
29972
+ *
29973
+ * See `RuntimeStateDurability`. Enforced by
29974
+ * `scripts/check-runtime-state-durability.ts`.
29975
+ */
29976
+ durability: "restored",
29977
+ /** Clock fields: written, but excluded from the compare that decides
29978
+ * whether persisting is worth a SQLite commit. */
29979
+ volatileStateFields: ["lastFetchedAt"]
29980
+ };
29981
+ //#endregion
29982
+ //#region src/capabilities/native-object-detection.cap.ts
29983
+ /**
29984
+ * On-camera AI object detection cap. Surfaces per-device the classes
29985
+ * the firmware can detect and the last-seen instance of each. The
29986
+ * provider also fan-outs these to the global `detection.camera-native`
29987
+ * event bus with `source: 'onboard'` so cross-cutting system services
29988
+ * (alert-center, advanced-notifier, recording-engine) can subscribe
29989
+ * once and receive events from every camera.
29990
+ *
29991
+ * Distinct from `motion-detection` (ML pipeline) and `motion` (hardware
29992
+ * PIR or firmware motion pulse): this cap is specifically the AI
29993
+ * classifier output coming FROM the camera, not the local pipeline.
29994
+ */
29995
+ var NativeObjectClassEnum = z.enum([
29996
+ "person",
29997
+ "vehicle",
29998
+ "animal",
29999
+ "face",
30000
+ "package",
30001
+ "other"
30002
+ ]);
30003
+ var NativeDetectionSchema = z.object({
30004
+ class: NativeObjectClassEnum,
30005
+ timestamp: z.number(),
30006
+ /** Firmware-provided confidence [0..1]. Reolink pushes don't carry it → undefined. */
30007
+ confidence: z.number().min(0).max(1).optional()
30008
+ });
30009
+ var NativeObjectDetectionStatusSchema = z.object({
30010
+ /**
30011
+ * Last observed instance per class. Missing entries mean the class
30012
+ * is supported but nothing has been seen since the provider started.
30013
+ *
30014
+ * MUST be a partial record: providers seed an empty `{}` on cold-start
30015
+ * and write one class at a time as detections arrive. In Zod 4
30016
+ * `z.record(enum, …)` is EXHAUSTIVE (requires every enum key), so a
30017
+ * partial write throws "expected object, received undefined" for every
30018
+ * unseen class. `z.partialRecord` keeps the enum-key narrowing while
30019
+ * allowing the sparse shape the providers actually write.
30020
+ */
30021
+ lastByClass: z.partialRecord(NativeObjectClassEnum, NativeDetectionSchema.nullable()),
30022
+ /** Classes the firmware is capable of detecting — enumerated at device register. */
30023
+ supportedClasses: z.array(NativeObjectClassEnum).readonly(),
30024
+ /**
30025
+ * Whether forwarding of onboard AI detections is enabled for this device.
30026
+ * Default FALSE (opt-in, cold-start) — onboard AI pushes are noisy/sparse and
30027
+ * churn the tracker, so forwarding stays off until the operator enables it.
30028
+ */
30029
+ enabled: z.boolean()
30030
+ });
30031
+ var NativeObjectDetectionRuntimeStateSchema = NativeObjectDetectionStatusSchema.extend({
30032
+ /** Required by createRuntimeStateBridge — epoch ms of last refresh. */
30033
+ lastFetchedAt: z.number() });
30034
+ var nativeObjectDetectionCapability = {
30035
+ name: "native-object-detection",
30036
+ scope: "device",
30037
+ deviceNative: true,
30038
+ mode: "singleton",
30039
+ deviceTypes: [DeviceType.Camera],
30040
+ methods: { setEnabled: method(z.object({
30041
+ deviceId: z.number(),
30042
+ enabled: z.boolean()
30043
+ }), z.void(), {
30044
+ kind: "mutation",
30045
+ auth: "admin"
30046
+ }) },
30047
+ events: { onDetected: { data: z.object({
30048
+ deviceId: z.number(),
30049
+ detection: NativeDetectionSchema
30050
+ }) } },
30051
+ status: {
30052
+ schema: NativeObjectDetectionStatusSchema,
30053
+ kind: "push"
30054
+ },
30055
+ runtimeState: NativeObjectDetectionRuntimeStateSchema,
30056
+ /**
30057
+ * Runtime-state durability: **restored** — `enabled` is an operator toggle on a camera whose refresh is a no-op and whose staleMs is Infinity. There is no hardware value to re-read — losing it loses the setting.
30058
+ *
30059
+ * See `RuntimeStateDurability`. Enforced by
30060
+ * `scripts/check-runtime-state-durability.ts`.
30061
+ */
30062
+ durability: "restored",
30063
+ /** Clock fields: written, but excluded from the compare that decides
30064
+ * whether persisting is worth a SQLite commit. */
30065
+ volatileStateFields: ["lastFetchedAt"]
30066
+ };
30067
+ //#endregion
30068
+ //#region src/capabilities/navigation.cap.ts
30069
+ /**
30070
+ * `navigation` — a device-scoped capability that natively expresses the FULL
30071
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
30072
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
30073
+ *
30074
+ * Why a NEW cap rather than overloading `ptz`:
30075
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
30076
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
30077
+ * The two are different physical models: PTZ is absolute-position + presets,
30078
+ * navigation is momentary drive nudges + discrete robot ACTIONS
30079
+ * (dock / spot-clean / follow-pet / go-to-point / …).
30080
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
30081
+ * the reverse:
30082
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
30083
+ * / `getOptions`), and
30084
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
30085
+ * robot camera shows up in the existing PTZ control path without every
30086
+ * PTZ provider learning about robots. The mapping lives in the adapter,
30087
+ * not here (see the addon design note):
30088
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
30089
+ * ptz.stop() → navigation.stop()
30090
+ * ptz.goHome() → navigation.runAction('goHome')
30091
+ * ptz.getPresets() → navigation.listActions() (id→preset)
30092
+ * ptz.goToPreset(id) → navigation.runAction(id)
30093
+ *
30094
+ * ## Continuous drive
30095
+ *
30096
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
30097
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
30098
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
30099
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
30100
+ * coalesce them. The UI owns the cadence.
30101
+ *
30102
+ * ## The action dictionary
30103
+ *
30104
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
30105
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
30106
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
30107
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
30108
+ * vendor-specific list. `kind: 'action'` entries are triggered with
30109
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
30110
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
30111
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
30112
+ *
30113
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
30114
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
30115
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
30116
+ * every device handle. A future nodedreame publish adds a typed
30117
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
30118
+ * provider can then swap the raw calls for the typed methods with no change to
30119
+ * THIS contract.
30120
+ */
30121
+ /**
30122
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
30123
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
30124
+ * halts it.
30125
+ *
30126
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
30127
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
30128
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
30129
+ * vector by it (drivers without proportional drive ignore it).
30130
+ *
30131
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
30132
+ * axis alone; an all-undefined nudge is a no-op.
30133
+ */
30134
+ var NavigationMoveCommandSchema = z.object({
30135
+ pan: z.number().min(-1).max(1).optional(),
30136
+ tilt: z.number().min(-1).max(1).optional(),
30137
+ speed: z.number().min(0).max(1).optional()
30138
+ });
30139
+ /**
30140
+ * The enumerated discrete actions a navigation-capable robot can perform via
30141
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
30142
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
30143
+ * `playSound` (see the `sound` dictionary entries).
30144
+ */
30145
+ var NavigationActionIdSchema = z.enum([
30146
+ "goHome",
30147
+ "locate",
30148
+ "spotClean",
30149
+ "findPet",
30150
+ "personFollow",
30151
+ "stop",
30152
+ "startClean",
30153
+ "pauseClean",
30154
+ "dockWash",
30155
+ "autoEmpty",
30156
+ "flashOn",
30157
+ "flashOff"
30158
+ ]);
30159
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
30160
+ var NavigationEntryKindSchema = z.enum(["action", "sound"]);
30161
+ /**
30162
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
30163
+ * native panel and the PTZ mimic render as a button.
30164
+ *
30165
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
30166
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
30167
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
30168
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
30169
+ * - `label` — operator-facing English label.
30170
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
30171
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
30172
+ * PTZ render ONLY enabled entries. Data-driven: the provider
30173
+ * flips it from config, never by editing code.
30174
+ */
30175
+ var NavigationActionEntrySchema = z.object({
30176
+ id: z.string(),
30177
+ kind: NavigationEntryKindSchema,
30178
+ label: z.string(),
30179
+ icon: z.string(),
30180
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
30181
+ soundId: z.number().int().optional(),
30182
+ /** Per-device feature flag — render this entry only when true. */
30183
+ enabled: z.boolean()
30184
+ });
30185
+ /**
30186
+ * Canonical dictionary of every navigation control (discrete actions + sounds)
30187
+ * with its default label + icon hint. A provider filters this to the subset a
30188
+ * device supports (and may override a label). Exported so the provider AND the
30189
+ * UI share ONE list instead of re-deriving labels / ids independently.
30190
+ *
30191
+ * Icons are lucide-style hints; the viewer maps them to its own icon set. Every
30192
+ * catalog default is `enabled: true`; a provider overrides per-device from
30193
+ * config (data-driven — enabling / disabling one later is a config change, not a
30194
+ * code change).
30195
+ */
30196
+ var NAVIGATION_ACTION_CATALOG = [
30197
+ {
30198
+ id: "startClean",
30199
+ kind: "action",
30200
+ label: "Start cleaning",
30201
+ icon: "play",
30202
+ enabled: true
30203
+ },
30204
+ {
30205
+ id: "pauseClean",
30206
+ kind: "action",
30207
+ label: "Pause cleaning",
30208
+ icon: "pause",
30209
+ enabled: true
30210
+ },
30211
+ {
30212
+ id: "stop",
30213
+ kind: "action",
30214
+ label: "Stop",
30215
+ icon: "hand",
30216
+ enabled: true
30217
+ },
30218
+ {
30219
+ id: "goHome",
30220
+ kind: "action",
30221
+ label: "Return to dock",
30222
+ icon: "home",
30223
+ enabled: true
30224
+ },
30225
+ {
30226
+ id: "locate",
30227
+ kind: "action",
30228
+ label: "Locate",
30229
+ icon: "bell",
30230
+ enabled: true
30231
+ },
30232
+ {
30233
+ id: "spotClean",
30234
+ kind: "action",
30235
+ label: "Spot clean here",
30236
+ icon: "crosshair",
30237
+ enabled: true
30238
+ },
30239
+ {
30240
+ id: "findPet",
30241
+ kind: "action",
30242
+ label: "Find pet",
30243
+ icon: "paw-print",
30244
+ enabled: true
30245
+ },
30246
+ {
30247
+ id: "personFollow",
30248
+ kind: "action",
30249
+ label: "Follow me",
30250
+ icon: "footprints",
30251
+ enabled: true
30252
+ },
30253
+ {
30254
+ id: "dockWash",
30255
+ kind: "action",
30256
+ label: "Wash mop",
30257
+ icon: "droplets",
30258
+ enabled: true
30259
+ },
30260
+ {
30261
+ id: "autoEmpty",
30262
+ kind: "action",
30263
+ label: "Empty dustbin",
30264
+ icon: "trash-2",
30265
+ enabled: true
30266
+ },
30267
+ {
30268
+ id: "flashOn",
30269
+ kind: "action",
30270
+ label: "Flash on",
30271
+ icon: "flashlight",
30272
+ enabled: true
30273
+ },
30274
+ {
30275
+ id: "flashOff",
30276
+ kind: "action",
30277
+ label: "Flash off",
30278
+ icon: "flashlight-off",
30279
+ enabled: true
30280
+ },
30281
+ {
30282
+ id: "sound:meow",
30283
+ kind: "sound",
30284
+ label: "Meow",
30285
+ icon: "cat",
30286
+ soundId: 684,
30287
+ enabled: true
30288
+ },
30289
+ {
30290
+ id: "sound:bark",
30291
+ kind: "sound",
30292
+ label: "Woof",
30293
+ icon: "dog",
30294
+ soundId: 685,
30295
+ enabled: true
30296
+ },
30297
+ {
30298
+ id: "sound:footsteps",
30299
+ kind: "sound",
30300
+ label: "Footsteps",
30301
+ icon: "footprints",
30302
+ soundId: 686,
30303
+ enabled: true
30304
+ },
30305
+ {
30306
+ id: "sound:purring",
30307
+ kind: "sound",
30308
+ label: "Purring",
30309
+ icon: "cat",
30310
+ soundId: 687,
30311
+ enabled: true
30312
+ },
30313
+ {
30314
+ id: "sound:tickTock",
30315
+ kind: "sound",
30316
+ label: "Tick-tock",
30317
+ icon: "clock",
30318
+ soundId: 688,
30319
+ enabled: true
30320
+ }
30321
+ ];
30322
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
30323
+ var NavigationPointSchema = z.object({
30324
+ x: z.number(),
30325
+ y: z.number()
30326
+ });
30327
+ /**
30328
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
30329
+ * The cap reports which are enabled so the UI / PTZ render only the controls
30330
+ * that are turned on for THIS device. Data-driven: the provider derives these
30331
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
30332
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
30333
+ * that are not dictionary entries.
30334
+ *
30335
+ * - `move` / `stop` — the momentary drive joystick.
30336
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
30337
+ * map-coordinate plumbing is wired.
30338
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
30339
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
30340
+ * - `light` — the on/off fill-light toggle (works anytime).
30341
+ * - `lightMode` — the auto/manual selector + manual level slider (a
30342
+ * camera-service control; needs an active stream).
29568
30343
  */
29569
- var MotionOnMotionChangedDataSchema = z.object({
29570
- deviceId: z.number(),
29571
- detected: z.boolean(),
29572
- timestamp: z.number(),
29573
- source: MotionSourceEnum,
29574
- regions: z.array(MotionRegionSchema).readonly().optional()
30344
+ var NavigationFeaturesSchema = z.object({
30345
+ move: z.boolean(),
30346
+ stop: z.boolean(),
30347
+ goToPoint: z.boolean(),
30348
+ runAction: z.boolean(),
30349
+ playSound: z.boolean(),
30350
+ light: z.boolean(),
30351
+ lightMode: z.boolean()
29575
30352
  });
29576
- var motionCapability = {
29577
- name: "motion",
29578
- scope: "device",
29579
- mode: "singleton",
29580
- /**
29581
- * Providers register per-device natives via `ctx.registerNativeCap`
29582
- * (Hikvision/Reolink/Amcrest/Wyze/HA/Homematic/Alexa/Matter) — there is
29583
- * NO system singleton provider. Without this flag `resolveCapMount`
29584
- * derived `{ kind: 'singleton' }`, so `motion.getStatus`/`isDetected`
29585
- * resolved via `registry.getSingleton('motion')` (always null) and every
29586
- * call 412'd "provider not available" while bindings listed a live
29587
- * `motion` native (2026-08-02). The flag routes the router through
29588
- * `requireDeviceScoped` → `getProviderForDevice`, like `motion-trigger`,
29589
- * `snapshot` and every other per-device native cap.
29590
- */
29591
- deviceNative: true,
29592
- deviceTypes: [DeviceType.Camera, DeviceType.Sensor],
29593
- methods: {
29594
- /**
29595
- * Pull the current motion state synchronously. Convenience shortcut
29596
- * for consumers that don't need the full status object; equivalent
29597
- * to `getStatus()?.detected ?? false`. Will likely be folded into
29598
- * `getStatus` once the auto-injected status surface lands in every
29599
- * consumer.
29600
- */
29601
- isDetected: method(z.object({ deviceId: z.number() }), z.boolean()) },
29602
- events: {
29603
- /**
29604
- * Fires every time the runner transitions a camera between
29605
- * `watching` and `active` phases. `source` carries which motion
29606
- * path drove the transition; `regions` is populated only for
29607
- * `source: 'analyzer'` (frame-diff regions from the ML motion
29608
- * detector) — onboard sources don't carry per-frame regions
29609
- * here (camera-provided zones / AI metadata live in dedicated
29610
- * channels: `detection.camera-native`, future zone capability).
29611
- *
29612
- * Consumers that want all motion pushes (even with `detected`
29613
- * unchanged) should subscribe to the status subscription via
29614
- * `device-manager.subscribeDeviceStatusAggregate` instead.
29615
- */
29616
- onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
29617
- status: {
29618
- schema: MotionStatusSchema,
29619
- kind: "push"
29620
- },
29621
- /**
29622
- * Runtime-state slice — the last observed motion snapshot, mirrored
29623
- * by the kernel and readable cross-process via
29624
- * `device.state.motion.value`. Reads never invoke the provider, so
29625
- * UIs and other addons can poll the cached state safely.
29626
- */
29627
- runtimeState: MotionStatusSchema,
29628
- /**
29629
- * Runtime-state durability: **session** — self-clearing by construction (`autoClearAfterMs`); a restored `detected: true` is a frozen event, and the next frame re-publishes the real one.
29630
- *
29631
- * See `RuntimeStateDurability`. Enforced by
29632
- * `scripts/check-runtime-state-durability.ts`.
29633
- */
29634
- durability: "session"
29635
- };
29636
- //#endregion
29637
- //#region src/capabilities/motion-trigger.cap.ts
30353
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
30354
+ var NavigationLightModeSchema = z.enum(["auto", "manual"]);
30355
+ /** Manual fill-light level bounds (the camera-service accepts 40..100). */
30356
+ var NAVIGATION_LIGHT_LEVEL_MIN = 40;
30357
+ var NAVIGATION_LIGHT_LEVEL_MAX = 100;
30358
+ /** Coarse work mode the robot reports — drives the UI's active-state chips. */
30359
+ var NavigationModeSchema = z.enum([
30360
+ "idle",
30361
+ "cleaning",
30362
+ "spot",
30363
+ "following",
30364
+ "goto",
30365
+ "returning",
30366
+ "paused",
30367
+ "unknown"
30368
+ ]);
29638
30369
  /**
29639
- * Motion-trigger toggle for accessory devices.
29640
- *
29641
- * "Motion trigger" means: when the parent camera detects motion, the
29642
- * accessory activates automatically. The cap exposes a single boolean
29643
- * — `enabled` — that drivers map to the vendor-specific firmware
29644
- * action (Reolink: `setSirenOnMotion`, `setFloodlightOnMotion`; ONVIF
29645
- * relay: schedule binding; …).
29646
- *
29647
- * The accessory still has its own `switch` cap for direct on/off; this
29648
- * cap is independent. Toggling motion-trigger on does NOT necessarily
29649
- * toggle the switch on — it just instructs the firmware to flip the
29650
- * switch when motion fires.
29651
- *
29652
- * Driver-specific knobs (motion duration window, brightness while
29653
- * triggered, schedule windows) live in the device's
29654
- * `getSettingsUISchema()` instead of bloating this cap — same
29655
- * principle as `switch` and `brightness` keeping their surface
29656
- * minimal.
30370
+ * Live navigation state so the UI can reflect what the robot is doing:
30371
+ * - `mode` — coarse activity (idle / cleaning / following / …).
30372
+ * - `following` — person/pet follow is currently armed.
30373
+ * - `flash` — the on-camera fill light is on.
30374
+ * - `lightMode` — auto vs manual fill-light mode.
30375
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
30376
+ * `lightMode === 'manual'`.
29657
30377
  */
29658
- var MotionTriggerStatusSchema = z.object({
29659
- enabled: z.boolean(),
29660
- /** Ms epoch of the last operator-driven change. */
30378
+ var NavigationStatusSchema = z.object({
30379
+ mode: NavigationModeSchema,
30380
+ following: z.boolean(),
30381
+ flash: z.boolean(),
30382
+ lightMode: NavigationLightModeSchema,
30383
+ lightLevel: z.number().min(40).max(100),
30384
+ /** Ms epoch when the slice was last updated. */
29661
30385
  lastChangedAt: z.number()
29662
30386
  });
29663
30387
  /**
29664
- * Persistent slice mirrored across restarts. The provider writes here
29665
- * on every successful firmware fetch / setMotionTrigger push; the cap
29666
- * router and admin-ui hero read straight from this snapshot via
29667
- * `device.state.motionTrigger.value` instead of re-issuing a firmware
29668
- * round-trip on every UI mount. `lastFetchedAt` lets the framework
29669
- * helper (`createRuntimeStateBridge`) stale-check before deciding
29670
- * whether to refresh from the camera.
29671
- */
29672
- var MotionTriggerRuntimeStateSchema = MotionTriggerStatusSchema.extend({
29673
- /** Ms epoch of the last successful camera fetch (0 = never). */
29674
- lastFetchedAt: z.number() });
29675
- var motionTriggerCapability = {
29676
- name: "motion-trigger",
29677
- scope: "device",
29678
- deviceNative: true,
29679
- mode: "singleton",
29680
- deviceTypes: [
29681
- DeviceType.Light,
29682
- DeviceType.Siren,
29683
- DeviceType.Switch
29684
- ],
29685
- methods: { setMotionTrigger: method(z.object({
29686
- deviceId: z.number().int().nonnegative(),
29687
- enabled: z.boolean()
29688
- }), z.void(), {
29689
- kind: "mutation",
29690
- auth: "admin"
29691
- }) },
29692
- events: { onMotionTriggerChanged: { data: z.object({
29693
- deviceId: z.number(),
29694
- enabled: z.boolean(),
29695
- lastChangedAt: z.number()
29696
- }) } },
29697
- status: {
29698
- schema: MotionTriggerStatusSchema,
29699
- kind: "command-driven"
29700
- },
29701
- runtimeState: MotionTriggerRuntimeStateSchema,
29702
- /**
29703
- * Runtime-state durability: **session** — the authority for motion-trigger enablement is the provider's own config; the slice is a mirror of it, re-published on connect.
29704
- *
29705
- * See `RuntimeStateDurability`. Enforced by
29706
- * `scripts/check-runtime-state-durability.ts`.
29707
- */
29708
- durability: "session"
29709
- };
29710
- //#endregion
29711
- //#region src/capabilities/motion-zones.cap.ts
29712
- /**
29713
- * Motion-zones share the same MaskShape vocabulary as privacy-mask — the
29714
- * on-camera motion-detection mask is a single `grid` region (a row-major
29715
- * boolean cell lattice the camera's onboard VMD evaluates). Composing it as
29716
- * a region keeps one drawing-plane model across all geometry caps.
30388
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
30389
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
30390
+ * convention.
29717
30391
  */
29718
- /** A motion-zone region — exactly one boolean cell grid today. */
29719
- var MotionZoneRegionSchema = z.object({
29720
- id: z.number(),
29721
- enabled: z.boolean(),
29722
- shape: MaskGridShapeSchema
29723
- });
29724
- /** Current on-camera motion-detection state — master enable + sensitivity +
29725
- * the grid region(s). */
29726
- var MotionZoneStatusSchema = z.object({
29727
- enabled: z.boolean(),
29728
- sensitivity: z.number(),
29729
- /** Grid region(s). Today exactly one `grid` shape. */
29730
- regions: z.array(MotionZoneRegionSchema),
29731
- lastFetchedAt: z.number()
29732
- });
29733
- /** Per-camera availability — grid dims are fixed per camera model; the UI
29734
- * sizes its editor from `grid`. */
29735
- var MotionZoneOptionsSchema = z.object({
29736
- maxRegions: z.number(),
29737
- supportedShapes: z.array(MaskShapeKindSchema),
29738
- grid: MaskGridDimsSchema,
29739
- sensitivity: z.object({
29740
- min: z.number(),
29741
- max: z.number(),
29742
- step: z.number()
29743
- })
29744
- });
29745
- /** Partial change — every field optional. */
29746
- var MotionZonePatchSchema = z.object({
29747
- enabled: z.boolean().optional(),
29748
- sensitivity: z.number().optional(),
29749
- regions: z.array(MotionZoneRegionSchema).optional()
29750
- });
29751
- var motionZonesCapability = {
29752
- name: "motion-zones",
30392
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: z.number() });
30393
+ var navigationCapability = {
30394
+ name: "navigation",
29753
30395
  scope: "device",
29754
30396
  deviceNative: true,
29755
30397
  mode: "singleton",
29756
30398
  deviceTypes: [DeviceType.Camera],
29757
30399
  deviceConfig: { ui: {
29758
30400
  kind: "widget",
29759
- widgetId: "host/motion-zones-grid",
29760
- tab: "motion",
29761
- label: "Motion Zones"
30401
+ widgetId: "host/navigation-panel",
30402
+ tab: "navigation",
30403
+ topTab: true,
30404
+ label: "Navigation",
30405
+ order: 0
29762
30406
  } },
29763
30407
  methods: {
29764
- getOptions: method(z.object({ deviceId: z.number() }), MotionZoneOptionsSchema),
29765
- setZone: method(z.object({
30408
+ /**
30409
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
30410
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
30411
+ * path) works for any authenticated user, not admin-only. The UI sends
30412
+ * these at ~1 Hz while a control is held; the provider forwards each one to
30413
+ * a single drive write WITHOUT debouncing.
30414
+ */
30415
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: z.number() }), z.void(), { kind: "mutation" }),
30416
+ /** Halt all motion immediately (zero drive vector). */
30417
+ stop: method(z.object({ deviceId: z.number() }), z.void(), { kind: "mutation" }),
30418
+ /** Send the robot to a point on its live map. */
30419
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: z.number() }), z.void(), { kind: "mutation" }),
30420
+ /**
30421
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
30422
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
30423
+ */
30424
+ listActions: method(z.object({ deviceId: z.number() }), z.array(NavigationActionEntrySchema)),
30425
+ /**
30426
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
30427
+ * unsupported action ids are rejected by the provider.
30428
+ */
30429
+ runAction: method(z.object({
29766
30430
  deviceId: z.number(),
29767
- patch: MotionZonePatchSchema
29768
- }), z.void(), {
29769
- kind: "mutation",
29770
- auth: "admin"
29771
- })
30431
+ actionId: NavigationActionIdSchema
30432
+ }), z.void(), { kind: "mutation" }),
30433
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
30434
+ playSound: method(z.object({
30435
+ deviceId: z.number(),
30436
+ soundId: z.number().int()
30437
+ }), z.void(), { kind: "mutation" }),
30438
+ /**
30439
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
30440
+ * works anytime, no active stream required).
30441
+ */
30442
+ setLightOn: method(z.object({
30443
+ deviceId: z.number(),
30444
+ on: z.boolean()
30445
+ }), z.void(), { kind: "mutation" }),
30446
+ /**
30447
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
30448
+ * initial `level`. The auto/manual + level control is a CAMERA-service
30449
+ * action that generally needs an active camera stream/monitor session — the
30450
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
30451
+ */
30452
+ setLightMode: method(z.object({
30453
+ deviceId: z.number(),
30454
+ mode: NavigationLightModeSchema,
30455
+ level: z.number().min(40).max(100).optional()
30456
+ }), z.void(), { kind: "mutation" }),
30457
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
30458
+ setLightLevel: method(z.object({
30459
+ deviceId: z.number(),
30460
+ level: z.number().min(40).max(100)
30461
+ }), z.void(), { kind: "mutation" }),
30462
+ /**
30463
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
30464
+ * controls the UI shows (the per-entry flags for the dictionary come back on
30465
+ * `listActions`).
30466
+ */
30467
+ getFeatures: method(z.object({ deviceId: z.number() }), NavigationFeaturesSchema)
29772
30468
  },
30469
+ events: { onStatusChanged: { data: z.object({
30470
+ deviceId: z.number(),
30471
+ status: NavigationStatusSchema
30472
+ }) } },
29773
30473
  status: {
29774
- schema: MotionZoneStatusSchema,
29775
- kind: "poll"
30474
+ schema: NavigationStatusSchema,
30475
+ kind: "push"
29776
30476
  },
29777
- runtimeState: MotionZoneStatusSchema,
29778
30477
  /**
29779
- * Runtime-state durability: **restored** — the 14 KB polygon list is the single largest slice on the fleet and has not changed since the operator drew it. Highest value per byte in the table.
30478
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
30479
+ * for live mode / follow / flash changes.
30480
+ */
30481
+ runtimeState: NavigationRuntimeStateSchema,
30482
+ /**
30483
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
30484
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
30485
+ * that. The live handle re-publishes on connect.
29780
30486
  *
29781
30487
  * See `RuntimeStateDurability`. Enforced by
29782
30488
  * `scripts/check-runtime-state-durability.ts`.
29783
30489
  */
29784
- durability: "restored",
29785
- /** Clock fields: written, but excluded from the compare that decides
29786
- * whether persisting is worth a SQLite commit. */
29787
- volatileStateFields: ["lastFetchedAt"]
30490
+ durability: "session"
29788
30491
  };
29789
30492
  //#endregion
29790
- //#region src/capabilities/native-object-detection.cap.ts
30493
+ //#region src/capabilities/network-link.cap.ts
29791
30494
  /**
29792
- * On-camera AI object detection cap. Surfaces per-device the classes
29793
- * the firmware can detect and the last-seen instance of each. The
29794
- * provider also fan-outs these to the global `detection.camera-native`
29795
- * event bus with `source: 'onboard'` so cross-cutting system services
29796
- * (alert-center, advanced-notifier, recording-engine) can subscribe
29797
- * once and receive events from every camera.
30495
+ * How a device reaches the network, and how well.
29798
30496
  *
29799
- * Distinct from `motion-detection` (ML pipeline) and `motion` (hardware
29800
- * PIR or firmware motion pulse): this cap is specifically the AI
29801
- * classifier output coming FROM the camera, not the local pipeline.
30497
+ * NOT `connectivity`: that cap is an UPSTREAM system's binary view of whether
30498
+ * an entity is reachable (a Home Assistant `binary_sensor` with
30499
+ * `device_class: connectivity`). This one is the device's OWN link — the
30500
+ * medium it is on and the signal it sees — the way `battery` is the device's
30501
+ * own charge.
30502
+ *
30503
+ * `'wifi'`, `'ethernet'` and `'cellular'` are links the firmware actually
30504
+ * reported. `'unknown'` is the ABSENCE of an answer — the provider has
30505
+ * registered the capability but has not read the link yet (D315: unknown is
30506
+ * not empty). Consumers skip it rather than draw a wire or a bar.
29802
30507
  */
29803
- var NativeObjectClassEnum = z.enum([
29804
- "person",
29805
- "vehicle",
29806
- "animal",
29807
- "face",
29808
- "package",
29809
- "other"
29810
- ]);
29811
- var NativeDetectionSchema = z.object({
29812
- class: NativeObjectClassEnum,
29813
- timestamp: z.number(),
29814
- /** Firmware-provided confidence [0..1]. Reolink pushes don't carry it → undefined. */
29815
- confidence: z.number().min(0).max(1).optional()
29816
- });
29817
- var NativeObjectDetectionStatusSchema = z.object({
29818
- /**
29819
- * Last observed instance per class. Missing entries mean the class
29820
- * is supported but nothing has been seen since the provider started.
29821
- *
29822
- * MUST be a partial record: providers seed an empty `{}` on cold-start
29823
- * and write one class at a time as detections arrive. In Zod 4
29824
- * `z.record(enum, …)` is EXHAUSTIVE (requires every enum key), so a
29825
- * partial write throws "expected object, received undefined" for every
29826
- * unseen class. `z.partialRecord` keeps the enum-key narrowing while
29827
- * allowing the sparse shape the providers actually write.
29828
- */
29829
- lastByClass: z.partialRecord(NativeObjectClassEnum, NativeDetectionSchema.nullable()),
29830
- /** Classes the firmware is capable of detecting — enumerated at device register. */
29831
- supportedClasses: z.array(NativeObjectClassEnum).readonly(),
30508
+ var NETWORK_LINK_TYPES = [
30509
+ "wifi",
30510
+ "ethernet",
30511
+ "cellular",
30512
+ "unknown"
30513
+ ];
30514
+ /**
30515
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
30516
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
30517
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
30518
+ * one Home Assistant projection.
30519
+ */
30520
+ var NetworkLinkStatusSchema = z.object({
30521
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
30522
+ type: z.enum(NETWORK_LINK_TYPES),
29832
30523
  /**
29833
- * Whether forwarding of onboard AI detections is enabled for this device.
29834
- * Default FALSE (opt-in, cold-start) — onboard AI pushes are noisy/sparse and
29835
- * churn the tracker, so forwarding stays off until the operator enables it.
30524
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
30525
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
30526
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
30527
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
30528
+ * SKIP a null rather than coerce it.
29836
30529
  */
29837
- enabled: z.boolean()
30530
+ signalPercent: z.number().min(0).max(100).nullable(),
30531
+ /** Raw received signal strength in dBm, when the firmware reports one. */
30532
+ rssiDbm: z.number().optional(),
30533
+ /** Network name of a wireless link, when the firmware reports it. */
30534
+ ssid: z.string().optional(),
30535
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
30536
+ lastUpdated: z.number()
29838
30537
  });
29839
- var NativeObjectDetectionRuntimeStateSchema = NativeObjectDetectionStatusSchema.extend({
29840
- /** Required by createRuntimeStateBridge — epoch ms of last refresh. */
29841
- lastFetchedAt: z.number() });
29842
- var nativeObjectDetectionCapability = {
29843
- name: "native-object-detection",
30538
+ /** The slice a provider seeds before its first read: nothing is known yet. */
30539
+ var NETWORK_LINK_UNKNOWN = {
30540
+ type: "unknown",
30541
+ signalPercent: null,
30542
+ lastUpdated: 0
30543
+ };
30544
+ /**
30545
+ * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
30546
+ * Out-of-range or non-finite input is not a reading: `null`.
30547
+ */
30548
+ function signalPercentFromBars(bars, maxBars) {
30549
+ if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
30550
+ if (bars < 0 || bars > maxBars) return null;
30551
+ return Math.round(bars / maxBars * 100);
30552
+ }
30553
+ /**
30554
+ * Normalise an RSSI in dBm to 0..100 on the usual wifi scale: -100 dBm and
30555
+ * below is 0 %, -50 dBm and above is 100 %, linear between. Non-finite or
30556
+ * positive input is not an RSSI: `null`.
30557
+ */
30558
+ function signalPercentFromRssi(rssiDbm) {
30559
+ if (rssiDbm === void 0 || !Number.isFinite(rssiDbm) || rssiDbm > 0) return null;
30560
+ return Math.round((Math.min(-50, Math.max(-100, rssiDbm)) + 100) * 2);
30561
+ }
30562
+ var networkLinkCapability = {
30563
+ name: "network-link",
29844
30564
  scope: "device",
29845
30565
  deviceNative: true,
29846
30566
  mode: "singleton",
29847
- deviceTypes: [DeviceType.Camera],
29848
- methods: { setEnabled: method(z.object({
29849
- deviceId: z.number(),
29850
- enabled: z.boolean()
29851
- }), z.void(), {
29852
- kind: "mutation",
29853
- auth: "admin"
29854
- }) },
29855
- events: { onDetected: { data: z.object({
30567
+ deviceTypes: [
30568
+ DeviceType.Camera,
30569
+ DeviceType.Sensor,
30570
+ DeviceType.Button,
30571
+ DeviceType.Switch,
30572
+ DeviceType.Light,
30573
+ DeviceType.Lock,
30574
+ DeviceType.Siren
30575
+ ],
30576
+ methods: {},
30577
+ events: {
30578
+ /**
30579
+ * Emitted whenever the cached status changes (a link switch, a signal
30580
+ * reading that moved). Mirrored on the parent chain by the
30581
+ * DeviceEventPropagator like `battery.onStatusChanged`.
30582
+ */
30583
+ onStatusChanged: { data: z.object({
29856
30584
  deviceId: z.number(),
29857
- detection: NativeDetectionSchema
30585
+ status: NetworkLinkStatusSchema
29858
30586
  }) } },
29859
30587
  status: {
29860
- schema: NativeObjectDetectionStatusSchema,
29861
- kind: "push"
30588
+ schema: NetworkLinkStatusSchema,
30589
+ kind: "push",
30590
+ empty: NETWORK_LINK_UNKNOWN
29862
30591
  },
29863
- runtimeState: NativeObjectDetectionRuntimeStateSchema,
29864
30592
  /**
29865
- * Runtime-state durability: **restored** — `enabled` is an operator toggle on a camera whose refresh is a no-op and whose staleMs is Infinity. There is no hardware value to re-read — losing it loses the setting.
30593
+ * Runtime-state slice — every provider stores the same shape under
30594
+ * `device.runtimeState['network-link']`, read once by the badge and the
30595
+ * Home Assistant projector regardless of the driver.
30596
+ */
30597
+ runtimeState: NetworkLinkStatusSchema,
30598
+ /**
30599
+ * Runtime-state durability: **restored** — a link reading is slow to
30600
+ * change and a sleeping battery camera may not report for hours; the
30601
+ * restored slice is what the badge shows until the next read.
29866
30602
  *
29867
30603
  * See `RuntimeStateDurability`. Enforced by
29868
30604
  * `scripts/check-runtime-state-durability.ts`.
@@ -29870,7 +30606,7 @@ var nativeObjectDetectionCapability = {
29870
30606
  durability: "restored",
29871
30607
  /** Clock fields: written, but excluded from the compare that decides
29872
30608
  * whether persisting is worth a SQLite commit. */
29873
- volatileStateFields: ["lastFetchedAt"]
30609
+ volatileStateFields: ["lastUpdated"]
29874
30610
  };
29875
30611
  //#endregion
29876
30612
  //#region src/capabilities/network-quality.cap.ts
@@ -31805,431 +32541,6 @@ var ptzAutotrackCapability = {
31805
32541
  durability: "session"
31806
32542
  };
31807
32543
  //#endregion
31808
- //#region src/capabilities/navigation.cap.ts
31809
- /**
31810
- * `navigation` — a device-scoped capability that natively expresses the FULL
31811
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
31812
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
31813
- *
31814
- * Why a NEW cap rather than overloading `ptz`:
31815
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
31816
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
31817
- * The two are different physical models: PTZ is absolute-position + presets,
31818
- * navigation is momentary drive nudges + discrete robot ACTIONS
31819
- * (dock / spot-clean / follow-pet / go-to-point / …).
31820
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
31821
- * the reverse:
31822
- * 1. a native CamStack navigation panel (data-driven from `listActions`
31823
- * / `getOptions`), and
31824
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
31825
- * robot camera shows up in the existing PTZ control path without every
31826
- * PTZ provider learning about robots. The mapping lives in the adapter,
31827
- * not here (see the addon design note):
31828
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
31829
- * ptz.stop() → navigation.stop()
31830
- * ptz.goHome() → navigation.runAction('goHome')
31831
- * ptz.getPresets() → navigation.listActions() (id→preset)
31832
- * ptz.goToPreset(id) → navigation.runAction(id)
31833
- *
31834
- * ## Continuous drive
31835
- *
31836
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
31837
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
31838
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
31839
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
31840
- * coalesce them. The UI owns the cadence.
31841
- *
31842
- * ## The action dictionary
31843
- *
31844
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
31845
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
31846
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
31847
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
31848
- * vendor-specific list. `kind: 'action'` entries are triggered with
31849
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
31850
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
31851
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
31852
- *
31853
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
31854
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
31855
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
31856
- * every device handle. A future nodedreame publish adds a typed
31857
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
31858
- * provider can then swap the raw calls for the typed methods with no change to
31859
- * THIS contract.
31860
- */
31861
- /**
31862
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
31863
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
31864
- * halts it.
31865
- *
31866
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
31867
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
31868
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
31869
- * vector by it (drivers without proportional drive ignore it).
31870
- *
31871
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
31872
- * axis alone; an all-undefined nudge is a no-op.
31873
- */
31874
- var NavigationMoveCommandSchema = z.object({
31875
- pan: z.number().min(-1).max(1).optional(),
31876
- tilt: z.number().min(-1).max(1).optional(),
31877
- speed: z.number().min(0).max(1).optional()
31878
- });
31879
- /**
31880
- * The enumerated discrete actions a navigation-capable robot can perform via
31881
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
31882
- * subset it supports through `listActions`. Sounds are NOT here — they go through
31883
- * `playSound` (see the `sound` dictionary entries).
31884
- */
31885
- var NavigationActionIdSchema = z.enum([
31886
- "goHome",
31887
- "locate",
31888
- "spotClean",
31889
- "findPet",
31890
- "personFollow",
31891
- "stop",
31892
- "startClean",
31893
- "pauseClean",
31894
- "dockWash",
31895
- "autoEmpty",
31896
- "flashOn",
31897
- "flashOff"
31898
- ]);
31899
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
31900
- var NavigationEntryKindSchema = z.enum(["action", "sound"]);
31901
- /**
31902
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
31903
- * native panel and the PTZ mimic render as a button.
31904
- *
31905
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
31906
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
31907
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
31908
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
31909
- * - `label` — operator-facing English label.
31910
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
31911
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
31912
- * PTZ render ONLY enabled entries. Data-driven: the provider
31913
- * flips it from config, never by editing code.
31914
- */
31915
- var NavigationActionEntrySchema = z.object({
31916
- id: z.string(),
31917
- kind: NavigationEntryKindSchema,
31918
- label: z.string(),
31919
- icon: z.string(),
31920
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
31921
- soundId: z.number().int().optional(),
31922
- /** Per-device feature flag — render this entry only when true. */
31923
- enabled: z.boolean()
31924
- });
31925
- /**
31926
- * Canonical dictionary of every navigation control (discrete actions + sounds)
31927
- * with its default label + icon hint. A provider filters this to the subset a
31928
- * device supports (and may override a label). Exported so the provider AND the
31929
- * UI share ONE list instead of re-deriving labels / ids independently.
31930
- *
31931
- * Icons are lucide-style hints; the viewer maps them to its own icon set. Every
31932
- * catalog default is `enabled: true`; a provider overrides per-device from
31933
- * config (data-driven — enabling / disabling one later is a config change, not a
31934
- * code change).
31935
- */
31936
- var NAVIGATION_ACTION_CATALOG = [
31937
- {
31938
- id: "startClean",
31939
- kind: "action",
31940
- label: "Start cleaning",
31941
- icon: "play",
31942
- enabled: true
31943
- },
31944
- {
31945
- id: "pauseClean",
31946
- kind: "action",
31947
- label: "Pause cleaning",
31948
- icon: "pause",
31949
- enabled: true
31950
- },
31951
- {
31952
- id: "stop",
31953
- kind: "action",
31954
- label: "Stop",
31955
- icon: "hand",
31956
- enabled: true
31957
- },
31958
- {
31959
- id: "goHome",
31960
- kind: "action",
31961
- label: "Return to dock",
31962
- icon: "home",
31963
- enabled: true
31964
- },
31965
- {
31966
- id: "locate",
31967
- kind: "action",
31968
- label: "Locate",
31969
- icon: "bell",
31970
- enabled: true
31971
- },
31972
- {
31973
- id: "spotClean",
31974
- kind: "action",
31975
- label: "Spot clean here",
31976
- icon: "crosshair",
31977
- enabled: true
31978
- },
31979
- {
31980
- id: "findPet",
31981
- kind: "action",
31982
- label: "Find pet",
31983
- icon: "paw-print",
31984
- enabled: true
31985
- },
31986
- {
31987
- id: "personFollow",
31988
- kind: "action",
31989
- label: "Follow me",
31990
- icon: "footprints",
31991
- enabled: true
31992
- },
31993
- {
31994
- id: "dockWash",
31995
- kind: "action",
31996
- label: "Wash mop",
31997
- icon: "droplets",
31998
- enabled: true
31999
- },
32000
- {
32001
- id: "autoEmpty",
32002
- kind: "action",
32003
- label: "Empty dustbin",
32004
- icon: "trash-2",
32005
- enabled: true
32006
- },
32007
- {
32008
- id: "flashOn",
32009
- kind: "action",
32010
- label: "Flash on",
32011
- icon: "flashlight",
32012
- enabled: true
32013
- },
32014
- {
32015
- id: "flashOff",
32016
- kind: "action",
32017
- label: "Flash off",
32018
- icon: "flashlight-off",
32019
- enabled: true
32020
- },
32021
- {
32022
- id: "sound:meow",
32023
- kind: "sound",
32024
- label: "Meow",
32025
- icon: "cat",
32026
- soundId: 684,
32027
- enabled: true
32028
- },
32029
- {
32030
- id: "sound:bark",
32031
- kind: "sound",
32032
- label: "Woof",
32033
- icon: "dog",
32034
- soundId: 685,
32035
- enabled: true
32036
- },
32037
- {
32038
- id: "sound:footsteps",
32039
- kind: "sound",
32040
- label: "Footsteps",
32041
- icon: "footprints",
32042
- soundId: 686,
32043
- enabled: true
32044
- },
32045
- {
32046
- id: "sound:purring",
32047
- kind: "sound",
32048
- label: "Purring",
32049
- icon: "cat",
32050
- soundId: 687,
32051
- enabled: true
32052
- },
32053
- {
32054
- id: "sound:tickTock",
32055
- kind: "sound",
32056
- label: "Tick-tock",
32057
- icon: "clock",
32058
- soundId: 688,
32059
- enabled: true
32060
- }
32061
- ];
32062
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
32063
- var NavigationPointSchema = z.object({
32064
- x: z.number(),
32065
- y: z.number()
32066
- });
32067
- /**
32068
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
32069
- * The cap reports which are enabled so the UI / PTZ render only the controls
32070
- * that are turned on for THIS device. Data-driven: the provider derives these
32071
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
32072
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
32073
- * that are not dictionary entries.
32074
- *
32075
- * - `move` / `stop` — the momentary drive joystick.
32076
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
32077
- * map-coordinate plumbing is wired.
32078
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
32079
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
32080
- * - `light` — the on/off fill-light toggle (works anytime).
32081
- * - `lightMode` — the auto/manual selector + manual level slider (a
32082
- * camera-service control; needs an active stream).
32083
- */
32084
- var NavigationFeaturesSchema = z.object({
32085
- move: z.boolean(),
32086
- stop: z.boolean(),
32087
- goToPoint: z.boolean(),
32088
- runAction: z.boolean(),
32089
- playSound: z.boolean(),
32090
- light: z.boolean(),
32091
- lightMode: z.boolean()
32092
- });
32093
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
32094
- var NavigationLightModeSchema = z.enum(["auto", "manual"]);
32095
- /** Manual fill-light level bounds (the camera-service accepts 40..100). */
32096
- var NAVIGATION_LIGHT_LEVEL_MIN = 40;
32097
- var NAVIGATION_LIGHT_LEVEL_MAX = 100;
32098
- /** Coarse work mode the robot reports — drives the UI's active-state chips. */
32099
- var NavigationModeSchema = z.enum([
32100
- "idle",
32101
- "cleaning",
32102
- "spot",
32103
- "following",
32104
- "goto",
32105
- "returning",
32106
- "paused",
32107
- "unknown"
32108
- ]);
32109
- /**
32110
- * Live navigation state so the UI can reflect what the robot is doing:
32111
- * - `mode` — coarse activity (idle / cleaning / following / …).
32112
- * - `following` — person/pet follow is currently armed.
32113
- * - `flash` — the on-camera fill light is on.
32114
- * - `lightMode` — auto vs manual fill-light mode.
32115
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
32116
- * `lightMode === 'manual'`.
32117
- */
32118
- var NavigationStatusSchema = z.object({
32119
- mode: NavigationModeSchema,
32120
- following: z.boolean(),
32121
- flash: z.boolean(),
32122
- lightMode: NavigationLightModeSchema,
32123
- lightLevel: z.number().min(40).max(100),
32124
- /** Ms epoch when the slice was last updated. */
32125
- lastChangedAt: z.number()
32126
- });
32127
- /**
32128
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
32129
- * observable). Adds `lastFetchedAt` on top of the status shape per the
32130
- * convention.
32131
- */
32132
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: z.number() });
32133
- var navigationCapability = {
32134
- name: "navigation",
32135
- scope: "device",
32136
- deviceNative: true,
32137
- mode: "singleton",
32138
- deviceTypes: [DeviceType.Camera],
32139
- deviceConfig: { ui: {
32140
- kind: "widget",
32141
- widgetId: "host/navigation-panel",
32142
- tab: "navigation",
32143
- topTab: true,
32144
- label: "Navigation",
32145
- order: 0
32146
- } },
32147
- methods: {
32148
- /**
32149
- * Momentary drive nudge (the robot moves). `protected` — mirrors
32150
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
32151
- * path) works for any authenticated user, not admin-only. The UI sends
32152
- * these at ~1 Hz while a control is held; the provider forwards each one to
32153
- * a single drive write WITHOUT debouncing.
32154
- */
32155
- move: method(NavigationMoveCommandSchema.extend({ deviceId: z.number() }), z.void(), { kind: "mutation" }),
32156
- /** Halt all motion immediately (zero drive vector). */
32157
- stop: method(z.object({ deviceId: z.number() }), z.void(), { kind: "mutation" }),
32158
- /** Send the robot to a point on its live map. */
32159
- goToPoint: method(NavigationPointSchema.extend({ deviceId: z.number() }), z.void(), { kind: "mutation" }),
32160
- /**
32161
- * Enumerate the discrete controls THIS device supports (data-driven UI +
32162
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
32163
- */
32164
- listActions: method(z.object({ deviceId: z.number() }), z.array(NavigationActionEntrySchema)),
32165
- /**
32166
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
32167
- * unsupported action ids are rejected by the provider.
32168
- */
32169
- runAction: method(z.object({
32170
- deviceId: z.number(),
32171
- actionId: NavigationActionIdSchema
32172
- }), z.void(), { kind: "mutation" }),
32173
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
32174
- playSound: method(z.object({
32175
- deviceId: z.number(),
32176
- soundId: z.number().int()
32177
- }), z.void(), { kind: "mutation" }),
32178
- /**
32179
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
32180
- * works anytime, no active stream required).
32181
- */
32182
- setLightOn: method(z.object({
32183
- deviceId: z.number(),
32184
- on: z.boolean()
32185
- }), z.void(), { kind: "mutation" }),
32186
- /**
32187
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
32188
- * initial `level`. The auto/manual + level control is a CAMERA-service
32189
- * action that generally needs an active camera stream/monitor session — the
32190
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
32191
- */
32192
- setLightMode: method(z.object({
32193
- deviceId: z.number(),
32194
- mode: NavigationLightModeSchema,
32195
- level: z.number().min(40).max(100).optional()
32196
- }), z.void(), { kind: "mutation" }),
32197
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
32198
- setLightLevel: method(z.object({
32199
- deviceId: z.number(),
32200
- level: z.number().min(40).max(100)
32201
- }), z.void(), { kind: "mutation" }),
32202
- /**
32203
- * Per-device FEATURE-FLAG report for the general primitives — drives which
32204
- * controls the UI shows (the per-entry flags for the dictionary come back on
32205
- * `listActions`).
32206
- */
32207
- getFeatures: method(z.object({ deviceId: z.number() }), NavigationFeaturesSchema)
32208
- },
32209
- events: { onStatusChanged: { data: z.object({
32210
- deviceId: z.number(),
32211
- status: NavigationStatusSchema
32212
- }) } },
32213
- status: {
32214
- schema: NavigationStatusSchema,
32215
- kind: "push"
32216
- },
32217
- /**
32218
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
32219
- * for live mode / follow / flash changes.
32220
- */
32221
- runtimeState: NavigationRuntimeStateSchema,
32222
- /**
32223
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
32224
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
32225
- * that. The live handle re-publishes on connect.
32226
- *
32227
- * See `RuntimeStateDurability`. Enforced by
32228
- * `scripts/check-runtime-state-durability.ts`.
32229
- */
32230
- durability: "session"
32231
- };
32232
- //#endregion
32233
32544
  //#region src/capabilities/reboot.cap.ts
32234
32545
  /**
32235
32546
  * reboot — device-scoped capability for "soft" device reboots (firmware
@@ -36361,134 +36672,6 @@ var RUNTIME_DEFAULTS = {
36361
36672
  "auth.tokenExpiry": "30d"
36362
36673
  };
36363
36674
  //#endregion
36364
- //#region src/device/container-primary-child.ts
36365
- /**
36366
- * WHICH child a container stands for — one definition, for every consumer.
36367
- *
36368
- * A CONTAINER device has no controllable surface of its own: it groups entity
36369
- * children (a Gree air-conditioner grouping a climate child plus light, x-fan
36370
- * and health switches). Everything that has to show or act on a container has
36371
- * to answer the same question — which child IS the container — and until now
36372
- * three places answered it separately:
36373
- *
36374
- * - `ui-library/device-controls/primary-child.ts` (admin-ui rendering)
36375
- * - `addon-provider-homeassistant` PARENT_TYPE_PRIORITY (adoption)
36376
- * - the viewer's own `container-primary.ts` (linked-devices panel)
36377
- *
36378
- * Each carried the same list and a comment asking the others to stay in sync.
36379
- * This is that list, in the one package all of them already depend on.
36380
- *
36381
- * `ui-library` and the server's linked-devices expansion IMPORT it. Two
36382
- * consumers cannot, and keep a checked copy instead: the viewer resolves
36383
- * `@camstack/types` from its own `node_modules` (an installed release, where a
36384
- * newly added export simply is not there), and the Home Assistant provider
36385
- * expresses the same precedence over the `DeviceType` enum because it answers
36386
- * a different question from the same ordering. `scripts/check-container-
36387
- * priority-in-sync.ts` fails the build when either drifts — the comment that
36388
- * used to ask for this could not.
36389
- *
36390
- * The rule has two halves and the ORDER matters: an operator's explicit pick
36391
- * wins outright, and only in its absence does type priority decide. The pick is
36392
- * keyed on the child's re-sync-stable `entityId`, not its numeric id, so it
36393
- * survives a re-sync that reallocates ids.
36394
- */
36395
- /**
36396
- * Type priority, most→least "primary". An actuator (climate / lock / cover / …)
36397
- * outranks a bare `switch` so a container's defining child wins over its
36398
- * auxiliary switches. Unknown or absent types sort after every entry.
36399
- *
36400
- * NB: `siren` deliberately sits BELOW `switch` — it is a switch-family
36401
- * actuator, and a camera's siren must not out-rank the thing the container is.
36402
- *
36403
- * These strings are matched against a child's `DeviceType` VALUE, so they must
36404
- * equal the enum's string values.
36405
- */
36406
- var CONTAINER_CHILD_PRIORITY = [
36407
- "media-player",
36408
- "alarm-panel",
36409
- "thermostat",
36410
- "climate",
36411
- "humidifier",
36412
- "water-heater",
36413
- "lock",
36414
- "cover",
36415
- "valve",
36416
- "fan",
36417
- "vacuum",
36418
- "lawn-mower",
36419
- "light",
36420
- "switch",
36421
- "siren",
36422
- "button",
36423
- "control",
36424
- "notifier",
36425
- "script",
36426
- "automation",
36427
- "update",
36428
- "presence",
36429
- "weather",
36430
- "image",
36431
- "sensor"
36432
- ];
36433
- /**
36434
- * Roles that say what a container IS, most→least defining. Consulted BEFORE
36435
- * type priority, because `DeviceType` cannot tell them apart: Home Assistant
36436
- * maps a door contact, a battery level, a temperature reading and a "last seen"
36437
- * timestamp all to `DeviceType.Sensor`. Measured on container 4127 — children
36438
- * `battery-sensor`, `temperature-sensor`, `datetime-sensor`, `contact-sensor`
36439
- * and a role-less `button` — the type list ranked `button` above `sensor` and
36440
- * the container stood for its "Identifica" button instead of the door contact
36441
- * it is named after.
36442
- *
36443
- * Only STATE-DEFINING roles belong here. A diagnostic reading (battery,
36444
- * temperature, humidity, signal, last-seen) is never what a container is, so
36445
- * they are deliberately absent and fall through to type priority.
36446
- */
36447
- var CONTAINER_CHILD_ROLE_PRIORITY = [
36448
- "contact-sensor",
36449
- "motion-sensor",
36450
- "occupancy-sensor",
36451
- "smoke-sensor",
36452
- "co-sensor",
36453
- "gas-sensor",
36454
- "leak-sensor",
36455
- "vibration-sensor",
36456
- "tamper-sensor",
36457
- "sound-sensor"
36458
- ];
36459
- /**
36460
- * NOT in the list, deliberately: `binary-sensor` and `binary-helper`. They are
36461
- * GENERIC — they say "this reports a boolean", not what the container is — and
36462
- * ranking them above type priority is a live regression, not a hypothetical:
36463
- * container 1837 holds a real `lock` (features `['lock-open']`) alongside a
36464
- * child named "Actuator" whose only role is `binary-sensor`, and the generic
36465
- * role beat the lock. A role earns a place here by naming a SUBJECT (a contact,
36466
- * a leak, smoke), never by naming a datatype.
36467
- */
36468
- function roleRank(role) {
36469
- if (role === void 0) return CONTAINER_CHILD_ROLE_PRIORITY.length;
36470
- const i = CONTAINER_CHILD_ROLE_PRIORITY.indexOf(role);
36471
- return i === -1 ? CONTAINER_CHILD_ROLE_PRIORITY.length : i;
36472
- }
36473
- function rank(type) {
36474
- const i = CONTAINER_CHILD_PRIORITY.indexOf(type);
36475
- return i === -1 ? CONTAINER_CHILD_PRIORITY.length : i;
36476
- }
36477
- /**
36478
- * The child a container stands for: the operator's pick when it still exists,
36479
- * else the highest-priority type. `null` for a childless container — a caller
36480
- * must decide what an empty container means for it, rather than being handed a
36481
- * child that is not there.
36482
- */
36483
- function resolveContainerPrimaryChild(children, overrideEntityId, containerName) {
36484
- if (overrideEntityId !== void 0 && overrideEntityId !== null) {
36485
- const picked = children.find((c) => c.stableId === overrideEntityId) ?? children.find((c) => c.entityId !== void 0 && c.entityId === overrideEntityId);
36486
- if (picked !== void 0) return picked;
36487
- }
36488
- const namesake = (c) => containerName !== void 0 && containerName.length > 0 && c.name !== void 0 && c.name.toLowerCase() === containerName.toLowerCase() ? 0 : 1;
36489
- return [...children].toSorted((a, b) => roleRank(a.role) - roleRank(b.role) || namesake(a) - namesake(b) || rank(a.type) - rank(b.type))[0] ?? null;
36490
- }
36491
- //#endregion
36492
36675
  //#region src/device/accessory.ts
36493
36676
  /**
36494
36677
  * Accessory device helpers — shared across drivers.
@@ -38074,6 +38257,134 @@ function isBatteryPresenceFault(presence) {
38074
38257
  return presence === "unreachable";
38075
38258
  }
38076
38259
  //#endregion
38260
+ //#region src/device/container-primary-child.ts
38261
+ /**
38262
+ * WHICH child a container stands for — one definition, for every consumer.
38263
+ *
38264
+ * A CONTAINER device has no controllable surface of its own: it groups entity
38265
+ * children (a Gree air-conditioner grouping a climate child plus light, x-fan
38266
+ * and health switches). Everything that has to show or act on a container has
38267
+ * to answer the same question — which child IS the container — and until now
38268
+ * three places answered it separately:
38269
+ *
38270
+ * - `ui-library/device-controls/primary-child.ts` (admin-ui rendering)
38271
+ * - `addon-provider-homeassistant` PARENT_TYPE_PRIORITY (adoption)
38272
+ * - the viewer's own `container-primary.ts` (linked-devices panel)
38273
+ *
38274
+ * Each carried the same list and a comment asking the others to stay in sync.
38275
+ * This is that list, in the one package all of them already depend on.
38276
+ *
38277
+ * `ui-library` and the server's linked-devices expansion IMPORT it. Two
38278
+ * consumers cannot, and keep a checked copy instead: the viewer resolves
38279
+ * `@camstack/types` from its own `node_modules` (an installed release, where a
38280
+ * newly added export simply is not there), and the Home Assistant provider
38281
+ * expresses the same precedence over the `DeviceType` enum because it answers
38282
+ * a different question from the same ordering. `scripts/check-container-
38283
+ * priority-in-sync.ts` fails the build when either drifts — the comment that
38284
+ * used to ask for this could not.
38285
+ *
38286
+ * The rule has two halves and the ORDER matters: an operator's explicit pick
38287
+ * wins outright, and only in its absence does type priority decide. The pick is
38288
+ * keyed on the child's re-sync-stable `entityId`, not its numeric id, so it
38289
+ * survives a re-sync that reallocates ids.
38290
+ */
38291
+ /**
38292
+ * Type priority, most→least "primary". An actuator (climate / lock / cover / …)
38293
+ * outranks a bare `switch` so a container's defining child wins over its
38294
+ * auxiliary switches. Unknown or absent types sort after every entry.
38295
+ *
38296
+ * NB: `siren` deliberately sits BELOW `switch` — it is a switch-family
38297
+ * actuator, and a camera's siren must not out-rank the thing the container is.
38298
+ *
38299
+ * These strings are matched against a child's `DeviceType` VALUE, so they must
38300
+ * equal the enum's string values.
38301
+ */
38302
+ var CONTAINER_CHILD_PRIORITY = [
38303
+ "media-player",
38304
+ "alarm-panel",
38305
+ "thermostat",
38306
+ "climate",
38307
+ "humidifier",
38308
+ "water-heater",
38309
+ "lock",
38310
+ "cover",
38311
+ "valve",
38312
+ "fan",
38313
+ "vacuum",
38314
+ "lawn-mower",
38315
+ "light",
38316
+ "switch",
38317
+ "siren",
38318
+ "button",
38319
+ "control",
38320
+ "notifier",
38321
+ "script",
38322
+ "automation",
38323
+ "update",
38324
+ "presence",
38325
+ "weather",
38326
+ "image",
38327
+ "sensor"
38328
+ ];
38329
+ /**
38330
+ * Roles that say what a container IS, most→least defining. Consulted BEFORE
38331
+ * type priority, because `DeviceType` cannot tell them apart: Home Assistant
38332
+ * maps a door contact, a battery level, a temperature reading and a "last seen"
38333
+ * timestamp all to `DeviceType.Sensor`. Measured on container 4127 — children
38334
+ * `battery-sensor`, `temperature-sensor`, `datetime-sensor`, `contact-sensor`
38335
+ * and a role-less `button` — the type list ranked `button` above `sensor` and
38336
+ * the container stood for its "Identifica" button instead of the door contact
38337
+ * it is named after.
38338
+ *
38339
+ * Only STATE-DEFINING roles belong here. A diagnostic reading (battery,
38340
+ * temperature, humidity, signal, last-seen) is never what a container is, so
38341
+ * they are deliberately absent and fall through to type priority.
38342
+ */
38343
+ var CONTAINER_CHILD_ROLE_PRIORITY = [
38344
+ "contact-sensor",
38345
+ "motion-sensor",
38346
+ "occupancy-sensor",
38347
+ "smoke-sensor",
38348
+ "co-sensor",
38349
+ "gas-sensor",
38350
+ "leak-sensor",
38351
+ "vibration-sensor",
38352
+ "tamper-sensor",
38353
+ "sound-sensor"
38354
+ ];
38355
+ /**
38356
+ * NOT in the list, deliberately: `binary-sensor` and `binary-helper`. They are
38357
+ * GENERIC — they say "this reports a boolean", not what the container is — and
38358
+ * ranking them above type priority is a live regression, not a hypothetical:
38359
+ * container 1837 holds a real `lock` (features `['lock-open']`) alongside a
38360
+ * child named "Actuator" whose only role is `binary-sensor`, and the generic
38361
+ * role beat the lock. A role earns a place here by naming a SUBJECT (a contact,
38362
+ * a leak, smoke), never by naming a datatype.
38363
+ */
38364
+ function roleRank(role) {
38365
+ if (role === void 0) return CONTAINER_CHILD_ROLE_PRIORITY.length;
38366
+ const i = CONTAINER_CHILD_ROLE_PRIORITY.indexOf(role);
38367
+ return i === -1 ? CONTAINER_CHILD_ROLE_PRIORITY.length : i;
38368
+ }
38369
+ function rank(type) {
38370
+ const i = CONTAINER_CHILD_PRIORITY.indexOf(type);
38371
+ return i === -1 ? CONTAINER_CHILD_PRIORITY.length : i;
38372
+ }
38373
+ /**
38374
+ * The child a container stands for: the operator's pick when it still exists,
38375
+ * else the highest-priority type. `null` for a childless container — a caller
38376
+ * must decide what an empty container means for it, rather than being handed a
38377
+ * child that is not there.
38378
+ */
38379
+ function resolveContainerPrimaryChild(children, overrideEntityId, containerName) {
38380
+ if (overrideEntityId !== void 0 && overrideEntityId !== null) {
38381
+ const picked = children.find((c) => c.stableId === overrideEntityId) ?? children.find((c) => c.entityId !== void 0 && c.entityId === overrideEntityId);
38382
+ if (picked !== void 0) return picked;
38383
+ }
38384
+ const namesake = (c) => containerName !== void 0 && containerName.length > 0 && c.name !== void 0 && c.name.toLowerCase() === containerName.toLowerCase() ? 0 : 1;
38385
+ return [...children].toSorted((a, b) => roleRank(a.role) - roleRank(b.role) || namesake(a) - namesake(b) || rank(a.type) - rank(b.type))[0] ?? null;
38386
+ }
38387
+ //#endregion
38077
38388
  //#region src/device/declared-device.ts
38078
38389
  /** Marker written to a declared integration's `info`. */
38079
38390
  var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
@@ -39883,6 +40194,7 @@ var CAPABILITY_NAMES = {
39883
40194
  storage: "storage",
39884
40195
  storageEvictable: "storage-evictable",
39885
40196
  storageMigration: "storage-migration",
40197
+ storageOccupancy: "storage-occupancy",
39886
40198
  storageProvider: "storage-provider",
39887
40199
  streamBroker: "stream-broker",
39888
40200
  streamCatalog: "stream-catalog",
@@ -40428,6 +40740,10 @@ var CAPABILITY_ROUTER_KEYS = [
40428
40740
  key: "storageMigration",
40429
40741
  name: "storage-migration"
40430
40742
  },
40743
+ {
40744
+ key: "storageOccupancy",
40745
+ name: "storage-occupancy"
40746
+ },
40431
40747
  {
40432
40748
  key: "storageProvider",
40433
40749
  name: "storage-provider"
@@ -40672,6 +40988,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
40672
40988
  storageCapability,
40673
40989
  storageEvictableCapability,
40674
40990
  storageMigrationCapability,
40991
+ storageOccupancyCapability,
40675
40992
  storageProviderCapability,
40676
40993
  streamBrokerCapability,
40677
40994
  streamCatalogCapability,
@@ -45640,13 +45957,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
45640
45957
  addonId: null,
45641
45958
  access: "view"
45642
45959
  },
45643
- "storage.getDefaultLocation": {
45960
+ "storage.list": {
45644
45961
  capName: "storage",
45645
45962
  capScope: "system",
45646
45963
  addonId: null,
45647
45964
  access: "view"
45648
45965
  },
45649
- "storage.list": {
45966
+ "storage.listDrainProgress": {
45650
45967
  capName: "storage",
45651
45968
  capScope: "system",
45652
45969
  addonId: null,
@@ -45796,6 +46113,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
45796
46113
  addonId: null,
45797
46114
  access: "view"
45798
46115
  },
46116
+ "storageOccupancy.getOccupancy": {
46117
+ capName: "storage-occupancy",
46118
+ capScope: "system",
46119
+ addonId: null,
46120
+ access: "view"
46121
+ },
45799
46122
  "storageProvider.abortUpload": {
45800
46123
  capName: "storage-provider",
45801
46124
  capScope: "system",
@@ -46931,6 +47254,7 @@ var KNOWN_CAP_NAMES = [
46931
47254
  "storage",
46932
47255
  "storage-evictable",
46933
47256
  "storage-migration",
47257
+ "storage-occupancy",
46934
47258
  "storage-provider",
46935
47259
  "stream-broker",
46936
47260
  "stream-catalog",
@@ -47077,6 +47401,7 @@ var SYSTEM_CAP_NAMES = [
47077
47401
  "storage",
47078
47402
  "storage-evictable",
47079
47403
  "storage-migration",
47404
+ "storage-occupancy",
47080
47405
  "storage-provider",
47081
47406
  "stream-broker",
47082
47407
  "system",
@@ -50073,10 +50398,10 @@ function createSystemProxy(api) {
50073
50398
  readChunk: (input) => dispatch("storage", "readChunk", "query", input),
50074
50399
  endDownload: (input) => dispatch("storage", "endDownload", "mutation", input),
50075
50400
  listLocations: (input) => dispatch("storage", "listLocations", "query", input),
50076
- getDefaultLocation: (input) => dispatch("storage", "getDefaultLocation", "query", input),
50077
50401
  listLocationDeclarations: (input) => dispatch("storage", "listLocationDeclarations", "query", input),
50078
50402
  upsertLocation: (input) => dispatch("storage", "upsertLocation", "mutation", input),
50079
50403
  deleteLocation: (input) => dispatch("storage", "deleteLocation", "mutation", input),
50404
+ listDrainProgress: (input) => dispatch("storage", "listDrainProgress", "query", input),
50080
50405
  testLocation: (input) => dispatch("storage", "testLocation", "query", input),
50081
50406
  listProviders: (input) => dispatch("storage", "listProviders", "query", input),
50082
50407
  testConfig: (input) => dispatch("storage", "testConfig", "query", input)
@@ -54130,4 +54455,4 @@ function enumerateInferenceDevices(hw) {
54130
54455
  return out;
54131
54456
  }
54132
54457
  //#endregion
54133
- export { ACCESSORY_LABEL, ACCESS_ROLES, ALEXA_EGRESS_PROFILE, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, AUDIO_ANALYSIS_CAP_NAME, AUDIO_BACKEND_CHOICES, AUDIO_MACRO_LABELS, AUDIO_PRESETS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionCandidateResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, AdoptionJobSchema, AdoptionJobStateSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, AdoptionOutcomeSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, ApiKeyRecordSchema, ApiKeySummarySchema, ArchiveEntrySchema, ArchiveManifestSchema, AttachmentMediaTypeSchema, AttachmentSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationActionSchema, AutomationConditionOperatorSchema, AutomationConditionSchema, AutomationControlStatusSchema, AutomationRecipeSchema, AutomationTriggerSchema, AvailableIntegrationTypeSchema, BACKEND_TO_FORMAT, BASE_LIVE_EGRESS_PROFILE, BATTERY_DEVICE_PROFILE, BATTERY_UNREACHABLE_AFTER_MS, BOOT_RECOVERY_BACKOFF_MS, BacklightModeSchema, BackupDestinationInfoSchema, BackupEntrySchema, BackupRunPhaseSchema, BackupRunSchema, BackupRunStateSchema, BackupTriggerResultSchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, BulkRecordSchema, CAMERA_SWITCH_CATALOG, CAMERA_SWITCH_ORDER, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, CLASS_MAP_MACRO_TARGETS, CLUSTER_MODEL_SCOPED_STEPS, CLUSTER_MODEL_SECTION_ID, CLUSTER_STEP_SETTING_FIELDS, COCO_80_LABELS, COCO_TO_MACRO, CONNECTION_TEST_TIMEOUT_MS, CONTAINER_CHILD_PRIORITY, CORE_BLOCKS_ADDON_ID, CORE_BLOCK_ADDON_PREFIX, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraOccupancySnapshotForDeviceSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusDegradationReasonSchema, CameraStatusDegradationSchema, CameraStatusSchema, CameraStatusStageSchema, CameraStreamSchema, CameraSwitchAuthoritySchema, CameraSwitchGroupSchema, CameraSwitchIdSchema, CameraSwitchSchema, CameraSwitchUnavailableReasonSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipPlaybackSchema, ClipSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectionTestDescriptorSchema, ConnectionTestInputSchema, ConnectionTestOutcomeSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, ConvertArtifactSchema, ConvertResultSchema, ConvertTargetSchema, CoreBlockCompileResultSchema, CoreBlockInputSchema, CoreBlockPlacementSchema, CoreBlockSchema, CoreBlockStatusSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, CustomModelDescriptorSchema, DATAPLANE_SECRET_HEADER, DECLARED_DEVICE_SWEEP_LIMIT, DECLARED_INTEGRATION_FIXED_KEY, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_CLUSTER_STEP_MODELS, DEFAULT_CLUSTER_STEP_SETTINGS, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_DETAIL_CROP_CONVENTION, DEFAULT_EVENTS_BAND_BUFFER_SEC, DEFAULT_EVENT_COLOR, DEFAULT_FEATURES, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS, DEFAULT_MIN_LANDMARK_FACE_SIZE_PX, DEFAULT_NATIVE_LEASE_SETTINGS, DEFAULT_POOL_MEMORY_POLICY, DEFAULT_RECORDING_PROFILES, DEFAULT_RETENTION, DEFAULT_RUNTIME_STATE_DURABILITY, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFAULT_TOKEN_EXPIRY, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, DETECTION_MACRO_CLASSES, DETECTION_PIPELINE_CAP_NAME, DEVICE_BACKEND_TO_FORMAT, DEVICE_CAP_NAMES, DEVICE_CHILDREN_BATCH_MAX, DEVICE_PROFILES, DEVICE_RESTORE_RETRY_CONCURRENCY, DEVICE_RESTORE_RETRY_DELAYS_MS, DEVICE_SCOPED_CAPS, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATE_READERS, DEVICE_STATUS_METHOD, DEVICE_TYPE_CONTROL_KIND, DEVICE_TYPE_INFO, EngineInfoSchema as DataStoreEngineInfoSchema, DayNightModeSchema, DayNightOptionsSchema, DayNightSettingsPatchSchema, DayNightStatusSchema, DeclaredDevices, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetailCropConventionSchema, DetectionCatalogClassMapSchema, DetectionSourceSchema, DeviceCodeSeveritySchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceNetworkStatsSchema, DeviceRestoreRetryScheduler, DeviceRole, DeviceRuntimeState, DeviceSelectorSchema, DeviceStatusSchema, DeviceType, DiagnosticIdSchema, DiagnosticWindowPatchSchema, DiagnosticWindowSchema, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DiscoveredTargetSchema, DiskReconcileJobSchema, DisposerChain, DoorbellPressEventSchema, DoorbellStatusSchema, EVENTFUL_CAP_NAMES, EVENT_DENSITY_BATCH_MAX, EVENT_KIND_BY_CAP, EVENT_PAD_MS, EVENT_TAXONOMY, EXPORT_DENSE_MAX_RANGES, EXPRESSION_BUILTINS, EXPRESSION_BUILTIN_NAMES, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, EgressEncodeSchema, EgressRateControlSchema, EgressTranscodeRequestSchema, EgressTranscodeSchema, ElementConfigStore, EmbeddingInfoSchema, EmbeddingResultSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventDensityBucketSchema, EventDensityForDeviceSchema, EventEmitterStatusSchema, EventFireSchema, EventItemSchema, EventKindCategorySchema, EventKindDescriptorSchema, EventKindIconSchema, EventKindSchema, EventKindsForDeviceSchema, EventMediaArtifactSchema, EventMediaCoverageSchema, EventMediaKindSchema, EventMediaProductionSchema, EventSourceType, ExportBytesSchema, ExportDenseRangeSchema, ExportDenseSchema, ExportDownloadSchema, ExportOptionsSchema, ExportRecordSchema, ExportSetupFieldSchema, ExportSetupSchema, ExportSpeedSchema, ExportStateSchema, ExportTimelapseSchema, ExposedDeviceSchema, ExposureModeSchema, ExpressionBindingSourceSchema, ExpressionEvalError, ExpressionFieldBindingSchema, ExpressionGlobalBindingSchema, ExpressionLiteralBindingSchema, ExpressionParseError, ExpressionSourceSchema, FIRST_LEVEL_MACRO_CLASSES, FULL_IMAGE_BBOX, FailureContributionSchema, FailureCounters, FailureReasonCountSchema, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, Fmp4BoxSplitter, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, FrameLazyCountersSchema, FrameLazyMetricsSchema, GasStatusSchema, GetLoggingSettingsInputSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, HAP_AUDIO_BASE, HAP_AUDIO_BITRATE_KBPS, HAP_AUDIO_VBV_KBITS, HAP_KEYFRAME_INTERVAL_SEC, HF_BASE_URL, HF_REPO, HWACCEL_OPTIONS, HealthStatusSchema, HfModelResolutionSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, INFERENCE_DEVICE_EXCLUSION_REASONS, ImageContractSchema, ImageContractStateSchema, ImageRotateSchema, ImageSettingsOptionsSchema, ImageSettingsPatchSchema, ImageSettingsStatusSchema, ImageStatusSchema, InferenceDeviceExclusionReasonSchema, IngestOwnerSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, KeyEventSchema, LOAD_CONTRIBUTION_ATTRIBUTIONS, LOAD_CONTRIBUTION_ROLES, LOG_CHANNEL_TICK_MS, LOG_LEVEL_RANK, LabelAttributionSchema, LabelDefinitionSchema, LabelTierSchema, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LedgerWalkDeviceReportSchema, LedgerWalkInputSchema, LedgerWalkRefusalSchema, LedgerWalkReportSchema, LedgerWalkSkipCountsSchema, LedgerWalkSkipReasonSchema, LinkedDeviceSchema, LinkedDevicesModeSchema, LlmDefaultSchema, LlmDefaultSelectorSchema, LlmDownloadProgressSchema, LlmErrorCodeSchema, LlmGenerateBaseInputSchema, LlmGenerateErrSchema, LlmGenerateOkSchema, LlmGenerateResultSchema, LlmImageSchema, LlmNodeModelSchema, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, LlmRetryPolicySchema, LlmRuntimeCompleteInputSchema, LlmRuntimeDiskUsageSchema, LlmRuntimeNodeSchema, LlmRuntimeStatusSchema, LlmTimeoutDefaults, LlmUsageRollupSchema, LlmUsageSchema, LoadContributionSchema, LocateSegmentResultSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogChannelApplyResultSchema, LogChannelDescriptorSchema, LogChannelGate, LogChannelLevelSchema, LogChannelRegistry, LogChannelWindowPatchSchema, LogChannelWindowSchema, LogChannelWindowStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, LoggingEffectiveSchema, LoggingExplicitSchema, LoggingLevelLayerSchema, LoggingLevelSourceSchema, LoggingScopeKindSchema, LoggingSettingsPatchSchema, LoggingSettingsStateSchema, LoginMethodContributionSchema, LoginStageEnum, MACRO_LABELS, MAX_CLIP_EVENT_IDS, MAX_CLIP_LABELS, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, MAX_KEYS, MAX_REASONS_PER_KEY, MAX_SENSOR_TRIGGER_DEVICES, MAX_TRACK_DEBUG_NOTE_LEN, METHOD_ACCESS_MAP, METHOD_DEVICE_SELECTORS, MODEL_FORMATS, MODEL_PROVIDER_IDS, MOTION_TRIGGER_FEATURE, ManagedModelCatalogEntrySchema, ManagedModelExtraFileSchema, ManagedModelRefSchema, ManagedRuntimeConfigSchema, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileInfoSchema, MediaFileKindEnum, MediaFileRefSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MediaRelocateModeSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, MigrateDeviceResultSchema, MigrateSwitchOutcomeSchema, MigrateSwitchReportSchema, ModelCatalogEntrySchema, ModelConvertInputSchema, ModelConvertMetadataSchema, ModelDistributeInputSchema, ModelDistributeResultSchema, ModelExtraFileSchema, ModelFormatEntrySchema, ModelFormatsSchema, ModelProviderIdSchema, ModelSubstitutionSchema, ModelVariantGroupSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, MutationFilterSchema, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SCENE_BUDGET_FIELD, NATIVE_LEASE_SCENE_BUDGET_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, NAVIGATION_ACTION_CATALOG, NAVIGATION_LIGHT_LEVEL_MAX, NAVIGATION_LIGHT_LEVEL_MIN, NC_ALARM_SYSTEM_EVENT_KINDS, NC_AUDIO_CONFIRM_HITS_DEFAULT, NC_AUDIO_CONFIRM_HITS_MAX, NC_AUDIO_CONFIRM_HITS_MIN, NC_AUDIO_CONFIRM_WINDOW_MAX_SEC, NC_AUDIO_CONFIRM_WINDOW_MIN_SEC, NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT, NC_AUDIO_DBFS_FLOOR, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, NC_AUDIO_SEED, NC_AUTHORABLE_SYSTEM_EVENT_KINDS, NC_BASE_CONDITION_KEYS, NC_CONDITION_CATALOG, NC_CONFIRM_DEFAULT_MAX_IMAGE_PX, NC_CONFIRM_DEFAULT_TIMEOUT_MS, NC_CONFIRM_MAX_TIMEOUT_MS, NC_CONFIRM_MIN_TIMEOUT_MS, NC_DEFAULT_SNOOZE_MINUTES, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_OCCUPANCY_DEFAULTS, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_RULE_SECTIONS, NC_SNOOZE_MAX_MINUTES, NC_SYSTEM_DELIVERY, NC_SYSTEM_EVENT_FILTER_KEYS, NC_TAXONOMY, NETWORK_LINK_TYPES, NETWORK_LINK_UNKNOWN, NativeCropBboxSchema, NativeCropRefSchema, NativeCropResultSchema, NativeDetectionSchema, NativeLeaseAdmissionSchema, NativeLeaseSettingsSchema, NativeObjectClassEnum, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionStatusSchema, NavigationActionEntrySchema, NavigationActionIdSchema, NavigationEntryKindSchema, NavigationFeaturesSchema, NavigationLightModeSchema, NavigationModeSchema, NavigationMoveCommandSchema, NavigationPointSchema, NavigationRuntimeStateSchema, NavigationStatusSchema, NcAlarmConfigSchema, NcAlarmModeCoverageSchema, NcAlarmSettingsPatchSchema, NcAlarmSettingsSchema, NcAlarmSkipReasonSchema, NcAlarmSkippedDeviceSchema, NcAudioConditionSchema, NcConditionDescriptorSchema, NcConditionsSchema, NcConfirmExpectSchema, NcConfirmSchema, NcCrossingSchema, NcDeliverySchema, NcDeviceStateConditionSchema, NcHistoryEntrySchema, NcHistoryFilterSchema, NcHistoryRecordKindSchema, NcHistoryStatusSchema, NcHistorySubjectSchema, NcMediaFrameSchema, NcMediaPolicySchema, NcOccupancyConditionSchema, NcPlateMatcherSchema, NcRuleActionSchema, NcRuleActionSequenceSchema, NcRuleActionsSchema, NcRuleInputSchema, NcRuleNotificationButtonSchema, NcRulePatchSchema, NcRuleSchema, NcRuleTargetSchema, NcSceneConditionSchema, NcScheduleSchema, NcScheduleWindowSchema, NcSnoozeInputSchema, NcSnoozeSchema, NcSnoozeScopeSchema, NcSnoozeSuppressedSchema, NcSystemEventConditionSchema, NcSystemEventKindSchema, NcTaxonomyEntrySchema, NcTaxonomySchema, NcTestResultSchema, NcThrottleGranularitySchema, NcThrottleSchema, NcZoneConditionSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NetworkLinkStatusSchema, NotificationActionIconSchema, NotificationActionSchema, NotificationFormatSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OPERATOR_WRITTEN_STALE_MS, OPS_LOG_DEFAULT_LIMIT, OPS_LOG_RING_DEFAULT_MAX, OVERFLOW_REASON, OauthIntegrationDescriptorSchema, ObjectEventSchema, OpsLogDomainSchema, OpsLogEntrySchema, OpsLogOpSchema, OpsLogQueryInputSchema, OpsLogReasonSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdRenderOutcomeEnum, OsdRenderResultSchema, OsdSlotBindingSchema, OsdSlotViewSchema, OsdSourceOptionSchema, OsdSourceSchema, OsdSourceValueTypeEnum, OsdStatusSchema, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PRIVACY_MASK_CAP_NAME, PROVIDER_KIND_CAP_NAMES, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, PasskeyLoginMethodSchema, PasskeySummarySchema, PcmSampleFormatSchema, PerScopeBreakdownSchema, PetFeederStatusSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, PlaceholderReasonSchema, PolygonPointSchema, PoolMemoryWatchdog, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzMoveCommandSchema, PtzOptionsSchema, PtzPositionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, RATE_CONTROL_RELAXED, RATE_CONTROL_TIGHT, REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHABILITY_PROBE_TIMEOUT_MS, RECOGNITION_TYPES, RECORDING_EXPORT_MAX_READ_BYTES, RECORDING_TIMELINE_BATCH_MAX, REDACTED_SECRET, RESERVED_BINDING_NAMES, RESTORED_CAP_NAMES, ROOT_BUCKET_KEY, RUNTIME_DEFAULTS, RUNTIME_STATE_POLICY, RUNTIME_STATE_REFRESH_MISS_COOLDOWN_MS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadGopBytesResultSchema, ReadSegmentBytesResultSchema, ReadWindowBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RecentTracksPageSchema, RecentTracksQueryInput, RecordingAvailabilityForDeviceSchema, RecordingAvailabilitySchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysForDeviceSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingObjectTriggerClassSchema, RecordingRangeSchema, RecordingRebalanceInputSchema, RecordingRebalanceMoveSchema, RecordingRebalancePlanSchema, RecordingRebalanceSkipReasonSchema, RecordingRebalanceSkipSchema, RecordingRetentionSchema, RecordingSignalRuntimeStateSchema, RecordingSignalStatusSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RedirectLoginMethodSchema, RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, RelocateFootageClassSchema, RelocateFootageInputSchema, RelocateJobSchema, RelocateJobStateSchema, RelocateMediaInputSchema, RelocateResidueInputSchema, RelocateResidueSchema, RenderedAsSchema, ReportMotionInputSchema, ReportedFailureContributionSchema, ReportedLoadContributionSchema, RequestCensusGroupSchema, RequestCensusProcedureSchema, RequestCensusSnapshotSchema, RequestCensusStatusSchema, RetrainAnnotationDraftSchema, RetrainAnnotationKindSchema, RetrainAnnotationSchema, RetrainAnnotationSourceSchema, RetrainAssistResultSchema, RetrainAssistSubjectSchema, RetrainCopyRefusalSchema, RetrainFrameCandidateSchema, RetrainFrameListSchema, RetrainFrameSchema, RetrainFrameSelectionSchema, RetrainMacroClassSchema, RetrainStatusSchema, RetrainTrackSchema, RetrainTransitionResultSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerFrameSourceSchema, RunnerInferenceDeviceSchema, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCENE_CONDITIONS, SCENE_CONFIRM_DEFAULT_MAX_IMAGE_PX, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS, SCENE_DEFAULT_ANCHOR_THRESHOLD, SCENE_DEFAULT_CHECK_INTERVAL_SEC, SCENE_DEFAULT_OBSERVATION_SPACING_SEC, SCENE_DEFAULT_QUIET_SECONDS, SCENE_DEFAULT_UNCOVERED_POLICY, SCENE_DIVERGED, SCENE_RESET_RECAPTURES, SCOPE_PRESETS, SENSOR_FEATURES, SENSOR_MAP, SHARE_VIEW_KINDS, SOURCE_CAPS, SOURCE_CAP_ACTIVE_FIELD, SOURCE_CAP_CHANGED_AT_FIELD, SOURCE_DEVICE_TYPES, SOURCE_INFO_METADATA_KEY, STORAGE_ACCESS_FALLBACK, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SUMMARIES_DEFAULT_LIMIT, SUMMARIES_MAX_LIMIT, SYSTEM_CAP_NAMES, SYSTEM_SCOPE_DEVICE_METHODS, SceneCheckSchema, SceneConditionSchema, SceneConfirmSchema, SceneMonitorSchema, SceneMonitorStateSchema, SceneMonitorStatusForDeviceSchema, SceneMonitorStatusSchema, SceneReferenceSchema, SceneUnavailableSchema, SceneUncoveredPolicySchema, SceneVerdictSchema, ScopedTokenSchema, ScopedTokenSummarySchema, ScoredObjectEventSchema, ScriptRunnerStatusSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SendResultSchema, SensorEventSchema, ServerBootModeSchema, ServerPackageStatusSchema, ServerRollbackInfoSchema, ServerUpdateActionResultSchema, ServerUpdateCheckResultSchema, ServerUpdateStateSchema, SetLoggingSettingsInputSchema, SetSiteLocationInputSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, StationaryObjectSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, StorageAccessSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, StorageCleanupInputSchema, StorageCleanupJobSchema, StorageCleanupPhaseSchema, StorageCleanupStatusInputSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, StorageMigrationClassSchema, StorageMigrationDestinationsSchema, StorageMigrationDrainInputSchema, StorageMigrationFindingCodeSchema, StorageMigrationFindingSchema, StorageMigrationFootageMoveInputSchema, StorageMigrationInputSchema, StorageMigrationJobSchema, StorageMigrationLaneSchema, StorageMigrationLeaseInputSchema, StorageMigrationMediaMoveInputSchema, StorageMigrationModeSchema, StorageMigrationMoveProgressSchema, StorageMigrationMoveSchema, StorageMigrationMoverSchema, StorageMigrationParticipantSchema, StorageMigrationPhaseSchema, StorageMigrationPlanSchema, StorageMigrationResidueSchema, StorageMigrationSourcesSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SummarySchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TAXONOMY_COLORS, TIMELAPSE_DENSE_FLOOR_SEC, TIMEZONES, TRANSCODE_DOWN_MAX_BITRATE_KBPS, TRANSCODE_DOWN_MAX_HEIGHT, TamperStatusSchema, TankStatusSchema, TargetKindCapsSchema, TargetKindLevelSchema, TargetKindSchema, TargetSchema, TemperatureSensorStatusSchema, TerminalInstanceInfoSchema, TerminalLegacyCameraSchema, TerminalOutputBatchSchema, TerminalOutputEventSchema, TerminalProfileInfoSchema, TerminalSessionInfoSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, TestConnectionStatusEnum, TestResultSchema, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackCascadeCountsSchema, TrackEnvelopeSchema, TrackFlagsPatchSchema, TrackFlagsSchema, TrackProjectionSchema, TrackSchema, TrackSourceSchema, TrackStateSchema, TrackZoneFilterSchema, TrackedDetectionSchema, TrainingExportDeviceTotalsSchema, TrainingExportSummarySchema, TransportPlaneCountsSchema, TransportPlaneSchema, TurnServerSchema, UNATTRIBUTED_BUCKET_KEY, UNIT_TABLE, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UnitConversionError, UnstampedEventMediaCountSchema, UnstampedRowsSchema, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VISIT_MERGE_GAP_MS, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VectorDeclareIndexInputSchema, VectorDeleteByFilterInputSchema, VectorDeleteInputSchema, VectorDeleteResultSchema, VectorFilterSchema, VectorGetInputSchema, VectorGetResultSchema, VectorItemSchema, VectorMatchSchema, VectorMetadataSchema, VectorMetricSchema, VectorQueryInputSchema, VectorQueryResultSchema, VectorStatsInputSchema, VectorStatsResultSchema, VectorUpsertInputSchema, VectorUpsertResultSchema, VibrationStatusSchema, VideoEncodeSchema, WEBRTC_EGRESS_PROFILE, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WhiteBalanceModeSchema, WidgetHostEnum, WidgetLoginMethodSchema, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, YAMNET_TO_MACRO, ZoneCrossingDirectionSchema, ZoneCrossingSchema, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, __resetLogChannelRegistryForTests, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, asBoolean, asJsonArray, asJsonObject, asNumber, asString, assertTimelapseCadences, audioAnalysisCapability, audioAnalyzerCapability, audioCodecCapability, audioIsFailClosed, audioKindId, audioLabelChoices, audioMetricsCapability, audioModeOf, audioOrDefaults, audioPlanFromEncodeProfile, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, bareAddonId, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildAudioArgs, buildEventKindDescriptor, buildFfmpegArgs, buildInputArgs, buildModelVariantGroups, buildNcTaxonomy, buildRoleScopes, buildStreamParamsConfigSchema, buildVideoArgs, buttonCapability, cameraCredentialsCapability, cameraPipelineConfigCapability, cameraStreamsCapability, canConvertUnit, canonicalEgressPlan, carbonMonoxideCapability, cellsToRects, classifyBearerPrincipal, classifyStream, classifyStreams, climateControlCapability, clusterModelSettingKey, clusterStepSettingFieldsFor, clusterStepSettingKey, collectHydratedFieldEntries, collectHydratedFieldValues, collectSecretConfigKeys, colorCapability, colorForKind, commitWatchdogRestart, compileExpression, compileExpressionSafe, composeSwitchedOff, conditionDepth, conditionExclusionReason, conditionVisibleForKind, connectionTestCapability, connectivityCapability, consumablesCapability, contactCapability, controlCapability, convertUnit, coreBlockAddonId, coreBlockIdFromAddonId, coreBlocksCapability, cosineSimilarity, countConditionLeaves, coverCapability, createDeviceProxy, createDurableState, createEvent, createEventBusSliceSource, createExpressionScope, createHwAccelCache, createLazyTrpcSource, createLogChannelsProvider, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, customModelRegistryCapability, dataStoreProviderCapability, dayNightCapability, declarationOwnerNodeId, declareLogChannel, decodeVectorBase64, decoderCapability, defaultDeliveryForSection, defaultDeviceFor, defineCustomActions, deriveBatteryPresence, deriveCameraSwitches, deriveDetailCropRect, deriveRecordingMode, describeModelVariant, detectAccessRole, detectionPipelineCapability, deviceAdoptionCapability, deviceBackendToFormat, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceSelectorMatches, deviceStateCapability, deviceStatusCapability, doorbellCapability, droppedConditionsForKind, egressTranscodeSharingKey, egressTransportFromRequest, embeddingEncoderCapability, emitDownForOwnedCaps, emitReadiness, encodeProfileFromStreamShape, encodeVectorBase64, enumSensorCapability, enumerateInferenceDevices, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateAst, evaluateExpressionSource, evaluatePoolMemory, evaluateSensorEdge, evaluateZoneRules, event, eventEmitterCapability, eventsCapability, expandCapMethods, extractNestedAddonId, extractSourceInfoFromMetadata, faceGalleryCapability, failureContributionCapability, failureRate, fanControlCapability, featureProbeCapability, filesystemBrowseCapability, findTimezone, floodCapability, foldSnapshotByFunction, formatForBackend, formatForRuntime, gasCapability, generateAutomationBlock, getAudioMacroClassIds, getByPath, getCapsByProviderKind, getLogChannelRegistry, getTaxonomyEntry, hasMotionTrigger, hfModelUrl, htmlToText, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, imageSettingsCapability, inferModelProvider, initialPoolMemoryState, integrationsCapability, intercomCapability, invocationFromEncodeProfile, isAgentOnlyPlacement, isArrayOutputSchema, isAudioLabelSelected, isAudioRule, isBaseConditionKey, isBatteryPresenceFault, isClusterScopedStep, isCollectionArrayMethod, isDeployableToAgent, isDetectionMacroClass, isDeviceConfigCap, isDeviceScopedCap, isEvent, isFirstLevelMacroClass, isIsolatedBuiltin, isNode, isObjectInput, isOccupancyRule, isRestoredCap, isSameAddonId, isScheduleActive, isSecretConfigField, isSoftwareDecode, isSourceCap, isSystemDelivery, isVoidInput, jobKindSchema, kebabToCamel, knownValues, lawnMowerControlCapability, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, llmCapability, llmRuntimeCapability, loadContributionCapability, localNetworkCapability, locationSimilarity, lockControlCapability, logBannerArgs, logChannelsCapability, logDestinationCapability, logLevelAtMost, loginMethodCapability, looseSchema, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, markdownToHtmlLite, markdownToText, maskUrlCredentials, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, methodAccessForHttpMethod, metricsProviderCapability, migrateLegacyDeviceSignalConfig, modelConvertCapability, modelDistributorCapability, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, navigationCapability, networkAccessCapability, networkLinkCapability, networkQualityCapability, nodePin, nodesCapability, normalizeAddonInitResult, normalizeAudioLabel, normalizeTokenScopes, normalizeUnit, notificationOutputCapability, notificationRulesCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, objectInputDeclaresAddonId, osdCapability, osdManagerCapability, overlayClusterStepSettings, parseCameraStreamConfig, parseExpression, parseJsonArray, parseJsonObject, parseJsonUnknown, parseProcStatus, parseProfileBrokerId, parseRuleSection, parseStreamParamsFormPatch, patchAudio, petFeederCapability, pickAccessoryControl, pickClusterStepModels, pickClusterStepSettings, pickDetailCropConvention, pickNativeLeaseOverride, pickPreferredRtspEntry, pickRestartCandidate, pickVideoEncoder, pickerForCondition, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, plateGalleryCapability, platformProbeCapability, poolMemoryThreshold, powerMeterCapability, prepareNotification, presenceCapability, pressureSensorCapability, principalMayReachAddon, privacyMaskCapability, procedureAuthKey, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, readClusterStepModels, readClusterStepSettings, readDetailCropConvention, readDeviceStateFrom, readNativeLeaseOverride, readNodePin, readTimelapseGeneratedAt, readinessKey, rebootCapability, recordingCapability, recordingExportCapability, recordingSignalCapability, rectsToCells, reducePoints, requiresPython, resetPoolBaseline, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveAddonRuntime, resolveBucketMs, resolveCapMount, resolveClusterStepModelId, resolveContainerPrimaryChild, resolveDetectionRuntime, resolveDeviceControlKind, resolveDeviceProfile, resolveEgressDecodeHwAccel, resolveFormat, resolveHydratedFieldValue, resolveMethodAuth, resolveModelFormat, resolveMutate, resolvePoolMemoryPolicy, resolveRecordingProfiles, resolveRunnerId, resolveVariantModelId, resolveViewableDeviceIds, roleSpec, ruleEditorSectionsForKind, ruleKindOf, ruleKindSpec, ruleMatchesSection, ruleSection, ruleSectionOf, ruleSeedForSection, runInferenceStep, runtimeDevices, runtimeStatePolicyFor, sceneMonitorCapability, schemaDeclaresAnyField, scopeInherits, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, scoreRuntimes, scriptRunnerCapability, selectAssignedProfileSlots, serverManagementCapability, setByPath, settingsStoreCapability, signalPercentFromBars, signalPercentFromRssi, sleep, sleepCancellable, sliceActiveValue, sliceChangedAt, smokeCapability, smtpProviderCapability, snapshotCapability, ssoBridgeCapability, startReachabilityPoll, stateVocabularyFor, storageCapability, storageEvictableCapability, storageMigrationCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, stripRetiredBandPreBufferSec, subKindsOf, summarisePrivacyAudio, summarizeEffectiveScope, supportedRuntimes, switchCapability, switchedOffIds, synthesizeSourceInfo, systemCapability, systemEventFilterApplies, systemEventFilterAppliesToAnyKind, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, terminalSessionCapability, textToHtml, toDeviceSummary, toExpressionValue, toNodeId, toStreamSourceEntry, toastCapability, toggleAudioLabel, tokenize, transcodeBody, tryConvertUnit, turnProviderCapability, unitDimension, unitsForDimension, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, validateExpressionSource, validateRecipeBounds, valveCapability, vectorDimFromBase64, vectorStoreCapability, vibrationCapability, videoclipsCapability, viewerUiCapability, waterHeaterCapability, weatherCapability, webrtcClientHintsSchema, webrtcSessionCapability, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };
54458
+ export { ACCESSORY_LABEL, ACCESS_ROLES, ALEXA_EGRESS_PROFILE, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, AUDIO_ANALYSIS_CAP_NAME, AUDIO_BACKEND_CHOICES, AUDIO_MACRO_LABELS, AUDIO_PRESETS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionCandidateResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, AdoptionJobSchema, AdoptionJobStateSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, AdoptionOutcomeSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, ApiKeyRecordSchema, ApiKeySummarySchema, ArchiveEntrySchema, ArchiveManifestSchema, AttachmentMediaTypeSchema, AttachmentSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationActionSchema, AutomationConditionOperatorSchema, AutomationConditionSchema, AutomationControlStatusSchema, AutomationRecipeSchema, AutomationTriggerSchema, AvailableIntegrationTypeSchema, BACKEND_TO_FORMAT, BASE_LIVE_EGRESS_PROFILE, BATTERY_DEVICE_PROFILE, BATTERY_UNREACHABLE_AFTER_MS, BOOT_RECOVERY_BACKOFF_MS, BacklightModeSchema, BackupDestinationInfoSchema, BackupEntrySchema, BackupRunPhaseSchema, BackupRunSchema, BackupRunStateSchema, BackupTriggerResultSchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, BulkRecordSchema, CAMERA_SWITCH_CATALOG, CAMERA_SWITCH_ORDER, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, CLASS_MAP_MACRO_TARGETS, CLUSTER_MODEL_SCOPED_STEPS, CLUSTER_MODEL_SECTION_ID, CLUSTER_STEP_SETTING_FIELDS, COCO_80_LABELS, COCO_TO_MACRO, CONNECTION_TEST_TIMEOUT_MS, CONTAINER_CHILD_PRIORITY, CORE_BLOCKS_ADDON_ID, CORE_BLOCK_ADDON_PREFIX, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraOccupancySnapshotForDeviceSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusDegradationReasonSchema, CameraStatusDegradationSchema, CameraStatusSchema, CameraStatusStageSchema, CameraStreamSchema, CameraSwitchAuthoritySchema, CameraSwitchGroupSchema, CameraSwitchIdSchema, CameraSwitchSchema, CameraSwitchUnavailableReasonSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipPlaybackSchema, ClipSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectionTestDescriptorSchema, ConnectionTestInputSchema, ConnectionTestOutcomeSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, ConvertArtifactSchema, ConvertResultSchema, ConvertTargetSchema, CoreBlockCompileResultSchema, CoreBlockInputSchema, CoreBlockPlacementSchema, CoreBlockSchema, CoreBlockStatusSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, CustomModelDescriptorSchema, DATAPLANE_SECRET_HEADER, DECLARED_DEVICE_SWEEP_LIMIT, DECLARED_INTEGRATION_FIXED_KEY, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_CLUSTER_STEP_MODELS, DEFAULT_CLUSTER_STEP_SETTINGS, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_DETAIL_CROP_CONVENTION, DEFAULT_EVENTS_BAND_BUFFER_SEC, DEFAULT_EVENT_COLOR, DEFAULT_FEATURES, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS, DEFAULT_MIN_LANDMARK_FACE_SIZE_PX, DEFAULT_NATIVE_LEASE_SETTINGS, DEFAULT_POOL_MEMORY_POLICY, DEFAULT_RECORDING_PROFILES, DEFAULT_RETENTION, DEFAULT_RUNTIME_STATE_DURABILITY, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFAULT_TOKEN_EXPIRY, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, DETECTION_MACRO_CLASSES, DETECTION_PIPELINE_CAP_NAME, DEVICE_BACKEND_TO_FORMAT, DEVICE_CAP_NAMES, DEVICE_CHILDREN_BATCH_MAX, DEVICE_PROFILES, DEVICE_RESTORE_RETRY_CONCURRENCY, DEVICE_RESTORE_RETRY_DELAYS_MS, DEVICE_SCOPED_CAPS, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATE_READERS, DEVICE_STATUS_METHOD, DEVICE_TYPE_CONTROL_KIND, DEVICE_TYPE_INFO, EngineInfoSchema as DataStoreEngineInfoSchema, DayNightModeSchema, DayNightOptionsSchema, DayNightSettingsPatchSchema, DayNightStatusSchema, DeclaredDevices, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetailCropConventionSchema, DetectionCatalogClassMapSchema, DetectionSourceSchema, DeviceCodeSeveritySchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceNetworkStatsSchema, DeviceRestoreRetryScheduler, DeviceRole, DeviceRuntimeState, DeviceSelectorSchema, DeviceStatusSchema, DeviceType, DiagnosticIdSchema, DiagnosticWindowPatchSchema, DiagnosticWindowSchema, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DiscoveredTargetSchema, DiskReconcileJobSchema, DisposerChain, DoorbellPressEventSchema, DoorbellStatusSchema, EVENTFUL_CAP_NAMES, EVENT_DENSITY_BATCH_MAX, EVENT_KIND_BY_CAP, EVENT_PAD_MS, EVENT_TAXONOMY, EXPORT_DENSE_MAX_RANGES, EXPRESSION_BUILTINS, EXPRESSION_BUILTIN_NAMES, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, EgressEncodeSchema, EgressRateControlSchema, EgressTranscodeRequestSchema, EgressTranscodeSchema, ElementConfigStore, EmbeddingInfoSchema, EmbeddingResultSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventDensityBucketSchema, EventDensityForDeviceSchema, EventEmitterStatusSchema, EventFireSchema, EventItemSchema, EventKindCategorySchema, EventKindDescriptorSchema, EventKindIconSchema, EventKindSchema, EventKindsForDeviceSchema, EventMediaArtifactSchema, EventMediaCoverageSchema, EventMediaKindSchema, EventMediaProductionSchema, EventSourceType, ExportBytesSchema, ExportDenseRangeSchema, ExportDenseSchema, ExportDownloadSchema, ExportOptionsSchema, ExportRecordSchema, ExportSetupFieldSchema, ExportSetupSchema, ExportSpeedSchema, ExportStateSchema, ExportTimelapseSchema, ExposedDeviceSchema, ExposureModeSchema, ExpressionBindingSourceSchema, ExpressionEvalError, ExpressionFieldBindingSchema, ExpressionGlobalBindingSchema, ExpressionLiteralBindingSchema, ExpressionParseError, ExpressionSourceSchema, FIRST_LEVEL_MACRO_CLASSES, FULL_IMAGE_BBOX, FailureContributionSchema, FailureCounters, FailureReasonCountSchema, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, Fmp4BoxSplitter, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, FrameLazyCountersSchema, FrameLazyMetricsSchema, GasStatusSchema, GetLoggingSettingsInputSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, HAP_AUDIO_BASE, HAP_AUDIO_BITRATE_KBPS, HAP_AUDIO_VBV_KBITS, HAP_KEYFRAME_INTERVAL_SEC, HF_BASE_URL, HF_REPO, HWACCEL_OPTIONS, HealthStatusSchema, HfModelResolutionSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, INFERENCE_DEVICE_EXCLUSION_REASONS, ImageContractSchema, ImageContractStateSchema, ImageRotateSchema, ImageSettingsOptionsSchema, ImageSettingsPatchSchema, ImageSettingsStatusSchema, ImageStatusSchema, InferenceDeviceExclusionReasonSchema, IngestOwnerSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, KeyEventSchema, LEGACY_READ_ONLY_CONFIG_KEY, LOAD_CONTRIBUTION_ATTRIBUTIONS, LOAD_CONTRIBUTION_ROLES, LOG_CHANNEL_TICK_MS, LOG_LEVEL_RANK, LabelAttributionSchema, LabelDefinitionSchema, LabelTierSchema, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LedgerWalkDeviceReportSchema, LedgerWalkInputSchema, LedgerWalkRefusalSchema, LedgerWalkReportSchema, LedgerWalkSkipCountsSchema, LedgerWalkSkipReasonSchema, LegacyStorageLocationDefaultSchema, LinkedDeviceSchema, LinkedDevicesModeSchema, LlmDefaultSchema, LlmDefaultSelectorSchema, LlmDownloadProgressSchema, LlmErrorCodeSchema, LlmGenerateBaseInputSchema, LlmGenerateErrSchema, LlmGenerateOkSchema, LlmGenerateResultSchema, LlmImageSchema, LlmNodeModelSchema, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, LlmRetryPolicySchema, LlmRuntimeCompleteInputSchema, LlmRuntimeDiskUsageSchema, LlmRuntimeNodeSchema, LlmRuntimeStatusSchema, LlmTimeoutDefaults, LlmUsageRollupSchema, LlmUsageSchema, LoadContributionSchema, LocateSegmentResultSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogChannelApplyResultSchema, LogChannelDescriptorSchema, LogChannelGate, LogChannelLevelSchema, LogChannelRegistry, LogChannelWindowPatchSchema, LogChannelWindowSchema, LogChannelWindowStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, LoggingEffectiveSchema, LoggingExplicitSchema, LoggingLevelLayerSchema, LoggingLevelSourceSchema, LoggingScopeKindSchema, LoggingSettingsPatchSchema, LoggingSettingsStateSchema, LoginMethodContributionSchema, LoginStageEnum, MACRO_LABELS, MAX_CLIP_EVENT_IDS, MAX_CLIP_LABELS, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, MAX_KEYS, MAX_REASONS_PER_KEY, MAX_SENSOR_TRIGGER_DEVICES, MAX_TRACK_DEBUG_NOTE_LEN, METHOD_ACCESS_MAP, METHOD_DEVICE_SELECTORS, MODEL_FORMATS, MODEL_PROVIDER_IDS, MOTION_TRIGGER_FEATURE, ManagedModelCatalogEntrySchema, ManagedModelExtraFileSchema, ManagedModelRefSchema, ManagedRuntimeConfigSchema, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileInfoSchema, MediaFileKindEnum, MediaFileRefSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MediaRelocateModeSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, MigrateDeviceResultSchema, MigrateSwitchOutcomeSchema, MigrateSwitchReportSchema, ModelCatalogEntrySchema, ModelConvertInputSchema, ModelConvertMetadataSchema, ModelDistributeInputSchema, ModelDistributeResultSchema, ModelExtraFileSchema, ModelFormatEntrySchema, ModelFormatsSchema, ModelProviderIdSchema, ModelSubstitutionSchema, ModelVariantGroupSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, MutationFilterSchema, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SCENE_BUDGET_FIELD, NATIVE_LEASE_SCENE_BUDGET_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, NAVIGATION_ACTION_CATALOG, NAVIGATION_LIGHT_LEVEL_MAX, NAVIGATION_LIGHT_LEVEL_MIN, NC_ALARM_SYSTEM_EVENT_KINDS, NC_AUDIO_CONFIRM_HITS_DEFAULT, NC_AUDIO_CONFIRM_HITS_MAX, NC_AUDIO_CONFIRM_HITS_MIN, NC_AUDIO_CONFIRM_WINDOW_MAX_SEC, NC_AUDIO_CONFIRM_WINDOW_MIN_SEC, NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT, NC_AUDIO_DBFS_FLOOR, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, NC_AUDIO_SEED, NC_AUTHORABLE_SYSTEM_EVENT_KINDS, NC_BASE_CONDITION_KEYS, NC_CONDITION_CATALOG, NC_CONFIRM_DEFAULT_MAX_IMAGE_PX, NC_CONFIRM_DEFAULT_TIMEOUT_MS, NC_CONFIRM_MAX_TIMEOUT_MS, NC_CONFIRM_MIN_TIMEOUT_MS, NC_DEFAULT_SNOOZE_MINUTES, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_OCCUPANCY_DEFAULTS, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_RULE_SECTIONS, NC_SNOOZE_MAX_MINUTES, NC_SYSTEM_DELIVERY, NC_SYSTEM_EVENT_FILTER_KEYS, NC_TAXONOMY, NETWORK_LINK_TYPES, NETWORK_LINK_UNKNOWN, NativeCropBboxSchema, NativeCropRefSchema, NativeCropResultSchema, NativeDetectionSchema, NativeLeaseAdmissionSchema, NativeLeaseSettingsSchema, NativeObjectClassEnum, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionStatusSchema, NavigationActionEntrySchema, NavigationActionIdSchema, NavigationEntryKindSchema, NavigationFeaturesSchema, NavigationLightModeSchema, NavigationModeSchema, NavigationMoveCommandSchema, NavigationPointSchema, NavigationRuntimeStateSchema, NavigationStatusSchema, NcAlarmConfigSchema, NcAlarmModeCoverageSchema, NcAlarmSettingsPatchSchema, NcAlarmSettingsSchema, NcAlarmSkipReasonSchema, NcAlarmSkippedDeviceSchema, NcAudioConditionSchema, NcConditionDescriptorSchema, NcConditionsSchema, NcConfirmExpectSchema, NcConfirmSchema, NcCrossingSchema, NcDeliverySchema, NcDeviceStateConditionSchema, NcHistoryEntrySchema, NcHistoryFilterSchema, NcHistoryRecordKindSchema, NcHistoryStatusSchema, NcHistorySubjectSchema, NcMediaFrameSchema, NcMediaPolicySchema, NcOccupancyConditionSchema, NcPlateMatcherSchema, NcRuleActionSchema, NcRuleActionSequenceSchema, NcRuleActionsSchema, NcRuleInputSchema, NcRuleNotificationButtonSchema, NcRulePatchSchema, NcRuleSchema, NcRuleTargetSchema, NcSceneConditionSchema, NcScheduleSchema, NcScheduleWindowSchema, NcSnoozeInputSchema, NcSnoozeSchema, NcSnoozeScopeSchema, NcSnoozeSuppressedSchema, NcSystemEventConditionSchema, NcSystemEventKindSchema, NcTaxonomyEntrySchema, NcTaxonomySchema, NcTestResultSchema, NcThrottleGranularitySchema, NcThrottleSchema, NcZoneConditionSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NetworkLinkStatusSchema, NotificationActionIconSchema, NotificationActionSchema, NotificationFormatSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OPERATOR_WRITTEN_STALE_MS, OPS_LOG_DEFAULT_LIMIT, OPS_LOG_RING_DEFAULT_MAX, OVERFLOW_REASON, OauthIntegrationDescriptorSchema, ObjectEventSchema, OpsLogDomainSchema, OpsLogEntrySchema, OpsLogOpSchema, OpsLogQueryInputSchema, OpsLogReasonSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdRenderOutcomeEnum, OsdRenderResultSchema, OsdSlotBindingSchema, OsdSlotViewSchema, OsdSourceOptionSchema, OsdSourceSchema, OsdSourceValueTypeEnum, OsdStatusSchema, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PRIVACY_MASK_CAP_NAME, PROVIDER_KIND_CAP_NAMES, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, PasskeyLoginMethodSchema, PasskeySummarySchema, PcmSampleFormatSchema, PerScopeBreakdownSchema, PetFeederStatusSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, PlaceholderReasonSchema, PolygonPointSchema, PoolMemoryWatchdog, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzMoveCommandSchema, PtzOptionsSchema, PtzPositionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, RATE_CONTROL_RELAXED, RATE_CONTROL_TIGHT, REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHABILITY_PROBE_TIMEOUT_MS, RECOGNITION_TYPES, RECORDING_EXPORT_MAX_READ_BYTES, RECORDING_TIMELINE_BATCH_MAX, REDACTED_SECRET, RESERVED_BINDING_NAMES, RESTORED_CAP_NAMES, ROOT_BUCKET_KEY, RUNTIME_DEFAULTS, RUNTIME_STATE_POLICY, RUNTIME_STATE_REFRESH_MISS_COOLDOWN_MS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadGopBytesResultSchema, ReadSegmentBytesResultSchema, ReadWindowBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RecentTracksPageSchema, RecentTracksQueryInput, RecordingAvailabilityForDeviceSchema, RecordingAvailabilitySchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysForDeviceSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingObjectTriggerClassSchema, RecordingRangeSchema, RecordingRebalanceInputSchema, RecordingRebalanceMoveSchema, RecordingRebalancePlanSchema, RecordingRebalanceSkipReasonSchema, RecordingRebalanceSkipSchema, RecordingRetentionSchema, RecordingSignalRuntimeStateSchema, RecordingSignalStatusSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RedirectLoginMethodSchema, RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, RelocateFootageClassSchema, RelocateFootageInputSchema, RelocateJobSchema, RelocateJobStateSchema, RelocateMediaInputSchema, RelocateResidueInputSchema, RelocateResidueSchema, RenderedAsSchema, ReportMotionInputSchema, ReportedFailureContributionSchema, ReportedLoadContributionSchema, RequestCensusGroupSchema, RequestCensusProcedureSchema, RequestCensusSnapshotSchema, RequestCensusStatusSchema, RetrainAnnotationDraftSchema, RetrainAnnotationKindSchema, RetrainAnnotationSchema, RetrainAnnotationSourceSchema, RetrainAssistResultSchema, RetrainAssistSubjectSchema, RetrainCopyRefusalSchema, RetrainFrameCandidateSchema, RetrainFrameListSchema, RetrainFrameSchema, RetrainFrameSelectionSchema, RetrainMacroClassSchema, RetrainStatusSchema, RetrainTrackSchema, RetrainTransitionResultSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerFrameSourceSchema, RunnerInferenceDeviceSchema, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCENE_CONDITIONS, SCENE_CONFIRM_DEFAULT_MAX_IMAGE_PX, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS, SCENE_DEFAULT_ANCHOR_THRESHOLD, SCENE_DEFAULT_CHECK_INTERVAL_SEC, SCENE_DEFAULT_OBSERVATION_SPACING_SEC, SCENE_DEFAULT_QUIET_SECONDS, SCENE_DEFAULT_UNCOVERED_POLICY, SCENE_DIVERGED, SCENE_RESET_RECAPTURES, SCOPE_PRESETS, SENSOR_FEATURES, SENSOR_MAP, SHARE_VIEW_KINDS, SOURCE_CAPS, SOURCE_CAP_ACTIVE_FIELD, SOURCE_CAP_CHANGED_AT_FIELD, SOURCE_DEVICE_TYPES, SOURCE_INFO_METADATA_KEY, STORAGE_ACCESS_FALLBACK, STORAGE_BYTES_PER_GB, STORAGE_LOCATION_MODES, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SUMMARIES_DEFAULT_LIMIT, SUMMARIES_MAX_LIMIT, SYSTEM_CAP_NAMES, SYSTEM_SCOPE_DEVICE_METHODS, SceneCheckSchema, SceneConditionSchema, SceneConfirmSchema, SceneMonitorSchema, SceneMonitorStateSchema, SceneMonitorStatusForDeviceSchema, SceneMonitorStatusSchema, SceneReferenceSchema, SceneUnavailableSchema, SceneUncoveredPolicySchema, SceneVerdictSchema, ScopedTokenSchema, ScopedTokenSummarySchema, ScoredObjectEventSchema, ScriptRunnerStatusSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SendResultSchema, SensorEventSchema, ServerBootModeSchema, ServerPackageStatusSchema, ServerRollbackInfoSchema, ServerUpdateActionResultSchema, ServerUpdateCheckResultSchema, ServerUpdateStateSchema, SetLoggingSettingsInputSchema, SetSiteLocationInputSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, StationaryObjectSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, StorageAccessSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, StorageCleanupInputSchema, StorageCleanupJobSchema, StorageCleanupPhaseSchema, StorageCleanupStatusInputSchema, StorageDrainProgressSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, StorageEvictionPolicySchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationModeSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, StorageMigrationClassSchema, StorageMigrationDestinationsSchema, StorageMigrationDrainInputSchema, StorageMigrationFindingCodeSchema, StorageMigrationFindingSchema, StorageMigrationFootageMoveInputSchema, StorageMigrationInputSchema, StorageMigrationJobSchema, StorageMigrationLaneSchema, StorageMigrationLeaseInputSchema, StorageMigrationMediaMoveInputSchema, StorageMigrationModeSchema, StorageMigrationMoveProgressSchema, StorageMigrationMoveSchema, StorageMigrationMoverSchema, StorageMigrationParticipantSchema, StorageMigrationPhaseSchema, StorageMigrationPlanSchema, StorageMigrationResidueSchema, StorageMigrationSourcesSchema, StorageOccupancyReportSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SummarySchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TAXONOMY_COLORS, TIMELAPSE_DENSE_FLOOR_SEC, TIMEZONES, TRANSCODE_DOWN_MAX_BITRATE_KBPS, TRANSCODE_DOWN_MAX_HEIGHT, TamperStatusSchema, TankStatusSchema, TargetKindCapsSchema, TargetKindLevelSchema, TargetKindSchema, TargetSchema, TemperatureSensorStatusSchema, TerminalInstanceInfoSchema, TerminalLegacyCameraSchema, TerminalOutputBatchSchema, TerminalOutputEventSchema, TerminalProfileInfoSchema, TerminalSessionInfoSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, TestConnectionStatusEnum, TestResultSchema, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackCascadeCountsSchema, TrackEnvelopeSchema, TrackFlagsPatchSchema, TrackFlagsSchema, TrackProjectionSchema, TrackSchema, TrackSourceSchema, TrackStateSchema, TrackZoneFilterSchema, TrackedDetectionSchema, TrainingExportDeviceTotalsSchema, TrainingExportSummarySchema, TransportPlaneCountsSchema, TransportPlaneSchema, TurnServerSchema, UNATTRIBUTED_BUCKET_KEY, UNIT_TABLE, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UnitConversionError, UnstampedEventMediaCountSchema, UnstampedRowsSchema, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VISIT_MERGE_GAP_MS, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VectorDeclareIndexInputSchema, VectorDeleteByFilterInputSchema, VectorDeleteInputSchema, VectorDeleteResultSchema, VectorFilterSchema, VectorGetInputSchema, VectorGetResultSchema, VectorItemSchema, VectorMatchSchema, VectorMetadataSchema, VectorMetricSchema, VectorQueryInputSchema, VectorQueryResultSchema, VectorStatsInputSchema, VectorStatsResultSchema, VectorUpsertInputSchema, VectorUpsertResultSchema, VibrationStatusSchema, VideoEncodeSchema, WEBRTC_EGRESS_PROFILE, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WhiteBalanceModeSchema, WidgetHostEnum, WidgetLoginMethodSchema, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, YAMNET_TO_MACRO, ZoneCrossingDirectionSchema, ZoneCrossingSchema, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, __resetLogChannelRegistryForTests, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, asBoolean, asJsonArray, asJsonObject, asNumber, asString, assertTimelapseCadences, audioAnalysisCapability, audioAnalyzerCapability, audioCodecCapability, audioIsFailClosed, audioKindId, audioLabelChoices, audioMetricsCapability, audioModeOf, audioOrDefaults, audioPlanFromEncodeProfile, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, bareAddonId, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildAudioArgs, buildEventKindDescriptor, buildFfmpegArgs, buildInputArgs, buildModelVariantGroups, buildNcTaxonomy, buildRoleScopes, buildStreamParamsConfigSchema, buildVideoArgs, buttonCapability, cameraCredentialsCapability, cameraPipelineConfigCapability, cameraStreamsCapability, canConvertUnit, canonicalEgressPlan, carbonMonoxideCapability, cellsToRects, classifyBearerPrincipal, classifyStream, classifyStreams, climateControlCapability, clusterModelSettingKey, clusterStepSettingFieldsFor, clusterStepSettingKey, collectHydratedFieldEntries, collectHydratedFieldValues, collectSecretConfigKeys, colorCapability, colorForKind, commitWatchdogRestart, compileExpression, compileExpressionSafe, composeSwitchedOff, conditionDepth, conditionExclusionReason, conditionVisibleForKind, connectionTestCapability, connectivityCapability, consumablesCapability, contactCapability, controlCapability, convertUnit, coreBlockAddonId, coreBlockIdFromAddonId, coreBlocksCapability, cosineSimilarity, countConditionLeaves, coverCapability, createDeviceProxy, createDurableState, createEvent, createEventBusSliceSource, createExpressionScope, createHwAccelCache, createLazyTrpcSource, createLogChannelsProvider, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, customModelRegistryCapability, dataStoreProviderCapability, dayNightCapability, declarationOwnerNodeId, declareLogChannel, decodeVectorBase64, decoderCapability, defaultDeliveryForSection, defaultDeviceFor, defineCustomActions, deriveBatteryPresence, deriveCameraSwitches, deriveDetailCropRect, deriveRecordingMode, describeModelVariant, detectAccessRole, detectionPipelineCapability, deviceAdoptionCapability, deviceBackendToFormat, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceSelectorMatches, deviceStateCapability, deviceStatusCapability, doorbellCapability, droppedConditionsForKind, egressTranscodeSharingKey, egressTransportFromRequest, embeddingEncoderCapability, emitDownForOwnedCaps, emitReadiness, encodeProfileFromStreamShape, encodeVectorBase64, enumSensorCapability, enumerateInferenceDevices, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateAst, evaluateExpressionSource, evaluatePoolMemory, evaluateSensorEdge, evaluateZoneRules, event, eventEmitterCapability, eventsCapability, evictionPolicyForMode, evictionPolicyOfLocation, expandCapMethods, extractNestedAddonId, extractSourceInfoFromMetadata, faceGalleryCapability, failureContributionCapability, failureRate, fanControlCapability, featureProbeCapability, filesystemBrowseCapability, findTimezone, floodCapability, foldSnapshotByFunction, formatForBackend, formatForRuntime, gasCapability, gbToBytes, generateAutomationBlock, getAudioMacroClassIds, getByPath, getCapsByProviderKind, getLogChannelRegistry, getTaxonomyEntry, hasMotionTrigger, hfModelUrl, htmlToText, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, imageSettingsCapability, inferModelProvider, initialPoolMemoryState, integrationsCapability, intercomCapability, invocationFromEncodeProfile, isAgentOnlyPlacement, isArrayOutputSchema, isAudioLabelSelected, isAudioRule, isBaseConditionKey, isBatteryPresenceFault, isClusterScopedStep, isCollectionArrayMethod, isDeployableToAgent, isDetectionMacroClass, isDeviceConfigCap, isDeviceScopedCap, isEvent, isFirstLevelMacroClass, isIsolatedBuiltin, isLocationEnabled, isNode, isObjectInput, isOccupancyRule, isRestoredCap, isSameAddonId, isScheduleActive, isSecretConfigField, isSoftwareDecode, isSourceCap, isStorageLocationMode, isSystemDelivery, isVoidInput, jobKindSchema, kebabToCamel, knownValues, lawnMowerControlCapability, legacyModeOf, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, llmCapability, llmRuntimeCapability, loadContributionCapability, localNetworkCapability, locationSimilarity, lockControlCapability, logBannerArgs, logChannelsCapability, logDestinationCapability, logLevelAtMost, loginMethodCapability, looseSchema, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, markdownToHtmlLite, markdownToText, maskUrlCredentials, mayReadLocation, mayWriteToLocation, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, methodAccessForHttpMethod, metricsProviderCapability, migrateLegacyDeviceSignalConfig, modeMayRead, modeMayWrite, modelConvertCapability, modelDistributorCapability, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, navigationCapability, networkAccessCapability, networkLinkCapability, networkQualityCapability, nodePin, nodesCapability, normalizeAddonInitResult, normalizeAudioLabel, normalizeTokenScopes, normalizeUnit, notificationOutputCapability, notificationRulesCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, objectInputDeclaresAddonId, osdCapability, osdManagerCapability, overlayClusterStepSettings, parseCameraStreamConfig, parseExpression, parseJsonArray, parseJsonObject, parseJsonUnknown, parseProcStatus, parseProfileBrokerId, parseRuleSection, parseStreamParamsFormPatch, patchAudio, petFeederCapability, pickAccessoryControl, pickClusterStepModels, pickClusterStepSettings, pickDetailCropConvention, pickNativeLeaseOverride, pickPreferredRtspEntry, pickRestartCandidate, pickVideoEncoder, pickerForCondition, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, plateGalleryCapability, platformProbeCapability, poolMemoryThreshold, powerMeterCapability, prepareNotification, presenceCapability, pressureSensorCapability, principalMayReachAddon, privacyMaskCapability, procedureAuthKey, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, readClusterStepModels, readClusterStepSettings, readDetailCropConvention, readDeviceStateFrom, readNativeLeaseOverride, readNodePin, readTimelapseGeneratedAt, readinessKey, rebootCapability, recordingCapability, recordingExportCapability, recordingSignalCapability, rectsToCells, reducePoints, requiresPython, resetPoolBaseline, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveAddonRuntime, resolveBucketMs, resolveCapMount, resolveClusterStepModelId, resolveContainerPrimaryChild, resolveDetectionRuntime, resolveDeviceControlKind, resolveDeviceProfile, resolveEgressDecodeHwAccel, resolveFormat, resolveHydratedFieldValue, resolveLocationMode, resolveMethodAuth, resolveModelFormat, resolveMutate, resolvePoolMemoryPolicy, resolveRecordingProfiles, resolveRunnerId, resolveVariantModelId, resolveViewableDeviceIds, roleSpec, ruleEditorSectionsForKind, ruleKindOf, ruleKindSpec, ruleMatchesSection, ruleSection, ruleSectionOf, ruleSeedForSection, runInferenceStep, runtimeDevices, runtimeStatePolicyFor, sceneMonitorCapability, schemaDeclaresAnyField, scopeInherits, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, scoreRuntimes, scriptRunnerCapability, selectAssignedProfileSlots, serverManagementCapability, setByPath, settingsStoreCapability, signalPercentFromBars, signalPercentFromRssi, sleep, sleepCancellable, sliceActiveValue, sliceChangedAt, smokeCapability, smtpProviderCapability, snapshotCapability, ssoBridgeCapability, startReachabilityPoll, stateVocabularyFor, storageCapability, storageEvictableCapability, storageMigrationCapability, storageOccupancyCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, stripRetiredBandPreBufferSec, strippedOfLegacyReadOnly, subKindsOf, summarisePrivacyAudio, summarizeEffectiveScope, supportedRuntimes, switchCapability, switchedOffIds, synthesizeSourceInfo, systemCapability, systemEventFilterApplies, systemEventFilterAppliesToAnyKind, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, terminalSessionCapability, textToHtml, toDeviceSummary, toExpressionValue, toNodeId, toStreamSourceEntry, toastCapability, toggleAudioLabel, tokenize, transcodeBody, tryConvertUnit, turnProviderCapability, unitDimension, unitsForDimension, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, validateExpressionSource, validateRecipeBounds, valveCapability, vectorDimFromBase64, vectorStoreCapability, vibrationCapability, videoclipsCapability, viewerUiCapability, waterHeaterCapability, weatherCapability, webrtcClientHintsSchema, webrtcSessionCapability, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, withLocationMode, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };