@camstack/addon-import-alexa 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
@@ -7626,6 +7626,111 @@ var CameraSwitchGroupSchema = object({
7626
7626
  fetchedAt: number()
7627
7627
  });
7628
7628
  /**
7629
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7630
+ * an addon declares its channels in.
7631
+ *
7632
+ * ## Two axes, deliberately separated
7633
+ *
7634
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7635
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7636
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7637
+ * and rots silently. So a channel is declared where it is consulted, and the
7638
+ * `log-channels` capability enumerates the declarations.
7639
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7640
+ * thing: the logging settings document on the `system` cap. Two authorities
7641
+ * over the values is the exact defect
7642
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7643
+ * remove; re-introducing it from the cure side would be grotesque.
7644
+ *
7645
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7646
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7647
+ * the hot path with a value somebody actually read, and by
7648
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7649
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7650
+ * disarmed one (D49).
7651
+ *
7652
+ * ## The canonical call shape
7653
+ *
7654
+ * ```ts
7655
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7656
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7657
+ * }
7658
+ * ```
7659
+ *
7660
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7661
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7662
+ * object literal is never constructed because it lives inside the branch. It
7663
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7664
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7665
+ * destination floor (measured at 1.93 ns/call when off).
7666
+ *
7667
+ * ## Why a channel emits at `info`
7668
+ *
7669
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7670
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7671
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7672
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7673
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7674
+ * emits at the channel's declared level, whose schema floor is `info`.
7675
+ */
7676
+ /**
7677
+ * The level a channel writes at once armed.
7678
+ *
7679
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7680
+ * not leave the process for Loki, and the whole point of arming a channel is
7681
+ * to read it later.
7682
+ */
7683
+ var LogChannelLevelSchema = _enum([
7684
+ "info",
7685
+ "warn",
7686
+ "error"
7687
+ ]);
7688
+ /**
7689
+ * What an addon declares about one channel. No value, no state — a
7690
+ * declaration is inert.
7691
+ */
7692
+ var LogChannelDescriptorSchema = object({
7693
+ /**
7694
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7695
+ * the addon's short name so an operator reading a channel list can tell who
7696
+ * owns it without a second lookup.
7697
+ */
7698
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7699
+ /** One sentence: what the operator will SEE after arming it. */
7700
+ description: string().min(1),
7701
+ /** The level its lines are emitted at. Never below `info`. */
7702
+ defaultLevel: LogChannelLevelSchema,
7703
+ /**
7704
+ * Whether this channel can be narrowed to a camera.
7705
+ *
7706
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7707
+ * consulted with the numeric device id, AND every line the channel admits
7708
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7709
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7710
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7711
+ * the body is the only way to filter.
7712
+ *
7713
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7714
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7715
+ * the operator narrows to one camera, sees nothing, and concludes the code
7716
+ * path was never taken.
7717
+ */
7718
+ perDevice: boolean()
7719
+ });
7720
+ /**
7721
+ * An armed window over one channel, as the document hands it to a mirror.
7722
+ *
7723
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7724
+ * expires by itself, which is the one failure a boolean cannot avoid.
7725
+ */
7726
+ var LogChannelWindowSchema = object({
7727
+ channel: string().min(1),
7728
+ /** Epoch ms the window closes at. */
7729
+ armedUntilMs: number(),
7730
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7731
+ deviceIds: array(number().int()).readonly().nullable()
7732
+ });
7733
+ /**
7629
7734
  * Ops-log — the durable, append-only operations audit shared by the
7630
7735
  * recordings and events management surfaces.
7631
7736
  *
@@ -11314,6 +11419,35 @@ var MutationFilterSchema = object({
11314
11419
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11315
11420
  whereNot: record(string(), unknown()).optional()
11316
11421
  });
11422
+ /**
11423
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11424
+ *
11425
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11426
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11427
+ * a `Record<column, op>` shape could not express.
11428
+ */
11429
+ var AggregateFieldSchema = object({
11430
+ /** Result key. */
11431
+ as: string().min(1),
11432
+ /** Column to aggregate. Must be a real column of a declared collection. */
11433
+ field: string().min(1),
11434
+ op: _enum([
11435
+ "sum",
11436
+ "min",
11437
+ "max"
11438
+ ])
11439
+ });
11440
+ /**
11441
+ * `COUNT(*)` plus one number per requested field.
11442
+ *
11443
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11444
+ * that really is 0 are different facts, and an accounting caller that renders
11445
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11446
+ */
11447
+ var AggregateResultSchema = object({
11448
+ count: number().int(),
11449
+ values: record(string(), number().nullable())
11450
+ });
11317
11451
  /** A single stored record: `{ id, data }`. */
