@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
@@ -1,4 +1,5 @@
1
1
  import { IScopedLogger, IStorageProviderImpl, StorageAccess, StorageLocation, StorageLocationDeclaration, StorageLocationRef } from '@camstack/types';
2
+ import { ResolveRoot } from './location-root-collision.js';
2
3
  import { ILocationStore } from './location-store.js';
3
4
  export interface ListLocationsFilter {
4
5
  readonly type?: string;
@@ -184,27 +185,33 @@ export declare class StorageOrchestratorService {
184
185
  */
185
186
  attachStore(store: ILocationStore): Promise<void>;
186
187
  /**
187
- * ONE explicit migration onto the enabled write set (D383), run once per
188
- * boot against the rows that came off disk. Idempotent: the second boot finds
188
+ * ONE explicit migration onto the four-state model (D385), run once per boot
189
+ * against the rows that came off disk. Idempotent: the second boot finds
189
190
  * nothing to do.
190
191
  *
191
192
  * Two steps, in order, and each one is a WRITE — the point is that "absent"
192
193
  * stops existing rather than being re-interpreted on every read forever:
193
194
  *
194
- * 1. A flagless row (persisted before `enabled` existed) is stamped
195
- * `enabled: true`. Absence already meant active, so this preserves
196
- * behaviour exactly; it is the operator's "the initial locations are
197
- * enabled" spelled into the store.
198
- * 2. A type left with NO enabled row — only reachable from a hand-edited
199
- * store or a row an older build wrote — gets one enabled back, chosen as
195
+ * 1. A row with no `mode` is stamped with the mode its legacy flags imply
196
+ * (`legacyModeOf`): `config.readOnly === true` → `readonly` and the
197
+ * config key is DELETED; `enabled === false` → `readonly` (the
198
+ * CONSERVATIVE direction — a state change must never start deleting
199
+ * footage on its own); everything else → `active`. `withLocationMode`
200
+ * derives `enabled` from the mode, so the two can never disagree, and
201
+ * this subsumes the D383 pass that stamped flagless rows `enabled: true`.
202
+ * 2. A type left with NO write target — only reachable from a hand-edited
203
+ * store or a row an older build wrote — gets one made `active`, chosen as
200
204
  * the row the RETIRED default flag named, else the `:default`-slugged
201
205
  * row, else the lexicographically first. Loudly: a class with no write
202
206
  * target records nowhere, and refusing to repair it here would leave the
203
207
  * hub silently unable to write with no operator action pending.
204
208
  *
205
- * An operator's explicit `enabled: false` is never reversed by step 1 — only
206
- * step 2 touches it, and only when the alternative is a class that cannot
207
- * write at all.
209
+ * An operator's explicit `readonly`/`drain`/`disabled` is never reversed by
210
+ * step 1 — only step 2 touches it, and only when the alternative is a class
211
+ * that cannot write at all.
212
+ *
213
+ * On the live hub every location is enabled with no `readOnly`, so step 1 is
214
+ * a no-op that stamps `active` and nothing else changes.
208
215
  */
209
216
  private migrateOntoTheWriteSet;
210
217
  /** Apply one migrated row in memory and mirror it to the store. */
@@ -443,6 +450,20 @@ export declare class StorageOrchestratorService {
443
450
  readonly backupBasePath?: string;
444
451
  readonly declarations: readonly StorageLocationDeclaration[];
445
452
  }): void;
453
+ /**
454
+ * The same-type physical-root refusal (D389).
455
+ *
456
+ * An unresolvable root — another node's disk, a remote provider, a path that
457
+ * does not exist yet — WARNS and lets the write through. Refusing on a read
458
+ * that could not be taken blocks the operator on a doubt, and the recorder's
459
+ * demotion still catches what slips past (D49's spirit).
460
+ */
461
+ private refuseSameTypeRootCollision;
462
+ /** Injectable so a test can drive symlinks and unresolvable paths without
463
+ * touching a real filesystem. Production takes the shared derivation. */
464
+ private resolveRoot;
465
+ /** Test seam for {@link refuseSameTypeRootCollision}. */
466
+ setRootResolver(resolveRoot: ResolveRoot): void;
446
467
  /** Internal: check whether any location of the given type exists. */
447
468
  private hasAnyLocationOfType;
448
469
  }
