@camstack/addon-mqtt-broker 1.2.32 → 1.2.34

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.
@@ -7497,6 +7497,111 @@ var CameraSwitchGroupSchema = object({
7497
7497
  fetchedAt: number()
7498
7498
  });
7499
7499
  /**
7500
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7501
+ * an addon declares its channels in.
7502
+ *
7503
+ * ## Two axes, deliberately separated
7504
+ *
7505
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7506
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7507
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7508
+ * and rots silently. So a channel is declared where it is consulted, and the
7509
+ * `log-channels` capability enumerates the declarations.
7510
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7511
+ * thing: the logging settings document on the `system` cap. Two authorities
7512
+ * over the values is the exact defect
7513
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7514
+ * remove; re-introducing it from the cure side would be grotesque.
7515
+ *
7516
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7517
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7518
+ * the hot path with a value somebody actually read, and by
7519
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7520
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7521
+ * disarmed one (D49).
7522
+ *
7523
+ * ## The canonical call shape
7524
+ *
7525
+ * ```ts
7526
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7527
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7528
+ * }
7529
+ * ```
7530
+ *
7531
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7532
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7533
+ * object literal is never constructed because it lives inside the branch. It
7534
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7535
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7536
+ * destination floor (measured at 1.93 ns/call when off).
7537
+ *
7538
+ * ## Why a channel emits at `info`
7539
+ *
7540
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7541
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7542
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7543
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7544
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7545
+ * emits at the channel's declared level, whose schema floor is `info`.
7546
+ */
7547
+ /**
7548
+ * The level a channel writes at once armed.
7549
+ *
7550
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7551
+ * not leave the process for Loki, and the whole point of arming a channel is
7552
+ * to read it later.
7553
+ */
7554
+ var LogChannelLevelSchema = _enum([
7555
+ "info",
7556
+ "warn",
7557
+ "error"
7558
+ ]);
7559
+ /**
7560
+ * What an addon declares about one channel. No value, no state — a
7561
+ * declaration is inert.
7562
+ */
7563
+ var LogChannelDescriptorSchema = object({
7564
+ /**
7565
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7566
+ * the addon's short name so an operator reading a channel list can tell who
7567
+ * owns it without a second lookup.
7568
+ */
7569
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7570
+ /** One sentence: what the operator will SEE after arming it. */
7571
+ description: string().min(1),
7572
+ /** The level its lines are emitted at. Never below `info`. */
7573
+ defaultLevel: LogChannelLevelSchema,
7574
+ /**
7575
+ * Whether this channel can be narrowed to a camera.
7576
+ *
7577
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7578
+ * consulted with the numeric device id, AND every line the channel admits
7579
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7580
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7581
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7582
+ * the body is the only way to filter.
7583
+ *
7584
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7585
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7586
+ * the operator narrows to one camera, sees nothing, and concludes the code
7587
+ * path was never taken.
7588
+ */
7589
+ perDevice: boolean()
7590
+ });
7591
+ /**
7592
+ * An armed window over one channel, as the document hands it to a mirror.
7593
+ *
7594
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7595
+ * expires by itself, which is the one failure a boolean cannot avoid.
7596
+ */
7597
+ var LogChannelWindowSchema = object({
7598
+ channel: string().min(1),
7599
+ /** Epoch ms the window closes at. */
7600
+ armedUntilMs: number(),
7601
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7602
+ deviceIds: array(number().int()).readonly().nullable()
7603
+ });
7604
+ /**
7500
7605
  * Ops-log — the durable, append-only operations audit shared by the
7501
7606
  * recordings and events management surfaces.
7502
7607
  *
@@ -11064,6 +11169,35 @@ var MutationFilterSchema = object({
11064
11169
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11065
11170
  whereNot: record(string(), unknown()).optional()
11066
11171
  });
11172
+ /**
11173
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11174
+ *
11175
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11176
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11177
+ * a `Record<column, op>` shape could not express.
11178
+ */
11179
+ var AggregateFieldSchema = object({
11180
+ /** Result key. */
11181
+ as: string().min(1),
11182
+ /** Column to aggregate. Must be a real column of a declared collection. */
11183
+ field: string().min(1),
11184
+ op: _enum([
11185
+ "sum",
11186
+ "min",
11187
+ "max"
11188
+ ])
11189
+ });
11190
+ /**
11191
+ * `COUNT(*)` plus one number per requested field.
11192
+ *
11193
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11194
+ * that really is 0 are different facts, and an accounting caller that renders
11195
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11196
+ */
11197
+ var AggregateResultSchema = object({
11198
+ count: number().int(),
11199
+ values: record(string(), number().nullable())
11200
+ });
11067
11201
  /** A single stored record: `{ id, data }`. */
