@camstack/addon-provider-rademacher 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
@@ -8453,6 +8453,111 @@ var CameraSwitchGroupSchema = object({
8453
8453
  fetchedAt: number()
8454
8454
  });
8455
8455
  /**
8456
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8457
+ * an addon declares its channels in.
8458
+ *
8459
+ * ## Two axes, deliberately separated
8460
+ *
8461
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8462
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8463
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8464
+ * and rots silently. So a channel is declared where it is consulted, and the
8465
+ * `log-channels` capability enumerates the declarations.
8466
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8467
+ * thing: the logging settings document on the `system` cap. Two authorities
8468
+ * over the values is the exact defect
8469
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8470
+ * remove; re-introducing it from the cure side would be grotesque.
8471
+ *
8472
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8473
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8474
+ * the hot path with a value somebody actually read, and by
8475
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8476
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8477
+ * disarmed one (D49).
8478
+ *
8479
+ * ## The canonical call shape
8480
+ *
8481
+ * ```ts
8482
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8483
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8484
+ * }
8485
+ * ```
8486
+ *
8487
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8488
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8489
+ * object literal is never constructed because it lives inside the branch. It
8490
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8491
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8492
+ * destination floor (measured at 1.93 ns/call when off).
8493
+ *
8494
+ * ## Why a channel emits at `info`
8495
+ *
8496
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8497
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8498
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8499
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8500
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8501
+ * emits at the channel's declared level, whose schema floor is `info`.
8502
+ */
8503
+ /**
8504
+ * The level a channel writes at once armed.
8505
+ *
8506
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8507
+ * not leave the process for Loki, and the whole point of arming a channel is
8508
+ * to read it later.
8509
+ */
8510
+ var LogChannelLevelSchema = _enum([
8511
+ "info",
8512
+ "warn",
8513
+ "error"
8514
+ ]);
8515
+ /**
8516
+ * What an addon declares about one channel. No value, no state — a
8517
+ * declaration is inert.
8518
+ */
8519
+ var LogChannelDescriptorSchema = object({
8520
+ /**
8521
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8522
+ * the addon's short name so an operator reading a channel list can tell who
8523
+ * owns it without a second lookup.
8524
+ */
8525
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8526
+ /** One sentence: what the operator will SEE after arming it. */
8527
+ description: string().min(1),
8528
+ /** The level its lines are emitted at. Never below `info`. */
8529
+ defaultLevel: LogChannelLevelSchema,
8530
+ /**
8531
+ * Whether this channel can be narrowed to a camera.
8532
+ *
8533
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8534
+ * consulted with the numeric device id, AND every line the channel admits
8535
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8536
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8537
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8538
+ * the body is the only way to filter.
8539
+ *
8540
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8541
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8542
+ * the operator narrows to one camera, sees nothing, and concludes the code
8543
+ * path was never taken.
8544
+ */
8545
+ perDevice: boolean()
8546
+ });
8547
+ /**
8548
+ * An armed window over one channel, as the document hands it to a mirror.
8549
+ *
8550
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8551
+ * expires by itself, which is the one failure a boolean cannot avoid.
8552
+ */
8553
+ var LogChannelWindowSchema = object({
8554
+ channel: string().min(1),
8555
+ /** Epoch ms the window closes at. */
8556
+ armedUntilMs: number(),
8557
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8558
+ deviceIds: array(number().int()).readonly().nullable()
8559
+ });
8560
+ /**
8456
8561
  * Ops-log — the durable, append-only operations audit shared by the
8457
8562
  * recordings and events management surfaces.
8458
8563
  *
@@ -12073,6 +12178,35 @@ var MutationFilterSchema = object({
12073
12178
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
12074
12179
  whereNot: record(string(), unknown()).optional()
12075
12180
  });
12181
+ /**
12182
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
12183
+ *
12184
+ * `as` names the slot in the result, so the SAME column may be asked twice with
12185
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
12186
+ * a `Record<column, op>` shape could not express.
12187
+ */
12188
+ var AggregateFieldSchema = object({
12189
+ /** Result key. */
12190
+ as: string().min(1),
12191
+ /** Column to aggregate. Must be a real column of a declared collection. */
12192
+ field: string().min(1),
12193
+ op: _enum([
12194
+ "sum",
12195
+ "min",
12196
+ "max"
12197
+ ])
12198
+ });
12199
+ /**
12200
+ * `COUNT(*)` plus one number per requested field.
12201
+ *
12202
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
12203
+ * that really is 0 are different facts, and an accounting caller that renders
12204
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
12205
+ */
12206
+ var AggregateResultSchema = object({
12207
+ count: number().int(),
12208
+ values: record(string(), number().nullable())
12209
+ });
12076
12210
  /** A single stored record: `{ id, data }`. */
