@camstack/addon-provider-wyze 0.2.36 → 0.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
@@ -7500,6 +7500,111 @@ var CameraSwitchGroupSchema = object({
7500
7500
  fetchedAt: number()
7501
7501
  });
7502
7502
  /**
7503
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7504
+ * an addon declares its channels in.
7505
+ *
7506
+ * ## Two axes, deliberately separated
7507
+ *
7508
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7509
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7510
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7511
+ * and rots silently. So a channel is declared where it is consulted, and the
7512
+ * `log-channels` capability enumerates the declarations.
7513
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7514
+ * thing: the logging settings document on the `system` cap. Two authorities
7515
+ * over the values is the exact defect
7516
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7517
+ * remove; re-introducing it from the cure side would be grotesque.
7518
+ *
7519
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7520
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7521
+ * the hot path with a value somebody actually read, and by
7522
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7523
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7524
+ * disarmed one (D49).
7525
+ *
7526
+ * ## The canonical call shape
7527
+ *
7528
+ * ```ts
7529
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7530
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7531
+ * }
7532
+ * ```
7533
+ *
7534
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7535
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7536
+ * object literal is never constructed because it lives inside the branch. It
7537
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7538
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7539
+ * destination floor (measured at 1.93 ns/call when off).
7540
+ *
7541
+ * ## Why a channel emits at `info`
7542
+ *
7543
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7544
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7545
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7546
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7547
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7548
+ * emits at the channel's declared level, whose schema floor is `info`.
7549
+ */
7550
+ /**
7551
+ * The level a channel writes at once armed.
7552
+ *
7553
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7554
+ * not leave the process for Loki, and the whole point of arming a channel is
7555
+ * to read it later.
7556
+ */
7557
+ var LogChannelLevelSchema = _enum([
7558
+ "info",
7559
+ "warn",
7560
+ "error"
7561
+ ]);
7562
+ /**
7563
+ * What an addon declares about one channel. No value, no state — a
7564
+ * declaration is inert.
7565
+ */
7566
+ var LogChannelDescriptorSchema = object({
7567
+ /**
7568
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7569
+ * the addon's short name so an operator reading a channel list can tell who
7570
+ * owns it without a second lookup.
7571
+ */
7572
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7573
+ /** One sentence: what the operator will SEE after arming it. */
7574
+ description: string().min(1),
7575
+ /** The level its lines are emitted at. Never below `info`. */
7576
+ defaultLevel: LogChannelLevelSchema,
7577
+ /**
7578
+ * Whether this channel can be narrowed to a camera.
7579
+ *
7580
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7581
+ * consulted with the numeric device id, AND every line the channel admits
7582
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7583
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7584
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7585
+ * the body is the only way to filter.
7586
+ *
7587
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7588
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7589
+ * the operator narrows to one camera, sees nothing, and concludes the code
7590
+ * path was never taken.
7591
+ */
7592
+ perDevice: boolean()
7593
+ });
7594
+ /**
7595
+ * An armed window over one channel, as the document hands it to a mirror.
7596
+ *
7597
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7598
+ * expires by itself, which is the one failure a boolean cannot avoid.
7599
+ */
7600
+ var LogChannelWindowSchema = object({
7601
+ channel: string().min(1),
7602
+ /** Epoch ms the window closes at. */
7603
+ armedUntilMs: number(),
7604
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7605
+ deviceIds: array(number().int()).readonly().nullable()
7606
+ });
7607
+ /**
7503
7608
  * Ops-log — the durable, append-only operations audit shared by the
7504
7609
  * recordings and events management surfaces.
7505
7610
  *
@@ -11120,6 +11225,35 @@ var MutationFilterSchema = object({
11120
11225
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11121
11226
  whereNot: record(string(), unknown()).optional()
11122
11227
  });
11228
+ /**
11229
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11230
+ *
11231
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11232
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11233
+ * a `Record<column, op>` shape could not express.
11234
+ */
11235
+ var AggregateFieldSchema = object({
11236
+ /** Result key. */
11237
+ as: string().min(1),
11238
+ /** Column to aggregate. Must be a real column of a declared collection. */
11239
+ field: string().min(1),
11240
+ op: _enum([
11241
+ "sum",
11242
+ "min",
11243
+ "max"
11244
+ ])
11245
+ });
11246
+ /**
11247
+ * `COUNT(*)` plus one number per requested field.
11248
+ *
11249
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11250
+ * that really is 0 are different facts, and an accounting caller that renders
11251
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11252
+ */
11253
+ var AggregateResultSchema = object({
11254
+ count: number().int(),
11255
+ values: record(string(), number().nullable())
11256
+ });
11123
11257
  /** A single stored record: `{ id, data }`. */
