@camstack/addon-notifiers 1.2.36 → 1.2.38

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
@@ -7601,6 +7601,111 @@ var CameraSwitchGroupSchema = object({
7601
7601
  fetchedAt: number()
7602
7602
  });
7603
7603
  /**
7604
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7605
+ * an addon declares its channels in.
7606
+ *
7607
+ * ## Two axes, deliberately separated
7608
+ *
7609
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7610
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7611
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7612
+ * and rots silently. So a channel is declared where it is consulted, and the
7613
+ * `log-channels` capability enumerates the declarations.
7614
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7615
+ * thing: the logging settings document on the `system` cap. Two authorities
7616
+ * over the values is the exact defect
7617
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7618
+ * remove; re-introducing it from the cure side would be grotesque.
7619
+ *
7620
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7621
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7622
+ * the hot path with a value somebody actually read, and by
7623
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7624
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7625
+ * disarmed one (D49).
7626
+ *
7627
+ * ## The canonical call shape
7628
+ *
7629
+ * ```ts
7630
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7631
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7632
+ * }
7633
+ * ```
7634
+ *
7635
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7636
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7637
+ * object literal is never constructed because it lives inside the branch. It
7638
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7639
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7640
+ * destination floor (measured at 1.93 ns/call when off).
7641
+ *
7642
+ * ## Why a channel emits at `info`
7643
+ *
7644
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7645
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7646
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7647
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7648
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7649
+ * emits at the channel's declared level, whose schema floor is `info`.
7650
+ */
7651
+ /**
7652
+ * The level a channel writes at once armed.
7653
+ *
7654
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7655
+ * not leave the process for Loki, and the whole point of arming a channel is
7656
+ * to read it later.
7657
+ */
7658
+ var LogChannelLevelSchema = _enum([
7659
+ "info",
7660
+ "warn",
7661
+ "error"
7662
+ ]);
7663
+ /**
7664
+ * What an addon declares about one channel. No value, no state — a
7665
+ * declaration is inert.
7666
+ */
7667
+ var LogChannelDescriptorSchema = object({
7668
+ /**
7669
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7670
+ * the addon's short name so an operator reading a channel list can tell who
7671
+ * owns it without a second lookup.
7672
+ */
7673
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7674
+ /** One sentence: what the operator will SEE after arming it. */
7675
+ description: string().min(1),
7676
+ /** The level its lines are emitted at. Never below `info`. */
7677
+ defaultLevel: LogChannelLevelSchema,
7678
+ /**
7679
+ * Whether this channel can be narrowed to a camera.
7680
+ *
7681
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7682
+ * consulted with the numeric device id, AND every line the channel admits
7683
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7684
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7685
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7686
+ * the body is the only way to filter.
7687
+ *
7688
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7689
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7690
+ * the operator narrows to one camera, sees nothing, and concludes the code
7691
+ * path was never taken.
7692
+ */
7693
+ perDevice: boolean()
7694
+ });
7695
+ /**
7696
+ * An armed window over one channel, as the document hands it to a mirror.
7697
+ *
7698
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7699
+ * expires by itself, which is the one failure a boolean cannot avoid.
7700
+ */
7701
+ var LogChannelWindowSchema = object({
7702
+ channel: string().min(1),
7703
+ /** Epoch ms the window closes at. */
7704
+ armedUntilMs: number(),
7705
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7706
+ deviceIds: array(number().int()).readonly().nullable()
7707
+ });
7708
+ /**
7604
7709
  * Ops-log — the durable, append-only operations audit shared by the
7605
7710
  * recordings and events management surfaces.
7606
7711
  *
@@ -11160,6 +11265,35 @@ var MutationFilterSchema = object({
11160
11265
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11161
11266
  whereNot: record(string(), unknown()).optional()
11162
11267
  });
11268
+ /**
11269
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11270
+ *
11271
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11272
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11273
+ * a `Record<column, op>` shape could not express.
11274
+ */
11275
+ var AggregateFieldSchema = object({
11276
+ /** Result key. */
11277
+ as: string().min(1),
11278
+ /** Column to aggregate. Must be a real column of a declared collection. */
11279
+ field: string().min(1),
11280
+ op: _enum([
11281
+ "sum",
11282
+ "min",
11283
+ "max"
11284
+ ])
11285
+ });
11286
+ /**
11287
+ * `COUNT(*)` plus one number per requested field.
11288
+ *
11289
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11290
+ * that really is 0 are different facts, and an accounting caller that renders
11291
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11292
+ */
11293
+ var AggregateResultSchema = object({
11294
+ count: number().int(),
11295
+ values: record(string(), number().nullable())
11296
+ });
11163
11297
  /** A single stored record: `{ id, data }`. */
