@camstack/addon-provider-gree 0.2.34 → 0.2.35

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
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let dgram = require("dgram");
3
3
  let crypto$1 = require("crypto");
4
4
  let events = require("events");
5
- //#region ../types/dist/event-category-CIa_iT6b.mjs
5
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
6
6
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
7
7
  EventCategory["SystemBoot"] = "system.boot";
8
8
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -439,7 +439,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
439
439
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
440
440
  /**
441
441
  * Periodic per-node process-tree snapshot (camstack-related pids
442
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
442
+ * with root / managed / system classification). Emitted ~0.2 Hz by
443
443
  * the metrics-provider addon. Drives the Cluster → Processes tab
444
444
  * without polling `metricsProvider.listNodeProcesses`.
445
445
  */
@@ -11231,6 +11231,19 @@ var SettingsRecordSchema = object({
11231
11231
  data: record(string(), unknown())
11232
11232
  });
11233
11233
  /**
11234
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11235
+ * optional.
11236
+ *
11237
+ * A separate schema rather than loosening the shared one: every other method
11238
+ * on this cap addresses a row BY its id, and making that field optional
11239
+ * everywhere would turn a forgotten key into a silently generated one on
11240
+ * `update` and `delete` as well.
11241
+ */
11242
+ var BulkRecordSchema = object({
11243
+ id: string().optional(),
11244
+ data: record(string(), unknown())
11245
+ });
11246
+ /**
11234
11247
  * Column declaration for a structured (SQL-backed) collection.
11235
11248
  *
11236
11249
  * Logical types — the backend translates each to the matching SQLite
@@ -11287,6 +11300,10 @@ method(object({
11287
11300
  collection: string(),
11288
11301
  record: SettingsRecordSchema
11289
11302
  }), _void(), { kind: "mutation" }), method(object({
11303
+ namespace: string().optional(),
11304
+ collection: string(),
11305
+ records: array(BulkRecordSchema).readonly()
11306
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11290
11307
  namespace: string().optional(),
11291
11308
  collection: string(),
11292
11309
  id: string(),
@@ -11395,6 +11412,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11395
11412
  }), _void(), {
11396
11413
  kind: "mutation",
11397
11414
  auth: "admin"
11415
+ }), method(object({
11416
+ namespace: string().optional(),
11417
+ collection: string(),
11418
+ records: array(BulkRecordSchema).readonly()
11419
+ }), object({ inserted: number().int() }), {
11420
+ kind: "mutation",
11421
+ auth: "admin"
11398
11422
  }), method(object({
11399
11423
  namespace: string().optional(),
11400
11424
  collection: string(),
@@ -13325,6 +13349,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13325
13349
  limit: number().optional(),
13326
13350
  tags: record(string(), string()).optional()
13327
13351
  }), array(LogEntrySchema).readonly());
13352
+ var LoadContributionSchema = object({
13353
+ role: _enum([
13354
+ "decode",
13355
+ "transcode",
13356
+ "recording",
13357
+ "streaming",
13358
+ "detection"
13359
+ ]),
13360
+ /**
13361
+ * The NUMERIC device id — the same value every log line carries as
13362
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13363
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13364
+ * contributor that cannot name its camera must not emit the entry at all,
13365
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13366
+ * and would quietly turn one camera's cost into everybody's.
13367
+ */
13368
+ deviceId: number().int().positive().nullable(),
13369
+ attribution: _enum([
13370
+ "measured",
13371
+ "accounted",
13372
+ "unattributable"
13373
+ ]),
13374
+ /**
13375
+ * What ONE entry is, in the contributor's own words — `615/high`,
13376
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13377
+ * family and inventing a common one would lose the only information that
13378
+ * makes two entries for the same camera distinguishable.
13379
+ */
13380
+ unit: string(),
13381
+ /**
13382
+ * The OS process this cost lives in, when there is one. Present so a
13383
+ * consumer can (a) tell two generations of the same unit apart across a
13384
+ * restart, and (b) subtract claimed processes from the node's process
13385
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13386
+ * process of its own.
13387
+ */
13388
+ pid: number().int().positive().optional(),
13389
+ /**
13390
+ * When this generation started. The pid's incarnation marker: a consumer
13391
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13392
+ * window when this changes, because the counter restarted from zero in a new
13393
+ * process.
13394
+ */
13395
+ startedAtMs: number().optional(),
13396
+ /**
13397
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13398
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13399
+ * contribution is asked for.
13400
+ *
13401
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13402
+ * needs a sampler, and a new per-node sampler is the defect half of
13403
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13404
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13405
+ *
13406
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13407
+ * an entry with no process.
13408
+ */
13409
+ cpuSeconds: number().optional(),
13410
+ /** Resident bytes of this unit's process, same source and same rules. */
13411
+ rssBytes: number().optional()
13412
+ });
13413
+ method(_void(), array(LoadContributionSchema).readonly());
13328
13414
  /**
13329
13415
  * `login-method` — collection cap through which auth addons contribute
13330
13416
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13528,8 +13614,7 @@ var NodeProcessSchema = object({
13528
13614
  classification: _enum([
13529
13615
  "root",
13530
13616
  "managed",
13531
- "system",
13532
- "ghost"
13617
+ "system"
13533
13618
  ]),
13534
13619
  /** `$process` addon binding when `managed`, else null. */
