@camstack/addon-matter-broker 0.2.31 → 0.2.33

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 (3) hide show
  1. package/dist/addon.js +409 -30
  2. package/dist/addon.mjs +409 -30
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7482,6 +7482,111 @@ var CameraSwitchGroupSchema = object({
7482
7482
  fetchedAt: number()
7483
7483
  });
7484
7484
  /**
7485
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7486
+ * an addon declares its channels in.
7487
+ *
7488
+ * ## Two axes, deliberately separated
7489
+ *
7490
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7491
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7492
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7493
+ * and rots silently. So a channel is declared where it is consulted, and the
7494
+ * `log-channels` capability enumerates the declarations.
7495
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7496
+ * thing: the logging settings document on the `system` cap. Two authorities
7497
+ * over the values is the exact defect
7498
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7499
+ * remove; re-introducing it from the cure side would be grotesque.
7500
+ *
7501
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7502
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7503
+ * the hot path with a value somebody actually read, and by
7504
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7505
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7506
+ * disarmed one (D49).
7507
+ *
7508
+ * ## The canonical call shape
7509
+ *
7510
+ * ```ts
7511
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7512
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7513
+ * }
7514
+ * ```
7515
+ *
7516
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7517
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7518
+ * object literal is never constructed because it lives inside the branch. It
7519
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7520
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7521
+ * destination floor (measured at 1.93 ns/call when off).
7522
+ *
7523
+ * ## Why a channel emits at `info`
7524
+ *
7525
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7526
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7527
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7528
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7529
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7530
+ * emits at the channel's declared level, whose schema floor is `info`.
7531
+ */
7532
+ /**
7533
+ * The level a channel writes at once armed.
7534
+ *
7535
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7536
+ * not leave the process for Loki, and the whole point of arming a channel is
7537
+ * to read it later.
7538
+ */
7539
+ var LogChannelLevelSchema = _enum([
7540
+ "info",
7541
+ "warn",
7542
+ "error"
7543
+ ]);
7544
+ /**
7545
+ * What an addon declares about one channel. No value, no state — a
7546
+ * declaration is inert.
7547
+ */
7548
+ var LogChannelDescriptorSchema = object({
7549
+ /**
7550
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7551
+ * the addon's short name so an operator reading a channel list can tell who
7552
+ * owns it without a second lookup.
7553
+ */
7554
+ name: string$2().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7555
+ /** One sentence: what the operator will SEE after arming it. */
7556
+ description: string$2().min(1),
7557
+ /** The level its lines are emitted at. Never below `info`. */
7558
+ defaultLevel: LogChannelLevelSchema,
7559
+ /**
7560
+ * Whether this channel can be narrowed to a camera.
7561
+ *
7562
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7563
+ * consulted with the numeric device id, AND every line the channel admits
7564
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7565
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7566
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7567
+ * the body is the only way to filter.
7568
+ *
7569
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7570
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7571
+ * the operator narrows to one camera, sees nothing, and concludes the code
7572
+ * path was never taken.
7573
+ */
7574
+ perDevice: boolean()
7575
+ });
7576
+ /**
7577
+ * An armed window over one channel, as the document hands it to a mirror.
7578
+ *
7579
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7580
+ * expires by itself, which is the one failure a boolean cannot avoid.
7581
+ */
7582
+ var LogChannelWindowSchema = object({
7583
+ channel: string$2().min(1),
7584
+ /** Epoch ms the window closes at. */
7585
+ armedUntilMs: number(),
7586
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7587
+ deviceIds: array(number().int()).readonly().nullable()
7588
+ });
7589
+ /**
7485
7590
  * Ops-log — the durable, append-only operations audit shared by the
7486
7591
  * recordings and events management surfaces.
7487
7592
  *
@@ -11151,6 +11256,35 @@ var MutationFilterSchema = object({
11151
11256
  whereBetween: record(string$2(), tuple([unknown(), unknown()])).optional(),
11152
11257
  whereNot: record(string$2(), unknown()).optional()
11153
11258
  });
11259
+ /**
11260
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11261
+ *
11262
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11263
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11264
+ * a `Record<column, op>` shape could not express.
11265
+ */
11266
+ var AggregateFieldSchema = object({
11267
+ /** Result key. */
11268
+ as: string$2().min(1),
11269
+ /** Column to aggregate. Must be a real column of a declared collection. */
11270
+ field: string$2().min(1),
11271
+ op: _enum([
11272
+ "sum",
11273
+ "min",
11274
+ "max"
11275
+ ])
11276
+ });
11277
+ /**
11278
+ * `COUNT(*)` plus one number per requested field.
11279
+ *
11280
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11281
+ * that really is 0 are different facts, and an accounting caller that renders
11282
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11283
+ */
11284
+ var AggregateResultSchema = object({
11285
+ count: number().int(),
11286
+ values: record(string$2(), number().nullable())
11287
+ });
11154
11288
  /** A single stored record: `{ id, data }`. */
