@camstack/addon-provider-dreo 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
@@ -7504,6 +7504,111 @@ var CameraSwitchGroupSchema = object({
7504
7504
  fetchedAt: number()
7505
7505
  });
7506
7506
  /**
7507
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7508
+ * an addon declares its channels in.
7509
+ *
7510
+ * ## Two axes, deliberately separated
7511
+ *
7512
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7513
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7514
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7515
+ * and rots silently. So a channel is declared where it is consulted, and the
7516
+ * `log-channels` capability enumerates the declarations.
7517
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7518
+ * thing: the logging settings document on the `system` cap. Two authorities
7519
+ * over the values is the exact defect
7520
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7521
+ * remove; re-introducing it from the cure side would be grotesque.
7522
+ *
7523
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7524
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7525
+ * the hot path with a value somebody actually read, and by
7526
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7527
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7528
+ * disarmed one (D49).
7529
+ *
7530
+ * ## The canonical call shape
7531
+ *
7532
+ * ```ts
7533
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7534
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7535
+ * }
7536
+ * ```
7537
+ *
7538
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7539
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7540
+ * object literal is never constructed because it lives inside the branch. It
7541
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7542
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7543
+ * destination floor (measured at 1.93 ns/call when off).
7544
+ *
7545
+ * ## Why a channel emits at `info`
7546
+ *
7547
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7548
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7549
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7550
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7551
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7552
+ * emits at the channel's declared level, whose schema floor is `info`.
7553
+ */
7554
+ /**
7555
+ * The level a channel writes at once armed.
7556
+ *
7557
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7558
+ * not leave the process for Loki, and the whole point of arming a channel is
7559
+ * to read it later.
7560
+ */
7561
+ var LogChannelLevelSchema = _enum([
7562
+ "info",
7563
+ "warn",
7564
+ "error"
7565
+ ]);
7566
+ /**
7567
+ * What an addon declares about one channel. No value, no state — a
7568
+ * declaration is inert.
7569
+ */
7570
+ var LogChannelDescriptorSchema = object({
7571
+ /**
7572
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7573
+ * the addon's short name so an operator reading a channel list can tell who
7574
+ * owns it without a second lookup.
7575
+ */
7576
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7577
+ /** One sentence: what the operator will SEE after arming it. */
7578
+ description: string().min(1),
7579
+ /** The level its lines are emitted at. Never below `info`. */
7580
+ defaultLevel: LogChannelLevelSchema,
7581
+ /**
7582
+ * Whether this channel can be narrowed to a camera.
7583
+ *
7584
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7585
+ * consulted with the numeric device id, AND every line the channel admits
7586
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7587
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7588
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7589
+ * the body is the only way to filter.
7590
+ *
7591
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7592
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7593
+ * the operator narrows to one camera, sees nothing, and concludes the code
7594
+ * path was never taken.
7595
+ */
7596
+ perDevice: boolean()
7597
+ });
7598
+ /**
7599
+ * An armed window over one channel, as the document hands it to a mirror.
7600
+ *
7601
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7602
+ * expires by itself, which is the one failure a boolean cannot avoid.
7603
+ */
7604
+ var LogChannelWindowSchema = object({
7605
+ channel: string().min(1),
7606
+ /** Epoch ms the window closes at. */
7607
+ armedUntilMs: number(),
7608
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7609
+ deviceIds: array(number().int()).readonly().nullable()
7610
+ });
7611
+ /**
7507
7612
  * Ops-log — the durable, append-only operations audit shared by the
7508
7613
  * recordings and events management surfaces.
7509
7614
  *
@@ -11124,6 +11229,35 @@ var MutationFilterSchema = object({
11124
11229
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11125
11230
  whereNot: record(string(), unknown()).optional()
11126
11231
  });
11232
+ /**
11233
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11234
+ *
11235
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11236
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11237
+ * a `Record<column, op>` shape could not express.
11238
+ */
11239
+ var AggregateFieldSchema = object({
11240
+ /** Result key. */
11241
+ as: string().min(1),
11242
+ /** Column to aggregate. Must be a real column of a declared collection. */
11243
+ field: string().min(1),
11244
+ op: _enum([
11245
+ "sum",
11246
+ "min",
11247
+ "max"
11248
+ ])
11249
+ });
11250
+ /**
11251
+ * `COUNT(*)` plus one number per requested field.
11252
+ *
11253
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11254
+ * that really is 0 are different facts, and an accounting caller that renders
11255
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11256
+ */
11257
+ var AggregateResultSchema = object({
11258
+ count: number().int(),
11259
+ values: record(string(), number().nullable())
11260
+ });
11127
11261
  /** A single stored record: `{ id, data }`. */
