@camstack/addon-export-hap 1.2.43 → 1.2.45

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.
@@ -8134,6 +8134,111 @@ var CameraSwitchGroupSchema = object({
8134
8134
  fetchedAt: number()
8135
8135
  });
8136
8136
  /**
8137
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8138
+ * an addon declares its channels in.
8139
+ *
8140
+ * ## Two axes, deliberately separated
8141
+ *
8142
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8143
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8144
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8145
+ * and rots silently. So a channel is declared where it is consulted, and the
8146
+ * `log-channels` capability enumerates the declarations.
8147
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8148
+ * thing: the logging settings document on the `system` cap. Two authorities
8149
+ * over the values is the exact defect
8150
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8151
+ * remove; re-introducing it from the cure side would be grotesque.
8152
+ *
8153
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8154
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8155
+ * the hot path with a value somebody actually read, and by
8156
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8157
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8158
+ * disarmed one (D49).
8159
+ *
8160
+ * ## The canonical call shape
8161
+ *
8162
+ * ```ts
8163
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8164
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8165
+ * }
8166
+ * ```
8167
+ *
8168
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8169
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8170
+ * object literal is never constructed because it lives inside the branch. It
8171
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8172
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8173
+ * destination floor (measured at 1.93 ns/call when off).
8174
+ *
8175
+ * ## Why a channel emits at `info`
8176
+ *
8177
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8178
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8179
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8180
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8181
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8182
+ * emits at the channel's declared level, whose schema floor is `info`.
8183
+ */
8184
+ /**
8185
+ * The level a channel writes at once armed.
8186
+ *
8187
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8188
+ * not leave the process for Loki, and the whole point of arming a channel is
8189
+ * to read it later.
8190
+ */
8191
+ var LogChannelLevelSchema = _enum([
8192
+ "info",
8193
+ "warn",
8194
+ "error"
8195
+ ]);
8196
+ /**
8197
+ * What an addon declares about one channel. No value, no state — a
8198
+ * declaration is inert.
8199
+ */
8200
+ var LogChannelDescriptorSchema = object({
8201
+ /**
8202
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8203
+ * the addon's short name so an operator reading a channel list can tell who
8204
+ * owns it without a second lookup.
8205
+ */
8206
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8207
+ /** One sentence: what the operator will SEE after arming it. */
8208
+ description: string().min(1),
8209
+ /** The level its lines are emitted at. Never below `info`. */
8210
+ defaultLevel: LogChannelLevelSchema,
8211
+ /**
8212
+ * Whether this channel can be narrowed to a camera.
8213
+ *
8214
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8215
+ * consulted with the numeric device id, AND every line the channel admits
8216
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8217
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8218
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8219
+ * the body is the only way to filter.
8220
+ *
8221
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8222
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8223
+ * the operator narrows to one camera, sees nothing, and concludes the code
8224
+ * path was never taken.
8225
+ */
8226
+ perDevice: boolean()
8227
+ });
8228
+ /**
8229
+ * An armed window over one channel, as the document hands it to a mirror.
8230
+ *
8231
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8232
+ * expires by itself, which is the one failure a boolean cannot avoid.
8233
+ */
8234
+ var LogChannelWindowSchema = object({
8235
+ channel: string().min(1),
8236
+ /** Epoch ms the window closes at. */
8237
+ armedUntilMs: number(),
8238
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8239
+ deviceIds: array(number().int()).readonly().nullable()
8240
+ });
8241
+ /**
8137
8242
  * Ops-log — the durable, append-only operations audit shared by the
8138
8243
  * recordings and events management surfaces.
8139
8244
  *
@@ -11706,6 +11811,35 @@ var MutationFilterSchema = object({
11706
11811
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11707
11812
  whereNot: record(string(), unknown()).optional()
11708
11813
  });
11814
+ /**
11815
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11816
+ *
11817
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11818
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11819
+ * a `Record<column, op>` shape could not express.
11820
+ */
11821
+ var AggregateFieldSchema = object({
11822
+ /** Result key. */
11823
+ as: string().min(1),
11824
+ /** Column to aggregate. Must be a real column of a declared collection. */
11825
+ field: string().min(1),
11826
+ op: _enum([
11827
+ "sum",
11828
+ "min",
11829
+ "max"
11830
+ ])
11831
+ });
11832
+ /**
11833
+ * `COUNT(*)` plus one number per requested field.
11834
+ *
11835
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11836
+ * that really is 0 are different facts, and an accounting caller that renders
11837
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11838
+ */
11839
+ var AggregateResultSchema = object({
11840
+ count: number().int(),
11841
+ values: record(string(), number().nullable())
11842
+ });
11709
11843
  /** A single stored record: `{ id, data }`. */