11068
11202
  var SettingsRecordSchema = object({
11069
11203
  id: string(),
@@ -11148,6 +11282,11 @@ method(object({
11148
11282
  collection: string(),
11149
11283
  filter: QueryFilterSchema.optional()
11150
11284
  }), number()), method(object({
11285
+ namespace: string().optional(),
11286
+ collection: string(),
11287
+ fields: array(AggregateFieldSchema).readonly(),
11288
+ filter: QueryFilterSchema.optional()
11289
+ }), AggregateResultSchema), method(object({
11151
11290
  namespace: string().optional(),
11152
11291
  collection: string(),
11153
11292
  field: string(),
@@ -11264,6 +11403,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11264
11403
  collection: string(),
11265
11404
  filter: QueryFilterSchema.optional()
11266
11405
  }), number(), { auth: "admin" }), method(object({
11406
+ namespace: string().optional(),
11407
+ collection: string(),
11408
+ fields: array(AggregateFieldSchema).readonly(),
11409
+ filter: QueryFilterSchema.optional()
11410
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11267
11411
  namespace: string().optional(),
11268
11412
  collection: string(),
11269
11413
  field: string(),
@@ -11825,24 +11969,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
11825
11969
  kind: "mutation",
11826
11970
  auth: "admin"
11827
11971
  });
11828
- /**
11829
- * Device Manager capability — hub-side singleton that unifies device persistence,
11830
- * live registry access, and all management operations into a single tRPC surface.
11831
- *
11832
- * Replaces:
11833
- * - `device-persistence` capability (persistence methods absorbed here)
11834
- * - `device-management.router.ts` (deleted in Phase 2)
11835
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
11836
- *
11837
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
11838
- * fork into separate processes but never run on remote cluster agents. Therefore:
11839
- * - No nodeId routing needed — this is a pure hub singleton.
11840
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
11841
- * - No shadow registry or cross-node aggregation required.
11842
- *
11843
- * Forked workers register devices back to the hub via `ctx.devices`
11844
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
11845
- */
11846
11972
  /** One child-placement directive on a container's `childLayout`. Structurally
11847
11973
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
11848
11974
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12211,7 +12337,7 @@ method(object({
12211
12337
  * it answers today and the caller filters as it already does.
12212
12338
  */
12213
12339
  deviceIds: array(number()).optional()
12214
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12340
+ }), 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({
12215
12341
  mode: LinkedDevicesModeSchema,
12216
12342
  devices: array(LinkedDeviceSchema)
12217
12343
  })), 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({
@@ -12935,6 +13061,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
12935
13061
  kind: "mutation",
12936
13062
  auth: "admin"
12937
13063
  });
13064
+ /**
13065
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13066
+ * through. It stores nothing.
13067
+ *
13068
+ * ## Why a capability at all, and why this shape
13069
+ *
13070
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13071
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13072
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13073
+ * fails, an operator just never sees the channel somebody added. So the list
13074
+ * is assembled from declarations at runtime.
13075
+ *
13076
+ * The shape is copied from `log-destination.cap.ts`, which already does
13077
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13078
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13079
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13080
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13081
+ * runner's declarations reach hub-main over the transport that already exists.
13082
+ * No new UDS message, no second registry.
13083
+ *
13084
+ * ## What it deliberately does NOT own
13085
+ *
13086
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13087
+ * ONE place: the logging settings document on the `system` cap
13088
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13089
+ * value is the defect the plan behind this work exists to remove, and
13090
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13091
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13092
+ * setter for a window and no persistence of any kind.
13093
+ *
13094
+ * ## Why `apply` is here even so
13095
+ *
13096
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13097
+ * seam has to carry the value from the authority to the mirror, and a channel
13098
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13099
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13100
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13101
+ * persists nothing, it is never the source of a value, and it is called only
13102
+ * with a set the hub actually read (D49 — a read that fails does not call it
13103
+ * at all, so no channel is silently disarmed by a bad read).
13104
+ */
13105
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13106
+ var LogChannelApplyResultSchema = object({
13107
+ /** How many declared channels are armed in this process after the call. */
13108
+ armed: number().int().min(0),
13109
+ /**
13110
+ * Names the document armed that this process does not declare. Reported
13111
+ * rather than swallowed: a name here is either a typo or an addon that has
13112
+ * not booted, and both deserve a line instead of silence.
13113
+ */
13114
+ unknown: array(string()).readonly()
13115
+ });
13116
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
12938
13117
  var LogLevelSchema = _enum([
12939
13118
  "debug",
12940
13119
  "info",
@@ -26209,17 +26388,60 @@ var SetSiteLocationInputSchema = object({
26209
26388
  longitude: number().min(-180).max(180)
26210
26389
  }).nullable();
26211
26390
  /**
26212
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26391
+ * The TRANSPORT a call arrived on.
26392
+ *
26393
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26394
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26395
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26396
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26397
+ * checkable rather than asserted.
26398
+ *
26399
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26400
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26401
+ * connection; the viewer talks to the hub over `wsLink`
26402
+ * exclusively, so this is the plane the HTTP census could not see.
26403
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26404
+ * never touches a socket and therefore never touched a census.
26405
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26406
+ * that is exactly what its `0` asserts: every plane the hub has can name
26407
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26408
+ * plane nobody instrumented lands here instead of vanishing from the total.
26409
+ */
26410
+ var TransportPlaneSchema = _enum([
26411
+ "http",
26412
+ "ws",
26413
+ "mesh",
26414
+ "unknown"
26415
+ ]);
26416
+ /**
26417
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26418
+ * reads as "not instrumented", which is the one thing this census must never
26419
+ * make an operator wonder about.
26420
+ */
26421
+ var TransportPlaneCountsSchema = object({
26422
+ http: number(),
26423
+ ws: number(),
26424
+ mesh: number(),
26425
+ unknown: number()
26426
+ });
26427
+ /**
26428
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26213
26429
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26214
26430
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26215
26431
  * already prints - never a token, never an `Authorization` header.
26432
+ *
26433
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26434
+ * and lives for hours, so folding it into a call count makes one long-lived
26435
+ * stream look like a storm.
26216
26436
  */
26217
26437
  var RequestCensusGroupSchema = object({
26438
+ plane: TransportPlaneSchema,
26218
26439
  procedure: string(),
26219
26440
  userAgent: string(),
26220
26441
  ip: string(),
26221
26442
  principal: string(),
26222
26443
  calls: number(),
26444
+ subscriptions: number(),
26223
26445
  perMin: number()
26224
26446
  });
26225
26447
  /**
@@ -26232,6 +26454,14 @@ var RequestCensusGroupSchema = object({
26232
26454
  var RequestCensusProcedureSchema = object({
26233
26455
  procedure: string(),
26234
26456
  calls: number(),
26457
+ /**
26458
+ * The same total, split by transport. THIS is the row that answers the
26459
+ * question the census exists for: one look at `deviceManager.listAll` says
26460
+ * which plane carried the 4 960, without joining two log lines by eye.
26461
+ */
26462
+ planes: TransportPlaneCountsSchema,
26463
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26464
+ subscriptions: number(),
26235
26465
  perMin: number()
26236
26466
  });
