@camstack/addon-provider-amcrest 0.2.36 → 0.2.38

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
@@ -4,7 +4,7 @@ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).expor
4
4
  //#endregion
5
5
  let node_crypto = require("node:crypto");
6
6
  let node_os = require("node:os");
7
- //#region ../types/dist/event-category-CIa_iT6b.mjs
7
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
8
8
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
9
9
  EventCategory["SystemBoot"] = "system.boot";
10
10
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -441,7 +441,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
441
441
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
442
442
  /**
443
443
  * Periodic per-node process-tree snapshot (camstack-related pids
444
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
444
+ * with root / managed / system classification). Emitted ~0.2 Hz by
445
445
  * the metrics-provider addon. Drives the Cluster → Processes tab
446
446
  * without polling `metricsProvider.listNodeProcesses`.
447
447
  */
@@ -11221,6 +11221,19 @@ var SettingsRecordSchema = object({
11221
11221
  data: record(string(), unknown())
11222
11222
  });
11223
11223
  /**
11224
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11225
+ * optional.
11226
+ *
11227
+ * A separate schema rather than loosening the shared one: every other method
11228
+ * on this cap addresses a row BY its id, and making that field optional
11229
+ * everywhere would turn a forgotten key into a silently generated one on
11230
+ * `update` and `delete` as well.
11231
+ */
11232
+ var BulkRecordSchema = object({
11233
+ id: string().optional(),
11234
+ data: record(string(), unknown())
11235
+ });
11236
+ /**
11224
11237
  * Column declaration for a structured (SQL-backed) collection.
11225
11238
  *
11226
11239
  * Logical types — the backend translates each to the matching SQLite
@@ -11277,6 +11290,10 @@ method(object({
11277
11290
  collection: string(),
11278
11291
  record: SettingsRecordSchema
11279
11292
  }), _void(), { kind: "mutation" }), method(object({
11293
+ namespace: string().optional(),
11294
+ collection: string(),
11295
+ records: array(BulkRecordSchema).readonly()
11296
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11280
11297
  namespace: string().optional(),
11281
11298
  collection: string(),
11282
11299
  id: string(),
@@ -11385,6 +11402,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11385
11402
  }), _void(), {
11386
11403
  kind: "mutation",
11387
11404
  auth: "admin"
11405
+ }), method(object({
11406
+ namespace: string().optional(),
11407
+ collection: string(),
11408
+ records: array(BulkRecordSchema).readonly()
11409
+ }), object({ inserted: number().int() }), {
11410
+ kind: "mutation",
11411
+ auth: "admin"
11388
11412
  }), method(object({
11389
11413
  namespace: string().optional(),
11390
11414
  collection: string(),
@@ -13315,6 +13339,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13315
13339
  limit: number().optional(),
13316
13340
  tags: record(string(), string()).optional()
13317
13341
  }), array(LogEntrySchema).readonly());
13342
+ var LoadContributionSchema = object({
13343
+ role: _enum([
13344
+ "decode",
13345
+ "transcode",
13346
+ "recording",
13347
+ "streaming",
13348
+ "detection"
13349
+ ]),
13350
+ /**
13351
+ * The NUMERIC device id — the same value every log line carries as
13352
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13353
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13354
+ * contributor that cannot name its camera must not emit the entry at all,
13355
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13356
+ * and would quietly turn one camera's cost into everybody's.
13357
+ */
13358
+ deviceId: number().int().positive().nullable(),
13359
+ attribution: _enum([
13360
+ "measured",
13361
+ "accounted",
13362
+ "unattributable"
13363
+ ]),
13364
+ /**
13365
+ * What ONE entry is, in the contributor's own words — `615/high`,
13366
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13367
+ * family and inventing a common one would lose the only information that
13368
+ * makes two entries for the same camera distinguishable.
13369
+ */
13370
+ unit: string(),
13371
+ /**
13372
+ * The OS process this cost lives in, when there is one. Present so a
13373
+ * consumer can (a) tell two generations of the same unit apart across a
13374
+ * restart, and (b) subtract claimed processes from the node's process
13375
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13376
+ * process of its own.
13377
+ */
13378
+ pid: number().int().positive().optional(),
13379
+ /**
13380
+ * When this generation started. The pid's incarnation marker: a consumer
13381
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13382
+ * window when this changes, because the counter restarted from zero in a new
13383
+ * process.
13384
+ */
13385
+ startedAtMs: number().optional(),
13386
+ /**
13387
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13388
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13389
+ * contribution is asked for.
13390
+ *
13391
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13392
+ * needs a sampler, and a new per-node sampler is the defect half of
13393
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13394
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13395
+ *
13396
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13397
+ * an entry with no process.
13398
+ */
13399
+ cpuSeconds: number().optional(),
13400
+ /** Resident bytes of this unit's process, same source and same rules. */
13401
+ rssBytes: number().optional()
13402
+ });
13403
+ method(_void(), array(LoadContributionSchema).readonly());
13318
13404
  /**
13319
13405
  * `login-method` — collection cap through which auth addons contribute
13320
13406
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13518,8 +13604,7 @@ var NodeProcessSchema = object({
13518
13604
  classification: _enum([
13519
13605
  "root",
13520
13606
  "managed",
13521
- "system",
13522
- "ghost"
13607
+ "system"
13523
13608
  ]),
13524
13609
  /** `$process` addon binding when `managed`, else null. */
