@camstack/addon-provider-rtsp 1.2.32 → 1.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -7524,6 +7524,111 @@ function classifyStreams(streams) {
7524
7524
  return result;
7525
7525
  }
7526
7526
  /**
7527
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7528
+ * an addon declares its channels in.
7529
+ *
7530
+ * ## Two axes, deliberately separated
7531
+ *
7532
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7533
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7534
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7535
+ * and rots silently. So a channel is declared where it is consulted, and the
7536
+ * `log-channels` capability enumerates the declarations.
7537
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7538
+ * thing: the logging settings document on the `system` cap. Two authorities
7539
+ * over the values is the exact defect
7540
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7541
+ * remove; re-introducing it from the cure side would be grotesque.
7542
+ *
7543
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7544
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7545
+ * the hot path with a value somebody actually read, and by
7546
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7547
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7548
+ * disarmed one (D49).
7549
+ *
7550
+ * ## The canonical call shape
7551
+ *
7552
+ * ```ts
7553
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7554
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7555
+ * }
7556
+ * ```
7557
+ *
7558
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7559
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7560
+ * object literal is never constructed because it lives inside the branch. It
7561
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7562
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7563
+ * destination floor (measured at 1.93 ns/call when off).
7564
+ *
7565
+ * ## Why a channel emits at `info`
7566
+ *
7567
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7568
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7569
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7570
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7571
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7572
+ * emits at the channel's declared level, whose schema floor is `info`.
7573
+ */
7574
+ /**
7575
+ * The level a channel writes at once armed.
7576
+ *
7577
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7578
+ * not leave the process for Loki, and the whole point of arming a channel is
7579
+ * to read it later.
7580
+ */
7581
+ var LogChannelLevelSchema = _enum([
7582
+ "info",
7583
+ "warn",
7584
+ "error"
7585
+ ]);
7586
+ /**
7587
+ * What an addon declares about one channel. No value, no state — a
7588
+ * declaration is inert.
7589
+ */
7590
+ var LogChannelDescriptorSchema = object({
7591
+ /**
7592
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7593
+ * the addon's short name so an operator reading a channel list can tell who
7594
+ * owns it without a second lookup.
7595
+ */
7596
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7597
+ /** One sentence: what the operator will SEE after arming it. */
7598
+ description: string().min(1),
7599
+ /** The level its lines are emitted at. Never below `info`. */
7600
+ defaultLevel: LogChannelLevelSchema,
7601
+ /**
7602
+ * Whether this channel can be narrowed to a camera.
7603
+ *
7604
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7605
+ * consulted with the numeric device id, AND every line the channel admits
7606
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7607
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7608
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7609
+ * the body is the only way to filter.
7610
+ *
7611
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7612
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7613
+ * the operator narrows to one camera, sees nothing, and concludes the code
7614
+ * path was never taken.
7615
+ */
7616
+ perDevice: boolean()
7617
+ });
7618
+ /**
7619
+ * An armed window over one channel, as the document hands it to a mirror.
7620
+ *
7621
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7622
+ * expires by itself, which is the one failure a boolean cannot avoid.
7623
+ */
7624
+ var LogChannelWindowSchema = object({
7625
+ channel: string().min(1),
7626
+ /** Epoch ms the window closes at. */
7627
+ armedUntilMs: number(),
7628
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7629
+ deviceIds: array(number().int()).readonly().nullable()
7630
+ });
7631
+ /**
7527
7632
  * Ops-log — the durable, append-only operations audit shared by the
7528
7633
  * recordings and events management surfaces.
7529
7634
  *
@@ -11144,6 +11249,35 @@ var MutationFilterSchema = object({
11144
11249
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11145
11250
  whereNot: record(string(), unknown()).optional()
11146
11251
  });
11252
+ /**
11253
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11254
+ *
11255
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11256
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11257
+ * a `Record<column, op>` shape could not express.
11258
+ */
11259
+ var AggregateFieldSchema = object({
11260
+ /** Result key. */
11261
+ as: string().min(1),
11262
+ /** Column to aggregate. Must be a real column of a declared collection. */
11263
+ field: string().min(1),
11264
+ op: _enum([
11265
+ "sum",
11266
+ "min",
11267
+ "max"
11268
+ ])
11269
+ });
11270
+ /**
11271
+ * `COUNT(*)` plus one number per requested field.
11272
+ *
11273
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11274
+ * that really is 0 are different facts, and an accounting caller that renders
11275
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11276
+ */
11277
+ var AggregateResultSchema = object({
11278
+ count: number().int(),
11279
+ values: record(string(), number().nullable())
11280
+ });
11147
11281
  /** A single stored record: `{ id, data }`. */