11318
11452
  var SettingsRecordSchema = object({
11319
11453
  id: string(),
@@ -11398,6 +11532,11 @@ method(object({
11398
11532
  collection: string(),
11399
11533
  filter: QueryFilterSchema.optional()
11400
11534
  }), number()), method(object({
11535
+ namespace: string().optional(),
11536
+ collection: string(),
11537
+ fields: array(AggregateFieldSchema).readonly(),
11538
+ filter: QueryFilterSchema.optional()
11539
+ }), AggregateResultSchema), method(object({
11401
11540
  namespace: string().optional(),
11402
11541
  collection: string(),
11403
11542
  field: string(),
@@ -11514,6 +11653,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11514
11653
  collection: string(),
11515
11654
  filter: QueryFilterSchema.optional()
11516
11655
  }), number(), { auth: "admin" }), method(object({
11656
+ namespace: string().optional(),
11657
+ collection: string(),
11658
+ fields: array(AggregateFieldSchema).readonly(),
11659
+ filter: QueryFilterSchema.optional()
11660
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11517
11661
  namespace: string().optional(),
11518
11662
  collection: string(),
11519
11663
  field: string(),
@@ -12254,24 +12398,6 @@ var deviceProviderCapability = {
12254
12398
  })
12255
12399
  }
12256
12400
  };
12257
- /**
12258
- * Device Manager capability — hub-side singleton that unifies device persistence,
12259
- * live registry access, and all management operations into a single tRPC surface.
12260
- *
12261
- * Replaces:
12262
- * - `device-persistence` capability (persistence methods absorbed here)
12263
- * - `device-management.router.ts` (deleted in Phase 2)
12264
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12265
- *
12266
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12267
- * fork into separate processes but never run on remote cluster agents. Therefore:
12268
- * - No nodeId routing needed — this is a pure hub singleton.
12269
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12270
- * - No shadow registry or cross-node aggregation required.
12271
- *
12272
- * Forked workers register devices back to the hub via `ctx.devices`
12273
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12274
- */
12275
12401
  /** One child-placement directive on a container's `childLayout`. Structurally
12276
12402
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12277
12403
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12640,7 +12766,7 @@ method(object({
12640
12766
  * it answers today and the caller filters as it already does.
12641
12767
  */
12642
12768
  deviceIds: array(number()).optional()
12643
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12769
+ }), 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({
12644
12770
  mode: LinkedDevicesModeSchema,
12645
12771
  devices: array(LinkedDeviceSchema)
12646
12772
  })), 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({
@@ -13364,6 +13490,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13364
13490
  kind: "mutation",
13365
13491
  auth: "admin"
13366
13492
  });
13493
+ /**
13494
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13495
+ * through. It stores nothing.
13496
+ *
13497
+ * ## Why a capability at all, and why this shape
13498
+ *
13499
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13500
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13501
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13502
+ * fails, an operator just never sees the channel somebody added. So the list
13503
+ * is assembled from declarations at runtime.
13504
+ *
13505
+ * The shape is copied from `log-destination.cap.ts`, which already does
13506
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13507
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13508
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13509
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13510
+ * runner's declarations reach hub-main over the transport that already exists.
13511
+ * No new UDS message, no second registry.
13512
+ *
13513
+ * ## What it deliberately does NOT own
13514
+ *
13515
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13516
+ * ONE place: the logging settings document on the `system` cap
13517
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13518
+ * value is the defect the plan behind this work exists to remove, and
13519
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13520
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13521
+ * setter for a window and no persistence of any kind.
13522
+ *
13523
+ * ## Why `apply` is here even so
13524
+ *
13525
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13526
+ * seam has to carry the value from the authority to the mirror, and a channel
13527
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13528
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13529
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13530
+ * persists nothing, it is never the source of a value, and it is called only
13531
+ * with a set the hub actually read (D49 — a read that fails does not call it
13532
+ * at all, so no channel is silently disarmed by a bad read).
13533
+ */
13534
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13535
+ var LogChannelApplyResultSchema = object({
13536
+ /** How many declared channels are armed in this process after the call. */
13537
+ armed: number().int().min(0),
13538
+ /**
13539
+ * Names the document armed that this process does not declare. Reported
13540
+ * rather than swallowed: a name here is either a typo or an addon that has
13541
+ * not booted, and both deserve a line instead of silence.
13542
+ */
13543
+ unknown: array(string()).readonly()
13544
+ });
13545
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13367
13546
  var LogLevelSchema = _enum([
13368
13547
  "debug",
13369
13548
  "info",
@@ -28663,17 +28842,60 @@ var SetSiteLocationInputSchema = object({
28663
28842
  longitude: number().min(-180).max(180)
28664
28843
  }).nullable();
28665
28844
  /**
28666
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28845
+ * The TRANSPORT a call arrived on.
28846
+ *
28847
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28848
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28849
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28850
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28851
+ * checkable rather than asserted.
28852
+ *
28853
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28854
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28855
+ * connection; the viewer talks to the hub over `wsLink`
28856
+ * exclusively, so this is the plane the HTTP census could not see.
28857
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28858
+ * never touches a socket and therefore never touched a census.
28859
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28860
+ * that is exactly what its `0` asserts: every plane the hub has can name
28861
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28862
+ * plane nobody instrumented lands here instead of vanishing from the total.
28863
+ */
28864
+ var TransportPlaneSchema = _enum([
28865
+ "http",
28866
+ "ws",
28867
+ "mesh",
28868
+ "unknown"
28869
+ ]);
28870
+ /**
28871
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28872
+ * reads as "not instrumented", which is the one thing this census must never
28873
+ * make an operator wonder about.
28874
+ */
28875
+ var TransportPlaneCountsSchema = object({
28876
+ http: number(),
28877
+ ws: number(),
28878
+ mesh: number(),
28879
+ unknown: number()
28880
+ });
28881
+ /**
28882
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28667
28883
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28668
28884
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28669
28885
  * already prints - never a token, never an `Authorization` header.
28886
+ *
28887
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28888
+ * and lives for hours, so folding it into a call count makes one long-lived
28889
+ * stream look like a storm.
28670
28890
  */
28671
28891
  var RequestCensusGroupSchema = object({
28892
+ plane: TransportPlaneSchema,
28672
28893
  procedure: string(),
28673
28894
  userAgent: string(),
28674
28895
  ip: string(),
28675
28896
  principal: string(),
28676
28897
  calls: number(),
28898
+ subscriptions: number(),
28677
28899
  perMin: number()
28678
28900
  });
28679
28901
  /**
@@ -28686,6 +28908,14 @@ var RequestCensusGroupSchema = object({
28686
28908
  var RequestCensusProcedureSchema = object({
28687
28909
  procedure: string(),
28688
28910
  calls: number(),
28911
+ /**
28912
+ * The same total, split by transport. THIS is the row that answers the
28913
+ * question the census exists for: one look at `deviceManager.listAll` says
28914
+ * which plane carried the 4 960, without joining two log lines by eye.
28915
+ */
28916
+ planes: TransportPlaneCountsSchema,
28917
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28918
+ subscriptions: number(),
28689
28919
  perMin: number()
28690
28920
  });
