@camstack/addon-decoder-nodeav 1.2.31 → 1.2.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +409 -30
  2. package/dist/index.mjs +409 -30
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7468,6 +7468,111 @@ var CameraSwitchGroupSchema = object({
7468
7468
  fetchedAt: number()
7469
7469
  });
7470
7470
  /**
7471
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7472
+ * an addon declares its channels in.
7473
+ *
7474
+ * ## Two axes, deliberately separated
7475
+ *
7476
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7477
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7478
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7479
+ * and rots silently. So a channel is declared where it is consulted, and the
7480
+ * `log-channels` capability enumerates the declarations.
7481
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7482
+ * thing: the logging settings document on the `system` cap. Two authorities
7483
+ * over the values is the exact defect
7484
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7485
+ * remove; re-introducing it from the cure side would be grotesque.
7486
+ *
7487
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7488
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7489
+ * the hot path with a value somebody actually read, and by
7490
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7491
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7492
+ * disarmed one (D49).
7493
+ *
7494
+ * ## The canonical call shape
7495
+ *
7496
+ * ```ts
7497
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7498
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7499
+ * }
7500
+ * ```
7501
+ *
7502
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7503
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7504
+ * object literal is never constructed because it lives inside the branch. It
7505
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7506
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7507
+ * destination floor (measured at 1.93 ns/call when off).
7508
+ *
7509
+ * ## Why a channel emits at `info`
7510
+ *
7511
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7512
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7513
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7514
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7515
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7516
+ * emits at the channel's declared level, whose schema floor is `info`.
7517
+ */
7518
+ /**
7519
+ * The level a channel writes at once armed.
7520
+ *
7521
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7522
+ * not leave the process for Loki, and the whole point of arming a channel is
7523
+ * to read it later.
7524
+ */
7525
+ var LogChannelLevelSchema = _enum([
7526
+ "info",
7527
+ "warn",
7528
+ "error"
7529
+ ]);
7530
+ /**
7531
+ * What an addon declares about one channel. No value, no state — a
7532
+ * declaration is inert.
7533
+ */
7534
+ var LogChannelDescriptorSchema = object({
7535
+ /**
7536
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7537
+ * the addon's short name so an operator reading a channel list can tell who
7538
+ * owns it without a second lookup.
7539
+ */
7540
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7541
+ /** One sentence: what the operator will SEE after arming it. */
7542
+ description: string().min(1),
7543
+ /** The level its lines are emitted at. Never below `info`. */
7544
+ defaultLevel: LogChannelLevelSchema,
7545
+ /**
7546
+ * Whether this channel can be narrowed to a camera.
7547
+ *
7548
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7549
+ * consulted with the numeric device id, AND every line the channel admits
7550
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7551
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7552
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7553
+ * the body is the only way to filter.
7554
+ *
7555
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7556
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7557
+ * the operator narrows to one camera, sees nothing, and concludes the code
7558
+ * path was never taken.
7559
+ */
7560
+ perDevice: boolean()
7561
+ });
7562
+ /**
7563
+ * An armed window over one channel, as the document hands it to a mirror.
7564
+ *
7565
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7566
+ * expires by itself, which is the one failure a boolean cannot avoid.
7567
+ */
7568
+ var LogChannelWindowSchema = object({
7569
+ channel: string().min(1),
7570
+ /** Epoch ms the window closes at. */
7571
+ armedUntilMs: number(),
7572
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7573
+ deviceIds: array(number().int()).readonly().nullable()
7574
+ });
7575
+ /**
7471
7576
  * Ops-log — the durable, append-only operations audit shared by the
7472
7577
  * recordings and events management surfaces.
7473
7578
  *
@@ -11023,6 +11128,35 @@ var MutationFilterSchema = object({
11023
11128
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11024
11129
  whereNot: record(string(), unknown()).optional()
11025
11130
  });
11131
+ /**
11132
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11133
+ *
11134
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11135
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11136
+ * a `Record<column, op>` shape could not express.
11137
+ */
11138
+ var AggregateFieldSchema = object({
11139
+ /** Result key. */
11140
+ as: string().min(1),
11141
+ /** Column to aggregate. Must be a real column of a declared collection. */
11142
+ field: string().min(1),
11143
+ op: _enum([
11144
+ "sum",
11145
+ "min",
11146
+ "max"
11147
+ ])
11148
+ });
11149
+ /**
11150
+ * `COUNT(*)` plus one number per requested field.
11151
+ *
11152
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11153
+ * that really is 0 are different facts, and an accounting caller that renders
11154
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11155
+ */
11156
+ var AggregateResultSchema = object({
11157
+ count: number().int(),
11158
+ values: record(string(), number().nullable())
11159
+ });
11026
11160
  /** A single stored record: `{ id, data }`. */
