@camstack/system 1.2.143 → 1.2.145

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 (62) hide show
  1. package/dist/addon-runner.js +1 -1
  2. package/dist/addon-runner.mjs +1 -1
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +157 -35
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +157 -35
  17. package/dist/builtins/device-manager/device-queries.d.ts +22 -0
  18. package/dist/builtins/device-manager/device-row-store.d.ts +18 -0
  19. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  20. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  21. package/dist/builtins/hub-forwarder/index.js +1 -1
  22. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  23. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  24. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  25. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  26. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  27. package/dist/builtins/local-network/local-network.addon.js +1 -1
  28. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  29. package/dist/builtins/loki-logging/index.js +1 -1
  30. package/dist/builtins/loki-logging/index.mjs +1 -1
  31. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  32. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  33. package/dist/builtins/platform-probe/index.js +1 -1
  34. package/dist/builtins/platform-probe/index.mjs +1 -1
  35. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  36. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  37. package/dist/builtins/snapshot/index.js +1 -1
  38. package/dist/builtins/snapshot/index.mjs +1 -1
  39. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  40. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  41. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +14 -1
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  43. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +2 -1
  45. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +2 -1
  46. package/dist/builtins/system-config/system-config.addon.js +1 -1
  47. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  48. package/dist/builtins/winston-logging/index.js +1 -1
  49. package/dist/builtins/winston-logging/index.mjs +1 -1
  50. package/dist/{dist-CQs1b7uh.js → dist-BVU5JADq.js} +488 -29
  51. package/dist/{dist-CVuVKA-O.mjs → dist-CG7kwIZp.mjs} +488 -29
  52. package/dist/index.js +28 -9
  53. package/dist/index.mjs +28 -9
  54. package/dist/kernel/index.d.ts +1 -1
  55. package/dist/kernel/moleculer/children-batch-loader.d.ts +46 -0
  56. package/dist/kernel/moleculer/core-cap-service.d.ts +17 -2
  57. package/dist/kernel/moleculer/process-service.d.ts +15 -6
  58. package/dist/{manifest-python-deps-BuhBXCg0.mjs → manifest-python-deps-BRyNCnnG.mjs} +191 -1
  59. package/dist/{manifest-python-deps-B_mCU6gz.js → manifest-python-deps-GjlyPjm0.js} +191 -1
  60. package/dist/{retired-settings-keys-DnMYSIEr.mjs → retired-settings-keys-Dm1z4mO4.mjs} +1 -1
  61. package/dist/{retired-settings-keys-Dvei9nhG.js → retired-settings-keys-_PLI9w0k.js} +1 -1
  62. package/package.json +1 -1
@@ -3595,6 +3595,111 @@ function logLevelAtMost(level, threshold) {
3595
3595
  return LOG_LEVEL_RANK[level] <= LOG_LEVEL_RANK[threshold];
3596
3596
  }
