@camstack/system 1.1.15 → 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.
- 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 +14 -0
- package/dist/{manifest-python-deps-Cro19O4u.js → manifest-python-deps-D-LSp57v.js} +84 -1
- package/dist/{manifest-python-deps-BfJEdXhi.mjs → manifest-python-deps-D-mT3V97.mjs} +67 -2
- 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-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);
|
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-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-
|
|
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");
|
|
@@ -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-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";
|
|
@@ -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,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)
|
|
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)
|
|
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 {
|
|
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 };
|