@camstack/addon-provider-gree 0.2.31 → 0.2.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +409 -30
  2. package/dist/addon.mjs +409 -30
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7471,6 +7471,111 @@ var CameraSwitchGroupSchema = object({
7471
7471
  fetchedAt: number()
7472
7472
  });
7473
7473
  /**
7474
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7475
+ * an addon declares its channels in.
7476
+ *
7477
+ * ## Two axes, deliberately separated
7478
+ *
7479
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7480
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7481
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7482
+ * and rots silently. So a channel is declared where it is consulted, and the
7483
+ * `log-channels` capability enumerates the declarations.
7484
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7485
+ * thing: the logging settings document on the `system` cap. Two authorities
7486
+ * over the values is the exact defect
7487
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7488
+ * remove; re-introducing it from the cure side would be grotesque.
7489
+ *
7490
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7491
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7492
+ * the hot path with a value somebody actually read, and by
7493
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7494
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7495
+ * disarmed one (D49).
7496
+ *
7497
+ * ## The canonical call shape
7498
+ *
7499
+ * ```ts
7500
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7501
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7502
+ * }
7503
+ * ```
7504
+ *
7505
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7506
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7507
+ * object literal is never constructed because it lives inside the branch. It
7508
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7509
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7510
+ * destination floor (measured at 1.93 ns/call when off).
7511
+ *
7512
+ * ## Why a channel emits at `info`
7513
+ *
7514
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7515
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7516
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7517
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7518
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7519
+ * emits at the channel's declared level, whose schema floor is `info`.
7520
+ */
7521
+ /**
7522
+ * The level a channel writes at once armed.
7523
+ *
7524
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7525
+ * not leave the process for Loki, and the whole point of arming a channel is
7526
+ * to read it later.
7527
+ */
7528
+ var LogChannelLevelSchema = _enum([
7529
+ "info",
7530
+ "warn",
7531
+ "error"
7532
+ ]);
7533
+ /**
7534
+ * What an addon declares about one channel. No value, no state — a
7535
+ * declaration is inert.
7536
+ */
7537
+ var LogChannelDescriptorSchema = object({
7538
+ /**
7539
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7540
+ * the addon's short name so an operator reading a channel list can tell who
7541
+ * owns it without a second lookup.
7542
+ */
7543
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7544
+ /** One sentence: what the operator will SEE after arming it. */
7545
+ description: string().min(1),
7546
+ /** The level its lines are emitted at. Never below `info`. */
7547
+ defaultLevel: LogChannelLevelSchema,
7548
+ /**
7549
+ * Whether this channel can be narrowed to a camera.
7550
+ *
7551
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7552
+ * consulted with the numeric device id, AND every line the channel admits
7553
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7554
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7555
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7556
+ * the body is the only way to filter.
7557
+ *
7558
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7559
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7560
+ * the operator narrows to one camera, sees nothing, and concludes the code
7561
+ * path was never taken.
7562
+ */
7563
+ perDevice: boolean()
7564
+ });
7565
+ /**
7566
+ * An armed window over one channel, as the document hands it to a mirror.
7567
+ *
7568
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7569
+ * expires by itself, which is the one failure a boolean cannot avoid.
7570
+ */
7571
+ var LogChannelWindowSchema = object({
7572
+ channel: string().min(1),
7573
+ /** Epoch ms the window closes at. */
7574
+ armedUntilMs: number(),
7575
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7576
+ deviceIds: array(number().int()).readonly().nullable()
7577
+ });
7578
+ /**
7474
7579
  * Ops-log — the durable, append-only operations audit shared by the
7475
7580
  * recordings and events management surfaces.
7476
7581
  *
@@ -11091,6 +11196,35 @@ var MutationFilterSchema = object({
11091
11196
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11092
11197
  whereNot: record(string(), unknown()).optional()
11093
11198
  });
11199
+ /**
11200
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11201
+ *
11202
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11203
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11204
+ * a `Record<column, op>` shape could not express.
11205
+ */
11206
+ var AggregateFieldSchema = object({
11207
+ /** Result key. */
11208
+ as: string().min(1),
11209
+ /** Column to aggregate. Must be a real column of a declared collection. */
11210
+ field: string().min(1),
11211
+ op: _enum([
11212
+ "sum",
11213
+ "min",
11214
+ "max"
11215
+ ])
11216
+ });
11217
+ /**
11218
+ * `COUNT(*)` plus one number per requested field.
11219
+ *
11220
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11221
+ * that really is 0 are different facts, and an accounting caller that renders
11222
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11223
+ */
11224
+ var AggregateResultSchema = object({
11225
+ count: number().int(),
11226
+ values: record(string(), number().nullable())
11227
+ });
11094
11228
  /** A single stored record: `{ id, data }`. */
