@camstack/addon-matter-broker 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
@@ -13,7 +13,7 @@ let node_stream_promises = require("node:stream/promises");
13
13
  let node_net = require("node:net");
14
14
  let node_dgram = require("node:dgram");
15
15
  node_dgram = require_esm.__toESM(node_dgram, 1);
16
- //#region ../types/dist/event-category-CIa_iT6b.mjs
16
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
17
17
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
18
18
  EventCategory["SystemBoot"] = "system.boot";
19
19
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -450,7 +450,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
450
450
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
451
451
  /**
452
452
  * Periodic per-node process-tree snapshot (camstack-related pids
453
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
453
+ * with root / managed / system classification). Emitted ~0.2 Hz by
454
454
  * the metrics-provider addon. Drives the Cluster → Processes tab
455
455
  * without polling `metricsProvider.listNodeProcesses`.
456
456
  */
@@ -11291,6 +11291,19 @@ var SettingsRecordSchema = object({
11291
11291
  data: record(string$2(), unknown())
11292
11292
  });
11293
11293
  /**
11294
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11295
+ * optional.
11296
+ *
11297
+ * A separate schema rather than loosening the shared one: every other method
11298
+ * on this cap addresses a row BY its id, and making that field optional
11299
+ * everywhere would turn a forgotten key into a silently generated one on
11300
+ * `update` and `delete` as well.
11301
+ */
11302
+ var BulkRecordSchema = object({
11303
+ id: string$2().optional(),
11304
+ data: record(string$2(), unknown())
11305
+ });
11306
+ /**
11294
11307
  * Column declaration for a structured (SQL-backed) collection.
11295
11308
  *
11296
11309
  * Logical types — the backend translates each to the matching SQLite
@@ -11347,6 +11360,10 @@ method(object({
11347
11360
  collection: string$2(),
11348
11361
  record: SettingsRecordSchema
11349
11362
  }), _void(), { kind: "mutation" }), method(object({
11363
+ namespace: string$2().optional(),
11364
+ collection: string$2(),
11365
+ records: array(BulkRecordSchema).readonly()
11366
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11350
11367
  namespace: string$2().optional(),
11351
11368
  collection: string$2(),
11352
11369
  id: string$2(),
@@ -11455,6 +11472,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11455
11472
  }), _void(), {
11456
11473
  kind: "mutation",
11457
11474
  auth: "admin"
11475
+ }), method(object({
11476
+ namespace: string$2().optional(),
11477
+ collection: string$2(),
11478
+ records: array(BulkRecordSchema).readonly()
11479
+ }), object({ inserted: number().int() }), {
11480
+ kind: "mutation",
11481
+ auth: "admin"
11458
11482
  }), method(object({
11459
11483
  namespace: string$2().optional(),
11460
11484
  collection: string$2(),
@@ -13402,6 +13426,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13402
13426
  limit: number().optional(),
13403
13427
  tags: record(string$2(), string$2()).optional()
13404
13428
  }), array(LogEntrySchema).readonly());
13429
+ var LoadContributionSchema = object({
13430
+ role: _enum([
13431
+ "decode",
13432
+ "transcode",
13433
+ "recording",
13434
+ "streaming",
13435
+ "detection"
13436
+ ]),
13437
+ /**
13438
+ * The NUMERIC device id — the same value every log line carries as
13439
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13440
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13441
+ * contributor that cannot name its camera must not emit the entry at all,
13442
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13443
+ * and would quietly turn one camera's cost into everybody's.
13444
+ */
13445
+ deviceId: number().int().positive().nullable(),
13446
+ attribution: _enum([
13447
+ "measured",
13448
+ "accounted",
13449
+ "unattributable"
13450
+ ]),
13451
+ /**
13452
+ * What ONE entry is, in the contributor's own words — `615/high`,
13453
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13454
+ * family and inventing a common one would lose the only information that
13455
+ * makes two entries for the same camera distinguishable.
13456
+ */
13457
+ unit: string$2(),
13458
+ /**
13459
+ * The OS process this cost lives in, when there is one. Present so a
13460
+ * consumer can (a) tell two generations of the same unit apart across a
13461
+ * restart, and (b) subtract claimed processes from the node's process
13462
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13463
+ * process of its own.
13464
+ */
13465
+ pid: number().int().positive().optional(),
13466
+ /**
13467
+ * When this generation started. The pid's incarnation marker: a consumer
13468
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13469
+ * window when this changes, because the counter restarted from zero in a new
13470
+ * process.
13471
+ */
13472
+ startedAtMs: number().optional(),
13473
+ /**
13474
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13475
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13476
+ * contribution is asked for.
13477
+ *
13478
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13479
+ * needs a sampler, and a new per-node sampler is the defect half of
13480
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13481
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13482
+ *
13483
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13484
+ * an entry with no process.
13485
+ */
13486
+ cpuSeconds: number().optional(),
13487
+ /** Resident bytes of this unit's process, same source and same rules. */
13488
+ rssBytes: number().optional()
13489
+ });
13490
+ method(_void(), array(LoadContributionSchema).readonly());
13405
13491
  /**
13406
13492
  * `login-method` — collection cap through which auth addons contribute
13407
13493
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13605,8 +13691,7 @@ var NodeProcessSchema = object({
13605
13691
  classification: _enum([
13606
13692
  "root",
13607
13693
  "managed",
13608
- "system",
13609
- "ghost"
13694
+ "system"
13610
13695
  ]),
13611
13696
  /** `$process` addon binding when `managed`, else null. */