12077
12211
  var SettingsRecordSchema = object({
12078
12212
  id: string(),
@@ -12157,6 +12291,11 @@ method(object({
12157
12291
  collection: string(),
12158
12292
  filter: QueryFilterSchema.optional()
12159
12293
  }), number()), method(object({
12294
+ namespace: string().optional(),
12295
+ collection: string(),
12296
+ fields: array(AggregateFieldSchema).readonly(),
12297
+ filter: QueryFilterSchema.optional()
12298
+ }), AggregateResultSchema), method(object({
12160
12299
  namespace: string().optional(),
12161
12300
  collection: string(),
12162
12301
  field: string(),
@@ -12273,6 +12412,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12273
12412
  collection: string(),
12274
12413
  filter: QueryFilterSchema.optional()
12275
12414
  }), number(), { auth: "admin" }), method(object({
12415
+ namespace: string().optional(),
12416
+ collection: string(),
12417
+ fields: array(AggregateFieldSchema).readonly(),
12418
+ filter: QueryFilterSchema.optional()
12419
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
12276
12420
  namespace: string().optional(),
12277
12421
  collection: string(),
12278
12422
  field: string(),
@@ -12996,24 +13140,6 @@ var deviceProviderCapability = {
12996
13140
  })
12997
13141
  }
12998
13142
  };
12999
- /**
13000
- * Device Manager capability — hub-side singleton that unifies device persistence,
13001
- * live registry access, and all management operations into a single tRPC surface.
13002
- *
13003
- * Replaces:
13004
- * - `device-persistence` capability (persistence methods absorbed here)
13005
- * - `device-management.router.ts` (deleted in Phase 2)
13006
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
13007
- *
13008
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
13009
- * fork into separate processes but never run on remote cluster agents. Therefore:
13010
- * - No nodeId routing needed — this is a pure hub singleton.
13011
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
13012
- * - No shadow registry or cross-node aggregation required.
13013
- *
13014
- * Forked workers register devices back to the hub via `ctx.devices`
13015
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
13016
- */
13017
13143
  /** One child-placement directive on a container's `childLayout`. Structurally
13018
13144
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
13019
13145
  * shape for the same field. The child is identified by its re-sync-stable
@@ -13382,7 +13508,7 @@ method(object({
13382
13508
  * it answers today and the caller filters as it already does.
13383
13509
  */
13384
13510
  deviceIds: array(number()).optional()
13385
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
13511
+ }), 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({
13386
13512
  mode: LinkedDevicesModeSchema,
13387
13513
  devices: array(LinkedDeviceSchema)
13388
13514
  })), 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({
@@ -14106,6 +14232,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14106
14232
  kind: "mutation",
14107
14233
  auth: "admin"
14108
14234
  });
14235
+ /**
14236
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
14237
+ * through. It stores nothing.
14238
+ *
14239
+ * ## Why a capability at all, and why this shape
14240
+ *
14241
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
14242
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
14243
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
14244
+ * fails, an operator just never sees the channel somebody added. So the list
14245
+ * is assembled from declarations at runtime.
14246
+ *
14247
+ * The shape is copied from `log-destination.cap.ts`, which already does
14248
+ * exactly this job: `mode: 'collection'`, `internal: true`,
14249
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
14250
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
14251
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
14252
+ * runner's declarations reach hub-main over the transport that already exists.
14253
+ * No new UDS message, no second registry.
14254
+ *
14255
+ * ## What it deliberately does NOT own
14256
+ *
14257
+ * The VALUES — which channel is armed, for which cameras, until when — live in
14258
+ * ONE place: the logging settings document on the `system` cap
14259
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
14260
+ * value is the defect the plan behind this work exists to remove, and
14261
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
14262
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
14263
+ * setter for a window and no persistence of any kind.
14264
+ *
14265
+ * ## Why `apply` is here even so
14266
+ *
14267
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
14268
+ * seam has to carry the value from the authority to the mirror, and a channel
14269
+ * that cannot be reached is precisely the dead knob this whole slice exists to
14270
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
14271
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
14272
+ * persists nothing, it is never the source of a value, and it is called only
14273
+ * with a set the hub actually read (D49 — a read that fails does not call it
14274
+ * at all, so no channel is silently disarmed by a bad read).
14275
+ */
14276
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
14277
+ var LogChannelApplyResultSchema = object({
14278
+ /** How many declared channels are armed in this process after the call. */
14279
+ armed: number().int().min(0),
14280
+ /**
14281
+ * Names the document armed that this process does not declare. Reported
14282
+ * rather than swallowed: a name here is either a typo or an addon that has
14283
+ * not booted, and both deserve a line instead of silence.
14284
+ */
14285
+ unknown: array(string()).readonly()
14286
+ });
14287
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
14109
14288
  var LogLevelSchema = _enum([
14110
14289
  "debug",
14111
14290
  "info",
@@ -29388,17 +29567,60 @@ var SetSiteLocationInputSchema = object({
29388
29567
  longitude: number().min(-180).max(180)
29389
29568
  }).nullable();
29390
29569
  /**
29391
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29570
+ * The TRANSPORT a call arrived on.
29571
+ *
29572
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29573
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29574
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29575
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29576
+ * checkable rather than asserted.
29577
+ *
29578
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29579
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29580
+ * connection; the viewer talks to the hub over `wsLink`
29581
+ * exclusively, so this is the plane the HTTP census could not see.
29582
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29583
+ * never touches a socket and therefore never touched a census.
29584
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29585
+ * that is exactly what its `0` asserts: every plane the hub has can name
29586
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29587
+ * plane nobody instrumented lands here instead of vanishing from the total.
29588
+ */
29589
+ var TransportPlaneSchema = _enum([
29590
+ "http",
29591
+ "ws",
29592
+ "mesh",
29593
+ "unknown"
29594
+ ]);
29595
+ /**
29596
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29597
+ * reads as "not instrumented", which is the one thing this census must never
29598
+ * make an operator wonder about.
29599
+ */
29600
+ var TransportPlaneCountsSchema = object({
29601
+ http: number(),
29602
+ ws: number(),
29603
+ mesh: number(),
29604
+ unknown: number()
29605
+ });
29606
+ /**
29607
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29392
29608
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29393
29609
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29394
29610
  * already prints - never a token, never an `Authorization` header.
29611
+ *
29612
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29613
+ * and lives for hours, so folding it into a call count makes one long-lived
29614
+ * stream look like a storm.
29395
29615
  */
29396
29616
  var RequestCensusGroupSchema = object({
29617
+ plane: TransportPlaneSchema,
29397
29618
  procedure: string(),
29398
29619
  userAgent: string(),
29399
29620
  ip: string(),
29400
29621
  principal: string(),
29401
29622
  calls: number(),
29623
+ subscriptions: number(),
29402
29624
  perMin: number()
29403
29625
  });
29404
29626
  /**
@@ -29411,6 +29633,14 @@ var RequestCensusGroupSchema = object({
29411
29633
  var RequestCensusProcedureSchema = object({
29412
29634
  procedure: string(),
29413
29635
  calls: number(),
29636
+ /**
29637
+ * The same total, split by transport. THIS is the row that answers the
29638
+ * question the census exists for: one look at `deviceManager.listAll` says
29639
+ * which plane carried the 4 960, without joining two log lines by eye.
29640
+ */
29641
+ planes: TransportPlaneCountsSchema,
29642
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29643
+ subscriptions: number(),
29414
29644
  perMin: number()
29415
29645
  });