13525
13610
  addonId: string().nullable(),
@@ -13527,22 +13612,39 @@ var NodeProcessSchema = object({
13527
13612
  nodeId: string().nullable(),
13528
13613
  /** Truncated command line. */
13529
13614
  command: string(),
13615
+ /**
13616
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13617
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13618
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13619
+ */
13530
13620
  cpuPercent: number(),
13531
13621
  memoryRssBytes: number(),
13622
+ /**
13623
+ * Instantaneous CPU% of the process's own threads over the last
13624
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13625
+ *
13626
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13627
+ * boot), the pid was recycled, or this node is not Linux.
13628
+ */
13629
+ cpuMainPercent: number().nullable(),
13630
+ /**
13631
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13632
+ *
13633
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13634
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13635
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13636
+ * "allocating too much".
13637
+ *
13638
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13639
+ * (background compilation runs there too), so it is reported as
13640
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13641
+ * meaning as on `cpuMainPercent`.
13642
+ */
13643
+ cpuGcPercent: number().nullable(),
13644
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13645
+ threadCount: number().nullable(),
13532
13646
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13533
- uptimeSec: number(),
13534
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13535
- orphaned: boolean()
13536
- });
13537
- var KillProcessInputSchema = object({
13538
- pid: number(),
13539
- /** Force = SIGKILL. Default is SIGTERM. */
13540
- force: boolean().optional()
13541
- });
13542
- var KillProcessResultSchema = object({
13543
- success: boolean(),
13544
- reason: string().optional(),
13545
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13647
+ uptimeSec: number()
13546
13648
  });