3597
3597
  /**
3598
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
3599
+ * an addon declares its channels in.
3600
+ *
3601
+ * ## Two axes, deliberately separated
3602
+ *
3603
+ * - **DECLARATION** — which channels exist. Only the addon knows:
3604
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
3605
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
3606
+ * and rots silently. So a channel is declared where it is consulted, and the
3607
+ * `log-channels` capability enumerates the declarations.
3608
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
3609
+ * thing: the logging settings document on the `system` cap. Two authorities
3610
+ * over the values is the exact defect
3611
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
3612
+ * remove; re-introducing it from the cure side would be grotesque.
3613
+ *
3614
+ * Nothing in this file reads a clock, an env var or a store. The registry is
3615
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
3616
+ * the hot path with a value somebody actually read, and by
3617
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
3618
+ * never reaches here, so it can neither disarm an armed channel nor arm a
3619
+ * disarmed one (D49).
3620
+ *
3621
+ * ## The canonical call shape
3622
+ *
3623
+ * ```ts
3624
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
3625
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
3626
+ * }
3627
+ * ```
3628
+ *
3629
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
3630
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
3631
+ * object literal is never constructed because it lives inside the branch. It
3632
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
3633
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
3634
+ * destination floor (measured at 1.93 ns/call when off).
3635
+ *
3636
+ * ## Why a channel emits at `info`
3637
+ *
3638
+ * `loki-logging.addon.ts` pins the destination default at `info` and
3639
+ * `loki-destination.ts` drops everything below it, so a line emitted at
3640
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
3641
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
3642
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
3643
+ * emits at the channel's declared level, whose schema floor is `info`.
3644
+ */
3645
+ /**
3646
+ * The level a channel writes at once armed.
3647
+ *
3648
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
3649
+ * not leave the process for Loki, and the whole point of arming a channel is
3650
+ * to read it later.
3651
+ */
3652
+ var LogChannelLevelSchema = zod.z.enum([
3653
+ "info",
3654
+ "warn",
3655
+ "error"
3656
+ ]);
3657
+ /**
3658
+ * What an addon declares about one channel. No value, no state — a
3659
+ * declaration is inert.
3660
+ */
3661
+ var LogChannelDescriptorSchema = zod.z.object({
3662
+ /**
3663
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
3664
+ * the addon's short name so an operator reading a channel list can tell who
3665
+ * owns it without a second lookup.
3666
+ */
3667
+ name: zod.z.string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
3668
+ /** One sentence: what the operator will SEE after arming it. */
3669
+ description: zod.z.string().min(1),
3670
+ /** The level its lines are emitted at. Never below `info`. */
3671
+ defaultLevel: LogChannelLevelSchema,
3672
+ /**
3673
+ * Whether this channel can be narrowed to a camera.
3674
+ *
3675
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
3676
+ * consulted with the numeric device id, AND every line the channel admits
3677
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
3678
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
3679
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
3680
+ * the body is the only way to filter.
3681
+ *
3682
+ * A channel whose lines carry the device only in `meta` (or not at all) is
3683
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
3684
+ * the operator narrows to one camera, sees nothing, and concludes the code
3685
+ * path was never taken.
3686
+ */
3687
+ perDevice: zod.z.boolean()
3688
+ });
3689
+ /**
3690
+ * An armed window over one channel, as the document hands it to a mirror.
3691
+ *
3692
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
3693
+ * expires by itself, which is the one failure a boolean cannot avoid.
3694
+ */
3695
+ var LogChannelWindowSchema = zod.z.object({
3696
+ channel: zod.z.string().min(1),
3697
+ /** Epoch ms the window closes at. */
3698
+ armedUntilMs: zod.z.number(),
3699
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
3700
+ deviceIds: zod.z.array(zod.z.number().int()).readonly().nullable()
3701
+ });
3702
+ /**
3598
3703
  * Ops-log — the durable, append-only operations audit shared by the
3599
3704
  * recordings and events management surfaces.
3600
3705
  *
@@ -8134,6 +8239,35 @@ var MutationFilterSchema = zod.z.object({
8134
8239
  whereBetween: zod.z.record(zod.z.string(), zod.z.tuple([zod.z.unknown(), zod.z.unknown()])).optional(),
8135
8240
  whereNot: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
8136
8241
  });
8242
+ /**
8243
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
8244
+ *
8245
+ * `as` names the slot in the result, so the SAME column may be asked twice with
8246
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
8247
+ * a `Record<column, op>` shape could not express.
8248
+ */
8249
+ var AggregateFieldSchema = zod.z.object({
8250
+ /** Result key. */
8251
+ as: zod.z.string().min(1),
8252
+ /** Column to aggregate. Must be a real column of a declared collection. */
8253
+ field: zod.z.string().min(1),
8254
+ op: zod.z.enum([
8255
+ "sum",
8256
+ "min",
8257
+ "max"
8258
+ ])
8259
+ });
8260
+ /**
8261
+ * `COUNT(*)` plus one number per requested field.
8262
+ *
8263
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
8264
+ * that really is 0 are different facts, and an accounting caller that renders
8265
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
8266
+ */
8267
+ var AggregateResultSchema = zod.z.object({
8268
+ count: zod.z.number().int(),
8269
+ values: zod.z.record(zod.z.string(), zod.z.number().nullable())
8270
+ });
8137
8271
  /** A single stored record: `{ id, data }`. */
8138
8272
  var SettingsRecordSchema = zod.z.object({
8139
8273
  id: zod.z.string(),
@@ -8301,6 +8435,32 @@ var settingsStoreCapability = {
8301
8435
  collection: zod.z.string(),
8302
8436
  filter: QueryFilterSchema.optional()
8303
8437
  }), zod.z.number()),