13612
13697
  addonId: string$2().nullable(),
@@ -13614,22 +13699,39 @@ var NodeProcessSchema = object({
13614
13699
  nodeId: string$2().nullable(),
13615
13700
  /** Truncated command line. */
13616
13701
  command: string$2(),
13702
+ /**
13703
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13704
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13705
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13706
+ */
13617
13707
  cpuPercent: number(),
13618
13708
  memoryRssBytes: number(),
13709
+ /**
13710
+ * Instantaneous CPU% of the process's own threads over the last
13711
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13712
+ *
13713
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13714
+ * boot), the pid was recycled, or this node is not Linux.
13715
+ */
13716
+ cpuMainPercent: number().nullable(),
13717
+ /**
13718
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13719
+ *
13720
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13721
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13722
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13723
+ * "allocating too much".
13724
+ *
13725
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13726
+ * (background compilation runs there too), so it is reported as
13727
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13728
+ * meaning as on `cpuMainPercent`.
13729
+ */
13730
+ cpuGcPercent: number().nullable(),
13731
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13732
+ threadCount: number().nullable(),
13619
13733
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13620
- uptimeSec: number(),
13621
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13622
- orphaned: boolean()
13623
- });
13624
- var KillProcessInputSchema = object({
13625
- pid: number(),
13626
- /** Force = SIGKILL. Default is SIGTERM. */
13627
- force: boolean().optional()
13628
- });
13629
- var KillProcessResultSchema = object({
13630
- success: boolean(),
13631
- reason: string$2().optional(),
13632
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13734
+ uptimeSec: number()
13633
13735
  });