11710
11844
  var SettingsRecordSchema = object({
11711
11845
  id: string(),
@@ -11790,6 +11924,11 @@ method(object({
11790
11924
  collection: string(),
11791
11925
  filter: QueryFilterSchema.optional()
11792
11926
  }), number()), method(object({
11927
+ namespace: string().optional(),
11928
+ collection: string(),
11929
+ fields: array(AggregateFieldSchema).readonly(),
11930
+ filter: QueryFilterSchema.optional()
11931
+ }), AggregateResultSchema), method(object({
11793
11932
  namespace: string().optional(),
11794
11933
  collection: string(),
11795
11934
  field: string(),
@@ -11906,6 +12045,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11906
12045
  collection: string(),
11907
12046
  filter: QueryFilterSchema.optional()
11908
12047
  }), number(), { auth: "admin" }), method(object({
12048
+ namespace: string().optional(),
12049
+ collection: string(),
12050
+ fields: array(AggregateFieldSchema).readonly(),
12051
+ filter: QueryFilterSchema.optional()
12052
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11909
12053
  namespace: string().optional(),
11910
12054
  collection: string(),
11911
12055
  field: string(),
@@ -12548,24 +12692,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12548
12692
  kind: "mutation",
12549
12693
  auth: "admin"
12550
12694
  });
12551
- /**
12552
- * Device Manager capability — hub-side singleton that unifies device persistence,
12553
- * live registry access, and all management operations into a single tRPC surface.
12554
- *
12555
- * Replaces:
12556
- * - `device-persistence` capability (persistence methods absorbed here)
12557
- * - `device-management.router.ts` (deleted in Phase 2)
12558
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12559
- *
12560
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12561
- * fork into separate processes but never run on remote cluster agents. Therefore:
12562
- * - No nodeId routing needed — this is a pure hub singleton.
12563
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12564
- * - No shadow registry or cross-node aggregation required.
12565
- *
12566
- * Forked workers register devices back to the hub via `ctx.devices`
12567
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12568
- */
12569
12695
  /** One child-placement directive on a container's `childLayout`. Structurally
12570
12696
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12571
12697
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12934,7 +13060,7 @@ method(object({
12934
13060
  * it answers today and the caller filters as it already does.
12935
13061
  */
12936
13062
  deviceIds: array(number()).optional()
12937
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
13063
+ }), 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({
12938
13064
  mode: LinkedDevicesModeSchema,
12939
13065
  devices: array(LinkedDeviceSchema)
12940
13066
  })), 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({
@@ -13658,6 +13784,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13658
13784
  kind: "mutation",
13659
13785
  auth: "admin"
13660
13786
  });
13787
+ /**
13788
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13789
+ * through. It stores nothing.
13790
+ *
13791
+ * ## Why a capability at all, and why this shape
13792
+ *
13793
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13794
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13795
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13796
+ * fails, an operator just never sees the channel somebody added. So the list
13797
+ * is assembled from declarations at runtime.
13798
+ *
13799
+ * The shape is copied from `log-destination.cap.ts`, which already does
13800
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13801
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13802
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13803
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13804
+ * runner's declarations reach hub-main over the transport that already exists.
13805
+ * No new UDS message, no second registry.
13806
+ *
13807
+ * ## What it deliberately does NOT own
13808
+ *
13809
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13810
+ * ONE place: the logging settings document on the `system` cap
13811
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13812
+ * value is the defect the plan behind this work exists to remove, and
13813
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13814
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13815
+ * setter for a window and no persistence of any kind.
13816
+ *
13817
+ * ## Why `apply` is here even so
13818
+ *
13819
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13820
+ * seam has to carry the value from the authority to the mirror, and a channel
13821
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13822
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13823
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13824
+ * persists nothing, it is never the source of a value, and it is called only
13825
+ * with a set the hub actually read (D49 — a read that fails does not call it
13826
+ * at all, so no channel is silently disarmed by a bad read).
13827
+ */
13828
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13829
+ var LogChannelApplyResultSchema = object({
13830
+ /** How many declared channels are armed in this process after the call. */
13831
+ armed: number().int().min(0),
13832
+ /**
13833
+ * Names the document armed that this process does not declare. Reported
13834
+ * rather than swallowed: a name here is either a typo or an addon that has
13835
+ * not booted, and both deserve a line instead of silence.
13836
+ */
13837
+ unknown: array(string()).readonly()
13838
+ });
13839
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13661
13840
  var LogLevelSchema = _enum([
13662
13841
  "debug",
13663
13842
  "info",
@@ -26970,17 +27149,60 @@ var SetSiteLocationInputSchema = object({
26970
27149
  longitude: number().min(-180).max(180)
26971
27150
  }).nullable();
26972
27151
  /**
26973
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
27152
+ * The TRANSPORT a call arrived on.
27153
+ *
27154
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
27155
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
27156
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
27157
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
27158
+ * checkable rather than asserted.
27159
+ *
27160
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
27161
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
27162
+ * connection; the viewer talks to the hub over `wsLink`
27163
+ * exclusively, so this is the plane the HTTP census could not see.
27164
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
27165
+ * never touches a socket and therefore never touched a census.
27166
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
27167
+ * that is exactly what its `0` asserts: every plane the hub has can name
27168
+ * itself. It is an output bucket, never a knob — a call that arrives on a
27169
+ * plane nobody instrumented lands here instead of vanishing from the total.
27170
+ */
27171
+ var TransportPlaneSchema = _enum([
27172
+ "http",
27173
+ "ws",
27174
+ "mesh",
27175
+ "unknown"
27176
+ ]);
27177
+ /**
27178
+ * Calls per plane. Every key is always present, `0` included — an absent plane
27179
+ * reads as "not instrumented", which is the one thing this census must never
27180
+ * make an operator wonder about.
27181
+ */
27182
+ var TransportPlaneCountsSchema = object({
27183
+ http: number(),
27184
+ ws: number(),
27185
+ mesh: number(),
27186
+ unknown: number()
27187
+ });
27188
+ /**
27189
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26974
27190
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26975
27191
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26976
27192
  * already prints - never a token, never an `Authorization` header.
27193
+ *
27194
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
27195
+ * and lives for hours, so folding it into a call count makes one long-lived
27196
+ * stream look like a storm.
26977
27197
  */
26978
27198
  var RequestCensusGroupSchema = object({
27199
+ plane: TransportPlaneSchema,
26979
27200
  procedure: string(),
26980
27201
  userAgent: string(),
26981
27202
  ip: string(),
26982
27203
  principal: string(),
26983
27204
  calls: number(),
27205
+ subscriptions: number(),
26984
27206
  perMin: number()
26985
27207
  });
26986
27208
  /**
@@ -26993,6 +27215,14 @@ var RequestCensusGroupSchema = object({
26993
27215
  var RequestCensusProcedureSchema = object({
26994
27216
  procedure: string(),
26995
27217
  calls: number(),
27218
+ /**
27219
+ * The same total, split by transport. THIS is the row that answers the
27220
+ * question the census exists for: one look at `deviceManager.listAll` says
27221
+ * which plane carried the 4 960, without joining two log lines by eye.
27222
+ */
27223
+ planes: TransportPlaneCountsSchema,
27224
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
27225
+ subscriptions: number(),
26996
27226
  perMin: number()
26997
27227
  });
