@camstack/addon-provider-unifi 0.2.35 → 0.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +255 -25
  2. package/dist/addon.mjs +255 -25
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region ../types/dist/event-category-CIa_iT6b.mjs
2
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -436,7 +436,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
436
436
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
437
437
  /**
438
438
  * Periodic per-node process-tree snapshot (camstack-related pids
439
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
439
+ * with root / managed / system classification). Emitted ~0.2 Hz by
440
440
  * the metrics-provider addon. Drives the Cluster → Processes tab
441
441
  * without polling `metricsProvider.listNodeProcesses`.
442
442
  */
@@ -11228,6 +11228,19 @@ var SettingsRecordSchema = object({
11228
11228
  data: record(string(), unknown())
11229
11229
  });
11230
11230
  /**
11231
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11232
+ * optional.
11233
+ *
11234
+ * A separate schema rather than loosening the shared one: every other method
11235
+ * on this cap addresses a row BY its id, and making that field optional
11236
+ * everywhere would turn a forgotten key into a silently generated one on
11237
+ * `update` and `delete` as well.
11238
+ */
11239
+ var BulkRecordSchema = object({
11240
+ id: string().optional(),
11241
+ data: record(string(), unknown())
11242
+ });
11243
+ /**
11231
11244
  * Column declaration for a structured (SQL-backed) collection.
11232
11245
  *
11233
11246
  * Logical types — the backend translates each to the matching SQLite
@@ -11284,6 +11297,10 @@ method(object({
11284
11297
  collection: string(),
11285
11298
  record: SettingsRecordSchema
11286
11299
  }), _void(), { kind: "mutation" }), method(object({
11300
+ namespace: string().optional(),
11301
+ collection: string(),
11302
+ records: array(BulkRecordSchema).readonly()
11303
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11287
11304
  namespace: string().optional(),
11288
11305
  collection: string(),
11289
11306
  id: string(),
@@ -11392,6 +11409,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11392
11409
  }), _void(), {
11393
11410
  kind: "mutation",
11394
11411
  auth: "admin"
11412
+ }), method(object({
11413
+ namespace: string().optional(),
11414
+ collection: string(),
11415
+ records: array(BulkRecordSchema).readonly()
11416
+ }), object({ inserted: number().int() }), {
11417
+ kind: "mutation",
11418
+ auth: "admin"
11395
11419
  }), method(object({
11396
11420
  namespace: string().optional(),
11397
11421
  collection: string(),
@@ -13322,6 +13346,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13322
13346
  limit: number().optional(),
13323
13347
  tags: record(string(), string()).optional()
13324
13348
  }), array(LogEntrySchema).readonly());
13349
+ var LoadContributionSchema = object({
13350
+ role: _enum([
13351
+ "decode",
13352
+ "transcode",
13353
+ "recording",
13354
+ "streaming",
13355
+ "detection"
13356
+ ]),
13357
+ /**
13358
+ * The NUMERIC device id — the same value every log line carries as
13359
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13360
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13361
+ * contributor that cannot name its camera must not emit the entry at all,
13362
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13363
+ * and would quietly turn one camera's cost into everybody's.
13364
+ */
13365
+ deviceId: number().int().positive().nullable(),
13366
+ attribution: _enum([
13367
+ "measured",
13368
+ "accounted",
13369
+ "unattributable"
13370
+ ]),
13371
+ /**
13372
+ * What ONE entry is, in the contributor's own words — `615/high`,
13373
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13374
+ * family and inventing a common one would lose the only information that
13375
+ * makes two entries for the same camera distinguishable.
13376
+ */
13377
+ unit: string(),
13378
+ /**
13379
+ * The OS process this cost lives in, when there is one. Present so a
13380
+ * consumer can (a) tell two generations of the same unit apart across a
13381
+ * restart, and (b) subtract claimed processes from the node's process
13382
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13383
+ * process of its own.
13384
+ */
13385
+ pid: number().int().positive().optional(),
13386
+ /**
13387
+ * When this generation started. The pid's incarnation marker: a consumer
13388
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13389
+ * window when this changes, because the counter restarted from zero in a new
13390
+ * process.
13391
+ */
13392
+ startedAtMs: number().optional(),
13393
+ /**
13394
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13395
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13396
+ * contribution is asked for.
13397
+ *
13398
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13399
+ * needs a sampler, and a new per-node sampler is the defect half of
13400
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13401
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13402
+ *
13403
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13404
+ * an entry with no process.
13405
+ */
13406
+ cpuSeconds: number().optional(),
13407
+ /** Resident bytes of this unit's process, same source and same rules. */
13408
+ rssBytes: number().optional()
13409
+ });
13410
+ method(_void(), array(LoadContributionSchema).readonly());
13325
13411
  /**
13326
13412
  * `login-method` — collection cap through which auth addons contribute
13327
13413
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13525,8 +13611,7 @@ var NodeProcessSchema = object({
13525
13611
  classification: _enum([
13526
13612
  "root",
13527
13613
  "managed",
13528
- "system",
13529
- "ghost"
13614
+ "system"
13530
13615
  ]),
13531
13616
  /** `$process` addon binding when `managed`, else null. */