11155
11289
  var SettingsRecordSchema = object({
11156
11290
  id: string$2(),
@@ -11235,6 +11369,11 @@ method(object({
11235
11369
  collection: string$2(),
11236
11370
  filter: QueryFilterSchema.optional()
11237
11371
  }), number()), method(object({
11372
+ namespace: string$2().optional(),
11373
+ collection: string$2(),
11374
+ fields: array(AggregateFieldSchema).readonly(),
11375
+ filter: QueryFilterSchema.optional()
11376
+ }), AggregateResultSchema), method(object({
11238
11377
  namespace: string$2().optional(),
11239
11378
  collection: string$2(),
11240
11379
  field: string$2(),
@@ -11351,6 +11490,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11351
11490
  collection: string$2(),
11352
11491
  filter: QueryFilterSchema.optional()
11353
11492
  }), number(), { auth: "admin" }), method(object({
11493
+ namespace: string$2().optional(),
11494
+ collection: string$2(),
11495
+ fields: array(AggregateFieldSchema).readonly(),
11496
+ filter: QueryFilterSchema.optional()
11497
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11354
11498
  namespace: string$2().optional(),
11355
11499
  collection: string$2(),
11356
11500
  field: string$2(),
@@ -12091,24 +12235,6 @@ var deviceProviderCapability = {
12091
12235
  })
12092
12236
  }
12093
12237
  };
12094
- /**
12095
- * Device Manager capability — hub-side singleton that unifies device persistence,
12096
- * live registry access, and all management operations into a single tRPC surface.
12097
- *
12098
- * Replaces:
12099
- * - `device-persistence` capability (persistence methods absorbed here)
12100
- * - `device-management.router.ts` (deleted in Phase 2)
12101
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12102
- *
12103
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12104
- * fork into separate processes but never run on remote cluster agents. Therefore:
12105
- * - No nodeId routing needed — this is a pure hub singleton.
12106
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12107
- * - No shadow registry or cross-node aggregation required.
12108
- *
12109
- * Forked workers register devices back to the hub via `ctx.devices`
12110
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12111
- */
12112
12238
  /** One child-placement directive on a container's `childLayout`. Structurally
12113
12239
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12114
12240
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12477,7 +12603,7 @@ method(object({
12477
12603
  * it answers today and the caller filters as it already does.
12478
12604
  */
12479
12605
  deviceIds: array(number()).optional()
12480
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12606
+ }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ parentDeviceIds: array(number()).max(256) }), record(string$2(), array(DeviceInfoSchema))), method(object({ deviceId: number() }), object({
12481
12607
  mode: LinkedDevicesModeSchema,
12482
12608
  devices: array(LinkedDeviceSchema)
12483
12609
  })), 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({
@@ -13201,6 +13327,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13201
13327
  kind: "mutation",
13202
13328
  auth: "admin"
13203
13329
  });
13330
+ /**
13331
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13332
+ * through. It stores nothing.
13333
+ *
13334
+ * ## Why a capability at all, and why this shape
13335
+ *
13336
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13337
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13338
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13339
+ * fails, an operator just never sees the channel somebody added. So the list
13340
+ * is assembled from declarations at runtime.
13341
+ *
13342
+ * The shape is copied from `log-destination.cap.ts`, which already does
13343
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13344
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13345
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13346
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13347
+ * runner's declarations reach hub-main over the transport that already exists.
13348
+ * No new UDS message, no second registry.
13349
+ *
13350
+ * ## What it deliberately does NOT own
13351
+ *
13352
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13353
+ * ONE place: the logging settings document on the `system` cap
13354
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13355
+ * value is the defect the plan behind this work exists to remove, and
13356
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13357
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13358
+ * setter for a window and no persistence of any kind.
13359
+ *
13360
+ * ## Why `apply` is here even so
13361
+ *
13362
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13363
+ * seam has to carry the value from the authority to the mirror, and a channel
13364
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13365
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13366
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13367
+ * persists nothing, it is never the source of a value, and it is called only
13368
+ * with a set the hub actually read (D49 — a read that fails does not call it
13369
+ * at all, so no channel is silently disarmed by a bad read).
13370
+ */
13371
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13372
+ var LogChannelApplyResultSchema = object({
13373
+ /** How many declared channels are armed in this process after the call. */
13374
+ armed: number().int().min(0),
13375
+ /**
13376
+ * Names the document armed that this process does not declare. Reported
13377
+ * rather than swallowed: a name here is either a typo or an addon that has
13378
+ * not booted, and both deserve a line instead of silence.
13379
+ */
13380
+ unknown: array(string$2()).readonly()
13381
+ });
13382
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13204
13383
  var LogLevelSchema = _enum([
13205
13384
  "debug",
13206
13385
  "info",
@@ -28500,17 +28679,60 @@ var SetSiteLocationInputSchema = object({
28500
28679
  longitude: number().min(-180).max(180)
28501
28680
  }).nullable();
28502
28681
  /**
28503
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28682
+ * The TRANSPORT a call arrived on.
28683
+ *
28684
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28685
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28686
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28687
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28688
+ * checkable rather than asserted.
28689
+ *
28690
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28691
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28692
+ * connection; the viewer talks to the hub over `wsLink`
28693
+ * exclusively, so this is the plane the HTTP census could not see.
28694
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28695
+ * never touches a socket and therefore never touched a census.
28696
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28697
+ * that is exactly what its `0` asserts: every plane the hub has can name
28698
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28699
+ * plane nobody instrumented lands here instead of vanishing from the total.
28700
+ */
28701
+ var TransportPlaneSchema = _enum([
28702
+ "http",
28703
+ "ws",
28704
+ "mesh",
28705
+ "unknown"
28706
+ ]);
28707
+ /**
28708
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28709
+ * reads as "not instrumented", which is the one thing this census must never
28710
+ * make an operator wonder about.
28711
+ */
28712
+ var TransportPlaneCountsSchema = object({
28713
+ http: number(),
28714
+ ws: number(),
28715
+ mesh: number(),
28716
+ unknown: number()
28717
+ });
28718
+ /**
28719
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28504
28720
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28505
28721
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28506
28722
  * already prints - never a token, never an `Authorization` header.
28723
+ *
28724
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28725
+ * and lives for hours, so folding it into a call count makes one long-lived
28726
+ * stream look like a storm.
28507
28727
  */
28508
28728
  var RequestCensusGroupSchema = object({
28729
+ plane: TransportPlaneSchema,
28509
28730
  procedure: string$2(),
28510
28731
  userAgent: string$2(),
28511
28732
  ip: string$2(),
28512
28733
  principal: string$2(),
28513
28734
  calls: number(),
28735
+ subscriptions: number(),
28514
28736
  perMin: number()
28515
28737
  });
28516
28738
  /**
@@ -28523,6 +28745,14 @@ var RequestCensusGroupSchema = object({
28523
28745
  var RequestCensusProcedureSchema = object({
28524
28746
  procedure: string$2(),
28525
28747
  calls: number(),
28748
+ /**
28749
+ * The same total, split by transport. THIS is the row that answers the
28750
+ * question the census exists for: one look at `deviceManager.listAll` says
28751
+ * which plane carried the 4 960, without joining two log lines by eye.
28752
+ */
28753
+ planes: TransportPlaneCountsSchema,
28754
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28755
+ subscriptions: number(),
28526
28756
  perMin: number()
28527
28757
  });
