@camstack/addon-provider-petkit 0.2.32 → 0.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +409 -30
  2. package/dist/addon.mjs +409 -30
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8570,6 +8570,111 @@ var CameraSwitchGroupSchema = object({
8570
8570
  fetchedAt: number()
8571
8571
  });
8572
8572
  /**
8573
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8574
+ * an addon declares its channels in.
8575
+ *
8576
+ * ## Two axes, deliberately separated
8577
+ *
8578
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8579
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8580
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8581
+ * and rots silently. So a channel is declared where it is consulted, and the
8582
+ * `log-channels` capability enumerates the declarations.
8583
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8584
+ * thing: the logging settings document on the `system` cap. Two authorities
8585
+ * over the values is the exact defect
8586
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8587
+ * remove; re-introducing it from the cure side would be grotesque.
8588
+ *
8589
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8590
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8591
+ * the hot path with a value somebody actually read, and by
8592
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8593
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8594
+ * disarmed one (D49).
8595
+ *
8596
+ * ## The canonical call shape
8597
+ *
8598
+ * ```ts
8599
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8600
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8601
+ * }
8602
+ * ```
8603
+ *
8604
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8605
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8606
+ * object literal is never constructed because it lives inside the branch. It
8607
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8608
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8609
+ * destination floor (measured at 1.93 ns/call when off).
8610
+ *
8611
+ * ## Why a channel emits at `info`
8612
+ *
8613
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8614
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8615
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8616
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8617
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8618
+ * emits at the channel's declared level, whose schema floor is `info`.
8619
+ */
8620
+ /**
8621
+ * The level a channel writes at once armed.
8622
+ *
8623
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8624
+ * not leave the process for Loki, and the whole point of arming a channel is
8625
+ * to read it later.
8626
+ */
8627
+ var LogChannelLevelSchema = _enum([
8628
+ "info",
8629
+ "warn",
8630
+ "error"
8631
+ ]);
8632
+ /**
8633
+ * What an addon declares about one channel. No value, no state — a
8634
+ * declaration is inert.
8635
+ */
8636
+ var LogChannelDescriptorSchema = object({
8637
+ /**
8638
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8639
+ * the addon's short name so an operator reading a channel list can tell who
8640
+ * owns it without a second lookup.
8641
+ */
8642
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8643
+ /** One sentence: what the operator will SEE after arming it. */
8644
+ description: string().min(1),
8645
+ /** The level its lines are emitted at. Never below `info`. */
8646
+ defaultLevel: LogChannelLevelSchema,
8647
+ /**
8648
+ * Whether this channel can be narrowed to a camera.
8649
+ *
8650
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8651
+ * consulted with the numeric device id, AND every line the channel admits
8652
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8653
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8654
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8655
+ * the body is the only way to filter.
8656
+ *
8657
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8658
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8659
+ * the operator narrows to one camera, sees nothing, and concludes the code
8660
+ * path was never taken.
8661
+ */
8662
+ perDevice: boolean()
8663
+ });
8664
+ /**
8665
+ * An armed window over one channel, as the document hands it to a mirror.
8666
+ *
8667
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8668
+ * expires by itself, which is the one failure a boolean cannot avoid.
8669
+ */
8670
+ var LogChannelWindowSchema = object({
8671
+ channel: string().min(1),
8672
+ /** Epoch ms the window closes at. */
8673
+ armedUntilMs: number(),
8674
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8675
+ deviceIds: array(number().int()).readonly().nullable()
8676
+ });
8677
+ /**
8573
8678
  * Ops-log — the durable, append-only operations audit shared by the
8574
8679
  * recordings and events management surfaces.
8575
8680
  *
@@ -12190,6 +12295,35 @@ var MutationFilterSchema = object({
12190
12295
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
12191
12296
  whereNot: record(string(), unknown()).optional()
12192
12297
  });
12298
+ /**
12299
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
12300
+ *
12301
+ * `as` names the slot in the result, so the SAME column may be asked twice with
12302
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
12303
+ * a `Record<column, op>` shape could not express.
12304
+ */
12305
+ var AggregateFieldSchema = object({
12306
+ /** Result key. */
12307
+ as: string().min(1),
12308
+ /** Column to aggregate. Must be a real column of a declared collection. */
12309
+ field: string().min(1),
12310
+ op: _enum([
12311
+ "sum",
12312
+ "min",
12313
+ "max"
12314
+ ])
12315
+ });
12316
+ /**
12317
+ * `COUNT(*)` plus one number per requested field.
12318
+ *
12319
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
12320
+ * that really is 0 are different facts, and an accounting caller that renders
12321
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
12322
+ */
12323
+ var AggregateResultSchema = object({
12324
+ count: number().int(),
12325
+ values: record(string(), number().nullable())
12326
+ });
12193
12327
  /** A single stored record: `{ id, data }`. */