26998
27228
  /**
@@ -27020,14 +27250,45 @@ var RequestCensusStatusSchema = object({
27020
27250
  */
27021
27251
  procedureCalls: number(),
27022
27252
  /**
27253
+ * `procedureCalls` split by transport. The four keys sum to
27254
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
27255
+ * `planesExplainTotal` is that identity, checked rather than assumed.
27256
+ */
27257
+ planes: TransportPlaneCountsSchema,
27258
+ /**
27259
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
27260
+ * on no plane at all - which is a RESULT (a plane is missing from the
27261
+ * instrument), not a failure, and it has to be visible to be read as one.
27262
+ */
27263
+ planesExplainTotal: boolean(),
27264
+ /**
27023
27265
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
27024
- * transport resolves one context per connection - but the number that says
27025
- * whether a plane this census cannot see was busy while HTTP was quiet.
27266
+ * adapter resolves one context per connection - kept because a plane's call
27267
+ * count of zero against 37 open connections says something different from a
27268
+ * plane with no connections at all.
27026
27269
  */
27027
27270
  wsConnections: number(),
27271
+ /**
27272
+ * Client frames the WS plane looked at. `wsMessages` far above
27273
+ * `planes.ws + subscriptions` means most traffic is not operations
27274
+ * (keepalives, connection params) - which is itself an answer.
27275
+ */
27276
+ wsMessages: number(),
27277
+ /**
27278
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
27279
+ * purpose: one live-events stream opened at boot and held for six hours is
27280
+ * one subscription, and counting it as a call would let a quiet plane
27281
+ * masquerade as the storm.
27282
+ */
27283
+ subscriptions: number(),
27284
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
27285
+ subscriptionStops: number(),
27028
27286
  distinctGroups: number(),
27029
- /** Calls counted in the totals whose group attribution was shed at the
27030
- * cardinality bound. */
27287
+ /**
27288
+ * Operations counted in the totals whose CALLER attribution was shed at the
27289
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
27290
+ * which transport they arrived on, they just lost their group row.
27291
+ */
27031
27292
  unattributedCalls: number(),
27032
27293
  procedures: array(RequestCensusProcedureSchema).readonly(),
27033
27294
  groups: array(RequestCensusGroupSchema).readonly()
@@ -27050,10 +27311,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
27050
27311
  * The layers of the level hierarchy, general → specific. The most specific
27051
27312
  * layer that carries an explicit value wins.
27052
27313
  *
27053
- * `component` is DECLARED and not yet resolvable: the per-component channels
27054
- * are a later slice of the same plan, and a `levelSource` enum that has to
27055
- * grow later would force every consumer of this document to change with it.
27056
- * Nothing returns `component` today.
27314
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
27315
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
27316
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
27317
+ * that turning it on would not force every consumer of this document to widen
27318
+ * a `levelSource` enum — which is what has now not happened.
27057
27319
  */
27058
27320
  var LoggingScopeKindSchema = _enum([
27059
27321
  "cluster",
@@ -27080,6 +27342,14 @@ var LoggingLevelLayerSchema = object({
27080
27342
  scope: LoggingScopeKindSchema,
27081
27343
  /** The node this layer speaks for; `null` on the cluster layer. */
27082
27344
  nodeId: string().nullable(),
27345
+ /**
27346
+ * The declared channel this layer speaks for; `null` on every layer but
27347
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
27348
+ * by design — the convention this repo settled on is one orchestrator-wide
27349
+ * setting, never per node (D52) — so a component layer that carried a node
27350
+ * would invite a per-node copy of a value that has no per-node meaning.
27351
+ */
27352
+ component: string().nullable(),
27083
27353
  /** Explicitly set here, or `null` when this layer inherits. */
27084
27354
  level: LogLevelSchema$1.nullable()
27085
27355
  });
@@ -27121,6 +27391,49 @@ var DiagnosticWindowPatchSchema = object({
27121
27391
  reportEveryMs: number().int().positive().optional()
27122
27392
  });
27123
27393
  /**
27394
+ * A channel ARMED, as the document reports it.
27395
+ *
27396
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
27397
+ * and the time left, because a diagnostic left running is itself an incident
27398
+ * and "armed for 10 minutes" said an hour ago is not an answer.
27399
+ */
27400
+ var LogChannelWindowStateSchema = object({
27401
+ channel: string(),
27402
+ armed: boolean(),
27403
+ /** Epoch ms the window closes at. 0 when disarmed. */
27404
+ armedUntilMs: number(),
27405
+ /** Ms left before it expires on its own. 0 when disarmed. */
27406
+ remainingMs: number(),
27407
+ /**
27408
+ * The cameras it is narrowed to, or `null` for every camera.
27409
+ *
27410
+ * A channel declared `perDevice: false` can only ever report `null` here:
27411
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
27412
+ * produce a filter that silently matches nothing. The server REFUSES such a
27413
+ * patch rather than quietly widening it — ignoring the request would teach
27414
+ * the operator that per-camera filtering works on that channel when it does
27415
+ * not.
27416
+ */
27417
+ deviceIds: array(number().int()).readonly().nullable()
27418
+ });
27419
+ /**
27420
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
27421
+ * for the same reason: a channel is a window with a deadline, never a switch.
27422
+ */
27423
+ var LogChannelWindowPatchSchema = object({
27424
+ channel: string().min(1),
27425
+ armMs: number().int().min(0),
27426
+ /**
27427
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
27428
+ *
27429
+ * Numeric because the repo's own rule makes it possible: every log line
27430
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
27431
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
27432
+ * diagnosed by hand, and this is the first thing that collects on it.
27433
+ */
27434
+ deviceIds: array(number().int()).readonly().nullable().optional()
27435
+ });
27436
+ /**
27124
27437
  * A PATCH, and patches MERGE.
27125
27438
  *
27126
27439
  * A field absent from the patch is left exactly as it was — arming a
@@ -27139,7 +27452,14 @@ var LoggingSettingsPatchSchema = object({
27139
27452
  * Only the diagnostics NAMED here change. An armed window that is not listed
27140
27453
  * keeps running — a patch is never a full replacement.
27141
27454
  */
27142
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
27455
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
27456
+ /**
27457
+ * Only the channels NAMED here change. An armed channel that is not listed
27458
+ * keeps running — same rule as `diagnostics`, because a patch that silently
27459
+ * disarmed the channels it did not mention would make the Levels page and
27460
+ * the Diagnostics page fight over the same value.
27461
+ */
27462
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
27143
27463
  });