26237
26467
  /**
@@ -26259,14 +26489,45 @@ var RequestCensusStatusSchema = object({
26259
26489
  */
26260
26490
  procedureCalls: number(),
26261
26491
  /**
26492
+ * `procedureCalls` split by transport. The four keys sum to
26493
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26494
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26495
+ */
26496
+ planes: TransportPlaneCountsSchema,
26497
+ /**
26498
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26499
+ * on no plane at all - which is a RESULT (a plane is missing from the
26500
+ * instrument), not a failure, and it has to be visible to be read as one.
26501
+ */
26502
+ planesExplainTotal: boolean(),
26503
+ /**
26262
26504
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
26263
- * transport resolves one context per connection - but the number that says
26264
- * whether a plane this census cannot see was busy while HTTP was quiet.
26505
+ * adapter resolves one context per connection - kept because a plane's call
26506
+ * count of zero against 37 open connections says something different from a
26507
+ * plane with no connections at all.
26265
26508
  */
26266
26509
  wsConnections: number(),
26510
+ /**
26511
+ * Client frames the WS plane looked at. `wsMessages` far above
26512
+ * `planes.ws + subscriptions` means most traffic is not operations
26513
+ * (keepalives, connection params) - which is itself an answer.
26514
+ */
26515
+ wsMessages: number(),
26516
+ /**
26517
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26518
+ * purpose: one live-events stream opened at boot and held for six hours is
26519
+ * one subscription, and counting it as a call would let a quiet plane
26520
+ * masquerade as the storm.
26521
+ */
26522
+ subscriptions: number(),
26523
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26524
+ subscriptionStops: number(),
26267
26525
  distinctGroups: number(),
26268
- /** Calls counted in the totals whose group attribution was shed at the
26269
- * cardinality bound. */
26526
+ /**
26527
+ * Operations counted in the totals whose CALLER attribution was shed at the
26528
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26529
+ * which transport they arrived on, they just lost their group row.
26530
+ */
26270
26531
  unattributedCalls: number(),
26271
26532
  procedures: array(RequestCensusProcedureSchema).readonly(),
26272
26533
  groups: array(RequestCensusGroupSchema).readonly()
@@ -26289,10 +26550,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
26289
26550
  * The layers of the level hierarchy, general → specific. The most specific
26290
26551
  * layer that carries an explicit value wins.
26291
26552
  *
26292
- * `component` is DECLARED and not yet resolvable: the per-component channels
26293
- * are a later slice of the same plan, and a `levelSource` enum that has to
26294
- * grow later would force every consumer of this document to change with it.
26295
- * Nothing returns `component` today.
26553
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
26554
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
26555
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
26556
+ * that turning it on would not force every consumer of this document to widen
26557
+ * a `levelSource` enum — which is what has now not happened.
26296
26558
  */
26297
26559
  var LoggingScopeKindSchema = _enum([
26298
26560
  "cluster",
@@ -26319,6 +26581,14 @@ var LoggingLevelLayerSchema = object({
26319
26581
  scope: LoggingScopeKindSchema,
26320
26582
  /** The node this layer speaks for; `null` on the cluster layer. */
26321
26583
  nodeId: string().nullable(),
26584
+ /**
26585
+ * The declared channel this layer speaks for; `null` on every layer but
26586
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
26587
+ * by design — the convention this repo settled on is one orchestrator-wide
26588
+ * setting, never per node (D52) — so a component layer that carried a node
26589
+ * would invite a per-node copy of a value that has no per-node meaning.
26590
+ */
26591
+ component: string().nullable(),
26322
26592
  /** Explicitly set here, or `null` when this layer inherits. */
26323
26593
  level: LogLevelSchema$1.nullable()
26324
26594
  });
@@ -26360,6 +26630,49 @@ var DiagnosticWindowPatchSchema = object({
26360
26630
  reportEveryMs: number().int().positive().optional()
26361
26631
  });
26362
26632
  /**
26633
+ * A channel ARMED, as the document reports it.
26634
+ *
26635
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
26636
+ * and the time left, because a diagnostic left running is itself an incident
26637
+ * and "armed for 10 minutes" said an hour ago is not an answer.
26638
+ */
26639
+ var LogChannelWindowStateSchema = object({
26640
+ channel: string(),
26641
+ armed: boolean(),
26642
+ /** Epoch ms the window closes at. 0 when disarmed. */
26643
+ armedUntilMs: number(),
26644
+ /** Ms left before it expires on its own. 0 when disarmed. */
26645
+ remainingMs: number(),
26646
+ /**
26647
+ * The cameras it is narrowed to, or `null` for every camera.
26648
+ *
26649
+ * A channel declared `perDevice: false` can only ever report `null` here:
26650
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
26651
+ * produce a filter that silently matches nothing. The server REFUSES such a
26652
+ * patch rather than quietly widening it — ignoring the request would teach
26653
+ * the operator that per-camera filtering works on that channel when it does
26654
+ * not.
26655
+ */
26656
+ deviceIds: array(number().int()).readonly().nullable()
26657
+ });
26658
+ /**
26659
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
26660
+ * for the same reason: a channel is a window with a deadline, never a switch.
26661
+ */
26662
+ var LogChannelWindowPatchSchema = object({
26663
+ channel: string().min(1),
26664
+ armMs: number().int().min(0),
26665
+ /**
26666
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
26667
+ *
26668
+ * Numeric because the repo's own rule makes it possible: every log line
26669
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
26670
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
26671
+ * diagnosed by hand, and this is the first thing that collects on it.
26672
+ */
26673
+ deviceIds: array(number().int()).readonly().nullable().optional()
26674
+ });
26675
+ /**
26363
26676
  * A PATCH, and patches MERGE.
26364
26677
  *
26365
26678
  * A field absent from the patch is left exactly as it was — arming a
@@ -26378,7 +26691,14 @@ var LoggingSettingsPatchSchema = object({
26378
26691
  * Only the diagnostics NAMED here change. An armed window that is not listed
26379
26692
  * keeps running — a patch is never a full replacement.
26380
26693
  */
26381
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26694
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
26695
+ /**
26696
+ * Only the channels NAMED here change. An armed channel that is not listed
26697
+ * keeps running — same rule as `diagnostics`, because a patch that silently
26698
+ * disarmed the channels it did not mention would make the Levels page and
26699
+ * the Diagnostics page fight over the same value.
26700
+ */
26701
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
26382
26702
  });