11128
11262
  var SettingsRecordSchema = object({
11129
11263
  id: string(),
@@ -11208,6 +11342,11 @@ method(object({
11208
11342
  collection: string(),
11209
11343
  filter: QueryFilterSchema.optional()
11210
11344
  }), number()), method(object({
11345
+ namespace: string().optional(),
11346
+ collection: string(),
11347
+ fields: array(AggregateFieldSchema).readonly(),
11348
+ filter: QueryFilterSchema.optional()
11349
+ }), AggregateResultSchema), method(object({
11211
11350
  namespace: string().optional(),
11212
11351
  collection: string(),
11213
11352
  field: string(),
@@ -11324,6 +11463,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11324
11463
  collection: string(),
11325
11464
  filter: QueryFilterSchema.optional()
11326
11465
  }), number(), { auth: "admin" }), method(object({
11466
+ namespace: string().optional(),
11467
+ collection: string(),
11468
+ fields: array(AggregateFieldSchema).readonly(),
11469
+ filter: QueryFilterSchema.optional()
11470
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11327
11471
  namespace: string().optional(),
11328
11472
  collection: string(),
11329
11473
  field: string(),
@@ -12064,24 +12208,6 @@ var deviceProviderCapability = {
12064
12208
  })
12065
12209
  }
12066
12210
  };
12067
- /**
12068
- * Device Manager capability — hub-side singleton that unifies device persistence,
12069
- * live registry access, and all management operations into a single tRPC surface.
12070
- *
12071
- * Replaces:
12072
- * - `device-persistence` capability (persistence methods absorbed here)
12073
- * - `device-management.router.ts` (deleted in Phase 2)
12074
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12075
- *
12076
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12077
- * fork into separate processes but never run on remote cluster agents. Therefore:
12078
- * - No nodeId routing needed — this is a pure hub singleton.
12079
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12080
- * - No shadow registry or cross-node aggregation required.
12081
- *
12082
- * Forked workers register devices back to the hub via `ctx.devices`
12083
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12084
- */
12085
12211
  /** One child-placement directive on a container's `childLayout`. Structurally
12086
12212
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12087
12213
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12450,7 +12576,7 @@ method(object({
12450
12576
  * it answers today and the caller filters as it already does.
12451
12577
  */
12452
12578
  deviceIds: array(number()).optional()
12453
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12579
+ }), 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({
12454
12580
  mode: LinkedDevicesModeSchema,
12455
12581
  devices: array(LinkedDeviceSchema)
12456
12582
  })), 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({
@@ -13174,6 +13300,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13174
13300
  kind: "mutation",
13175
13301
  auth: "admin"
13176
13302
  });
13303
+ /**
13304
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13305
+ * through. It stores nothing.
13306
+ *
13307
+ * ## Why a capability at all, and why this shape
13308
+ *
13309
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13310
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13311
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13312
+ * fails, an operator just never sees the channel somebody added. So the list
13313
+ * is assembled from declarations at runtime.
13314
+ *
13315
+ * The shape is copied from `log-destination.cap.ts`, which already does
13316
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13317
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13318
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13319
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13320
+ * runner's declarations reach hub-main over the transport that already exists.
13321
+ * No new UDS message, no second registry.
13322
+ *
13323
+ * ## What it deliberately does NOT own
13324
+ *
13325
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13326
+ * ONE place: the logging settings document on the `system` cap
13327
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13328
+ * value is the defect the plan behind this work exists to remove, and
13329
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13330
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13331
+ * setter for a window and no persistence of any kind.
13332
+ *
13333
+ * ## Why `apply` is here even so
13334
+ *
13335
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13336
+ * seam has to carry the value from the authority to the mirror, and a channel
13337
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13338
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13339
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13340
+ * persists nothing, it is never the source of a value, and it is called only
13341
+ * with a set the hub actually read (D49 — a read that fails does not call it
13342
+ * at all, so no channel is silently disarmed by a bad read).
13343
+ */
13344
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13345
+ var LogChannelApplyResultSchema = object({
13346
+ /** How many declared channels are armed in this process after the call. */
13347
+ armed: number().int().min(0),
13348
+ /**
13349
+ * Names the document armed that this process does not declare. Reported
13350
+ * rather than swallowed: a name here is either a typo or an addon that has
13351
+ * not booted, and both deserve a line instead of silence.
13352
+ */
13353
+ unknown: array(string()).readonly()
13354
+ });
13355
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13177
13356
  var LogLevelSchema = _enum([
13178
13357
  "debug",
13179
13358
  "info",
@@ -28464,17 +28643,60 @@ var SetSiteLocationInputSchema = object({
28464
28643
  longitude: number().min(-180).max(180)
28465
28644
  }).nullable();
28466
28645
  /**
28467
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28646
+ * The TRANSPORT a call arrived on.
28647
+ *
28648
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28649
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28650
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28651
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28652
+ * checkable rather than asserted.
28653
+ *
28654
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28655
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28656
+ * connection; the viewer talks to the hub over `wsLink`
28657
+ * exclusively, so this is the plane the HTTP census could not see.
28658
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28659
+ * never touches a socket and therefore never touched a census.
28660
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28661
+ * that is exactly what its `0` asserts: every plane the hub has can name
28662
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28663
+ * plane nobody instrumented lands here instead of vanishing from the total.
28664
+ */
28665
+ var TransportPlaneSchema = _enum([
28666
+ "http",
28667
+ "ws",
28668
+ "mesh",
28669
+ "unknown"
28670
+ ]);
28671
+ /**
28672
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28673
+ * reads as "not instrumented", which is the one thing this census must never
28674
+ * make an operator wonder about.
28675
+ */
28676
+ var TransportPlaneCountsSchema = object({
28677
+ http: number(),
28678
+ ws: number(),
28679
+ mesh: number(),
28680
+ unknown: number()
28681
+ });
28682
+ /**
28683
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28468
28684
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28469
28685
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28470
28686
  * already prints - never a token, never an `Authorization` header.
28687
+ *
28688
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28689
+ * and lives for hours, so folding it into a call count makes one long-lived
28690
+ * stream look like a storm.
28471
28691
  */
28472
28692
  var RequestCensusGroupSchema = object({
28693
+ plane: TransportPlaneSchema,
28473
28694
  procedure: string(),
28474
28695
  userAgent: string(),
28475
28696
  ip: string(),
28476
28697
  principal: string(),
28477
28698
  calls: number(),
28699
+ subscriptions: number(),
28478
28700
  perMin: number()
28479
28701
  });
28480
28702
  /**
@@ -28487,6 +28709,14 @@ var RequestCensusGroupSchema = object({
28487
28709
  var RequestCensusProcedureSchema = object({
28488
28710
  procedure: string(),
28489
28711
  calls: number(),
28712
+ /**
28713
+ * The same total, split by transport. THIS is the row that answers the
28714
+ * question the census exists for: one look at `deviceManager.listAll` says
28715
+ * which plane carried the 4 960, without joining two log lines by eye.
28716
+ */
28717
+ planes: TransportPlaneCountsSchema,
28718
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28719
+ subscriptions: number(),
28490
28720
  perMin: number()
28491
28721
  });