27144
27464
  /**
27145
27465
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -27152,9 +27472,22 @@ var LoggingSettingsPatchSchema = object({
27152
27472
  * authority over the whole hierarchy and answers for every layer, so the
27153
27473
  * layer selector needs a name the transport does not already own.
27154
27474
  */
27155
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
27475
+ var GetLoggingSettingsInputSchema = object({
27476
+ scopeNodeId: string().optional(),
27477
+ /**
27478
+ * The declared CHANNEL this document is addressed at, when the caller wants
27479
+ * the `component` layer. Absent = the node/cluster hierarchy only.
27480
+ *
27481
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
27482
+ * axes from collapsing: a component level is cluster-wide, a node level is
27483
+ * not, and one selector for both would make "which of these two did I just
27484
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
27485
+ */
27486
+ scopeComponent: string().optional()
27487
+ });
27156
27488
  var SetLoggingSettingsInputSchema = object({
27157
27489
  scopeNodeId: string().optional(),
27490
+ scopeComponent: string().optional(),
27158
27491
  patch: LoggingSettingsPatchSchema
27159
27492
  });
27160
27493
  /**
@@ -27169,9 +27502,20 @@ var SetLoggingSettingsInputSchema = object({
27169
27502
  var LoggingSettingsStateSchema = object({
27170
27503
  /** The layer this document was read at. `null` = the cluster layer. */
27171
27504
  scopeNodeId: string().nullable(),
27505
+ /** The channel this document was read at. `null` = no component layer. */
27506
+ scopeComponent: string().nullable(),
27172
27507
  effective: LoggingEffectiveSchema,
27173
27508
  explicit: LoggingExplicitSchema,
27174
27509
  activeWindows: array(DiagnosticWindowSchema).readonly(),
27510
+ /**
27511
+ * Every channel the cluster's addons DECLARE, gathered from the
27512
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
27513
+ * channel added by a redeployed addon appears without anybody editing a
27514
+ * list, and a channel whose addon is gone stops being offered.
27515
+ */
27516
+ channels: array(LogChannelDescriptorSchema).readonly(),
27517
+ /** The channels ARMED right now, each with its deadline. */
27518
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
27175
27519
  persisted: boolean()
27176
27520
  });