26383
26703
  /**
26384
26704
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -26391,9 +26711,22 @@ var LoggingSettingsPatchSchema = object({
26391
26711
  * authority over the whole hierarchy and answers for every layer, so the
26392
26712
  * layer selector needs a name the transport does not already own.
26393
26713
  */
26394
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26714
+ var GetLoggingSettingsInputSchema = object({
26715
+ scopeNodeId: string().optional(),
26716
+ /**
26717
+ * The declared CHANNEL this document is addressed at, when the caller wants
26718
+ * the `component` layer. Absent = the node/cluster hierarchy only.
26719
+ *
26720
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
26721
+ * axes from collapsing: a component level is cluster-wide, a node level is
26722
+ * not, and one selector for both would make "which of these two did I just
26723
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
26724
+ */
26725
+ scopeComponent: string().optional()
26726
+ });
26395
26727
  var SetLoggingSettingsInputSchema = object({
26396
26728
  scopeNodeId: string().optional(),
26729
+ scopeComponent: string().optional(),
26397
26730
  patch: LoggingSettingsPatchSchema
26398
26731
  });
26399
26732
  /**
@@ -26408,9 +26741,20 @@ var SetLoggingSettingsInputSchema = object({
26408
26741
  var LoggingSettingsStateSchema = object({
26409
26742
  /** The layer this document was read at. `null` = the cluster layer. */
26410
26743
  scopeNodeId: string().nullable(),
26744
+ /** The channel this document was read at. `null` = no component layer. */
26745
+ scopeComponent: string().nullable(),
26411
26746
  effective: LoggingEffectiveSchema,
26412
26747
  explicit: LoggingExplicitSchema,
26413
26748
  activeWindows: array(DiagnosticWindowSchema).readonly(),
26749
+ /**
26750
+ * Every channel the cluster's addons DECLARE, gathered from the
26751
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
26752
+ * channel added by a redeployed addon appears without anybody editing a
26753
+ * list, and a channel whose addon is gone stops being offered.
26754
+ */
26755
+ channels: array(LogChannelDescriptorSchema).readonly(),
26756
+ /** The channels ARMED right now, each with its deadline. */
26757
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
26414
26758
  persisted: boolean()
26415
26759
  });