@@ -1,4 +1,26 @@
1
1
  import { IScopedLogger, IStorageEvictableProvider } from '@camstack/types';
2
+ import { DrainProgress, DrainState } from './drain-ratchet.js';
3
+ /**
4
+ * One draining location and the ACTIVE locations of its class the drain is
5
+ * paced against (D386). Supplied by the orchestrator, which is the only thing
6
+ * that knows a location's mode.
7
+ */
8
+ export interface DrainPlanEntry {
9
+ readonly locationId: string;
10
+ /** Locations of the SAME class whose growth the drain is matched to. Empty
11
+ * means the pace is unmeasurable and the cap stands still. */
12
+ readonly activePeerLocationIds: readonly string[];
13
+ }
14
+ /**
15
+ * Durable home for the ratchet state. It MUST survive a process restart: a cap
16
+ * recomputed from today's usage starts again at the top and silently undoes
17
+ * every byte of progress.
18
+ */
19
+ export interface DrainStateStore {
20
+ load(): Promise<readonly DrainState[]>;
21
+ save(state: DrainState): Promise<void>;
22
+ clear(locationId: string): Promise<void>;
23
+ }
2
24
  /**
3
25
  * StoragePressureManager — core-owned TRIGGER for disk-space relief.
4
26
  *
@@ -50,12 +72,35 @@ export interface PressureManagerDeps {
50
72
  * independently), preserving prior single-disk behaviour.
51
73
  */
52
74
  readonly getLocationDeviceKey?: (locationId: string) => Promise<string | null>;
75
+ /** Locations in `drain` mode, each with the active peers of its class.
76
+ * Absent → no drain (the behaviour before D386). */
77
+ readonly getDrainPlan?: () => Promise<readonly DrainPlanEntry[]>;
78
+ /** Where the ratchet state lives across restarts. Absent → drain is inert:
79
+ * without persistence the cap would reset on every boot, which is worse
80
+ * than not draining. */
81
+ readonly drainState?: DrainStateStore;
53
82
  }
54
83
  export declare class StoragePressureManager {
55
84
  private readonly deps;
85
+ /** Last sweep's drain progress, by location. Read-only surface for the UI. */
86
+ private drainProgress;
56
87
  constructor(deps: PressureManagerDeps);
57
88
  /** Relieve every managed location currently under its threshold. */
58
89
  sweep(): Promise<void>;
90
+ /**
91
+ * The drain pass (D386). A `drain` location is excluded from nothing — it is
92
+ * given a monotonically descending effective usage cap and handed to the SAME
93
+ * `relieveToUsageCap` machinery every other cap uses. There is no second
94
+ * eviction path, and no operator-facing rate.
95
+ */
96
+ private sweepDrains;
97
+ /** Progress for every draining location, as of the last sweep. The read a UI
98
+ * asks for — it never triggers work of its own. */
99
+ drainProgressSnapshot(): readonly DrainProgress[];
100
+ /** Evictable bytes on one location, summed across every provider. */
101
+ private evictableUsageOf;
102
+ /** Evictable bytes across a set of locations. */
103
+ private evictableUsageOfAll;
59
104
  /** Evict oldest-first until the location's evictable usage fits `maxBytes`. */
60
105
  private relieveToUsageCap;
61
106
  /**
@@ -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/system-config/system-config.addon.ts
8
8
  /**
9
9
  * Built-in `system-config` addon — Phase 4 of the settings redesign.
@@ -1,4 +1,4 @@
1
- import { Lt as errMsg, Rt as BaseAddon, tn as hydrateSchema } from "../../dist-CiHYspij.mjs";
1
+ import { Jt as BaseAddon, dn as hydrateSchema, qt as errMsg } from "../../dist-BmJpFsC2.mjs";
2
2
  //#region src/builtins/system-config/system-config.addon.ts
3
3
  /**
4
4
  * Built-in `system-config` addon — Phase 4 of the settings redesign.
@@ -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_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 { 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
  import * as path$1 from "node:path";
4
4
  import path from "node:path";