13535
13620
  addonId: string().nullable(),
@@ -13537,22 +13622,39 @@ var NodeProcessSchema = object({
13537
13622
  nodeId: string().nullable(),
13538
13623
  /** Truncated command line. */
13539
13624
  command: string(),
13625
+ /**
13626
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13627
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13628
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13629
+ */
13540
13630
  cpuPercent: number(),
13541
13631
  memoryRssBytes: number(),
13632
+ /**
13633
+ * Instantaneous CPU% of the process's own threads over the last
13634
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13635
+ *
13636
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13637
+ * boot), the pid was recycled, or this node is not Linux.
13638
+ */
13639
+ cpuMainPercent: number().nullable(),
13640
+ /**
13641
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13642
+ *
13643
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13644
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13645
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13646
+ * "allocating too much".
13647
+ *
13648
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13649
+ * (background compilation runs there too), so it is reported as
13650
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13651
+ * meaning as on `cpuMainPercent`.
13652
+ */
13653
+ cpuGcPercent: number().nullable(),
13654
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13655
+ threadCount: number().nullable(),
13542
13656
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13543
- uptimeSec: number(),
13544
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13545
- orphaned: boolean()
13546
- });
13547
- var KillProcessInputSchema = object({
13548
- pid: number(),
13549
- /** Force = SIGKILL. Default is SIGTERM. */
13550
- force: boolean().optional()
13551
- });
13552
- var KillProcessResultSchema = object({
13553
- success: boolean(),
13554
- reason: string().optional(),
13555
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13657
+ uptimeSec: number()
13556
13658
  });