13532
13617
  addonId: string().nullable(),
@@ -13534,22 +13619,39 @@ var NodeProcessSchema = object({
13534
13619
  nodeId: string().nullable(),
13535
13620
  /** Truncated command line. */
13536
13621
  command: string(),
13622
+ /**
13623
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13624
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13625
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13626
+ */
13537
13627
  cpuPercent: number(),
13538
13628
  memoryRssBytes: number(),
13629
+ /**
13630
+ * Instantaneous CPU% of the process's own threads over the last
13631
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13632
+ *
13633
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13634
+ * boot), the pid was recycled, or this node is not Linux.
13635
+ */
13636
+ cpuMainPercent: number().nullable(),
13637
+ /**
13638
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13639
+ *
13640
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13641
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13642
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13643
+ * "allocating too much".
13644
+ *
13645
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13646
+ * (background compilation runs there too), so it is reported as
13647
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13648
+ * meaning as on `cpuMainPercent`.
13649
+ */
13650
+ cpuGcPercent: number().nullable(),
13651
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13652
+ threadCount: number().nullable(),
13539
13653
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13540
- uptimeSec: number(),
13541
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13542
- orphaned: boolean()
13543
- });
13544
- var KillProcessInputSchema = object({
13545
- pid: number(),
13546
- /** Force = SIGKILL. Default is SIGTERM. */
13547
- force: boolean().optional()
13548
- });
13549
- var KillProcessResultSchema = object({
13550
- success: boolean(),
13551
- reason: string().optional(),
13552
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13654
+ uptimeSec: number()
13553
13655
  });
