@camstack/system 1.2.28 → 1.2.30
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.
- package/dist/addon-runner.js +3 -3
- package/dist/addon-runner.mjs +2 -2
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.d.ts +0 -7
- package/dist/builtins/alerts/alerts.addon.js +47 -25
- package/dist/builtins/alerts/alerts.addon.mjs +47 -25
- package/dist/builtins/alerts/prune-policy.d.ts +44 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/filter-compiler.d.ts +61 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +50 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +8 -2
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +136 -64
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +136 -64
- package/dist/builtins/storage-orchestrator/data-store-dispatch.d.ts +12 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +18 -7
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +80 -11
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +80 -11
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{dist-BXmFvn3h.mjs → dist-Dr_P0DOB.mjs} +492 -166
- package/dist/{dist-BxtIzexq.js → dist-VIwdvws5.js} +497 -165
- package/dist/index.d.ts +2 -0
- package/dist/index.js +150 -2
- package/dist/index.mjs +146 -3
- package/dist/kernel/addon-installer.d.ts +38 -0
- package/dist/kernel/heap-watch.d.ts +36 -0
- package/dist/kernel/transport/uds-event-bus.d.ts +4 -1
- package/dist/{manifest-python-deps-KZ00cbfP.js → manifest-python-deps-BqE5j0-O.js} +25 -4
- package/dist/{manifest-python-deps-BNOApgK0.mjs → manifest-python-deps-Ck4-9K9m.mjs} +25 -4
- package/package.json +7 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IDataStoreProvider, ISettingsStoreProvider } from '@camstack/types';
|
|
2
|
+
/** How the dispatcher reaches the registered engines, read per call. */
|
|
3
|
+
export type GetDataStoreEngines = () => readonly IDataStoreProvider[];
|
|
4
|
+
/**
|
|
5
|
+
* Build the `settings-store` provider that fronts the registered engines.
|
|
6
|
+
*
|
|
7
|
+
* `getEngines` is read on every call, never captured: engines register
|
|
8
|
+
* during boot and a runner respawn replaces the instance, so a snapshot
|
|
9
|
+
* taken at construction time would go stale exactly when an addon crashed
|
|
10
|
+
* and came back.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createDataStoreDispatch(getEngines: GetDataStoreEngines): ISettingsStoreProvider;
|
|
@@ -25,16 +25,27 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
25
25
|
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
26
26
|
protected onShutdown(): Promise<void>;
|
|
27
27
|
/**
|
|
28
|
-
* Resolve the live
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* Resolve the live engine from the capability registry and wrap it in a
|
|
29
|
+
* `SqliteLocationStore`. Returns `null` when no engine has registered
|
|
30
|
+
* yet — the service falls back to in-memory only. Production boot order
|
|
31
|
+
* (`data-store-provider` precedes `storage` in `INFRA_CAPABILITIES`)
|
|
32
|
+
* makes this the rare path.
|
|
33
|
+
*
|
|
34
|
+
* Reads the ENGINE, not the `settings-store` singleton: since D44 this
|
|
35
|
+
* addon *is* that singleton, so asking the registry for it would hand
|
|
36
|
+
* the orchestrator its own dispatcher and route its location table back
|
|
37
|
+
* through itself.
|
|
38
|
+
*
|
|
39
|
+
* The `ensureTable` / `tableInsert` reach-around below is the B2 bypass,
|
|
40
|
+
* still open: those six methods live on the concrete backend and on no
|
|
41
|
+
* cap. Promoting them to the door is a separate task; until then this
|
|
42
|
+
* holds the engine object directly, which only works because the engine
|
|
43
|
+
* is in-process on this node.
|
|
33
44
|
*/
|
|
34
45
|
private resolveLocationStore;
|
|
35
46
|
/**
|
|
36
|
-
* Late-wire the persistence store once
|
|
37
|
-
* Production boot order means the store is usually absent at
|
|
47
|
+
* Late-wire the persistence store once a `data-store-provider` engine
|
|
48
|
+
* registers. Production boot order means the store is usually absent at
|
|
38
49
|
* `onInitialize`; this runs on every `capability:provider-registered`
|
|
39
50
|
* event until it succeeds. Single-flighted + idempotent (the service
|
|
40
51
|
* ignores a second attach). Without this, operator edits (e.g. a
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-VIwdvws5.js");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_chunk.__toESM(node_path);
|
|
9
9
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -730,6 +730,55 @@ async function collectProviderInfos(providers, onError) {
|
|
|
730
730
|
return out;
|
|
731
731
|
}
|
|
732
732
|
//#endregion
|
|
733
|
+
//#region src/builtins/storage-orchestrator/data-store-dispatch.ts
|
|
734
|
+
/**
|
|
735
|
+
* Pick the engine to serve a call.
|
|
736
|
+
*
|
|
737
|
+
* Today the rule is "the only one there is". Two cases are refused rather
|
|
738
|
+
* than guessed:
|
|
739
|
+
*
|
|
740
|
+
* - **none registered** — resolving to a no-op would make every read
|
|
741
|
+
* answer `undefined` and every write disappear, which reads exactly
|
|
742
|
+
* like an empty database;
|
|
743
|
+
* - **more than one** — there is no routing rule yet. The `engine` hint
|
|
744
|
+
* on `declareCollection` is what will choose, and until it exists a
|
|
745
|
+
* silent pick would send a collection to whichever engine happened to
|
|
746
|
+
* register first.
|
|
747
|
+
*/
|
|
748
|
+
function resolveEngine(getEngines) {
|
|
749
|
+
const engines = getEngines();
|
|
750
|
+
if (engines.length === 0) throw new Error("settings-store: no data-store-provider engine is registered — the data door has nothing behind it");
|
|
751
|
+
if (engines.length > 1) throw new Error(`settings-store: ${engines.length} data-store-provider engines are registered and there is no routing rule yet — declare the engine on the collection first`);
|
|
752
|
+
const engine = engines[0];
|
|
753
|
+
if (!engine) throw new Error("settings-store: data-store-provider collection yielded an empty entry");
|
|
754
|
+
return engine;
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Build the `settings-store` provider that fronts the registered engines.
|
|
758
|
+
*
|
|
759
|
+
* `getEngines` is read on every call, never captured: engines register
|
|
760
|
+
* during boot and a runner respawn replaces the instance, so a snapshot
|
|
761
|
+
* taken at construction time would go stale exactly when an addon crashed
|
|
762
|
+
* and came back.
|
|
763
|
+
*/
|
|
764
|
+
function createDataStoreDispatch(getEngines) {
|
|
765
|
+
const engine = async () => resolveEngine(getEngines);
|
|
766
|
+
return {
|
|
767
|
+
get: async (input) => (await engine()).get(input),
|
|
768
|
+
set: async (input) => (await engine()).set(input),
|
|
769
|
+
query: async (input) => (await engine()).query(input),
|
|
770
|
+
insert: async (input) => (await engine()).insert(input),
|
|
771
|
+
update: async (input) => (await engine()).update(input),
|
|
772
|
+
delete: async (input) => (await engine()).delete(input),
|
|
773
|
+
deleteWhere: async (input) => (await engine()).deleteWhere(input),
|
|
774
|
+
updateWhere: async (input) => (await engine()).updateWhere(input),
|
|
775
|
+
count: async (input) => (await engine()).count(input),
|
|
776
|
+
histogram: async (input) => (await engine()).histogram(input),
|
|
777
|
+
isEmpty: async (input) => (await engine()).isEmpty(input),
|
|
778
|
+
declareCollection: async (input) => (await engine()).declareCollection(input)
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
//#endregion
|
|
733
782
|
//#region src/builtins/storage-orchestrator/storage-pressure-manager.ts
|
|
734
783
|
var DEFAULT_MAX_ROUNDS = 8;
|
|
735
784
|
var DEFAULT_HYSTERESIS_PERCENT = 1;
|
|
@@ -891,6 +940,7 @@ var StoragePressureManager = class {
|
|
|
891
940
|
* Task 7 will migrate consumers off the legacy storage shim.
|
|
892
941
|
*/
|
|
893
942
|
var STORAGE_PROVIDER_CAP_NAME = "storage-provider";
|
|
943
|
+
var DATA_STORE_PROVIDER_CAP_NAME = "data-store-provider";
|
|
894
944
|
var STORAGE_EVICTABLE_CAP_NAME = "storage-evictable";
|
|
895
945
|
/**
|
|
896
946
|
* Single-node default: existing node-local locations live on the hub.
|
|
@@ -935,6 +985,11 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
935
985
|
if (!reg) return [];
|
|
936
986
|
return reg.getCollection(STORAGE_PROVIDER_CAP_NAME);
|
|
937
987
|
};
|
|
988
|
+
const getEngines = () => {
|
|
989
|
+
const reg = this.ctx.kernel.capabilityRegistry;
|
|
990
|
+
if (!reg) return [];
|
|
991
|
+
return reg.getCollection(DATA_STORE_PROVIDER_CAP_NAME);
|
|
992
|
+
};
|
|
938
993
|
const locationStore = this.resolveLocationStore();
|
|
939
994
|
const service = new StorageOrchestratorService(this.ctx.logger, getProviders, locationStore, this.ctx.kernel.localNodeId ?? "hub", (nodeId) => {
|
|
940
995
|
const proxy = this.ctx.kernel.resolveNodeCapability?.("storage-provider", nodeId);
|
|
@@ -1126,6 +1181,9 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
1126
1181
|
return [{
|
|
1127
1182
|
capability: require_dist.storageCapability,
|
|
1128
1183
|
provider
|
|
1184
|
+
}, {
|
|
1185
|
+
capability: require_dist.settingsStoreCapability,
|
|
1186
|
+
provider: createDataStoreDispatch(getEngines)
|
|
1129
1187
|
}];
|
|
1130
1188
|
}
|
|
1131
1189
|
async onShutdown() {
|
|
@@ -1142,18 +1200,29 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
1142
1200
|
this.service = null;
|
|
1143
1201
|
}
|
|
1144
1202
|
/**
|
|
1145
|
-
* Resolve the live
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1203
|
+
* Resolve the live engine from the capability registry and wrap it in a
|
|
1204
|
+
* `SqliteLocationStore`. Returns `null` when no engine has registered
|
|
1205
|
+
* yet — the service falls back to in-memory only. Production boot order
|
|
1206
|
+
* (`data-store-provider` precedes `storage` in `INFRA_CAPABILITIES`)
|
|
1207
|
+
* makes this the rare path.
|
|
1208
|
+
*
|
|
1209
|
+
* Reads the ENGINE, not the `settings-store` singleton: since D44 this
|
|
1210
|
+
* addon *is* that singleton, so asking the registry for it would hand
|
|
1211
|
+
* the orchestrator its own dispatcher and route its location table back
|
|
1212
|
+
* through itself.
|
|
1213
|
+
*
|
|
1214
|
+
* The `ensureTable` / `tableInsert` reach-around below is the B2 bypass,
|
|
1215
|
+
* still open: those six methods live on the concrete backend and on no
|
|
1216
|
+
* cap. Promoting them to the door is a separate task; until then this
|
|
1217
|
+
* holds the engine object directly, which only works because the engine
|
|
1218
|
+
* is in-process on this node.
|
|
1150
1219
|
*/
|
|
1151
1220
|
resolveLocationStore(quiet = false) {
|
|
1152
1221
|
const reg = this.ctx.kernel.capabilityRegistry;
|
|
1153
1222
|
if (!reg) return null;
|
|
1154
|
-
const backend = reg.
|
|
1223
|
+
const backend = reg.getCollection(DATA_STORE_PROVIDER_CAP_NAME)[0];
|
|
1155
1224
|
if (!backend) {
|
|
1156
|
-
if (!quiet) this.ctx.logger.warn("storage-orchestrator: no
|
|
1225
|
+
if (!quiet) this.ctx.logger.warn("storage-orchestrator: no data-store-provider engine yet — running in-memory until one registers");
|
|
1157
1226
|
return null;
|
|
1158
1227
|
}
|
|
1159
1228
|
if (!backend.ensureTable || !backend.tableInsert) {
|
|
@@ -1163,8 +1232,8 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
1163
1232
|
return new SqliteLocationStore(backend);
|
|
1164
1233
|
}
|
|
1165
1234
|
/**
|
|
1166
|
-
* Late-wire the persistence store once
|
|
1167
|
-
* Production boot order means the store is usually absent at
|
|
1235
|
+
* Late-wire the persistence store once a `data-store-provider` engine
|
|
1236
|
+
* registers. Production boot order means the store is usually absent at
|
|
1168
1237
|
* `onInitialize`; this runs on every `capability:provider-registered`
|
|
1169
1238
|
* event until it succeeds. Single-flighted + idempotent (the service
|
|
1170
1239
|
* ignores a second attach). Without this, operator edits (e.g. a
|
|
@@ -1178,7 +1247,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
1178
1247
|
if (this.storeWireInFlight) return this.storeWireInFlight;
|
|
1179
1248
|
const store = this.resolveLocationStore(true);
|
|
1180
1249
|
if (!store) return;
|
|
1181
|
-
this.ctx.logger.info("storage-orchestrator:
|
|
1250
|
+
this.ctx.logger.info("storage-orchestrator: data-store engine now available — wiring persistence");
|
|
1182
1251
|
this.storeWireInFlight = service.attachStore(store).then(() => this.seedFromDeclarations()).catch((err) => {
|
|
1183
1252
|
this.ctx.logger.error("storage-orchestrator: attachStore failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
1184
1253
|
}).finally(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as storageCapability, Et as parseJsonObject, Z as settingsStoreCapability, d as StorageLocationTypeSchema, ot as BaseAddon } from "../../dist-Dr_P0DOB.mjs";
|
|
2
2
|
import * as path$1 from "node:path";
|
|
3
3
|
import * as fs from "node:fs/promises";
|
|
4
4
|
import { buildStorageLocationRegistry } from "@camstack/system";
|
|
@@ -723,6 +723,55 @@ async function collectProviderInfos(providers, onError) {
|
|
|
723
723
|
return out;
|
|
724
724
|
}
|
|
725
725
|
//#endregion
|
|
726
|
+
//#region src/builtins/storage-orchestrator/data-store-dispatch.ts
|
|
727
|
+
/**
|
|
728
|
+
* Pick the engine to serve a call.
|
|
729
|
+
*
|
|
730
|
+
* Today the rule is "the only one there is". Two cases are refused rather
|
|
731
|
+
* than guessed:
|
|
732
|
+
*
|
|
733
|
+
* - **none registered** — resolving to a no-op would make every read
|
|
734
|
+
* answer `undefined` and every write disappear, which reads exactly
|
|
735
|
+
* like an empty database;
|
|
736
|
+
* - **more than one** — there is no routing rule yet. The `engine` hint
|
|
737
|
+
* on `declareCollection` is what will choose, and until it exists a
|
|
738
|
+
* silent pick would send a collection to whichever engine happened to
|
|
739
|
+
* register first.
|
|
740
|
+
*/
|
|
741
|
+
function resolveEngine(getEngines) {
|
|
742
|
+
const engines = getEngines();
|
|
743
|
+
if (engines.length === 0) throw new Error("settings-store: no data-store-provider engine is registered — the data door has nothing behind it");
|
|
744
|
+
if (engines.length > 1) throw new Error(`settings-store: ${engines.length} data-store-provider engines are registered and there is no routing rule yet — declare the engine on the collection first`);
|
|
745
|
+
const engine = engines[0];
|
|
746
|
+
if (!engine) throw new Error("settings-store: data-store-provider collection yielded an empty entry");
|
|
747
|
+
return engine;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Build the `settings-store` provider that fronts the registered engines.
|
|
751
|
+
*
|
|
752
|
+
* `getEngines` is read on every call, never captured: engines register
|
|
753
|
+
* during boot and a runner respawn replaces the instance, so a snapshot
|
|
754
|
+
* taken at construction time would go stale exactly when an addon crashed
|
|
755
|
+
* and came back.
|
|
756
|
+
*/
|
|
757
|
+
function createDataStoreDispatch(getEngines) {
|
|
758
|
+
const engine = async () => resolveEngine(getEngines);
|
|
759
|
+
return {
|
|
760
|
+
get: async (input) => (await engine()).get(input),
|
|
761
|
+
set: async (input) => (await engine()).set(input),
|
|
762
|
+
query: async (input) => (await engine()).query(input),
|
|
763
|
+
insert: async (input) => (await engine()).insert(input),
|
|
764
|
+
update: async (input) => (await engine()).update(input),
|
|
765
|
+
delete: async (input) => (await engine()).delete(input),
|
|
766
|
+
deleteWhere: async (input) => (await engine()).deleteWhere(input),
|
|
767
|
+
updateWhere: async (input) => (await engine()).updateWhere(input),
|
|
768
|
+
count: async (input) => (await engine()).count(input),
|
|
769
|
+
histogram: async (input) => (await engine()).histogram(input),
|
|
770
|
+
isEmpty: async (input) => (await engine()).isEmpty(input),
|
|
771
|
+
declareCollection: async (input) => (await engine()).declareCollection(input)
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
//#endregion
|
|
726
775
|
//#region src/builtins/storage-orchestrator/storage-pressure-manager.ts
|
|
727
776
|
var DEFAULT_MAX_ROUNDS = 8;
|
|
728
777
|
var DEFAULT_HYSTERESIS_PERCENT = 1;
|
|
@@ -884,6 +933,7 @@ var StoragePressureManager = class {
|
|
|
884
933
|
* Task 7 will migrate consumers off the legacy storage shim.
|
|
885
934
|
*/
|
|
886
935
|
var STORAGE_PROVIDER_CAP_NAME = "storage-provider";
|
|
936
|
+
var DATA_STORE_PROVIDER_CAP_NAME = "data-store-provider";
|
|
887
937
|
var STORAGE_EVICTABLE_CAP_NAME = "storage-evictable";
|
|
888
938
|
/**
|
|
889
939
|
* Single-node default: existing node-local locations live on the hub.
|
|
@@ -928,6 +978,11 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
928
978
|
if (!reg) return [];
|
|
929
979
|
return reg.getCollection(STORAGE_PROVIDER_CAP_NAME);
|
|
930
980
|
};
|
|
981
|
+
const getEngines = () => {
|
|
982
|
+
const reg = this.ctx.kernel.capabilityRegistry;
|
|
983
|
+
if (!reg) return [];
|
|
984
|
+
return reg.getCollection(DATA_STORE_PROVIDER_CAP_NAME);
|
|
985
|
+
};
|
|
931
986
|
const locationStore = this.resolveLocationStore();
|
|
932
987
|
const service = new StorageOrchestratorService(this.ctx.logger, getProviders, locationStore, this.ctx.kernel.localNodeId ?? "hub", (nodeId) => {
|
|
933
988
|
const proxy = this.ctx.kernel.resolveNodeCapability?.("storage-provider", nodeId);
|
|
@@ -1119,6 +1174,9 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
1119
1174
|
return [{
|
|
1120
1175
|
capability: storageCapability,
|
|
1121
1176
|
provider
|
|
1177
|
+
}, {
|
|
1178
|
+
capability: settingsStoreCapability,
|
|
1179
|
+
provider: createDataStoreDispatch(getEngines)
|
|
1122
1180
|
}];
|
|
1123
1181
|
}
|
|
1124
1182
|
async onShutdown() {
|
|
@@ -1135,18 +1193,29 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
1135
1193
|
this.service = null;
|
|
1136
1194
|
}
|
|
1137
1195
|
/**
|
|
1138
|
-
* Resolve the live
|
|
1139
|
-
*
|
|
1140
|
-
*
|
|
1141
|
-
*
|
|
1142
|
-
*
|
|
1196
|
+
* Resolve the live engine from the capability registry and wrap it in a
|
|
1197
|
+
* `SqliteLocationStore`. Returns `null` when no engine has registered
|
|
1198
|
+
* yet — the service falls back to in-memory only. Production boot order
|
|
1199
|
+
* (`data-store-provider` precedes `storage` in `INFRA_CAPABILITIES`)
|
|
1200
|
+
* makes this the rare path.
|
|
1201
|
+
*
|
|
1202
|
+
* Reads the ENGINE, not the `settings-store` singleton: since D44 this
|
|
1203
|
+
* addon *is* that singleton, so asking the registry for it would hand
|
|
1204
|
+
* the orchestrator its own dispatcher and route its location table back
|
|
1205
|
+
* through itself.
|
|
1206
|
+
*
|
|
1207
|
+
* The `ensureTable` / `tableInsert` reach-around below is the B2 bypass,
|
|
1208
|
+
* still open: those six methods live on the concrete backend and on no
|
|
1209
|
+
* cap. Promoting them to the door is a separate task; until then this
|
|
1210
|
+
* holds the engine object directly, which only works because the engine
|
|
1211
|
+
* is in-process on this node.
|
|
1143
1212
|
*/
|
|
1144
1213
|
resolveLocationStore(quiet = false) {
|
|
1145
1214
|
const reg = this.ctx.kernel.capabilityRegistry;
|
|
1146
1215
|
if (!reg) return null;
|
|
1147
|
-
const backend = reg.
|
|
1216
|
+
const backend = reg.getCollection(DATA_STORE_PROVIDER_CAP_NAME)[0];
|
|
1148
1217
|
if (!backend) {
|
|
1149
|
-
if (!quiet) this.ctx.logger.warn("storage-orchestrator: no
|
|
1218
|
+
if (!quiet) this.ctx.logger.warn("storage-orchestrator: no data-store-provider engine yet — running in-memory until one registers");
|
|
1150
1219
|
return null;
|
|
1151
1220
|
}
|
|
1152
1221
|
if (!backend.ensureTable || !backend.tableInsert) {
|
|
@@ -1156,8 +1225,8 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
1156
1225
|
return new SqliteLocationStore(backend);
|
|
1157
1226
|
}
|
|
1158
1227
|
/**
|
|
1159
|
-
* Late-wire the persistence store once
|
|
1160
|
-
* Production boot order means the store is usually absent at
|
|
1228
|
+
* Late-wire the persistence store once a `data-store-provider` engine
|
|
1229
|
+
* registers. Production boot order means the store is usually absent at
|
|
1161
1230
|
* `onInitialize`; this runs on every `capability:provider-registered`
|
|
1162
1231
|
* event until it succeeds. Single-flighted + idempotent (the service
|
|
1163
1232
|
* ignores a second attach). Without this, operator edits (e.g. a
|
|
@@ -1171,7 +1240,7 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
1171
1240
|
if (this.storeWireInFlight) return this.storeWireInFlight;
|
|
1172
1241
|
const store = this.resolveLocationStore(true);
|
|
1173
1242
|
if (!store) return;
|
|
1174
|
-
this.ctx.logger.info("storage-orchestrator:
|
|
1243
|
+
this.ctx.logger.info("storage-orchestrator: data-store engine now available — wiring persistence");
|
|
1175
1244
|
this.storeWireInFlight = service.attachStore(store).then(() => this.seedFromDeclarations()).catch((err) => {
|
|
1176
1245
|
this.ctx.logger.error("storage-orchestrator: attachStore failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
1177
1246
|
}).finally(() => {
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-VIwdvws5.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 {
|
|
1
|
+
import { Ct as hydrateSchema, at as errMsg, ot as BaseAddon } from "../../dist-Dr_P0DOB.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-
|
|
6
|
+
const require_dist = require("../../dist-VIwdvws5.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 {
|
|
1
|
+
import { B as logDestinationCapability, ot as BaseAddon } from "../../dist-Dr_P0DOB.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";
|