13557
13659
  var DumpHeapSnapshotInputSchema = object({
13558
13660
  /** The addon whose runner should dump a heap snapshot. */
@@ -13565,6 +13667,104 @@ var DumpHeapSnapshotResultSchema = object({
13565
13667
  pid: number().optional(),
13566
13668
  reason: string().optional()
13567
13669
  });
13670
+ /**
13671
+ * One point of one function's series.
13672
+ *
13673
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13674
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13675
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13676
+ * Either would give us a tool built to find peaks that does not show peaks.
13677
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13678
+ * into the bucket, and a mean stays derivable where it is wanted.
13679
+ *
13680
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13681
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13682
+ * caller cannot tell which it received — which is what "one reader" means.
13683
+ */
13684
+ var LoadPointSchema = object({
13685
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13686
+ atMs: number(),
13687
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13688
+ samples: number().int(),
13689
+ /**
13690
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13691
+ * of every snapshot in it reported a thread split. A partial sum is a
13692
+ * smaller number that looks exactly as real as a complete one.
13693
+ */
13694
+ cpuMainPercent: number().nullable(),
13695
+ cpuMainPercentMin: number().nullable(),
13696
+ cpuGcPercent: number().nullable(),
13697
+ cpuGcPercentMin: number().nullable(),
13698
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13699
+ cpuLifetimePercent: number(),
13700
+ cpuLifetimePercentMin: number(),
13701
+ memoryRssBytes: number(),
13702
+ memoryRssBytesMin: number(),
13703
+ processCount: number().int(),
13704
+ processCountMin: number().int()
13705
+ });
13706
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13707
+ var LoadFunctionSeriesSchema = object({
13708
+ key: string(),
13709
+ kind: _enum([
13710
+ "addon",
13711
+ "root",
13712
+ "unattributed"
13713
+ ]),
13714
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13715
+ points: array(LoadPointSchema).readonly()
13716
+ });
13717
+ var NodeLoadSeriesSchema = object({
13718
+ nodeId: string(),
13719
+ /** One entry per function seen in the window, heaviest-first. */
13720
+ series: array(LoadFunctionSeriesSchema).readonly(),
13721
+ /**
13722
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13723
+ * reduction was needed — so a caller can always say what one point covers
13724
+ * without having to know whether it was reduced.
13725
+ */
13726
+ bucketMs: number(),
13727
+ /** Raw snapshots that went into this answer, across both tiers. */
13728
+ retainedSamples: number(),
13729
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13730
+ oldestAtMs: number().nullable(),
13731
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13732
+ cadenceMs: number(),
13733
+ /**
13734
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13735
+ * alone — an agent (which holds no table), or a store that refused.
13736
+ * Reported because "the last hour" and "the last six hours" are different
13737
+ * questions and an operator must not have to guess which was answered.
13738
+ */
13739
+ durable: boolean()
13740
+ });
13741
+ var GetLoadSeriesInputSchema = object({
13742
+ /**
13743
+ * The node whose series is wanted.
13744
+ *
13745
+ * NOT named `nodeId`: the generated cap router strips a top-level
13746
+ * `nodeId` from every method input and uses it to ROUTE the call to
13747
+ * that node's provider (`generated-cap-routers.ts`). A series target
13748
+ * called `nodeId` would silently become a routing pin and never reach
13749
+ * the provider. The hub holds every node it hears from, so the
13750
+ * ordinary call is unpinned — answered by the hub, for any node.
13751
+ */
13752
+ forNodeId: string(),
13753
+ /**
13754
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13755
+ * holds and receives only what it is missing, so seeding a live chart
13756
+ * from this method cannot double a point already drawn.
13757
+ */
13758
+ sinceMs: number().optional(),
13759
+ /**
13760
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13761
+ * preserving min and max per bucket.
13762
+ *
13763
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13764
+ * long one, which is why a chart passes its own pixel width.
13765
+ */
13766
+ maxPoints: number().int().positive().optional()
13767
+ });
13568
13768
  var SystemMetricsSchema = object({
13569
13769
  cpuPercent: number(),
13570
13770
  memoryPercent: number(),
@@ -13575,10 +13775,7 @@ var SystemMetricsSchema = object({
13575
13775
  gpuPercent: number().optional(),
13576
13776
  gpuMemoryPercent: number().optional()
13577
13777
  });
13578
- 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, {
13579
- kind: "mutation",
13580
- auth: "admin"
13581
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13778
+ 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, {
13582
13779
  kind: "mutation",
13583
13780
  auth: "admin"
13584
13781
  });
@@ -28908,6 +29105,15 @@ var LoggingSettingsPatchSchema = object({
28908
29105
  * authority over the whole hierarchy and answers for every layer, so the
28909
29106
  * layer selector needs a name the transport does not already own.
28910
29107
  */
29108
+ /**
29109
+ * One contribution, plus WHO reported it.
29110
+ *
29111
+ * The addon and node are added by the hub as it enumerates providers, never by
29112
+ * the contributor: an addon reporting its own identity could report somebody
29113
+ * else's, and the whole point of this surface is that no claim is made by
29114
+ * anyone but its owner.
29115
+ */
29116
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
28911
29117
  var GetLoggingSettingsInputSchema = object({
28912
29118
  scopeNodeId: string().optional(),
28913
29119
  /**
@@ -28966,7 +29172,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28966
29172
  }), method(_void(), SiteLocationStatusSchema, {
28967
29173
  kind: "mutation",
28968
29174
  auth: "admin"
28969
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29175
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28970
29176
  kind: "mutation",
28971
29177
  auth: "admin"
28972
29178
  });
@@ -31990,6 +32196,12 @@ Object.freeze({
31990
32196
  addonId: null,
31991
32197
  access: "create"
31992
32198
  },
32199
+ "dataStoreProvider.insertMany": {
32200
+ capName: "data-store-provider",
32201
+ capScope: "system",
32202
+ addonId: null,
32203
+ access: "create"
32204
+ },
31993
32205
  "dataStoreProvider.isEmpty": {
31994
32206
  capName: "data-store-provider",
31995
32207
  capScope: "system",
@@ -33304,6 +33516,12 @@ Object.freeze({
33304
33516
  addonId: null,
33305
33517
  access: "create"
33306
33518
  },
33519
+ "loadContribution.list": {
33520
+ capName: "load-contribution",
33521
+ capScope: "system",
33522
+ addonId: null,
33523
+ access: "view"
33524
+ },
33307
33525
  "localNetwork.downloadCa": {
33308
33526
  capName: "local-network",
33309
33527
  capScope: "system",
@@ -33604,17 +33822,17 @@ Object.freeze({
33604
33822
  addonId: null,
33605
33823
  access: "view"
33606
33824
  },
33607
- "metricsProvider.getProcessStats": {
33825
+ "metricsProvider.getLoadSeries": {
33608
33826
  capName: "metrics-provider",
33609
33827
  capScope: "system",
33610
33828
  addonId: null,
33611
33829
  access: "view"
33612
33830
  },
33613
- "metricsProvider.killProcess": {
33831
+ "metricsProvider.getProcessStats": {
33614
33832
  capName: "metrics-provider",
33615
33833
  capScope: "system",
33616
33834
  addonId: null,
33617
- access: "create"
33835
+ access: "view"
33618
33836
  },
33619
33837
  "metricsProvider.listAddonInstances": {
33620
33838
  capName: "metrics-provider",
@@ -35626,6 +35844,12 @@ Object.freeze({
35626
35844
  addonId: null,
35627
35845
  access: "create"
35628
35846
  },
35847
+ "settingsStore.insertMany": {
35848
+ capName: "settings-store",
35849
+ capScope: "system",
35850
+ addonId: null,
35851
+ access: "create"
35852
+ },
35629
35853
  "settingsStore.isEmpty": {
35630
35854
  capName: "settings-store",
35631
35855
  capScope: "system",
@@ -36238,6 +36462,12 @@ Object.freeze({
36238
36462
  addonId: null,
36239
36463
  access: "create"
36240
36464
  },
36465
+ "system.getLoadContributions": {
36466
+ capName: "system",
36467
+ capScope: "system",
36468
+ addonId: null,
36469
+ access: "view"
36470
+ },
36241
36471
  "system.getLoggingSettings": {
36242
36472
  capName: "system",
36243
36473
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createSocket } from "dgram";
2
2
  import { createCipheriv, createDecipheriv } from "crypto";
3
3
  import { EventEmitter } from "events";
4
- //#region ../types/dist/event-category-CIa_iT6b.mjs
4
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
5
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
6
6
  EventCategory["SystemBoot"] = "system.boot";
7
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -438,7 +438,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
438
438
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
439
439
  /**
440
440
  * Periodic per-node process-tree snapshot (camstack-related pids
441
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
441
+ * with root / managed / system classification). Emitted ~0.2 Hz by
442
442
  * the metrics-provider addon. Drives the Cluster → Processes tab
443
443
  * without polling `metricsProvider.listNodeProcesses`.
444
444
  */
@@ -11230,6 +11230,19 @@ var SettingsRecordSchema = object({
11230
11230
  data: record(string(), unknown())
11231
11231
  });
11232
11232
  /**
11233
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11234
+ * optional.
11235
+ *
11236
+ * A separate schema rather than loosening the shared one: every other method
11237
+ * on this cap addresses a row BY its id, and making that field optional
11238
+ * everywhere would turn a forgotten key into a silently generated one on
11239
+ * `update` and `delete` as well.
11240
+ */
11241
+ var BulkRecordSchema = object({
11242
+ id: string().optional(),
11243
+ data: record(string(), unknown())
11244
+ });
11245
+ /**
11233
11246
  * Column declaration for a structured (SQL-backed) collection.
11234
11247
  *
11235
11248
  * Logical types — the backend translates each to the matching SQLite
@@ -11286,6 +11299,10 @@ method(object({
11286
11299
  collection: string(),
11287
11300
  record: SettingsRecordSchema
11288
11301
  }), _void(), { kind: "mutation" }), method(object({
11302
+ namespace: string().optional(),
11303
+ collection: string(),
11304
+ records: array(BulkRecordSchema).readonly()
11305
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11289
11306
  namespace: string().optional(),
11290
11307
  collection: string(),
11291
11308
  id: string(),
@@ -11394,6 +11411,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11394
11411
  }), _void(), {
11395
11412
  kind: "mutation",
11396
11413
  auth: "admin"
11414
+ }), method(object({
11415
+ namespace: string().optional(),
11416
+ collection: string(),
11417
+ records: array(BulkRecordSchema).readonly()
11418
+ }), object({ inserted: number().int() }), {
11419
+ kind: "mutation",
11420
+ auth: "admin"
11397
11421
  }), method(object({
11398
11422
  namespace: string().optional(),
11399
11423
  collection: string(),
@@ -13324,6 +13348,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13324
13348
  limit: number().optional(),
13325
13349
  tags: record(string(), string()).optional()
13326
13350
  }), array(LogEntrySchema).readonly());
13351
+ var LoadContributionSchema = object({
13352
+ role: _enum([
13353
+ "decode",
13354
+ "transcode",
13355
+ "recording",
13356
+ "streaming",
13357
+ "detection"
13358
+ ]),
13359
+ /**
13360
+ * The NUMERIC device id — the same value every log line carries as
13361
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13362
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13363
+ * contributor that cannot name its camera must not emit the entry at all,
13364
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13365
+ * and would quietly turn one camera's cost into everybody's.
13366
+ */
13367
+ deviceId: number().int().positive().nullable(),
13368
+ attribution: _enum([
13369
+ "measured",
13370
+ "accounted",
13371
+ "unattributable"
13372
+ ]),
13373
+ /**
13374
+ * What ONE entry is, in the contributor's own words — `615/high`,
13375
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13376
+ * family and inventing a common one would lose the only information that
13377
+ * makes two entries for the same camera distinguishable.
13378
+ */
13379
+ unit: string(),
13380
+ /**
13381
+ * The OS process this cost lives in, when there is one. Present so a
13382
+ * consumer can (a) tell two generations of the same unit apart across a
13383
+ * restart, and (b) subtract claimed processes from the node's process
13384
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13385
+ * process of its own.
13386
+ */
13387
+ pid: number().int().positive().optional(),
13388
+ /**
13389
+ * When this generation started. The pid's incarnation marker: a consumer
13390
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13391
+ * window when this changes, because the counter restarted from zero in a new
13392
+ * process.
13393
+ */
13394
+ startedAtMs: number().optional(),
13395
+ /**
13396
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13397
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13398
+ * contribution is asked for.
13399
+ *
13400
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13401
+ * needs a sampler, and a new per-node sampler is the defect half of
13402
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13403
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13404
+ *
13405
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13406
+ * an entry with no process.
13407
+ */
13408
+ cpuSeconds: number().optional(),
13409
+ /** Resident bytes of this unit's process, same source and same rules. */
13410
+ rssBytes: number().optional()
13411
+ });
13412
+ method(_void(), array(LoadContributionSchema).readonly());
13327
13413
  /**
13328
13414
  * `login-method` — collection cap through which auth addons contribute
13329
13415
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13527,8 +13613,7 @@ var NodeProcessSchema = object({
13527
13613
  classification: _enum([
13528
13614
  "root",
13529
13615
  "managed",
13530
- "system",
13531
- "ghost"
13616
+ "system"
13532
13617
  ]),
13533
13618
  /** `$process` addon binding when `managed`, else null. */
13534
13619
  addonId: string().nullable(),
@@ -13536,22 +13621,39 @@ var NodeProcessSchema = object({
13536
13621
  nodeId: string().nullable(),
13537
13622
  /** Truncated command line. */
13538
13623
  command: string(),
13624
+ /**
13625
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13626
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13627
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13628
+ */
13539
13629
  cpuPercent: number(),
13540
13630
  memoryRssBytes: number(),
13631
+ /**
13632
+ * Instantaneous CPU% of the process's own threads over the last
13633
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13634
+ *
13635
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13636
+ * boot), the pid was recycled, or this node is not Linux.
13637
+ */
13638
+ cpuMainPercent: number().nullable(),
13639
+ /**
13640
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13641
+ *
13642
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13643
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13644
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13645
+ * "allocating too much".
13646
+ *
13647
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13648
+ * (background compilation runs there too), so it is reported as
13649
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13650
+ * meaning as on `cpuMainPercent`.
13651
+ */
13652
+ cpuGcPercent: number().nullable(),
13653
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13654
+ threadCount: number().nullable(),
13541
13655
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13542
- uptimeSec: number(),
13543
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13544
- orphaned: boolean()
13545
- });
13546
- var KillProcessInputSchema = object({
13547
- pid: number(),
13548
- /** Force = SIGKILL. Default is SIGTERM. */
13549
- force: boolean().optional()
13550
- });
13551
- var KillProcessResultSchema = object({
13552
- success: boolean(),
13553
- reason: string().optional(),
13554
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13656
+ uptimeSec: number()
13555
13657
  });
13556
13658
  var DumpHeapSnapshotInputSchema = object({
13557
13659
  /** The addon whose runner should dump a heap snapshot. */
@@ -13564,6 +13666,104 @@ var DumpHeapSnapshotResultSchema = object({
13564
13666
  pid: number().optional(),
13565
13667
  reason: string().optional()
13566
13668
  });
13669
+ /**
13670
+ * One point of one function's series.
13671
+ *
13672
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13673
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13674
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13675
+ * Either would give us a tool built to find peaks that does not show peaks.
13676
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13677
+ * into the bucket, and a mean stays derivable where it is wanted.
13678
+ *
13679
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13680
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13681
+ * caller cannot tell which it received — which is what "one reader" means.
13682
+ */
13683
+ var LoadPointSchema = object({
13684
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13685
+ atMs: number(),
13686
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13687
+ samples: number().int(),
13688
+ /**
13689
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13690
+ * of every snapshot in it reported a thread split. A partial sum is a
13691
+ * smaller number that looks exactly as real as a complete one.
13692
+ */
13693
+ cpuMainPercent: number().nullable(),
13694
+ cpuMainPercentMin: number().nullable(),
13695
+ cpuGcPercent: number().nullable(),
13696
+ cpuGcPercentMin: number().nullable(),
13697
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13698
+ cpuLifetimePercent: number(),
13699
+ cpuLifetimePercentMin: number(),
13700
+ memoryRssBytes: number(),
13701
+ memoryRssBytesMin: number(),
13702
+ processCount: number().int(),
13703
+ processCountMin: number().int()
13704
+ });
13705
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13706
+ var LoadFunctionSeriesSchema = object({
13707
+ key: string(),
13708
+ kind: _enum([
13709
+ "addon",
13710
+ "root",
13711
+ "unattributed"
13712
+ ]),
13713
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13714
+ points: array(LoadPointSchema).readonly()
13715
+ });
13716
+ var NodeLoadSeriesSchema = object({
13717
+ nodeId: string(),
13718
+ /** One entry per function seen in the window, heaviest-first. */
13719
+ series: array(LoadFunctionSeriesSchema).readonly(),
13720
+ /**
13721
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13722
+ * reduction was needed — so a caller can always say what one point covers
13723
+ * without having to know whether it was reduced.
13724
+ */
13725
+ bucketMs: number(),
13726
+ /** Raw snapshots that went into this answer, across both tiers. */
13727
+ retainedSamples: number(),
13728
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13729
+ oldestAtMs: number().nullable(),
13730
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13731
+ cadenceMs: number(),
13732
+ /**
13733
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13734
+ * alone — an agent (which holds no table), or a store that refused.
13735
+ * Reported because "the last hour" and "the last six hours" are different
13736
+ * questions and an operator must not have to guess which was answered.
13737
+ */
13738
+ durable: boolean()
13739
+ });
13740
+ var GetLoadSeriesInputSchema = object({
13741
+ /**
13742
+ * The node whose series is wanted.
13743
+ *
13744
+ * NOT named `nodeId`: the generated cap router strips a top-level
13745
+ * `nodeId` from every method input and uses it to ROUTE the call to
13746
+ * that node's provider (`generated-cap-routers.ts`). A series target
13747
+ * called `nodeId` would silently become a routing pin and never reach
13748
+ * the provider. The hub holds every node it hears from, so the
13749
+ * ordinary call is unpinned — answered by the hub, for any node.
13750
+ */
13751
+ forNodeId: string(),
13752
+ /**
13753
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13754
+ * holds and receives only what it is missing, so seeding a live chart
13755
+ * from this method cannot double a point already drawn.
13756
+ */
13757
+ sinceMs: number().optional(),
13758
+ /**
13759
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13760
+ * preserving min and max per bucket.
13761
+ *
13762
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13763
+ * long one, which is why a chart passes its own pixel width.
13764
+ */
13765
+ maxPoints: number().int().positive().optional()
13766
+ });
13567
13767
  var SystemMetricsSchema = object({
13568
13768
  cpuPercent: number(),
13569
13769
  memoryPercent: number(),
@@ -13574,10 +13774,7 @@ var SystemMetricsSchema = object({
13574
13774
  gpuPercent: number().optional(),
13575
13775
  gpuMemoryPercent: number().optional()
13576
13776
  });
13577
- 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, {
13578
- kind: "mutation",
13579
- auth: "admin"
13580
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13777
+ 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, {
13581
13778
  kind: "mutation",
13582
13779
  auth: "admin"
13583
13780
  });
@@ -28907,6 +29104,15 @@ var LoggingSettingsPatchSchema = object({
28907
29104
  * authority over the whole hierarchy and answers for every layer, so the
28908
29105
  * layer selector needs a name the transport does not already own.
28909
29106
  */
29107
+ /**
29108
+ * One contribution, plus WHO reported it.
29109
+ *
29110
+ * The addon and node are added by the hub as it enumerates providers, never by
29111
+ * the contributor: an addon reporting its own identity could report somebody
29112
+ * else's, and the whole point of this surface is that no claim is made by
29113
+ * anyone but its owner.
29114
+ */
29115
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
28910
29116
  var GetLoggingSettingsInputSchema = object({
28911
29117
  scopeNodeId: string().optional(),
28912
29118
  /**
@@ -28965,7 +29171,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
28965
29171
  }), method(_void(), SiteLocationStatusSchema, {
28966
29172
  kind: "mutation",
28967
29173
  auth: "admin"
28968
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29174
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
28969
29175
  kind: "mutation",
28970
29176
  auth: "admin"
28971
29177
  });
@@ -31989,6 +32195,12 @@ Object.freeze({
31989
32195
  addonId: null,
31990
32196
  access: "create"
31991
32197
  },
32198
+ "dataStoreProvider.insertMany": {
32199
+ capName: "data-store-provider",
32200
+ capScope: "system",
32201
+ addonId: null,
32202
+ access: "create"
32203
+ },
31992
32204
  "dataStoreProvider.isEmpty": {
31993
32205
  capName: "data-store-provider",
31994
32206
  capScope: "system",
@@ -33303,6 +33515,12 @@ Object.freeze({
33303
33515
  addonId: null,
33304
33516
  access: "create"
33305
33517
  },
33518
+ "loadContribution.list": {
33519
+ capName: "load-contribution",
33520
+ capScope: "system",
33521
+ addonId: null,
33522
+ access: "view"
33523
+ },
33306
33524
  "localNetwork.downloadCa": {
33307
33525
  capName: "local-network",
33308
33526
  capScope: "system",
@@ -33603,17 +33821,17 @@ Object.freeze({
33603
33821
  addonId: null,
33604
33822
  access: "view"
33605
33823
  },
33606
- "metricsProvider.getProcessStats": {
33824
+ "metricsProvider.getLoadSeries": {
33607
33825
  capName: "metrics-provider",
33608
33826
  capScope: "system",
33609
33827
  addonId: null,
33610
33828
  access: "view"
33611
33829
  },
33612
- "metricsProvider.killProcess": {
33830
+ "metricsProvider.getProcessStats": {
33613
33831
  capName: "metrics-provider",
33614
33832
  capScope: "system",
33615
33833
  addonId: null,
33616
- access: "create"
33834
+ access: "view"
33617
33835
  },
33618
33836
  "metricsProvider.listAddonInstances": {
33619
33837
  capName: "metrics-provider",
@@ -35625,6 +35843,12 @@ Object.freeze({
35625
35843
  addonId: null,
35626
35844
  access: "create"
35627
35845
  },
35846
+ "settingsStore.insertMany": {
35847
+ capName: "settings-store",
35848
+ capScope: "system",
35849
+ addonId: null,
35850
+ access: "create"
35851
+ },
35628
35852
  "settingsStore.isEmpty": {
35629
35853
  capName: "settings-store",
35630
35854
  capScope: "system",
@@ -36237,6 +36461,12 @@ Object.freeze({
36237
36461
  addonId: null,
36238
36462
  access: "create"
36239
36463
  },
36464
+ "system.getLoadContributions": {
36465
+ capName: "system",
36466
+ capScope: "system",
36467
+ addonId: null,
36468
+ access: "view"
36469
+ },
36240
36470
  "system.getLoggingSettings": {
36241
36471
  capName: "system",
36242
36472
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-gree",
3
- "version": "0.2.34",
3
+ "version": "0.2.35",
4
4
  "description": "Gree air-conditioner device-provider addon for CamStack — wraps the @apocaliss92/nodegree local-UDP client (LAN discovery + AES control), exposing climate-control and fan-control",
5
5
  "keywords": [
6
6
  "camstack",