27177
27521
  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(), {
@@ -28764,6 +29108,12 @@ Object.freeze({
28764
29108
  addonId: null,
28765
29109
  access: "view"
28766
29110
  },
29111
+ "dataStoreProvider.aggregate": {
29112
+ capName: "data-store-provider",
29113
+ capScope: "system",
29114
+ addonId: null,
29115
+ access: "view"
29116
+ },
28767
29117
  "dataStoreProvider.count": {
28768
29118
  capName: "data-store-provider",
28769
29119
  capScope: "system",
@@ -29178,6 +29528,12 @@ Object.freeze({
29178
29528
  addonId: null,
29179
29529
  access: "view"
29180
29530
  },
29531
+ "deviceManager.getChildrenBatch": {
29532
+ capName: "device-manager",
29533
+ capScope: "system",
29534
+ addonId: null,
29535
+ access: "view"
29536
+ },
29181
29537
  "deviceManager.getConfigSchema": {
29182
29538
  capName: "device-manager",
29183
29539
  capScope: "system",
@@ -30228,6 +30584,18 @@ Object.freeze({
30228
30584
  addonId: null,
30229
30585
  access: "create"
30230
30586
  },
30587
+ "logChannels.apply": {
30588
+ capName: "log-channels",
30589
+ capScope: "system",
30590
+ addonId: null,
30591
+ access: "create"
30592
+ },
30593
+ "logChannels.list": {
30594
+ capName: "log-channels",
30595
+ capScope: "system",
30596
+ addonId: null,
30597
+ access: "view"
30598
+ },
30231
30599
  "logDestination.query": {
30232
30600
  capName: "log-destination",
30233
30601
  capScope: "system",
@@ -32382,6 +32750,12 @@ Object.freeze({
32382
32750
  addonId: null,
32383
32751
  access: "create"
32384
32752
  },
32753
+ "settingsStore.aggregate": {
32754
+ capName: "settings-store",
32755
+ capScope: "system",
32756
+ addonId: null,
32757
+ access: "view"
32758
+ },
32385
32759
  "settingsStore.count": {
32386
32760
  capName: "settings-store",
32387
32761
  capScope: "system",
@@ -33961,6 +34335,11 @@ Object.freeze({
33961
34335
  form: "single",
33962
34336
  optional: false
33963
34337
  }],
34338
+ "deviceManager.getChildrenBatch": [{
34339
+ name: "parentDeviceIds",
34340
+ form: "array",
34341
+ optional: false
34342
+ }],
33964
34343
  "deviceManager.getConfigSchema": [{
33965
34344
  name: "deviceId",
33966
34345
  form: "single",
@@ -8122,6 +8122,111 @@ var CameraSwitchGroupSchema = object({
8122
8122
  fetchedAt: number()
8123
8123
  });
8124
8124
  /**
8125
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8126
+ * an addon declares its channels in.
8127
+ *
8128
+ * ## Two axes, deliberately separated
8129
+ *
8130
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8131
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8132
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8133
+ * and rots silently. So a channel is declared where it is consulted, and the
8134
+ * `log-channels` capability enumerates the declarations.
8135
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8136
+ * thing: the logging settings document on the `system` cap. Two authorities
8137
+ * over the values is the exact defect
8138
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8139
+ * remove; re-introducing it from the cure side would be grotesque.
8140
+ *
8141
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8142
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8143
+ * the hot path with a value somebody actually read, and by
8144
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8145
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8146
+ * disarmed one (D49).
8147
+ *
8148
+ * ## The canonical call shape
8149
+ *
8150
+ * ```ts
8151
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8152
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8153
+ * }
8154
+ * ```
8155
+ *
8156
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8157
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8158
+ * object literal is never constructed because it lives inside the branch. It
8159
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8160
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8161
+ * destination floor (measured at 1.93 ns/call when off).
8162
+ *
8163
+ * ## Why a channel emits at `info`
8164
+ *
8165
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8166
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8167
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8168
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8169
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8170
+ * emits at the channel's declared level, whose schema floor is `info`.
8171
+ */
8172
+ /**
8173
+ * The level a channel writes at once armed.
8174
+ *
8175
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8176
+ * not leave the process for Loki, and the whole point of arming a channel is
8177
+ * to read it later.
8178
+ */
8179
+ var LogChannelLevelSchema = _enum([
8180
+ "info",
8181
+ "warn",
8182
+ "error"
8183
+ ]);
8184
+ /**
8185
+ * What an addon declares about one channel. No value, no state — a
8186
+ * declaration is inert.
8187
+ */
8188
+ var LogChannelDescriptorSchema = object({
8189
+ /**
8190
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8191
+ * the addon's short name so an operator reading a channel list can tell who
8192
+ * owns it without a second lookup.
8193
+ */
8194
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8195
+ /** One sentence: what the operator will SEE after arming it. */
8196
+ description: string().min(1),
8197
+ /** The level its lines are emitted at. Never below `info`. */
8198
+ defaultLevel: LogChannelLevelSchema,
8199
+ /**
8200
+ * Whether this channel can be narrowed to a camera.
8201
+ *
8202
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8203
+ * consulted with the numeric device id, AND every line the channel admits
8204
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8205
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8206
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8207
+ * the body is the only way to filter.
8208
+ *
8209
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8210
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8211
+ * the operator narrows to one camera, sees nothing, and concludes the code
8212
+ * path was never taken.
8213
+ */
8214
+ perDevice: boolean()
8215
+ });
8216
+ /**
8217
+ * An armed window over one channel, as the document hands it to a mirror.
8218
+ *
8219
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8220
+ * expires by itself, which is the one failure a boolean cannot avoid.
8221
+ */
8222
+ var LogChannelWindowSchema = object({
8223
+ channel: string().min(1),
8224
+ /** Epoch ms the window closes at. */
8225
+ armedUntilMs: number(),
8226
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8227
+ deviceIds: array(number().int()).readonly().nullable()
8228
+ });
8229
+ /**
8125
8230
  * Ops-log — the durable, append-only operations audit shared by the
8126
8231
  * recordings and events management surfaces.
8127
8232
  *
@@ -11694,6 +11799,35 @@ var MutationFilterSchema = object({
11694
11799
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11695
11800
  whereNot: record(string(), unknown()).optional()
11696
11801
  });
11802
+ /**
11803
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11804
+ *
11805
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11806
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11807
+ * a `Record<column, op>` shape could not express.
11808
+ */
11809
+ var AggregateFieldSchema = object({
11810
+ /** Result key. */
11811
+ as: string().min(1),
11812
+ /** Column to aggregate. Must be a real column of a declared collection. */
11813
+ field: string().min(1),
11814
+ op: _enum([
11815
+ "sum",
11816
+ "min",
11817
+ "max"
11818
+ ])
11819
+ });
11820
+ /**
11821
+ * `COUNT(*)` plus one number per requested field.
11822
+ *
11823
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11824
+ * that really is 0 are different facts, and an accounting caller that renders
11825
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11826
+ */
11827
+ var AggregateResultSchema = object({
11828
+ count: number().int(),
11829
+ values: record(string(), number().nullable())
11830
+ });
11697
11831
  /** A single stored record: `{ id, data }`. */
11698
11832
  var SettingsRecordSchema = object({
11699
11833
  id: string(),
@@ -11778,6 +11912,11 @@ method(object({
11778
11912
  collection: string(),
11779
11913
  filter: QueryFilterSchema.optional()
11780
11914
  }), number()), method(object({
11915
+ namespace: string().optional(),
11916
+ collection: string(),
11917
+ fields: array(AggregateFieldSchema).readonly(),
11918
+ filter: QueryFilterSchema.optional()
11919
+ }), AggregateResultSchema), method(object({
11781
11920
  namespace: string().optional(),
11782
11921
  collection: string(),
11783
11922
  field: string(),
@@ -11894,6 +12033,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11894
12033
  collection: string(),
11895
12034
  filter: QueryFilterSchema.optional()
11896
12035
  }), number(), { auth: "admin" }), method(object({
12036
+ namespace: string().optional(),
12037
+ collection: string(),
12038
+ fields: array(AggregateFieldSchema).readonly(),
12039
+ filter: QueryFilterSchema.optional()
12040
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11897
12041
  namespace: string().optional(),
11898
12042
  collection: string(),
11899
12043
  field: string(),
@@ -12536,24 +12680,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12536
12680
  kind: "mutation",
12537
12681
  auth: "admin"
12538
12682
  });
12539
- /**
12540
- * Device Manager capability — hub-side singleton that unifies device persistence,
12541
- * live registry access, and all management operations into a single tRPC surface.
12542
- *
12543
- * Replaces:
12544
- * - `device-persistence` capability (persistence methods absorbed here)
12545
- * - `device-management.router.ts` (deleted in Phase 2)
12546
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12547
- *
12548
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12549
- * fork into separate processes but never run on remote cluster agents. Therefore:
12550
- * - No nodeId routing needed — this is a pure hub singleton.
12551
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12552
- * - No shadow registry or cross-node aggregation required.
12553
- *
12554
- * Forked workers register devices back to the hub via `ctx.devices`
12555
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12556
- */
12557
12683
  /** One child-placement directive on a container's `childLayout`. Structurally
12558
12684
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12559
12685
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12922,7 +13048,7 @@ method(object({
12922
13048
  * it answers today and the caller filters as it already does.
12923
13049
  */
12924
13050
  deviceIds: array(number()).optional()
12925
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
13051
+ }), 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({
12926
13052
  mode: LinkedDevicesModeSchema,
12927
13053
  devices: array(LinkedDeviceSchema)
12928
13054
  })), 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({
@@ -13646,6 +13772,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13646
13772
  kind: "mutation",
13647
13773
  auth: "admin"
13648
13774
  });
13775
+ /**
13776
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13777
+ * through. It stores nothing.
13778
+ *
13779
+ * ## Why a capability at all, and why this shape
13780
+ *
13781
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13782
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13783
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13784
+ * fails, an operator just never sees the channel somebody added. So the list
13785
+ * is assembled from declarations at runtime.
13786
+ *
13787
+ * The shape is copied from `log-destination.cap.ts`, which already does
13788
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13789
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13790
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13791
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13792
+ * runner's declarations reach hub-main over the transport that already exists.
13793
+ * No new UDS message, no second registry.
13794
+ *
13795
+ * ## What it deliberately does NOT own
13796
+ *
13797
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13798
+ * ONE place: the logging settings document on the `system` cap
13799
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13800
+ * value is the defect the plan behind this work exists to remove, and
13801
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13802
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13803
+ * setter for a window and no persistence of any kind.
13804
+ *
13805
+ * ## Why `apply` is here even so
13806
+ *
13807
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13808
+ * seam has to carry the value from the authority to the mirror, and a channel
13809
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13810
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13811
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13812
+ * persists nothing, it is never the source of a value, and it is called only
13813
+ * with a set the hub actually read (D49 — a read that fails does not call it
13814
+ * at all, so no channel is silently disarmed by a bad read).
13815
+ */
13816
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13817
+ var LogChannelApplyResultSchema = object({
13818
+ /** How many declared channels are armed in this process after the call. */
13819
+ armed: number().int().min(0),
13820
+ /**
13821
+ * Names the document armed that this process does not declare. Reported
13822
+ * rather than swallowed: a name here is either a typo or an addon that has
13823
+ * not booted, and both deserve a line instead of silence.
13824
+ */
13825
+ unknown: array(string()).readonly()
13826
+ });
13827
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13649
13828
  var LogLevelSchema = _enum([
13650
13829
  "debug",
13651
13830
  "info",
@@ -26958,17 +27137,60 @@ var SetSiteLocationInputSchema = object({
26958
27137
  longitude: number().min(-180).max(180)
26959
27138
  }).nullable();
26960
27139
  /**
26961
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
27140
+ * The TRANSPORT a call arrived on.
27141
+ *
27142
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
27143
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
27144
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
27145
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
27146
+ * checkable rather than asserted.
27147
+ *
27148
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
27149
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
27150
+ * connection; the viewer talks to the hub over `wsLink`
27151
+ * exclusively, so this is the plane the HTTP census could not see.
27152
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
27153
+ * never touches a socket and therefore never touched a census.
27154
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
27155
+ * that is exactly what its `0` asserts: every plane the hub has can name
27156
+ * itself. It is an output bucket, never a knob — a call that arrives on a
27157
+ * plane nobody instrumented lands here instead of vanishing from the total.
27158
+ */
27159
+ var TransportPlaneSchema = _enum([
27160
+ "http",
27161
+ "ws",
27162
+ "mesh",
27163
+ "unknown"
27164
+ ]);
27165
+ /**
27166
+ * Calls per plane. Every key is always present, `0` included — an absent plane
27167
+ * reads as "not instrumented", which is the one thing this census must never
27168
+ * make an operator wonder about.
27169
+ */
27170
+ var TransportPlaneCountsSchema = object({
27171
+ http: number(),
27172
+ ws: number(),
27173
+ mesh: number(),
27174
+ unknown: number()
27175
+ });
27176
+ /**
27177
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26962
27178
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26963
27179
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26964
27180
  * already prints - never a token, never an `Authorization` header.
27181
+ *
27182
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
27183
+ * and lives for hours, so folding it into a call count makes one long-lived
27184
+ * stream look like a storm.
26965
27185
  */
26966
27186
  var RequestCensusGroupSchema = object({
27187
+ plane: TransportPlaneSchema,
26967
27188
  procedure: string(),
26968
27189
  userAgent: string(),
26969
27190
  ip: string(),
26970
27191
  principal: string(),
26971
27192
  calls: number(),
27193
+ subscriptions: number(),
26972
27194
  perMin: number()
26973
27195
  });
26974
27196
  /**
@@ -26981,6 +27203,14 @@ var RequestCensusGroupSchema = object({
26981
27203
  var RequestCensusProcedureSchema = object({
26982
27204
  procedure: string(),
26983
27205
  calls: number(),
27206
+ /**
27207
+ * The same total, split by transport. THIS is the row that answers the
27208
+ * question the census exists for: one look at `deviceManager.listAll` says
27209
+ * which plane carried the 4 960, without joining two log lines by eye.
27210
+ */
27211
+ planes: TransportPlaneCountsSchema,
27212
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
27213
+ subscriptions: number(),
26984
27214
  perMin: number()
26985
27215
  });
26986
27216
  /**
@@ -27008,14 +27238,45 @@ var RequestCensusStatusSchema = object({
27008
27238
  */
27009
27239
  procedureCalls: number(),
27010
27240
  /**
27241
+ * `procedureCalls` split by transport. The four keys sum to
27242
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
27243
+ * `planesExplainTotal` is that identity, checked rather than assumed.
27244
+ */
27245
+ planes: TransportPlaneCountsSchema,
27246
+ /**
27247
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
27248
+ * on no plane at all - which is a RESULT (a plane is missing from the
27249
+ * instrument), not a failure, and it has to be visible to be read as one.
27250
+ */
27251
+ planesExplainTotal: boolean(),
27252
+ /**
27011
27253
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
27012
- * transport resolves one context per connection - but the number that says
27013
- * whether a plane this census cannot see was busy while HTTP was quiet.
27254
+ * adapter resolves one context per connection - kept because a plane's call
27255
+ * count of zero against 37 open connections says something different from a
27256
+ * plane with no connections at all.
27014
27257
  */
27015
27258
  wsConnections: number(),
27259
+ /**
27260
+ * Client frames the WS plane looked at. `wsMessages` far above
27261
+ * `planes.ws + subscriptions` means most traffic is not operations
27262
+ * (keepalives, connection params) - which is itself an answer.
27263
+ */
27264
+ wsMessages: number(),
27265
+ /**
27266
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
27267
+ * purpose: one live-events stream opened at boot and held for six hours is
27268
+ * one subscription, and counting it as a call would let a quiet plane
27269
+ * masquerade as the storm.
27270
+ */
27271
+ subscriptions: number(),
27272
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
27273
+ subscriptionStops: number(),
27016
27274
  distinctGroups: number(),
27017
- /** Calls counted in the totals whose group attribution was shed at the
27018
- * cardinality bound. */
27275
+ /**
27276
+ * Operations counted in the totals whose CALLER attribution was shed at the
27277
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
27278
+ * which transport they arrived on, they just lost their group row.
27279
+ */
27019
27280
  unattributedCalls: number(),
27020
27281
  procedures: array(RequestCensusProcedureSchema).readonly(),
27021
27282
  groups: array(RequestCensusGroupSchema).readonly()
@@ -27038,10 +27299,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
27038
27299
  * The layers of the level hierarchy, general → specific. The most specific
27039
27300
  * layer that carries an explicit value wins.
27040
27301
  *
27041
- * `component` is DECLARED and not yet resolvable: the per-component channels
27042
- * are a later slice of the same plan, and a `levelSource` enum that has to
27043
- * grow later would force every consumer of this document to change with it.
27044
- * Nothing returns `component` today.
27302
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
27303
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
27304
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
27305
+ * that turning it on would not force every consumer of this document to widen
27306
+ * a `levelSource` enum — which is what has now not happened.
27045
27307
  */
27046
27308
  var LoggingScopeKindSchema = _enum([
27047
27309
  "cluster",
@@ -27068,6 +27330,14 @@ var LoggingLevelLayerSchema = object({
27068
27330
  scope: LoggingScopeKindSchema,
27069
27331
  /** The node this layer speaks for; `null` on the cluster layer. */
27070
27332
  nodeId: string().nullable(),
27333
+ /**
27334
+ * The declared channel this layer speaks for; `null` on every layer but
27335
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
27336
+ * by design — the convention this repo settled on is one orchestrator-wide
27337
+ * setting, never per node (D52) — so a component layer that carried a node
27338
+ * would invite a per-node copy of a value that has no per-node meaning.
27339
+ */
27340
+ component: string().nullable(),
27071
27341
  /** Explicitly set here, or `null` when this layer inherits. */
27072
27342
  level: LogLevelSchema$1.nullable()
27073
27343
  });
@@ -27109,6 +27379,49 @@ var DiagnosticWindowPatchSchema = object({
27109
27379
  reportEveryMs: number().int().positive().optional()
27110
27380
  });
27111
27381
  /**
27382
+ * A channel ARMED, as the document reports it.
27383
+ *
27384
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
27385
+ * and the time left, because a diagnostic left running is itself an incident
27386
+ * and "armed for 10 minutes" said an hour ago is not an answer.
27387
+ */
27388
+ var LogChannelWindowStateSchema = object({
27389
+ channel: string(),
27390
+ armed: boolean(),
27391
+ /** Epoch ms the window closes at. 0 when disarmed. */
27392
+ armedUntilMs: number(),
27393
+ /** Ms left before it expires on its own. 0 when disarmed. */
27394
+ remainingMs: number(),
27395
+ /**
27396
+ * The cameras it is narrowed to, or `null` for every camera.
27397
+ *
27398
+ * A channel declared `perDevice: false` can only ever report `null` here:
27399
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
27400
+ * produce a filter that silently matches nothing. The server REFUSES such a
27401
+ * patch rather than quietly widening it — ignoring the request would teach
27402
+ * the operator that per-camera filtering works on that channel when it does
27403
+ * not.
27404
+ */
27405
+ deviceIds: array(number().int()).readonly().nullable()
27406
+ });
27407
+ /**
27408
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
27409
+ * for the same reason: a channel is a window with a deadline, never a switch.
27410
+ */
27411
+ var LogChannelWindowPatchSchema = object({
27412
+ channel: string().min(1),
27413
+ armMs: number().int().min(0),
27414
+ /**
27415
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
27416
+ *
27417
+ * Numeric because the repo's own rule makes it possible: every log line
27418
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
27419
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
27420
+ * diagnosed by hand, and this is the first thing that collects on it.
27421
+ */
27422
+ deviceIds: array(number().int()).readonly().nullable().optional()
27423
+ });
27424
+ /**
27112
27425
  * A PATCH, and patches MERGE.
27113
27426
  *
27114
27427
  * A field absent from the patch is left exactly as it was — arming a
@@ -27127,7 +27440,14 @@ var LoggingSettingsPatchSchema = object({
27127
27440
  * Only the diagnostics NAMED here change. An armed window that is not listed
27128
27441
  * keeps running — a patch is never a full replacement.
27129
27442
  */
27130
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
27443
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
27444
+ /**
27445
+ * Only the channels NAMED here change. An armed channel that is not listed
27446
+ * keeps running — same rule as `diagnostics`, because a patch that silently
27447
+ * disarmed the channels it did not mention would make the Levels page and
27448
+ * the Diagnostics page fight over the same value.
27449
+ */
27450
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
27131
27451
  });
27132
27452
  /**
27133
27453
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -27140,9 +27460,22 @@ var LoggingSettingsPatchSchema = object({
27140
27460
  * authority over the whole hierarchy and answers for every layer, so the
27141
27461
  * layer selector needs a name the transport does not already own.
27142
27462
  */
27143
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
27463
+ var GetLoggingSettingsInputSchema = object({
27464
+ scopeNodeId: string().optional(),
27465
+ /**
27466
+ * The declared CHANNEL this document is addressed at, when the caller wants
27467
+ * the `component` layer. Absent = the node/cluster hierarchy only.
27468
+ *
27469
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
27470
+ * axes from collapsing: a component level is cluster-wide, a node level is
27471
+ * not, and one selector for both would make "which of these two did I just
27472
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
27473
+ */
27474
+ scopeComponent: string().optional()
27475
+ });
27144
27476
  var SetLoggingSettingsInputSchema = object({
27145
27477
  scopeNodeId: string().optional(),
27478
+ scopeComponent: string().optional(),
27146
27479
  patch: LoggingSettingsPatchSchema
27147
27480
  });
27148
27481
  /**
@@ -27157,9 +27490,20 @@ var SetLoggingSettingsInputSchema = object({
27157
27490
  var LoggingSettingsStateSchema = object({
27158
27491
  /** The layer this document was read at. `null` = the cluster layer. */
27159
27492
  scopeNodeId: string().nullable(),
27493
+ /** The channel this document was read at. `null` = no component layer. */
27494
+ scopeComponent: string().nullable(),
27160
27495
  effective: LoggingEffectiveSchema,
27161
27496
  explicit: LoggingExplicitSchema,
27162
27497
  activeWindows: array(DiagnosticWindowSchema).readonly(),
27498
+ /**
27499
+ * Every channel the cluster's addons DECLARE, gathered from the
27500
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
27501
+ * channel added by a redeployed addon appears without anybody editing a
27502
+ * list, and a channel whose addon is gone stops being offered.
27503
+ */
27504
+ channels: array(LogChannelDescriptorSchema).readonly(),
27505
+ /** The channels ARMED right now, each with its deadline. */
27506
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
27163
27507
  persisted: boolean()
27164
27508
  });
27165
27509
  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(), {
@@ -28752,6 +29096,12 @@ Object.freeze({
28752
29096
  addonId: null,
28753
29097
  access: "view"
28754
29098
  },
29099
+ "dataStoreProvider.aggregate": {
29100
+ capName: "data-store-provider",
29101
+ capScope: "system",
29102
+ addonId: null,
29103
+ access: "view"
29104
+ },
28755
29105
  "dataStoreProvider.count": {
28756
29106
  capName: "data-store-provider",
28757
29107
  capScope: "system",
@@ -29166,6 +29516,12 @@ Object.freeze({
29166
29516
  addonId: null,
29167
29517
  access: "view"
29168
29518
  },
29519
+ "deviceManager.getChildrenBatch": {
29520
+ capName: "device-manager",
29521
+ capScope: "system",
29522
+ addonId: null,
29523
+ access: "view"
29524
+ },
29169
29525
  "deviceManager.getConfigSchema": {
29170
29526
  capName: "device-manager",
29171
29527
  capScope: "system",
@@ -30216,6 +30572,18 @@ Object.freeze({
30216
30572
  addonId: null,
30217
30573
  access: "create"
30218
30574
  },
30575
+ "logChannels.apply": {
30576
+ capName: "log-channels",
30577
+ capScope: "system",
30578
+ addonId: null,
30579
+ access: "create"
30580
+ },
30581
+ "logChannels.list": {
30582
+ capName: "log-channels",
30583
+ capScope: "system",
30584
+ addonId: null,
30585
+ access: "view"
30586
+ },
30219
30587
  "logDestination.query": {
30220
30588
  capName: "log-destination",
30221
30589
  capScope: "system",
@@ -32370,6 +32738,12 @@ Object.freeze({
32370
32738
  addonId: null,
32371
32739
  access: "create"
32372
32740
  },
32741
+ "settingsStore.aggregate": {
32742
+ capName: "settings-store",
32743
+ capScope: "system",
32744
+ addonId: null,
32745
+ access: "view"
32746
+ },
32373
32747
  "settingsStore.count": {
32374
32748
  capName: "settings-store",
32375
32749
  capScope: "system",
@@ -33949,6 +34323,11 @@ Object.freeze({
33949
34323
  form: "single",
33950
34324
  optional: false
33951
34325
  }],
34326
+ "deviceManager.getChildrenBatch": [{
34327
+ name: "parentDeviceIds",
34328
+ form: "array",
34329
+ optional: false
34330
+ }],
33952
34331
  "deviceManager.getConfigSchema": [{
33953
34332
  name: "deviceId",
33954
34333
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-hap",
3
- "version": "1.2.43",
3
+ "version": "1.2.45",
4
4
  "description": "HomeKit (HAP) exporter for CamStack devices. Publishes each exposed device as its own HomeKit accessory: cameras and doorbells with SRTP streaming, HomeKit Secure Video, motion, two-way audio, PTZ and battery; switches, lights, locks and sensors through a capability→service table.",
5
5
  "keywords": [
6
6
  "camstack",