@camstack/system 1.2.202 → 1.2.204

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 (60) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +12 -0
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +37 -3
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +37 -3
  10. package/dist/builtins/console-logging/index.js +1 -1
  11. package/dist/builtins/console-logging/index.mjs +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  14. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  15. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  18. package/dist/builtins/hub-forwarder/index.js +1 -1
  19. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  20. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  22. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  24. package/dist/builtins/local-network/local-network.addon.js +1 -1
  25. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  26. package/dist/builtins/loki-logging/index.js +1 -1
  27. package/dist/builtins/loki-logging/index.mjs +1 -1
  28. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  30. package/dist/builtins/platform-probe/index.js +1 -1
  31. package/dist/builtins/platform-probe/index.mjs +1 -1
  32. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  34. package/dist/builtins/snapshot/index.js +1 -1
  35. package/dist/builtins/snapshot/index.mjs +1 -1
  36. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  37. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  38. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  39. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  40. package/dist/builtins/storage-orchestrator/drain-ratchet.d.ts +104 -0
  41. package/dist/builtins/storage-orchestrator/drain-state-store.d.ts +13 -0
  42. package/dist/builtins/storage-orchestrator/location-occupancy-slice.d.ts +47 -0
  43. package/dist/builtins/storage-orchestrator/location-protection.d.ts +20 -0
  44. package/dist/builtins/storage-orchestrator/location-root-collision.d.ts +44 -0
  45. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +47 -0
  46. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +714 -58
  47. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +714 -58
  48. package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +32 -11
  49. package/dist/builtins/storage-orchestrator/storage-pressure-manager.d.ts +45 -0
  50. package/dist/builtins/system-config/system-config.addon.js +1 -1
  51. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  52. package/dist/builtins/winston-logging/index.js +1 -1
  53. package/dist/builtins/winston-logging/index.mjs +1 -1
  54. package/dist/{dist-jZb-HKI5.js → dist-BD7M9-5N.js} +749 -374
  55. package/dist/{dist-CiHYspij.mjs → dist-BmJpFsC2.mjs} +690 -375
  56. package/dist/index.js +1 -1
  57. package/dist/index.mjs +1 -1
  58. package/dist/{retired-settings-keys-DeRxo3vg.mjs → retired-settings-keys-BZJcJj6L.mjs} +1 -1
  59. package/dist/{retired-settings-keys-Dxv9S_lO.js → retired-settings-keys-h7YxHNjB.js} +1 -1
  60. package/package.json +1 -1
@@ -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-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Lt as errMsg, O as addonPagesCapability, Rt as BaseAddon, un as EventCategory } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, bn as EventCategory, k as addonPagesCapability, qt as errMsg } from "../../dist-BmJpFsC2.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
@@ -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-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { A as addonWidgetsCapability, Lt as errMsg, Rt as BaseAddon, un as EventCategory } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, bn as EventCategory, j as addonWidgetsCapability, qt as errMsg } from "../../dist-BmJpFsC2.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  //#region src/builtins/alerts/prune-policy.ts
8
8
  /**
9
9
  * Ids older than `cutoffMs`, oldest first.
@@ -1,4 +1,4 @@
1
- import { Lt as errMsg, Rt as BaseAddon, Zt as createEvent, j as alertsCapability, n as AlertSchema, un as EventCategory } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, M as alertsCapability, bn as EventCategory, n as AlertSchema, qt as errMsg, sn as createEvent } from "../../dist-BmJpFsC2.mjs";
2
2
  //#region src/builtins/alerts/prune-policy.ts
3
3
  /**
4
4
  * Ids older than `cutoffMs`, oldest first.
@@ -76,6 +76,18 @@ export declare class BackupOrchestratorAddon extends BaseAddon<Record<string, ne
76
76
  * Failures on individual locations are logged and skipped so a single
77
77
  * unreachable destination doesn't blank out the whole UI.
78
78
  */
79
+ /**
80
+ * Bytes the archives occupy on each named location (D388).
81
+ *
82
+ * Summed from each location's own manifest — the record the uploader writes
83
+ * — so this never walks a filesystem and never stats a remote destination.
84
+ * A manifest that cannot be read contributes NOTHING and is logged: a
85
+ * destination that is temporarily unreachable must read back as unknown, not
86
+ * as an empty disk. A location holding no archives is omitted for the same
87
+ * reason it is omitted everywhere else — only the orchestrator can tell
88
+ * "nobody reported" from "reported nothing".
89
+ */
90
+ private backupOccupancy;
79
91
  private aggregatedList;
