@camstack/addon-provider-dreo 0.2.34 → 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
@@ -35,7 +35,7 @@ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["modu
35
35
  //#endregion
36
36
  let crypto$1 = require("crypto");
37
37
  let events = require("events");
38
- //#region ../types/dist/event-category-CIa_iT6b.mjs
38
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
39
39
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
40
  EventCategory["SystemBoot"] = "system.boot";
41
41
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -472,7 +472,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
472
472
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
473
473
  /**
474
474
  * Periodic per-node process-tree snapshot (camstack-related pids
475
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
475
+ * with root / managed / system classification). Emitted ~0.2 Hz by
476
476
  * the metrics-provider addon. Drives the Cluster → Processes tab
477
477
  * without polling `metricsProvider.listNodeProcesses`.
478
478
  */
@@ -11264,6 +11264,19 @@ var SettingsRecordSchema = object({
11264
11264
  data: record(string(), unknown())
11265
11265
  });
11266
11266
  /**
11267
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11268
+ * optional.
11269
+ *
11270
+ * A separate schema rather than loosening the shared one: every other method
11271
+ * on this cap addresses a row BY its id, and making that field optional
11272
+ * everywhere would turn a forgotten key into a silently generated one on
11273
+ * `update` and `delete` as well.
11274
+ */
11275
+ var BulkRecordSchema = object({
11276
+ id: string().optional(),
11277
+ data: record(string(), unknown())
11278
+ });
11279
+ /**
11267
11280
  * Column declaration for a structured (SQL-backed) collection.
11268
11281
  *
11269
11282
  * Logical types — the backend translates each to the matching SQLite
@@ -11320,6 +11333,10 @@ method(object({
11320
11333
  collection: string(),
11321
11334
  record: SettingsRecordSchema
11322
11335
  }), _void(), { kind: "mutation" }), method(object({
11336
+ namespace: string().optional(),
11337
+ collection: string(),
11338
+ records: array(BulkRecordSchema).readonly()
11339
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11323
11340
  namespace: string().optional(),
11324
11341
  collection: string(),
11325
11342
  id: string(),
@@ -11428,6 +11445,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11428
11445
  }), _void(), {
11429
11446
  kind: "mutation",
11430
11447
  auth: "admin"
11448
+ }), method(object({
11449
+ namespace: string().optional(),
11450
+ collection: string(),
11451
+ records: array(BulkRecordSchema).readonly()
11452
+ }), object({ inserted: number().int() }), {
11453
+ kind: "mutation",
11454
+ auth: "admin"
11431
11455
  }), method(object({
11432
11456
  namespace: string().optional(),
11433
11457
  collection: string(),
@@ -13375,6 +13399,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13375
13399
  limit: number().optional(),
13376
13400
  tags: record(string(), string()).optional()
13377
13401
  }), array(LogEntrySchema).readonly());
13402
+ var LoadContributionSchema = object({
13403
+ role: _enum([
13404
+ "decode",
13405
+ "transcode",
13406
+ "recording",
13407
+ "streaming",
13408
+ "detection"
13409
+ ]),
13410
+ /**
13411
+ * The NUMERIC device id — the same value every log line carries as
13412
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13413
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13414
+ * contributor that cannot name its camera must not emit the entry at all,
13415
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13416
+ * and would quietly turn one camera's cost into everybody's.
13417
+ */
13418
+ deviceId: number().int().positive().nullable(),
13419
+ attribution: _enum([
13420
+ "measured",
13421
+ "accounted",
13422
+ "unattributable"
13423
+ ]),
13424
+ /**
13425
+ * What ONE entry is, in the contributor's own words — `615/high`,
13426
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13427
+ * family and inventing a common one would lose the only information that
13428
+ * makes two entries for the same camera distinguishable.
13429
+ */
13430
+ unit: string(),
13431
+ /**
13432
+ * The OS process this cost lives in, when there is one. Present so a
13433
+ * consumer can (a) tell two generations of the same unit apart across a
13434
+ * restart, and (b) subtract claimed processes from the node's process
13435
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13436
+ * process of its own.
13437
+ */
13438
+ pid: number().int().positive().optional(),
13439
+ /**
13440
+ * When this generation started. The pid's incarnation marker: a consumer
13441
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13442
+ * window when this changes, because the counter restarted from zero in a new
13443
+ * process.
13444
+ */
13445
+ startedAtMs: number().optional(),
13446
+ /**
13447
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13448
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13449
+ * contribution is asked for.
13450
+ *
13451
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13452
+ * needs a sampler, and a new per-node sampler is the defect half of
13453
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13454
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13455
+ *
13456
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13457
+ * an entry with no process.
13458
+ */
13459
+ cpuSeconds: number().optional(),
13460
+ /** Resident bytes of this unit's process, same source and same rules. */
13461
+ rssBytes: number().optional()
13462
+ });
13463
+ method(_void(), array(LoadContributionSchema).readonly());
13378
13464
  /**
13379
13465
  * `login-method` — collection cap through which auth addons contribute
13380
13466
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13578,8 +13664,7 @@ var NodeProcessSchema = object({
13578
13664
  classification: _enum([
13579
13665
  "root",
13580
13666
  "managed",
13581
- "system",
13582
- "ghost"
13667
+ "system"
13583
13668
  ]),
13584
13669
  /** `$process` addon binding when `managed`, else null. */