11148
11282
  var SettingsRecordSchema = object({
11149
11283
  id: string(),
@@ -11228,6 +11362,11 @@ method(object({
11228
11362
  collection: string(),
11229
11363
  filter: QueryFilterSchema.optional()
11230
11364
  }), number()), method(object({
11365
+ namespace: string().optional(),
11366
+ collection: string(),
11367
+ fields: array(AggregateFieldSchema).readonly(),
11368
+ filter: QueryFilterSchema.optional()
11369
+ }), AggregateResultSchema), method(object({
11231
11370
  namespace: string().optional(),
11232
11371
  collection: string(),
11233
11372
  field: string(),
@@ -11344,6 +11483,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11344
11483
  collection: string(),
11345
11484
  filter: QueryFilterSchema.optional()
11346
11485
  }), number(), { auth: "admin" }), method(object({
11486
+ namespace: string().optional(),
11487
+ collection: string(),
11488
+ fields: array(AggregateFieldSchema).readonly(),
11489
+ filter: QueryFilterSchema.optional()
11490
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11347
11491
  namespace: string().optional(),
11348
11492
  collection: string(),
11349
11493
  field: string(),
@@ -12067,24 +12211,6 @@ var deviceProviderCapability = {
12067
12211
  })
12068
12212
  }
12069
12213
  };
12070
- /**
12071
- * Device Manager capability — hub-side singleton that unifies device persistence,
12072
- * live registry access, and all management operations into a single tRPC surface.
12073
- *
12074
- * Replaces:
12075
- * - `device-persistence` capability (persistence methods absorbed here)
12076
- * - `device-management.router.ts` (deleted in Phase 2)
12077
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12078
- *
12079
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12080
- * fork into separate processes but never run on remote cluster agents. Therefore:
12081
- * - No nodeId routing needed — this is a pure hub singleton.
12082
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12083
- * - No shadow registry or cross-node aggregation required.
12084
- *
12085
- * Forked workers register devices back to the hub via `ctx.devices`
12086
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12087
- */
12088
12214
  /** One child-placement directive on a container's `childLayout`. Structurally
12089
12215
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12090
12216
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12453,7 +12579,7 @@ method(object({
12453
12579
  * it answers today and the caller filters as it already does.
12454
12580
  */
12455
12581
  deviceIds: array(number()).optional()
12456
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12582
+ }), 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({
12457
12583
  mode: LinkedDevicesModeSchema,
12458
12584
  devices: array(LinkedDeviceSchema)
12459
12585
  })), 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({
@@ -13177,6 +13303,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13177
13303
  kind: "mutation",
13178
13304
  auth: "admin"
13179
13305
  });
13306
+ /**
13307
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13308
+ * through. It stores nothing.
13309
+ *
13310
+ * ## Why a capability at all, and why this shape
13311
+ *
13312
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13313
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13314
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13315
+ * fails, an operator just never sees the channel somebody added. So the list
13316
+ * is assembled from declarations at runtime.
13317
+ *
13318
+ * The shape is copied from `log-destination.cap.ts`, which already does
13319
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13320
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13321
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13322
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13323
+ * runner's declarations reach hub-main over the transport that already exists.
13324
+ * No new UDS message, no second registry.
13325
+ *
13326
+ * ## What it deliberately does NOT own
13327
+ *
13328
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13329
+ * ONE place: the logging settings document on the `system` cap
13330
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13331
+ * value is the defect the plan behind this work exists to remove, and
13332
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13333
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13334
+ * setter for a window and no persistence of any kind.
13335
+ *
13336
+ * ## Why `apply` is here even so
13337
+ *
13338
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13339
+ * seam has to carry the value from the authority to the mirror, and a channel
13340
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13341
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13342
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13343
+ * persists nothing, it is never the source of a value, and it is called only
13344
+ * with a set the hub actually read (D49 — a read that fails does not call it
13345
+ * at all, so no channel is silently disarmed by a bad read).
13346
+ */
13347
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13348
+ var LogChannelApplyResultSchema = object({
13349
+ /** How many declared channels are armed in this process after the call. */
13350
+ armed: number().int().min(0),
13351
+ /**
13352
+ * Names the document armed that this process does not declare. Reported
13353
+ * rather than swallowed: a name here is either a typo or an addon that has
13354
+ * not booted, and both deserve a line instead of silence.
13355
+ */
13356
+ unknown: array(string()).readonly()
13357
+ });
13358
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13180
13359
  var LogLevelSchema = _enum([
13181
13360
  "debug",
13182
13361
  "info",
@@ -28571,17 +28750,60 @@ var SetSiteLocationInputSchema = object({
28571
28750
  longitude: number().min(-180).max(180)
28572
28751
  }).nullable();
28573
28752
  /**
28574
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28753
+ * The TRANSPORT a call arrived on.
28754
+ *
28755
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28756
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28757
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28758
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28759
+ * checkable rather than asserted.
28760
+ *
28761
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28762
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28763
+ * connection; the viewer talks to the hub over `wsLink`
28764
+ * exclusively, so this is the plane the HTTP census could not see.
28765
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28766
+ * never touches a socket and therefore never touched a census.
28767
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28768
+ * that is exactly what its `0` asserts: every plane the hub has can name
28769
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28770
+ * plane nobody instrumented lands here instead of vanishing from the total.
28771
+ */
28772
+ var TransportPlaneSchema = _enum([
28773
+ "http",
28774
+ "ws",
28775
+ "mesh",
28776
+ "unknown"
28777
+ ]);
28778
+ /**
28779
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28780
+ * reads as "not instrumented", which is the one thing this census must never
28781
+ * make an operator wonder about.
28782
+ */
28783
+ var TransportPlaneCountsSchema = object({
28784
+ http: number(),
28785
+ ws: number(),
28786
+ mesh: number(),
28787
+ unknown: number()
28788
+ });
28789
+ /**
28790
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28575
28791
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28576
28792
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28577
28793
  * already prints - never a token, never an `Authorization` header.
28794
+ *
28795
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28796
+ * and lives for hours, so folding it into a call count makes one long-lived
28797
+ * stream look like a storm.
28578
28798
  */
28579
28799
  var RequestCensusGroupSchema = object({
28800
+ plane: TransportPlaneSchema,
28580
28801
  procedure: string(),
28581
28802
  userAgent: string(),
28582
28803
  ip: string(),
28583
28804
  principal: string(),
28584
28805
  calls: number(),
28806
+ subscriptions: number(),
28585
28807
  perMin: number()
28586
28808
  });
28587
28809
  /**
@@ -28594,6 +28816,14 @@ var RequestCensusGroupSchema = object({
28594
28816
  var RequestCensusProcedureSchema = object({
28595
28817
  procedure: string(),
28596
28818
  calls: number(),
28819
+ /**
28820
+ * The same total, split by transport. THIS is the row that answers the
28821
+ * question the census exists for: one look at `deviceManager.listAll` says
28822
+ * which plane carried the 4 960, without joining two log lines by eye.
28823
+ */
28824
+ planes: TransportPlaneCountsSchema,
28825
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28826
+ subscriptions: number(),
28597
28827
  perMin: number()
28598
28828
  });