28492
28722
  /**
@@ -28514,14 +28744,45 @@ var RequestCensusStatusSchema = object({
28514
28744
  */
28515
28745
  procedureCalls: number(),
28516
28746
  /**
28747
+ * `procedureCalls` split by transport. The four keys sum to
28748
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28749
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28750
+ */
28751
+ planes: TransportPlaneCountsSchema,
28752
+ /**
28753
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28754
+ * on no plane at all - which is a RESULT (a plane is missing from the
28755
+ * instrument), not a failure, and it has to be visible to be read as one.
28756
+ */
28757
+ planesExplainTotal: boolean(),
28758
+ /**
28517
28759
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28518
- * transport resolves one context per connection - but the number that says
28519
- * whether a plane this census cannot see was busy while HTTP was quiet.
28760
+ * adapter resolves one context per connection - kept because a plane's call
28761
+ * count of zero against 37 open connections says something different from a
28762
+ * plane with no connections at all.
28520
28763
  */
28521
28764
  wsConnections: number(),
28765
+ /**
28766
+ * Client frames the WS plane looked at. `wsMessages` far above
28767
+ * `planes.ws + subscriptions` means most traffic is not operations
28768
+ * (keepalives, connection params) - which is itself an answer.
28769
+ */
28770
+ wsMessages: number(),
28771
+ /**
28772
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28773
+ * purpose: one live-events stream opened at boot and held for six hours is
28774
+ * one subscription, and counting it as a call would let a quiet plane
28775
+ * masquerade as the storm.
28776
+ */
28777
+ subscriptions: number(),
28778
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28779
+ subscriptionStops: number(),
28522
28780
  distinctGroups: number(),
28523
- /** Calls counted in the totals whose group attribution was shed at the
28524
- * cardinality bound. */
28781
+ /**
28782
+ * Operations counted in the totals whose CALLER attribution was shed at the
28783
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28784
+ * which transport they arrived on, they just lost their group row.
28785
+ */
28525
28786
  unattributedCalls: number(),
28526
28787
  procedures: array(RequestCensusProcedureSchema).readonly(),
28527
28788
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28544,10 +28805,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28544
28805
  * The layers of the level hierarchy, general → specific. The most specific
28545
28806
  * layer that carries an explicit value wins.
28546
28807
  *
28547
- * `component` is DECLARED and not yet resolvable: the per-component channels
28548
- * are a later slice of the same plan, and a `levelSource` enum that has to
28549
- * grow later would force every consumer of this document to change with it.
28550
- * Nothing returns `component` today.
28808
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28809
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28810
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28811
+ * that turning it on would not force every consumer of this document to widen
28812
+ * a `levelSource` enum — which is what has now not happened.
28551
28813
  */
28552
28814
  var LoggingScopeKindSchema = _enum([
28553
28815
  "cluster",
@@ -28574,6 +28836,14 @@ var LoggingLevelLayerSchema = object({
28574
28836
  scope: LoggingScopeKindSchema,
28575
28837
  /** The node this layer speaks for; `null` on the cluster layer. */
28576
28838
  nodeId: string().nullable(),
28839
+ /**
28840
+ * The declared channel this layer speaks for; `null` on every layer but
28841
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28842
+ * by design — the convention this repo settled on is one orchestrator-wide
28843
+ * setting, never per node (D52) — so a component layer that carried a node
28844
+ * would invite a per-node copy of a value that has no per-node meaning.
28845
+ */
28846
+ component: string().nullable(),
28577
28847
  /** Explicitly set here, or `null` when this layer inherits. */
28578
28848
  level: LogLevelSchema$1.nullable()
28579
28849
  });
@@ -28615,6 +28885,49 @@ var DiagnosticWindowPatchSchema = object({
28615
28885
  reportEveryMs: number().int().positive().optional()
28616
28886
  });
28617
28887
  /**
28888
+ * A channel ARMED, as the document reports it.
28889
+ *
28890
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28891
+ * and the time left, because a diagnostic left running is itself an incident
28892
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28893
+ */
28894
+ var LogChannelWindowStateSchema = object({
28895
+ channel: string(),
28896
+ armed: boolean(),
28897
+ /** Epoch ms the window closes at. 0 when disarmed. */
28898
+ armedUntilMs: number(),
28899
+ /** Ms left before it expires on its own. 0 when disarmed. */
28900
+ remainingMs: number(),
28901
+ /**
28902
+ * The cameras it is narrowed to, or `null` for every camera.
28903
+ *
28904
+ * A channel declared `perDevice: false` can only ever report `null` here:
28905
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28906
+ * produce a filter that silently matches nothing. The server REFUSES such a
28907
+ * patch rather than quietly widening it — ignoring the request would teach
28908
+ * the operator that per-camera filtering works on that channel when it does
28909
+ * not.
28910
+ */
28911
+ deviceIds: array(number().int()).readonly().nullable()
28912
+ });
28913
+ /**
28914
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28915
+ * for the same reason: a channel is a window with a deadline, never a switch.
28916
+ */
28917
+ var LogChannelWindowPatchSchema = object({
28918
+ channel: string().min(1),
28919
+ armMs: number().int().min(0),
28920
+ /**
28921
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
28922
+ *
28923
+ * Numeric because the repo's own rule makes it possible: every log line
28924
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
28925
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
28926
+ * diagnosed by hand, and this is the first thing that collects on it.
28927
+ */
28928
+ deviceIds: array(number().int()).readonly().nullable().optional()
28929
+ });
28930
+ /**
28618
28931
  * A PATCH, and patches MERGE.
28619
28932
  *
28620
28933
  * A field absent from the patch is left exactly as it was — arming a
@@ -28633,7 +28946,14 @@ var LoggingSettingsPatchSchema = object({
28633
28946
  * Only the diagnostics NAMED here change. An armed window that is not listed
28634
28947
  * keeps running — a patch is never a full replacement.
28635
28948
  */
28636
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28949
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
28950
+ /**
28951
+ * Only the channels NAMED here change. An armed channel that is not listed
28952
+ * keeps running — same rule as `diagnostics`, because a patch that silently
28953
+ * disarmed the channels it did not mention would make the Levels page and
28954
+ * the Diagnostics page fight over the same value.
28955
+ */
28956
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28637
28957
  });