80
92
  private stagingPath;
81
93
  /**
@@ -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-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let buffer = require("buffer");
9
9
  let node_fs_promises = require("node:fs/promises");
@@ -5449,6 +5449,9 @@ var BackupOrchestratorAddon = class extends require_dist.BaseAddon {
5449
5449
  return [{
5450
5450
  capability: require_dist.backupCapability,
5451
5451
  provider
5452
+ }, {
5453
+ capability: require_dist.storageOccupancyCapability,
5454
+ provider: { getOccupancy: async (input) => this.backupOccupancy(input.locationIds) }
5452
5455
  }];
5453
5456
  }
5454
5457
  async onShutdown() {
@@ -5570,7 +5573,7 @@ var BackupOrchestratorAddon = class extends require_dist.BaseAddon {
5570
5573
  subId,
5571
5574
  displayName,
5572
5575
  kind: kindFromProviderId(loc.providerId),
5573
- triggerSupported: effective.enabled && loc.enabled !== false,
5576
+ triggerSupported: effective.enabled && require_dist.mayWriteToLocation(loc),
5574
5577
  restoreSupported: true,
5575
5578
  enabled: effective.enabled,
5576
5579
  retentionCount: effective.retentionCount,
@@ -5601,6 +5604,37 @@ var BackupOrchestratorAddon = class extends require_dist.BaseAddon {
5601
5604
  * Failures on individual locations are logged and skipped so a single
5602
5605
  * unreachable destination doesn't blank out the whole UI.
5603
5606
  */