28599
28829
  /**
@@ -28621,14 +28851,45 @@ var RequestCensusStatusSchema = object({
28621
28851
  */
28622
28852
  procedureCalls: number(),
28623
28853
  /**
28854
+ * `procedureCalls` split by transport. The four keys sum to
28855
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28856
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28857
+ */
28858
+ planes: TransportPlaneCountsSchema,
28859
+ /**
28860
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28861
+ * on no plane at all - which is a RESULT (a plane is missing from the
28862
+ * instrument), not a failure, and it has to be visible to be read as one.
28863
+ */
28864
+ planesExplainTotal: boolean(),
28865
+ /**
28624
28866
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28625
- * transport resolves one context per connection - but the number that says
28626
- * whether a plane this census cannot see was busy while HTTP was quiet.
28867
+ * adapter resolves one context per connection - kept because a plane's call
28868
+ * count of zero against 37 open connections says something different from a
28869
+ * plane with no connections at all.
28627
28870
  */
28628
28871
  wsConnections: number(),
28872
+ /**
28873
+ * Client frames the WS plane looked at. `wsMessages` far above
28874
+ * `planes.ws + subscriptions` means most traffic is not operations
28875
+ * (keepalives, connection params) - which is itself an answer.
28876
+ */
28877
+ wsMessages: number(),
28878
+ /**
28879
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28880
+ * purpose: one live-events stream opened at boot and held for six hours is
28881
+ * one subscription, and counting it as a call would let a quiet plane
28882
+ * masquerade as the storm.
28883
+ */
28884
+ subscriptions: number(),
28885
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28886
+ subscriptionStops: number(),
28629
28887
  distinctGroups: number(),
28630
- /** Calls counted in the totals whose group attribution was shed at the
28631
- * cardinality bound. */
28888
+ /**
28889
+ * Operations counted in the totals whose CALLER attribution was shed at the
28890
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28891
+ * which transport they arrived on, they just lost their group row.
28892
+ */
28632
28893
  unattributedCalls: number(),
28633
28894
  procedures: array(RequestCensusProcedureSchema).readonly(),
28634
28895
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28651,10 +28912,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28651
28912
  * The layers of the level hierarchy, general → specific. The most specific
28652
28913
  * layer that carries an explicit value wins.
28653
28914
  *
28654
- * `component` is DECLARED and not yet resolvable: the per-component channels
28655
- * are a later slice of the same plan, and a `levelSource` enum that has to
28656
- * grow later would force every consumer of this document to change with it.
28657
- * Nothing returns `component` today.
28915
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28916
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28917
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28918
+ * that turning it on would not force every consumer of this document to widen
28919
+ * a `levelSource` enum — which is what has now not happened.
28658
28920
  */
28659
28921
  var LoggingScopeKindSchema = _enum([
28660
28922
  "cluster",
@@ -28681,6 +28943,14 @@ var LoggingLevelLayerSchema = object({
28681
28943
  scope: LoggingScopeKindSchema,
28682
28944
  /** The node this layer speaks for; `null` on the cluster layer. */
28683
28945
  nodeId: string().nullable(),
28946
+ /**
28947
+ * The declared channel this layer speaks for; `null` on every layer but
28948
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28949
+ * by design — the convention this repo settled on is one orchestrator-wide
28950
+ * setting, never per node (D52) — so a component layer that carried a node
28951
+ * would invite a per-node copy of a value that has no per-node meaning.
28952
+ */
28953
+ component: string().nullable(),
28684
28954
  /** Explicitly set here, or `null` when this layer inherits. */
28685
28955
  level: LogLevelSchema$1.nullable()
28686
28956
  });
@@ -28722,6 +28992,49 @@ var DiagnosticWindowPatchSchema = object({
28722
28992
  reportEveryMs: number().int().positive().optional()
28723
28993
  });
28724
28994
  /**
28995
+ * A channel ARMED, as the document reports it.
28996
+ *
28997
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28998
+ * and the time left, because a diagnostic left running is itself an incident
28999
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29000
+ */
29001
+ var LogChannelWindowStateSchema = object({
29002
+ channel: string(),
29003
+ armed: boolean(),
29004
+ /** Epoch ms the window closes at. 0 when disarmed. */
29005
+ armedUntilMs: number(),
29006
+ /** Ms left before it expires on its own. 0 when disarmed. */
29007
+ remainingMs: number(),
29008
+ /**
29009
+ * The cameras it is narrowed to, or `null` for every camera.
29010
+ *
29011
+ * A channel declared `perDevice: false` can only ever report `null` here:
29012
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29013
+ * produce a filter that silently matches nothing. The server REFUSES such a
29014
+ * patch rather than quietly widening it — ignoring the request would teach
29015
+ * the operator that per-camera filtering works on that channel when it does
29016
+ * not.
29017
+ */
29018
+ deviceIds: array(number().int()).readonly().nullable()
29019
+ });
29020
+ /**
29021
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29022
+ * for the same reason: a channel is a window with a deadline, never a switch.
29023
+ */
29024
+ var LogChannelWindowPatchSchema = object({
29025
+ channel: string().min(1),
29026
+ armMs: number().int().min(0),
29027
+ /**
29028
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29029
+ *
29030
+ * Numeric because the repo's own rule makes it possible: every log line
29031
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29032
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29033
+ * diagnosed by hand, and this is the first thing that collects on it.
29034
+ */
29035
+ deviceIds: array(number().int()).readonly().nullable().optional()
29036
+ });
29037
+ /**
28725
29038
  * A PATCH, and patches MERGE.
28726
29039
  *
28727
29040
  * A field absent from the patch is left exactly as it was — arming a
@@ -28740,7 +29053,14 @@ var LoggingSettingsPatchSchema = object({
28740
29053
  * Only the diagnostics NAMED here change. An armed window that is not listed
28741
29054
  * keeps running — a patch is never a full replacement.
28742
29055
  */
28743
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29056
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29057
+ /**
29058
+ * Only the channels NAMED here change. An armed channel that is not listed
29059
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29060
+ * disarmed the channels it did not mention would make the Levels page and
29061
+ * the Diagnostics page fight over the same value.
29062
+ */
29063
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28744
29064
  });