13634
13736
  var DumpHeapSnapshotInputSchema = object({
13635
13737
  /** The addon whose runner should dump a heap snapshot. */
@@ -13642,6 +13744,104 @@ var DumpHeapSnapshotResultSchema = object({
13642
13744
  pid: number().optional(),
13643
13745
  reason: string$2().optional()
13644
13746
  });
13747
+ /**
13748
+ * One point of one function's series.
13749
+ *
13750
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13751
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13752
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13753
+ * Either would give us a tool built to find peaks that does not show peaks.
13754
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13755
+ * into the bucket, and a mean stays derivable where it is wanted.
13756
+ *
13757
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13758
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13759
+ * caller cannot tell which it received — which is what "one reader" means.
13760
+ */
13761
+ var LoadPointSchema = object({
13762
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13763
+ atMs: number(),
13764
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13765
+ samples: number().int(),
13766
+ /**
13767
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13768
+ * of every snapshot in it reported a thread split. A partial sum is a
13769
+ * smaller number that looks exactly as real as a complete one.
13770
+ */
13771
+ cpuMainPercent: number().nullable(),
13772
+ cpuMainPercentMin: number().nullable(),
13773
+ cpuGcPercent: number().nullable(),
13774
+ cpuGcPercentMin: number().nullable(),
13775
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13776
+ cpuLifetimePercent: number(),
13777
+ cpuLifetimePercentMin: number(),
13778
+ memoryRssBytes: number(),
13779
+ memoryRssBytesMin: number(),
13780
+ processCount: number().int(),
13781
+ processCountMin: number().int()
13782
+ });
13783
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13784
+ var LoadFunctionSeriesSchema = object({
13785
+ key: string$2(),
13786
+ kind: _enum([
13787
+ "addon",
13788
+ "root",
13789
+ "unattributed"
13790
+ ]),
13791
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13792
+ points: array(LoadPointSchema).readonly()
13793
+ });
13794
+ var NodeLoadSeriesSchema = object({
13795
+ nodeId: string$2(),
13796
+ /** One entry per function seen in the window, heaviest-first. */
13797
+ series: array(LoadFunctionSeriesSchema).readonly(),
13798
+ /**
13799
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13800
+ * reduction was needed — so a caller can always say what one point covers
13801
+ * without having to know whether it was reduced.
13802
+ */
13803
+ bucketMs: number(),
13804
+ /** Raw snapshots that went into this answer, across both tiers. */
13805
+ retainedSamples: number(),
13806
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13807
+ oldestAtMs: number().nullable(),
13808
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13809
+ cadenceMs: number(),
13810
+ /**
13811
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13812
+ * alone — an agent (which holds no table), or a store that refused.
13813
+ * Reported because "the last hour" and "the last six hours" are different
13814
+ * questions and an operator must not have to guess which was answered.
13815
+ */
13816
+ durable: boolean()
13817
+ });
13818
+ var GetLoadSeriesInputSchema = object({
13819
+ /**
13820
+ * The node whose series is wanted.
13821
+ *
13822
+ * NOT named `nodeId`: the generated cap router strips a top-level
13823
+ * `nodeId` from every method input and uses it to ROUTE the call to
13824
+ * that node's provider (`generated-cap-routers.ts`). A series target
13825
+ * called `nodeId` would silently become a routing pin and never reach
13826
+ * the provider. The hub holds every node it hears from, so the
13827
+ * ordinary call is unpinned — answered by the hub, for any node.
13828
+ */
13829
+ forNodeId: string$2(),
13830
+ /**
13831
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13832
+ * holds and receives only what it is missing, so seeding a live chart
13833
+ * from this method cannot double a point already drawn.
13834
+ */
13835
+ sinceMs: number().optional(),
13836
+ /**
13837
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13838
+ * preserving min and max per bucket.
13839
+ *
13840
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13841
+ * long one, which is why a chart passes its own pixel width.
13842
+ */
13843
+ maxPoints: number().int().positive().optional()
13844
+ });
13645
13845
  var SystemMetricsSchema = object({
13646
13846
  cpuPercent: number(),
13647
13847
  memoryPercent: number(),
@@ -13652,10 +13852,7 @@ var SystemMetricsSchema = object({
13652
13852
  gpuPercent: number().optional(),
13653
13853
  gpuMemoryPercent: number().optional()
13654
13854
  });
13655
- method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string$2() }), 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$2() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
13656
- kind: "mutation",
13657
- auth: "admin"
13658
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13855
+ method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string$2() }), 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$2() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(GetLoadSeriesInputSchema, NodeLoadSeriesSchema), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13659
13856
  kind: "mutation",
13660
13857
  auth: "admin"
13661
13858
  });
