@camstack/system 1.2.144 → 1.2.146

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 +2 -1
  2. package/dist/addon-runner.mjs +2 -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-D3lqzV40.js → dist-BVU5JADq.js} +401 -24
  51. package/dist/{dist-6rM7chzb.mjs → dist-CG7kwIZp.mjs} +401 -24
  52. package/dist/index.d.ts +2 -2
  53. package/dist/index.js +60 -11
  54. package/dist/index.mjs +52 -12
  55. package/dist/kernel/heap-watch.d.ts +209 -1
  56. package/dist/kernel/moleculer/children-batch-loader.d.ts +46 -0
  57. package/dist/kernel/moleculer/process-service.d.ts +15 -6
  58. package/dist/{manifest-python-deps-BuhBXCg0.mjs → manifest-python-deps-CVeckyXx.mjs} +390 -8
  59. package/dist/{manifest-python-deps-B_mCU6gz.js → manifest-python-deps-CktMcXzS.js} +443 -7
  60. package/dist/{retired-settings-keys-BtvClSPu.mjs → retired-settings-keys-Dm1z4mO4.mjs} +1 -1
  61. package/dist/{retired-settings-keys-OtUQtEbq.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 = 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 = 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: 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: 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: 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 = z.object({
3696
+ channel: z.string().min(1),
3697
+ /** Epoch ms the window closes at. */
3698
+ armedUntilMs: z.number(),
3699
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
3700
+ deviceIds: z.array(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 = z.object({
8134
8239
  whereBetween: z.record(z.string(), z.tuple([z.unknown(), z.unknown()])).optional(),
8135
8240
  whereNot: z.record(z.string(), 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 = z.object({
8250
+ /** Result key. */
8251
+ as: z.string().min(1),
8252
+ /** Column to aggregate. Must be a real column of a declared collection. */
8253
+ field: z.string().min(1),
8254
+ op: 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 = z.object({
8268
+ count: z.number().int(),
8269
+ values: z.record(z.string(), z.number().nullable())
8270
+ });
8137
8271
  /** A single stored record: `{ id, data }`. */
8138
8272
  var SettingsRecordSchema = z.object({
8139
8273
  id: z.string(),
@@ -8301,6 +8435,32 @@ var settingsStoreCapability = {
8301
8435
  collection: z.string(),
8302
8436
  filter: QueryFilterSchema.optional()
8303
8437
  }), 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(z.object({
8459
+ namespace: z.string().optional(),
8460
+ collection: z.string(),
8461
+ fields: z.array(AggregateFieldSchema).readonly(),
8462
+ filter: QueryFilterSchema.optional()
8463
+ }), AggregateResultSchema),
8304
8464
  /** Grouped counts per ((field-origin)/bucketSize) bucket, filtered. */
8305
8465
  histogram: method(z.object({
8306
8466
  namespace: z.string().optional(),
@@ -8507,6 +8667,15 @@ var dataStoreProviderCapability = {
8507
8667
  collection: z.string(),
8508
8668
  filter: QueryFilterSchema.optional()
8509
8669
  }), 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(z.object({
8674
+ namespace: z.string().optional(),
8675
+ collection: z.string(),
8676
+ fields: 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(z.object({
8512
8681
  namespace: 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(z.object({ parentDeviceId: z.number() }), 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(z.object({ parentDeviceIds: z.array(z.number()).max(256) }), z.record(z.string(), 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 = z.object({
11237
+ /** How many declared channels are armed in this process after the call. */
11238
+ armed: 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: z.array(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(z.void(), 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(z.object({ windows: 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 = z.enum([
11011
11269
  "debug",
11012
11270
  "info",
@@ -29729,10 +29987,11 @@ var DiagnosticIdSchema = z.enum(["request-census"]);
29729
29987
  * The layers of the level hierarchy, general → specific. The most specific
29730
29988
  * layer that carries an explicit value wins.
29731
29989
  *
29732
- * `component` is DECLARED and not yet resolvable: the per-component channels
29733
- * are a later slice of the same plan, and a `levelSource` enum that has to
29734
- * grow later would force every consumer of this document to change with it.
29735
- * 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.
29736
29995
  */
29737
29996
  var LoggingScopeKindSchema = z.enum([
29738
29997
  "cluster",
@@ -29759,6 +30018,14 @@ var LoggingLevelLayerSchema = z.object({
29759
30018
  scope: LoggingScopeKindSchema,
29760
30019
  /** The node this layer speaks for; `null` on the cluster layer. */
29761
30020
  nodeId: 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: z.string().nullable(),
29762
30029
  /** Explicitly set here, or `null` when this layer inherits. */
29763
30030
  level: LogLevelSchema$1.nullable()
29764
30031
  });
@@ -29800,6 +30067,49 @@ var DiagnosticWindowPatchSchema = z.object({
29800
30067
  reportEveryMs: z.number().int().positive().optional()
29801
30068
  });
29802
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 = z.object({
30077
+ channel: z.string(),
30078
+ armed: z.boolean(),
30079
+ /** Epoch ms the window closes at. 0 when disarmed. */
30080
+ armedUntilMs: z.number(),
30081
+ /** Ms left before it expires on its own. 0 when disarmed. */
30082
+ remainingMs: 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: z.array(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 = z.object({
30100
+ channel: z.string().min(1),
30101
+ armMs: 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: z.array(z.number().int()).readonly().nullable().optional()
30111
+ });
30112
+ /**
29803
30113
  * A PATCH, and patches MERGE.
29804
30114
  *
29805
30115
  * A field absent from the patch is left exactly as it was — arming a
@@ -29818,7 +30128,14 @@ var LoggingSettingsPatchSchema = z.object({
29818
30128
  * Only the diagnostics NAMED here change. An armed window that is not listed
29819
30129
  * keeps running — a patch is never a full replacement.
29820
30130
  */
29821
- diagnostics: z.array(DiagnosticWindowPatchSchema).readonly().optional()
30131
+ diagnostics: 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: z.array(LogChannelWindowPatchSchema).readonly().optional()
29822
30139
  });
29823
30140
  /**
29824
30141
  * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
@@ -29831,9 +30148,22 @@ var LoggingSettingsPatchSchema = z.object({
29831
30148
  * authority over the whole hierarchy and answers for every layer, so the
29832
30149
  * layer selector needs a name the transport does not already own.
29833
30150
  */
29834
- var GetLoggingSettingsInputSchema = z.object({ scopeNodeId: z.string().optional() });
30151
+ var GetLoggingSettingsInputSchema = z.object({
30152
+ scopeNodeId: 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: z.string().optional()
30163
+ });
29835
30164
  var SetLoggingSettingsInputSchema = z.object({
29836
30165
  scopeNodeId: z.string().optional(),
30166
+ scopeComponent: z.string().optional(),
29837
30167
  patch: LoggingSettingsPatchSchema
29838
30168
  });
29839
30169
  /**
@@ -29848,9 +30178,20 @@ var SetLoggingSettingsInputSchema = z.object({
29848
30178
  var LoggingSettingsStateSchema = z.object({
29849
30179
  /** The layer this document was read at. `null` = the cluster layer. */
29850
30180
  scopeNodeId: z.string().nullable(),
30181
+ /** The channel this document was read at. `null` = no component layer. */
30182
+ scopeComponent: z.string().nullable(),
29851
30183
  effective: LoggingEffectiveSchema,
29852
30184
  explicit: LoggingExplicitSchema,
29853
30185
  activeWindows: 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: z.array(LogChannelDescriptorSchema).readonly(),
30193
+ /** The channels ARMED right now, each with its deadline. */
30194
+ activeChannels: z.array(LogChannelWindowStateSchema).readonly(),
29854
30195
  persisted: z.boolean()
29855
30196
  });
29856
30197
  var systemCapability = {
@@ -31709,6 +32050,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
31709
32050
  llmRuntimeCapability,
31710
32051
  localNetworkCapability,
31711
32052
  lockControlCapability,
32053
+ logChannelsCapability,
31712
32054
  logDestinationCapability,
31713
32055
  loginMethodCapability,
31714
32056
  mediaPlayerCapability,
@@ -32675,6 +33017,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32675
33017
  addonId: null,
32676
33018
  access: "view"
32677
33019
  },
33020
+ "dataStoreProvider.aggregate": {
33021
+ capName: "data-store-provider",
33022
+ capScope: "system",
33023
+ addonId: null,
33024
+ access: "view"
33025
+ },
32678
33026
  "dataStoreProvider.count": {
32679
33027
  capName: "data-store-provider",
32680
33028
  capScope: "system",
@@ -33089,6 +33437,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33089
33437
  addonId: null,
33090
33438
  access: "view"
33091
33439
  },
33440
+ "deviceManager.getChildrenBatch": {
33441
+ capName: "device-manager",
33442
+ capScope: "system",
33443
+ addonId: null,
33444
+ access: "view"
33445
+ },
33092
33446
  "deviceManager.getConfigSchema": {
33093
33447
  capName: "device-manager",
33094
33448
  capScope: "system",
@@ -34139,6 +34493,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
34139
34493
  addonId: null,
34140
34494
  access: "create"
34141
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
+ },
34142
34508
  "logDestination.query": {
34143
34509
  capName: "log-destination",
34144
34510
  capScope: "system",
@@ -36293,6 +36659,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
36293
36659
  addonId: null,
36294
36660
  access: "create"
36295
36661
  },
36662
+ "settingsStore.aggregate": {
36663
+ capName: "settings-store",
36664
+ capScope: "system",
36665
+ addonId: null,
36666
+ access: "view"
36667
+ },
36296
36668
  "settingsStore.count": {
36297
36669
  capName: "settings-store",
36298
36670
  capScope: "system",
@@ -37872,6 +38244,11 @@ Object.freeze({
37872
38244
  form: "single",
37873
38245
  optional: false
37874
38246
  }],
38247
+ "deviceManager.getChildrenBatch": [{
38248
+ name: "parentDeviceIds",
38249
+ form: "array",
38250
+ optional: false
38251
+ }],
37875
38252
  "deviceManager.getConfigSchema": [{
37876
38253
  name: "deviceId",
37877
38254
  form: "single",
package/dist/index.d.ts CHANGED
@@ -46,8 +46,8 @@ export { createFileDataPlaneHandler } from './http/file-data-plane.js';
46
46
  export { allFamiliesListenHost, applyLanHttp, bindPendingLanHttp, closeLanHttp, DEFAULT_LAN_HTTP_PORT, readLanHttpState, registerLanHttpHandler, } from './http/lan-http-bind.js';
47
47
  export type { ReverseProxyOptions } from './http/reverse-proxy.js';
48
48
  export { proxyToUpstream } from './http/reverse-proxy.js';
49
- export type { HeapReclaimer, HeapReclaimOptions, HeapSample, HeapWatchSink, RunnerHeapWatchOptions, } from './kernel/heap-watch.js';
50
- export { buildHeapSample, createV8Reclaimer, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, } from './kernel/heap-watch.js';
49
+ export type { HeapReclaimer, HeapReclaimOptions, HeapSample, HeapWatchSink, RssBreakdown, RssBudgetOptions, RssBudgetState, RssGrowthShape, RunnerHeapWatchOptions, } from './kernel/heap-watch.js';
50
+ export { buildHeapSample, createV8Reclaimer, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, hubMainRssBudget, describeRss, nextRssBudgetState, parseRssBudgetMb, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, } from './kernel/heap-watch.js';
51
51
  export type { AddonDataPlaneFacility, DataPlaneSink, } from './kernel/moleculer/addon-data-plane-facility.js';
52
52
  export { createAddonDataPlaneFacility } from './kernel/moleculer/addon-data-plane-facility.js';
53
53
  export type { ElementState, ElementStatus, } from './lifecycle/lifecycle-state-machine.js';