11164
11298
  var SettingsRecordSchema = object({
11165
11299
  id: string(),
@@ -11244,6 +11378,11 @@ method(object({
11244
11378
  collection: string(),
11245
11379
  filter: QueryFilterSchema.optional()
11246
11380
  }), number()), method(object({
11381
+ namespace: string().optional(),
11382
+ collection: string(),
11383
+ fields: array(AggregateFieldSchema).readonly(),
11384
+ filter: QueryFilterSchema.optional()
11385
+ }), AggregateResultSchema), method(object({
11247
11386
  namespace: string().optional(),
11248
11387
  collection: string(),
11249
11388
  field: string(),
@@ -11360,6 +11499,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11360
11499
  collection: string(),
11361
11500
  filter: QueryFilterSchema.optional()
11362
11501
  }), number(), { auth: "admin" }), method(object({
11502
+ namespace: string().optional(),
11503
+ collection: string(),
11504
+ fields: array(AggregateFieldSchema).readonly(),
11505
+ filter: QueryFilterSchema.optional()
11506
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11363
11507
  namespace: string().optional(),
11364
11508
  collection: string(),
11365
11509
  field: string(),
@@ -11921,24 +12065,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
11921
12065
  kind: "mutation",
11922
12066
  auth: "admin"
11923
12067
  });
11924
- /**
11925
- * Device Manager capability — hub-side singleton that unifies device persistence,
11926
- * live registry access, and all management operations into a single tRPC surface.
11927
- *
11928
- * Replaces:
11929
- * - `device-persistence` capability (persistence methods absorbed here)
11930
- * - `device-management.router.ts` (deleted in Phase 2)
11931
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
11932
- *
11933
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
11934
- * fork into separate processes but never run on remote cluster agents. Therefore:
11935
- * - No nodeId routing needed — this is a pure hub singleton.
11936
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
11937
- * - No shadow registry or cross-node aggregation required.
11938
- *
11939
- * Forked workers register devices back to the hub via `ctx.devices`
11940
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
11941
- */
11942
12068
  /** One child-placement directive on a container's `childLayout`. Structurally
11943
12069
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
11944
12070
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12307,7 +12433,7 @@ method(object({
12307
12433
  * it answers today and the caller filters as it already does.
12308
12434
  */
12309
12435
  deviceIds: array(number()).optional()
12310
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12436
+ }), 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({
12311
12437
  mode: LinkedDevicesModeSchema,
12312
12438
  devices: array(LinkedDeviceSchema)
12313
12439
  })), 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({
@@ -13031,6 +13157,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13031
13157
  kind: "mutation",
13032
13158
  auth: "admin"
13033
13159
  });
13160
+ /**
13161
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13162
+ * through. It stores nothing.
13163
+ *
13164
+ * ## Why a capability at all, and why this shape
13165
+ *
13166
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13167
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13168
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13169
+ * fails, an operator just never sees the channel somebody added. So the list
13170
+ * is assembled from declarations at runtime.
13171
+ *
13172
+ * The shape is copied from `log-destination.cap.ts`, which already does
13173
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13174
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13175
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13176
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13177
+ * runner's declarations reach hub-main over the transport that already exists.
13178
+ * No new UDS message, no second registry.
13179
+ *
13180
+ * ## What it deliberately does NOT own
13181
+ *
13182
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13183
+ * ONE place: the logging settings document on the `system` cap
13184
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13185
+ * value is the defect the plan behind this work exists to remove, and
13186
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13187
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13188
+ * setter for a window and no persistence of any kind.
13189
+ *
13190
+ * ## Why `apply` is here even so
13191
+ *
13192
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13193
+ * seam has to carry the value from the authority to the mirror, and a channel
13194
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13195
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13196
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13197
+ * persists nothing, it is never the source of a value, and it is called only
13198
+ * with a set the hub actually read (D49 — a read that fails does not call it
13199
+ * at all, so no channel is silently disarmed by a bad read).
13200
+ */
13201
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13202
+ var LogChannelApplyResultSchema = object({
13203
+ /** How many declared channels are armed in this process after the call. */
13204
+ armed: number().int().min(0),
13205
+ /**
13206
+ * Names the document armed that this process does not declare. Reported
13207
+ * rather than swallowed: a name here is either a typo or an addon that has
13208
+ * not booted, and both deserve a line instead of silence.
13209
+ */
13210
+ unknown: array(string()).readonly()
13211
+ });
13212
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13034
13213
  var LogLevelSchema = _enum([
13035
13214
  "debug",
13036
13215
  "info",
@@ -26300,17 +26479,60 @@ var SetSiteLocationInputSchema = object({
26300
26479
  longitude: number().min(-180).max(180)
26301
26480
  }).nullable();
26302
26481
  /**
26303
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26482
+ * The TRANSPORT a call arrived on.
26483
+ *
26484
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26485
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26486
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26487
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26488
+ * checkable rather than asserted.
26489
+ *
26490
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26491
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26492
+ * connection; the viewer talks to the hub over `wsLink`
26493
+ * exclusively, so this is the plane the HTTP census could not see.
26494
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26495
+ * never touches a socket and therefore never touched a census.
26496
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26497
+ * that is exactly what its `0` asserts: every plane the hub has can name
26498
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26499
+ * plane nobody instrumented lands here instead of vanishing from the total.
26500
+ */
26501
+ var TransportPlaneSchema = _enum([
26502
+ "http",
26503
+ "ws",
26504
+ "mesh",
26505
+ "unknown"
26506
+ ]);
26507
+ /**
26508
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26509
+ * reads as "not instrumented", which is the one thing this census must never
26510
+ * make an operator wonder about.
26511
+ */
26512
+ var TransportPlaneCountsSchema = object({
26513
+ http: number(),
26514
+ ws: number(),
26515
+ mesh: number(),
26516
+ unknown: number()
26517
+ });
26518
+ /**
26519
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26304
26520
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26305
26521
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26306
26522
  * already prints - never a token, never an `Authorization` header.
26523
+ *
26524
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26525
+ * and lives for hours, so folding it into a call count makes one long-lived
26526
+ * stream look like a storm.
26307
26527
  */
26308
26528
  var RequestCensusGroupSchema = object({
26529
+ plane: TransportPlaneSchema,
26309
26530
  procedure: string(),
26310
26531
  userAgent: string(),
26311
26532
  ip: string(),
26312
26533
  principal: string(),
26313
26534
  calls: number(),
26535
+ subscriptions: number(),
26314
26536
  perMin: number()
26315
26537
  });
26316
26538
  /**
@@ -26323,6 +26545,14 @@ var RequestCensusGroupSchema = object({
26323
26545
  var RequestCensusProcedureSchema = object({
26324
26546
  procedure: string(),
26325
26547
  calls: number(),
26548
+ /**
26549
+ * The same total, split by transport. THIS is the row that answers the
26550
+ * question the census exists for: one look at `deviceManager.listAll` says
26551
+ * which plane carried the 4 960, without joining two log lines by eye.
26552
+ */
26553
+ planes: TransportPlaneCountsSchema,
26554
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26555
+ subscriptions: number(),
26326
26556
  perMin: number()
26327
26557
  });