28638
28958
  /**
28639
28959
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28646,9 +28966,22 @@ var LoggingSettingsPatchSchema = object({
28646
28966
  * authority over the whole hierarchy and answers for every layer, so the
28647
28967
  * layer selector needs a name the transport does not already own.
28648
28968
  */
28649
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28969
+ var GetLoggingSettingsInputSchema = object({
28970
+ scopeNodeId: string().optional(),
28971
+ /**
28972
+ * The declared CHANNEL this document is addressed at, when the caller wants
28973
+ * the `component` layer. Absent = the node/cluster hierarchy only.
28974
+ *
28975
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
28976
+ * axes from collapsing: a component level is cluster-wide, a node level is
28977
+ * not, and one selector for both would make "which of these two did I just
28978
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
28979
+ */
28980
+ scopeComponent: string().optional()
28981
+ });
28650
28982
  var SetLoggingSettingsInputSchema = object({
28651
28983
  scopeNodeId: string().optional(),
28984
+ scopeComponent: string().optional(),
28652
28985
  patch: LoggingSettingsPatchSchema
28653
28986
  });
28654
28987
  /**
@@ -28663,9 +28996,20 @@ var SetLoggingSettingsInputSchema = object({
28663
28996
  var LoggingSettingsStateSchema = object({
28664
28997
  /** The layer this document was read at. `null` = the cluster layer. */
28665
28998
  scopeNodeId: string().nullable(),
28999
+ /** The channel this document was read at. `null` = no component layer. */
29000
+ scopeComponent: string().nullable(),
28666
29001
  effective: LoggingEffectiveSchema,
28667
29002
  explicit: LoggingExplicitSchema,
28668
29003
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29004
+ /**
29005
+ * Every channel the cluster's addons DECLARE, gathered from the
29006
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29007
+ * channel added by a redeployed addon appears without anybody editing a
29008
+ * list, and a channel whose addon is gone stops being offered.
29009
+ */
29010
+ channels: array(LogChannelDescriptorSchema).readonly(),
29011
+ /** The channels ARMED right now, each with its deadline. */
29012
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28669
29013
  persisted: boolean()
28670
29014
  });