11124
11258
  var SettingsRecordSchema = object({
11125
11259
  id: string(),
@@ -11204,6 +11338,11 @@ method(object({
11204
11338
  collection: string(),
11205
11339
  filter: QueryFilterSchema.optional()
11206
11340
  }), number()), method(object({
11341
+ namespace: string().optional(),
11342
+ collection: string(),
11343
+ fields: array(AggregateFieldSchema).readonly(),
11344
+ filter: QueryFilterSchema.optional()
11345
+ }), AggregateResultSchema), method(object({
11207
11346
  namespace: string().optional(),
11208
11347
  collection: string(),
11209
11348
  field: string(),
@@ -11320,6 +11459,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11320
11459
  collection: string(),
11321
11460
  filter: QueryFilterSchema.optional()
11322
11461
  }), number(), { auth: "admin" }), method(object({
11462
+ namespace: string().optional(),
11463
+ collection: string(),
11464
+ fields: array(AggregateFieldSchema).readonly(),
11465
+ filter: QueryFilterSchema.optional()
11466
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11323
11467
  namespace: string().optional(),
11324
11468
  collection: string(),
11325
11469
  field: string(),
@@ -12060,24 +12204,6 @@ var deviceProviderCapability = {
12060
12204
  })
12061
12205
  }
12062
12206
  };
12063
- /**
12064
- * Device Manager capability — hub-side singleton that unifies device persistence,
12065
- * live registry access, and all management operations into a single tRPC surface.
12066
- *
12067
- * Replaces:
12068
- * - `device-persistence` capability (persistence methods absorbed here)
12069
- * - `device-management.router.ts` (deleted in Phase 2)
12070
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12071
- *
12072
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12073
- * fork into separate processes but never run on remote cluster agents. Therefore:
12074
- * - No nodeId routing needed — this is a pure hub singleton.
12075
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12076
- * - No shadow registry or cross-node aggregation required.
12077
- *
12078
- * Forked workers register devices back to the hub via `ctx.devices`
12079
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12080
- */
12081
12207
  /** One child-placement directive on a container's `childLayout`. Structurally
12082
12208
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12083
12209
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12446,7 +12572,7 @@ method(object({
12446
12572
  * it answers today and the caller filters as it already does.
12447
12573
  */
12448
12574
  deviceIds: array(number()).optional()
12449
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12575
+ }), 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({
12450
12576
  mode: LinkedDevicesModeSchema,
12451
12577
  devices: array(LinkedDeviceSchema)
12452
12578
  })), 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({
@@ -13170,6 +13296,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13170
13296
  kind: "mutation",
13171
13297
  auth: "admin"
13172
13298
  });
13299
+ /**
13300
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13301
+ * through. It stores nothing.
13302
+ *
13303
+ * ## Why a capability at all, and why this shape
13304
+ *
13305
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13306
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13307
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13308
+ * fails, an operator just never sees the channel somebody added. So the list
13309
+ * is assembled from declarations at runtime.
13310
+ *
13311
+ * The shape is copied from `log-destination.cap.ts`, which already does
13312
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13313
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13314
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13315
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13316
+ * runner's declarations reach hub-main over the transport that already exists.
13317
+ * No new UDS message, no second registry.
13318
+ *
13319
+ * ## What it deliberately does NOT own
13320
+ *
13321
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13322
+ * ONE place: the logging settings document on the `system` cap
13323
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13324
+ * value is the defect the plan behind this work exists to remove, and
13325
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13326
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13327
+ * setter for a window and no persistence of any kind.
13328
+ *
13329
+ * ## Why `apply` is here even so
13330
+ *
13331
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13332
+ * seam has to carry the value from the authority to the mirror, and a channel
13333
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13334
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13335
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13336
+ * persists nothing, it is never the source of a value, and it is called only
13337
+ * with a set the hub actually read (D49 — a read that fails does not call it
13338
+ * at all, so no channel is silently disarmed by a bad read).
13339
+ */
13340
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13341
+ var LogChannelApplyResultSchema = object({
13342
+ /** How many declared channels are armed in this process after the call. */
13343
+ armed: number().int().min(0),
13344
+ /**
13345
+ * Names the document armed that this process does not declare. Reported
13346
+ * rather than swallowed: a name here is either a typo or an addon that has
13347
+ * not booted, and both deserve a line instead of silence.
13348
+ */
13349
+ unknown: array(string()).readonly()
13350
+ });
13351
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13173
13352
  var LogLevelSchema = _enum([
13174
13353
  "debug",
13175
13354
  "info",
@@ -28564,17 +28743,60 @@ var SetSiteLocationInputSchema = object({
28564
28743
  longitude: number().min(-180).max(180)
28565
28744
  }).nullable();
28566
28745
  /**
28567
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28746
+ * The TRANSPORT a call arrived on.
28747
+ *
28748
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28749
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28750
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28751
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28752
+ * checkable rather than asserted.
28753
+ *
28754
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28755
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28756
+ * connection; the viewer talks to the hub over `wsLink`
28757
+ * exclusively, so this is the plane the HTTP census could not see.
28758
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28759
+ * never touches a socket and therefore never touched a census.
28760
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28761
+ * that is exactly what its `0` asserts: every plane the hub has can name
28762
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28763
+ * plane nobody instrumented lands here instead of vanishing from the total.
28764
+ */
28765
+ var TransportPlaneSchema = _enum([
28766
+ "http",
28767
+ "ws",
28768
+ "mesh",
28769
+ "unknown"
28770
+ ]);
28771
+ /**
28772
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28773
+ * reads as "not instrumented", which is the one thing this census must never
28774
+ * make an operator wonder about.
28775
+ */
28776
+ var TransportPlaneCountsSchema = object({
28777
+ http: number(),
28778
+ ws: number(),
28779
+ mesh: number(),
28780
+ unknown: number()
28781
+ });
28782
+ /**
28783
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28568
28784
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28569
28785
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28570
28786
  * already prints - never a token, never an `Authorization` header.
28787
+ *
28788
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28789
+ * and lives for hours, so folding it into a call count makes one long-lived
28790
+ * stream look like a storm.
28571
28791
  */
28572
28792
  var RequestCensusGroupSchema = object({
28793
+ plane: TransportPlaneSchema,
28573
28794
  procedure: string(),
28574
28795
  userAgent: string(),
28575
28796
  ip: string(),
28576
28797
  principal: string(),
28577
28798
  calls: number(),
28799
+ subscriptions: number(),
28578
28800
  perMin: number()
28579
28801
  });
28580
28802
  /**
@@ -28587,6 +28809,14 @@ var RequestCensusGroupSchema = object({
28587
28809
  var RequestCensusProcedureSchema = object({
28588
28810
  procedure: string(),
28589
28811
  calls: number(),
28812
+ /**
28813
+ * The same total, split by transport. THIS is the row that answers the
28814
+ * question the census exists for: one look at `deviceManager.listAll` says
28815
+ * which plane carried the 4 960, without joining two log lines by eye.
28816
+ */
28817
+ planes: TransportPlaneCountsSchema,
28818
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28819
+ subscriptions: number(),
28590
28820
  perMin: number()
28591
28821
  });
