@camstack/addon-provider-amcrest 0.2.33 → 0.2.35

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
@@ -7461,6 +7461,111 @@ var CameraSwitchGroupSchema = object({
7461
7461
  fetchedAt: number()
7462
7462
  });
7463
7463
  /**
7464
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7465
+ * an addon declares its channels in.
7466
+ *
7467
+ * ## Two axes, deliberately separated
7468
+ *
7469
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7470
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7471
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7472
+ * and rots silently. So a channel is declared where it is consulted, and the
7473
+ * `log-channels` capability enumerates the declarations.
7474
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7475
+ * thing: the logging settings document on the `system` cap. Two authorities
7476
+ * over the values is the exact defect
7477
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7478
+ * remove; re-introducing it from the cure side would be grotesque.
7479
+ *
7480
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7481
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7482
+ * the hot path with a value somebody actually read, and by
7483
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7484
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7485
+ * disarmed one (D49).
7486
+ *
7487
+ * ## The canonical call shape
7488
+ *
7489
+ * ```ts
7490
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7491
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7492
+ * }
7493
+ * ```
7494
+ *
7495
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7496
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7497
+ * object literal is never constructed because it lives inside the branch. It
7498
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7499
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7500
+ * destination floor (measured at 1.93 ns/call when off).
7501
+ *
7502
+ * ## Why a channel emits at `info`
7503
+ *
7504
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7505
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7506
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7507
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7508
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7509
+ * emits at the channel's declared level, whose schema floor is `info`.
7510
+ */
7511
+ /**
7512
+ * The level a channel writes at once armed.
7513
+ *
7514
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7515
+ * not leave the process for Loki, and the whole point of arming a channel is
7516
+ * to read it later.
7517
+ */
7518
+ var LogChannelLevelSchema = _enum([
7519
+ "info",
7520
+ "warn",
7521
+ "error"
7522
+ ]);
7523
+ /**
7524
+ * What an addon declares about one channel. No value, no state — a
7525
+ * declaration is inert.
7526
+ */
7527
+ var LogChannelDescriptorSchema = object({
7528
+ /**
7529
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7530
+ * the addon's short name so an operator reading a channel list can tell who
7531
+ * owns it without a second lookup.
7532
+ */
7533
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7534
+ /** One sentence: what the operator will SEE after arming it. */
7535
+ description: string().min(1),
7536
+ /** The level its lines are emitted at. Never below `info`. */
7537
+ defaultLevel: LogChannelLevelSchema,
7538
+ /**
7539
+ * Whether this channel can be narrowed to a camera.
7540
+ *
7541
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7542
+ * consulted with the numeric device id, AND every line the channel admits
7543
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7544
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7545
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7546
+ * the body is the only way to filter.
7547
+ *
7548
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7549
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7550
+ * the operator narrows to one camera, sees nothing, and concludes the code
7551
+ * path was never taken.
7552
+ */
7553
+ perDevice: boolean()
7554
+ });
7555
+ /**
7556
+ * An armed window over one channel, as the document hands it to a mirror.
7557
+ *
7558
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7559
+ * expires by itself, which is the one failure a boolean cannot avoid.
7560
+ */
7561
+ var LogChannelWindowSchema = object({
7562
+ channel: string().min(1),
7563
+ /** Epoch ms the window closes at. */
7564
+ armedUntilMs: number(),
7565
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7566
+ deviceIds: array(number().int()).readonly().nullable()
7567
+ });
7568
+ /**
7464
7569
  * Ops-log — the durable, append-only operations audit shared by the
7465
7570
  * recordings and events management surfaces.
7466
7571
  *
@@ -11081,6 +11186,35 @@ var MutationFilterSchema = object({
11081
11186
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11082
11187
  whereNot: record(string(), unknown()).optional()
11083
11188
  });
11189
+ /**
11190
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11191
+ *
11192
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11193
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11194
+ * a `Record<column, op>` shape could not express.
11195
+ */
11196
+ var AggregateFieldSchema = object({
11197
+ /** Result key. */
11198
+ as: string().min(1),
11199
+ /** Column to aggregate. Must be a real column of a declared collection. */
11200
+ field: string().min(1),
11201
+ op: _enum([
11202
+ "sum",
11203
+ "min",
11204
+ "max"
11205
+ ])
11206
+ });
11207
+ /**
11208
+ * `COUNT(*)` plus one number per requested field.
11209
+ *
11210
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11211
+ * that really is 0 are different facts, and an accounting caller that renders
11212
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11213
+ */
11214
+ var AggregateResultSchema = object({
11215
+ count: number().int(),
11216
+ values: record(string(), number().nullable())
11217
+ });
11084
11218
  /** A single stored record: `{ id, data }`. */