26328
26558
  /**
@@ -26350,14 +26580,45 @@ var RequestCensusStatusSchema = object({
26350
26580
  */
26351
26581
  procedureCalls: number(),
26352
26582
  /**
26583
+ * `procedureCalls` split by transport. The four keys sum to
26584
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26585
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26586
+ */
26587
+ planes: TransportPlaneCountsSchema,
26588
+ /**
26589
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26590
+ * on no plane at all - which is a RESULT (a plane is missing from the
26591
+ * instrument), not a failure, and it has to be visible to be read as one.
26592
+ */
26593
+ planesExplainTotal: boolean(),
26594
+ /**
26353
26595
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
26354
- * transport resolves one context per connection - but the number that says
26355
- * whether a plane this census cannot see was busy while HTTP was quiet.
26596
+ * adapter resolves one context per connection - kept because a plane's call
26597
+ * count of zero against 37 open connections says something different from a
26598
+ * plane with no connections at all.
26356
26599
  */
26357
26600
  wsConnections: number(),
26601
+ /**
26602
+ * Client frames the WS plane looked at. `wsMessages` far above
26603
+ * `planes.ws + subscriptions` means most traffic is not operations
26604
+ * (keepalives, connection params) - which is itself an answer.
26605
+ */
26606
+ wsMessages: number(),
26607
+ /**
26608
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26609
+ * purpose: one live-events stream opened at boot and held for six hours is
26610
+ * one subscription, and counting it as a call would let a quiet plane
26611
+ * masquerade as the storm.
26612
+ */
26613
+ subscriptions: number(),
26614
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26615
+ subscriptionStops: number(),
26358
26616
  distinctGroups: number(),
26359
- /** Calls counted in the totals whose group attribution was shed at the
26360
- * cardinality bound. */
26617
+ /**
26618
+ * Operations counted in the totals whose CALLER attribution was shed at the
26619
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26620
+ * which transport they arrived on, they just lost their group row.
26621
+ */
26361
26622
  unattributedCalls: number(),
26362
26623
  procedures: array(RequestCensusProcedureSchema).readonly(),
26363
26624
  groups: array(RequestCensusGroupSchema).readonly()
@@ -26380,10 +26641,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
26380
26641
  * The layers of the level hierarchy, general → specific. The most specific
26381
26642
  * layer that carries an explicit value wins.
26382
26643
  *
26383
- * `component` is DECLARED and not yet resolvable: the per-component channels
26384
- * are a later slice of the same plan, and a `levelSource` enum that has to
26385
- * grow later would force every consumer of this document to change with it.
26386
- * Nothing returns `component` today.
26644
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
26645
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
26646
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
26647
+ * that turning it on would not force every consumer of this document to widen
26648
+ * a `levelSource` enum — which is what has now not happened.
26387
26649
  */
26388
26650
  var LoggingScopeKindSchema = _enum([
26389
26651
  "cluster",
@@ -26410,6 +26672,14 @@ var LoggingLevelLayerSchema = object({
26410
26672
  scope: LoggingScopeKindSchema,
26411
26673
  /** The node this layer speaks for; `null` on the cluster layer. */
26412
26674
  nodeId: string().nullable(),
26675
+ /**
26676
+ * The declared channel this layer speaks for; `null` on every layer but
26677
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
26678
+ * by design — the convention this repo settled on is one orchestrator-wide
26679
+ * setting, never per node (D52) — so a component layer that carried a node
26680
+ * would invite a per-node copy of a value that has no per-node meaning.
26681
+ */
26682
+ component: string().nullable(),
26413
26683
  /** Explicitly set here, or `null` when this layer inherits. */
26414
26684
  level: LogLevelSchema$1.nullable()
26415
26685
  });
@@ -26451,6 +26721,49 @@ var DiagnosticWindowPatchSchema = object({
26451
26721
  reportEveryMs: number().int().positive().optional()
26452
26722
  });
26453
26723
  /**
26724
+ * A channel ARMED, as the document reports it.
26725
+ *
26726
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
26727
+ * and the time left, because a diagnostic left running is itself an incident
26728
+ * and "armed for 10 minutes" said an hour ago is not an answer.
26729
+ */
26730
+ var LogChannelWindowStateSchema = object({
26731
+ channel: string(),
26732
+ armed: boolean(),
26733
+ /** Epoch ms the window closes at. 0 when disarmed. */
26734
+ armedUntilMs: number(),
26735
+ /** Ms left before it expires on its own. 0 when disarmed. */
26736
+ remainingMs: number(),
26737
+ /**
26738
+ * The cameras it is narrowed to, or `null` for every camera.
26739
+ *
26740
+ * A channel declared `perDevice: false` can only ever report `null` here:
26741
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
26742
+ * produce a filter that silently matches nothing. The server REFUSES such a
26743
+ * patch rather than quietly widening it — ignoring the request would teach
26744
+ * the operator that per-camera filtering works on that channel when it does
26745
+ * not.
26746
+ */
26747
+ deviceIds: array(number().int()).readonly().nullable()
26748
+ });
26749
+ /**
26750
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
26751
+ * for the same reason: a channel is a window with a deadline, never a switch.
26752
+ */
26753
+ var LogChannelWindowPatchSchema = object({
26754
+ channel: string().min(1),
26755
+ armMs: number().int().min(0),
26756
+ /**
26757
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
26758
+ *
26759
+ * Numeric because the repo's own rule makes it possible: every log line
26760
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
26761
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
26762
+ * diagnosed by hand, and this is the first thing that collects on it.
26763
+ */
26764
+ deviceIds: array(number().int()).readonly().nullable().optional()
26765
+ });
26766
+ /**
26454
26767
  * A PATCH, and patches MERGE.
26455
26768
  *
26456
26769
  * A field absent from the patch is left exactly as it was — arming a
@@ -26469,7 +26782,14 @@ var LoggingSettingsPatchSchema = object({
26469
26782
  * Only the diagnostics NAMED here change. An armed window that is not listed
26470
26783
  * keeps running — a patch is never a full replacement.
26471
26784
  */
26472
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26785
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
26786
+ /**
26787
+ * Only the channels NAMED here change. An armed channel that is not listed
26788
+ * keeps running — same rule as `diagnostics`, because a patch that silently
26789
+ * disarmed the channels it did not mention would make the Levels page and
26790
+ * the Diagnostics page fight over the same value.
26791
+ */
26792
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
26473
26793
  });
