@camstack/addon-pipeline 1.2.134 → 1.2.135

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 (37) hide show
  1. package/dist/{addon-utils-Cg_Sl2UR.js → addon-utils-CKf8kbwh.js} +1 -1
  2. package/dist/audio-analyzer/index.js +3 -3
  3. package/dist/audio-analyzer/index.mjs +2 -2
  4. package/dist/detection-pipeline/index.js +5 -5
  5. package/dist/detection-pipeline/index.mjs +3 -3
  6. package/dist/{dist-BnwP1K09.js → dist-BzLiQ8Ue.js} +612 -25
  7. package/dist/{dist-Dsn9NGO3.mjs → dist-C1dXLLQq.mjs} +595 -26
  8. package/dist/{event-loop-stall-monitor-CRdmHBpl.mjs → event-loop-stall-monitor-CU-xxX5c.mjs} +1 -1
  9. package/dist/{event-loop-stall-monitor-DRpAtCOy.js → event-loop-stall-monitor-DjV4Bow7.js} +1 -1
  10. package/dist/{lazy-sharp-Div0sK_l.js → lazy-sharp-DxWmhTqk.js} +1 -1
  11. package/dist/motion-wasm/index.js +2 -2
  12. package/dist/motion-wasm/index.mjs +1 -1
  13. package/dist/pipeline-runner/index.js +4 -4
  14. package/dist/pipeline-runner/index.mjs +3 -3
  15. package/dist/{process-memory-C3Q8YXd_.js → process-memory-CZK3D3kM.js} +1 -1
  16. package/dist/{process-memory-B-zF-wcr.mjs → process-memory-CaEwi5Cd.mjs} +1 -1
  17. package/dist/recorder/index.js +357 -327
  18. package/dist/recorder/index.mjs +356 -326
  19. package/dist/{segment-demux-js-BOIExWSt.js → segment-demux-js-BbpqygHL.js} +1 -1
  20. package/dist/{segment-demux-js-BIyVwpSp.mjs → segment-demux-js-njRO85gd.mjs} +1 -1
  21. package/dist/session-decode/decode-worker-child.js +2 -2
  22. package/dist/session-decode/decode-worker-child.mjs +1 -1
  23. package/dist/stream-broker/_stub.js +2 -2
  24. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CASELLGa.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C14Qqrqn.mjs} +3 -3
  25. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DqplWP1i.mjs +26 -0
  26. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DKMXG57X.mjs +26 -0
  27. package/dist/stream-broker/demux-worker-child.js +1 -1
  28. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  29. package/dist/stream-broker/{hostInit-BjhhoD3z.mjs → hostInit-kjsveCjG.mjs} +3 -3
  30. package/dist/stream-broker/index.js +105 -7
  31. package/dist/stream-broker/index.mjs +105 -7
  32. package/dist/stream-broker/remoteEntry.js +1 -1
  33. package/dist/{worker-protocol-Bo2fIjZ2.js → worker-protocol-DvTZBvh2.js} +1 -1
  34. package/dist/{worker-protocol-CaQCRtsw.mjs → worker-protocol-DxsVx0G7.mjs} +1 -1
  35. package/package.json +4 -1
  36. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BF-ziHjH.mjs +0 -26
  37. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-77rGxv1J.mjs +0 -26
@@ -8436,6 +8436,362 @@ var CameraSwitchGroupSchema = object({
8436
8436
  fetchedAt: number()
8437
8437
  });