11085
11219
  var SettingsRecordSchema = object({
11086
11220
  id: string(),
@@ -11165,6 +11299,11 @@ method(object({
11165
11299
  collection: string(),
11166
11300
  filter: QueryFilterSchema.optional()
11167
11301
  }), number()), method(object({
11302
+ namespace: string().optional(),
11303
+ collection: string(),
11304
+ fields: array(AggregateFieldSchema).readonly(),
11305
+ filter: QueryFilterSchema.optional()
11306
+ }), AggregateResultSchema), method(object({
11168
11307
  namespace: string().optional(),
11169
11308
  collection: string(),
11170
11309
  field: string(),
@@ -11281,6 +11420,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11281
11420
  collection: string(),
11282
11421
  filter: QueryFilterSchema.optional()
11283
11422
  }), number(), { auth: "admin" }), method(object({
11423
+ namespace: string().optional(),
11424
+ collection: string(),
11425
+ fields: array(AggregateFieldSchema).readonly(),
11426
+ filter: QueryFilterSchema.optional()
11427
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11284
11428
  namespace: string().optional(),
11285
11429
  collection: string(),
11286
11430
  field: string(),
@@ -12004,24 +12148,6 @@ var deviceProviderCapability = {
12004
12148
  })
12005
12149
  }
12006
12150
  };
12007
- /**
12008
- * Device Manager capability — hub-side singleton that unifies device persistence,
12009
- * live registry access, and all management operations into a single tRPC surface.
12010
- *
12011
- * Replaces:
12012
- * - `device-persistence` capability (persistence methods absorbed here)
12013
- * - `device-management.router.ts` (deleted in Phase 2)
12014
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12015
- *
12016
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12017
- * fork into separate processes but never run on remote cluster agents. Therefore:
12018
- * - No nodeId routing needed — this is a pure hub singleton.
12019
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12020
- * - No shadow registry or cross-node aggregation required.
12021
- *
12022
- * Forked workers register devices back to the hub via `ctx.devices`
12023
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12024
- */
12025
12151
  /** One child-placement directive on a container's `childLayout`. Structurally
12026
12152
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12027
12153
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12390,7 +12516,7 @@ method(object({
12390
12516
  * it answers today and the caller filters as it already does.
12391
12517
  */
12392
12518
  deviceIds: array(number()).optional()
12393
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12519
+ }), 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({
12394
12520
  mode: LinkedDevicesModeSchema,
12395
12521
  devices: array(LinkedDeviceSchema)
12396
12522
  })), 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({
@@ -13114,6 +13240,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13114
13240
  kind: "mutation",
13115
13241
  auth: "admin"
13116
13242
  });
13243
+ /**
13244
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13245
+ * through. It stores nothing.
13246
+ *
13247
+ * ## Why a capability at all, and why this shape
13248
+ *
13249
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13250
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13251
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13252
+ * fails, an operator just never sees the channel somebody added. So the list
13253
+ * is assembled from declarations at runtime.
13254
+ *
13255
+ * The shape is copied from `log-destination.cap.ts`, which already does
13256
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13257
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13258
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13259
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13260
+ * runner's declarations reach hub-main over the transport that already exists.
13261
+ * No new UDS message, no second registry.
13262
+ *
13263
+ * ## What it deliberately does NOT own
13264
+ *
13265
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13266
+ * ONE place: the logging settings document on the `system` cap
13267
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13268
+ * value is the defect the plan behind this work exists to remove, and
13269
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13270
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13271
+ * setter for a window and no persistence of any kind.
13272
+ *
13273
+ * ## Why `apply` is here even so
13274
+ *
13275
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13276
+ * seam has to carry the value from the authority to the mirror, and a channel
13277
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13278
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13279
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13280
+ * persists nothing, it is never the source of a value, and it is called only
13281
+ * with a set the hub actually read (D49 — a read that fails does not call it
13282
+ * at all, so no channel is silently disarmed by a bad read).
13283
+ */
13284
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13285
+ var LogChannelApplyResultSchema = object({
13286
+ /** How many declared channels are armed in this process after the call. */
13287
+ armed: number().int().min(0),
13288
+ /**
13289
+ * Names the document armed that this process does not declare. Reported
13290
+ * rather than swallowed: a name here is either a typo or an addon that has
13291
+ * not booted, and both deserve a line instead of silence.
13292
+ */
13293
+ unknown: array(string()).readonly()
13294
+ });
13295
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13117
13296
  var LogLevelSchema = _enum([
13118
13297
  "debug",
13119
13298
  "info",
@@ -28786,17 +28965,60 @@ var SetSiteLocationInputSchema = object({
28786
28965
  longitude: number().min(-180).max(180)
28787
28966
  }).nullable();
28788
28967
  /**
28789
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28968
+ * The TRANSPORT a call arrived on.
28969
+ *
28970
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28971
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28972
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28973
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28974
+ * checkable rather than asserted.
28975
+ *
28976
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28977
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28978
+ * connection; the viewer talks to the hub over `wsLink`
28979
+ * exclusively, so this is the plane the HTTP census could not see.
28980
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28981
+ * never touches a socket and therefore never touched a census.
28982
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28983
+ * that is exactly what its `0` asserts: every plane the hub has can name
28984
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28985
+ * plane nobody instrumented lands here instead of vanishing from the total.
28986
+ */
28987
+ var TransportPlaneSchema = _enum([
28988
+ "http",
28989
+ "ws",
28990
+ "mesh",
28991
+ "unknown"
28992
+ ]);
28993
+ /**
28994
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28995
+ * reads as "not instrumented", which is the one thing this census must never
28996
+ * make an operator wonder about.
28997
+ */
28998
+ var TransportPlaneCountsSchema = object({
28999
+ http: number(),
29000
+ ws: number(),
29001
+ mesh: number(),
29002
+ unknown: number()
29003
+ });
29004
+ /**
29005
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28790
29006
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28791
29007
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28792
29008
  * already prints - never a token, never an `Authorization` header.
29009
+ *
29010
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29011
+ * and lives for hours, so folding it into a call count makes one long-lived
29012
+ * stream look like a storm.
28793
29013
  */
28794
29014
  var RequestCensusGroupSchema = object({
29015
+ plane: TransportPlaneSchema,
28795
29016
  procedure: string(),
28796
29017
  userAgent: string(),
28797
29018
  ip: string(),
28798
29019
  principal: string(),
28799
29020
  calls: number(),
29021
+ subscriptions: number(),
28800
29022
  perMin: number()
28801
29023
  });
28802
29024
  /**
@@ -28809,6 +29031,14 @@ var RequestCensusGroupSchema = object({
28809
29031
  var RequestCensusProcedureSchema = object({
28810
29032
  procedure: string(),
28811
29033
  calls: number(),
29034
+ /**
29035
+ * The same total, split by transport. THIS is the row that answers the
29036
+ * question the census exists for: one look at `deviceManager.listAll` says
29037
+ * which plane carried the 4 960, without joining two log lines by eye.
29038
+ */
29039
+ planes: TransportPlaneCountsSchema,
29040
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29041
+ subscriptions: number(),
28812
29042
  perMin: number()
28813
29043
  });
