@camstack/addon-provider-tuya 0.2.34 → 0.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +255 -25
  2. package/dist/addon.mjs +255 -25
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -819,7 +819,7 @@ async function discoverDevices(options = {}, binder = createDgramBinder()) {
819
819
  return [...byId.values()];
820
820
  }
821
821
  //#endregion
822
- //#region ../types/dist/event-category-CIa_iT6b.mjs
822
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
823
823
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
824
824
  EventCategory["SystemBoot"] = "system.boot";
825
825
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1256,7 +1256,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1256
1256
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
1257
1257
  /**
1258
1258
  * Periodic per-node process-tree snapshot (camstack-related pids
1259
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
1259
+ * with root / managed / system classification). Emitted ~0.2 Hz by
1260
1260
  * the metrics-provider addon. Drives the Cluster → Processes tab
1261
1261
  * without polling `metricsProvider.listNodeProcesses`.
1262
1262
  */
@@ -12048,6 +12048,19 @@ var SettingsRecordSchema = object({
12048
12048
  data: record(string(), unknown())
12049
12049
  });
12050
12050
  /**
12051
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
12052
+ * optional.
12053
+ *
12054
+ * A separate schema rather than loosening the shared one: every other method
12055
+ * on this cap addresses a row BY its id, and making that field optional
12056
+ * everywhere would turn a forgotten key into a silently generated one on
12057
+ * `update` and `delete` as well.
12058
+ */
12059
+ var BulkRecordSchema = object({
12060
+ id: string().optional(),
12061
+ data: record(string(), unknown())
12062
+ });
12063
+ /**
12051
12064
  * Column declaration for a structured (SQL-backed) collection.
12052
12065
  *
12053
12066
  * Logical types — the backend translates each to the matching SQLite
@@ -12104,6 +12117,10 @@ method(object({
12104
12117
  collection: string(),
12105
12118
  record: SettingsRecordSchema
12106
12119
  }), _void(), { kind: "mutation" }), method(object({
12120
+ namespace: string().optional(),
12121
+ collection: string(),
12122
+ records: array(BulkRecordSchema).readonly()
12123
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
12107
12124
  namespace: string().optional(),
12108
12125
  collection: string(),
12109
12126
  id: string(),
@@ -12212,6 +12229,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12212
12229
  }), _void(), {
12213
12230
  kind: "mutation",
12214
12231
  auth: "admin"
12232
+ }), method(object({
12233
+ namespace: string().optional(),
12234
+ collection: string(),
12235
+ records: array(BulkRecordSchema).readonly()
12236
+ }), object({ inserted: number().int() }), {
12237
+ kind: "mutation",
12238
+ auth: "admin"
12215
12239
  }), method(object({
12216
12240
  namespace: string().optional(),
12217
12241
  collection: string(),
@@ -14159,6 +14183,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14159
14183
  limit: number().optional(),
14160
14184
  tags: record(string(), string()).optional()
14161
14185
  }), array(LogEntrySchema).readonly());
14186
+ var LoadContributionSchema = object({
14187
+ role: _enum([
14188
+ "decode",
14189
+ "transcode",
14190
+ "recording",
14191
+ "streaming",
14192
+ "detection"
14193
+ ]),
14194
+ /**
14195
+ * The NUMERIC device id — the same value every log line carries as
14196
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14197
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14198
+ * contributor that cannot name its camera must not emit the entry at all,
14199
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14200
+ * and would quietly turn one camera's cost into everybody's.
14201
+ */
14202
+ deviceId: number().int().positive().nullable(),
14203
+ attribution: _enum([
14204
+ "measured",
14205
+ "accounted",
14206
+ "unattributable"
14207
+ ]),
14208
+ /**
14209
+ * What ONE entry is, in the contributor's own words — `615/high`,
14210
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14211
+ * family and inventing a common one would lose the only information that
14212
+ * makes two entries for the same camera distinguishable.
14213
+ */
14214
+ unit: string(),
14215
+ /**
14216
+ * The OS process this cost lives in, when there is one. Present so a
14217
+ * consumer can (a) tell two generations of the same unit apart across a
14218
+ * restart, and (b) subtract claimed processes from the node's process
14219
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14220
+ * process of its own.
14221
+ */
14222
+ pid: number().int().positive().optional(),
14223
+ /**
14224
+ * When this generation started. The pid's incarnation marker: a consumer
14225
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14226
+ * window when this changes, because the counter restarted from zero in a new
14227
+ * process.
14228
+ */
14229
+ startedAtMs: number().optional(),
14230
+ /**
14231
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14232
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14233
+ * contribution is asked for.
14234
+ *
14235
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14236
+ * needs a sampler, and a new per-node sampler is the defect half of
14237
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14238
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14239
+ *
14240
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14241
+ * an entry with no process.
14242
+ */
14243
+ cpuSeconds: number().optional(),
14244
+ /** Resident bytes of this unit's process, same source and same rules. */
14245
+ rssBytes: number().optional()
14246
+ });
14247
+ method(_void(), array(LoadContributionSchema).readonly());
14162
14248
  /**
14163
14249
  * `login-method` — collection cap through which auth addons contribute
14164
14250
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -14362,8 +14448,7 @@ var NodeProcessSchema = object({
14362
14448
  classification: _enum([
14363
14449
  "root",
14364
14450
  "managed",
14365
- "system",
14366
- "ghost"
14451
+ "system"
14367
14452
  ]),
14368
14453
  /** `$process` addon binding when `managed`, else null. */