29416
29646
  /**
@@ -29438,14 +29668,45 @@ var RequestCensusStatusSchema = object({
29438
29668
  */
29439
29669
  procedureCalls: number(),
29440
29670
  /**
29671
+ * `procedureCalls` split by transport. The four keys sum to
29672
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29673
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29674
+ */
29675
+ planes: TransportPlaneCountsSchema,
29676
+ /**
29677
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29678
+ * on no plane at all - which is a RESULT (a plane is missing from the
29679
+ * instrument), not a failure, and it has to be visible to be read as one.
29680
+ */
29681
+ planesExplainTotal: boolean(),
29682
+ /**
29441
29683
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
29442
- * transport resolves one context per connection - but the number that says
29443
- * whether a plane this census cannot see was busy while HTTP was quiet.
29684
+ * adapter resolves one context per connection - kept because a plane's call
29685
+ * count of zero against 37 open connections says something different from a
29686
+ * plane with no connections at all.
29444
29687
  */
29445
29688
  wsConnections: number(),
29689
+ /**
29690
+ * Client frames the WS plane looked at. `wsMessages` far above
29691
+ * `planes.ws + subscriptions` means most traffic is not operations
29692
+ * (keepalives, connection params) - which is itself an answer.
29693
+ */
29694
+ wsMessages: number(),
29695
+ /**
29696
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29697
+ * purpose: one live-events stream opened at boot and held for six hours is
29698
+ * one subscription, and counting it as a call would let a quiet plane
29699
+ * masquerade as the storm.
29700
+ */
29701
+ subscriptions: number(),
29702
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29703
+ subscriptionStops: number(),
29446
29704
  distinctGroups: number(),
29447
- /** Calls counted in the totals whose group attribution was shed at the
29448
- * cardinality bound. */
29705
+ /**
29706
+ * Operations counted in the totals whose CALLER attribution was shed at the
29707
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29708
+ * which transport they arrived on, they just lost their group row.
29709
+ */
29449
29710
  unattributedCalls: number(),
29450
29711
  procedures: array(RequestCensusProcedureSchema).readonly(),
29451
29712
  groups: array(RequestCensusGroupSchema).readonly()
@@ -29468,10 +29729,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
29468
29729
  * The layers of the level hierarchy, general → specific. The most specific
29469
29730
  * layer that carries an explicit value wins.
29470
29731
  *
29471
- * `component` is DECLARED and not yet resolvable: the per-component channels
29472
- * are a later slice of the same plan, and a `levelSource` enum that has to
29473
- * grow later would force every consumer of this document to change with it.
29474
- * Nothing returns `component` today.
29732
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29733
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29734
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29735
+ * that turning it on would not force every consumer of this document to widen
29736
+ * a `levelSource` enum — which is what has now not happened.
29475
29737
  */
29476
29738
  var LoggingScopeKindSchema = _enum([
29477
29739
  "cluster",
@@ -29498,6 +29760,14 @@ var LoggingLevelLayerSchema = object({
29498
29760
  scope: LoggingScopeKindSchema,
29499
29761
  /** The node this layer speaks for; `null` on the cluster layer. */
29500
29762
  nodeId: string().nullable(),
29763
+ /**
29764
+ * The declared channel this layer speaks for; `null` on every layer but
29765
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29766
+ * by design — the convention this repo settled on is one orchestrator-wide
29767
+ * setting, never per node (D52) — so a component layer that carried a node
29768
+ * would invite a per-node copy of a value that has no per-node meaning.
29769
+ */
29770
+ component: string().nullable(),
29501
29771
  /** Explicitly set here, or `null` when this layer inherits. */
29502
29772
  level: LogLevelSchema$1.nullable()
29503
29773
  });
@@ -29539,6 +29809,49 @@ var DiagnosticWindowPatchSchema = object({
29539
29809
  reportEveryMs: number().int().positive().optional()
29540
29810
  });
29541
29811
  /**
29812
+ * A channel ARMED, as the document reports it.
29813
+ *
29814
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29815
+ * and the time left, because a diagnostic left running is itself an incident
29816
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29817
+ */
29818
+ var LogChannelWindowStateSchema = object({
29819
+ channel: string(),
29820
+ armed: boolean(),
29821
+ /** Epoch ms the window closes at. 0 when disarmed. */
29822
+ armedUntilMs: number(),
29823
+ /** Ms left before it expires on its own. 0 when disarmed. */
29824
+ remainingMs: number(),
29825
+ /**
29826
+ * The cameras it is narrowed to, or `null` for every camera.
29827
+ *
29828
+ * A channel declared `perDevice: false` can only ever report `null` here:
29829
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29830
+ * produce a filter that silently matches nothing. The server REFUSES such a
29831
+ * patch rather than quietly widening it — ignoring the request would teach
29832
+ * the operator that per-camera filtering works on that channel when it does
29833
+ * not.
29834
+ */
29835
+ deviceIds: array(number().int()).readonly().nullable()
29836
+ });
29837
+ /**
29838
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29839
+ * for the same reason: a channel is a window with a deadline, never a switch.
29840
+ */
29841
+ var LogChannelWindowPatchSchema = object({
29842
+ channel: string().min(1),
29843
+ armMs: number().int().min(0),
29844
+ /**
29845
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29846
+ *
29847
+ * Numeric because the repo's own rule makes it possible: every log line
29848
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29849
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29850
+ * diagnosed by hand, and this is the first thing that collects on it.
29851
+ */
29852
+ deviceIds: array(number().int()).readonly().nullable().optional()
29853
+ });
29854
+ /**
29542
29855
  * A PATCH, and patches MERGE.
29543
29856
  *
29544
29857
  * A field absent from the patch is left exactly as it was — arming a
@@ -29557,7 +29870,14 @@ var LoggingSettingsPatchSchema = object({
29557
29870
  * Only the diagnostics NAMED here change. An armed window that is not listed
29558
29871
  * keeps running — a patch is never a full replacement.
29559
29872
  */
29560
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29873
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29874
+ /**
29875
+ * Only the channels NAMED here change. An armed channel that is not listed
29876
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29877
+ * disarmed the channels it did not mention would make the Levels page and
29878
+ * the Diagnostics page fight over the same value.
29879
+ */
29880
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
29561
29881
  });
