@camstack/types 1.2.114 → 1.2.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +2 -1
- package/dist/addon.mjs +2 -1
- package/dist/capabilities/data-store-provider.cap.d.ts +34 -0
- package/dist/capabilities/device-manager.cap.d.ts +99 -0
- package/dist/capabilities/index.d.ts +6 -3
- package/dist/capabilities/log-channels.cap.d.ts +93 -0
- package/dist/capabilities/settings-store.cap.d.ts +81 -1
- package/dist/capabilities/system.cap.d.ts +109 -5
- package/dist/generated/addon-api.d.ts +44 -0
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/collection-array-methods.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +2 -2
- package/dist/generated/system-proxy.d.ts +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +717 -6
- package/dist/index.mjs +703 -7
- package/dist/interfaces/logging.d.ts +15 -0
- package/dist/interfaces/storage.d.ts +26 -0
- package/dist/logging/log-channel-provider.d.ts +62 -0
- package/dist/logging/log-channel.d.ts +194 -0
- package/dist/logging/log-channel.singleton.d.ts +33 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1368,6 +1368,378 @@ function logLevelAtMost(level, threshold) {
|
|
|
1368
1368
|
return LOG_LEVEL_RANK[level] <= LOG_LEVEL_RANK[threshold];
|
|
1369
1369
|
}
|
|
1370
1370
|
//#endregion
|
|
1371
|
+
//#region src/logging/log-channel.ts
|
|
1372
|
+
/**
|
|
1373
|
+
* Per-component log CHANNELS — the gate a hot path consults, and the registry
|
|
1374
|
+
* an addon declares its channels in.
|
|
1375
|
+
*
|
|
1376
|
+
* ## Two axes, deliberately separated
|
|
1377
|
+
*
|
|
1378
|
+
* - **DECLARATION** — which channels exist. Only the addon knows:
|
|
1379
|
+
* `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
|
|
1380
|
+
* baichuan/handshake. A hand-wired central list rots at the first addition,
|
|
1381
|
+
* and rots silently. So a channel is declared where it is consulted, and the
|
|
1382
|
+
* `log-channels` capability enumerates the declarations.
|
|
1383
|
+
* - **VALUE** — at which level, for which scope, until when. That stays ONE
|
|
1384
|
+
* thing: the logging settings document on the `system` cap. Two authorities
|
|
1385
|
+
* over the values is the exact defect
|
|
1386
|
+
* `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
|
|
1387
|
+
* remove; re-introducing it from the cure side would be grotesque.
|
|
1388
|
+
*
|
|
1389
|
+
* Nothing in this file reads a clock, an env var or a store. The registry is
|
|
1390
|
+
* a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
|
|
1391
|
+
* the hot path with a value somebody actually read, and by
|
|
1392
|
+
* {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
|
|
1393
|
+
* never reaches here, so it can neither disarm an armed channel nor arm a
|
|
1394
|
+
* disarmed one (D49).
|
|
1395
|
+
*
|
|
1396
|
+
* ## The canonical call shape
|
|
1397
|
+
*
|
|
1398
|
+
* ```ts
|
|
1399
|
+
* if (CH_RTP.on && CH_RTP.wants(deviceId)) {
|
|
1400
|
+
* CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
|
|
1401
|
+
* }
|
|
1402
|
+
* ```
|
|
1403
|
+
*
|
|
1404
|
+
* `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
|
|
1405
|
+
* read. Disarmed, a call site costs one load and one branch, and the `extras`
|
|
1406
|
+
* object literal is never constructed because it lives inside the branch. It
|
|
1407
|
+
* is the same shape already proven in production at `stream-broker.ts:1650`,
|
|
1408
|
+
* and the same discipline `LoggingGate.allowsDestination` uses for the
|
|
1409
|
+
* destination floor (measured at 1.93 ns/call when off).
|
|
1410
|
+
*
|
|
1411
|
+
* ## Why a channel emits at `info`
|
|
1412
|
+
*
|
|
1413
|
+
* `loki-logging.addon.ts` pins the destination default at `info` and
|
|
1414
|
+
* `loki-destination.ts` drops everything below it, so a line emitted at
|
|
1415
|
+
* `debug` never reaches Loki and the hub's in-memory ring only holds ~35
|
|
1416
|
+
* minutes. A diagnostic that cannot be read an hour later is worse than no
|
|
1417
|
+
* diagnostic, because it looks done. {@link LogChannelGate.log} therefore
|
|
1418
|
+
* emits at the channel's declared level, whose schema floor is `info`.
|
|
1419
|
+
*/
|
|
1420
|
+
/**
|
|
1421
|
+
* The level a channel writes at once armed.
|
|
1422
|
+
*
|
|
1423
|
+
* `debug` is absent ON PURPOSE and not by omission: below `info` the line does
|
|
1424
|
+
* not leave the process for Loki, and the whole point of arming a channel is
|
|
1425
|
+
* to read it later.
|
|
1426
|
+
*/
|
|
1427
|
+
var LogChannelLevelSchema = zod.z.enum([
|
|
1428
|
+
"info",
|
|
1429
|
+
"warn",
|
|
1430
|
+
"error"
|
|
1431
|
+
]);
|
|
1432
|
+
/**
|
|
1433
|
+
* What an addon declares about one channel. No value, no state — a
|
|
1434
|
+
* declaration is inert.
|
|
1435
|
+
*/
|
|
1436
|
+
var LogChannelDescriptorSchema = zod.z.object({
|
|
1437
|
+
/**
|
|
1438
|
+
* Dotted `area.thing`, unique across the workspace. `area` is conventionally
|
|
1439
|
+
* the addon's short name so an operator reading a channel list can tell who
|
|
1440
|
+
* owns it without a second lookup.
|
|
1441
|
+
*/
|
|
1442
|
+
name: zod.z.string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
|
|
1443
|
+
/** One sentence: what the operator will SEE after arming it. */
|
|
1444
|
+
description: zod.z.string().min(1),
|
|
1445
|
+
/** The level its lines are emitted at. Never below `info`. */
|
|
1446
|
+
defaultLevel: LogChannelLevelSchema,
|
|
1447
|
+
/**
|
|
1448
|
+
* Whether this channel can be narrowed to a camera.
|
|
1449
|
+
*
|
|
1450
|
+
* `true` is a PROMISE with two halves, and both must hold: the gate is
|
|
1451
|
+
* consulted with the numeric device id, AND every line the channel admits
|
|
1452
|
+
* carries `tags: { deviceId }` with that same numeric id. The second half is
|
|
1453
|
+
* what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
|
|
1454
|
+
* keeps `deviceId` out of the stream labels for cardinality, so the tag in
|
|
1455
|
+
* the body is the only way to filter.
|
|
1456
|
+
*
|
|
1457
|
+
* A channel whose lines carry the device only in `meta` (or not at all) is
|
|
1458
|
+
* declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
|
|
1459
|
+
* the operator narrows to one camera, sees nothing, and concludes the code
|
|
1460
|
+
* path was never taken.
|
|
1461
|
+
*/
|
|
1462
|
+
perDevice: zod.z.boolean()
|
|
1463
|
+
});
|
|
1464
|
+
/**
|
|
1465
|
+
* An armed window over one channel, as the document hands it to a mirror.
|
|
1466
|
+
*
|
|
1467
|
+
* A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
|
|
1468
|
+
* expires by itself, which is the one failure a boolean cannot avoid.
|
|
1469
|
+
*/
|
|
1470
|
+
var LogChannelWindowSchema = zod.z.object({
|
|
1471
|
+
channel: zod.z.string().min(1),
|
|
1472
|
+
/** Epoch ms the window closes at. */
|
|
1473
|
+
armedUntilMs: zod.z.number(),
|
|
1474
|
+
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
1475
|
+
deviceIds: zod.z.array(zod.z.number().int()).readonly().nullable()
|
|
1476
|
+
});
|
|
1477
|
+
/**
|
|
1478
|
+
* The gate a hot path holds.
|
|
1479
|
+
*
|
|
1480
|
+
* Obtain it ONCE — at module scope or in a constructor — and keep the
|
|
1481
|
+
* reference. Looking a channel up by name per line would put a Map lookup on
|
|
1482
|
+
* the path this class exists to keep free.
|
|
1483
|
+
*/
|
|
1484
|
+
var LogChannelGate = class {
|
|
1485
|
+
descriptor;
|
|
1486
|
+
/**
|
|
1487
|
+
* HOT PATH GUARD. A plain data FIELD, and it must stay one.
|
|
1488
|
+
*
|
|
1489
|
+
* `log-channel.spec.ts` asserts the property descriptor has no getter and
|
|
1490
|
+
* booby-traps the device set, so turning this into an accessor — or reading
|
|
1491
|
+
* anything before it — fails the spec instead of taxing every line the
|
|
1492
|
+
* process emits.
|
|
1493
|
+
*/
|
|
1494
|
+
on = false;
|
|
1495
|
+
/** `null` while armed for every camera. Never read while `on` is false. */
|
|
1496
|
+
devices = null;
|
|
1497
|
+
level;
|
|
1498
|
+
closesAtMs = 0;
|
|
1499
|
+
constructor(descriptor) {
|
|
1500
|
+
this.descriptor = descriptor;
|
|
1501
|
+
this.level = descriptor.defaultLevel;
|
|
1502
|
+
}
|
|
1503
|
+
/** Epoch ms this channel disarms itself at. 0 when disarmed. */
|
|
1504
|
+
get armedUntilMs() {
|
|
1505
|
+
return this.on ? this.closesAtMs : 0;
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* Does this channel want a line about `deviceId`?
|
|
1509
|
+
*
|
|
1510
|
+
* Call it only behind `gate.on &&`. On its own it is still correct — the
|
|
1511
|
+
* guard is repeated inside — but the point of the prefix is that a disarmed
|
|
1512
|
+
* channel must not pay the call at all.
|
|
1513
|
+
*/
|
|
1514
|
+
wants(deviceId) {
|
|
1515
|
+
if (!this.on) return false;
|
|
1516
|
+
return this.devices === null || this.devices.has(deviceId);
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Emit one line on this channel, at the channel's declared level.
|
|
1520
|
+
*
|
|
1521
|
+
* The channel name is added as `tags.logChannel` so LogQL can select the
|
|
1522
|
+
* channel without matching on the message text, and whatever `tags` the
|
|
1523
|
+
* caller passed — `deviceId` above all — is preserved.
|
|
1524
|
+
*/
|
|
1525
|
+
log(logger, message, extras) {
|
|
1526
|
+
if (!this.on) return;
|
|
1527
|
+
const tags = {
|
|
1528
|
+
...extras.tags,
|
|
1529
|
+
logChannel: this.descriptor.name
|
|
1530
|
+
};
|
|
1531
|
+
const line = {
|
|
1532
|
+
...extras,
|
|
1533
|
+
tags
|
|
1534
|
+
};
|
|
1535
|
+
if (this.level === "error") logger.error(message, line);
|
|
1536
|
+
else if (this.level === "warn") logger.warn(message, line);
|
|
1537
|
+
else logger.info(message, line);
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Arm (or RE-arm, restarting) this channel. Off the hot path only.
|
|
1541
|
+
*
|
|
1542
|
+
* An empty `deviceIds` list is treated as "every camera" rather than "no
|
|
1543
|
+
* camera": a window that matches nothing is indistinguishable from a
|
|
1544
|
+
* disarmed one, and the operator who asked for it would wait for lines that
|
|
1545
|
+
* can never come.
|
|
1546
|
+
*/
|
|
1547
|
+
arm(window) {
|
|
1548
|
+
const ids = window.deviceIds;
|
|
1549
|
+
this.devices = ids === null || ids.length === 0 ? null : new Set(ids);
|
|
1550
|
+
this.closesAtMs = window.armedUntilMs;
|
|
1551
|
+
this.on = true;
|
|
1552
|
+
}
|
|
1553
|
+
/** Disarm. Off the hot path only. */
|
|
1554
|
+
disarm() {
|
|
1555
|
+
this.on = false;
|
|
1556
|
+
this.devices = null;
|
|
1557
|
+
this.closesAtMs = 0;
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
/**
|
|
1561
|
+
* Every channel this PROCESS declares, and the mirror of what is armed on it.
|
|
1562
|
+
*
|
|
1563
|
+
* One per process. A forked runner has its own, and it is refreshed through
|
|
1564
|
+
* the `log-channels` capability by the hub that owns the document — the
|
|
1565
|
+
* registry never reaches for a value itself.
|
|
1566
|
+
*/
|
|
1567
|
+
var LogChannelRegistry = class {
|
|
1568
|
+
gates = /* @__PURE__ */ new Map();
|
|
1569
|
+
/**
|
|
1570
|
+
* Declare a channel and get its gate.
|
|
1571
|
+
*
|
|
1572
|
+
* A duplicate name throws. Two declarations of one name is a programming
|
|
1573
|
+
* error, not a merge: the operator would arm one and the other would stay
|
|
1574
|
+
* dark, which is the dead-knob shape (D62) with an extra step.
|
|
1575
|
+
*/
|
|
1576
|
+
declare(descriptor) {
|
|
1577
|
+
const parsed = LogChannelDescriptorSchema.parse(descriptor);
|
|
1578
|
+
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`);
|
|
1579
|
+
const gate = new LogChannelGate(parsed);
|
|
1580
|
+
this.gates.set(parsed.name, gate);
|
|
1581
|
+
return gate;
|
|
1582
|
+
}
|
|
1583
|
+
/** The declarations, sorted by name so a list is stable to read and diff. */
|
|
1584
|
+
list() {
|
|
1585
|
+
return [...this.gates.values()].map((gate) => gate.descriptor).sort((a, b) => a.name.localeCompare(b.name));
|
|
1586
|
+
}
|
|
1587
|
+
/** The gate for a declared channel, or `undefined`. */
|
|
1588
|
+
gate(name) {
|
|
1589
|
+
return this.gates.get(name);
|
|
1590
|
+
}
|
|
1591
|
+
/**
|
|
1592
|
+
* Apply the FULL set of armed windows. Off the hot path.
|
|
1593
|
+
*
|
|
1594
|
+
* Full, not incremental, and that is the whole design: the document is the
|
|
1595
|
+
* authority, so a channel the document does not name is disarmed here. An
|
|
1596
|
+
* incremental apply would let a disarm get lost in transit and leave a
|
|
1597
|
+
* channel running that nobody can see is running.
|
|
1598
|
+
*
|
|
1599
|
+
* A window already past its deadline is ignored rather than armed — a
|
|
1600
|
+
* restore that re-armed an expired window would make a forgotten diagnostic
|
|
1601
|
+
* immortal across restarts.
|
|
1602
|
+
*
|
|
1603
|
+
* Returns the names it could not place, so the caller can log them: a
|
|
1604
|
+
* channel named in the document that this process does not declare is
|
|
1605
|
+
* either a typo or an addon that has not booted yet, and both deserve a
|
|
1606
|
+
* line rather than silence.
|
|
1607
|
+
*/
|
|
1608
|
+
apply(windows, nowMs) {
|
|
1609
|
+
const wanted = /* @__PURE__ */ new Map();
|
|
1610
|
+
const unknown = [];
|
|
1611
|
+
for (const window of windows) {
|
|
1612
|
+
if (window.armedUntilMs <= nowMs) continue;
|
|
1613
|
+
if (!this.gates.has(window.channel)) {
|
|
1614
|
+
unknown.push(window.channel);
|
|
1615
|
+
continue;
|
|
1616
|
+
}
|
|
1617
|
+
wanted.set(window.channel, window);
|
|
1618
|
+
}
|
|
1619
|
+
for (const [name, gate] of this.gates) {
|
|
1620
|
+
const window = wanted.get(name);
|
|
1621
|
+
if (window === void 0) gate.disarm();
|
|
1622
|
+
else gate.arm(window);
|
|
1623
|
+
}
|
|
1624
|
+
return unknown;
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Disarm whatever has run out. Called on a timer, NEVER from a log path — a
|
|
1628
|
+
* diagnostic that adds a `Date.now()` to the path it is measuring measures
|
|
1629
|
+
* itself.
|
|
1630
|
+
*
|
|
1631
|
+
* Returns the names it closed, so the caller can write the one line that
|
|
1632
|
+
* says a window ended and stops "it went quiet" from reading as "the branch
|
|
1633
|
+
* was not taken".
|
|
1634
|
+
*/
|
|
1635
|
+
tick(nowMs) {
|
|
1636
|
+
const closed = [];
|
|
1637
|
+
for (const [name, gate] of this.gates) if (gate.on && gate.armedUntilMs <= nowMs) {
|
|
1638
|
+
gate.disarm();
|
|
1639
|
+
closed.push(name);
|
|
1640
|
+
}
|
|
1641
|
+
return closed;
|
|
1642
|
+
}
|
|
1643
|
+
/** The channels armed right now, as the document would describe them. */
|
|
1644
|
+
armed() {
|
|
1645
|
+
const out = [];
|
|
1646
|
+
for (const [name, gate] of this.gates) if (gate.on) out.push({
|
|
1647
|
+
channel: name,
|
|
1648
|
+
armedUntilMs: gate.armedUntilMs,
|
|
1649
|
+
deviceIds: null
|
|
1650
|
+
});
|
|
1651
|
+
return out;
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
//#endregion
|
|
1655
|
+
//#region src/logging/log-channel.singleton.ts
|
|
1656
|
+
/**
|
|
1657
|
+
* Process-wide holder for the {@link LogChannelRegistry}.
|
|
1658
|
+
*
|
|
1659
|
+
* Three call sites that never meet need the SAME instance: the hot paths that
|
|
1660
|
+
* declare a gate at module scope, the `log-channels` provider that enumerates
|
|
1661
|
+
* the declarations for the hub, and the same provider applying the windows the
|
|
1662
|
+
* document hands down. A registry built inside any one of them would be
|
|
1663
|
+
* refreshed and collected — the shape of a knob that never does anything.
|
|
1664
|
+
*
|
|
1665
|
+
* Same idiom as `logging-gate.singleton.ts` and
|
|
1666
|
+
* `http-request-census.singleton.ts`.
|
|
1667
|
+
*/
|
|
1668
|
+
var instance = null;
|
|
1669
|
+
/** The process-wide log channel registry. Created empty on first use. */
|
|
1670
|
+
function getLogChannelRegistry() {
|
|
1671
|
+
instance ??= new LogChannelRegistry();
|
|
1672
|
+
return instance;
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Declare a channel on the process-wide registry and get its gate.
|
|
1676
|
+
*
|
|
1677
|
+
* The one call an addon makes. Keep the returned gate in a module-scope
|
|
1678
|
+
* `const`: looking a channel up by name per line would put a Map lookup on
|
|
1679
|
+
* exactly the path this mechanism exists to keep free.
|
|
1680
|
+
*
|
|
1681
|
+
* `scripts/check-log-channel-gated.ts` reads these call sites. It pairs the
|
|
1682
|
+
* declared name with the binding it is assigned to and refuses to let a
|
|
1683
|
+
* channel ship that no `<binding>.on` anywhere consults — a declared channel
|
|
1684
|
+
* nobody reads is a knob the operator turns with nothing happening, forever,
|
|
1685
|
+
* and without a line. That is D62, and this repo has now shipped it three
|
|
1686
|
+
* times (`audioThresholdDbfs`, the HA entities with no source, the second
|
|
1687
|
+
* per-camera switch that wrote a store nobody read).
|
|
1688
|
+
*/
|
|
1689
|
+
function declareLogChannel(descriptor) {
|
|
1690
|
+
return getLogChannelRegistry().declare(descriptor);
|
|
1691
|
+
}
|
|
1692
|
+
/** Test-only: drop the instance so a spec starts from an empty registry. */
|
|
1693
|
+
function __resetLogChannelRegistryForTests() {
|
|
1694
|
+
instance = null;
|
|
1695
|
+
}
|
|
1696
|
+
//#endregion
|
|
1697
|
+
//#region src/logging/log-channel-provider.ts
|
|
1698
|
+
/**
|
|
1699
|
+
* How often expiry is noticed. Coarse on purpose: the cost of a channel
|
|
1700
|
+
* running a few seconds past its deadline is a few extra lines, and the cost
|
|
1701
|
+
* of a tight timer in every addon process is paid forever.
|
|
1702
|
+
*/
|
|
1703
|
+
var LOG_CHANNEL_TICK_MS = 5e3;
|
|
1704
|
+
/**
|
|
1705
|
+
* Build the `log-channels` provider for this process.
|
|
1706
|
+
*
|
|
1707
|
+
* `logger` is used ONLY off the hot path — for the arm/expiry lines — so a
|
|
1708
|
+
* channel that is never armed costs this module nothing but a timer.
|
|
1709
|
+
*/
|
|
1710
|
+
function createLogChannelsProvider(logger, options = {}) {
|
|
1711
|
+
const registry = getLogChannelRegistry();
|
|
1712
|
+
const now = options.now ?? Date.now;
|
|
1713
|
+
const tickMs = options.tickMs ?? 5e3;
|
|
1714
|
+
const timer = setInterval(() => {
|
|
1715
|
+
const closed = registry.tick(now());
|
|
1716
|
+
for (const name of closed) logger.info("log channel window closed", {
|
|
1717
|
+
tags: { logChannel: name },
|
|
1718
|
+
meta: { channel: name }
|
|
1719
|
+
});
|
|
1720
|
+
}, tickMs);
|
|
1721
|
+
timer.unref?.();
|
|
1722
|
+
return {
|
|
1723
|
+
list: () => registry.list(),
|
|
1724
|
+
apply: (input) => {
|
|
1725
|
+
const unknown = registry.apply(input.windows, now());
|
|
1726
|
+
const armed = registry.armed();
|
|
1727
|
+
logger.info("log channels applied", { meta: {
|
|
1728
|
+
armed: armed.map((window) => window.channel),
|
|
1729
|
+
unknown,
|
|
1730
|
+
declared: registry.list().length
|
|
1731
|
+
} });
|
|
1732
|
+
return {
|
|
1733
|
+
armed: armed.length,
|
|
1734
|
+
unknown
|
|
1735
|
+
};
|
|
1736
|
+
},
|
|
1737
|
+
stop: () => {
|
|
1738
|
+
clearInterval(timer);
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
//#endregion
|
|
1371
1743
|
//#region src/interfaces/ops-log.ts
|
|
1372
1744
|
/**
|
|
1373
1745
|
* Ops-log — the durable, append-only operations audit shared by the
|
|
@@ -7312,6 +7684,35 @@ var MutationFilterSchema = zod.z.object({
|
|
|
7312
7684
|
whereBetween: zod.z.record(zod.z.string(), zod.z.tuple([zod.z.unknown(), zod.z.unknown()])).optional(),
|
|
7313
7685
|
whereNot: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
7314
7686
|
});
|
|
7687
|
+
/**
|
|
7688
|
+
* One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
|
|
7689
|
+
*
|
|
7690
|
+
* `as` names the slot in the result, so the SAME column may be asked twice with
|
|
7691
|
+
* two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
|
|
7692
|
+
* a `Record<column, op>` shape could not express.
|
|
7693
|
+
*/
|
|
7694
|
+
var AggregateFieldSchema = zod.z.object({
|
|
7695
|
+
/** Result key. */
|
|
7696
|
+
as: zod.z.string().min(1),
|
|
7697
|
+
/** Column to aggregate. Must be a real column of a declared collection. */
|
|
7698
|
+
field: zod.z.string().min(1),
|
|
7699
|
+
op: zod.z.enum([
|
|
7700
|
+
"sum",
|
|
7701
|
+
"min",
|
|
7702
|
+
"max"
|
|
7703
|
+
])
|
|
7704
|
+
});
|
|
7705
|
+
/**
|
|
7706
|
+
* `COUNT(*)` plus one number per requested field.
|
|
7707
|
+
*
|
|
7708
|
+
* `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
|
|
7709
|
+
* that really is 0 are different facts, and an accounting caller that renders
|
|
7710
|
+
* "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
|
|
7711
|
+
*/
|
|
7712
|
+
var AggregateResultSchema = zod.z.object({
|
|
7713
|
+
count: zod.z.number().int(),
|
|
7714
|
+
values: zod.z.record(zod.z.string(), zod.z.number().nullable())
|
|
7715
|
+
});
|
|
7315
7716
|
/** A single stored record: `{ id, data }`. */
|
|
7316
7717
|
var SettingsRecordSchema = zod.z.object({
|
|
7317
7718
|
id: zod.z.string(),
|
|
@@ -7479,6 +7880,32 @@ var settingsStoreCapability = {
|
|
|
7479
7880
|
collection: zod.z.string(),
|
|
7480
7881
|
filter: QueryFilterSchema.optional()
|
|
7481
7882
|
}), zod.z.number()),
|
|
7883
|
+
/**
|
|
7884
|
+
* `COUNT(*)` and one `SUM` / `MIN` / `MAX` per requested field, in ONE
|
|
7885
|
+
* statement, over the rows `filter` selects.
|
|
7886
|
+
*
|
|
7887
|
+
* Exists because "how much is there" was being answered by materialising
|
|
7888
|
+
* "what is there". The recorder's storage-pressure sweep asked its in-RAM
|
|
7889
|
+
* footage index for bytes/count/oldest/newest across a set of storage
|
|
7890
|
+
* locations twice a minute, and the only way to answer that from a map is
|
|
7891
|
+
* to visit every row — 7.1 M of them on the live hub, ~15 M row visits a
|
|
7892
|
+
* minute on the main thread, which is also why the whole archive had to
|
|
7893
|
+
* stay resident to be visited. The question is a sum; nothing needs to be
|
|
7894
|
+
* materialised to answer it.
|
|
7895
|
+
*
|
|
7896
|
+
* **The engine REFUSES a field it cannot serve**, exactly as
|
|
7897
|
+
* `query.columns` does and unlike a PREDICATE, which is skipped when
|
|
7898
|
+
* unresolvable. A dropped predicate over-matches and the caller sees extra
|
|
7899
|
+
* rows; a dropped aggregate returns a NUMBER that is wrong and looks
|
|
7900
|
+
* exactly like a real one. That asymmetry is what this repo has already
|
|
7901
|
+
* paid for once in `count`.
|
|
7902
|
+
*/
|
|
7903
|
+
aggregate: require_sleep.method(zod.z.object({
|
|
7904
|
+
namespace: zod.z.string().optional(),
|
|
7905
|
+
collection: zod.z.string(),
|
|
7906
|
+
fields: zod.z.array(AggregateFieldSchema).readonly(),
|
|
7907
|
+
filter: QueryFilterSchema.optional()
|
|
7908
|
+
}), AggregateResultSchema),
|
|
7482
7909
|
/** Grouped counts per ((field-origin)/bucketSize) bucket, filtered. */
|
|
7483
7910
|
histogram: require_sleep.method(zod.z.object({
|
|
7484
7911
|
namespace: zod.z.string().optional(),
|
|
@@ -7687,6 +8114,15 @@ var dataStoreProviderCapability = {
|
|
|
7687
8114
|
collection: zod.z.string(),
|
|
7688
8115
|
filter: QueryFilterSchema.optional()
|
|
7689
8116
|
}), zod.z.number(), { auth: "admin" }),
|
|
8117
|
+
/** `COUNT(*)` plus one SUM/MIN/MAX per field, in one statement. Mirror of
|
|
8118
|
+
* `settings-store.aggregate` — see it for why an unresolvable field is
|
|
8119
|
+
* refused rather than dropped. */
|
|
8120
|
+
aggregate: require_sleep.method(zod.z.object({
|
|
8121
|
+
namespace: zod.z.string().optional(),
|
|
8122
|
+
collection: zod.z.string(),
|
|
8123
|
+
fields: zod.z.array(AggregateFieldSchema).readonly(),
|
|
8124
|
+
filter: QueryFilterSchema.optional()
|
|
8125
|
+
}), AggregateResultSchema, { auth: "admin" }),
|
|
7690
8126
|
/** Grouped counts per ((field-origin)/bucketSize) bucket, filtered. */
|
|
7691
8127
|
histogram: require_sleep.method(zod.z.object({
|
|
7692
8128
|
namespace: zod.z.string().optional(),
|
|
@@ -8663,6 +9099,28 @@ var deviceProviderCapability = {
|
|
|
8663
9099
|
* Forked workers register devices back to the hub via `ctx.devices`
|
|
8664
9100
|
* (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
|
|
8665
9101
|
*/
|
|
9102
|
+
/**
|
|
9103
|
+
* Most parents one `getChildrenBatch` may name.
|
|
9104
|
+
*
|
|
9105
|
+
* Every parent in the set becomes one bound `?` in the `parentDeviceId IN (…)`
|
|
9106
|
+
* the store compiles ({@link DeviceRowStore.listByParentMany} →
|
|
9107
|
+
* `filter-compiler.ts`), so the set size IS the SQL variable count. Two bounds
|
|
9108
|
+
* meet here and 256 clears both:
|
|
9109
|
+
*
|
|
9110
|
+
* - `SQLITE_MAX_VARIABLE_NUMBER` is 32 766 on SQLite ≥ 3.32 but **999** on
|
|
9111
|
+
* anything older, and better-sqlite3 links whatever amalgamation it was
|
|
9112
|
+
* built against on the host. A fleet-sized set (1 017 parents today) sits
|
|
9113
|
+
* ON that older limit; 256 stays a factor of four below it, so the batch
|
|
9114
|
+
* can never turn a boot into `too many SQL variables` on a host nobody
|
|
9115
|
+
* checked the build of.
|
|
9116
|
+
* - One call's answer is the children of those parents, and the answer
|
|
9117
|
+
* crosses a process boundary. Capping the ask caps the message.
|
|
9118
|
+
*
|
|
9119
|
+
* A caller with more parents sends ⌈n/256⌉ calls — four for today's fleet,
|
|
9120
|
+
* against 1 024 today. The cap is on the SCHEMA, not only on the caller: an
|
|
9121
|
+
* over-eager caller is refused, not silently truncated to a wrong answer.
|
|
9122
|
+
*/
|
|
9123
|
+
var DEVICE_CHILDREN_BATCH_MAX = 256;
|
|
8666
9124
|
/** One child-placement directive on a container's `childLayout`. Structurally
|
|
8667
9125
|
* identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
|
|
8668
9126
|
* shape for the same field. The child is identified by its re-sync-stable
|
|
@@ -9174,6 +9632,39 @@ var deviceManagerCapability = {
|
|
|
9174
9632
|
/** List children of a parent device (by parent numeric id). */
|
|
9175
9633
|
getChildren: require_sleep.method(zod.z.object({ parentDeviceId: zod.z.number() }), zod.z.array(DeviceInfoSchema)),
|
|
9176
9634
|
/**
|
|
9635
|
+
* `getChildren` for a NAMED SET of parents, in one call.
|
|
9636
|
+
*
|
|
9637
|
+
* The accessory reconcile in `device-cap-proxy.ts` asks this question once
|
|
9638
|
+
* per registered device — every `BaseDevice` inherits a
|
|
9639
|
+
* `getAccessoryChildren()` that returns `[]`, so even a leaf accessory
|
|
9640
|
+
* pays a round-trip to learn it has nothing to prune. Measured on the live
|
|
9641
|
+
* hub 2026-08-27 over a 120-second boot window, fleet of 1 017 devices:
|
|
9642
|
+
* `DeviceRowStore.list < DeviceRowStore.listByParent < getChildren` at
|
|
9643
|
+
* **1 024 calls** returning **919 rows in total** — 1 024 RPCs and 1 024
|
|
9644
|
+
* indexed scans to move less than one row each. `listByParentMany`
|
|
9645
|
+
* collapses the scans; this collapses the RPCs.
|
|
9646
|
+
*
|
|
9647
|
+
* Keyed by parent id as a STRING — a JSON object cannot key by number
|
|
9648
|
+
* (same reason as `getDeviceStatusAggregateBatch`). The per-parent value
|
|
9649
|
+
* is exactly what `getChildren` returns for that parent.
|
|
9650
|
+
*
|
|
9651
|
+
* A parent with no children — or one the fleet does not know — is ABSENT
|
|
9652
|
+
* from the record, never an invented empty row: the same contract as
|
|
9653
|
+
* `DeviceRowStore.getMany`/`listByParentMany`. An EMPTY `parentDeviceIds`
|
|
9654
|
+
* reads nothing at all rather than degrading to "every device".
|
|
9655
|
+
*
|
|
9656
|
+
* `parentDeviceIds` is capped at {@link DEVICE_CHILDREN_BATCH_MAX} — see
|
|
9657
|
+
* that constant for why. A caller with more parents than that sends more
|
|
9658
|
+
* than one call; it never sends one pathological one.
|
|
9659
|
+
*
|
|
9660
|
+
* Version skew: this is a NEW method, not a new field on `getChildren`, so
|
|
9661
|
+
* a hub that predates it answers NOT_FOUND rather than silently stripping
|
|
9662
|
+
* an unknown input key and answering a DIFFERENT question. The kernel-side
|
|
9663
|
+
* loader degrades to per-parent `getChildren` on that error — see
|
|
9664
|
+
* `children-batch-loader.ts`.
|
|
9665
|
+
*/
|
|
9666
|
+
getChildrenBatch: require_sleep.method(zod.z.object({ parentDeviceIds: zod.z.array(zod.z.number()).max(256) }), zod.z.record(zod.z.string(), zod.z.array(DeviceInfoSchema))),
|
|
9667
|
+
/**
|
|
9177
9668
|
* Resolve the devices LINKED to a camera — the single policy authority
|
|
9178
9669
|
* both consumers call (viewer devices panel + pipeline-analytics event
|
|
9179
9670
|
* kinds/ingest). Device-tree children are ALWAYS included; mode 'auto'
|
|
@@ -10355,6 +10846,82 @@ var llmCapability = {
|
|
|
10355
10846
|
}
|
|
10356
10847
|
};
|
|
10357
10848
|
//#endregion
|
|
10849
|
+
//#region src/capabilities/log-channels.cap.ts
|
|
10850
|
+
/**
|
|
10851
|
+
* `log-channels` — the capability an addon DECLARES its diagnostic channels
|
|
10852
|
+
* through. It stores nothing.
|
|
10853
|
+
*
|
|
10854
|
+
* ## Why a capability at all, and why this shape
|
|
10855
|
+
*
|
|
10856
|
+
* Which channels exist is knowledge only the addon has: `stream-broker` knows
|
|
10857
|
+
* webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
|
|
10858
|
+
* maintained by hand rots at the first addition and rots INVISIBLY — nothing
|
|
10859
|
+
* fails, an operator just never sees the channel somebody added. So the list
|
|
10860
|
+
* is assembled from declarations at runtime.
|
|
10861
|
+
*
|
|
10862
|
+
* The shape is copied from `log-destination.cap.ts`, which already does
|
|
10863
|
+
* exactly this job: `mode: 'collection'`, `internal: true`,
|
|
10864
|
+
* `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
|
|
10865
|
+
* `addons.listCapabilityProviders` still enumerates it, and the hub's
|
|
10866
|
+
* `CapabilityRegistry` still holds an RPC proxy per provider so a forked
|
|
10867
|
+
* runner's declarations reach hub-main over the transport that already exists.
|
|
10868
|
+
* No new UDS message, no second registry.
|
|
10869
|
+
*
|
|
10870
|
+
* ## What it deliberately does NOT own
|
|
10871
|
+
*
|
|
10872
|
+
* The VALUES — which channel is armed, for which cameras, until when — live in
|
|
10873
|
+
* ONE place: the logging settings document on the `system` cap
|
|
10874
|
+
* (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
|
|
10875
|
+
* value is the defect the plan behind this work exists to remove, and
|
|
10876
|
+
* `setRequestCensus` was retired (D245) rather than allowed to be a second
|
|
10877
|
+
* one. {@link logChannelsCapability} therefore has no getter for a level, no
|
|
10878
|
+
* setter for a window and no persistence of any kind.
|
|
10879
|
+
*
|
|
10880
|
+
* ## Why `apply` is here even so
|
|
10881
|
+
*
|
|
10882
|
+
* The gate lives in the addon's PROCESS; the document lives in hub-main. Some
|
|
10883
|
+
* seam has to carry the value from the authority to the mirror, and a channel
|
|
10884
|
+
* that cannot be reached is precisely the dead knob this whole slice exists to
|
|
10885
|
+
* make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
|
|
10886
|
+
* `apply` is that seam and nothing more: it writes an in-memory mirror, it
|
|
10887
|
+
* persists nothing, it is never the source of a value, and it is called only
|
|
10888
|
+
* with a set the hub actually read (D49 — a read that fails does not call it
|
|
10889
|
+
* at all, so no channel is silently disarmed by a bad read).
|
|
10890
|
+
*/
|
|
10891
|
+
/** What `apply` reports back — enough to log, not enough to be a second state. */
|
|
10892
|
+
var LogChannelApplyResultSchema = zod.z.object({
|
|
10893
|
+
/** How many declared channels are armed in this process after the call. */
|
|
10894
|
+
armed: zod.z.number().int().min(0),
|
|
10895
|
+
/**
|
|
10896
|
+
* Names the document armed that this process does not declare. Reported
|
|
10897
|
+
* rather than swallowed: a name here is either a typo or an addon that has
|
|
10898
|
+
* not booted, and both deserve a line instead of silence.
|
|
10899
|
+
*/
|
|
10900
|
+
unknown: zod.z.array(zod.z.string()).readonly()
|
|
10901
|
+
});
|
|
10902
|
+
var logChannelsCapability = {
|
|
10903
|
+
name: "log-channels",
|
|
10904
|
+
scope: "system",
|
|
10905
|
+
mode: "collection",
|
|
10906
|
+
internal: true,
|
|
10907
|
+
methods: {
|
|
10908
|
+
/** The channels this addon declares. Inert: no value, no state. */
|
|
10909
|
+
list: require_sleep.method(zod.z.void(), zod.z.array(LogChannelDescriptorSchema).readonly()),
|
|
10910
|
+
/**
|
|
10911
|
+
* Refresh this process's mirror from the document's FULL set of armed
|
|
10912
|
+
* windows.
|
|
10913
|
+
*
|
|
10914
|
+
* Full and not incremental on purpose: the document is the authority, so a
|
|
10915
|
+
* channel it does not name is disarmed here. An incremental apply would
|
|
10916
|
+
* let a disarm get lost in transit and leave a channel running that
|
|
10917
|
+
* nobody can see is running.
|
|
10918
|
+
*/
|
|
10919
|
+
apply: require_sleep.method(zod.z.object({ windows: zod.z.array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" })
|
|
10920
|
+
},
|
|
10921
|
+
/** In-process only — enumerated through `addons.listCapabilityProviders`. */
|
|
10922
|
+
mount: { kind: "skip" }
|
|
10923
|
+
};
|
|
10924
|
+
//#endregion
|
|
10358
10925
|
//#region src/capabilities/log-destination.cap.ts
|
|
10359
10926
|
var LogLevelSchema = zod.z.enum([
|
|
10360
10927
|
"debug",
|
|
@@ -30610,10 +31177,11 @@ var DiagnosticIdSchema = zod.z.enum(["request-census"]);
|
|
|
30610
31177
|
* The layers of the level hierarchy, general → specific. The most specific
|
|
30611
31178
|
* layer that carries an explicit value wins.
|
|
30612
31179
|
*
|
|
30613
|
-
* `component`
|
|
30614
|
-
*
|
|
30615
|
-
*
|
|
30616
|
-
*
|
|
31180
|
+
* `component` became RESOLVABLE on 2026-08-27: a component is a declared log
|
|
31181
|
+
* CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
|
|
31182
|
+
* `scopeComponent`. It was declared-but-dark in the first slice precisely so
|
|
31183
|
+
* that turning it on would not force every consumer of this document to widen
|
|
31184
|
+
* a `levelSource` enum — which is what has now not happened.
|
|
30617
31185
|
*/
|
|
30618
31186
|
var LoggingScopeKindSchema = zod.z.enum([
|
|
30619
31187
|
"cluster",
|
|
@@ -30640,6 +31208,14 @@ var LoggingLevelLayerSchema = zod.z.object({
|
|
|
30640
31208
|
scope: LoggingScopeKindSchema,
|
|
30641
31209
|
/** The node this layer speaks for; `null` on the cluster layer. */
|
|
30642
31210
|
nodeId: zod.z.string().nullable(),
|
|
31211
|
+
/**
|
|
31212
|
+
* The declared channel this layer speaks for; `null` on every layer but
|
|
31213
|
+
* `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
|
|
31214
|
+
* by design — the convention this repo settled on is one orchestrator-wide
|
|
31215
|
+
* setting, never per node (D52) — so a component layer that carried a node
|
|
31216
|
+
* would invite a per-node copy of a value that has no per-node meaning.
|
|
31217
|
+
*/
|
|
31218
|
+
component: zod.z.string().nullable(),
|
|
30643
31219
|
/** Explicitly set here, or `null` when this layer inherits. */
|
|
30644
31220
|
level: LogLevelSchema$1.nullable()
|
|
30645
31221
|
});
|
|
@@ -30681,6 +31257,49 @@ var DiagnosticWindowPatchSchema = zod.z.object({
|
|
|
30681
31257
|
reportEveryMs: zod.z.number().int().positive().optional()
|
|
30682
31258
|
});
|
|
30683
31259
|
/**
|
|
31260
|
+
* A channel ARMED, as the document reports it.
|
|
31261
|
+
*
|
|
31262
|
+
* `armMs` is not echoed back: what an operator needs to see is the deadline
|
|
31263
|
+
* and the time left, because a diagnostic left running is itself an incident
|
|
31264
|
+
* and "armed for 10 minutes" said an hour ago is not an answer.
|
|
31265
|
+
*/
|
|
31266
|
+
var LogChannelWindowStateSchema = zod.z.object({
|
|
31267
|
+
channel: zod.z.string(),
|
|
31268
|
+
armed: zod.z.boolean(),
|
|
31269
|
+
/** Epoch ms the window closes at. 0 when disarmed. */
|
|
31270
|
+
armedUntilMs: zod.z.number(),
|
|
31271
|
+
/** Ms left before it expires on its own. 0 when disarmed. */
|
|
31272
|
+
remainingMs: zod.z.number(),
|
|
31273
|
+
/**
|
|
31274
|
+
* The cameras it is narrowed to, or `null` for every camera.
|
|
31275
|
+
*
|
|
31276
|
+
* A channel declared `perDevice: false` can only ever report `null` here:
|
|
31277
|
+
* its lines do not carry `tags: { deviceId }`, so narrowing them would
|
|
31278
|
+
* produce a filter that silently matches nothing. The server REFUSES such a
|
|
31279
|
+
* patch rather than quietly widening it — ignoring the request would teach
|
|
31280
|
+
* the operator that per-camera filtering works on that channel when it does
|
|
31281
|
+
* not.
|
|
31282
|
+
*/
|
|
31283
|
+
deviceIds: zod.z.array(zod.z.number().int()).readonly().nullable()
|
|
31284
|
+
});
|
|
31285
|
+
/**
|
|
31286
|
+
* `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
|
|
31287
|
+
* for the same reason: a channel is a window with a deadline, never a switch.
|
|
31288
|
+
*/
|
|
31289
|
+
var LogChannelWindowPatchSchema = zod.z.object({
|
|
31290
|
+
channel: zod.z.string().min(1),
|
|
31291
|
+
armMs: zod.z.number().int().min(0),
|
|
31292
|
+
/**
|
|
31293
|
+
* Narrow to these numeric device ids. Absent or `null` = every camera.
|
|
31294
|
+
*
|
|
31295
|
+
* Numeric because the repo's own rule makes it possible: every log line
|
|
31296
|
+
* about a device carries `tags: { deviceId }` with the numeric id. That rule
|
|
31297
|
+
* was paid for with a 22% thumbnail gap and a 3-hour media blackout both
|
|
31298
|
+
* diagnosed by hand, and this is the first thing that collects on it.
|
|
31299
|
+
*/
|
|
31300
|
+
deviceIds: zod.z.array(zod.z.number().int()).readonly().nullable().optional()
|
|
31301
|
+
});
|
|
31302
|
+
/**
|
|
30684
31303
|
* A PATCH, and patches MERGE.
|
|
30685
31304
|
*
|
|
30686
31305
|
* A field absent from the patch is left exactly as it was — arming a
|
|
@@ -30699,7 +31318,14 @@ var LoggingSettingsPatchSchema = zod.z.object({
|
|
|
30699
31318
|
* Only the diagnostics NAMED here change. An armed window that is not listed
|
|
30700
31319
|
* keeps running — a patch is never a full replacement.
|
|
30701
31320
|
*/
|
|
30702
|
-
diagnostics: zod.z.array(DiagnosticWindowPatchSchema).readonly().optional()
|
|
31321
|
+
diagnostics: zod.z.array(DiagnosticWindowPatchSchema).readonly().optional(),
|
|
31322
|
+
/**
|
|
31323
|
+
* Only the channels NAMED here change. An armed channel that is not listed
|
|
31324
|
+
* keeps running — same rule as `diagnostics`, because a patch that silently
|
|
31325
|
+
* disarmed the channels it did not mention would make the Levels page and
|
|
31326
|
+
* the Diagnostics page fight over the same value.
|
|
31327
|
+
*/
|
|
31328
|
+
channels: zod.z.array(LogChannelWindowPatchSchema).readonly().optional()
|
|
30703
31329
|
});
|
|
30704
31330
|
/**
|
|
30705
31331
|
* Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
|
|
@@ -30712,9 +31338,22 @@ var LoggingSettingsPatchSchema = zod.z.object({
|
|
|
30712
31338
|
* authority over the whole hierarchy and answers for every layer, so the
|
|
30713
31339
|
* layer selector needs a name the transport does not already own.
|
|
30714
31340
|
*/
|
|
30715
|
-
var GetLoggingSettingsInputSchema = zod.z.object({
|
|
31341
|
+
var GetLoggingSettingsInputSchema = zod.z.object({
|
|
31342
|
+
scopeNodeId: zod.z.string().optional(),
|
|
31343
|
+
/**
|
|
31344
|
+
* The declared CHANNEL this document is addressed at, when the caller wants
|
|
31345
|
+
* the `component` layer. Absent = the node/cluster hierarchy only.
|
|
31346
|
+
*
|
|
31347
|
+
* Naming it separately rather than overloading `scopeNodeId` keeps the two
|
|
31348
|
+
* axes from collapsing: a component level is cluster-wide, a node level is
|
|
31349
|
+
* not, and one selector for both would make "which of these two did I just
|
|
31350
|
+
* set" unanswerable — the exact ambiguity `explicit` exists to remove.
|
|
31351
|
+
*/
|
|
31352
|
+
scopeComponent: zod.z.string().optional()
|
|
31353
|
+
});
|
|
30716
31354
|
var SetLoggingSettingsInputSchema = zod.z.object({
|
|
30717
31355
|
scopeNodeId: zod.z.string().optional(),
|
|
31356
|
+
scopeComponent: zod.z.string().optional(),
|
|
30718
31357
|
patch: LoggingSettingsPatchSchema
|
|
30719
31358
|
});
|
|
30720
31359
|
/**
|
|
@@ -30729,9 +31368,20 @@ var SetLoggingSettingsInputSchema = zod.z.object({
|
|
|
30729
31368
|
var LoggingSettingsStateSchema = zod.z.object({
|
|
30730
31369
|
/** The layer this document was read at. `null` = the cluster layer. */
|
|
30731
31370
|
scopeNodeId: zod.z.string().nullable(),
|
|
31371
|
+
/** The channel this document was read at. `null` = no component layer. */
|
|
31372
|
+
scopeComponent: zod.z.string().nullable(),
|
|
30732
31373
|
effective: LoggingEffectiveSchema,
|
|
30733
31374
|
explicit: LoggingExplicitSchema,
|
|
30734
31375
|
activeWindows: zod.z.array(DiagnosticWindowSchema).readonly(),
|
|
31376
|
+
/**
|
|
31377
|
+
* Every channel the cluster's addons DECLARE, gathered from the
|
|
31378
|
+
* `log-channels` providers. Not stored anywhere: assembled per read, so a
|
|
31379
|
+
* channel added by a redeployed addon appears without anybody editing a
|
|
31380
|
+
* list, and a channel whose addon is gone stops being offered.
|
|
31381
|
+
*/
|
|
31382
|
+
channels: zod.z.array(LogChannelDescriptorSchema).readonly(),
|
|
31383
|
+
/** The channels ARMED right now, each with its deadline. */
|
|
31384
|
+
activeChannels: zod.z.array(LogChannelWindowStateSchema).readonly(),
|
|
30735
31385
|
persisted: zod.z.boolean()
|
|
30736
31386
|
});
|
|
30737
31387
|
var systemCapability = {
|
|
@@ -35121,6 +35771,7 @@ var CAPABILITY_NAMES = {
|
|
|
35121
35771
|
llmRuntime: "llm-runtime",
|
|
35122
35772
|
localNetwork: "local-network",
|
|
35123
35773
|
lockControl: "lock-control",
|
|
35774
|
+
logChannels: "log-channels",
|
|
35124
35775
|
logDestination: "log-destination",
|
|
35125
35776
|
loginMethod: "login-method",
|
|
35126
35777
|
mediaPlayer: "media-player",
|
|
@@ -35492,6 +36143,10 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
35492
36143
|
key: "lockControl",
|
|
35493
36144
|
name: "lock-control"
|
|
35494
36145
|
},
|
|
36146
|
+
{
|
|
36147
|
+
key: "logChannels",
|
|
36148
|
+
name: "log-channels"
|
|
36149
|
+
},
|
|
35495
36150
|
{
|
|
35496
36151
|
key: "logDestination",
|
|
35497
36152
|
name: "log-destination"
|
|
@@ -35880,6 +36535,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
35880
36535
|
llmRuntimeCapability,
|
|
35881
36536
|
localNetworkCapability,
|
|
35882
36537
|
lockControlCapability,
|
|
36538
|
+
logChannelsCapability,
|
|
35883
36539
|
logDestinationCapability,
|
|
35884
36540
|
loginMethodCapability,
|
|
35885
36541
|
mediaPlayerCapability,
|
|
@@ -36848,6 +37504,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
36848
37504
|
addonId: null,
|
|
36849
37505
|
access: "view"
|
|
36850
37506
|
},
|
|
37507
|
+
"dataStoreProvider.aggregate": {
|
|
37508
|
+
capName: "data-store-provider",
|
|
37509
|
+
capScope: "system",
|
|
37510
|
+
addonId: null,
|
|
37511
|
+
access: "view"
|
|
37512
|
+
},
|
|
36851
37513
|
"dataStoreProvider.count": {
|
|
36852
37514
|
capName: "data-store-provider",
|
|
36853
37515
|
capScope: "system",
|
|
@@ -37262,6 +37924,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
37262
37924
|
addonId: null,
|
|
37263
37925
|
access: "view"
|
|
37264
37926
|
},
|
|
37927
|
+
"deviceManager.getChildrenBatch": {
|
|
37928
|
+
capName: "device-manager",
|
|
37929
|
+
capScope: "system",
|
|
37930
|
+
addonId: null,
|
|
37931
|
+
access: "view"
|
|
37932
|
+
},
|
|
37265
37933
|
"deviceManager.getConfigSchema": {
|
|
37266
37934
|
capName: "device-manager",
|
|
37267
37935
|
capScope: "system",
|
|
@@ -38312,6 +38980,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
38312
38980
|
addonId: null,
|
|
38313
38981
|
access: "create"
|
|
38314
38982
|
},
|
|
38983
|
+
"logChannels.apply": {
|
|
38984
|
+
capName: "log-channels",
|
|
38985
|
+
capScope: "system",
|
|
38986
|
+
addonId: null,
|
|
38987
|
+
access: "create"
|
|
38988
|
+
},
|
|
38989
|
+
"logChannels.list": {
|
|
38990
|
+
capName: "log-channels",
|
|
38991
|
+
capScope: "system",
|
|
38992
|
+
addonId: null,
|
|
38993
|
+
access: "view"
|
|
38994
|
+
},
|
|
38315
38995
|
"logDestination.query": {
|
|
38316
38996
|
capName: "log-destination",
|
|
38317
38997
|
capScope: "system",
|
|
@@ -40466,6 +41146,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
40466
41146
|
addonId: null,
|
|
40467
41147
|
access: "create"
|
|
40468
41148
|
},
|
|
41149
|
+
"settingsStore.aggregate": {
|
|
41150
|
+
capName: "settings-store",
|
|
41151
|
+
capScope: "system",
|
|
41152
|
+
addonId: null,
|
|
41153
|
+
access: "view"
|
|
41154
|
+
},
|
|
40469
41155
|
"settingsStore.count": {
|
|
40470
41156
|
capName: "settings-store",
|
|
40471
41157
|
capScope: "system",
|
|
@@ -41815,6 +42501,7 @@ var KNOWN_CAP_NAMES = [
|
|
|
41815
42501
|
"llm-runtime",
|
|
41816
42502
|
"local-network",
|
|
41817
42503
|
"lock-control",
|
|
42504
|
+
"log-channels",
|
|
41818
42505
|
"log-destination",
|
|
41819
42506
|
"login-method",
|
|
41820
42507
|
"media-player",
|
|
@@ -41973,6 +42660,7 @@ var SYSTEM_CAP_NAMES = [
|
|
|
41973
42660
|
"llm",
|
|
41974
42661
|
"llm-runtime",
|
|
41975
42662
|
"local-network",
|
|
42663
|
+
"log-channels",
|
|
41976
42664
|
"log-destination",
|
|
41977
42665
|
"login-method",
|
|
41978
42666
|
"mesh-network",
|
|
@@ -42302,6 +42990,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
42302
42990
|
form: "single",
|
|
42303
42991
|
optional: false
|
|
42304
42992
|
}],
|
|
42993
|
+
"deviceManager.getChildrenBatch": [{
|
|
42994
|
+
name: "parentDeviceIds",
|
|
42995
|
+
form: "array",
|
|
42996
|
+
optional: false
|
|
42997
|
+
}],
|
|
42305
42998
|
"deviceManager.getConfigSchema": [{
|
|
42306
42999
|
name: "deviceId",
|
|
42307
43000
|
form: "single",
|
|
@@ -43778,6 +44471,7 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
|
|
|
43778
44471
|
"deviceManager.getBindings",
|
|
43779
44472
|
"deviceManager.getBindingsBatch",
|
|
43780
44473
|
"deviceManager.getChildren",
|
|
44474
|
+
"deviceManager.getChildrenBatch",
|
|
43781
44475
|
"deviceManager.getConfigSchema",
|
|
43782
44476
|
"deviceManager.getDevice",
|
|
43783
44477
|
"deviceManager.getDeviceAggregate",
|
|
@@ -44515,6 +45209,7 @@ function createSystemProxy(api) {
|
|
|
44515
45209
|
listPersistedByAddon: (input) => dispatch("deviceManager", "listPersistedByAddon", "query", input),
|
|
44516
45210
|
listAll: (input) => dispatch("deviceManager", "listAll", "query", input),
|
|
44517
45211
|
getChildren: (input) => dispatch("deviceManager", "getChildren", "query", input),
|
|
45212
|
+
getChildrenBatch: (input) => dispatch("deviceManager", "getChildrenBatch", "query", input),
|
|
44518
45213
|
getLinkedDevicesBatch: (input) => dispatch("deviceManager", "getLinkedDevicesBatch", "query", input),
|
|
44519
45214
|
removeByIntegration: (input) => dispatch("deviceManager", "removeByIntegration", "mutation", input),
|
|
44520
45215
|
getBindingsBatch: (input) => dispatch("deviceManager", "getBindingsBatch", "query", input),
|
|
@@ -44829,6 +45524,7 @@ function createSystemProxy(api) {
|
|
|
44829
45524
|
deleteWhere: (input) => dispatch("settingsStore", "deleteWhere", "mutation", input),
|
|
44830
45525
|
updateWhere: (input) => dispatch("settingsStore", "updateWhere", "mutation", input),
|
|
44831
45526
|
count: (input) => dispatch("settingsStore", "count", "query", input),
|
|
45527
|
+
aggregate: (input) => dispatch("settingsStore", "aggregate", "query", input),
|
|
44832
45528
|
histogram: (input) => dispatch("settingsStore", "histogram", "query", input),
|
|
44833
45529
|
isEmpty: (input) => dispatch("settingsStore", "isEmpty", "query", input),
|
|
44834
45530
|
declareCollection: (input) => dispatch("settingsStore", "declareCollection", "mutation", input)
|
|
@@ -49128,6 +49824,7 @@ exports.DETECTION_MACRO_CLASSES = DETECTION_MACRO_CLASSES;
|
|
|
49128
49824
|
exports.DETECTION_PIPELINE_CAP_NAME = DETECTION_PIPELINE_CAP_NAME;
|
|
49129
49825
|
exports.DEVICE_BACKEND_TO_FORMAT = DEVICE_BACKEND_TO_FORMAT;
|
|
49130
49826
|
exports.DEVICE_CAP_NAMES = DEVICE_CAP_NAMES;
|
|
49827
|
+
exports.DEVICE_CHILDREN_BATCH_MAX = DEVICE_CHILDREN_BATCH_MAX;
|
|
49131
49828
|
exports.DEVICE_PROFILES = DEVICE_PROFILES;
|
|
49132
49829
|
exports.DEVICE_SCOPED_CAPS = require_sleep.DEVICE_SCOPED_CAPS;
|
|
49133
49830
|
exports.DEVICE_SETTINGS_CONTRIBUTION_METHODS = require_sleep.DEVICE_SETTINGS_CONTRIBUTION_METHODS;
|
|
@@ -49278,6 +49975,7 @@ exports.IntercomAbilitySchema = IntercomAbilitySchema;
|
|
|
49278
49975
|
exports.IntercomStatusSchema = IntercomStatusSchema;
|
|
49279
49976
|
exports.KNOWN_CAP_NAMES = KNOWN_CAP_NAMES;
|
|
49280
49977
|
exports.KeyEventSchema = KeyEventSchema;
|
|
49978
|
+
exports.LOG_CHANNEL_TICK_MS = LOG_CHANNEL_TICK_MS;
|
|
49281
49979
|
exports.LOG_LEVEL_RANK = LOG_LEVEL_RANK;
|
|
49282
49980
|
exports.LabelAttributionSchema = LabelAttributionSchema;
|
|
49283
49981
|
exports.LabelDefinitionSchema = LabelDefinitionSchema;
|
|
@@ -49313,6 +50011,14 @@ exports.LocateSegmentResultSchema = LocateSegmentResultSchema;
|
|
|
49313
50011
|
exports.LocationStatSchema = LocationStatSchema;
|
|
49314
50012
|
exports.LockControlStatusSchema = LockControlStatusSchema;
|
|
49315
50013
|
exports.LockStateSchema = LockStateSchema;
|
|
50014
|
+
exports.LogChannelApplyResultSchema = LogChannelApplyResultSchema;
|
|
50015
|
+
exports.LogChannelDescriptorSchema = LogChannelDescriptorSchema;
|
|
50016
|
+
exports.LogChannelGate = LogChannelGate;
|
|
50017
|
+
exports.LogChannelLevelSchema = LogChannelLevelSchema;
|
|
50018
|
+
exports.LogChannelRegistry = LogChannelRegistry;
|
|
50019
|
+
exports.LogChannelWindowPatchSchema = LogChannelWindowPatchSchema;
|
|
50020
|
+
exports.LogChannelWindowSchema = LogChannelWindowSchema;
|
|
50021
|
+
exports.LogChannelWindowStateSchema = LogChannelWindowStateSchema;
|
|
49316
50022
|
exports.LogEntrySchema = LogEntrySchema;
|
|
49317
50023
|
exports.LogLevelSchema = LogLevelSchema;
|
|
49318
50024
|
exports.LogStreamEntrySchema = LogStreamEntrySchema;
|
|
@@ -49863,6 +50569,7 @@ exports.ZoneRuleStageEnum = ZoneRuleStageEnum;
|
|
|
49863
50569
|
exports.ZoneRulesArraySchema = ZoneRulesArraySchema;
|
|
49864
50570
|
exports.ZoneSchema = ZoneSchema;
|
|
49865
50571
|
exports.ZoneScopeBreakdownSchema = ZoneScopeBreakdownSchema;
|
|
50572
|
+
exports.__resetLogChannelRegistryForTests = __resetLogChannelRegistryForTests;
|
|
49866
50573
|
exports.accessoriesCapability = accessoriesCapability;
|
|
49867
50574
|
exports.accessoryStableId = accessoryStableId;
|
|
49868
50575
|
exports.addonPagesCapability = addonPagesCapability;
|
|
@@ -49959,6 +50666,7 @@ exports.createEventBusSliceSource = require_sleep.createEventBusSliceSource;
|
|
|
49959
50666
|
exports.createExpressionScope = createExpressionScope;
|
|
49960
50667
|
exports.createHwAccelCache = createHwAccelCache;
|
|
49961
50668
|
exports.createLazyTrpcSource = require_sleep.createLazyTrpcSource;
|
|
50669
|
+
exports.createLogChannelsProvider = createLogChannelsProvider;
|
|
49962
50670
|
exports.createMirrorSource = require_sleep.createMirrorSource;
|
|
49963
50671
|
exports.createRuntimeStateBridge = createRuntimeStateBridge;
|
|
49964
50672
|
exports.createSliceHandle = require_sleep.createSliceHandle;
|
|
@@ -49968,6 +50676,7 @@ exports.customModelRegistryCapability = customModelRegistryCapability;
|
|
|
49968
50676
|
exports.dataStoreProviderCapability = dataStoreProviderCapability;
|
|
49969
50677
|
exports.dayNightCapability = dayNightCapability;
|
|
49970
50678
|
exports.declarationOwnerNodeId = declarationOwnerNodeId;
|
|
50679
|
+
exports.declareLogChannel = declareLogChannel;
|
|
49971
50680
|
exports.decodeVectorBase64 = decodeVectorBase64;
|
|
49972
50681
|
exports.decoderCapability = decoderCapability;
|
|
49973
50682
|
exports.defaultDeliveryForSection = defaultDeliveryForSection;
|
|
@@ -50030,6 +50739,7 @@ exports.generateAutomationBlock = generateAutomationBlock;
|
|
|
50030
50739
|
exports.getAudioMacroClassIds = getAudioMacroClassIds;
|
|
50031
50740
|
exports.getByPath = getByPath;
|
|
50032
50741
|
exports.getCapsByProviderKind = getCapsByProviderKind;
|
|
50742
|
+
exports.getLogChannelRegistry = getLogChannelRegistry;
|
|
50033
50743
|
exports.getTaxonomyEntry = getTaxonomyEntry;
|
|
50034
50744
|
exports.hasMotionTrigger = hasMotionTrigger;
|
|
50035
50745
|
exports.hfModelUrl = hfModelUrl;
|
|
@@ -50083,6 +50793,7 @@ exports.localNetworkCapability = localNetworkCapability;
|
|
|
50083
50793
|
exports.locationSimilarity = locationSimilarity;
|
|
50084
50794
|
exports.lockControlCapability = lockControlCapability;
|
|
50085
50795
|
exports.logBannerArgs = require_canonical_hash.logBannerArgs;
|
|
50796
|
+
exports.logChannelsCapability = logChannelsCapability;
|
|
50086
50797
|
exports.logDestinationCapability = logDestinationCapability;
|
|
50087
50798
|
exports.logLevelAtMost = logLevelAtMost;
|
|
50088
50799
|
exports.loginMethodCapability = loginMethodCapability;
|