@camstack/system 1.1.14 → 1.1.16

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-Cro19O4u.js");
2
+ const require_manifest_python_deps = require("./manifest-python-deps-D-LSp57v.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-BfJEdXhi.mjs";
1
+ import { $ as getWorkerNativeCapProvider, N as createUdsLoggerWithControl, P as LocalChildClient, _t as resolveAddonClass, et as getWorkerNativeCapSnapshot, gt as installManifestNativeDeps, i as createUdsAddonContext, it as validateProviderRegistrations, nt as setWorkerNativeCapsChangeListener, t as installManifestPythonDeps } from "./manifest-python-deps-D-mT3V97.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";
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-Cro19O4u.js");
23
+ const require_manifest_python_deps = require("./manifest-python-deps-D-LSp57v.js");
24
24
  const require_custom_action_registry = require("./custom-action-registry-vLYEFTtv.js");
25
25
  let _camstack_types_node = require("@camstack/types/node");
26
26
  let node_http = require("node:http");
@@ -92344,32 +92344,48 @@ async function getPidStats$1(pids) {
92344
92344
  });
92345
92345
  }
92346
92346
  /**
92347
- * Heavy runners (media / ML / native): frame data lives in shared memory (`@camstack/shm-ring`) and
92348
- * native buffers, but these processes still allocate enough on the JS heap that shrinking V8's
92349
- * young generation would add scavenge-GC churn, and a low old-space cap would risk OOM. They keep
92350
- * V8 defaults. Everyone else is a lightweight, mostly-idle control-plane runner (providers, auth,
92351
- * tunnels, storage, smtp, notifier, admin-ui) that over-reserves ~15 MB of young-gen it never uses.
92352
- *
92353
- * Matched by a substring of the addon package dir (e.g. `.../@camstack/addon-pipeline/dist`), so it
92354
- * is robust to the addonId vs package-name distinction.
92347
+ * Resolve the declared heap profile for one addon by reading its package.json manifest
92348
+ * (`camstack.addons[].execution.heapProfile`). `addonDir` points at the addon's built `dist`, so the
92349
+ * manifest is one level up; we also try `addonDir` itself for layouts where it IS the package root.
92350
+ * Result is cached per (dir,id) — spawns are infrequent but a runner may re-spawn on crash/restart.
92351
+ * Returns `undefined` when the manifest is unreadable or declares no profile treated as light.
92352
+ */
92353
+ var heapProfileCache = /* @__PURE__ */ new Map();
92354
+ function readAddonHeapProfile(spec) {
92355
+ const cacheKey = `${spec.addonDir}::${spec.addonId}`;
92356
+ const cached = heapProfileCache.get(cacheKey);
92357
+ if (cached !== void 0 || heapProfileCache.has(cacheKey)) return cached;
92358
+ let profile;
92359
+ for (const manifestPath of [node_path.join(spec.addonDir, "package.json"), node_path.join(node_path.dirname(spec.addonDir), "package.json")]) try {
92360
+ const raw = node_fs.readFileSync(manifestPath, "utf8");
92361
+ const parsed = JSON.parse(raw);
92362
+ profile = extractHeapProfile(parsed, spec.addonId);
92363
+ if (profile !== void 0) break;
92364
+ if (manifestHasAddon(parsed, spec.addonId)) break;
92365
+ } catch {}
92366
+ heapProfileCache.set(cacheKey, profile);
92367
+ return profile;
92368
+ }
92369
+ function manifestHasAddon(parsed, addonId) {
92370
+ return readManifestAddons(parsed).some((a) => a.id === addonId);
92371
+ }
92372
+ function extractHeapProfile(parsed, addonId) {
92373
+ const value = readManifestAddons(parsed).find((a) => a.id === addonId)?.execution?.heapProfile;
92374
+ return value === "heavy" || value === "light" ? value : void 0;
92375
+ }
92376
+ function readManifestAddons(parsed) {
92377
+ if (typeof parsed !== "object" || parsed === null) return [];
92378
+ const camstack = parsed.camstack;
92379
+ if (typeof camstack !== "object" || camstack === null) return [];
92380
+ const addons = camstack.addons;
92381
+ return Array.isArray(addons) ? addons : [];
92382
+ }
92383
+ /**
92384
+ * A runner is heavy if ANY co-located addon declares `heapProfile: 'heavy'` in its manifest.
92385
+ * Everything else (the un-annotated default) is a light control-plane runner. No hard-coded names.
92355
92386
  */
92356
- var HEAVY_RUNNER_DIR_MARKERS = [
92357
- "addon-pipeline",
92358
- "addon-detection-pipeline",
92359
- "addon-pipeline-runner",
92360
- "addon-pipeline-orchestrator",
92361
- "addon-decoder",
92362
- "addon-benchmark",
92363
- "addon-audio-codec",
92364
- "addon-motion",
92365
- "addon-embedding",
92366
- "addon-model-studio",
92367
- "addon-analytics-suite",
92368
- "addon-provider-reolink",
92369
- "addon-provider-matter"
92370
- ];
92371
92387
  function isHeavyRunner(addons) {
92372
- return addons.some((a) => HEAVY_RUNNER_DIR_MARKERS.some((m) => a.addonDir.includes(m)));
92388
+ return addons.some((a) => readAddonHeapProfile(a) === "heavy");
92373
92389
  }