11027
11161
  var SettingsRecordSchema = object({
11028
11162
  id: string(),
@@ -11107,6 +11241,11 @@ method(object({
11107
11241
  collection: string(),
11108
11242
  filter: QueryFilterSchema.optional()
11109
11243
  }), number()), method(object({
11244
+ namespace: string().optional(),
11245
+ collection: string(),
11246
+ fields: array(AggregateFieldSchema).readonly(),
11247
+ filter: QueryFilterSchema.optional()
11248
+ }), AggregateResultSchema), method(object({
11110
11249
  namespace: string().optional(),
11111
11250
  collection: string(),
11112
11251
  field: string(),
@@ -11223,6 +11362,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11223
11362
  collection: string(),
11224
11363
  filter: QueryFilterSchema.optional()
11225
11364
  }), number(), { auth: "admin" }), method(object({
11365
+ namespace: string().optional(),
11366
+ collection: string(),
11367
+ fields: array(AggregateFieldSchema).readonly(),
11368
+ filter: QueryFilterSchema.optional()
11369
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11226
11370
  namespace: string().optional(),
11227
11371
  collection: string(),
11228
11372
  field: string(),
@@ -11877,24 +12021,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
11877
12021
  kind: "mutation",
11878
12022
  auth: "admin"
11879
12023
  });
11880
- /**
11881
- * Device Manager capability — hub-side singleton that unifies device persistence,
11882
- * live registry access, and all management operations into a single tRPC surface.
11883
- *
11884
- * Replaces:
11885
- * - `device-persistence` capability (persistence methods absorbed here)
11886
- * - `device-management.router.ts` (deleted in Phase 2)
11887
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
11888
- *
11889
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
11890
- * fork into separate processes but never run on remote cluster agents. Therefore:
11891
- * - No nodeId routing needed — this is a pure hub singleton.
11892
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
11893
- * - No shadow registry or cross-node aggregation required.
11894
- *
11895
- * Forked workers register devices back to the hub via `ctx.devices`
11896
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
11897
- */
11898
12024
  /** One child-placement directive on a container's `childLayout`. Structurally
11899
12025
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
11900
12026
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12263,7 +12389,7 @@ method(object({
12263
12389
  * it answers today and the caller filters as it already does.
12264
12390
  */
12265
12391
  deviceIds: array(number()).optional()
12266
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12392
+ }), 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({
12267
12393
  mode: LinkedDevicesModeSchema,
12268
12394
  devices: array(LinkedDeviceSchema)
12269
12395
  })), 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({
@@ -12987,6 +13113,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
12987
13113
  kind: "mutation",
12988
13114
  auth: "admin"
12989
13115
  });
13116
+ /**
13117
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13118
+ * through. It stores nothing.
13119
+ *
13120
+ * ## Why a capability at all, and why this shape
13121
+ *
13122
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13123
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13124
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13125
+ * fails, an operator just never sees the channel somebody added. So the list
13126
+ * is assembled from declarations at runtime.
13127
+ *
13128
+ * The shape is copied from `log-destination.cap.ts`, which already does
13129
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13130
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13131
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13132
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13133
+ * runner's declarations reach hub-main over the transport that already exists.
13134
+ * No new UDS message, no second registry.
13135
+ *
13136
+ * ## What it deliberately does NOT own
13137
+ *
13138
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13139
+ * ONE place: the logging settings document on the `system` cap
13140
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13141
+ * value is the defect the plan behind this work exists to remove, and
13142
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13143
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13144
+ * setter for a window and no persistence of any kind.
13145
+ *
13146
+ * ## Why `apply` is here even so
13147
+ *
13148
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13149
+ * seam has to carry the value from the authority to the mirror, and a channel
13150
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13151
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13152
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13153
+ * persists nothing, it is never the source of a value, and it is called only
13154
+ * with a set the hub actually read (D49 — a read that fails does not call it
13155
+ * at all, so no channel is silently disarmed by a bad read).
13156
+ */
13157
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13158
+ var LogChannelApplyResultSchema = object({
13159
+ /** How many declared channels are armed in this process after the call. */
13160
+ armed: number().int().min(0),
13161
+ /**
13162
+ * Names the document armed that this process does not declare. Reported
13163
+ * rather than swallowed: a name here is either a typo or an addon that has
13164
+ * not booted, and both deserve a line instead of silence.
13165
+ */
13166
+ unknown: array(string()).readonly()
13167
+ });
13168
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
12990
13169
  var LogLevelSchema = _enum([
12991
13170
  "debug",
12992
13171
  "info",
@@ -26242,17 +26421,60 @@ var SetSiteLocationInputSchema = object({
26242
26421
  longitude: number().min(-180).max(180)
26243
26422
  }).nullable();
26244
26423
  /**
26245
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26424
+ * The TRANSPORT a call arrived on.
26425
+ *
26426
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26427
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26428
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26429
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26430
+ * checkable rather than asserted.
26431
+ *
26432
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26433
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26434
+ * connection; the viewer talks to the hub over `wsLink`
26435
+ * exclusively, so this is the plane the HTTP census could not see.
26436
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26437
+ * never touches a socket and therefore never touched a census.
26438
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26439
+ * that is exactly what its `0` asserts: every plane the hub has can name
26440
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26441
+ * plane nobody instrumented lands here instead of vanishing from the total.
26442
+ */
26443
+ var TransportPlaneSchema = _enum([
26444
+ "http",
26445
+ "ws",
26446
+ "mesh",
26447
+ "unknown"
26448
+ ]);
26449
+ /**
26450
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26451
+ * reads as "not instrumented", which is the one thing this census must never
26452
+ * make an operator wonder about.
26453
+ */
26454
+ var TransportPlaneCountsSchema = object({
26455
+ http: number(),
26456
+ ws: number(),
26457
+ mesh: number(),
26458
+ unknown: number()
26459
+ });
26460
+ /**
26461
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26246
26462
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26247
26463
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26248
26464
  * already prints - never a token, never an `Authorization` header.
26465
+ *
26466
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26467
+ * and lives for hours, so folding it into a call count makes one long-lived
26468
+ * stream look like a storm.
26249
26469
  */
26250
26470
  var RequestCensusGroupSchema = object({
26471
+ plane: TransportPlaneSchema,
26251
26472
  procedure: string(),
26252
26473
  userAgent: string(),
26253
26474
  ip: string(),
26254
26475
  principal: string(),
26255
26476
  calls: number(),
26477
+ subscriptions: number(),
26256
26478
  perMin: number()
26257
26479
  });
26258
26480
  /**
@@ -26265,6 +26487,14 @@ var RequestCensusGroupSchema = object({
26265
26487
  var RequestCensusProcedureSchema = object({
26266
26488
  procedure: string(),
26267
26489
  calls: number(),
26490
+ /**
26491
+ * The same total, split by transport. THIS is the row that answers the
26492
+ * question the census exists for: one look at `deviceManager.listAll` says
26493
+ * which plane carried the 4 960, without joining two log lines by eye.
26494
+ */
26495
+ planes: TransportPlaneCountsSchema,
26496
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26497
+ subscriptions: number(),
26268
26498
  perMin: number()
26269
26499
  });
