@camstack/addon-provider-velux 0.2.32 → 0.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.
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
@@ -7468,6 +7468,111 @@ var CameraSwitchGroupSchema = object({
7468
7468
  fetchedAt: number()
7469
7469
  });
7470
7470
  /**
7471
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7472
+ * an addon declares its channels in.
7473
+ *
7474
+ * ## Two axes, deliberately separated
7475
+ *
7476
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7477
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7478
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7479
+ * and rots silently. So a channel is declared where it is consulted, and the
7480
+ * `log-channels` capability enumerates the declarations.
7481
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7482
+ * thing: the logging settings document on the `system` cap. Two authorities
7483
+ * over the values is the exact defect
7484
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7485
+ * remove; re-introducing it from the cure side would be grotesque.
7486
+ *
7487
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7488
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7489
+ * the hot path with a value somebody actually read, and by
7490
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7491
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7492
+ * disarmed one (D49).
7493
+ *
7494
+ * ## The canonical call shape
7495
+ *
7496
+ * ```ts
7497
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7498
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7499
+ * }
7500
+ * ```
7501
+ *
7502
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7503
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7504
+ * object literal is never constructed because it lives inside the branch. It
7505
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7506
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7507
+ * destination floor (measured at 1.93 ns/call when off).
7508
+ *
7509
+ * ## Why a channel emits at `info`
7510
+ *
7511
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7512
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7513
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7514
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7515
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7516
+ * emits at the channel's declared level, whose schema floor is `info`.
7517
+ */
7518
+ /**
7519
+ * The level a channel writes at once armed.
7520
+ *
7521
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7522
+ * not leave the process for Loki, and the whole point of arming a channel is
7523
+ * to read it later.
7524
+ */
7525
+ var LogChannelLevelSchema = _enum([
7526
+ "info",
7527
+ "warn",
7528
+ "error"
7529
+ ]);
7530
+ /**
7531
+ * What an addon declares about one channel. No value, no state — a
7532
+ * declaration is inert.
7533
+ */
7534
+ var LogChannelDescriptorSchema = object({
7535
+ /**
7536
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7537
+ * the addon's short name so an operator reading a channel list can tell who
7538
+ * owns it without a second lookup.
7539
+ */
7540
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7541
+ /** One sentence: what the operator will SEE after arming it. */
7542
+ description: string().min(1),
7543
+ /** The level its lines are emitted at. Never below `info`. */
7544
+ defaultLevel: LogChannelLevelSchema,
7545
+ /**
7546
+ * Whether this channel can be narrowed to a camera.
7547
+ *
7548
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7549
+ * consulted with the numeric device id, AND every line the channel admits
7550
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7551
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7552
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7553
+ * the body is the only way to filter.
7554
+ *
7555
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7556
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7557
+ * the operator narrows to one camera, sees nothing, and concludes the code
7558
+ * path was never taken.
7559
+ */
7560
+ perDevice: boolean()
7561
+ });
7562
+ /**
7563
+ * An armed window over one channel, as the document hands it to a mirror.
7564
+ *
7565
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7566
+ * expires by itself, which is the one failure a boolean cannot avoid.
7567
+ */
7568
+ var LogChannelWindowSchema = object({
7569
+ channel: string().min(1),
7570
+ /** Epoch ms the window closes at. */
7571
+ armedUntilMs: number(),
7572
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7573
+ deviceIds: array(number().int()).readonly().nullable()
7574
+ });
7575
+ /**
7471
7576
  * Ops-log — the durable, append-only operations audit shared by the
7472
7577
  * recordings and events management surfaces.
7473
7578
  *
@@ -11088,6 +11193,35 @@ var MutationFilterSchema = object({
11088
11193
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11089
11194
  whereNot: record(string(), unknown()).optional()
11090
11195
  });
11196
+ /**
11197
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11198
+ *
11199
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11200
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11201
+ * a `Record<column, op>` shape could not express.
11202
+ */
11203
+ var AggregateFieldSchema = object({
11204
+ /** Result key. */
11205
+ as: string().min(1),
11206
+ /** Column to aggregate. Must be a real column of a declared collection. */
11207
+ field: string().min(1),
11208
+ op: _enum([
11209
+ "sum",
11210
+ "min",
11211
+ "max"
11212
+ ])
11213
+ });
11214
+ /**
11215
+ * `COUNT(*)` plus one number per requested field.
11216
+ *
11217
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11218
+ * that really is 0 are different facts, and an accounting caller that renders
11219
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11220
+ */
11221
+ var AggregateResultSchema = object({
11222
+ count: number().int(),
11223
+ values: record(string(), number().nullable())
11224
+ });
11091
11225
  /** A single stored record: `{ id, data }`. */