11095
11229
  var SettingsRecordSchema = object({
11096
11230
  id: string(),
@@ -11175,6 +11309,11 @@ method(object({
11175
11309
  collection: string(),
11176
11310
  filter: QueryFilterSchema.optional()
11177
11311
  }), number()), method(object({
11312
+ namespace: string().optional(),
11313
+ collection: string(),
11314
+ fields: array(AggregateFieldSchema).readonly(),
11315
+ filter: QueryFilterSchema.optional()
11316
+ }), AggregateResultSchema), method(object({
11178
11317
  namespace: string().optional(),
11179
11318
  collection: string(),
11180
11319
  field: string(),
@@ -11291,6 +11430,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11291
11430
  collection: string(),
11292
11431
  filter: QueryFilterSchema.optional()
11293
11432
  }), number(), { auth: "admin" }), method(object({
11433
+ namespace: string().optional(),
11434
+ collection: string(),
11435
+ fields: array(AggregateFieldSchema).readonly(),
11436
+ filter: QueryFilterSchema.optional()
11437
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11294
11438
  namespace: string().optional(),
11295
11439
  collection: string(),
11296
11440
  field: string(),
@@ -12014,24 +12158,6 @@ var deviceProviderCapability = {
12014
12158
  })
12015
12159
  }
12016
12160
  };
12017
- /**
12018
- * Device Manager capability — hub-side singleton that unifies device persistence,
12019
- * live registry access, and all management operations into a single tRPC surface.
12020
- *
12021
- * Replaces:
12022
- * - `device-persistence` capability (persistence methods absorbed here)
12023
- * - `device-management.router.ts` (deleted in Phase 2)
12024
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12025
- *
12026
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12027
- * fork into separate processes but never run on remote cluster agents. Therefore:
12028
- * - No nodeId routing needed — this is a pure hub singleton.
12029
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12030
- * - No shadow registry or cross-node aggregation required.
12031
- *
12032
- * Forked workers register devices back to the hub via `ctx.devices`
12033
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12034
- */
12035
12161
  /** One child-placement directive on a container's `childLayout`. Structurally
12036
12162
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12037
12163
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12400,7 +12526,7 @@ method(object({
12400
12526
  * it answers today and the caller filters as it already does.
12401
12527
  */
12402
12528
  deviceIds: array(number()).optional()
12403
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12529
+ }), 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({
12404
12530
  mode: LinkedDevicesModeSchema,
12405
12531
  devices: array(LinkedDeviceSchema)
12406
12532
  })), 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({
@@ -13124,6 +13250,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13124
13250
  kind: "mutation",
13125
13251
  auth: "admin"
13126
13252
  });
13253
+ /**
13254
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13255
+ * through. It stores nothing.
13256
+ *
13257
+ * ## Why a capability at all, and why this shape
13258
+ *
13259
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13260
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13261
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13262
+ * fails, an operator just never sees the channel somebody added. So the list
13263
+ * is assembled from declarations at runtime.
13264
+ *
13265
+ * The shape is copied from `log-destination.cap.ts`, which already does
13266
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13267
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13268
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13269
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13270
+ * runner's declarations reach hub-main over the transport that already exists.
13271
+ * No new UDS message, no second registry.
13272
+ *
13273
+ * ## What it deliberately does NOT own
13274
+ *
13275
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13276
+ * ONE place: the logging settings document on the `system` cap
13277
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13278
+ * value is the defect the plan behind this work exists to remove, and
13279
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13280
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13281
+ * setter for a window and no persistence of any kind.
13282
+ *
13283
+ * ## Why `apply` is here even so
13284
+ *
13285
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13286
+ * seam has to carry the value from the authority to the mirror, and a channel
13287
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13288
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13289
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13290
+ * persists nothing, it is never the source of a value, and it is called only
13291
+ * with a set the hub actually read (D49 — a read that fails does not call it
13292
+ * at all, so no channel is silently disarmed by a bad read).
13293
+ */
13294
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13295
+ var LogChannelApplyResultSchema = object({
13296
+ /** How many declared channels are armed in this process after the call. */
13297
+ armed: number().int().min(0),
13298
+ /**
13299
+ * Names the document armed that this process does not declare. Reported
13300
+ * rather than swallowed: a name here is either a typo or an addon that has
13301
+ * not booted, and both deserve a line instead of silence.
13302
+ */
13303
+ unknown: array(string()).readonly()
13304
+ });
13305
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13127
13306
  var LogLevelSchema = _enum([
13128
13307
  "debug",
13129
13308
  "info",
@@ -28406,17 +28585,60 @@ var SetSiteLocationInputSchema = object({
28406
28585
  longitude: number().min(-180).max(180)
28407
28586
  }).nullable();
28408
28587
  /**
28409
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28588
+ * The TRANSPORT a call arrived on.
28589
+ *
28590
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28591
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28592
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28593
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28594
+ * checkable rather than asserted.
28595
+ *
28596
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28597
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28598
+ * connection; the viewer talks to the hub over `wsLink`
28599
+ * exclusively, so this is the plane the HTTP census could not see.
28600
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28601
+ * never touches a socket and therefore never touched a census.
28602
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28603
+ * that is exactly what its `0` asserts: every plane the hub has can name
28604
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28605
+ * plane nobody instrumented lands here instead of vanishing from the total.
28606
+ */
28607
+ var TransportPlaneSchema = _enum([
28608
+ "http",
28609
+ "ws",
28610
+ "mesh",
28611
+ "unknown"
28612
+ ]);
28613
+ /**
28614
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28615
+ * reads as "not instrumented", which is the one thing this census must never
28616
+ * make an operator wonder about.
28617
+ */
28618
+ var TransportPlaneCountsSchema = object({
28619
+ http: number(),
28620
+ ws: number(),
28621
+ mesh: number(),
28622
+ unknown: number()
28623
+ });
28624
+ /**
28625
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28410
28626
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28411
28627
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28412
28628
  * already prints - never a token, never an `Authorization` header.
28629
+ *
28630
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28631
+ * and lives for hours, so folding it into a call count makes one long-lived
28632
+ * stream look like a storm.
28413
28633
  */
28414
28634
  var RequestCensusGroupSchema = object({
28635
+ plane: TransportPlaneSchema,
28415
28636
  procedure: string(),
28416
28637
  userAgent: string(),
28417
28638
  ip: string(),
28418
28639
  principal: string(),
28419
28640
  calls: number(),
28641
+ subscriptions: number(),
28420
28642
  perMin: number()
28421
28643
  });
28422
28644
  /**
@@ -28429,6 +28651,14 @@ var RequestCensusGroupSchema = object({
28429
28651
  var RequestCensusProcedureSchema = object({
28430
28652
  procedure: string(),
28431
28653
  calls: number(),
28654
+ /**
28655
+ * The same total, split by transport. THIS is the row that answers the
28656
+ * question the census exists for: one look at `deviceManager.listAll` says
28657
+ * which plane carried the 4 960, without joining two log lines by eye.
28658
+ */
28659
+ planes: TransportPlaneCountsSchema,
28660
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28661
+ subscriptions: number(),
28432
28662
  perMin: number()
28433
28663
  });