26270
26500
  /**
@@ -26292,14 +26522,45 @@ var RequestCensusStatusSchema = object({
26292
26522
  */
26293
26523
  procedureCalls: number(),
26294
26524
  /**
26525
+ * `procedureCalls` split by transport. The four keys sum to
26526
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26527
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26528
+ */
26529
+ planes: TransportPlaneCountsSchema,
26530
+ /**
26531
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26532
+ * on no plane at all - which is a RESULT (a plane is missing from the
26533
+ * instrument), not a failure, and it has to be visible to be read as one.
26534
+ */
26535
+ planesExplainTotal: boolean(),
26536
+ /**
26295
26537
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
26296
- * transport resolves one context per connection - but the number that says
26297
- * whether a plane this census cannot see was busy while HTTP was quiet.
26538
+ * adapter resolves one context per connection - kept because a plane's call
26539
+ * count of zero against 37 open connections says something different from a
26540
+ * plane with no connections at all.
26298
26541
  */
26299
26542
  wsConnections: number(),
26543
+ /**
26544
+ * Client frames the WS plane looked at. `wsMessages` far above
26545
+ * `planes.ws + subscriptions` means most traffic is not operations
26546
+ * (keepalives, connection params) - which is itself an answer.
26547
+ */
26548
+ wsMessages: number(),
26549
+ /**
26550
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26551
+ * purpose: one live-events stream opened at boot and held for six hours is
26552
+ * one subscription, and counting it as a call would let a quiet plane
26553
+ * masquerade as the storm.
26554
+ */
26555
+ subscriptions: number(),
26556
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26557
+ subscriptionStops: number(),
26300
26558
  distinctGroups: number(),
26301
- /** Calls counted in the totals whose group attribution was shed at the
26302
- * cardinality bound. */
26559
+ /**
26560
+ * Operations counted in the totals whose CALLER attribution was shed at the
26561
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26562
+ * which transport they arrived on, they just lost their group row.
26563
+ */
26303
26564
  unattributedCalls: number(),
26304
26565
  procedures: array(RequestCensusProcedureSchema).readonly(),
26305
26566
  groups: array(RequestCensusGroupSchema).readonly()
@@ -26322,10 +26583,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
26322
26583
  * The layers of the level hierarchy, general → specific. The most specific
26323
26584
  * layer that carries an explicit value wins.
26324
26585
  *
26325
- * `component` is DECLARED and not yet resolvable: the per-component channels
26326
- * are a later slice of the same plan, and a `levelSource` enum that has to
26327
- * grow later would force every consumer of this document to change with it.
26328
- * Nothing returns `component` today.
26586
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
26587
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
26588
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
26589
+ * that turning it on would not force every consumer of this document to widen
26590
+ * a `levelSource` enum — which is what has now not happened.
26329
26591
  */
26330
26592
  var LoggingScopeKindSchema = _enum([
26331
26593
  "cluster",
@@ -26352,6 +26614,14 @@ var LoggingLevelLayerSchema = object({
26352
26614
  scope: LoggingScopeKindSchema,
26353
26615
  /** The node this layer speaks for; `null` on the cluster layer. */
26354
26616
  nodeId: string().nullable(),
26617
+ /**
26618
+ * The declared channel this layer speaks for; `null` on every layer but
26619
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
26620
+ * by design — the convention this repo settled on is one orchestrator-wide
26621
+ * setting, never per node (D52) — so a component layer that carried a node
26622
+ * would invite a per-node copy of a value that has no per-node meaning.
26623
+ */
26624
+ component: string().nullable(),
26355
26625
  /** Explicitly set here, or `null` when this layer inherits. */
26356
26626
  level: LogLevelSchema$1.nullable()
26357
26627
  });
@@ -26393,6 +26663,49 @@ var DiagnosticWindowPatchSchema = object({
26393
26663
  reportEveryMs: number().int().positive().optional()
26394
26664
  });
26395
26665
  /**
26666
+ * A channel ARMED, as the document reports it.
26667
+ *
26668
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
26669
+ * and the time left, because a diagnostic left running is itself an incident
26670
+ * and "armed for 10 minutes" said an hour ago is not an answer.
26671
+ */
26672
+ var LogChannelWindowStateSchema = object({
26673
+ channel: string(),
26674
+ armed: boolean(),
26675
+ /** Epoch ms the window closes at. 0 when disarmed. */
26676
+ armedUntilMs: number(),
26677
+ /** Ms left before it expires on its own. 0 when disarmed. */
26678
+ remainingMs: number(),
26679
+ /**
26680
+ * The cameras it is narrowed to, or `null` for every camera.
26681
+ *
26682
+ * A channel declared `perDevice: false` can only ever report `null` here:
26683
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
26684
+ * produce a filter that silently matches nothing. The server REFUSES such a
26685
+ * patch rather than quietly widening it — ignoring the request would teach
26686
+ * the operator that per-camera filtering works on that channel when it does
26687
+ * not.
26688
+ */
26689
+ deviceIds: array(number().int()).readonly().nullable()
26690
+ });
26691
+ /**
26692
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
26693
+ * for the same reason: a channel is a window with a deadline, never a switch.
26694
+ */
26695
+ var LogChannelWindowPatchSchema = object({
26696
+ channel: string().min(1),
26697
+ armMs: number().int().min(0),
26698
+ /**
26699
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
26700
+ *
26701
+ * Numeric because the repo's own rule makes it possible: every log line
26702
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
26703
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
26704
+ * diagnosed by hand, and this is the first thing that collects on it.
26705
+ */
26706
+ deviceIds: array(number().int()).readonly().nullable().optional()
26707
+ });
26708
+ /**
26396
26709
  * A PATCH, and patches MERGE.
26397
26710
  *
26398
26711
  * A field absent from the patch is left exactly as it was — arming a
@@ -26411,7 +26724,14 @@ var LoggingSettingsPatchSchema = object({
26411
26724
  * Only the diagnostics NAMED here change. An armed window that is not listed
26412
26725
  * keeps running — a patch is never a full replacement.
26413
26726
  */
26414
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26727
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
26728
+ /**
26729
+ * Only the channels NAMED here change. An armed channel that is not listed
26730
+ * keeps running — same rule as `diagnostics`, because a patch that silently
26731
+ * disarmed the channels it did not mention would make the Levels page and
26732
+ * the Diagnostics page fight over the same value.
26733
+ */
26734
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
26415
26735
  });