5607
+ /**
5608
+ * Bytes the archives occupy on each named location (D388).
5609
+ *
5610
+ * Summed from each location's own manifest — the record the uploader writes
5611
+ * — so this never walks a filesystem and never stats a remote destination.
5612
+ * A manifest that cannot be read contributes NOTHING and is logged: a
5613
+ * destination that is temporarily unreachable must read back as unknown, not
5614
+ * as an empty disk. A location holding no archives is omitted for the same
5615
+ * reason it is omitted everywhere else — only the orchestrator can tell
5616
+ * "nobody reported" from "reported nothing".
5617
+ */
5618
+ async backupOccupancy(locationIds) {
5619
+ const measuredAtMs = Date.now();
5620
+ const out = [];
5621
+ for (const locationId of locationIds) {
5622
+ let manifest;
5623
+ try {
5624
+ manifest = await readLocationManifest(this.storageApi(), locationId);
5625
+ } catch {
5626
+ continue;
5627
+ }
5628
+ const ownedBytes = manifest.archives.reduce((sum, a) => sum + a.sizeBytes, 0);
5629
+ if (ownedBytes <= 0) continue;
5630
+ out.push({
5631
+ locationId,
5632
+ ownedBytes,
5633
+ measuredAtMs
5634
+ });
5635
+ }
5636
+ return out;
5637
+ }
5604
5638
  async aggregatedList() {
5605
5639
  const locations = await this.fetchBackupLocations();
5606
5640
  const out = [];
@@ -6079,7 +6113,7 @@ var BackupOrchestratorAddon = class extends require_dist.BaseAddon {
6079
6113
  const selection = selectBackupTargets({
6080
6114
  candidates: locations.map((l) => ({
6081
6115
  id: l.id,
6082
- locationEnabled: l.enabled !== false,
6116
+ locationEnabled: require_dist.mayWriteToLocation(l),
6083
6117
  policyEnabled: (policies.get(l.id) ?? this.fallbackPolicy(l.id)).enabled
6084
6118
  })),
6085
6119
  ...requested && requested.length > 0 ? { requested: [...requested] } : {}
@@ -1,4 +1,4 @@
1
- import { N as backupCapability, Rt as BaseAddon, un as EventCategory } from "../../dist-CiHYspij.mjs";
1
+ import { Bt as storageOccupancyCapability, Jt as BaseAddon, P as backupCapability, bn as EventCategory, yt as mayWriteToLocation } from "../../dist-BmJpFsC2.mjs";
2
2
  import { randomBytes, randomUUID } from "node:crypto";
3
3
  import { Buffer as Buffer$1 } from "buffer";
4
4
  import * as fsp from "node:fs/promises";
@@ -5434,6 +5434,9 @@ var BackupOrchestratorAddon = class extends BaseAddon {
5434
5434
  return [{
5435
5435
  capability: backupCapability,
5436
5436
  provider
5437
+ }, {
5438
+ capability: storageOccupancyCapability,
5439
+ provider: { getOccupancy: async (input) => this.backupOccupancy(input.locationIds) }
5437
5440
  }];
5438
5441
  }
5439
5442
  async onShutdown() {
@@ -5555,7 +5558,7 @@ var BackupOrchestratorAddon = class extends BaseAddon {
5555
5558
  subId,
5556
5559
  displayName,
5557
5560
  kind: kindFromProviderId(loc.providerId),
5558
- triggerSupported: effective.enabled && loc.enabled !== false,
5561
+ triggerSupported: effective.enabled && mayWriteToLocation(loc),
5559
5562
  restoreSupported: true,
5560
5563
  enabled: effective.enabled,
5561
5564
  retentionCount: effective.retentionCount,
@@ -5586,6 +5589,37 @@ var BackupOrchestratorAddon = class extends BaseAddon {
5586
5589
  * Failures on individual locations are logged and skipped so a single
5587
5590
  * unreachable destination doesn't blank out the whole UI.
5588
5591
  */
5592
+ /**
5593
+ * Bytes the archives occupy on each named location (D388).
5594
+ *
5595
+ * Summed from each location's own manifest — the record the uploader writes
5596
+ * — so this never walks a filesystem and never stats a remote destination.
5597
+ * A manifest that cannot be read contributes NOTHING and is logged: a
5598
+ * destination that is temporarily unreachable must read back as unknown, not
5599
+ * as an empty disk. A location holding no archives is omitted for the same
5600
+ * reason it is omitted everywhere else — only the orchestrator can tell
5601
+ * "nobody reported" from "reported nothing".
5602
+ */
5603
+ async backupOccupancy(locationIds) {
5604
+ const measuredAtMs = Date.now();
5605
+ const out = [];
5606
+ for (const locationId of locationIds) {
5607
+ let manifest;
5608
+ try {
5609
+ manifest = await readLocationManifest(this.storageApi(), locationId);
5610
+ } catch {
5611
+ continue;
5612
+ }
5613
+ const ownedBytes = manifest.archives.reduce((sum, a) => sum + a.sizeBytes, 0);
5614
+ if (ownedBytes <= 0) continue;
5615
+ out.push({
5616
+ locationId,
5617
+ ownedBytes,
5618
+ measuredAtMs
5619
+ });
5620
+ }
5621
+ return out;
5622
+ }
5589
5623
  async aggregatedList() {
5590
5624
  const locations = await this.fetchBackupLocations();
5591
5625
  const out = [];
@@ -6064,7 +6098,7 @@ var BackupOrchestratorAddon = class extends BaseAddon {
6064
6098
  const selection = selectBackupTargets({
6065
6099
  candidates: locations.map((l) => ({
6066
6100
  id: l.id,
6067
- locationEnabled: l.enabled !== false,
6101
+ locationEnabled: mayWriteToLocation(l),
6068
6102
  policyEnabled: (policies.get(l.id) ?? this.fallbackPolicy(l.id)).enabled
6069
6103
  })),
6070
6104
  ...requested && requested.length > 0 ? { requested: [...requested] } : {}
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  //#region src/builtins/console-logging/console-destination.ts
9
9
  var LEVEL_RANK = {
@@ -1,4 +1,4 @@
1
- import { Rt as BaseAddon, dt as logDestinationCapability } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, ht as logDestinationCapability } from "../../dist-BmJpFsC2.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  //#region src/builtins/console-logging/console-destination.ts
4
4
  var LEVEL_RANK = {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-jZb-HKI5.js");
3
+ const require_dist = require("../../dist-BD7M9-5N.js");
4
4
  let node_crypto = require("node:crypto");
5
5
  let node_fs_promises = require("node:fs/promises");
6
6
  node_fs_promises = require_chunk.__toESM(node_fs_promises);
@@ -1,4 +1,4 @@
1
- import { B as coreBlocksCapability, Lt as errMsg, R as coreBlockAddonId, Rt as BaseAddon, c as CORE_BLOCK_ADDON_PREFIX, d as DeclaredDevices, l as CoreBlockSchema, s as CORE_BLOCKS_ADDON_ID, z as coreBlockIdFromAddonId } from "../../dist-CiHYspij.mjs";
1
+ import { B as coreBlockIdFromAddonId, Jt as BaseAddon, V as coreBlocksCapability, c as CORE_BLOCK_ADDON_PREFIX, d as DeclaredDevices, l as CoreBlockSchema, qt as errMsg, s as CORE_BLOCKS_ADDON_ID, z as coreBlockAddonId } from "../../dist-BmJpFsC2.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import * as fs from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-jZb-HKI5.js");
7
- const require_retired_settings_keys = require("../../retired-settings-keys-Dxv9S_lO.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
+ const require_retired_settings_keys = require("../../retired-settings-keys-h7YxHNjB.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let _camstack_types_node = require("@camstack/types/node");
10
10
  //#region src/builtins/device-manager/adoption-job-engine.ts
@@ -1,5 +1,5 @@
1
- import { G as deviceStateCapability, Ht as DeviceFeature, I as buildStreamParamsConfigSchema, K as deviceStatusCapability, Lt as errMsg, Rt as BaseAddon, S as STREAM_PROFILE_META, St as resolveContainerPrimaryChild, Ut as DeviceRole, W as deviceManagerCapability, Wt as DeviceType, X as enumerateSchemaFields, Y as enumerateItemArrayFields, _t as parseStreamParamsFormPatch, a as CAMERA_SWITCH_ORDER, f as DeviceStatusSchema, ht as normalizeUnit, ln as sleep, nn as isDeviceConfigCap, o as CAP_NAMES_WITH_STATUS, qt as WELL_KNOWN_TAB_MAP, t as ALL_CAPABILITY_DEFINITIONS, un as EventCategory, wt as runtimeStatePolicyFor } from "../../dist-CiHYspij.mjs";
2
- import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-DeRxo3vg.mjs";
1
+ import { $t as DeviceRole, G as deviceManagerCapability, Jt as BaseAddon, K as deviceStateCapability, L as buildStreamParamsConfigSchema, Mt as runtimeStatePolicyFor, Qt as DeviceFeature, S as STREAM_PROFILE_META, St as normalizeUnit, X as enumerateItemArrayFields, Z as enumerateSchemaFields, a as CAMERA_SWITCH_ORDER, bn as EventCategory, en as DeviceType, f as DeviceStatusSchema, fn as isDeviceConfigCap, kt as resolveContainerPrimaryChild, o as CAP_NAMES_WITH_STATUS, q as deviceStatusCapability, qt as errMsg, rn as WELL_KNOWN_TAB_MAP, t as ALL_CAPABILITY_DEFINITIONS, wt as parseStreamParamsFormPatch, yn as sleep } from "../../dist-BmJpFsC2.mjs";
2
+ import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-BZJcJj6L.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { canonicalDeviceFingerprint } from "@camstack/types/node";
5
5
  //#region src/builtins/device-manager/adoption-job-engine.ts
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  //#region src/builtins/doorbell/trigger-engine.ts
8
8
  /**
9
9
  * Pure trigger logic for the virtual-doorbell builtin — edge detection over
@@ -1,4 +1,4 @@
1
- import { Lt as errMsg, P as bareAddonId, Rt as BaseAddon, Wt as DeviceType, Z as evaluateSensorEdge, Zt as createEvent, at as isSameAddonId, b as SOURCE_DEVICE_TYPES, ot as isSourceCap, q as doorbellCapability, un as EventCategory, y as SOURCE_CAPS } from "../../dist-CiHYspij.mjs";
1
+ import { F as bareAddonId, J as doorbellCapability, Jt as BaseAddon, Q as evaluateSensorEdge, b as SOURCE_DEVICE_TYPES, bn as EventCategory, ct as isSameAddonId, en as DeviceType, lt as isSourceCap, qt as errMsg, sn as createEvent, y as SOURCE_CAPS } from "../../dist-BmJpFsC2.mjs";
2
2
  //#region src/builtins/doorbell/trigger-engine.ts
3
3
  /**
4
4
  * Pure trigger logic for the virtual-doorbell builtin — edge detection over
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
9
9
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -1,4 +1,4 @@
1
- import { Rt as BaseAddon, dt as logDestinationCapability } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, ht as logDestinationCapability } from "../../dist-BmJpFsC2.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
4
4
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-jZb-HKI5.js");
3
+ const require_dist = require("../../dist-BD7M9-5N.js");
4
4
  //#region src/builtins/liveness-monitor/liveness-checks.ts
5
5
  var NO_DEVICES = "liveness:no-devices";
6
6
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -1,4 +1,4 @@
1
- import { Lt as errMsg, Rt as BaseAddon, Zt as createEvent, un as EventCategory, v as RecordingStatusSchema } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, bn as EventCategory, qt as errMsg, sn as createEvent, v as RecordingStatusSchema } from "../../dist-BmJpFsC2.mjs";
2
2
  //#region src/builtins/liveness-monitor/liveness-checks.ts
3
3
  var NO_DEVICES = "liveness:no-devices";
4
4
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -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-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  node_crypto = require_chunk.__toESM(node_crypto);
9
9
  let crypto$1 = require("crypto");
@@ -1,5 +1,5 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { C as ScopedTokenSchema, D as UserRecordSchema, M as authProviderCapability, Pt as userManagementCapability, Rt as BaseAddon, r as ApiKeyRecordSchema } from "../../dist-CiHYspij.mjs";
2
+ import { C as ScopedTokenSchema, Jt as BaseAddon, N as authProviderCapability, O as UserRecordSchema, Ut as userManagementCapability, r as ApiKeyRecordSchema } from "../../dist-BmJpFsC2.mjs";
3
3
  import * as crypto$2 from "node:crypto";
4
4
  import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
5
5
  import nodeCrypto from "crypto";
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-jZb-HKI5.js");
3
+ const require_dist = require("../../dist-BD7M9-5N.js");
4
4
  const require_tls = require("../../tls-BxQlomxd.js");
5
5
  let node_fs_promises = require("node:fs/promises");
6
6
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Rt as BaseAddon, un as EventCategory, ut as localNetworkCapability } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, bn as EventCategory, mt as localNetworkCapability } from "../../dist-BmJpFsC2.mjs";
2
2
  import { S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, i as writeExtraSans, l as reissueTlsLeaf, n as readTlsAccessStatus, o as validateUploadedTls, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, y as applyLanHttp } from "../../tls-DOTmtLCW.mjs";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import { join } from "node:path";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  //#region src/builtins/loki-logging/loki-payload.ts
8
8
  /**
9
9
  * Loki rejects a label name that is not a valid Prometheus label
@@ -1,4 +1,4 @@
1
- import { Rt as BaseAddon, dt as logDestinationCapability } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, ht as logDestinationCapability } from "../../dist-BmJpFsC2.mjs";
2
2
  //#region src/builtins/loki-logging/loki-payload.ts
3
3
  /**
4
4
  * Loki rejects a label name that is not a valid Prometheus label
@@ -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-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  let node_fs_promises = require("node:fs/promises");
8
8
  let node_child_process = require("node:child_process");
9
9
  let node_util = require("node:util");
@@ -1,4 +1,4 @@
1
- import { Lt as errMsg, Rt as BaseAddon, Zt as createEvent, bt as reducePoints, et as foldSnapshotByFunction, mt as metricsProviderCapability, un as EventCategory, xt as resolveBucketMs } from "../../dist-CiHYspij.mjs";
1
+ import { Dt as reducePoints, Jt as BaseAddon, Ot as resolveBucketMs, bn as EventCategory, bt as metricsProviderCapability, nt as foldSnapshotByFunction, qt as errMsg, sn as createEvent } from "../../dist-BmJpFsC2.mjs";
2
2
  import { readFile, readdir } from "node:fs/promises";
3
3
  import { execFile, execFileSync } from "node:child_process";
4
4
  import { promisify } from "node:util";
@@ -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-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  let node_child_process = require("node:child_process");
8
8
  let node_util = require("node:util");
9
9
  let node_fs = require("node:fs");
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM } from "../../chunk-CNf5ZN-e.mjs";
2
- import { $t as emitReadiness, Dt as scoreRuntimes, J as enumerateInferenceDevices, Lt as errMsg, Rt as BaseAddon, un as EventCategory, vt as platformProbeCapability } from "../../dist-CiHYspij.mjs";
2
+ import { Ft as scoreRuntimes, Jt as BaseAddon, Tt as platformProbeCapability, Y as enumerateInferenceDevices, bn as EventCategory, ln as emitReadiness, qt as errMsg } from "../../dist-BmJpFsC2.mjs";
3
3
  import { execFile } from "node:child_process";
4
4
  import { promisify } from "node:util";
5
5
  import * as fs from "node:fs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
8
8
  /**
9
9
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -1,4 +1,4 @@
1
- import { Rt as BaseAddon, un as EventCategory } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, bn as EventCategory } from "../../dist-BmJpFsC2.mjs";
2
2
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
3
3
  /**
4
4
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -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-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  let zod = require("zod");
8
8
  let node_crypto = require("node:crypto");
9
9
  let _camstack_types_node = require("@camstack/types/node");
@@ -1,4 +1,4 @@
1
- import { F as batteryCapability, Ht as DeviceFeature, Lt as errMsg, Nt as streamQualityLabel, P as bareAddonId, Rt as BaseAddon, U as deriveBatteryPresence, Wt as DeviceType, i as BatteryStatusSchema, kt as snapshotCapability, rn as nodePin, un as EventCategory } from "../../dist-CiHYspij.mjs";
1
+ import { F as bareAddonId, Ht as streamQualityLabel, I as batteryCapability, Jt as BaseAddon, Lt as snapshotCapability, Qt as DeviceFeature, W as deriveBatteryPresence, bn as EventCategory, en as DeviceType, i as BatteryStatusSchema, pn as nodePin, qt as errMsg } from "../../dist-BmJpFsC2.mjs";
2
2
  import { z } from "zod";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { signExpiringUrl, verifyExpiringUrl } from "@camstack/types/node";
@@ -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-jZb-HKI5.js");
6
+ const require_dist = require("../../dist-BD7M9-5N.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { $ as filesystemBrowseCapability, Mt as storageProviderCapability, Rt as BaseAddon } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, Vt as storageProviderCapability, tt as filesystemBrowseCapability } from "../../dist-BmJpFsC2.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The growth-matched drain ratchet (D386).
3
+ *
4
+ * `readonly` takes a location OUT of pressure eviction. `drain` must instead
5
+ * SHRINK it — and priority ordering alone does nothing, because the draining
6
+ * disk and the destination are different physical devices: pressure on one can
7
+ * never trigger eviction on the other.
8
+ *
9
+ * So a draining location gets a **monotonically descending effective usage
10
+ * cap**, enforced through the existing `relieveToUsageCap` machinery rather
11
+ * than a second eviction path. The pace is GROWTH-MATCHED: each sweep, the
12
+ * draining location cedes as many bytes as the ACTIVE locations of its class
13
+ * gained since the previous sweep. There is no operator-facing rate — the
14
+ * operator sets one flag and nothing else.
15
+ *
16
+ * The properties this module exists to hold, each one a named test:
17
+ *
18
+ * - no growth in the destination ⇒ nothing is deleted this sweep;
19
+ * - the cap never rises again — a shrunken cap survives a sweep where growth
20
+ * is negative or unmeasurable;
21
+ * - the state survives a process restart (it is PERSISTED, never recomputed
22
+ * from scratch — a recomputed cap would start again at today's usage and
23
+ * silently undo every byte of progress);
24
+ * - reaching zero stops the ratchet and reports the location as drained;
25
+ * - switching back to `readonly` or `active` stops it immediately (the caller
26
+ * clears the state; nothing here keeps running on its own).
27
+ *
28
+ * Pure. Every input is a parameter, every output is a new object.
29
+ */
30
+ /** What one sweep measured about a draining location and its class. */
31
+ export interface DrainObservation {
32
+ readonly locationId: string;
33
+ /** Evictable bytes on the DRAINING location, now. */
34
+ readonly usedBytes: number;
35
+ /**
36
+ * Evictable bytes held by the ACTIVE locations of the same class, now.
37
+ * `null` when this sweep could not measure them — no active peer, or a
38
+ * provider read that failed. Unmeasurable is NOT zero growth with a
39
+ * different name: it must never be allowed to move the cap in either
40
+ * direction, and it must never be folded into the observed growth rate the
41
+ * estimate is derived from.
42
+ */
43
+ readonly peerUsedBytes: number | null;
44
+ readonly atMs: number;
45
+ }
46
+ /** The persisted ratchet state for one draining location. */
47
+ export interface DrainState {
48
+ readonly locationId: string;
49
+ /** When the drain began. Persisted so a restart reports real elapsed time. */
50
+ readonly startedAtMs: number;
51
+ /** Evictable bytes at that moment — the denominator of "progress". */
52
+ readonly startBytes: number;
53
+ /** The effective usage cap. NEVER rises. */
54
+ readonly capBytes: number;
55
+ /** Peer footprint at the previous sweep; the next sweep's growth is measured
56
+ * against it. `null` until a sweep manages to measure it. */
57
+ readonly lastPeerBytes: number | null;
58
+ readonly lastSweepMs: number;
59
+ /** Total MEASURED growth ceded so far, and the wall time it took. The empty
60
+ * estimate is derived from these two and from nothing else — a rate the
61
+ * system has not observed is reported as absent, never as a date. */
62
+ readonly observedGrowthBytes: number;
63
+ readonly observedElapsedMs: number;
64
+ }
65
+ /** One sweep's decision. */
66
+ export interface DrainStep {
67
+ readonly state: DrainState;
68
+ /**
69
+ * The cap to enforce this sweep, or `null` when nothing is to be evicted —
70
+ * the first sweep (no growth measured yet) and a location already drained.
71
+ */
72
+ readonly capBytes: number | null;
73
+ /** The location holds nothing more: the ratchet stops and the caller reports
74
+ * it drained. */
75
+ readonly drained: boolean;
76
+ /** Growth measured this sweep, or `null` when it was unmeasurable. */
77
+ readonly growthBytes: number | null;
78
+ }
79
+ /** Progress a UI can render. */
80
+ export interface DrainProgress {
81
+ readonly locationId: string;
82
+ readonly startedAtMs: number;
83
+ readonly startBytes: number;
84
+ readonly bytesRemaining: number;
85
+ readonly drained: boolean;
86
+ /**
87
+ * Epoch ms this location is expected to be empty, or `null` when the growth
88
+ * rate is unknown. Never a fabricated date: a drain with no observed growth
89
+ * has no honest ETA, and inventing one is how an operator learns not to
90
+ * believe the screen.
91
+ */
92
+ readonly estimatedEmptyAtMs: number | null;
93
+ }
94
+ /** The state a drain starts from. No deletion happens on this sweep. */
95
+ export declare function beginDrain(observation: DrainObservation): DrainState;
96
+ /**
97
+ * Advance the ratchet by one sweep. `previous` is `null` on the first sweep of
98
+ * a drain (and after a state the caller cleared), which only ARMS the ratchet:
99
+ * the first growth can be measured no earlier than the second sweep, and a cap
100
+ * derived from no measurement would be a rate the operator never asked for.
101
+ */
102
+ export declare function stepDrain(previous: DrainState | null, observation: DrainObservation): DrainStep;
103
+ /** Progress for a UI, derived from the persisted state and today's usage. */
104
+ export declare function drainProgressOf(state: DrainState, usedBytes: number, nowMs: number): DrainProgress;
@@ -0,0 +1,13 @@
1
+ import { ISettingsStoreProvider } from '@camstack/types';
2
+ import { DrainState } from './drain-ratchet.js';
3
+ import { DrainStateStore } from './storage-pressure-manager.js';
4
+ /** {@link DrainStateStore} on the `settings-store` collection surface. */
5
+ export declare class SqliteDrainStateStore implements DrainStateStore {
6
+ private readonly store;
7
+ private declared;
8
+ constructor(store: ISettingsStoreProvider);
9
+ private ensureDeclared;
10
+ load(): Promise<readonly DrainState[]>;
11
+ save(state: DrainState): Promise<void>;
12
+ clear(locationId: string): Promise<void>;
13
+ }