29562
29882
  /**
29563
29883
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -29570,9 +29890,22 @@ var LoggingSettingsPatchSchema = object({
29570
29890
  * authority over the whole hierarchy and answers for every layer, so the
29571
29891
  * layer selector needs a name the transport does not already own.
29572
29892
  */
29573
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29893
+ var GetLoggingSettingsInputSchema = object({
29894
+ scopeNodeId: string().optional(),
29895
+ /**
29896
+ * The declared CHANNEL this document is addressed at, when the caller wants
29897
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29898
+ *
29899
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29900
+ * axes from collapsing: a component level is cluster-wide, a node level is
29901
+ * not, and one selector for both would make "which of these two did I just
29902
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29903
+ */
29904
+ scopeComponent: string().optional()
29905
+ });
29574
29906
  var SetLoggingSettingsInputSchema = object({
29575
29907
  scopeNodeId: string().optional(),
29908
+ scopeComponent: string().optional(),
29576
29909
  patch: LoggingSettingsPatchSchema
29577
29910
  });
29578
29911
  /**
@@ -29587,9 +29920,20 @@ var SetLoggingSettingsInputSchema = object({
29587
29920
  var LoggingSettingsStateSchema = object({
29588
29921
  /** The layer this document was read at. `null` = the cluster layer. */
29589
29922
  scopeNodeId: string().nullable(),
29923
+ /** The channel this document was read at. `null` = no component layer. */
29924
+ scopeComponent: string().nullable(),
29590
29925
  effective: LoggingEffectiveSchema,
29591
29926
  explicit: LoggingExplicitSchema,
29592
29927
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29928
+ /**
29929
+ * Every channel the cluster's addons DECLARE, gathered from the
29930
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29931
+ * channel added by a redeployed addon appears without anybody editing a
29932
+ * list, and a channel whose addon is gone stops being offered.
29933
+ */
29934
+ channels: array(LogChannelDescriptorSchema).readonly(),
29935
+ /** The channels ARMED right now, each with its deadline. */
29936
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
29593
29937
  persisted: boolean()
29594
29938
  });