11092
11226
  var SettingsRecordSchema = object({
11093
11227
  id: string(),
@@ -11172,6 +11306,11 @@ method(object({
11172
11306
  collection: string(),
11173
11307
  filter: QueryFilterSchema.optional()
11174
11308
  }), number()), method(object({
11309
+ namespace: string().optional(),
11310
+ collection: string(),
11311
+ fields: array(AggregateFieldSchema).readonly(),
11312
+ filter: QueryFilterSchema.optional()
11313
+ }), AggregateResultSchema), method(object({
11175
11314
  namespace: string().optional(),
11176
11315
  collection: string(),
11177
11316
  field: string(),
@@ -11288,6 +11427,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11288
11427
  collection: string(),
11289
11428
  filter: QueryFilterSchema.optional()
11290
11429
  }), number(), { auth: "admin" }), method(object({
11430
+ namespace: string().optional(),
11431
+ collection: string(),
11432
+ fields: array(AggregateFieldSchema).readonly(),
11433
+ filter: QueryFilterSchema.optional()
11434
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11291
11435
  namespace: string().optional(),
11292
11436
  collection: string(),
11293
11437
  field: string(),
@@ -12011,24 +12155,6 @@ var deviceProviderCapability = {
12011
12155
  })
12012
12156
  }
12013
12157
  };
12014
- /**
12015
- * Device Manager capability — hub-side singleton that unifies device persistence,
12016
- * live registry access, and all management operations into a single tRPC surface.
12017
- *
12018
- * Replaces:
12019
- * - `device-persistence` capability (persistence methods absorbed here)
12020
- * - `device-management.router.ts` (deleted in Phase 2)
12021
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12022
- *
12023
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12024
- * fork into separate processes but never run on remote cluster agents. Therefore:
12025
- * - No nodeId routing needed — this is a pure hub singleton.
12026
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12027
- * - No shadow registry or cross-node aggregation required.
12028
- *
12029
- * Forked workers register devices back to the hub via `ctx.devices`
12030
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12031
- */
12032
12158
  /** One child-placement directive on a container's `childLayout`. Structurally
12033
12159
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12034
12160
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12397,7 +12523,7 @@ method(object({
12397
12523
  * it answers today and the caller filters as it already does.
12398
12524
  */
12399
12525
  deviceIds: array(number()).optional()
12400
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12526
+ }), 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({
12401
12527
  mode: LinkedDevicesModeSchema,
12402
12528
  devices: array(LinkedDeviceSchema)
12403
12529
  })), 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({
@@ -13121,6 +13247,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13121
13247
  kind: "mutation",
13122
13248
  auth: "admin"
13123
13249
  });
13250
+ /**
13251
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13252
+ * through. It stores nothing.
13253
+ *
13254
+ * ## Why a capability at all, and why this shape
13255
+ *
13256
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13257
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13258
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13259
+ * fails, an operator just never sees the channel somebody added. So the list
13260
+ * is assembled from declarations at runtime.
13261
+ *
13262
+ * The shape is copied from `log-destination.cap.ts`, which already does
13263
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13264
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13265
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13266
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13267
+ * runner's declarations reach hub-main over the transport that already exists.
13268
+ * No new UDS message, no second registry.
13269
+ *
13270
+ * ## What it deliberately does NOT own
13271
+ *
13272
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13273
+ * ONE place: the logging settings document on the `system` cap
13274
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13275
+ * value is the defect the plan behind this work exists to remove, and
13276
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13277
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13278
+ * setter for a window and no persistence of any kind.
13279
+ *
13280
+ * ## Why `apply` is here even so
13281
+ *
13282
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13283
+ * seam has to carry the value from the authority to the mirror, and a channel
13284
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13285
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13286
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13287
+ * persists nothing, it is never the source of a value, and it is called only
13288
+ * with a set the hub actually read (D49 — a read that fails does not call it
13289
+ * at all, so no channel is silently disarmed by a bad read).
13290
+ */
13291
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13292
+ var LogChannelApplyResultSchema = object({
13293
+ /** How many declared channels are armed in this process after the call. */
13294
+ armed: number().int().min(0),
13295
+ /**
13296
+ * Names the document armed that this process does not declare. Reported
13297
+ * rather than swallowed: a name here is either a typo or an addon that has
13298
+ * not booted, and both deserve a line instead of silence.
13299
+ */
13300
+ unknown: array(string()).readonly()
13301
+ });
13302
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13124
13303
  var LogLevelSchema = _enum([
13125
13304
  "debug",
13126
13305
  "info",
@@ -28403,17 +28582,60 @@ var SetSiteLocationInputSchema = object({
28403
28582
  longitude: number().min(-180).max(180)
28404
28583
  }).nullable();
28405
28584
  /**
28406
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28585
+ * The TRANSPORT a call arrived on.
28586
+ *
28587
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28588
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28589
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28590
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28591
+ * checkable rather than asserted.
28592
+ *
28593
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28594
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28595
+ * connection; the viewer talks to the hub over `wsLink`
28596
+ * exclusively, so this is the plane the HTTP census could not see.
28597
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28598
+ * never touches a socket and therefore never touched a census.
28599
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28600
+ * that is exactly what its `0` asserts: every plane the hub has can name
28601
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28602
+ * plane nobody instrumented lands here instead of vanishing from the total.
28603
+ */
28604
+ var TransportPlaneSchema = _enum([
28605
+ "http",
28606
+ "ws",
28607
+ "mesh",
28608
+ "unknown"
28609
+ ]);
28610
+ /**
28611
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28612
+ * reads as "not instrumented", which is the one thing this census must never
28613
+ * make an operator wonder about.
28614
+ */
28615
+ var TransportPlaneCountsSchema = object({
28616
+ http: number(),
28617
+ ws: number(),
28618
+ mesh: number(),
28619
+ unknown: number()
28620
+ });
28621
+ /**
28622
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28407
28623
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28408
28624
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28409
28625
  * already prints - never a token, never an `Authorization` header.
28626
+ *
28627
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28628
+ * and lives for hours, so folding it into a call count makes one long-lived
28629
+ * stream look like a storm.
28410
28630
  */
28411
28631
  var RequestCensusGroupSchema = object({
28632
+ plane: TransportPlaneSchema,
28412
28633
  procedure: string(),
28413
28634
  userAgent: string(),
28414
28635
  ip: string(),
28415
28636
  principal: string(),
28416
28637
  calls: number(),
28638
+ subscriptions: number(),
28417
28639
  perMin: number()
28418
28640
  });
28419
28641
  /**
@@ -28426,6 +28648,14 @@ var RequestCensusGroupSchema = object({
28426
28648
  var RequestCensusProcedureSchema = object({
28427
28649
  procedure: string(),
28428
28650
  calls: number(),
28651
+ /**
28652
+ * The same total, split by transport. THIS is the row that answers the
28653
+ * question the census exists for: one look at `deviceManager.listAll` says
28654
+ * which plane carried the 4 960, without joining two log lines by eye.
28655
+ */
28656
+ planes: TransportPlaneCountsSchema,
28657
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28658
+ subscriptions: number(),
28429
28659
  perMin: number()
28430
28660
  });
