@camstack/addon-provider-hikvision 1.2.41 → 1.2.43

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
@@ -6,7 +6,7 @@ let node_crypto = require("node:crypto");
6
6
  let node_http = require("node:http");
7
7
  let node_https = require("node:https");
8
8
  let node_os = require("node:os");
9
- //#region ../types/dist/event-category-CIa_iT6b.mjs
9
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
10
10
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
11
11
  EventCategory["SystemBoot"] = "system.boot";
12
12
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -443,7 +443,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
443
443
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
444
444
  /**
445
445
  * Periodic per-node process-tree snapshot (camstack-related pids
446
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
446
+ * with root / managed / system classification). Emitted ~0.2 Hz by
447
447
  * the metrics-provider addon. Drives the Cluster → Processes tab
448
448
  * without polling `metricsProvider.listNodeProcesses`.
449
449
  */
@@ -11410,6 +11410,19 @@ var SettingsRecordSchema = object({
11410
11410
  data: record(string(), unknown())
11411
11411
  });
11412
11412
  /**
11413
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11414
+ * optional.
11415
+ *
11416
+ * A separate schema rather than loosening the shared one: every other method
11417
+ * on this cap addresses a row BY its id, and making that field optional
11418
+ * everywhere would turn a forgotten key into a silently generated one on
11419
+ * `update` and `delete` as well.
11420
+ */
11421
+ var BulkRecordSchema = object({
11422
+ id: string().optional(),
11423
+ data: record(string(), unknown())
11424
+ });
11425
+ /**
11413
11426
  * Column declaration for a structured (SQL-backed) collection.
11414
11427
  *
11415
11428
  * Logical types — the backend translates each to the matching SQLite
@@ -11466,6 +11479,10 @@ method(object({
11466
11479
  collection: string(),
11467
11480
  record: SettingsRecordSchema
11468
11481
  }), _void(), { kind: "mutation" }), method(object({
11482
+ namespace: string().optional(),
11483
+ collection: string(),
11484
+ records: array(BulkRecordSchema).readonly()
11485
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11469
11486
  namespace: string().optional(),
11470
11487
  collection: string(),
11471
11488
  id: string(),
@@ -11574,6 +11591,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11574
11591
  }), _void(), {
11575
11592
  kind: "mutation",
11576
11593
  auth: "admin"
11594
+ }), method(object({
11595
+ namespace: string().optional(),
11596
+ collection: string(),
11597
+ records: array(BulkRecordSchema).readonly()
11598
+ }), object({ inserted: number().int() }), {
11599
+ kind: "mutation",
11600
+ auth: "admin"
11577
11601
  }), method(object({
11578
11602
  namespace: string().optional(),
11579
11603
  collection: string(),
@@ -13504,6 +13528,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13504
13528
  limit: number().optional(),
13505
13529
  tags: record(string(), string()).optional()
13506
13530
  }), array(LogEntrySchema).readonly());
13531
+ var LoadContributionSchema = object({
13532
+ role: _enum([
13533
+ "decode",
13534
+ "transcode",
13535
+ "recording",
13536
+ "streaming",
13537
+ "detection"
13538
+ ]),
13539
+ /**
13540
+ * The NUMERIC device id — the same value every log line carries as
13541
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13542
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13543
+ * contributor that cannot name its camera must not emit the entry at all,
13544
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13545
+ * and would quietly turn one camera's cost into everybody's.
13546
+ */
13547
+ deviceId: number().int().positive().nullable(),
13548
+ attribution: _enum([
13549
+ "measured",
13550
+ "accounted",
13551
+ "unattributable"
13552
+ ]),
13553
+ /**
13554
+ * What ONE entry is, in the contributor's own words — `615/high`,
13555
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13556
+ * family and inventing a common one would lose the only information that
13557
+ * makes two entries for the same camera distinguishable.
13558
+ */
13559
+ unit: string(),
13560
+ /**
13561
+ * The OS process this cost lives in, when there is one. Present so a
13562
+ * consumer can (a) tell two generations of the same unit apart across a
13563
+ * restart, and (b) subtract claimed processes from the node's process
13564
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13565
+ * process of its own.
13566
+ */
13567
+ pid: number().int().positive().optional(),
13568
+ /**
13569
+ * When this generation started. The pid's incarnation marker: a consumer
13570
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13571
+ * window when this changes, because the counter restarted from zero in a new
13572
+ * process.
13573
+ */
13574
+ startedAtMs: number().optional(),
13575
+ /**
13576
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13577
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13578
+ * contribution is asked for.
13579
+ *
13580
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13581
+ * needs a sampler, and a new per-node sampler is the defect half of
13582
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13583
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13584
+ *
13585
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13586
+ * an entry with no process.
13587
+ */
13588
+ cpuSeconds: number().optional(),
13589
+ /** Resident bytes of this unit's process, same source and same rules. */
13590
+ rssBytes: number().optional()
13591
+ });
13592
+ method(_void(), array(LoadContributionSchema).readonly());
13507
13593
  /**
13508
13594
  * `login-method` — collection cap through which auth addons contribute
13509
13595
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13707,8 +13793,7 @@ var NodeProcessSchema = object({
13707
13793
  classification: _enum([
13708
13794
  "root",
13709
13795
  "managed",
13710
- "system",
13711
- "ghost"
13796
+ "system"
13712
13797
  ]),
13713
13798
  /** `$process` addon binding when `managed`, else null. */