29595
29939
  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(), {
@@ -32574,6 +32918,12 @@ Object.freeze({
32574
32918
  addonId: null,
32575
32919
  access: "view"
32576
32920
  },
32921
+ "dataStoreProvider.aggregate": {
32922
+ capName: "data-store-provider",
32923
+ capScope: "system",
32924
+ addonId: null,
32925
+ access: "view"
32926
+ },
32577
32927
  "dataStoreProvider.count": {
32578
32928
  capName: "data-store-provider",
32579
32929
  capScope: "system",
@@ -32988,6 +33338,12 @@ Object.freeze({
32988
33338
  addonId: null,
32989
33339
  access: "view"
32990
33340
  },
33341
+ "deviceManager.getChildrenBatch": {
33342
+ capName: "device-manager",
33343
+ capScope: "system",
33344
+ addonId: null,
33345
+ access: "view"
33346
+ },
32991
33347
  "deviceManager.getConfigSchema": {
32992
33348
  capName: "device-manager",
32993
33349
  capScope: "system",
@@ -34038,6 +34394,18 @@ Object.freeze({
34038
34394
  addonId: null,
34039
34395
  access: "create"
34040
34396
  },
34397
+ "logChannels.apply": {
34398
+ capName: "log-channels",
34399
+ capScope: "system",
34400
+ addonId: null,
34401
+ access: "create"
34402
+ },
34403
+ "logChannels.list": {
34404
+ capName: "log-channels",
34405
+ capScope: "system",
34406
+ addonId: null,
34407
+ access: "view"
34408
+ },
34041
34409
  "logDestination.query": {
34042
34410
  capName: "log-destination",
34043
34411
  capScope: "system",
@@ -36192,6 +36560,12 @@ Object.freeze({
36192
36560
  addonId: null,
36193
36561
  access: "create"
36194
36562
  },
36563
+ "settingsStore.aggregate": {
36564
+ capName: "settings-store",
36565
+ capScope: "system",
36566
+ addonId: null,
36567
+ access: "view"
36568
+ },
36195
36569
  "settingsStore.count": {
36196
36570
  capName: "settings-store",
36197
36571
  capScope: "system",
@@ -37771,6 +38145,11 @@ Object.freeze({
37771
38145
  form: "single",
37772
38146
  optional: false
37773
38147
  }],
38148
+ "deviceManager.getChildrenBatch": [{
38149
+ name: "parentDeviceIds",
38150
+ form: "array",
38151
+ optional: false
38152
+ }],
37774
38153
  "deviceManager.getConfigSchema": [{
37775
38154
  name: "deviceId",
37776
38155
  form: "single",
package/dist/addon.mjs CHANGED
@@ -8452,6 +8452,111 @@ var CameraSwitchGroupSchema = object({
8452
8452
  fetchedAt: number()
8453
8453
  });
8454
8454
  /**
8455
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8456
+ * an addon declares its channels in.
8457
+ *
8458
+ * ## Two axes, deliberately separated
8459
+ *
8460
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8461
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8462
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8463
+ * and rots silently. So a channel is declared where it is consulted, and the
8464
+ * `log-channels` capability enumerates the declarations.
8465
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8466
+ * thing: the logging settings document on the `system` cap. Two authorities
8467
+ * over the values is the exact defect
8468
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8469
+ * remove; re-introducing it from the cure side would be grotesque.
8470
+ *
8471
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8472
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8473
+ * the hot path with a value somebody actually read, and by
8474
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8475
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8476
+ * disarmed one (D49).
8477
+ *
8478
+ * ## The canonical call shape
8479
+ *
8480
+ * ```ts
8481
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8482
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8483
+ * }
8484
+ * ```
8485
+ *
8486
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8487
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8488
+ * object literal is never constructed because it lives inside the branch. It
8489
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8490
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8491
+ * destination floor (measured at 1.93 ns/call when off).
8492
+ *
8493
+ * ## Why a channel emits at `info`
8494
+ *
8495
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8496
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8497
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8498
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8499
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8500
+ * emits at the channel's declared level, whose schema floor is `info`.
8501
+ */
8502
+ /**
8503
+ * The level a channel writes at once armed.
8504
+ *
8505
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8506
+ * not leave the process for Loki, and the whole point of arming a channel is
8507
+ * to read it later.
8508
+ */
8509
+ var LogChannelLevelSchema = _enum([
8510
+ "info",
8511
+ "warn",
8512
+ "error"
8513
+ ]);
8514
+ /**
8515
+ * What an addon declares about one channel. No value, no state — a
8516
+ * declaration is inert.
8517
+ */
8518
+ var LogChannelDescriptorSchema = object({
8519
+ /**
8520
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8521
+ * the addon's short name so an operator reading a channel list can tell who
8522
+ * owns it without a second lookup.
8523
+ */
8524
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8525
+ /** One sentence: what the operator will SEE after arming it. */
8526
+ description: string().min(1),
8527
+ /** The level its lines are emitted at. Never below `info`. */
8528
+ defaultLevel: LogChannelLevelSchema,
8529
+ /**
8530
+ * Whether this channel can be narrowed to a camera.
8531
+ *
8532
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8533
+ * consulted with the numeric device id, AND every line the channel admits
8534
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8535
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8536
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8537
+ * the body is the only way to filter.
8538
+ *
8539
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8540
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8541
+ * the operator narrows to one camera, sees nothing, and concludes the code
8542
+ * path was never taken.
8543
+ */
8544
+ perDevice: boolean()
8545
+ });
8546
+ /**
8547
+ * An armed window over one channel, as the document hands it to a mirror.
8548
+ *
8549
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8550
+ * expires by itself, which is the one failure a boolean cannot avoid.
8551
+ */
8552
+ var LogChannelWindowSchema = object({
8553
+ channel: string().min(1),
8554
+ /** Epoch ms the window closes at. */
8555
+ armedUntilMs: number(),
8556
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8557
+ deviceIds: array(number().int()).readonly().nullable()
8558
+ });
8559
+ /**
8455
8560
  * Ops-log — the durable, append-only operations audit shared by the
8456
8561
  * recordings and events management surfaces.
8457
8562
  *
@@ -12072,6 +12177,35 @@ var MutationFilterSchema = object({
12072
12177
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
12073
12178
  whereNot: record(string(), unknown()).optional()
12074
12179
  });
12180
+ /**
12181
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
12182
+ *
12183
+ * `as` names the slot in the result, so the SAME column may be asked twice with
12184
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
12185
+ * a `Record<column, op>` shape could not express.
12186
+ */
12187
+ var AggregateFieldSchema = object({
12188
+ /** Result key. */
12189
+ as: string().min(1),
12190
+ /** Column to aggregate. Must be a real column of a declared collection. */
12191
+ field: string().min(1),
12192
+ op: _enum([
12193
+ "sum",
12194
+ "min",
12195
+ "max"
12196
+ ])
12197
+ });
12198
+ /**
12199
+ * `COUNT(*)` plus one number per requested field.
12200
+ *
12201
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
12202
+ * that really is 0 are different facts, and an accounting caller that renders
12203
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
12204
+ */
12205
+ var AggregateResultSchema = object({
12206
+ count: number().int(),
12207
+ values: record(string(), number().nullable())
12208
+ });
12075
12209
  /** A single stored record: `{ id, data }`. */
12076
12210
  var SettingsRecordSchema = object({
12077
12211
  id: string(),
@@ -12156,6 +12290,11 @@ method(object({
12156
12290
  collection: string(),
12157
12291
  filter: QueryFilterSchema.optional()
12158
12292
  }), number()), method(object({
12293
+ namespace: string().optional(),
12294
+ collection: string(),
12295
+ fields: array(AggregateFieldSchema).readonly(),
12296
+ filter: QueryFilterSchema.optional()
12297
+ }), AggregateResultSchema), method(object({
12159
12298
  namespace: string().optional(),
12160
12299
  collection: string(),
12161
12300
  field: string(),
@@ -12272,6 +12411,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12272
12411
  collection: string(),
12273
12412
  filter: QueryFilterSchema.optional()
12274
12413
  }), number(), { auth: "admin" }), method(object({
12414
+ namespace: string().optional(),
12415
+ collection: string(),
12416
+ fields: array(AggregateFieldSchema).readonly(),
12417
+ filter: QueryFilterSchema.optional()
12418
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
12275
12419
  namespace: string().optional(),
12276
12420
  collection: string(),
12277
12421
  field: string(),
@@ -12995,24 +13139,6 @@ var deviceProviderCapability = {
12995
13139
  })
12996
13140
  }
12997
13141
  };
12998
- /**
12999
- * Device Manager capability — hub-side singleton that unifies device persistence,
13000
- * live registry access, and all management operations into a single tRPC surface.
13001
- *
13002
- * Replaces:
13003
- * - `device-persistence` capability (persistence methods absorbed here)
13004
- * - `device-management.router.ts` (deleted in Phase 2)
13005
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
13006
- *
13007
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
13008
- * fork into separate processes but never run on remote cluster agents. Therefore:
13009
- * - No nodeId routing needed — this is a pure hub singleton.
13010
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
13011
- * - No shadow registry or cross-node aggregation required.
13012
- *
13013
- * Forked workers register devices back to the hub via `ctx.devices`
13014
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
13015
- */
13016
13142
  /** One child-placement directive on a container's `childLayout`. Structurally
13017
13143
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
13018
13144
  * shape for the same field. The child is identified by its re-sync-stable
@@ -13381,7 +13507,7 @@ method(object({
13381
13507
  * it answers today and the caller filters as it already does.
13382
13508
  */
13383
13509
  deviceIds: array(number()).optional()
13384
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
13510
+ }), 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({
13385
13511
  mode: LinkedDevicesModeSchema,
13386
13512
  devices: array(LinkedDeviceSchema)
13387
13513
  })), 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({
@@ -14105,6 +14231,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14105
14231
  kind: "mutation",
14106
14232
  auth: "admin"
14107
14233
  });
14234
+ /**
14235
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
14236
+ * through. It stores nothing.
14237
+ *
14238
+ * ## Why a capability at all, and why this shape
14239
+ *
14240
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
14241
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
14242
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
14243
+ * fails, an operator just never sees the channel somebody added. So the list
14244
+ * is assembled from declarations at runtime.
14245
+ *
14246
+ * The shape is copied from `log-destination.cap.ts`, which already does
14247
+ * exactly this job: `mode: 'collection'`, `internal: true`,
14248
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
14249
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
14250
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
14251
+ * runner's declarations reach hub-main over the transport that already exists.
14252
+ * No new UDS message, no second registry.
14253
+ *
14254
+ * ## What it deliberately does NOT own
14255
+ *
14256
+ * The VALUES — which channel is armed, for which cameras, until when — live in
14257
+ * ONE place: the logging settings document on the `system` cap
14258
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
14259
+ * value is the defect the plan behind this work exists to remove, and
14260
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
14261
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
14262
+ * setter for a window and no persistence of any kind.
14263
+ *
14264
+ * ## Why `apply` is here even so
14265
+ *
14266
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
14267
+ * seam has to carry the value from the authority to the mirror, and a channel
14268
+ * that cannot be reached is precisely the dead knob this whole slice exists to
14269
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
14270
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
14271
+ * persists nothing, it is never the source of a value, and it is called only
14272
+ * with a set the hub actually read (D49 — a read that fails does not call it
14273
+ * at all, so no channel is silently disarmed by a bad read).
14274
+ */
14275
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
14276
+ var LogChannelApplyResultSchema = object({
14277
+ /** How many declared channels are armed in this process after the call. */
14278
+ armed: number().int().min(0),
14279
+ /**
14280
+ * Names the document armed that this process does not declare. Reported
14281
+ * rather than swallowed: a name here is either a typo or an addon that has
14282
+ * not booted, and both deserve a line instead of silence.
14283
+ */
14284
+ unknown: array(string()).readonly()
14285
+ });
14286
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
14108
14287
  var LogLevelSchema = _enum([
14109
14288
  "debug",
14110
14289
  "info",
@@ -29387,17 +29566,60 @@ var SetSiteLocationInputSchema = object({
29387
29566
  longitude: number().min(-180).max(180)
29388
29567
  }).nullable();
29389
29568
  /**
29390
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29569
+ * The TRANSPORT a call arrived on.
29570
+ *
29571
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29572
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29573
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29574
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29575
+ * checkable rather than asserted.
29576
+ *
29577
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29578
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29579
+ * connection; the viewer talks to the hub over `wsLink`
29580
+ * exclusively, so this is the plane the HTTP census could not see.
29581
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29582
+ * never touches a socket and therefore never touched a census.
29583
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29584
+ * that is exactly what its `0` asserts: every plane the hub has can name
29585
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29586
+ * plane nobody instrumented lands here instead of vanishing from the total.
29587
+ */
29588
+ var TransportPlaneSchema = _enum([
29589
+ "http",
29590
+ "ws",
29591
+ "mesh",
29592
+ "unknown"
29593
+ ]);
29594
+ /**
29595
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29596
+ * reads as "not instrumented", which is the one thing this census must never
29597
+ * make an operator wonder about.
29598
+ */
29599
+ var TransportPlaneCountsSchema = object({
29600
+ http: number(),
29601
+ ws: number(),
29602
+ mesh: number(),
29603
+ unknown: number()
29604
+ });
29605
+ /**
29606
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29391
29607
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29392
29608
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29393
29609
  * already prints - never a token, never an `Authorization` header.
29610
+ *
29611
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29612
+ * and lives for hours, so folding it into a call count makes one long-lived
29613
+ * stream look like a storm.
29394
29614
  */
29395
29615
  var RequestCensusGroupSchema = object({
29616
+ plane: TransportPlaneSchema,
29396
29617
  procedure: string(),
29397
29618
  userAgent: string(),
29398
29619
  ip: string(),
29399
29620
  principal: string(),
29400
29621
  calls: number(),
29622
+ subscriptions: number(),
29401
29623
  perMin: number()
29402
29624
  });
29403
29625
  /**
@@ -29410,6 +29632,14 @@ var RequestCensusGroupSchema = object({
29410
29632
  var RequestCensusProcedureSchema = object({
29411
29633
  procedure: string(),
29412
29634
  calls: number(),
29635
+ /**
29636
+ * The same total, split by transport. THIS is the row that answers the
29637
+ * question the census exists for: one look at `deviceManager.listAll` says
29638
+ * which plane carried the 4 960, without joining two log lines by eye.
29639
+ */
29640
+ planes: TransportPlaneCountsSchema,
29641
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29642
+ subscriptions: number(),
29413
29643
  perMin: number()
29414
29644
  });
29415
29645
  /**
@@ -29437,14 +29667,45 @@ var RequestCensusStatusSchema = object({
29437
29667
  */
29438
29668
  procedureCalls: number(),
29439
29669
  /**
29670
+ * `procedureCalls` split by transport. The four keys sum to
29671
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29672
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29673
+ */
29674
+ planes: TransportPlaneCountsSchema,
29675
+ /**
29676
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29677
+ * on no plane at all - which is a RESULT (a plane is missing from the
29678
+ * instrument), not a failure, and it has to be visible to be read as one.
29679
+ */
29680
+ planesExplainTotal: boolean(),
29681
+ /**
29440
29682
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
29441
- * transport resolves one context per connection - but the number that says
29442
- * whether a plane this census cannot see was busy while HTTP was quiet.
29683
+ * adapter resolves one context per connection - kept because a plane's call
29684
+ * count of zero against 37 open connections says something different from a
29685
+ * plane with no connections at all.
29443
29686
  */
29444
29687
  wsConnections: number(),
29688
+ /**
29689
+ * Client frames the WS plane looked at. `wsMessages` far above
29690
+ * `planes.ws + subscriptions` means most traffic is not operations
29691
+ * (keepalives, connection params) - which is itself an answer.
29692
+ */
29693
+ wsMessages: number(),
29694
+ /**
29695
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29696
+ * purpose: one live-events stream opened at boot and held for six hours is
29697
+ * one subscription, and counting it as a call would let a quiet plane
29698
+ * masquerade as the storm.
29699
+ */
29700
+ subscriptions: number(),
29701
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29702
+ subscriptionStops: number(),
29445
29703
  distinctGroups: number(),
29446
- /** Calls counted in the totals whose group attribution was shed at the
29447
- * cardinality bound. */
29704
+ /**
29705
+ * Operations counted in the totals whose CALLER attribution was shed at the
29706
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29707
+ * which transport they arrived on, they just lost their group row.
29708
+ */
29448
29709
  unattributedCalls: number(),
29449
29710
  procedures: array(RequestCensusProcedureSchema).readonly(),
29450
29711
  groups: array(RequestCensusGroupSchema).readonly()
@@ -29467,10 +29728,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
29467
29728
  * The layers of the level hierarchy, general → specific. The most specific
29468
29729
  * layer that carries an explicit value wins.
29469
29730
  *
29470
- * `component` is DECLARED and not yet resolvable: the per-component channels
29471
- * are a later slice of the same plan, and a `levelSource` enum that has to
29472
- * grow later would force every consumer of this document to change with it.
29473
- * Nothing returns `component` today.
29731
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29732
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29733
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29734
+ * that turning it on would not force every consumer of this document to widen
29735
+ * a `levelSource` enum — which is what has now not happened.
29474
29736
  */
29475
29737
  var LoggingScopeKindSchema = _enum([
29476
29738
  "cluster",
@@ -29497,6 +29759,14 @@ var LoggingLevelLayerSchema = object({
29497
29759
  scope: LoggingScopeKindSchema,
29498
29760
  /** The node this layer speaks for; `null` on the cluster layer. */
29499
29761
  nodeId: string().nullable(),
29762
+ /**
29763
+ * The declared channel this layer speaks for; `null` on every layer but
29764
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29765
+ * by design — the convention this repo settled on is one orchestrator-wide
29766
+ * setting, never per node (D52) — so a component layer that carried a node
29767
+ * would invite a per-node copy of a value that has no per-node meaning.
29768
+ */
29769
+ component: string().nullable(),
29500
29770
  /** Explicitly set here, or `null` when this layer inherits. */
29501
29771
  level: LogLevelSchema$1.nullable()
29502
29772
  });
@@ -29538,6 +29808,49 @@ var DiagnosticWindowPatchSchema = object({
29538
29808
  reportEveryMs: number().int().positive().optional()
29539
29809
  });
29540
29810
  /**
29811
+ * A channel ARMED, as the document reports it.
29812
+ *
29813
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29814
+ * and the time left, because a diagnostic left running is itself an incident
29815
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29816
+ */
29817
+ var LogChannelWindowStateSchema = object({
29818
+ channel: string(),
29819
+ armed: boolean(),
29820
+ /** Epoch ms the window closes at. 0 when disarmed. */
29821
+ armedUntilMs: number(),
29822
+ /** Ms left before it expires on its own. 0 when disarmed. */
29823
+ remainingMs: number(),
29824
+ /**
29825
+ * The cameras it is narrowed to, or `null` for every camera.
29826
+ *
29827
+ * A channel declared `perDevice: false` can only ever report `null` here:
29828
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29829
+ * produce a filter that silently matches nothing. The server REFUSES such a
29830
+ * patch rather than quietly widening it — ignoring the request would teach
29831
+ * the operator that per-camera filtering works on that channel when it does
29832
+ * not.
29833
+ */
29834
+ deviceIds: array(number().int()).readonly().nullable()
29835
+ });
29836
+ /**
29837
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29838
+ * for the same reason: a channel is a window with a deadline, never a switch.
29839
+ */
29840
+ var LogChannelWindowPatchSchema = object({
29841
+ channel: string().min(1),
29842
+ armMs: number().int().min(0),
29843
+ /**
29844
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29845
+ *
29846
+ * Numeric because the repo's own rule makes it possible: every log line
29847
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29848
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29849
+ * diagnosed by hand, and this is the first thing that collects on it.
29850
+ */
29851
+ deviceIds: array(number().int()).readonly().nullable().optional()
29852
+ });
29853
+ /**
29541
29854
  * A PATCH, and patches MERGE.
29542
29855
  *
29543
29856
  * A field absent from the patch is left exactly as it was — arming a
@@ -29556,7 +29869,14 @@ var LoggingSettingsPatchSchema = object({
29556
29869
  * Only the diagnostics NAMED here change. An armed window that is not listed
29557
29870
  * keeps running — a patch is never a full replacement.
29558
29871
  */
29559
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29872
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29873
+ /**
29874
+ * Only the channels NAMED here change. An armed channel that is not listed
29875
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29876
+ * disarmed the channels it did not mention would make the Levels page and
29877
+ * the Diagnostics page fight over the same value.
29878
+ */
29879
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
29560
29880
  });
29561
29881
  /**
29562
29882
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -29569,9 +29889,22 @@ var LoggingSettingsPatchSchema = object({
29569
29889
  * authority over the whole hierarchy and answers for every layer, so the
29570
29890
  * layer selector needs a name the transport does not already own.
29571
29891
  */
29572
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29892
+ var GetLoggingSettingsInputSchema = object({
29893
+ scopeNodeId: string().optional(),
29894
+ /**
29895
+ * The declared CHANNEL this document is addressed at, when the caller wants
29896
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29897
+ *
29898
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29899
+ * axes from collapsing: a component level is cluster-wide, a node level is
29900
+ * not, and one selector for both would make "which of these two did I just
29901
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29902
+ */
29903
+ scopeComponent: string().optional()
29904
+ });
29573
29905
  var SetLoggingSettingsInputSchema = object({
29574
29906
  scopeNodeId: string().optional(),
29907
+ scopeComponent: string().optional(),
29575
29908
  patch: LoggingSettingsPatchSchema
29576
29909
  });
29577
29910
  /**
@@ -29586,9 +29919,20 @@ var SetLoggingSettingsInputSchema = object({
29586
29919
  var LoggingSettingsStateSchema = object({
29587
29920
  /** The layer this document was read at. `null` = the cluster layer. */
29588
29921
  scopeNodeId: string().nullable(),
29922
+ /** The channel this document was read at. `null` = no component layer. */
29923
+ scopeComponent: string().nullable(),
29589
29924
  effective: LoggingEffectiveSchema,
29590
29925
  explicit: LoggingExplicitSchema,
29591
29926
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29927
+ /**
29928
+ * Every channel the cluster's addons DECLARE, gathered from the
29929
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29930
+ * channel added by a redeployed addon appears without anybody editing a
29931
+ * list, and a channel whose addon is gone stops being offered.
29932
+ */
29933
+ channels: array(LogChannelDescriptorSchema).readonly(),
29934
+ /** The channels ARMED right now, each with its deadline. */
29935
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
29592
29936
  persisted: boolean()
29593
29937
  });
29594
29938
  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(), {
@@ -32573,6 +32917,12 @@ Object.freeze({
32573
32917
  addonId: null,
32574
32918
  access: "view"
32575
32919
  },
32920
+ "dataStoreProvider.aggregate": {
32921
+ capName: "data-store-provider",
32922
+ capScope: "system",
32923
+ addonId: null,
32924
+ access: "view"
32925
+ },
32576
32926
  "dataStoreProvider.count": {
32577
32927
  capName: "data-store-provider",
32578
32928
  capScope: "system",
@@ -32987,6 +33337,12 @@ Object.freeze({
32987
33337
  addonId: null,
32988
33338
  access: "view"
32989
33339
  },
33340
+ "deviceManager.getChildrenBatch": {
33341
+ capName: "device-manager",
33342
+ capScope: "system",
33343
+ addonId: null,
33344
+ access: "view"
33345
+ },
32990
33346
  "deviceManager.getConfigSchema": {
32991
33347
  capName: "device-manager",
32992
33348
  capScope: "system",
@@ -34037,6 +34393,18 @@ Object.freeze({
34037
34393
  addonId: null,
34038
34394
  access: "create"
34039
34395
  },
34396
+ "logChannels.apply": {
34397
+ capName: "log-channels",
34398
+ capScope: "system",
34399
+ addonId: null,
34400
+ access: "create"
34401
+ },
34402
+ "logChannels.list": {
34403
+ capName: "log-channels",
34404
+ capScope: "system",
34405
+ addonId: null,
34406
+ access: "view"
34407
+ },
34040
34408
  "logDestination.query": {
34041
34409
  capName: "log-destination",
34042
34410
  capScope: "system",
@@ -36191,6 +36559,12 @@ Object.freeze({
36191
36559
  addonId: null,
36192
36560
  access: "create"
36193
36561
  },
36562
+ "settingsStore.aggregate": {
36563
+ capName: "settings-store",
36564
+ capScope: "system",
36565
+ addonId: null,
36566
+ access: "view"
36567
+ },
36194
36568
  "settingsStore.count": {
36195
36569
  capName: "settings-store",
36196
36570
  capScope: "system",
@@ -37770,6 +38144,11 @@ Object.freeze({
37770
38144
  form: "single",
37771
38145
  optional: false
37772
38146
  }],
38147
+ "deviceManager.getChildrenBatch": [{
38148
+ name: "parentDeviceIds",
38149
+ form: "array",
38150
+ optional: false
38151
+ }],
37773
38152
  "deviceManager.getConfigSchema": [{
37774
38153
  name: "deviceId",
37775
38154
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rademacher",
3
- "version": "0.2.31",
3
+ "version": "0.2.33",
4
4
  "description": "Rademacher HomePilot device-provider addon for CamStack — wraps the @apocaliss92/noderademacher local-hub client (roller shutters over the cover cap)",
5
5
  "keywords": [
6
6
  "camstack",