28671
29015
  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(), {
@@ -31650,6 +31994,12 @@ Object.freeze({
31650
31994
  addonId: null,
31651
31995
  access: "view"
31652
31996
  },
31997
+ "dataStoreProvider.aggregate": {
31998
+ capName: "data-store-provider",
31999
+ capScope: "system",
32000
+ addonId: null,
32001
+ access: "view"
32002
+ },
31653
32003
  "dataStoreProvider.count": {
31654
32004
  capName: "data-store-provider",
31655
32005
  capScope: "system",
@@ -32064,6 +32414,12 @@ Object.freeze({
32064
32414
  addonId: null,
32065
32415
  access: "view"
32066
32416
  },
32417
+ "deviceManager.getChildrenBatch": {
32418
+ capName: "device-manager",
32419
+ capScope: "system",
32420
+ addonId: null,
32421
+ access: "view"
32422
+ },
32067
32423
  "deviceManager.getConfigSchema": {
32068
32424
  capName: "device-manager",
32069
32425
  capScope: "system",
@@ -33114,6 +33470,18 @@ Object.freeze({
33114
33470
  addonId: null,
33115
33471
  access: "create"
33116
33472
  },
33473
+ "logChannels.apply": {
33474
+ capName: "log-channels",
33475
+ capScope: "system",
33476
+ addonId: null,
33477
+ access: "create"
33478
+ },
33479
+ "logChannels.list": {
33480
+ capName: "log-channels",
33481
+ capScope: "system",
33482
+ addonId: null,
33483
+ access: "view"
33484
+ },
33117
33485
  "logDestination.query": {
33118
33486
  capName: "log-destination",
33119
33487
  capScope: "system",
@@ -35268,6 +35636,12 @@ Object.freeze({
35268
35636
  addonId: null,
35269
35637
  access: "create"
35270
35638
  },
35639
+ "settingsStore.aggregate": {
35640
+ capName: "settings-store",
35641
+ capScope: "system",
35642
+ addonId: null,
35643
+ access: "view"
35644
+ },
35271
35645
  "settingsStore.count": {
35272
35646
  capName: "settings-store",
35273
35647
  capScope: "system",
@@ -36847,6 +37221,11 @@ Object.freeze({
36847
37221
  form: "single",
36848
37222
  optional: false
36849
37223
  }],
37224
+ "deviceManager.getChildrenBatch": [{
37225
+ name: "parentDeviceIds",
37226
+ form: "array",
37227
+ optional: false
37228
+ }],
36850
37229
  "deviceManager.getConfigSchema": [{
36851
37230
  name: "deviceId",
36852
37231
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7505,6 +7505,111 @@ var CameraSwitchGroupSchema = object({
7505
7505
  fetchedAt: number()
7506
7506
  });
7507
7507
  /**
7508
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7509
+ * an addon declares its channels in.
7510
+ *
7511
+ * ## Two axes, deliberately separated
7512
+ *
7513
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7514
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7515
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7516
+ * and rots silently. So a channel is declared where it is consulted, and the
7517
+ * `log-channels` capability enumerates the declarations.
7518
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7519
+ * thing: the logging settings document on the `system` cap. Two authorities
7520
+ * over the values is the exact defect
7521
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7522
+ * remove; re-introducing it from the cure side would be grotesque.
7523
+ *
7524
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7525
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7526
+ * the hot path with a value somebody actually read, and by
7527
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7528
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7529
+ * disarmed one (D49).
7530
+ *
7531
+ * ## The canonical call shape
7532
+ *
7533
+ * ```ts
7534
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7535
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7536
+ * }
7537
+ * ```
7538
+ *
7539
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7540
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7541
+ * object literal is never constructed because it lives inside the branch. It
7542
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7543
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7544
+ * destination floor (measured at 1.93 ns/call when off).
7545
+ *
7546
+ * ## Why a channel emits at `info`
7547
+ *
7548
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7549
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7550
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7551
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7552
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7553
+ * emits at the channel's declared level, whose schema floor is `info`.
7554
+ */
7555
+ /**
7556
+ * The level a channel writes at once armed.
7557
+ *
7558
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7559
+ * not leave the process for Loki, and the whole point of arming a channel is
7560
+ * to read it later.
7561
+ */
7562
+ var LogChannelLevelSchema = _enum([
7563
+ "info",
7564
+ "warn",
7565
+ "error"
7566
+ ]);
7567
+ /**
7568
+ * What an addon declares about one channel. No value, no state — a
7569
+ * declaration is inert.
7570
+ */
7571
+ var LogChannelDescriptorSchema = object({
7572
+ /**
7573
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7574
+ * the addon's short name so an operator reading a channel list can tell who
7575
+ * owns it without a second lookup.
7576
+ */
7577
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7578
+ /** One sentence: what the operator will SEE after arming it. */
7579
+ description: string().min(1),
7580
+ /** The level its lines are emitted at. Never below `info`. */
7581
+ defaultLevel: LogChannelLevelSchema,
7582
+ /**
7583
+ * Whether this channel can be narrowed to a camera.
7584
+ *
7585
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7586
+ * consulted with the numeric device id, AND every line the channel admits
7587
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7588
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7589
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7590
+ * the body is the only way to filter.
7591
+ *
7592
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7593
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7594
+ * the operator narrows to one camera, sees nothing, and concludes the code
7595
+ * path was never taken.
7596
+ */
7597
+ perDevice: boolean()
7598
+ });
7599
+ /**
7600
+ * An armed window over one channel, as the document hands it to a mirror.
7601
+ *
7602
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7603
+ * expires by itself, which is the one failure a boolean cannot avoid.
7604
+ */
7605
+ var LogChannelWindowSchema = object({
7606
+ channel: string().min(1),
7607
+ /** Epoch ms the window closes at. */
7608
+ armedUntilMs: number(),
7609
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7610
+ deviceIds: array(number().int()).readonly().nullable()
7611
+ });
7612
+ /**
7508
7613
  * Ops-log — the durable, append-only operations audit shared by the
7509
7614
  * recordings and events management surfaces.
7510
7615
  *
@@ -11125,6 +11230,35 @@ var MutationFilterSchema = object({
11125
11230
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11126
11231
  whereNot: record(string(), unknown()).optional()
11127
11232
  });
11233
+ /**
11234
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11235
+ *
11236
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11237
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11238
+ * a `Record<column, op>` shape could not express.
11239
+ */
11240
+ var AggregateFieldSchema = object({
11241
+ /** Result key. */
11242
+ as: string().min(1),
11243
+ /** Column to aggregate. Must be a real column of a declared collection. */
11244
+ field: string().min(1),
11245
+ op: _enum([
11246
+ "sum",
11247
+ "min",
11248
+ "max"
11249
+ ])
11250
+ });
11251
+ /**
11252
+ * `COUNT(*)` plus one number per requested field.
11253
+ *
11254
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11255
+ * that really is 0 are different facts, and an accounting caller that renders
11256
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11257
+ */
11258
+ var AggregateResultSchema = object({
11259
+ count: number().int(),
11260
+ values: record(string(), number().nullable())
11261
+ });
11128
11262
  /** A single stored record: `{ id, data }`. */
11129
11263
  var SettingsRecordSchema = object({
11130
11264
  id: string(),
@@ -11209,6 +11343,11 @@ method(object({
11209
11343
  collection: string(),
11210
11344
  filter: QueryFilterSchema.optional()
11211
11345
  }), number()), method(object({
11346
+ namespace: string().optional(),
11347
+ collection: string(),
11348
+ fields: array(AggregateFieldSchema).readonly(),
11349
+ filter: QueryFilterSchema.optional()
11350
+ }), AggregateResultSchema), method(object({
11212
11351
  namespace: string().optional(),
11213
11352
  collection: string(),
11214
11353
  field: string(),
@@ -11325,6 +11464,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11325
11464
  collection: string(),
11326
11465
  filter: QueryFilterSchema.optional()
11327
11466
  }), number(), { auth: "admin" }), method(object({
11467
+ namespace: string().optional(),
11468
+ collection: string(),
11469
+ fields: array(AggregateFieldSchema).readonly(),
11470
+ filter: QueryFilterSchema.optional()
11471
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11328
11472
  namespace: string().optional(),
11329
11473
  collection: string(),
11330
11474
  field: string(),
@@ -12065,24 +12209,6 @@ var deviceProviderCapability = {
12065
12209
  })
12066
12210
  }
12067
12211
  };
12068
- /**
12069
- * Device Manager capability — hub-side singleton that unifies device persistence,
12070
- * live registry access, and all management operations into a single tRPC surface.
12071
- *
12072
- * Replaces:
12073
- * - `device-persistence` capability (persistence methods absorbed here)
12074
- * - `device-management.router.ts` (deleted in Phase 2)
12075
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12076
- *
12077
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12078
- * fork into separate processes but never run on remote cluster agents. Therefore:
12079
- * - No nodeId routing needed — this is a pure hub singleton.
12080
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12081
- * - No shadow registry or cross-node aggregation required.
12082
- *
12083
- * Forked workers register devices back to the hub via `ctx.devices`
12084
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12085
- */
12086
12212
  /** One child-placement directive on a container's `childLayout`. Structurally
12087
12213
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12088
12214
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12451,7 +12577,7 @@ method(object({
12451
12577
  * it answers today and the caller filters as it already does.
12452
12578
  */
12453
12579
  deviceIds: array(number()).optional()
12454
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12580
+ }), 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({
12455
12581
  mode: LinkedDevicesModeSchema,
12456
12582
  devices: array(LinkedDeviceSchema)
12457
12583
  })), 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({
@@ -13175,6 +13301,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13175
13301
  kind: "mutation",
13176
13302
  auth: "admin"
13177
13303
  });
13304
+ /**
13305
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13306
+ * through. It stores nothing.
13307
+ *
13308
+ * ## Why a capability at all, and why this shape
13309
+ *
13310
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13311
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13312
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13313
+ * fails, an operator just never sees the channel somebody added. So the list
13314
+ * is assembled from declarations at runtime.
13315
+ *
13316
+ * The shape is copied from `log-destination.cap.ts`, which already does
13317
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13318
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13319
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13320
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13321
+ * runner's declarations reach hub-main over the transport that already exists.
13322
+ * No new UDS message, no second registry.
13323
+ *
13324
+ * ## What it deliberately does NOT own
13325
+ *
13326
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13327
+ * ONE place: the logging settings document on the `system` cap
13328
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13329
+ * value is the defect the plan behind this work exists to remove, and
13330
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13331
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13332
+ * setter for a window and no persistence of any kind.
13333
+ *
13334
+ * ## Why `apply` is here even so
13335
+ *
13336
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13337
+ * seam has to carry the value from the authority to the mirror, and a channel
13338
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13339
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13340
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13341
+ * persists nothing, it is never the source of a value, and it is called only
13342
+ * with a set the hub actually read (D49 — a read that fails does not call it
13343
+ * at all, so no channel is silently disarmed by a bad read).
13344
+ */
13345
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13346
+ var LogChannelApplyResultSchema = object({
13347
+ /** How many declared channels are armed in this process after the call. */
13348
+ armed: number().int().min(0),
13349
+ /**
13350
+ * Names the document armed that this process does not declare. Reported
13351
+ * rather than swallowed: a name here is either a typo or an addon that has
13352
+ * not booted, and both deserve a line instead of silence.
13353
+ */
13354
+ unknown: array(string()).readonly()
13355
+ });
13356
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13178
13357
  var LogLevelSchema = _enum([
13179
13358
  "debug",
13180
13359
  "info",
@@ -28465,17 +28644,60 @@ var SetSiteLocationInputSchema = object({
28465
28644
  longitude: number().min(-180).max(180)
28466
28645
  }).nullable();
28467
28646
  /**
28468
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28647
+ * The TRANSPORT a call arrived on.
28648
+ *
28649
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28650
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28651
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28652
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28653
+ * checkable rather than asserted.
28654
+ *
28655
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28656
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28657
+ * connection; the viewer talks to the hub over `wsLink`
28658
+ * exclusively, so this is the plane the HTTP census could not see.
28659
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28660
+ * never touches a socket and therefore never touched a census.
28661
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28662
+ * that is exactly what its `0` asserts: every plane the hub has can name
28663
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28664
+ * plane nobody instrumented lands here instead of vanishing from the total.
28665
+ */
28666
+ var TransportPlaneSchema = _enum([
28667
+ "http",
28668
+ "ws",
28669
+ "mesh",
28670
+ "unknown"
28671
+ ]);
28672
+ /**
28673
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28674
+ * reads as "not instrumented", which is the one thing this census must never
28675
+ * make an operator wonder about.
28676
+ */
28677
+ var TransportPlaneCountsSchema = object({
28678
+ http: number(),
28679
+ ws: number(),
28680
+ mesh: number(),
28681
+ unknown: number()
28682
+ });
28683
+ /**
28684
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28469
28685
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28470
28686
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28471
28687
  * already prints - never a token, never an `Authorization` header.
28688
+ *
28689
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28690
+ * and lives for hours, so folding it into a call count makes one long-lived
28691
+ * stream look like a storm.
28472
28692
  */
28473
28693
  var RequestCensusGroupSchema = object({
28694
+ plane: TransportPlaneSchema,
28474
28695
  procedure: string(),
28475
28696
  userAgent: string(),
28476
28697
  ip: string(),
28477
28698
  principal: string(),
28478
28699
  calls: number(),
28700
+ subscriptions: number(),
28479
28701
  perMin: number()
28480
28702
  });
28481
28703
  /**
@@ -28488,6 +28710,14 @@ var RequestCensusGroupSchema = object({
28488
28710
  var RequestCensusProcedureSchema = object({
28489
28711
  procedure: string(),
28490
28712
  calls: number(),
28713
+ /**
28714
+ * The same total, split by transport. THIS is the row that answers the
28715
+ * question the census exists for: one look at `deviceManager.listAll` says
28716
+ * which plane carried the 4 960, without joining two log lines by eye.
28717
+ */
28718
+ planes: TransportPlaneCountsSchema,
28719
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28720
+ subscriptions: number(),
28491
28721
  perMin: number()
28492
28722
  });
28493
28723
  /**
@@ -28515,14 +28745,45 @@ var RequestCensusStatusSchema = object({
28515
28745
  */
28516
28746
  procedureCalls: number(),
28517
28747
  /**
28748
+ * `procedureCalls` split by transport. The four keys sum to
28749
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28750
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28751
+ */
28752
+ planes: TransportPlaneCountsSchema,
28753
+ /**
28754
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28755
+ * on no plane at all - which is a RESULT (a plane is missing from the
28756
+ * instrument), not a failure, and it has to be visible to be read as one.
28757
+ */
28758
+ planesExplainTotal: boolean(),
28759
+ /**
28518
28760
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28519
- * transport resolves one context per connection - but the number that says
28520
- * whether a plane this census cannot see was busy while HTTP was quiet.
28761
+ * adapter resolves one context per connection - kept because a plane's call
28762
+ * count of zero against 37 open connections says something different from a
28763
+ * plane with no connections at all.
28521
28764
  */
28522
28765
  wsConnections: number(),
28766
+ /**
28767
+ * Client frames the WS plane looked at. `wsMessages` far above
28768
+ * `planes.ws + subscriptions` means most traffic is not operations
28769
+ * (keepalives, connection params) - which is itself an answer.
28770
+ */
28771
+ wsMessages: number(),
28772
+ /**
28773
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28774
+ * purpose: one live-events stream opened at boot and held for six hours is
28775
+ * one subscription, and counting it as a call would let a quiet plane
28776
+ * masquerade as the storm.
28777
+ */
28778
+ subscriptions: number(),
28779
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28780
+ subscriptionStops: number(),
28523
28781
  distinctGroups: number(),
28524
- /** Calls counted in the totals whose group attribution was shed at the
28525
- * cardinality bound. */
28782
+ /**
28783
+ * Operations counted in the totals whose CALLER attribution was shed at the
28784
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28785
+ * which transport they arrived on, they just lost their group row.
28786
+ */
28526
28787
  unattributedCalls: number(),
28527
28788
  procedures: array(RequestCensusProcedureSchema).readonly(),
28528
28789
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28545,10 +28806,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28545
28806
  * The layers of the level hierarchy, general → specific. The most specific
28546
28807
  * layer that carries an explicit value wins.
28547
28808
  *
28548
- * `component` is DECLARED and not yet resolvable: the per-component channels
28549
- * are a later slice of the same plan, and a `levelSource` enum that has to
28550
- * grow later would force every consumer of this document to change with it.
28551
- * Nothing returns `component` today.
28809
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28810
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28811
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28812
+ * that turning it on would not force every consumer of this document to widen
28813
+ * a `levelSource` enum — which is what has now not happened.
28552
28814
  */
28553
28815
  var LoggingScopeKindSchema = _enum([
28554
28816
  "cluster",
@@ -28575,6 +28837,14 @@ var LoggingLevelLayerSchema = object({
28575
28837
  scope: LoggingScopeKindSchema,
28576
28838
  /** The node this layer speaks for; `null` on the cluster layer. */
28577
28839
  nodeId: string().nullable(),
28840
+ /**
28841
+ * The declared channel this layer speaks for; `null` on every layer but
28842
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28843
+ * by design — the convention this repo settled on is one orchestrator-wide
28844
+ * setting, never per node (D52) — so a component layer that carried a node
28845
+ * would invite a per-node copy of a value that has no per-node meaning.
28846
+ */
28847
+ component: string().nullable(),
28578
28848
  /** Explicitly set here, or `null` when this layer inherits. */
28579
28849
  level: LogLevelSchema$1.nullable()
28580
28850
  });
@@ -28616,6 +28886,49 @@ var DiagnosticWindowPatchSchema = object({
28616
28886
  reportEveryMs: number().int().positive().optional()
28617
28887
  });
28618
28888
  /**
28889
+ * A channel ARMED, as the document reports it.
28890
+ *
28891
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28892
+ * and the time left, because a diagnostic left running is itself an incident
28893
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28894
+ */
28895
+ var LogChannelWindowStateSchema = object({
28896
+ channel: string(),
28897
+ armed: boolean(),
28898
+ /** Epoch ms the window closes at. 0 when disarmed. */
28899
+ armedUntilMs: number(),
28900
+ /** Ms left before it expires on its own. 0 when disarmed. */
28901
+ remainingMs: number(),
28902
+ /**
28903
+ * The cameras it is narrowed to, or `null` for every camera.
28904
+ *
28905
+ * A channel declared `perDevice: false` can only ever report `null` here:
28906
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28907
+ * produce a filter that silently matches nothing. The server REFUSES such a
28908
+ * patch rather than quietly widening it — ignoring the request would teach
28909
+ * the operator that per-camera filtering works on that channel when it does
28910
+ * not.
28911
+ */
28912
+ deviceIds: array(number().int()).readonly().nullable()
28913
+ });
28914
+ /**
28915
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28916
+ * for the same reason: a channel is a window with a deadline, never a switch.
28917
+ */
28918
+ var LogChannelWindowPatchSchema = object({
28919
+ channel: string().min(1),
28920
+ armMs: number().int().min(0),
28921
+ /**
28922
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
28923
+ *
28924
+ * Numeric because the repo's own rule makes it possible: every log line
28925
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
28926
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
28927
+ * diagnosed by hand, and this is the first thing that collects on it.
28928
+ */
28929
+ deviceIds: array(number().int()).readonly().nullable().optional()
28930
+ });
28931
+ /**
28619
28932
  * A PATCH, and patches MERGE.
28620
28933
  *
28621
28934
  * A field absent from the patch is left exactly as it was — arming a
@@ -28634,7 +28947,14 @@ var LoggingSettingsPatchSchema = object({
28634
28947
  * Only the diagnostics NAMED here change. An armed window that is not listed
28635
28948
  * keeps running — a patch is never a full replacement.
28636
28949
  */
28637
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28950
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
28951
+ /**
28952
+ * Only the channels NAMED here change. An armed channel that is not listed
28953
+ * keeps running — same rule as `diagnostics`, because a patch that silently
28954
+ * disarmed the channels it did not mention would make the Levels page and
28955
+ * the Diagnostics page fight over the same value.
28956
+ */
28957
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28638
28958
  });
28639
28959
  /**
28640
28960
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28647,9 +28967,22 @@ var LoggingSettingsPatchSchema = object({
28647
28967
  * authority over the whole hierarchy and answers for every layer, so the
28648
28968
  * layer selector needs a name the transport does not already own.
28649
28969
  */
28650
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28970
+ var GetLoggingSettingsInputSchema = object({
28971
+ scopeNodeId: string().optional(),
28972
+ /**
28973
+ * The declared CHANNEL this document is addressed at, when the caller wants
28974
+ * the `component` layer. Absent = the node/cluster hierarchy only.
28975
+ *
28976
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
28977
+ * axes from collapsing: a component level is cluster-wide, a node level is
28978
+ * not, and one selector for both would make "which of these two did I just
28979
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
28980
+ */
28981
+ scopeComponent: string().optional()
28982
+ });
28651
28983
  var SetLoggingSettingsInputSchema = object({
28652
28984
  scopeNodeId: string().optional(),
28985
+ scopeComponent: string().optional(),
28653
28986
  patch: LoggingSettingsPatchSchema
28654
28987
  });
28655
28988
  /**
@@ -28664,9 +28997,20 @@ var SetLoggingSettingsInputSchema = object({
28664
28997
  var LoggingSettingsStateSchema = object({
28665
28998
  /** The layer this document was read at. `null` = the cluster layer. */
28666
28999
  scopeNodeId: string().nullable(),
29000
+ /** The channel this document was read at. `null` = no component layer. */
29001
+ scopeComponent: string().nullable(),
28667
29002
  effective: LoggingEffectiveSchema,
28668
29003
  explicit: LoggingExplicitSchema,
28669
29004
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29005
+ /**
29006
+ * Every channel the cluster's addons DECLARE, gathered from the
29007
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29008
+ * channel added by a redeployed addon appears without anybody editing a
29009
+ * list, and a channel whose addon is gone stops being offered.
29010
+ */
29011
+ channels: array(LogChannelDescriptorSchema).readonly(),
29012
+ /** The channels ARMED right now, each with its deadline. */
29013
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28670
29014
  persisted: boolean()
28671
29015
  });
28672
29016
  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(), {
@@ -31651,6 +31995,12 @@ Object.freeze({
31651
31995
  addonId: null,
31652
31996
  access: "view"
31653
31997
  },
31998
+ "dataStoreProvider.aggregate": {
31999
+ capName: "data-store-provider",
32000
+ capScope: "system",
32001
+ addonId: null,
32002
+ access: "view"
32003
+ },
31654
32004
  "dataStoreProvider.count": {
31655
32005
  capName: "data-store-provider",
31656
32006
  capScope: "system",
@@ -32065,6 +32415,12 @@ Object.freeze({
32065
32415
  addonId: null,
32066
32416
  access: "view"
32067
32417
  },
32418
+ "deviceManager.getChildrenBatch": {
32419
+ capName: "device-manager",
32420
+ capScope: "system",
32421
+ addonId: null,
32422
+ access: "view"
32423
+ },
32068
32424
  "deviceManager.getConfigSchema": {
32069
32425
  capName: "device-manager",
32070
32426
  capScope: "system",
@@ -33115,6 +33471,18 @@ Object.freeze({
33115
33471
  addonId: null,
33116
33472
  access: "create"
33117
33473
  },
33474
+ "logChannels.apply": {
33475
+ capName: "log-channels",
33476
+ capScope: "system",
33477
+ addonId: null,
33478
+ access: "create"
33479
+ },
33480
+ "logChannels.list": {
33481
+ capName: "log-channels",
33482
+ capScope: "system",
33483
+ addonId: null,
33484
+ access: "view"
33485
+ },
33118
33486
  "logDestination.query": {
33119
33487
  capName: "log-destination",
33120
33488
  capScope: "system",
@@ -35269,6 +35637,12 @@ Object.freeze({
35269
35637
  addonId: null,
35270
35638
  access: "create"
35271
35639
  },
35640
+ "settingsStore.aggregate": {
35641
+ capName: "settings-store",
35642
+ capScope: "system",
35643
+ addonId: null,
35644
+ access: "view"
35645
+ },
35272
35646
  "settingsStore.count": {
35273
35647
  capName: "settings-store",
35274
35648
  capScope: "system",
@@ -36848,6 +37222,11 @@ Object.freeze({
36848
37222
  form: "single",
36849
37223
  optional: false
36850
37224
  }],
37225
+ "deviceManager.getChildrenBatch": [{
37226
+ name: "parentDeviceIds",
37227
+ form: "array",
37228
+ optional: false
37229
+ }],
36851
37230
  "deviceManager.getConfigSchema": [{
36852
37231
  name: "deviceId",
36853
37232
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreo",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "description": "Dreo smart-device (fan / air-circulator / purifier / heater / humidifier) device-provider addon for CamStack — wraps the @apocaliss92/nodedreo Dreo cloud client (REST + WebSocket)",
5
5
  "keywords": [
6
6
  "camstack",