28592
28822
  /**
@@ -28614,14 +28844,45 @@ var RequestCensusStatusSchema = object({
28614
28844
  */
28615
28845
  procedureCalls: number(),
28616
28846
  /**
28847
+ * `procedureCalls` split by transport. The four keys sum to
28848
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28849
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28850
+ */
28851
+ planes: TransportPlaneCountsSchema,
28852
+ /**
28853
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28854
+ * on no plane at all - which is a RESULT (a plane is missing from the
28855
+ * instrument), not a failure, and it has to be visible to be read as one.
28856
+ */
28857
+ planesExplainTotal: boolean(),
28858
+ /**
28617
28859
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28618
- * transport resolves one context per connection - but the number that says
28619
- * whether a plane this census cannot see was busy while HTTP was quiet.
28860
+ * adapter resolves one context per connection - kept because a plane's call
28861
+ * count of zero against 37 open connections says something different from a
28862
+ * plane with no connections at all.
28620
28863
  */
28621
28864
  wsConnections: number(),
28865
+ /**
28866
+ * Client frames the WS plane looked at. `wsMessages` far above
28867
+ * `planes.ws + subscriptions` means most traffic is not operations
28868
+ * (keepalives, connection params) - which is itself an answer.
28869
+ */
28870
+ wsMessages: number(),
28871
+ /**
28872
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28873
+ * purpose: one live-events stream opened at boot and held for six hours is
28874
+ * one subscription, and counting it as a call would let a quiet plane
28875
+ * masquerade as the storm.
28876
+ */
28877
+ subscriptions: number(),
28878
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28879
+ subscriptionStops: number(),
28622
28880
  distinctGroups: number(),
28623
- /** Calls counted in the totals whose group attribution was shed at the
28624
- * cardinality bound. */
28881
+ /**
28882
+ * Operations counted in the totals whose CALLER attribution was shed at the
28883
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28884
+ * which transport they arrived on, they just lost their group row.
28885
+ */
28625
28886
  unattributedCalls: number(),
28626
28887
  procedures: array(RequestCensusProcedureSchema).readonly(),
28627
28888
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28644,10 +28905,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28644
28905
  * The layers of the level hierarchy, general → specific. The most specific
28645
28906
  * layer that carries an explicit value wins.
28646
28907
  *
28647
- * `component` is DECLARED and not yet resolvable: the per-component channels
28648
- * are a later slice of the same plan, and a `levelSource` enum that has to
28649
- * grow later would force every consumer of this document to change with it.
28650
- * Nothing returns `component` today.
28908
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28909
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28910
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28911
+ * that turning it on would not force every consumer of this document to widen
28912
+ * a `levelSource` enum — which is what has now not happened.
28651
28913
  */
28652
28914
  var LoggingScopeKindSchema = _enum([
28653
28915
  "cluster",
@@ -28674,6 +28936,14 @@ var LoggingLevelLayerSchema = object({
28674
28936
  scope: LoggingScopeKindSchema,
28675
28937
  /** The node this layer speaks for; `null` on the cluster layer. */
28676
28938
  nodeId: string().nullable(),
28939
+ /**
28940
+ * The declared channel this layer speaks for; `null` on every layer but
28941
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28942
+ * by design — the convention this repo settled on is one orchestrator-wide
28943
+ * setting, never per node (D52) — so a component layer that carried a node
28944
+ * would invite a per-node copy of a value that has no per-node meaning.
28945
+ */
28946
+ component: string().nullable(),
28677
28947
  /** Explicitly set here, or `null` when this layer inherits. */
28678
28948
  level: LogLevelSchema$1.nullable()
28679
28949
  });
@@ -28715,6 +28985,49 @@ var DiagnosticWindowPatchSchema = object({
28715
28985
  reportEveryMs: number().int().positive().optional()
28716
28986
  });
28717
28987
  /**
28988
+ * A channel ARMED, as the document reports it.
28989
+ *
28990
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28991
+ * and the time left, because a diagnostic left running is itself an incident
28992
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28993
+ */
28994
+ var LogChannelWindowStateSchema = object({
28995
+ channel: string(),
28996
+ armed: boolean(),
28997
+ /** Epoch ms the window closes at. 0 when disarmed. */
28998
+ armedUntilMs: number(),
28999
+ /** Ms left before it expires on its own. 0 when disarmed. */
29000
+ remainingMs: number(),
29001
+ /**
29002
+ * The cameras it is narrowed to, or `null` for every camera.
29003
+ *
29004
+ * A channel declared `perDevice: false` can only ever report `null` here:
29005
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29006
+ * produce a filter that silently matches nothing. The server REFUSES such a
29007
+ * patch rather than quietly widening it — ignoring the request would teach
29008
+ * the operator that per-camera filtering works on that channel when it does
29009
+ * not.
29010
+ */
29011
+ deviceIds: array(number().int()).readonly().nullable()
29012
+ });
29013
+ /**
29014
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29015
+ * for the same reason: a channel is a window with a deadline, never a switch.
29016
+ */
29017
+ var LogChannelWindowPatchSchema = object({
29018
+ channel: string().min(1),
29019
+ armMs: number().int().min(0),
29020
+ /**
29021
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29022
+ *
29023
+ * Numeric because the repo's own rule makes it possible: every log line
29024
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29025
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29026
+ * diagnosed by hand, and this is the first thing that collects on it.
29027
+ */
29028
+ deviceIds: array(number().int()).readonly().nullable().optional()
29029
+ });
29030
+ /**
28718
29031
  * A PATCH, and patches MERGE.
28719
29032
  *
28720
29033
  * A field absent from the patch is left exactly as it was — arming a
@@ -28733,7 +29046,14 @@ var LoggingSettingsPatchSchema = object({
28733
29046
  * Only the diagnostics NAMED here change. An armed window that is not listed
28734
29047
  * keeps running — a patch is never a full replacement.
28735
29048
  */
28736
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29049
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29050
+ /**
29051
+ * Only the channels NAMED here change. An armed channel that is not listed
29052
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29053
+ * disarmed the channels it did not mention would make the Levels page and
29054
+ * the Diagnostics page fight over the same value.
29055
+ */
29056
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28737
29057
  });