28434
28664
  /**
@@ -28456,14 +28686,45 @@ var RequestCensusStatusSchema = object({
28456
28686
  */
28457
28687
  procedureCalls: number(),
28458
28688
  /**
28689
+ * `procedureCalls` split by transport. The four keys sum to
28690
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28691
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28692
+ */
28693
+ planes: TransportPlaneCountsSchema,
28694
+ /**
28695
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28696
+ * on no plane at all - which is a RESULT (a plane is missing from the
28697
+ * instrument), not a failure, and it has to be visible to be read as one.
28698
+ */
28699
+ planesExplainTotal: boolean(),
28700
+ /**
28459
28701
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28460
- * transport resolves one context per connection - but the number that says
28461
- * whether a plane this census cannot see was busy while HTTP was quiet.
28702
+ * adapter resolves one context per connection - kept because a plane's call
28703
+ * count of zero against 37 open connections says something different from a
28704
+ * plane with no connections at all.
28462
28705
  */
28463
28706
  wsConnections: number(),
28707
+ /**
28708
+ * Client frames the WS plane looked at. `wsMessages` far above
28709
+ * `planes.ws + subscriptions` means most traffic is not operations
28710
+ * (keepalives, connection params) - which is itself an answer.
28711
+ */
28712
+ wsMessages: number(),
28713
+ /**
28714
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28715
+ * purpose: one live-events stream opened at boot and held for six hours is
28716
+ * one subscription, and counting it as a call would let a quiet plane
28717
+ * masquerade as the storm.
28718
+ */
28719
+ subscriptions: number(),
28720
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28721
+ subscriptionStops: number(),
28464
28722
  distinctGroups: number(),
28465
- /** Calls counted in the totals whose group attribution was shed at the
28466
- * cardinality bound. */
28723
+ /**
28724
+ * Operations counted in the totals whose CALLER attribution was shed at the
28725
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28726
+ * which transport they arrived on, they just lost their group row.
28727
+ */
28467
28728
  unattributedCalls: number(),
28468
28729
  procedures: array(RequestCensusProcedureSchema).readonly(),
28469
28730
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28486,10 +28747,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28486
28747
  * The layers of the level hierarchy, general → specific. The most specific
28487
28748
  * layer that carries an explicit value wins.
28488
28749
  *
28489
- * `component` is DECLARED and not yet resolvable: the per-component channels
28490
- * are a later slice of the same plan, and a `levelSource` enum that has to
28491
- * grow later would force every consumer of this document to change with it.
28492
- * Nothing returns `component` today.
28750
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28751
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28752
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28753
+ * that turning it on would not force every consumer of this document to widen
28754
+ * a `levelSource` enum — which is what has now not happened.
28493
28755
  */
28494
28756
  var LoggingScopeKindSchema = _enum([
28495
28757
  "cluster",
@@ -28516,6 +28778,14 @@ var LoggingLevelLayerSchema = object({
28516
28778
  scope: LoggingScopeKindSchema,
28517
28779
  /** The node this layer speaks for; `null` on the cluster layer. */
28518
28780
  nodeId: string().nullable(),
28781
+ /**
28782
+ * The declared channel this layer speaks for; `null` on every layer but
28783
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28784
+ * by design — the convention this repo settled on is one orchestrator-wide
28785
+ * setting, never per node (D52) — so a component layer that carried a node
28786
+ * would invite a per-node copy of a value that has no per-node meaning.
28787
+ */
28788
+ component: string().nullable(),
28519
28789
  /** Explicitly set here, or `null` when this layer inherits. */
28520
28790
  level: LogLevelSchema$1.nullable()
28521
28791
  });
@@ -28557,6 +28827,49 @@ var DiagnosticWindowPatchSchema = object({
28557
28827
  reportEveryMs: number().int().positive().optional()
28558
28828
  });
28559
28829
  /**
28830
+ * A channel ARMED, as the document reports it.
28831
+ *
28832
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28833
+ * and the time left, because a diagnostic left running is itself an incident
28834
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28835
+ */
28836
+ var LogChannelWindowStateSchema = object({
28837
+ channel: string(),
28838
+ armed: boolean(),
28839
+ /** Epoch ms the window closes at. 0 when disarmed. */
28840
+ armedUntilMs: number(),
28841
+ /** Ms left before it expires on its own. 0 when disarmed. */
28842
+ remainingMs: number(),
28843
+ /**
28844
+ * The cameras it is narrowed to, or `null` for every camera.
28845
+ *
28846
+ * A channel declared `perDevice: false` can only ever report `null` here:
28847
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28848
+ * produce a filter that silently matches nothing. The server REFUSES such a
28849
+ * patch rather than quietly widening it — ignoring the request would teach
28850
+ * the operator that per-camera filtering works on that channel when it does
28851
+ * not.
28852
+ */
28853
+ deviceIds: array(number().int()).readonly().nullable()
28854
+ });
28855
+ /**
28856
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28857
+ * for the same reason: a channel is a window with a deadline, never a switch.
28858
+ */
28859
+ var LogChannelWindowPatchSchema = object({
28860
+ channel: string().min(1),
28861
+ armMs: number().int().min(0),
28862
+ /**
28863
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
28864
+ *
28865
+ * Numeric because the repo's own rule makes it possible: every log line
28866
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
28867
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
28868
+ * diagnosed by hand, and this is the first thing that collects on it.
28869
+ */
28870
+ deviceIds: array(number().int()).readonly().nullable().optional()
28871
+ });
28872
+ /**
28560
28873
  * A PATCH, and patches MERGE.
28561
28874
  *
28562
28875
  * A field absent from the patch is left exactly as it was — arming a
@@ -28575,7 +28888,14 @@ var LoggingSettingsPatchSchema = object({
28575
28888
  * Only the diagnostics NAMED here change. An armed window that is not listed
28576
28889
  * keeps running — a patch is never a full replacement.
28577
28890
  */
28578
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28891
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
28892
+ /**
28893
+ * Only the channels NAMED here change. An armed channel that is not listed
28894
+ * keeps running — same rule as `diagnostics`, because a patch that silently
28895
+ * disarmed the channels it did not mention would make the Levels page and
28896
+ * the Diagnostics page fight over the same value.
28897
+ */
28898
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28579
28899
  });
