@camstack/system 1.1.25 → 1.1.26

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.
@@ -39,8 +39,7 @@ import { BaseAddon, errMsg, hydrateSchema } from "@camstack/types";
39
39
  /** Section key → user-facing section title. */
40
40
  var SECTION_TITLES = {
41
41
  server: "Server",
42
- auth: "Authentication",
43
- ffmpeg: "FFmpeg"
42
+ auth: "Authentication"
44
43
  };
45
44
  /** Keys that map 1:1 to a given yml section — used by `updateGlobalSettings`
46
45
  * to figure out which section owns each key in the incoming patch. */
@@ -48,10 +47,7 @@ var KEY_TO_SECTION = {
48
47
  port: "server",
49
48
  host: "server",
50
49
  dataPath: "server",
51
- tokenExpiry: "auth",
52
- binaryPath: "ffmpeg",
53
- hwAccel: "ffmpeg",
54
- threadCount: "ffmpeg"
50
+ tokenExpiry: "auth"
55
51
  };
56
52
  var SystemConfigAddon = class extends BaseAddon {
57
53
  id = "system-config";
@@ -62,119 +58,56 @@ var SystemConfigAddon = class extends BaseAddon {
62
58
  this.ctx.logger.info("Initialized — exposes yml-backed sections via getGlobalSettings");
63
59
  }
64
60
  buildGlobalSchema() {
65
- return { sections: [
66
- {
67
- id: "system-config-server",
68
- title: SECTION_TITLES["server"],
69
- description: "Core server connection settings — read-only, loaded from config.yaml at bootstrap.",
70
- columns: 2,
71
- fields: [
72
- {
73
- type: "info",
74
- key: "server-restart-note",
75
- label: "Restart required",
76
- content: "Server settings are read-only. Change them in config.yaml and restart.",
77
- variant: "warning"
78
- },
79
- {
80
- type: "text",
81
- key: "port",
82
- label: "Port",
83
- description: "Listening port",
84
- disabled: true
85
- },
86
- {
87
- type: "text",
88
- key: "host",
89
- label: "Host",
90
- description: "Bind address",
91
- disabled: true
92
- },
93
- {
94
- type: "text",
95
- key: "dataPath",
96
- label: "Data Path",
97
- description: "Root data directory",
98
- disabled: true,
99
- span: 2
100
- }
101
- ]
102
- },
103
- {
104
- id: "system-config-auth",
105
- title: SECTION_TITLES["auth"],
106
- description: "Token and session settings.",
107
- columns: 1,
108
- fields: [{
61
+ return { sections: [{
62
+ id: "system-config-server",
63
+ title: SECTION_TITLES["server"],
64
+ description: "Core server connection settings — read-only, loaded from config.yaml at bootstrap.",
65
+ columns: 2,
66
+ fields: [
67
+ {
68
+ type: "info",
69
+ key: "server-restart-note",
70
+ label: "Restart required",
71
+ content: "Server settings are read-only. Change them in config.yaml and restart.",
72
+ variant: "warning"
73
+ },
74
+ {
109
75
  type: "text",
110
- key: "tokenExpiry",
111
- label: "Token Expiry",
112
- description: "JWT token lifetime (e.g. 24h, 7d, 1h)",
113
- placeholder: "24h",
114
- default: "24h"
115
- }]
116
- },
117
- {
118
- id: "system-config-ffmpeg",
119
- title: SECTION_TITLES["ffmpeg"],
120
- description: "FFmpeg binary and hardware acceleration settings.",
121
- columns: 2,
122
- fields: [
123
- {
124
- type: "text",
125
- key: "binaryPath",
126
- label: "Binary Path",
127
- description: "Path to ffmpeg executable",
128
- placeholder: "ffmpeg",
129
- default: "ffmpeg",
130
- span: 2
131
- },
132
- {
133
- type: "select",
134
- key: "hwAccel",
135
- label: "Hardware Acceleration",
136
- description: "GPU decoding/encoding backend",
137
- default: "auto",
138
- options: [
139
- {
140
- value: "auto",
141
- label: "Auto-detect"
142
- },
143
- {
144
- value: "none",
145
- label: "None (CPU only)"
146
- },
147
- {
148
- value: "videotoolbox",
149
- label: "VideoToolbox (macOS)"
150
- },
151
- {
152
- value: "vaapi",
153
- label: "VA-API (Linux Intel/AMD)"
154
- },
155
- {
156
- value: "qsv",
157
- label: "QSV (Intel Quick Sync)"
158
- },
159
- {
160
- value: "cuda",
161
- label: "CUDA (NVIDIA)"
162
- }
163
- ]
164
- },
165
- {
166
- type: "number",
167
- key: "threadCount",
168
- label: "Thread Count",
169
- description: "0 = auto (let FFmpeg decide)",
170
- min: 0,
171
- max: 16,
172
- step: 1,
173
- default: 0
174
- }
175
- ]
176
- }
177
- ] };
76
+ key: "port",
77
+ label: "Port",
78
+ description: "Listening port",
79
+ disabled: true
80
+ },
81
+ {
82
+ type: "text",
83
+ key: "host",
84
+ label: "Host",
85
+ description: "Bind address",
86
+ disabled: true
87
+ },
88
+ {
89
+ type: "text",
90
+ key: "dataPath",
91
+ label: "Data Path",
92
+ description: "Root data directory",
93
+ disabled: true,
94
+ span: 2
95
+ }
96
+ ]
97
+ }, {
98
+ id: "system-config-auth",
99
+ title: SECTION_TITLES["auth"],
100
+ description: "Token and session settings.",
101
+ columns: 1,
102
+ fields: [{
103
+ type: "text",
104
+ key: "tokenExpiry",
105
+ label: "Token Expiry",
106
+ description: "JWT token lifetime (e.g. 24h, 7d, 1h)",
107
+ placeholder: "24h",
108
+ default: "24h"
109
+ }]
110
+ }] };
178
111
  }
179
112
  async getGlobalSettings() {
180
113
  const schema = this.buildGlobalSchema();
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-BqXCckob.js");
23
+ const require_manifest_python_deps = require("./manifest-python-deps-CCmnJmNf.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");
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 buildUdsNativeCapProxy, A as createParentUnownedCallHandler, B as AGENT_CAP_FWD_SERVICE, C as buildLinkChain, D as HUB_CAP_FWD_ACTION, E as localProviderLink, F as createUdsLoggerWithControl, G as createLocalTransport, H as CapRouteError, I as LocalChildClient, J as SocketChannel, K as UdsLocalTransportClient, L as LocalChildRegistry, M as createUdsEventBus, N as udsChildLogToWorkerEntry, O as HUB_CAP_FWD_SERVICE, P as createUdsLogger, Q as buildNativeCapProxy, R as UDS_NO_ROUTE_PREFIX, S as brokerTransportLink, T as ipcParentLink, U as classifyCapRoute, V as CapRouteResolver, W as callWithServiceDiscovery, X as FrameDecoder, Y as localEndpointPath, Z as encodeFrame, _ as resolveHwAccel, _t as CapabilityUnavailableError, a as getWorkerDeviceRegistry, at as createAddonService, b as getCapUsageRegistry, c as setHubConnected, ct as capActionName, d as getMoleculerEventStats, dt as capServiceName, et as createBrokerDeviceManagerApi, f as registerEventBusService, ft as parseCapAction, g as createKernelHwAccel, gt as CapabilityHandle, h as AddonDepsManager, ht as DeviceRegistry, i as createUdsAddonContext, j as createUdsEventBridge, k as createHubCapForwardService, l as EVENT_TOPIC_PREFIX, lt as capActionSuffix, m as subscribePassthrough, mt as serializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as validateProviderRegistrations, p as setNodeEventInterest, pt as deserializeTypedArrays, q as UdsLocalTransportServer, r as createAddonContext, rt as mountNativeCapService, s as getOrInitReadinessRegistryForClient, st as NATIVE_PROVIDER_SERVICE_INFIX, t as installManifestPythonDeps, u as getBrokerEventBus, ut as capBareAction, v as CapUsageRegistry, vt as installManifestNativeDeps, w as ipcChildLink, x as brokerCallForCap, y as __resetCapUsageRegistryForTests, yt as resolveAddonClass, z as AGENT_CAP_FWD_ACTION } from "./manifest-python-deps-Dxl4twM3.mjs";
21
+ import { $ as buildUdsNativeCapProxy, A as createParentUnownedCallHandler, B as AGENT_CAP_FWD_SERVICE, C as buildLinkChain, D as HUB_CAP_FWD_ACTION, E as localProviderLink, F as createUdsLoggerWithControl, G as createLocalTransport, H as CapRouteError, I as LocalChildClient, J as SocketChannel, K as UdsLocalTransportClient, L as LocalChildRegistry, M as createUdsEventBus, N as udsChildLogToWorkerEntry, O as HUB_CAP_FWD_SERVICE, P as createUdsLogger, Q as buildNativeCapProxy, R as UDS_NO_ROUTE_PREFIX, S as brokerTransportLink, T as ipcParentLink, U as classifyCapRoute, V as CapRouteResolver, W as callWithServiceDiscovery, X as FrameDecoder, Y as localEndpointPath, Z as encodeFrame, _ as resolveHwAccel, _t as CapabilityUnavailableError, a as getWorkerDeviceRegistry, at as createAddonService, b as getCapUsageRegistry, c as setHubConnected, ct as capActionName, d as getMoleculerEventStats, dt as capServiceName, et as createBrokerDeviceManagerApi, f as registerEventBusService, ft as parseCapAction, g as createKernelHwAccel, gt as CapabilityHandle, h as AddonDepsManager, ht as DeviceRegistry, i as createUdsAddonContext, j as createUdsEventBridge, k as createHubCapForwardService, l as EVENT_TOPIC_PREFIX, lt as capActionSuffix, m as subscribePassthrough, mt as serializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as validateProviderRegistrations, p as setNodeEventInterest, pt as deserializeTypedArrays, q as UdsLocalTransportServer, r as createAddonContext, rt as mountNativeCapService, s as getOrInitReadinessRegistryForClient, st as NATIVE_PROVIDER_SERVICE_INFIX, t as installManifestPythonDeps, u as getBrokerEventBus, ut as capBareAction, v as CapUsageRegistry, vt as installManifestNativeDeps, w as ipcChildLink, x as brokerCallForCap, y as __resetCapUsageRegistryForTests, yt as resolveAddonClass, z as AGENT_CAP_FWD_ACTION } from "./manifest-python-deps-DPA7N9UP.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,4 +1,13 @@
1
1
  import { HwAccelBackend, HwAccelResolution } from '@camstack/types';
2
+ export interface PlatformSignals {
3
+ readonly platform: NodeJS.Platform;
4
+ readonly arch: string;
5
+ readonly hasNvidiaGpu: boolean;
6
+ readonly hasAmdGpu: boolean;
7
+ readonly hasIntelGpu: boolean;
8
+ readonly hasRenderNode: boolean;
9
+ }
10
+ export declare function probePlatform(): PlatformSignals;
2
11
  /**
3
12
  * Resolve the preferred hardware acceleration backend order for the
4
13
  * current host.
@@ -0,0 +1,16 @@
1
+ import { IKernelInferenceEngine, KernelInferenceHardware } from '@camstack/types';
2
+ import { PlatformSignals } from '../hwaccel/hwaccel-resolver.js';
3
+ /**
4
+ * Map the shared platform GPU-vendor probe into the inference `gpu`/`npu` types
5
+ * the runtime scorer understands. NVIDIA → cuda; Intel iGPU (or a bare render
6
+ * node) → openvino; Apple Silicon → CoreML/ANE. The Intel NPU is not separately
7
+ * detected — an Intel iGPU already selects openvino (the NPU only bumps the
8
+ * score, never changes the winner). PURE — unit-tested.
9
+ */
10
+ export declare function mapSignalsToInferenceHardware(signals: PlatformSignals): KernelInferenceHardware;
11
+ /**
12
+ * Build the local in-process inference-hardware resolver used to populate
13
+ * `ctx.kernel.inferenceEngine`. The exact model as `createKernelHwAccel`:
14
+ * deterministic per host, safe to call repeatedly, always the LOCAL node.
15
+ */
16
+ export declare function createKernelInferenceEngine(): IKernelInferenceEngine;
@@ -5661,6 +5661,29 @@ function createKernelHwAccel() {
5661
5661
  return { resolve: async (prefer) => resolveHwAccel(prefer) };
5662
5662
  }
5663
5663
  //#endregion
5664
+ //#region src/kernel/inference/inference-resolver.ts
5665
+ /**
5666
+ * Map the shared platform GPU-vendor probe into the inference `gpu`/`npu` types
5667
+ * the runtime scorer understands. NVIDIA → cuda; Intel iGPU (or a bare render
5668
+ * node) → openvino; Apple Silicon → CoreML/ANE. The Intel NPU is not separately
5669
+ * detected — an Intel iGPU already selects openvino (the NPU only bumps the
5670
+ * score, never changes the winner). PURE — unit-tested.
5671
+ */
5672
+ function mapSignalsToInferenceHardware(signals) {
5673
+ return {
5674
+ gpu: signals.hasNvidiaGpu ? { type: "nvidia" } : signals.hasIntelGpu || signals.hasRenderNode ? { type: "intel" } : null,
5675
+ npu: signals.platform === "darwin" && signals.arch === "arm64" ? { type: "apple-ane" } : null
5676
+ };
5677
+ }
5678
+ /**
5679
+ * Build the local in-process inference-hardware resolver used to populate
5680
+ * `ctx.kernel.inferenceEngine`. The exact model as `createKernelHwAccel`:
5681
+ * deterministic per host, safe to call repeatedly, always the LOCAL node.
5682
+ */
5683
+ function createKernelInferenceEngine() {
5684
+ return { resolveHardware: async () => mapSignalsToInferenceHardware(probePlatform()) };
5685
+ }
5686
+ //#endregion
5664
5687
  //#region src/kernel/moleculer/addon-data-plane-facility.ts
5665
5688
  /**
5666
5689
  * Kernel side of the addon HTTP **data-plane** (see {@link AddonDataPlane}).
@@ -6926,6 +6949,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
6926
6949
  })
6927
6950
  };
6928
6951
  const hwaccel = createKernelHwAccel();
6952
+ const inferenceEngine = createKernelInferenceEngine();
6929
6953
  return {
6930
6954
  localNodeId: nodeId,
6931
6955
  storage: options?.storageProvider ?? void 0,
@@ -6946,7 +6970,8 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
6946
6970
  }),
6947
6971
  ...runtime.mode === "broker" ? { cluster: { broker: adaptBrokerToCluster(runtime.broker) } } : {},
6948
6972
  streamProbe,
6949
- hwaccel
6973
+ hwaccel,
6974
+ inferenceEngine
6950
6975
  };
6951
6976
  })(),
6952
6977
  registerProvider(capabilityName, provider) {
@@ -5659,6 +5659,29 @@ function createKernelHwAccel() {
5659
5659
  return { resolve: async (prefer) => resolveHwAccel(prefer) };
5660
5660
  }
5661
5661
  //#endregion
5662
+ //#region src/kernel/inference/inference-resolver.ts
5663
+ /**
5664
+ * Map the shared platform GPU-vendor probe into the inference `gpu`/`npu` types
5665
+ * the runtime scorer understands. NVIDIA → cuda; Intel iGPU (or a bare render
5666
+ * node) → openvino; Apple Silicon → CoreML/ANE. The Intel NPU is not separately
5667
+ * detected — an Intel iGPU already selects openvino (the NPU only bumps the
5668
+ * score, never changes the winner). PURE — unit-tested.
5669
+ */
5670
+ function mapSignalsToInferenceHardware(signals) {
5671
+ return {
5672
+ gpu: signals.hasNvidiaGpu ? { type: "nvidia" } : signals.hasIntelGpu || signals.hasRenderNode ? { type: "intel" } : null,
5673
+ npu: signals.platform === "darwin" && signals.arch === "arm64" ? { type: "apple-ane" } : null
5674
+ };
5675
+ }
5676
+ /**
5677
+ * Build the local in-process inference-hardware resolver used to populate
5678
+ * `ctx.kernel.inferenceEngine`. The exact model as `createKernelHwAccel`:
5679
+ * deterministic per host, safe to call repeatedly, always the LOCAL node.
5680
+ */
5681
+ function createKernelInferenceEngine() {
5682
+ return { resolveHardware: async () => mapSignalsToInferenceHardware(probePlatform()) };
5683
+ }
5684
+ //#endregion
5662
5685
  //#region src/kernel/moleculer/addon-data-plane-facility.ts
5663
5686
  /**
5664
5687
  * Kernel side of the addon HTTP **data-plane** (see {@link AddonDataPlane}).
@@ -6924,6 +6947,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
6924
6947
  })
6925
6948
  };
6926
6949
  const hwaccel = createKernelHwAccel();
6950
+ const inferenceEngine = createKernelInferenceEngine();
6927
6951
  return {
6928
6952
  localNodeId: nodeId,
6929
6953
  storage: options?.storageProvider ?? void 0,
@@ -6944,7 +6968,8 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
6944
6968
  }),
6945
6969
  ...runtime.mode === "broker" ? { cluster: { broker: adaptBrokerToCluster(runtime.broker) } } : {},
6946
6970
  streamProbe,
6947
- hwaccel
6971
+ hwaccel,
6972
+ inferenceEngine
6948
6973
  };
6949
6974
  })(),
6950
6975
  registerProvider(capabilityName, provider) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",
@@ -1,37 +0,0 @@
1
- import { HardwareDecodeAccels, IScopedLogger } from '@camstack/types';
2
- /**
3
- * Injectable runner for `ffmpeg -hwaccels`. Defaults to a real `execFile`;
4
- * tests pass a fake to assert behaviour without spawning ffmpeg.
5
- */
6
- export type HwAccelExecFn = (ffmpegPath: string, args: readonly string[]) => Promise<{
7
- stdout: string;
8
- }>;
9
- /**
10
- * Parse the output of `ffmpeg -hwaccels`. The listing looks like:
11
- *
12
- * Hardware acceleration methods:
13
- * videotoolbox
14
- *
15
- * The header line is dropped; remaining non-empty trimmed lines are the
16
- * method names, lowercased and de-duplicated (order preserved).
17
- */
18
- export declare function parseHwAccelsOutput(stdout: string): string[];
19
- /**
20
- * Probes which `-hwaccel` decode backends the configured ffmpeg binary
21
- * supports. Mirrors {@link HardwareEncoderProber} (configured binary, cached,
22
- * single-flight, forceable). Never throws: a probe failure yields an empty
23
- * method list so callers fall back to software decode.
24
- */
25
- export declare class HardwareDecodeAccelProber {
26
- private cached;
27
- private inflight;
28
- private readonly logger;
29
- private readonly ffmpegPath;
30
- private readonly execFn;
31
- constructor(logger: IScopedLogger, ffmpegPath?: string, execFn?: HwAccelExecFn);
32
- getCached(): HardwareDecodeAccels | null;
33
- probe(options?: {
34
- readonly force?: boolean;
35
- }): Promise<HardwareDecodeAccels>;
36
- private runProbe;
37
- }
@@ -1,13 +0,0 @@
1
- import { HardwareInfo, HardwareEncoders, IScopedLogger } from '@camstack/types';
2
- export declare class HardwareEncoderProber {
3
- private cached;
4
- private inflight;
5
- private readonly logger;
6
- private readonly ffmpegPath;
7
- constructor(logger: IScopedLogger, ffmpegPath?: string);
8
- getCached(): HardwareEncoders | null;
9
- probe(hardware: HardwareInfo, options?: {
10
- readonly force?: boolean;
11
- }): Promise<HardwareEncoders>;
12
- private runProbe;
13
- }