@camstack/system 1.1.15 → 1.1.17
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 +1 -1
- package/dist/addon-runner.mjs +1 -1
- package/dist/index.js +4 -1
- package/dist/index.mjs +2 -2
- package/dist/kernel/transport/hub-cap-forward.d.ts +34 -0
- package/dist/kernel/transport/index.d.ts +2 -0
- package/dist/kernel/transport/parent-unowned-call.d.ts +32 -0
- package/dist/{manifest-python-deps-BfJEdXhi.mjs → manifest-python-deps-DOAh19rY.mjs} +71 -2
- package/dist/{manifest-python-deps-Cro19O4u.js → manifest-python-deps-lZd5B4FS.js} +88 -1
- package/package.json +1 -1
package/dist/addon-runner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_manifest_python_deps = require("./manifest-python-deps-
|
|
2
|
+
const require_manifest_python_deps = require("./manifest-python-deps-lZd5B4FS.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);
|
package/dist/addon-runner.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
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-DOAh19rY.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-
|
|
23
|
+
const require_manifest_python_deps = require("./manifest-python-deps-lZd5B4FS.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");
|
|
@@ -93298,6 +93298,8 @@ exports.FsStorageBackend = FsStorageBackend;
|
|
|
93298
93298
|
exports.HEALTH_MONITOR_GRACE_PERIOD_MS = HEALTH_MONITOR_GRACE_PERIOD_MS;
|
|
93299
93299
|
exports.HEALTH_MONITOR_RETRY_INTERVALS_MS = HEALTH_MONITOR_RETRY_INTERVALS_MS;
|
|
93300
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;
|
|
93301
93303
|
exports.HubForwarderAddon = require_builtins_hub_forwarder_index.HubForwarderAddon$1;
|
|
93302
93304
|
exports.HubForwarderDestination = require_builtins_hub_forwarder_index.HubForwarderDestination$1;
|
|
93303
93305
|
exports.HubLogForwarder = HubLogForwarder;
|
|
@@ -93405,6 +93407,7 @@ exports.createBroker = createBroker;
|
|
|
93405
93407
|
exports.createBrokerDeviceManagerApi = require_manifest_python_deps.createBrokerDeviceManagerApi;
|
|
93406
93408
|
exports.createCoreCapService = createCoreCapService;
|
|
93407
93409
|
exports.createFileDataPlaneHandler = require_model_download_service.createFileDataPlaneHandler;
|
|
93410
|
+
exports.createHubCapForwardService = require_manifest_python_deps.createHubCapForwardService;
|
|
93408
93411
|
exports.createHubService = createHubService;
|
|
93409
93412
|
exports.createHwAccelService = require_manifest_python_deps.createHwAccelService;
|
|
93410
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
|
|
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-DOAh19rY.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";
|
|
@@ -93246,4 +93246,4 @@ async function stageFrameworkLockstep(input) {
|
|
|
93246
93246
|
return results;
|
|
93247
93247
|
}
|
|
93248
93248
|
//#endregion
|
|
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, 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,38 @@ 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>;
|
|
75
|
+
/**
|
|
76
|
+
* Optional empty-collection fast-path. Returns `[]` (an empty aggregate) when
|
|
77
|
+
* `capName` is a `mode:'collection'` cap whose `method` is array-output AND
|
|
78
|
+
* ZERO providers are registered cluster-wide; `null`/`undefined` otherwise.
|
|
79
|
+
*
|
|
80
|
+
* Why: a collection cap with no providers IS the empty collection — but with
|
|
81
|
+
* nothing registered, the resolver returns `no-provider` and the call falls
|
|
82
|
+
* to the broker fallback, which polls Moleculer service discovery for a
|
|
83
|
+
* `${cap}.${method}` service that will NEVER appear until the discovery
|
|
84
|
+
* deadline (~30s) elapses. That 30s stall hit EVERY WebRTC cold start via the
|
|
85
|
+
* provider-less `turn-provider` (`getTurnServers`). Returning `[]` up front
|
|
86
|
+
* treats a provider-less collection as the empty collection it is — instant,
|
|
87
|
+
* no discovery. A collection WITH ≥1 provider returns `null` here and routes
|
|
88
|
+
* normally (the aggregate fans out across its providers as before). The
|
|
89
|
+
* kernel layer has no cap registry, so the wiring side (which has both the
|
|
90
|
+
* `CapabilityDefinition`s and the registry) injects this.
|
|
91
|
+
*/
|
|
92
|
+
readonly resolveEmptyCollection?: (capName: string, method: string) => readonly unknown[] | null;
|
|
61
93
|
/** Optional logger for the broker-fallback diagnostic line. */
|
|
62
94
|
readonly logger?: ParentUnownedCallLogger;
|
|
63
95
|
}
|
|
@@ -4619,6 +4619,10 @@ function createParentUnownedCallHandler(deps) {
|
|
|
4619
4619
|
return async (input) => {
|
|
4620
4620
|
const deviceId = input.deviceId ?? extractDeviceId(input.args);
|
|
4621
4621
|
const nodeId = input.nodeId ?? extractNodeId(input.args);
|
|
4622
|
+
if (nodeId === void 0) {
|
|
4623
|
+
const empty = deps.resolveEmptyCollection?.(input.capName, input.method);
|
|
4624
|
+
if (empty != null) return empty;
|
|
4625
|
+
}
|
|
4622
4626
|
const resolver = deps.getResolver();
|
|
4623
4627
|
if (resolver !== null) try {
|
|
4624
4628
|
const route = resolver.resolveCapRoute(input.capName, {
|
|
@@ -4652,8 +4656,24 @@ function createParentUnownedCallHandler(deps) {
|
|
|
4652
4656
|
});
|
|
4653
4657
|
}
|
|
4654
4658
|
const owner = deps.nodeRegistry.listNativeCapEntriesForDevice(deviceId).find((entry) => entry.capName === input.capName);
|
|
4655
|
-
if (owner !== void 0)
|
|
4659
|
+
if (owner !== void 0) {
|
|
4660
|
+
if (deps.forwardToHub !== void 0) return await deps.forwardToHub({
|
|
4661
|
+
capName: input.capName,
|
|
4662
|
+
method: input.method,
|
|
4663
|
+
args: input.args,
|
|
4664
|
+
deviceId,
|
|
4665
|
+
nodeId: owner.nodeId
|
|
4666
|
+
});
|
|
4667
|
+
return await brokerCallForCap(deps.broker, input.capName, input.method, input.args, { nodeId: owner.nodeId });
|
|
4668
|
+
}
|
|
4656
4669
|
}
|
|
4670
|
+
if (deps.forwardToHub !== void 0) return await deps.forwardToHub({
|
|
4671
|
+
capName: input.capName,
|
|
4672
|
+
method: input.method,
|
|
4673
|
+
args: input.args,
|
|
4674
|
+
...deviceId !== void 0 ? { deviceId } : {},
|
|
4675
|
+
...nodeId !== void 0 ? { nodeId } : {}
|
|
4676
|
+
});
|
|
4657
4677
|
deps.logger?.warn?.("routing child unowned cap call via broker fallback", {
|
|
4658
4678
|
capName: input.capName,
|
|
4659
4679
|
method: input.method
|
|
@@ -4666,6 +4686,55 @@ function createParentUnownedCallHandler(deps) {
|
|
|
4666
4686
|
};
|
|
4667
4687
|
}
|
|
4668
4688
|
//#endregion
|
|
4689
|
+
//#region src/kernel/transport/hub-cap-forward.ts
|
|
4690
|
+
/** The Moleculer service name the hub registers for agent→hub cap forwarding. */
|
|
4691
|
+
var HUB_CAP_FWD_SERVICE = "$hub-cap-fwd";
|
|
4692
|
+
/** The Moleculer action (service.action) for hub cap forwarding. */
|
|
4693
|
+
var HUB_CAP_FWD_ACTION = `${HUB_CAP_FWD_SERVICE}.forward`;
|
|
4694
|
+
/**
|
|
4695
|
+
* Narrow Moleculer's loosely-typed `ctx.params` to {@link HubCapForwardParams}
|
|
4696
|
+
* without unsafe casts — mirrors `agent-cap-dispatch-service.ts:narrowParams`.
|
|
4697
|
+
*/
|
|
4698
|
+
function narrowParams(raw) {
|
|
4699
|
+
if (raw === null || typeof raw !== "object") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
|
|
4700
|
+
const capName = Reflect.get(raw, "capName");
|
|
4701
|
+
const method = Reflect.get(raw, "method");
|
|
4702
|
+
if (typeof capName !== "string" || typeof method !== "string") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
|
|
4703
|
+
const deviceId = Reflect.get(raw, "deviceId");
|
|
4704
|
+
const nodeId = Reflect.get(raw, "nodeId");
|
|
4705
|
+
return {
|
|
4706
|
+
capName,
|
|
4707
|
+
method,
|
|
4708
|
+
args: Reflect.get(raw, "args"),
|
|
4709
|
+
deviceId: typeof deviceId === "number" ? deviceId : void 0,
|
|
4710
|
+
nodeId: typeof nodeId === "string" && nodeId.length > 0 ? nodeId : void 0
|
|
4711
|
+
};
|
|
4712
|
+
}
|
|
4713
|
+
/**
|
|
4714
|
+
* Build the `$hub-cap-fwd` Moleculer `ServiceSchema`. The hub registers this on
|
|
4715
|
+
* its broker (only the hub registers it → an agent's `broker.call` for
|
|
4716
|
+
* `$hub-cap-fwd.forward` discovers it on the hub with no explicit nodeID pin).
|
|
4717
|
+
*
|
|
4718
|
+
* @param onUnownedCall The hub's cap routing handler (from
|
|
4719
|
+
* `createParentUnownedCallHandler`). Reused verbatim so
|
|
4720
|
+
* forwarded calls route exactly like a hub-local child's.
|
|
4721
|
+
*/
|
|
4722
|
+
function createHubCapForwardService(onUnownedCall) {
|
|
4723
|
+
return {
|
|
4724
|
+
name: HUB_CAP_FWD_SERVICE,
|
|
4725
|
+
actions: { forward: { handler: async (ctx) => {
|
|
4726
|
+
const { capName, method, args, deviceId, nodeId } = narrowParams(ctx.params);
|
|
4727
|
+
return onUnownedCall({
|
|
4728
|
+
capName,
|
|
4729
|
+
method,
|
|
4730
|
+
args,
|
|
4731
|
+
...deviceId !== void 0 ? { deviceId } : {},
|
|
4732
|
+
...nodeId !== void 0 ? { nodeId } : {}
|
|
4733
|
+
});
|
|
4734
|
+
} } }
|
|
4735
|
+
};
|
|
4736
|
+
}
|
|
4737
|
+
//#endregion
|
|
4669
4738
|
//#region src/kernel/moleculer/trpc-links.ts
|
|
4670
4739
|
/** Convert camelCase → kebab-case. */
|
|
4671
4740
|
function toKebab(name) {
|
|
@@ -6585,4 +6654,4 @@ async function installManifestPythonDeps(declaration, addonDir, deps, logger) {
|
|
|
6585
6654
|
await deps.installPythonRequirements(reqAbs);
|
|
6586
6655
|
}
|
|
6587
6656
|
//#endregion
|
|
6588
|
-
export {
|
|
6657
|
+
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 };
|
|
@@ -4621,6 +4621,10 @@ function createParentUnownedCallHandler(deps) {
|
|
|
4621
4621
|
return async (input) => {
|
|
4622
4622
|
const deviceId = input.deviceId ?? extractDeviceId(input.args);
|
|
4623
4623
|
const nodeId = input.nodeId ?? extractNodeId(input.args);
|
|
4624
|
+
if (nodeId === void 0) {
|
|
4625
|
+
const empty = deps.resolveEmptyCollection?.(input.capName, input.method);
|
|
4626
|
+
if (empty != null) return empty;
|
|
4627
|
+
}
|
|
4624
4628
|
const resolver = deps.getResolver();
|
|
4625
4629
|
if (resolver !== null) try {
|
|
4626
4630
|
const route = resolver.resolveCapRoute(input.capName, {
|
|
@@ -4654,8 +4658,24 @@ function createParentUnownedCallHandler(deps) {
|
|
|
4654
4658
|
});
|
|
4655
4659
|
}
|
|
4656
4660
|
const owner = deps.nodeRegistry.listNativeCapEntriesForDevice(deviceId).find((entry) => entry.capName === input.capName);
|
|
4657
|
-
if (owner !== void 0)
|
|
4661
|
+
if (owner !== void 0) {
|
|
4662
|
+
if (deps.forwardToHub !== void 0) return await deps.forwardToHub({
|
|
4663
|
+
capName: input.capName,
|
|
4664
|
+
method: input.method,
|
|
4665
|
+
args: input.args,
|
|
4666
|
+
deviceId,
|
|
4667
|
+
nodeId: owner.nodeId
|
|
4668
|
+
});
|
|
4669
|
+
return await brokerCallForCap(deps.broker, input.capName, input.method, input.args, { nodeId: owner.nodeId });
|
|
4670
|
+
}
|
|
4658
4671
|
}
|
|
4672
|
+
if (deps.forwardToHub !== void 0) return await deps.forwardToHub({
|
|
4673
|
+
capName: input.capName,
|
|
4674
|
+
method: input.method,
|
|
4675
|
+
args: input.args,
|
|
4676
|
+
...deviceId !== void 0 ? { deviceId } : {},
|
|
4677
|
+
...nodeId !== void 0 ? { nodeId } : {}
|
|
4678
|
+
});
|
|
4659
4679
|
deps.logger?.warn?.("routing child unowned cap call via broker fallback", {
|
|
4660
4680
|
capName: input.capName,
|
|
4661
4681
|
method: input.method
|
|
@@ -4668,6 +4688,55 @@ function createParentUnownedCallHandler(deps) {
|
|
|
4668
4688
|
};
|
|
4669
4689
|
}
|
|
4670
4690
|
//#endregion
|
|
4691
|
+
//#region src/kernel/transport/hub-cap-forward.ts
|
|
4692
|
+
/** The Moleculer service name the hub registers for agent→hub cap forwarding. */
|
|
4693
|
+
var HUB_CAP_FWD_SERVICE = "$hub-cap-fwd";
|
|
4694
|
+
/** The Moleculer action (service.action) for hub cap forwarding. */
|
|
4695
|
+
var HUB_CAP_FWD_ACTION = `${HUB_CAP_FWD_SERVICE}.forward`;
|
|
4696
|
+
/**
|
|
4697
|
+
* Narrow Moleculer's loosely-typed `ctx.params` to {@link HubCapForwardParams}
|
|
4698
|
+
* without unsafe casts — mirrors `agent-cap-dispatch-service.ts:narrowParams`.
|
|
4699
|
+
*/
|
|
4700
|
+
function narrowParams(raw) {
|
|
4701
|
+
if (raw === null || typeof raw !== "object") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
|
|
4702
|
+
const capName = Reflect.get(raw, "capName");
|
|
4703
|
+
const method = Reflect.get(raw, "method");
|
|
4704
|
+
if (typeof capName !== "string" || typeof method !== "string") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
|
|
4705
|
+
const deviceId = Reflect.get(raw, "deviceId");
|
|
4706
|
+
const nodeId = Reflect.get(raw, "nodeId");
|
|
4707
|
+
return {
|
|
4708
|
+
capName,
|
|
4709
|
+
method,
|
|
4710
|
+
args: Reflect.get(raw, "args"),
|
|
4711
|
+
deviceId: typeof deviceId === "number" ? deviceId : void 0,
|
|
4712
|
+
nodeId: typeof nodeId === "string" && nodeId.length > 0 ? nodeId : void 0
|
|
4713
|
+
};
|
|
4714
|
+
}
|
|
4715
|
+
/**
|
|
4716
|
+
* Build the `$hub-cap-fwd` Moleculer `ServiceSchema`. The hub registers this on
|
|
4717
|
+
* its broker (only the hub registers it → an agent's `broker.call` for
|
|
4718
|
+
* `$hub-cap-fwd.forward` discovers it on the hub with no explicit nodeID pin).
|
|
4719
|
+
*
|
|
4720
|
+
* @param onUnownedCall The hub's cap routing handler (from
|
|
4721
|
+
* `createParentUnownedCallHandler`). Reused verbatim so
|
|
4722
|
+
* forwarded calls route exactly like a hub-local child's.
|
|
4723
|
+
*/
|
|
4724
|
+
function createHubCapForwardService(onUnownedCall) {
|
|
4725
|
+
return {
|
|
4726
|
+
name: HUB_CAP_FWD_SERVICE,
|
|
4727
|
+
actions: { forward: { handler: async (ctx) => {
|
|
4728
|
+
const { capName, method, args, deviceId, nodeId } = narrowParams(ctx.params);
|
|
4729
|
+
return onUnownedCall({
|
|
4730
|
+
capName,
|
|
4731
|
+
method,
|
|
4732
|
+
args,
|
|
4733
|
+
...deviceId !== void 0 ? { deviceId } : {},
|
|
4734
|
+
...nodeId !== void 0 ? { nodeId } : {}
|
|
4735
|
+
});
|
|
4736
|
+
} } }
|
|
4737
|
+
};
|
|
4738
|
+
}
|
|
4739
|
+
//#endregion
|
|
4671
4740
|
//#region src/kernel/moleculer/trpc-links.ts
|
|
4672
4741
|
/** Convert camelCase → kebab-case. */
|
|
4673
4742
|
function toKebab(name) {
|
|
@@ -6653,6 +6722,18 @@ Object.defineProperty(exports, "FrameDecoder", {
|
|
|
6653
6722
|
return FrameDecoder;
|
|
6654
6723
|
}
|
|
6655
6724
|
});
|
|
6725
|
+
Object.defineProperty(exports, "HUB_CAP_FWD_ACTION", {
|
|
6726
|
+
enumerable: true,
|
|
6727
|
+
get: function() {
|
|
6728
|
+
return HUB_CAP_FWD_ACTION;
|
|
6729
|
+
}
|
|
6730
|
+
});
|
|
6731
|
+
Object.defineProperty(exports, "HUB_CAP_FWD_SERVICE", {
|
|
6732
|
+
enumerable: true,
|
|
6733
|
+
get: function() {
|
|
6734
|
+
return HUB_CAP_FWD_SERVICE;
|
|
6735
|
+
}
|
|
6736
|
+
});
|
|
6656
6737
|
Object.defineProperty(exports, "LocalChildClient", {
|
|
6657
6738
|
enumerable: true,
|
|
6658
6739
|
get: function() {
|
|
@@ -6791,6 +6872,12 @@ Object.defineProperty(exports, "createBrokerDeviceManagerApi", {
|
|
|
6791
6872
|
return createBrokerDeviceManagerApi;
|
|
6792
6873
|
}
|
|
6793
6874
|
});
|
|
6875
|
+
Object.defineProperty(exports, "createHubCapForwardService", {
|
|
6876
|
+
enumerable: true,
|
|
6877
|
+
get: function() {
|
|
6878
|
+
return createHubCapForwardService;
|
|
6879
|
+
}
|
|
6880
|
+
});
|
|
6794
6881
|
Object.defineProperty(exports, "createHwAccelService", {
|
|
6795
6882
|
enumerable: true,
|
|
6796
6883
|
get: function() {
|