28580
28900
  /**
28581
28901
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28588,9 +28908,22 @@ var LoggingSettingsPatchSchema = object({
28588
28908
  * authority over the whole hierarchy and answers for every layer, so the
28589
28909
  * layer selector needs a name the transport does not already own.
28590
28910
  */
28591
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28911
+ var GetLoggingSettingsInputSchema = object({
28912
+ scopeNodeId: string().optional(),
28913
+ /**
28914
+ * The declared CHANNEL this document is addressed at, when the caller wants
28915
+ * the `component` layer. Absent = the node/cluster hierarchy only.
28916
+ *
28917
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
28918
+ * axes from collapsing: a component level is cluster-wide, a node level is
28919
+ * not, and one selector for both would make "which of these two did I just
28920
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
28921
+ */
28922
+ scopeComponent: string().optional()
28923
+ });
28592
28924
  var SetLoggingSettingsInputSchema = object({
28593
28925
  scopeNodeId: string().optional(),
28926
+ scopeComponent: string().optional(),
28594
28927
  patch: LoggingSettingsPatchSchema
28595
28928
  });
28596
28929
  /**
@@ -28605,9 +28938,20 @@ var SetLoggingSettingsInputSchema = object({
28605
28938
  var LoggingSettingsStateSchema = object({
28606
28939
  /** The layer this document was read at. `null` = the cluster layer. */
28607
28940
  scopeNodeId: string().nullable(),
28941
+ /** The channel this document was read at. `null` = no component layer. */
28942
+ scopeComponent: string().nullable(),
28608
28943
  effective: LoggingEffectiveSchema,
28609
28944
  explicit: LoggingExplicitSchema,
28610
28945
  activeWindows: array(DiagnosticWindowSchema).readonly(),
28946
+ /**
28947
+ * Every channel the cluster's addons DECLARE, gathered from the
28948
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
28949
+ * channel added by a redeployed addon appears without anybody editing a
28950
+ * list, and a channel whose addon is gone stops being offered.
28951
+ */
28952
+ channels: array(LogChannelDescriptorSchema).readonly(),
28953
+ /** The channels ARMED right now, each with its deadline. */
28954
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28611
28955
  persisted: boolean()
28612
28956
  });