28745
29065
  /**
28746
29066
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28753,9 +29073,22 @@ var LoggingSettingsPatchSchema = object({
28753
29073
  * authority over the whole hierarchy and answers for every layer, so the
28754
29074
  * layer selector needs a name the transport does not already own.
28755
29075
  */
28756
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29076
+ var GetLoggingSettingsInputSchema = object({
29077
+ scopeNodeId: string().optional(),
29078
+ /**
29079
+ * The declared CHANNEL this document is addressed at, when the caller wants
29080
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29081
+ *
29082
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29083
+ * axes from collapsing: a component level is cluster-wide, a node level is
29084
+ * not, and one selector for both would make "which of these two did I just
29085
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29086
+ */
29087
+ scopeComponent: string().optional()
29088
+ });
28757
29089
  var SetLoggingSettingsInputSchema = object({
28758
29090
  scopeNodeId: string().optional(),
29091
+ scopeComponent: string().optional(),
28759
29092
  patch: LoggingSettingsPatchSchema
28760
29093
  });
28761
29094
  /**
@@ -28770,9 +29103,20 @@ var SetLoggingSettingsInputSchema = object({
28770
29103
  var LoggingSettingsStateSchema = object({
28771
29104
  /** The layer this document was read at. `null` = the cluster layer. */
28772
29105
  scopeNodeId: string().nullable(),
29106
+ /** The channel this document was read at. `null` = no component layer. */
29107
+ scopeComponent: string().nullable(),
28773
29108
  effective: LoggingEffectiveSchema,
28774
29109
  explicit: LoggingExplicitSchema,
28775
29110
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29111
+ /**
29112
+ * Every channel the cluster's addons DECLARE, gathered from the
29113
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29114
+ * channel added by a redeployed addon appears without anybody editing a
29115
+ * list, and a channel whose addon is gone stops being offered.
29116
+ */
29117
+ channels: array(LogChannelDescriptorSchema).readonly(),
29118
+ /** The channels ARMED right now, each with its deadline. */
29119
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28776
29120
  persisted: boolean()
28777
29121
  });
