@camstack/system 1.1.3 → 1.1.4

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.
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_manifest_python_deps = require("./manifest-python-deps-RihGbmpb.js");
2
+ const require_manifest_python_deps = require("./manifest-python-deps-LVY7BATp.js");
3
3
  const require_custom_action_registry = require("./custom-action-registry-vLYEFTtv.js");
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_chunk.__toESM(node_fs);
@@ -1,4 +1,4 @@
1
- import { $ as setWorkerNativeCapsChangeListener, A as createUdsLoggerWithControl, X as getWorkerNativeCapProvider, Z as getWorkerNativeCapSnapshot, i as createUdsAddonContext, j as LocalChildClient, mt as resolveAddonClass, pt as installManifestNativeDeps, t as installManifestPythonDeps, tt as validateProviderRegistrations } from "./manifest-python-deps-8Wvwz-d1.mjs";
1
+ import { $ as setWorkerNativeCapsChangeListener, A as createUdsLoggerWithControl, X as getWorkerNativeCapProvider, Z as getWorkerNativeCapSnapshot, i as createUdsAddonContext, j as LocalChildClient, mt as resolveAddonClass, pt as installManifestNativeDeps, t as installManifestPythonDeps, tt as validateProviderRegistrations } from "./manifest-python-deps-kMVttwkC.mjs";
2
2
  import { t as CustomActionRegistry } from "./custom-action-registry-BEXwC-oo.mjs";
3
3
  import { register } from "node:module";
4
4
  import * as fs from "node:fs";
@@ -1568,12 +1568,7 @@ var BackupOrchestratorAddon = class extends _camstack_types.BaseAddon {
1568
1568
  super({});
1569
1569
  }