92374
92390
  /**
92375
92391
  * Per-placement V8 heap flags (Block D). LIGHT runners cap their young generation
@@ -93282,6 +93298,8 @@ exports.FsStorageBackend = FsStorageBackend;
93282
93298
  exports.HEALTH_MONITOR_GRACE_PERIOD_MS = HEALTH_MONITOR_GRACE_PERIOD_MS;
93283
93299
  exports.HEALTH_MONITOR_RETRY_INTERVALS_MS = HEALTH_MONITOR_RETRY_INTERVALS_MS;
93284
93300
  exports.HEALTH_MONITOR_TICK_MS = HEALTH_MONITOR_TICK_MS;
93301
+ exports.HUB_CAP_FWD_ACTION = require_manifest_python_deps.HUB_CAP_FWD_ACTION;
93302
+ exports.HUB_CAP_FWD_SERVICE = require_manifest_python_deps.HUB_CAP_FWD_SERVICE;
93285
93303
  exports.HubForwarderAddon = require_builtins_hub_forwarder_index.HubForwarderAddon$1;
93286
93304
  exports.HubForwarderDestination = require_builtins_hub_forwarder_index.HubForwarderDestination$1;
93287
93305
  exports.HubLogForwarder = HubLogForwarder;
@@ -93389,6 +93407,7 @@ exports.createBroker = createBroker;
93389
93407
  exports.createBrokerDeviceManagerApi = require_manifest_python_deps.createBrokerDeviceManagerApi;
93390
93408
  exports.createCoreCapService = createCoreCapService;
93391
93409
  exports.createFileDataPlaneHandler = require_model_download_service.createFileDataPlaneHandler;
93410
+ exports.createHubCapForwardService = require_manifest_python_deps.createHubCapForwardService;
93392
93411
  exports.createHubService = createHubService;
93393
93412
  exports.createHwAccelService = require_manifest_python_deps.createHwAccelService;
93394
93413
  exports.createKernelHwAccel = require_manifest_python_deps.createKernelHwAccel;
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ import { LocalAuthAddon, a as require_ms, c as __esmMin, d as __toCommonJS, f as
18
18
  import "./builtins/local-auth/index.mjs";
19
19
  import { DeviceManagerAddon } from "./builtins/device-manager/device-manager.addon.mjs";
20
20
  import "./builtins/device-manager/index.mjs";
21
- 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-BfJEdXhi.mjs";
21
+ import { A as createUdsEventBus, B as CapRouteError, C as ipcParentLink, D as createHubCapForwardService, E as HUB_CAP_FWD_SERVICE, F as LocalChildRegistry, G as UdsLocalTransportServer, H as callWithServiceDiscovery, I as UDS_NO_ROUTE_PREFIX, J as FrameDecoder, K as SocketChannel, L as AGENT_CAP_FWD_ACTION, M as createUdsLogger, N as createUdsLoggerWithControl, O as createParentUnownedCallHandler, P as LocalChildClient, Q as createBrokerDeviceManagerApi, R as AGENT_CAP_FWD_SERVICE, S as ipcChildLink, T as HUB_CAP_FWD_ACTION, U as createLocalTransport, V as classifyCapRoute, W as UdsLocalTransportClient, X as buildNativeCapProxy, Y as encodeFrame, Z as buildUdsNativeCapProxy, _ as __resetCapUsageRegistryForTests, _t as resolveAddonClass, a as getWorkerDeviceRegistry, at as NATIVE_PROVIDER_SERVICE_INFIX, b as brokerTransportLink, c as setHubConnected, ct as capBareAction, d as registerEventBusService, dt as deserializeTypedArrays, f as AddonDepsManager, ft as serializeTypedArrays, g as CapUsageRegistry, gt as installManifestNativeDeps, h as createHwAccelService, ht as CapabilityUnavailableError, i as createUdsAddonContext, it as validateProviderRegistrations, j as udsChildLogToWorkerEntry, k as createUdsEventBridge, l as EVENT_TOPIC_PREFIX, lt as capServiceName, m as resolveHwAccel, mt as CapabilityHandle, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as capActionName, p as createKernelHwAccel, pt as DeviceRegistry, q as localEndpointPath, r as createAddonContext, rt as createAddonService, s as getOrInitReadinessRegistryForClient, st as capActionSuffix, t as installManifestPythonDeps, tt as mountNativeCapService, u as getBrokerEventBus, ut as parseCapAction, v as getCapUsageRegistry, w as localProviderLink, x as buildLinkChain, y as brokerCallForCap, z as CapRouteResolver } from "./manifest-python-deps-D-mT3V97.mjs";
22
22
  import { t as CustomActionRegistry } from "./custom-action-registry-BEXwC-oo.mjs";
23
23
  import { PYTHON_VERSION, buildBinaryPath, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
24
24
  import { request } from "node:http";
@@ -92336,32 +92336,48 @@ async function getPidStats$1(pids) {
92336
92336
  });
92337
92337
  }
92338
92338
  /**
92339
- * Heavy runners (media / ML / native): frame data lives in shared memory (`@camstack/shm-ring`) and
92340
- * native buffers, but these processes still allocate enough on the JS heap that shrinking V8's
92341
- * young generation would add scavenge-GC churn, and a low old-space cap would risk OOM. They keep
92342
- * V8 defaults. Everyone else is a lightweight, mostly-idle control-plane runner (providers, auth,
92343
- * tunnels, storage, smtp, notifier, admin-ui) that over-reserves ~15 MB of young-gen it never uses.
92344
- *
92345
- * Matched by a substring of the addon package dir (e.g. `.../@camstack/addon-pipeline/dist`), so it
92346
- * is robust to the addonId vs package-name distinction.
92339
+ * Resolve the declared heap profile for one addon by reading its package.json manifest
92340
+ * (`camstack.addons[].execution.heapProfile`). `addonDir` points at the addon's built `dist`, so the
92341
+ * manifest is one level up; we also try `addonDir` itself for layouts where it IS the package root.
92342
+ * Result is cached per (dir,id) — spawns are infrequent but a runner may re-spawn on crash/restart.
92343
+ * Returns `undefined` when the manifest is unreadable or declares no profile treated as light.
92344
+ */
92345
+ var heapProfileCache = /* @__PURE__ */ new Map();
92346
+ function readAddonHeapProfile(spec) {
92347
+ const cacheKey = `${spec.addonDir}::${spec.addonId}`;
92348
+ const cached = heapProfileCache.get(cacheKey);
92349
+ if (cached !== void 0 || heapProfileCache.has(cacheKey)) return cached;
92350
+ let profile;
92351
+ for (const manifestPath of [path$39.join(spec.addonDir, "package.json"), path$39.join(path$39.dirname(spec.addonDir), "package.json")]) try {
92352
+ const raw = fs$17.readFileSync(manifestPath, "utf8");
92353
+ const parsed = JSON.parse(raw);
92354
+ profile = extractHeapProfile(parsed, spec.addonId);
92355
+ if (profile !== void 0) break;
92356
+ if (manifestHasAddon(parsed, spec.addonId)) break;
92357
+ } catch {}
92358
+ heapProfileCache.set(cacheKey, profile);
92359
+ return profile;
92360
+ }
92361
+ function manifestHasAddon(parsed, addonId) {
92362
+ return readManifestAddons(parsed).some((a) => a.id === addonId);
92363
+ }
92364
+ function extractHeapProfile(parsed, addonId) {
92365
+ const value = readManifestAddons(parsed).find((a) => a.id === addonId)?.execution?.heapProfile;
92366
+ return value === "heavy" || value === "light" ? value : void 0;
92367
+ }
92368
+ function readManifestAddons(parsed) {
92369
+ if (typeof parsed !== "object" || parsed === null) return [];
92370
+ const camstack = parsed.camstack;
92371
+ if (typeof camstack !== "object" || camstack === null) return [];
92372
+ const addons = camstack.addons;
92373
+ return Array.isArray(addons) ? addons : [];
92374
+ }
92375
+ /**
92376
+ * A runner is heavy if ANY co-located addon declares `heapProfile: 'heavy'` in its manifest.
92377
+ * Everything else (the un-annotated default) is a light control-plane runner. No hard-coded names.
92347
92378
  */