14369
14454
  addonId: string().nullable(),
@@ -14371,22 +14456,39 @@ var NodeProcessSchema = object({
14371
14456
  nodeId: string().nullable(),
14372
14457
  /** Truncated command line. */
14373
14458
  command: string(),
14459
+ /**
14460
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
14461
+ * On a runner up for days it barely moves. Fine as a column, useless as a
14462
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
14463
+ */
14374
14464
  cpuPercent: number(),
14375
14465
  memoryRssBytes: number(),
14466
+ /**
14467
+ * Instantaneous CPU% of the process's own threads over the last
14468
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
14469
+ *
14470
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
14471
+ * boot), the pid was recycled, or this node is not Linux.
14472
+ */
14473
+ cpuMainPercent: number().nullable(),
14474
+ /**
14475
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
14476
+ *
14477
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
14478
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
14479
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
14480
+ * "allocating too much".
14481
+ *
14482
+ * Concurrent GC is the dominant tenant of that pool but not the only one
14483
+ * (background compilation runs there too), so it is reported as
14484
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
14485
+ * meaning as on `cpuMainPercent`.
14486
+ */
14487
+ cpuGcPercent: number().nullable(),
14488
+ /** Threads seen in the tick scan. `null` under the same conditions. */
14489
+ threadCount: number().nullable(),
14376
14490
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
14377
- uptimeSec: number(),
14378
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
14379
- orphaned: boolean()
14380
- });
14381
- var KillProcessInputSchema = object({
14382
- pid: number(),
14383
- /** Force = SIGKILL. Default is SIGTERM. */
14384
- force: boolean().optional()
14385
- });
14386
- var KillProcessResultSchema = object({
14387
- success: boolean(),
14388
- reason: string().optional(),
14389
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
14491
+ uptimeSec: number()
14390
14492
  });