8438
8438
  /**
8439
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8440
+ * an addon declares its channels in.
8441
+ *
8442
+ * ## Two axes, deliberately separated
8443
+ *
8444
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8445
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8446
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8447
+ * and rots silently. So a channel is declared where it is consulted, and the
8448
+ * `log-channels` capability enumerates the declarations.
8449
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8450
+ * thing: the logging settings document on the `system` cap. Two authorities
8451
+ * over the values is the exact defect
8452
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8453
+ * remove; re-introducing it from the cure side would be grotesque.
8454
+ *
8455
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8456
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8457
+ * the hot path with a value somebody actually read, and by
8458
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8459
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8460
+ * disarmed one (D49).
8461
+ *
8462
+ * ## The canonical call shape
8463
+ *
8464
+ * ```ts
8465
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8466
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8467
+ * }
8468
+ * ```
8469
+ *
8470
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8471
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8472
+ * object literal is never constructed because it lives inside the branch. It
8473
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8474
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8475
+ * destination floor (measured at 1.93 ns/call when off).
8476
+ *
8477
+ * ## Why a channel emits at `info`
8478
+ *
8479
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8480
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8481
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8482
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8483
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8484
+ * emits at the channel's declared level, whose schema floor is `info`.
8485
+ */
8486
+ /**
8487
+ * The level a channel writes at once armed.
8488
+ *
8489
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8490
+ * not leave the process for Loki, and the whole point of arming a channel is
8491
+ * to read it later.
8492
+ */
8493
+ var LogChannelLevelSchema = _enum([
8494
+ "info",
8495
+ "warn",
8496
+ "error"
8497
+ ]);
8498
+ /**
8499
+ * What an addon declares about one channel. No value, no state — a
8500
+ * declaration is inert.
8501
+ */
8502
+ var LogChannelDescriptorSchema = object({
8503
+ /**
8504
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8505
+ * the addon's short name so an operator reading a channel list can tell who
8506
+ * owns it without a second lookup.
8507
+ */
8508
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8509
+ /** One sentence: what the operator will SEE after arming it. */
8510
+ description: string().min(1),
8511
+ /** The level its lines are emitted at. Never below `info`. */
8512
+ defaultLevel: LogChannelLevelSchema,
8513
+ /**
8514
+ * Whether this channel can be narrowed to a camera.
8515
+ *
8516
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8517
+ * consulted with the numeric device id, AND every line the channel admits
8518
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8519
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8520
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8521
+ * the body is the only way to filter.
8522
+ *
8523
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8524
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8525
+ * the operator narrows to one camera, sees nothing, and concludes the code
8526
+ * path was never taken.
8527
+ */
8528
+ perDevice: boolean()
8529
+ });
8530
+ /**
8531
+ * An armed window over one channel, as the document hands it to a mirror.
8532
+ *
8533
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8534
+ * expires by itself, which is the one failure a boolean cannot avoid.
8535
+ */
8536
+ var LogChannelWindowSchema = object({
8537
+ channel: string().min(1),
8538
+ /** Epoch ms the window closes at. */
8539
+ armedUntilMs: number(),
8540
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8541
+ deviceIds: array(number().int()).readonly().nullable()
8542
+ });
8543
+ /**
8544
+ * The gate a hot path holds.
8545
+ *
8546
+ * Obtain it ONCE — at module scope or in a constructor — and keep the
8547
+ * reference. Looking a channel up by name per line would put a Map lookup on
8548
+ * the path this class exists to keep free.
8549
+ */
8550
+ var LogChannelGate = class {
8551
+ descriptor;
8552
+ /**
8553
+ * HOT PATH GUARD. A plain data FIELD, and it must stay one.
8554
+ *
8555
+ * `log-channel.spec.ts` asserts the property descriptor has no getter and
8556
+ * booby-traps the device set, so turning this into an accessor — or reading
8557
+ * anything before it — fails the spec instead of taxing every line the
8558
+ * process emits.
8559
+ */
8560
+ on = false;
8561
+ /** `null` while armed for every camera. Never read while `on` is false. */
8562
+ devices = null;
8563
+ level;
8564
+ closesAtMs = 0;
8565
+ constructor(descriptor) {
8566
+ this.descriptor = descriptor;
8567
+ this.level = descriptor.defaultLevel;
8568
+ }
8569
+ /** Epoch ms this channel disarms itself at. 0 when disarmed. */
8570
+ get armedUntilMs() {
8571
+ return this.on ? this.closesAtMs : 0;
8572
+ }
8573
+ /**
8574
+ * Does this channel want a line about `deviceId`?
8575
+ *
8576
+ * Call it only behind `gate.on &&`. On its own it is still correct — the
8577
+ * guard is repeated inside — but the point of the prefix is that a disarmed
8578
+ * channel must not pay the call at all.
8579
+ */
8580
+ wants(deviceId) {
8581
+ if (!this.on) return false;
8582
+ return this.devices === null || this.devices.has(deviceId);
8583
+ }
8584
+ /**
8585
+ * Emit one line on this channel, at the channel's declared level.
8586
+ *
8587
+ * The channel name is added as `tags.logChannel` so LogQL can select the
8588
+ * channel without matching on the message text, and whatever `tags` the
8589
+ * caller passed — `deviceId` above all — is preserved.
8590
+ */
8591
+ log(logger, message, extras) {
8592
+ if (!this.on) return;
8593
+ const tags = {
8594
+ ...extras.tags,
8595
+ logChannel: this.descriptor.name
8596
+ };
8597
+ const line = {
8598
+ ...extras,
8599
+ tags
8600
+ };
8601
+ if (this.level === "error") logger.error(message, line);
8602
+ else if (this.level === "warn") logger.warn(message, line);
8603
+ else logger.info(message, line);
8604
+ }
8605
+ /**
8606
+ * Arm (or RE-arm, restarting) this channel. Off the hot path only.
8607
+ *
8608
+ * An empty `deviceIds` list is treated as "every camera" rather than "no
8609
+ * camera": a window that matches nothing is indistinguishable from a
8610
+ * disarmed one, and the operator who asked for it would wait for lines that
8611
+ * can never come.
8612
+ */
8613
+ arm(window) {
8614
+ const ids = window.deviceIds;
8615
+ this.devices = ids === null || ids.length === 0 ? null : new Set(ids);
8616
+ this.closesAtMs = window.armedUntilMs;
8617
+ this.on = true;
8618
+ }
8619
+ /** Disarm. Off the hot path only. */
8620
+ disarm() {
8621
+ this.on = false;
8622
+ this.devices = null;
8623
+ this.closesAtMs = 0;
8624
+ }
8625
+ };
8626
+ /**
8627
+ * Every channel this PROCESS declares, and the mirror of what is armed on it.
8628
+ *
8629
+ * One per process. A forked runner has its own, and it is refreshed through
8630
+ * the `log-channels` capability by the hub that owns the document — the
8631
+ * registry never reaches for a value itself.
8632
+ */
8633
+ var LogChannelRegistry = class {
8634
+ gates = /* @__PURE__ */ new Map();
8635
+ /**
8636
+ * Declare a channel and get its gate.
8637
+ *
8638
+ * A duplicate name throws. Two declarations of one name is a programming
8639
+ * error, not a merge: the operator would arm one and the other would stay
8640
+ * dark, which is the dead-knob shape (D62) with an extra step.
8641
+ */
8642
+ declare(descriptor) {
8643
+ const parsed = LogChannelDescriptorSchema.parse(descriptor);
8644
+ 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`);
8645
+ const gate = new LogChannelGate(parsed);
8646
+ this.gates.set(parsed.name, gate);
8647
+ return gate;
8648
+ }
8649
+ /** The declarations, sorted by name so a list is stable to read and diff. */
8650
+ list() {
8651
+ return [...this.gates.values()].map((gate) => gate.descriptor).sort((a, b) => a.name.localeCompare(b.name));
8652
+ }
8653
+ /** The gate for a declared channel, or `undefined`. */
8654
+ gate(name) {
8655
+ return this.gates.get(name);
8656
+ }
8657
+ /**
8658
+ * Apply the FULL set of armed windows. Off the hot path.
8659
+ *
8660
+ * Full, not incremental, and that is the whole design: the document is the
8661
+ * authority, so a channel the document does not name is disarmed here. An
8662
+ * incremental apply would let a disarm get lost in transit and leave a
8663
+ * channel running that nobody can see is running.
8664
+ *
8665
+ * A window already past its deadline is ignored rather than armed — a
8666
+ * restore that re-armed an expired window would make a forgotten diagnostic
8667
+ * immortal across restarts.
8668
+ *
8669
+ * Returns the names it could not place, so the caller can log them: a
8670
+ * channel named in the document that this process does not declare is
8671
+ * either a typo or an addon that has not booted yet, and both deserve a
8672
+ * line rather than silence.
8673
+ */
8674
+ apply(windows, nowMs) {
8675
+ const wanted = /* @__PURE__ */ new Map();
8676
+ const unknown = [];
8677
+ for (const window of windows) {
8678
+ if (window.armedUntilMs <= nowMs) continue;
8679
+ if (!this.gates.has(window.channel)) {
8680
+ unknown.push(window.channel);
8681
+ continue;
8682
+ }
8683
+ wanted.set(window.channel, window);
8684
+ }
8685
+ for (const [name, gate] of this.gates) {
8686
+ const window = wanted.get(name);
8687
+ if (window === void 0) gate.disarm();
8688
+ else gate.arm(window);
8689
+ }
8690
+ return unknown;
8691
+ }
8692
+ /**
8693
+ * Disarm whatever has run out. Called on a timer, NEVER from a log path — a
8694
+ * diagnostic that adds a `Date.now()` to the path it is measuring measures
8695
+ * itself.
8696
+ *
8697
+ * Returns the names it closed, so the caller can write the one line that
8698
+ * says a window ended and stops "it went quiet" from reading as "the branch
8699
+ * was not taken".
8700
+ */
8701
+ tick(nowMs) {
8702
+ const closed = [];
8703
+ for (const [name, gate] of this.gates) if (gate.on && gate.armedUntilMs <= nowMs) {
8704
+ gate.disarm();
8705
+ closed.push(name);
8706
+ }
8707
+ return closed;
8708
+ }
8709
+ /** The channels armed right now, as the document would describe them. */
8710
+ armed() {
8711
+ const out = [];
8712
+ for (const [name, gate] of this.gates) if (gate.on) out.push({
8713
+ channel: name,
8714
+ armedUntilMs: gate.armedUntilMs,
8715
+ deviceIds: null
8716
+ });
8717
+ return out;
8718
+ }
8719
+ };
8720
+ /**
8721
+ * Process-wide holder for the {@link LogChannelRegistry}.
8722
+ *
8723
+ * Three call sites that never meet need the SAME instance: the hot paths that
8724
+ * declare a gate at module scope, the `log-channels` provider that enumerates
8725
+ * the declarations for the hub, and the same provider applying the windows the
8726
+ * document hands down. A registry built inside any one of them would be
8727
+ * refreshed and collected — the shape of a knob that never does anything.
8728
+ *
8729
+ * Same idiom as `logging-gate.singleton.ts` and
8730
+ * `http-request-census.singleton.ts`.
8731
+ */
8732
+ var instance = null;
8733
+ /** The process-wide log channel registry. Created empty on first use. */
8734
+ function getLogChannelRegistry() {
8735
+ instance ??= new LogChannelRegistry();
8736
+ return instance;
8737
+ }
8738
+ /**
8739
+ * Declare a channel on the process-wide registry and get its gate.
8740
+ *
8741
+ * The one call an addon makes. Keep the returned gate in a module-scope
8742
+ * `const`: looking a channel up by name per line would put a Map lookup on
8743
+ * exactly the path this mechanism exists to keep free.
8744
+ *
8745
+ * `scripts/check-log-channel-gated.ts` reads these call sites. It pairs the
8746
+ * declared name with the binding it is assigned to and refuses to let a
8747
+ * channel ship that no `<binding>.on` anywhere consults — a declared channel
8748
+ * nobody reads is a knob the operator turns with nothing happening, forever,
8749
+ * and without a line. That is D62, and this repo has now shipped it three
8750
+ * times (`audioThresholdDbfs`, the HA entities with no source, the second
8751
+ * per-camera switch that wrote a store nobody read).
8752
+ */
8753
+ function declareLogChannel(descriptor) {
8754
+ return getLogChannelRegistry().declare(descriptor);
8755
+ }
8756
+ /**
8757
+ * Build the `log-channels` provider for this process.
8758
+ *
8759
+ * `logger` is used ONLY off the hot path — for the arm/expiry lines — so a
8760
+ * channel that is never armed costs this module nothing but a timer.
8761
+ */
8762
+ function createLogChannelsProvider(logger, options = {}) {
8763
+ const registry = getLogChannelRegistry();
8764
+ const now = options.now ?? Date.now;
8765
+ const tickMs = options.tickMs ?? 5e3;
8766
+ const timer = setInterval(() => {
8767
+ const closed = registry.tick(now());
8768
+ for (const name of closed) logger.info("log channel window closed", {
8769
+ tags: { logChannel: name },
8770
+ meta: { channel: name }
8771
+ });
8772
+ }, tickMs);
8773
+ timer.unref?.();
8774
+ return {
8775
+ list: () => registry.list(),
8776
+ apply: (input) => {
8777
+ const unknown = registry.apply(input.windows, now());
8778
+ const armed = registry.armed();
8779
+ logger.info("log channels applied", { meta: {
8780
+ armed: armed.map((window) => window.channel),
8781
+ unknown,
8782
+ declared: registry.list().length
8783
+ } });
8784
+ return {
8785
+ armed: armed.length,
8786
+ unknown
8787
+ };
8788
+ },
8789
+ stop: () => {
8790
+ clearInterval(timer);
8791
+ }
8792
+ };
8793
+ }
8794
+ /**
8439
8795
  * Ops-log — the durable, append-only operations audit shared by the
8440
8796
  * recordings and events management surfaces.
8441
8797
  *
@@ -12500,6 +12856,35 @@ var MutationFilterSchema = object({
12500
12856
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
12501
12857
  whereNot: record(string(), unknown()).optional()
12502
12858
  });
12859
+ /**
12860
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
12861
+ *
12862
+ * `as` names the slot in the result, so the SAME column may be asked twice with
12863
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
12864
+ * a `Record<column, op>` shape could not express.
12865
+ */
12866
+ var AggregateFieldSchema = object({
12867
+ /** Result key. */
12868
+ as: string().min(1),
12869
+ /** Column to aggregate. Must be a real column of a declared collection. */
12870
+ field: string().min(1),
12871
+ op: _enum([
12872
+ "sum",
12873
+ "min",
12874
+ "max"
12875
+ ])
12876
+ });
12877
+ /**
12878
+ * `COUNT(*)` plus one number per requested field.
12879
+ *
12880
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
12881
+ * that really is 0 are different facts, and an accounting caller that renders
12882
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
12883
+ */
12884
+ var AggregateResultSchema = object({
12885
+ count: number().int(),
12886
+ values: record(string(), number().nullable())
12887
+ });
12503
12888
  /** A single stored record: `{ id, data }`. */
12504
12889
  var SettingsRecordSchema = object({
12505
12890
  id: string(),
@@ -12584,6 +12969,11 @@ method(object({
12584
12969
  collection: string(),
12585
12970
  filter: QueryFilterSchema.optional()
12586
12971
  }), number()), method(object({
12972
+ namespace: string().optional(),
12973
+ collection: string(),
12974
+ fields: array(AggregateFieldSchema).readonly(),
12975
+ filter: QueryFilterSchema.optional()
12976
+ }), AggregateResultSchema), method(object({
12587
12977
  namespace: string().optional(),
12588
12978
  collection: string(),
12589
12979
  field: string(),
@@ -12700,6 +13090,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12700
13090
  collection: string(),
12701
13091
  filter: QueryFilterSchema.optional()
12702
13092
  }), number(), { auth: "admin" }), method(object({
13093
+ namespace: string().optional(),
13094
+ collection: string(),
13095
+ fields: array(AggregateFieldSchema).readonly(),
13096
+ filter: QueryFilterSchema.optional()
13097
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
12703
13098
  namespace: string().optional(),
12704
13099
  collection: string(),
12705
13100
  field: string(),
@@ -13292,24 +13687,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
13292
13687
  kind: "mutation",
13293
13688
  auth: "admin"
13294
13689
  });
13295
- /**
13296
- * Device Manager capability — hub-side singleton that unifies device persistence,
13297
- * live registry access, and all management operations into a single tRPC surface.
13298
- *
13299
- * Replaces:
13300
- * - `device-persistence` capability (persistence methods absorbed here)
13301
- * - `device-management.router.ts` (deleted in Phase 2)
13302
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
13303
- *
13304
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
13305
- * fork into separate processes but never run on remote cluster agents. Therefore:
13306
- * - No nodeId routing needed — this is a pure hub singleton.
13307
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
13308
- * - No shadow registry or cross-node aggregation required.
13309
- *
13310
- * Forked workers register devices back to the hub via `ctx.devices`
13311
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
13312
- */
13313
13690
  /** One child-placement directive on a container's `childLayout`. Structurally
13314
13691
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
13315
13692
  * shape for the same field. The child is identified by its re-sync-stable
@@ -13678,7 +14055,7 @@ method(object({
13678
14055
  * it answers today and the caller filters as it already does.
13679
14056
  */
13680
14057
  deviceIds: array(number()).optional()
13681
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
14058
+ }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ parentDeviceIds: array(number()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number() }), object({
13682
14059
  mode: LinkedDevicesModeSchema,
13683
14060
  devices: array(LinkedDeviceSchema)
13684
14061
  })), method(object({ deviceIds: array(number()) }), array(LinkedDevicesForDeviceSchema)), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
@@ -14402,6 +14779,80 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14402
14779
  kind: "mutation",
14403
14780
  auth: "admin"
14404
14781
  });
14782
+ /**
14783
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
14784
+ * through. It stores nothing.
14785
+ *
14786
+ * ## Why a capability at all, and why this shape
14787
+ *
14788
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
14789
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
14790
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
14791
+ * fails, an operator just never sees the channel somebody added. So the list
14792
+ * is assembled from declarations at runtime.
14793
+ *
14794
+ * The shape is copied from `log-destination.cap.ts`, which already does
14795
+ * exactly this job: `mode: 'collection'`, `internal: true`,
14796
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
14797
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
14798
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
14799
+ * runner's declarations reach hub-main over the transport that already exists.
14800
+ * No new UDS message, no second registry.
14801
+ *
14802
+ * ## What it deliberately does NOT own
14803
+ *
14804
+ * The VALUES — which channel is armed, for which cameras, until when — live in
14805
+ * ONE place: the logging settings document on the `system` cap
14806
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
14807
+ * value is the defect the plan behind this work exists to remove, and
14808
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
14809
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
14810
+ * setter for a window and no persistence of any kind.
14811
+ *
14812
+ * ## Why `apply` is here even so
14813
+ *
14814
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
14815
+ * seam has to carry the value from the authority to the mirror, and a channel
14816
+ * that cannot be reached is precisely the dead knob this whole slice exists to
14817
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
14818
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
14819
+ * persists nothing, it is never the source of a value, and it is called only
14820
+ * with a set the hub actually read (D49 — a read that fails does not call it
14821
+ * at all, so no channel is silently disarmed by a bad read).
14822
+ */
14823
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
14824
+ var LogChannelApplyResultSchema = object({
14825
+ /** How many declared channels are armed in this process after the call. */
14826
+ armed: number().int().min(0),
14827
+ /**
14828
+ * Names the document armed that this process does not declare. Reported
14829
+ * rather than swallowed: a name here is either a typo or an addon that has
14830
+ * not booted, and both deserve a line instead of silence.
14831
+ */
14832
+ unknown: array(string()).readonly()
14833
+ });
14834
+ var logChannelsCapability = {
14835
+ name: "log-channels",
14836
+ scope: "system",
14837
+ mode: "collection",
14838
+ internal: true,
14839
+ methods: {
14840
+ /** The channels this addon declares. Inert: no value, no state. */
14841
+ list: method(_void(), array(LogChannelDescriptorSchema).readonly()),
14842
+ /**
14843
+ * Refresh this process's mirror from the document's FULL set of armed
14844
+ * windows.
14845
+ *
14846
+ * Full and not incremental on purpose: the document is the authority, so a
14847
+ * channel it does not name is disarmed here. An incremental apply would
14848
+ * let a disarm get lost in transit and leave a channel running that
14849
+ * nobody can see is running.
14850
+ */
14851
+ apply: method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" })
14852
+ },
14853
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
14854
+ mount: { kind: "skip" }
14855
+ };
14405
14856
  var LogLevelSchema = _enum([
14406
14857
  "debug",
14407
14858
  "info",
@@ -28816,10 +29267,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28816
29267
  * The layers of the level hierarchy, general → specific. The most specific
28817
29268
  * layer that carries an explicit value wins.
28818
29269
  *
28819
- * `component` is DECLARED and not yet resolvable: the per-component channels
28820
- * are a later slice of the same plan, and a `levelSource` enum that has to
28821
- * grow later would force every consumer of this document to change with it.
28822
- * Nothing returns `component` today.
29270
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29271
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29272
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29273
+ * that turning it on would not force every consumer of this document to widen
29274
+ * a `levelSource` enum — which is what has now not happened.
28823
29275
  */
28824
29276
  var LoggingScopeKindSchema = _enum([
28825
29277
  "cluster",
@@ -28846,6 +29298,14 @@ var LoggingLevelLayerSchema = object({
28846
29298
  scope: LoggingScopeKindSchema,
28847
29299
  /** The node this layer speaks for; `null` on the cluster layer. */
28848
29300
  nodeId: string().nullable(),
29301
+ /**
29302
+ * The declared channel this layer speaks for; `null` on every layer but
29303
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29304
+ * by design — the convention this repo settled on is one orchestrator-wide
29305
+ * setting, never per node (D52) — so a component layer that carried a node
29306
+ * would invite a per-node copy of a value that has no per-node meaning.
29307
+ */
29308
+ component: string().nullable(),
28849
29309
  /** Explicitly set here, or `null` when this layer inherits. */
28850
29310
  level: LogLevelSchema$1.nullable()
28851
29311
  });
@@ -28887,6 +29347,49 @@ var DiagnosticWindowPatchSchema = object({
28887
29347
  reportEveryMs: number().int().positive().optional()
28888
29348
  });
28889
29349
  /**
29350
+ * A channel ARMED, as the document reports it.
29351
+ *
29352
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29353
+ * and the time left, because a diagnostic left running is itself an incident
29354
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29355
+ */
29356
+ var LogChannelWindowStateSchema = object({
29357
+ channel: string(),
29358
+ armed: boolean(),
29359
+ /** Epoch ms the window closes at. 0 when disarmed. */
29360
+ armedUntilMs: number(),
29361
+ /** Ms left before it expires on its own. 0 when disarmed. */
29362
+ remainingMs: number(),
29363
+ /**
29364
+ * The cameras it is narrowed to, or `null` for every camera.
29365
+ *
29366
+ * A channel declared `perDevice: false` can only ever report `null` here:
29367
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29368
+ * produce a filter that silently matches nothing. The server REFUSES such a
29369
+ * patch rather than quietly widening it — ignoring the request would teach
29370
+ * the operator that per-camera filtering works on that channel when it does
29371
+ * not.
29372
+ */
29373
+ deviceIds: array(number().int()).readonly().nullable()
29374
+ });
29375
+ /**
29376
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29377
+ * for the same reason: a channel is a window with a deadline, never a switch.
29378
+ */
29379
+ var LogChannelWindowPatchSchema = object({
29380
+ channel: string().min(1),
29381
+ armMs: number().int().min(0),
29382
+ /**
29383
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29384
+ *
29385
+ * Numeric because the repo's own rule makes it possible: every log line
29386
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29387
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29388
+ * diagnosed by hand, and this is the first thing that collects on it.
29389
+ */
29390
+ deviceIds: array(number().int()).readonly().nullable().optional()
29391
+ });
29392
+ /**
28890
29393
  * A PATCH, and patches MERGE.
28891
29394
  *
28892
29395
  * A field absent from the patch is left exactly as it was — arming a
@@ -28905,7 +29408,14 @@ var LoggingSettingsPatchSchema = object({
28905
29408
  * Only the diagnostics NAMED here change. An armed window that is not listed
28906
29409
  * keeps running — a patch is never a full replacement.
28907
29410
  */
28908
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29411
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29412
+ /**
29413
+ * Only the channels NAMED here change. An armed channel that is not listed
29414
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29415
+ * disarmed the channels it did not mention would make the Levels page and
29416
+ * the Diagnostics page fight over the same value.
29417
+ */
29418
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28909
29419
  });
28910
29420
  /**
28911
29421
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28918,9 +29428,22 @@ var LoggingSettingsPatchSchema = object({
28918
29428
  * authority over the whole hierarchy and answers for every layer, so the
28919
29429
  * layer selector needs a name the transport does not already own.
28920
29430
  */
28921
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29431
+ var GetLoggingSettingsInputSchema = object({
29432
+ scopeNodeId: string().optional(),
29433
+ /**
29434
+ * The declared CHANNEL this document is addressed at, when the caller wants
29435
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29436
+ *
29437
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29438
+ * axes from collapsing: a component level is cluster-wide, a node level is
29439
+ * not, and one selector for both would make "which of these two did I just
29440
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29441
+ */
29442
+ scopeComponent: string().optional()
29443
+ });
28922
29444
  var SetLoggingSettingsInputSchema = object({
28923
29445
  scopeNodeId: string().optional(),
29446
+ scopeComponent: string().optional(),
28924
29447
  patch: LoggingSettingsPatchSchema
28925
29448
  });
28926
29449
  /**
@@ -28935,9 +29458,20 @@ var SetLoggingSettingsInputSchema = object({
28935
29458
  var LoggingSettingsStateSchema = object({
28936
29459
  /** The layer this document was read at. `null` = the cluster layer. */
28937
29460
  scopeNodeId: string().nullable(),
29461
+ /** The channel this document was read at. `null` = no component layer. */
29462
+ scopeComponent: string().nullable(),
28938
29463
  effective: LoggingEffectiveSchema,
28939
29464
  explicit: LoggingExplicitSchema,
28940
29465
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29466
+ /**
29467
+ * Every channel the cluster's addons DECLARE, gathered from the
29468
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29469
+ * channel added by a redeployed addon appears without anybody editing a
29470
+ * list, and a channel whose addon is gone stops being offered.
29471
+ */
29472
+ channels: array(LogChannelDescriptorSchema).readonly(),
29473
+ /** The channels ARMED right now, each with its deadline. */
29474
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28941
29475
  persisted: boolean()
28942
29476
  });
28943
29477
  method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
@@ -30673,6 +31207,12 @@ Object.freeze({
30673
31207
  addonId: null,
30674
31208
  access: "view"
30675
31209
  },
31210
+ "dataStoreProvider.aggregate": {
31211
+ capName: "data-store-provider",
31212
+ capScope: "system",
31213
+ addonId: null,
31214
+ access: "view"
31215
+ },
30676
31216
  "dataStoreProvider.count": {
30677
31217
  capName: "data-store-provider",
30678
31218
  capScope: "system",
@@ -31087,6 +31627,12 @@ Object.freeze({
31087
31627
  addonId: null,
31088
31628
  access: "view"
31089
31629
  },
31630
+ "deviceManager.getChildrenBatch": {
31631
+ capName: "device-manager",
31632
+ capScope: "system",
31633
+ addonId: null,
31634
+ access: "view"
31635
+ },
31090
31636
  "deviceManager.getConfigSchema": {
31091
31637
  capName: "device-manager",
31092
31638
  capScope: "system",
@@ -32137,6 +32683,18 @@ Object.freeze({
32137
32683
  addonId: null,
32138
32684
  access: "create"
32139
32685
  },
32686
+ "logChannels.apply": {
32687
+ capName: "log-channels",
32688
+ capScope: "system",
32689
+ addonId: null,
32690
+ access: "create"
32691
+ },
32692
+ "logChannels.list": {
32693
+ capName: "log-channels",
32694
+ capScope: "system",
32695
+ addonId: null,
32696
+ access: "view"
32697
+ },
32140
32698
  "logDestination.query": {
32141
32699
  capName: "log-destination",
32142
32700
  capScope: "system",
@@ -34291,6 +34849,12 @@ Object.freeze({
34291
34849
  addonId: null,
34292
34850
  access: "create"
34293
34851
  },
34852
+ "settingsStore.aggregate": {
34853
+ capName: "settings-store",
34854
+ capScope: "system",
34855
+ addonId: null,
34856
+ access: "view"
34857
+ },
34294
34858
  "settingsStore.count": {
34295
34859
  capName: "settings-store",
34296
34860
  capScope: "system",
@@ -35870,6 +36434,11 @@ Object.freeze({
35870
36434
  form: "single",
35871
36435
  optional: false
35872
36436
  }],
36437
+ "deviceManager.getChildrenBatch": [{
36438
+ name: "parentDeviceIds",
36439
+ form: "array",
36440
+ optional: false
36441
+ }],
35873
36442
  "deviceManager.getConfigSchema": [{
35874
36443
  name: "deviceId",
35875
36444
  form: "single",
@@ -39215,12 +39784,24 @@ Object.defineProperty(exports, "createHwAccelCache", {
39215
39784
  return createHwAccelCache;
39216
39785
  }
39217
39786
  });
39787
+ Object.defineProperty(exports, "createLogChannelsProvider", {
39788
+ enumerable: true,
39789
+ get: function() {
39790
+ return createLogChannelsProvider;
39791
+ }
39792
+ });
39218
39793
  Object.defineProperty(exports, "customAction", {
39219
39794
  enumerable: true,
39220
39795
  get: function() {
39221
39796
  return customAction;
39222
39797
  }
39223
39798
  });
39799
+ Object.defineProperty(exports, "declareLogChannel", {
39800
+ enumerable: true,
39801
+ get: function() {
39802
+ return declareLogChannel;
39803
+ }
39804
+ });
39224
39805
  Object.defineProperty(exports, "defaultDeviceFor", {
39225
39806
  enumerable: true,
39226
39807
  get: function() {
@@ -39353,6 +39934,12 @@ Object.defineProperty(exports, "literal", {
39353
39934
  return literal;
39354
39935
  }
39355
39936
  });
39937
+ Object.defineProperty(exports, "logChannelsCapability", {
39938
+ enumerable: true,
39939
+ get: function() {
39940
+ return logChannelsCapability;
39941
+ }
39942
+ });
39356
39943
  Object.defineProperty(exports, "makeProfileBrokerId", {
39357
39944
  enumerable: true,
39358
39945
  get: function() {