92348
- var HEAVY_RUNNER_DIR_MARKERS = [
92349
- "addon-pipeline",
92350
- "addon-detection-pipeline",
92351
- "addon-pipeline-runner",
92352
- "addon-pipeline-orchestrator",
92353
- "addon-decoder",
92354
- "addon-benchmark",
92355
- "addon-audio-codec",
92356
- "addon-motion",
92357
- "addon-embedding",
92358
- "addon-model-studio",
92359
- "addon-analytics-suite",
92360
- "addon-provider-reolink",
92361
- "addon-provider-matter"
92362
- ];
92363
92379
  function isHeavyRunner(addons) {
92364
- return addons.some((a) => HEAVY_RUNNER_DIR_MARKERS.some((m) => a.addonDir.includes(m)));
92380
+ return addons.some((a) => readAddonHeapProfile(a) === "heavy");
92365
92381
  }
92366
92382
  /**
92367
92383
  * Per-placement V8 heap flags (Block D). LIGHT runners cap their young generation
@@ -93230,4 +93246,4 @@ async function stageFrameworkLockstep(input) {
93230
93246
  return results;
93231
93247
  }
93232
93248
  //#endregion
93233
- export { AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AlertCenterAddon, ApiKeyManager, AuthManager, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, CORE_CAP_SERVICE_NAME, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CustomActionRegistry, DEFAULT_DATA_PATH, DataPlaneRegistry, DeviceManagerAddon, DeviceRegistry, DeviceStore, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FRAMEWORK_LOCKSTEP, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, INFRA_CAPABILITIES, IntegrationRegistry, JobJournal, LifecycleJobEngine, LifecycleStateMachine, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, PYTHON_VERSION, PipelineRunner, PipelineValidator, PythonEnvManager, RESTART_MARKER_FILE, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, ScopedLogger, ScopedTokenManager, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemConfigAddon, SystemEventBus, ToastService, UDS_NO_ROUTE_PREFIX, UdsLocalTransportClient, UdsLocalTransportServer, UserManager, WinstonDestination, WinstonLoggingAddon, __resetCapUsageRegistryForTests, adaptBrokerToCluster, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildBinaryPath, buildCapRouters, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildStorageLocationRegistry, buildUdsNativeCapProxy, builderMountedCapNames, callRegisterNodeWithRetry, callWithServiceDiscovery, capActionName, capActionSuffix, capBareAction, capServiceName, classifyCapRoute, clearPendingRestart, clusterSecretMatches, collectModelFiles, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonService, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCoreCapService, createFileDataPlaneHandler, createHubService, createHwAccelService, createKernelHwAccel, createLocalTransport, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, deleteModelFromDisk, deriveAgentListenPort, describeProviderKindDrift, detectWorkspacePackagesDir, downloadBinary, downloadFile, downloadModel, emitDownForOwnedCaps, encodeFrame, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensurePython, ensureTlsCert, fetchJson, findInPath, formatLogLine, getBrokerEventBus, getCapUsageRegistry, getFfmpegDownloadUrl, getModelFilePath, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getWorkerDeviceRegistry, hashClusterSecret, installManifestNativeDeps, installManifestPythonDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcChildLink, ipcParentLink, isAddonDeploySource, isClusterSecretMismatchError, isInfraCapability, isModelDownloaded, isSourceNewer, loadTlsCert, localEndpointPath, localProviderLink, mountNativeCapService, parseCapAction, parseRangeHeader, parseTokenizedUrl, proxyToUpstream, readPendingRestart, readinessKey, registerEventBusService, resolveFilePath, resolveHwAccel, scheduleSelfRestart, scopeKey, scopesAllowDeviceCap, serializeTypedArrays, setHubConnected, stageFrameworkLockstep, stripCamstackDeps, udsChildLogToWorkerEntry, validateProviderRegistrations, writePendingRestart };
93249
+ export { AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AlertCenterAddon, ApiKeyManager, AuthManager, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, CORE_CAP_SERVICE_NAME, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CustomActionRegistry, DEFAULT_DATA_PATH, DataPlaneRegistry, DeviceManagerAddon, DeviceRegistry, DeviceStore, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FRAMEWORK_LOCKSTEP, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HUB_CAP_FWD_ACTION, HUB_CAP_FWD_SERVICE, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, INFRA_CAPABILITIES, IntegrationRegistry, JobJournal, LifecycleJobEngine, LifecycleStateMachine, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, PYTHON_VERSION, PipelineRunner, PipelineValidator, PythonEnvManager, RESTART_MARKER_FILE, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, ScopedLogger, ScopedTokenManager, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemConfigAddon, SystemEventBus, ToastService, UDS_NO_ROUTE_PREFIX, UdsLocalTransportClient, UdsLocalTransportServer, UserManager, WinstonDestination, WinstonLoggingAddon, __resetCapUsageRegistryForTests, adaptBrokerToCluster, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildBinaryPath, buildCapRouters, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildStorageLocationRegistry, buildUdsNativeCapProxy, builderMountedCapNames, callRegisterNodeWithRetry, callWithServiceDiscovery, capActionName, capActionSuffix, capBareAction, capServiceName, classifyCapRoute, clearPendingRestart, clusterSecretMatches, collectModelFiles, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonService, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCoreCapService, createFileDataPlaneHandler, createHubCapForwardService, createHubService, createHwAccelService, createKernelHwAccel, createLocalTransport, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, deleteModelFromDisk, deriveAgentListenPort, describeProviderKindDrift, detectWorkspacePackagesDir, downloadBinary, downloadFile, downloadModel, emitDownForOwnedCaps, encodeFrame, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensurePython, ensureTlsCert, fetchJson, findInPath, formatLogLine, getBrokerEventBus, getCapUsageRegistry, getFfmpegDownloadUrl, getModelFilePath, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getWorkerDeviceRegistry, hashClusterSecret, installManifestNativeDeps, installManifestPythonDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcChildLink, ipcParentLink, isAddonDeploySource, isClusterSecretMismatchError, isInfraCapability, isModelDownloaded, isSourceNewer, loadTlsCert, localEndpointPath, localProviderLink, mountNativeCapService, parseCapAction, parseRangeHeader, parseTokenizedUrl, proxyToUpstream, readPendingRestart, readinessKey, registerEventBusService, resolveFilePath, resolveHwAccel, scheduleSelfRestart, scopeKey, scopesAllowDeviceCap, serializeTypedArrays, setHubConnected, stageFrameworkLockstep, stripCamstackDeps, udsChildLogToWorkerEntry, validateProviderRegistrations, writePendingRestart };
@@ -0,0 +1,34 @@
1
+ import { ServiceSchema } from 'moleculer';
2
+ import { CapCallInput } from './child-cap-protocol.js';
3
+ /** The Moleculer service name the hub registers for agent→hub cap forwarding. */
4
+ export declare const HUB_CAP_FWD_SERVICE: "$hub-cap-fwd";
5
+ /** The Moleculer action (service.action) for hub cap forwarding. */
6
+ export declare const HUB_CAP_FWD_ACTION: "$hub-cap-fwd.forward";
7
+ /**
8
+ * Params envelope an agent sends to `$hub-cap-fwd.forward`. Mirrors
9
+ * {@link CapCallInput} (the hub's onUnownedCall input): `capName` + `method` are
10
+ * required; `args` passes through; `deviceId` / `nodeId` are optional routing
11
+ * hints the hub's resolver honours.
12
+ */
13
+ export interface HubCapForwardParams {
14
+ readonly capName: string;
15
+ readonly method: string;
16
+ readonly args: unknown;
17
+ readonly deviceId?: number;
18
+ readonly nodeId?: string;
19
+ }
20
+ /**
21
+ * Handler that routes an agent-originated cap call through the hub's own
22
+ * unowned-call routing. Structurally the hub's `onUnownedCall`.
23
+ */
24
+ export type HubUnownedCallHandler = (input: CapCallInput) => Promise<unknown>;
25
+ /**
26
+ * Build the `$hub-cap-fwd` Moleculer `ServiceSchema`. The hub registers this on
27
+ * its broker (only the hub registers it → an agent's `broker.call` for
28
+ * `$hub-cap-fwd.forward` discovers it on the hub with no explicit nodeID pin).
29
+ *
30
+ * @param onUnownedCall The hub's cap routing handler (from
31
+ * `createParentUnownedCallHandler`). Reused verbatim so
32
+ * forwarded calls route exactly like a hub-local child's.
33
+ */
34
+ export declare function createHubCapForwardService(onUnownedCall: HubUnownedCallHandler): ServiceSchema;
@@ -25,3 +25,5 @@ export { createUdsEventBridge } from './uds-event-bridge.js';
25
25
  export type { UdsEventBridgeDeps, ChildEventBroadcaster } from './uds-event-bridge.js';