12194
12328
  var SettingsRecordSchema = object({
12195
12329
  id: string(),
@@ -12274,6 +12408,11 @@ method(object({
12274
12408
  collection: string(),
12275
12409
  filter: QueryFilterSchema.optional()
12276
12410
  }), number()), method(object({
12411
+ namespace: string().optional(),
12412
+ collection: string(),
12413
+ fields: array(AggregateFieldSchema).readonly(),
12414
+ filter: QueryFilterSchema.optional()
12415
+ }), AggregateResultSchema), method(object({
12277
12416
  namespace: string().optional(),
12278
12417
  collection: string(),
12279
12418
  field: string(),
@@ -12390,6 +12529,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12390
12529
  collection: string(),
12391
12530
  filter: QueryFilterSchema.optional()
12392
12531
  }), number(), { auth: "admin" }), method(object({
12532
+ namespace: string().optional(),
12533
+ collection: string(),
12534
+ fields: array(AggregateFieldSchema).readonly(),
12535
+ filter: QueryFilterSchema.optional()
12536
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
12393
12537
  namespace: string().optional(),
12394
12538
  collection: string(),
12395
12539
  field: string(),
@@ -13130,24 +13274,6 @@ var deviceProviderCapability = {
13130
13274
  })
13131
13275
  }
13132
13276
  };
13133
- /**
13134
- * Device Manager capability — hub-side singleton that unifies device persistence,
13135
- * live registry access, and all management operations into a single tRPC surface.
13136
- *
13137
- * Replaces:
13138
- * - `device-persistence` capability (persistence methods absorbed here)
13139
- * - `device-management.router.ts` (deleted in Phase 2)
13140
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
13141
- *
13142
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
13143
- * fork into separate processes but never run on remote cluster agents. Therefore:
13144
- * - No nodeId routing needed — this is a pure hub singleton.
13145
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
13146
- * - No shadow registry or cross-node aggregation required.
13147
- *
13148
- * Forked workers register devices back to the hub via `ctx.devices`
13149
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
13150
- */
13151
13277
  /** One child-placement directive on a container's `childLayout`. Structurally
13152
13278
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
13153
13279
  * shape for the same field. The child is identified by its re-sync-stable
@@ -13516,7 +13642,7 @@ method(object({
13516
13642
  * it answers today and the caller filters as it already does.
13517
13643
  */
13518
13644
  deviceIds: array(number()).optional()
13519
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
13645
+ }), 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({
13520
13646
  mode: LinkedDevicesModeSchema,
13521
13647
  devices: array(LinkedDeviceSchema)
13522
13648
  })), 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({
@@ -14240,6 +14366,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14240
14366
  kind: "mutation",
14241
14367
  auth: "admin"
14242
14368
  });
14369
+ /**
14370
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
14371
+ * through. It stores nothing.
14372
+ *
14373
+ * ## Why a capability at all, and why this shape
14374
+ *
14375
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
14376
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
14377
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
14378
+ * fails, an operator just never sees the channel somebody added. So the list
14379
+ * is assembled from declarations at runtime.
14380
+ *
14381
+ * The shape is copied from `log-destination.cap.ts`, which already does
14382
+ * exactly this job: `mode: 'collection'`, `internal: true`,
14383
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
14384
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
14385
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
14386
+ * runner's declarations reach hub-main over the transport that already exists.
14387
+ * No new UDS message, no second registry.
14388
+ *
14389
+ * ## What it deliberately does NOT own
14390
+ *
14391
+ * The VALUES — which channel is armed, for which cameras, until when — live in
14392
+ * ONE place: the logging settings document on the `system` cap
14393
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
14394
+ * value is the defect the plan behind this work exists to remove, and
14395
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
14396
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
14397
+ * setter for a window and no persistence of any kind.
14398
+ *
14399
+ * ## Why `apply` is here even so
14400
+ *
14401
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
14402
+ * seam has to carry the value from the authority to the mirror, and a channel
14403
+ * that cannot be reached is precisely the dead knob this whole slice exists to
14404
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
14405
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
14406
+ * persists nothing, it is never the source of a value, and it is called only
14407
+ * with a set the hub actually read (D49 — a read that fails does not call it
14408
+ * at all, so no channel is silently disarmed by a bad read).
14409
+ */
14410
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
14411
+ var LogChannelApplyResultSchema = object({
14412
+ /** How many declared channels are armed in this process after the call. */
14413
+ armed: number().int().min(0),
14414
+ /**
14415
+ * Names the document armed that this process does not declare. Reported
14416
+ * rather than swallowed: a name here is either a typo or an addon that has
14417
+ * not booted, and both deserve a line instead of silence.
14418
+ */
14419
+ unknown: array(string()).readonly()
14420
+ });
14421
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
14243
14422
  var LogLevelSchema = _enum([
14244
14423
  "debug",
14245
14424
  "info",
@@ -29530,17 +29709,60 @@ var SetSiteLocationInputSchema = object({
29530
29709
  longitude: number().min(-180).max(180)
29531
29710
  }).nullable();
29532
29711
  /**
29533
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29712
+ * The TRANSPORT a call arrived on.
29713
+ *
29714
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29715
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29716
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29717
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29718
+ * checkable rather than asserted.
29719
+ *
29720
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29721
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29722
+ * connection; the viewer talks to the hub over `wsLink`
29723
+ * exclusively, so this is the plane the HTTP census could not see.
29724
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29725
+ * never touches a socket and therefore never touched a census.
29726
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29727
+ * that is exactly what its `0` asserts: every plane the hub has can name
29728
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29729
+ * plane nobody instrumented lands here instead of vanishing from the total.
29730
+ */
29731
+ var TransportPlaneSchema = _enum([
29732
+ "http",
29733
+ "ws",
29734
+ "mesh",
29735
+ "unknown"
29736
+ ]);
29737
+ /**
29738
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29739
+ * reads as "not instrumented", which is the one thing this census must never
29740
+ * make an operator wonder about.
29741
+ */
29742
+ var TransportPlaneCountsSchema = object({
29743
+ http: number(),
29744
+ ws: number(),
29745
+ mesh: number(),
29746
+ unknown: number()
29747
+ });
29748
+ /**
29749
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29534
29750
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29535
29751
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29536
29752
  * already prints - never a token, never an `Authorization` header.
29753
+ *
29754
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29755
+ * and lives for hours, so folding it into a call count makes one long-lived
29756
+ * stream look like a storm.
29537
29757
  */
29538
29758
  var RequestCensusGroupSchema = object({
29759
+ plane: TransportPlaneSchema,
29539
29760
  procedure: string(),
29540
29761
  userAgent: string(),
29541
29762
  ip: string(),
29542
29763
  principal: string(),
29543
29764
  calls: number(),
29765
+ subscriptions: number(),
29544
29766
  perMin: number()
29545
29767
  });
29546
29768
  /**
@@ -29553,6 +29775,14 @@ var RequestCensusGroupSchema = object({
29553
29775
  var RequestCensusProcedureSchema = object({
29554
29776
  procedure: string(),
29555
29777
  calls: number(),
29778
+ /**
29779
+ * The same total, split by transport. THIS is the row that answers the
29780
+ * question the census exists for: one look at `deviceManager.listAll` says
29781
+ * which plane carried the 4 960, without joining two log lines by eye.
29782
+ */
29783
+ planes: TransportPlaneCountsSchema,
29784
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29785
+ subscriptions: number(),
29556
29786
  perMin: number()
29557
29787
  });