8438
+ /**
8439
+ * `COUNT(*)` and one `SUM` / `MIN` / `MAX` per requested field, in ONE
8440
+ * statement, over the rows `filter` selects.
8441
+ *
8442
+ * Exists because "how much is there" was being answered by materialising
8443
+ * "what is there". The recorder's storage-pressure sweep asked its in-RAM
8444
+ * footage index for bytes/count/oldest/newest across a set of storage
8445
+ * locations twice a minute, and the only way to answer that from a map is
8446
+ * to visit every row — 7.1 M of them on the live hub, ~15 M row visits a
8447
+ * minute on the main thread, which is also why the whole archive had to
8448
+ * stay resident to be visited. The question is a sum; nothing needs to be
8449
+ * materialised to answer it.
8450
+ *
8451
+ * **The engine REFUSES a field it cannot serve**, exactly as
8452
+ * `query.columns` does and unlike a PREDICATE, which is skipped when
8453
+ * unresolvable. A dropped predicate over-matches and the caller sees extra
8454
+ * rows; a dropped aggregate returns a NUMBER that is wrong and looks
8455
+ * exactly like a real one. That asymmetry is what this repo has already
8456
+ * paid for once in `count`.
8457
+ */
8458
+ aggregate: method(zod.z.object({
8459
+ namespace: zod.z.string().optional(),
8460
+ collection: zod.z.string(),
8461
+ fields: zod.z.array(AggregateFieldSchema).readonly(),
8462
+ filter: QueryFilterSchema.optional()
8463
+ }), AggregateResultSchema),
8304
8464
  /** Grouped counts per ((field-origin)/bucketSize) bucket, filtered. */