28814
29044
  /**
@@ -28836,14 +29066,45 @@ var RequestCensusStatusSchema = object({
28836
29066
  */
28837
29067
  procedureCalls: number(),
28838
29068
  /**
29069
+ * `procedureCalls` split by transport. The four keys sum to
29070
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29071
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29072
+ */
29073
+ planes: TransportPlaneCountsSchema,
29074
+ /**
29075
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29076
+ * on no plane at all - which is a RESULT (a plane is missing from the
29077
+ * instrument), not a failure, and it has to be visible to be read as one.
29078
+ */
29079
+ planesExplainTotal: boolean(),
29080
+ /**
28839
29081
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28840
- * transport resolves one context per connection - but the number that says
28841
- * whether a plane this census cannot see was busy while HTTP was quiet.
29082
+ * adapter resolves one context per connection - kept because a plane's call
29083
+ * count of zero against 37 open connections says something different from a
29084
+ * plane with no connections at all.
28842
29085
  */
28843
29086
  wsConnections: number(),
29087
+ /**
29088
+ * Client frames the WS plane looked at. `wsMessages` far above
29089
+ * `planes.ws + subscriptions` means most traffic is not operations
29090
+ * (keepalives, connection params) - which is itself an answer.
29091
+ */
29092
+ wsMessages: number(),
29093
+ /**
29094
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29095
+ * purpose: one live-events stream opened at boot and held for six hours is
29096
+ * one subscription, and counting it as a call would let a quiet plane
29097
+ * masquerade as the storm.
29098
+ */
29099
+ subscriptions: number(),
29100
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29101
+ subscriptionStops: number(),
28844
29102
  distinctGroups: number(),
28845
- /** Calls counted in the totals whose group attribution was shed at the
28846
- * cardinality bound. */
29103
+ /**
29104
+ * Operations counted in the totals whose CALLER attribution was shed at the
29105
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29106
+ * which transport they arrived on, they just lost their group row.
29107
+ */
28847
29108
  unattributedCalls: number(),
28848
29109
  procedures: array(RequestCensusProcedureSchema).readonly(),
28849
29110
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28866,10 +29127,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28866
29127
  * The layers of the level hierarchy, general → specific. The most specific
28867
29128
  * layer that carries an explicit value wins.
28868
29129
  *
28869
- * `component` is DECLARED and not yet resolvable: the per-component channels
28870
- * are a later slice of the same plan, and a `levelSource` enum that has to
28871
- * grow later would force every consumer of this document to change with it.
28872
- * Nothing returns `component` today.
29130
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29131
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29132
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29133
+ * that turning it on would not force every consumer of this document to widen
29134
+ * a `levelSource` enum — which is what has now not happened.
28873
29135
  */
28874
29136
  var LoggingScopeKindSchema = _enum([
28875
29137
  "cluster",
@@ -28896,6 +29158,14 @@ var LoggingLevelLayerSchema = object({
28896
29158
  scope: LoggingScopeKindSchema,
28897
29159
  /** The node this layer speaks for; `null` on the cluster layer. */
28898
29160
  nodeId: string().nullable(),
29161
+ /**
29162
+ * The declared channel this layer speaks for; `null` on every layer but
29163
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29164
+ * by design — the convention this repo settled on is one orchestrator-wide
29165
+ * setting, never per node (D52) — so a component layer that carried a node
29166
+ * would invite a per-node copy of a value that has no per-node meaning.
29167
+ */
29168
+ component: string().nullable(),
28899
29169
  /** Explicitly set here, or `null` when this layer inherits. */
28900
29170
  level: LogLevelSchema$1.nullable()
28901
29171
  });
@@ -28937,6 +29207,49 @@ var DiagnosticWindowPatchSchema = object({
28937
29207
  reportEveryMs: number().int().positive().optional()
28938
29208
  });
28939
29209
  /**
29210
+ * A channel ARMED, as the document reports it.
29211
+ *
29212
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29213
+ * and the time left, because a diagnostic left running is itself an incident
29214
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29215
+ */
29216
+ var LogChannelWindowStateSchema = object({
29217
+ channel: string(),
29218
+ armed: boolean(),
29219
+ /** Epoch ms the window closes at. 0 when disarmed. */
29220
+ armedUntilMs: number(),
29221
+ /** Ms left before it expires on its own. 0 when disarmed. */
29222
+ remainingMs: number(),
29223
+ /**
29224
+ * The cameras it is narrowed to, or `null` for every camera.
29225
+ *
29226
+ * A channel declared `perDevice: false` can only ever report `null` here:
29227
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29228
+ * produce a filter that silently matches nothing. The server REFUSES such a
29229
+ * patch rather than quietly widening it — ignoring the request would teach
29230
+ * the operator that per-camera filtering works on that channel when it does
29231
+ * not.
29232
+ */
29233
+ deviceIds: array(number().int()).readonly().nullable()
29234
+ });
29235
+ /**
29236
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29237
+ * for the same reason: a channel is a window with a deadline, never a switch.
29238
+ */
29239
+ var LogChannelWindowPatchSchema = object({
29240
+ channel: string().min(1),
29241
+ armMs: number().int().min(0),
29242
+ /**
29243
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29244
+ *
29245
+ * Numeric because the repo's own rule makes it possible: every log line
29246
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29247
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29248
+ * diagnosed by hand, and this is the first thing that collects on it.
29249
+ */
29250
+ deviceIds: array(number().int()).readonly().nullable().optional()
29251
+ });
29252
+ /**
28940
29253
  * A PATCH, and patches MERGE.
28941
29254
  *
28942
29255
  * A field absent from the patch is left exactly as it was — arming a
@@ -28955,7 +29268,14 @@ var LoggingSettingsPatchSchema = object({
28955
29268
  * Only the diagnostics NAMED here change. An armed window that is not listed
28956
29269
  * keeps running — a patch is never a full replacement.
28957
29270
  */
28958
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29271
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29272
+ /**
29273
+ * Only the channels NAMED here change. An armed channel that is not listed
29274
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29275
+ * disarmed the channels it did not mention would make the Levels page and
29276
+ * the Diagnostics page fight over the same value.
29277
+ */
29278
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28959
29279
  });