@@ -29002,6 +29199,15 @@ var LoggingSettingsPatchSchema = object({
29002
29199
  * authority over the whole hierarchy and answers for every layer, so the
29003
29200
  * layer selector needs a name the transport does not already own.
29004
29201
  */
29202
+ /**
29203
+ * One contribution, plus WHO reported it.
29204
+ *
29205
+ * The addon and node are added by the hub as it enumerates providers, never by
29206
+ * the contributor: an addon reporting its own identity could report somebody
29207
+ * else's, and the whole point of this surface is that no claim is made by
29208
+ * anyone but its owner.
29209
+ */
29210
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string$2() });
29005
29211
  var GetLoggingSettingsInputSchema = object({
29006
29212
  scopeNodeId: string$2().optional(),
29007
29213
  /**
@@ -29060,7 +29266,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29060
29266
  }), method(_void(), SiteLocationStatusSchema, {
29061
29267
  kind: "mutation",
29062
29268
  auth: "admin"
29063
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29269
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29064
29270
  kind: "mutation",
29065
29271
  auth: "admin"
29066
29272
  });
@@ -32084,6 +32290,12 @@ Object.freeze({
32084
32290
  addonId: null,
32085
32291
  access: "create"
32086
32292
  },
32293
+ "dataStoreProvider.insertMany": {
32294
+ capName: "data-store-provider",
32295
+ capScope: "system",
32296
+ addonId: null,
32297
+ access: "create"
32298
+ },
32087
32299
  "dataStoreProvider.isEmpty": {
32088
32300
  capName: "data-store-provider",
32089
32301
  capScope: "system",
@@ -33398,6 +33610,12 @@ Object.freeze({
33398
33610
  addonId: null,
33399
33611
  access: "create"
33400
33612
  },
33613
+ "loadContribution.list": {
33614
+ capName: "load-contribution",
33615
+ capScope: "system",
33616
+ addonId: null,
33617
+ access: "view"
33618
+ },
33401
33619
  "localNetwork.downloadCa": {
33402
33620
  capName: "local-network",
33403
33621
  capScope: "system",
@@ -33698,17 +33916,17 @@ Object.freeze({
33698
33916
  addonId: null,
33699
33917
  access: "view"
33700
33918
  },
33701
- "metricsProvider.getProcessStats": {
33919
+ "metricsProvider.getLoadSeries": {
33702
33920
  capName: "metrics-provider",
33703
33921
  capScope: "system",
33704
33922
  addonId: null,
33705
33923
  access: "view"
33706
33924
  },
33707
- "metricsProvider.killProcess": {
33925
+ "metricsProvider.getProcessStats": {
33708
33926
  capName: "metrics-provider",
33709
33927
  capScope: "system",
33710
33928
  addonId: null,
33711
- access: "create"
33929
+ access: "view"
33712
33930
  },
33713
33931
  "metricsProvider.listAddonInstances": {
33714
33932
  capName: "metrics-provider",
@@ -35720,6 +35938,12 @@ Object.freeze({
35720
35938
  addonId: null,
35721
35939
  access: "create"
35722
35940
  },
35941
+ "settingsStore.insertMany": {
35942
+ capName: "settings-store",
35943
+ capScope: "system",
35944
+ addonId: null,
35945
+ access: "create"
35946
+ },
35723
35947
  "settingsStore.isEmpty": {
35724
35948
  capName: "settings-store",
35725
35949
  capScope: "system",
@@ -36332,6 +36556,12 @@ Object.freeze({
36332
36556
  addonId: null,
36333
36557
  access: "create"
36334
36558
  },
36559
+ "system.getLoadContributions": {
36560
+ capName: "system",
36561
+ capScope: "system",
36562
+ addonId: null,
36563
+ access: "view"
36564
+ },
36335
36565
  "system.getLoggingSettings": {
36336
36566
  capName: "system",
36337
36567
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -11,7 +11,7 @@ import { networkInterfaces, tmpdir, uptime } from "node:os";
11
11
  import { finished } from "node:stream/promises";
12
12
  import { createConnection, createServer as createServer$2 } from "node:net";
13
13
  import * as dgram from "node:dgram";
14
- //#region ../types/dist/event-category-CIa_iT6b.mjs
14
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
15
15
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
16
16
  EventCategory["SystemBoot"] = "system.boot";
17
17
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -448,7 +448,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
448
448
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
449
449
  /**
450
450
  * Periodic per-node process-tree snapshot (camstack-related pids
451
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
451
+ * with root / managed / system classification). Emitted ~0.2 Hz by
452
452
  * the metrics-provider addon. Drives the Cluster → Processes tab
453
453
  * without polling `metricsProvider.listNodeProcesses`.
454
454
  */
@@ -11289,6 +11289,19 @@ var SettingsRecordSchema = object({
11289
11289
  data: record(string$2(), unknown())
11290
11290
  });
11291
11291
  /**
11292
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11293
+ * optional.
11294
+ *
11295
+ * A separate schema rather than loosening the shared one: every other method
11296
+ * on this cap addresses a row BY its id, and making that field optional
11297
+ * everywhere would turn a forgotten key into a silently generated one on
11298
+ * `update` and `delete` as well.
11299
+ */
11300
+ var BulkRecordSchema = object({
11301
+ id: string$2().optional(),
11302
+ data: record(string$2(), unknown())
11303
+ });
11304
+ /**
11292
11305
  * Column declaration for a structured (SQL-backed) collection.
11293
11306
  *
11294
11307
  * Logical types — the backend translates each to the matching SQLite
@@ -11345,6 +11358,10 @@ method(object({
11345
11358
  collection: string$2(),
11346
11359
  record: SettingsRecordSchema
11347
11360
  }), _void(), { kind: "mutation" }), method(object({
11361
+ namespace: string$2().optional(),
11362
+ collection: string$2(),
11363
+ records: array(BulkRecordSchema).readonly()
11364
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11348
11365
  namespace: string$2().optional(),
11349
11366
  collection: string$2(),
11350
11367
  id: string$2(),
@@ -11453,6 +11470,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11453
11470
  }), _void(), {
11454
11471
  kind: "mutation",
11455
11472
  auth: "admin"
11473
+ }), method(object({
11474
+ namespace: string$2().optional(),
11475
+ collection: string$2(),
11476
+ records: array(BulkRecordSchema).readonly()
11477
+ }), object({ inserted: number().int() }), {
11478
+ kind: "mutation",
11479
+ auth: "admin"
11456
11480
  }), method(object({
11457
11481
  namespace: string$2().optional(),
11458
11482
  collection: string$2(),
@@ -13400,6 +13424,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13400
13424
  limit: number().optional(),
13401
13425
  tags: record(string$2(), string$2()).optional()
13402
13426
  }), array(LogEntrySchema).readonly());
13427
+ var LoadContributionSchema = object({
13428
+ role: _enum([
13429
+ "decode",
13430
+ "transcode",
13431
+ "recording",
13432
+ "streaming",
13433
+ "detection"
13434
+ ]),
13435
+ /**
13436
+ * The NUMERIC device id — the same value every log line carries as
13437
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13438
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13439
+ * contributor that cannot name its camera must not emit the entry at all,
13440
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13441
+ * and would quietly turn one camera's cost into everybody's.
13442
+ */
13443
+ deviceId: number().int().positive().nullable(),
13444
+ attribution: _enum([
13445
+ "measured",
13446
+ "accounted",
13447
+ "unattributable"
13448
+ ]),
13449
+ /**
13450
+ * What ONE entry is, in the contributor's own words — `615/high`,
13451
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13452
+ * family and inventing a common one would lose the only information that
13453
+ * makes two entries for the same camera distinguishable.
13454
+ */
13455
+ unit: string$2(),
13456
+ /**
13457
+ * The OS process this cost lives in, when there is one. Present so a
13458
+ * consumer can (a) tell two generations of the same unit apart across a
13459
+ * restart, and (b) subtract claimed processes from the node's process
13460
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13461
+ * process of its own.
13462
+ */
13463
+ pid: number().int().positive().optional(),
13464
+ /**
13465
+ * When this generation started. The pid's incarnation marker: a consumer
13466
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13467
+ * window when this changes, because the counter restarted from zero in a new
13468
+ * process.
13469
+ */
13470
+ startedAtMs: number().optional(),
13471
+ /**
13472
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13473
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13474
+ * contribution is asked for.
13475
+ *
13476
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13477
+ * needs a sampler, and a new per-node sampler is the defect half of
13478
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13479
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13480
+ *
13481
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13482
+ * an entry with no process.
13483
+ */
13484
+ cpuSeconds: number().optional(),
13485
+ /** Resident bytes of this unit's process, same source and same rules. */
13486
+ rssBytes: number().optional()
13487
+ });
13488
+ method(_void(), array(LoadContributionSchema).readonly());
13403
13489
  /**
13404
13490
  * `login-method` — collection cap through which auth addons contribute
13405
13491
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13603,8 +13689,7 @@ var NodeProcessSchema = object({
13603
13689
  classification: _enum([
13604
13690
  "root",
13605
13691
  "managed",
13606
- "system",
13607
- "ghost"
13692
+ "system"
13608
13693
  ]),
13609
13694
  /** `$process` addon binding when `managed`, else null. */
