@camstack/system 1.1.21 → 1.1.23

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/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 { $ as buildNativeCapProxy, A as createHubCapForwardService, B as AGENT_CAP_FWD_ACTION, C as brokerTransportLink, D as localProviderLink, E as ipcParentLink, F as createUdsLogger, G as callWithServiceDiscovery, H as CapRouteResolver, I as createUdsLoggerWithControl, J as UdsLocalTransportServer, K as createLocalTransport, L as LocalChildClient, M as createUdsEventBridge, N as createUdsEventBus, O as HUB_CAP_FWD_ACTION, P as udsChildLogToWorkerEntry, Q as encodeFrame, R as LocalChildRegistry, S as brokerCallForCap, T as ipcChildLink, U as CapRouteError, V as AGENT_CAP_FWD_SERVICE, W as classifyCapRoute, X as localEndpointPath, Y as SocketChannel, Z as FrameDecoder, _ as resolveHwAccel, _t as CapabilityHandle, a as getWorkerDeviceRegistry, b as __resetCapUsageRegistryForTests, bt as resolveAddonClass, c as setHubConnected, ct as NATIVE_PROVIDER_SERVICE_INFIX, d as getMoleculerEventStats, dt as capBareAction, et as buildUdsNativeCapProxy, f as registerEventBusService, ft as capServiceName, g as createKernelHwAccel, gt as DeviceRegistry, h as AddonDepsManager, ht as serializeTypedArrays, i as createUdsAddonContext, it as mountNativeCapService, j as createParentUnownedCallHandler, k as HUB_CAP_FWD_SERVICE, l as EVENT_TOPIC_PREFIX, lt as capActionName, m as subscribePassthrough, mt as deserializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as createAddonService, p as setNodeEventInterest, pt as parseCapAction, q as UdsLocalTransportClient, r as createAddonContext, s as getOrInitReadinessRegistryForClient, st as validateProviderRegistrations, t as installManifestPythonDeps, tt as createBrokerDeviceManagerApi, u as getBrokerEventBus, ut as capActionSuffix, v as createHwAccelService, vt as CapabilityUnavailableError, w as buildLinkChain, x as getCapUsageRegistry, y as CapUsageRegistry, yt as installManifestNativeDeps, z as UDS_NO_ROUTE_PREFIX } from "./manifest-python-deps-Bp7nvTNF.mjs";
21
+ import { $ as buildNativeCapProxy, A as createHubCapForwardService, B as AGENT_CAP_FWD_ACTION, C as brokerTransportLink, D as localProviderLink, E as ipcParentLink, F as createUdsLogger, G as callWithServiceDiscovery, H as CapRouteResolver, I as createUdsLoggerWithControl, J as UdsLocalTransportServer, K as createLocalTransport, L as LocalChildClient, M as createUdsEventBridge, N as createUdsEventBus, O as HUB_CAP_FWD_ACTION, P as udsChildLogToWorkerEntry, Q as encodeFrame, R as LocalChildRegistry, S as brokerCallForCap, T as ipcChildLink, U as CapRouteError, V as AGENT_CAP_FWD_SERVICE, W as classifyCapRoute, X as localEndpointPath, Y as SocketChannel, Z as FrameDecoder, _ as resolveHwAccel, _t as CapabilityHandle, a as getWorkerDeviceRegistry, b as __resetCapUsageRegistryForTests, bt as resolveAddonClass, c as setHubConnected, ct as NATIVE_PROVIDER_SERVICE_INFIX, d as getMoleculerEventStats, dt as capBareAction, et as buildUdsNativeCapProxy, f as registerEventBusService, ft as capServiceName, g as createKernelHwAccel, gt as DeviceRegistry, h as AddonDepsManager, ht as serializeTypedArrays, i as createUdsAddonContext, it as mountNativeCapService, j as createParentUnownedCallHandler, k as HUB_CAP_FWD_SERVICE, l as EVENT_TOPIC_PREFIX, lt as capActionName, m as subscribePassthrough, mt as deserializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as createAddonService, p as setNodeEventInterest, pt as parseCapAction, q as UdsLocalTransportClient, r as createAddonContext, s as getOrInitReadinessRegistryForClient, st as validateProviderRegistrations, t as installManifestPythonDeps, tt as createBrokerDeviceManagerApi, u as getBrokerEventBus, ut as capActionSuffix, v as createHwAccelService, vt as CapabilityUnavailableError, w as buildLinkChain, x as getCapUsageRegistry, y as CapUsageRegistry, yt as installManifestNativeDeps, z as UDS_NO_ROUTE_PREFIX } from "./manifest-python-deps-hDWMDe_b.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";
@@ -1,6 +1,6 @@
1
- import { CapCallInput } from './child-cap-protocol.js';
2
1
  import { ServiceDiscoveryBroker } from '../moleculer/resilient-cap-call.js';