26474
26794
  /**
26475
26795
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -26482,9 +26802,22 @@ var LoggingSettingsPatchSchema = object({
26482
26802
  * authority over the whole hierarchy and answers for every layer, so the
26483
26803
  * layer selector needs a name the transport does not already own.
26484
26804
  */
26485
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26805
+ var GetLoggingSettingsInputSchema = object({
26806
+ scopeNodeId: string().optional(),
26807
+ /**
26808
+ * The declared CHANNEL this document is addressed at, when the caller wants
26809
+ * the `component` layer. Absent = the node/cluster hierarchy only.
26810
+ *
26811
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
26812
+ * axes from collapsing: a component level is cluster-wide, a node level is
26813
+ * not, and one selector for both would make "which of these two did I just
26814
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
26815
+ */
26816
+ scopeComponent: string().optional()
26817
+ });
26486
26818
  var SetLoggingSettingsInputSchema = object({
26487
26819
  scopeNodeId: string().optional(),
26820
+ scopeComponent: string().optional(),
26488
26821
  patch: LoggingSettingsPatchSchema
26489
26822
  });
26490
26823
  /**
@@ -26499,9 +26832,20 @@ var SetLoggingSettingsInputSchema = object({
26499
26832
  var LoggingSettingsStateSchema = object({
26500
26833
  /** The layer this document was read at. `null` = the cluster layer. */
26501
26834
  scopeNodeId: string().nullable(),
26835
+ /** The channel this document was read at. `null` = no component layer. */
26836
+ scopeComponent: string().nullable(),
26502
26837
  effective: LoggingEffectiveSchema,
26503
26838
  explicit: LoggingExplicitSchema,
26504
26839
  activeWindows: array(DiagnosticWindowSchema).readonly(),
26840
+ /**
26841
+ * Every channel the cluster's addons DECLARE, gathered from the
26842
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
26843
+ * channel added by a redeployed addon appears without anybody editing a
26844
+ * list, and a channel whose addon is gone stops being offered.
26845
+ */
26846
+ channels: array(LogChannelDescriptorSchema).readonly(),
26847
+ /** The channels ARMED right now, each with its deadline. */
26848
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
26505
26849
  persisted: boolean()
26506
26850
  });