13714
13799
  addonId: string().nullable(),
@@ -13716,22 +13801,39 @@ var NodeProcessSchema = object({
13716
13801
  nodeId: string().nullable(),
13717
13802
  /** Truncated command line. */
13718
13803
  command: string(),
13804
+ /**
13805
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13806
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13807
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13808
+ */
13719
13809
  cpuPercent: number(),
13720
13810
  memoryRssBytes: number(),
13811
+ /**
13812
+ * Instantaneous CPU% of the process's own threads over the last
13813
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13814
+ *
13815
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13816
+ * boot), the pid was recycled, or this node is not Linux.
13817
+ */
13818
+ cpuMainPercent: number().nullable(),
13819
+ /**
13820
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13821
+ *
13822
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13823
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13824
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13825
+ * "allocating too much".
13826
+ *
13827
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13828
+ * (background compilation runs there too), so it is reported as
13829
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13830
+ * meaning as on `cpuMainPercent`.
13831
+ */
13832
+ cpuGcPercent: number().nullable(),
13833
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13834
+ threadCount: number().nullable(),
13721
13835
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13722
- uptimeSec: number(),
13723
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13724
- orphaned: boolean()
13725
- });
13726
- var KillProcessInputSchema = object({
13727
- pid: number(),
13728
- /** Force = SIGKILL. Default is SIGTERM. */
13729
- force: boolean().optional()
13730
- });
13731
- var KillProcessResultSchema = object({
13732
- success: boolean(),
13733
- reason: string().optional(),
13734
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13836
+ uptimeSec: number()
13735
13837
  });