13547
13649
  var DumpHeapSnapshotInputSchema = object({
13548
13650
  /** The addon whose runner should dump a heap snapshot. */
@@ -13555,6 +13657,104 @@ var DumpHeapSnapshotResultSchema = object({
13555
13657
  pid: number().optional(),
13556
13658
  reason: string().optional()
13557
13659
  });
13660
+ /**
13661
+ * One point of one function's series.
13662
+ *
13663
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13664
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13665
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13666
+ * Either would give us a tool built to find peaks that does not show peaks.
13667
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13668
+ * into the bucket, and a mean stays derivable where it is wanted.
13669
+ *
13670
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13671
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13672
+ * caller cannot tell which it received — which is what "one reader" means.
13673
+ */
13674
+ var LoadPointSchema = object({
13675
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13676
+ atMs: number(),
13677
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13678
+ samples: number().int(),
13679
+ /**
13680
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13681
+ * of every snapshot in it reported a thread split. A partial sum is a
13682
+ * smaller number that looks exactly as real as a complete one.
13683
+ */
13684
+ cpuMainPercent: number().nullable(),
13685
+ cpuMainPercentMin: number().nullable(),
13686
+ cpuGcPercent: number().nullable(),
13687
+ cpuGcPercentMin: number().nullable(),
13688
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13689
+ cpuLifetimePercent: number(),
13690
+ cpuLifetimePercentMin: number(),
13691
+ memoryRssBytes: number(),
13692
+ memoryRssBytesMin: number(),
13693
+ processCount: number().int(),
13694
+ processCountMin: number().int()
13695
+ });
13696
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13697
+ var LoadFunctionSeriesSchema = object({
13698
+ key: string(),
13699
+ kind: _enum([
13700
+ "addon",
13701
+ "root",
13702
+ "unattributed"
13703
+ ]),
13704
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13705
+ points: array(LoadPointSchema).readonly()
13706
+ });
13707
+ var NodeLoadSeriesSchema = object({
13708
+ nodeId: string(),
13709
+ /** One entry per function seen in the window, heaviest-first. */
13710
+ series: array(LoadFunctionSeriesSchema).readonly(),
13711
+ /**
13712
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13713
+ * reduction was needed — so a caller can always say what one point covers
13714
+ * without having to know whether it was reduced.
13715
+ */
13716
+ bucketMs: number(),
13717
+ /** Raw snapshots that went into this answer, across both tiers. */
13718
+ retainedSamples: number(),
13719
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13720
+ oldestAtMs: number().nullable(),
13721
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13722
+ cadenceMs: number(),
13723
+ /**
13724
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13725
+ * alone — an agent (which holds no table), or a store that refused.
13726
+ * Reported because "the last hour" and "the last six hours" are different
13727
+ * questions and an operator must not have to guess which was answered.
13728
+ */
13729
+ durable: boolean()
13730
+ });
13731
+ var GetLoadSeriesInputSchema = object({
13732
+ /**
13733
+ * The node whose series is wanted.
13734
+ *
13735
+ * NOT named `nodeId`: the generated cap router strips a top-level
13736
+ * `nodeId` from every method input and uses it to ROUTE the call to
13737
+ * that node's provider (`generated-cap-routers.ts`). A series target
13738
+ * called `nodeId` would silently become a routing pin and never reach
13739
+ * the provider. The hub holds every node it hears from, so the
13740
+ * ordinary call is unpinned — answered by the hub, for any node.
13741
+ */
13742
+ forNodeId: string(),
13743
+ /**
13744
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13745
+ * holds and receives only what it is missing, so seeding a live chart
13746
+ * from this method cannot double a point already drawn.
13747
+ */
13748
+ sinceMs: number().optional(),
13749
+ /**
13750
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13751
+ * preserving min and max per bucket.
13752
+ *
13753
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13754
+ * long one, which is why a chart passes its own pixel width.
13755
+ */
13756
+ maxPoints: number().int().positive().optional()
13757
+ });
13558
13758
  var SystemMetricsSchema = object({
13559
13759
  cpuPercent: number(),
13560
13760
  memoryPercent: number(),
@@ -13565,10 +13765,7 @@ var SystemMetricsSchema = object({
13565
13765
  gpuPercent: number().optional(),
13566
13766
  gpuMemoryPercent: number().optional()
13567
13767
  });
13568
- 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, {
13569
- kind: "mutation",
13570
- auth: "admin"
13571
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13768
+ 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, {
13572
13769
  kind: "mutation",
13573
13770
  auth: "admin"
13574
13771
  });
@@ -29288,6 +29485,15 @@ var LoggingSettingsPatchSchema = object({
29288
29485
  * authority over the whole hierarchy and answers for every layer, so the
29289
29486
  * layer selector needs a name the transport does not already own.
29290
29487
  */
29488
+ /**
29489
+ * One contribution, plus WHO reported it.
29490
+ *
29491
+ * The addon and node are added by the hub as it enumerates providers, never by
29492
+ * the contributor: an addon reporting its own identity could report somebody
29493
+ * else's, and the whole point of this surface is that no claim is made by
29494
+ * anyone but its owner.
29495
+ */
29496
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29291
29497
  var GetLoggingSettingsInputSchema = object({
29292
29498
  scopeNodeId: string().optional(),
29293
29499
  /**
@@ -29346,7 +29552,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29346
29552
  }), method(_void(), SiteLocationStatusSchema, {
29347
29553
  kind: "mutation",
29348
29554
  auth: "admin"
29349
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29555
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29350
29556
  kind: "mutation",
29351
29557
  auth: "admin"
29352
29558
  });
@@ -32576,6 +32782,12 @@ Object.freeze({
32576
32782
  addonId: null,
32577
32783
  access: "create"
32578
32784
  },
32785
+ "dataStoreProvider.insertMany": {
32786
+ capName: "data-store-provider",
32787
+ capScope: "system",
32788
+ addonId: null,
32789
+ access: "create"
32790
+ },
32579
32791
  "dataStoreProvider.isEmpty": {
32580
32792
  capName: "data-store-provider",
32581
32793
  capScope: "system",
@@ -33890,6 +34102,12 @@ Object.freeze({
33890
34102
  addonId: null,
33891
34103
  access: "create"
33892
34104
  },
34105
+ "loadContribution.list": {
34106
+ capName: "load-contribution",
34107
+ capScope: "system",
34108
+ addonId: null,
34109
+ access: "view"
34110
+ },
33893
34111
  "localNetwork.downloadCa": {
33894
34112
  capName: "local-network",
33895
34113
  capScope: "system",
@@ -34190,17 +34408,17 @@ Object.freeze({
34190
34408
  addonId: null,
34191
34409
  access: "view"
34192
34410
  },
34193
- "metricsProvider.getProcessStats": {
34411
+ "metricsProvider.getLoadSeries": {
34194
34412
  capName: "metrics-provider",
34195
34413
  capScope: "system",
34196
34414
  addonId: null,
34197
34415
  access: "view"
34198
34416
  },
34199
- "metricsProvider.killProcess": {
34417
+ "metricsProvider.getProcessStats": {
34200
34418
  capName: "metrics-provider",
34201
34419
  capScope: "system",
34202
34420
  addonId: null,
34203
- access: "create"
34421
+ access: "view"
34204
34422
  },
34205
34423
  "metricsProvider.listAddonInstances": {
34206
34424
  capName: "metrics-provider",
@@ -36212,6 +36430,12 @@ Object.freeze({
36212
36430
  addonId: null,
36213
36431
  access: "create"
36214
36432
  },
36433
+ "settingsStore.insertMany": {
36434
+ capName: "settings-store",
36435
+ capScope: "system",
36436
+ addonId: null,
36437
+ access: "create"
36438
+ },
36215
36439
  "settingsStore.isEmpty": {
36216
36440
  capName: "settings-store",
36217
36441
  capScope: "system",
@@ -36824,6 +37048,12 @@ Object.freeze({
36824
37048
  addonId: null,
36825
37049
  access: "create"
36826
37050
  },
37051
+ "system.getLoadContributions": {
37052
+ capName: "system",
37053
+ capScope: "system",
37054
+ addonId: null,
37055
+ access: "view"
37056
+ },
36827
37057
  "system.getLoggingSettings": {
36828
37058
  capName: "system",
36829
37059
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -5,7 +5,7 @@ import { networkInterfaces } from "node:os";
5
5
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
6
6
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
7
7
  //#endregion
8
- //#region ../types/dist/event-category-CIa_iT6b.mjs
8
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
9
9
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
10
10
  EventCategory["SystemBoot"] = "system.boot";
11
11
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -442,7 +442,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
442
442
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
443
443
  /**
444
444
  * Periodic per-node process-tree snapshot (camstack-related pids
445
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
445
+ * with root / managed / system classification). Emitted ~0.2 Hz by
446
446
  * the metrics-provider addon. Drives the Cluster → Processes tab
447
447
  * without polling `metricsProvider.listNodeProcesses`.
448
448
  */
@@ -11222,6 +11222,19 @@ var SettingsRecordSchema = object({
11222
11222
  data: record(string(), unknown())
11223
11223
  });
11224
11224
  /**
11225
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11226
+ * optional.
11227
+ *
11228
+ * A separate schema rather than loosening the shared one: every other method
11229
+ * on this cap addresses a row BY its id, and making that field optional
11230
+ * everywhere would turn a forgotten key into a silently generated one on
11231
+ * `update` and `delete` as well.
11232
+ */
11233
+ var BulkRecordSchema = object({
11234
+ id: string().optional(),
11235
+ data: record(string(), unknown())
11236
+ });
11237
+ /**
11225
11238
  * Column declaration for a structured (SQL-backed) collection.
11226
11239
  *
11227
11240
  * Logical types — the backend translates each to the matching SQLite
@@ -11278,6 +11291,10 @@ method(object({
11278
11291
  collection: string(),
11279
11292
  record: SettingsRecordSchema
11280
11293
  }), _void(), { kind: "mutation" }), method(object({
11294
+ namespace: string().optional(),
11295
+ collection: string(),
11296
+ records: array(BulkRecordSchema).readonly()
11297
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11281
11298
  namespace: string().optional(),
11282
11299
  collection: string(),
11283
11300
  id: string(),
@@ -11386,6 +11403,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11386
11403
  }), _void(), {
11387
11404
  kind: "mutation",
11388
11405
  auth: "admin"
11406
+ }), method(object({
11407
+ namespace: string().optional(),
11408
+ collection: string(),
11409
+ records: array(BulkRecordSchema).readonly()
11410
+ }), object({ inserted: number().int() }), {
11411
+ kind: "mutation",
11412
+ auth: "admin"
11389
11413
  }), method(object({
11390
11414
  namespace: string().optional(),
11391
11415
  collection: string(),
@@ -13316,6 +13340,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13316
13340
  limit: number().optional(),
13317
13341
  tags: record(string(), string()).optional()
13318
13342
  }), array(LogEntrySchema).readonly());
13343
+ var LoadContributionSchema = object({
13344
+ role: _enum([
13345
+ "decode",
13346
+ "transcode",
13347
+ "recording",
13348
+ "streaming",
13349
+ "detection"
13350
+ ]),
13351
+ /**
13352
+ * The NUMERIC device id — the same value every log line carries as
13353
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13354
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13355
+ * contributor that cannot name its camera must not emit the entry at all,
13356
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13357
+ * and would quietly turn one camera's cost into everybody's.
13358
+ */
13359
+ deviceId: number().int().positive().nullable(),
13360
+ attribution: _enum([
13361
+ "measured",
13362
+ "accounted",
13363
+ "unattributable"
13364
+ ]),
13365
+ /**
13366
+ * What ONE entry is, in the contributor's own words — `615/high`,
13367
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13368
+ * family and inventing a common one would lose the only information that
13369
+ * makes two entries for the same camera distinguishable.
13370
+ */
13371
+ unit: string(),
13372
+ /**
13373
+ * The OS process this cost lives in, when there is one. Present so a
13374
+ * consumer can (a) tell two generations of the same unit apart across a
13375
+ * restart, and (b) subtract claimed processes from the node's process
13376
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13377
+ * process of its own.
13378
+ */
13379
+ pid: number().int().positive().optional(),
13380
+ /**
13381
+ * When this generation started. The pid's incarnation marker: a consumer
13382
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13383
+ * window when this changes, because the counter restarted from zero in a new
13384
+ * process.
13385
+ */
13386
+ startedAtMs: number().optional(),
13387
+ /**
13388
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13389
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13390
+ * contribution is asked for.
13391
+ *
13392
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13393
+ * needs a sampler, and a new per-node sampler is the defect half of
13394
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13395
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13396
+ *
13397
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13398
+ * an entry with no process.
13399
+ */
13400
+ cpuSeconds: number().optional(),
13401
+ /** Resident bytes of this unit's process, same source and same rules. */
13402
+ rssBytes: number().optional()
13403
+ });
13404
+ method(_void(), array(LoadContributionSchema).readonly());
13319
13405
  /**
13320
13406
  * `login-method` — collection cap through which auth addons contribute
13321
13407
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13519,8 +13605,7 @@ var NodeProcessSchema = object({
13519
13605
  classification: _enum([
13520
13606
  "root",
13521
13607
  "managed",
13522
- "system",
13523
- "ghost"
13608
+ "system"
13524
13609
  ]),
13525
13610
  /** `$process` addon binding when `managed`, else null. */
13526
13611
  addonId: string().nullable(),
@@ -13528,22 +13613,39 @@ var NodeProcessSchema = object({
13528
13613
  nodeId: string().nullable(),
13529
13614
  /** Truncated command line. */
13530
13615
  command: string(),
13616
+ /**
13617
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13618
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13619
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13620
+ */
13531
13621
  cpuPercent: number(),
13532
13622
  memoryRssBytes: number(),
13623
+ /**
13624
+ * Instantaneous CPU% of the process's own threads over the last
13625
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13626
+ *
13627
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13628
+ * boot), the pid was recycled, or this node is not Linux.
13629
+ */
13630
+ cpuMainPercent: number().nullable(),
13631
+ /**
13632
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13633
+ *
13634
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13635
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13636
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13637
+ * "allocating too much".
13638
+ *
13639
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13640
+ * (background compilation runs there too), so it is reported as
13641
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13642
+ * meaning as on `cpuMainPercent`.
13643
+ */
13644
+ cpuGcPercent: number().nullable(),
13645
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13646
+ threadCount: number().nullable(),
13533
13647
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13534
- uptimeSec: number(),
13535
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13536
- orphaned: boolean()
13537
- });
13538
- var KillProcessInputSchema = object({
13539
- pid: number(),
13540
- /** Force = SIGKILL. Default is SIGTERM. */
13541
- force: boolean().optional()
13542
- });
13543
- var KillProcessResultSchema = object({
13544
- success: boolean(),
13545
- reason: string().optional(),
13546
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13648
+ uptimeSec: number()
13547
13649
  });
13548
13650
  var DumpHeapSnapshotInputSchema = object({
13549
13651
  /** The addon whose runner should dump a heap snapshot. */
@@ -13556,6 +13658,104 @@ var DumpHeapSnapshotResultSchema = object({
13556
13658
  pid: number().optional(),
13557
13659
  reason: string().optional()
13558
13660
  });
13661
+ /**
13662
+ * One point of one function's series.
13663
+ *
13664
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13665
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13666
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13667
+ * Either would give us a tool built to find peaks that does not show peaks.
13668
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13669
+ * into the bucket, and a mean stays derivable where it is wanted.
13670
+ *
13671
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13672
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13673
+ * caller cannot tell which it received — which is what "one reader" means.
13674
+ */
13675
+ var LoadPointSchema = object({
13676
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13677
+ atMs: number(),
13678
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13679
+ samples: number().int(),
13680
+ /**
13681
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13682
+ * of every snapshot in it reported a thread split. A partial sum is a
13683
+ * smaller number that looks exactly as real as a complete one.
13684
+ */
13685
+ cpuMainPercent: number().nullable(),
13686
+ cpuMainPercentMin: number().nullable(),
13687
+ cpuGcPercent: number().nullable(),
13688
+ cpuGcPercentMin: number().nullable(),
13689
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13690
+ cpuLifetimePercent: number(),
13691
+ cpuLifetimePercentMin: number(),
13692
+ memoryRssBytes: number(),
13693
+ memoryRssBytesMin: number(),
13694
+ processCount: number().int(),
13695
+ processCountMin: number().int()
13696
+ });
13697
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13698
+ var LoadFunctionSeriesSchema = object({
13699
+ key: string(),
13700
+ kind: _enum([
13701
+ "addon",
13702
+ "root",
13703
+ "unattributed"
13704
+ ]),
13705
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13706
+ points: array(LoadPointSchema).readonly()
13707
+ });
13708
+ var NodeLoadSeriesSchema = object({
13709
+ nodeId: string(),
13710
+ /** One entry per function seen in the window, heaviest-first. */
13711
+ series: array(LoadFunctionSeriesSchema).readonly(),
13712
+ /**
13713
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13714
+ * reduction was needed — so a caller can always say what one point covers
13715
+ * without having to know whether it was reduced.
13716
+ */
13717
+ bucketMs: number(),
13718
+ /** Raw snapshots that went into this answer, across both tiers. */
13719
+ retainedSamples: number(),
13720
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13721
+ oldestAtMs: number().nullable(),
13722
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13723
+ cadenceMs: number(),
13724
+ /**
13725
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13726
+ * alone — an agent (which holds no table), or a store that refused.
13727
+ * Reported because "the last hour" and "the last six hours" are different
13728
+ * questions and an operator must not have to guess which was answered.
13729
+ */
13730
+ durable: boolean()
13731
+ });
13732
+ var GetLoadSeriesInputSchema = object({
13733
+ /**
13734
+ * The node whose series is wanted.
13735
+ *
13736
+ * NOT named `nodeId`: the generated cap router strips a top-level
13737
+ * `nodeId` from every method input and uses it to ROUTE the call to
13738
+ * that node's provider (`generated-cap-routers.ts`). A series target
13739
+ * called `nodeId` would silently become a routing pin and never reach
13740
+ * the provider. The hub holds every node it hears from, so the
13741
+ * ordinary call is unpinned — answered by the hub, for any node.
13742
+ */
13743
+ forNodeId: string(),
13744
+ /**
13745
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13746
+ * holds and receives only what it is missing, so seeding a live chart
13747
+ * from this method cannot double a point already drawn.
13748
+ */
13749
+ sinceMs: number().optional(),
13750
+ /**
13751
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13752
+ * preserving min and max per bucket.
13753
+ *
13754
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13755
+ * long one, which is why a chart passes its own pixel width.
13756
+ */
13757
+ maxPoints: number().int().positive().optional()
13758
+ });
13559
13759
  var SystemMetricsSchema = object({
13560
13760
  cpuPercent: number(),
13561
13761
  memoryPercent: number(),
@@ -13566,10 +13766,7 @@ var SystemMetricsSchema = object({
13566
13766
  gpuPercent: number().optional(),
13567
13767
  gpuMemoryPercent: number().optional()
13568
13768
  });
13569
- 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, {
13570
- kind: "mutation",
13571
- auth: "admin"
13572
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13769
+ 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, {
13573
13770
  kind: "mutation",
13574
13771
  auth: "admin"
13575
13772
  });
@@ -29289,6 +29486,15 @@ var LoggingSettingsPatchSchema = object({
29289
29486
  * authority over the whole hierarchy and answers for every layer, so the
29290
29487
  * layer selector needs a name the transport does not already own.
29291
29488
  */
29489
+ /**
29490
+ * One contribution, plus WHO reported it.
29491
+ *
29492
+ * The addon and node are added by the hub as it enumerates providers, never by
29493
+ * the contributor: an addon reporting its own identity could report somebody
29494
+ * else's, and the whole point of this surface is that no claim is made by
29495
+ * anyone but its owner.
29496
+ */
29497
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29292
29498
  var GetLoggingSettingsInputSchema = object({
29293
29499
  scopeNodeId: string().optional(),
29294
29500
  /**
@@ -29347,7 +29553,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29347
29553
  }), method(_void(), SiteLocationStatusSchema, {
29348
29554
  kind: "mutation",
29349
29555
  auth: "admin"
29350
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29556
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29351
29557
  kind: "mutation",
29352
29558
  auth: "admin"
29353
29559
  });
@@ -32577,6 +32783,12 @@ Object.freeze({
32577
32783
  addonId: null,
32578
32784
  access: "create"
32579
32785
  },
32786
+ "dataStoreProvider.insertMany": {
32787
+ capName: "data-store-provider",
32788
+ capScope: "system",
32789
+ addonId: null,
32790
+ access: "create"
32791
+ },
32580
32792
  "dataStoreProvider.isEmpty": {
32581
32793
  capName: "data-store-provider",
32582
32794
  capScope: "system",
@@ -33891,6 +34103,12 @@ Object.freeze({
33891
34103
  addonId: null,
33892
34104
  access: "create"
33893
34105
  },
34106
+ "loadContribution.list": {
34107
+ capName: "load-contribution",
34108
+ capScope: "system",
34109
+ addonId: null,
34110
+ access: "view"
34111
+ },
33894
34112
  "localNetwork.downloadCa": {
33895
34113
  capName: "local-network",
33896
34114
  capScope: "system",
@@ -34191,17 +34409,17 @@ Object.freeze({
34191
34409
  addonId: null,
34192
34410
  access: "view"
34193
34411
  },
34194
- "metricsProvider.getProcessStats": {
34412
+ "metricsProvider.getLoadSeries": {
34195
34413
  capName: "metrics-provider",
34196
34414
  capScope: "system",
34197
34415
  addonId: null,
34198
34416
  access: "view"
34199
34417
  },
34200
- "metricsProvider.killProcess": {
34418
+ "metricsProvider.getProcessStats": {
34201
34419
  capName: "metrics-provider",
34202
34420
  capScope: "system",
34203
34421
  addonId: null,
34204
- access: "create"
34422
+ access: "view"
34205
34423
  },
34206
34424
  "metricsProvider.listAddonInstances": {
34207
34425
  capName: "metrics-provider",
@@ -36213,6 +36431,12 @@ Object.freeze({
36213
36431
  addonId: null,
36214
36432
  access: "create"
36215
36433
  },
36434
+ "settingsStore.insertMany": {
36435
+ capName: "settings-store",
36436
+ capScope: "system",
36437
+ addonId: null,
36438
+ access: "create"
36439
+ },
36216
36440
  "settingsStore.isEmpty": {
36217
36441
  capName: "settings-store",
36218
36442
  capScope: "system",
@@ -36825,6 +37049,12 @@ Object.freeze({
36825
37049
  addonId: null,
36826
37050
  access: "create"
36827
37051
  },
37052
+ "system.getLoadContributions": {
37053
+ capName: "system",
37054
+ capScope: "system",
37055
+ addonId: null,
37056
+ access: "view"
37057
+ },
36828
37058
  "system.getLoggingSettings": {
36829
37059
  capName: "system",
36830
37060
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.2.36",
3
+ "version": "0.2.38",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",