13610
13695
  addonId: string$2().nullable(),
@@ -13612,22 +13697,39 @@ var NodeProcessSchema = object({
13612
13697
  nodeId: string$2().nullable(),
13613
13698
  /** Truncated command line. */
13614
13699
  command: string$2(),
13700
+ /**
13701
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13702
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13703
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13704
+ */
13615
13705
  cpuPercent: number(),
13616
13706
  memoryRssBytes: number(),
13707
+ /**
13708
+ * Instantaneous CPU% of the process's own threads over the last
13709
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13710
+ *
13711
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13712
+ * boot), the pid was recycled, or this node is not Linux.
13713
+ */
13714
+ cpuMainPercent: number().nullable(),
13715
+ /**
13716
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13717
+ *
13718
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13719
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13720
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13721
+ * "allocating too much".
13722
+ *
13723
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13724
+ * (background compilation runs there too), so it is reported as
13725
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13726
+ * meaning as on `cpuMainPercent`.
13727
+ */
13728
+ cpuGcPercent: number().nullable(),
13729
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13730
+ threadCount: number().nullable(),
13617
13731
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13618
- uptimeSec: number(),
13619
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13620
- orphaned: boolean()
13621
- });
13622
- var KillProcessInputSchema = object({
13623
- pid: number(),
13624
- /** Force = SIGKILL. Default is SIGTERM. */
13625
- force: boolean().optional()
13626
- });
13627
- var KillProcessResultSchema = object({
13628
- success: boolean(),
13629
- reason: string$2().optional(),
13630
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13732
+ uptimeSec: number()
13631
13733
  });