28528
28758
  /**
@@ -28550,14 +28780,45 @@ var RequestCensusStatusSchema = object({
28550
28780
  */
28551
28781
  procedureCalls: number(),
28552
28782
  /**
28783
+ * `procedureCalls` split by transport. The four keys sum to
28784
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28785
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28786
+ */
28787
+ planes: TransportPlaneCountsSchema,
28788
+ /**
28789
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28790
+ * on no plane at all - which is a RESULT (a plane is missing from the
28791
+ * instrument), not a failure, and it has to be visible to be read as one.
28792
+ */
28793
+ planesExplainTotal: boolean(),
28794
+ /**
28553
28795
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28554
- * transport resolves one context per connection - but the number that says
28555
- * whether a plane this census cannot see was busy while HTTP was quiet.
28796
+ * adapter resolves one context per connection - kept because a plane's call
28797
+ * count of zero against 37 open connections says something different from a
28798
+ * plane with no connections at all.
28556
28799
  */
28557
28800
  wsConnections: number(),
28801
+ /**
28802
+ * Client frames the WS plane looked at. `wsMessages` far above
28803
+ * `planes.ws + subscriptions` means most traffic is not operations
28804
+ * (keepalives, connection params) - which is itself an answer.
28805
+ */
28806
+ wsMessages: number(),
28807
+ /**
28808
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28809
+ * purpose: one live-events stream opened at boot and held for six hours is
28810
+ * one subscription, and counting it as a call would let a quiet plane
28811
+ * masquerade as the storm.
28812
+ */
28813
+ subscriptions: number(),
28814
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28815
+ subscriptionStops: number(),
28558
28816
  distinctGroups: number(),
28559
- /** Calls counted in the totals whose group attribution was shed at the
28560
- * cardinality bound. */
28817
+ /**
28818
+ * Operations counted in the totals whose CALLER attribution was shed at the
28819
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28820
+ * which transport they arrived on, they just lost their group row.
28821
+ */
28561
28822
  unattributedCalls: number(),
28562
28823
  procedures: array(RequestCensusProcedureSchema).readonly(),
28563
28824
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28580,10 +28841,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28580
28841
  * The layers of the level hierarchy, general → specific. The most specific
28581
28842
  * layer that carries an explicit value wins.
28582
28843
  *
28583
- * `component` is DECLARED and not yet resolvable: the per-component channels
28584
- * are a later slice of the same plan, and a `levelSource` enum that has to
28585
- * grow later would force every consumer of this document to change with it.
28586
- * Nothing returns `component` today.
28844
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28845
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28846
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28847
+ * that turning it on would not force every consumer of this document to widen
28848
+ * a `levelSource` enum — which is what has now not happened.
28587
28849
  */
28588
28850
  var LoggingScopeKindSchema = _enum([
28589
28851
  "cluster",
@@ -28610,6 +28872,14 @@ var LoggingLevelLayerSchema = object({
28610
28872
  scope: LoggingScopeKindSchema,
28611
28873
  /** The node this layer speaks for; `null` on the cluster layer. */
28612
28874
  nodeId: string$2().nullable(),
28875
+ /**
28876
+ * The declared channel this layer speaks for; `null` on every layer but
28877
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28878
+ * by design — the convention this repo settled on is one orchestrator-wide
28879
+ * setting, never per node (D52) — so a component layer that carried a node
28880
+ * would invite a per-node copy of a value that has no per-node meaning.
28881
+ */
28882
+ component: string$2().nullable(),
28613
28883
  /** Explicitly set here, or `null` when this layer inherits. */
28614
28884
  level: LogLevelSchema$1.nullable()
28615
28885
  });
@@ -28651,6 +28921,49 @@ var DiagnosticWindowPatchSchema = object({
28651
28921
  reportEveryMs: number().int().positive().optional()
28652
28922
  });
28653
28923
  /**
28924
+ * A channel ARMED, as the document reports it.
28925
+ *
28926
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28927
+ * and the time left, because a diagnostic left running is itself an incident
28928
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28929
+ */
28930
+ var LogChannelWindowStateSchema = object({
28931
+ channel: string$2(),
28932
+ armed: boolean(),
28933
+ /** Epoch ms the window closes at. 0 when disarmed. */
28934
+ armedUntilMs: number(),
28935
+ /** Ms left before it expires on its own. 0 when disarmed. */
28936
+ remainingMs: number(),
28937
+ /**
28938
+ * The cameras it is narrowed to, or `null` for every camera.
28939
+ *
28940
+ * A channel declared `perDevice: false` can only ever report `null` here:
28941
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28942
+ * produce a filter that silently matches nothing. The server REFUSES such a
28943
+ * patch rather than quietly widening it — ignoring the request would teach
28944
+ * the operator that per-camera filtering works on that channel when it does
28945
+ * not.
28946
+ */
28947
+ deviceIds: array(number().int()).readonly().nullable()
28948
+ });
28949
+ /**
28950
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28951
+ * for the same reason: a channel is a window with a deadline, never a switch.
28952
+ */
28953
+ var LogChannelWindowPatchSchema = object({
28954
+ channel: string$2().min(1),
28955
+ armMs: number().int().min(0),
28956
+ /**
28957
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
28958
+ *
28959
+ * Numeric because the repo's own rule makes it possible: every log line
28960
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
28961
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
28962
+ * diagnosed by hand, and this is the first thing that collects on it.
28963
+ */
28964
+ deviceIds: array(number().int()).readonly().nullable().optional()
28965
+ });
28966
+ /**
28654
28967
  * A PATCH, and patches MERGE.
28655
28968
  *
28656
28969
  * A field absent from the patch is left exactly as it was — arming a
@@ -28669,7 +28982,14 @@ var LoggingSettingsPatchSchema = object({
28669
28982
  * Only the diagnostics NAMED here change. An armed window that is not listed
28670
28983
  * keeps running — a patch is never a full replacement.
28671
28984
  */
28672
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28985
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
28986
+ /**
28987
+ * Only the channels NAMED here change. An armed channel that is not listed
28988
+ * keeps running — same rule as `diagnostics`, because a patch that silently
28989
+ * disarmed the channels it did not mention would make the Levels page and
28990
+ * the Diagnostics page fight over the same value.
28991
+ */
28992
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28673
28993
  });