26
26
  export { createParentUnownedCallHandler } from './parent-unowned-call.js';
27
27
  export type { ParentUnownedCallDeps, ParentUnownedCallLogger } from './parent-unowned-call.js';
28
+ export { createHubCapForwardService, HUB_CAP_FWD_SERVICE, HUB_CAP_FWD_ACTION, } from './hub-cap-forward.js';
29
+ export type { HubCapForwardParams, HubUnownedCallHandler } from './hub-cap-forward.js';
@@ -58,6 +58,20 @@ export interface ParentUnownedCallDeps {
58
58
  * deviceId-carrying SYSTEM-cap calls (e.g. `system.info({deviceId})`) fast.
59
59
  */
60
60
  readonly isDeviceNativeCap?: (capName: string) => boolean;
61
+ /**
62
+ * Optional forward-to-hub dispatcher (the AGENT path). When present, a cap
63
+ * that no agent-LOCAL child owns is forwarded to the hub's `$hub-cap-fwd`
64
+ * service instead of attempted via raw Moleculer service discovery
65
+ * (`brokerCallForCap`). This is what makes an agent's forked addon reach a
66
+ * HUB-hosted cap (`stream-broker`, `settings-store`, …): hub-local addon
67
+ * runners register NO Moleculer service, so raw discovery for `${cap}.*`
68
+ * 30s-deadlines. The hub side answers `$hub-cap-fwd.forward` by running the
69
+ * call through ITS OWN `onUnownedCall` (resolver + broker-fallback), so the
70
+ * agent inherits the hub's full routing. The hub itself passes this undefined
71
+ * (it IS the hub) and keeps the `brokerCallForCap` path for its `$`-core
72
+ * services. See `hub-cap-forward.ts`.
73
+ */
74
+ readonly forwardToHub?: (input: CapCallInput) => Promise<unknown>;
61
75
  /** Optional logger for the broker-fallback diagnostic line. */
62
76
  readonly logger?: ParentUnownedCallLogger;
63
77
  }
