@camstack/system 1.2.447 → 1.2.449

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 (106) hide show
  1. package/assets/device-history/icon.svg +4 -0
  2. package/dist/{agent-https-5DYAOJMO.js → agent-https-CMz4S56_.js} +2 -2
  3. package/dist/{agent-https-BWUEf6ev.mjs → agent-https-D6lRxHma.mjs} +2 -2
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  5. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  8. package/dist/builtins/alerts/alerts.addon.js +2 -2
  9. package/dist/builtins/alerts/alerts.addon.mjs +2 -2
  10. package/dist/builtins/autotrack/index.js +1 -1
  11. package/dist/builtins/autotrack/index.mjs +1 -1
  12. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  13. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  14. package/dist/builtins/calendars/calendars.addon.js +1 -1
  15. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  16. package/dist/builtins/camera-grid/index.js +1 -1
  17. package/dist/builtins/camera-grid/index.mjs +1 -1
  18. package/dist/builtins/composer/composer.addon.js +2 -2
  19. package/dist/builtins/composer/composer.addon.mjs +2 -2
  20. package/dist/builtins/console-logging/index.js +1 -1
  21. package/dist/builtins/console-logging/index.mjs +1 -1
  22. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  23. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  24. package/dist/builtins/device-history/capture/capture-engine.d.ts +87 -0
  25. package/dist/builtins/device-history/capture/capture-filter.d.ts +37 -0
  26. package/dist/builtins/device-history/capture/device-directory.d.ts +47 -0
  27. package/dist/builtins/device-history/capture/field-path.d.ts +10 -0
  28. package/dist/builtins/device-history/capture/point-writer.d.ts +63 -0
  29. package/dist/builtins/device-history/device-history.addon.d.ts +38 -0
  30. package/dist/builtins/device-history/device-history.addon.js +2823 -0
  31. package/dist/builtins/device-history/device-history.addon.mjs +2816 -0
  32. package/dist/builtins/device-history/index.d.ts +3 -0
  33. package/dist/builtins/device-history/ingest/producer-ingest.d.ts +89 -0
  34. package/dist/builtins/device-history/query/history-query.d.ts +69 -0
  35. package/dist/builtins/device-history/retention/departure-tracker.d.ts +33 -0
  36. package/dist/builtins/device-history/retention/retention.d.ts +67 -0
  37. package/dist/builtins/device-history/rollup/rollup-engine.d.ts +72 -0
  38. package/dist/builtins/device-history/rollup/rollup-math.d.ts +44 -0
  39. package/dist/builtins/device-history/runtime/history-runtime.d.ts +93 -0
  40. package/dist/builtins/device-history/status/counters.d.ts +55 -0
  41. package/dist/builtins/device-history/store/history-door.d.ts +7 -0
  42. package/dist/builtins/device-history/store/history-schema.d.ts +26 -0
  43. package/dist/builtins/device-history/store/history-store.d.ts +86 -0
  44. package/dist/builtins/device-history/store/row-readers.d.ts +11 -0
  45. package/dist/builtins/device-history/store/series-registry.d.ts +39 -0
  46. package/dist/builtins/device-history/time/bucket-time.d.ts +25 -0
  47. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  48. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  49. package/dist/builtins/hub-forwarder/index.js +1 -1
  50. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  51. package/dist/builtins/keychain/index.js +4 -4
  52. package/dist/builtins/keychain/index.mjs +4 -4
  53. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  54. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  55. package/dist/builtins/local-auth/local-auth.addon.js +3 -3
  56. package/dist/builtins/local-auth/local-auth.addon.mjs +3 -3
  57. package/dist/builtins/local-network/local-network.addon.js +2 -2
  58. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  59. package/dist/builtins/loki-logging/index.js +1 -1
  60. package/dist/builtins/loki-logging/index.mjs +1 -1
  61. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  62. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  63. package/dist/builtins/platform-probe/index.js +1 -1
  64. package/dist/builtins/platform-probe/index.mjs +1 -1
  65. package/dist/builtins/record-entries/index.js +1 -1
  66. package/dist/builtins/record-entries/index.mjs +1 -1
  67. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  68. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  69. package/dist/builtins/snapshot/index.js +1 -1
  70. package/dist/builtins/snapshot/index.mjs +1 -1
  71. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  72. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  73. package/dist/builtins/sqlite-storage/index.js +1 -1
  74. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  75. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +4 -6
  76. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +12 -15
  77. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +12 -15
  78. package/dist/builtins/sqlite-storage/vector-provider.d.ts +6 -0
  79. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  80. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  81. package/dist/builtins/system-config/system-config.addon.js +3 -3
  82. package/dist/builtins/system-config/system-config.addon.mjs +3 -3
  83. package/dist/builtins/winston-logging/index.js +1 -1
  84. package/dist/builtins/winston-logging/index.mjs +1 -1
  85. package/dist/{composition-sources-BwIIltnZ.js → composition-sources-BQmhc3se.js} +1 -1
  86. package/dist/{composition-sources-BmC5jAUv.mjs → composition-sources-DzuruDVY.mjs} +1 -1
  87. package/dist/{constants-DA_tjzIk.js → constants-BPWA-r-Y.js} +1 -1
  88. package/dist/{constants-6XHGmEUF.mjs → constants-gzGZbnwO.mjs} +1 -1
  89. package/dist/{device-ca-CnbrgfmW.js → device-ca-75rt3U_U.js} +1 -1
  90. package/dist/{device-ca-Bh_ClxMO.mjs → device-ca-D05nqNXE.mjs} +1 -1
  91. package/dist/{dist-BkNfEJKa.js → dist-Ct88catN.js} +385 -1
  92. package/dist/{dist-CkZIrsAP.mjs → dist-DV2ll9Hi.mjs} +356 -2
  93. package/dist/file-host-worker.js +1 -1
  94. package/dist/file-host-worker.mjs +1 -1
  95. package/dist/{hub-mdns-ciao-CoyIUWHC.mjs → hub-mdns-ciao-BPOg2iyc.mjs} +2 -2
  96. package/dist/{hub-mdns-ciao-m5LIr4oA.js → hub-mdns-ciao-DAU1WttG.js} +2 -2
  97. package/dist/index.d.ts +1 -0
  98. package/dist/index.js +9 -7
  99. package/dist/index.mjs +9 -8
  100. package/dist/{phase6-declare-gate-BDWZuB2n.mjs → phase6-declare-gate-BJplW6tX.mjs} +1 -1
  101. package/dist/{phase6-declare-gate-Bl7KocEs.js → phase6-declare-gate-C6WqagkC.js} +1 -1
  102. package/dist/{restore-archive-B57xI5Ue.js → restore-archive-Cprdh3P9.js} +1 -1
  103. package/dist/{restore-archive-CMr4V7Fi.mjs → restore-archive-Jiz63mVB.mjs} +1 -1
  104. package/dist/{wal-maintenance-Bqm4zrNA.mjs → wal-maintenance-BineOch3.mjs} +0 -0
  105. package/dist/{wal-maintenance-CuG1DUca.js → wal-maintenance-mwCBe3Vr.js} +0 -0
  106. package/package.json +24 -1
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BkNfEJKa.js");
6
+ const require_dist = require("../../dist-Ct88catN.js");
7
7
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
8
8
  const require_x509_es = require("../../x509.es-C4cOo48M.js");