26507
26851
  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(), {
@@ -28078,6 +28422,12 @@ Object.freeze({
28078
28422
  addonId: null,
28079
28423
  access: "view"
28080
28424
  },
28425
+ "dataStoreProvider.aggregate": {
28426
+ capName: "data-store-provider",
28427
+ capScope: "system",
28428
+ addonId: null,
28429
+ access: "view"
28430
+ },
28081
28431
  "dataStoreProvider.count": {
28082
28432
  capName: "data-store-provider",
28083
28433
  capScope: "system",
@@ -28492,6 +28842,12 @@ Object.freeze({
28492
28842
  addonId: null,
28493
28843
  access: "view"
28494
28844
  },
28845
+ "deviceManager.getChildrenBatch": {
28846
+ capName: "device-manager",
28847
+ capScope: "system",
28848
+ addonId: null,
28849
+ access: "view"
28850
+ },
28495
28851
  "deviceManager.getConfigSchema": {
28496
28852
  capName: "device-manager",
28497
28853
  capScope: "system",
@@ -29542,6 +29898,18 @@ Object.freeze({
29542
29898
  addonId: null,
29543
29899
  access: "create"
29544
29900
  },
29901
+ "logChannels.apply": {
29902
+ capName: "log-channels",
29903
+ capScope: "system",
29904
+ addonId: null,
29905
+ access: "create"
29906
+ },
29907
+ "logChannels.list": {
29908
+ capName: "log-channels",
29909
+ capScope: "system",
29910
+ addonId: null,
29911
+ access: "view"
29912
+ },
29545
29913
  "logDestination.query": {
29546
29914
  capName: "log-destination",
29547
29915
  capScope: "system",
@@ -31696,6 +32064,12 @@ Object.freeze({
31696
32064
  addonId: null,
31697
32065
  access: "create"
31698
32066
  },
32067
+ "settingsStore.aggregate": {
32068
+ capName: "settings-store",
32069
+ capScope: "system",
32070
+ addonId: null,
32071
+ access: "view"
32072
+ },
31699
32073
  "settingsStore.count": {
31700
32074
  capName: "settings-store",
31701
32075
  capScope: "system",
@@ -33275,6 +33649,11 @@ Object.freeze({
33275
33649
  form: "single",
33276
33650
  optional: false
33277
33651
  }],
33652
+ "deviceManager.getChildrenBatch": [{
33653
+ name: "parentDeviceIds",
33654
+ form: "array",
33655
+ optional: false
33656
+ }],
33278
33657
  "deviceManager.getConfigSchema": [{
33279
33658
  name: "deviceId",
33280
33659
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7574,6 +7574,111 @@ var CameraSwitchGroupSchema = object({
7574
7574
  fetchedAt: number()
7575
7575
  });
7576
7576
  /**
7577
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7578
+ * an addon declares its channels in.
7579
+ *
7580
+ * ## Two axes, deliberately separated
7581
+ *
7582
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7583
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7584
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7585
+ * and rots silently. So a channel is declared where it is consulted, and the
7586
+ * `log-channels` capability enumerates the declarations.
7587
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7588
+ * thing: the logging settings document on the `system` cap. Two authorities
7589
+ * over the values is the exact defect
7590
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7591
+ * remove; re-introducing it from the cure side would be grotesque.
7592
+ *
7593
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7594
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7595
+ * the hot path with a value somebody actually read, and by
7596
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7597
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7598
+ * disarmed one (D49).
7599
+ *
7600
+ * ## The canonical call shape
7601
+ *
7602
+ * ```ts
7603
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7604
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7605
+ * }
7606
+ * ```
7607
+ *
7608
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7609
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7610
+ * object literal is never constructed because it lives inside the branch. It
7611
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7612
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7613
+ * destination floor (measured at 1.93 ns/call when off).
7614
+ *
7615
+ * ## Why a channel emits at `info`
7616
+ *
7617
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7618
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7619
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7620
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7621
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7622
+ * emits at the channel's declared level, whose schema floor is `info`.
7623
+ */
7624
+ /**
7625
+ * The level a channel writes at once armed.
7626
+ *
7627
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7628
+ * not leave the process for Loki, and the whole point of arming a channel is
7629
+ * to read it later.
7630
+ */
7631
+ var LogChannelLevelSchema = _enum([
7632
+ "info",
7633
+ "warn",
7634
+ "error"
7635
+ ]);
7636
+ /**
7637
+ * What an addon declares about one channel. No value, no state — a
7638
+ * declaration is inert.
7639
+ */
7640
+ var LogChannelDescriptorSchema = object({
7641
+ /**
7642
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7643
+ * the addon's short name so an operator reading a channel list can tell who
7644
+ * owns it without a second lookup.
7645
+ */
7646
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7647
+ /** One sentence: what the operator will SEE after arming it. */
7648
+ description: string().min(1),
7649
+ /** The level its lines are emitted at. Never below `info`. */
7650
+ defaultLevel: LogChannelLevelSchema,
7651
+ /**
7652
+ * Whether this channel can be narrowed to a camera.
7653
+ *
7654
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7655
+ * consulted with the numeric device id, AND every line the channel admits
7656
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7657
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7658
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7659
+ * the body is the only way to filter.
7660
+ *
7661
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7662
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7663
+ * the operator narrows to one camera, sees nothing, and concludes the code
7664
+ * path was never taken.
7665
+ */
7666
+ perDevice: boolean()
7667
+ });
7668
+ /**
7669
+ * An armed window over one channel, as the document hands it to a mirror.
7670
+ *
7671
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7672
+ * expires by itself, which is the one failure a boolean cannot avoid.
7673
+ */
7674
+ var LogChannelWindowSchema = object({
7675
+ channel: string().min(1),
7676
+ /** Epoch ms the window closes at. */
7677
+ armedUntilMs: number(),
7678
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7679
+ deviceIds: array(number().int()).readonly().nullable()
7680
+ });
7681
+ /**
7577
7682
  * Ops-log — the durable, append-only operations audit shared by the
7578
7683
  * recordings and events management surfaces.
7579
7684
  *
@@ -11133,6 +11238,35 @@ var MutationFilterSchema = object({
11133
11238
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11134
11239
  whereNot: record(string(), unknown()).optional()
11135
11240
  });
11241
+ /**
11242
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11243
+ *
11244
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11245
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11246
+ * a `Record<column, op>` shape could not express.
11247
+ */
11248
+ var AggregateFieldSchema = object({
11249
+ /** Result key. */
11250
+ as: string().min(1),
11251
+ /** Column to aggregate. Must be a real column of a declared collection. */
11252
+ field: string().min(1),
11253
+ op: _enum([
11254
+ "sum",
11255
+ "min",
11256
+ "max"
11257
+ ])
11258
+ });
11259
+ /**
11260
+ * `COUNT(*)` plus one number per requested field.
11261
+ *
11262
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11263
+ * that really is 0 are different facts, and an accounting caller that renders
11264
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11265
+ */
11266
+ var AggregateResultSchema = object({
11267
+ count: number().int(),
11268
+ values: record(string(), number().nullable())
11269
+ });
11136
11270
  /** A single stored record: `{ id, data }`. */
11137
11271
  var SettingsRecordSchema = object({
11138
11272
  id: string(),
@@ -11217,6 +11351,11 @@ method(object({
11217
11351
  collection: string(),
11218
11352
  filter: QueryFilterSchema.optional()
11219
11353
  }), number()), method(object({
11354
+ namespace: string().optional(),
11355
+ collection: string(),
11356
+ fields: array(AggregateFieldSchema).readonly(),
11357
+ filter: QueryFilterSchema.optional()
11358
+ }), AggregateResultSchema), method(object({
11220
11359
  namespace: string().optional(),
11221
11360
  collection: string(),
11222
11361
  field: string(),
@@ -11333,6 +11472,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11333
11472
  collection: string(),
11334
11473
  filter: QueryFilterSchema.optional()
11335
11474
  }), number(), { auth: "admin" }), method(object({
11475
+ namespace: string().optional(),
11476
+ collection: string(),
11477
+ fields: array(AggregateFieldSchema).readonly(),
11478
+ filter: QueryFilterSchema.optional()
11479
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11336
11480
  namespace: string().optional(),
11337
11481
  collection: string(),
11338
11482
  field: string(),
@@ -11894,24 +12038,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
11894
12038
  kind: "mutation",
11895
12039
  auth: "admin"
11896
12040
  });
11897
- /**
11898
- * Device Manager capability — hub-side singleton that unifies device persistence,
11899
- * live registry access, and all management operations into a single tRPC surface.
11900
- *
11901
- * Replaces:
11902
- * - `device-persistence` capability (persistence methods absorbed here)
11903
- * - `device-management.router.ts` (deleted in Phase 2)
11904
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
11905
- *
11906
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
11907
- * fork into separate processes but never run on remote cluster agents. Therefore:
11908
- * - No nodeId routing needed — this is a pure hub singleton.
11909
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
11910
- * - No shadow registry or cross-node aggregation required.
11911
- *
11912
- * Forked workers register devices back to the hub via `ctx.devices`
11913
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
11914
- */
11915
12041
  /** One child-placement directive on a container's `childLayout`. Structurally
11916
12042
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
11917
12043
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12280,7 +12406,7 @@ method(object({
12280
12406
  * it answers today and the caller filters as it already does.
12281
12407
  */
12282
12408
  deviceIds: array(number()).optional()
12283
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12409
+ }), 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({
12284
12410
  mode: LinkedDevicesModeSchema,
12285
12411
  devices: array(LinkedDeviceSchema)
12286
12412
  })), 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({
@@ -13004,6 +13130,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13004
13130
  kind: "mutation",
13005
13131
  auth: "admin"
13006
13132
  });
13133
+ /**
13134
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13135
+ * through. It stores nothing.
13136
+ *
13137
+ * ## Why a capability at all, and why this shape
13138
+ *
13139
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13140
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13141
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13142
+ * fails, an operator just never sees the channel somebody added. So the list
13143
+ * is assembled from declarations at runtime.
13144
+ *
13145
+ * The shape is copied from `log-destination.cap.ts`, which already does
13146
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13147
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13148
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13149
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13150
+ * runner's declarations reach hub-main over the transport that already exists.
13151
+ * No new UDS message, no second registry.
13152
+ *
13153
+ * ## What it deliberately does NOT own
13154
+ *
13155
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13156
+ * ONE place: the logging settings document on the `system` cap
13157
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13158
+ * value is the defect the plan behind this work exists to remove, and
13159
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13160
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13161
+ * setter for a window and no persistence of any kind.
13162
+ *
13163
+ * ## Why `apply` is here even so
13164
+ *
13165
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13166
+ * seam has to carry the value from the authority to the mirror, and a channel
13167
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13168
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13169
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13170
+ * persists nothing, it is never the source of a value, and it is called only
13171
+ * with a set the hub actually read (D49 — a read that fails does not call it
13172
+ * at all, so no channel is silently disarmed by a bad read).
13173
+ */
13174
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13175
+ var LogChannelApplyResultSchema = object({
13176
+ /** How many declared channels are armed in this process after the call. */
13177
+ armed: number().int().min(0),
13178
+ /**
13179
+ * Names the document armed that this process does not declare. Reported
13180
+ * rather than swallowed: a name here is either a typo or an addon that has
13181
+ * not booted, and both deserve a line instead of silence.
13182
+ */
13183
+ unknown: array(string()).readonly()
13184
+ });
13185
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13007
13186
  var LogLevelSchema = _enum([
13008
13187
  "debug",
13009
13188
  "info",
@@ -26273,17 +26452,60 @@ var SetSiteLocationInputSchema = object({
26273
26452
  longitude: number().min(-180).max(180)
26274
26453
  }).nullable();
26275
26454
  /**
26276
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26455
+ * The TRANSPORT a call arrived on.
26456
+ *
26457
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26458
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26459
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26460
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26461
+ * checkable rather than asserted.
26462
+ *
26463
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26464
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26465
+ * connection; the viewer talks to the hub over `wsLink`
26466
+ * exclusively, so this is the plane the HTTP census could not see.
26467
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26468
+ * never touches a socket and therefore never touched a census.
26469
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26470
+ * that is exactly what its `0` asserts: every plane the hub has can name
26471
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26472
+ * plane nobody instrumented lands here instead of vanishing from the total.
26473
+ */
26474
+ var TransportPlaneSchema = _enum([
26475
+ "http",
26476
+ "ws",
26477
+ "mesh",
26478
+ "unknown"
26479
+ ]);
26480
+ /**
26481
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26482
+ * reads as "not instrumented", which is the one thing this census must never
26483
+ * make an operator wonder about.
26484
+ */
26485
+ var TransportPlaneCountsSchema = object({
26486
+ http: number(),
26487
+ ws: number(),
26488
+ mesh: number(),
26489
+ unknown: number()
26490
+ });
26491
+ /**
26492
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26277
26493
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26278
26494
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26279
26495
  * already prints - never a token, never an `Authorization` header.
26496
+ *
26497
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26498
+ * and lives for hours, so folding it into a call count makes one long-lived
26499
+ * stream look like a storm.
26280
26500
  */
26281
26501
  var RequestCensusGroupSchema = object({
26502
+ plane: TransportPlaneSchema,
26282
26503
  procedure: string(),
26283
26504
  userAgent: string(),
26284
26505
  ip: string(),
26285
26506
  principal: string(),
26286
26507
  calls: number(),
26508
+ subscriptions: number(),
26287
26509
  perMin: number()
26288
26510
  });
26289
26511
  /**
@@ -26296,6 +26518,14 @@ var RequestCensusGroupSchema = object({
26296
26518
  var RequestCensusProcedureSchema = object({
26297
26519
  procedure: string(),
26298
26520
  calls: number(),
26521
+ /**
26522
+ * The same total, split by transport. THIS is the row that answers the
26523
+ * question the census exists for: one look at `deviceManager.listAll` says
26524
+ * which plane carried the 4 960, without joining two log lines by eye.
26525
+ */
26526
+ planes: TransportPlaneCountsSchema,
26527
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26528
+ subscriptions: number(),
26299
26529
  perMin: number()
26300
26530
  });
26301
26531
  /**
@@ -26323,14 +26553,45 @@ var RequestCensusStatusSchema = object({
26323
26553
  */
26324
26554
  procedureCalls: number(),
26325
26555
  /**
26556
+ * `procedureCalls` split by transport. The four keys sum to
26557
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26558
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26559
+ */
26560
+ planes: TransportPlaneCountsSchema,
26561
+ /**
26562
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26563
+ * on no plane at all - which is a RESULT (a plane is missing from the
26564
+ * instrument), not a failure, and it has to be visible to be read as one.
26565
+ */
26566
+ planesExplainTotal: boolean(),
26567
+ /**
26326
26568
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
26327
- * transport resolves one context per connection - but the number that says
26328
- * whether a plane this census cannot see was busy while HTTP was quiet.
26569
+ * adapter resolves one context per connection - kept because a plane's call
26570
+ * count of zero against 37 open connections says something different from a
26571
+ * plane with no connections at all.
26329
26572
  */
26330
26573
  wsConnections: number(),
26574
+ /**
26575
+ * Client frames the WS plane looked at. `wsMessages` far above
26576
+ * `planes.ws + subscriptions` means most traffic is not operations
26577
+ * (keepalives, connection params) - which is itself an answer.
26578
+ */
26579
+ wsMessages: number(),
26580
+ /**
26581
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26582
+ * purpose: one live-events stream opened at boot and held for six hours is
26583
+ * one subscription, and counting it as a call would let a quiet plane
26584
+ * masquerade as the storm.
26585
+ */
26586
+ subscriptions: number(),
26587
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26588
+ subscriptionStops: number(),
26331
26589
  distinctGroups: number(),
26332
- /** Calls counted in the totals whose group attribution was shed at the
26333
- * cardinality bound. */
26590
+ /**
26591
+ * Operations counted in the totals whose CALLER attribution was shed at the
26592
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26593
+ * which transport they arrived on, they just lost their group row.
26594
+ */
26334
26595
  unattributedCalls: number(),
26335
26596
  procedures: array(RequestCensusProcedureSchema).readonly(),
26336
26597
  groups: array(RequestCensusGroupSchema).readonly()
@@ -26353,10 +26614,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
26353
26614
  * The layers of the level hierarchy, general → specific. The most specific
26354
26615
  * layer that carries an explicit value wins.
26355
26616
  *
26356
- * `component` is DECLARED and not yet resolvable: the per-component channels
26357
- * are a later slice of the same plan, and a `levelSource` enum that has to
26358
- * grow later would force every consumer of this document to change with it.
26359
- * Nothing returns `component` today.
26617
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
26618
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
26619
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
26620
+ * that turning it on would not force every consumer of this document to widen
26621
+ * a `levelSource` enum — which is what has now not happened.
26360
26622
  */
26361
26623
  var LoggingScopeKindSchema = _enum([
26362
26624
  "cluster",
@@ -26383,6 +26645,14 @@ var LoggingLevelLayerSchema = object({
26383
26645
  scope: LoggingScopeKindSchema,
26384
26646
  /** The node this layer speaks for; `null` on the cluster layer. */
26385
26647
  nodeId: string().nullable(),
26648
+ /**
26649
+ * The declared channel this layer speaks for; `null` on every layer but
26650
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
26651
+ * by design — the convention this repo settled on is one orchestrator-wide
26652
+ * setting, never per node (D52) — so a component layer that carried a node
26653
+ * would invite a per-node copy of a value that has no per-node meaning.
26654
+ */
26655
+ component: string().nullable(),
26386
26656
  /** Explicitly set here, or `null` when this layer inherits. */
26387
26657
  level: LogLevelSchema$1.nullable()
26388
26658
  });
@@ -26424,6 +26694,49 @@ var DiagnosticWindowPatchSchema = object({
26424
26694
  reportEveryMs: number().int().positive().optional()
26425
26695
  });
26426
26696
  /**
26697
+ * A channel ARMED, as the document reports it.
26698
+ *
26699
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
26700
+ * and the time left, because a diagnostic left running is itself an incident
26701
+ * and "armed for 10 minutes" said an hour ago is not an answer.
26702
+ */
26703
+ var LogChannelWindowStateSchema = object({
26704
+ channel: string(),
26705
+ armed: boolean(),
26706
+ /** Epoch ms the window closes at. 0 when disarmed. */
26707
+ armedUntilMs: number(),
26708
+ /** Ms left before it expires on its own. 0 when disarmed. */
26709
+ remainingMs: number(),
26710
+ /**
26711
+ * The cameras it is narrowed to, or `null` for every camera.
26712
+ *
26713
+ * A channel declared `perDevice: false` can only ever report `null` here:
26714
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
26715
+ * produce a filter that silently matches nothing. The server REFUSES such a
26716
+ * patch rather than quietly widening it — ignoring the request would teach
26717
+ * the operator that per-camera filtering works on that channel when it does
26718
+ * not.
26719
+ */
26720
+ deviceIds: array(number().int()).readonly().nullable()
26721
+ });
26722
+ /**
26723
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
26724
+ * for the same reason: a channel is a window with a deadline, never a switch.
26725
+ */
26726
+ var LogChannelWindowPatchSchema = object({
26727
+ channel: string().min(1),
26728
+ armMs: number().int().min(0),
26729
+ /**
26730
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
26731
+ *
26732
+ * Numeric because the repo's own rule makes it possible: every log line
26733
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
26734
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
26735
+ * diagnosed by hand, and this is the first thing that collects on it.
26736
+ */
26737
+ deviceIds: array(number().int()).readonly().nullable().optional()
26738
+ });
26739
+ /**
26427
26740
  * A PATCH, and patches MERGE.
26428
26741
  *
26429
26742
  * A field absent from the patch is left exactly as it was — arming a
@@ -26442,7 +26755,14 @@ var LoggingSettingsPatchSchema = object({
26442
26755
  * Only the diagnostics NAMED here change. An armed window that is not listed
26443
26756
  * keeps running — a patch is never a full replacement.
26444
26757
  */
26445
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26758
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
26759
+ /**
26760
+ * Only the channels NAMED here change. An armed channel that is not listed
26761
+ * keeps running — same rule as `diagnostics`, because a patch that silently
26762
+ * disarmed the channels it did not mention would make the Levels page and
26763
+ * the Diagnostics page fight over the same value.
26764
+ */
26765
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
26446
26766
  });
26447
26767
  /**
26448
26768
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -26455,9 +26775,22 @@ var LoggingSettingsPatchSchema = object({
26455
26775
  * authority over the whole hierarchy and answers for every layer, so the
26456
26776
  * layer selector needs a name the transport does not already own.
26457
26777
  */
26458
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26778
+ var GetLoggingSettingsInputSchema = object({
26779
+ scopeNodeId: string().optional(),
26780
+ /**
26781
+ * The declared CHANNEL this document is addressed at, when the caller wants
26782
+ * the `component` layer. Absent = the node/cluster hierarchy only.
26783
+ *
26784
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
26785
+ * axes from collapsing: a component level is cluster-wide, a node level is
26786
+ * not, and one selector for both would make "which of these two did I just
26787
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
26788
+ */
26789
+ scopeComponent: string().optional()
26790
+ });
26459
26791
  var SetLoggingSettingsInputSchema = object({
26460
26792
  scopeNodeId: string().optional(),
26793
+ scopeComponent: string().optional(),
26461
26794
  patch: LoggingSettingsPatchSchema
26462
26795
  });
26463
26796
  /**
@@ -26472,9 +26805,20 @@ var SetLoggingSettingsInputSchema = object({
26472
26805
  var LoggingSettingsStateSchema = object({
26473
26806
  /** The layer this document was read at. `null` = the cluster layer. */
26474
26807
  scopeNodeId: string().nullable(),
26808
+ /** The channel this document was read at. `null` = no component layer. */
26809
+ scopeComponent: string().nullable(),
26475
26810
  effective: LoggingEffectiveSchema,
26476
26811
  explicit: LoggingExplicitSchema,
26477
26812
  activeWindows: array(DiagnosticWindowSchema).readonly(),
26813
+ /**
26814
+ * Every channel the cluster's addons DECLARE, gathered from the
26815
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
26816
+ * channel added by a redeployed addon appears without anybody editing a
26817
+ * list, and a channel whose addon is gone stops being offered.
26818
+ */
26819
+ channels: array(LogChannelDescriptorSchema).readonly(),
26820
+ /** The channels ARMED right now, each with its deadline. */
26821
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
26478
26822
  persisted: boolean()
26479
26823
  });
26480
26824
  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(), {
@@ -28051,6 +28395,12 @@ Object.freeze({
28051
28395
  addonId: null,
28052
28396
  access: "view"
28053
28397
  },
28398
+ "dataStoreProvider.aggregate": {
28399
+ capName: "data-store-provider",
28400
+ capScope: "system",
28401
+ addonId: null,
28402
+ access: "view"
28403
+ },
28054
28404
  "dataStoreProvider.count": {
28055
28405
  capName: "data-store-provider",
28056
28406
  capScope: "system",
@@ -28465,6 +28815,12 @@ Object.freeze({
28465
28815
  addonId: null,
28466
28816
  access: "view"
28467
28817
  },
28818
+ "deviceManager.getChildrenBatch": {
28819
+ capName: "device-manager",
28820
+ capScope: "system",
28821
+ addonId: null,
28822
+ access: "view"
28823
+ },
28468
28824
  "deviceManager.getConfigSchema": {
28469
28825
  capName: "device-manager",
28470
28826
  capScope: "system",
@@ -29515,6 +29871,18 @@ Object.freeze({
29515
29871
  addonId: null,
29516
29872
  access: "create"
29517
29873
  },
29874
+ "logChannels.apply": {
29875
+ capName: "log-channels",
29876
+ capScope: "system",
29877
+ addonId: null,
29878
+ access: "create"
29879
+ },
29880
+ "logChannels.list": {
29881
+ capName: "log-channels",
29882
+ capScope: "system",
29883
+ addonId: null,
29884
+ access: "view"
29885
+ },
29518
29886
  "logDestination.query": {
29519
29887
  capName: "log-destination",
29520
29888
  capScope: "system",
@@ -31669,6 +32037,12 @@ Object.freeze({
31669
32037
  addonId: null,
31670
32038
  access: "create"
31671
32039
  },
32040
+ "settingsStore.aggregate": {
32041
+ capName: "settings-store",
32042
+ capScope: "system",
32043
+ addonId: null,
32044
+ access: "view"
32045
+ },
31672
32046
  "settingsStore.count": {
31673
32047
  capName: "settings-store",
31674
32048
  capScope: "system",
@@ -33248,6 +33622,11 @@ Object.freeze({
33248
33622
  form: "single",
33249
33623
  optional: false
33250
33624
  }],
33625
+ "deviceManager.getChildrenBatch": [{
33626
+ name: "parentDeviceIds",
33627
+ form: "array",
33628
+ optional: false
33629
+ }],
33251
33630
  "deviceManager.getConfigSchema": [{
33252
33631
  name: "deviceId",
33253
33632
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-notifiers",
3
- "version": "1.2.36",
3
+ "version": "1.2.38",
4
4
  "description": "System notifiers addon for CamStack — a `notification-output` collection provider hosting per-kind notifier adapters (ntfy, pushover, gotify, telegram, discord, webhook, zentik).",
5
5
  "keywords": [
6
6
  "camstack",