28613
28957
  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(), {
@@ -31592,6 +31936,12 @@ Object.freeze({
31592
31936
  addonId: null,
31593
31937
  access: "view"
31594
31938
  },
31939
+ "dataStoreProvider.aggregate": {
31940
+ capName: "data-store-provider",
31941
+ capScope: "system",
31942
+ addonId: null,
31943
+ access: "view"
31944
+ },
31595
31945
  "dataStoreProvider.count": {
31596
31946
  capName: "data-store-provider",
31597
31947
  capScope: "system",
@@ -32006,6 +32356,12 @@ Object.freeze({
32006
32356
  addonId: null,
32007
32357
  access: "view"
32008
32358
  },
32359
+ "deviceManager.getChildrenBatch": {
32360
+ capName: "device-manager",
32361
+ capScope: "system",
32362
+ addonId: null,
32363
+ access: "view"
32364
+ },
32009
32365
  "deviceManager.getConfigSchema": {
32010
32366
  capName: "device-manager",
32011
32367
  capScope: "system",
@@ -33056,6 +33412,18 @@ Object.freeze({
33056
33412
  addonId: null,
33057
33413
  access: "create"
33058
33414
  },
33415
+ "logChannels.apply": {
33416
+ capName: "log-channels",
33417
+ capScope: "system",
33418
+ addonId: null,
33419
+ access: "create"
33420
+ },
33421
+ "logChannels.list": {
33422
+ capName: "log-channels",
33423
+ capScope: "system",
33424
+ addonId: null,
33425
+ access: "view"
33426
+ },
33059
33427
  "logDestination.query": {
33060
33428
  capName: "log-destination",
33061
33429
  capScope: "system",
@@ -35210,6 +35578,12 @@ Object.freeze({
35210
35578
  addonId: null,
35211
35579
  access: "create"
35212
35580
  },
35581
+ "settingsStore.aggregate": {
35582
+ capName: "settings-store",
35583
+ capScope: "system",
35584
+ addonId: null,
35585
+ access: "view"
35586
+ },
35213
35587
  "settingsStore.count": {
35214
35588
  capName: "settings-store",
35215
35589
  capScope: "system",
@@ -36789,6 +37163,11 @@ Object.freeze({
36789
37163
  form: "single",
36790
37164
  optional: false
36791
37165
  }],
37166
+ "deviceManager.getChildrenBatch": [{
37167
+ name: "parentDeviceIds",
37168
+ form: "array",
37169
+ optional: false
37170
+ }],
36792
37171
  "deviceManager.getConfigSchema": [{
36793
37172
  name: "deviceId",
36794
37173
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7470,6 +7470,111 @@ var CameraSwitchGroupSchema = object({
7470
7470
  fetchedAt: number()
7471
7471
  });
7472
7472
  /**
7473
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7474
+ * an addon declares its channels in.
7475
+ *
7476
+ * ## Two axes, deliberately separated
7477
+ *
7478
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7479
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7480
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7481
+ * and rots silently. So a channel is declared where it is consulted, and the
7482
+ * `log-channels` capability enumerates the declarations.
7483
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7484
+ * thing: the logging settings document on the `system` cap. Two authorities
7485
+ * over the values is the exact defect
7486
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7487
+ * remove; re-introducing it from the cure side would be grotesque.
7488
+ *
7489
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7490
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7491
+ * the hot path with a value somebody actually read, and by
7492
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7493
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7494
+ * disarmed one (D49).
7495
+ *
7496
+ * ## The canonical call shape
7497
+ *
7498
+ * ```ts
7499
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7500
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7501
+ * }
7502
+ * ```
7503
+ *
7504
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7505
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7506
+ * object literal is never constructed because it lives inside the branch. It
7507
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7508
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7509
+ * destination floor (measured at 1.93 ns/call when off).
7510
+ *
7511
+ * ## Why a channel emits at `info`
7512
+ *
7513
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7514
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7515
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7516
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7517
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7518
+ * emits at the channel's declared level, whose schema floor is `info`.
7519
+ */
7520
+ /**
7521
+ * The level a channel writes at once armed.
7522
+ *
7523
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7524
+ * not leave the process for Loki, and the whole point of arming a channel is
7525
+ * to read it later.
7526
+ */
7527
+ var LogChannelLevelSchema = _enum([
7528
+ "info",
7529
+ "warn",
7530
+ "error"
7531
+ ]);
7532
+ /**
7533
+ * What an addon declares about one channel. No value, no state — a
7534
+ * declaration is inert.
7535
+ */
7536
+ var LogChannelDescriptorSchema = object({
7537
+ /**
7538
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7539
+ * the addon's short name so an operator reading a channel list can tell who
7540
+ * owns it without a second lookup.
7541
+ */
7542
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7543
+ /** One sentence: what the operator will SEE after arming it. */
7544
+ description: string().min(1),
7545
+ /** The level its lines are emitted at. Never below `info`. */
7546
+ defaultLevel: LogChannelLevelSchema,
7547
+ /**
7548
+ * Whether this channel can be narrowed to a camera.
7549
+ *
7550
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7551
+ * consulted with the numeric device id, AND every line the channel admits
7552
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7553
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7554
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7555
+ * the body is the only way to filter.
7556
+ *
7557
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7558
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7559
+ * the operator narrows to one camera, sees nothing, and concludes the code
7560
+ * path was never taken.
7561
+ */
7562
+ perDevice: boolean()
7563
+ });
7564
+ /**
7565
+ * An armed window over one channel, as the document hands it to a mirror.
7566
+ *
7567
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7568
+ * expires by itself, which is the one failure a boolean cannot avoid.
7569
+ */
7570
+ var LogChannelWindowSchema = object({
7571
+ channel: string().min(1),
7572
+ /** Epoch ms the window closes at. */
7573
+ armedUntilMs: number(),
7574
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7575
+ deviceIds: array(number().int()).readonly().nullable()
7576
+ });
7577
+ /**
7473
7578
  * Ops-log — the durable, append-only operations audit shared by the
7474
7579
  * recordings and events management surfaces.
7475
7580
  *
@@ -11090,6 +11195,35 @@ var MutationFilterSchema = object({
11090
11195
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11091
11196
  whereNot: record(string(), unknown()).optional()
11092
11197
  });
11198
+ /**
11199
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11200
+ *
11201
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11202
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11203
+ * a `Record<column, op>` shape could not express.
11204
+ */
11205
+ var AggregateFieldSchema = object({
11206
+ /** Result key. */
11207
+ as: string().min(1),
11208
+ /** Column to aggregate. Must be a real column of a declared collection. */
11209
+ field: string().min(1),
11210
+ op: _enum([
11211
+ "sum",
11212
+ "min",
11213
+ "max"
11214
+ ])
11215
+ });
11216
+ /**
11217
+ * `COUNT(*)` plus one number per requested field.
11218
+ *
11219
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11220
+ * that really is 0 are different facts, and an accounting caller that renders
11221
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11222
+ */
11223
+ var AggregateResultSchema = object({
11224
+ count: number().int(),
11225
+ values: record(string(), number().nullable())
11226
+ });
11093
11227
  /** A single stored record: `{ id, data }`. */
11094
11228
  var SettingsRecordSchema = object({
11095
11229
  id: string(),
@@ -11174,6 +11308,11 @@ method(object({
11174
11308
  collection: string(),
11175
11309
  filter: QueryFilterSchema.optional()
11176
11310
  }), number()), method(object({
11311
+ namespace: string().optional(),
11312
+ collection: string(),
11313
+ fields: array(AggregateFieldSchema).readonly(),
11314
+ filter: QueryFilterSchema.optional()
11315
+ }), AggregateResultSchema), method(object({
11177
11316
  namespace: string().optional(),
11178
11317
  collection: string(),
11179
11318
  field: string(),
@@ -11290,6 +11429,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11290
11429
  collection: string(),
11291
11430
  filter: QueryFilterSchema.optional()
11292
11431
  }), number(), { auth: "admin" }), method(object({
11432
+ namespace: string().optional(),
11433
+ collection: string(),
11434
+ fields: array(AggregateFieldSchema).readonly(),
11435
+ filter: QueryFilterSchema.optional()
11436
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11293
11437
  namespace: string().optional(),
11294
11438
  collection: string(),
11295
11439
  field: string(),
@@ -12013,24 +12157,6 @@ var deviceProviderCapability = {
12013
12157
  })
12014
12158
  }
12015
12159
  };
12016
- /**
12017
- * Device Manager capability — hub-side singleton that unifies device persistence,
12018
- * live registry access, and all management operations into a single tRPC surface.
12019
- *
12020
- * Replaces:
12021
- * - `device-persistence` capability (persistence methods absorbed here)
12022
- * - `device-management.router.ts` (deleted in Phase 2)
12023
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12024
- *
12025
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12026
- * fork into separate processes but never run on remote cluster agents. Therefore:
12027
- * - No nodeId routing needed — this is a pure hub singleton.
12028
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12029
- * - No shadow registry or cross-node aggregation required.
12030
- *
12031
- * Forked workers register devices back to the hub via `ctx.devices`
12032
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12033
- */
12034
12160
  /** One child-placement directive on a container's `childLayout`. Structurally
12035
12161
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12036
12162
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12399,7 +12525,7 @@ method(object({
12399
12525
  * it answers today and the caller filters as it already does.
12400
12526
  */
12401
12527
  deviceIds: array(number()).optional()
12402
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12528
+ }), 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({
12403
12529
  mode: LinkedDevicesModeSchema,
12404
12530
  devices: array(LinkedDeviceSchema)
12405
12531
  })), 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({
@@ -13123,6 +13249,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13123
13249
  kind: "mutation",
13124
13250
  auth: "admin"
13125
13251
  });
13252
+ /**
13253
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13254
+ * through. It stores nothing.
13255
+ *
13256
+ * ## Why a capability at all, and why this shape
13257
+ *
13258
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13259
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13260
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13261
+ * fails, an operator just never sees the channel somebody added. So the list
13262
+ * is assembled from declarations at runtime.
13263
+ *
13264
+ * The shape is copied from `log-destination.cap.ts`, which already does
13265
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13266
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13267
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13268
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13269
+ * runner's declarations reach hub-main over the transport that already exists.
13270
+ * No new UDS message, no second registry.
13271
+ *
13272
+ * ## What it deliberately does NOT own
13273
+ *
13274
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13275
+ * ONE place: the logging settings document on the `system` cap
13276
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13277
+ * value is the defect the plan behind this work exists to remove, and
13278
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13279
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13280
+ * setter for a window and no persistence of any kind.
13281
+ *
13282
+ * ## Why `apply` is here even so
13283
+ *
13284
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13285
+ * seam has to carry the value from the authority to the mirror, and a channel
13286
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13287
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13288
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13289
+ * persists nothing, it is never the source of a value, and it is called only
13290
+ * with a set the hub actually read (D49 — a read that fails does not call it
13291
+ * at all, so no channel is silently disarmed by a bad read).
13292
+ */
13293
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13294
+ var LogChannelApplyResultSchema = object({
13295
+ /** How many declared channels are armed in this process after the call. */
13296
+ armed: number().int().min(0),
13297
+ /**
13298
+ * Names the document armed that this process does not declare. Reported
13299
+ * rather than swallowed: a name here is either a typo or an addon that has
13300
+ * not booted, and both deserve a line instead of silence.
13301
+ */
13302
+ unknown: array(string()).readonly()
13303
+ });
13304
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13126
13305
  var LogLevelSchema = _enum([
13127
13306
  "debug",
13128
13307
  "info",
@@ -28405,17 +28584,60 @@ var SetSiteLocationInputSchema = object({
28405
28584
  longitude: number().min(-180).max(180)
28406
28585
  }).nullable();
28407
28586
  /**
28408
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28587
+ * The TRANSPORT a call arrived on.
28588
+ *
28589
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28590
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28591
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28592
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28593
+ * checkable rather than asserted.
28594
+ *
28595
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28596
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28597
+ * connection; the viewer talks to the hub over `wsLink`
28598
+ * exclusively, so this is the plane the HTTP census could not see.
28599
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28600
+ * never touches a socket and therefore never touched a census.
28601
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28602
+ * that is exactly what its `0` asserts: every plane the hub has can name
28603
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28604
+ * plane nobody instrumented lands here instead of vanishing from the total.
28605
+ */
28606
+ var TransportPlaneSchema = _enum([
28607
+ "http",
28608
+ "ws",
28609
+ "mesh",
28610
+ "unknown"
28611
+ ]);
28612
+ /**
28613
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28614
+ * reads as "not instrumented", which is the one thing this census must never
28615
+ * make an operator wonder about.
28616
+ */
28617
+ var TransportPlaneCountsSchema = object({
28618
+ http: number(),
28619
+ ws: number(),
28620
+ mesh: number(),
28621
+ unknown: number()
28622
+ });
28623
+ /**
28624
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28409
28625
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28410
28626
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28411
28627
  * already prints - never a token, never an `Authorization` header.
28628
+ *
28629
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28630
+ * and lives for hours, so folding it into a call count makes one long-lived
28631
+ * stream look like a storm.
28412
28632
  */
28413
28633
  var RequestCensusGroupSchema = object({
28634
+ plane: TransportPlaneSchema,
28414
28635
  procedure: string(),
28415
28636
  userAgent: string(),
28416
28637
  ip: string(),
28417
28638
  principal: string(),
28418
28639
  calls: number(),
28640
+ subscriptions: number(),
28419
28641
  perMin: number()
28420
28642
  });
28421
28643
  /**
@@ -28428,6 +28650,14 @@ var RequestCensusGroupSchema = object({
28428
28650
  var RequestCensusProcedureSchema = object({
28429
28651
  procedure: string(),
28430
28652
  calls: number(),
28653
+ /**
28654
+ * The same total, split by transport. THIS is the row that answers the
28655
+ * question the census exists for: one look at `deviceManager.listAll` says
28656
+ * which plane carried the 4 960, without joining two log lines by eye.
28657
+ */
28658
+ planes: TransportPlaneCountsSchema,
28659
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28660
+ subscriptions: number(),
28431
28661
  perMin: number()
28432
28662
  });
28433
28663
  /**
@@ -28455,14 +28685,45 @@ var RequestCensusStatusSchema = object({
28455
28685
  */
28456
28686
  procedureCalls: number(),
28457
28687
  /**
28688
+ * `procedureCalls` split by transport. The four keys sum to
28689
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28690
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28691
+ */
28692
+ planes: TransportPlaneCountsSchema,
28693
+ /**
28694
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28695
+ * on no plane at all - which is a RESULT (a plane is missing from the
28696
+ * instrument), not a failure, and it has to be visible to be read as one.
28697
+ */
28698
+ planesExplainTotal: boolean(),
28699
+ /**
28458
28700
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28459
- * transport resolves one context per connection - but the number that says
28460
- * whether a plane this census cannot see was busy while HTTP was quiet.
28701
+ * adapter resolves one context per connection - kept because a plane's call
28702
+ * count of zero against 37 open connections says something different from a
28703
+ * plane with no connections at all.
28461
28704
  */
28462
28705
  wsConnections: number(),
28706
+ /**
28707
+ * Client frames the WS plane looked at. `wsMessages` far above
28708
+ * `planes.ws + subscriptions` means most traffic is not operations
28709
+ * (keepalives, connection params) - which is itself an answer.
28710
+ */
28711
+ wsMessages: number(),
28712
+ /**
28713
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28714
+ * purpose: one live-events stream opened at boot and held for six hours is
28715
+ * one subscription, and counting it as a call would let a quiet plane
28716
+ * masquerade as the storm.
28717
+ */
28718
+ subscriptions: number(),
28719
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28720
+ subscriptionStops: number(),
28463
28721
  distinctGroups: number(),
28464
- /** Calls counted in the totals whose group attribution was shed at the
28465
- * cardinality bound. */
28722
+ /**
28723
+ * Operations counted in the totals whose CALLER attribution was shed at the
28724
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28725
+ * which transport they arrived on, they just lost their group row.
28726
+ */
28466
28727
  unattributedCalls: number(),
28467
28728
  procedures: array(RequestCensusProcedureSchema).readonly(),
28468
28729
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28485,10 +28746,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28485
28746
  * The layers of the level hierarchy, general → specific. The most specific
28486
28747
  * layer that carries an explicit value wins.
28487
28748
  *
28488
- * `component` is DECLARED and not yet resolvable: the per-component channels
28489
- * are a later slice of the same plan, and a `levelSource` enum that has to
28490
- * grow later would force every consumer of this document to change with it.
28491
- * Nothing returns `component` today.
28749
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
28750
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
28751
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
28752
+ * that turning it on would not force every consumer of this document to widen
28753
+ * a `levelSource` enum — which is what has now not happened.
28492
28754
  */
28493
28755
  var LoggingScopeKindSchema = _enum([
28494
28756
  "cluster",
@@ -28515,6 +28777,14 @@ var LoggingLevelLayerSchema = object({
28515
28777
  scope: LoggingScopeKindSchema,
28516
28778
  /** The node this layer speaks for; `null` on the cluster layer. */
28517
28779
  nodeId: string().nullable(),
28780
+ /**
28781
+ * The declared channel this layer speaks for; `null` on every layer but
28782
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
28783
+ * by design — the convention this repo settled on is one orchestrator-wide
28784
+ * setting, never per node (D52) — so a component layer that carried a node
28785
+ * would invite a per-node copy of a value that has no per-node meaning.
28786
+ */
28787
+ component: string().nullable(),
28518
28788
  /** Explicitly set here, or `null` when this layer inherits. */
28519
28789
  level: LogLevelSchema$1.nullable()
28520
28790
  });
@@ -28556,6 +28826,49 @@ var DiagnosticWindowPatchSchema = object({
28556
28826
  reportEveryMs: number().int().positive().optional()
28557
28827
  });
28558
28828
  /**
28829
+ * A channel ARMED, as the document reports it.
28830
+ *
28831
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
28832
+ * and the time left, because a diagnostic left running is itself an incident
28833
+ * and "armed for 10 minutes" said an hour ago is not an answer.
28834
+ */
28835
+ var LogChannelWindowStateSchema = object({
28836
+ channel: string(),
28837
+ armed: boolean(),
28838
+ /** Epoch ms the window closes at. 0 when disarmed. */
28839
+ armedUntilMs: number(),
28840
+ /** Ms left before it expires on its own. 0 when disarmed. */
28841
+ remainingMs: number(),
28842
+ /**
28843
+ * The cameras it is narrowed to, or `null` for every camera.
28844
+ *
28845
+ * A channel declared `perDevice: false` can only ever report `null` here:
28846
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
28847
+ * produce a filter that silently matches nothing. The server REFUSES such a
28848
+ * patch rather than quietly widening it — ignoring the request would teach
28849
+ * the operator that per-camera filtering works on that channel when it does
28850
+ * not.
28851
+ */
28852
+ deviceIds: array(number().int()).readonly().nullable()
28853
+ });
28854
+ /**
28855
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
28856
+ * for the same reason: a channel is a window with a deadline, never a switch.
28857
+ */
28858
+ var LogChannelWindowPatchSchema = object({
28859
+ channel: string().min(1),
28860
+ armMs: number().int().min(0),
28861
+ /**
28862
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
28863
+ *
28864
+ * Numeric because the repo's own rule makes it possible: every log line
28865
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
28866
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
28867
+ * diagnosed by hand, and this is the first thing that collects on it.
28868
+ */
28869
+ deviceIds: array(number().int()).readonly().nullable().optional()
28870
+ });
28871
+ /**
28559
28872
  * A PATCH, and patches MERGE.
28560
28873
  *
28561
28874
  * A field absent from the patch is left exactly as it was — arming a
@@ -28574,7 +28887,14 @@ var LoggingSettingsPatchSchema = object({
28574
28887
  * Only the diagnostics NAMED here change. An armed window that is not listed
28575
28888
  * keeps running — a patch is never a full replacement.
28576
28889
  */
28577
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
28890
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
28891
+ /**
28892
+ * Only the channels NAMED here change. An armed channel that is not listed
28893
+ * keeps running — same rule as `diagnostics`, because a patch that silently
28894
+ * disarmed the channels it did not mention would make the Levels page and
28895
+ * the Diagnostics page fight over the same value.
28896
+ */
28897
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28578
28898
  });
28579
28899
  /**
28580
28900
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28587,9 +28907,22 @@ var LoggingSettingsPatchSchema = object({
28587
28907
  * authority over the whole hierarchy and answers for every layer, so the
28588
28908
  * layer selector needs a name the transport does not already own.
28589
28909
  */
28590
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
28910
+ var GetLoggingSettingsInputSchema = object({
28911
+ scopeNodeId: string().optional(),
28912
+ /**
28913
+ * The declared CHANNEL this document is addressed at, when the caller wants
28914
+ * the `component` layer. Absent = the node/cluster hierarchy only.
28915
+ *
28916
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
28917
+ * axes from collapsing: a component level is cluster-wide, a node level is
28918
+ * not, and one selector for both would make "which of these two did I just
28919
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
28920
+ */
28921
+ scopeComponent: string().optional()
28922
+ });
28591
28923
  var SetLoggingSettingsInputSchema = object({
28592
28924
  scopeNodeId: string().optional(),
28925
+ scopeComponent: string().optional(),
28593
28926
  patch: LoggingSettingsPatchSchema
28594
28927
  });
28595
28928
  /**
@@ -28604,9 +28937,20 @@ var SetLoggingSettingsInputSchema = object({
28604
28937
  var LoggingSettingsStateSchema = object({
28605
28938
  /** The layer this document was read at. `null` = the cluster layer. */
28606
28939
  scopeNodeId: string().nullable(),
28940
+ /** The channel this document was read at. `null` = no component layer. */
28941
+ scopeComponent: string().nullable(),
28607
28942
  effective: LoggingEffectiveSchema,
28608
28943
  explicit: LoggingExplicitSchema,
28609
28944
  activeWindows: array(DiagnosticWindowSchema).readonly(),
28945
+ /**
28946
+ * Every channel the cluster's addons DECLARE, gathered from the
28947
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
28948
+ * channel added by a redeployed addon appears without anybody editing a
28949
+ * list, and a channel whose addon is gone stops being offered.
28950
+ */
28951
+ channels: array(LogChannelDescriptorSchema).readonly(),
28952
+ /** The channels ARMED right now, each with its deadline. */
28953
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28610
28954
  persisted: boolean()
28611
28955
  });
28612
28956
  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(), {
@@ -31591,6 +31935,12 @@ Object.freeze({
31591
31935
  addonId: null,
31592
31936
  access: "view"
31593
31937
  },
31938
+ "dataStoreProvider.aggregate": {
31939
+ capName: "data-store-provider",
31940
+ capScope: "system",
31941
+ addonId: null,
31942
+ access: "view"
31943
+ },
31594
31944
  "dataStoreProvider.count": {
31595
31945
  capName: "data-store-provider",
31596
31946
  capScope: "system",
@@ -32005,6 +32355,12 @@ Object.freeze({
32005
32355
  addonId: null,
32006
32356
  access: "view"
32007
32357
  },
32358
+ "deviceManager.getChildrenBatch": {
32359
+ capName: "device-manager",
32360
+ capScope: "system",
32361
+ addonId: null,
32362
+ access: "view"
32363
+ },
32008
32364
  "deviceManager.getConfigSchema": {
32009
32365
  capName: "device-manager",
32010
32366
  capScope: "system",
@@ -33055,6 +33411,18 @@ Object.freeze({
33055
33411
  addonId: null,
33056
33412
  access: "create"
33057
33413
  },
33414
+ "logChannels.apply": {
33415
+ capName: "log-channels",
33416
+ capScope: "system",
33417
+ addonId: null,
33418
+ access: "create"
33419
+ },
33420
+ "logChannels.list": {
33421
+ capName: "log-channels",
33422
+ capScope: "system",
33423
+ addonId: null,
33424
+ access: "view"
33425
+ },
33058
33426
  "logDestination.query": {
33059
33427
  capName: "log-destination",
33060
33428
  capScope: "system",
@@ -35209,6 +35577,12 @@ Object.freeze({
35209
35577
  addonId: null,
35210
35578
  access: "create"
35211
35579
  },
35580
+ "settingsStore.aggregate": {
35581
+ capName: "settings-store",
35582
+ capScope: "system",
35583
+ addonId: null,
35584
+ access: "view"
35585
+ },
35212
35586
  "settingsStore.count": {
35213
35587
  capName: "settings-store",
35214
35588
  capScope: "system",
@@ -36788,6 +37162,11 @@ Object.freeze({
36788
37162
  form: "single",
36789
37163
  optional: false
36790
37164
  }],
37165
+ "deviceManager.getChildrenBatch": [{
37166
+ name: "parentDeviceIds",
37167
+ form: "array",
37168
+ optional: false
37169
+ }],
36791
37170
  "deviceManager.getConfigSchema": [{
36792
37171
  name: "deviceId",
36793
37172
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-gree",
3
- "version": "0.2.31",
3
+ "version": "0.2.33",
4
4
  "description": "Gree air-conditioner device-provider addon for CamStack — wraps the @apocaliss92/nodegree local-UDP client (LAN discovery + AES control), exposing climate-control and fan-control",
5
5
  "keywords": [
6
6
  "camstack",