13585
13670
  addonId: string().nullable(),
@@ -13587,22 +13672,39 @@ var NodeProcessSchema = object({
13587
13672
  nodeId: string().nullable(),
13588
13673
  /** Truncated command line. */
13589
13674
  command: string(),
13675
+ /**
13676
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13677
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13678
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13679
+ */
13590
13680
  cpuPercent: number(),
13591
13681
  memoryRssBytes: number(),
13682
+ /**
13683
+ * Instantaneous CPU% of the process's own threads over the last
13684
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13685
+ *
13686
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13687
+ * boot), the pid was recycled, or this node is not Linux.
13688
+ */
13689
+ cpuMainPercent: number().nullable(),
13690
+ /**
13691
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13692
+ *
13693
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13694
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13695
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13696
+ * "allocating too much".
13697
+ *
13698
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13699
+ * (background compilation runs there too), so it is reported as
13700
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13701
+ * meaning as on `cpuMainPercent`.
13702
+ */
13703
+ cpuGcPercent: number().nullable(),
13704
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13705
+ threadCount: number().nullable(),
13592
13706
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13593
- uptimeSec: number(),
13594
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13595
- orphaned: boolean()
13596
- });
13597
- var KillProcessInputSchema = object({
13598
- pid: number(),
13599
- /** Force = SIGKILL. Default is SIGTERM. */
13600
- force: boolean().optional()
13601
- });
13602
- var KillProcessResultSchema = object({
13603
- success: boolean(),
13604
- reason: string().optional(),
13605
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13707
+ uptimeSec: number()
13606
13708
  });