29558
29788
  /**
@@ -29580,14 +29810,45 @@ var RequestCensusStatusSchema = object({
29580
29810
  */
29581
29811
  procedureCalls: number(),
29582
29812
  /**
29813
+ * `procedureCalls` split by transport. The four keys sum to
29814
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29815
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29816
+ */
29817
+ planes: TransportPlaneCountsSchema,
29818
+ /**
29819
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29820
+ * on no plane at all - which is a RESULT (a plane is missing from the
29821
+ * instrument), not a failure, and it has to be visible to be read as one.
29822
+ */
29823
+ planesExplainTotal: boolean(),
29824
+ /**
29583
29825
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
29584
- * transport resolves one context per connection - but the number that says
29585
- * whether a plane this census cannot see was busy while HTTP was quiet.
29826
+ * adapter resolves one context per connection - kept because a plane's call
29827
+ * count of zero against 37 open connections says something different from a
29828
+ * plane with no connections at all.
29586
29829
  */
29587
29830
  wsConnections: number(),
29831
+ /**
29832
+ * Client frames the WS plane looked at. `wsMessages` far above
29833
+ * `planes.ws + subscriptions` means most traffic is not operations
29834
+ * (keepalives, connection params) - which is itself an answer.
29835
+ */
29836
+ wsMessages: number(),
29837
+ /**
29838
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29839
+ * purpose: one live-events stream opened at boot and held for six hours is
29840
+ * one subscription, and counting it as a call would let a quiet plane
29841
+ * masquerade as the storm.
29842
+ */
29843
+ subscriptions: number(),
29844
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29845
+ subscriptionStops: number(),
29588
29846
  distinctGroups: number(),
29589
- /** Calls counted in the totals whose group attribution was shed at the
29590
- * cardinality bound. */
29847
+ /**
29848
+ * Operations counted in the totals whose CALLER attribution was shed at the
29849
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29850
+ * which transport they arrived on, they just lost their group row.
29851
+ */
29591
29852
  unattributedCalls: number(),
29592
29853
  procedures: array(RequestCensusProcedureSchema).readonly(),
29593
29854
  groups: array(RequestCensusGroupSchema).readonly()
@@ -29610,10 +29871,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
29610
29871
  * The layers of the level hierarchy, general → specific. The most specific
29611
29872
  * layer that carries an explicit value wins.
29612
29873
  *
29613
- * `component` is DECLARED and not yet resolvable: the per-component channels
29614
- * are a later slice of the same plan, and a `levelSource` enum that has to
29615
- * grow later would force every consumer of this document to change with it.
29616
- * Nothing returns `component` today.
29874
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29875
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29876
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29877
+ * that turning it on would not force every consumer of this document to widen
29878
+ * a `levelSource` enum — which is what has now not happened.
29617
29879
  */
29618
29880
  var LoggingScopeKindSchema = _enum([
29619
29881
  "cluster",
@@ -29640,6 +29902,14 @@ var LoggingLevelLayerSchema = object({
29640
29902
  scope: LoggingScopeKindSchema,
29641
29903
  /** The node this layer speaks for; `null` on the cluster layer. */
29642
29904
  nodeId: string().nullable(),
29905
+ /**
29906
+ * The declared channel this layer speaks for; `null` on every layer but
29907
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29908
+ * by design — the convention this repo settled on is one orchestrator-wide
29909
+ * setting, never per node (D52) — so a component layer that carried a node
29910
+ * would invite a per-node copy of a value that has no per-node meaning.
29911
+ */
29912
+ component: string().nullable(),
29643
29913
  /** Explicitly set here, or `null` when this layer inherits. */
29644
29914
  level: LogLevelSchema$1.nullable()
29645
29915
  });
@@ -29681,6 +29951,49 @@ var DiagnosticWindowPatchSchema = object({
29681
29951
  reportEveryMs: number().int().positive().optional()
29682
29952
  });
29683
29953
  /**
29954
+ * A channel ARMED, as the document reports it.
29955
+ *
29956
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29957
+ * and the time left, because a diagnostic left running is itself an incident
29958
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29959
+ */
29960
+ var LogChannelWindowStateSchema = object({
29961
+ channel: string(),
29962
+ armed: boolean(),
29963
+ /** Epoch ms the window closes at. 0 when disarmed. */
29964
+ armedUntilMs: number(),
29965
+ /** Ms left before it expires on its own. 0 when disarmed. */
29966
+ remainingMs: number(),
29967
+ /**
29968
+ * The cameras it is narrowed to, or `null` for every camera.
29969
+ *
29970
+ * A channel declared `perDevice: false` can only ever report `null` here:
29971
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29972
+ * produce a filter that silently matches nothing. The server REFUSES such a
29973
+ * patch rather than quietly widening it — ignoring the request would teach
29974
+ * the operator that per-camera filtering works on that channel when it does
29975
+ * not.
29976
+ */
29977
+ deviceIds: array(number().int()).readonly().nullable()
29978
+ });
29979
+ /**
29980
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29981
+ * for the same reason: a channel is a window with a deadline, never a switch.
29982
+ */
29983
+ var LogChannelWindowPatchSchema = object({
29984
+ channel: string().min(1),
29985
+ armMs: number().int().min(0),
29986
+ /**
29987
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29988
+ *
29989
+ * Numeric because the repo's own rule makes it possible: every log line
29990
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29991
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29992
+ * diagnosed by hand, and this is the first thing that collects on it.
29993
+ */
29994
+ deviceIds: array(number().int()).readonly().nullable().optional()
29995
+ });
29996
+ /**
29684
29997
  * A PATCH, and patches MERGE.
29685
29998
  *
29686
29999
  * A field absent from the patch is left exactly as it was — arming a
@@ -29699,7 +30012,14 @@ var LoggingSettingsPatchSchema = object({
29699
30012
  * Only the diagnostics NAMED here change. An armed window that is not listed
29700
30013
  * keeps running — a patch is never a full replacement.
29701
30014
  */
29702
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
30015
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
30016
+ /**
30017
+ * Only the channels NAMED here change. An armed channel that is not listed
30018
+ * keeps running — same rule as `diagnostics`, because a patch that silently
30019
+ * disarmed the channels it did not mention would make the Levels page and
30020
+ * the Diagnostics page fight over the same value.
30021
+ */
30022
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
29703
30023
  });