14391
14493
  var DumpHeapSnapshotInputSchema = object({
14392
14494
  /** The addon whose runner should dump a heap snapshot. */
@@ -14399,6 +14501,104 @@ var DumpHeapSnapshotResultSchema = object({
14399
14501
  pid: number().optional(),
14400
14502
  reason: string().optional()
14401
14503
  });
14504
+ /**
14505
+ * One point of one function's series.
14506
+ *
14507
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
14508
+ * point of the whole surface. The two obvious reductions both lie: a mean per
14509
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
14510
+ * Either would give us a tool built to find peaks that does not show peaks.
14511
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
14512
+ * into the bucket, and a mean stays derivable where it is wanted.
14513
+ *
14514
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
14515
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
14516
+ * caller cannot tell which it received — which is what "one reader" means.
14517
+ */
14518
+ var LoadPointSchema = object({
14519
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
14520
+ atMs: number(),
14521
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
14522
+ samples: number().int(),
14523
+ /**
14524
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
14525
+ * of every snapshot in it reported a thread split. A partial sum is a
14526
+ * smaller number that looks exactly as real as a complete one.
14527
+ */
14528
+ cpuMainPercent: number().nullable(),
14529
+ cpuMainPercentMin: number().nullable(),
14530
+ cpuGcPercent: number().nullable(),
14531
+ cpuGcPercentMin: number().nullable(),
14532
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
14533
+ cpuLifetimePercent: number(),
14534
+ cpuLifetimePercentMin: number(),
14535
+ memoryRssBytes: number(),
14536
+ memoryRssBytesMin: number(),
14537
+ processCount: number().int(),
14538
+ processCountMin: number().int()
14539
+ });
14540
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
14541
+ var LoadFunctionSeriesSchema = object({
14542
+ key: string(),
14543
+ kind: _enum([
14544
+ "addon",
14545
+ "root",
14546
+ "unattributed"
14547
+ ]),
14548
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
14549
+ points: array(LoadPointSchema).readonly()
14550
+ });
14551
+ var NodeLoadSeriesSchema = object({
14552
+ nodeId: string(),
14553
+ /** One entry per function seen in the window, heaviest-first. */
14554
+ series: array(LoadFunctionSeriesSchema).readonly(),
14555
+ /**
14556
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
14557
+ * reduction was needed — so a caller can always say what one point covers
14558
+ * without having to know whether it was reduced.
14559
+ */
14560
+ bucketMs: number(),
14561
+ /** Raw snapshots that went into this answer, across both tiers. */
14562
+ retainedSamples: number(),
14563
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
14564
+ oldestAtMs: number().nullable(),
14565
+ /** The fixed sampling cadence in force on the cluster, in ms. */
14566
+ cadenceMs: number(),
14567
+ /**
14568
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
14569
+ * alone — an agent (which holds no table), or a store that refused.
14570
+ * Reported because "the last hour" and "the last six hours" are different
14571
+ * questions and an operator must not have to guess which was answered.
14572
+ */
14573
+ durable: boolean()
14574
+ });
14575
+ var GetLoadSeriesInputSchema = object({
14576
+ /**
14577
+ * The node whose series is wanted.
14578
+ *
14579
+ * NOT named `nodeId`: the generated cap router strips a top-level
14580
+ * `nodeId` from every method input and uses it to ROUTE the call to
14581
+ * that node's provider (`generated-cap-routers.ts`). A series target
14582
+ * called `nodeId` would silently become a routing pin and never reach
14583
+ * the provider. The hub holds every node it hears from, so the
14584
+ * ordinary call is unpinned — answered by the hub, for any node.
14585
+ */
14586
+ forNodeId: string(),
14587
+ /**
14588
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
14589
+ * holds and receives only what it is missing, so seeding a live chart
14590
+ * from this method cannot double a point already drawn.
14591
+ */
14592
+ sinceMs: number().optional(),
14593
+ /**
14594
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
14595
+ * preserving min and max per bucket.
14596
+ *
14597
+ * Absent means NO reduction — legitimate for a short window and a trap for a
14598
+ * long one, which is why a chart passes its own pixel width.
14599
+ */
14600
+ maxPoints: number().int().positive().optional()
14601
+ });
14402
14602
  var SystemMetricsSchema = object({
14403
14603
  cpuPercent: number(),
14404
14604
  memoryPercent: number(),
@@ -14409,10 +14609,7 @@ var SystemMetricsSchema = object({
14409
14609
  gpuPercent: number().optional(),
14410
14610
  gpuMemoryPercent: number().optional()
14411
14611
  });
14412
- 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, {
14413
- kind: "mutation",
14414
- auth: "admin"
14415
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
14612
+ 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, {
14416
14613
  kind: "mutation",
14417
14614
  auth: "admin"
14418
14615
  });
@@ -29750,6 +29947,15 @@ var LoggingSettingsPatchSchema = object({
29750
29947
  * authority over the whole hierarchy and answers for every layer, so the
29751
29948
  * layer selector needs a name the transport does not already own.
29752
29949
  */
29950
+ /**
29951
+ * One contribution, plus WHO reported it.
29952
+ *
29953
+ * The addon and node are added by the hub as it enumerates providers, never by
29954
+ * the contributor: an addon reporting its own identity could report somebody
29955
+ * else's, and the whole point of this surface is that no claim is made by
29956
+ * anyone but its owner.
29957
+ */
29958
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29753
29959
  var GetLoggingSettingsInputSchema = object({
29754
29960
  scopeNodeId: string().optional(),
29755
29961
  /**
@@ -29808,7 +30014,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29808
30014
  }), method(_void(), SiteLocationStatusSchema, {
29809
30015
  kind: "mutation",
29810
30016
  auth: "admin"
29811
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
30017
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29812
30018
  kind: "mutation",
29813
30019
  auth: "admin"
29814
30020
  });
@@ -32832,6 +33038,12 @@ Object.freeze({
32832
33038
  addonId: null,
32833
33039
  access: "create"
32834
33040
  },
33041
+ "dataStoreProvider.insertMany": {
33042
+ capName: "data-store-provider",
33043
+ capScope: "system",
33044
+ addonId: null,
33045
+ access: "create"
33046
+ },
32835
33047
  "dataStoreProvider.isEmpty": {
32836
33048
  capName: "data-store-provider",
32837
33049
  capScope: "system",
@@ -34146,6 +34358,12 @@ Object.freeze({
34146
34358
  addonId: null,
34147
34359
  access: "create"
34148
34360
  },
34361
+ "loadContribution.list": {
34362
+ capName: "load-contribution",
34363
+ capScope: "system",
34364
+ addonId: null,
34365
+ access: "view"
34366
+ },
34149
34367
  "localNetwork.downloadCa": {
34150
34368
  capName: "local-network",
34151
34369
  capScope: "system",
@@ -34446,17 +34664,17 @@ Object.freeze({
34446
34664
  addonId: null,
34447
34665
  access: "view"
34448
34666
  },
34449
- "metricsProvider.getProcessStats": {
34667
+ "metricsProvider.getLoadSeries": {
34450
34668
  capName: "metrics-provider",
34451
34669
  capScope: "system",
34452
34670
  addonId: null,
34453
34671
  access: "view"
34454
34672
  },
34455
- "metricsProvider.killProcess": {
34673
+ "metricsProvider.getProcessStats": {
34456
34674
  capName: "metrics-provider",
34457
34675
  capScope: "system",
34458
34676
  addonId: null,
34459
- access: "create"
34677
+ access: "view"
34460
34678
  },
34461
34679
  "metricsProvider.listAddonInstances": {
34462
34680
  capName: "metrics-provider",
@@ -36468,6 +36686,12 @@ Object.freeze({
36468
36686
  addonId: null,
36469
36687
  access: "create"
36470
36688
  },
36689
+ "settingsStore.insertMany": {
36690
+ capName: "settings-store",
36691
+ capScope: "system",
36692
+ addonId: null,
36693
+ access: "create"
36694
+ },
36471
36695
  "settingsStore.isEmpty": {
36472
36696
  capName: "settings-store",
36473
36697
  capScope: "system",
@@ -37080,6 +37304,12 @@ Object.freeze({
37080
37304
  addonId: null,
37081
37305
  access: "create"
37082
37306
  },
37307
+ "system.getLoadContributions": {
37308
+ capName: "system",
37309
+ capScope: "system",
37310
+ addonId: null,
37311
+ access: "view"
37312
+ },
37083
37313
  "system.getLoggingSettings": {
37084
37314
  capName: "system",
37085
37315
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -818,7 +818,7 @@ async function discoverDevices(options = {}, binder = createDgramBinder()) {
818
818
  return [...byId.values()];
819
819
  }
820
820
  //#endregion
821
- //#region ../types/dist/event-category-CIa_iT6b.mjs
821
+ //#region ../types/dist/event-category-BZL-fdNj.mjs
822
822
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
823
823
  EventCategory["SystemBoot"] = "system.boot";
824
824
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1255,7 +1255,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1255
1255
  EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
1256
1256
  /**
1257
1257
  * Periodic per-node process-tree snapshot (camstack-related pids
1258
- * with ghost / managed / root classification). Emitted ~0.2 Hz by
1258
+ * with root / managed / system classification). Emitted ~0.2 Hz by
1259
1259
  * the metrics-provider addon. Drives the Cluster → Processes tab
1260
1260
  * without polling `metricsProvider.listNodeProcesses`.
1261
1261
  */
@@ -12047,6 +12047,19 @@ var SettingsRecordSchema = object({
12047
12047
  data: record(string(), unknown())
12048
12048
  });
12049
12049
  /**
12050
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
12051
+ * optional.
12052
+ *
12053
+ * A separate schema rather than loosening the shared one: every other method
12054
+ * on this cap addresses a row BY its id, and making that field optional
12055
+ * everywhere would turn a forgotten key into a silently generated one on
12056
+ * `update` and `delete` as well.
12057
+ */
12058
+ var BulkRecordSchema = object({
12059
+ id: string().optional(),
12060
+ data: record(string(), unknown())
12061
+ });
12062
+ /**
12050
12063
  * Column declaration for a structured (SQL-backed) collection.
12051
12064
  *
12052
12065
  * Logical types — the backend translates each to the matching SQLite
@@ -12103,6 +12116,10 @@ method(object({
12103
12116
  collection: string(),
12104
12117
  record: SettingsRecordSchema
12105
12118
  }), _void(), { kind: "mutation" }), method(object({
12119
+ namespace: string().optional(),
12120
+ collection: string(),
12121
+ records: array(BulkRecordSchema).readonly()
12122
+ }), object({ inserted: number().int() }), { kind: "mutation" }), method(object({
12106
12123
  namespace: string().optional(),
12107
12124
  collection: string(),
12108
12125
  id: string(),
@@ -12211,6 +12228,13 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
12211
12228
  }), _void(), {
12212
12229
  kind: "mutation",
12213
12230
  auth: "admin"
12231
+ }), method(object({
12232
+ namespace: string().optional(),
12233
+ collection: string(),
12234
+ records: array(BulkRecordSchema).readonly()
12235
+ }), object({ inserted: number().int() }), {
12236
+ kind: "mutation",
12237
+ auth: "admin"
12214
12238
  }), method(object({
12215
12239
  namespace: string().optional(),
12216
12240
  collection: string(),
@@ -14158,6 +14182,68 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14158
14182
  limit: number().optional(),
14159
14183
  tags: record(string(), string()).optional()
14160
14184
  }), array(LogEntrySchema).readonly());
14185
+ var LoadContributionSchema = object({
14186
+ role: _enum([
14187
+ "decode",
14188
+ "transcode",
14189
+ "recording",
14190
+ "streaming",
14191
+ "detection"
14192
+ ]),
14193
+ /**
14194
+ * The NUMERIC device id — the same value every log line carries as
14195
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14196
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14197
+ * contributor that cannot name its camera must not emit the entry at all,
14198
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14199
+ * and would quietly turn one camera's cost into everybody's.
14200
+ */
14201
+ deviceId: number().int().positive().nullable(),
14202
+ attribution: _enum([
14203
+ "measured",
14204
+ "accounted",
14205
+ "unattributable"
14206
+ ]),
14207
+ /**
14208
+ * What ONE entry is, in the contributor's own words — `615/high`,
14209
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14210
+ * family and inventing a common one would lose the only information that
14211
+ * makes two entries for the same camera distinguishable.
14212
+ */
14213
+ unit: string(),
14214
+ /**
14215
+ * The OS process this cost lives in, when there is one. Present so a
14216
+ * consumer can (a) tell two generations of the same unit apart across a
14217
+ * restart, and (b) subtract claimed processes from the node's process
14218
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14219
+ * process of its own.
14220
+ */
14221
+ pid: number().int().positive().optional(),
14222
+ /**
14223
+ * When this generation started. The pid's incarnation marker: a consumer
14224
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14225
+ * window when this changes, because the counter restarted from zero in a new
14226
+ * process.
14227
+ */
14228
+ startedAtMs: number().optional(),
14229
+ /**
14230
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14231
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14232
+ * contribution is asked for.
14233
+ *
14234
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14235
+ * needs a sampler, and a new per-node sampler is the defect half of
14236
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14237
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14238
+ *
14239
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14240
+ * an entry with no process.
14241
+ */
14242
+ cpuSeconds: number().optional(),
14243
+ /** Resident bytes of this unit's process, same source and same rules. */
14244
+ rssBytes: number().optional()
14245
+ });
14246
+ method(_void(), array(LoadContributionSchema).readonly());
14161
14247
  /**
14162
14248
  * `login-method` — collection cap through which auth addons contribute
14163
14249
  * their pre-auth login surfaces to the login page. This is the SINGLE,
@@ -14361,8 +14447,7 @@ var NodeProcessSchema = object({
14361
14447
  classification: _enum([
14362
14448
  "root",
14363
14449
  "managed",
14364
- "system",
14365
- "ghost"
14450
+ "system"
14366
14451
  ]),
14367
14452
  /** `$process` addon binding when `managed`, else null. */
14368
14453
  addonId: string().nullable(),
@@ -14370,22 +14455,39 @@ var NodeProcessSchema = object({
14370
14455
  nodeId: string().nullable(),
14371
14456
  /** Truncated command line. */
14372
14457
  command: string(),
14458
+ /**
14459
+ * `ps pcpu` — CPU averaged over the process's WHOLE LIFETIME, not a rate.
14460
+ * On a runner up for days it barely moves. Fine as a column, useless as a
14461
+ * series: use `cpuMainPercent + cpuGcPercent` for anything time-varying.
14462
+ */
14373
14463
  cpuPercent: number(),
14374
14464
  memoryRssBytes: number(),
14465
+ /**
14466
+ * Instantaneous CPU% of the process's own threads over the last
14467
+ * process-snapshot window, from a `/proc/<pid>/task/*` tick delta.
14468
+ *
14469
+ * `null` = UNKNOWN, never zero: no previous sample yet (first tick after
14470
+ * boot), the pid was recycled, or this node is not Linux.
14471
+ */
14472
+ cpuMainPercent: number().nullable(),
14473
+ /**
14474
+ * Instantaneous CPU% of V8's `V8Worker` platform pool over the same window.
14475
+ *
14476
+ * This is the number that rewrote the 2026-08-27 diagnosis — hub-main 73%,
14477
+ * `stream-broker` 61% (`docs/architecture/load-ledger.md`). A CPU chart that
14478
+ * does not separate it from `cpuMainPercent` shows "busy" where the truth is
14479
+ * "allocating too much".
14480
+ *
14481
+ * Concurrent GC is the dominant tenant of that pool but not the only one
14482
+ * (background compilation runs there too), so it is reported as
14483
+ * "GC / V8 helpers" rather than as pure collection time. `null` has the same
14484
+ * meaning as on `cpuMainPercent`.
14485
+ */
14486
+ cpuGcPercent: number().nullable(),
14487
+ /** Threads seen in the tick scan. `null` under the same conditions. */
14488
+ threadCount: number().nullable(),
14375
14489
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
14376
- uptimeSec: number(),
14377
- /** True when ancestor walk reaches `ppid=1` (reparented to init/launchd). */
14378
- orphaned: boolean()
14379
- });
14380
- var KillProcessInputSchema = object({
14381
- pid: number(),
14382
- /** Force = SIGKILL. Default is SIGTERM. */
14383
- force: boolean().optional()
14384
- });
14385
- var KillProcessResultSchema = object({
14386
- success: boolean(),
14387
- reason: string().optional(),
14388
- signal: _enum(["SIGTERM", "SIGKILL"]).optional()
14490
+ uptimeSec: number()
14389
14491
  });
14390
14492
  var DumpHeapSnapshotInputSchema = object({
14391
14493
  /** The addon whose runner should dump a heap snapshot. */
@@ -14398,6 +14500,104 @@ var DumpHeapSnapshotResultSchema = object({
14398
14500
  pid: number().optional(),
14399
14501
  reason: string().optional()
14400
14502
  });
14503
+ /**
14504
+ * One point of one function's series.
14505
+ *
14506
+ * The unsuffixed fields are the bucket's **MAXIMUM**, and that choice is the
14507
+ * point of the whole surface. The two obvious reductions both lie: a mean per
14508
+ * bucket smears a spike away, and taking every Nth sample skips it outright.
14509
+ * Either would give us a tool built to find peaks that does not show peaks.
14510
+ * `...Min` carries the other end, `samples` says how many raw snapshots folded
14511
+ * into the bucket, and a mean stays derivable where it is wanted.
14512
+ *
14513
+ * An UNREDUCED point is a one-sample bucket: `samples === 1` and each `...Min`
14514
+ * equals its unsuffixed twin. Reduced and unreduced are the same shape, so a
14515
+ * caller cannot tell which it received — which is what "one reader" means.
14516
+ */
14517
+ var LoadPointSchema = object({
14518
+ /** Bucket START, or the snapshot's own timestamp when unreduced. */
14519
+ atMs: number(),
14520
+ /** Raw snapshots in this bucket. Never 0 — AN EMPTY BUCKET IS ABSENT. */
14521
+ samples: number().int(),
14522
+ /**
14523
+ * `null` = UNKNOWN and it PROPAGATES: a bucket is null unless every process
14524
+ * of every snapshot in it reported a thread split. A partial sum is a
14525
+ * smaller number that looks exactly as real as a complete one.
14526
+ */
14527
+ cpuMainPercent: number().nullable(),
14528
+ cpuMainPercentMin: number().nullable(),
14529
+ cpuGcPercent: number().nullable(),
14530
+ cpuGcPercentMin: number().nullable(),
14531
+ /** Lifetime-average CPU%, summed. Always known — and never a rate. */
14532
+ cpuLifetimePercent: number(),
14533
+ cpuLifetimePercentMin: number(),
14534
+ memoryRssBytes: number(),
14535
+ memoryRssBytesMin: number(),
14536
+ processCount: number().int(),
14537
+ processCountMin: number().int()
14538
+ });
14539
+ /** One function's series. `key` is an addonId, `__root__` or `__unattributed__`. */
14540
+ var LoadFunctionSeriesSchema = object({
14541
+ key: string(),
14542
+ kind: _enum([
14543
+ "addon",
14544
+ "root",
14545
+ "unattributed"
14546
+ ]),
14547
+ /** Oldest-first. A missing interval is MISSING — never zero-filled. */
14548
+ points: array(LoadPointSchema).readonly()
14549
+ });
14550
+ var NodeLoadSeriesSchema = object({
14551
+ nodeId: string(),
14552
+ /** One entry per function seen in the window, heaviest-first. */
14553
+ series: array(LoadFunctionSeriesSchema).readonly(),
14554
+ /**
14555
+ * Width of one returned bucket, in ms. Equals the sampling cadence when no
14556
+ * reduction was needed — so a caller can always say what one point covers
14557
+ * without having to know whether it was reduced.
14558
+ */
14559
+ bucketMs: number(),
14560
+ /** Raw snapshots that went into this answer, across both tiers. */
14561
+ retainedSamples: number(),
14562
+ /** Oldest snapshot represented, or `null` when nothing is retained. */
14563
+ oldestAtMs: number().nullable(),
14564
+ /** The fixed sampling cadence in force on the cluster, in ms. */
14565
+ cadenceMs: number(),
14566
+ /**
14567
+ * Did the DURABLE tier contribute? `false` means the answer is the hot ring
14568
+ * alone — an agent (which holds no table), or a store that refused.
14569
+ * Reported because "the last hour" and "the last six hours" are different
14570
+ * questions and an operator must not have to guess which was answered.
14571
+ */
14572
+ durable: boolean()
14573
+ });
14574
+ var GetLoadSeriesInputSchema = object({
14575
+ /**
14576
+ * The node whose series is wanted.
14577
+ *
14578
+ * NOT named `nodeId`: the generated cap router strips a top-level
14579
+ * `nodeId` from every method input and uses it to ROUTE the call to
14580
+ * that node's provider (`generated-cap-routers.ts`). A series target
14581
+ * called `nodeId` would silently become a routing pin and never reach
14582
+ * the provider. The hub holds every node it hears from, so the
14583
+ * ordinary call is unpinned — answered by the hub, for any node.
14584
+ */
14585
+ forNodeId: string(),
14586
+ /**
14587
+ * EXCLUSIVE lower bound. A caller passes the newest `atMs` it already
14588
+ * holds and receives only what it is missing, so seeding a live chart
14589
+ * from this method cannot double a point already drawn.
14590
+ */
14591
+ sinceMs: number().optional(),
14592
+ /**
14593
+ * Most points the caller wants PER FUNCTION. The window is reduced to fit,
14594
+ * preserving min and max per bucket.
14595
+ *
14596
+ * Absent means NO reduction — legitimate for a short window and a trap for a
14597
+ * long one, which is why a chart passes its own pixel width.
14598
+ */
14599
+ maxPoints: number().int().positive().optional()
14600
+ });
14401
14601
  var SystemMetricsSchema = object({
14402
14602
  cpuPercent: number(),
14403
14603
  memoryPercent: number(),
@@ -14408,10 +14608,7 @@ var SystemMetricsSchema = object({
14408
14608
  gpuPercent: number().optional(),
14409
14609
  gpuMemoryPercent: number().optional()
14410
14610
  });
14411
- 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, {
14412
- kind: "mutation",
14413
- auth: "admin"
14414
- }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
14611
+ 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, {
14415
14612
  kind: "mutation",
14416
14613
  auth: "admin"
14417
14614
  });
@@ -29749,6 +29946,15 @@ var LoggingSettingsPatchSchema = object({
29749
29946
  * authority over the whole hierarchy and answers for every layer, so the
29750
29947
  * layer selector needs a name the transport does not already own.
29751
29948
  */
29949
+ /**
29950
+ * One contribution, plus WHO reported it.
29951
+ *
29952
+ * The addon and node are added by the hub as it enumerates providers, never by
29953
+ * the contributor: an addon reporting its own identity could report somebody
29954
+ * else's, and the whole point of this surface is that no claim is made by
29955
+ * anyone but its owner.
29956
+ */
29957
+ var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29752
29958
  var GetLoggingSettingsInputSchema = object({
29753
29959
  scopeNodeId: string().optional(),
29754
29960
  /**
@@ -29807,7 +30013,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29807
30013
  }), method(_void(), SiteLocationStatusSchema, {
29808
30014
  kind: "mutation",
29809
30015
  auth: "admin"
29810
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
30016
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29811
30017
  kind: "mutation",
29812
30018
  auth: "admin"
29813
30019
  });
@@ -32831,6 +33037,12 @@ Object.freeze({
32831
33037
  addonId: null,
32832
33038
  access: "create"
32833
33039
  },
33040
+ "dataStoreProvider.insertMany": {
33041
+ capName: "data-store-provider",
33042
+ capScope: "system",
33043
+ addonId: null,
33044
+ access: "create"
33045
+ },
32834
33046
  "dataStoreProvider.isEmpty": {
32835
33047
  capName: "data-store-provider",
32836
33048
  capScope: "system",
@@ -34145,6 +34357,12 @@ Object.freeze({
34145
34357
  addonId: null,
34146
34358
  access: "create"
34147
34359
  },
34360
+ "loadContribution.list": {
34361
+ capName: "load-contribution",
34362
+ capScope: "system",
34363
+ addonId: null,
34364
+ access: "view"
34365
+ },
34148
34366
  "localNetwork.downloadCa": {
34149
34367
  capName: "local-network",
34150
34368
  capScope: "system",
@@ -34445,17 +34663,17 @@ Object.freeze({
34445
34663
  addonId: null,
34446
34664
  access: "view"
34447
34665
  },
34448
- "metricsProvider.getProcessStats": {
34666
+ "metricsProvider.getLoadSeries": {
34449
34667
  capName: "metrics-provider",
34450
34668
  capScope: "system",
34451
34669
  addonId: null,
34452
34670
  access: "view"
34453
34671
  },
34454
- "metricsProvider.killProcess": {
34672
+ "metricsProvider.getProcessStats": {
34455
34673
  capName: "metrics-provider",
34456
34674
  capScope: "system",
34457
34675
  addonId: null,
34458
- access: "create"
34676
+ access: "view"
34459
34677
  },
34460
34678
  "metricsProvider.listAddonInstances": {
34461
34679
  capName: "metrics-provider",
@@ -36467,6 +36685,12 @@ Object.freeze({
36467
36685
  addonId: null,
36468
36686
  access: "create"
36469
36687
  },
36688
+ "settingsStore.insertMany": {
36689
+ capName: "settings-store",
36690
+ capScope: "system",
36691
+ addonId: null,
36692
+ access: "create"
36693
+ },
36470
36694
  "settingsStore.isEmpty": {
36471
36695
  capName: "settings-store",
36472
36696
  capScope: "system",
@@ -37079,6 +37303,12 @@ Object.freeze({
37079
37303
  addonId: null,
37080
37304
  access: "create"
37081
37305
  },
37306
+ "system.getLoadContributions": {
37307
+ capName: "system",
37308
+ capScope: "system",
37309
+ addonId: null,
37310
+ access: "view"
37311
+ },
37082
37312
  "system.getLoggingSettings": {
37083
37313
  capName: "system",
37084
37314
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
4
4
  "description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
5
5
  "keywords": [
6
6
  "camstack",