13632
13734
  var DumpHeapSnapshotInputSchema = object({
13633
13735
  /** The addon whose runner should dump a heap snapshot. */
@@ -13640,6 +13742,104 @@ var DumpHeapSnapshotResultSchema = object({
13640
13742
  pid: number().optional(),
13641
13743
  reason: string$2().optional()
13642
13744
  });
13745
+ /**
13746
+ * One point of one function's series.
13747
+ *
13748
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13749
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13750
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13751
+ * Either would give us a tool built to find peaks that does not show peaks.
13752
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13753
+ * into the bucket, and a mean stays derivable where it is wanted.
13754
+ *
13755
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13756
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13757
+ * caller cannot tell which it received — which is what "one reader" means.
13758
+ */
13759
+ var LoadPointSchema = object({
13760
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13761
+ atMs: number(),
13762
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13763
+ samples: number().int(),
13764
+ /**
13765
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13766
+ * of every snapshot in it reported a thread split. A partial sum is a
13767
+ * smaller number that looks exactly as real as a complete one.
13768
+ */
13769
+ cpuMainPercent: number().nullable(),
13770
+ cpuMainPercentMin: number().nullable(),
13771
+ cpuGcPercent: number().nullable(),
13772
+ cpuGcPercentMin: number().nullable(),
13773
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13774
+ cpuLifetimePercent: number(),
13775
+ cpuLifetimePercentMin: number(),
13776
+ memoryRssBytes: number(),
13777
+ memoryRssBytesMin: number(),
13778
+ processCount: number().int(),
13779
+ processCountMin: number().int()
13780
+ });
13781
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13782
+ var LoadFunctionSeriesSchema = object({
13783
+ key: string$2(),
13784
+ kind: _enum([
13785
+ "addon",
13786
+ "root",
13787
+ "unattributed"
13788
+ ]),
13789
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13790
+ points: array(LoadPointSchema).readonly()
13791
+ });
13792
+ var NodeLoadSeriesSchema = object({
13793
+ nodeId: string$2(),
13794
+ /** One entry per function seen in the window, heaviest-first. */
13795
+ series: array(LoadFunctionSeriesSchema).readonly(),
13796
+ /**
13797
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13798
+ * reduction was needed — so a caller can always say what one point covers
13799
+ * without having to know whether it was reduced.
13800
+ */
13801
+ bucketMs: number(),
13802
+ /** Raw snapshots that went into this answer, across both tiers. */
13803
+ retainedSamples: number(),
13804
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13805
+ oldestAtMs: number().nullable(),
13806
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13807
+ cadenceMs: number(),
13808
+ /**
13809
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13810
+ * alone — an agent (which holds no table), or a store that refused.
13811
+ * Reported because "the last hour" and "the last six hours" are different
13812
+ * questions and an operator must not have to guess which was answered.
13813
+ */
13814
+ durable: boolean()
13815
+ });
13816
+ var GetLoadSeriesInputSchema = object({
13817
+ /**
13818
+ * The node whose series is wanted.
13819
+ *
13820
+ * NOT named `nodeId`: the generated cap router strips a top-level
13821
+ * `nodeId` from every method input and uses it to ROUTE the call to
13822
+ * that node's provider (`generated-cap-routers.ts`). A series target
13823
+ * called `nodeId` would silently become a routing pin and never reach
13824
+ * the provider. The hub holds every node it hears from, so the
13825
+ * ordinary call is unpinned — answered by the hub, for any node.
13826
+ */
13827
+ forNodeId: string$2(),
13828
+ /**
13829
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13830
+ * holds and receives only what it is missing, so seeding a live chart
13831
+ * from this method cannot double a point already drawn.
13832
+ */
13833
+ sinceMs: number().optional(),
13834
+ /**
13835
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13836
+ * preserving min and max per bucket.
13837
+ *
13838
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13839
+ * long one, which is why a chart passes its own pixel width.
13840
+ */
13841
+ maxPoints: number().int().positive().optional()
13842
+ });
13643
13843
  var SystemMetricsSchema = object({
13644
13844
  cpuPercent: number(),
13645
13845
  memoryPercent: number(),
@@ -13650,10 +13850,7 @@ var SystemMetricsSchema = object({
13650
13850
  gpuPercent: number().optional(),
13651
13851
  gpuMemoryPercent: number().optional()
13652
13852
  });
13653
- method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string$2() }), 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$2() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
13654
- kind: "mutation",
13655
- auth: "admin"
13656
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13853
+ method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string$2() }), 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$2() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(GetLoadSeriesInputSchema, NodeLoadSeriesSchema), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13657
13854
  kind: "mutation",