9
- const require_constants$8 = require("../../constants-DA_tjzIk.js");
10
- const require_agent_https = require("../../agent-https-5DYAOJMO.js");
9
+ const require_constants$8 = require("../../constants-BPWA-r-Y.js");
10
+ const require_agent_https = require("../../agent-https-CMz4S56_.js");
11
11
  const require_src$1 = require("../../src-CnAqG6EF.js");
12
12
  let zod = require("zod");
13
13
  let node_crypto = require("node:crypto");
@@ -1,9 +1,9 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Ei as defineCustomActions, Lr as errMsg, Mi as hydrateSchema, Rr as BaseAddon, rr as shortHostname, tt as ServerNameSchema, wi as customAction } from "../../dist-CkZIrsAP.mjs";
2
+ import { Hr as BaseAddon, Li as hydrateSchema, Vr as errMsg, ji as defineCustomActions, ki as customAction, nt as ServerNameSchema, sr as shortHostname } from "../../dist-DV2ll9Hi.mjs";
3
3
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
4
4
  import { c as Pkcs10CertificateRequest } from "../../x509.es-DK__ETIe.mjs";
5
- import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "../../constants-6XHGmEUF.mjs";
6
- import { $ as generateMeshKeyPair, B as systemConfigRecordKinds, F as AGENT_HTTPS_NAMES_COLLECTION, G as describeMeshLeaf, H as MESH_NODE_CERTIFICATES_COLUMNS, I as AGENT_HTTPS_NAMES_COLUMNS, L as AgentHttpsNames, Q as generateMeshCa, R as getProcessAgentHttpsNames, U as MeshCertificateRegistry, V as MESH_NODE_CERTIFICATES_COLLECTION, X as createMeshCsrPem, Y as caFingerprintCompact, Z as exportMeshPrivateKeyPem, et as isValidAgentNodeId, it as subjectCn, j as isLocalOnlyHostname, nt as issueMeshLeafFromCsr, q as setProcessMeshCertificateRegistry, rt as loadMeshCa, tt as issueMeshLeafForNode, u as isPrivateAddress, z as setProcessAgentHttpsNames } from "../../agent-https-BWUEf6ev.mjs";
5
+ import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "../../constants-gzGZbnwO.mjs";
6
+ import { $ as generateMeshKeyPair, B as systemConfigRecordKinds, F as AGENT_HTTPS_NAMES_COLLECTION, G as describeMeshLeaf, H as MESH_NODE_CERTIFICATES_COLUMNS, I as AGENT_HTTPS_NAMES_COLUMNS, L as AgentHttpsNames, Q as generateMeshCa, R as getProcessAgentHttpsNames, U as MeshCertificateRegistry, V as MESH_NODE_CERTIFICATES_COLLECTION, X as createMeshCsrPem, Y as caFingerprintCompact, Z as exportMeshPrivateKeyPem, et as isValidAgentNodeId, it as subjectCn, j as isLocalOnlyHostname, nt as issueMeshLeafFromCsr, q as setProcessMeshCertificateRegistry, rt as loadMeshCa, tt as issueMeshLeafForNode, u as isPrivateAddress, z as setProcessAgentHttpsNames } from "../../agent-https-D6lRxHma.mjs";
7
7
  import { t as require_src } from "../../src-hG4grMU4.mjs";