28431
28661
  /**
@@ -28453,14 +28683,45 @@ var RequestCensusStatusSchema = object({
28453
28683
  */
28454
28684
  procedureCalls: number(),
28455
28685
  /**
28686
+ * `procedureCalls` split by transport. The four keys sum to
28687
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28688
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28689
+ */
28690
+ planes: TransportPlaneCountsSchema,
28691
+ /**
28692
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28693
+ * on no plane at all - which is a RESULT (a plane is missing from the
28694
+ * instrument), not a failure, and it has to be visible to be read as one.
28695
+ */
28696
+ planesExplainTotal: boolean(),
28697
+ /**
28456
28698
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28457
- * transport resolves one context per connection - but the number that says
28458
- * whether a plane this census cannot see was busy while HTTP was quiet.
28699
+ * adapter resolves one context per connection - kept because a plane's call
28700
+ * count of zero against 37 open connections says something different from a
28701
+ * plane with no connections at all.
28459
28702
  */
28460
28703
  wsConnections: number(),
28704
+ /**
28705
+ * Client frames the WS plane looked at. `wsMessages` far above
28706
+ * `planes.ws + subscriptions` means most traffic is not operations
28707
+ * (keepalives, connection params) - which is itself an answer.
28708
+ */
28709
+ wsMessages: number(),
28710
+ /**
28711
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28712
+ * purpose: one live-events stream opened at boot and held for six hours is
28713
+ * one subscription, and counting it as a call would let a quiet plane
28714
+ * masquerade as the storm.
28715
+ */
28716
+ subscriptions: number(),
28717
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28718
+ subscriptionStops: number(),
28461
28719
  distinctGroups: number(),
28462
- /** Calls counted in the totals whose group attribution was shed at the
28463
- * cardinality bound. */
28720
+ /**
28721
+ * Operations counted in the totals whose CALLER attribution was shed at the
28722
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28723
+ * which transport they arrived on, they just lost their group row.
28724
+ */
28464
28725
  unattributedCalls: number(),
28465
28726
  procedures: array(RequestCensusProcedureSchema).readonly(),
28466
28727
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28483,10 +28744,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28483
28744
  * The layers of the level hierarchy, general → specific. The most specific
28484
28745
  * layer that carries an explicit value wins.
28485
28746
  *
28486
- * `component` is DECLARED and not yet resolvable: the per-component channels
28487
- * are a later slice of the same plan, and a `levelSource` enum that has to
28488
- * grow later would force every consumer of this document to change with it.
28489
- * Nothing returns `component` today.
28747
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28748
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28749
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28750
+ * that turning it on would not force every consumer of this document to widen
28751
+ * a `levelSource` enum — which is what has now not happened.
28490
28752
  */
28491
28753
  var LoggingScopeKindSchema = _enum([
28492
28754
  "cluster",
@@ -28513,6 +28775,14 @@ var LoggingLevelLayerSchema = object({
28513
28775
  scope: LoggingScopeKindSchema,
28514
28776
  /** The node this layer speaks for; `null` on the cluster layer. */
28515
28777
  nodeId: string().nullable(),
28778
+ /**
28779
+ * The declared channel this layer speaks for; `null` on every layer but
28780
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28781
+ * by design — the convention this repo settled on is one orchestrator-wide
28782
+ * setting, never per node (D52) — so a component layer that carried a node
28783
+ * would invite a per-node copy of a value that has no per-node meaning.
28784
+ */
28785
+ component: string().nullable(),
28516
28786
  /** Explicitly set here, or `null` when this layer inherits. */
28517
28787
  level: LogLevelSchema$1.nullable()
28518
28788
  });
@@ -28554,6 +28824,49 @@ var DiagnosticWindowPatchSchema = object({
28554
28824
  reportEveryMs: number().int().positive().optional()
28555
28825
  });
28556
28826
  /**
28827
+ * A channel ARMED, as the document reports it.
28828
+ *
28829
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28830
+ * and the time left, because a diagnostic left running is itself an incident
28831
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28832
+ */
28833
+ var LogChannelWindowStateSchema = object({
28834
+ channel: string(),
28835
+ armed: boolean(),
28836
+ /** Epoch ms the window closes at. 0 when disarmed. */
28837
+ armedUntilMs: number(),
28838
+ /** Ms left before it expires on its own. 0 when disarmed. */
28839
+ remainingMs: number(),
28840
+ /**
28841
+ * The cameras it is narrowed to, or `null` for every camera.
28842
+ *
28843
+ * A channel declared `perDevice: false` can only ever report `null` here:
28844
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28845
+ * produce a filter that silently matches nothing. The server REFUSES such a
28846
+ * patch rather than quietly widening it — ignoring the request would teach
28847
+ * the operator that per-camera filtering works on that channel when it does
28848
+ * not.
28849
+ */
28850
+ deviceIds: array(number().int()).readonly().nullable()
28851
+ });
28852
+ /**
28853
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28854
+ * for the same reason: a channel is a window with a deadline, never a switch.
28855
+ */
28856
+ var LogChannelWindowPatchSchema = object({
28857
+ channel: string().min(1),
28858
+ armMs: number().int().min(0),
28859
+ /**
28860
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
28861
+ *
28862
+ * Numeric because the repo's own rule makes it possible: every log line
28863
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
28864
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
28865
+ * diagnosed by hand, and this is the first thing that collects on it.
28866
+ */
28867
+ deviceIds: array(number().int()).readonly().nullable().optional()
28868
+ });
28869
+ /**
28557
28870
  * A PATCH, and patches MERGE.
28558
28871
  *
28559
28872
  * A field absent from the patch is left exactly as it was — arming a
@@ -28572,7 +28885,14 @@ var LoggingSettingsPatchSchema = object({
28572
28885
  * Only the diagnostics NAMED here change. An armed window that is not listed
28573
28886
  * keeps running — a patch is never a full replacement.
28574
28887
  */
28575
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28888
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
28889
+ /**
28890
+ * Only the channels NAMED here change. An armed channel that is not listed
28891
+ * keeps running — same rule as `diagnostics`, because a patch that silently
28892
+ * disarmed the channels it did not mention would make the Levels page and
28893
+ * the Diagnostics page fight over the same value.
28894
+ */
28895
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28576
28896
  });