13658
13855
  auth: "admin"
13659
13856
  });
@@ -29000,6 +29197,15 @@ var LoggingSettingsPatchSchema = object({
29000
29197
  * authority over the whole hierarchy and answers for every layer, so the
29001
29198
  * layer selector needs a name the transport does not already own.
29002
29199
  */
29200
+ /**
29201
+ * One contribution, plus WHO reported it.
29202
+ *
29203
+ * The addon and node are added by the hub as it enumerates providers, never by
29204
+ * the contributor: an addon reporting its own identity could report somebody
29205
+ * else's, and the whole point of this surface is that no claim is made by
29206
+ * anyone but its owner.
29207
+ */
29208
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string$2() });
29003
29209
  var GetLoggingSettingsInputSchema = object({
29004
29210
  scopeNodeId: string$2().optional(),
29005
29211
  /**
@@ -29058,7 +29264,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29058
29264
  }), method(_void(), SiteLocationStatusSchema, {
29059
29265
  kind: "mutation",
29060
29266
  auth: "admin"
29061
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29267
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29062
29268
  kind: "mutation",
29063
29269
  auth: "admin"
29064
29270
  });
@@ -32082,6 +32288,12 @@ Object.freeze({
32082
32288
  addonId: null,
32083
32289
  access: "create"
32084
32290
  },
32291
+ "dataStoreProvider.insertMany": {
32292
+ capName: "data-store-provider",
32293
+ capScope: "system",
32294
+ addonId: null,
32295
+ access: "create"
32296
+ },
32085
32297
  "dataStoreProvider.isEmpty": {
32086
32298
  capName: "data-store-provider",
32087
32299
  capScope: "system",
@@ -33396,6 +33608,12 @@ Object.freeze({
33396
33608
  addonId: null,
33397
33609
  access: "create"
33398
33610
  },
33611
+ "loadContribution.list": {
33612
+ capName: "load-contribution",
33613
+ capScope: "system",
33614
+ addonId: null,
33615
+ access: "view"
33616
+ },
33399
33617
  "localNetwork.downloadCa": {
33400
33618
  capName: "local-network",
33401
33619
  capScope: "system",
@@ -33696,17 +33914,17 @@ Object.freeze({
33696
33914
  addonId: null,
33697
33915
  access: "view"
33698
33916
  },
33699
- "metricsProvider.getProcessStats": {
33917
+ "metricsProvider.getLoadSeries": {
33700
33918
  capName: "metrics-provider",
33701
33919
  capScope: "system",
33702
33920
  addonId: null,
33703
33921
  access: "view"
33704
33922
  },
33705
- "metricsProvider.killProcess": {
33923
+ "metricsProvider.getProcessStats": {
33706
33924
  capName: "metrics-provider",
33707
33925
  capScope: "system",
33708
33926
  addonId: null,
33709
- access: "create"
33927
+ access: "view"
33710
33928
  },
33711
33929
  "metricsProvider.listAddonInstances": {
33712
33930
  capName: "metrics-provider",
@@ -35718,6 +35936,12 @@ Object.freeze({
35718
35936
  addonId: null,
35719
35937
  access: "create"
35720
35938
  },
35939
+ "settingsStore.insertMany": {
35940
+ capName: "settings-store",
35941
+ capScope: "system",
35942
+ addonId: null,
35943
+ access: "create"
35944
+ },
35721
35945
  "settingsStore.isEmpty": {
35722
35946
  capName: "settings-store",
35723
35947
  capScope: "system",
@@ -36330,6 +36554,12 @@ Object.freeze({
36330
36554
  addonId: null,
36331
36555
  access: "create"
36332
36556
  },
36557
+ "system.getLoadContributions": {
36558
+ capName: "system",
36559
+ capScope: "system",
36560
+ addonId: null,
36561
+ access: "view"
36562
+ },
36333
36563
  "system.getLoggingSettings": {
36334
36564
  capName: "system",
36335
36565
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-matter-broker",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
4
4
  "description": "Matter broker addon for CamStack — owns a Matter fabric (commissioning + the long-lived controller) via the matter.js controller and brokers commissioned Matter nodes into CamStack",
5
5
  "keywords": [
6
6
  "camstack",