28960
29280
  /**
28961
29281
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28968,9 +29288,22 @@ var LoggingSettingsPatchSchema = object({
28968
29288
  * authority over the whole hierarchy and answers for every layer, so the
28969
29289
  * layer selector needs a name the transport does not already own.
28970
29290
  */
28971
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29291
+ var GetLoggingSettingsInputSchema = object({
29292
+ scopeNodeId: string().optional(),
29293
+ /**
29294
+ * The declared CHANNEL this document is addressed at, when the caller wants
29295
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29296
+ *
29297
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29298
+ * axes from collapsing: a component level is cluster-wide, a node level is
29299
+ * not, and one selector for both would make "which of these two did I just
29300
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29301
+ */
29302
+ scopeComponent: string().optional()
29303
+ });
28972
29304
  var SetLoggingSettingsInputSchema = object({
28973
29305
  scopeNodeId: string().optional(),
29306
+ scopeComponent: string().optional(),
28974
29307
  patch: LoggingSettingsPatchSchema
28975
29308
  });
28976
29309
  /**
@@ -28985,9 +29318,20 @@ var SetLoggingSettingsInputSchema = object({
28985
29318
  var LoggingSettingsStateSchema = object({
28986
29319
  /** The layer this document was read at. `null` = the cluster layer. */
28987
29320
  scopeNodeId: string().nullable(),
29321
+ /** The channel this document was read at. `null` = no component layer. */
29322
+ scopeComponent: string().nullable(),
28988
29323
  effective: LoggingEffectiveSchema,
28989
29324
  explicit: LoggingExplicitSchema,
28990
29325
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29326
+ /**
29327
+ * Every channel the cluster's addons DECLARE, gathered from the
29328
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29329
+ * channel added by a redeployed addon appears without anybody editing a
29330
+ * list, and a channel whose addon is gone stops being offered.
29331
+ */
29332
+ channels: array(LogChannelDescriptorSchema).readonly(),
29333
+ /** The channels ARMED right now, each with its deadline. */
29334
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28991
29335
  persisted: boolean()
28992
29336
  });