28778
29122
  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(), {
@@ -31823,6 +32167,12 @@ Object.freeze({
31823
32167
  addonId: null,
31824
32168
  access: "view"
31825
32169
  },
32170
+ "dataStoreProvider.aggregate": {
32171
+ capName: "data-store-provider",
32172
+ capScope: "system",
32173
+ addonId: null,
32174
+ access: "view"
32175
+ },
31826
32176
  "dataStoreProvider.count": {
31827
32177
  capName: "data-store-provider",
31828
32178
  capScope: "system",
@@ -32237,6 +32587,12 @@ Object.freeze({
32237
32587
  addonId: null,
32238
32588
  access: "view"
32239
32589
  },
32590
+ "deviceManager.getChildrenBatch": {
32591
+ capName: "device-manager",
32592
+ capScope: "system",
32593
+ addonId: null,
32594
+ access: "view"
32595
+ },
32240
32596
  "deviceManager.getConfigSchema": {
32241
32597
  capName: "device-manager",
32242
32598
  capScope: "system",
@@ -33287,6 +33643,18 @@ Object.freeze({
33287
33643
  addonId: null,
33288
33644
  access: "create"
33289
33645
  },
33646
+ "logChannels.apply": {
33647
+ capName: "log-channels",
33648
+ capScope: "system",
33649
+ addonId: null,
33650
+ access: "create"
33651
+ },
33652
+ "logChannels.list": {
33653
+ capName: "log-channels",
33654
+ capScope: "system",
33655
+ addonId: null,
33656
+ access: "view"
33657
+ },
33290
33658
  "logDestination.query": {
33291
33659
  capName: "log-destination",
33292
33660
  capScope: "system",
@@ -35441,6 +35809,12 @@ Object.freeze({
35441
35809
  addonId: null,
35442
35810
  access: "create"
35443
35811
  },
35812
+ "settingsStore.aggregate": {
35813
+ capName: "settings-store",
35814
+ capScope: "system",
35815
+ addonId: null,
35816
+ access: "view"
35817
+ },
35444
35818
  "settingsStore.count": {
35445
35819
  capName: "settings-store",
35446
35820
  capScope: "system",
@@ -37020,6 +37394,11 @@ Object.freeze({
37020
37394
  form: "single",
37021
37395
  optional: false
37022
37396
  }],
37397
+ "deviceManager.getChildrenBatch": [{
37398
+ name: "parentDeviceIds",
37399
+ form: "array",
37400
+ optional: false
37401
+ }],
37023
37402
  "deviceManager.getConfigSchema": [{
37024
37403
  name: "deviceId",
37025
37404
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7500,6 +7500,111 @@ function classifyStreams(streams) {
7500
7500
  return result;
7501
7501
  }
7502
7502
  /**
7503
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7504
+ * an addon declares its channels in.
7505
+ *
7506
+ * ## Two axes, deliberately separated
7507
+ *
7508
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7509
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7510
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7511
+ * and rots silently. So a channel is declared where it is consulted, and the
7512
+ * `log-channels` capability enumerates the declarations.
7513
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7514
+ * thing: the logging settings document on the `system` cap. Two authorities
7515
+ * over the values is the exact defect
7516
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7517
+ * remove; re-introducing it from the cure side would be grotesque.
7518
+ *
7519
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7520
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7521
+ * the hot path with a value somebody actually read, and by
7522
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7523
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7524
+ * disarmed one (D49).
7525
+ *
7526
+ * ## The canonical call shape
7527
+ *
7528
+ * ```ts
7529
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7530
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7531
+ * }
7532
+ * ```
7533
+ *
7534
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7535
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7536
+ * object literal is never constructed because it lives inside the branch. It
7537
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7538
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7539
+ * destination floor (measured at 1.93 ns/call when off).
7540
+ *
7541
+ * ## Why a channel emits at `info`
7542
+ *
7543
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7544
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7545
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7546
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7547
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7548
+ * emits at the channel's declared level, whose schema floor is `info`.
7549
+ */
7550
+ /**
7551
+ * The level a channel writes at once armed.
7552
+ *
7553
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7554
+ * not leave the process for Loki, and the whole point of arming a channel is
7555
+ * to read it later.
7556
+ */
7557
+ var LogChannelLevelSchema = _enum([
7558
+ "info",
7559
+ "warn",
7560
+ "error"
7561
+ ]);
7562
+ /**
7563
+ * What an addon declares about one channel. No value, no state — a
7564
+ * declaration is inert.
7565
+ */
7566
+ var LogChannelDescriptorSchema = object({
7567
+ /**
7568
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7569
+ * the addon's short name so an operator reading a channel list can tell who
7570
+ * owns it without a second lookup.
7571
+ */
7572
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7573
+ /** One sentence: what the operator will SEE after arming it. */
7574
+ description: string().min(1),
7575
+ /** The level its lines are emitted at. Never below `info`. */
7576
+ defaultLevel: LogChannelLevelSchema,
7577
+ /**
7578
+ * Whether this channel can be narrowed to a camera.
7579
+ *
7580
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7581
+ * consulted with the numeric device id, AND every line the channel admits
7582
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7583
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7584
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7585
+ * the body is the only way to filter.
7586
+ *
7587
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7588
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7589
+ * the operator narrows to one camera, sees nothing, and concludes the code
7590
+ * path was never taken.
7591
+ */
7592
+ perDevice: boolean()
7593
+ });
7594
+ /**
7595
+ * An armed window over one channel, as the document hands it to a mirror.
7596
+ *
7597
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7598
+ * expires by itself, which is the one failure a boolean cannot avoid.
7599
+ */
7600
+ var LogChannelWindowSchema = object({
7601
+ channel: string().min(1),
7602
+ /** Epoch ms the window closes at. */
7603
+ armedUntilMs: number(),
7604
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7605
+ deviceIds: array(number().int()).readonly().nullable()
7606
+ });
7607
+ /**
7503
7608
  * Ops-log — the durable, append-only operations audit shared by the
7504
7609
  * recordings and events management surfaces.
7505
7610
  *
@@ -11120,6 +11225,35 @@ var MutationFilterSchema = object({
11120
11225
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11121
11226
  whereNot: record(string(), unknown()).optional()
11122
11227
  });
11228
+ /**
11229
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11230
+ *
11231
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11232
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11233
+ * a `Record<column, op>` shape could not express.
11234
+ */
11235
+ var AggregateFieldSchema = object({
11236
+ /** Result key. */
11237
+ as: string().min(1),
11238
+ /** Column to aggregate. Must be a real column of a declared collection. */
11239
+ field: string().min(1),
11240
+ op: _enum([
11241
+ "sum",
11242
+ "min",
11243
+ "max"
11244
+ ])
11245
+ });
11246
+ /**
11247
+ * `COUNT(*)` plus one number per requested field.
11248
+ *
11249
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11250
+ * that really is 0 are different facts, and an accounting caller that renders
11251
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11252
+ */
11253
+ var AggregateResultSchema = object({
11254
+ count: number().int(),
11255
+ values: record(string(), number().nullable())
11256
+ });
11123
11257
  /** A single stored record: `{ id, data }`. */
11124
11258
  var SettingsRecordSchema = object({
11125
11259
  id: string(),
@@ -11204,6 +11338,11 @@ method(object({
11204
11338
  collection: string(),
11205
11339
  filter: QueryFilterSchema.optional()
11206
11340
  }), number()), method(object({
11341
+ namespace: string().optional(),
11342
+ collection: string(),
11343
+ fields: array(AggregateFieldSchema).readonly(),
11344
+ filter: QueryFilterSchema.optional()
11345
+ }), AggregateResultSchema), method(object({
11207
11346
  namespace: string().optional(),
11208
11347
  collection: string(),
11209
11348
  field: string(),
@@ -11320,6 +11459,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11320
11459
  collection: string(),
11321
11460
  filter: QueryFilterSchema.optional()
11322
11461
  }), number(), { auth: "admin" }), method(object({
11462
+ namespace: string().optional(),
11463
+ collection: string(),
11464
+ fields: array(AggregateFieldSchema).readonly(),
11465
+ filter: QueryFilterSchema.optional()
11466
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11323
11467
  namespace: string().optional(),
11324
11468
  collection: string(),
11325
11469
  field: string(),
@@ -12043,24 +12187,6 @@ var deviceProviderCapability = {
12043
12187
  })
12044
12188
  }
12045
12189
  };
12046
- /**
12047
- * Device Manager capability — hub-side singleton that unifies device persistence,
12048
- * live registry access, and all management operations into a single tRPC surface.
12049
- *
12050
- * Replaces:
12051
- * - `device-persistence` capability (persistence methods absorbed here)
12052
- * - `device-management.router.ts` (deleted in Phase 2)
12053
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12054
- *
12055
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12056
- * fork into separate processes but never run on remote cluster agents. Therefore:
12057
- * - No nodeId routing needed — this is a pure hub singleton.
12058
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12059
- * - No shadow registry or cross-node aggregation required.
12060
- *
12061
- * Forked workers register devices back to the hub via `ctx.devices`
12062
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12063
- */
12064
12190
  /** One child-placement directive on a container's `childLayout`. Structurally
12065
12191
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12066
12192
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12429,7 +12555,7 @@ method(object({
12429
12555
  * it answers today and the caller filters as it already does.
12430
12556
  */
12431
12557
  deviceIds: array(number()).optional()
12432
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12558
+ }), 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({
12433
12559
  mode: LinkedDevicesModeSchema,
12434
12560
  devices: array(LinkedDeviceSchema)
12435
12561
  })), 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({
@@ -13153,6 +13279,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13153
13279
  kind: "mutation",
13154
13280
  auth: "admin"
13155
13281
  });
13282
+ /**
13283
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13284
+ * through. It stores nothing.
13285
+ *
13286
+ * ## Why a capability at all, and why this shape
13287
+ *
13288
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13289
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13290
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13291
+ * fails, an operator just never sees the channel somebody added. So the list
13292
+ * is assembled from declarations at runtime.
13293
+ *
13294
+ * The shape is copied from `log-destination.cap.ts`, which already does
13295
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13296
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13297
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13298
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13299
+ * runner's declarations reach hub-main over the transport that already exists.
13300
+ * No new UDS message, no second registry.
13301
+ *
13302
+ * ## What it deliberately does NOT own
13303
+ *
13304
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13305
+ * ONE place: the logging settings document on the `system` cap
13306
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13307
+ * value is the defect the plan behind this work exists to remove, and
13308
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13309
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13310
+ * setter for a window and no persistence of any kind.
13311
+ *
13312
+ * ## Why `apply` is here even so
13313
+ *
13314
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13315
+ * seam has to carry the value from the authority to the mirror, and a channel
13316
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13317
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13318
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13319
+ * persists nothing, it is never the source of a value, and it is called only
13320
+ * with a set the hub actually read (D49 — a read that fails does not call it
13321
+ * at all, so no channel is silently disarmed by a bad read).
13322
+ */
13323
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13324
+ var LogChannelApplyResultSchema = object({
13325
+ /** How many declared channels are armed in this process after the call. */
13326
+ armed: number().int().min(0),
13327
+ /**
13328
+ * Names the document armed that this process does not declare. Reported
13329
+ * rather than swallowed: a name here is either a typo or an addon that has
13330
+ * not booted, and both deserve a line instead of silence.
13331
+ */
13332
+ unknown: array(string()).readonly()
13333
+ });
13334
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13156
13335
  var LogLevelSchema = _enum([
13157
13336
  "debug",
13158
13337
  "info",
@@ -28547,17 +28726,60 @@ var SetSiteLocationInputSchema = object({
28547
28726
  longitude: number().min(-180).max(180)
28548
28727
  }).nullable();
28549
28728
  /**
28550
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28729
+ * The TRANSPORT a call arrived on.
28730
+ *
28731
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28732
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28733
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28734
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28735
+ * checkable rather than asserted.
28736
+ *
28737
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28738
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28739
+ * connection; the viewer talks to the hub over `wsLink`
28740
+ * exclusively, so this is the plane the HTTP census could not see.
28741
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28742
+ * never touches a socket and therefore never touched a census.
28743
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28744
+ * that is exactly what its `0` asserts: every plane the hub has can name
28745
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28746
+ * plane nobody instrumented lands here instead of vanishing from the total.
28747
+ */
28748
+ var TransportPlaneSchema = _enum([
28749
+ "http",
28750
+ "ws",
28751
+ "mesh",
28752
+ "unknown"
28753
+ ]);
28754
+ /**
28755
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28756
+ * reads as "not instrumented", which is the one thing this census must never
28757
+ * make an operator wonder about.
28758
+ */
28759
+ var TransportPlaneCountsSchema = object({
28760
+ http: number(),
28761
+ ws: number(),
28762
+ mesh: number(),
28763
+ unknown: number()
28764
+ });
28765
+ /**
28766
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28551
28767
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28552
28768
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28553
28769
  * already prints - never a token, never an `Authorization` header.
28770
+ *
28771
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28772
+ * and lives for hours, so folding it into a call count makes one long-lived
28773
+ * stream look like a storm.
28554
28774
  */
28555
28775
  var RequestCensusGroupSchema = object({
28776
+ plane: TransportPlaneSchema,
28556
28777
  procedure: string(),
28557
28778
  userAgent: string(),
28558
28779
  ip: string(),
28559
28780
  principal: string(),
28560
28781
  calls: number(),
28782
+ subscriptions: number(),
28561
28783
  perMin: number()
28562
28784
  });
28563
28785
  /**
@@ -28570,6 +28792,14 @@ var RequestCensusGroupSchema = object({
28570
28792
  var RequestCensusProcedureSchema = object({
28571
28793
  procedure: string(),
28572
28794
  calls: number(),
28795
+ /**
28796
+ * The same total, split by transport. THIS is the row that answers the
28797
+ * question the census exists for: one look at `deviceManager.listAll` says
28798
+ * which plane carried the 4 960, without joining two log lines by eye.
28799
+ */
28800
+ planes: TransportPlaneCountsSchema,
28801
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28802
+ subscriptions: number(),
28573
28803
  perMin: number()
28574
28804
  });
28575
28805
  /**
@@ -28597,14 +28827,45 @@ var RequestCensusStatusSchema = object({
28597
28827
  */
28598
28828
  procedureCalls: number(),
28599
28829
  /**
28830
+ * `procedureCalls` split by transport. The four keys sum to
28831
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28832
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28833
+ */
28834
+ planes: TransportPlaneCountsSchema,
28835
+ /**
28836
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28837
+ * on no plane at all - which is a RESULT (a plane is missing from the
28838
+ * instrument), not a failure, and it has to be visible to be read as one.
28839
+ */
28840
+ planesExplainTotal: boolean(),
28841
+ /**
28600
28842
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28601
- * transport resolves one context per connection - but the number that says
28602
- * whether a plane this census cannot see was busy while HTTP was quiet.
28843
+ * adapter resolves one context per connection - kept because a plane's call
28844
+ * count of zero against 37 open connections says something different from a
28845
+ * plane with no connections at all.
28603
28846
  */
28604
28847
  wsConnections: number(),
28848
+ /**
28849
+ * Client frames the WS plane looked at. `wsMessages` far above
28850
+ * `planes.ws + subscriptions` means most traffic is not operations
28851
+ * (keepalives, connection params) - which is itself an answer.
28852
+ */
28853
+ wsMessages: number(),
28854
+ /**
28855
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28856
+ * purpose: one live-events stream opened at boot and held for six hours is
28857
+ * one subscription, and counting it as a call would let a quiet plane
28858
+ * masquerade as the storm.
28859
+ */
28860
+ subscriptions: number(),
28861
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28862
+ subscriptionStops: number(),
28605
28863
  distinctGroups: number(),
28606
- /** Calls counted in the totals whose group attribution was shed at the
28607
- * cardinality bound. */
28864
+ /**
28865
+ * Operations counted in the totals whose CALLER attribution was shed at the
28866
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28867
+ * which transport they arrived on, they just lost their group row.
28868
+ */
28608
28869
  unattributedCalls: number(),
28609
28870
  procedures: array(RequestCensusProcedureSchema).readonly(),
28610
28871
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28627,10 +28888,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28627
28888
  * The layers of the level hierarchy, general → specific. The most specific
28628
28889
  * layer that carries an explicit value wins.
28629
28890
  *
28630
- * `component` is DECLARED and not yet resolvable: the per-component channels
28631
- * are a later slice of the same plan, and a `levelSource` enum that has to
28632
- * grow later would force every consumer of this document to change with it.
28633
- * Nothing returns `component` today.
28891
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28892
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28893
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28894
+ * that turning it on would not force every consumer of this document to widen
28895
+ * a `levelSource` enum — which is what has now not happened.
28634
28896
  */
28635
28897
  var LoggingScopeKindSchema = _enum([
28636
28898
  "cluster",
@@ -28657,6 +28919,14 @@ var LoggingLevelLayerSchema = object({
28657
28919
  scope: LoggingScopeKindSchema,
28658
28920
  /** The node this layer speaks for; `null` on the cluster layer. */
28659
28921
  nodeId: string().nullable(),
28922
+ /**
28923
+ * The declared channel this layer speaks for; `null` on every layer but
28924
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28925
+ * by design — the convention this repo settled on is one orchestrator-wide
28926
+ * setting, never per node (D52) — so a component layer that carried a node
28927
+ * would invite a per-node copy of a value that has no per-node meaning.
28928
+ */
28929
+ component: string().nullable(),
28660
28930
  /** Explicitly set here, or `null` when this layer inherits. */
28661
28931
  level: LogLevelSchema$1.nullable()
28662
28932
  });
@@ -28698,6 +28968,49 @@ var DiagnosticWindowPatchSchema = object({
28698
28968
  reportEveryMs: number().int().positive().optional()
28699
28969
  });
28700
28970
  /**
28971
+ * A channel ARMED, as the document reports it.
28972
+ *
28973
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28974
+ * and the time left, because a diagnostic left running is itself an incident
28975
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28976
+ */
28977
+ var LogChannelWindowStateSchema = object({
28978
+ channel: string(),
28979
+ armed: boolean(),
28980
+ /** Epoch ms the window closes at. 0 when disarmed. */
28981
+ armedUntilMs: number(),
28982
+ /** Ms left before it expires on its own. 0 when disarmed. */
28983
+ remainingMs: number(),
28984
+ /**
28985
+ * The cameras it is narrowed to, or `null` for every camera.
28986
+ *
28987
+ * A channel declared `perDevice: false` can only ever report `null` here:
28988
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28989
+ * produce a filter that silently matches nothing. The server REFUSES such a
28990
+ * patch rather than quietly widening it — ignoring the request would teach
28991
+ * the operator that per-camera filtering works on that channel when it does
28992
+ * not.
28993
+ */
28994
+ deviceIds: array(number().int()).readonly().nullable()
28995
+ });
28996
+ /**
28997
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28998
+ * for the same reason: a channel is a window with a deadline, never a switch.
28999
+ */
29000
+ var LogChannelWindowPatchSchema = object({
29001
+ channel: string().min(1),
29002
+ armMs: number().int().min(0),
29003
+ /**
29004
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29005
+ *
29006
+ * Numeric because the repo's own rule makes it possible: every log line
29007
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29008
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29009
+ * diagnosed by hand, and this is the first thing that collects on it.
29010
+ */
29011
+ deviceIds: array(number().int()).readonly().nullable().optional()
29012
+ });
29013
+ /**
28701
29014
  * A PATCH, and patches MERGE.
28702
29015
  *
28703
29016
  * A field absent from the patch is left exactly as it was — arming a
@@ -28716,7 +29029,14 @@ var LoggingSettingsPatchSchema = object({
28716
29029
  * Only the diagnostics NAMED here change. An armed window that is not listed
28717
29030
  * keeps running — a patch is never a full replacement.
28718
29031
  */
28719
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29032
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29033
+ /**
29034
+ * Only the channels NAMED here change. An armed channel that is not listed
29035
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29036
+ * disarmed the channels it did not mention would make the Levels page and
29037
+ * the Diagnostics page fight over the same value.
29038
+ */
29039
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28720
29040
  });
28721
29041
  /**
28722
29042
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28729,9 +29049,22 @@ var LoggingSettingsPatchSchema = object({
28729
29049
  * authority over the whole hierarchy and answers for every layer, so the
28730
29050
  * layer selector needs a name the transport does not already own.
28731
29051
  */
28732
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29052
+ var GetLoggingSettingsInputSchema = object({
29053
+ scopeNodeId: string().optional(),
29054
+ /**
29055
+ * The declared CHANNEL this document is addressed at, when the caller wants
29056
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29057
+ *
29058
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29059
+ * axes from collapsing: a component level is cluster-wide, a node level is
29060
+ * not, and one selector for both would make "which of these two did I just
29061
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29062
+ */
29063
+ scopeComponent: string().optional()
29064
+ });
28733
29065
  var SetLoggingSettingsInputSchema = object({
28734
29066
  scopeNodeId: string().optional(),
29067
+ scopeComponent: string().optional(),
28735
29068
  patch: LoggingSettingsPatchSchema
28736
29069
  });
28737
29070
  /**
@@ -28746,9 +29079,20 @@ var SetLoggingSettingsInputSchema = object({
28746
29079
  var LoggingSettingsStateSchema = object({
28747
29080
  /** The layer this document was read at. `null` = the cluster layer. */
28748
29081
  scopeNodeId: string().nullable(),
29082
+ /** The channel this document was read at. `null` = no component layer. */
29083
+ scopeComponent: string().nullable(),
28749
29084
  effective: LoggingEffectiveSchema,
28750
29085
  explicit: LoggingExplicitSchema,
28751
29086
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29087
+ /**
29088
+ * Every channel the cluster's addons DECLARE, gathered from the
29089
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29090
+ * channel added by a redeployed addon appears without anybody editing a
29091
+ * list, and a channel whose addon is gone stops being offered.
29092
+ */
29093
+ channels: array(LogChannelDescriptorSchema).readonly(),
29094
+ /** The channels ARMED right now, each with its deadline. */
29095
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28752
29096
  persisted: boolean()
28753
29097
  });
28754
29098
  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(), {
@@ -31799,6 +32143,12 @@ Object.freeze({
31799
32143
  addonId: null,
31800
32144
  access: "view"
31801
32145
  },
32146
+ "dataStoreProvider.aggregate": {
32147
+ capName: "data-store-provider",
32148
+ capScope: "system",
32149
+ addonId: null,
32150
+ access: "view"
32151
+ },
31802
32152
  "dataStoreProvider.count": {
31803
32153
  capName: "data-store-provider",
31804
32154
  capScope: "system",
@@ -32213,6 +32563,12 @@ Object.freeze({
32213
32563
  addonId: null,
32214
32564
  access: "view"
32215
32565
  },
32566
+ "deviceManager.getChildrenBatch": {
32567
+ capName: "device-manager",
32568
+ capScope: "system",
32569
+ addonId: null,
32570
+ access: "view"
32571
+ },
32216
32572
  "deviceManager.getConfigSchema": {
32217
32573
  capName: "device-manager",
32218
32574
  capScope: "system",
@@ -33263,6 +33619,18 @@ Object.freeze({
33263
33619
  addonId: null,
33264
33620
  access: "create"
33265
33621
  },
33622
+ "logChannels.apply": {
33623
+ capName: "log-channels",
33624
+ capScope: "system",
33625
+ addonId: null,
33626
+ access: "create"
33627
+ },
33628
+ "logChannels.list": {
33629
+ capName: "log-channels",
33630
+ capScope: "system",
33631
+ addonId: null,
33632
+ access: "view"
33633
+ },
33266
33634
  "logDestination.query": {
33267
33635
  capName: "log-destination",
33268
33636
  capScope: "system",
@@ -35417,6 +35785,12 @@ Object.freeze({
35417
35785
  addonId: null,
35418
35786
  access: "create"
35419
35787
  },
35788
+ "settingsStore.aggregate": {
35789
+ capName: "settings-store",
35790
+ capScope: "system",
35791
+ addonId: null,
35792
+ access: "view"
35793
+ },
35420
35794
  "settingsStore.count": {
35421
35795
  capName: "settings-store",
35422
35796
  capScope: "system",
@@ -36996,6 +37370,11 @@ Object.freeze({
36996
37370
  form: "single",
36997
37371
  optional: false
36998
37372
  }],
37373
+ "deviceManager.getChildrenBatch": [{
37374
+ name: "parentDeviceIds",
37375
+ form: "array",
37376
+ optional: false
37377
+ }],
36999
37378
  "deviceManager.getConfigSchema": [{
37000
37379
  name: "deviceId",
37001
37380
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rtsp",
3
- "version": "1.2.32",
3
+ "version": "1.2.34",
4
4
  "description": "Generic RTSP camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",