13554
13656
  var DumpHeapSnapshotInputSchema = object({
13555
13657
  /** The addon whose runner should dump a heap snapshot. */
@@ -13562,6 +13664,104 @@ var DumpHeapSnapshotResultSchema = object({
13562
13664
  pid: number().optional(),
13563
13665
  reason: string().optional()
13564
13666
  });
13667
+ /**
13668
+ * One point of one function's series.
13669
+ *
13670
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13671
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13672
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13673
+ * Either would give us a tool built to find peaks that does not show peaks.
13674
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13675
+ * into the bucket, and a mean stays derivable where it is wanted.
13676
+ *
13677
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13678
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13679
+ * caller cannot tell which it received — which is what "one reader" means.
13680
+ */
13681
+ var LoadPointSchema = object({
13682
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13683
+ atMs: number(),
13684
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13685
+ samples: number().int(),
13686
+ /**
13687
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13688
+ * of every snapshot in it reported a thread split. A partial sum is a
13689
+ * smaller number that looks exactly as real as a complete one.
13690
+ */
13691
+ cpuMainPercent: number().nullable(),
13692
+ cpuMainPercentMin: number().nullable(),
13693
+ cpuGcPercent: number().nullable(),
13694
+ cpuGcPercentMin: number().nullable(),
13695
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13696
+ cpuLifetimePercent: number(),
13697
+ cpuLifetimePercentMin: number(),
13698
+ memoryRssBytes: number(),
13699
+ memoryRssBytesMin: number(),
13700
+ processCount: number().int(),
13701
+ processCountMin: number().int()
13702
+ });
13703
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13704
+ var LoadFunctionSeriesSchema = object({
13705
+ key: string(),
13706
+ kind: _enum([
13707
+ "addon",
13708
+ "root",
13709
+ "unattributed"
13710
+ ]),
13711
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13712
+ points: array(LoadPointSchema).readonly()
13713
+ });
13714
+ var NodeLoadSeriesSchema = object({
13715
+ nodeId: string(),
13716
+ /** One entry per function seen in the window, heaviest-first. */
13717
+ series: array(LoadFunctionSeriesSchema).readonly(),
13718
+ /**
13719
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13720
+ * reduction was needed — so a caller can always say what one point covers
13721
+ * without having to know whether it was reduced.
13722
+ */
13723
+ bucketMs: number(),
13724
+ /** Raw snapshots that went into this answer, across both tiers. */
13725
+ retainedSamples: number(),
13726
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13727
+ oldestAtMs: number().nullable(),
13728
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13729
+ cadenceMs: number(),
13730
+ /**
13731
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13732
+ * alone — an agent (which holds no table), or a store that refused.
13733
+ * Reported because "the last hour" and "the last six hours" are different
13734
+ * questions and an operator must not have to guess which was answered.
13735
+ */
13736
+ durable: boolean()
13737
+ });
13738
+ var GetLoadSeriesInputSchema = object({
13739
+ /**
13740
+ * The node whose series is wanted.
13741
+ *
13742
+ * NOT named `nodeId`: the generated cap router strips a top-level
13743
+ * `nodeId` from every method input and uses it to ROUTE the call to
13744
+ * that node's provider (`generated-cap-routers.ts`). A series target
13745
+ * called `nodeId` would silently become a routing pin and never reach
13746
+ * the provider. The hub holds every node it hears from, so the
13747
+ * ordinary call is unpinned — answered by the hub, for any node.
13748
+ */
13749
+ forNodeId: string(),
13750
+ /**
13751
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13752
+ * holds and receives only what it is missing, so seeding a live chart
13753
+ * from this method cannot double a point already drawn.
13754
+ */
13755
+ sinceMs: number().optional(),
13756
+ /**
13757
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13758
+ * preserving min and max per bucket.
13759
+ *
13760
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13761
+ * long one, which is why a chart passes its own pixel width.
13762
+ */
13763
+ maxPoints: number().int().positive().optional()
13764
+ });
13565
13765
  var SystemMetricsSchema = object({
13566
13766
  cpuPercent: number(),
13567
13767
  memoryPercent: number(),
@@ -13572,10 +13772,7 @@ var SystemMetricsSchema = object({
13572
13772
  gpuPercent: number().optional(),
13573
13773
  gpuMemoryPercent: number().optional()
13574
13774
  });
13575
- method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
13576
- kind: "mutation",
13577
- auth: "admin"
13578
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13775
+ method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(GetLoadSeriesInputSchema, NodeLoadSeriesSchema), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13579
13776
  kind: "mutation",
13580
13777
  auth: "admin"
13581
13778
  });
@@ -28922,6 +29119,15 @@ var LoggingSettingsPatchSchema = object({
28922
29119
  * authority over the whole hierarchy and answers for every layer, so the
28923
29120
  * layer selector needs a name the transport does not already own.
28924
29121
  */
29122
+ /**
29123
+ * One contribution, plus WHO reported it.
29124
+ *
29125
+ * The addon and node are added by the hub as it enumerates providers, never by
29126
+ * the contributor: an addon reporting its own identity could report somebody
29127
+ * else's, and the whole point of this surface is that no claim is made by
29128
+ * anyone but its owner.
29129
+ */
29130
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
28925
29131
  var GetLoggingSettingsInputSchema = object({
28926
29132
  scopeNodeId: string().optional(),
28927
29133
  /**
@@ -28980,7 +29186,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28980
29186
  }), method(_void(), SiteLocationStatusSchema, {
28981
29187
  kind: "mutation",
28982
29188
  auth: "admin"
28983
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29189
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28984
29190
  kind: "mutation",
28985
29191
  auth: "admin"
28986
29192
  });
@@ -32004,6 +32210,12 @@ Object.freeze({
32004
32210
  addonId: null,
32005
32211
  access: "create"
32006
32212
  },
32213
+ "dataStoreProvider.insertMany": {
32214
+ capName: "data-store-provider",
32215
+ capScope: "system",
32216
+ addonId: null,
32217
+ access: "create"
32218
+ },
32007
32219
  "dataStoreProvider.isEmpty": {
32008
32220
  capName: "data-store-provider",
32009
32221
  capScope: "system",
@@ -33318,6 +33530,12 @@ Object.freeze({
33318
33530
  addonId: null,
33319
33531
  access: "create"
33320
33532
  },
33533
+ "loadContribution.list": {
33534
+ capName: "load-contribution",
33535
+ capScope: "system",
33536
+ addonId: null,
33537
+ access: "view"
33538
+ },
33321
33539
  "localNetwork.downloadCa": {
33322
33540
  capName: "local-network",
33323
33541
  capScope: "system",
@@ -33618,17 +33836,17 @@ Object.freeze({
33618
33836
  addonId: null,
33619
33837
  access: "view"
33620
33838
  },
33621
- "metricsProvider.getProcessStats": {
33839
+ "metricsProvider.getLoadSeries": {
33622
33840
  capName: "metrics-provider",
33623
33841
  capScope: "system",
33624
33842
  addonId: null,
33625
33843
  access: "view"
33626
33844
  },
33627
- "metricsProvider.killProcess": {
33845
+ "metricsProvider.getProcessStats": {
33628
33846
  capName: "metrics-provider",
33629
33847
  capScope: "system",
33630
33848
  addonId: null,
33631
- access: "create"
33849
+ access: "view"
33632
33850
  },
33633
33851
  "metricsProvider.listAddonInstances": {
33634
33852
  capName: "metrics-provider",
@@ -35640,6 +35858,12 @@ Object.freeze({
35640
35858
  addonId: null,
35641
35859
  access: "create"
35642
35860
  },
35861
+ "settingsStore.insertMany": {
35862
+ capName: "settings-store",
35863
+ capScope: "system",
35864
+ addonId: null,
35865
+ access: "create"
35866
+ },
35643
35867
  "settingsStore.isEmpty": {
35644
35868
  capName: "settings-store",
35645
35869
  capScope: "system",
@@ -36252,6 +36476,12 @@ Object.freeze({
36252
36476
  addonId: null,
36253
36477
  access: "create"
36254
36478
  },
36479
+ "system.getLoadContributions": {
36480
+ capName: "system",
36481
+ capScope: "system",
36482
+ addonId: null,
36483
+ access: "view"
36484
+ },
36255
36485
  "system.getLoggingSettings": {
36256
36486
  capName: "system",
36257
36487
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../types/dist/event-category-CIa_iT6b.mjs
1
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
2
2
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
3
3
  EventCategory["SystemBoot"] = "system.boot";
4
4
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -435,7 +435,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
435
435
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
436
436
  /**
437
437
  * Periodic per-node process-tree snapshot (camstack-related pids
438
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
438
+ * with root / managed / system classification). Emitted ~0.2 Hz by
439
439
  * the metrics-provider addon. Drives the Cluster → Processes tab
440
440
  * without polling `metricsProvider.listNodeProcesses`.
441
441
  */
@@ -11227,6 +11227,19 @@ var SettingsRecordSchema = object({
11227
11227
  data: record(string(), unknown())
11228
11228
  });
11229
11229
  /**
11230
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11231
+ * optional.
11232
+ *
11233
+ * A separate schema rather than loosening the shared one: every other method
11234
+ * on this cap addresses a row BY its id, and making that field optional
11235
+ * everywhere would turn a forgotten key into a silently generated one on
11236
+ * `update` and `delete` as well.
11237
+ */
11238
+ var BulkRecordSchema = object({
11239
+ id: string().optional(),
11240
+ data: record(string(), unknown())
11241
+ });
11242
+ /**
11230
11243
  * Column declaration for a structured (SQL-backed) collection.
11231
11244
  *
11232
11245
  * Logical types — the backend translates each to the matching SQLite
@@ -11283,6 +11296,10 @@ method(object({
11283
11296
  collection: string(),
11284
11297
  record: SettingsRecordSchema
11285
11298
  }), _void(), { kind: "mutation" }), method(object({
11299
+ namespace: string().optional(),
11300
+ collection: string(),
11301
+ records: array(BulkRecordSchema).readonly()
11302
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11286
11303
  namespace: string().optional(),
11287
11304
  collection: string(),
11288
11305
  id: string(),
@@ -11391,6 +11408,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11391
11408
  }), _void(), {
11392
11409
  kind: "mutation",
11393
11410
  auth: "admin"
11411
+ }), method(object({
11412
+ namespace: string().optional(),
11413
+ collection: string(),
11414
+ records: array(BulkRecordSchema).readonly()
11415
+ }), object({ inserted: number().int() }), {
11416
+ kind: "mutation",
11417
+ auth: "admin"
11394
11418
  }), method(object({
11395
11419
  namespace: string().optional(),
11396
11420
  collection: string(),
@@ -13321,6 +13345,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13321
13345
  limit: number().optional(),
13322
13346
  tags: record(string(), string()).optional()
13323
13347
  }), array(LogEntrySchema).readonly());
13348
+ var LoadContributionSchema = object({
13349
+ role: _enum([
13350
+ "decode",
13351
+ "transcode",
13352
+ "recording",
13353
+ "streaming",
13354
+ "detection"
13355
+ ]),
13356
+ /**
13357
+ * The NUMERIC device id — the same value every log line carries as
13358
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13359
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13360
+ * contributor that cannot name its camera must not emit the entry at all,
13361
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13362
+ * and would quietly turn one camera's cost into everybody's.
13363
+ */
13364
+ deviceId: number().int().positive().nullable(),
13365
+ attribution: _enum([
13366
+ "measured",
13367
+ "accounted",
13368
+ "unattributable"
13369
+ ]),
13370
+ /**
13371
+ * What ONE entry is, in the contributor's own words — `615/high`,
13372
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13373
+ * family and inventing a common one would lose the only information that
13374
+ * makes two entries for the same camera distinguishable.
13375
+ */
13376
+ unit: string(),
13377
+ /**
13378
+ * The OS process this cost lives in, when there is one. Present so a
13379
+ * consumer can (a) tell two generations of the same unit apart across a
13380
+ * restart, and (b) subtract claimed processes from the node's process
13381
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13382
+ * process of its own.
13383
+ */
13384
+ pid: number().int().positive().optional(),
13385
+ /**
13386
+ * When this generation started. The pid's incarnation marker: a consumer
13387
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13388
+ * window when this changes, because the counter restarted from zero in a new
13389
+ * process.
13390
+ */
13391
+ startedAtMs: number().optional(),
13392
+ /**
13393
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13394
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13395
+ * contribution is asked for.
13396
+ *
13397
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13398
+ * needs a sampler, and a new per-node sampler is the defect half of
13399
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13400
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13401
+ *
13402
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13403
+ * an entry with no process.
13404
+ */
13405
+ cpuSeconds: number().optional(),
13406
+ /** Resident bytes of this unit's process, same source and same rules. */
13407
+ rssBytes: number().optional()
13408
+ });
13409
+ method(_void(), array(LoadContributionSchema).readonly());
13324
13410
  /**
13325
13411
  * `login-method` — collection cap through which auth addons contribute
13326
13412
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13524,8 +13610,7 @@ var NodeProcessSchema = object({
13524
13610
  classification: _enum([
13525
13611
  "root",
13526
13612
  "managed",
13527
- "system",
13528
- "ghost"
13613
+ "system"
13529
13614
  ]),
13530
13615
  /** `$process` addon binding when `managed`, else null. */
13531
13616
  addonId: string().nullable(),
@@ -13533,22 +13618,39 @@ var NodeProcessSchema = object({
13533
13618
  nodeId: string().nullable(),
13534
13619
  /** Truncated command line. */
13535
13620
  command: string(),
13621
+ /**
13622
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13623
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13624
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13625
+ */
13536
13626
  cpuPercent: number(),
13537
13627
  memoryRssBytes: number(),
13628
+ /**
13629
+ * Instantaneous CPU% of the process's own threads over the last
13630
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13631
+ *
13632
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13633
+ * boot), the pid was recycled, or this node is not Linux.
13634
+ */
13635
+ cpuMainPercent: number().nullable(),
13636
+ /**
13637
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13638
+ *
13639
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13640
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13641
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13642
+ * "allocating too much".
13643
+ *
13644
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13645
+ * (background compilation runs there too), so it is reported as
13646
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13647
+ * meaning as on `cpuMainPercent`.
13648
+ */
13649
+ cpuGcPercent: number().nullable(),
13650
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13651
+ threadCount: number().nullable(),
13538
13652
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13539
- uptimeSec: number(),
13540
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13541
- orphaned: boolean()
13542
- });
13543
- var KillProcessInputSchema = object({
13544
- pid: number(),
13545
- /** Force = SIGKILL. Default is SIGTERM. */
13546
- force: boolean().optional()
13547
- });
13548
- var KillProcessResultSchema = object({
13549
- success: boolean(),
13550
- reason: string().optional(),
13551
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13653
+ uptimeSec: number()
13552
13654
  });
13553
13655
  var DumpHeapSnapshotInputSchema = object({
13554
13656
  /** The addon whose runner should dump a heap snapshot. */
@@ -13561,6 +13663,104 @@ var DumpHeapSnapshotResultSchema = object({
13561
13663
  pid: number().optional(),
13562
13664
  reason: string().optional()
13563
13665
  });
13666
+ /**
13667
+ * One point of one function's series.
13668
+ *
13669
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13670
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13671
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13672
+ * Either would give us a tool built to find peaks that does not show peaks.
13673
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13674
+ * into the bucket, and a mean stays derivable where it is wanted.
13675
+ *
13676
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13677
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13678
+ * caller cannot tell which it received — which is what "one reader" means.
13679
+ */
13680
+ var LoadPointSchema = object({
13681
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13682
+ atMs: number(),
13683
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13684
+ samples: number().int(),
13685
+ /**
13686
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13687
+ * of every snapshot in it reported a thread split. A partial sum is a
13688
+ * smaller number that looks exactly as real as a complete one.
13689
+ */
13690
+ cpuMainPercent: number().nullable(),
13691
+ cpuMainPercentMin: number().nullable(),
13692
+ cpuGcPercent: number().nullable(),
13693
+ cpuGcPercentMin: number().nullable(),
13694
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13695
+ cpuLifetimePercent: number(),
13696
+ cpuLifetimePercentMin: number(),
13697
+ memoryRssBytes: number(),
13698
+ memoryRssBytesMin: number(),
13699
+ processCount: number().int(),
13700
+ processCountMin: number().int()
13701
+ });
13702
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13703
+ var LoadFunctionSeriesSchema = object({
13704
+ key: string(),
13705
+ kind: _enum([
13706
+ "addon",
13707
+ "root",
13708
+ "unattributed"
13709
+ ]),
13710
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13711
+ points: array(LoadPointSchema).readonly()
13712
+ });
13713
+ var NodeLoadSeriesSchema = object({
13714
+ nodeId: string(),
13715
+ /** One entry per function seen in the window, heaviest-first. */
13716
+ series: array(LoadFunctionSeriesSchema).readonly(),
13717
+ /**
13718
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13719
+ * reduction was needed — so a caller can always say what one point covers
13720
+ * without having to know whether it was reduced.
13721
+ */
13722
+ bucketMs: number(),
13723
+ /** Raw snapshots that went into this answer, across both tiers. */
13724
+ retainedSamples: number(),
13725
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13726
+ oldestAtMs: number().nullable(),
13727
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13728
+ cadenceMs: number(),
13729
+ /**
13730
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13731
+ * alone — an agent (which holds no table), or a store that refused.
13732
+ * Reported because "the last hour" and "the last six hours" are different
13733
+ * questions and an operator must not have to guess which was answered.
13734
+ */
13735
+ durable: boolean()
13736
+ });
13737
+ var GetLoadSeriesInputSchema = object({
13738
+ /**
13739
+ * The node whose series is wanted.
13740
+ *
13741
+ * NOT named `nodeId`: the generated cap router strips a top-level
13742
+ * `nodeId` from every method input and uses it to ROUTE the call to
13743
+ * that node's provider (`generated-cap-routers.ts`). A series target
13744
+ * called `nodeId` would silently become a routing pin and never reach
13745
+ * the provider. The hub holds every node it hears from, so the
13746
+ * ordinary call is unpinned — answered by the hub, for any node.
13747
+ */
13748
+ forNodeId: string(),
13749
+ /**
13750
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13751
+ * holds and receives only what it is missing, so seeding a live chart
13752
+ * from this method cannot double a point already drawn.
13753
+ */
13754
+ sinceMs: number().optional(),
13755
+ /**
13756
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13757
+ * preserving min and max per bucket.
13758
+ *
13759
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13760
+ * long one, which is why a chart passes its own pixel width.
13761
+ */
13762
+ maxPoints: number().int().positive().optional()
13763
+ });
13564
13764
  var SystemMetricsSchema = object({
13565
13765
  cpuPercent: number(),
13566
13766
  memoryPercent: number(),
@@ -13571,10 +13771,7 @@ var SystemMetricsSchema = object({
13571
13771
  gpuPercent: number().optional(),
13572
13772
  gpuMemoryPercent: number().optional()
13573
13773
  });
13574
- method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
13575
- kind: "mutation",
13576
- auth: "admin"
13577
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13774
+ method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(GetLoadSeriesInputSchema, NodeLoadSeriesSchema), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13578
13775
  kind: "mutation",
13579
13776
  auth: "admin"
13580
13777
  });
@@ -28921,6 +29118,15 @@ var LoggingSettingsPatchSchema = object({
28921
29118
  * authority over the whole hierarchy and answers for every layer, so the
28922
29119
  * layer selector needs a name the transport does not already own.
28923
29120
  */
29121
+ /**
29122
+ * One contribution, plus WHO reported it.
29123
+ *
29124
+ * The addon and node are added by the hub as it enumerates providers, never by
29125
+ * the contributor: an addon reporting its own identity could report somebody
29126
+ * else's, and the whole point of this surface is that no claim is made by
29127
+ * anyone but its owner.
29128
+ */
29129
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
28924
29130
  var GetLoggingSettingsInputSchema = object({
28925
29131
  scopeNodeId: string().optional(),
28926
29132
  /**
@@ -28979,7 +29185,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28979
29185
  }), method(_void(), SiteLocationStatusSchema, {
28980
29186
  kind: "mutation",
28981
29187
  auth: "admin"
28982
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29188
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28983
29189
  kind: "mutation",
28984
29190
  auth: "admin"
28985
29191
  });
@@ -32003,6 +32209,12 @@ Object.freeze({
32003
32209
  addonId: null,
32004
32210
  access: "create"
32005
32211
  },
32212
+ "dataStoreProvider.insertMany": {
32213
+ capName: "data-store-provider",
32214
+ capScope: "system",
32215
+ addonId: null,
32216
+ access: "create"
32217
+ },
32006
32218
  "dataStoreProvider.isEmpty": {
32007
32219
  capName: "data-store-provider",
32008
32220
  capScope: "system",
@@ -33317,6 +33529,12 @@ Object.freeze({
33317
33529
  addonId: null,
33318
33530
  access: "create"
33319
33531
  },
33532
+ "loadContribution.list": {
33533
+ capName: "load-contribution",
33534
+ capScope: "system",
33535
+ addonId: null,
33536
+ access: "view"
33537
+ },
33320
33538
  "localNetwork.downloadCa": {
33321
33539
  capName: "local-network",
33322
33540
  capScope: "system",
@@ -33617,17 +33835,17 @@ Object.freeze({
33617
33835
  addonId: null,
33618
33836
  access: "view"
33619
33837
  },
33620
- "metricsProvider.getProcessStats": {
33838
+ "metricsProvider.getLoadSeries": {
33621
33839
  capName: "metrics-provider",
33622
33840
  capScope: "system",
33623
33841
  addonId: null,
33624
33842
  access: "view"
33625
33843
  },
33626
- "metricsProvider.killProcess": {
33844
+ "metricsProvider.getProcessStats": {
33627
33845
  capName: "metrics-provider",
33628
33846
  capScope: "system",
33629
33847
  addonId: null,
33630
- access: "create"
33848
+ access: "view"
33631
33849
  },
33632
33850
  "metricsProvider.listAddonInstances": {
33633
33851
  capName: "metrics-provider",
@@ -35639,6 +35857,12 @@ Object.freeze({
35639
35857
  addonId: null,
35640
35858
  access: "create"
35641
35859
  },
35860
+ "settingsStore.insertMany": {
35861
+ capName: "settings-store",
35862
+ capScope: "system",
35863
+ addonId: null,
35864
+ access: "create"
35865
+ },
35642
35866
  "settingsStore.isEmpty": {
35643
35867
  capName: "settings-store",
35644
35868
  capScope: "system",
@@ -36251,6 +36475,12 @@ Object.freeze({
36251
36475
  addonId: null,
36252
36476
  access: "create"
36253
36477
  },
36478
+ "system.getLoadContributions": {
36479
+ capName: "system",
36480
+ capScope: "system",
36481
+ addonId: null,
36482
+ access: "view"
36483
+ },
36254
36484
  "system.getLoggingSettings": {
36255
36485
  capName: "system",
36256
36486
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-unifi",
3
- "version": "0.2.35",
3
+ "version": "0.2.36",
4
4
  "description": "UniFi Network controller device-provider addon for CamStack — local-controller infra switches/APs (as containers) + network-client presence. NO cameras/Protect.",
5
5
  "keywords": [
6
6
  "camstack",