@camstack/addon-remote-storage 1.2.31 → 1.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.
package/dist/s3.addon.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-Dry6vSuS.js");
5
+ const require_shared = require("./shared-BkgFJ2q-.js");
6
6
  let node_stream = require("node:stream");
7
7
  let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
8
8
  let _aws_sdk_lib_storage = require("@aws-sdk/lib-storage");
package/dist/s3.addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-Mt26R5Yt.mjs";
1
+ import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-JInb-Tpq.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { DeleteObjectCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
4
4
  import { Upload } from "@aws-sdk/lib-storage";
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-Dry6vSuS.js");
5
+ const require_shared = require("./shared-BkgFJ2q-.js");
6
6
  let ssh2 = require("ssh2");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_shared.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-Mt26R5Yt.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-JInb-Tpq.mjs";
2
2
  import { Client } from "ssh2";
3
3
  import * as path from "node:path";
4
4
  //#region src/providers/sftp/sftp-config-schema.ts
@@ -7476,6 +7476,111 @@ var CameraSwitchGroupSchema = object({
7476
7476
  fetchedAt: number()
7477
7477
  });
7478
7478
  /**
7479
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7480
+ * an addon declares its channels in.
7481
+ *
7482
+ * ## Two axes, deliberately separated
7483
+ *
7484
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7485
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7486
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7487
+ * and rots silently. So a channel is declared where it is consulted, and the
7488
+ * `log-channels` capability enumerates the declarations.
7489
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7490
+ * thing: the logging settings document on the `system` cap. Two authorities
7491
+ * over the values is the exact defect
7492
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7493
+ * remove; re-introducing it from the cure side would be grotesque.
7494
+ *
7495
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7496
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7497
+ * the hot path with a value somebody actually read, and by
7498
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7499
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7500
+ * disarmed one (D49).
7501
+ *
7502
+ * ## The canonical call shape
7503
+ *
7504
+ * ```ts
7505
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7506
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7507
+ * }
7508
+ * ```
7509
+ *
7510
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7511
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7512
+ * object literal is never constructed because it lives inside the branch. It
7513
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7514
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7515
+ * destination floor (measured at 1.93 ns/call when off).
7516
+ *
7517
+ * ## Why a channel emits at `info`
7518
+ *
7519
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7520
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7521
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7522
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7523
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7524
+ * emits at the channel's declared level, whose schema floor is `info`.
7525
+ */
7526
+ /**
7527
+ * The level a channel writes at once armed.
7528
+ *
7529
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7530
+ * not leave the process for Loki, and the whole point of arming a channel is
7531
+ * to read it later.
7532
+ */
7533
+ var LogChannelLevelSchema = _enum([
7534
+ "info",
7535
+ "warn",
7536
+ "error"
7537
+ ]);
7538
+ /**
7539
+ * What an addon declares about one channel. No value, no state — a
7540
+ * declaration is inert.
7541
+ */
7542
+ var LogChannelDescriptorSchema = object({
7543
+ /**
7544
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7545
+ * the addon's short name so an operator reading a channel list can tell who
7546
+ * owns it without a second lookup.
7547
+ */
7548
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7549
+ /** One sentence: what the operator will SEE after arming it. */
7550
+ description: string().min(1),
7551
+ /** The level its lines are emitted at. Never below `info`. */
7552
+ defaultLevel: LogChannelLevelSchema,
7553
+ /**
7554
+ * Whether this channel can be narrowed to a camera.
7555
+ *
7556
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7557
+ * consulted with the numeric device id, AND every line the channel admits
7558
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7559
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7560
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7561
+ * the body is the only way to filter.
7562
+ *
7563
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7564
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7565
+ * the operator narrows to one camera, sees nothing, and concludes the code
7566
+ * path was never taken.
7567
+ */
7568
+ perDevice: boolean()
7569
+ });
7570
+ /**
7571
+ * An armed window over one channel, as the document hands it to a mirror.
7572
+ *
7573
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7574
+ * expires by itself, which is the one failure a boolean cannot avoid.
7575
+ */
7576
+ var LogChannelWindowSchema = object({
7577
+ channel: string().min(1),
7578
+ /** Epoch ms the window closes at. */
7579
+ armedUntilMs: number(),
7580
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7581
+ deviceIds: array(number().int()).readonly().nullable()
7582
+ });
7583
+ /**
7479
7584
  * Ops-log — the durable, append-only operations audit shared by the
7480
7585
  * recordings and events management surfaces.
7481
7586
  *
@@ -10994,6 +11099,35 @@ var MutationFilterSchema = object({
10994
11099
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
10995
11100
  whereNot: record(string(), unknown()).optional()
10996
11101
  });
11102
+ /**
11103
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11104
+ *
11105
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11106
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11107
+ * a `Record<column, op>` shape could not express.
11108
+ */
11109
+ var AggregateFieldSchema = object({
11110
+ /** Result key. */
11111
+ as: string().min(1),
11112
+ /** Column to aggregate. Must be a real column of a declared collection. */
11113
+ field: string().min(1),
11114
+ op: _enum([
11115
+ "sum",
11116
+ "min",
11117
+ "max"
11118
+ ])
11119
+ });
11120
+ /**
11121
+ * `COUNT(*)` plus one number per requested field.
11122
+ *
11123
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11124
+ * that really is 0 are different facts, and an accounting caller that renders
11125
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11126
+ */
11127
+ var AggregateResultSchema = object({
11128
+ count: number().int(),
11129
+ values: record(string(), number().nullable())
11130
+ });
10997
11131
  /** A single stored record: `{ id, data }`. */
10998
11132
  var SettingsRecordSchema = object({
10999
11133
  id: string(),
@@ -11078,6 +11212,11 @@ method(object({
11078
11212
  collection: string(),
11079
11213
  filter: QueryFilterSchema.optional()
11080
11214
  }), number()), method(object({
11215
+ namespace: string().optional(),
11216
+ collection: string(),
11217
+ fields: array(AggregateFieldSchema).readonly(),
11218
+ filter: QueryFilterSchema.optional()
11219
+ }), AggregateResultSchema), method(object({
11081
11220
  namespace: string().optional(),
11082
11221
  collection: string(),
11083
11222
  field: string(),
@@ -11194,6 +11333,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11194
11333
  collection: string(),
11195
11334
  filter: QueryFilterSchema.optional()
11196
11335
  }), number(), { auth: "admin" }), method(object({
11336
+ namespace: string().optional(),
11337
+ collection: string(),
11338
+ fields: array(AggregateFieldSchema).readonly(),
11339
+ filter: QueryFilterSchema.optional()
11340
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11197
11341
  namespace: string().optional(),
11198
11342
  collection: string(),
11199
11343
  field: string(),
@@ -11755,24 +11899,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
11755
11899
  kind: "mutation",
11756
11900
  auth: "admin"
11757
11901
  });
11758
- /**
11759
- * Device Manager capability — hub-side singleton that unifies device persistence,
11760
- * live registry access, and all management operations into a single tRPC surface.
11761
- *
11762
- * Replaces:
11763
- * - `device-persistence` capability (persistence methods absorbed here)
11764
- * - `device-management.router.ts` (deleted in Phase 2)
11765
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
11766
- *
11767
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
11768
- * fork into separate processes but never run on remote cluster agents. Therefore:
11769
- * - No nodeId routing needed — this is a pure hub singleton.
11770
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
11771
- * - No shadow registry or cross-node aggregation required.
11772
- *
11773
- * Forked workers register devices back to the hub via `ctx.devices`
11774
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
11775
- */
11776
11902
  /** One child-placement directive on a container's `childLayout`. Structurally
11777
11903
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
11778
11904
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12141,7 +12267,7 @@ method(object({
12141
12267
  * it answers today and the caller filters as it already does.
12142
12268
  */
12143
12269
  deviceIds: array(number()).optional()
12144
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12270
+ }), 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({
12145
12271
  mode: LinkedDevicesModeSchema,
12146
12272
  devices: array(LinkedDeviceSchema)
12147
12273
  })), 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({
@@ -12865,6 +12991,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
12865
12991
  kind: "mutation",
12866
12992
  auth: "admin"
12867
12993
  });
12994
+ /**
12995
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
12996
+ * through. It stores nothing.
12997
+ *
12998
+ * ## Why a capability at all, and why this shape
12999
+ *
13000
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
13001
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
13002
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
13003
+ * fails, an operator just never sees the channel somebody added. So the list
13004
+ * is assembled from declarations at runtime.
13005
+ *
13006
+ * The shape is copied from `log-destination.cap.ts`, which already does
13007
+ * exactly this job: `mode: 'collection'`, `internal: true`,
13008
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
13009
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
13010
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
13011
+ * runner's declarations reach hub-main over the transport that already exists.
13012
+ * No new UDS message, no second registry.
13013
+ *
13014
+ * ## What it deliberately does NOT own
13015
+ *
13016
+ * The VALUES — which channel is armed, for which cameras, until when — live in
13017
+ * ONE place: the logging settings document on the `system` cap
13018
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
13019
+ * value is the defect the plan behind this work exists to remove, and
13020
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
13021
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
13022
+ * setter for a window and no persistence of any kind.
13023
+ *
13024
+ * ## Why `apply` is here even so
13025
+ *
13026
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13027
+ * seam has to carry the value from the authority to the mirror, and a channel
13028
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13029
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13030
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13031
+ * persists nothing, it is never the source of a value, and it is called only
13032
+ * with a set the hub actually read (D49 — a read that fails does not call it
13033
+ * at all, so no channel is silently disarmed by a bad read).
13034
+ */
13035
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13036
+ var LogChannelApplyResultSchema = object({
13037
+ /** How many declared channels are armed in this process after the call. */
13038
+ armed: number().int().min(0),
13039
+ /**
13040
+ * Names the document armed that this process does not declare. Reported
13041
+ * rather than swallowed: a name here is either a typo or an addon that has
13042
+ * not booted, and both deserve a line instead of silence.
13043
+ */
13044
+ unknown: array(string()).readonly()
13045
+ });
13046
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
12868
13047
  var LogLevelSchema = _enum([
12869
13048
  "debug",
12870
13049
  "info",
@@ -26180,17 +26359,60 @@ var SetSiteLocationInputSchema = object({
26180
26359
  longitude: number().min(-180).max(180)
26181
26360
  }).nullable();
26182
26361
  /**
26183
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26362
+ * The TRANSPORT a call arrived on.
26363
+ *
26364
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26365
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26366
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26367
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26368
+ * checkable rather than asserted.
26369
+ *
26370
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26371
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26372
+ * connection; the viewer talks to the hub over `wsLink`
26373
+ * exclusively, so this is the plane the HTTP census could not see.
26374
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26375
+ * never touches a socket and therefore never touched a census.
26376
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26377
+ * that is exactly what its `0` asserts: every plane the hub has can name
26378
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26379
+ * plane nobody instrumented lands here instead of vanishing from the total.
26380
+ */
26381
+ var TransportPlaneSchema = _enum([
26382
+ "http",
26383
+ "ws",
26384
+ "mesh",
26385
+ "unknown"
26386
+ ]);
26387
+ /**
26388
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26389
+ * reads as "not instrumented", which is the one thing this census must never
26390
+ * make an operator wonder about.
26391
+ */
26392
+ var TransportPlaneCountsSchema = object({
26393
+ http: number(),
26394
+ ws: number(),
26395
+ mesh: number(),
26396
+ unknown: number()
26397
+ });
26398
+ /**
26399
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26184
26400
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26185
26401
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26186
26402
  * already prints - never a token, never an `Authorization` header.
26403
+ *
26404
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26405
+ * and lives for hours, so folding it into a call count makes one long-lived
26406
+ * stream look like a storm.
26187
26407
  */
26188
26408
  var RequestCensusGroupSchema = object({
26409
+ plane: TransportPlaneSchema,
26189
26410
  procedure: string(),
26190
26411
  userAgent: string(),
26191
26412
  ip: string(),
26192
26413
  principal: string(),
26193
26414
  calls: number(),
26415
+ subscriptions: number(),
26194
26416
  perMin: number()
26195
26417
  });
26196
26418
  /**
@@ -26203,6 +26425,14 @@ var RequestCensusGroupSchema = object({
26203
26425
  var RequestCensusProcedureSchema = object({
26204
26426
  procedure: string(),
26205
26427
  calls: number(),
26428
+ /**
26429
+ * The same total, split by transport. THIS is the row that answers the
26430
+ * question the census exists for: one look at `deviceManager.listAll` says
26431
+ * which plane carried the 4 960, without joining two log lines by eye.
26432
+ */
26433
+ planes: TransportPlaneCountsSchema,
26434
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26435
+ subscriptions: number(),
26206
26436
  perMin: number()
26207
26437
  });
26208
26438
  /**
@@ -26230,14 +26460,45 @@ var RequestCensusStatusSchema = object({
26230
26460
  */
26231
26461
  procedureCalls: number(),
26232
26462
  /**
26463
+ * `procedureCalls` split by transport. The four keys sum to
26464
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26465
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26466
+ */
26467
+ planes: TransportPlaneCountsSchema,
26468
+ /**
26469
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26470
+ * on no plane at all - which is a RESULT (a plane is missing from the
26471
+ * instrument), not a failure, and it has to be visible to be read as one.
26472
+ */
26473
+ planesExplainTotal: boolean(),
26474
+ /**
26233
26475
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
26234
- * transport resolves one context per connection - but the number that says
26235
- * whether a plane this census cannot see was busy while HTTP was quiet.
26476
+ * adapter resolves one context per connection - kept because a plane's call
26477
+ * count of zero against 37 open connections says something different from a
26478
+ * plane with no connections at all.
26236
26479
  */
26237
26480
  wsConnections: number(),
26481
+ /**
26482
+ * Client frames the WS plane looked at. `wsMessages` far above
26483
+ * `planes.ws + subscriptions` means most traffic is not operations
26484
+ * (keepalives, connection params) - which is itself an answer.
26485
+ */
26486
+ wsMessages: number(),
26487
+ /**
26488
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26489
+ * purpose: one live-events stream opened at boot and held for six hours is
26490
+ * one subscription, and counting it as a call would let a quiet plane
26491
+ * masquerade as the storm.
26492
+ */
26493
+ subscriptions: number(),
26494
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26495
+ subscriptionStops: number(),
26238
26496
  distinctGroups: number(),
26239
- /** Calls counted in the totals whose group attribution was shed at the
26240
- * cardinality bound. */
26497
+ /**
26498
+ * Operations counted in the totals whose CALLER attribution was shed at the
26499
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26500
+ * which transport they arrived on, they just lost their group row.
26501
+ */
26241
26502
  unattributedCalls: number(),
26242
26503
  procedures: array(RequestCensusProcedureSchema).readonly(),
26243
26504
  groups: array(RequestCensusGroupSchema).readonly()
@@ -26260,10 +26521,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
26260
26521
  * The layers of the level hierarchy, general → specific. The most specific
26261
26522
  * layer that carries an explicit value wins.
26262
26523
  *
26263
- * `component` is DECLARED and not yet resolvable: the per-component channels
26264
- * are a later slice of the same plan, and a `levelSource` enum that has to
26265
- * grow later would force every consumer of this document to change with it.
26266
- * Nothing returns `component` today.
26524
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
26525
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
26526
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
26527
+ * that turning it on would not force every consumer of this document to widen
26528
+ * a `levelSource` enum — which is what has now not happened.
26267
26529
  */
26268
26530
  var LoggingScopeKindSchema = _enum([
26269
26531
  "cluster",
@@ -26290,6 +26552,14 @@ var LoggingLevelLayerSchema = object({
26290
26552
  scope: LoggingScopeKindSchema,
26291
26553
  /** The node this layer speaks for; `null` on the cluster layer. */
26292
26554
  nodeId: string().nullable(),
26555
+ /**
26556
+ * The declared channel this layer speaks for; `null` on every layer but
26557
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
26558
+ * by design — the convention this repo settled on is one orchestrator-wide
26559
+ * setting, never per node (D52) — so a component layer that carried a node
26560
+ * would invite a per-node copy of a value that has no per-node meaning.
26561
+ */
26562
+ component: string().nullable(),
26293
26563
  /** Explicitly set here, or `null` when this layer inherits. */
26294
26564
  level: LogLevelSchema$1.nullable()
26295
26565
  });
@@ -26331,6 +26601,49 @@ var DiagnosticWindowPatchSchema = object({
26331
26601
  reportEveryMs: number().int().positive().optional()
26332
26602
  });
26333
26603
  /**
26604
+ * A channel ARMED, as the document reports it.
26605
+ *
26606
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
26607
+ * and the time left, because a diagnostic left running is itself an incident
26608
+ * and "armed for 10 minutes" said an hour ago is not an answer.
26609
+ */
26610
+ var LogChannelWindowStateSchema = object({
26611
+ channel: string(),
26612
+ armed: boolean(),
26613
+ /** Epoch ms the window closes at. 0 when disarmed. */
26614
+ armedUntilMs: number(),
26615
+ /** Ms left before it expires on its own. 0 when disarmed. */
26616
+ remainingMs: number(),
26617
+ /**
26618
+ * The cameras it is narrowed to, or `null` for every camera.
26619
+ *
26620
+ * A channel declared `perDevice: false` can only ever report `null` here:
26621
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
26622
+ * produce a filter that silently matches nothing. The server REFUSES such a
26623
+ * patch rather than quietly widening it — ignoring the request would teach
26624
+ * the operator that per-camera filtering works on that channel when it does
26625
+ * not.
26626
+ */
26627
+ deviceIds: array(number().int()).readonly().nullable()
26628
+ });
26629
+ /**
26630
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
26631
+ * for the same reason: a channel is a window with a deadline, never a switch.
26632
+ */
26633
+ var LogChannelWindowPatchSchema = object({
26634
+ channel: string().min(1),
26635
+ armMs: number().int().min(0),
26636
+ /**
26637
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
26638
+ *
26639
+ * Numeric because the repo's own rule makes it possible: every log line
26640
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
26641
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
26642
+ * diagnosed by hand, and this is the first thing that collects on it.
26643
+ */
26644
+ deviceIds: array(number().int()).readonly().nullable().optional()
26645
+ });
26646
+ /**
26334
26647
  * A PATCH, and patches MERGE.
26335
26648
  *
26336
26649
  * A field absent from the patch is left exactly as it was — arming a
@@ -26349,7 +26662,14 @@ var LoggingSettingsPatchSchema = object({
26349
26662
  * Only the diagnostics NAMED here change. An armed window that is not listed
26350
26663
  * keeps running — a patch is never a full replacement.
26351
26664
  */
26352
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26665
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
26666
+ /**
26667
+ * Only the channels NAMED here change. An armed channel that is not listed
26668
+ * keeps running — same rule as `diagnostics`, because a patch that silently
26669
+ * disarmed the channels it did not mention would make the Levels page and
26670
+ * the Diagnostics page fight over the same value.
26671
+ */
26672
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
26353
26673
  });
26354
26674
  /**
26355
26675
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -26362,9 +26682,22 @@ var LoggingSettingsPatchSchema = object({
26362
26682
  * authority over the whole hierarchy and answers for every layer, so the
26363
26683
  * layer selector needs a name the transport does not already own.
26364
26684
  */
26365
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26685
+ var GetLoggingSettingsInputSchema = object({
26686
+ scopeNodeId: string().optional(),
26687
+ /**
26688
+ * The declared CHANNEL this document is addressed at, when the caller wants
26689
+ * the `component` layer. Absent = the node/cluster hierarchy only.
26690
+ *
26691
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
26692
+ * axes from collapsing: a component level is cluster-wide, a node level is
26693
+ * not, and one selector for both would make "which of these two did I just
26694
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
26695
+ */
26696
+ scopeComponent: string().optional()
26697
+ });
26366
26698
  var SetLoggingSettingsInputSchema = object({
26367
26699
  scopeNodeId: string().optional(),
26700
+ scopeComponent: string().optional(),
26368
26701
  patch: LoggingSettingsPatchSchema
26369
26702
  });
26370
26703
  /**
@@ -26379,9 +26712,20 @@ var SetLoggingSettingsInputSchema = object({
26379
26712
  var LoggingSettingsStateSchema = object({
26380
26713
  /** The layer this document was read at. `null` = the cluster layer. */
26381
26714
  scopeNodeId: string().nullable(),
26715
+ /** The channel this document was read at. `null` = no component layer. */
26716
+ scopeComponent: string().nullable(),
26382
26717
  effective: LoggingEffectiveSchema,
26383
26718
  explicit: LoggingExplicitSchema,
26384
26719
  activeWindows: array(DiagnosticWindowSchema).readonly(),
26720
+ /**
26721
+ * Every channel the cluster's addons DECLARE, gathered from the
26722
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
26723
+ * channel added by a redeployed addon appears without anybody editing a
26724
+ * list, and a channel whose addon is gone stops being offered.
26725
+ */
26726
+ channels: array(LogChannelDescriptorSchema).readonly(),
26727
+ /** The channels ARMED right now, each with its deadline. */
26728
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
26385
26729
  persisted: boolean()
26386
26730
  });