13736
13838
  var DumpHeapSnapshotInputSchema = object({
13737
13839
  /** The addon whose runner should dump a heap snapshot. */
@@ -13744,6 +13846,104 @@ var DumpHeapSnapshotResultSchema = object({
13744
13846
  pid: number().optional(),
13745
13847
  reason: string().optional()
13746
13848
  });
13849
+ /**
13850
+ * One point of one function's series.
13851
+ *
13852
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13853
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13854
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13855
+ * Either would give us a tool built to find peaks that does not show peaks.
13856
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13857
+ * into the bucket, and a mean stays derivable where it is wanted.
13858
+ *
13859
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13860
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13861
+ * caller cannot tell which it received — which is what "one reader" means.
13862
+ */
13863
+ var LoadPointSchema = object({
13864
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13865
+ atMs: number(),
13866
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13867
+ samples: number().int(),
13868
+ /**
13869
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13870
+ * of every snapshot in it reported a thread split. A partial sum is a
13871
+ * smaller number that looks exactly as real as a complete one.
13872
+ */
13873
+ cpuMainPercent: number().nullable(),
13874
+ cpuMainPercentMin: number().nullable(),
13875
+ cpuGcPercent: number().nullable(),
13876
+ cpuGcPercentMin: number().nullable(),
13877
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13878
+ cpuLifetimePercent: number(),
13879
+ cpuLifetimePercentMin: number(),
13880
+ memoryRssBytes: number(),
13881
+ memoryRssBytesMin: number(),
13882
+ processCount: number().int(),
13883
+ processCountMin: number().int()
13884
+ });
13885
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13886
+ var LoadFunctionSeriesSchema = object({
13887
+ key: string(),
13888
+ kind: _enum([
13889
+ "addon",
13890
+ "root",
13891
+ "unattributed"
13892
+ ]),
13893
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13894
+ points: array(LoadPointSchema).readonly()
13895
+ });
13896
+ var NodeLoadSeriesSchema = object({
13897
+ nodeId: string(),
13898
+ /** One entry per function seen in the window, heaviest-first. */
13899
+ series: array(LoadFunctionSeriesSchema).readonly(),
13900
+ /**
13901
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13902
+ * reduction was needed — so a caller can always say what one point covers
13903
+ * without having to know whether it was reduced.
13904
+ */
13905
+ bucketMs: number(),
13906
+ /** Raw snapshots that went into this answer, across both tiers. */
13907
+ retainedSamples: number(),
13908
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13909
+ oldestAtMs: number().nullable(),
13910
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13911
+ cadenceMs: number(),
13912
+ /**
13913
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13914
+ * alone — an agent (which holds no table), or a store that refused.
13915
+ * Reported because "the last hour" and "the last six hours" are different
13916
+ * questions and an operator must not have to guess which was answered.
13917
+ */
13918
+ durable: boolean()
13919
+ });
13920
+ var GetLoadSeriesInputSchema = object({
13921
+ /**
13922
+ * The node whose series is wanted.
13923
+ *
13924
+ * NOT named `nodeId`: the generated cap router strips a top-level
13925
+ * `nodeId` from every method input and uses it to ROUTE the call to
13926
+ * that node's provider (`generated-cap-routers.ts`). A series target
13927
+ * called `nodeId` would silently become a routing pin and never reach
13928
+ * the provider. The hub holds every node it hears from, so the
13929
+ * ordinary call is unpinned — answered by the hub, for any node.
13930
+ */
13931
+ forNodeId: string(),
13932
+ /**
13933
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13934
+ * holds and receives only what it is missing, so seeding a live chart
13935
+ * from this method cannot double a point already drawn.
13936
+ */
13937
+ sinceMs: number().optional(),
13938
+ /**
13939
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13940
+ * preserving min and max per bucket.
13941
+ *
13942
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13943
+ * long one, which is why a chart passes its own pixel width.
13944
+ */
13945
+ maxPoints: number().int().positive().optional()
13946
+ });
13747
13947
  var SystemMetricsSchema = object({
13748
13948
  cpuPercent: number(),
13749
13949
  memoryPercent: number(),
@@ -13754,10 +13954,7 @@ var SystemMetricsSchema = object({
13754
13954
  gpuPercent: number().optional(),
13755
13955
  gpuMemoryPercent: number().optional()
13756
13956
  });
13757
- 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, {
13758
- kind: "mutation",
13759
- auth: "admin"
13760
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13957
+ 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, {
13761
13958
  kind: "mutation",
13762
13959
  auth: "admin"
13763
13960
  });
@@ -29522,6 +29719,15 @@ var LoggingSettingsPatchSchema = object({
29522
29719
  * authority over the whole hierarchy and answers for every layer, so the
29523
29720
  * layer selector needs a name the transport does not already own.
29524
29721
  */
29722
+ /**
29723
+ * One contribution, plus WHO reported it.
29724
+ *
29725
+ * The addon and node are added by the hub as it enumerates providers, never by
29726
+ * the contributor: an addon reporting its own identity could report somebody
29727
+ * else's, and the whole point of this surface is that no claim is made by
29728
+ * anyone but its owner.
29729
+ */
29730
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29525
29731
  var GetLoggingSettingsInputSchema = object({
29526
29732
  scopeNodeId: string().optional(),
29527
29733
  /**
@@ -29580,7 +29786,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29580
29786
  }), method(_void(), SiteLocationStatusSchema, {
29581
29787
  kind: "mutation",
29582
29788
  auth: "admin"
29583
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29789
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29584
29790
  kind: "mutation",
29585
29791
  auth: "admin"
29586
29792
  });
@@ -32837,6 +33043,12 @@ Object.freeze({
32837
33043
  addonId: null,
32838
33044
  access: "create"
32839
33045
  },
33046
+ "dataStoreProvider.insertMany": {
33047
+ capName: "data-store-provider",
33048
+ capScope: "system",
33049
+ addonId: null,
33050
+ access: "create"
33051
+ },
32840
33052
  "dataStoreProvider.isEmpty": {
32841
33053
  capName: "data-store-provider",
32842
33054
  capScope: "system",
@@ -34151,6 +34363,12 @@ Object.freeze({
34151
34363
  addonId: null,
34152
34364
  access: "create"
34153
34365
  },
34366
+ "loadContribution.list": {
34367
+ capName: "load-contribution",
34368
+ capScope: "system",
34369
+ addonId: null,
34370
+ access: "view"
34371
+ },
34154
34372
  "localNetwork.downloadCa": {
34155
34373
  capName: "local-network",
34156
34374
  capScope: "system",
@@ -34451,17 +34669,17 @@ Object.freeze({
34451
34669
  addonId: null,
34452
34670
  access: "view"
34453
34671
  },
34454
- "metricsProvider.getProcessStats": {
34672
+ "metricsProvider.getLoadSeries": {
34455
34673
  capName: "metrics-provider",
34456
34674
  capScope: "system",
34457
34675
  addonId: null,
34458
34676
  access: "view"
34459
34677
  },
34460
- "metricsProvider.killProcess": {
34678
+ "metricsProvider.getProcessStats": {
34461
34679
  capName: "metrics-provider",
34462
34680
  capScope: "system",
34463
34681
  addonId: null,
34464
- access: "create"
34682
+ access: "view"
34465
34683
  },
34466
34684
  "metricsProvider.listAddonInstances": {
34467
34685
  capName: "metrics-provider",
@@ -36473,6 +36691,12 @@ Object.freeze({
36473
36691
  addonId: null,
36474
36692
  access: "create"
36475
36693
  },
36694
+ "settingsStore.insertMany": {
36695
+ capName: "settings-store",
36696
+ capScope: "system",
36697
+ addonId: null,
36698
+ access: "create"
36699
+ },
36476
36700
  "settingsStore.isEmpty": {
36477
36701
  capName: "settings-store",
36478
36702
  capScope: "system",
@@ -37085,6 +37309,12 @@ Object.freeze({
37085
37309
  addonId: null,
37086
37310
  access: "create"
37087
37311
  },
37312
+ "system.getLoadContributions": {
37313
+ capName: "system",
37314
+ capScope: "system",
37315
+ addonId: null,
37316
+ access: "view"
37317
+ },
37088
37318
  "system.getLoggingSettings": {
37089
37319
  capName: "system",
37090
37320
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7,7 +7,7 @@ import { networkInterfaces } from "node:os";
7
7
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
8
8
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
9
9
  //#endregion
10
- //#region ../types/dist/event-category-CIa_iT6b.mjs
10
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
11
11
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
12
12
  EventCategory["SystemBoot"] = "system.boot";
13
13
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -444,7 +444,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
444
444
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
445
445
  /**
446
446
  * Periodic per-node process-tree snapshot (camstack-related pids
447
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
447
+ * with root / managed / system classification). Emitted ~0.2 Hz by
448
448
  * the metrics-provider addon. Drives the Cluster → Processes tab
449
449
  * without polling `metricsProvider.listNodeProcesses`.
450
450
  */
@@ -11411,6 +11411,19 @@ var SettingsRecordSchema = object({
11411
11411
  data: record(string(), unknown())
11412
11412
  });
11413
11413
  /**
11414
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
11415
+ * optional.
11416
+ *
11417
+ * A separate schema rather than loosening the shared one: every other method
11418
+ * on this cap addresses a row BY its id, and making that field optional
11419
+ * everywhere would turn a forgotten key into a silently generated one on
11420
+ * `update` and `delete` as well.
11421
+ */
11422
+ var BulkRecordSchema = object({
11423
+ id: string().optional(),
11424
+ data: record(string(), unknown())
11425
+ });
11426
+ /**
11414
11427
  * Column declaration for a structured (SQL-backed) collection.
11415
11428
  *
11416
11429
  * Logical types — the backend translates each to the matching SQLite
@@ -11467,6 +11480,10 @@ method(object({
11467
11480
  collection: string(),
11468
11481
  record: SettingsRecordSchema
11469
11482
  }), _void(), { kind: "mutation" }), method(object({
11483
+ namespace: string().optional(),
11484
+ collection: string(),
11485
+ records: array(BulkRecordSchema).readonly()
11486
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
11470
11487
  namespace: string().optional(),
11471
11488
  collection: string(),
11472
11489
  id: string(),
@@ -11575,6 +11592,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11575
11592
  }), _void(), {
11576
11593
  kind: "mutation",
11577
11594
  auth: "admin"
11595
+ }), method(object({
11596
+ namespace: string().optional(),
11597
+ collection: string(),
11598
+ records: array(BulkRecordSchema).readonly()
11599
+ }), object({ inserted: number().int() }), {
11600
+ kind: "mutation",
11601
+ auth: "admin"
11578
11602
  }), method(object({
11579
11603
  namespace: string().optional(),
11580
11604
  collection: string(),
@@ -13505,6 +13529,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13505
13529
  limit: number().optional(),
13506
13530
  tags: record(string(), string()).optional()
13507
13531
  }), array(LogEntrySchema).readonly());
13532
+ var LoadContributionSchema = object({
13533
+ role: _enum([
13534
+ "decode",
13535
+ "transcode",
13536
+ "recording",
13537
+ "streaming",
13538
+ "detection"
13539
+ ]),
13540
+ /**
13541
+ * The NUMERIC device id — the same value every log line carries as
13542
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13543
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13544
+ * contributor that cannot name its camera must not emit the entry at all,
13545
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13546
+ * and would quietly turn one camera's cost into everybody's.
13547
+ */
13548
+ deviceId: number().int().positive().nullable(),
13549
+ attribution: _enum([
13550
+ "measured",
13551
+ "accounted",
13552
+ "unattributable"
13553
+ ]),
13554
+ /**
13555
+ * What ONE entry is, in the contributor's own words — `615/high`,
13556
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13557
+ * family and inventing a common one would lose the only information that
13558
+ * makes two entries for the same camera distinguishable.
13559
+ */
13560
+ unit: string(),
13561
+ /**
13562
+ * The OS process this cost lives in, when there is one. Present so a
13563
+ * consumer can (a) tell two generations of the same unit apart across a
13564
+ * restart, and (b) subtract claimed processes from the node's process
13565
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13566
+ * process of its own.
13567
+ */
13568
+ pid: number().int().positive().optional(),
13569
+ /**
13570
+ * When this generation started. The pid's incarnation marker: a consumer
13571
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13572
+ * window when this changes, because the counter restarted from zero in a new
13573
+ * process.
13574
+ */
13575
+ startedAtMs: number().optional(),
13576
+ /**
13577
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13578
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13579
+ * contribution is asked for.
13580
+ *
13581
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13582
+ * needs a sampler, and a new per-node sampler is the defect half of
13583
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13584
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13585
+ *
13586
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13587
+ * an entry with no process.
13588
+ */
13589
+ cpuSeconds: number().optional(),
13590
+ /** Resident bytes of this unit's process, same source and same rules. */
13591
+ rssBytes: number().optional()
13592
+ });
13593
+ method(_void(), array(LoadContributionSchema).readonly());
13508
13594
  /**
13509
13595
  * `login-method` — collection cap through which auth addons contribute
13510
13596
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -13708,8 +13794,7 @@ var NodeProcessSchema = object({
13708
13794
  classification: _enum([
13709
13795
  "root",
13710
13796
  "managed",
13711
- "system",
13712
- "ghost"
13797
+ "system"
13713
13798
  ]),
13714
13799
  /** `$process` addon binding when `managed`, else null. */
13715
13800
  addonId: string().nullable(),
@@ -13717,22 +13802,39 @@ var NodeProcessSchema = object({
13717
13802
  nodeId: string().nullable(),
13718
13803
  /** Truncated command line. */
13719
13804
  command: string(),
13805
+ /**
13806
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
13807
+ * On a runner up for days it barely moves. Fine as a column, useless as a
13808
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
13809
+ */
13720
13810
  cpuPercent: number(),
13721
13811
  memoryRssBytes: number(),
13812
+ /**
13813
+ * Instantaneous CPU% of the process's own threads over the last
13814
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
13815
+ *
13816
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
13817
+ * boot), the pid was recycled, or this node is not Linux.
13818
+ */
13819
+ cpuMainPercent: number().nullable(),
13820
+ /**
13821
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
13822
+ *
13823
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
13824
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
13825
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
13826
+ * "allocating too much".
13827
+ *
13828
+ * Concurrent GC is the dominant tenant of that pool but not the only one
13829
+ * (background compilation runs there too), so it is reported as
13830
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
13831
+ * meaning as on `cpuMainPercent`.
13832
+ */
13833
+ cpuGcPercent: number().nullable(),
13834
+ /** Threads seen in the tick scan. `null` under the same conditions. */
13835
+ threadCount: number().nullable(),
13722
13836
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
13723
- uptimeSec: number(),
13724
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
13725
- orphaned: boolean()
13726
- });
13727
- var KillProcessInputSchema = object({
13728
- pid: number(),
13729
- /** Force = SIGKILL. Default is SIGTERM. */
13730
- force: boolean().optional()
13731
- });
13732
- var KillProcessResultSchema = object({
13733
- success: boolean(),
13734
- reason: string().optional(),
13735
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
13837
+ uptimeSec: number()
13736
13838
  });
13737
13839
  var DumpHeapSnapshotInputSchema = object({
13738
13840
  /** The addon whose runner should dump a heap snapshot. */
@@ -13745,6 +13847,104 @@ var DumpHeapSnapshotResultSchema = object({
13745
13847
  pid: number().optional(),
13746
13848
  reason: string().optional()
13747
13849
  });
13850
+ /**
13851
+ * One point of one function's series.
13852
+ *
13853
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
13854
+ * point of the whole surface. The two obvious reductions both lie: a mean per
13855
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
13856
+ * Either would give us a tool built to find peaks that does not show peaks.
13857
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
13858
+ * into the bucket, and a mean stays derivable where it is wanted.
13859
+ *
13860
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
13861
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
13862
+ * caller cannot tell which it received — which is what "one reader" means.
13863
+ */
13864
+ var LoadPointSchema = object({
13865
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
13866
+ atMs: number(),
13867
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
13868
+ samples: number().int(),
13869
+ /**
13870
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
13871
+ * of every snapshot in it reported a thread split. A partial sum is a
13872
+ * smaller number that looks exactly as real as a complete one.
13873
+ */
13874
+ cpuMainPercent: number().nullable(),
13875
+ cpuMainPercentMin: number().nullable(),
13876
+ cpuGcPercent: number().nullable(),
13877
+ cpuGcPercentMin: number().nullable(),
13878
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
13879
+ cpuLifetimePercent: number(),
13880
+ cpuLifetimePercentMin: number(),
13881
+ memoryRssBytes: number(),
13882
+ memoryRssBytesMin: number(),
13883
+ processCount: number().int(),
13884
+ processCountMin: number().int()
13885
+ });
13886
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
13887
+ var LoadFunctionSeriesSchema = object({
13888
+ key: string(),
13889
+ kind: _enum([
13890
+ "addon",
13891
+ "root",
13892
+ "unattributed"
13893
+ ]),
13894
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
13895
+ points: array(LoadPointSchema).readonly()
13896
+ });
13897
+ var NodeLoadSeriesSchema = object({
13898
+ nodeId: string(),
13899
+ /** One entry per function seen in the window, heaviest-first. */
13900
+ series: array(LoadFunctionSeriesSchema).readonly(),
13901
+ /**
13902
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
13903
+ * reduction was needed — so a caller can always say what one point covers
13904
+ * without having to know whether it was reduced.
13905
+ */
13906
+ bucketMs: number(),
13907
+ /** Raw snapshots that went into this answer, across both tiers. */
13908
+ retainedSamples: number(),
13909
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
13910
+ oldestAtMs: number().nullable(),
13911
+ /** The fixed sampling cadence in force on the cluster, in ms. */
13912
+ cadenceMs: number(),
13913
+ /**
13914
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
13915
+ * alone — an agent (which holds no table), or a store that refused.
13916
+ * Reported because "the last hour" and "the last six hours" are different
13917
+ * questions and an operator must not have to guess which was answered.
13918
+ */
13919
+ durable: boolean()
13920
+ });
13921
+ var GetLoadSeriesInputSchema = object({
13922
+ /**
13923
+ * The node whose series is wanted.
13924
+ *
13925
+ * NOT named `nodeId`: the generated cap router strips a top-level
13926
+ * `nodeId` from every method input and uses it to ROUTE the call to
13927
+ * that node's provider (`generated-cap-routers.ts`). A series target
13928
+ * called `nodeId` would silently become a routing pin and never reach
13929
+ * the provider. The hub holds every node it hears from, so the
13930
+ * ordinary call is unpinned — answered by the hub, for any node.
13931
+ */
13932
+ forNodeId: string(),
13933
+ /**
13934
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
13935
+ * holds and receives only what it is missing, so seeding a live chart
13936
+ * from this method cannot double a point already drawn.
13937
+ */
13938
+ sinceMs: number().optional(),
13939
+ /**
13940
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
13941
+ * preserving min and max per bucket.
13942
+ *
13943
+ * Absent means NO reduction — legitimate for a short window and a trap for a
13944
+ * long one, which is why a chart passes its own pixel width.
13945
+ */
13946
+ maxPoints: number().int().positive().optional()
13947
+ });
13748
13948
  var SystemMetricsSchema = object({
13749
13949
  cpuPercent: number(),
13750
13950
  memoryPercent: number(),
@@ -13755,10 +13955,7 @@ var SystemMetricsSchema = object({
13755
13955
  gpuPercent: number().optional(),
13756
13956
  gpuMemoryPercent: number().optional()
13757
13957
  });
13758
- 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, {
13759
- kind: "mutation",
13760
- auth: "admin"
13761
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
13958
+ 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, {
13762
13959
  kind: "mutation",
13763
13960
  auth: "admin"
13764
13961
  });
@@ -29523,6 +29720,15 @@ var LoggingSettingsPatchSchema = object({
29523
29720
  * authority over the whole hierarchy and answers for every layer, so the
29524
29721
  * layer selector needs a name the transport does not already own.
29525
29722
  */
29723
+ /**
29724
+ * One contribution, plus WHO reported it.
29725
+ *
29726
+ * The addon and node are added by the hub as it enumerates providers, never by
29727
+ * the contributor: an addon reporting its own identity could report somebody
29728
+ * else's, and the whole point of this surface is that no claim is made by
29729
+ * anyone but its owner.
29730
+ */
29731
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29526
29732
  var GetLoggingSettingsInputSchema = object({
29527
29733
  scopeNodeId: string().optional(),
29528
29734
  /**
@@ -29581,7 +29787,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29581
29787
  }), method(_void(), SiteLocationStatusSchema, {
29582
29788
  kind: "mutation",
29583
29789
  auth: "admin"
29584
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29790
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29585
29791
  kind: "mutation",
29586
29792
  auth: "admin"
29587
29793
  });
@@ -32838,6 +33044,12 @@ Object.freeze({
32838
33044
  addonId: null,
32839
33045
  access: "create"
32840
33046
  },
33047
+ "dataStoreProvider.insertMany": {
33048
+ capName: "data-store-provider",
33049
+ capScope: "system",
33050
+ addonId: null,
33051
+ access: "create"
33052
+ },
32841
33053
  "dataStoreProvider.isEmpty": {
32842
33054
  capName: "data-store-provider",
32843
33055
  capScope: "system",
@@ -34152,6 +34364,12 @@ Object.freeze({
34152
34364
  addonId: null,
34153
34365
  access: "create"
34154
34366
  },
34367
+ "loadContribution.list": {
34368
+ capName: "load-contribution",
34369
+ capScope: "system",
34370
+ addonId: null,
34371
+ access: "view"
34372
+ },
34155
34373
  "localNetwork.downloadCa": {
34156
34374
  capName: "local-network",
34157
34375
  capScope: "system",
@@ -34452,17 +34670,17 @@ Object.freeze({
34452
34670
  addonId: null,
34453
34671
  access: "view"
34454
34672
  },
34455
- "metricsProvider.getProcessStats": {
34673
+ "metricsProvider.getLoadSeries": {
34456
34674
  capName: "metrics-provider",
34457
34675
  capScope: "system",
34458
34676
  addonId: null,
34459
34677
  access: "view"
34460
34678
  },
34461
- "metricsProvider.killProcess": {
34679
+ "metricsProvider.getProcessStats": {
34462
34680
  capName: "metrics-provider",
34463
34681
  capScope: "system",
34464
34682
  addonId: null,
34465
- access: "create"
34683
+ access: "view"
34466
34684
  },
34467
34685
  "metricsProvider.listAddonInstances": {
34468
34686
  capName: "metrics-provider",
@@ -36474,6 +36692,12 @@ Object.freeze({
36474
36692
  addonId: null,
36475
36693
  access: "create"
36476
36694
  },
36695
+ "settingsStore.insertMany": {
36696
+ capName: "settings-store",
36697
+ capScope: "system",
36698
+ addonId: null,
36699
+ access: "create"
36700
+ },
36477
36701
  "settingsStore.isEmpty": {
36478
36702
  capName: "settings-store",
36479
36703
  capScope: "system",
@@ -37086,6 +37310,12 @@ Object.freeze({
37086
37310
  addonId: null,
37087
37311
  access: "create"
37088
37312
  },
37313
+ "system.getLoadContributions": {
37314
+ capName: "system",
37315
+ capScope: "system",
37316
+ addonId: null,
37317
+ access: "view"
37318
+ },
37089
37319
  "system.getLoggingSettings": {
37090
37320
  capName: "system",
37091
37321
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-hikvision",
3
- "version": "1.2.41",
3
+ "version": "1.2.43",
4
4
  "description": "Hikvision camera device provider addon for CamStack — ISAPI over HTTP(S) with digest auth (snapshot, alarm stream, RTSP discovery)",
5
5
  "keywords": [
6
6
  "camstack",