13607
13709
  var DumpHeapSnapshotInputSchema = object({
13608
13710
  /** The addon whose runner should dump a heap snapshot. */
@@ -13615,6 +13717,104 @@ var DumpHeapSnapshotResultSchema = object({
13615
13717
  pid: number().optional(),
13616
13718
  reason: string().optional()
13617
13719
  });
13720
+ /**
13721
+ * One point of one function's series.
13722
+ *
13723
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13724
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13725
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13726
+ * Either would give us a tool built to find peaks that does not show peaks.
13727
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13728
+ * into the bucket, and a mean stays derivable where it is wanted.
13729
+ *
13730
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13731
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13732
+ * caller cannot tell which it received — which is what "one reader" means.
13733
+ */
13734
+ var LoadPointSchema = object({
13735
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13736
+ atMs: number(),
13737
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13738
+ samples: number().int(),
13739
+ /**
13740
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13741
+ * of every snapshot in it reported a thread split. A partial sum is a
13742
+ * smaller number that looks exactly as real as a complete one.
13743
+ */
13744
+ cpuMainPercent: number().nullable(),
13745
+ cpuMainPercentMin: number().nullable(),
13746
+ cpuGcPercent: number().nullable(),
13747
+ cpuGcPercentMin: number().nullable(),
13748
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13749
+ cpuLifetimePercent: number(),
13750
+ cpuLifetimePercentMin: number(),
13751
+ memoryRssBytes: number(),
13752
+ memoryRssBytesMin: number(),
13753
+ processCount: number().int(),
13754
+ processCountMin: number().int()
13755
+ });
13756
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13757
+ var LoadFunctionSeriesSchema = object({
13758
+ key: string(),
13759
+ kind: _enum([
13760
+ "addon",
13761
+ "root",
13762
+ "unattributed"
13763
+ ]),
13764
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13765
+ points: array(LoadPointSchema).readonly()
13766
+ });
13767
+ var NodeLoadSeriesSchema = object({
13768
+ nodeId: string(),
13769
+ /** One entry per function seen in the window, heaviest-first. */
13770
+ series: array(LoadFunctionSeriesSchema).readonly(),
13771
+ /**
13772
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13773
+ * reduction was needed — so a caller can always say what one point covers
13774
+ * without having to know whether it was reduced.
13775
+ */
13776
+ bucketMs: number(),
13777
+ /** Raw snapshots that went into this answer, across both tiers. */
13778
+ retainedSamples: number(),
13779
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13780
+ oldestAtMs: number().nullable(),
13781
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13782
+ cadenceMs: number(),
13783
+ /**
13784
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13785
+ * alone — an agent (which holds no table), or a store that refused.
13786
+ * Reported because "the last hour" and "the last six hours" are different
13787
+ * questions and an operator must not have to guess which was answered.
13788
+ */
13789
+ durable: boolean()
13790
+ });
13791
+ var GetLoadSeriesInputSchema = object({
13792
+ /**
13793
+ * The node whose series is wanted.
13794
+ *
13795
+ * NOT named `nodeId`: the generated cap router strips a top-level
13796
+ * `nodeId` from every method input and uses it to ROUTE the call to
13797
+ * that node's provider (`generated-cap-routers.ts`). A series target
13798
+ * called `nodeId` would silently become a routing pin and never reach
13799
+ * the provider. The hub holds every node it hears from, so the
13800
+ * ordinary call is unpinned — answered by the hub, for any node.
13801
+ */
13802
+ forNodeId: string(),
13803
+ /**
13804
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13805
+ * holds and receives only what it is missing, so seeding a live chart
13806
+ * from this method cannot double a point already drawn.
13807
+ */
13808
+ sinceMs: number().optional(),
13809
+ /**
13810
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13811
+ * preserving min and max per bucket.
13812
+ *
13813
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13814
+ * long one, which is why a chart passes its own pixel width.
13815
+ */
13816
+ maxPoints: number().int().positive().optional()
13817
+ });
13618
13818
  var SystemMetricsSchema = object({
13619
13819
  cpuPercent: number(),
13620
13820
  memoryPercent: number(),
@@ -13625,10 +13825,7 @@ var SystemMetricsSchema = object({
13625
13825
  gpuPercent: number().optional(),
13626
13826
  gpuMemoryPercent: number().optional()
13627
13827
  });
13628
- 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, {
13629
- kind: "mutation",
13630
- auth: "admin"
13631
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13828
+ 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, {
13632
13829
  kind: "mutation",
13633
13830
  auth: "admin"
13634
13831
  });
@@ -28966,6 +29163,15 @@ var LoggingSettingsPatchSchema = object({
28966
29163
  * authority over the whole hierarchy and answers for every layer, so the
28967
29164
  * layer selector needs a name the transport does not already own.
28968
29165
  */
29166
+ /**
29167
+ * One contribution, plus WHO reported it.
29168
+ *
29169
+ * The addon and node are added by the hub as it enumerates providers, never by
29170
+ * the contributor: an addon reporting its own identity could report somebody
29171
+ * else's, and the whole point of this surface is that no claim is made by
29172
+ * anyone but its owner.
29173
+ */
29174
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
28969
29175
  var GetLoggingSettingsInputSchema = object({
28970
29176
  scopeNodeId: string().optional(),
28971
29177
  /**
@@ -29024,7 +29230,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29024
29230
  }), method(_void(), SiteLocationStatusSchema, {
29025
29231
  kind: "mutation",
29026
29232
  auth: "admin"
29027
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29233
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29028
29234
  kind: "mutation",
29029
29235
  auth: "admin"
29030
29236
  });
@@ -32048,6 +32254,12 @@ Object.freeze({
32048
32254
  addonId: null,
32049
32255
  access: "create"
32050
32256
  },
32257
+ "dataStoreProvider.insertMany": {
32258
+ capName: "data-store-provider",
32259
+ capScope: "system",
32260
+ addonId: null,
32261
+ access: "create"
32262
+ },
32051
32263
  "dataStoreProvider.isEmpty": {
32052
32264
  capName: "data-store-provider",
32053
32265
  capScope: "system",
@@ -33362,6 +33574,12 @@ Object.freeze({
33362
33574
  addonId: null,
33363
33575
  access: "create"
33364
33576
  },
33577
+ "loadContribution.list": {
33578
+ capName: "load-contribution",
33579
+ capScope: "system",
33580
+ addonId: null,
33581
+ access: "view"
33582
+ },
33365
33583
  "localNetwork.downloadCa": {
33366
33584
  capName: "local-network",
33367
33585
  capScope: "system",
@@ -33662,17 +33880,17 @@ Object.freeze({
33662
33880
  addonId: null,
33663
33881
  access: "view"
33664
33882
  },
33665
- "metricsProvider.getProcessStats": {
33883
+ "metricsProvider.getLoadSeries": {
33666
33884
  capName: "metrics-provider",
33667
33885
  capScope: "system",
33668
33886
  addonId: null,
33669
33887
  access: "view"
33670
33888
  },
33671
- "metricsProvider.killProcess": {
33889
+ "metricsProvider.getProcessStats": {
33672
33890
  capName: "metrics-provider",
33673
33891
  capScope: "system",
33674
33892
  addonId: null,
33675
- access: "create"
33893
+ access: "view"
33676
33894
  },
33677
33895
  "metricsProvider.listAddonInstances": {
33678
33896
  capName: "metrics-provider",
@@ -35684,6 +35902,12 @@ Object.freeze({
35684
35902
  addonId: null,
35685
35903
  access: "create"
35686
35904
  },
35905
+ "settingsStore.insertMany": {
35906
+ capName: "settings-store",
35907
+ capScope: "system",
35908
+ addonId: null,
35909
+ access: "create"
35910
+ },
35687
35911
  "settingsStore.isEmpty": {
35688
35912
  capName: "settings-store",
35689
35913
  capScope: "system",
@@ -36296,6 +36520,12 @@ Object.freeze({
36296
36520
  addonId: null,
36297
36521
  access: "create"
36298
36522
  },
36523
+ "system.getLoadContributions": {
36524
+ capName: "system",
36525
+ capScope: "system",
36526
+ addonId: null,
36527
+ access: "view"
36528
+ },
36299
36529
  "system.getLoggingSettings": {
36300
36530
  capName: "system",
36301
36531
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -36,7 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
37
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
38
38
  //#endregion
39
- //#region ../types/dist/event-category-CIa_iT6b.mjs
39
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
40
40
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
41
41
  EventCategory["SystemBoot"] = "system.boot";
42
42
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -473,7 +473,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
473
473
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
474
474
  /**
475
475
  * Periodic per-node process-tree snapshot (camstack-related pids
476
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
476
+ * with root / managed / system classification). Emitted ~0.2 Hz by
477
477
  * the metrics-provider addon. Drives the Cluster → Processes tab
478
478
  * without polling `metricsProvider.listNodeProcesses`.
479
479
  */
@@ -11265,6 +11265,19 @@ var SettingsRecordSchema = object({
11265
11265
  data: record(string(), unknown())
11266
11266
  });
11267
11267
  /**
11268
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11269
+ * optional.
11270
+ *
11271
+ * A separate schema rather than loosening the shared one: every other method
11272
+ * on this cap addresses a row BY its id, and making that field optional
11273
+ * everywhere would turn a forgotten key into a silently generated one on
11274
+ * `update` and `delete` as well.
11275
+ */
11276
+ var BulkRecordSchema = object({
11277
+ id: string().optional(),
11278
+ data: record(string(), unknown())
11279
+ });
11280
+ /**
11268
11281
  * Column declaration for a structured (SQL-backed) collection.
11269
11282
  *
11270
11283
  * Logical types — the backend translates each to the matching SQLite
@@ -11321,6 +11334,10 @@ method(object({
11321
11334
  collection: string(),
11322
11335
  record: SettingsRecordSchema
11323
11336
  }), _void(), { kind: "mutation" }), method(object({
11337
+ namespace: string().optional(),
11338
+ collection: string(),
11339
+ records: array(BulkRecordSchema).readonly()
11340
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11324
11341
  namespace: string().optional(),
11325
11342
  collection: string(),
11326
11343
  id: string(),
@@ -11429,6 +11446,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11429
11446
  }), _void(), {
11430
11447
  kind: "mutation",
11431
11448
  auth: "admin"
11449
+ }), method(object({
11450
+ namespace: string().optional(),
11451
+ collection: string(),
11452
+ records: array(BulkRecordSchema).readonly()
11453
+ }), object({ inserted: number().int() }), {
11454
+ kind: "mutation",
11455
+ auth: "admin"
11432
11456
  }), method(object({
11433
11457
  namespace: string().optional(),
11434
11458
  collection: string(),
@@ -13376,6 +13400,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13376
13400
  limit: number().optional(),
13377
13401
  tags: record(string(), string()).optional()
13378
13402
  }), array(LogEntrySchema).readonly());
13403
+ var LoadContributionSchema = object({
13404
+ role: _enum([
13405
+ "decode",
13406
+ "transcode",
13407
+ "recording",
13408
+ "streaming",
13409
+ "detection"
13410
+ ]),
13411
+ /**
13412
+ * The NUMERIC device id — the same value every log line carries as
13413
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13414
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13415
+ * contributor that cannot name its camera must not emit the entry at all,
13416
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13417
+ * and would quietly turn one camera's cost into everybody's.
13418
+ */
13419
+ deviceId: number().int().positive().nullable(),
13420
+ attribution: _enum([
13421
+ "measured",
13422
+ "accounted",
13423
+ "unattributable"
13424
+ ]),
13425
+ /**
13426
+ * What ONE entry is, in the contributor's own words — `615/high`,
13427
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13428
+ * family and inventing a common one would lose the only information that
13429
+ * makes two entries for the same camera distinguishable.
13430
+ */
13431
+ unit: string(),
13432
+ /**
13433
+ * The OS process this cost lives in, when there is one. Present so a
13434
+ * consumer can (a) tell two generations of the same unit apart across a
13435
+ * restart, and (b) subtract claimed processes from the node's process
13436
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13437
+ * process of its own.
13438
+ */
13439
+ pid: number().int().positive().optional(),
13440
+ /**
13441
+ * When this generation started. The pid's incarnation marker: a consumer
13442
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13443
+ * window when this changes, because the counter restarted from zero in a new
13444
+ * process.
13445
+ */
13446
+ startedAtMs: number().optional(),
13447
+ /**
13448
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13449
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13450
+ * contribution is asked for.
13451
+ *
13452
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13453
+ * needs a sampler, and a new per-node sampler is the defect half of
13454
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13455
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13456
+ *
13457
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13458
+ * an entry with no process.
13459
+ */
13460
+ cpuSeconds: number().optional(),
13461
+ /** Resident bytes of this unit's process, same source and same rules. */
13462
+ rssBytes: number().optional()
13463
+ });
13464
+ method(_void(), array(LoadContributionSchema).readonly());
13379
13465
  /**
13380
13466
  * `login-method` — collection cap through which auth addons contribute
13381
13467
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13579,8 +13665,7 @@ var NodeProcessSchema = object({
13579
13665
  classification: _enum([
13580
13666
  "root",
13581
13667
  "managed",
13582
- "system",
13583
- "ghost"
13668
+ "system"
13584
13669
  ]),
13585
13670
  /** `$process` addon binding when `managed`, else null. */
13586
13671
  addonId: string().nullable(),
@@ -13588,22 +13673,39 @@ var NodeProcessSchema = object({
13588
13673
  nodeId: string().nullable(),
13589
13674
  /** Truncated command line. */
13590
13675
  command: string(),
13676
+ /**
13677
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13678
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13679
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13680
+ */
13591
13681
  cpuPercent: number(),
13592
13682
  memoryRssBytes: number(),
13683
+ /**
13684
+ * Instantaneous CPU% of the process's own threads over the last
13685
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13686
+ *
13687
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13688
+ * boot), the pid was recycled, or this node is not Linux.
13689
+ */
13690
+ cpuMainPercent: number().nullable(),
13691
+ /**
13692
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13693
+ *
13694
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13695
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13696
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13697
+ * "allocating too much".
13698
+ *
13699
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13700
+ * (background compilation runs there too), so it is reported as
13701
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13702
+ * meaning as on `cpuMainPercent`.
13703
+ */
13704
+ cpuGcPercent: number().nullable(),
13705
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13706
+ threadCount: number().nullable(),
13593
13707
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13594
- uptimeSec: number(),
13595
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13596
- orphaned: boolean()
13597
- });
13598
- var KillProcessInputSchema = object({
13599
- pid: number(),
13600
- /** Force = SIGKILL. Default is SIGTERM. */
13601
- force: boolean().optional()
13602
- });
13603
- var KillProcessResultSchema = object({
13604
- success: boolean(),
13605
- reason: string().optional(),
13606
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13708
+ uptimeSec: number()
13607
13709
  });
13608
13710
  var DumpHeapSnapshotInputSchema = object({
13609
13711
  /** The addon whose runner should dump a heap snapshot. */
@@ -13616,6 +13718,104 @@ var DumpHeapSnapshotResultSchema = object({
13616
13718
  pid: number().optional(),
13617
13719
  reason: string().optional()
13618
13720
  });
13721
+ /**
13722
+ * One point of one function's series.
13723
+ *
13724
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13725
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13726
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13727
+ * Either would give us a tool built to find peaks that does not show peaks.
13728
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13729
+ * into the bucket, and a mean stays derivable where it is wanted.
13730
+ *
13731
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13732
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13733
+ * caller cannot tell which it received — which is what "one reader" means.
13734
+ */
13735
+ var LoadPointSchema = object({
13736
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13737
+ atMs: number(),
13738
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13739
+ samples: number().int(),
13740
+ /**
13741
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13742
+ * of every snapshot in it reported a thread split. A partial sum is a
13743
+ * smaller number that looks exactly as real as a complete one.
13744
+ */
13745
+ cpuMainPercent: number().nullable(),
13746
+ cpuMainPercentMin: number().nullable(),
13747
+ cpuGcPercent: number().nullable(),
13748
+ cpuGcPercentMin: number().nullable(),
13749
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13750
+ cpuLifetimePercent: number(),
13751
+ cpuLifetimePercentMin: number(),
13752
+ memoryRssBytes: number(),
13753
+ memoryRssBytesMin: number(),
13754
+ processCount: number().int(),
13755
+ processCountMin: number().int()
13756
+ });
13757
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13758
+ var LoadFunctionSeriesSchema = object({
13759
+ key: string(),
13760
+ kind: _enum([
13761
+ "addon",
13762
+ "root",
13763
+ "unattributed"
13764
+ ]),
13765
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13766
+ points: array(LoadPointSchema).readonly()
13767
+ });
13768
+ var NodeLoadSeriesSchema = object({
13769
+ nodeId: string(),
13770
+ /** One entry per function seen in the window, heaviest-first. */
13771
+ series: array(LoadFunctionSeriesSchema).readonly(),
13772
+ /**
13773
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13774
+ * reduction was needed — so a caller can always say what one point covers
13775
+ * without having to know whether it was reduced.
13776
+ */
13777
+ bucketMs: number(),
13778
+ /** Raw snapshots that went into this answer, across both tiers. */
13779
+ retainedSamples: number(),
13780
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13781
+ oldestAtMs: number().nullable(),
13782
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13783
+ cadenceMs: number(),
13784
+ /**
13785
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13786
+ * alone — an agent (which holds no table), or a store that refused.
13787
+ * Reported because "the last hour" and "the last six hours" are different
13788
+ * questions and an operator must not have to guess which was answered.
13789
+ */
13790
+ durable: boolean()
13791
+ });
13792
+ var GetLoadSeriesInputSchema = object({
13793
+ /**
13794
+ * The node whose series is wanted.
13795
+ *
13796
+ * NOT named `nodeId`: the generated cap router strips a top-level
13797
+ * `nodeId` from every method input and uses it to ROUTE the call to
13798
+ * that node's provider (`generated-cap-routers.ts`). A series target
13799
+ * called `nodeId` would silently become a routing pin and never reach
13800
+ * the provider. The hub holds every node it hears from, so the
13801
+ * ordinary call is unpinned — answered by the hub, for any node.
13802
+ */
13803
+ forNodeId: string(),
13804
+ /**
13805
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13806
+ * holds and receives only what it is missing, so seeding a live chart
13807
+ * from this method cannot double a point already drawn.
13808
+ */
13809
+ sinceMs: number().optional(),
13810
+ /**
13811
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13812
+ * preserving min and max per bucket.
13813
+ *
13814
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13815
+ * long one, which is why a chart passes its own pixel width.
13816
+ */
13817
+ maxPoints: number().int().positive().optional()
13818
+ });
13619
13819
  var SystemMetricsSchema = object({
13620
13820
  cpuPercent: number(),
13621
13821
  memoryPercent: number(),
@@ -13626,10 +13826,7 @@ var SystemMetricsSchema = object({
13626
13826
  gpuPercent: number().optional(),
13627
13827
  gpuMemoryPercent: number().optional()
13628
13828
  });
13629
- 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, {
13630
- kind: "mutation",
13631
- auth: "admin"
13632
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13829
+ 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, {
13633
13830
  kind: "mutation",
13634
13831
  auth: "admin"
13635
13832
  });
@@ -28967,6 +29164,15 @@ var LoggingSettingsPatchSchema = object({
28967
29164
  * authority over the whole hierarchy and answers for every layer, so the
28968
29165
  * layer selector needs a name the transport does not already own.
28969
29166
  */
29167
+ /**
29168
+ * One contribution, plus WHO reported it.
29169
+ *
29170
+ * The addon and node are added by the hub as it enumerates providers, never by
29171
+ * the contributor: an addon reporting its own identity could report somebody
29172
+ * else's, and the whole point of this surface is that no claim is made by
29173
+ * anyone but its owner.
29174
+ */
29175
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
28970
29176
  var GetLoggingSettingsInputSchema = object({
28971
29177
  scopeNodeId: string().optional(),
28972
29178
  /**
@@ -29025,7 +29231,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29025
29231
  }), method(_void(), SiteLocationStatusSchema, {
29026
29232
  kind: "mutation",
29027
29233
  auth: "admin"
29028
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29234
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29029
29235
  kind: "mutation",
29030
29236
  auth: "admin"
29031
29237
  });
@@ -32049,6 +32255,12 @@ Object.freeze({
32049
32255
  addonId: null,
32050
32256
  access: "create"
32051
32257
  },
32258
+ "dataStoreProvider.insertMany": {
32259
+ capName: "data-store-provider",
32260
+ capScope: "system",
32261
+ addonId: null,
32262
+ access: "create"
32263
+ },
32052
32264
  "dataStoreProvider.isEmpty": {
32053
32265
  capName: "data-store-provider",
32054
32266
  capScope: "system",
@@ -33363,6 +33575,12 @@ Object.freeze({
33363
33575
  addonId: null,
33364
33576
  access: "create"
33365
33577
  },
33578
+ "loadContribution.list": {
33579
+ capName: "load-contribution",
33580
+ capScope: "system",
33581
+ addonId: null,
33582
+ access: "view"
33583
+ },
33366
33584
  "localNetwork.downloadCa": {
33367
33585
  capName: "local-network",
33368
33586
  capScope: "system",
@@ -33663,17 +33881,17 @@ Object.freeze({
33663
33881
  addonId: null,
33664
33882
  access: "view"
33665
33883
  },
33666
- "metricsProvider.getProcessStats": {
33884
+ "metricsProvider.getLoadSeries": {
33667
33885
  capName: "metrics-provider",
33668
33886
  capScope: "system",
33669
33887
  addonId: null,
33670
33888
  access: "view"
33671
33889
  },
33672
- "metricsProvider.killProcess": {
33890
+ "metricsProvider.getProcessStats": {
33673
33891
  capName: "metrics-provider",
33674
33892
  capScope: "system",
33675
33893
  addonId: null,
33676
- access: "create"
33894
+ access: "view"
33677
33895
  },
33678
33896
  "metricsProvider.listAddonInstances": {
33679
33897
  capName: "metrics-provider",
@@ -35685,6 +35903,12 @@ Object.freeze({
35685
35903
  addonId: null,
35686
35904
  access: "create"
35687
35905
  },
35906
+ "settingsStore.insertMany": {
35907
+ capName: "settings-store",
35908
+ capScope: "system",
35909
+ addonId: null,
35910
+ access: "create"
35911
+ },
35688
35912
  "settingsStore.isEmpty": {
35689
35913
  capName: "settings-store",
35690
35914
  capScope: "system",
@@ -36297,6 +36521,12 @@ Object.freeze({
36297
36521
  addonId: null,
36298
36522
  access: "create"
36299
36523
  },
36524
+ "system.getLoadContributions": {
36525
+ capName: "system",
36526
+ capScope: "system",
36527
+ addonId: null,
36528
+ access: "view"
36529
+ },
36300
36530
  "system.getLoggingSettings": {
36301
36531
  capName: "system",
36302
36532
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreo",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
4
4
  "description": "Dreo smart-device (fan / air-circulator / purifier / heater / humidifier) device-provider addon for CamStack — wraps the @apocaliss92/nodedreo Dreo cloud client (REST + WebSocket)",
5
5
  "keywords": [
6
6
  "camstack",