28674
28994
  /**
28675
28995
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28682,9 +29002,22 @@ var LoggingSettingsPatchSchema = object({
28682
29002
  * authority over the whole hierarchy and answers for every layer, so the
28683
29003
  * layer selector needs a name the transport does not already own.
28684
29004
  */
28685
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string$2().optional() });
29005
+ var GetLoggingSettingsInputSchema = object({
29006
+ scopeNodeId: string$2().optional(),
29007
+ /**
29008
+ * The declared CHANNEL this document is addressed at, when the caller wants
29009
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29010
+ *
29011
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29012
+ * axes from collapsing: a component level is cluster-wide, a node level is
29013
+ * not, and one selector for both would make "which of these two did I just
29014
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29015
+ */
29016
+ scopeComponent: string$2().optional()
29017
+ });
28686
29018
  var SetLoggingSettingsInputSchema = object({
28687
29019
  scopeNodeId: string$2().optional(),
29020
+ scopeComponent: string$2().optional(),
28688
29021
  patch: LoggingSettingsPatchSchema
28689
29022
  });
28690
29023
  /**
@@ -28699,9 +29032,20 @@ var SetLoggingSettingsInputSchema = object({
28699
29032
  var LoggingSettingsStateSchema = object({
28700
29033
  /** The layer this document was read at. `null` = the cluster layer. */
28701
29034
  scopeNodeId: string$2().nullable(),
29035
+ /** The channel this document was read at. `null` = no component layer. */
29036
+ scopeComponent: string$2().nullable(),
28702
29037
  effective: LoggingEffectiveSchema,
28703
29038
  explicit: LoggingExplicitSchema,
28704
29039
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29040
+ /**
29041
+ * Every channel the cluster's addons DECLARE, gathered from the
29042
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29043
+ * channel added by a redeployed addon appears without anybody editing a
29044
+ * list, and a channel whose addon is gone stops being offered.
29045
+ */
29046
+ channels: array(LogChannelDescriptorSchema).readonly(),
29047
+ /** The channels ARMED right now, each with its deadline. */
29048
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28705
29049
  persisted: boolean()
28706
29050
  });