8
8
  import { z } from "zod";
9
9
  import { X509Certificate, createHash, createPrivateKey, randomBytes, randomInt, sign, timingSafeEqual, verify, webcrypto } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BkNfEJKa.js");
6
+ const require_dist = require("../../dist-Ct88catN.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_chunk.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { Rr as BaseAddon, xn as logDestinationCapability } from "../../dist-CkZIrsAP.mjs";
1
+ import { Hr as BaseAddon, Tn as logDestinationCapability } from "../../dist-DV2ll9Hi.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  import * as path$1 from "node:path";
4
4
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-BkNfEJKa.js");
1
+ const require_dist = require("./dist-Ct88catN.js");
2
2
  //#region src/builtins/core-blocks/composition-sources.ts
3
3
  /**
4
4
  * Describe what a composition reads and writes for SAVE-time validation
@@ -1,4 +1,4 @@
1
- import { Ar as compositionSourceKey, Lr as errMsg } from "./dist-CkZIrsAP.mjs";
1
+ import { Pr as compositionSourceKey, Vr as errMsg } from "./dist-DV2ll9Hi.mjs";
2
2
  //#region src/builtins/core-blocks/composition-sources.ts
3
3
  /**
4
4
  * Describe what a composition reads and writes for SAVE-time validation
@@ -1,5 +1,5 @@
1
1
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
2
- var MESH_CA_KEY_REF = require("./dist-BkNfEJKa.js").buildSecretRef({
2
+ var MESH_CA_KEY_REF = require("./dist-Ct88catN.js").buildSecretRef({
3
3
  owner: "system",
4
4
  scope: { kind: "global" },
5
5
  fieldPath: "meshCaKey"
@@ -1,4 +1,4 @@
1
- import { vi as buildSecretRef } from "./dist-CkZIrsAP.mjs";
1
+ import { Ci as buildSecretRef } from "./dist-DV2ll9Hi.mjs";
2
2
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
3
3
  var MESH_CA_KEY_REF = buildSecretRef({
4
4
  owner: "system",
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-BkNfEJKa.js");
1
+ const require_dist = require("./dist-Ct88catN.js");
2
2
  const require_x509_es = require("./x509.es-C4cOo48M.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -1,4 +1,4 @@
1
- import { D as DEVICE_SAN_CREDENTIAL_PREFIX, O as DEVICE_SAN_USER_PREFIX, vi as buildSecretRef } from "./dist-CkZIrsAP.mjs";
1
+ import { Ci as buildSecretRef, D as DEVICE_SAN_CREDENTIAL_PREFIX, O as DEVICE_SAN_USER_PREFIX } from "./dist-DV2ll9Hi.mjs";
2
2
  import { S as backdatedNotBefore, a as KeyUsageFlags, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension } from "./x509.es-DK__ETIe.mjs";
3
3
  import { X509Certificate, createPublicKey, randomBytes, verify, webcrypto } from "node:crypto";
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -4566,6 +4566,8 @@ zod.z.object({
4566
4566
  field: zod.z.string().min(1),
4567
4567
  on: zod.z.literal("advance")
4568
4568
  });
4569
+ /** Capture floor (ms) applied to `gauge` / `counter` series when a field states none. */
4570
+ var HISTORY_DEFAULT_MIN_INTERVAL_MS = 1e4;
4569
4571
  /**
4570
4572
  * Resolve the EFFECTIVE mount hint for a cap — the explicit `mount` when
4571
4573
  * present, else the scope/mode/deviceNative-derived default. Single source
@@ -86251,7 +86253,289 @@ var SESSION_ONLY_POLICY = {
86251
86253
  durability: "session",
86252
86254
  volatileFields: []
86253
86255
  };
86254
- DeviceType.Camera;
86256
+ /**
86257
+ * Cap history catalog, projected from every `*.cap.ts` `history` block.
86258
+ * 34 caps with series (62 series), 37 caps answered `'none'`.
86259
+ * Field keys are `runtimeState` paths (`a.b` into fixed objects only).
86260
+ */
86261
+ var HISTORY_CATALOG = {
86262
+ "air-quality-sensor": {
86263
+ "co2Ppm": {
86264
+ kind: "gauge",
86265
+ unit: "ppm",
86266
+ deadband: 5
86267
+ },
86268
+ "vocPpb": {
86269
+ kind: "gauge",
86270
+ unit: "ppb",
86271
+ deadband: 5
86272
+ },
86273
+ "pm25": {
86274
+ kind: "gauge",
86275
+ unit: "ug/m3",
86276
+ deadband: 1
86277
+ },
86278
+ "pm10": {
86279
+ kind: "gauge",
86280
+ unit: "ug/m3",
86281
+ deadband: 1
86282
+ },
86283
+ "aqi": {
86284
+ kind: "gauge",
86285
+ unit: "count",
86286
+ deadband: 1
86287
+ }
86288
+ },
86289
+ "ambient-light-sensor": { "lux": {
86290
+ kind: "gauge",
86291
+ unit: "lx",
86292
+ deadbandPct: 10,
86293
+ minIntervalMs: 6e4
86294
+ } },
86295
+ "battery": { "percentage": {
86296
+ kind: "gauge",
86297
+ unit: "%"
86298
+ } },
86299
+ "binary": { "on": { kind: "boolean" } },
86300
+ "brightness": { "percentage": {
86301
+ kind: "gauge",
86302
+ unit: "%",
86303
+ minIntervalMs: 0
86304
+ } },
86305
+ "carbon-monoxide": { "detected": { kind: "boolean" } },
86306
+ "climate-control": {
86307
+ "currentTemp": {
86308
+ kind: "gauge",
86309
+ unit: "°C",
86310
+ deadband: .1
86311
+ },
86312
+ "currentHumidity": {
86313
+ kind: "gauge",
86314
+ unit: "%",
86315
+ deadband: .5
86316
+ },
86317
+ "target": {
86318
+ kind: "gauge",
86319
+ unit: "°C",
86320
+ minIntervalMs: 0
86321
+ },
86322
+ "targetHigh": {
86323
+ kind: "gauge",
86324
+ unit: "°C",
86325
+ minIntervalMs: 0
86326
+ },
86327
+ "targetLow": {
86328
+ kind: "gauge",
86329
+ unit: "°C",
86330
+ minIntervalMs: 0
86331
+ }
86332
+ },
86333
+ "contact": { "entryOpen": { kind: "boolean" } },
86334
+ "cover": { "position": {
86335
+ kind: "gauge",
86336
+ unit: "%",
86337
+ minIntervalMs: 0
86338
+ } },
86339
+ "device-status": { "online": { kind: "boolean" } },
86340
+ "dishwasher": { "progressPercent": {
86341
+ kind: "gauge",
86342
+ unit: "%",
86343
+ deadband: 2
86344
+ } },
86345
+ "fan-control": {
86346
+ "percentage": {
86347
+ kind: "gauge",
86348
+ unit: "%",
86349
+ minIntervalMs: 0
86350
+ },
86351
+ "oscillating": { kind: "boolean" }
86352
+ },
86353
+ "flood": { "flooded": { kind: "boolean" } },
86354
+ "gas": { "detected": { kind: "boolean" } },
86355
+ "heating-valve": { "position": {
86356
+ kind: "gauge",
86357
+ unit: "%",
86358
+ deadband: 1
86359
+ } },
86360
+ "humidifier": {
86361
+ "currentHumidity": {
86362
+ kind: "gauge",
86363
+ unit: "%",
86364
+ deadband: .5
86365
+ },
86366
+ "on": { kind: "boolean" }
86367
+ },
86368
+ "humidity-sensor": { "percent": {
86369
+ kind: "gauge",
86370
+ unit: "%",
86371
+ deadband: .5
86372
+ } },
86373
+ "lawn-mower-control": { "batteryLevel": {
86374
+ kind: "gauge",
86375
+ unit: "%",
86376
+ deadband: 2
86377
+ } },
86378
+ "motion": { "detected": {
86379
+ kind: "boolean",
86380
+ excludeDeviceTypes: [DeviceType.Camera]
86381
+ } },
86382
+ "network-link": {
86383
+ "signalPercent": {
86384
+ kind: "gauge",
86385
+ unit: "%",
86386
+ deadband: 3,
86387
+ minIntervalMs: 6e4
86388
+ },
86389
+ "rssiDbm": {
86390
+ kind: "gauge",
86391
+ unit: "dBm",
86392
+ deadband: 2,
86393
+ minIntervalMs: 6e4
86394
+ }
86395
+ },
86396
+ "numeric-sensor": { "value": {
86397
+ kind: "gauge",
86398
+ unitFrom: "unit",
86399
+ minIntervalMs: 3e4
86400
+ } },
86401
+ "pet-feeder": {
86402
+ "foodLevel": { kind: "gauge" },
86403
+ "food1": { kind: "gauge" },
86404
+ "food2": { kind: "gauge" },
86405
+ "batteryPower": {
86406
+ kind: "gauge",
86407
+ unit: "%",
86408
+ deadband: 2
86409
+ },
86410
+ "desiccantLeftDays": {
86411
+ kind: "gauge",
86412
+ unit: "days"
86413
+ }
86414
+ },
86415
+ "power-meter": {
86416
+ "watts": {
86417
+ kind: "gauge",
86418
+ unit: "W",
86419
+ deadband: 1,
86420
+ minIntervalMs: 3e4
86421
+ },
86422
+ "kwhTotal": {
86423
+ kind: "counter",
86424
+ unit: "kWh",
86425
+ deadband: .01,
86426
+ minIntervalMs: 6e4
86427
+ },
86428
+ "volts": {
86429
+ kind: "gauge",
86430
+ unit: "V",
86431
+ deadband: 1,
86432
+ minIntervalMs: 3e4
86433
+ },
86434
+ "amps": {
86435
+ kind: "gauge",
86436
+ unit: "A",
86437
+ deadband: .05,
86438
+ minIntervalMs: 3e4
86439
+ },
86440
+ "va": {
86441
+ kind: "gauge",
86442
+ unit: "VA",
86443
+ deadband: 1,
86444
+ minIntervalMs: 3e4
86445
+ },
86446
+ "powerFactor": {
86447
+ kind: "gauge",
86448
+ unit: "ratio",
86449
+ deadband: .01,
86450
+ minIntervalMs: 6e4
86451
+ }
86452
+ },
86453
+ "presence": { "batteryPercent": {
86454
+ kind: "gauge",
86455
+ unit: "%",
86456
+ deadband: 1
86457
+ } },
86458
+ "pressure-sensor": { "hpa": {
86459
+ kind: "gauge",
86460
+ unit: "hPa",
86461
+ deadband: .1
86462
+ } },
86463
+ "smoke": { "detected": { kind: "boolean" } },
86464
+ "switch": { "on": { kind: "boolean" } },
86465
+ "tamper": { "tampered": { kind: "boolean" } },
86466
+ "temperature-sensor": { "celsius": {
86467
+ kind: "gauge",
86468
+ unit: "°C",
86469
+ deadband: .1
86470
+ } },
86471
+ "vacuum-control": {
86472
+ "batteryLevel": {
86473
+ kind: "gauge",
86474
+ unit: "%",
86475
+ deadband: 2
86476
+ },
86477
+ "cleanWater.level": {
86478
+ kind: "gauge",
86479
+ unit: "%",
86480
+ deadband: 2
86481
+ },
86482
+ "dirtyWater.level": {
86483
+ kind: "gauge",
86484
+ unit: "%",
86485
+ deadband: 2
86486
+ },
86487
+ "detergent.level": {
86488
+ kind: "gauge",
86489
+ unit: "%",
86490
+ deadband: 2
86491
+ },
86492
+ "dustBin.level": {
86493
+ kind: "gauge",
86494
+ unit: "%",
86495
+ deadband: 2
86496
+ }
86497
+ },
86498
+ "valve": { "position": {
86499
+ kind: "gauge",
86500
+ unit: "%",
86501
+ minIntervalMs: 0
86502
+ } },
86503
+ "vibration": { "detected": { kind: "boolean" } },
86504
+ "water-heater": {
86505
+ "currentTemp": {
86506
+ kind: "gauge",
86507
+ unit: "°C",
86508
+ deadband: .5
86509
+ },
86510
+ "targetTemp": {
86511
+ kind: "gauge",
86512
+ unit: "°C",
86513
+ minIntervalMs: 0
86514
+ }
86515
+ },
86516
+ "weather": {
86517
+ "temperature": {
86518
+ kind: "gauge",
86519
+ unitFrom: "temperatureUnit",
86520
+ deadband: .2
86521
+ },
86522
+ "humidity": {
86523
+ kind: "gauge",
86524
+ unit: "%",
86525
+ deadband: 1
86526
+ },
86527
+ "pressure": {
86528
+ kind: "gauge",
86529
+ unitFrom: "pressureUnit",
86530
+ deadband: .5
86531
+ },
86532
+ "windSpeed": {
86533
+ kind: "gauge",
86534
+ unitFrom: "windSpeedUnit",
86535
+ deadband: .5
86536
+ }
86537
+ }
86538
+ };
86255
86539
  var G711_SCALE_CORRECTION_DB = {
86256
86540
  PCMU: 20 * Math.log10(4),
86257
86541
  PCMA: 20 * Math.log10(8)
@@ -87613,6 +87897,76 @@ function enumerateInferenceDevices(hw) {
87613
87897
  }
87614
87898
  return out;
87615
87899
  }
87900
+ /** How often an implementer re-asks for tombstones after its start-up pass. */
87901
+ var REMOVAL_RECONCILE_INTERVAL_MS = 360 * 60 * 1e3;
87902
+ /** One reconcile pass over every tombstone inside the retention window. */
87903
+ async function reconcileRemovedDevices(opts) {
87904
+ const now = opts.now ?? (() => Date.now());
87905
+ const api = opts.api;
87906
+ if (api === void 0) {
87907
+ opts.logger.warn("device removal reconcile skipped — no device-manager api");
87908
+ return {
87909
+ read: false,
87910
+ applied: 0,
87911
+ failed: 0
87912
+ };
87913
+ }
87914
+ let tombstones;
87915
+ try {
87916
+ tombstones = await api.deviceManager.listDeletedSince.query({ sinceMs: now() - DEVICE_TOMBSTONE_RETENTION_MS });
87917
+ } catch (err) {
87918
+ opts.logger.warn("device removal reconcile skipped — tombstones unreadable, nothing deleted", { meta: { error: errMsg(err) } });
87919
+ return {
87920
+ read: false,
87921
+ applied: 0,
87922
+ failed: 0
87923
+ };
87924
+ }
87925
+ let applied = 0;
87926
+ let failed = 0;
87927
+ for (const tombstone of tombstones) try {
87928
+ const result = await opts.remove(tombstone);
87929
+ applied += 1;
87930
+ if (Object.values(result.counts).reduce((sum, n) => sum + n, 0) > 0) opts.logger.info("device removal reconcile cleaned a missed deletion", {
87931
+ tags: { deviceId: tombstone.deviceId },
87932
+ meta: {
87933
+ counts: result.counts,
87934
+ deletedAt: tombstone.deletedAt
87935
+ }
87936
+ });
87937
+ } catch (err) {
87938
+ failed += 1;
87939
+ opts.logger.warn("device removal reconcile failed for a device — retried next pass", {
87940
+ tags: { deviceId: tombstone.deviceId },
87941
+ meta: { error: errMsg(err) }
87942
+ });
87943
+ }
87944
+ return {
87945
+ read: true,
87946
+ applied,
87947
+ failed
87948
+ };
87949
+ }
87950
+ /**
87951
+ * Run the reconcile now and then periodically. Returns the disposer. The timer
87952
+ * is unref'd and a pass never overlaps the previous one.
87953
+ */
87954
+ function armRemovalReconcile(opts) {
87955
+ let running = false;
87956
+ const pass = () => {
87957
+ if (running) return;
87958
+ running = true;
87959
+ reconcileRemovedDevices(opts).catch((err) => {
87960
+ opts.logger.warn("device removal reconcile pass crashed", { meta: { error: errMsg(err) } });
87961
+ }).finally(() => {
87962
+ running = false;
87963
+ });
87964
+ };
87965
+ pass();
87966
+ const timer = setInterval(pass, REMOVAL_RECONCILE_INTERVAL_MS);
87967
+ timer.unref?.();
87968
+ return () => clearInterval(timer);
87969
+ }
87616
87970
  //#endregion
87617
87971
  Object.defineProperty(exports, "AGENT_MDNS_SERVICE_TYPE", {
87618
87972
  enumerable: true,
@@ -87914,6 +88268,18 @@ Object.defineProperty(exports, "ForeignSecretMarkerError", {
87914
88268
  return ForeignSecretMarkerError;
87915
88269
  }
87916
88270
  });
88271
+ Object.defineProperty(exports, "HISTORY_CATALOG", {
88272
+ enumerable: true,
88273
+ get: function() {
88274
+ return HISTORY_CATALOG;
88275
+ }
88276
+ });
88277
+ Object.defineProperty(exports, "HISTORY_DEFAULT_MIN_INTERVAL_MS", {
88278
+ enumerable: true,
88279
+ get: function() {
88280
+ return HISTORY_DEFAULT_MIN_INTERVAL_MS;
88281
+ }
88282
+ });
87917
88283
  Object.defineProperty(exports, "HUB_MDNS_SERVICE_TYPE", {
87918
88284
  enumerable: true,
87919
88285
  get: function() {
@@ -88220,6 +88586,12 @@ Object.defineProperty(exports, "alertsCapability", {
88220
88586
  return alertsCapability;
88221
88587
  }
88222
88588
  });
88589
+ Object.defineProperty(exports, "armRemovalReconcile", {
88590
+ enumerable: true,
88591
+ get: function() {
88592
+ return armRemovalReconcile;
88593
+ }
88594
+ });
88223
88595
  Object.defineProperty(exports, "asJsonObject", {
88224
88596
  enumerable: true,
88225
88597
  get: function() {
@@ -88538,12 +88910,24 @@ Object.defineProperty(exports, "deviceExtensionCapability", {
88538
88910
  return deviceExtensionCapability;
88539
88911
  }
88540
88912
  });
88913
+ Object.defineProperty(exports, "deviceHistoryCapability", {
88914
+ enumerable: true,
88915
+ get: function() {
88916
+ return deviceHistoryCapability;
88917
+ }
88918
+ });
88541
88919
  Object.defineProperty(exports, "deviceManagerCapability", {
88542
88920
  enumerable: true,
88543
88921
  get: function() {
88544
88922
  return deviceManagerCapability;
88545
88923
  }
88546
88924
  });
88925
+ Object.defineProperty(exports, "deviceRemovalHookCapability", {
88926
+ enumerable: true,
88927
+ get: function() {
88928
+ return deviceRemovalHookCapability;
88929
+ }
88930
+ });
88547
88931
  Object.defineProperty(exports, "deviceStateCapability", {
88548
88932
  enumerable: true,
88549
88933
  get: function() {