28691
28921
  /**
@@ -28713,14 +28943,45 @@ var RequestCensusStatusSchema = object({
28713
28943
  */
28714
28944
  procedureCalls: number(),
28715
28945
  /**
28946
+ * `procedureCalls` split by transport. The four keys sum to
28947
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28948
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28949
+ */
28950
+ planes: TransportPlaneCountsSchema,
28951
+ /**
28952
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28953
+ * on no plane at all - which is a RESULT (a plane is missing from the
28954
+ * instrument), not a failure, and it has to be visible to be read as one.
28955
+ */
28956
+ planesExplainTotal: boolean(),
28957
+ /**
28716
28958
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28717
- * transport resolves one context per connection - but the number that says
28718
- * whether a plane this census cannot see was busy while HTTP was quiet.
28959
+ * adapter resolves one context per connection - kept because a plane's call
28960
+ * count of zero against 37 open connections says something different from a
28961
+ * plane with no connections at all.
28719
28962
  */
28720
28963
  wsConnections: number(),
28964
+ /**
28965
+ * Client frames the WS plane looked at. `wsMessages` far above
28966
+ * `planes.ws + subscriptions` means most traffic is not operations
28967
+ * (keepalives, connection params) - which is itself an answer.
28968
+ */
28969
+ wsMessages: number(),
28970
+ /**
28971
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28972
+ * purpose: one live-events stream opened at boot and held for six hours is
28973
+ * one subscription, and counting it as a call would let a quiet plane
28974
+ * masquerade as the storm.
28975
+ */
28976
+ subscriptions: number(),
28977
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28978
+ subscriptionStops: number(),
28721
28979
  distinctGroups: number(),
28722
- /** Calls counted in the totals whose group attribution was shed at the
28723
- * cardinality bound. */
28980
+ /**
28981
+ * Operations counted in the totals whose CALLER attribution was shed at the
28982
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28983
+ * which transport they arrived on, they just lost their group row.
28984
+ */
28724
28985
  unattributedCalls: number(),
28725
28986
  procedures: array(RequestCensusProcedureSchema).readonly(),
28726
28987
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28743,10 +29004,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28743
29004
  * The layers of the level hierarchy, general → specific. The most specific
28744
29005
  * layer that carries an explicit value wins.
28745
29006
  *
28746
- * `component` is DECLARED and not yet resolvable: the per-component channels
28747
- * are a later slice of the same plan, and a `levelSource` enum that has to
28748
- * grow later would force every consumer of this document to change with it.
28749
- * Nothing returns `component` today.
29007
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29008
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29009
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29010
+ * that turning it on would not force every consumer of this document to widen
29011
+ * a `levelSource` enum — which is what has now not happened.
28750
29012
  */
28751
29013
  var LoggingScopeKindSchema = _enum([
28752
29014
  "cluster",
@@ -28773,6 +29035,14 @@ var LoggingLevelLayerSchema = object({
28773
29035
  scope: LoggingScopeKindSchema,
28774
29036
  /** The node this layer speaks for; `null` on the cluster layer. */
28775
29037
  nodeId: string().nullable(),
29038
+ /**
29039
+ * The declared channel this layer speaks for; `null` on every layer but
29040
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29041
+ * by design — the convention this repo settled on is one orchestrator-wide
29042
+ * setting, never per node (D52) — so a component layer that carried a node
29043
+ * would invite a per-node copy of a value that has no per-node meaning.
29044
+ */
29045
+ component: string().nullable(),
28776
29046
  /** Explicitly set here, or `null` when this layer inherits. */
28777
29047
  level: LogLevelSchema$1.nullable()
28778
29048
  });
@@ -28814,6 +29084,49 @@ var DiagnosticWindowPatchSchema = object({
28814
29084
  reportEveryMs: number().int().positive().optional()
28815
29085
  });
28816
29086
  /**
29087
+ * A channel ARMED, as the document reports it.
29088
+ *
29089
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29090
+ * and the time left, because a diagnostic left running is itself an incident
29091
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29092
+ */
29093
+ var LogChannelWindowStateSchema = object({
29094
+ channel: string(),
29095
+ armed: boolean(),
29096
+ /** Epoch ms the window closes at. 0 when disarmed. */
29097
+ armedUntilMs: number(),
29098
+ /** Ms left before it expires on its own. 0 when disarmed. */
29099
+ remainingMs: number(),
29100
+ /**
29101
+ * The cameras it is narrowed to, or `null` for every camera.
29102
+ *
29103
+ * A channel declared `perDevice: false` can only ever report `null` here:
29104
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29105
+ * produce a filter that silently matches nothing. The server REFUSES such a
29106
+ * patch rather than quietly widening it — ignoring the request would teach
29107
+ * the operator that per-camera filtering works on that channel when it does
29108
+ * not.
29109
+ */
29110
+ deviceIds: array(number().int()).readonly().nullable()
29111
+ });
29112
+ /**
29113
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29114
+ * for the same reason: a channel is a window with a deadline, never a switch.
29115
+ */
29116
+ var LogChannelWindowPatchSchema = object({
29117
+ channel: string().min(1),
29118
+ armMs: number().int().min(0),
29119
+ /**
29120
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29121
+ *
29122
+ * Numeric because the repo's own rule makes it possible: every log line
29123
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29124
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29125
+ * diagnosed by hand, and this is the first thing that collects on it.
29126
+ */
29127
+ deviceIds: array(number().int()).readonly().nullable().optional()
29128
+ });
29129
+ /**
28817
29130
  * A PATCH, and patches MERGE.
28818
29131
  *
28819
29132
  * A field absent from the patch is left exactly as it was — arming a
@@ -28832,7 +29145,14 @@ var LoggingSettingsPatchSchema = object({
28832
29145
  * Only the diagnostics NAMED here change. An armed window that is not listed
28833
29146
  * keeps running — a patch is never a full replacement.
28834
29147
  */
28835
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29148
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29149
+ /**
29150
+ * Only the channels NAMED here change. An armed channel that is not listed
29151
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29152
+ * disarmed the channels it did not mention would make the Levels page and
29153
+ * the Diagnostics page fight over the same value.
29154
+ */
29155
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28836
29156
  });