28707
29051
  method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string$2(), unknown()), _null(), {
@@ -31686,6 +32030,12 @@ Object.freeze({
31686
32030
  addonId: null,
31687
32031
  access: "view"
31688
32032
  },
32033
+ "dataStoreProvider.aggregate": {
32034
+ capName: "data-store-provider",
32035
+ capScope: "system",
32036
+ addonId: null,
32037
+ access: "view"
32038
+ },
31689
32039
  "dataStoreProvider.count": {
31690
32040
  capName: "data-store-provider",
31691
32041
  capScope: "system",
@@ -32100,6 +32450,12 @@ Object.freeze({
32100
32450
  addonId: null,
32101
32451
  access: "view"
32102
32452
  },
32453
+ "deviceManager.getChildrenBatch": {
32454
+ capName: "device-manager",
32455
+ capScope: "system",
32456
+ addonId: null,
32457
+ access: "view"
32458
+ },
32103
32459
  "deviceManager.getConfigSchema": {
32104
32460
  capName: "device-manager",
32105
32461
  capScope: "system",
@@ -33150,6 +33506,18 @@ Object.freeze({
33150
33506
  addonId: null,
33151
33507
  access: "create"
33152
33508
  },
33509
+ "logChannels.apply": {
33510
+ capName: "log-channels",
33511
+ capScope: "system",
33512
+ addonId: null,
33513
+ access: "create"
33514
+ },
33515
+ "logChannels.list": {
33516
+ capName: "log-channels",
33517
+ capScope: "system",
33518
+ addonId: null,
33519
+ access: "view"
33520
+ },
33153
33521
  "logDestination.query": {
33154
33522
  capName: "log-destination",
33155
33523
  capScope: "system",
@@ -35304,6 +35672,12 @@ Object.freeze({
35304
35672
  addonId: null,
35305
35673
  access: "create"
35306
35674
  },
35675
+ "settingsStore.aggregate": {
35676
+ capName: "settings-store",
35677
+ capScope: "system",
35678
+ addonId: null,
35679
+ access: "view"
35680
+ },
35307
35681
  "settingsStore.count": {
35308
35682
  capName: "settings-store",
35309
35683
  capScope: "system",
@@ -36883,6 +37257,11 @@ Object.freeze({
36883
37257
  form: "single",
36884
37258
  optional: false
36885
37259
  }],
37260
+ "deviceManager.getChildrenBatch": [{
37261
+ name: "parentDeviceIds",
37262
+ form: "array",
37263
+ optional: false
37264
+ }],
36886
37265
  "deviceManager.getConfigSchema": [{
36887
37266
  name: "deviceId",
36888
37267
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7480,6 +7480,111 @@ var CameraSwitchGroupSchema = object({
7480
7480
  fetchedAt: number()
7481
7481
  });
7482
7482
  /**
7483
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7484
+ * an addon declares its channels in.
7485
+ *
7486
+ * ## Two axes, deliberately separated
7487
+ *
7488
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7489
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7490
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7491
+ * and rots silently. So a channel is declared where it is consulted, and the
7492
+ * `log-channels` capability enumerates the declarations.
7493
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7494
+ * thing: the logging settings document on the `system` cap. Two authorities
7495
+ * over the values is the exact defect
7496
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7497
+ * remove; re-introducing it from the cure side would be grotesque.
7498
+ *
7499
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7500
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7501
+ * the hot path with a value somebody actually read, and by
7502
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7503
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7504
+ * disarmed one (D49).
7505
+ *
7506
+ * ## The canonical call shape
7507
+ *
7508
+ * ```ts
7509
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7510
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7511
+ * }
7512
+ * ```
7513
+ *
7514
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7515
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7516
+ * object literal is never constructed because it lives inside the branch. It
7517
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7518
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7519
+ * destination floor (measured at 1.93 ns/call when off).
7520
+ *
7521
+ * ## Why a channel emits at `info`
7522
+ *
7523
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7524
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7525
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7526
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7527
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7528
+ * emits at the channel's declared level, whose schema floor is `info`.
7529
+ */
7530
+ /**
7531
+ * The level a channel writes at once armed.
7532
+ *
7533
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7534
+ * not leave the process for Loki, and the whole point of arming a channel is
7535
+ * to read it later.
7536
+ */
7537
+ var LogChannelLevelSchema = _enum([
7538
+ "info",
7539
+ "warn",
7540
+ "error"
7541
+ ]);
7542
+ /**
7543
+ * What an addon declares about one channel. No value, no state — a
7544
+ * declaration is inert.
7545
+ */
7546
+ var LogChannelDescriptorSchema = object({
7547
+ /**
7548
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7549
+ * the addon's short name so an operator reading a channel list can tell who
7550
+ * owns it without a second lookup.
7551
+ */
7552
+ name: string$2().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7553
+ /** One sentence: what the operator will SEE after arming it. */
7554
+ description: string$2().min(1),
7555
+ /** The level its lines are emitted at. Never below `info`. */
7556
+ defaultLevel: LogChannelLevelSchema,
7557
+ /**
7558
+ * Whether this channel can be narrowed to a camera.
7559
+ *
7560
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7561
+ * consulted with the numeric device id, AND every line the channel admits
7562
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7563
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7564
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7565
+ * the body is the only way to filter.
7566
+ *
7567
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7568
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7569
+ * the operator narrows to one camera, sees nothing, and concludes the code
7570
+ * path was never taken.
7571
+ */
7572
+ perDevice: boolean()
7573
+ });
7574
+ /**
7575
+ * An armed window over one channel, as the document hands it to a mirror.
7576
+ *
7577
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7578
+ * expires by itself, which is the one failure a boolean cannot avoid.
7579
+ */
7580
+ var LogChannelWindowSchema = object({
7581
+ channel: string$2().min(1),
7582
+ /** Epoch ms the window closes at. */
7583
+ armedUntilMs: number(),
7584
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7585
+ deviceIds: array(number().int()).readonly().nullable()
7586
+ });
7587
+ /**
7483
7588
  * Ops-log — the durable, append-only operations audit shared by the
7484
7589
  * recordings and events management surfaces.
7485
7590
  *
@@ -11149,6 +11254,35 @@ var MutationFilterSchema = object({
11149
11254
  whereBetween: record(string$2(), tuple([unknown(), unknown()])).optional(),
11150
11255
  whereNot: record(string$2(), unknown()).optional()
11151
11256
  });
11257
+ /**
11258
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11259
+ *
11260
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11261
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11262
+ * a `Record<column, op>` shape could not express.
11263
+ */
11264
+ var AggregateFieldSchema = object({
11265
+ /** Result key. */
11266
+ as: string$2().min(1),
11267
+ /** Column to aggregate. Must be a real column of a declared collection. */
11268
+ field: string$2().min(1),
11269
+ op: _enum([
11270
+ "sum",
11271
+ "min",
11272
+ "max"
11273
+ ])
11274
+ });
11275
+ /**
11276
+ * `COUNT(*)` plus one number per requested field.
11277
+ *
11278
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11279
+ * that really is 0 are different facts, and an accounting caller that renders
11280
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11281
+ */
11282
+ var AggregateResultSchema = object({
11283
+ count: number().int(),
11284
+ values: record(string$2(), number().nullable())
11285
+ });
11152
11286
  /** A single stored record: `{ id, data }`. */
11153
11287
  var SettingsRecordSchema = object({
11154
11288
  id: string$2(),
@@ -11233,6 +11367,11 @@ method(object({
11233
11367
  collection: string$2(),
11234
11368
  filter: QueryFilterSchema.optional()
11235
11369
  }), number()), method(object({
11370
+ namespace: string$2().optional(),
11371
+ collection: string$2(),
11372
+ fields: array(AggregateFieldSchema).readonly(),
11373
+ filter: QueryFilterSchema.optional()
11374
+ }), AggregateResultSchema), method(object({
11236
11375
  namespace: string$2().optional(),
11237
11376
  collection: string$2(),
11238
11377
  field: string$2(),
@@ -11349,6 +11488,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11349
11488
  collection: string$2(),
11350
11489
  filter: QueryFilterSchema.optional()
11351
11490
  }), number(), { auth: "admin" }), method(object({
11491
+ namespace: string$2().optional(),
11492
+ collection: string$2(),
11493
+ fields: array(AggregateFieldSchema).readonly(),
11494
+ filter: QueryFilterSchema.optional()
11495
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11352
11496
  namespace: string$2().optional(),
11353
11497
  collection: string$2(),
11354
11498
  field: string$2(),
@@ -12089,24 +12233,6 @@ var deviceProviderCapability = {
12089
12233
  })
12090
12234
  }
12091
12235
  };
12092
- /**
12093
- * Device Manager capability — hub-side singleton that unifies device persistence,
12094
- * live registry access, and all management operations into a single tRPC surface.
12095
- *
12096
- * Replaces:
12097
- * - `device-persistence` capability (persistence methods absorbed here)
12098
- * - `device-management.router.ts` (deleted in Phase 2)
12099
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12100
- *
12101
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12102
- * fork into separate processes but never run on remote cluster agents. Therefore:
12103
- * - No nodeId routing needed — this is a pure hub singleton.
12104
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12105
- * - No shadow registry or cross-node aggregation required.
12106
- *
12107
- * Forked workers register devices back to the hub via `ctx.devices`
12108
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12109
- */
12110
12236
  /** One child-placement directive on a container's `childLayout`. Structurally
12111
12237
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12112
12238
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12475,7 +12601,7 @@ method(object({
12475
12601
  * it answers today and the caller filters as it already does.
12476
12602
  */
12477
12603
  deviceIds: array(number()).optional()
12478
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12604
+ }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ parentDeviceIds: array(number()).max(256) }), record(string$2(), array(DeviceInfoSchema))), method(object({ deviceId: number() }), object({
12479
12605
  mode: LinkedDevicesModeSchema,
12480
12606
  devices: array(LinkedDeviceSchema)
12481
12607
  })), 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({
@@ -13199,6 +13325,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13199
13325
  kind: "mutation",
13200
13326
  auth: "admin"
13201
13327
  });
13328
+ /**
13329
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13330
+ * through. It stores nothing.
13331
+ *
13332
+ * ## Why a capability at all, and why this shape
13333
+ *
13334
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13335
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13336
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13337
+ * fails, an operator just never sees the channel somebody added. So the list
13338
+ * is assembled from declarations at runtime.
13339
+ *
13340
+ * The shape is copied from `log-destination.cap.ts`, which already does
13341
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13342
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13343
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13344
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13345
+ * runner's declarations reach hub-main over the transport that already exists.
13346
+ * No new UDS message, no second registry.
13347
+ *
13348
+ * ## What it deliberately does NOT own
13349
+ *
13350
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13351
+ * ONE place: the logging settings document on the `system` cap
13352
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13353
+ * value is the defect the plan behind this work exists to remove, and
13354
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13355
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13356
+ * setter for a window and no persistence of any kind.
13357
+ *
13358
+ * ## Why `apply` is here even so
13359
+ *
13360
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13361
+ * seam has to carry the value from the authority to the mirror, and a channel
13362
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13363
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13364
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13365
+ * persists nothing, it is never the source of a value, and it is called only
13366
+ * with a set the hub actually read (D49 — a read that fails does not call it
13367
+ * at all, so no channel is silently disarmed by a bad read).
13368
+ */
13369
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13370
+ var LogChannelApplyResultSchema = object({
13371
+ /** How many declared channels are armed in this process after the call. */
13372
+ armed: number().int().min(0),
13373
+ /**
13374
+ * Names the document armed that this process does not declare. Reported
13375
+ * rather than swallowed: a name here is either a typo or an addon that has
13376
+ * not booted, and both deserve a line instead of silence.
13377
+ */
13378
+ unknown: array(string$2()).readonly()
13379
+ });
13380
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13202
13381
  var LogLevelSchema = _enum([
13203
13382
  "debug",
13204
13383
  "info",
@@ -28498,17 +28677,60 @@ var SetSiteLocationInputSchema = object({
28498
28677
  longitude: number().min(-180).max(180)
28499
28678
  }).nullable();
28500
28679
  /**
28501
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28680
+ * The TRANSPORT a call arrived on.
28681
+ *
28682
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28683
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28684
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28685
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28686
+ * checkable rather than asserted.
28687
+ *
28688
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28689
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28690
+ * connection; the viewer talks to the hub over `wsLink`
28691
+ * exclusively, so this is the plane the HTTP census could not see.
28692
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28693
+ * never touches a socket and therefore never touched a census.
28694
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28695
+ * that is exactly what its `0` asserts: every plane the hub has can name
28696
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28697
+ * plane nobody instrumented lands here instead of vanishing from the total.
28698
+ */
28699
+ var TransportPlaneSchema = _enum([
28700
+ "http",
28701
+ "ws",
28702
+ "mesh",
28703
+ "unknown"
28704
+ ]);
28705
+ /**
28706
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28707
+ * reads as "not instrumented", which is the one thing this census must never
28708
+ * make an operator wonder about.
28709
+ */
28710
+ var TransportPlaneCountsSchema = object({
28711
+ http: number(),
28712
+ ws: number(),
28713
+ mesh: number(),
28714
+ unknown: number()
28715
+ });
28716
+ /**
28717
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28502
28718
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28503
28719
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28504
28720
  * already prints - never a token, never an `Authorization` header.
28721
+ *
28722
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28723
+ * and lives for hours, so folding it into a call count makes one long-lived
28724
+ * stream look like a storm.
28505
28725
  */
28506
28726
  var RequestCensusGroupSchema = object({
28727
+ plane: TransportPlaneSchema,
28507
28728
  procedure: string$2(),
28508
28729
  userAgent: string$2(),
28509
28730
  ip: string$2(),
28510
28731
  principal: string$2(),
28511
28732
  calls: number(),
28733
+ subscriptions: number(),
28512
28734
  perMin: number()
28513
28735
  });
28514
28736
  /**
@@ -28521,6 +28743,14 @@ var RequestCensusGroupSchema = object({
28521
28743
  var RequestCensusProcedureSchema = object({
28522
28744
  procedure: string$2(),
28523
28745
  calls: number(),
28746
+ /**
28747
+ * The same total, split by transport. THIS is the row that answers the
28748
+ * question the census exists for: one look at `deviceManager.listAll` says
28749
+ * which plane carried the 4 960, without joining two log lines by eye.
28750
+ */
28751
+ planes: TransportPlaneCountsSchema,
28752
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28753
+ subscriptions: number(),
28524
28754
  perMin: number()
28525
28755
  });
28526
28756
  /**
@@ -28548,14 +28778,45 @@ var RequestCensusStatusSchema = object({
28548
28778
  */
28549
28779
  procedureCalls: number(),
28550
28780
  /**
28781
+ * `procedureCalls` split by transport. The four keys sum to
28782
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28783
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28784
+ */
28785
+ planes: TransportPlaneCountsSchema,
28786
+ /**
28787
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28788
+ * on no plane at all - which is a RESULT (a plane is missing from the
28789
+ * instrument), not a failure, and it has to be visible to be read as one.
28790
+ */
28791
+ planesExplainTotal: boolean(),
28792
+ /**
28551
28793
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28552
- * transport resolves one context per connection - but the number that says
28553
- * whether a plane this census cannot see was busy while HTTP was quiet.
28794
+ * adapter resolves one context per connection - kept because a plane's call
28795
+ * count of zero against 37 open connections says something different from a
28796
+ * plane with no connections at all.
28554
28797
  */
28555
28798
  wsConnections: number(),
28799
+ /**
28800
+ * Client frames the WS plane looked at. `wsMessages` far above
28801
+ * `planes.ws + subscriptions` means most traffic is not operations
28802
+ * (keepalives, connection params) - which is itself an answer.
28803
+ */
28804
+ wsMessages: number(),
28805
+ /**
28806
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28807
+ * purpose: one live-events stream opened at boot and held for six hours is
28808
+ * one subscription, and counting it as a call would let a quiet plane
28809
+ * masquerade as the storm.
28810
+ */
28811
+ subscriptions: number(),
28812
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28813
+ subscriptionStops: number(),
28556
28814
  distinctGroups: number(),
28557
- /** Calls counted in the totals whose group attribution was shed at the
28558
- * cardinality bound. */
28815
+ /**
28816
+ * Operations counted in the totals whose CALLER attribution was shed at the
28817
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28818
+ * which transport they arrived on, they just lost their group row.
28819
+ */
28559
28820
  unattributedCalls: number(),
28560
28821
  procedures: array(RequestCensusProcedureSchema).readonly(),
28561
28822
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28578,10 +28839,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28578
28839
  * The layers of the level hierarchy, general → specific. The most specific
28579
28840
  * layer that carries an explicit value wins.
28580
28841
  *
28581
- * `component` is DECLARED and not yet resolvable: the per-component channels
28582
- * are a later slice of the same plan, and a `levelSource` enum that has to
28583
- * grow later would force every consumer of this document to change with it.
28584
- * Nothing returns `component` today.
28842
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28843
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28844
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28845
+ * that turning it on would not force every consumer of this document to widen
28846
+ * a `levelSource` enum — which is what has now not happened.
28585
28847
  */
28586
28848
  var LoggingScopeKindSchema = _enum([
28587
28849
  "cluster",
@@ -28608,6 +28870,14 @@ var LoggingLevelLayerSchema = object({
28608
28870
  scope: LoggingScopeKindSchema,
28609
28871
  /** The node this layer speaks for; `null` on the cluster layer. */
28610
28872
  nodeId: string$2().nullable(),
28873
+ /**
28874
+ * The declared channel this layer speaks for; `null` on every layer but
28875
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28876
+ * by design — the convention this repo settled on is one orchestrator-wide
28877
+ * setting, never per node (D52) — so a component layer that carried a node
28878
+ * would invite a per-node copy of a value that has no per-node meaning.
28879
+ */
28880
+ component: string$2().nullable(),
28611
28881
  /** Explicitly set here, or `null` when this layer inherits. */
28612
28882
  level: LogLevelSchema$1.nullable()
28613
28883
  });
@@ -28649,6 +28919,49 @@ var DiagnosticWindowPatchSchema = object({
28649
28919
  reportEveryMs: number().int().positive().optional()
28650
28920
  });
28651
28921
  /**
28922
+ * A channel ARMED, as the document reports it.
28923
+ *
28924
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28925
+ * and the time left, because a diagnostic left running is itself an incident
28926
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28927
+ */
28928
+ var LogChannelWindowStateSchema = object({
28929
+ channel: string$2(),
28930
+ armed: boolean(),
28931
+ /** Epoch ms the window closes at. 0 when disarmed. */
28932
+ armedUntilMs: number(),
28933
+ /** Ms left before it expires on its own. 0 when disarmed. */
28934
+ remainingMs: number(),
28935
+ /**
28936
+ * The cameras it is narrowed to, or `null` for every camera.
28937
+ *
28938
+ * A channel declared `perDevice: false` can only ever report `null` here:
28939
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28940
+ * produce a filter that silently matches nothing. The server REFUSES such a
28941
+ * patch rather than quietly widening it — ignoring the request would teach
28942
+ * the operator that per-camera filtering works on that channel when it does
28943
+ * not.
28944
+ */
28945
+ deviceIds: array(number().int()).readonly().nullable()
28946
+ });
28947
+ /**
28948
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28949
+ * for the same reason: a channel is a window with a deadline, never a switch.
28950
+ */
28951
+ var LogChannelWindowPatchSchema = object({
28952
+ channel: string$2().min(1),
28953
+ armMs: number().int().min(0),
28954
+ /**
28955
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
28956
+ *
28957
+ * Numeric because the repo's own rule makes it possible: every log line
28958
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
28959
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
28960
+ * diagnosed by hand, and this is the first thing that collects on it.
28961
+ */
28962
+ deviceIds: array(number().int()).readonly().nullable().optional()
28963
+ });
28964
+ /**
28652
28965
  * A PATCH, and patches MERGE.
28653
28966
  *
28654
28967
  * A field absent from the patch is left exactly as it was — arming a
@@ -28667,7 +28980,14 @@ var LoggingSettingsPatchSchema = object({
28667
28980
  * Only the diagnostics NAMED here change. An armed window that is not listed
28668
28981
  * keeps running — a patch is never a full replacement.
28669
28982
  */
28670
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28983
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
28984
+ /**
28985
+ * Only the channels NAMED here change. An armed channel that is not listed
28986
+ * keeps running — same rule as `diagnostics`, because a patch that silently
28987
+ * disarmed the channels it did not mention would make the Levels page and
28988
+ * the Diagnostics page fight over the same value.
28989
+ */
28990
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28671
28991
  });
28672
28992
  /**
28673
28993
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28680,9 +29000,22 @@ var LoggingSettingsPatchSchema = object({
28680
29000
  * authority over the whole hierarchy and answers for every layer, so the
28681
29001
  * layer selector needs a name the transport does not already own.
28682
29002
  */
28683
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string$2().optional() });
29003
+ var GetLoggingSettingsInputSchema = object({
29004
+ scopeNodeId: string$2().optional(),
29005
+ /**
29006
+ * The declared CHANNEL this document is addressed at, when the caller wants
29007
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29008
+ *
29009
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29010
+ * axes from collapsing: a component level is cluster-wide, a node level is
29011
+ * not, and one selector for both would make "which of these two did I just
29012
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29013
+ */
29014
+ scopeComponent: string$2().optional()
29015
+ });
28684
29016
  var SetLoggingSettingsInputSchema = object({
28685
29017
  scopeNodeId: string$2().optional(),
29018
+ scopeComponent: string$2().optional(),
28686
29019
  patch: LoggingSettingsPatchSchema
28687
29020
  });
28688
29021
  /**
@@ -28697,9 +29030,20 @@ var SetLoggingSettingsInputSchema = object({
28697
29030
  var LoggingSettingsStateSchema = object({
28698
29031
  /** The layer this document was read at. `null` = the cluster layer. */
28699
29032
  scopeNodeId: string$2().nullable(),
29033
+ /** The channel this document was read at. `null` = no component layer. */
29034
+ scopeComponent: string$2().nullable(),
28700
29035
  effective: LoggingEffectiveSchema,
28701
29036
  explicit: LoggingExplicitSchema,
28702
29037
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29038
+ /**
29039
+ * Every channel the cluster's addons DECLARE, gathered from the
29040
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29041
+ * channel added by a redeployed addon appears without anybody editing a
29042
+ * list, and a channel whose addon is gone stops being offered.
29043
+ */
29044
+ channels: array(LogChannelDescriptorSchema).readonly(),
29045
+ /** The channels ARMED right now, each with its deadline. */
29046
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28703
29047
  persisted: boolean()
28704
29048
  });
28705
29049
  method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string$2(), unknown()), _null(), {
@@ -31684,6 +32028,12 @@ Object.freeze({
31684
32028
  addonId: null,
31685
32029
  access: "view"
31686
32030
  },
32031
+ "dataStoreProvider.aggregate": {
32032
+ capName: "data-store-provider",
32033
+ capScope: "system",
32034
+ addonId: null,
32035
+ access: "view"
32036
+ },
31687
32037
  "dataStoreProvider.count": {
31688
32038
  capName: "data-store-provider",
31689
32039
  capScope: "system",
@@ -32098,6 +32448,12 @@ Object.freeze({
32098
32448
  addonId: null,
32099
32449
  access: "view"
32100
32450
  },
32451
+ "deviceManager.getChildrenBatch": {
32452
+ capName: "device-manager",
32453
+ capScope: "system",
32454
+ addonId: null,
32455
+ access: "view"
32456
+ },
32101
32457
  "deviceManager.getConfigSchema": {
32102
32458
  capName: "device-manager",
32103
32459
  capScope: "system",
@@ -33148,6 +33504,18 @@ Object.freeze({
33148
33504
  addonId: null,
33149
33505
  access: "create"
33150
33506
  },
33507
+ "logChannels.apply": {
33508
+ capName: "log-channels",
33509
+ capScope: "system",
33510
+ addonId: null,
33511
+ access: "create"
33512
+ },
33513
+ "logChannels.list": {
33514
+ capName: "log-channels",
33515
+ capScope: "system",
33516
+ addonId: null,
33517
+ access: "view"
33518
+ },
33151
33519
  "logDestination.query": {
33152
33520
  capName: "log-destination",
33153
33521
  capScope: "system",
@@ -35302,6 +35670,12 @@ Object.freeze({
35302
35670
  addonId: null,
35303
35671
  access: "create"
35304
35672
  },
35673
+ "settingsStore.aggregate": {
35674
+ capName: "settings-store",
35675
+ capScope: "system",
35676
+ addonId: null,
35677
+ access: "view"
35678
+ },
35305
35679
  "settingsStore.count": {
35306
35680
  capName: "settings-store",
35307
35681
  capScope: "system",
@@ -36881,6 +37255,11 @@ Object.freeze({
36881
37255
  form: "single",
36882
37256
  optional: false
36883
37257
  }],
37258
+ "deviceManager.getChildrenBatch": [{
37259
+ name: "parentDeviceIds",
37260
+ form: "array",
37261
+ optional: false
37262
+ }],
36884
37263
  "deviceManager.getConfigSchema": [{
36885
37264
  name: "deviceId",
36886
37265
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-matter-broker",
3
- "version": "0.2.31",
3
+ "version": "0.2.33",
4
4
  "description": "Matter broker addon for CamStack — owns a Matter fabric (commissioning + the long-lived controller) via the matter.js controller and brokers commissioned Matter nodes into CamStack",
5
5
  "keywords": [
6
6
  "camstack",