26416
26736
  /**
26417
26737
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -26424,9 +26744,22 @@ var LoggingSettingsPatchSchema = object({
26424
26744
  * authority over the whole hierarchy and answers for every layer, so the
26425
26745
  * layer selector needs a name the transport does not already own.
26426
26746
  */
26427
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26747
+ var GetLoggingSettingsInputSchema = object({
26748
+ scopeNodeId: string().optional(),
26749
+ /**
26750
+ * The declared CHANNEL this document is addressed at, when the caller wants
26751
+ * the `component` layer. Absent = the node/cluster hierarchy only.
26752
+ *
26753
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
26754
+ * axes from collapsing: a component level is cluster-wide, a node level is
26755
+ * not, and one selector for both would make "which of these two did I just
26756
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
26757
+ */
26758
+ scopeComponent: string().optional()
26759
+ });
26428
26760
  var SetLoggingSettingsInputSchema = object({
26429
26761
  scopeNodeId: string().optional(),
26762
+ scopeComponent: string().optional(),
26430
26763
  patch: LoggingSettingsPatchSchema
26431
26764
  });
26432
26765
  /**
@@ -26441,9 +26774,20 @@ var SetLoggingSettingsInputSchema = object({
26441
26774
  var LoggingSettingsStateSchema = object({
26442
26775
  /** The layer this document was read at. `null` = the cluster layer. */
26443
26776
  scopeNodeId: string().nullable(),
26777
+ /** The channel this document was read at. `null` = no component layer. */
26778
+ scopeComponent: string().nullable(),
26444
26779
  effective: LoggingEffectiveSchema,
26445
26780
  explicit: LoggingExplicitSchema,
26446
26781
  activeWindows: array(DiagnosticWindowSchema).readonly(),
26782
+ /**
26783
+ * Every channel the cluster's addons DECLARE, gathered from the
26784
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
26785
+ * channel added by a redeployed addon appears without anybody editing a
26786
+ * list, and a channel whose addon is gone stops being offered.
26787
+ */
26788
+ channels: array(LogChannelDescriptorSchema).readonly(),
26789
+ /** The channels ARMED right now, each with its deadline. */
26790
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
26447
26791
  persisted: boolean()
26448
26792
  });