3
2
  import { CapRoute, CapRouteOpts, HubLocalUdsRoute, InProcessProviderRef } from './cap-route.js';
3
+ import { CapCallInput } from './child-cap-protocol.js';
4
4
  /**
5
5
  * Minimal surface of LocalChildRegistry that the resolver needs.
6
6
  * Keeping a narrow interface here prevents the resolver from depending on the
@@ -80,6 +80,14 @@ export interface CapRouteResolverDeps {
80
80
  * Decouples the resolver from CapabilityRegistry.
81
81
  */
82
82
  readonly inProcessProviders: InProcessProviderLookup;
83
+ /**
84
+ * Optional NODE-ACCURATE lookup for providers physically resident on the
85
+ * hub node — consulted ONLY when a call is EXPLICITLY pinned to the hub.
86
+ * `inProcessProviders` may resolve the cluster-elected ACTIVE singleton
87
+ * (a remote-proxy provider registered in the hub registry), which must not
88
+ * satisfy a `nodePin('hub')`. See `CapRouteSnapshot.hubResidentProvides`.
89
+ */
90
+ readonly hubResidentProviders?: InProcessProviderLookup;
83
91
  /**
84
92
  * Per-cap-method RPC timeout (ms). Lets a long-running cap method (e.g.
85
93
  * `model-convert.convert`, minutes) override the default 60s remote/forward
@@ -133,6 +141,7 @@ export declare class CapRouteResolver {
133
141
  private readonly hubLocalRegistry;
134
142
  private readonly nodeAuthority;
135
143
  private readonly inProcessProviders;
144
+ private readonly hubResidentProviders?;
136
145
  private readonly capTimeoutMs?;
137
146
  private readonly snapshot;
138
147
  constructor(deps: CapRouteResolverDeps);
@@ -108,6 +108,26 @@ export interface CapRouteSnapshot {
108
108
  * null, classifyCapRoute throws no-provider rather than casting.
109
109
  */
110
110
  readonly getInProcessProviderRef?: (cap: string) => InProcessProviderRef | null;