1570
1570
  async onInitialize() {
1571
- const envDataPath = process.env["CAMSTACK_DATA"];
1572
- const fallbackLocation = await this.ctx.api.storage.resolve.query({
1573
- location: "data",
1574
- relativePath: ""
1575
- }).catch(() => null);
1576
- this.dataDir = envDataPath ?? (fallbackLocation ? parentDir(fallbackLocation) : "camstack-data");
1571
+ this.dataDir = this.ctx.nodeDataDir;
1577
1572
  this.systemBackup = new SystemBackupService(this.dataDir, this.ctx.logger);
1578
1573
  this.policies = this.resolvePolicyService();
1579
1574
  if (this.policies) try {
@@ -2213,17 +2208,6 @@ function latestArchiveOf(manifest) {
2213
2208
  for (const a of manifest.archives) if (a.createdAt > newest.createdAt) newest = a;
2214
2209
  return newest;
2215
2210
  }
2216
- /**
2217
- * Tiny `path.dirname`-equivalent that only depends on `/` and `\`.
2218
- * Avoids a `node:path` import in this module purely so the
2219
- * destination-policy.ts and manifest-store.ts neighbours stay node-
2220
- * builtin-free at the import surface.
2221
- */
2222
- function parentDir(p) {
2223
- const sep = p.includes("/") ? "/" : "\\";
2224
- const i = p.lastIndexOf(sep);
2225
- return i <= 0 ? "" : p.slice(0, i);
2226
- }
2227
2211
  //#endregion
2228
2212
  exports.BackupOrchestratorAddon = BackupOrchestratorAddon;
2229
2213
  exports.default = BackupOrchestratorAddon;
@@ -1560,12 +1560,7 @@ var BackupOrchestratorAddon = class extends BaseAddon {
1560
1560
  super({});
1561
1561
  }
1562
1562
  async onInitialize() {
1563
- const envDataPath = process.env["CAMSTACK_DATA"];
1564
- const fallbackLocation = await this.ctx.api.storage.resolve.query({
1565
- location: "data",
1566
- relativePath: ""
1567
- }).catch(() => null);
1568
- this.dataDir = envDataPath ?? (fallbackLocation ? parentDir(fallbackLocation) : "camstack-data");
1563
+ this.dataDir = this.ctx.nodeDataDir;
1569
1564
  this.systemBackup = new SystemBackupService(this.dataDir, this.ctx.logger);
1570
1565
  this.policies = this.resolvePolicyService();
1571
1566
  if (this.policies) try {
@@ -2205,16 +2200,5 @@ function latestArchiveOf(manifest) {
2205
2200
  for (const a of manifest.archives) if (a.createdAt > newest.createdAt) newest = a;
2206
2201
  return newest;
2207
2202
  }
2208
- /**
2209
- * Tiny `path.dirname`-equivalent that only depends on `/` and `\`.
2210
- * Avoids a `node:path` import in this module purely so the
2211
- * destination-policy.ts and manifest-store.ts neighbours stay node-
2212
- * builtin-free at the import surface.
2213
- */
2214
- function parentDir(p) {
2215
- const sep = p.includes("/") ? "/" : "\\";
2216
- const i = p.lastIndexOf(sep);
2217
- return i <= 0 ? "" : p.slice(0, i);
2218
- }
2219
2203
  //#endregion
2220
2204
  export { BackupOrchestratorAddon, BackupOrchestratorAddon as default };
@@ -76,9 +76,9 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
76
76
  * map is a no-op (each declared id's `<id>:default` is already in the
77
77
  * service's map).
78
78
  *
79
- * `basePath` is the filesystem storage root, falling back to
80
- * `process.env.CAMSTACK_DATA ?? path.resolve(process.cwd(), 'camstack-data')`.
81
- * Every declared default is attributed to the `filesystem-storage`
79
+ * `basePath` is this node's data root (`ctx.nodeDataDir` = `CAMSTACK_DATA`
80
+ * ?? the kernel boot dir). Every declared default is attributed to the
81
+ * `filesystem-storage`
82
82
  * provider; operators repoint individual locations (or add remote
83
83
  * SFTP/S3/WebDAV instances) through the admin UI afterwards.
84
84
  */
@@ -1062,9 +1062,9 @@ var StorageOrchestratorAddon = class extends _camstack_types.BaseAddon {
1062
1062
  * map is a no-op (each declared id's `<id>:default` is already in the
1063
1063
  * service's map).
1064
1064
  *
1065
- * `basePath` is the filesystem storage root, falling back to
1066
- * `process.env.CAMSTACK_DATA ?? path.resolve(process.cwd(), 'camstack-data')`.
1067
- * Every declared default is attributed to the `filesystem-storage`
1065
+ * `basePath` is this node's data root (`ctx.nodeDataDir` = `CAMSTACK_DATA`
1066
+ * ?? the kernel boot dir). Every declared default is attributed to the
1067
+ * `filesystem-storage`
1068
1068
  * provider; operators repoint individual locations (or add remote
1069
1069
  * SFTP/S3/WebDAV instances) through the admin UI afterwards.
1070
1070
  */
@@ -1074,10 +1074,9 @@ var StorageOrchestratorAddon = class extends _camstack_types.BaseAddon {
1074
1074
  const registry = (0, _camstack_system.buildStorageLocationRegistry)(this.ctx.kernel.listStorageLocationDeclarations?.() ?? []);
1075
1075
  this.service.setRegistry(registry);
1076
1076
  this.service.pruneUndeclaredSystemLocations();
1077
- const basePath = process.env["CAMSTACK_DATA"] ?? node_path.resolve(process.cwd(), "camstack-data");
1078
1077
  this.service.seedDefaults({
1079
1078
  providerId: "filesystem-storage",
1080
- basePath,
1079
+ basePath: this.ctx.nodeDataDir,
1081
1080
  declarations: registry.list()
1082
1081
  });
1083
1082
  await this.service.backfillNodeIds(HUB_NODE_ID);
@@ -1055,9 +1055,9 @@ var StorageOrchestratorAddon = class extends BaseAddon {
1055
1055
  * map is a no-op (each declared id's `<id>:default` is already in the
1056
1056
  * service's map).
1057
1057
  *
1058
- * `basePath` is the filesystem storage root, falling back to
1059
- * `process.env.CAMSTACK_DATA ?? path.resolve(process.cwd(), 'camstack-data')`.
1060
- * Every declared default is attributed to the `filesystem-storage`
1058
+ * `basePath` is this node's data root (`ctx.nodeDataDir` = `CAMSTACK_DATA`
1059
+ * ?? the kernel boot dir). Every declared default is attributed to the
1060
+ * `filesystem-storage`
1061
1061
  * provider; operators repoint individual locations (or add remote
1062
1062
  * SFTP/S3/WebDAV instances) through the admin UI afterwards.
1063
1063
  */
@@ -1067,10 +1067,9 @@ var StorageOrchestratorAddon = class extends BaseAddon {
1067
1067
  const registry = buildStorageLocationRegistry(this.ctx.kernel.listStorageLocationDeclarations?.() ?? []);
1068
1068
  this.service.setRegistry(registry);
1069
1069
  this.service.pruneUndeclaredSystemLocations();
1070
- const basePath = process.env["CAMSTACK_DATA"] ?? path$1.resolve(process.cwd(), "camstack-data");
1071
1070
  this.service.seedDefaults({
1072
1071
  providerId: "filesystem-storage",
1073
- basePath,
1072
+ basePath: this.ctx.nodeDataDir,
1074
1073
  declarations: registry.list()
1075
1074
  });
1076
1075
  await this.service.backfillNodeIds(HUB_NODE_ID);
@@ -83,10 +83,7 @@ var WinstonLoggingAddon = class extends _camstack_types.BaseAddon {
83
83
  });
84
84
  }
85
85
  async onInitialize() {
86
- const logsDir = await this.ctx.api.storage.resolve.query({
87
- location: "logs",
88
- relativePath: ""
89
- }).catch(() => "camstack-data/logs");
86
+ const logsDir = node_path.default.join(this.ctx.nodeDataDir, "logs");
90
87
  this.destination = new WinstonDestination();
91
88
  await this.destination.initialize({
92
89
  ...this.config,
@@ -1,5 +1,6 @@
1
1
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
2
2
  import * as path$1 from "node:path";
3
+ import path from "node:path";
3
4
  import { BaseAddon, logDestinationCapability } from "@camstack/types";
4
5
  import * as winston from "winston";
5
6
  import DailyRotateFile from "winston-daily-rotate-file";
@@ -75,10 +76,7 @@ var WinstonLoggingAddon = class extends BaseAddon {
75
76
  });
76
77
  }
77
78
  async onInitialize() {
78
- const logsDir = await this.ctx.api.storage.resolve.query({
79
- location: "logs",
80
- relativePath: ""
81
- }).catch(() => "camstack-data/logs");
79
+ const logsDir = path.join(this.ctx.nodeDataDir, "logs");
82
80
  this.destination = new WinstonDestination();
83
81
  await this.destination.initialize({
84
82
  ...this.config,
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ const require_builtins_local_auth_local_auth_addon = require("./builtins/local-a
20
20
  require("./builtins/local-auth/index.js");
21
21
  const require_builtins_device_manager_device_manager_addon = require("./builtins/device-manager/device-manager.addon.js");
22
22
  require("./builtins/device-manager/index.js");
23
- const require_manifest_python_deps = require("./manifest-python-deps-RihGbmpb.js");
23
+ const require_manifest_python_deps = require("./manifest-python-deps-LVY7BATp.js");
24
24
  const require_custom_action_registry = require("./custom-action-registry-vLYEFTtv.js");
25
25
  const require_graceful_fs$1 = require("./graceful-fs-lg19SZNz.js");
26
26
  let _camstack_types_node = require("@camstack/types/node");
package/dist/index.mjs CHANGED
@@ -19,7 +19,7 @@ import { LocalAuthAddon, a as require_safe_buffer, i as AuthManager, n as ApiKey
19
19
  import "./builtins/local-auth/index.mjs";
20
20
  import { DeviceManagerAddon } from "./builtins/device-manager/device-manager.addon.mjs";
21
21
  import "./builtins/device-manager/index.mjs";
22
- import { A as createUdsLoggerWithControl, B as createLocalTransport, C as ipcParentLink, D as createUdsEventBus, E as createUdsEventBridge, F as AGENT_CAP_FWD_SERVICE, G as FrameDecoder, H as UdsLocalTransportServer, I as CapRouteResolver, J as buildUdsNativeCapProxy, K as encodeFrame, L as CapRouteError, M as LocalChildRegistry, N as UDS_NO_ROUTE_PREFIX, O as udsChildLogToWorkerEntry, P as AGENT_CAP_FWD_ACTION, Q as mountNativeCapService, R as classifyCapRoute, S as ipcChildLink, T as createParentUnownedCallHandler, U as SocketChannel, V as UdsLocalTransportClient, W as localEndpointPath, Y as createBrokerDeviceManagerApi, _ as __resetCapUsageRegistryForTests, a as getWorkerDeviceRegistry, at as capBareAction, b as brokerTransportLink, c as setHubConnected, ct as deserializeTypedArrays, d as registerEventBusService, dt as CapabilityHandle, et as createAddonService, f as AddonDepsManager, ft as CapabilityUnavailableError, g as CapUsageRegistry, h as createHwAccelService, i as createUdsAddonContext, it as capActionSuffix, j as LocalChildClient, k as createUdsLogger, l as EVENT_TOPIC_PREFIX, lt as serializeTypedArrays, m as resolveHwAccel, mt as resolveAddonClass, n as adaptBrokerToCluster, nt as NATIVE_PROVIDER_SERVICE_INFIX, o as getOrInitReadinessRegistry, ot as capServiceName, p as createKernelHwAccel, pt as installManifestNativeDeps, q as buildNativeCapProxy, r as createAddonContext, rt as capActionName, s as getOrInitReadinessRegistryForClient, st as parseCapAction, t as installManifestPythonDeps, tt as validateProviderRegistrations, u as getBrokerEventBus, ut as DeviceRegistry, v as getCapUsageRegistry, w as localProviderLink, x as buildLinkChain, y as brokerCallForCap, z as callWithServiceDiscovery } from "./manifest-python-deps-8Wvwz-d1.mjs";
22
+ import { A as createUdsLoggerWithControl, B as createLocalTransport, C as ipcParentLink, D as createUdsEventBus, E as createUdsEventBridge, F as AGENT_CAP_FWD_SERVICE, G as FrameDecoder, H as UdsLocalTransportServer, I as CapRouteResolver, J as buildUdsNativeCapProxy, K as encodeFrame, L as CapRouteError, M as LocalChildRegistry, N as UDS_NO_ROUTE_PREFIX, O as udsChildLogToWorkerEntry, P as AGENT_CAP_FWD_ACTION, Q as mountNativeCapService, R as classifyCapRoute, S as ipcChildLink, T as createParentUnownedCallHandler, U as SocketChannel, V as UdsLocalTransportClient, W as localEndpointPath, Y as createBrokerDeviceManagerApi, _ as __resetCapUsageRegistryForTests, a as getWorkerDeviceRegistry, at as capBareAction, b as brokerTransportLink, c as setHubConnected, ct as deserializeTypedArrays, d as registerEventBusService, dt as CapabilityHandle, et as createAddonService, f as AddonDepsManager, ft as CapabilityUnavailableError, g as CapUsageRegistry, h as createHwAccelService, i as createUdsAddonContext, it as capActionSuffix, j as LocalChildClient, k as createUdsLogger, l as EVENT_TOPIC_PREFIX, lt as serializeTypedArrays, m as resolveHwAccel, mt as resolveAddonClass, n as adaptBrokerToCluster, nt as NATIVE_PROVIDER_SERVICE_INFIX, o as getOrInitReadinessRegistry, ot as capServiceName, p as createKernelHwAccel, pt as installManifestNativeDeps, q as buildNativeCapProxy, r as createAddonContext, rt as capActionName, s as getOrInitReadinessRegistryForClient, st as parseCapAction, t as installManifestPythonDeps, tt as validateProviderRegistrations, u as getBrokerEventBus, ut as DeviceRegistry, v as getCapUsageRegistry, w as localProviderLink, x as buildLinkChain, y as brokerCallForCap, z as callWithServiceDiscovery } from "./manifest-python-deps-kMVttwkC.mjs";
23
23
  import { t as CustomActionRegistry } from "./custom-action-registry-BEXwC-oo.mjs";
24
24
  import { n as require_src, t as require_graceful_fs } from "./graceful-fs-BoR9GuPS.mjs";
25
25
  import { PYTHON_VERSION, buildBinaryPath, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
@@ -6236,11 +6236,8 @@ async function createUdsAddonContext(client, nodeId, declaration, dataDir, optio
6236
6236
  async function buildAddonContext(runtime, declaration, dataDir, options) {
6237
6237
  const nodeId = runtimeNodeId(runtime);
6238
6238
  const addonId = declaration.id;
6239
- const storage = options?.storageProvider;
6240
- const addonDataDir = storage ? await storage.resolve({
6241
- location: "addons-data",
6242
- relativePath: addonId
6243
- }) : node_path.resolve(dataDir, "addons-data", addonId);
6239
+ const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
6240
+ const addonDataDir = node_path.resolve(nodeDataDir, "addons-data", addonId);
6244
6241
  node_fs.mkdirSync(addonDataDir, { recursive: true });
6245
6242
  if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
6246
6243
  const regs = getRegistries(nodeId);
@@ -6413,6 +6410,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
6413
6410
  eventBus: scopedEventBus,
6414
6411
  addonConfig: options?.addonConfig ?? {},
6415
6412
  dataDir: addonDataDir,
6413
+ nodeDataDir,
6416
6414
  dataPlane: dataPlaneFacility.dataPlane,
6417
6415
  api,
6418
6416
  deps: new AddonDepsManager(addonDataDir, scopedLogger),
@@ -6441,7 +6439,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
6441
6439
  const hwaccel = createKernelHwAccel();
6442
6440
  return {
6443
6441
  localNodeId: nodeId,
6444
- storage: storage ?? void 0,
6442
+ storage: options?.storageProvider ?? void 0,
6445
6443
  capabilityRegistry: options?.capabilityRegistry,
6446
6444
  ...options?.listStorageLocationDeclarations ? { listStorageLocationDeclarations: options.listStorageLocationDeclarations } : {},
6447
6445
  readinessRegistry: readinessRegistry(),
@@ -6235,11 +6235,8 @@ async function createUdsAddonContext(client, nodeId, declaration, dataDir, optio
6235
6235
  async function buildAddonContext(runtime, declaration, dataDir, options) {
6236
6236
  const nodeId = runtimeNodeId(runtime);
6237
6237
  const addonId = declaration.id;
6238
- const storage = options?.storageProvider;
6239
- const addonDataDir = storage ? await storage.resolve({
6240
- location: "addons-data",
6241
- relativePath: addonId
6242
- }) : path$1.resolve(dataDir, "addons-data", addonId);
6238
+ const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
6239
+ const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
6243
6240
  fs.mkdirSync(addonDataDir, { recursive: true });
6244
6241
  if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
6245
6242
  const regs = getRegistries(nodeId);
@@ -6412,6 +6409,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
6412
6409
  eventBus: scopedEventBus,
6413
6410
  addonConfig: options?.addonConfig ?? {},
6414
6411
  dataDir: addonDataDir,
6412
+ nodeDataDir,
6415
6413
  dataPlane: dataPlaneFacility.dataPlane,
6416
6414
  api,
6417
6415
  deps: new AddonDepsManager(addonDataDir, scopedLogger),
@@ -6440,7 +6438,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
6440
6438
  const hwaccel = createKernelHwAccel();
6441
6439
  return {
6442
6440
  localNodeId: nodeId,
6443
- storage: storage ?? void 0,
6441
+ storage: options?.storageProvider ?? void 0,
6444
6442
  capabilityRegistry: options?.capabilityRegistry,
6445
6443
  ...options?.listStorageLocationDeclarations ? { listStorageLocationDeclarations: options.listStorageLocationDeclarations } : {},
6446
6444
  readinessRegistry: readinessRegistry(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",
@@ -46,14 +46,6 @@
46
46
  {
47
47
  "name": "filesystem-browse"
48
48
  }
49
- ],
50
- "storageLocations": [
51
- {
52
- "id": "data",
53
- "displayName": "Local Data",
54
- "description": "SQLite database and core state.",
55
- "cardinality": "single"
56
- }
57
49
  ]
58
50
  },
59
51
  {
@@ -65,14 +57,6 @@
65
57
  {
66
58
  "name": "settings-store"
67
59
  }
68
- ],
69
- "storageLocations": [
70
- {
71
- "id": "addons-data",
72
- "displayName": "Addons Data",
73
- "description": "Per-addon persistent store.",
74
- "cardinality": "single"
75
- }
76
60
  ]
77
61
  },
78
62
  {
@@ -84,14 +68,6 @@
84
68
  {
85
69
  "name": "log-destination"
86
70
  }
87
- ],
88
- "storageLocations": [
89
- {
90
- "id": "logs",
91
- "displayName": "Logs",
92
- "description": "Rotated log files.",
93
- "cardinality": "single"
94
- }
95
71
  ]
96
72
  },
97
73
  {