8305
8465
  histogram: method(zod.z.object({
8306
8466
  namespace: zod.z.string().optional(),
@@ -8507,6 +8667,15 @@ var dataStoreProviderCapability = {
8507
8667
  collection: zod.z.string(),
8508
8668
  filter: QueryFilterSchema.optional()
8509
8669
  }), zod.z.number(), { auth: "admin" }),
8670
+ /** `COUNT(*)` plus one SUM/MIN/MAX per field, in one statement. Mirror of
8671
+ * `settings-store.aggregate` — see it for why an unresolvable field is
8672
+ * refused rather than dropped. */
8673
+ aggregate: method(zod.z.object({
8674
+ namespace: zod.z.string().optional(),
8675
+ collection: zod.z.string(),
8676
+ fields: zod.z.array(AggregateFieldSchema).readonly(),
8677
+ filter: QueryFilterSchema.optional()
8678
+ }), AggregateResultSchema, { auth: "admin" }),
8510
8679
  /** Grouped counts per ((field-origin)/bucketSize) bucket, filtered. */
8511
8680
  histogram: method(zod.z.object({
8512
8681
  namespace: zod.z.string().optional(),
@@ -9329,24 +9498,6 @@ var deviceProviderCapability = {
9329
9498
  })
9330
9499
  }
9331
9500
  };
9332
- /**
9333
- * Device Manager capability — hub-side singleton that unifies device persistence,
9334
- * live registry access, and all management operations into a single tRPC surface.
9335
- *
9336
- * Replaces:
9337
- * - `device-persistence` capability (persistence methods absorbed here)
9338
- * - `device-management.router.ts` (deleted in Phase 2)
9339
- * - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
9340
- *
9341
- * All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
9342
- * fork into separate processes but never run on remote cluster agents. Therefore:
9343
- * - No nodeId routing needed — this is a pure hub singleton.
9344
- * - The hub's DeviceRegistry is the single source of truth for all live devices.
9345
- * - No shadow registry or cross-node aggregation required.
9346
- *
9347
- * Forked workers register devices back to the hub via `ctx.devices`
9348
- * (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
9349
- */
9350
9501
  /** One child-placement directive on a container's `childLayout`. Structurally
9351
9502
  * identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
9352
9503
  * shape for the same field. The child is identified by its re-sync-stable
@@ -9858,6 +10009,39 @@ var deviceManagerCapability = {
9858
10009
  /** List children of a parent device (by parent numeric id). */
9859
10010
  getChildren: method(zod.z.object({ parentDeviceId: zod.z.number() }), zod.z.array(DeviceInfoSchema)),
9860
10011
  /**
10012
+ * `getChildren` for a NAMED SET of parents, in one call.
10013
+ *
10014
+ * The accessory reconcile in `device-cap-proxy.ts` asks this question once
10015
+ * per registered device — every `BaseDevice` inherits a
10016
+ * `getAccessoryChildren()` that returns `[]`, so even a leaf accessory
10017
+ * pays a round-trip to learn it has nothing to prune. Measured on the live
10018
+ * hub 2026-08-27 over a 120-second boot window, fleet of 1 017 devices:
10019
+ * `DeviceRowStore.list < DeviceRowStore.listByParent < getChildren` at
10020
+ * **1 024 calls** returning **919 rows in total** — 1 024 RPCs and 1 024
10021
+ * indexed scans to move less than one row each. `listByParentMany`
10022
+ * collapses the scans; this collapses the RPCs.
10023
+ *
10024
+ * Keyed by parent id as a STRING — a JSON object cannot key by number
10025
+ * (same reason as `getDeviceStatusAggregateBatch`). The per-parent value
10026
+ * is exactly what `getChildren` returns for that parent.
10027
+ *
10028
+ * A parent with no children — or one the fleet does not know — is ABSENT
10029
+ * from the record, never an invented empty row: the same contract as
10030
+ * `DeviceRowStore.getMany`/`listByParentMany`. An EMPTY `parentDeviceIds`
10031
+ * reads nothing at all rather than degrading to "every device".
10032
+ *
10033
+ * `parentDeviceIds` is capped at {@link DEVICE_CHILDREN_BATCH_MAX} — see
10034
+ * that constant for why. A caller with more parents than that sends more
10035
+ * than one call; it never sends one pathological one.
10036
+ *
10037
+ * Version skew: this is a NEW method, not a new field on `getChildren`, so
10038
+ * a hub that predates it answers NOT_FOUND rather than silently stripping
10039
+ * an unknown input key and answering a DIFFERENT question. The kernel-side
10040
+ * loader degrades to per-parent `getChildren` on that error — see
10041
+ * `children-batch-loader.ts`.
10042
+ */
10043
+ getChildrenBatch: method(zod.z.object({ parentDeviceIds: zod.z.array(zod.z.number()).max(256) }), zod.z.record(zod.z.string(), zod.z.array(DeviceInfoSchema))),
10044
+ /**
9861
10045
  * Resolve the devices LINKED to a camera — the single policy authority
9862
10046
  * both consumers call (viewer devices panel + pipeline-analytics event
9863
10047
  * kinds/ingest). Device-tree children are ALWAYS included; mode 'auto'
@@ -11007,6 +11191,80 @@ var llmCapability = {
11007
11191
  })
11008
11192
  }
11009
11193
  };
11194
+ /**
11195
+ * `log-channels` — the capability an addon DECLARES its diagnostic channels
11196
+ * through. It stores nothing.
11197
+ *
11198
+ * ## Why a capability at all, and why this shape
11199
+ *
11200
+ * Which channels exist is knowledge only the addon has: `stream-broker` knows
11201
+ * webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
11202
+ * maintained by hand rots at the first addition and rots INVISIBLY — nothing
11203
+ * fails, an operator just never sees the channel somebody added. So the list
11204
+ * is assembled from declarations at runtime.
11205
+ *
11206
+ * The shape is copied from `log-destination.cap.ts`, which already does
11207
+ * exactly this job: `mode: 'collection'`, `internal: true`,
11208
+ * `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
11209
+ * `addons.listCapabilityProviders` still enumerates it, and the hub's
11210
+ * `CapabilityRegistry` still holds an RPC proxy per provider so a forked
11211
+ * runner's declarations reach hub-main over the transport that already exists.
11212
+ * No new UDS message, no second registry.
11213
+ *
11214
+ * ## What it deliberately does NOT own
11215
+ *
11216
+ * The VALUES — which channel is armed, for which cameras, until when — live in
11217
+ * ONE place: the logging settings document on the `system` cap
11218
+ * (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
11219
+ * value is the defect the plan behind this work exists to remove, and
11220
+ * `setRequestCensus` was retired (D245) rather than allowed to be a second
11221
+ * one. {@link logChannelsCapability} therefore has no getter for a level, no
11222
+ * setter for a window and no persistence of any kind.
11223
+ *
11224
+ * ## Why `apply` is here even so
11225
+ *
11226
+ * The gate lives in the addon's PROCESS; the document lives in hub-main. Some
11227
+ * seam has to carry the value from the authority to the mirror, and a channel
11228
+ * that cannot be reached is precisely the dead knob this whole slice exists to
11229
+ * make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
11230
+ * `apply` is that seam and nothing more: it writes an in-memory mirror, it
11231
+ * persists nothing, it is never the source of a value, and it is called only
11232
+ * with a set the hub actually read (D49 — a read that fails does not call it
11233
+ * at all, so no channel is silently disarmed by a bad read).
11234
+ */
11235
+ /** What `apply` reports back — enough to log, not enough to be a second state. */
11236
+ var LogChannelApplyResultSchema = zod.z.object({
11237
+ /** How many declared channels are armed in this process after the call. */
11238
+ armed: zod.z.number().int().min(0),
11239
+ /**
11240
+ * Names the document armed that this process does not declare. Reported
11241
+ * rather than swallowed: a name here is either a typo or an addon that has
11242
+ * not booted, and both deserve a line instead of silence.
11243
+ */
11244
+ unknown: zod.z.array(zod.z.string()).readonly()
11245
+ });
11246
+ var logChannelsCapability = {
11247
+ name: "log-channels",
11248
+ scope: "system",
11249
+ mode: "collection",
11250
+ internal: true,
11251
+ methods: {
11252
+ /** The channels this addon declares. Inert: no value, no state. */
11253
+ list: method(zod.z.void(), zod.z.array(LogChannelDescriptorSchema).readonly()),
11254
+ /**
11255
+ * Refresh this process's mirror from the document's FULL set of armed
11256
+ * windows.
11257
+ *
11258
+ * Full and not incremental on purpose: the document is the authority, so a
11259
+ * channel it does not name is disarmed here. An incremental apply would
11260
+ * let a disarm get lost in transit and leave a channel running that
11261
+ * nobody can see is running.
11262
+ */
11263
+ apply: method(zod.z.object({ windows: zod.z.array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" })
11264
+ },
11265
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
11266
+ mount: { kind: "skip" }
11267
+ };
11010
11268
  var LogLevelSchema = zod.z.enum([
11011
11269
  "debug",
11012
11270
  "info",
@@ -29567,17 +29825,60 @@ var SetSiteLocationInputSchema = zod.z.object({
29567
29825
  longitude: zod.z.number().min(-180).max(180)
29568
29826
  }).nullable();
29569
29827
  /**
29570
- * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
29828
+ * The TRANSPORT a call arrived on.
29829
+ *
29830
+ * Every counted call carries exactly one of these, and `unknown` is a PLANE
29831
+ * rather than a gap: a plane that cannot attribute a call declares it here, so
29832
+ * the call lands in a named bucket instead of vanishing. `planes` summing to
29833
+ * `procedureCalls` is what makes "the sum of the planes explains the total"
29834
+ * checkable rather than asserted.
29835
+ *
29836
+ * - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
29837
+ * - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
29838
+ * connection; the viewer talks to the hub over `wsLink`
29839
+ * exclusively, so this is the plane the HTTP census could not see.
29840
+ * - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
29841
+ * never touches a socket and therefore never touched a census.
29842
+ * - `unknown` — counted, plane undecidable. No hook produces it today, and
29843
+ * that is exactly what its `0` asserts: every plane the hub has can name
29844
+ * itself. It is an output bucket, never a knob — a call that arrives on a
29845
+ * plane nobody instrumented lands here instead of vanishing from the total.
29846
+ */
29847
+ var TransportPlaneSchema = zod.z.enum([
29848
+ "http",
29849
+ "ws",
29850
+ "mesh",
29851
+ "unknown"
29852
+ ]);
29853
+ /**
29854
+ * Calls per plane. Every key is always present, `0` included — an absent plane
29855
+ * reads as "not instrumented", which is the one thing this census must never
29856
+ * make an operator wonder about.
29857
+ */
29858
+ var TransportPlaneCountsSchema = zod.z.object({
29859
+ http: zod.z.number(),
29860
+ ws: zod.z.number(),
29861
+ mesh: zod.z.number(),
29862
+ unknown: zod.z.number()
29863
+ });
29864
+ /**
29865
+ * One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
29571
29866
  * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
29572
29867
  * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
29573
29868
  * already prints - never a token, never an `Authorization` header.
29869
+ *
29870
+ * `subscriptions` is counted APART from `calls`: a subscription is opened once
29871
+ * and lives for hours, so folding it into a call count makes one long-lived
29872
+ * stream look like a storm.
29574
29873
  */
29575
29874
  var RequestCensusGroupSchema = zod.z.object({
29875
+ plane: TransportPlaneSchema,
29576
29876
  procedure: zod.z.string(),
29577
29877
  userAgent: zod.z.string(),
29578
29878
  ip: zod.z.string(),
29579
29879
  principal: zod.z.string(),
29580
29880
  calls: zod.z.number(),
29881
+ subscriptions: zod.z.number(),
29581
29882
  perMin: zod.z.number()
29582
29883
  });
29583
29884
  /**
@@ -29590,6 +29891,14 @@ var RequestCensusGroupSchema = zod.z.object({
29590
29891
  var RequestCensusProcedureSchema = zod.z.object({
29591
29892
  procedure: zod.z.string(),
29592
29893
  calls: zod.z.number(),
29894
+ /**
29895
+ * The same total, split by transport. THIS is the row that answers the
29896
+ * question the census exists for: one look at `deviceManager.listAll` says
29897
+ * which plane carried the 4 960, without joining two log lines by eye.
29898
+ */
29899
+ planes: TransportPlaneCountsSchema,
29900
+ /** Subscription STARTS on this procedure. Never folded into `calls`. */
29901
+ subscriptions: zod.z.number(),
29593
29902
  perMin: zod.z.number()
29594
29903
  });
29595
29904
  /**
@@ -29617,14 +29926,45 @@ var RequestCensusStatusSchema = zod.z.object({
29617
29926
  */
29618
29927
  procedureCalls: zod.z.number(),
29619
29928
  /**
29929
+ * `procedureCalls` split by transport. The four keys sum to
29930
+ * `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
29931
+ * `planesExplainTotal` is that identity, checked rather than assumed.
29932
+ */
29933
+ planes: TransportPlaneCountsSchema,
29934
+ /**
29935
+ * True iff `planes` sums to `procedureCalls`. False means a call was counted
29936
+ * on no plane at all - which is a RESULT (a plane is missing from the
29937
+ * instrument), not a failure, and it has to be visible to be read as one.
29938
+ */
29939
+ planesExplainTotal: zod.z.boolean(),
29940
+ /**
29620
29941
  * tRPC WebSocket connections opened during the window. NOT calls - the WS
29621
- * transport resolves one context per connection - but the number that says
29622
- * whether a plane this census cannot see was busy while HTTP was quiet.
29942
+ * adapter resolves one context per connection - kept because a plane's call
29943
+ * count of zero against 37 open connections says something different from a
29944
+ * plane with no connections at all.
29623
29945
  */
29624
29946
  wsConnections: zod.z.number(),
29947
+ /**
29948
+ * Client frames the WS plane looked at. `wsMessages` far above
29949
+ * `planes.ws + subscriptions` means most traffic is not operations
29950
+ * (keepalives, connection params) - which is itself an answer.
29951
+ */
29952
+ wsMessages: zod.z.number(),
29953
+ /**
29954
+ * Subscription STARTS across every plane, excluded from `procedureCalls` on
29955
+ * purpose: one live-events stream opened at boot and held for six hours is
29956
+ * one subscription, and counting it as a call would let a quiet plane
29957
+ * masquerade as the storm.
29958
+ */
29959
+ subscriptions: zod.z.number(),
29960
+ /** `subscription.stop` frames. Starts minus stops is what is still open. */
29961
+ subscriptionStops: zod.z.number(),
29625
29962
  distinctGroups: zod.z.number(),
29626
- /** Calls counted in the totals whose group attribution was shed at the
29627
- * cardinality bound. */
29963
+ /**
29964
+ * Operations counted in the totals whose CALLER attribution was shed at the
29965
+ * cardinality bound. Unrelated to the `unknown` PLANE: these calls know
29966
+ * which transport they arrived on, they just lost their group row.
29967
+ */
29628
29968
  unattributedCalls: zod.z.number(),
29629
29969
  procedures: zod.z.array(RequestCensusProcedureSchema).readonly(),
29630
29970
  groups: zod.z.array(RequestCensusGroupSchema).readonly()
@@ -29647,10 +29987,11 @@ var DiagnosticIdSchema = zod.z.enum(["request-census"]);
29647
29987
  * The layers of the level hierarchy, general → specific. The most specific
29648
29988
  * layer that carries an explicit value wins.
29649
29989
  *
29650
- * `component` is DECLARED and not yet resolvable: the per-component channels
29651
- * are a later slice of the same plan, and a `levelSource` enum that has to
29652
- * grow later would force every consumer of this document to change with it.
29653
- * Nothing returns `component` today.
29990
+ * `component` became RESOLVABLE on 2026-08-27: a component is a declared log
29991
+ * CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
29992
+ * `scopeComponent`. It was declared-but-dark in the first slice precisely so
29993
+ * that turning it on would not force every consumer of this document to widen
29994
+ * a `levelSource` enum — which is what has now not happened.
29654
29995
  */
29655
29996
  var LoggingScopeKindSchema = zod.z.enum([
29656
29997
  "cluster",
@@ -29677,6 +30018,14 @@ var LoggingLevelLayerSchema = zod.z.object({
29677
30018
  scope: LoggingScopeKindSchema,
29678
30019
  /** The node this layer speaks for; `null` on the cluster layer. */
29679
30020
  nodeId: zod.z.string().nullable(),
30021
+ /**
30022
+ * The declared channel this layer speaks for; `null` on every layer but
30023
+ * `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
30024
+ * by design — the convention this repo settled on is one orchestrator-wide
30025
+ * setting, never per node (D52) — so a component layer that carried a node
30026
+ * would invite a per-node copy of a value that has no per-node meaning.
30027
+ */
30028
+ component: zod.z.string().nullable(),
29680
30029
  /** Explicitly set here, or `null` when this layer inherits. */
29681
30030
  level: LogLevelSchema$1.nullable()
29682
30031
  });
@@ -29718,6 +30067,49 @@ var DiagnosticWindowPatchSchema = zod.z.object({
29718
30067
  reportEveryMs: zod.z.number().int().positive().optional()
29719
30068
  });
29720
30069
  /**
30070
+ * A channel ARMED, as the document reports it.
30071
+ *
30072
+ * `armMs` is not echoed back: what an operator needs to see is the deadline
30073
+ * and the time left, because a diagnostic left running is itself an incident
30074
+ * and "armed for 10 minutes" said an hour ago is not an answer.
30075
+ */
30076
+ var LogChannelWindowStateSchema = zod.z.object({
30077
+ channel: zod.z.string(),
30078
+ armed: zod.z.boolean(),
30079
+ /** Epoch ms the window closes at. 0 when disarmed. */
30080
+ armedUntilMs: zod.z.number(),
30081
+ /** Ms left before it expires on its own. 0 when disarmed. */
30082
+ remainingMs: zod.z.number(),
30083
+ /**
30084
+ * The cameras it is narrowed to, or `null` for every camera.
30085
+ *
30086
+ * A channel declared `perDevice: false` can only ever report `null` here:
30087
+ * its lines do not carry `tags: { deviceId }`, so narrowing them would
30088
+ * produce a filter that silently matches nothing. The server REFUSES such a
30089
+ * patch rather than quietly widening it — ignoring the request would teach
30090
+ * the operator that per-camera filtering works on that channel when it does
30091
+ * not.
30092
+ */
30093
+ deviceIds: zod.z.array(zod.z.number().int()).readonly().nullable()
30094
+ });
30095
+ /**
30096
+ * `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
30097
+ * for the same reason: a channel is a window with a deadline, never a switch.
30098
+ */
30099
+ var LogChannelWindowPatchSchema = zod.z.object({
30100
+ channel: zod.z.string().min(1),
30101
+ armMs: zod.z.number().int().min(0),
30102
+ /**
30103
+ * Narrow to these numeric device ids. Absent or `null` = every camera.
30104
+ *
30105
+ * Numeric because the repo's own rule makes it possible: every log line
30106
+ * about a device carries `tags: { deviceId }` with the numeric id. That rule
30107
+ * was paid for with a 22% thumbnail gap and a 3-hour media blackout both
30108
+ * diagnosed by hand, and this is the first thing that collects on it.
30109
+ */
30110
+ deviceIds: zod.z.array(zod.z.number().int()).readonly().nullable().optional()
30111
+ });
30112
+ /**
29721
30113
  * A PATCH, and patches MERGE.
29722
30114
  *
29723
30115
  * A field absent from the patch is left exactly as it was — arming a
@@ -29736,7 +30128,14 @@ var LoggingSettingsPatchSchema = zod.z.object({
29736
30128
  * Only the diagnostics NAMED here change. An armed window that is not listed
29737
30129
  * keeps running — a patch is never a full replacement.
29738
30130
  */
29739
- diagnostics: zod.z.array(DiagnosticWindowPatchSchema).readonly().optional()
30131
+ diagnostics: zod.z.array(DiagnosticWindowPatchSchema).readonly().optional(),
30132
+ /**
30133
+ * Only the channels NAMED here change. An armed channel that is not listed
30134
+ * keeps running — same rule as `diagnostics`, because a patch that silently
30135
+ * disarmed the channels it did not mention would make the Levels page and
30136
+ * the Diagnostics page fight over the same value.
30137
+ */
30138
+ channels: zod.z.array(LogChannelWindowPatchSchema).readonly().optional()
29740
30139
  });
29741
30140
  /**
29742
30141
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -29749,9 +30148,22 @@ var LoggingSettingsPatchSchema = zod.z.object({
29749
30148
  * authority over the whole hierarchy and answers for every layer, so the
29750
30149
  * layer selector needs a name the transport does not already own.
29751
30150
  */
29752
- var GetLoggingSettingsInputSchema = zod.z.object({ scopeNodeId: zod.z.string().optional() });
30151
+ var GetLoggingSettingsInputSchema = zod.z.object({
30152
+ scopeNodeId: zod.z.string().optional(),
30153
+ /**
30154
+ * The declared CHANNEL this document is addressed at, when the caller wants
30155
+ * the `component` layer. Absent = the node/cluster hierarchy only.
30156
+ *
30157
+ * Naming it separately rather than overloading `scopeNodeId` keeps the two
30158
+ * axes from collapsing: a component level is cluster-wide, a node level is
30159
+ * not, and one selector for both would make "which of these two did I just
30160
+ * set" unanswerable — the exact ambiguity `explicit` exists to remove.
30161
+ */
30162
+ scopeComponent: zod.z.string().optional()
30163
+ });
29753
30164
  var SetLoggingSettingsInputSchema = zod.z.object({
29754
30165
  scopeNodeId: zod.z.string().optional(),
30166
+ scopeComponent: zod.z.string().optional(),
29755
30167
  patch: LoggingSettingsPatchSchema
29756
30168
  });
29757
30169
  /**
@@ -29766,9 +30178,20 @@ var SetLoggingSettingsInputSchema = zod.z.object({
29766
30178
  var LoggingSettingsStateSchema = zod.z.object({
29767
30179
  /** The layer this document was read at. `null` = the cluster layer. */
29768
30180
  scopeNodeId: zod.z.string().nullable(),
30181
+ /** The channel this document was read at. `null` = no component layer. */
30182
+ scopeComponent: zod.z.string().nullable(),
29769
30183
  effective: LoggingEffectiveSchema,
29770
30184
  explicit: LoggingExplicitSchema,
29771
30185
  activeWindows: zod.z.array(DiagnosticWindowSchema).readonly(),
30186
+ /**
30187
+ * Every channel the cluster's addons DECLARE, gathered from the
30188
+ * `log-channels` providers. Not stored anywhere: assembled per read, so a
30189
+ * channel added by a redeployed addon appears without anybody editing a
30190
+ * list, and a channel whose addon is gone stops being offered.
30191
+ */
30192
+ channels: zod.z.array(LogChannelDescriptorSchema).readonly(),
30193
+ /** The channels ARMED right now, each with its deadline. */
30194
+ activeChannels: zod.z.array(LogChannelWindowStateSchema).readonly(),
29772
30195
  persisted: zod.z.boolean()
29773
30196
  });
29774
30197
  var systemCapability = {
@@ -31627,6 +32050,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
31627
32050
  llmRuntimeCapability,
31628
32051
  localNetworkCapability,
31629
32052
  lockControlCapability,
32053
+ logChannelsCapability,
31630
32054
  logDestinationCapability,
31631
32055
  loginMethodCapability,
31632
32056
  mediaPlayerCapability,
@@ -32593,6 +33017,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32593
33017
  addonId: null,
32594
33018
  access: "view"
32595
33019
  },
33020
+ "dataStoreProvider.aggregate": {
33021
+ capName: "data-store-provider",
33022
+ capScope: "system",
33023
+ addonId: null,
33024
+ access: "view"
33025
+ },
32596
33026
  "dataStoreProvider.count": {
32597
33027
  capName: "data-store-provider",
32598
33028
  capScope: "system",
@@ -33007,6 +33437,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33007
33437
  addonId: null,
33008
33438
  access: "view"
33009
33439
  },
33440
+ "deviceManager.getChildrenBatch": {
33441
+ capName: "device-manager",
33442
+ capScope: "system",
33443
+ addonId: null,
33444
+ access: "view"
33445
+ },
33010
33446
  "deviceManager.getConfigSchema": {
33011
33447
  capName: "device-manager",
33012
33448
  capScope: "system",
@@ -34057,6 +34493,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
34057
34493
  addonId: null,
34058
34494
  access: "create"
34059
34495
  },
34496
+ "logChannels.apply": {
34497
+ capName: "log-channels",
34498
+ capScope: "system",
34499
+ addonId: null,
34500
+ access: "create"
34501
+ },
34502
+ "logChannels.list": {
34503
+ capName: "log-channels",
34504
+ capScope: "system",
34505
+ addonId: null,
34506
+ access: "view"
34507
+ },
34060
34508
  "logDestination.query": {
34061
34509
  capName: "log-destination",
34062
34510
  capScope: "system",
@@ -36211,6 +36659,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
36211
36659
  addonId: null,
36212
36660
  access: "create"
36213
36661
  },
36662
+ "settingsStore.aggregate": {
36663
+ capName: "settings-store",
36664
+ capScope: "system",
36665
+ addonId: null,
36666
+ access: "view"
36667
+ },
36214
36668
  "settingsStore.count": {
36215
36669
  capName: "settings-store",
36216
36670
  capScope: "system",
@@ -37790,6 +38244,11 @@ Object.freeze({
37790
38244
  form: "single",
37791
38245
  optional: false
37792
38246
  }],
38247
+ "deviceManager.getChildrenBatch": [{
38248
+ name: "parentDeviceIds",
38249
+ form: "array",
38250
+ optional: false
38251
+ }],
37793
38252
  "deviceManager.getConfigSchema": [{
37794
38253
  name: "deviceId",
37795
38254
  form: "single",