111
+ /**
112
+ * Optional NODE-ACCURATE variant of `hubInProcessProvides`, consulted ONLY
113
+ * for an EXPLICIT hub pin (`opts.nodeId === hubNodeId`). Returns true only
114
+ * when a provider physically resident on the hub node exists.
115
+ *
116
+ * Rationale: `hubInProcessProvides` may be backed by the cluster-elected
117
+ * ACTIVE singleton — which can be a REMOTE-proxy provider registered in the
118
+ * hub registry. That is correct for UNPINNED dispatch (election adherence)
119
+ * but must NOT satisfy an explicit `nodePin('hub')`: dispatching the remote
120
+ * proxy as "hub-in-process" silently executes the call on another node
121
+ * (the shm frame-plane cross-node decoder-session storm). When absent,
122
+ * classifyExplicitNode falls back to `hubInProcessProvides` (legacy).
123
+ */
124
+ readonly hubResidentProvides?: (cap: string) => boolean;
125
+ /**
126
+ * Optional: resolves the InProcessProviderRef of a HUB-RESIDENT provider
127
+ * (paired with `hubResidentProvides` — same node-accuracy contract). Used
128
+ * instead of `getInProcessProviderRef` when `hubResidentProvides` is set.
129
+ */
130
+ readonly getHubResidentProviderRef?: (cap: string) => InProcessProviderRef | null;
111
131
  /**
112
132
  * Optional: enumerates all known remote nodeIds for singleton cap resolution
113
133
  * (the case where no explicit nodeId is given by the caller).
@@ -3584,8 +3584,11 @@ function classifyCapRoute(capName, opts, snapshot) {
3584
3584
  }
3585
3585
  function classifyExplicitNode(capName, nodeId, deviceId, snap, rejected) {
3586
3586
  if (nodeId === snap.hubNodeId) {
3587
- if (snap.hubInProcessProvides(capName)) {
3588
- const ref = snap.getInProcessProviderRef?.(capName) ?? null;
3587
+ const residentProvides = snap.hubResidentProvides;
3588
+ const providesOnHub = residentProvides ?? snap.hubInProcessProvides;
3589
+ const getRef = residentProvides !== void 0 ? snap.getHubResidentProviderRef : snap.getInProcessProviderRef;
3590
+ if (providesOnHub(capName)) {
3591
+ const ref = getRef?.(capName) ?? null;
3589
3592
  if (ref !== null) return {
3590
3593
  kind: "hub-in-process",
3591
3594
  capName,
@@ -3750,6 +3753,7 @@ var CapRouteResolver = class {
3750
3753
  hubLocalRegistry;
3751
3754
  nodeAuthority;
3752
3755
  inProcessProviders;
3756
+ hubResidentProviders;
3753
3757
  capTimeoutMs;
3754
3758
  snapshot;
3755
3759
  constructor(deps) {
@@ -3758,6 +3762,7 @@ var CapRouteResolver = class {
3758
3762
  this.hubLocalRegistry = deps.hubLocalRegistry;
3759
3763
  this.nodeAuthority = deps.nodeAuthority;
3760
3764
  this.inProcessProviders = deps.inProcessProviders;
3765
+ this.hubResidentProviders = deps.hubResidentProviders;
3761
3766
  this.capTimeoutMs = deps.capTimeoutMs;
3762
3767
  this.snapshot = this.buildSnapshot();
3763
3768
  }
@@ -3879,9 +3884,14 @@ var CapRouteResolver = class {
3879
3884
  const hubLocalRegistry = this.hubLocalRegistry;
3880
3885
  const nodeAuthority = this.nodeAuthority;
3881
3886
  const inProcessProviders = this.inProcessProviders;
3887
+ const hubResidentProviders = this.hubResidentProviders;
3882
3888
  return {
3883
3889
  hubNodeId: this.hubNodeId,
3884
3890
  hubInProcessProvides: (cap) => inProcessProviders(cap) !== null,
3891
+ ...hubResidentProviders !== void 0 ? {
3892
+ hubResidentProvides: (cap) => hubResidentProviders(cap) !== null,
3893
+ getHubResidentProviderRef: (cap) => hubResidentProviders(cap)
3894
+ } : {},
3885
3895
  hubLocalChildProvides: (cap, deviceId) => hubLocalRegistry !== null && hubLocalRegistry.resolveChildId(cap, deviceId) !== null,
3886
3896
  nodeKnowsCap: (nodeId, cap) => nodeAuthority.nodeKnowsCap(nodeId, cap),
3887
3897
  nodeIsAgent: (nodeId) => nodeAuthority.nodeIsAgent(nodeId),
@@ -3582,8 +3582,11 @@ function classifyCapRoute(capName, opts, snapshot) {
3582
3582
  }
3583
3583
  function classifyExplicitNode(capName, nodeId, deviceId, snap, rejected) {
3584
3584
  if (nodeId === snap.hubNodeId) {
3585
- if (snap.hubInProcessProvides(capName)) {
3586
- const ref = snap.getInProcessProviderRef?.(capName) ?? null;
3585
+ const residentProvides = snap.hubResidentProvides;
3586
+ const providesOnHub = residentProvides ?? snap.hubInProcessProvides;
3587
+ const getRef = residentProvides !== void 0 ? snap.getHubResidentProviderRef : snap.getInProcessProviderRef;
3588
+ if (providesOnHub(capName)) {
3589
+ const ref = getRef?.(capName) ?? null;
3587
3590
  if (ref !== null) return {
3588
3591
  kind: "hub-in-process",
3589
3592
  capName,
@@ -3748,6 +3751,7 @@ var CapRouteResolver = class {
3748
3751
  hubLocalRegistry;
3749
3752
  nodeAuthority;
3750
3753
  inProcessProviders;
3754
+ hubResidentProviders;
3751
3755
  capTimeoutMs;
3752
3756
  snapshot;
3753
3757
  constructor(deps) {
@@ -3756,6 +3760,7 @@ var CapRouteResolver = class {
3756
3760
  this.hubLocalRegistry = deps.hubLocalRegistry;
3757
3761
  this.nodeAuthority = deps.nodeAuthority;
3758
3762
  this.inProcessProviders = deps.inProcessProviders;
3763
+ this.hubResidentProviders = deps.hubResidentProviders;
3759
3764
  this.capTimeoutMs = deps.capTimeoutMs;
3760
3765
  this.snapshot = this.buildSnapshot();
3761
3766
  }
@@ -3877,9 +3882,14 @@ var CapRouteResolver = class {
3877
3882
  const hubLocalRegistry = this.hubLocalRegistry;
3878
3883
  const nodeAuthority = this.nodeAuthority;
3879
3884
  const inProcessProviders = this.inProcessProviders;
3885
+ const hubResidentProviders = this.hubResidentProviders;
3880
3886
  return {
3881
3887
  hubNodeId: this.hubNodeId,
3882
3888
  hubInProcessProvides: (cap) => inProcessProviders(cap) !== null,
3889
+ ...hubResidentProviders !== void 0 ? {
3890
+ hubResidentProvides: (cap) => hubResidentProviders(cap) !== null,
3891
+ getHubResidentProviderRef: (cap) => hubResidentProviders(cap)
3892
+ } : {},
3883
3893
  hubLocalChildProvides: (cap, deviceId) => hubLocalRegistry !== null && hubLocalRegistry.resolveChildId(cap, deviceId) !== null,
3884
3894
  nodeKnowsCap: (nodeId, cap) => nodeAuthority.nodeKnowsCap(nodeId, cap),
3885
3895
  nodeIsAgent: (nodeId) => nodeAuthority.nodeIsAgent(nodeId),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",