28577
28897
  /**
28578
28898
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28585,9 +28905,22 @@ var LoggingSettingsPatchSchema = object({
28585
28905
  * authority over the whole hierarchy and answers for every layer, so the
28586
28906
  * layer selector needs a name the transport does not already own.
28587
28907
  */
28588
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28908
+ var GetLoggingSettingsInputSchema = object({
28909
+ scopeNodeId: string().optional(),
28910
+ /**
28911
+ * The declared CHANNEL this document is addressed at, when the caller wants
28912
+ * the `component` layer. Absent = the node/cluster hierarchy only.
28913
+ *
28914
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
28915
+ * axes from collapsing: a component level is cluster-wide, a node level is
28916
+ * not, and one selector for both would make "which of these two did I just
28917
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
28918
+ */
28919
+ scopeComponent: string().optional()
28920
+ });
28589
28921
  var SetLoggingSettingsInputSchema = object({
28590
28922
  scopeNodeId: string().optional(),
28923
+ scopeComponent: string().optional(),
28591
28924
  patch: LoggingSettingsPatchSchema
28592
28925
  });
28593
28926
  /**
@@ -28602,9 +28935,20 @@ var SetLoggingSettingsInputSchema = object({
28602
28935
  var LoggingSettingsStateSchema = object({
28603
28936
  /** The layer this document was read at. `null` = the cluster layer. */
28604
28937
  scopeNodeId: string().nullable(),
28938
+ /** The channel this document was read at. `null` = no component layer. */
28939
+ scopeComponent: string().nullable(),
28605
28940
  effective: LoggingEffectiveSchema,
28606
28941
  explicit: LoggingExplicitSchema,
28607
28942
  activeWindows: array(DiagnosticWindowSchema).readonly(),
28943
+ /**
28944
+ * Every channel the cluster's addons DECLARE, gathered from the
28945
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
28946
+ * channel added by a redeployed addon appears without anybody editing a
28947
+ * list, and a channel whose addon is gone stops being offered.
28948
+ */
28949
+ channels: array(LogChannelDescriptorSchema).readonly(),
28950
+ /** The channels ARMED right now, each with its deadline. */
28951
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28608
28952
  persisted: boolean()
28609
28953
  });