28993
29337
  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(), {
@@ -32178,6 +32522,12 @@ Object.freeze({
32178
32522
  addonId: null,
32179
32523
  access: "view"
32180
32524
  },
32525
+ "dataStoreProvider.aggregate": {
32526
+ capName: "data-store-provider",
32527
+ capScope: "system",
32528
+ addonId: null,
32529
+ access: "view"
32530
+ },
32181
32531
  "dataStoreProvider.count": {
32182
32532
  capName: "data-store-provider",
32183
32533
  capScope: "system",
@@ -32592,6 +32942,12 @@ Object.freeze({
32592
32942
  addonId: null,
32593
32943
  access: "view"
32594
32944
  },
32945
+ "deviceManager.getChildrenBatch": {
32946
+ capName: "device-manager",
32947
+ capScope: "system",
32948
+ addonId: null,
32949
+ access: "view"
32950
+ },
32595
32951
  "deviceManager.getConfigSchema": {
32596
32952
  capName: "device-manager",
32597
32953
  capScope: "system",
@@ -33642,6 +33998,18 @@ Object.freeze({
33642
33998
  addonId: null,
33643
33999
  access: "create"
33644
34000
  },
34001
+ "logChannels.apply": {
34002
+ capName: "log-channels",
34003
+ capScope: "system",
34004
+ addonId: null,
34005
+ access: "create"
34006
+ },
34007
+ "logChannels.list": {
34008
+ capName: "log-channels",
34009
+ capScope: "system",
34010
+ addonId: null,
34011
+ access: "view"
34012
+ },
33645
34013
  "logDestination.query": {
33646
34014
  capName: "log-destination",
33647
34015
  capScope: "system",
@@ -35796,6 +36164,12 @@ Object.freeze({
35796
36164
  addonId: null,
35797
36165
  access: "create"
35798
36166
  },
36167
+ "settingsStore.aggregate": {
36168
+ capName: "settings-store",
36169
+ capScope: "system",
36170
+ addonId: null,
36171
+ access: "view"
36172
+ },
35799
36173
  "settingsStore.count": {
35800
36174
  capName: "settings-store",
35801
36175
  capScope: "system",
@@ -37375,6 +37749,11 @@ Object.freeze({
37375
37749
  form: "single",
37376
37750
  optional: false
37377
37751
  }],
37752
+ "deviceManager.getChildrenBatch": [{
37753
+ name: "parentDeviceIds",
37754
+ form: "array",
37755
+ optional: false
37756
+ }],
37378
37757
  "deviceManager.getConfigSchema": [{
37379
37758
  name: "deviceId",
37380
37759
  form: "single",
package/dist/addon.mjs CHANGED
@@ -7462,6 +7462,111 @@ var CameraSwitchGroupSchema = object({
7462
7462
  fetchedAt: number()
7463
7463
  });
7464
7464
  /**
7465
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7466
+ * an addon declares its channels in.
7467
+ *
7468
+ * ## Two axes, deliberately separated
7469
+ *
7470
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7471
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7472
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7473
+ * and rots silently. So a channel is declared where it is consulted, and the
7474
+ * `log-channels` capability enumerates the declarations.
7475
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7476
+ * thing: the logging settings document on the `system` cap. Two authorities
7477
+ * over the values is the exact defect
7478
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7479
+ * remove; re-introducing it from the cure side would be grotesque.
7480
+ *
7481
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7482
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7483
+ * the hot path with a value somebody actually read, and by
7484
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7485
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7486
+ * disarmed one (D49).
7487
+ *
7488
+ * ## The canonical call shape
7489
+ *
7490
+ * ```ts
7491
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7492
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7493
+ * }
7494
+ * ```
7495
+ *
7496
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7497
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7498
+ * object literal is never constructed because it lives inside the branch. It
7499
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7500
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7501
+ * destination floor (measured at 1.93 ns/call when off).
7502
+ *
7503
+ * ## Why a channel emits at `info`
7504
+ *
7505
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7506
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7507
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7508
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7509
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7510
+ * emits at the channel's declared level, whose schema floor is `info`.
7511
+ */
7512
+ /**
7513
+ * The level a channel writes at once armed.
7514
+ *
7515
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7516
+ * not leave the process for Loki, and the whole point of arming a channel is
7517
+ * to read it later.
7518
+ */
7519
+ var LogChannelLevelSchema = _enum([
7520
+ "info",
7521
+ "warn",
7522
+ "error"
7523
+ ]);
7524
+ /**
7525
+ * What an addon declares about one channel. No value, no state — a
7526
+ * declaration is inert.
7527
+ */
7528
+ var LogChannelDescriptorSchema = object({
7529
+ /**
7530
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7531
+ * the addon's short name so an operator reading a channel list can tell who
7532
+ * owns it without a second lookup.
7533
+ */
7534
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7535
+ /** One sentence: what the operator will SEE after arming it. */
7536
+ description: string().min(1),
7537
+ /** The level its lines are emitted at. Never below `info`. */
7538
+ defaultLevel: LogChannelLevelSchema,
7539
+ /**
7540
+ * Whether this channel can be narrowed to a camera.
7541
+ *
7542
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7543
+ * consulted with the numeric device id, AND every line the channel admits
7544
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7545
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7546
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7547
+ * the body is the only way to filter.
7548
+ *
7549
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7550
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7551
+ * the operator narrows to one camera, sees nothing, and concludes the code
7552
+ * path was never taken.
7553
+ */
7554
+ perDevice: boolean()
7555
+ });
7556
+ /**
7557
+ * An armed window over one channel, as the document hands it to a mirror.
7558
+ *
7559
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7560
+ * expires by itself, which is the one failure a boolean cannot avoid.
7561
+ */
7562
+ var LogChannelWindowSchema = object({
7563
+ channel: string().min(1),
7564
+ /** Epoch ms the window closes at. */
7565
+ armedUntilMs: number(),
7566
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7567
+ deviceIds: array(number().int()).readonly().nullable()
7568
+ });
7569
+ /**
7465
7570
  * Ops-log — the durable, append-only operations audit shared by the
7466
7571
  * recordings and events management surfaces.
7467
7572
  *
@@ -11082,6 +11187,35 @@ var MutationFilterSchema = object({
11082
11187
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
11083
11188
  whereNot: record(string(), unknown()).optional()
11084
11189
  });
11190
+ /**
11191
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11192
+ *
11193
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11194
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11195
+ * a `Record<column, op>` shape could not express.
11196
+ */
11197
+ var AggregateFieldSchema = object({
11198
+ /** Result key. */
11199
+ as: string().min(1),
11200
+ /** Column to aggregate. Must be a real column of a declared collection. */
11201
+ field: string().min(1),
11202
+ op: _enum([
11203
+ "sum",
11204
+ "min",
11205
+ "max"
11206
+ ])
11207
+ });
11208
+ /**
11209
+ * `COUNT(*)` plus one number per requested field.
11210
+ *
11211
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11212
+ * that really is 0 are different facts, and an accounting caller that renders
11213
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11214
+ */
11215
+ var AggregateResultSchema = object({
11216
+ count: number().int(),
11217
+ values: record(string(), number().nullable())
11218
+ });
11085
11219
  /** A single stored record: `{ id, data }`. */
11086
11220
  var SettingsRecordSchema = object({
11087
11221
  id: string(),
@@ -11166,6 +11300,11 @@ method(object({
11166
11300
  collection: string(),
11167
11301
  filter: QueryFilterSchema.optional()
11168
11302
  }), number()), method(object({
11303
+ namespace: string().optional(),
11304
+ collection: string(),
11305
+ fields: array(AggregateFieldSchema).readonly(),
11306
+ filter: QueryFilterSchema.optional()
11307
+ }), AggregateResultSchema), method(object({
11169
11308
  namespace: string().optional(),
11170
11309
  collection: string(),
11171
11310
  field: string(),
@@ -11282,6 +11421,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11282
11421
  collection: string(),
11283
11422
  filter: QueryFilterSchema.optional()
11284
11423
  }), number(), { auth: "admin" }), method(object({
11424
+ namespace: string().optional(),
11425
+ collection: string(),
11426
+ fields: array(AggregateFieldSchema).readonly(),
11427
+ filter: QueryFilterSchema.optional()
11428
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11285
11429
  namespace: string().optional(),
11286
11430
  collection: string(),
11287
11431
  field: string(),
@@ -12005,24 +12149,6 @@ var deviceProviderCapability = {
12005
12149
  })
12006
12150
  }
12007
12151
  };
12008
- /**
12009
- * Device Manager capability — hub-side singleton that unifies device persistence,
12010
- * live registry access, and all management operations into a single tRPC surface.
12011
- *
12012
- * Replaces:
12013
- * - `device-persistence` capability (persistence methods absorbed here)
12014
- * - `device-management.router.ts` (deleted in Phase 2)
12015
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
12016
- *
12017
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
12018
- * fork into separate processes but never run on remote cluster agents. Therefore:
12019
- * - No nodeId routing needed — this is a pure hub singleton.
12020
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
12021
- * - No shadow registry or cross-node aggregation required.
12022
- *
12023
- * Forked workers register devices back to the hub via `ctx.devices`
12024
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
12025
- */
12026
12152
  /** One child-placement directive on a container's `childLayout`. Structurally
12027
12153
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
12028
12154
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12391,7 +12517,7 @@ method(object({
12391
12517
  * it answers today and the caller filters as it already does.
12392
12518
  */
12393
12519
  deviceIds: array(number()).optional()
12394
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12520
+ }), 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({
12395
12521
  mode: LinkedDevicesModeSchema,
12396
12522
  devices: array(LinkedDeviceSchema)
12397
12523
  })), 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({
@@ -13115,6 +13241,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13115
13241
  kind: "mutation",
13116
13242
  auth: "admin"
13117
13243
  });
13244
+ /**
13245
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
13246
+ * through. It stores nothing.
13247
+ *
13248
+ * ## Why a capability at all, and why this shape
13249
+ *
13250
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13251
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13252
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13253
+ * fails, an operator just never sees the channel somebody added. So the list
13254
+ * is assembled from declarations at runtime.
13255
+ *
13256
+ * The shape is copied from `log-destination.cap.ts`, which already does
13257
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13258
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13259
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13260
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13261
+ * runner's declarations reach hub-main over the transport that already exists.
13262
+ * No new UDS message, no second registry.
13263
+ *
13264
+ * ## What it deliberately does NOT own
13265
+ *
13266
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13267
+ * ONE place: the logging settings document on the `system` cap
13268
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13269
+ * value is the defect the plan behind this work exists to remove, and
13270
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13271
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13272
+ * setter for a window and no persistence of any kind.
13273
+ *
13274
+ * ## Why `apply` is here even so
13275
+ *
13276
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13277
+ * seam has to carry the value from the authority to the mirror, and a channel
13278
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13279
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13280
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13281
+ * persists nothing, it is never the source of a value, and it is called only
13282
+ * with a set the hub actually read (D49 — a read that fails does not call it
13283
+ * at all, so no channel is silently disarmed by a bad read).
13284
+ */
13285
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13286
+ var LogChannelApplyResultSchema = object({
13287
+ /** How many declared channels are armed in this process after the call. */
13288
+ armed: number().int().min(0),
13289
+ /**
13290
+ * Names the document armed that this process does not declare. Reported
13291
+ * rather than swallowed: a name here is either a typo or an addon that has
13292
+ * not booted, and both deserve a line instead of silence.
13293
+ */
13294
+ unknown: array(string()).readonly()
13295
+ });
13296
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
13118
13297
  var LogLevelSchema = _enum([
13119
13298
  "debug",
13120
13299
  "info",
@@ -28787,17 +28966,60 @@ var SetSiteLocationInputSchema = object({
28787
28966
  longitude: number().min(-180).max(180)
28788
28967
  }).nullable();
28789
28968
  /**
28790
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
28969
+ * The TRANSPORT a call arrived on.
28970
+ *
28971
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
28972
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
28973
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
28974
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
28975
+ * checkable rather than asserted.
28976
+ *
28977
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
28978
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
28979
+ * connection; the viewer talks to the hub over `wsLink`
28980
+ * exclusively, so this is the plane the HTTP census could not see.
28981
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
28982
+ * never touches a socket and therefore never touched a census.
28983
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
28984
+ * that is exactly what its `0` asserts: every plane the hub has can name
28985
+ * itself. It is an output bucket, never a knob — a call that arrives on a
28986
+ * plane nobody instrumented lands here instead of vanishing from the total.
28987
+ */
28988
+ var TransportPlaneSchema = _enum([
28989
+ "http",
28990
+ "ws",
28991
+ "mesh",
28992
+ "unknown"
28993
+ ]);
28994
+ /**
28995
+ * Calls per plane. Every key is always present, `0` included — an absent plane
28996
+ * reads as "not instrumented", which is the one thing this census must never
28997
+ * make an operator wonder about.
28998
+ */
28999
+ var TransportPlaneCountsSchema = object({
29000
+ http: number(),
29001
+ ws: number(),
29002
+ mesh: number(),
29003
+ unknown: number()
29004
+ });
29005
+ /**
29006
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
28791
29007
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
28792
29008
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
28793
29009
  * already prints - never a token, never an `Authorization` header.
29010
+ *
29011
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29012
+ * and lives for hours, so folding it into a call count makes one long-lived
29013
+ * stream look like a storm.
28794
29014
  */
28795
29015
  var RequestCensusGroupSchema = object({
29016
+ plane: TransportPlaneSchema,
28796
29017
  procedure: string(),
28797
29018
  userAgent: string(),
28798
29019
  ip: string(),
28799
29020
  principal: string(),
28800
29021
  calls: number(),
29022
+ subscriptions: number(),
28801
29023
  perMin: number()
28802
29024
  });
28803
29025
  /**
@@ -28810,6 +29032,14 @@ var RequestCensusGroupSchema = object({
28810
29032
  var RequestCensusProcedureSchema = object({
28811
29033
  procedure: string(),
28812
29034
  calls: number(),
29035
+ /**
29036
+ * The same total, split by transport. THIS is the row that answers the
29037
+ * question the census exists for: one look at `deviceManager.listAll` says
29038
+ * which plane carried the 4 960, without joining two log lines by eye.
29039
+ */
29040
+ planes: TransportPlaneCountsSchema,
29041
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29042
+ subscriptions: number(),
28813
29043
  perMin: number()
28814
29044
  });
28815
29045
  /**
@@ -28837,14 +29067,45 @@ var RequestCensusStatusSchema = object({
28837
29067
  */
28838
29068
  procedureCalls: number(),
28839
29069
  /**
29070
+ * `procedureCalls` split by transport. The four keys sum to
29071
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29072
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29073
+ */
29074
+ planes: TransportPlaneCountsSchema,
29075
+ /**
29076
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29077
+ * on no plane at all - which is a RESULT (a plane is missing from the
29078
+ * instrument), not a failure, and it has to be visible to be read as one.
29079
+ */
29080
+ planesExplainTotal: boolean(),
29081
+ /**
28840
29082
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
28841
- * transport resolves one context per connection - but the number that says
28842
- * whether a plane this census cannot see was busy while HTTP was quiet.
29083
+ * adapter resolves one context per connection - kept because a plane's call
29084
+ * count of zero against 37 open connections says something different from a
29085
+ * plane with no connections at all.
28843
29086
  */
28844
29087
  wsConnections: number(),
29088
+ /**
29089
+ * Client frames the WS plane looked at. `wsMessages` far above
29090
+ * `planes.ws + subscriptions` means most traffic is not operations
29091
+ * (keepalives, connection params) - which is itself an answer.
29092
+ */
29093
+ wsMessages: number(),
29094
+ /**
29095
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29096
+ * purpose: one live-events stream opened at boot and held for six hours is
29097
+ * one subscription, and counting it as a call would let a quiet plane
29098
+ * masquerade as the storm.
29099
+ */
29100
+ subscriptions: number(),
29101
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29102
+ subscriptionStops: number(),
28845
29103
  distinctGroups: number(),
28846
- /** Calls counted in the totals whose group attribution was shed at the
28847
- * cardinality bound. */
29104
+ /**
29105
+ * Operations counted in the totals whose CALLER attribution was shed at the
29106
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29107
+ * which transport they arrived on, they just lost their group row.
29108
+ */
28848
29109
  unattributedCalls: number(),
28849
29110
  procedures: array(RequestCensusProcedureSchema).readonly(),
28850
29111
  groups: array(RequestCensusGroupSchema).readonly()
@@ -28867,10 +29128,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
28867
29128
  * The layers of the level hierarchy, general → specific. The most specific
28868
29129
  * layer that carries an explicit value wins.
28869
29130
  *
28870
- * `component` is DECLARED and not yet resolvable: the per-component channels
28871
- * are a later slice of the same plan, and a `levelSource` enum that has to
28872
- * grow later would force every consumer of this document to change with it.
28873
- * Nothing returns `component` today.
29131
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29132
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29133
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29134
+ * that turning it on would not force every consumer of this document to widen
29135
+ * a `levelSource` enum — which is what has now not happened.
28874
29136
  */
28875
29137
  var LoggingScopeKindSchema = _enum([
28876
29138
  "cluster",
@@ -28897,6 +29159,14 @@ var LoggingLevelLayerSchema = object({
28897
29159
  scope: LoggingScopeKindSchema,
28898
29160
  /** The node this layer speaks for; `null` on the cluster layer. */
28899
29161
  nodeId: string().nullable(),
29162
+ /**
29163
+ * The declared channel this layer speaks for; `null` on every layer but
29164
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
29165
+ * by design — the convention this repo settled on is one orchestrator-wide
29166
+ * setting, never per node (D52) — so a component layer that carried a node
29167
+ * would invite a per-node copy of a value that has no per-node meaning.
29168
+ */
29169
+ component: string().nullable(),
28900
29170
  /** Explicitly set here, or `null` when this layer inherits. */
28901
29171
  level: LogLevelSchema$1.nullable()
28902
29172
  });
@@ -28938,6 +29208,49 @@ var DiagnosticWindowPatchSchema = object({
28938
29208
  reportEveryMs: number().int().positive().optional()
28939
29209
  });
28940
29210
  /**
29211
+ * A channel ARMED, as the document reports it.
29212
+ *
29213
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
29214
+ * and the time left, because a diagnostic left running is itself an incident
29215
+ * and "armed for 10 minutes" said an hour ago is not an answer.
29216
+ */
29217
+ var LogChannelWindowStateSchema = object({
29218
+ channel: string(),
29219
+ armed: boolean(),
29220
+ /** Epoch ms the window closes at. 0 when disarmed. */
29221
+ armedUntilMs: number(),
29222
+ /** Ms left before it expires on its own. 0 when disarmed. */
29223
+ remainingMs: number(),
29224
+ /**
29225
+ * The cameras it is narrowed to, or `null` for every camera.
29226
+ *
29227
+ * A channel declared `perDevice: false` can only ever report `null` here:
29228
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
29229
+ * produce a filter that silently matches nothing. The server REFUSES such a
29230
+ * patch rather than quietly widening it — ignoring the request would teach
29231
+ * the operator that per-camera filtering works on that channel when it does
29232
+ * not.
29233
+ */
29234
+ deviceIds: array(number().int()).readonly().nullable()
29235
+ });
29236
+ /**
29237
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
29238
+ * for the same reason: a channel is a window with a deadline, never a switch.
29239
+ */
29240
+ var LogChannelWindowPatchSchema = object({
29241
+ channel: string().min(1),
29242
+ armMs: number().int().min(0),
29243
+ /**
29244
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
29245
+ *
29246
+ * Numeric because the repo's own rule makes it possible: every log line
29247
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
29248
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
29249
+ * diagnosed by hand, and this is the first thing that collects on it.
29250
+ */
29251
+ deviceIds: array(number().int()).readonly().nullable().optional()
29252
+ });
29253
+ /**
28941
29254
  * A PATCH, and patches MERGE.
28942
29255
  *
28943
29256
  * A field absent from the patch is left exactly as it was — arming a
@@ -28956,7 +29269,14 @@ var LoggingSettingsPatchSchema = object({
28956
29269
  * Only the diagnostics NAMED here change. An armed window that is not listed
28957
29270
  * keeps running — a patch is never a full replacement.
28958
29271
  */
28959
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
29272
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
29273
+ /**
29274
+ * Only the channels NAMED here change. An armed channel that is not listed
29275
+ * keeps running — same rule as `diagnostics`, because a patch that silently
29276
+ * disarmed the channels it did not mention would make the Levels page and
29277
+ * the Diagnostics page fight over the same value.
29278
+ */
29279
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
28960
29280
  });
28961
29281
  /**
28962
29282
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -28969,9 +29289,22 @@ var LoggingSettingsPatchSchema = object({
28969
29289
  * authority over the whole hierarchy and answers for every layer, so the
28970
29290
  * layer selector needs a name the transport does not already own.
28971
29291
  */
28972
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
29292
+ var GetLoggingSettingsInputSchema = object({
29293
+ scopeNodeId: string().optional(),
29294
+ /**
29295
+ * The declared CHANNEL this document is addressed at, when the caller wants
29296
+ * the `component` layer. Absent = the node/cluster hierarchy only.
29297
+ *
29298
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
29299
+ * axes from collapsing: a component level is cluster-wide, a node level is
29300
+ * not, and one selector for both would make "which of these two did I just
29301
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
29302
+ */
29303
+ scopeComponent: string().optional()
29304
+ });
28973
29305
  var SetLoggingSettingsInputSchema = object({
28974
29306
  scopeNodeId: string().optional(),
29307
+ scopeComponent: string().optional(),
28975
29308
  patch: LoggingSettingsPatchSchema
28976
29309
  });
28977
29310
  /**
@@ -28986,9 +29319,20 @@ var SetLoggingSettingsInputSchema = object({
28986
29319
  var LoggingSettingsStateSchema = object({
28987
29320
  /** The layer this document was read at. `null` = the cluster layer. */
28988
29321
  scopeNodeId: string().nullable(),
29322
+ /** The channel this document was read at. `null` = no component layer. */
29323
+ scopeComponent: string().nullable(),
28989
29324
  effective: LoggingEffectiveSchema,
28990
29325
  explicit: LoggingExplicitSchema,
28991
29326
  activeWindows: array(DiagnosticWindowSchema).readonly(),
29327
+ /**
29328
+ * Every channel the cluster's addons DECLARE, gathered from the
29329
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
29330
+ * channel added by a redeployed addon appears without anybody editing a
29331
+ * list, and a channel whose addon is gone stops being offered.
29332
+ */
29333
+ channels: array(LogChannelDescriptorSchema).readonly(),
29334
+ /** The channels ARMED right now, each with its deadline. */
29335
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
28992
29336
  persisted: boolean()
28993
29337
  });
28994
29338
  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(), {
@@ -32179,6 +32523,12 @@ Object.freeze({
32179
32523
  addonId: null,
32180
32524
  access: "view"
32181
32525
  },
32526
+ "dataStoreProvider.aggregate": {
32527
+ capName: "data-store-provider",
32528
+ capScope: "system",
32529
+ addonId: null,
32530
+ access: "view"
32531
+ },
32182
32532
  "dataStoreProvider.count": {
32183
32533
  capName: "data-store-provider",
32184
32534
  capScope: "system",
@@ -32593,6 +32943,12 @@ Object.freeze({
32593
32943
  addonId: null,
32594
32944
  access: "view"
32595
32945
  },
32946
+ "deviceManager.getChildrenBatch": {
32947
+ capName: "device-manager",
32948
+ capScope: "system",
32949
+ addonId: null,
32950
+ access: "view"
32951
+ },
32596
32952
  "deviceManager.getConfigSchema": {
32597
32953
  capName: "device-manager",
32598
32954
  capScope: "system",
@@ -33643,6 +33999,18 @@ Object.freeze({
33643
33999
  addonId: null,
33644
34000
  access: "create"
33645
34001
  },
34002
+ "logChannels.apply": {
34003
+ capName: "log-channels",
34004
+ capScope: "system",
34005
+ addonId: null,
34006
+ access: "create"
34007
+ },
34008
+ "logChannels.list": {
34009
+ capName: "log-channels",
34010
+ capScope: "system",
34011
+ addonId: null,
34012
+ access: "view"
34013
+ },
33646
34014
  "logDestination.query": {
33647
34015
  capName: "log-destination",
33648
34016
  capScope: "system",
@@ -35797,6 +36165,12 @@ Object.freeze({
35797
36165
  addonId: null,
35798
36166
  access: "create"
35799
36167
  },
36168
+ "settingsStore.aggregate": {
36169
+ capName: "settings-store",
36170
+ capScope: "system",
36171
+ addonId: null,
36172
+ access: "view"
36173
+ },
35800
36174
  "settingsStore.count": {
35801
36175
  capName: "settings-store",
35802
36176
  capScope: "system",
@@ -37376,6 +37750,11 @@ Object.freeze({
37376
37750
  form: "single",
37377
37751
  optional: false
37378
37752
  }],
37753
+ "deviceManager.getChildrenBatch": [{
37754
+ name: "parentDeviceIds",
37755
+ form: "array",
37756
+ optional: false
37757
+ }],
37379
37758
  "deviceManager.getConfigSchema": [{
37380
37759
  name: "deviceId",
37381
37760
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",