26416
26760
  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(), {
@@ -27987,6 +28331,12 @@ Object.freeze({
27987
28331
  addonId: null,
27988
28332
  access: "view"
27989
28333
  },
28334
+ "dataStoreProvider.aggregate": {
28335
+ capName: "data-store-provider",
28336
+ capScope: "system",
28337
+ addonId: null,
28338
+ access: "view"
28339
+ },
27990
28340
  "dataStoreProvider.count": {
27991
28341
  capName: "data-store-provider",
27992
28342
  capScope: "system",
@@ -28401,6 +28751,12 @@ Object.freeze({
28401
28751
  addonId: null,
28402
28752
  access: "view"
28403
28753
  },
28754
+ "deviceManager.getChildrenBatch": {
28755
+ capName: "device-manager",
28756
+ capScope: "system",
28757
+ addonId: null,
28758
+ access: "view"
28759
+ },
28404
28760
  "deviceManager.getConfigSchema": {
28405
28761
  capName: "device-manager",
28406
28762
  capScope: "system",
@@ -29451,6 +29807,18 @@ Object.freeze({
29451
29807
  addonId: null,
29452
29808
  access: "create"
29453
29809
  },
29810
+ "logChannels.apply": {
29811
+ capName: "log-channels",
29812
+ capScope: "system",
29813
+ addonId: null,
29814
+ access: "create"
29815
+ },
29816
+ "logChannels.list": {
29817
+ capName: "log-channels",
29818
+ capScope: "system",
29819
+ addonId: null,
29820
+ access: "view"
29821
+ },
29454
29822
  "logDestination.query": {
29455
29823
  capName: "log-destination",
29456
29824
  capScope: "system",
@@ -31605,6 +31973,12 @@ Object.freeze({
31605
31973
  addonId: null,
31606
31974
  access: "create"
31607
31975
  },
31976
+ "settingsStore.aggregate": {
31977
+ capName: "settings-store",
31978
+ capScope: "system",
31979
+ addonId: null,
31980
+ access: "view"
31981
+ },
31608
31982
  "settingsStore.count": {
31609
31983
  capName: "settings-store",
31610
31984
  capScope: "system",
@@ -33184,6 +33558,11 @@ Object.freeze({
33184
33558
  form: "single",
33185
33559
  optional: false
33186
33560
  }],
33561
+ "deviceManager.getChildrenBatch": [{
33562
+ name: "parentDeviceIds",
33563
+ form: "array",
33564
+ optional: false
33565
+ }],
33187
33566
  "deviceManager.getConfigSchema": [{
33188
33567
  name: "deviceId",
33189
33568
  form: "single",
@@ -7492,6 +7492,111 @@ var CameraSwitchGroupSchema = object({
7492
7492
  fetchedAt: number()
7493
7493
  });
7494
7494
  /**
7495
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7496
+ * an addon declares its channels in.
7497
+ *
7498
+ * ## Two axes, deliberately separated
7499
+ *
7500
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7501
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7502
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7503
+ * and rots silently. So a channel is declared where it is consulted, and the
7504
+ * `log-channels` capability enumerates the declarations.
7505
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7506
+ * thing: the logging settings document on the `system` cap. Two authorities
7507
+ * over the values is the exact defect
7508
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7509
+ * remove; re-introducing it from the cure side would be grotesque.
7510
+ *
7511
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7512
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7513
+ * the hot path with a value somebody actually read, and by
7514
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7515
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7516
+ * disarmed one (D49).
7517
+ *
7518
+ * ## The canonical call shape
7519
+ *
7520
+ * ```ts
7521
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7522
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7523
+ * }
7524
+ * ```
7525
+ *
7526
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7527
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7528
+ * object literal is never constructed because it lives inside the branch. It
7529
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7530
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7531
+ * destination floor (measured at 1.93 ns/call when off).
7532
+ *
7533
+ * ## Why a channel emits at `info`
7534
+ *
7535
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7536
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7537
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7538
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7539
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7540
+ * emits at the channel's declared level, whose schema floor is `info`.
7541
+ */
7542
+ /**
7543
+ * The level a channel writes at once armed.
7544
+ *
7545
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7546
+ * not leave the process for Loki, and the whole point of arming a channel is
7547
+ * to read it later.
7548
+ */
7549
+ var LogChannelLevelSchema = _enum([
7550
+ "info",
7551
+ "warn",
7552
+ "error"
7553
+ ]);
7554
+ /**
7555
+ * What an addon declares about one channel. No value, no state — a
7556
+ * declaration is inert.
7557
+ */
7558
+ var LogChannelDescriptorSchema = object({
7559
+ /**
7560
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7561
+ * the addon's short name so an operator reading a channel list can tell who
7562
+ * owns it without a second lookup.
7563
+ */
7564
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7565
+ /** One sentence: what the operator will SEE after arming it. */
7566
+ description: string().min(1),
7567
+ /** The level its lines are emitted at. Never below `info`. */
7568
+ defaultLevel: LogChannelLevelSchema,
7569
+ /**
7570
+ * Whether this channel can be narrowed to a camera.
7571
+ *
7572
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7573
+ * consulted with the numeric device id, AND every line the channel admits
7574
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7575
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7576
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7577
+ * the body is the only way to filter.
7578
+ *
7579
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7580
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7581
+ * the operator narrows to one camera, sees nothing, and concludes the code
7582
+ * path was never taken.
7583
+ */
7584
+ perDevice: boolean()
7585
+ });
7586
+ /**
7587
+ * An armed window over one channel, as the document hands it to a mirror.
7588
+ *
7589
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7590
+ * expires by itself, which is the one failure a boolean cannot avoid.
7591
+ */
7592
+ var LogChannelWindowSchema = object({
7593
+ channel: string().min(1),
7594
+ /** Epoch ms the window closes at. */
7595
+ armedUntilMs: number(),
7596
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7597
+ deviceIds: array(number().int()).readonly().nullable()
7598
+ });
7599
+ /**
7495
7600
  * Ops-log — the durable, append-only operations audit shared by the
7496
7601
  * recordings and events management surfaces.
7497
7602
  *
@@ -11059,6 +11164,35 @@ var MutationFilterSchema = object({
11059
11164
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11060
11165
  whereNot: record(string(), unknown()).optional()
11061
11166
  });
11167
+ /**
11168
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11169
+ *
11170
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11171
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11172
+ * a `Record<column, op>` shape could not express.
11173
+ */
11174
+ var AggregateFieldSchema = object({
11175
+ /** Result key. */
11176
+ as: string().min(1),
11177
+ /** Column to aggregate. Must be a real column of a declared collection. */
11178
+ field: string().min(1),
11179
+ op: _enum([
11180
+ "sum",
11181
+ "min",
11182
+ "max"
11183
+ ])
11184
+ });
11185
+ /**
11186
+ * `COUNT(*)` plus one number per requested field.
11187
+ *
11188
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11189
+ * that really is 0 are different facts, and an accounting caller that renders
11190
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11191
+ */
11192
+ var AggregateResultSchema = object({
11193
+ count: number().int(),
11194
+ values: record(string(), number().nullable())
11195
+ });
11062
11196
  /** A single stored record: `{ id, data }`. */
11063
11197
  var SettingsRecordSchema = object({
11064
11198
  id: string(),
@@ -11143,6 +11277,11 @@ method(object({
11143
11277
  collection: string(),
11144
11278
  filter: QueryFilterSchema.optional()
11145
11279
  }), number()), method(object({
11280
+ namespace: string().optional(),
11281
+ collection: string(),
11282
+ fields: array(AggregateFieldSchema).readonly(),
11283
+ filter: QueryFilterSchema.optional()
11284
+ }), AggregateResultSchema), method(object({
11146
11285
  namespace: string().optional(),
11147
11286
  collection: string(),
11148
11287
  field: string(),
@@ -11259,6 +11398,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11259
11398
  collection: string(),
11260
11399
  filter: QueryFilterSchema.optional()
11261
11400
  }), number(), { auth: "admin" }), method(object({
11401
+ namespace: string().optional(),
11402
+ collection: string(),
11403
+ fields: array(AggregateFieldSchema).readonly(),
11404
+ filter: QueryFilterSchema.optional()
11405
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11262
11406
  namespace: string().optional(),
11263
11407
  collection: string(),
11264
11408
  field: string(),
@@ -11820,24 +11964,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
11820
11964
  kind: "mutation",
11821
11965
  auth: "admin"
11822
11966
  });
11823
- /**
11824
- * Device Manager capability — hub-side singleton that unifies device persistence,
11825
- * live registry access, and all management operations into a single tRPC surface.
11826
- *
11827
- * Replaces:
11828
- * - `device-persistence` capability (persistence methods absorbed here)
11829
- * - `device-management.router.ts` (deleted in Phase 2)
11830
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
11831
- *
11832
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
11833
- * fork into separate processes but never run on remote cluster agents. Therefore:
11834
- * - No nodeId routing needed — this is a pure hub singleton.
11835
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
11836
- * - No shadow registry or cross-node aggregation required.
11837
- *
11838
- * Forked workers register devices back to the hub via `ctx.devices`
11839
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
11840
- */
11841
11967
  /** One child-placement directive on a container's `childLayout`. Structurally
11842
11968
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
11843
11969
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12206,7 +12332,7 @@ method(object({
12206
12332
  * it answers today and the caller filters as it already does.
12207
12333
  */
12208
12334
  deviceIds: array(number()).optional()
12209
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12335
+ }), 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({
12210
12336
  mode: LinkedDevicesModeSchema,
12211
12337
  devices: array(LinkedDeviceSchema)
12212
12338
  })), 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({
@@ -12930,6 +13056,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
12930
13056
  kind: "mutation",
12931
13057
  auth: "admin"
12932
13058
  });
13059
+ /**
13060
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13061
+ * through. It stores nothing.
13062
+ *
13063
+ * ## Why a capability at all, and why this shape
13064
+ *
13065
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13066
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13067
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13068
+ * fails, an operator just never sees the channel somebody added. So the list
13069
+ * is assembled from declarations at runtime.
13070
+ *
13071
+ * The shape is copied from `log-destination.cap.ts`, which already does
13072
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13073
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13074
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13075
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13076
+ * runner's declarations reach hub-main over the transport that already exists.
13077
+ * No new UDS message, no second registry.
13078
+ *
13079
+ * ## What it deliberately does NOT own
13080
+ *
13081
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13082
+ * ONE place: the logging settings document on the `system` cap
13083
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13084
+ * value is the defect the plan behind this work exists to remove, and
13085
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13086
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13087
+ * setter for a window and no persistence of any kind.
13088
+ *
13089
+ * ## Why `apply` is here even so
13090
+ *
13091
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13092
+ * seam has to carry the value from the authority to the mirror, and a channel
13093
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13094
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13095
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13096
+ * persists nothing, it is never the source of a value, and it is called only
13097
+ * with a set the hub actually read (D49 — a read that fails does not call it
13098
+ * at all, so no channel is silently disarmed by a bad read).
13099
+ */
13100
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13101
+ var LogChannelApplyResultSchema = object({
13102
+ /** How many declared channels are armed in this process after the call. */
13103
+ armed: number().int().min(0),
13104
+ /**
13105
+ * Names the document armed that this process does not declare. Reported
13106
+ * rather than swallowed: a name here is either a typo or an addon that has
13107
+ * not booted, and both deserve a line instead of silence.
13108
+ */
13109
+ unknown: array(string()).readonly()
13110
+ });
13111
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
12933
13112
  var LogLevelSchema = _enum([
12934
13113
  "debug",
12935
13114
  "info",
@@ -26204,17 +26383,60 @@ var SetSiteLocationInputSchema = object({
26204
26383
  longitude: number().min(-180).max(180)
26205
26384
  }).nullable();
26206
26385
  /**
26207
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26386
+ * The TRANSPORT a call arrived on.
26387
+ *
26388
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26389
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26390
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26391
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26392
+ * checkable rather than asserted.
26393
+ *
26394
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26395
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26396
+ * connection; the viewer talks to the hub over `wsLink`
26397
+ * exclusively, so this is the plane the HTTP census could not see.
26398
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26399
+ * never touches a socket and therefore never touched a census.
26400
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26401
+ * that is exactly what its `0` asserts: every plane the hub has can name
26402
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26403
+ * plane nobody instrumented lands here instead of vanishing from the total.
26404
+ */
26405
+ var TransportPlaneSchema = _enum([
26406
+ "http",
26407
+ "ws",
26408
+ "mesh",
26409
+ "unknown"
26410
+ ]);
26411
+ /**
26412
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26413
+ * reads as "not instrumented", which is the one thing this census must never
26414
+ * make an operator wonder about.
26415
+ */
26416
+ var TransportPlaneCountsSchema = object({
26417
+ http: number(),
26418
+ ws: number(),
26419
+ mesh: number(),
26420
+ unknown: number()
26421
+ });
26422
+ /**
26423
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26208
26424
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26209
26425
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26210
26426
  * already prints - never a token, never an `Authorization` header.
26427
+ *
26428
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26429
+ * and lives for hours, so folding it into a call count makes one long-lived
26430
+ * stream look like a storm.
26211
26431
  */
26212
26432
  var RequestCensusGroupSchema = object({
26433
+ plane: TransportPlaneSchema,
26213
26434
  procedure: string(),
26214
26435
  userAgent: string(),
26215
26436
  ip: string(),
26216
26437
  principal: string(),
26217
26438
  calls: number(),
26439
+ subscriptions: number(),
26218
26440
  perMin: number()
26219
26441
  });
26220
26442
  /**
@@ -26227,6 +26449,14 @@ var RequestCensusGroupSchema = object({
26227
26449
  var RequestCensusProcedureSchema = object({
26228
26450
  procedure: string(),
26229
26451
  calls: number(),
26452
+ /**
26453
+ * The same total, split by transport. THIS is the row that answers the
26454
+ * question the census exists for: one look at `deviceManager.listAll` says
26455
+ * which plane carried the 4 960, without joining two log lines by eye.
26456
+ */
26457
+ planes: TransportPlaneCountsSchema,
26458
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26459
+ subscriptions: number(),
26230
26460
  perMin: number()
26231
26461
  });
26232
26462
  /**
@@ -26254,14 +26484,45 @@ var RequestCensusStatusSchema = object({
26254
26484
  */
26255
26485
  procedureCalls: number(),
26256
26486
  /**
26487
+ * `procedureCalls` split by transport. The four keys sum to
26488
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26489
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26490
+ */
26491
+ planes: TransportPlaneCountsSchema,
26492
+ /**
26493
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26494
+ * on no plane at all - which is a RESULT (a plane is missing from the
26495
+ * instrument), not a failure, and it has to be visible to be read as one.
26496
+ */
26497
+ planesExplainTotal: boolean(),
26498
+ /**
26257
26499
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
26258
- * transport resolves one context per connection - but the number that says
26259
- * whether a plane this census cannot see was busy while HTTP was quiet.
26500
+ * adapter resolves one context per connection - kept because a plane's call
26501
+ * count of zero against 37 open connections says something different from a
26502
+ * plane with no connections at all.
26260
26503
  */
26261
26504
  wsConnections: number(),
26505
+ /**
26506
+ * Client frames the WS plane looked at. `wsMessages` far above
26507
+ * `planes.ws + subscriptions` means most traffic is not operations
26508
+ * (keepalives, connection params) - which is itself an answer.
26509
+ */
26510
+ wsMessages: number(),
26511
+ /**
26512
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26513
+ * purpose: one live-events stream opened at boot and held for six hours is
26514
+ * one subscription, and counting it as a call would let a quiet plane
26515
+ * masquerade as the storm.
26516
+ */
26517
+ subscriptions: number(),
26518
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26519
+ subscriptionStops: number(),
26262
26520
  distinctGroups: number(),
26263
- /** Calls counted in the totals whose group attribution was shed at the
26264
- * cardinality bound. */
26521
+ /**
26522
+ * Operations counted in the totals whose CALLER attribution was shed at the
26523
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26524
+ * which transport they arrived on, they just lost their group row.
26525
+ */
26265
26526
  unattributedCalls: number(),
26266
26527
  procedures: array(RequestCensusProcedureSchema).readonly(),
26267
26528
  groups: array(RequestCensusGroupSchema).readonly()
@@ -26284,10 +26545,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
26284
26545
  * The layers of the level hierarchy, general → specific. The most specific
26285
26546
  * layer that carries an explicit value wins.
26286
26547
  *
26287
- * `component` is DECLARED and not yet resolvable: the per-component channels
26288
- * are a later slice of the same plan, and a `levelSource` enum that has to
26289
- * grow later would force every consumer of this document to change with it.
26290
- * Nothing returns `component` today.
26548
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
26549
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
26550
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
26551
+ * that turning it on would not force every consumer of this document to widen
26552
+ * a `levelSource` enum — which is what has now not happened.
26291
26553
  */
26292
26554
  var LoggingScopeKindSchema = _enum([
26293
26555
  "cluster",
@@ -26314,6 +26576,14 @@ var LoggingLevelLayerSchema = object({
26314
26576
  scope: LoggingScopeKindSchema,
26315
26577
  /** The node this layer speaks for; `null` on the cluster layer. */
26316
26578
  nodeId: string().nullable(),
26579
+ /**
26580
+ * The declared channel this layer speaks for; `null` on every layer but
26581
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
26582
+ * by design — the convention this repo settled on is one orchestrator-wide
26583
+ * setting, never per node (D52) — so a component layer that carried a node
26584
+ * would invite a per-node copy of a value that has no per-node meaning.
26585
+ */
26586
+ component: string().nullable(),
26317
26587
  /** Explicitly set here, or `null` when this layer inherits. */
26318
26588
  level: LogLevelSchema$1.nullable()
26319
26589
  });
@@ -26355,6 +26625,49 @@ var DiagnosticWindowPatchSchema = object({
26355
26625
  reportEveryMs: number().int().positive().optional()
26356
26626
  });
26357
26627
  /**
26628
+ * A channel ARMED, as the document reports it.
26629
+ *
26630
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
26631
+ * and the time left, because a diagnostic left running is itself an incident
26632
+ * and "armed for 10 minutes" said an hour ago is not an answer.
26633
+ */
26634
+ var LogChannelWindowStateSchema = object({
26635
+ channel: string(),
26636
+ armed: boolean(),
26637
+ /** Epoch ms the window closes at. 0 when disarmed. */
26638
+ armedUntilMs: number(),
26639
+ /** Ms left before it expires on its own. 0 when disarmed. */
26640
+ remainingMs: number(),
26641
+ /**
26642
+ * The cameras it is narrowed to, or `null` for every camera.
26643
+ *
26644
+ * A channel declared `perDevice: false` can only ever report `null` here:
26645
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
26646
+ * produce a filter that silently matches nothing. The server REFUSES such a
26647
+ * patch rather than quietly widening it — ignoring the request would teach
26648
+ * the operator that per-camera filtering works on that channel when it does
26649
+ * not.
26650
+ */
26651
+ deviceIds: array(number().int()).readonly().nullable()
26652
+ });
26653
+ /**
26654
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
26655
+ * for the same reason: a channel is a window with a deadline, never a switch.
26656
+ */
26657
+ var LogChannelWindowPatchSchema = object({
26658
+ channel: string().min(1),
26659
+ armMs: number().int().min(0),
26660
+ /**
26661
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
26662
+ *
26663
+ * Numeric because the repo's own rule makes it possible: every log line
26664
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
26665
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
26666
+ * diagnosed by hand, and this is the first thing that collects on it.
26667
+ */
26668
+ deviceIds: array(number().int()).readonly().nullable().optional()
26669
+ });
26670
+ /**
26358
26671
  * A PATCH, and patches MERGE.
26359
26672
  *
26360
26673
  * A field absent from the patch is left exactly as it was — arming a
@@ -26373,7 +26686,14 @@ var LoggingSettingsPatchSchema = object({
26373
26686
  * Only the diagnostics NAMED here change. An armed window that is not listed
26374
26687
  * keeps running — a patch is never a full replacement.
26375
26688
  */
26376
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26689
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
26690
+ /**
26691
+ * Only the channels NAMED here change. An armed channel that is not listed
26692
+ * keeps running — same rule as `diagnostics`, because a patch that silently
26693
+ * disarmed the channels it did not mention would make the Levels page and
26694
+ * the Diagnostics page fight over the same value.
26695
+ */
26696
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
26377
26697
  });
26378
26698
  /**
26379
26699
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -26386,9 +26706,22 @@ var LoggingSettingsPatchSchema = object({
26386
26706
  * authority over the whole hierarchy and answers for every layer, so the
26387
26707
  * layer selector needs a name the transport does not already own.
26388
26708
  */
26389
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26709
+ var GetLoggingSettingsInputSchema = object({
26710
+ scopeNodeId: string().optional(),
26711
+ /**
26712
+ * The declared CHANNEL this document is addressed at, when the caller wants
26713
+ * the `component` layer. Absent = the node/cluster hierarchy only.
26714
+ *
26715
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
26716
+ * axes from collapsing: a component level is cluster-wide, a node level is
26717
+ * not, and one selector for both would make "which of these two did I just
26718
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
26719
+ */
26720
+ scopeComponent: string().optional()
26721
+ });
26390
26722
  var SetLoggingSettingsInputSchema = object({
26391
26723
  scopeNodeId: string().optional(),
26724
+ scopeComponent: string().optional(),
26392
26725
  patch: LoggingSettingsPatchSchema
26393
26726
  });
26394
26727
  /**
@@ -26403,9 +26736,20 @@ var SetLoggingSettingsInputSchema = object({
26403
26736
  var LoggingSettingsStateSchema = object({
26404
26737
  /** The layer this document was read at. `null` = the cluster layer. */
26405
26738
  scopeNodeId: string().nullable(),
26739
+ /** The channel this document was read at. `null` = no component layer. */
26740
+ scopeComponent: string().nullable(),
26406
26741
  effective: LoggingEffectiveSchema,
26407
26742
  explicit: LoggingExplicitSchema,
26408
26743
  activeWindows: array(DiagnosticWindowSchema).readonly(),
26744
+ /**
26745
+ * Every channel the cluster's addons DECLARE, gathered from the
26746
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
26747
+ * channel added by a redeployed addon appears without anybody editing a
26748
+ * list, and a channel whose addon is gone stops being offered.
26749
+ */
26750
+ channels: array(LogChannelDescriptorSchema).readonly(),
26751
+ /** The channels ARMED right now, each with its deadline. */
26752
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
26409
26753
  persisted: boolean()
26410
26754
  });
26411
26755
  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(), {
@@ -27982,6 +28326,12 @@ Object.freeze({
27982
28326
  addonId: null,
27983
28327
  access: "view"
27984
28328
  },
28329
+ "dataStoreProvider.aggregate": {
28330
+ capName: "data-store-provider",
28331
+ capScope: "system",
28332
+ addonId: null,
28333
+ access: "view"
28334
+ },
27985
28335
  "dataStoreProvider.count": {
27986
28336
  capName: "data-store-provider",
27987
28337
  capScope: "system",
@@ -28396,6 +28746,12 @@ Object.freeze({
28396
28746
  addonId: null,
28397
28747
  access: "view"
28398
28748
  },
28749
+ "deviceManager.getChildrenBatch": {
28750
+ capName: "device-manager",
28751
+ capScope: "system",
28752
+ addonId: null,
28753
+ access: "view"
28754
+ },
28399
28755
  "deviceManager.getConfigSchema": {
28400
28756
  capName: "device-manager",
28401
28757
  capScope: "system",
@@ -29446,6 +29802,18 @@ Object.freeze({
29446
29802
  addonId: null,
29447
29803
  access: "create"
29448
29804
  },
29805
+ "logChannels.apply": {
29806
+ capName: "log-channels",
29807
+ capScope: "system",
29808
+ addonId: null,
29809
+ access: "create"
29810
+ },
29811
+ "logChannels.list": {
29812
+ capName: "log-channels",
29813
+ capScope: "system",
29814
+ addonId: null,
29815
+ access: "view"
29816
+ },
29449
29817
  "logDestination.query": {
29450
29818
  capName: "log-destination",
29451
29819
  capScope: "system",
@@ -31600,6 +31968,12 @@ Object.freeze({
31600
31968
  addonId: null,
31601
31969
  access: "create"
31602
31970
  },
31971
+ "settingsStore.aggregate": {
31972
+ capName: "settings-store",
31973
+ capScope: "system",
31974
+ addonId: null,
31975
+ access: "view"
31976
+ },
31603
31977
  "settingsStore.count": {
31604
31978
  capName: "settings-store",
31605
31979
  capScope: "system",
@@ -33179,6 +33553,11 @@ Object.freeze({
33179
33553
  form: "single",
33180
33554
  optional: false
33181
33555
  }],
33556
+ "deviceManager.getChildrenBatch": [{
33557
+ name: "parentDeviceIds",
33558
+ form: "array",
33559
+ optional: false
33560
+ }],
33182
33561
  "deviceManager.getConfigSchema": [{
33183
33562
  name: "deviceId",
33184
33563
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-mqtt-broker",
3
- "version": "1.2.32",
3
+ "version": "1.2.34",
4
4
  "description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
5
5
  "keywords": [
6
6
  "camstack",