28610
28954
  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(), {
@@ -31589,6 +31933,12 @@ Object.freeze({
31589
31933
  addonId: null,
31590
31934
  access: "view"
31591
31935
  },
31936
+ "dataStoreProvider.aggregate": {
31937
+ capName: "data-store-provider",
31938
+ capScope: "system",
31939
+ addonId: null,
31940
+ access: "view"
31941
+ },
31592
31942
  "dataStoreProvider.count": {
31593
31943
  capName: "data-store-provider",
31594
31944
  capScope: "system",
@@ -32003,6 +32353,12 @@ Object.freeze({
32003
32353
  addonId: null,
32004
32354
  access: "view"
32005
32355
  },
32356
+ "deviceManager.getChildrenBatch": {
32357
+ capName: "device-manager",
32358
+ capScope: "system",
32359
+ addonId: null,
32360
+ access: "view"
32361
+ },
32006
32362
  "deviceManager.getConfigSchema": {
32007
32363
  capName: "device-manager",
32008
32364
  capScope: "system",
@@ -33053,6 +33409,18 @@ Object.freeze({
33053
33409
  addonId: null,
33054
33410
  access: "create"
33055
33411
  },
33412
+ "logChannels.apply": {
33413
+ capName: "log-channels",
33414
+ capScope: "system",
33415
+ addonId: null,
33416
+ access: "create"
33417
+ },
33418
+ "logChannels.list": {
33419
+ capName: "log-channels",
33420
+ capScope: "system",
33421
+ addonId: null,
33422
+ access: "view"
33423
+ },
33056
33424
  "logDestination.query": {
33057
33425
  capName: "log-destination",
33058
33426
  capScope: "system",
@@ -35207,6 +35575,12 @@ Object.freeze({
35207
35575
  addonId: null,
35208
35576
  access: "create"
35209
35577
  },
35578
+ "settingsStore.aggregate": {
35579
+ capName: "settings-store",
35580
+ capScope: "system",
35581
+ addonId: null,
35582
+ access: "view"
35583
+ },
35210
35584
  "settingsStore.count": {
35211
35585
  capName: "settings-store",
35212
35586
  capScope: "system",
@@ -36786,6 +37160,11 @@ Object.freeze({
36786
37160
  form: "single",
36787
37161
  optional: false
36788
37162
  }],
37163
+ "deviceManager.getChildrenBatch": [{
37164
+ name: "parentDeviceIds",
37165
+ form: "array",
37166
+ optional: false
37167
+ }],
36789
37168
  "deviceManager.getConfigSchema": [{
36790
37169
  name: "deviceId",
36791
37170
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7467,6 +7467,111 @@ var CameraSwitchGroupSchema = object({
7467
7467
  fetchedAt: number()
7468
7468
  });
7469
7469
  /**
7470
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7471
+ * an addon declares its channels in.
7472
+ *
7473
+ * ## Two axes, deliberately separated
7474
+ *
7475
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7476
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7477
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7478
+ * and rots silently. So a channel is declared where it is consulted, and the
7479
+ * `log-channels` capability enumerates the declarations.
7480
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7481
+ * thing: the logging settings document on the `system` cap. Two authorities
7482
+ * over the values is the exact defect
7483
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7484
+ * remove; re-introducing it from the cure side would be grotesque.
7485
+ *
7486
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7487
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7488
+ * the hot path with a value somebody actually read, and by
7489
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7490
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7491
+ * disarmed one (D49).
7492
+ *
7493
+ * ## The canonical call shape
7494
+ *
7495
+ * ```ts
7496
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7497
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7498
+ * }
7499
+ * ```
7500
+ *
7501
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7502
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7503
+ * object literal is never constructed because it lives inside the branch. It
7504
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7505
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7506
+ * destination floor (measured at 1.93 ns/call when off).
7507
+ *
7508
+ * ## Why a channel emits at `info`
7509
+ *
7510
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7511
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7512
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7513
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7514
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7515
+ * emits at the channel's declared level, whose schema floor is `info`.
7516
+ */
7517
+ /**
7518
+ * The level a channel writes at once armed.
7519
+ *
7520
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7521
+ * not leave the process for Loki, and the whole point of arming a channel is
7522
+ * to read it later.
7523
+ */
7524
+ var LogChannelLevelSchema = _enum([
7525
+ "info",
7526
+ "warn",
7527
+ "error"
7528
+ ]);
7529
+ /**
7530
+ * What an addon declares about one channel. No value, no state — a
7531
+ * declaration is inert.
7532
+ */
7533
+ var LogChannelDescriptorSchema = object({
7534
+ /**
7535
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7536
+ * the addon's short name so an operator reading a channel list can tell who
7537
+ * owns it without a second lookup.
7538
+ */
7539
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7540
+ /** One sentence: what the operator will SEE after arming it. */
7541
+ description: string().min(1),
7542
+ /** The level its lines are emitted at. Never below `info`. */
7543
+ defaultLevel: LogChannelLevelSchema,
7544
+ /**
7545
+ * Whether this channel can be narrowed to a camera.
7546
+ *
7547
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7548
+ * consulted with the numeric device id, AND every line the channel admits
7549
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7550
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7551
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7552
+ * the body is the only way to filter.
7553
+ *
7554
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7555
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7556
+ * the operator narrows to one camera, sees nothing, and concludes the code
7557
+ * path was never taken.
7558
+ */
7559
+ perDevice: boolean()
7560
+ });
7561
+ /**
7562
+ * An armed window over one channel, as the document hands it to a mirror.
7563
+ *
7564
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7565
+ * expires by itself, which is the one failure a boolean cannot avoid.
7566
+ */
7567
+ var LogChannelWindowSchema = object({
7568
+ channel: string().min(1),
7569
+ /** Epoch ms the window closes at. */
7570
+ armedUntilMs: number(),
7571
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7572
+ deviceIds: array(number().int()).readonly().nullable()
7573
+ });
7574
+ /**
7470
7575
  * Ops-log — the durable, append-only operations audit shared by the
7471
7576
  * recordings and events management surfaces.
7472
7577
  *
@@ -11087,6 +11192,35 @@ var MutationFilterSchema = object({
11087
11192
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11088
11193
  whereNot: record(string(), unknown()).optional()
11089
11194
  });
11195
+ /**
11196
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11197
+ *
11198
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11199
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11200
+ * a `Record<column, op>` shape could not express.
11201
+ */
11202
+ var AggregateFieldSchema = object({
11203
+ /** Result key. */
11204
+ as: string().min(1),
11205
+ /** Column to aggregate. Must be a real column of a declared collection. */
11206
+ field: string().min(1),
11207
+ op: _enum([
11208
+ "sum",
11209
+ "min",
11210
+ "max"
11211
+ ])
11212
+ });
11213
+ /**
11214
+ * `COUNT(*)` plus one number per requested field.
11215
+ *
11216
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11217
+ * that really is 0 are different facts, and an accounting caller that renders
11218
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11219
+ */
11220
+ var AggregateResultSchema = object({
11221
+ count: number().int(),
11222
+ values: record(string(), number().nullable())
11223
+ });
11090
11224
  /** A single stored record: `{ id, data }`. */
11091
11225
  var SettingsRecordSchema = object({
11092
11226
  id: string(),
@@ -11171,6 +11305,11 @@ method(object({
11171
11305
  collection: string(),
11172
11306
  filter: QueryFilterSchema.optional()
11173
11307
  }), number()), method(object({
11308
+ namespace: string().optional(),
11309
+ collection: string(),
11310
+ fields: array(AggregateFieldSchema).readonly(),
11311
+ filter: QueryFilterSchema.optional()
11312
+ }), AggregateResultSchema), method(object({
11174
11313
  namespace: string().optional(),
11175
11314
  collection: string(),
11176
11315
  field: string(),
@@ -11287,6 +11426,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11287
11426
  collection: string(),
11288
11427
  filter: QueryFilterSchema.optional()
11289
11428
  }), number(), { auth: "admin" }), method(object({
11429
+ namespace: string().optional(),
11430
+ collection: string(),
11431
+ fields: array(AggregateFieldSchema).readonly(),
11432
+ filter: QueryFilterSchema.optional()
11433
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11290
11434
  namespace: string().optional(),
11291
11435
  collection: string(),
11292
11436
  field: string(),
@@ -12010,24 +12154,6 @@ var deviceProviderCapability = {
12010
12154
  })
12011
12155
  }
12012
12156
  };
12013
- /**
12014
- * Device Manager capability — hub-side singleton that unifies device persistence,
12015
- * live registry access, and all management operations into a single tRPC surface.
12016
- *
12017
- * Replaces:
12018
- * - `device-persistence` capability (persistence methods absorbed here)
12019
- * - `device-management.router.ts` (deleted in Phase 2)
12020
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12021
- *
12022
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12023
- * fork into separate processes but never run on remote cluster agents. Therefore:
12024
- * - No nodeId routing needed — this is a pure hub singleton.
12025
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12026
- * - No shadow registry or cross-node aggregation required.
12027
- *
12028
- * Forked workers register devices back to the hub via `ctx.devices`
12029
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12030
- */
12031
12157
  /** One child-placement directive on a container's `childLayout`. Structurally
12032
12158
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12033
12159
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12396,7 +12522,7 @@ method(object({
12396
12522
  * it answers today and the caller filters as it already does.
12397
12523
  */
12398
12524
  deviceIds: array(number()).optional()
12399
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12525
+ }), 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({
12400
12526
  mode: LinkedDevicesModeSchema,
12401
12527
  devices: array(LinkedDeviceSchema)
12402
12528
  })), 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({
@@ -13120,6 +13246,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13120
13246
  kind: "mutation",
13121
13247
  auth: "admin"
13122
13248
  });
13249
+ /**
13250
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13251
+ * through. It stores nothing.
13252
+ *
13253
+ * ## Why a capability at all, and why this shape
13254
+ *
13255
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13256
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13257
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13258
+ * fails, an operator just never sees the channel somebody added. So the list
13259
+ * is assembled from declarations at runtime.
13260
+ *
13261
+ * The shape is copied from `log-destination.cap.ts`, which already does
13262
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13263
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13264
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13265
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13266
+ * runner's declarations reach hub-main over the transport that already exists.
13267
+ * No new UDS message, no second registry.
13268
+ *
13269
+ * ## What it deliberately does NOT own
13270
+ *
13271
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13272
+ * ONE place: the logging settings document on the `system` cap
13273
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13274
+ * value is the defect the plan behind this work exists to remove, and
13275
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13276
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13277
+ * setter for a window and no persistence of any kind.
13278
+ *
13279
+ * ## Why `apply` is here even so
13280
+ *
13281
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13282
+ * seam has to carry the value from the authority to the mirror, and a channel
13283
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13284
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13285
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13286
+ * persists nothing, it is never the source of a value, and it is called only
13287
+ * with a set the hub actually read (D49 — a read that fails does not call it
13288
+ * at all, so no channel is silently disarmed by a bad read).
13289
+ */
13290
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13291
+ var LogChannelApplyResultSchema = object({
13292
+ /** How many declared channels are armed in this process after the call. */
13293
+ armed: number().int().min(0),
13294
+ /**
13295
+ * Names the document armed that this process does not declare. Reported
13296
+ * rather than swallowed: a name here is either a typo or an addon that has
13297
+ * not booted, and both deserve a line instead of silence.
13298
+ */
13299
+ unknown: array(string()).readonly()
13300
+ });
13301
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13123
13302
  var LogLevelSchema = _enum([
13124
13303
  "debug",
13125
13304
  "info",
@@ -28402,17 +28581,60 @@ var SetSiteLocationInputSchema = object({
28402
28581
  longitude: number().min(-180).max(180)
28403
28582
  }).nullable();
28404
28583
  /**
28405
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28584
+ * The TRANSPORT a call arrived on.
28585
+ *
28586
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28587
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28588
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28589
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28590
+ * checkable rather than asserted.
28591
+ *
28592
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28593
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28594
+ * connection; the viewer talks to the hub over `wsLink`
28595
+ * exclusively, so this is the plane the HTTP census could not see.
28596
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28597
+ * never touches a socket and therefore never touched a census.
28598
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28599
+ * that is exactly what its `0` asserts: every plane the hub has can name
28600
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28601
+ * plane nobody instrumented lands here instead of vanishing from the total.
28602
+ */
28603
+ var TransportPlaneSchema = _enum([
28604
+ "http",
28605
+ "ws",
28606
+ "mesh",
28607
+ "unknown"
28608
+ ]);
28609
+ /**
28610
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28611
+ * reads as "not instrumented", which is the one thing this census must never
28612
+ * make an operator wonder about.
28613
+ */
28614
+ var TransportPlaneCountsSchema = object({
28615
+ http: number(),
28616
+ ws: number(),
28617
+ mesh: number(),
28618
+ unknown: number()
28619
+ });
28620
+ /**
28621
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28406
28622
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28407
28623
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28408
28624
  * already prints - never a token, never an `Authorization` header.
28625
+ *
28626
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28627
+ * and lives for hours, so folding it into a call count makes one long-lived
28628
+ * stream look like a storm.
28409
28629
  */
28410
28630
  var RequestCensusGroupSchema = object({
28631
+ plane: TransportPlaneSchema,
28411
28632
  procedure: string(),
28412
28633
  userAgent: string(),
28413
28634
  ip: string(),
28414
28635
  principal: string(),
28415
28636
  calls: number(),
28637
+ subscriptions: number(),
28416
28638
  perMin: number()
28417
28639
  });
28418
28640
  /**
@@ -28425,6 +28647,14 @@ var RequestCensusGroupSchema = object({
28425
28647
  var RequestCensusProcedureSchema = object({
28426
28648
  procedure: string(),
28427
28649
  calls: number(),
28650
+ /**
28651
+ * The same total, split by transport. THIS is the row that answers the
28652
+ * question the census exists for: one look at `deviceManager.listAll` says
28653
+ * which plane carried the 4 960, without joining two log lines by eye.
28654
+ */
28655
+ planes: TransportPlaneCountsSchema,
28656
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28657
+ subscriptions: number(),
28428
28658
  perMin: number()
28429
28659
  });
28430
28660
  /**
@@ -28452,14 +28682,45 @@ var RequestCensusStatusSchema = object({
28452
28682
  */
28453
28683
  procedureCalls: number(),
28454
28684
  /**
28685
+ * `procedureCalls` split by transport. The four keys sum to
28686
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28687
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28688
+ */
28689
+ planes: TransportPlaneCountsSchema,
28690
+ /**
28691
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28692
+ * on no plane at all - which is a RESULT (a plane is missing from the
28693
+ * instrument), not a failure, and it has to be visible to be read as one.
28694
+ */
28695
+ planesExplainTotal: boolean(),
28696
+ /**
28455
28697
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28456
- * transport resolves one context per connection - but the number that says
28457
- * whether a plane this census cannot see was busy while HTTP was quiet.
28698
+ * adapter resolves one context per connection - kept because a plane's call
28699
+ * count of zero against 37 open connections says something different from a
28700
+ * plane with no connections at all.
28458
28701
  */
28459
28702
  wsConnections: number(),
28703
+ /**
28704
+ * Client frames the WS plane looked at. `wsMessages` far above
28705
+ * `planes.ws + subscriptions` means most traffic is not operations
28706
+ * (keepalives, connection params) - which is itself an answer.
28707
+ */
28708
+ wsMessages: number(),
28709
+ /**
28710
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28711
+ * purpose: one live-events stream opened at boot and held for six hours is
28712
+ * one subscription, and counting it as a call would let a quiet plane
28713
+ * masquerade as the storm.
28714
+ */
28715
+ subscriptions: number(),
28716
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28717
+ subscriptionStops: number(),
28460
28718
  distinctGroups: number(),
28461
- /** Calls counted in the totals whose group attribution was shed at the
28462
- * cardinality bound. */
28719
+ /**
28720
+ * Operations counted in the totals whose CALLER attribution was shed at the
28721
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28722
+ * which transport they arrived on, they just lost their group row.
28723
+ */
28463
28724
  unattributedCalls: number(),
28464
28725
  procedures: array(RequestCensusProcedureSchema).readonly(),
28465
28726
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28482,10 +28743,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28482
28743
  * The layers of the level hierarchy, general → specific. The most specific
28483
28744
  * layer that carries an explicit value wins.
28484
28745
  *
28485
- * `component` is DECLARED and not yet resolvable: the per-component channels
28486
- * are a later slice of the same plan, and a `levelSource` enum that has to
28487
- * grow later would force every consumer of this document to change with it.
28488
- * Nothing returns `component` today.
28746
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28747
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28748
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28749
+ * that turning it on would not force every consumer of this document to widen
28750
+ * a `levelSource` enum — which is what has now not happened.
28489
28751
  */
28490
28752
  var LoggingScopeKindSchema = _enum([
28491
28753
  "cluster",
@@ -28512,6 +28774,14 @@ var LoggingLevelLayerSchema = object({
28512
28774
  scope: LoggingScopeKindSchema,
28513
28775
  /** The node this layer speaks for; `null` on the cluster layer. */
28514
28776
  nodeId: string().nullable(),
28777
+ /**
28778
+ * The declared channel this layer speaks for; `null` on every layer but
28779
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28780
+ * by design — the convention this repo settled on is one orchestrator-wide
28781
+ * setting, never per node (D52) — so a component layer that carried a node
28782
+ * would invite a per-node copy of a value that has no per-node meaning.
28783
+ */
28784
+ component: string().nullable(),
28515
28785
  /** Explicitly set here, or `null` when this layer inherits. */
28516
28786
  level: LogLevelSchema$1.nullable()
28517
28787
  });
@@ -28553,6 +28823,49 @@ var DiagnosticWindowPatchSchema = object({
28553
28823
  reportEveryMs: number().int().positive().optional()
28554
28824
  });
28555
28825
  /**
28826
+ * A channel ARMED, as the document reports it.
28827
+ *
28828
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28829
+ * and the time left, because a diagnostic left running is itself an incident
28830
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28831
+ */
28832
+ var LogChannelWindowStateSchema = object({
28833
+ channel: string(),
28834
+ armed: boolean(),
28835
+ /** Epoch ms the window closes at. 0 when disarmed. */
28836
+ armedUntilMs: number(),
28837
+ /** Ms left before it expires on its own. 0 when disarmed. */
28838
+ remainingMs: number(),
28839
+ /**
28840
+ * The cameras it is narrowed to, or `null` for every camera.
28841
+ *
28842
+ * A channel declared `perDevice: false` can only ever report `null` here:
28843
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28844
+ * produce a filter that silently matches nothing. The server REFUSES such a
28845
+ * patch rather than quietly widening it — ignoring the request would teach
28846
+ * the operator that per-camera filtering works on that channel when it does
28847
+ * not.
28848
+ */
28849
+ deviceIds: array(number().int()).readonly().nullable()
28850
+ });
28851
+ /**
28852
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28853
+ * for the same reason: a channel is a window with a deadline, never a switch.
28854
+ */
28855
+ var LogChannelWindowPatchSchema = object({
28856
+ channel: string().min(1),
28857
+ armMs: number().int().min(0),
28858
+ /**
28859
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
28860
+ *
28861
+ * Numeric because the repo's own rule makes it possible: every log line
28862
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
28863
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
28864
+ * diagnosed by hand, and this is the first thing that collects on it.
28865
+ */
28866
+ deviceIds: array(number().int()).readonly().nullable().optional()
28867
+ });
28868
+ /**
28556
28869
  * A PATCH, and patches MERGE.
28557
28870
  *
28558
28871
  * A field absent from the patch is left exactly as it was — arming a
@@ -28571,7 +28884,14 @@ var LoggingSettingsPatchSchema = object({
28571
28884
  * Only the diagnostics NAMED here change. An armed window that is not listed
28572
28885
  * keeps running — a patch is never a full replacement.
28573
28886
  */
28574
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28887
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
28888
+ /**
28889
+ * Only the channels NAMED here change. An armed channel that is not listed
28890
+ * keeps running — same rule as `diagnostics`, because a patch that silently
28891
+ * disarmed the channels it did not mention would make the Levels page and
28892
+ * the Diagnostics page fight over the same value.
28893
+ */
28894
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28575
28895
  });
28576
28896
  /**
28577
28897
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28584,9 +28904,22 @@ var LoggingSettingsPatchSchema = object({
28584
28904
  * authority over the whole hierarchy and answers for every layer, so the
28585
28905
  * layer selector needs a name the transport does not already own.
28586
28906
  */
28587
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28907
+ var GetLoggingSettingsInputSchema = object({
28908
+ scopeNodeId: string().optional(),
28909
+ /**
28910
+ * The declared CHANNEL this document is addressed at, when the caller wants
28911
+ * the `component` layer. Absent = the node/cluster hierarchy only.
28912
+ *
28913
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
28914
+ * axes from collapsing: a component level is cluster-wide, a node level is
28915
+ * not, and one selector for both would make "which of these two did I just
28916
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
28917
+ */
28918
+ scopeComponent: string().optional()
28919
+ });
28588
28920
  var SetLoggingSettingsInputSchema = object({
28589
28921
  scopeNodeId: string().optional(),
28922
+ scopeComponent: string().optional(),
28590
28923
  patch: LoggingSettingsPatchSchema
28591
28924
  });
28592
28925
  /**
@@ -28601,9 +28934,20 @@ var SetLoggingSettingsInputSchema = object({
28601
28934
  var LoggingSettingsStateSchema = object({
28602
28935
  /** The layer this document was read at. `null` = the cluster layer. */
28603
28936
  scopeNodeId: string().nullable(),
28937
+ /** The channel this document was read at. `null` = no component layer. */
28938
+ scopeComponent: string().nullable(),
28604
28939
  effective: LoggingEffectiveSchema,
28605
28940
  explicit: LoggingExplicitSchema,
28606
28941
  activeWindows: array(DiagnosticWindowSchema).readonly(),
28942
+ /**
28943
+ * Every channel the cluster's addons DECLARE, gathered from the
28944
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
28945
+ * channel added by a redeployed addon appears without anybody editing a
28946
+ * list, and a channel whose addon is gone stops being offered.
28947
+ */
28948
+ channels: array(LogChannelDescriptorSchema).readonly(),
28949
+ /** The channels ARMED right now, each with its deadline. */
28950
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28607
28951
  persisted: boolean()
28608
28952
  });
28609
28953
  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(), {
@@ -31588,6 +31932,12 @@ Object.freeze({
31588
31932
  addonId: null,
31589
31933
  access: "view"
31590
31934
  },
31935
+ "dataStoreProvider.aggregate": {
31936
+ capName: "data-store-provider",
31937
+ capScope: "system",
31938
+ addonId: null,
31939
+ access: "view"
31940
+ },
31591
31941
  "dataStoreProvider.count": {
31592
31942
  capName: "data-store-provider",
31593
31943
  capScope: "system",
@@ -32002,6 +32352,12 @@ Object.freeze({
32002
32352
  addonId: null,
32003
32353
  access: "view"
32004
32354
  },
32355
+ "deviceManager.getChildrenBatch": {
32356
+ capName: "device-manager",
32357
+ capScope: "system",
32358
+ addonId: null,
32359
+ access: "view"
32360
+ },
32005
32361
  "deviceManager.getConfigSchema": {
32006
32362
  capName: "device-manager",
32007
32363
  capScope: "system",
@@ -33052,6 +33408,18 @@ Object.freeze({
33052
33408
  addonId: null,
33053
33409
  access: "create"
33054
33410
  },
33411
+ "logChannels.apply": {
33412
+ capName: "log-channels",
33413
+ capScope: "system",
33414
+ addonId: null,
33415
+ access: "create"
33416
+ },
33417
+ "logChannels.list": {
33418
+ capName: "log-channels",
33419
+ capScope: "system",
33420
+ addonId: null,
33421
+ access: "view"
33422
+ },
33055
33423
  "logDestination.query": {
33056
33424
  capName: "log-destination",
33057
33425
  capScope: "system",
@@ -35206,6 +35574,12 @@ Object.freeze({
35206
35574
  addonId: null,
35207
35575
  access: "create"
35208
35576
  },
35577
+ "settingsStore.aggregate": {
35578
+ capName: "settings-store",
35579
+ capScope: "system",
35580
+ addonId: null,
35581
+ access: "view"
35582
+ },
35209
35583
  "settingsStore.count": {
35210
35584
  capName: "settings-store",
35211
35585
  capScope: "system",
@@ -36785,6 +37159,11 @@ Object.freeze({
36785
37159
  form: "single",
36786
37160
  optional: false
36787
37161
  }],
37162
+ "deviceManager.getChildrenBatch": [{
37163
+ name: "parentDeviceIds",
37164
+ form: "array",
37165
+ optional: false
37166
+ }],
36788
37167
  "deviceManager.getConfigSchema": [{
36789
37168
  name: "deviceId",
36790
37169
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-velux",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "description": "Velux KLF-200 device-provider addon for CamStack — local-gateway window + shutter covers (positional, no tilt)",
5
5
  "keywords": [
6
6
  "camstack",