28837
29157
  /**
28838
29158
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28845,9 +29165,22 @@ var LoggingSettingsPatchSchema = object({
28845
29165
  * authority over the whole hierarchy and answers for every layer, so the
28846
29166
  * layer selector needs a name the transport does not already own.
28847
29167
  */
28848
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29168
+ var GetLoggingSettingsInputSchema = object({
29169
+ scopeNodeId: string().optional(),
29170
+ /**
29171
+ * The declared CHANNEL this document is addressed at, when the caller wants
29172
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29173
+ *
29174
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29175
+ * axes from collapsing: a component level is cluster-wide, a node level is
29176
+ * not, and one selector for both would make "which of these two did I just
29177
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29178
+ */
29179
+ scopeComponent: string().optional()
29180
+ });
28849
29181
  var SetLoggingSettingsInputSchema = object({
28850
29182
  scopeNodeId: string().optional(),
29183
+ scopeComponent: string().optional(),
28851
29184
  patch: LoggingSettingsPatchSchema
28852
29185
  });
28853
29186
  /**
@@ -28862,9 +29195,20 @@ var SetLoggingSettingsInputSchema = object({
28862
29195
  var LoggingSettingsStateSchema = object({
28863
29196
  /** The layer this document was read at. `null` = the cluster layer. */
28864
29197
  scopeNodeId: string().nullable(),
29198
+ /** The channel this document was read at. `null` = no component layer. */
29199
+ scopeComponent: string().nullable(),
28865
29200
  effective: LoggingEffectiveSchema,
28866
29201
  explicit: LoggingExplicitSchema,
28867
29202
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29203
+ /**
29204
+ * Every channel the cluster's addons DECLARE, gathered from the
29205
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29206
+ * channel added by a redeployed addon appears without anybody editing a
29207
+ * list, and a channel whose addon is gone stops being offered.
29208
+ */
29209
+ channels: array(LogChannelDescriptorSchema).readonly(),
29210
+ /** The channels ARMED right now, each with its deadline. */
29211
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28868
29212
  persisted: boolean()
28869
29213
  });