29704
30024
  /**
29705
30025
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -29712,9 +30032,22 @@ var LoggingSettingsPatchSchema = object({
29712
30032
  * authority over the whole hierarchy and answers for every layer, so the
29713
30033
  * layer selector needs a name the transport does not already own.
29714
30034
  */
29715
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
30035
+ var GetLoggingSettingsInputSchema = object({
30036
+ scopeNodeId: string().optional(),
30037
+ /**
30038
+ * The declared CHANNEL this document is addressed at, when the caller wants
30039
+ * the `component` layer. Absent = the node/cluster hierarchy only.
30040
+ *
30041
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
30042
+ * axes from collapsing: a component level is cluster-wide, a node level is
30043
+ * not, and one selector for both would make "which of these two did I just
30044
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
30045
+ */
30046
+ scopeComponent: string().optional()
30047
+ });
29716
30048
  var SetLoggingSettingsInputSchema = object({
29717
30049
  scopeNodeId: string().optional(),
30050
+ scopeComponent: string().optional(),
29718
30051
  patch: LoggingSettingsPatchSchema
29719
30052
  });
29720
30053
  /**
@@ -29729,9 +30062,20 @@ var SetLoggingSettingsInputSchema = object({
29729
30062
  var LoggingSettingsStateSchema = object({
29730
30063
  /** The layer this document was read at. `null` = the cluster layer. */
29731
30064
  scopeNodeId: string().nullable(),
30065
+ /** The channel this document was read at. `null` = no component layer. */
30066
+ scopeComponent: string().nullable(),
29732
30067
  effective: LoggingEffectiveSchema,
29733
30068
  explicit: LoggingExplicitSchema,
29734
30069
  activeWindows: array(DiagnosticWindowSchema).readonly(),
30070
+ /**
30071
+ * Every channel the cluster's addons DECLARE, gathered from the
30072
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
30073
+ * channel added by a redeployed addon appears without anybody editing a
30074
+ * list, and a channel whose addon is gone stops being offered.
30075
+ */
30076
+ channels: array(LogChannelDescriptorSchema).readonly(),
30077
+ /** The channels ARMED right now, each with its deadline. */
30078
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
29735
30079
  persisted: boolean()
29736
30080
  });