28738
29058
  /**
28739
29059
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28746,9 +29066,22 @@ var LoggingSettingsPatchSchema = object({
28746
29066
  * authority over the whole hierarchy and answers for every layer, so the
28747
29067
  * layer selector needs a name the transport does not already own.
28748
29068
  */
28749
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29069
+ var GetLoggingSettingsInputSchema = object({
29070
+ scopeNodeId: string().optional(),
29071
+ /**
29072
+ * The declared CHANNEL this document is addressed at, when the caller wants
29073
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29074
+ *
29075
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29076
+ * axes from collapsing: a component level is cluster-wide, a node level is
29077
+ * not, and one selector for both would make "which of these two did I just
29078
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29079
+ */
29080
+ scopeComponent: string().optional()
29081
+ });
28750
29082
  var SetLoggingSettingsInputSchema = object({
28751
29083
  scopeNodeId: string().optional(),
29084
+ scopeComponent: string().optional(),
28752
29085
  patch: LoggingSettingsPatchSchema
28753
29086
  });
28754
29087
  /**
@@ -28763,9 +29096,20 @@ var SetLoggingSettingsInputSchema = object({
28763
29096
  var LoggingSettingsStateSchema = object({
28764
29097
  /** The layer this document was read at. `null` = the cluster layer. */
28765
29098
  scopeNodeId: string().nullable(),
29099
+ /** The channel this document was read at. `null` = no component layer. */
29100
+ scopeComponent: string().nullable(),
28766
29101
  effective: LoggingEffectiveSchema,
28767
29102
  explicit: LoggingExplicitSchema,
28768
29103
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29104
+ /**
29105
+ * Every channel the cluster's addons DECLARE, gathered from the
29106
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29107
+ * channel added by a redeployed addon appears without anybody editing a
29108
+ * list, and a channel whose addon is gone stops being offered.
29109
+ */
29110
+ channels: array(LogChannelDescriptorSchema).readonly(),
29111
+ /** The channels ARMED right now, each with its deadline. */
29112
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28769
29113
  persisted: boolean()
28770
29114
  });