28870
29214
  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(), {
@@ -31849,6 +32193,12 @@ Object.freeze({
31849
32193
  addonId: null,
31850
32194
  access: "view"
31851
32195
  },
32196
+ "dataStoreProvider.aggregate": {
32197
+ capName: "data-store-provider",
32198
+ capScope: "system",
32199
+ addonId: null,
32200
+ access: "view"
32201
+ },
31852
32202
  "dataStoreProvider.count": {
31853
32203
  capName: "data-store-provider",
31854
32204
  capScope: "system",
@@ -32263,6 +32613,12 @@ Object.freeze({
32263
32613
  addonId: null,
32264
32614
  access: "view"
32265
32615
  },
32616
+ "deviceManager.getChildrenBatch": {
32617
+ capName: "device-manager",
32618
+ capScope: "system",
32619
+ addonId: null,
32620
+ access: "view"
32621
+ },
32266
32622
  "deviceManager.getConfigSchema": {
32267
32623
  capName: "device-manager",
32268
32624
  capScope: "system",
@@ -33313,6 +33669,18 @@ Object.freeze({
33313
33669
  addonId: null,
33314
33670
  access: "create"
33315
33671
  },
33672
+ "logChannels.apply": {
33673
+ capName: "log-channels",
33674
+ capScope: "system",
33675
+ addonId: null,
33676
+ access: "create"
33677
+ },
33678
+ "logChannels.list": {
33679
+ capName: "log-channels",
33680
+ capScope: "system",
33681
+ addonId: null,
33682
+ access: "view"
33683
+ },
33316
33684
  "logDestination.query": {
33317
33685
  capName: "log-destination",
33318
33686
  capScope: "system",
@@ -35467,6 +35835,12 @@ Object.freeze({
35467
35835
  addonId: null,
35468
35836
  access: "create"
35469
35837
  },
35838
+ "settingsStore.aggregate": {
35839
+ capName: "settings-store",
35840
+ capScope: "system",
35841
+ addonId: null,
35842
+ access: "view"
35843
+ },
35470
35844
  "settingsStore.count": {
35471
35845
  capName: "settings-store",
35472
35846
  capScope: "system",
@@ -37046,6 +37420,11 @@ Object.freeze({
37046
37420
  form: "single",
37047
37421
  optional: false
37048
37422
  }],
37423
+ "deviceManager.getChildrenBatch": [{
37424
+ name: "parentDeviceIds",
37425
+ form: "array",
37426
+ optional: false
37427
+ }],
37049
37428
  "deviceManager.getConfigSchema": [{
37050
37429
  name: "deviceId",
37051
37430
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7626,6 +7626,111 @@ var CameraSwitchGroupSchema = object({
7626
7626
  fetchedAt: number()
7627
7627
  });
7628
7628
  /**
7629
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7630
+ * an addon declares its channels in.
7631
+ *
7632
+ * ## Two axes, deliberately separated
7633
+ *
7634
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7635
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7636
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7637
+ * and rots silently. So a channel is declared where it is consulted, and the
7638
+ * `log-channels` capability enumerates the declarations.
7639
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7640
+ * thing: the logging settings document on the `system` cap. Two authorities
7641
+ * over the values is the exact defect
7642
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7643
+ * remove; re-introducing it from the cure side would be grotesque.
7644
+ *
7645
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7646
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7647
+ * the hot path with a value somebody actually read, and by
7648
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7649
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7650
+ * disarmed one (D49).
7651
+ *
7652
+ * ## The canonical call shape
7653
+ *
7654
+ * ```ts
7655
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7656
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7657
+ * }
7658
+ * ```
7659
+ *
7660
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7661
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7662
+ * object literal is never constructed because it lives inside the branch. It
7663
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7664
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7665
+ * destination floor (measured at 1.93 ns/call when off).
7666
+ *
7667
+ * ## Why a channel emits at `info`
7668
+ *
7669
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7670
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7671
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7672
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7673
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7674
+ * emits at the channel's declared level, whose schema floor is `info`.
7675
+ */
7676
+ /**
7677
+ * The level a channel writes at once armed.
7678
+ *
7679
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7680
+ * not leave the process for Loki, and the whole point of arming a channel is
7681
+ * to read it later.
7682
+ */
7683
+ var LogChannelLevelSchema = _enum([
7684
+ "info",
7685
+ "warn",
7686
+ "error"
7687
+ ]);
7688
+ /**
7689
+ * What an addon declares about one channel. No value, no state — a
7690
+ * declaration is inert.
7691
+ */
7692
+ var LogChannelDescriptorSchema = object({
7693
+ /**
7694
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7695
+ * the addon's short name so an operator reading a channel list can tell who
7696
+ * owns it without a second lookup.
7697
+ */
7698
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7699
+ /** One sentence: what the operator will SEE after arming it. */
7700
+ description: string().min(1),
7701
+ /** The level its lines are emitted at. Never below `info`. */
7702
+ defaultLevel: LogChannelLevelSchema,
7703
+ /**
7704
+ * Whether this channel can be narrowed to a camera.
7705
+ *
7706
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7707
+ * consulted with the numeric device id, AND every line the channel admits
7708
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7709
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7710
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7711
+ * the body is the only way to filter.
7712
+ *
7713
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7714
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7715
+ * the operator narrows to one camera, sees nothing, and concludes the code
7716
+ * path was never taken.
7717
+ */
7718
+ perDevice: boolean()
7719
+ });
7720
+ /**
7721
+ * An armed window over one channel, as the document hands it to a mirror.
7722
+ *
7723
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7724
+ * expires by itself, which is the one failure a boolean cannot avoid.
7725
+ */
7726
+ var LogChannelWindowSchema = object({
7727
+ channel: string().min(1),
7728
+ /** Epoch ms the window closes at. */
7729
+ armedUntilMs: number(),
7730
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7731
+ deviceIds: array(number().int()).readonly().nullable()
7732
+ });
7733
+ /**
7629
7734
  * Ops-log — the durable, append-only operations audit shared by the
7630
7735
  * recordings and events management surfaces.
7631
7736
  *
@@ -11314,6 +11419,35 @@ var MutationFilterSchema = object({
11314
11419
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11315
11420
  whereNot: record(string(), unknown()).optional()
11316
11421
  });
11422
+ /**
11423
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11424
+ *
11425
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11426
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11427
+ * a `Record<column, op>` shape could not express.
11428
+ */
11429
+ var AggregateFieldSchema = object({
11430
+ /** Result key. */
11431
+ as: string().min(1),
11432
+ /** Column to aggregate. Must be a real column of a declared collection. */
11433
+ field: string().min(1),
11434
+ op: _enum([
11435
+ "sum",
11436
+ "min",
11437
+ "max"
11438
+ ])
11439
+ });
11440
+ /**
11441
+ * `COUNT(*)` plus one number per requested field.
11442
+ *
11443
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11444
+ * that really is 0 are different facts, and an accounting caller that renders
11445
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11446
+ */
11447
+ var AggregateResultSchema = object({
11448
+ count: number().int(),
11449
+ values: record(string(), number().nullable())
11450
+ });
11317
11451
  /** A single stored record: `{ id, data }`. */
11318
11452
  var SettingsRecordSchema = object({
11319
11453
  id: string(),
@@ -11398,6 +11532,11 @@ method(object({
11398
11532
  collection: string(),
11399
11533
  filter: QueryFilterSchema.optional()
11400
11534
  }), number()), method(object({
11535
+ namespace: string().optional(),
11536
+ collection: string(),
11537
+ fields: array(AggregateFieldSchema).readonly(),
11538
+ filter: QueryFilterSchema.optional()
11539
+ }), AggregateResultSchema), method(object({
11401
11540
  namespace: string().optional(),
11402
11541
  collection: string(),
11403
11542
  field: string(),
@@ -11514,6 +11653,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11514
11653
  collection: string(),
11515
11654
  filter: QueryFilterSchema.optional()
11516
11655
  }), number(), { auth: "admin" }), method(object({
11656
+ namespace: string().optional(),
11657
+ collection: string(),
11658
+ fields: array(AggregateFieldSchema).readonly(),
11659
+ filter: QueryFilterSchema.optional()
11660
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11517
11661
  namespace: string().optional(),
11518
11662
  collection: string(),
11519
11663
  field: string(),
@@ -12254,24 +12398,6 @@ var deviceProviderCapability = {
12254
12398
  })
12255
12399
  }
12256
12400
  };
12257
- /**
12258
- * Device Manager capability — hub-side singleton that unifies device persistence,
12259
- * live registry access, and all management operations into a single tRPC surface.
12260
- *
12261
- * Replaces:
12262
- * - `device-persistence` capability (persistence methods absorbed here)
12263
- * - `device-management.router.ts` (deleted in Phase 2)
12264
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12265
- *
12266
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12267
- * fork into separate processes but never run on remote cluster agents. Therefore:
12268
- * - No nodeId routing needed — this is a pure hub singleton.
12269
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12270
- * - No shadow registry or cross-node aggregation required.
12271
- *
12272
- * Forked workers register devices back to the hub via `ctx.devices`
12273
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12274
- */
12275
12401
  /** One child-placement directive on a container's `childLayout`. Structurally
12276
12402
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12277
12403
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12640,7 +12766,7 @@ method(object({
12640
12766
  * it answers today and the caller filters as it already does.
12641
12767
  */
12642
12768
  deviceIds: array(number()).optional()
12643
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12769
+ }), 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({
12644
12770
  mode: LinkedDevicesModeSchema,
12645
12771
  devices: array(LinkedDeviceSchema)
12646
12772
  })), 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({
@@ -13364,6 +13490,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13364
13490
  kind: "mutation",
13365
13491
  auth: "admin"
13366
13492
  });
13493
+ /**
13494
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13495
+ * through. It stores nothing.
13496
+ *
13497
+ * ## Why a capability at all, and why this shape
13498
+ *
13499
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13500
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13501
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13502
+ * fails, an operator just never sees the channel somebody added. So the list
13503
+ * is assembled from declarations at runtime.
13504
+ *
13505
+ * The shape is copied from `log-destination.cap.ts`, which already does
13506
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13507
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13508
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13509
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13510
+ * runner's declarations reach hub-main over the transport that already exists.
13511
+ * No new UDS message, no second registry.
13512
+ *
13513
+ * ## What it deliberately does NOT own
13514
+ *
13515
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13516
+ * ONE place: the logging settings document on the `system` cap
13517
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13518
+ * value is the defect the plan behind this work exists to remove, and
13519
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13520
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13521
+ * setter for a window and no persistence of any kind.
13522
+ *
13523
+ * ## Why `apply` is here even so
13524
+ *
13525
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13526
+ * seam has to carry the value from the authority to the mirror, and a channel
13527
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13528
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13529
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13530
+ * persists nothing, it is never the source of a value, and it is called only
13531
+ * with a set the hub actually read (D49 — a read that fails does not call it
13532
+ * at all, so no channel is silently disarmed by a bad read).
13533
+ */
13534
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13535
+ var LogChannelApplyResultSchema = object({
13536
+ /** How many declared channels are armed in this process after the call. */
13537
+ armed: number().int().min(0),
13538
+ /**
13539
+ * Names the document armed that this process does not declare. Reported
13540
+ * rather than swallowed: a name here is either a typo or an addon that has
13541
+ * not booted, and both deserve a line instead of silence.
13542
+ */
13543
+ unknown: array(string()).readonly()
13544
+ });
13545
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13367
13546
  var LogLevelSchema = _enum([
13368
13547
  "debug",
13369
13548
  "info",
@@ -28663,17 +28842,60 @@ var SetSiteLocationInputSchema = object({
28663
28842
  longitude: number().min(-180).max(180)
28664
28843
  }).nullable();
28665
28844
  /**
28666
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28845
+ * The TRANSPORT a call arrived on.
28846
+ *
28847
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28848
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28849
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28850
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28851
+ * checkable rather than asserted.
28852
+ *
28853
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28854
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28855
+ * connection; the viewer talks to the hub over `wsLink`
28856
+ * exclusively, so this is the plane the HTTP census could not see.
28857
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28858
+ * never touches a socket and therefore never touched a census.
28859
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28860
+ * that is exactly what its `0` asserts: every plane the hub has can name
28861
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28862
+ * plane nobody instrumented lands here instead of vanishing from the total.
28863
+ */
28864
+ var TransportPlaneSchema = _enum([
28865
+ "http",
28866
+ "ws",
28867
+ "mesh",
28868
+ "unknown"
28869
+ ]);
28870
+ /**
28871
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28872
+ * reads as "not instrumented", which is the one thing this census must never
28873
+ * make an operator wonder about.
28874
+ */
28875
+ var TransportPlaneCountsSchema = object({
28876
+ http: number(),
28877
+ ws: number(),
28878
+ mesh: number(),
28879
+ unknown: number()
28880
+ });
28881
+ /**
28882
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28667
28883
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28668
28884
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28669
28885
  * already prints - never a token, never an `Authorization` header.
28886
+ *
28887
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
28888
+ * and lives for hours, so folding it into a call count makes one long-lived
28889
+ * stream look like a storm.
28670
28890
  */
28671
28891
  var RequestCensusGroupSchema = object({
28892
+ plane: TransportPlaneSchema,
28672
28893
  procedure: string(),
28673
28894
  userAgent: string(),
28674
28895
  ip: string(),
28675
28896
  principal: string(),
28676
28897
  calls: number(),
28898
+ subscriptions: number(),
28677
28899
  perMin: number()
28678
28900
  });
28679
28901
  /**
@@ -28686,6 +28908,14 @@ var RequestCensusGroupSchema = object({
28686
28908
  var RequestCensusProcedureSchema = object({
28687
28909
  procedure: string(),
28688
28910
  calls: number(),
28911
+ /**
28912
+ * The same total, split by transport. THIS is the row that answers the
28913
+ * question the census exists for: one look at `deviceManager.listAll` says
28914
+ * which plane carried the 4 960, without joining two log lines by eye.
28915
+ */
28916
+ planes: TransportPlaneCountsSchema,
28917
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
28918
+ subscriptions: number(),
28689
28919
  perMin: number()
28690
28920
  });
28691
28921
  /**
@@ -28713,14 +28943,45 @@ var RequestCensusStatusSchema = object({
28713
28943
  */
28714
28944
  procedureCalls: number(),
28715
28945
  /**
28946
+ * `procedureCalls` split by transport. The four keys sum to
28947
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
28948
+ * `planesExplainTotal` is that identity, checked rather than assumed.
28949
+ */
28950
+ planes: TransportPlaneCountsSchema,
28951
+ /**
28952
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
28953
+ * on no plane at all - which is a RESULT (a plane is missing from the
28954
+ * instrument), not a failure, and it has to be visible to be read as one.
28955
+ */
28956
+ planesExplainTotal: boolean(),
28957
+ /**
28716
28958
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28717
- * transport resolves one context per connection - but the number that says
28718
- * whether a plane this census cannot see was busy while HTTP was quiet.
28959
+ * adapter resolves one context per connection - kept because a plane's call
28960
+ * count of zero against 37 open connections says something different from a
28961
+ * plane with no connections at all.
28719
28962
  */
28720
28963
  wsConnections: number(),
28964
+ /**
28965
+ * Client frames the WS plane looked at. `wsMessages` far above
28966
+ * `planes.ws + subscriptions` means most traffic is not operations
28967
+ * (keepalives, connection params) - which is itself an answer.
28968
+ */
28969
+ wsMessages: number(),
28970
+ /**
28971
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
28972
+ * purpose: one live-events stream opened at boot and held for six hours is
28973
+ * one subscription, and counting it as a call would let a quiet plane
28974
+ * masquerade as the storm.
28975
+ */
28976
+ subscriptions: number(),
28977
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
28978
+ subscriptionStops: number(),
28721
28979
  distinctGroups: number(),
28722
- /** Calls counted in the totals whose group attribution was shed at the
28723
- * cardinality bound. */
28980
+ /**
28981
+ * Operations counted in the totals whose CALLER attribution was shed at the
28982
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
28983
+ * which transport they arrived on, they just lost their group row.
28984
+ */
28724
28985
  unattributedCalls: number(),
28725
28986
  procedures: array(RequestCensusProcedureSchema).readonly(),
28726
28987
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28743,10 +29004,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28743
29004
  * The layers of the level hierarchy, general → specific. The most specific
28744
29005
  * layer that carries an explicit value wins.
28745
29006
  *
28746
- * `component` is DECLARED and not yet resolvable: the per-component channels
28747
- * are a later slice of the same plan, and a `levelSource` enum that has to
28748
- * grow later would force every consumer of this document to change with it.
28749
- * Nothing returns `component` today.
29007
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29008
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29009
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29010
+ * that turning it on would not force every consumer of this document to widen
29011
+ * a `levelSource` enum — which is what has now not happened.
28750
29012
  */
28751
29013
  var LoggingScopeKindSchema = _enum([
28752
29014
  "cluster",
@@ -28773,6 +29035,14 @@ var LoggingLevelLayerSchema = object({
28773
29035
  scope: LoggingScopeKindSchema,
28774
29036
  /** The node this layer speaks for; `null` on the cluster layer. */
28775
29037
  nodeId: string().nullable(),
29038
+ /**
29039
+ * The declared channel this layer speaks for; `null` on every layer but
29040
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29041
+ * by design — the convention this repo settled on is one orchestrator-wide
29042
+ * setting, never per node (D52) — so a component layer that carried a node
29043
+ * would invite a per-node copy of a value that has no per-node meaning.
29044
+ */
29045
+ component: string().nullable(),
28776
29046
  /** Explicitly set here, or `null` when this layer inherits. */
28777
29047
  level: LogLevelSchema$1.nullable()
28778
29048
  });
@@ -28814,6 +29084,49 @@ var DiagnosticWindowPatchSchema = object({
28814
29084
  reportEveryMs: number().int().positive().optional()
28815
29085
  });
28816
29086
  /**
29087
+ * A channel ARMED, as the document reports it.
29088
+ *
29089
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29090
+ * and the time left, because a diagnostic left running is itself an incident
29091
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29092
+ */
29093
+ var LogChannelWindowStateSchema = object({
29094
+ channel: string(),
29095
+ armed: boolean(),
29096
+ /** Epoch ms the window closes at. 0 when disarmed. */
29097
+ armedUntilMs: number(),
29098
+ /** Ms left before it expires on its own. 0 when disarmed. */
29099
+ remainingMs: number(),
29100
+ /**
29101
+ * The cameras it is narrowed to, or `null` for every camera.
29102
+ *
29103
+ * A channel declared `perDevice: false` can only ever report `null` here:
29104
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29105
+ * produce a filter that silently matches nothing. The server REFUSES such a
29106
+ * patch rather than quietly widening it — ignoring the request would teach
29107
+ * the operator that per-camera filtering works on that channel when it does
29108
+ * not.
29109
+ */
29110
+ deviceIds: array(number().int()).readonly().nullable()
29111
+ });
29112
+ /**
29113
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29114
+ * for the same reason: a channel is a window with a deadline, never a switch.
29115
+ */
29116
+ var LogChannelWindowPatchSchema = object({
29117
+ channel: string().min(1),
29118
+ armMs: number().int().min(0),
29119
+ /**
29120
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29121
+ *
29122
+ * Numeric because the repo's own rule makes it possible: every log line
29123
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29124
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29125
+ * diagnosed by hand, and this is the first thing that collects on it.
29126
+ */
29127
+ deviceIds: array(number().int()).readonly().nullable().optional()
29128
+ });
29129
+ /**
28817
29130
  * A PATCH, and patches MERGE.
28818
29131
  *
28819
29132
  * A field absent from the patch is left exactly as it was — arming a
@@ -28832,7 +29145,14 @@ var LoggingSettingsPatchSchema = object({
28832
29145
  * Only the diagnostics NAMED here change. An armed window that is not listed
28833
29146
  * keeps running — a patch is never a full replacement.
28834
29147
  */
28835
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29148
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29149
+ /**
29150
+ * Only the channels NAMED here change. An armed channel that is not listed
29151
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29152
+ * disarmed the channels it did not mention would make the Levels page and
29153
+ * the Diagnostics page fight over the same value.
29154
+ */
29155
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28836
29156
  });
28837
29157
  /**
28838
29158
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28845,9 +29165,22 @@ var LoggingSettingsPatchSchema = object({
28845
29165
  * authority over the whole hierarchy and answers for every layer, so the
28846
29166
  * layer selector needs a name the transport does not already own.
28847
29167
  */
28848
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29168
+ var GetLoggingSettingsInputSchema = object({
29169
+ scopeNodeId: string().optional(),
29170
+ /**
29171
+ * The declared CHANNEL this document is addressed at, when the caller wants
29172
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29173
+ *
29174
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29175
+ * axes from collapsing: a component level is cluster-wide, a node level is
29176
+ * not, and one selector for both would make "which of these two did I just
29177
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29178
+ */
29179
+ scopeComponent: string().optional()
29180
+ });
28849
29181
  var SetLoggingSettingsInputSchema = object({
28850
29182
  scopeNodeId: string().optional(),
29183
+ scopeComponent: string().optional(),
28851
29184
  patch: LoggingSettingsPatchSchema
28852
29185
  });
28853
29186
  /**
@@ -28862,9 +29195,20 @@ var SetLoggingSettingsInputSchema = object({
28862
29195
  var LoggingSettingsStateSchema = object({
28863
29196
  /** The layer this document was read at. `null` = the cluster layer. */
28864
29197
  scopeNodeId: string().nullable(),
29198
+ /** The channel this document was read at. `null` = no component layer. */
29199
+ scopeComponent: string().nullable(),
28865
29200
  effective: LoggingEffectiveSchema,
28866
29201
  explicit: LoggingExplicitSchema,
28867
29202
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29203
+ /**
29204
+ * Every channel the cluster's addons DECLARE, gathered from the
29205
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29206
+ * channel added by a redeployed addon appears without anybody editing a
29207
+ * list, and a channel whose addon is gone stops being offered.
29208
+ */
29209
+ channels: array(LogChannelDescriptorSchema).readonly(),
29210
+ /** The channels ARMED right now, each with its deadline. */
29211
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28868
29212
  persisted: boolean()
28869
29213
  });
28870
29214
  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(), {
@@ -31849,6 +32193,12 @@ Object.freeze({
31849
32193
  addonId: null,
31850
32194
  access: "view"
31851
32195
  },
32196
+ "dataStoreProvider.aggregate": {
32197
+ capName: "data-store-provider",
32198
+ capScope: "system",
32199
+ addonId: null,
32200
+ access: "view"
32201
+ },
31852
32202
  "dataStoreProvider.count": {
31853
32203
  capName: "data-store-provider",
31854
32204
  capScope: "system",
@@ -32263,6 +32613,12 @@ Object.freeze({
32263
32613
  addonId: null,
32264
32614
  access: "view"
32265
32615
  },
32616
+ "deviceManager.getChildrenBatch": {
32617
+ capName: "device-manager",
32618
+ capScope: "system",
32619
+ addonId: null,
32620
+ access: "view"
32621
+ },
32266
32622
  "deviceManager.getConfigSchema": {
32267
32623
  capName: "device-manager",
32268
32624
  capScope: "system",
@@ -33313,6 +33669,18 @@ Object.freeze({
33313
33669
  addonId: null,
33314
33670
  access: "create"
33315
33671
  },
33672
+ "logChannels.apply": {
33673
+ capName: "log-channels",
33674
+ capScope: "system",
33675
+ addonId: null,
33676
+ access: "create"
33677
+ },
33678
+ "logChannels.list": {
33679
+ capName: "log-channels",
33680
+ capScope: "system",
33681
+ addonId: null,
33682
+ access: "view"
33683
+ },
33316
33684
  "logDestination.query": {
33317
33685
  capName: "log-destination",
33318
33686
  capScope: "system",
@@ -35467,6 +35835,12 @@ Object.freeze({
35467
35835
  addonId: null,
35468
35836
  access: "create"
35469
35837
  },
35838
+ "settingsStore.aggregate": {
35839
+ capName: "settings-store",
35840
+ capScope: "system",
35841
+ addonId: null,
35842
+ access: "view"
35843
+ },
35470
35844
  "settingsStore.count": {
35471
35845
  capName: "settings-store",
35472
35846
  capScope: "system",
@@ -37046,6 +37420,11 @@ Object.freeze({
37046
37420
  form: "single",
37047
37421
  optional: false
37048
37422
  }],
37423
+ "deviceManager.getChildrenBatch": [{
37424
+ name: "parentDeviceIds",
37425
+ form: "array",
37426
+ optional: false
37427
+ }],
37049
37428
  "deviceManager.getConfigSchema": [{
37050
37429
  name: "deviceId",
37051
37430
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-import-alexa",
3
- "version": "0.2.31",
3
+ "version": "0.2.33",
4
4
  "description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
5
5
  "keywords": [
6
6
  "camstack",