@camstack/server 1.2.164 → 1.2.166

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.
@@ -53,9 +53,9 @@ exports.startAgentHttpServer = startAgentHttpServer;
53
53
  const fs = __importStar(require("node:fs"));
54
54
  const path = __importStar(require("node:path"));
55
55
  const fastify_1 = __importDefault(require("fastify"));
56
+ const agent_http_auth_js_1 = require("./agent-http-auth.js");
56
57
  const derive_hub_url_js_1 = require("./derive-hub-url.js");
57
58
  Object.defineProperty(exports, "pickIpv4", { enumerable: true, get: function () { return derive_hub_url_js_1.pickIpv4; } });
58
- const agent_http_auth_js_1 = require("./agent-http-auth.js");
59
59
  /** Dotted-numeric version compare; `null` sorts lowest. */
60
60
  function compareVersions(a, b) {
61
61
  if (a === null && b === null)
@@ -101,6 +101,12 @@ function readUiDistCandidate(baseDir) {
101
101
  * packaged desktop app that ships a newer agent-ui in its resources would
102
102
  * otherwise keep serving the UI frozen at whatever version was first
103
103
  * installed (observed live: an app at v1.1.27 serving the v1.1.1 UI).
104
+ *
105
+ * This is the ONE runtime reader of `CAMSTACK_BUNDLED_ADDONS_DIR` that reads a
106
+ * package OUT of it (the rest only seed from it, or use it to locate the
107
+ * Electron Resources root). It reads the bundled copy in place and serves it
108
+ * over `@fastify/static` — so which dir that variable names is load-bearing
109
+ * here, not just at first boot.
104
110
  */
105
111
  function pickUiDist(installed, bundled) {
106
112
  if (installed && bundled) {
@@ -108,7 +114,13 @@ function pickUiDist(installed, bundled) {
108
114
  }
109
115
  return installed?.dir ?? bundled?.dir ?? null;
110
116
  }
111
- function resolveUiDistDir(dataDir, bundledAddonsDir,
117
+ function resolveUiDistDir(dataDir,
118
+ // `CAMSTACK_BUNDLED_ADDONS_DIR` — a dir of package dirs keyed by SHORT name
119
+ // (`<dir>/addon-agent-ui`), the same shape `AddonInstaller.findLocalPackage`
120
+ // joins onto. On a packaged desktop that is the closure's own scope dir,
121
+ // `Contents/Resources/node_modules/@camstack`; it was a second, hand-copied
122
+ // `Contents/Resources/addons` tree until 2026-08-25.
123
+ bundledAddonsDir,
112
124
  // Workspace / npm-package sibling — dev checkouts and Docker images where
113
125
  // @camstack/addon-agent-ui sits next to @camstack/agent in node_modules.
114
126
  // Always version-matched to the agent, so it keeps top priority.
@@ -36,22 +36,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.startAgent = startAgent;
37
37
  const fs = __importStar(require("node:fs"));
38
38
  const path = __importStar(require("node:path"));
39
- const agent_http_js_1 = require("./agent-http.js");
40
- const single_copy_cleanup_runner_js_1 = require("../single-copy-cleanup-runner.js");
41
- const derive_hub_url_js_1 = require("./derive-hub-url.js");
42
39
  const system_1 = require("@camstack/system");
43
- const types_1 = require("@camstack/types");
44
40
  // Capability definitions — must be declared before addon registerProvider() calls
45
- const types_2 = require("@camstack/types");
46
- const agent_config_js_1 = require("./agent-config.js");
47
- const agent_update_service_js_1 = require("./agent-update-service.js");
41
+ const types_1 = require("@camstack/types");
48
42
  const server_management_provider_js_1 = require("../api/core/server-management.provider.js");
49
- const infra_boot_guard_js_1 = require("./infra-boot-guard.js");
50
- const infra_boot_plan_js_1 = require("./infra-boot-plan.js");
51
43
  const package_dir_utils_js_1 = require("../core/addon/package-dir-utils.js");
44
+ const single_copy_cleanup_runner_js_1 = require("../single-copy-cleanup-runner.js");
52
45
  const addon_scan_js_1 = require("./addon-scan.js");
53
- const agent_service_js_1 = require("./agent-service.js");
46
+ const agent_config_js_1 = require("./agent-config.js");
54
47
  const agent_group_runner_js_1 = require("./agent-group-runner.js");
48
+ const agent_http_js_1 = require("./agent-http.js");
49
+ const agent_service_js_1 = require("./agent-service.js");
50
+ const agent_update_service_js_1 = require("./agent-update-service.js");
51
+ const derive_hub_url_js_1 = require("./derive-hub-url.js");
52
+ const infra_boot_guard_js_1 = require("./infra-boot-guard.js");
53
+ const infra_boot_plan_js_1 = require("./infra-boot-plan.js");
55
54
  const register_agent_cap_dispatch_js_1 = require("./register-agent-cap-dispatch.js");
56
55
  // ---------------------------------------------------------------------------
57
56
  // Agent LogManager — shared log pipeline for all addon loggers.
@@ -71,7 +70,7 @@ const agentLogManager = new system_2.LogManager(5000);
71
70
  * the hub singleton (which reads `nodeId` as data) instead of being pinned to
72
71
  * a node with no provider (dead broker fallback → ServiceNotFoundError).
73
72
  */
74
- const DATA_NODEID_CAPS = new Set(types_2.ALL_CAPABILITY_DEFINITIONS.filter((c) => c.nodeIdMode === 'data').map((c) => c.name));
73
+ const DATA_NODEID_CAPS = new Set(types_1.ALL_CAPABILITY_DEFINITIONS.filter((c) => c.nodeIdMode === 'data').map((c) => c.name));
75
74
  // ---------------------------------------------------------------------------
76
75
  // Main
77
76
  // ---------------------------------------------------------------------------
@@ -100,8 +99,10 @@ async function startAgent(configPath) {
100
99
  console.log(`[Agent] Data dir: ${config.dataDir}`);
101
100
  // Ensure required addon packages are installed in the agent's addonsDir.
102
101
  // Resolution order:
103
- // 1. `CAMSTACK_BUNDLED_ADDONS_DIR` — Electron-packaged builds copy
104
- // from `<resourcesPath>/addons` (`'local'` mode).
102
+ // 1. `CAMSTACK_BUNDLED_ADDONS_DIR` — Electron-packaged builds copy out of
103
+ // the closure's own scope dir, `<resourcesPath>/node_modules/@camstack`
104
+ // (`'local'` mode). Was a second `<resourcesPath>/addons` tree until
105
+ // 2026-08-25 — see `packages/desktop/src/process-manager.ts`.
105
106
  // 2. Otherwise npm from registry. Local dev pushes addons via
106
107
  // `camstack deploy` (CLI tarball upload), bypassing this path.
107
108
  const explicitSource = process.env['CAMSTACK_INSTALL_SOURCE'];
@@ -325,30 +326,30 @@ async function startAgent(configPath) {
325
326
  const capabilityRegistry = new system_1.CapabilityRegistry(consoleLogger);
326
327
  // Declare all capabilities the agent uses — required before registerProvider()
327
328
  const agentCapabilities = [
328
- types_2.storageCapability,
329
- types_2.storageProviderCapability,
329
+ types_1.storageCapability,
330
+ types_1.storageProviderCapability,
330
331
  // The path browser for "add a storage location on this node" — the agent
331
332
  // registers the provider since day one, but without DECLARING the cap
332
333
  // here the hub's manifest never learns of it and node-routed browse
333
334
  // answers "not available on node X" (2026-07-30 fix).
334
- types_2.filesystemBrowseCapability,
335
+ types_1.filesystemBrowseCapability,
335
336
  // The agent runs the same two-addon data topology as the hub (D44):
336
337
  // `settings-store` is the door served by storage-orchestrator,
337
338
  // `data-store-provider` is the engine sqlite-settings registers. BOTH
338
339
  // must be declared here — this array is hand-curated and nothing else
339
340
  // teaches an agent a capability, so omitting the engine leaves the
340
341
  // agent's door with nothing behind it.
341
- types_2.settingsStoreCapability,
342
- types_2.dataStoreProviderCapability,
343
- types_2.logDestinationCapability,
344
- types_2.metricsProviderCapability,
345
- types_2.decoderCapability,
346
- types_2.motionDetectionCapability,
347
- types_2.pipelineExecutorCapability,
348
- types_2.pipelineRunnerCapability,
349
- types_2.audioAnalyzerCapability,
350
- types_2.platformProbeCapability,
351
- types_2.serverManagementCapability,
342
+ types_1.settingsStoreCapability,
343
+ types_1.dataStoreProviderCapability,
344
+ types_1.logDestinationCapability,
345
+ types_1.metricsProviderCapability,
346
+ types_1.decoderCapability,
347
+ types_1.motionDetectionCapability,
348
+ types_1.pipelineExecutorCapability,
349
+ types_1.pipelineRunnerCapability,
350
+ types_1.audioAnalyzerCapability,
351
+ types_1.platformProbeCapability,
352
+ types_1.serverManagementCapability,
352
353
  ];
353
354
  for (const cap of agentCapabilities) {
354
355
  capabilityRegistry.declareCapability(cap);
@@ -817,7 +818,7 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
817
818
  await loader.loadFromAddonDir(dir);
818
819
  }
819
820
  catch (err) {
820
- console.warn(`[Agent] Failed to scan ${dir}: ${(0, types_2.errMsg)(err)}`);
821
+ console.warn(`[Agent] Failed to scan ${dir}: ${(0, types_1.errMsg)(err)}`);
821
822
  }
822
823
  }
823
824
  // Resolution is per-CAPABILITY (the guard names every missing required
@@ -888,7 +889,7 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
888
889
  console.log(`[Agent] Core addon "${addonId}" initialized`);
889
890
  }
890
891
  catch (err) {
891
- const msg = (0, types_2.errMsg)(err);
892
+ const msg = (0, types_1.errMsg)(err);
892
893
  console.error(`[Agent] Failed to initialize core addon "${addonId}": ${msg}`);
893
894
  if (step.required) {
894
895
  throw new Error(`Required infrastructure addon "${addonId}" failed: ${msg}`, { cause: err });
@@ -931,7 +932,7 @@ async function loadClusterCapableAddons(broker, config, capabilityRegistry, load
931
932
  await loader.loadFromAddonDir(dir);
932
933
  }
933
934
  catch (err) {
934
- console.warn(`[Agent] Skipping ${dir}: ${(0, types_2.errMsg)(err)}`);
935
+ console.warn(`[Agent] Skipping ${dir}: ${(0, types_1.errMsg)(err)}`);
935
936
  continue;
936
937
  }
937
938
  dirToLoader.set(dir, loader);
@@ -1092,7 +1093,7 @@ async function loadInProcessDeployedAddons(broker, dirs, dataDir, loadedAddons,
1092
1093
  await loader.loadFromAddonDir(dir);
1093
1094
  }
1094
1095
  catch (err) {
1095
- console.warn(`[Agent] Skipping ${dir}: ${(0, types_2.errMsg)(err)}`);
1096
+ console.warn(`[Agent] Skipping ${dir}: ${(0, types_1.errMsg)(err)}`);
1096
1097
  continue;
1097
1098
  }
1098
1099
  for (const registered of loader.listAddons()) {
@@ -1121,7 +1122,7 @@ async function loadInProcessDeployedAddons(broker, dirs, dataDir, loadedAddons,
1121
1122
  console.log(`[Agent] Deployed addon "${addonId}" loaded in-process`);
1122
1123
  }
1123
1124
  catch (err) {
1124
- const msg = (0, types_2.errMsg)(err);
1125
+ const msg = (0, types_1.errMsg)(err);
1125
1126
  console.error(`[Agent] Failed to load deployed addon "${addonId}": ${msg}`);
1126
1127
  loadedAddons.set(addonId, { id: addonId, status: 'error' });
1127
1128
  }
package/dist/launcher.js CHANGED
@@ -333,9 +333,11 @@ async function launch() {
333
333
  console.warn('[launcher] quarantineAddonResidue unavailable — skipping residue quarantine');
334
334
  }
335
335
  // Install source resolution:
336
- // 1. CAMSTACK_BUNDLED_ADDONS_DIR — set by Electron-packaged builds
337
- // to <resourcesPath>/addons. Pre-built addons ship with the
338
- // bundle, copied at first launch (`'local'` mode).
336
+ // 1. CAMSTACK_BUNDLED_ADDONS_DIR — set by Electron-packaged builds to
337
+ // the closure's own scope dir, <resourcesPath>/node_modules/@camstack.
338
+ // Pre-built addons ship inside that closure and are copied out of it at
339
+ // first launch (`'local'` mode). ONE copy in the bundle: the app used to
340
+ // ship a second, hand-copied <resourcesPath>/addons tree as well (D45).
339
341
  // 2. CAMSTACK_INSTALL_SOURCE=local — explicit opt-in to copy from
340
342
  // the monorepo workspace (used by e2e + dev bootstrap). Hub
341
343
  // auto-detects `packages/` via detectWorkspacePackagesDir.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.164",
3
+ "version": "1.2.166",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -38,11 +38,11 @@
38
38
  "@camstack/addon-auth": "1.2.31",
39
39
  "@camstack/addon-decoder-nodeav": "1.2.27",
40
40
  "@camstack/addon-notifiers": "1.2.32",
41
- "@camstack/addon-pipeline": "1.2.126",
41
+ "@camstack/addon-pipeline": "1.2.128",
42
42
  "@camstack/addon-pipeline-orchestrator": "1.2.105",
43
- "@camstack/addon-post-analysis": "1.2.124",
43
+ "@camstack/addon-post-analysis": "1.2.125",
44
44
  "@camstack/sdk": "1.2.31",
45
- "@camstack/system": "1.2.132",
45
+ "@camstack/system": "1.2.134",
46
46
  "@camstack/types": "1.2.105",
47
47
  "@camstack/ui-library": "1.2.71",
48
48
  "@fastify/compress": "^9.0.0",