29737
30081
  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(), {
@@ -32716,6 +33060,12 @@ Object.freeze({
32716
33060
  addonId: null,
32717
33061
  access: "view"
32718
33062
  },
33063
+ "dataStoreProvider.aggregate": {
33064
+ capName: "data-store-provider",
33065
+ capScope: "system",
33066
+ addonId: null,
33067
+ access: "view"
33068
+ },
32719
33069
  "dataStoreProvider.count": {
32720
33070
  capName: "data-store-provider",
32721
33071
  capScope: "system",
@@ -33130,6 +33480,12 @@ Object.freeze({
33130
33480
  addonId: null,
33131
33481
  access: "view"
33132
33482
  },
33483
+ "deviceManager.getChildrenBatch": {
33484
+ capName: "device-manager",
33485
+ capScope: "system",
33486
+ addonId: null,
33487
+ access: "view"
33488
+ },
33133
33489
  "deviceManager.getConfigSchema": {
33134
33490
  capName: "device-manager",
33135
33491
  capScope: "system",
@@ -34180,6 +34536,18 @@ Object.freeze({
34180
34536
  addonId: null,
34181
34537
  access: "create"
34182
34538
  },
34539
+ "logChannels.apply": {
34540
+ capName: "log-channels",
34541
+ capScope: "system",
34542
+ addonId: null,
34543
+ access: "create"
34544
+ },
34545
+ "logChannels.list": {
34546
+ capName: "log-channels",
34547
+ capScope: "system",
34548
+ addonId: null,
34549
+ access: "view"
34550
+ },
34183
34551
  "logDestination.query": {
34184
34552
  capName: "log-destination",
34185
34553
  capScope: "system",
@@ -36334,6 +36702,12 @@ Object.freeze({
36334
36702
  addonId: null,
36335
36703
  access: "create"
36336
36704
  },
36705
+ "settingsStore.aggregate": {
36706
+ capName: "settings-store",
36707
+ capScope: "system",
36708
+ addonId: null,
36709
+ access: "view"
36710
+ },
36337
36711
  "settingsStore.count": {
36338
36712
  capName: "settings-store",
36339
36713
  capScope: "system",
@@ -37913,6 +38287,11 @@ Object.freeze({
37913
38287
  form: "single",
37914
38288
  optional: false
37915
38289
  }],
38290
+ "deviceManager.getChildrenBatch": [{
38291
+ name: "parentDeviceIds",
38292
+ form: "array",
38293
+ optional: false
38294
+ }],
37916
38295
  "deviceManager.getConfigSchema": [{
37917
38296
  name: "deviceId",
37918
38297
  form: "single",
package/dist/addon.mjs CHANGED
@@ -8569,6 +8569,111 @@ var CameraSwitchGroupSchema = object({
8569
8569
  fetchedAt: number()
8570
8570
  });
8571
8571
  /**
8572
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8573
+ * an addon declares its channels in.
8574
+ *
8575
+ * ## Two axes, deliberately separated
8576
+ *
8577
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8578
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8579
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8580
+ * and rots silently. So a channel is declared where it is consulted, and the
8581
+ * `log-channels` capability enumerates the declarations.
8582
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8583
+ * thing: the logging settings document on the `system` cap. Two authorities
8584
+ * over the values is the exact defect
8585
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8586
+ * remove; re-introducing it from the cure side would be grotesque.
8587
+ *
8588
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8589
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8590
+ * the hot path with a value somebody actually read, and by
8591
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8592
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8593
+ * disarmed one (D49).
8594
+ *
8595
+ * ## The canonical call shape
8596
+ *
8597
+ * ```ts
8598
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8599
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8600
+ * }
8601
+ * ```
8602
+ *
8603
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8604
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8605
+ * object literal is never constructed because it lives inside the branch. It
8606
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8607
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8608
+ * destination floor (measured at 1.93 ns/call when off).
8609
+ *
8610
+ * ## Why a channel emits at `info`
8611
+ *
8612
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8613
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8614
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8615
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8616
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8617
+ * emits at the channel's declared level, whose schema floor is `info`.
8618
+ */
8619
+ /**
8620
+ * The level a channel writes at once armed.
8621
+ *
8622
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8623
+ * not leave the process for Loki, and the whole point of arming a channel is
8624
+ * to read it later.
8625
+ */
8626
+ var LogChannelLevelSchema = _enum([
8627
+ "info",
8628
+ "warn",
8629
+ "error"
8630
+ ]);
8631
+ /**
8632
+ * What an addon declares about one channel. No value, no state — a
8633
+ * declaration is inert.
8634
+ */
8635
+ var LogChannelDescriptorSchema = object({
8636
+ /**
8637
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8638
+ * the addon's short name so an operator reading a channel list can tell who
8639
+ * owns it without a second lookup.
8640
+ */
8641
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8642
+ /** One sentence: what the operator will SEE after arming it. */
8643
+ description: string().min(1),
8644
+ /** The level its lines are emitted at. Never below `info`. */
8645
+ defaultLevel: LogChannelLevelSchema,
8646
+ /**
8647
+ * Whether this channel can be narrowed to a camera.
8648
+ *
8649
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8650
+ * consulted with the numeric device id, AND every line the channel admits
8651
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8652
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8653
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8654
+ * the body is the only way to filter.
8655
+ *
8656
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8657
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8658
+ * the operator narrows to one camera, sees nothing, and concludes the code
8659
+ * path was never taken.
8660
+ */
8661
+ perDevice: boolean()
8662
+ });
8663
+ /**
8664
+ * An armed window over one channel, as the document hands it to a mirror.
8665
+ *
8666
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8667
+ * expires by itself, which is the one failure a boolean cannot avoid.
8668
+ */
8669
+ var LogChannelWindowSchema = object({
8670
+ channel: string().min(1),
8671
+ /** Epoch ms the window closes at. */
8672
+ armedUntilMs: number(),
8673
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8674
+ deviceIds: array(number().int()).readonly().nullable()
8675
+ });
8676
+ /**
8572
8677
  * Ops-log — the durable, append-only operations audit shared by the
8573
8678
  * recordings and events management surfaces.
8574
8679
  *
@@ -12189,6 +12294,35 @@ var MutationFilterSchema = object({
12189
12294
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
12190
12295
  whereNot: record(string(), unknown()).optional()
12191
12296
  });
12297
+ /**
12298
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
12299
+ *
12300
+ * `as` names the slot in the result, so the SAME column may be asked twice with
12301
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
12302
+ * a `Record<column, op>` shape could not express.
12303
+ */
12304
+ var AggregateFieldSchema = object({
12305
+ /** Result key. */
12306
+ as: string().min(1),
12307
+ /** Column to aggregate. Must be a real column of a declared collection. */
12308
+ field: string().min(1),
12309
+ op: _enum([
12310
+ "sum",
12311
+ "min",
12312
+ "max"
12313
+ ])
12314
+ });
12315
+ /**
12316
+ * `COUNT(*)` plus one number per requested field.
12317
+ *
12318
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
12319
+ * that really is 0 are different facts, and an accounting caller that renders
12320
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
12321
+ */
12322
+ var AggregateResultSchema = object({
12323
+ count: number().int(),
12324
+ values: record(string(), number().nullable())
12325
+ });
12192
12326
  /** A single stored record: `{ id, data }`. */
12193
12327
  var SettingsRecordSchema = object({
12194
12328
  id: string(),
@@ -12273,6 +12407,11 @@ method(object({
12273
12407
  collection: string(),
12274
12408
  filter: QueryFilterSchema.optional()
12275
12409
  }), number()), method(object({
12410
+ namespace: string().optional(),
12411
+ collection: string(),
12412
+ fields: array(AggregateFieldSchema).readonly(),
12413
+ filter: QueryFilterSchema.optional()
12414
+ }), AggregateResultSchema), method(object({
12276
12415
  namespace: string().optional(),
12277
12416
  collection: string(),
12278
12417
  field: string(),
@@ -12389,6 +12528,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12389
12528
  collection: string(),
12390
12529
  filter: QueryFilterSchema.optional()
12391
12530
  }), number(), { auth: "admin" }), method(object({
12531
+ namespace: string().optional(),
12532
+ collection: string(),
12533
+ fields: array(AggregateFieldSchema).readonly(),
12534
+ filter: QueryFilterSchema.optional()
12535
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
12392
12536
  namespace: string().optional(),
12393
12537
  collection: string(),
12394
12538
  field: string(),
@@ -13129,24 +13273,6 @@ var deviceProviderCapability = {
13129
13273
  })
13130
13274
  }
13131
13275
  };
13132
- /**
13133
- * Device Manager capability — hub-side singleton that unifies device persistence,
13134
- * live registry access, and all management operations into a single tRPC surface.
13135
- *
13136
- * Replaces:
13137
- * - `device-persistence` capability (persistence methods absorbed here)
13138
- * - `device-management.router.ts` (deleted in Phase 2)
13139
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
13140
- *
13141
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
13142
- * fork into separate processes but never run on remote cluster agents. Therefore:
13143
- * - No nodeId routing needed — this is a pure hub singleton.
13144
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
13145
- * - No shadow registry or cross-node aggregation required.
13146
- *
13147
- * Forked workers register devices back to the hub via `ctx.devices`
13148
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
13149
- */
13150
13276
  /** One child-placement directive on a container's `childLayout`. Structurally
13151
13277
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
13152
13278
  * shape for the same field. The child is identified by its re-sync-stable
@@ -13515,7 +13641,7 @@ method(object({
13515
13641
  * it answers today and the caller filters as it already does.
13516
13642
  */
13517
13643
  deviceIds: array(number()).optional()
13518
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
13644
+ }), 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({
13519
13645
  mode: LinkedDevicesModeSchema,
13520
13646
  devices: array(LinkedDeviceSchema)
13521
13647
  })), 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({
@@ -14239,6 +14365,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14239
14365
  kind: "mutation",
14240
14366
  auth: "admin"
14241
14367
  });
14368
+ /**
14369
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
14370
+ * through. It stores nothing.
14371
+ *
14372
+ * ## Why a capability at all, and why this shape
14373
+ *
14374
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
14375
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
14376
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
14377
+ * fails, an operator just never sees the channel somebody added. So the list
14378
+ * is assembled from declarations at runtime.
14379
+ *
14380
+ * The shape is copied from `log-destination.cap.ts`, which already does
14381
+ * exactly this job: `mode: 'collection'`, `internal: true`,
14382
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
14383
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
14384
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
14385
+ * runner's declarations reach hub-main over the transport that already exists.
14386
+ * No new UDS message, no second registry.
14387
+ *
14388
+ * ## What it deliberately does NOT own
14389
+ *
14390
+ * The VALUES — which channel is armed, for which cameras, until when — live in
14391
+ * ONE place: the logging settings document on the `system` cap
14392
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
14393
+ * value is the defect the plan behind this work exists to remove, and
14394
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
14395
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
14396
+ * setter for a window and no persistence of any kind.
14397
+ *
14398
+ * ## Why `apply` is here even so
14399
+ *
14400
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
14401
+ * seam has to carry the value from the authority to the mirror, and a channel
14402
+ * that cannot be reached is precisely the dead knob this whole slice exists to
14403
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
14404
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
14405
+ * persists nothing, it is never the source of a value, and it is called only
14406
+ * with a set the hub actually read (D49 — a read that fails does not call it
14407
+ * at all, so no channel is silently disarmed by a bad read).
14408
+ */
14409
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
14410
+ var LogChannelApplyResultSchema = object({
14411
+ /** How many declared channels are armed in this process after the call. */
14412
+ armed: number().int().min(0),
14413
+ /**
14414
+ * Names the document armed that this process does not declare. Reported
14415
+ * rather than swallowed: a name here is either a typo or an addon that has
14416
+ * not booted, and both deserve a line instead of silence.
14417
+ */
14418
+ unknown: array(string()).readonly()
14419
+ });
14420
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
14242
14421
  var LogLevelSchema = _enum([
14243
14422
  "debug",
14244
14423
  "info",
@@ -29529,17 +29708,60 @@ var SetSiteLocationInputSchema = object({
29529
29708
  longitude: number().min(-180).max(180)
29530
29709
  }).nullable();
29531
29710
  /**
29532
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29711
+ * The TRANSPORT a call arrived on.
29712
+ *
29713
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29714
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29715
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29716
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29717
+ * checkable rather than asserted.
29718
+ *
29719
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29720
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29721
+ * connection; the viewer talks to the hub over `wsLink`
29722
+ * exclusively, so this is the plane the HTTP census could not see.
29723
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29724
+ * never touches a socket and therefore never touched a census.
29725
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29726
+ * that is exactly what its `0` asserts: every plane the hub has can name
29727
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29728
+ * plane nobody instrumented lands here instead of vanishing from the total.
29729
+ */
29730
+ var TransportPlaneSchema = _enum([
29731
+ "http",
29732
+ "ws",
29733
+ "mesh",
29734
+ "unknown"
29735
+ ]);
29736
+ /**
29737
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29738
+ * reads as "not instrumented", which is the one thing this census must never
29739
+ * make an operator wonder about.
29740
+ */
29741
+ var TransportPlaneCountsSchema = object({
29742
+ http: number(),
29743
+ ws: number(),
29744
+ mesh: number(),
29745
+ unknown: number()
29746
+ });
29747
+ /**
29748
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29533
29749
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29534
29750
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29535
29751
  * already prints - never a token, never an `Authorization` header.
29752
+ *
29753
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29754
+ * and lives for hours, so folding it into a call count makes one long-lived
29755
+ * stream look like a storm.
29536
29756
  */
29537
29757
  var RequestCensusGroupSchema = object({
29758
+ plane: TransportPlaneSchema,
29538
29759
  procedure: string(),
29539
29760
  userAgent: string(),
29540
29761
  ip: string(),
29541
29762
  principal: string(),
29542
29763
  calls: number(),
29764
+ subscriptions: number(),
29543
29765
  perMin: number()
29544
29766
  });
29545
29767
  /**
@@ -29552,6 +29774,14 @@ var RequestCensusGroupSchema = object({
29552
29774
  var RequestCensusProcedureSchema = object({
29553
29775
  procedure: string(),
29554
29776
  calls: number(),
29777
+ /**
29778
+ * The same total, split by transport. THIS is the row that answers the
29779
+ * question the census exists for: one look at `deviceManager.listAll` says
29780
+ * which plane carried the 4 960, without joining two log lines by eye.
29781
+ */
29782
+ planes: TransportPlaneCountsSchema,
29783
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29784
+ subscriptions: number(),
29555
29785
  perMin: number()
29556
29786
  });
29557
29787
  /**
@@ -29579,14 +29809,45 @@ var RequestCensusStatusSchema = object({
29579
29809
  */
29580
29810
  procedureCalls: number(),
29581
29811
  /**
29812
+ * `procedureCalls` split by transport. The four keys sum to
29813
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29814
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29815
+ */
29816
+ planes: TransportPlaneCountsSchema,
29817
+ /**
29818
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29819
+ * on no plane at all - which is a RESULT (a plane is missing from the
29820
+ * instrument), not a failure, and it has to be visible to be read as one.
29821
+ */
29822
+ planesExplainTotal: boolean(),
29823
+ /**
29582
29824
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
29583
- * transport resolves one context per connection - but the number that says
29584
- * whether a plane this census cannot see was busy while HTTP was quiet.
29825
+ * adapter resolves one context per connection - kept because a plane's call
29826
+ * count of zero against 37 open connections says something different from a
29827
+ * plane with no connections at all.
29585
29828
  */
29586
29829
  wsConnections: number(),
29830
+ /**
29831
+ * Client frames the WS plane looked at. `wsMessages` far above
29832
+ * `planes.ws + subscriptions` means most traffic is not operations
29833
+ * (keepalives, connection params) - which is itself an answer.
29834
+ */
29835
+ wsMessages: number(),
29836
+ /**
29837
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29838
+ * purpose: one live-events stream opened at boot and held for six hours is
29839
+ * one subscription, and counting it as a call would let a quiet plane
29840
+ * masquerade as the storm.
29841
+ */
29842
+ subscriptions: number(),
29843
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29844
+ subscriptionStops: number(),
29587
29845
  distinctGroups: number(),
29588
- /** Calls counted in the totals whose group attribution was shed at the
29589
- * cardinality bound. */
29846
+ /**
29847
+ * Operations counted in the totals whose CALLER attribution was shed at the
29848
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29849
+ * which transport they arrived on, they just lost their group row.
29850
+ */
29590
29851
  unattributedCalls: number(),
29591
29852
  procedures: array(RequestCensusProcedureSchema).readonly(),
29592
29853
  groups: array(RequestCensusGroupSchema).readonly()
@@ -29609,10 +29870,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
29609
29870
  * The layers of the level hierarchy, general → specific. The most specific
29610
29871
  * layer that carries an explicit value wins.
29611
29872
  *
29612
- * `component` is DECLARED and not yet resolvable: the per-component channels
29613
- * are a later slice of the same plan, and a `levelSource` enum that has to
29614
- * grow later would force every consumer of this document to change with it.
29615
- * Nothing returns `component` today.
29873
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29874
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29875
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29876
+ * that turning it on would not force every consumer of this document to widen
29877
+ * a `levelSource` enum — which is what has now not happened.
29616
29878
  */
29617
29879
  var LoggingScopeKindSchema = _enum([
29618
29880
  "cluster",
@@ -29639,6 +29901,14 @@ var LoggingLevelLayerSchema = object({
29639
29901
  scope: LoggingScopeKindSchema,
29640
29902
  /** The node this layer speaks for; `null` on the cluster layer. */
29641
29903
  nodeId: string().nullable(),
29904
+ /**
29905
+ * The declared channel this layer speaks for; `null` on every layer but
29906
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29907
+ * by design — the convention this repo settled on is one orchestrator-wide
29908
+ * setting, never per node (D52) — so a component layer that carried a node
29909
+ * would invite a per-node copy of a value that has no per-node meaning.
29910
+ */
29911
+ component: string().nullable(),
29642
29912
  /** Explicitly set here, or `null` when this layer inherits. */
29643
29913
  level: LogLevelSchema$1.nullable()
29644
29914
  });
@@ -29680,6 +29950,49 @@ var DiagnosticWindowPatchSchema = object({
29680
29950
  reportEveryMs: number().int().positive().optional()
29681
29951
  });
29682
29952
  /**
29953
+ * A channel ARMED, as the document reports it.
29954
+ *
29955
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29956
+ * and the time left, because a diagnostic left running is itself an incident
29957
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29958
+ */
29959
+ var LogChannelWindowStateSchema = object({
29960
+ channel: string(),
29961
+ armed: boolean(),
29962
+ /** Epoch ms the window closes at. 0 when disarmed. */
29963
+ armedUntilMs: number(),
29964
+ /** Ms left before it expires on its own. 0 when disarmed. */
29965
+ remainingMs: number(),
29966
+ /**
29967
+ * The cameras it is narrowed to, or `null` for every camera.
29968
+ *
29969
+ * A channel declared `perDevice: false` can only ever report `null` here:
29970
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29971
+ * produce a filter that silently matches nothing. The server REFUSES such a
29972
+ * patch rather than quietly widening it — ignoring the request would teach
29973
+ * the operator that per-camera filtering works on that channel when it does
29974
+ * not.
29975
+ */
29976
+ deviceIds: array(number().int()).readonly().nullable()
29977
+ });
29978
+ /**
29979
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29980
+ * for the same reason: a channel is a window with a deadline, never a switch.
29981
+ */
29982
+ var LogChannelWindowPatchSchema = object({
29983
+ channel: string().min(1),
29984
+ armMs: number().int().min(0),
29985
+ /**
29986
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29987
+ *
29988
+ * Numeric because the repo's own rule makes it possible: every log line
29989
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29990
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29991
+ * diagnosed by hand, and this is the first thing that collects on it.
29992
+ */
29993
+ deviceIds: array(number().int()).readonly().nullable().optional()
29994
+ });
29995
+ /**
29683
29996
  * A PATCH, and patches MERGE.
29684
29997
  *
29685
29998
  * A field absent from the patch is left exactly as it was — arming a
@@ -29698,7 +30011,14 @@ var LoggingSettingsPatchSchema = object({
29698
30011
  * Only the diagnostics NAMED here change. An armed window that is not listed
29699
30012
  * keeps running — a patch is never a full replacement.
29700
30013
  */
29701
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
30014
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
30015
+ /**
30016
+ * Only the channels NAMED here change. An armed channel that is not listed
30017
+ * keeps running — same rule as `diagnostics`, because a patch that silently
30018
+ * disarmed the channels it did not mention would make the Levels page and
30019
+ * the Diagnostics page fight over the same value.
30020
+ */
30021
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
29702
30022
  });
29703
30023
  /**
29704
30024
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -29711,9 +30031,22 @@ var LoggingSettingsPatchSchema = object({
29711
30031
  * authority over the whole hierarchy and answers for every layer, so the
29712
30032
  * layer selector needs a name the transport does not already own.
29713
30033
  */
29714
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
30034
+ var GetLoggingSettingsInputSchema = object({
30035
+ scopeNodeId: string().optional(),
30036
+ /**
30037
+ * The declared CHANNEL this document is addressed at, when the caller wants
30038
+ * the `component` layer. Absent = the node/cluster hierarchy only.
30039
+ *
30040
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
30041
+ * axes from collapsing: a component level is cluster-wide, a node level is
30042
+ * not, and one selector for both would make "which of these two did I just
30043
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
30044
+ */
30045
+ scopeComponent: string().optional()
30046
+ });
29715
30047
  var SetLoggingSettingsInputSchema = object({
29716
30048
  scopeNodeId: string().optional(),
30049
+ scopeComponent: string().optional(),
29717
30050
  patch: LoggingSettingsPatchSchema
29718
30051
  });
29719
30052
  /**
@@ -29728,9 +30061,20 @@ var SetLoggingSettingsInputSchema = object({
29728
30061
  var LoggingSettingsStateSchema = object({
29729
30062
  /** The layer this document was read at. `null` = the cluster layer. */
29730
30063
  scopeNodeId: string().nullable(),
30064
+ /** The channel this document was read at. `null` = no component layer. */
30065
+ scopeComponent: string().nullable(),
29731
30066
  effective: LoggingEffectiveSchema,
29732
30067
  explicit: LoggingExplicitSchema,
29733
30068
  activeWindows: array(DiagnosticWindowSchema).readonly(),
30069
+ /**
30070
+ * Every channel the cluster's addons DECLARE, gathered from the
30071
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
30072
+ * channel added by a redeployed addon appears without anybody editing a
30073
+ * list, and a channel whose addon is gone stops being offered.
30074
+ */
30075
+ channels: array(LogChannelDescriptorSchema).readonly(),
30076
+ /** The channels ARMED right now, each with its deadline. */
30077
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
29734
30078
  persisted: boolean()
29735
30079
  });
29736
30080
  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(), {
@@ -32715,6 +33059,12 @@ Object.freeze({
32715
33059
  addonId: null,
32716
33060
  access: "view"
32717
33061
  },
33062
+ "dataStoreProvider.aggregate": {
33063
+ capName: "data-store-provider",
33064
+ capScope: "system",
33065
+ addonId: null,
33066
+ access: "view"
33067
+ },
32718
33068
  "dataStoreProvider.count": {
32719
33069
  capName: "data-store-provider",
32720
33070
  capScope: "system",
@@ -33129,6 +33479,12 @@ Object.freeze({
33129
33479
  addonId: null,
33130
33480
  access: "view"
33131
33481
  },
33482
+ "deviceManager.getChildrenBatch": {
33483
+ capName: "device-manager",
33484
+ capScope: "system",
33485
+ addonId: null,
33486
+ access: "view"
33487
+ },
33132
33488
  "deviceManager.getConfigSchema": {
33133
33489
  capName: "device-manager",
33134
33490
  capScope: "system",
@@ -34179,6 +34535,18 @@ Object.freeze({
34179
34535
  addonId: null,
34180
34536
  access: "create"
34181
34537
  },
34538
+ "logChannels.apply": {
34539
+ capName: "log-channels",
34540
+ capScope: "system",
34541
+ addonId: null,
34542
+ access: "create"
34543
+ },
34544
+ "logChannels.list": {
34545
+ capName: "log-channels",
34546
+ capScope: "system",
34547
+ addonId: null,
34548
+ access: "view"
34549
+ },
34182
34550
  "logDestination.query": {
34183
34551
  capName: "log-destination",
34184
34552
  capScope: "system",
@@ -36333,6 +36701,12 @@ Object.freeze({
36333
36701
  addonId: null,
36334
36702
  access: "create"
36335
36703
  },
36704
+ "settingsStore.aggregate": {
36705
+ capName: "settings-store",
36706
+ capScope: "system",
36707
+ addonId: null,
36708
+ access: "view"
36709
+ },
36336
36710
  "settingsStore.count": {
36337
36711
  capName: "settings-store",
36338
36712
  capScope: "system",
@@ -37912,6 +38286,11 @@ Object.freeze({
37912
38286
  form: "single",
37913
38287
  optional: false
37914
38288
  }],
38289
+ "deviceManager.getChildrenBatch": [{
38290
+ name: "parentDeviceIds",
38291
+ form: "array",
38292
+ optional: false
38293
+ }],
37915
38294
  "deviceManager.getConfigSchema": [{
37916
38295
  name: "deviceId",
37917
38296
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-petkit",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "description": "PetKit smart-feeder device-provider addon for CamStack — wraps the @apocaliss92/nodepetkit PetKit cloud client",
5
5
  "keywords": [
6
6
  "camstack",