26449
26793
  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(), {
@@ -28020,6 +28364,12 @@ Object.freeze({
28020
28364
  addonId: null,
28021
28365
  access: "view"
28022
28366
  },
28367
+ "dataStoreProvider.aggregate": {
28368
+ capName: "data-store-provider",
28369
+ capScope: "system",
28370
+ addonId: null,
28371
+ access: "view"
28372
+ },
28023
28373
  "dataStoreProvider.count": {
28024
28374
  capName: "data-store-provider",
28025
28375
  capScope: "system",
@@ -28434,6 +28784,12 @@ Object.freeze({
28434
28784
  addonId: null,
28435
28785
  access: "view"
28436
28786
  },
28787
+ "deviceManager.getChildrenBatch": {
28788
+ capName: "device-manager",
28789
+ capScope: "system",
28790
+ addonId: null,
28791
+ access: "view"
28792
+ },
28437
28793
  "deviceManager.getConfigSchema": {
28438
28794
  capName: "device-manager",
28439
28795
  capScope: "system",
@@ -29484,6 +29840,18 @@ Object.freeze({
29484
29840
  addonId: null,
29485
29841
  access: "create"
29486
29842
  },
29843
+ "logChannels.apply": {
29844
+ capName: "log-channels",
29845
+ capScope: "system",
29846
+ addonId: null,
29847
+ access: "create"
29848
+ },
29849
+ "logChannels.list": {
29850
+ capName: "log-channels",
29851
+ capScope: "system",
29852
+ addonId: null,
29853
+ access: "view"
29854
+ },
29487
29855
  "logDestination.query": {
29488
29856
  capName: "log-destination",
29489
29857
  capScope: "system",
@@ -31638,6 +32006,12 @@ Object.freeze({
31638
32006
  addonId: null,
31639
32007
  access: "create"
31640
32008
  },
32009
+ "settingsStore.aggregate": {
32010
+ capName: "settings-store",
32011
+ capScope: "system",
32012
+ addonId: null,
32013
+ access: "view"
32014
+ },
31641
32015
  "settingsStore.count": {
31642
32016
  capName: "settings-store",
31643
32017
  capScope: "system",
@@ -33217,6 +33591,11 @@ Object.freeze({
33217
33591
  form: "single",
33218
33592
  optional: false
33219
33593
  }],
33594
+ "deviceManager.getChildrenBatch": [{
33595
+ name: "parentDeviceIds",
33596
+ form: "array",
33597
+ optional: false
33598
+ }],
33220
33599
  "deviceManager.getConfigSchema": [{
33221
33600
  name: "deviceId",
33222
33601
  form: "single",
package/dist/index.mjs CHANGED
@@ -7464,6 +7464,111 @@ var CameraSwitchGroupSchema = object({
7464
7464
  fetchedAt: number()
7465
7465
  });
7466
7466
  /**
7467
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7468
+ * an addon declares its channels in.
7469
+ *
7470
+ * ## Two axes, deliberately separated
7471
+ *
7472
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7473
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7474
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7475
+ * and rots silently. So a channel is declared where it is consulted, and the
7476
+ * `log-channels` capability enumerates the declarations.
7477
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7478
+ * thing: the logging settings document on the `system` cap. Two authorities
7479
+ * over the values is the exact defect
7480
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7481
+ * remove; re-introducing it from the cure side would be grotesque.
7482
+ *
7483
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7484
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7485
+ * the hot path with a value somebody actually read, and by
7486
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7487
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7488
+ * disarmed one (D49).
7489
+ *
7490
+ * ## The canonical call shape
7491
+ *
7492
+ * ```ts
7493
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7494
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7495
+ * }
7496
+ * ```
7497
+ *
7498
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7499
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7500
+ * object literal is never constructed because it lives inside the branch. It
7501
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7502
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7503
+ * destination floor (measured at 1.93 ns/call when off).
7504
+ *
7505
+ * ## Why a channel emits at `info`
7506
+ *
7507
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7508
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7509
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7510
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7511
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7512
+ * emits at the channel's declared level, whose schema floor is `info`.
7513
+ */
7514
+ /**
7515
+ * The level a channel writes at once armed.
7516
+ *
7517
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7518
+ * not leave the process for Loki, and the whole point of arming a channel is
7519
+ * to read it later.
7520
+ */
7521
+ var LogChannelLevelSchema = _enum([
7522
+ "info",
7523
+ "warn",
7524
+ "error"
7525
+ ]);
7526
+ /**
7527
+ * What an addon declares about one channel. No value, no state — a
7528
+ * declaration is inert.
7529
+ */
7530
+ var LogChannelDescriptorSchema = object({
7531
+ /**
7532
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7533
+ * the addon's short name so an operator reading a channel list can tell who
7534
+ * owns it without a second lookup.
7535
+ */
7536
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7537
+ /** One sentence: what the operator will SEE after arming it. */
7538
+ description: string().min(1),
7539
+ /** The level its lines are emitted at. Never below `info`. */
7540
+ defaultLevel: LogChannelLevelSchema,
7541
+ /**
7542
+ * Whether this channel can be narrowed to a camera.
7543
+ *
7544
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7545
+ * consulted with the numeric device id, AND every line the channel admits
7546
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7547
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7548
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7549
+ * the body is the only way to filter.
7550
+ *
7551
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7552
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7553
+ * the operator narrows to one camera, sees nothing, and concludes the code
7554
+ * path was never taken.
7555
+ */
7556
+ perDevice: boolean()
7557
+ });
7558
+ /**
7559
+ * An armed window over one channel, as the document hands it to a mirror.
7560
+ *
7561
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7562
+ * expires by itself, which is the one failure a boolean cannot avoid.
7563
+ */
7564
+ var LogChannelWindowSchema = object({
7565
+ channel: string().min(1),
7566
+ /** Epoch ms the window closes at. */
7567
+ armedUntilMs: number(),
7568
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7569
+ deviceIds: array(number().int()).readonly().nullable()
7570
+ });
7571
+ /**
7467
7572
  * Ops-log — the durable, append-only operations audit shared by the
7468
7573
  * recordings and events management surfaces.
7469
7574
  *
@@ -11019,6 +11124,35 @@ var MutationFilterSchema = object({
11019
11124
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11020
11125
  whereNot: record(string(), unknown()).optional()
11021
11126
  });
11127
+ /**
11128
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11129
+ *
11130
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11131
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11132
+ * a `Record<column, op>` shape could not express.
11133
+ */
11134
+ var AggregateFieldSchema = object({
11135
+ /** Result key. */
11136
+ as: string().min(1),
11137
+ /** Column to aggregate. Must be a real column of a declared collection. */
11138
+ field: string().min(1),
11139
+ op: _enum([
11140
+ "sum",
11141
+ "min",
11142
+ "max"
11143
+ ])
11144
+ });
11145
+ /**
11146
+ * `COUNT(*)` plus one number per requested field.
11147
+ *
11148
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11149
+ * that really is 0 are different facts, and an accounting caller that renders
11150
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11151
+ */
11152
+ var AggregateResultSchema = object({
11153
+ count: number().int(),
11154
+ values: record(string(), number().nullable())
11155
+ });
11022
11156
  /** A single stored record: `{ id, data }`. */
11023
11157
  var SettingsRecordSchema = object({
11024
11158
  id: string(),
@@ -11103,6 +11237,11 @@ method(object({
11103
11237
  collection: string(),
11104
11238
  filter: QueryFilterSchema.optional()
11105
11239
  }), number()), method(object({
11240
+ namespace: string().optional(),
11241
+ collection: string(),
11242
+ fields: array(AggregateFieldSchema).readonly(),
11243
+ filter: QueryFilterSchema.optional()
11244
+ }), AggregateResultSchema), method(object({
11106
11245
  namespace: string().optional(),
11107
11246
  collection: string(),
11108
11247
  field: string(),
@@ -11219,6 +11358,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11219
11358
  collection: string(),
11220
11359
  filter: QueryFilterSchema.optional()
11221
11360
  }), number(), { auth: "admin" }), method(object({
11361
+ namespace: string().optional(),
11362
+ collection: string(),
11363
+ fields: array(AggregateFieldSchema).readonly(),
11364
+ filter: QueryFilterSchema.optional()
11365
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11222
11366
  namespace: string().optional(),
11223
11367
  collection: string(),
11224
11368
  field: string(),
@@ -11873,24 +12017,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
11873
12017
  kind: "mutation",
11874
12018
  auth: "admin"
11875
12019
  });
11876
- /**
11877
- * Device Manager capability — hub-side singleton that unifies device persistence,
11878
- * live registry access, and all management operations into a single tRPC surface.
11879
- *
11880
- * Replaces:
11881
- * - `device-persistence` capability (persistence methods absorbed here)
11882
- * - `device-management.router.ts` (deleted in Phase 2)
11883
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
11884
- *
11885
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
11886
- * fork into separate processes but never run on remote cluster agents. Therefore:
11887
- * - No nodeId routing needed — this is a pure hub singleton.
11888
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
11889
- * - No shadow registry or cross-node aggregation required.
11890
- *
11891
- * Forked workers register devices back to the hub via `ctx.devices`
11892
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
11893
- */
11894
12020
  /** One child-placement directive on a container's `childLayout`. Structurally
11895
12021
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
11896
12022
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12259,7 +12385,7 @@ method(object({
12259
12385
  * it answers today and the caller filters as it already does.
12260
12386
  */
12261
12387
  deviceIds: array(number()).optional()
12262
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12388
+ }), 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({
12263
12389
  mode: LinkedDevicesModeSchema,
12264
12390
  devices: array(LinkedDeviceSchema)
12265
12391
  })), 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({
@@ -12983,6 +13109,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
12983
13109
  kind: "mutation",
12984
13110
  auth: "admin"
12985
13111
  });
13112
+ /**
13113
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13114
+ * through. It stores nothing.
13115
+ *
13116
+ * ## Why a capability at all, and why this shape
13117
+ *
13118
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13119
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13120
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13121
+ * fails, an operator just never sees the channel somebody added. So the list
13122
+ * is assembled from declarations at runtime.
13123
+ *
13124
+ * The shape is copied from `log-destination.cap.ts`, which already does
13125
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13126
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13127
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13128
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13129
+ * runner's declarations reach hub-main over the transport that already exists.
13130
+ * No new UDS message, no second registry.
13131
+ *
13132
+ * ## What it deliberately does NOT own
13133
+ *
13134
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13135
+ * ONE place: the logging settings document on the `system` cap
13136
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13137
+ * value is the defect the plan behind this work exists to remove, and
13138
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13139
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13140
+ * setter for a window and no persistence of any kind.
13141
+ *
13142
+ * ## Why `apply` is here even so
13143
+ *
13144
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13145
+ * seam has to carry the value from the authority to the mirror, and a channel
13146
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13147
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13148
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13149
+ * persists nothing, it is never the source of a value, and it is called only
13150
+ * with a set the hub actually read (D49 — a read that fails does not call it
13151
+ * at all, so no channel is silently disarmed by a bad read).
13152
+ */
13153
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13154
+ var LogChannelApplyResultSchema = object({
13155
+ /** How many declared channels are armed in this process after the call. */
13156
+ armed: number().int().min(0),
13157
+ /**
13158
+ * Names the document armed that this process does not declare. Reported
13159
+ * rather than swallowed: a name here is either a typo or an addon that has
13160
+ * not booted, and both deserve a line instead of silence.
13161
+ */
13162
+ unknown: array(string()).readonly()
13163
+ });
13164
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
12986
13165
  var LogLevelSchema = _enum([
12987
13166
  "debug",
12988
13167
  "info",
@@ -26238,17 +26417,60 @@ var SetSiteLocationInputSchema = object({
26238
26417
  longitude: number().min(-180).max(180)
26239
26418
  }).nullable();
26240
26419
  /**
26241
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26420
+ * The TRANSPORT a call arrived on.
26421
+ *
26422
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26423
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26424
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26425
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26426
+ * checkable rather than asserted.
26427
+ *
26428
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26429
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26430
+ * connection; the viewer talks to the hub over `wsLink`
26431
+ * exclusively, so this is the plane the HTTP census could not see.
26432
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26433
+ * never touches a socket and therefore never touched a census.
26434
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26435
+ * that is exactly what its `0` asserts: every plane the hub has can name
26436
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26437
+ * plane nobody instrumented lands here instead of vanishing from the total.
26438
+ */
26439
+ var TransportPlaneSchema = _enum([
26440
+ "http",
26441
+ "ws",
26442
+ "mesh",
26443
+ "unknown"
26444
+ ]);
26445
+ /**
26446
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26447
+ * reads as "not instrumented", which is the one thing this census must never
26448
+ * make an operator wonder about.
26449
+ */
26450
+ var TransportPlaneCountsSchema = object({
26451
+ http: number(),
26452
+ ws: number(),
26453
+ mesh: number(),
26454
+ unknown: number()
26455
+ });
26456
+ /**
26457
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26242
26458
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26243
26459
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26244
26460
  * already prints - never a token, never an `Authorization` header.
26461
+ *
26462
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26463
+ * and lives for hours, so folding it into a call count makes one long-lived
26464
+ * stream look like a storm.
26245
26465
  */
26246
26466
  var RequestCensusGroupSchema = object({
26467
+ plane: TransportPlaneSchema,
26247
26468
  procedure: string(),
26248
26469
  userAgent: string(),
26249
26470
  ip: string(),
26250
26471
  principal: string(),
26251
26472
  calls: number(),
26473
+ subscriptions: number(),
26252
26474
  perMin: number()
26253
26475
  });
26254
26476
  /**
@@ -26261,6 +26483,14 @@ var RequestCensusGroupSchema = object({
26261
26483
  var RequestCensusProcedureSchema = object({
26262
26484
  procedure: string(),
26263
26485
  calls: number(),
26486
+ /**
26487
+ * The same total, split by transport. THIS is the row that answers the
26488
+ * question the census exists for: one look at `deviceManager.listAll` says
26489
+ * which plane carried the 4 960, without joining two log lines by eye.
26490
+ */
26491
+ planes: TransportPlaneCountsSchema,
26492
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26493
+ subscriptions: number(),
26264
26494
  perMin: number()
26265
26495
  });
26266
26496
  /**
@@ -26288,14 +26518,45 @@ var RequestCensusStatusSchema = object({
26288
26518
  */
26289
26519
  procedureCalls: number(),
26290
26520
  /**
26521
+ * `procedureCalls` split by transport. The four keys sum to
26522
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26523
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26524
+ */
26525
+ planes: TransportPlaneCountsSchema,
26526
+ /**
26527
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26528
+ * on no plane at all - which is a RESULT (a plane is missing from the
26529
+ * instrument), not a failure, and it has to be visible to be read as one.
26530
+ */
26531
+ planesExplainTotal: boolean(),
26532
+ /**
26291
26533
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
26292
- * transport resolves one context per connection - but the number that says
26293
- * whether a plane this census cannot see was busy while HTTP was quiet.
26534
+ * adapter resolves one context per connection - kept because a plane's call
26535
+ * count of zero against 37 open connections says something different from a
26536
+ * plane with no connections at all.
26294
26537
  */
26295
26538
  wsConnections: number(),
26539
+ /**
26540
+ * Client frames the WS plane looked at. `wsMessages` far above
26541
+ * `planes.ws + subscriptions` means most traffic is not operations
26542
+ * (keepalives, connection params) - which is itself an answer.
26543
+ */
26544
+ wsMessages: number(),
26545
+ /**
26546
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26547
+ * purpose: one live-events stream opened at boot and held for six hours is
26548
+ * one subscription, and counting it as a call would let a quiet plane
26549
+ * masquerade as the storm.
26550
+ */
26551
+ subscriptions: number(),
26552
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26553
+ subscriptionStops: number(),
26296
26554
  distinctGroups: number(),
26297
- /** Calls counted in the totals whose group attribution was shed at the
26298
- * cardinality bound. */
26555
+ /**
26556
+ * Operations counted in the totals whose CALLER attribution was shed at the
26557
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26558
+ * which transport they arrived on, they just lost their group row.
26559
+ */
26299
26560
  unattributedCalls: number(),
26300
26561
  procedures: array(RequestCensusProcedureSchema).readonly(),
26301
26562
  groups: array(RequestCensusGroupSchema).readonly()
@@ -26318,10 +26579,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
26318
26579
  * The layers of the level hierarchy, general → specific. The most specific
26319
26580
  * layer that carries an explicit value wins.
26320
26581
  *
26321
- * `component` is DECLARED and not yet resolvable: the per-component channels
26322
- * are a later slice of the same plan, and a `levelSource` enum that has to
26323
- * grow later would force every consumer of this document to change with it.
26324
- * Nothing returns `component` today.
26582
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
26583
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
26584
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
26585
+ * that turning it on would not force every consumer of this document to widen
26586
+ * a `levelSource` enum — which is what has now not happened.
26325
26587
  */
26326
26588
  var LoggingScopeKindSchema = _enum([
26327
26589
  "cluster",
@@ -26348,6 +26610,14 @@ var LoggingLevelLayerSchema = object({
26348
26610
  scope: LoggingScopeKindSchema,
26349
26611
  /** The node this layer speaks for; `null` on the cluster layer. */
26350
26612
  nodeId: string().nullable(),
26613
+ /**
26614
+ * The declared channel this layer speaks for; `null` on every layer but
26615
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
26616
+ * by design — the convention this repo settled on is one orchestrator-wide
26617
+ * setting, never per node (D52) — so a component layer that carried a node
26618
+ * would invite a per-node copy of a value that has no per-node meaning.
26619
+ */
26620
+ component: string().nullable(),
26351
26621
  /** Explicitly set here, or `null` when this layer inherits. */
26352
26622
  level: LogLevelSchema$1.nullable()
26353
26623
  });
@@ -26389,6 +26659,49 @@ var DiagnosticWindowPatchSchema = object({
26389
26659
  reportEveryMs: number().int().positive().optional()
26390
26660
  });
26391
26661
  /**
26662
+ * A channel ARMED, as the document reports it.
26663
+ *
26664
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
26665
+ * and the time left, because a diagnostic left running is itself an incident
26666
+ * and "armed for 10 minutes" said an hour ago is not an answer.
26667
+ */
26668
+ var LogChannelWindowStateSchema = object({
26669
+ channel: string(),
26670
+ armed: boolean(),
26671
+ /** Epoch ms the window closes at. 0 when disarmed. */
26672
+ armedUntilMs: number(),
26673
+ /** Ms left before it expires on its own. 0 when disarmed. */
26674
+ remainingMs: number(),
26675
+ /**
26676
+ * The cameras it is narrowed to, or `null` for every camera.
26677
+ *
26678
+ * A channel declared `perDevice: false` can only ever report `null` here:
26679
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
26680
+ * produce a filter that silently matches nothing. The server REFUSES such a
26681
+ * patch rather than quietly widening it — ignoring the request would teach
26682
+ * the operator that per-camera filtering works on that channel when it does
26683
+ * not.
26684
+ */
26685
+ deviceIds: array(number().int()).readonly().nullable()
26686
+ });
26687
+ /**
26688
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
26689
+ * for the same reason: a channel is a window with a deadline, never a switch.
26690
+ */
26691
+ var LogChannelWindowPatchSchema = object({
26692
+ channel: string().min(1),
26693
+ armMs: number().int().min(0),
26694
+ /**
26695
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
26696
+ *
26697
+ * Numeric because the repo's own rule makes it possible: every log line
26698
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
26699
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
26700
+ * diagnosed by hand, and this is the first thing that collects on it.
26701
+ */
26702
+ deviceIds: array(number().int()).readonly().nullable().optional()
26703
+ });
26704
+ /**
26392
26705
  * A PATCH, and patches MERGE.
26393
26706
  *
26394
26707
  * A field absent from the patch is left exactly as it was — arming a
@@ -26407,7 +26720,14 @@ var LoggingSettingsPatchSchema = object({
26407
26720
  * Only the diagnostics NAMED here change. An armed window that is not listed
26408
26721
  * keeps running — a patch is never a full replacement.
26409
26722
  */
26410
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26723
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
26724
+ /**
26725
+ * Only the channels NAMED here change. An armed channel that is not listed
26726
+ * keeps running — same rule as `diagnostics`, because a patch that silently
26727
+ * disarmed the channels it did not mention would make the Levels page and
26728
+ * the Diagnostics page fight over the same value.
26729
+ */
26730
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
26411
26731
  });
26412
26732
  /**
26413
26733
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -26420,9 +26740,22 @@ var LoggingSettingsPatchSchema = object({
26420
26740
  * authority over the whole hierarchy and answers for every layer, so the
26421
26741
  * layer selector needs a name the transport does not already own.
26422
26742
  */
26423
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26743
+ var GetLoggingSettingsInputSchema = object({
26744
+ scopeNodeId: string().optional(),
26745
+ /**
26746
+ * The declared CHANNEL this document is addressed at, when the caller wants
26747
+ * the `component` layer. Absent = the node/cluster hierarchy only.
26748
+ *
26749
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
26750
+ * axes from collapsing: a component level is cluster-wide, a node level is
26751
+ * not, and one selector for both would make "which of these two did I just
26752
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
26753
+ */
26754
+ scopeComponent: string().optional()
26755
+ });
26424
26756
  var SetLoggingSettingsInputSchema = object({
26425
26757
  scopeNodeId: string().optional(),
26758
+ scopeComponent: string().optional(),
26426
26759
  patch: LoggingSettingsPatchSchema
26427
26760
  });
26428
26761
  /**
@@ -26437,9 +26770,20 @@ var SetLoggingSettingsInputSchema = object({
26437
26770
  var LoggingSettingsStateSchema = object({
26438
26771
  /** The layer this document was read at. `null` = the cluster layer. */
26439
26772
  scopeNodeId: string().nullable(),
26773
+ /** The channel this document was read at. `null` = no component layer. */
26774
+ scopeComponent: string().nullable(),
26440
26775
  effective: LoggingEffectiveSchema,
26441
26776
  explicit: LoggingExplicitSchema,
26442
26777
  activeWindows: array(DiagnosticWindowSchema).readonly(),
26778
+ /**
26779
+ * Every channel the cluster's addons DECLARE, gathered from the
26780
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
26781
+ * channel added by a redeployed addon appears without anybody editing a
26782
+ * list, and a channel whose addon is gone stops being offered.
26783
+ */
26784
+ channels: array(LogChannelDescriptorSchema).readonly(),
26785
+ /** The channels ARMED right now, each with its deadline. */
26786
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
26443
26787
  persisted: boolean()
26444
26788
  });
26445
26789
  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(), {
@@ -28016,6 +28360,12 @@ Object.freeze({
28016
28360
  addonId: null,
28017
28361
  access: "view"
28018
28362
  },
28363
+ "dataStoreProvider.aggregate": {
28364
+ capName: "data-store-provider",
28365
+ capScope: "system",
28366
+ addonId: null,
28367
+ access: "view"
28368
+ },
28019
28369
  "dataStoreProvider.count": {
28020
28370
  capName: "data-store-provider",
28021
28371
  capScope: "system",
@@ -28430,6 +28780,12 @@ Object.freeze({
28430
28780
  addonId: null,
28431
28781
  access: "view"
28432
28782
  },
28783
+ "deviceManager.getChildrenBatch": {
28784
+ capName: "device-manager",
28785
+ capScope: "system",
28786
+ addonId: null,
28787
+ access: "view"
28788
+ },
28433
28789
  "deviceManager.getConfigSchema": {
28434
28790
  capName: "device-manager",
28435
28791
  capScope: "system",
@@ -29480,6 +29836,18 @@ Object.freeze({
29480
29836
  addonId: null,
29481
29837
  access: "create"
29482
29838
  },
29839
+ "logChannels.apply": {
29840
+ capName: "log-channels",
29841
+ capScope: "system",
29842
+ addonId: null,
29843
+ access: "create"
29844
+ },
29845
+ "logChannels.list": {
29846
+ capName: "log-channels",
29847
+ capScope: "system",
29848
+ addonId: null,
29849
+ access: "view"
29850
+ },
29483
29851
  "logDestination.query": {
29484
29852
  capName: "log-destination",
29485
29853
  capScope: "system",
@@ -31634,6 +32002,12 @@ Object.freeze({
31634
32002
  addonId: null,
31635
32003
  access: "create"
31636
32004
  },
32005
+ "settingsStore.aggregate": {
32006
+ capName: "settings-store",
32007
+ capScope: "system",
32008
+ addonId: null,
32009
+ access: "view"
32010
+ },
31637
32011
  "settingsStore.count": {
31638
32012
  capName: "settings-store",
31639
32013
  capScope: "system",
@@ -33213,6 +33587,11 @@ Object.freeze({
33213
33587
  form: "single",
33214
33588
  optional: false
33215
33589
  }],
33590
+ "deviceManager.getChildrenBatch": [{
33591
+ name: "parentDeviceIds",
33592
+ form: "array",
33593
+ optional: false
33594
+ }],
33216
33595
  "deviceManager.getConfigSchema": [{
33217
33596
  name: "deviceId",
33218
33597
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-decoder-nodeav",
3
- "version": "1.2.31",
3
+ "version": "1.2.33",
4
4
  "description": "Standalone in-process node-av decoder addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",