26387
26731
  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(), {
@@ -27958,6 +28302,12 @@ Object.freeze({
27958
28302
  addonId: null,
27959
28303
  access: "view"
27960
28304
  },
28305
+ "dataStoreProvider.aggregate": {
28306
+ capName: "data-store-provider",
28307
+ capScope: "system",
28308
+ addonId: null,
28309
+ access: "view"
28310
+ },
27961
28311
  "dataStoreProvider.count": {
27962
28312
  capName: "data-store-provider",
27963
28313
  capScope: "system",
@@ -28372,6 +28722,12 @@ Object.freeze({
28372
28722
  addonId: null,
28373
28723
  access: "view"
28374
28724
  },
28725
+ "deviceManager.getChildrenBatch": {
28726
+ capName: "device-manager",
28727
+ capScope: "system",
28728
+ addonId: null,
28729
+ access: "view"
28730
+ },
28375
28731
  "deviceManager.getConfigSchema": {
28376
28732
  capName: "device-manager",
28377
28733
  capScope: "system",
@@ -29422,6 +29778,18 @@ Object.freeze({
29422
29778
  addonId: null,
29423
29779
  access: "create"
29424
29780
  },
29781
+ "logChannels.apply": {
29782
+ capName: "log-channels",
29783
+ capScope: "system",
29784
+ addonId: null,
29785
+ access: "create"
29786
+ },
29787
+ "logChannels.list": {
29788
+ capName: "log-channels",
29789
+ capScope: "system",
29790
+ addonId: null,
29791
+ access: "view"
29792
+ },
29425
29793
  "logDestination.query": {
29426
29794
  capName: "log-destination",
29427
29795
  capScope: "system",
@@ -31576,6 +31944,12 @@ Object.freeze({
31576
31944
  addonId: null,
31577
31945
  access: "create"
31578
31946
  },
31947
+ "settingsStore.aggregate": {
31948
+ capName: "settings-store",
31949
+ capScope: "system",
31950
+ addonId: null,
31951
+ access: "view"
31952
+ },
31579
31953
  "settingsStore.count": {
31580
31954
  capName: "settings-store",
31581
31955
  capScope: "system",
@@ -33155,6 +33529,11 @@ Object.freeze({
33155
33529
  form: "single",
33156
33530
  optional: false
33157
33531
  }],
33532
+ "deviceManager.getChildrenBatch": [{
33533
+ name: "parentDeviceIds",
33534
+ form: "array",
33535
+ optional: false
33536
+ }],
33158
33537
  "deviceManager.getConfigSchema": [{
33159
33538
  name: "deviceId",
33160
33539
  form: "single",
@@ -7453,6 +7453,111 @@ var CameraSwitchGroupSchema = object({
7453
7453
  fetchedAt: number()
7454
7454
  });
7455
7455
  /**
7456
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
7457
+ * an addon declares its channels in.
7458
+ *
7459
+ * ## Two axes, deliberately separated
7460
+ *
7461
+ * - **DECLARATION** — which channels exist. Only the addon knows:
7462
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7463
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
7464
+ * and rots silently. So a channel is declared where it is consulted, and the
7465
+ * `log-channels` capability enumerates the declarations.
7466
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
7467
+ * thing: the logging settings document on the `system` cap. Two authorities
7468
+ * over the values is the exact defect
7469
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7470
+ * remove; re-introducing it from the cure side would be grotesque.
7471
+ *
7472
+ * Nothing in this file reads a clock, an env var or a store. The registry is
7473
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7474
+ * the hot path with a value somebody actually read, and by
7475
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7476
+ * never reaches here, so it can neither disarm an armed channel nor arm a
7477
+ * disarmed one (D49).
7478
+ *
7479
+ * ## The canonical call shape
7480
+ *
7481
+ * ```ts
7482
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7483
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7484
+ * }
7485
+ * ```
7486
+ *
7487
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7488
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
7489
+ * object literal is never constructed because it lives inside the branch. It
7490
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
7491
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
7492
+ * destination floor (measured at 1.93 ns/call when off).
7493
+ *
7494
+ * ## Why a channel emits at `info`
7495
+ *
7496
+ * `loki-logging.addon.ts` pins the destination default at `info` and
7497
+ * `loki-destination.ts` drops everything below it, so a line emitted at
7498
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7499
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
7500
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7501
+ * emits at the channel's declared level, whose schema floor is `info`.
7502
+ */
7503
+ /**
7504
+ * The level a channel writes at once armed.
7505
+ *
7506
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7507
+ * not leave the process for Loki, and the whole point of arming a channel is
7508
+ * to read it later.
7509
+ */
7510
+ var LogChannelLevelSchema = _enum([
7511
+ "info",
7512
+ "warn",
7513
+ "error"
7514
+ ]);
7515
+ /**
7516
+ * What an addon declares about one channel. No value, no state — a
7517
+ * declaration is inert.
7518
+ */
7519
+ var LogChannelDescriptorSchema = object({
7520
+ /**
7521
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7522
+ * the addon's short name so an operator reading a channel list can tell who
7523
+ * owns it without a second lookup.
7524
+ */
7525
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7526
+ /** One sentence: what the operator will SEE after arming it. */
7527
+ description: string().min(1),
7528
+ /** The level its lines are emitted at. Never below `info`. */
7529
+ defaultLevel: LogChannelLevelSchema,
7530
+ /**
7531
+ * Whether this channel can be narrowed to a camera.
7532
+ *
7533
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
7534
+ * consulted with the numeric device id, AND every line the channel admits
7535
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
7536
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7537
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7538
+ * the body is the only way to filter.
7539
+ *
7540
+ * A channel whose lines carry the device only in `meta` (or not at all) is
7541
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7542
+ * the operator narrows to one camera, sees nothing, and concludes the code
7543
+ * path was never taken.
7544
+ */
7545
+ perDevice: boolean()
7546
+ });
7547
+ /**
7548
+ * An armed window over one channel, as the document hands it to a mirror.
7549
+ *
7550
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7551
+ * expires by itself, which is the one failure a boolean cannot avoid.
7552
+ */
7553
+ var LogChannelWindowSchema = object({
7554
+ channel: string().min(1),
7555
+ /** Epoch ms the window closes at. */
7556
+ armedUntilMs: number(),
7557
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7558
+ deviceIds: array(number().int()).readonly().nullable()
7559
+ });
7560
+ /**
7456
7561
  * Ops-log — the durable, append-only operations audit shared by the
7457
7562
  * recordings and events management surfaces.
7458
7563
  *
@@ -10971,6 +11076,35 @@ var MutationFilterSchema = object({
10971
11076
  whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
10972
11077
  whereNot: record(string(), unknown()).optional()
10973
11078
  });
11079
+ /**
11080
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
11081
+ *
11082
+ * `as` names the slot in the result, so the SAME column may be asked twice with
11083
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
11084
+ * a `Record<column, op>` shape could not express.
11085
+ */
11086
+ var AggregateFieldSchema = object({
11087
+ /** Result key. */
11088
+ as: string().min(1),
11089
+ /** Column to aggregate. Must be a real column of a declared collection. */
11090
+ field: string().min(1),
11091
+ op: _enum([
11092
+ "sum",
11093
+ "min",
11094
+ "max"
11095
+ ])
11096
+ });
11097
+ /**
11098
+ * `COUNT(*)` plus one number per requested field.
11099
+ *
11100
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
11101
+ * that really is 0 are different facts, and an accounting caller that renders
11102
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
11103
+ */
11104
+ var AggregateResultSchema = object({
11105
+ count: number().int(),
11106
+ values: record(string(), number().nullable())
11107
+ });
10974
11108
  /** A single stored record: `{ id, data }`. */
10975
11109
  var SettingsRecordSchema = object({
10976
11110
  id: string(),
@@ -11055,6 +11189,11 @@ method(object({
11055
11189
  collection: string(),
11056
11190
  filter: QueryFilterSchema.optional()
11057
11191
  }), number()), method(object({
11192
+ namespace: string().optional(),
11193
+ collection: string(),
11194
+ fields: array(AggregateFieldSchema).readonly(),
11195
+ filter: QueryFilterSchema.optional()
11196
+ }), AggregateResultSchema), method(object({
11058
11197
  namespace: string().optional(),
11059
11198
  collection: string(),
11060
11199
  field: string(),
@@ -11171,6 +11310,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11171
11310
  collection: string(),
11172
11311
  filter: QueryFilterSchema.optional()
11173
11312
  }), number(), { auth: "admin" }), method(object({
11313
+ namespace: string().optional(),
11314
+ collection: string(),
11315
+ fields: array(AggregateFieldSchema).readonly(),
11316
+ filter: QueryFilterSchema.optional()
11317
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
11174
11318
  namespace: string().optional(),
11175
11319
  collection: string(),
11176
11320
  field: string(),
@@ -11732,24 +11876,6 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
11732
11876
  kind: "mutation",
11733
11877
  auth: "admin"
11734
11878
  });
11735
- /**
11736
- * Device Manager capability — hub-side singleton that unifies device persistence,
11737
- * live registry access, and all management operations into a single tRPC surface.
11738
- *
11739
- * Replaces:
11740
- * - `device-persistence` capability (persistence methods absorbed here)
11741
- * - `device-management.router.ts` (deleted in Phase 2)
11742
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
11743
- *
11744
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
11745
- * fork into separate processes but never run on remote cluster agents. Therefore:
11746
- * - No nodeId routing needed — this is a pure hub singleton.
11747
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
11748
- * - No shadow registry or cross-node aggregation required.
11749
- *
11750
- * Forked workers register devices back to the hub via `ctx.devices`
11751
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
11752
- */
11753
11879
  /** One child-placement directive on a container's `childLayout`. Structurally
11754
11880
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
11755
11881
  * shape for the same field. The child is identified by its re-sync-stable
@@ -12118,7 +12244,7 @@ method(object({
12118
12244
  * it answers today and the caller filters as it already does.
12119
12245
  */
12120
12246
  deviceIds: array(number()).optional()
12121
- }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
12247
+ }), 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({
12122
12248
  mode: LinkedDevicesModeSchema,
12123
12249
  devices: array(LinkedDeviceSchema)
12124
12250
  })), 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({
@@ -12842,6 +12968,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
12842
12968
  kind: "mutation",
12843
12969
  auth: "admin"
12844
12970
  });
12971
+ /**
12972
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
12973
+ * through. It stores nothing.
12974
+ *
12975
+ * ## Why a capability at all, and why this shape
12976
+ *
12977
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
12978
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
12979
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
12980
+ * fails, an operator just never sees the channel somebody added. So the list
12981
+ * is assembled from declarations at runtime.
12982
+ *
12983
+ * The shape is copied from `log-destination.cap.ts`, which already does
12984
+ * exactly this job: `mode: 'collection'`, `internal: true`,
12985
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
12986
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
12987
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
12988
+ * runner's declarations reach hub-main over the transport that already exists.
12989
+ * No new UDS message, no second registry.
12990
+ *
12991
+ * ## What it deliberately does NOT own
12992
+ *
12993
+ * The VALUES — which channel is armed, for which cameras, until when — live in
12994
+ * ONE place: the logging settings document on the `system` cap
12995
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
12996
+ * value is the defect the plan behind this work exists to remove, and
12997
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
12998
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
12999
+ * setter for a window and no persistence of any kind.
13000
+ *
13001
+ * ## Why `apply` is here even so
13002
+ *
13003
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
13004
+ * seam has to carry the value from the authority to the mirror, and a channel
13005
+ * that cannot be reached is precisely the dead knob this whole slice exists to
13006
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
13007
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
13008
+ * persists nothing, it is never the source of a value, and it is called only
13009
+ * with a set the hub actually read (D49 — a read that fails does not call it
13010
+ * at all, so no channel is silently disarmed by a bad read).
13011
+ */
13012
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
13013
+ var LogChannelApplyResultSchema = object({
13014
+ /** How many declared channels are armed in this process after the call. */
13015
+ armed: number().int().min(0),
13016
+ /**
13017
+ * Names the document armed that this process does not declare. Reported
13018
+ * rather than swallowed: a name here is either a typo or an addon that has
13019
+ * not booted, and both deserve a line instead of silence.
13020
+ */
13021
+ unknown: array(string()).readonly()
13022
+ });
13023
+ method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
12845
13024
  var LogLevelSchema = _enum([
12846
13025
  "debug",
12847
13026
  "info",
@@ -26157,17 +26336,60 @@ var SetSiteLocationInputSchema = object({
26157
26336
  longitude: number().min(-180).max(180)
26158
26337
  }).nullable();
26159
26338
  /**
26160
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
26339
+ * The TRANSPORT a call arrived on.
26340
+ *
26341
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
26342
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
26343
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
26344
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
26345
+ * checkable rather than asserted.
26346
+ *
26347
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
26348
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
26349
+ * connection; the viewer talks to the hub over `wsLink`
26350
+ * exclusively, so this is the plane the HTTP census could not see.
26351
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
26352
+ * never touches a socket and therefore never touched a census.
26353
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
26354
+ * that is exactly what its `0` asserts: every plane the hub has can name
26355
+ * itself. It is an output bucket, never a knob — a call that arrives on a
26356
+ * plane nobody instrumented lands here instead of vanishing from the total.
26357
+ */
26358
+ var TransportPlaneSchema = _enum([
26359
+ "http",
26360
+ "ws",
26361
+ "mesh",
26362
+ "unknown"
26363
+ ]);
26364
+ /**
26365
+ * Calls per plane. Every key is always present, `0` included — an absent plane
26366
+ * reads as "not instrumented", which is the one thing this census must never
26367
+ * make an operator wonder about.
26368
+ */
26369
+ var TransportPlaneCountsSchema = object({
26370
+ http: number(),
26371
+ ws: number(),
26372
+ mesh: number(),
26373
+ unknown: number()
26374
+ });
26375
+ /**
26376
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
26161
26377
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
26162
26378
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
26163
26379
  * already prints - never a token, never an `Authorization` header.
26380
+ *
26381
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
26382
+ * and lives for hours, so folding it into a call count makes one long-lived
26383
+ * stream look like a storm.
26164
26384
  */
26165
26385
  var RequestCensusGroupSchema = object({
26386
+ plane: TransportPlaneSchema,
26166
26387
  procedure: string(),
26167
26388
  userAgent: string(),
26168
26389
  ip: string(),
26169
26390
  principal: string(),
26170
26391
  calls: number(),
26392
+ subscriptions: number(),
26171
26393
  perMin: number()
26172
26394
  });
26173
26395
  /**
@@ -26180,6 +26402,14 @@ var RequestCensusGroupSchema = object({
26180
26402
  var RequestCensusProcedureSchema = object({
26181
26403
  procedure: string(),
26182
26404
  calls: number(),
26405
+ /**
26406
+ * The same total, split by transport. THIS is the row that answers the
26407
+ * question the census exists for: one look at `deviceManager.listAll` says
26408
+ * which plane carried the 4 960, without joining two log lines by eye.
26409
+ */
26410
+ planes: TransportPlaneCountsSchema,
26411
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
26412
+ subscriptions: number(),
26183
26413
  perMin: number()
26184
26414
  });
26185
26415
  /**
@@ -26207,14 +26437,45 @@ var RequestCensusStatusSchema = object({
26207
26437
  */
26208
26438
  procedureCalls: number(),
26209
26439
  /**
26440
+ * `procedureCalls` split by transport. The four keys sum to
26441
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
26442
+ * `planesExplainTotal` is that identity, checked rather than assumed.
26443
+ */
26444
+ planes: TransportPlaneCountsSchema,
26445
+ /**
26446
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
26447
+ * on no plane at all - which is a RESULT (a plane is missing from the
26448
+ * instrument), not a failure, and it has to be visible to be read as one.
26449
+ */
26450
+ planesExplainTotal: boolean(),
26451
+ /**
26210
26452
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
26211
- * transport resolves one context per connection - but the number that says
26212
- * whether a plane this census cannot see was busy while HTTP was quiet.
26453
+ * adapter resolves one context per connection - kept because a plane's call
26454
+ * count of zero against 37 open connections says something different from a
26455
+ * plane with no connections at all.
26213
26456
  */
26214
26457
  wsConnections: number(),
26458
+ /**
26459
+ * Client frames the WS plane looked at. `wsMessages` far above
26460
+ * `planes.ws + subscriptions` means most traffic is not operations
26461
+ * (keepalives, connection params) - which is itself an answer.
26462
+ */
26463
+ wsMessages: number(),
26464
+ /**
26465
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
26466
+ * purpose: one live-events stream opened at boot and held for six hours is
26467
+ * one subscription, and counting it as a call would let a quiet plane
26468
+ * masquerade as the storm.
26469
+ */
26470
+ subscriptions: number(),
26471
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
26472
+ subscriptionStops: number(),
26215
26473
  distinctGroups: number(),
26216
- /** Calls counted in the totals whose group attribution was shed at the
26217
- * cardinality bound. */
26474
+ /**
26475
+ * Operations counted in the totals whose CALLER attribution was shed at the
26476
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
26477
+ * which transport they arrived on, they just lost their group row.
26478
+ */
26218
26479
  unattributedCalls: number(),
26219
26480
  procedures: array(RequestCensusProcedureSchema).readonly(),
26220
26481
  groups: array(RequestCensusGroupSchema).readonly()
@@ -26237,10 +26498,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
26237
26498
  * The layers of the level hierarchy, general → specific. The most specific
26238
26499
  * layer that carries an explicit value wins.
26239
26500
  *
26240
- * `component` is DECLARED and not yet resolvable: the per-component channels
26241
- * are a later slice of the same plan, and a `levelSource` enum that has to
26242
- * grow later would force every consumer of this document to change with it.
26243
- * Nothing returns `component` today.
26501
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
26502
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
26503
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
26504
+ * that turning it on would not force every consumer of this document to widen
26505
+ * a `levelSource` enum — which is what has now not happened.
26244
26506
  */
26245
26507
  var LoggingScopeKindSchema = _enum([
26246
26508
  "cluster",
@@ -26267,6 +26529,14 @@ var LoggingLevelLayerSchema = object({
26267
26529
  scope: LoggingScopeKindSchema,
26268
26530
  /** The node this layer speaks for; `null` on the cluster layer. */
26269
26531
  nodeId: string().nullable(),
26532
+ /**
26533
+ * The declared channel this layer speaks for; `null` on every layer but
26534
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
26535
+ * by design — the convention this repo settled on is one orchestrator-wide
26536
+ * setting, never per node (D52) — so a component layer that carried a node
26537
+ * would invite a per-node copy of a value that has no per-node meaning.
26538
+ */
26539
+ component: string().nullable(),
26270
26540
  /** Explicitly set here, or `null` when this layer inherits. */
26271
26541
  level: LogLevelSchema$1.nullable()
26272
26542
  });
@@ -26308,6 +26578,49 @@ var DiagnosticWindowPatchSchema = object({
26308
26578
  reportEveryMs: number().int().positive().optional()
26309
26579
  });
26310
26580
  /**
26581
+ * A channel ARMED, as the document reports it.
26582
+ *
26583
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
26584
+ * and the time left, because a diagnostic left running is itself an incident
26585
+ * and "armed for 10 minutes" said an hour ago is not an answer.
26586
+ */
26587
+ var LogChannelWindowStateSchema = object({
26588
+ channel: string(),
26589
+ armed: boolean(),
26590
+ /** Epoch ms the window closes at. 0 when disarmed. */
26591
+ armedUntilMs: number(),
26592
+ /** Ms left before it expires on its own. 0 when disarmed. */
26593
+ remainingMs: number(),
26594
+ /**
26595
+ * The cameras it is narrowed to, or `null` for every camera.
26596
+ *
26597
+ * A channel declared `perDevice: false` can only ever report `null` here:
26598
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
26599
+ * produce a filter that silently matches nothing. The server REFUSES such a
26600
+ * patch rather than quietly widening it — ignoring the request would teach
26601
+ * the operator that per-camera filtering works on that channel when it does
26602
+ * not.
26603
+ */
26604
+ deviceIds: array(number().int()).readonly().nullable()
26605
+ });
26606
+ /**
26607
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
26608
+ * for the same reason: a channel is a window with a deadline, never a switch.
26609
+ */
26610
+ var LogChannelWindowPatchSchema = object({
26611
+ channel: string().min(1),
26612
+ armMs: number().int().min(0),
26613
+ /**
26614
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
26615
+ *
26616
+ * Numeric because the repo's own rule makes it possible: every log line
26617
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
26618
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
26619
+ * diagnosed by hand, and this is the first thing that collects on it.
26620
+ */
26621
+ deviceIds: array(number().int()).readonly().nullable().optional()
26622
+ });
26623
+ /**
26311
26624
  * A PATCH, and patches MERGE.
26312
26625
  *
26313
26626
  * A field absent from the patch is left exactly as it was — arming a
@@ -26326,7 +26639,14 @@ var LoggingSettingsPatchSchema = object({
26326
26639
  * Only the diagnostics NAMED here change. An armed window that is not listed
26327
26640
  * keeps running — a patch is never a full replacement.
26328
26641
  */
26329
- diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
26642
+ diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
26643
+ /**
26644
+ * Only the channels NAMED here change. An armed channel that is not listed
26645
+ * keeps running — same rule as `diagnostics`, because a patch that silently
26646
+ * disarmed the channels it did not mention would make the Levels page and
26647
+ * the Diagnostics page fight over the same value.
26648
+ */
26649
+ channels: array(LogChannelWindowPatchSchema).readonly().optional()
26330
26650
  });
26331
26651
  /**
26332
26652
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -26339,9 +26659,22 @@ var LoggingSettingsPatchSchema = object({
26339
26659
  * authority over the whole hierarchy and answers for every layer, so the
26340
26660
  * layer selector needs a name the transport does not already own.
26341
26661
  */
26342
- var GetLoggingSettingsInputSchema = object({ scopeNodeId: string().optional() });
26662
+ var GetLoggingSettingsInputSchema = object({
26663
+ scopeNodeId: string().optional(),
26664
+ /**
26665
+ * The declared CHANNEL this document is addressed at, when the caller wants
26666
+ * the `component` layer. Absent = the node/cluster hierarchy only.
26667
+ *
26668
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
26669
+ * axes from collapsing: a component level is cluster-wide, a node level is
26670
+ * not, and one selector for both would make "which of these two did I just
26671
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
26672
+ */
26673
+ scopeComponent: string().optional()
26674
+ });
26343
26675
  var SetLoggingSettingsInputSchema = object({
26344
26676
  scopeNodeId: string().optional(),
26677
+ scopeComponent: string().optional(),
26345
26678
  patch: LoggingSettingsPatchSchema
26346
26679
  });
26347
26680
  /**
@@ -26356,9 +26689,20 @@ var SetLoggingSettingsInputSchema = object({
26356
26689
  var LoggingSettingsStateSchema = object({
26357
26690
  /** The layer this document was read at. `null` = the cluster layer. */
26358
26691
  scopeNodeId: string().nullable(),
26692
+ /** The channel this document was read at. `null` = no component layer. */
26693
+ scopeComponent: string().nullable(),
26359
26694
  effective: LoggingEffectiveSchema,
26360
26695
  explicit: LoggingExplicitSchema,
26361
26696
  activeWindows: array(DiagnosticWindowSchema).readonly(),
26697
+ /**
26698
+ * Every channel the cluster's addons DECLARE, gathered from the
26699
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
26700
+ * channel added by a redeployed addon appears without anybody editing a
26701
+ * list, and a channel whose addon is gone stops being offered.
26702
+ */
26703
+ channels: array(LogChannelDescriptorSchema).readonly(),
26704
+ /** The channels ARMED right now, each with its deadline. */
26705
+ activeChannels: array(LogChannelWindowStateSchema).readonly(),
26362
26706
  persisted: boolean()
26363
26707
  });
26364
26708
  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(), {
@@ -27935,6 +28279,12 @@ Object.freeze({
27935
28279
  addonId: null,
27936
28280
  access: "view"
27937
28281
  },
28282
+ "dataStoreProvider.aggregate": {
28283
+ capName: "data-store-provider",
28284
+ capScope: "system",
28285
+ addonId: null,
28286
+ access: "view"
28287
+ },
27938
28288
  "dataStoreProvider.count": {
27939
28289
  capName: "data-store-provider",
27940
28290
  capScope: "system",
@@ -28349,6 +28699,12 @@ Object.freeze({
28349
28699
  addonId: null,
28350
28700
  access: "view"
28351
28701
  },
28702
+ "deviceManager.getChildrenBatch": {
28703
+ capName: "device-manager",
28704
+ capScope: "system",
28705
+ addonId: null,
28706
+ access: "view"
28707
+ },
28352
28708
  "deviceManager.getConfigSchema": {
28353
28709
  capName: "device-manager",
28354
28710
  capScope: "system",
@@ -29399,6 +29755,18 @@ Object.freeze({
29399
29755
  addonId: null,
29400
29756
  access: "create"
29401
29757
  },
29758
+ "logChannels.apply": {
29759
+ capName: "log-channels",
29760
+ capScope: "system",
29761
+ addonId: null,
29762
+ access: "create"
29763
+ },
29764
+ "logChannels.list": {
29765
+ capName: "log-channels",
29766
+ capScope: "system",
29767
+ addonId: null,
29768
+ access: "view"
29769
+ },
29402
29770
  "logDestination.query": {
29403
29771
  capName: "log-destination",
29404
29772
  capScope: "system",
@@ -31553,6 +31921,12 @@ Object.freeze({
31553
31921
  addonId: null,
31554
31922
  access: "create"
31555
31923
  },
31924
+ "settingsStore.aggregate": {
31925
+ capName: "settings-store",
31926
+ capScope: "system",
31927
+ addonId: null,
31928
+ access: "view"
31929
+ },
31556
31930
  "settingsStore.count": {
31557
31931
  capName: "settings-store",
31558
31932
  capScope: "system",
@@ -33132,6 +33506,11 @@ Object.freeze({
33132
33506
  form: "single",
33133
33507
  optional: false
33134
33508
  }],
33509
+ "deviceManager.getChildrenBatch": [{
33510
+ name: "parentDeviceIds",
33511
+ form: "array",
33512
+ optional: false
33513
+ }],
33135
33514
  "deviceManager.getConfigSchema": [{
33136
33515
  name: "deviceId",
33137
33516
  form: "single",
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-Dry6vSuS.js");
5
+ const require_shared = require("./shared-BkgFJ2q-.js");
6
6
  let node_stream = require("node:stream");
7
7
  let webdav = require("webdav");
8
8
  //#region src/providers/webdav/webdav-config-schema.ts
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-Mt26R5Yt.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-JInb-Tpq.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { AuthType, createClient } from "webdav";
4
4
  //#region src/providers/webdav/webdav-config-schema.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-remote-storage",
3
- "version": "1.2.31",
3
+ "version": "1.2.33",
4
4
  "description": "Remote storage providers (SFTP, S3, WebDAV) — unifies remote backends behind the storage-provider cap",
5
5
  "keywords": [
6
6
  "camstack",