28771
29115
  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(), {
@@ -31750,6 +32094,12 @@ Object.freeze({
31750
32094
  addonId: null,
31751
32095
  access: "view"
31752
32096
  },
32097
+ "dataStoreProvider.aggregate": {
32098
+ capName: "data-store-provider",
32099
+ capScope: "system",
32100
+ addonId: null,
32101
+ access: "view"
32102
+ },
31753
32103
  "dataStoreProvider.count": {
31754
32104
  capName: "data-store-provider",
31755
32105
  capScope: "system",
@@ -32164,6 +32514,12 @@ Object.freeze({
32164
32514
  addonId: null,
32165
32515
  access: "view"
32166
32516
  },
32517
+ "deviceManager.getChildrenBatch": {
32518
+ capName: "device-manager",
32519
+ capScope: "system",
32520
+ addonId: null,
32521
+ access: "view"
32522
+ },
32167
32523
  "deviceManager.getConfigSchema": {
32168
32524
  capName: "device-manager",
32169
32525
  capScope: "system",
@@ -33214,6 +33570,18 @@ Object.freeze({
33214
33570
  addonId: null,
33215
33571
  access: "create"
33216
33572
  },
33573
+ "logChannels.apply": {
33574
+ capName: "log-channels",
33575
+ capScope: "system",
33576
+ addonId: null,
33577
+ access: "create"
33578
+ },
33579
+ "logChannels.list": {
33580
+ capName: "log-channels",
33581
+ capScope: "system",
33582
+ addonId: null,
33583
+ access: "view"
33584
+ },
33217
33585
  "logDestination.query": {
33218
33586
  capName: "log-destination",
33219
33587
  capScope: "system",
@@ -35368,6 +35736,12 @@ Object.freeze({
35368
35736
  addonId: null,
35369
35737
  access: "create"
35370
35738
  },
35739
+ "settingsStore.aggregate": {
35740
+ capName: "settings-store",
35741
+ capScope: "system",
35742
+ addonId: null,
35743
+ access: "view"
35744
+ },
35371
35745
  "settingsStore.count": {
35372
35746
  capName: "settings-store",
35373
35747
  capScope: "system",
@@ -36947,6 +37321,11 @@ Object.freeze({
36947
37321
  form: "single",
36948
37322
  optional: false
36949
37323
  }],
37324
+ "deviceManager.getChildrenBatch": [{
37325
+ name: "parentDeviceIds",
37326
+ form: "array",
37327
+ optional: false
37328
+ }],
36950
37329
  "deviceManager.getConfigSchema": [{
36951
37330
  name: "deviceId",
36952
37331
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7479,6 +7479,111 @@ var CameraSwitchGroupSchema = object({
7479
7479
  fetchedAt: number()
7480
7480
  });
7481
7481
  /**
7482
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7483
+ * an addon declares its channels in.
7484
+ *
7485
+ * ## Two axes, deliberately separated
7486
+ *
7487
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7488
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7489
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7490
+ * and rots silently. So a channel is declared where it is consulted, and the
7491
+ * `log-channels` capability enumerates the declarations.
7492
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7493
+ * thing: the logging settings document on the `system` cap. Two authorities
7494
+ * over the values is the exact defect
7495
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7496
+ * remove; re-introducing it from the cure side would be grotesque.
7497
+ *
7498
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7499
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7500
+ * the hot path with a value somebody actually read, and by
7501
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7502
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7503
+ * disarmed one (D49).
7504
+ *
7505
+ * ## The canonical call shape
7506
+ *
7507
+ * ```ts
7508
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7509
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7510
+ * }
7511
+ * ```
7512
+ *
7513
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7514
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7515
+ * object literal is never constructed because it lives inside the branch. It
7516
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7517
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7518
+ * destination floor (measured at 1.93 ns/call when off).
7519
+ *
7520
+ * ## Why a channel emits at `info`
7521
+ *
7522
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7523
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7524
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7525
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7526
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7527
+ * emits at the channel's declared level, whose schema floor is `info`.
7528
+ */
7529
+ /**
7530
+ * The level a channel writes at once armed.
7531
+ *
7532
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7533
+ * not leave the process for Loki, and the whole point of arming a channel is
7534
+ * to read it later.
7535
+ */
7536
+ var LogChannelLevelSchema = _enum([
7537
+ "info",
7538
+ "warn",
7539
+ "error"
7540
+ ]);
7541
+ /**
7542
+ * What an addon declares about one channel. No value, no state — a
7543
+ * declaration is inert.
7544
+ */
7545
+ var LogChannelDescriptorSchema = object({
7546
+ /**
7547
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7548
+ * the addon's short name so an operator reading a channel list can tell who
7549
+ * owns it without a second lookup.
7550
+ */
7551
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7552
+ /** One sentence: what the operator will SEE after arming it. */
7553
+ description: string().min(1),
7554
+ /** The level its lines are emitted at. Never below `info`. */
7555
+ defaultLevel: LogChannelLevelSchema,
7556
+ /**
7557
+ * Whether this channel can be narrowed to a camera.
7558
+ *
7559
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7560
+ * consulted with the numeric device id, AND every line the channel admits
7561
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7562
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7563
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7564
+ * the body is the only way to filter.
7565
+ *
7566
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7567
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7568
+ * the operator narrows to one camera, sees nothing, and concludes the code
7569
+ * path was never taken.
7570
+ */
7571
+ perDevice: boolean()
7572
+ });
7573
+ /**
7574
+ * An armed window over one channel, as the document hands it to a mirror.
7575
+ *
7576
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7577
+ * expires by itself, which is the one failure a boolean cannot avoid.
7578
+ */
7579
+ var LogChannelWindowSchema = object({
7580
+ channel: string().min(1),
7581
+ /** Epoch ms the window closes at. */
7582
+ armedUntilMs: number(),
7583
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7584
+ deviceIds: array(number().int()).readonly().nullable()
7585
+ });
7586
+ /**
7482
7587
  * Ops-log — the durable, append-only operations audit shared by the
7483
7588
  * recordings and events management surfaces.
7484
7589
  *
@@ -11099,6 +11204,35 @@ var MutationFilterSchema = object({
11099
11204
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11100
11205
  whereNot: record(string(), unknown()).optional()
11101
11206
  });
11207
+ /**
11208
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11209
+ *
11210
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11211
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11212
+ * a `Record<column, op>` shape could not express.
11213
+ */
11214
+ var AggregateFieldSchema = object({
11215
+ /** Result key. */
11216
+ as: string().min(1),
11217
+ /** Column to aggregate. Must be a real column of a declared collection. */
11218
+ field: string().min(1),
11219
+ op: _enum([
11220
+ "sum",
11221
+ "min",
11222
+ "max"
11223
+ ])
11224
+ });
11225
+ /**
11226
+ * `COUNT(*)` plus one number per requested field.
11227
+ *
11228
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11229
+ * that really is 0 are different facts, and an accounting caller that renders
11230
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11231
+ */
11232
+ var AggregateResultSchema = object({
11233
+ count: number().int(),
11234
+ values: record(string(), number().nullable())
11235
+ });
11102
11236
  /** A single stored record: `{ id, data }`. */
11103
11237
  var SettingsRecordSchema = object({
11104
11238
  id: string(),
@@ -11183,6 +11317,11 @@ method(object({
11183
11317
  collection: string(),
11184
11318
  filter: QueryFilterSchema.optional()
11185
11319
  }), number()), method(object({
11320
+ namespace: string().optional(),
11321
+ collection: string(),
11322
+ fields: array(AggregateFieldSchema).readonly(),
11323
+ filter: QueryFilterSchema.optional()
11324
+ }), AggregateResultSchema), method(object({
11186
11325
  namespace: string().optional(),
11187
11326
  collection: string(),
11188
11327
  field: string(),
@@ -11299,6 +11438,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11299
11438
  collection: string(),
11300
11439
  filter: QueryFilterSchema.optional()
11301
11440
  }), number(), { auth: "admin" }), method(object({
11441
+ namespace: string().optional(),
11442
+ collection: string(),
11443
+ fields: array(AggregateFieldSchema).readonly(),
11444
+ filter: QueryFilterSchema.optional()
11445
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11302
11446
  namespace: string().optional(),
11303
11447
  collection: string(),
11304
11448
  field: string(),
@@ -12039,24 +12183,6 @@ var deviceProviderCapability = {
12039
12183
  })
12040
12184
  }
12041
12185
  };
12042
- /**
12043
- * Device Manager capability — hub-side singleton that unifies device persistence,
12044
- * live registry access, and all management operations into a single tRPC surface.
12045
- *
12046
- * Replaces:
12047
- * - `device-persistence` capability (persistence methods absorbed here)
12048
- * - `device-management.router.ts` (deleted in Phase 2)
12049
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12050
- *
12051
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12052
- * fork into separate processes but never run on remote cluster agents. Therefore:
12053
- * - No nodeId routing needed — this is a pure hub singleton.
12054
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12055
- * - No shadow registry or cross-node aggregation required.
12056
- *
12057
- * Forked workers register devices back to the hub via `ctx.devices`
12058
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12059
- */
12060
12186
  /** One child-placement directive on a container's `childLayout`. Structurally
12061
12187
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12062
12188
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12425,7 +12551,7 @@ method(object({
12425
12551
  * it answers today and the caller filters as it already does.
12426
12552
  */
12427
12553
  deviceIds: array(number()).optional()
12428
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12554
+ }), 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({
12429
12555
  mode: LinkedDevicesModeSchema,
12430
12556
  devices: array(LinkedDeviceSchema)
12431
12557
  })), 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({
@@ -13149,6 +13275,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13149
13275
  kind: "mutation",
13150
13276
  auth: "admin"
13151
13277
  });
13278
+ /**
13279
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13280
+ * through. It stores nothing.
13281
+ *
13282
+ * ## Why a capability at all, and why this shape
13283
+ *
13284
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13285
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13286
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13287
+ * fails, an operator just never sees the channel somebody added. So the list
13288
+ * is assembled from declarations at runtime.
13289
+ *
13290
+ * The shape is copied from `log-destination.cap.ts`, which already does
13291
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13292
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13293
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13294
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13295
+ * runner's declarations reach hub-main over the transport that already exists.
13296
+ * No new UDS message, no second registry.
13297
+ *
13298
+ * ## What it deliberately does NOT own
13299
+ *
13300
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13301
+ * ONE place: the logging settings document on the `system` cap
13302
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13303
+ * value is the defect the plan behind this work exists to remove, and
13304
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13305
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13306
+ * setter for a window and no persistence of any kind.
13307
+ *
13308
+ * ## Why `apply` is here even so
13309
+ *
13310
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13311
+ * seam has to carry the value from the authority to the mirror, and a channel
13312
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13313
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13314
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13315
+ * persists nothing, it is never the source of a value, and it is called only
13316
+ * with a set the hub actually read (D49 — a read that fails does not call it
13317
+ * at all, so no channel is silently disarmed by a bad read).
13318
+ */
13319
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13320
+ var LogChannelApplyResultSchema = object({
13321
+ /** How many declared channels are armed in this process after the call. */
13322
+ armed: number().int().min(0),
13323
+ /**
13324
+ * Names the document armed that this process does not declare. Reported
13325
+ * rather than swallowed: a name here is either a typo or an addon that has
13326
+ * not booted, and both deserve a line instead of silence.
13327
+ */
13328
+ unknown: array(string()).readonly()
13329
+ });
13330
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13152
13331
  var LogLevelSchema = _enum([
13153
13332
  "debug",
13154
13333
  "info",
@@ -28543,17 +28722,60 @@ var SetSiteLocationInputSchema = object({
28543
28722
  longitude: number().min(-180).max(180)
28544
28723
  }).nullable();
28545
28724
  /**
28546
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28725
+ * The TRANSPORT a call arrived on.
28726
+ *
28727
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28728
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28729
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28730
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28731
+ * checkable rather than asserted.
28732
+ *
28733
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28734
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28735
+ * connection; the viewer talks to the hub over `wsLink`
28736
+ * exclusively, so this is the plane the HTTP census could not see.
28737
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28738
+ * never touches a socket and therefore never touched a census.
28739
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28740
+ * that is exactly what its `0` asserts: every plane the hub has can name
28741
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28742
+ * plane nobody instrumented lands here instead of vanishing from the total.
28743
+ */
28744
+ var TransportPlaneSchema = _enum([
28745
+ "http",
28746
+ "ws",
28747
+ "mesh",
28748
+ "unknown"
28749
+ ]);
28750
+ /**
28751
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28752
+ * reads as "not instrumented", which is the one thing this census must never
28753
+ * make an operator wonder about.
28754
+ */
28755
+ var TransportPlaneCountsSchema = object({
28756
+ http: number(),
28757
+ ws: number(),
28758
+ mesh: number(),
28759
+ unknown: number()
28760
+ });
28761
+ /**
28762
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28547
28763
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28548
28764
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28549
28765
  * already prints - never a token, never an `Authorization` header.
28766
+ *
28767
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28768
+ * and lives for hours, so folding it into a call count makes one long-lived
28769
+ * stream look like a storm.
28550
28770
  */
28551
28771
  var RequestCensusGroupSchema = object({
28772
+ plane: TransportPlaneSchema,
28552
28773
  procedure: string(),
28553
28774
  userAgent: string(),
28554
28775
  ip: string(),
28555
28776
  principal: string(),
28556
28777
  calls: number(),
28778
+ subscriptions: number(),
28557
28779
  perMin: number()
28558
28780
  });
28559
28781
  /**
@@ -28566,6 +28788,14 @@ var RequestCensusGroupSchema = object({
28566
28788
  var RequestCensusProcedureSchema = object({
28567
28789
  procedure: string(),
28568
28790
  calls: number(),
28791
+ /**
28792
+ * The same total, split by transport. THIS is the row that answers the
28793
+ * question the census exists for: one look at `deviceManager.listAll` says
28794
+ * which plane carried the 4 960, without joining two log lines by eye.
28795
+ */
28796
+ planes: TransportPlaneCountsSchema,
28797
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28798
+ subscriptions: number(),
28569
28799
  perMin: number()
28570
28800
  });
28571
28801
  /**
@@ -28593,14 +28823,45 @@ var RequestCensusStatusSchema = object({
28593
28823
  */
28594
28824
  procedureCalls: number(),
28595
28825
  /**
28826
+ * `procedureCalls` split by transport. The four keys sum to
28827
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28828
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28829
+ */
28830
+ planes: TransportPlaneCountsSchema,
28831
+ /**
28832
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28833
+ * on no plane at all - which is a RESULT (a plane is missing from the
28834
+ * instrument), not a failure, and it has to be visible to be read as one.
28835
+ */
28836
+ planesExplainTotal: boolean(),
28837
+ /**
28596
28838
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28597
- * transport resolves one context per connection - but the number that says
28598
- * whether a plane this census cannot see was busy while HTTP was quiet.
28839
+ * adapter resolves one context per connection - kept because a plane's call
28840
+ * count of zero against 37 open connections says something different from a
28841
+ * plane with no connections at all.
28599
28842
  */
28600
28843
  wsConnections: number(),
28844
+ /**
28845
+ * Client frames the WS plane looked at. `wsMessages` far above
28846
+ * `planes.ws + subscriptions` means most traffic is not operations
28847
+ * (keepalives, connection params) - which is itself an answer.
28848
+ */
28849
+ wsMessages: number(),
28850
+ /**
28851
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28852
+ * purpose: one live-events stream opened at boot and held for six hours is
28853
+ * one subscription, and counting it as a call would let a quiet plane
28854
+ * masquerade as the storm.
28855
+ */
28856
+ subscriptions: number(),
28857
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28858
+ subscriptionStops: number(),
28601
28859
  distinctGroups: number(),
28602
- /** Calls counted in the totals whose group attribution was shed at the
28603
- * cardinality bound. */
28860
+ /**
28861
+ * Operations counted in the totals whose CALLER attribution was shed at the
28862
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28863
+ * which transport they arrived on, they just lost their group row.
28864
+ */
28604
28865
  unattributedCalls: number(),
28605
28866
  procedures: array(RequestCensusProcedureSchema).readonly(),
28606
28867
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28623,10 +28884,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28623
28884
  * The layers of the level hierarchy, general → specific. The most specific
28624
28885
  * layer that carries an explicit value wins.
28625
28886
  *
28626
- * `component` is DECLARED and not yet resolvable: the per-component channels
28627
- * are a later slice of the same plan, and a `levelSource` enum that has to
28628
- * grow later would force every consumer of this document to change with it.
28629
- * Nothing returns `component` today.
28887
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28888
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28889
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28890
+ * that turning it on would not force every consumer of this document to widen
28891
+ * a `levelSource` enum — which is what has now not happened.
28630
28892
  */
28631
28893
  var LoggingScopeKindSchema = _enum([
28632
28894
  "cluster",
@@ -28653,6 +28915,14 @@ var LoggingLevelLayerSchema = object({
28653
28915
  scope: LoggingScopeKindSchema,
28654
28916
  /** The node this layer speaks for; `null` on the cluster layer. */
28655
28917
  nodeId: string().nullable(),
28918
+ /**
28919
+ * The declared channel this layer speaks for; `null` on every layer but
28920
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28921
+ * by design — the convention this repo settled on is one orchestrator-wide
28922
+ * setting, never per node (D52) — so a component layer that carried a node
28923
+ * would invite a per-node copy of a value that has no per-node meaning.
28924
+ */
28925
+ component: string().nullable(),
28656
28926
  /** Explicitly set here, or `null` when this layer inherits. */
28657
28927
  level: LogLevelSchema$1.nullable()
28658
28928
  });
@@ -28694,6 +28964,49 @@ var DiagnosticWindowPatchSchema = object({
28694
28964
  reportEveryMs: number().int().positive().optional()
28695
28965
  });
28696
28966
  /**
28967
+ * A channel ARMED, as the document reports it.
28968
+ *
28969
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28970
+ * and the time left, because a diagnostic left running is itself an incident
28971
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28972
+ */
28973
+ var LogChannelWindowStateSchema = object({
28974
+ channel: string(),
28975
+ armed: boolean(),
28976
+ /** Epoch ms the window closes at. 0 when disarmed. */
28977
+ armedUntilMs: number(),
28978
+ /** Ms left before it expires on its own. 0 when disarmed. */
28979
+ remainingMs: number(),
28980
+ /**
28981
+ * The cameras it is narrowed to, or `null` for every camera.
28982
+ *
28983
+ * A channel declared `perDevice: false` can only ever report `null` here:
28984
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28985
+ * produce a filter that silently matches nothing. The server REFUSES such a
28986
+ * patch rather than quietly widening it — ignoring the request would teach
28987
+ * the operator that per-camera filtering works on that channel when it does
28988
+ * not.
28989
+ */
28990
+ deviceIds: array(number().int()).readonly().nullable()
28991
+ });
28992
+ /**
28993
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28994
+ * for the same reason: a channel is a window with a deadline, never a switch.
28995
+ */
28996
+ var LogChannelWindowPatchSchema = object({
28997
+ channel: string().min(1),
28998
+ armMs: number().int().min(0),
28999
+ /**
29000
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29001
+ *
29002
+ * Numeric because the repo's own rule makes it possible: every log line
29003
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29004
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29005
+ * diagnosed by hand, and this is the first thing that collects on it.
29006
+ */
29007
+ deviceIds: array(number().int()).readonly().nullable().optional()
29008
+ });
29009
+ /**
28697
29010
  * A PATCH, and patches MERGE.
28698
29011
  *
28699
29012
  * A field absent from the patch is left exactly as it was — arming a
@@ -28712,7 +29025,14 @@ var LoggingSettingsPatchSchema = object({
28712
29025
  * Only the diagnostics NAMED here change. An armed window that is not listed
28713
29026
  * keeps running — a patch is never a full replacement.
28714
29027
  */
28715
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29028
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29029
+ /**
29030
+ * Only the channels NAMED here change. An armed channel that is not listed
29031
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29032
+ * disarmed the channels it did not mention would make the Levels page and
29033
+ * the Diagnostics page fight over the same value.
29034
+ */
29035
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28716
29036
  });
28717
29037
  /**
28718
29038
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28725,9 +29045,22 @@ var LoggingSettingsPatchSchema = object({
28725
29045
  * authority over the whole hierarchy and answers for every layer, so the
28726
29046
  * layer selector needs a name the transport does not already own.
28727
29047
  */
28728
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29048
+ var GetLoggingSettingsInputSchema = object({
29049
+ scopeNodeId: string().optional(),
29050
+ /**
29051
+ * The declared CHANNEL this document is addressed at, when the caller wants
29052
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29053
+ *
29054
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29055
+ * axes from collapsing: a component level is cluster-wide, a node level is
29056
+ * not, and one selector for both would make "which of these two did I just
29057
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29058
+ */
29059
+ scopeComponent: string().optional()
29060
+ });
28729
29061
  var SetLoggingSettingsInputSchema = object({
28730
29062
  scopeNodeId: string().optional(),
29063
+ scopeComponent: string().optional(),
28731
29064
  patch: LoggingSettingsPatchSchema
28732
29065
  });
28733
29066
  /**
@@ -28742,9 +29075,20 @@ var SetLoggingSettingsInputSchema = object({
28742
29075
  var LoggingSettingsStateSchema = object({
28743
29076
  /** The layer this document was read at. `null` = the cluster layer. */
28744
29077
  scopeNodeId: string().nullable(),
29078
+ /** The channel this document was read at. `null` = no component layer. */
29079
+ scopeComponent: string().nullable(),
28745
29080
  effective: LoggingEffectiveSchema,
28746
29081
  explicit: LoggingExplicitSchema,
28747
29082
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29083
+ /**
29084
+ * Every channel the cluster's addons DECLARE, gathered from the
29085
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29086
+ * channel added by a redeployed addon appears without anybody editing a
29087
+ * list, and a channel whose addon is gone stops being offered.
29088
+ */
29089
+ channels: array(LogChannelDescriptorSchema).readonly(),
29090
+ /** The channels ARMED right now, each with its deadline. */
29091
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28748
29092
  persisted: boolean()
28749
29093
  });
28750
29094
  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(), {
@@ -31729,6 +32073,12 @@ Object.freeze({
31729
32073
  addonId: null,
31730
32074
  access: "view"
31731
32075
  },
32076
+ "dataStoreProvider.aggregate": {
32077
+ capName: "data-store-provider",
32078
+ capScope: "system",
32079
+ addonId: null,
32080
+ access: "view"
32081
+ },
31732
32082
  "dataStoreProvider.count": {
31733
32083
  capName: "data-store-provider",
31734
32084
  capScope: "system",
@@ -32143,6 +32493,12 @@ Object.freeze({
32143
32493
  addonId: null,
32144
32494
  access: "view"
32145
32495
  },
32496
+ "deviceManager.getChildrenBatch": {
32497
+ capName: "device-manager",
32498
+ capScope: "system",
32499
+ addonId: null,
32500
+ access: "view"
32501
+ },
32146
32502
  "deviceManager.getConfigSchema": {
32147
32503
  capName: "device-manager",
32148
32504
  capScope: "system",
@@ -33193,6 +33549,18 @@ Object.freeze({
33193
33549
  addonId: null,
33194
33550
  access: "create"
33195
33551
  },
33552
+ "logChannels.apply": {
33553
+ capName: "log-channels",
33554
+ capScope: "system",
33555
+ addonId: null,
33556
+ access: "create"
33557
+ },
33558
+ "logChannels.list": {
33559
+ capName: "log-channels",
33560
+ capScope: "system",
33561
+ addonId: null,
33562
+ access: "view"
33563
+ },
33196
33564
  "logDestination.query": {
33197
33565
  capName: "log-destination",
33198
33566
  capScope: "system",
@@ -35347,6 +35715,12 @@ Object.freeze({
35347
35715
  addonId: null,
35348
35716
  access: "create"
35349
35717
  },
35718
+ "settingsStore.aggregate": {
35719
+ capName: "settings-store",
35720
+ capScope: "system",
35721
+ addonId: null,
35722
+ access: "view"
35723
+ },
35350
35724
  "settingsStore.count": {
35351
35725
  capName: "settings-store",
35352
35726
  capScope: "system",
@@ -36926,6 +37300,11 @@ Object.freeze({
36926
37300
  form: "single",
36927
37301
  optional: false
36928
37302
  }],
37303
+ "deviceManager.getChildrenBatch": [{
37304
+ name: "parentDeviceIds",
37305
+ form: "array",
37306
+ optional: false
37307
+ }],
36929
37308
  "deviceManager.getConfigSchema": [{
36930
37309
  name: "deviceId",
36931
37310
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-wyze",
3
- "version": "0.2.36",
3
+ "version": "0.2.38",
4
4
  "description": "Wyze camera device-provider addon for CamStack — wraps the @apocaliss92/wyze-bridge-js P2P/DTLS client, feeding the stream-broker via the pull-rfc4571 lazy-publish path (a structural twin of addon-provider-reolink)",
5
5
  "keywords": [
6
6
  "camstack",