@@ -4654,8 +4654,24 @@ function createParentUnownedCallHandler(deps) {
4654
4654
  });
4655
4655
  }
4656
4656
  const owner = deps.nodeRegistry.listNativeCapEntriesForDevice(deviceId).find((entry) => entry.capName === input.capName);
4657
- if (owner !== void 0) return await brokerCallForCap(deps.broker, input.capName, input.method, input.args, { nodeId: owner.nodeId });
4657
+ if (owner !== void 0) {
4658
+ if (deps.forwardToHub !== void 0) return await deps.forwardToHub({
4659
+ capName: input.capName,
4660
+ method: input.method,
4661
+ args: input.args,
4662
+ deviceId,
4663
+ nodeId: owner.nodeId
4664
+ });
4665
+ return await brokerCallForCap(deps.broker, input.capName, input.method, input.args, { nodeId: owner.nodeId });
4666
+ }
4658
4667
  }
4668
+ if (deps.forwardToHub !== void 0) return await deps.forwardToHub({
4669
+ capName: input.capName,
4670
+ method: input.method,
4671
+ args: input.args,
4672
+ ...deviceId !== void 0 ? { deviceId } : {},
4673
+ ...nodeId !== void 0 ? { nodeId } : {}
4674
+ });
4659
4675
  deps.logger?.warn?.("routing child unowned cap call via broker fallback", {
4660
4676
  capName: input.capName,
4661
4677
  method: input.method
@@ -4668,6 +4684,55 @@ function createParentUnownedCallHandler(deps) {
4668
4684
  };
4669
4685
  }
4670
4686
  //#endregion
4687
+ //#region src/kernel/transport/hub-cap-forward.ts
4688
+ /** The Moleculer service name the hub registers for agent→hub cap forwarding. */
4689
+ var HUB_CAP_FWD_SERVICE = "$hub-cap-fwd";
4690
+ /** The Moleculer action (service.action) for hub cap forwarding. */
4691
+ var HUB_CAP_FWD_ACTION = `${HUB_CAP_FWD_SERVICE}.forward`;
4692
+ /**
4693
+ * Narrow Moleculer's loosely-typed `ctx.params` to {@link HubCapForwardParams}
4694
+ * without unsafe casts — mirrors `agent-cap-dispatch-service.ts:narrowParams`.
4695
+ */
4696
+ function narrowParams(raw) {
4697
+ if (raw === null || typeof raw !== "object") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
4698
+ const capName = Reflect.get(raw, "capName");
4699
+ const method = Reflect.get(raw, "method");
4700
+ if (typeof capName !== "string" || typeof method !== "string") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
4701
+ const deviceId = Reflect.get(raw, "deviceId");
4702
+ const nodeId = Reflect.get(raw, "nodeId");
4703
+ return {
4704
+ capName,
4705
+ method,
4706
+ args: Reflect.get(raw, "args"),
4707
+ deviceId: typeof deviceId === "number" ? deviceId : void 0,
4708
+ nodeId: typeof nodeId === "string" && nodeId.length > 0 ? nodeId : void 0
4709
+ };
4710
+ }
4711
+ /**
4712
+ * Build the `$hub-cap-fwd` Moleculer `ServiceSchema`. The hub registers this on
4713
+ * its broker (only the hub registers it → an agent's `broker.call` for
4714
+ * `$hub-cap-fwd.forward` discovers it on the hub with no explicit nodeID pin).
4715
+ *
4716
+ * @param onUnownedCall The hub's cap routing handler (from
4717
+ * `createParentUnownedCallHandler`). Reused verbatim so
4718
+ * forwarded calls route exactly like a hub-local child's.
4719
+ */
4720
+ function createHubCapForwardService(onUnownedCall) {
4721
+ return {
4722
+ name: HUB_CAP_FWD_SERVICE,
4723
+ actions: { forward: { handler: async (ctx) => {
4724
+ const { capName, method, args, deviceId, nodeId } = narrowParams(ctx.params);
4725
+ return onUnownedCall({
4726
+ capName,
4727
+ method,
4728
+ args,
4729
+ ...deviceId !== void 0 ? { deviceId } : {},
4730
+ ...nodeId !== void 0 ? { nodeId } : {}
4731
+ });
4732
+ } } }
4733
+ };
4734
+ }
4735
+ //#endregion
4671
4736
  //#region src/kernel/moleculer/trpc-links.ts
4672
4737
  /** Convert camelCase → kebab-case. */
4673
4738
  function toKebab(name) {
@@ -6653,6 +6718,18 @@ Object.defineProperty(exports, "FrameDecoder", {
6653
6718
  return FrameDecoder;
6654
6719
  }
6655
6720
  });
6721
+ Object.defineProperty(exports, "HUB_CAP_FWD_ACTION", {
6722
+ enumerable: true,
6723
+ get: function() {
6724
+ return HUB_CAP_FWD_ACTION;
6725
+ }
6726
+ });
6727
+ Object.defineProperty(exports, "HUB_CAP_FWD_SERVICE", {
6728
+ enumerable: true,
6729
+ get: function() {
6730
+ return HUB_CAP_FWD_SERVICE;
6731
+ }
6732
+ });
6656
6733
  Object.defineProperty(exports, "LocalChildClient", {
6657
6734
  enumerable: true,
6658
6735
  get: function() {
@@ -6791,6 +6868,12 @@ Object.defineProperty(exports, "createBrokerDeviceManagerApi", {
6791
6868
  return createBrokerDeviceManagerApi;
6792
6869
  }
6793
6870
  });
6871
+ Object.defineProperty(exports, "createHubCapForwardService", {
6872
+ enumerable: true,
6873
+ get: function() {
6874
+ return createHubCapForwardService;
6875
+ }
6876
+ });
6794
6877
  Object.defineProperty(exports, "createHwAccelService", {
6795
6878
  enumerable: true,
6796
6879
  get: function() {
@@ -4652,8 +4652,24 @@ function createParentUnownedCallHandler(deps) {
4652
4652
  });
4653
4653
  }
4654
4654
  const owner = deps.nodeRegistry.listNativeCapEntriesForDevice(deviceId).find((entry) => entry.capName === input.capName);
4655
- if (owner !== void 0) return await brokerCallForCap(deps.broker, input.capName, input.method, input.args, { nodeId: owner.nodeId });
4655
+ if (owner !== void 0) {
4656
+ if (deps.forwardToHub !== void 0) return await deps.forwardToHub({
4657
+ capName: input.capName,
4658
+ method: input.method,
4659
+ args: input.args,
4660
+ deviceId,
4661
+ nodeId: owner.nodeId
4662
+ });
4663
+ return await brokerCallForCap(deps.broker, input.capName, input.method, input.args, { nodeId: owner.nodeId });
4664
+ }
4656
4665
  }
4666
+ if (deps.forwardToHub !== void 0) return await deps.forwardToHub({
4667
+ capName: input.capName,
4668
+ method: input.method,
4669
+ args: input.args,
4670
+ ...deviceId !== void 0 ? { deviceId } : {},
4671
+ ...nodeId !== void 0 ? { nodeId } : {}
4672
+ });
4657
4673
  deps.logger?.warn?.("routing child unowned cap call via broker fallback", {
4658
4674
  capName: input.capName,
4659
4675
  method: input.method
@@ -4666,6 +4682,55 @@ function createParentUnownedCallHandler(deps) {
4666
4682
  };
4667
4683
  }
4668
4684
  //#endregion
4685
+ //#region src/kernel/transport/hub-cap-forward.ts
4686
+ /** The Moleculer service name the hub registers for agent→hub cap forwarding. */
4687
+ var HUB_CAP_FWD_SERVICE = "$hub-cap-fwd";
4688
+ /** The Moleculer action (service.action) for hub cap forwarding. */
4689
+ var HUB_CAP_FWD_ACTION = `${HUB_CAP_FWD_SERVICE}.forward`;
4690
+ /**
4691
+ * Narrow Moleculer's loosely-typed `ctx.params` to {@link HubCapForwardParams}
4692
+ * without unsafe casts — mirrors `agent-cap-dispatch-service.ts:narrowParams`.
4693
+ */
4694
+ function narrowParams(raw) {
4695
+ if (raw === null || typeof raw !== "object") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
4696
+ const capName = Reflect.get(raw, "capName");
4697
+ const method = Reflect.get(raw, "method");
4698
+ if (typeof capName !== "string" || typeof method !== "string") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
4699
+ const deviceId = Reflect.get(raw, "deviceId");
4700
+ const nodeId = Reflect.get(raw, "nodeId");
4701
+ return {
4702
+ capName,
4703
+ method,
4704
+ args: Reflect.get(raw, "args"),
4705
+ deviceId: typeof deviceId === "number" ? deviceId : void 0,
4706
+ nodeId: typeof nodeId === "string" && nodeId.length > 0 ? nodeId : void 0
4707
+ };
4708
+ }
4709
+ /**
4710
+ * Build the `$hub-cap-fwd` Moleculer `ServiceSchema`. The hub registers this on
4711
+ * its broker (only the hub registers it → an agent's `broker.call` for
4712
+ * `$hub-cap-fwd.forward` discovers it on the hub with no explicit nodeID pin).
4713
+ *
4714
+ * @param onUnownedCall The hub's cap routing handler (from
4715
+ * `createParentUnownedCallHandler`). Reused verbatim so
4716
+ * forwarded calls route exactly like a hub-local child's.
4717
+ */
4718
+ function createHubCapForwardService(onUnownedCall) {
4719
+ return {
4720
+ name: HUB_CAP_FWD_SERVICE,
4721
+ actions: { forward: { handler: async (ctx) => {
4722
+ const { capName, method, args, deviceId, nodeId } = narrowParams(ctx.params);
4723
+ return onUnownedCall({
4724
+ capName,
4725
+ method,
4726
+ args,
4727
+ ...deviceId !== void 0 ? { deviceId } : {},
4728
+ ...nodeId !== void 0 ? { nodeId } : {}
4729
+ });
4730
+ } } }
4731
+ };
4732
+ }
4733
+ //#endregion
4669
4734
  //#region src/kernel/moleculer/trpc-links.ts
4670
4735
  /** Convert camelCase → kebab-case. */
4671
4736
  function toKebab(name) {
@@ -6585,4 +6650,4 @@ async function installManifestPythonDeps(declaration, addonDir, deps, logger) {
6585
6650
  await deps.installPythonRequirements(reqAbs);
6586
6651
  }
6587
6652
  //#endregion
6588
- export { setWorkerNativeCapsChangeListener as $, createUdsLoggerWithControl as A, createLocalTransport as B, ipcParentLink as C, createUdsEventBus as D, createUdsEventBridge as E, AGENT_CAP_FWD_SERVICE as F, FrameDecoder as G, UdsLocalTransportServer as H, CapRouteResolver as I, buildUdsNativeCapProxy as J, encodeFrame as K, CapRouteError as L, LocalChildRegistry as M, UDS_NO_ROUTE_PREFIX as N, udsChildLogToWorkerEntry as O, AGENT_CAP_FWD_ACTION as P, mountNativeCapService as Q, classifyCapRoute as R, ipcChildLink as S, createParentUnownedCallHandler as T, SocketChannel as U, UdsLocalTransportClient as V, localEndpointPath as W, getWorkerNativeCapProvider as X, createBrokerDeviceManagerApi as Y, getWorkerNativeCapSnapshot as Z, __resetCapUsageRegistryForTests as _, getWorkerDeviceRegistry as a, capBareAction as at, brokerTransportLink as b, setHubConnected as c, deserializeTypedArrays as ct, registerEventBusService as d, CapabilityHandle as dt, createAddonService as et, AddonDepsManager as f, CapabilityUnavailableError as ft, CapUsageRegistry as g, createHwAccelService as h, createUdsAddonContext as i, capActionSuffix as it, LocalChildClient as j, createUdsLogger as k, EVENT_TOPIC_PREFIX as l, serializeTypedArrays as lt, resolveHwAccel as m, resolveAddonClass as mt, adaptBrokerToCluster as n, NATIVE_PROVIDER_SERVICE_INFIX as nt, getOrInitReadinessRegistry as o, capServiceName as ot, createKernelHwAccel as p, installManifestNativeDeps as pt, buildNativeCapProxy as q, createAddonContext as r, capActionName as rt, getOrInitReadinessRegistryForClient as s, parseCapAction as st, installManifestPythonDeps as t, validateProviderRegistrations as tt, getBrokerEventBus as u, DeviceRegistry as ut, getCapUsageRegistry as v, localProviderLink as w, buildLinkChain as x, brokerCallForCap as y, callWithServiceDiscovery as z };
6653
+ export { getWorkerNativeCapProvider as $, createUdsEventBus as A, CapRouteError as B, ipcParentLink as C, createHubCapForwardService as D, HUB_CAP_FWD_SERVICE as E, LocalChildRegistry as F, UdsLocalTransportServer as G, callWithServiceDiscovery as H, UDS_NO_ROUTE_PREFIX as I, FrameDecoder as J, SocketChannel as K, AGENT_CAP_FWD_ACTION as L, createUdsLogger as M, createUdsLoggerWithControl as N, createParentUnownedCallHandler as O, LocalChildClient as P, createBrokerDeviceManagerApi as Q, AGENT_CAP_FWD_SERVICE as R, ipcChildLink as S, HUB_CAP_FWD_ACTION as T, createLocalTransport as U, classifyCapRoute as V, UdsLocalTransportClient as W, buildNativeCapProxy as X, encodeFrame as Y, buildUdsNativeCapProxy as Z, __resetCapUsageRegistryForTests as _, resolveAddonClass as _t, getWorkerDeviceRegistry as a, NATIVE_PROVIDER_SERVICE_INFIX as at, brokerTransportLink as b, setHubConnected as c, capBareAction as ct, registerEventBusService as d, deserializeTypedArrays as dt, getWorkerNativeCapSnapshot as et, AddonDepsManager as f, serializeTypedArrays as ft, CapUsageRegistry as g, installManifestNativeDeps as gt, createHwAccelService as h, CapabilityUnavailableError as ht, createUdsAddonContext as i, validateProviderRegistrations as it, udsChildLogToWorkerEntry as j, createUdsEventBridge as k, EVENT_TOPIC_PREFIX as l, capServiceName as lt, resolveHwAccel as m, CapabilityHandle as mt, adaptBrokerToCluster as n, setWorkerNativeCapsChangeListener as nt, getOrInitReadinessRegistry as o, capActionName as ot, createKernelHwAccel as p, DeviceRegistry as pt, localEndpointPath as q, createAddonContext as r, createAddonService as rt, getOrInitReadinessRegistryForClient as s, capActionSuffix as st, installManifestPythonDeps as t, mountNativeCapService as tt, getBrokerEventBus as u, parseCapAction as ut, getCapUsageRegistry as v, localProviderLink as w, buildLinkChain as x, brokerCallForCap as y, CapRouteResolver as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",