@camstack/system 1.1.34 → 1.1.35
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/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +6 -6
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +6 -6
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +12 -12
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +5 -5
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +3 -3
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +69 -69
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/hub-forwarder/index.js +3 -3
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +7 -7
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +7 -7
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +5 -5
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +13 -13
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +13 -13
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +4 -4
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +9 -9
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +5 -5
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +5 -5
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +3 -3
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/dist-DlGZpWo8.mjs +24597 -0
- package/dist/dist-DriXJoVg.js +25070 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +92 -115
- package/dist/index.mjs +52 -52
- package/dist/{manifest-python-deps-u-AQBQY6.mjs → manifest-python-deps-MUu1e33G.mjs} +27 -27
- package/dist/{manifest-python-deps-CAnO1wPx.js → manifest-python-deps-jZA_Qorz.js} +3 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { $ as errMsg$1, A as isVoidInput, Ct as resolveCapMount, F as looseSchema, M as lifecycleJobSchema, O as isArrayOutputSchema, St as readinessKey, V as procedureAuthKey, _t as expandCapMethods, bt as parseJsonObject, ct as ReadinessRegistry, dt as asJsonObject$1, ft as asNumber, ht as emitDownForOwnedCaps, j as kebabToCamel, k as isObjectInput, lt as ReadinessTimeoutError, mt as createEvent, nt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, o as METHOD_ACCESS_MAP, p as addonSettingsCapability, pt as asString$1, rt as DEVICE_STATUS_METHOD, s as RUNTIME_DEFAULTS, st as EventCategory$1, t as ALL_CAPABILITY_DEFINITIONS, tt as DATAPLANE_SECRET_HEADER$1, wt as scopeKey, xt as parseJsonUnknown$1 } from "./dist-DlGZpWo8.mjs";
|
|
1
2
|
import { a as downloadModel, c as getModelFilePath, d as contentTypeFor, f as createAuthenticatedFileServer, h as resolveFilePath, i as downloadFile, l as isModelDownloaded, m as parseTokenizedUrl, n as collectModelFiles, o as ensureModel, p as parseRangeHeader, r as deleteModelFromDisk, s as fetchJson, t as ModelDownloadService, u as createFileDataPlaneHandler } from "./model-download-service-C-IHWnXx.mjs";
|
|
2
3
|
import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Le3l0qS2.mjs";
|
|
3
4
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
|
|
@@ -18,15 +19,15 @@ import { LocalAuthAddon, a as require_ms, c as __esmMin, d as __toCommonJS, f as
|
|
|
18
19
|
import "./builtins/local-auth/index.mjs";
|
|
19
20
|
import { DeviceManagerAddon } from "./builtins/device-manager/device-manager.addon.mjs";
|
|
20
21
|
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-
|
|
22
|
+
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-MUu1e33G.mjs";
|
|
22
23
|
import { t as CustomActionRegistry } from "./custom-action-registry-BEXwC-oo.mjs";
|
|
23
24
|
import { PYTHON_VERSION, buildBinaryPath, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
|
|
25
|
+
import { z } from "zod";
|
|
24
26
|
import { request } from "node:http";
|
|
25
27
|
import * as fs$17 from "node:fs";
|
|
26
28
|
import { accessSync, constants, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
27
29
|
import * as path$39 from "node:path";
|
|
28
30
|
import { dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
29
|
-
import { ALL_CAPABILITY_DEFINITIONS, DATAPLANE_SECRET_HEADER, EventCategory, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, asJsonObject, asNumber, asString, createEvent, emitDownForOwnedCaps, errMsg, expandCapMethods, isObjectInput, isVoidInput, kebabToCamel, lifecycleJobSchema, looseSchema, parseJsonObject, parseJsonUnknown, procedureAuthKey, readinessKey, resolveCapMount, scopeKey } from "@camstack/types";
|
|
30
31
|
import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
31
32
|
import { execFile, spawn } from "node:child_process";
|
|
32
33
|
import * as util$10 from "node:util";
|
|
@@ -34,8 +35,7 @@ import { promisify } from "node:util";
|
|
|
34
35
|
import * as vm from "node:vm";
|
|
35
36
|
import * as os$18 from "node:os";
|
|
36
37
|
import { lstat, readdir, readlink, realpath } from "node:fs/promises";
|
|
37
|
-
import {
|
|
38
|
-
import { asJsonObject as asJsonObject$1, parseJsonUnknown as parseJsonUnknown$1 } from "@camstack/types/addon";
|
|
38
|
+
import { asJsonObject, parseJsonUnknown } from "@camstack/types/addon";
|
|
39
39
|
import { EventEmitter } from "node:events";
|
|
40
40
|
import As from "node:stream";
|
|
41
41
|
import { StringDecoder } from "node:string_decoder";
|
|
@@ -150,7 +150,7 @@ function proxyToUpstream(opts) {
|
|
|
150
150
|
delete headers.host;
|
|
151
151
|
delete headers.connection;
|
|
152
152
|
delete headers["content-length"];
|
|
153
|
-
headers[DATAPLANE_SECRET_HEADER] = secret;
|
|
153
|
+
headers[DATAPLANE_SECRET_HEADER$1] = secret;
|
|
154
154
|
const upstream = request({
|
|
155
155
|
protocol: base.protocol,
|
|
156
156
|
hostname: base.hostname,
|
|
@@ -320,7 +320,7 @@ var PipelineRunner = class {
|
|
|
320
320
|
}
|
|
321
321
|
} catch (error) {
|
|
322
322
|
const stepMs = performance.now() - stepStart;
|
|
323
|
-
const message = errMsg(error);
|
|
323
|
+
const message = errMsg$1(error);
|
|
324
324
|
results.push({
|
|
325
325
|
addon: node.addon,
|
|
326
326
|
slot: "detector",
|
|
@@ -1562,7 +1562,7 @@ var NotificationService = class {
|
|
|
1562
1562
|
this.logger.error("Notification target failed", { meta: {
|
|
1563
1563
|
addonId: ref.addonId,
|
|
1564
1564
|
targetId: ref.targetId,
|
|
1565
|
-
error: errMsg(err)
|
|
1565
|
+
error: errMsg$1(err)
|
|
1566
1566
|
} });
|
|
1567
1567
|
}
|
|
1568
1568
|
}));
|
|
@@ -2338,7 +2338,7 @@ var AddonLoader = class {
|
|
|
2338
2338
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
2339
2339
|
async loadFromAddonDir(addonDir) {
|
|
2340
2340
|
const pkgJsonPath = path$39.join(addonDir, "package.json");
|
|
2341
|
-
const pkgJson = asJsonObject(parseJsonUnknown(fs$17.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
2341
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown$1(fs$17.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
2342
2342
|
const packageNameRaw = pkgJson["name"];
|
|
2343
2343
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
2344
2344
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -2704,7 +2704,7 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
2704
2704
|
const distSrc = path$39.join(srcPkgJsonDir, "dist");
|
|
2705
2705
|
if (fs$17.existsSync(distSrc)) await copyDirRecursive(distSrc, path$39.join(targetDir, "dist"));
|
|
2706
2706
|
try {
|
|
2707
|
-
const npmPkg = asJsonObject(parseJsonUnknown(await fs$17.promises.readFile(path$39.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
2707
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown$1(await fs$17.promises.readFile(path$39.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
2708
2708
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
2709
2709
|
} catch {}
|
|
2710
2710
|
} finally {
|
|
@@ -2936,15 +2936,15 @@ function parseInstallSource(value) {
|
|
|
2936
2936
|
function readPackageJson(pkgJsonPath) {
|
|
2937
2937
|
let raw;
|
|
2938
2938
|
try {
|
|
2939
|
-
raw = asJsonObject(parseJsonUnknown(fs$17.readFileSync(pkgJsonPath, "utf-8")));
|
|
2939
|
+
raw = asJsonObject$1(parseJsonUnknown$1(fs$17.readFileSync(pkgJsonPath, "utf-8")));
|
|
2940
2940
|
} catch {
|
|
2941
2941
|
return null;
|
|
2942
2942
|
}
|
|
2943
2943
|
if (!raw) return null;
|
|
2944
|
-
const name = asString(raw["name"]);
|
|
2945
|
-
const version = asString(raw["version"]);
|
|
2944
|
+
const name = asString$1(raw["name"]);
|
|
2945
|
+
const version = asString$1(raw["version"]);
|
|
2946
2946
|
if (!name || !version) return null;
|
|
2947
|
-
const camstack = asJsonObject(raw["camstack"]);
|
|
2947
|
+
const camstack = asJsonObject$1(raw["camstack"]);
|
|
2948
2948
|
const addonsField = camstack ? camstack["addons"] : void 0;
|
|
2949
2949
|
return {
|
|
2950
2950
|
name,
|
|
@@ -3064,7 +3064,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3064
3064
|
}
|
|
3065
3065
|
await this.installFromNpm(packageName);
|
|
3066
3066
|
} catch (err) {
|
|
3067
|
-
const msg = errMsg(err);
|
|
3067
|
+
const msg = errMsg$1(err);
|
|
3068
3068
|
if (packageName === "@camstack/system") throw new Error(`Required package ${packageName} failed to install: ${msg}`, { cause: err });
|
|
3069
3069
|
this.logger.error(`Failed to install ${packageName}`, { meta: { error: msg } });
|
|
3070
3070
|
}
|
|
@@ -3117,7 +3117,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3117
3117
|
if (this.installSource === "symlink") try {
|
|
3118
3118
|
return await this.installSymlink(packageName, sourceDir, pkgView.raw, targetDir);
|
|
3119
3119
|
} catch (err) {
|
|
3120
|
-
this.logger.warn(`${packageName} — symlink failed, falling back to copy: ${errMsg(err)}`);
|
|
3120
|
+
this.logger.warn(`${packageName} — symlink failed, falling back to copy: ${errMsg$1(err)}`);
|
|
3121
3121
|
}
|
|
3122
3122
|
return this.installCopy(packageName, sourceDir, pkgView.raw, targetDir);
|
|
3123
3123
|
}
|
|
@@ -3145,13 +3145,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3145
3145
|
ensureDir(path$39.dirname(targetDir));
|
|
3146
3146
|
fs$17.symlinkSync(sourceDir, targetDir, "dir");
|
|
3147
3147
|
this.manifest.upsert(packageName, {
|
|
3148
|
-
version: asString(pkgData.version, "0.0.0"),
|
|
3148
|
+
version: asString$1(pkgData.version, "0.0.0"),
|
|
3149
3149
|
source: "local"
|
|
3150
3150
|
});
|
|
3151
3151
|
this.logger.info(`${packageName} — symlinked → ${sourceDir}`);
|
|
3152
3152
|
return {
|
|
3153
|
-
name: asString(pkgData.name, packageName),
|
|
3154
|
-
version: asString(pkgData.version, "0.0.0")
|
|
3153
|
+
name: asString$1(pkgData.name, packageName),
|
|
3154
|
+
version: asString$1(pkgData.version, "0.0.0")
|
|
3155
3155
|
};
|
|
3156
3156
|
}
|
|
3157
3157
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
@@ -3167,7 +3167,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3167
3167
|
await copyDirRecursive(distDir, path$39.join(targetDir, "dist"));
|
|
3168
3168
|
await copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
3169
3169
|
await fs$17.promises.writeFile(path$39.join(targetDir, ".install-source"), "local");
|
|
3170
|
-
const localPkgVersion = asString(pkgData.version, "0.0.0");
|
|
3170
|
+
const localPkgVersion = asString$1(pkgData.version, "0.0.0");
|
|
3171
3171
|
this.manifest.upsert(packageName, {
|
|
3172
3172
|
version: localPkgVersion,
|
|
3173
3173
|
source: "local"
|
|
@@ -3186,7 +3186,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3186
3186
|
try {
|
|
3187
3187
|
await installManifestNativeDeps(targetDir, pkgData, this.logger, this.registry);
|
|
3188
3188
|
} catch (err) {
|
|
3189
|
-
this.logger.warn(`${packageName} — native deps install failed (continuing)`, { meta: { error: errMsg(err) } });
|
|
3189
|
+
this.logger.warn(`${packageName} — native deps install failed (continuing)`, { meta: { error: errMsg$1(err) } });
|
|
3190
3190
|
}
|
|
3191
3191
|
this.logger.info(`${packageName} — copied from ${sourceDir}`);
|
|
3192
3192
|
return {
|
|
@@ -3312,7 +3312,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3312
3312
|
}).catch((cleanupErr) => {
|
|
3313
3313
|
this.logger.debug("evictInstallDir: aside cleanup deferred (likely held open)", { meta: {
|
|
3314
3314
|
asideDir,
|
|
3315
|
-
error: errMsg(cleanupErr)
|
|
3315
|
+
error: errMsg$1(cleanupErr)
|
|
3316
3316
|
} });
|
|
3317
3317
|
});
|
|
3318
3318
|
}
|
|
@@ -3375,7 +3375,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3375
3375
|
try {
|
|
3376
3376
|
await installManifestNativeDeps(pkgDir, pkgView.raw, this.logger, this.registry);
|
|
3377
3377
|
} catch (nativeErr) {
|
|
3378
|
-
throw new Error(`${pkgView.name} — native deps install failed: ${errMsg(nativeErr)}`, { cause: nativeErr });
|
|
3378
|
+
throw new Error(`${pkgView.name} — native deps install failed: ${errMsg$1(nativeErr)}`, { cause: nativeErr });
|
|
3379
3379
|
}
|
|
3380
3380
|
await this.evictInstallDir(targetDir);
|
|
3381
3381
|
ensureDir(path$39.dirname(targetDir));
|
|
@@ -3434,7 +3434,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3434
3434
|
};
|
|
3435
3435
|
} else result = await this.installFromNpm(packageName, version);
|
|
3436
3436
|
} catch (installErr) {
|
|
3437
|
-
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg(installErr) } });
|
|
3437
|
+
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
|
|
3438
3438
|
try {
|
|
3439
3439
|
if (fs$17.existsSync(addonDir)) fs$17.rmSync(addonDir, {
|
|
3440
3440
|
recursive: true,
|
|
@@ -3449,7 +3449,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3449
3449
|
} catch (restoreErr) {
|
|
3450
3450
|
this.logger.error(`${packageName} — backup restore ALSO failed; manual recovery needed`, { meta: {
|
|
3451
3451
|
backupDir,
|
|
3452
|
-
error: errMsg(restoreErr)
|
|
3452
|
+
error: errMsg$1(restoreErr)
|
|
3453
3453
|
} });
|
|
3454
3454
|
}
|
|
3455
3455
|
throw installErr;
|
|
@@ -3504,7 +3504,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3504
3504
|
} else throw renameErr;
|
|
3505
3505
|
}
|
|
3506
3506
|
} catch (swapErr) {
|
|
3507
|
-
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg(swapErr) } });
|
|
3507
|
+
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
|
|
3508
3508
|
try {
|
|
3509
3509
|
if (fs$17.existsSync(addonDir)) fs$17.rmSync(addonDir, {
|
|
3510
3510
|
recursive: true,
|
|
@@ -3519,7 +3519,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3519
3519
|
} catch (restoreErr) {
|
|
3520
3520
|
this.logger.error(`${packageName} — backup restore ALSO failed; manual recovery needed`, { meta: {
|
|
3521
3521
|
backupDir,
|
|
3522
|
-
error: errMsg(restoreErr)
|
|
3522
|
+
error: errMsg$1(restoreErr)
|
|
3523
3523
|
} });
|
|
3524
3524
|
}
|
|
3525
3525
|
throw swapErr;
|
|
@@ -3663,8 +3663,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3663
3663
|
]) {
|
|
3664
3664
|
const candidate = path$39.join(this.workspaceDir, dirName);
|
|
3665
3665
|
try {
|
|
3666
|
-
const pkg = asJsonObject(parseJsonUnknown(fs$17.readFileSync(path$39.join(candidate, "package.json"), "utf-8")));
|
|
3667
|
-
if (pkg && asString(pkg["name"]) === packageName) return candidate;
|
|
3666
|
+
const pkg = asJsonObject$1(parseJsonUnknown$1(fs$17.readFileSync(path$39.join(candidate, "package.json"), "utf-8")));
|
|
3667
|
+
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
3668
3668
|
} catch {}
|
|
3669
3669
|
}
|
|
3670
3670
|
return null;
|
|
@@ -3680,7 +3680,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
3680
3680
|
timeout: 18e4
|
|
3681
3681
|
});
|
|
3682
3682
|
} catch (err) {
|
|
3683
|
-
const msg = errMsg(err);
|
|
3683
|
+
const msg = errMsg$1(err);
|
|
3684
3684
|
this.logger.warn(`${packageName} auto-build failed`, { meta: { error: msg } });
|
|
3685
3685
|
}
|
|
3686
3686
|
}
|
|
@@ -3800,7 +3800,7 @@ function readPendingRestart(dataDir) {
|
|
|
3800
3800
|
}
|
|
3801
3801
|
let parsed;
|
|
3802
3802
|
try {
|
|
3803
|
-
parsed = asJsonObject(parseJsonUnknown(raw));
|
|
3803
|
+
parsed = asJsonObject$1(parseJsonUnknown$1(raw));
|
|
3804
3804
|
} catch (err) {
|
|
3805
3805
|
console.error("[restart-coordinator] Marker JSON invalid — clearing:", err);
|
|
3806
3806
|
clearPendingRestart(dataDir);
|
|
@@ -3811,7 +3811,7 @@ function readPendingRestart(dataDir) {
|
|
|
3811
3811
|
clearPendingRestart(dataDir);
|
|
3812
3812
|
return null;
|
|
3813
3813
|
}
|
|
3814
|
-
const kindRaw = asString(parsed["kind"]);
|
|
3814
|
+
const kindRaw = asString$1(parsed["kind"]);
|
|
3815
3815
|
const requestedAt = asNumber(parsed["requestedAt"]);
|
|
3816
3816
|
if (!isRestartKind(kindRaw) || requestedAt <= 0) {
|
|
3817
3817
|
console.error("[restart-coordinator] Marker missing kind/requestedAt — clearing");
|
|
@@ -7608,7 +7608,7 @@ var ConfigManager = class ConfigManager {
|
|
|
7608
7608
|
constructor(configPath) {
|
|
7609
7609
|
this.configPath = configPath;
|
|
7610
7610
|
const rawYaml = this.loadYaml();
|
|
7611
|
-
const merged = this.applyEnvOverrides(asJsonObject
|
|
7611
|
+
const merged = this.applyEnvOverrides(asJsonObject(rawYaml) ?? {});
|
|
7612
7612
|
this.bootstrapConfig = bootstrapSchema.parse(merged);
|
|
7613
7613
|
this.warnDefaultCredentials();
|
|
7614
7614
|
const dataPath = this.bootstrapConfig.server.dataPath ?? "camstack-data";
|
|
@@ -7663,9 +7663,9 @@ var ConfigManager = class ConfigManager {
|
|
|
7663
7663
|
*/
|
|
7664
7664
|
getSection(section) {
|
|
7665
7665
|
const merged = {};
|
|
7666
|
-
const defaults = asJsonObject
|
|
7666
|
+
const defaults = asJsonObject(this.getFromRuntimeDefaults(section));
|
|
7667
7667
|
if (defaults) Object.assign(merged, defaults);
|
|
7668
|
-
const bootstrapSection = asJsonObject
|
|
7668
|
+
const bootstrapSection = asJsonObject({ ...this.bootstrapConfig }[section]);
|
|
7669
7669
|
if (bootstrapSection) Object.assign(merged, bootstrapSection);
|
|
7670
7670
|
if (this.settingsStore !== null) {
|
|
7671
7671
|
const nested = this.getNestedFromSystemSettings(section);
|
|
@@ -7684,7 +7684,7 @@ var ConfigManager = class ConfigManager {
|
|
|
7684
7684
|
/** Read all config for an addon from addon_settings. */
|
|
7685
7685
|
getAddonConfig(addonId) {
|
|
7686
7686
|
if (this.settingsStore !== null) return this.settingsStore.getAllAddon(addonId);
|
|
7687
|
-
return asJsonObject
|
|
7687
|
+
return asJsonObject(this.getFromBootstrap(`addons.${addonId}`)) ?? {};
|
|
7688
7688
|
}
|
|
7689
7689
|
/** Write (bulk-replace) config for an addon to addon_settings. */
|
|
7690
7690
|
setAddonConfig(addonId, config) {
|
|
@@ -7922,8 +7922,8 @@ var ConfigManager = class ConfigManager {
|
|
|
7922
7922
|
update(section, data) {
|
|
7923
7923
|
if (!ConfigManager.BOOTSTRAP_SECTIONS.has(section)) throw new Error(`[ConfigManager] Section "${section}" is a runtime setting — use setSection() to persist via the settings-store, not update() which writes to config.yaml`);
|
|
7924
7924
|
let raw = {};
|
|
7925
|
-
if (fs$17.existsSync(this.configPath)) raw = asJsonObject
|
|
7926
|
-
const existing = asJsonObject
|
|
7925
|
+
if (fs$17.existsSync(this.configPath)) raw = asJsonObject(load$1(fs$17.readFileSync(this.configPath, "utf-8"))) ?? {};
|
|
7926
|
+
const existing = asJsonObject(raw[section]) ?? {};
|
|
7927
7927
|
raw[section] = {
|
|
7928
7928
|
...existing,
|
|
7929
7929
|
...data
|
|
@@ -8024,13 +8024,13 @@ var ConfigManager = class ConfigManager {
|
|
|
8024
8024
|
loadRuntimeState() {
|
|
8025
8025
|
if (!fs$17.existsSync(this.runtimeStatePath)) return EMPTY_RUNTIME_STATE;
|
|
8026
8026
|
try {
|
|
8027
|
-
const parsed = asJsonObject
|
|
8027
|
+
const parsed = asJsonObject(parseJsonUnknown(fs$17.readFileSync(this.runtimeStatePath, "utf-8")));
|
|
8028
8028
|
if (parsed === null) return EMPTY_RUNTIME_STATE;
|
|
8029
|
-
const systemActivation = asJsonObject
|
|
8030
|
-
const deviceActivationRaw = asJsonObject
|
|
8029
|
+
const systemActivation = asJsonObject(parsed.systemActivation) ?? {};
|
|
8030
|
+
const deviceActivationRaw = asJsonObject(parsed.deviceActivation) ?? {};
|
|
8031
8031
|
const deviceActivation = {};
|
|
8032
8032
|
for (const [deviceId, entry] of Object.entries(deviceActivationRaw)) {
|
|
8033
|
-
const nested = asJsonObject
|
|
8033
|
+
const nested = asJsonObject(entry);
|
|
8034
8034
|
if (nested === null) continue;
|
|
8035
8035
|
const bools = {};
|
|
8036
8036
|
for (const [k, v] of Object.entries(nested)) if (typeof v === "boolean") bools[k] = v;
|
|
@@ -91662,7 +91662,7 @@ var HubLogForwarder = class {
|
|
|
91662
91662
|
tags: mergedTags,
|
|
91663
91663
|
...entry.meta !== void 0 ? { meta: entry.meta } : {}
|
|
91664
91664
|
}).catch((err) => {
|
|
91665
|
-
console.error(`[HubLogForwarder] $hub.log call failed: ${errMsg(err)}`);
|
|
91665
|
+
console.error(`[HubLogForwarder] $hub.log call failed: ${errMsg$1(err)}`);
|
|
91666
91666
|
});
|
|
91667
91667
|
}
|
|
91668
91668
|
async shutdown() {
|
|
@@ -92039,7 +92039,7 @@ var AddonHealthMonitor = class {
|
|
|
92039
92039
|
alertEmitted: false,
|
|
92040
92040
|
retrying: false
|
|
92041
92041
|
});
|
|
92042
|
-
if (wasAlerting) this.emit(EventCategory.AddonLoadRecovered, {
|
|
92042
|
+
if (wasAlerting) this.emit(EventCategory$1.AddonLoadRecovered, {
|
|
92043
92043
|
packageName,
|
|
92044
92044
|
addonId: addonId ?? existing?.addonId,
|
|
92045
92045
|
retryCount: existing.retryCount
|
|
@@ -92057,7 +92057,7 @@ var AddonHealthMonitor = class {
|
|
|
92057
92057
|
const intervalIdx = Math.min(retryCount - 1, this.retryIntervalsMs.length - 1);
|
|
92058
92058
|
const nextRetryAt = t + this.retryIntervalsMs[intervalIdx];
|
|
92059
92059
|
const errPayload = {
|
|
92060
|
-
message: errMsg(err),
|
|
92060
|
+
message: errMsg$1(err),
|
|
92061
92061
|
...err instanceof Error && err.stack ? { stack: err.stack } : {}
|
|
92062
92062
|
};
|
|
92063
92063
|
const next = {
|
|
@@ -92081,7 +92081,7 @@ var AddonHealthMonitor = class {
|
|
|
92081
92081
|
inGrace: this.inGracePeriod(),
|
|
92082
92082
|
error: errPayload.message
|
|
92083
92083
|
} });
|
|
92084
|
-
this.emit(EventCategory.AddonRetryScheduled, {
|
|
92084
|
+
this.emit(EventCategory$1.AddonRetryScheduled, {
|
|
92085
92085
|
packageName,
|
|
92086
92086
|
addonId: next.addonId,
|
|
92087
92087
|
retryCount,
|
|
@@ -92089,7 +92089,7 @@ var AddonHealthMonitor = class {
|
|
|
92089
92089
|
});
|
|
92090
92090
|
if (!this.inGracePeriod() && !next.alertEmitted) {
|
|
92091
92091
|
next.alertEmitted = true;
|
|
92092
|
-
this.emit(EventCategory.AddonLoadFailed, {
|
|
92092
|
+
this.emit(EventCategory$1.AddonLoadFailed, {
|
|
92093
92093
|
packageName,
|
|
92094
92094
|
addonId: next.addonId,
|
|
92095
92095
|
error: errPayload,
|
|
@@ -92177,7 +92177,7 @@ var AddonHealthMonitor = class {
|
|
|
92177
92177
|
this.graceEmittedFor = true;
|
|
92178
92178
|
for (const s of this.state.values()) if (s.phase === "failed" && !s.alertEmitted && s.lastError) {
|
|
92179
92179
|
s.alertEmitted = true;
|
|
92180
|
-
this.emit(EventCategory.AddonLoadFailed, {
|
|
92180
|
+
this.emit(EventCategory$1.AddonLoadFailed, {
|
|
92181
92181
|
packageName: s.packageName,
|
|
92182
92182
|
addonId: s.addonId,
|
|
92183
92183
|
error: s.lastError,
|
|
@@ -92194,7 +92194,7 @@ var AddonHealthMonitor = class {
|
|
|
92194
92194
|
const existing = this.state.get(packageName);
|
|
92195
92195
|
if (!existing) return;
|
|
92196
92196
|
existing.retrying = true;
|
|
92197
|
-
this.emit(EventCategory.AddonRetryAttempting, {
|
|
92197
|
+
this.emit(EventCategory$1.AddonRetryAttempting, {
|
|
92198
92198
|
packageName,
|
|
92199
92199
|
addonId: existing.addonId,
|
|
92200
92200
|
retryCount: existing.retryCount
|
|
@@ -92508,7 +92508,7 @@ function createProcessService(parentNodeId, dataDir, deps, parentTcpPort, parent
|
|
|
92508
92508
|
entry.state = "crashed";
|
|
92509
92509
|
capturedBroker?.logger.error(`[${runnerId}] Process exited (code=${code}, signal=${signal})`);
|
|
92510
92510
|
const decision = crashSupervisor.recordCrash(runnerId);
|
|
92511
|
-
emitRunnerEvent(EventCategory.ProcessCrashed, runnerId, {
|
|
92511
|
+
emitRunnerEvent(EventCategory$1.ProcessCrashed, runnerId, {
|
|
92512
92512
|
processId: runnerId,
|
|
92513
92513
|
exitCode: code ?? void 0,
|
|
92514
92514
|
signal: signal ?? void 0
|
|
@@ -92518,14 +92518,14 @@ function createProcessService(parentNodeId, dataDir, deps, parentTcpPort, parent
|
|
|
92518
92518
|
capturedBroker?.logger.error(`[${runnerId}] Crash circuit-breaker tripped — ${decision.crashesInWindow} crashes in ${CRASH_WINDOW_MS}ms. Not respawning.`);
|
|
92519
92519
|
processes.set(runnerId, entry);
|
|
92520
92520
|
if (capturedBroker) forceMoleculerDisconnect(capturedBroker, entry.nodeId);
|
|
92521
|
-
for (const addon of entry.runnerAddons) emitRunnerEvent(EventCategory.AddonCrashed, addon.addonId, {
|
|
92521
|
+
for (const addon of entry.runnerAddons) emitRunnerEvent(EventCategory$1.AddonCrashed, addon.addonId, {
|
|
92522
92522
|
addonId: addon.addonId,
|
|
92523
92523
|
error: `Crash circuit-breaker tripped after ${decision.crashesInWindow} crashes in ${CRASH_WINDOW_MS}ms`
|
|
92524
92524
|
});
|
|
92525
92525
|
return;
|
|
92526
92526
|
}
|
|
92527
92527
|
capturedBroker?.logger.warn(`[${runnerId}] Restart scheduled (attempt #${decision.crashesInWindow}, backoff ${decision.backoffMs}ms)...`);
|
|
92528
|
-
emitRunnerEvent(EventCategory.ProcessRestartScheduled, runnerId, {
|
|
92528
|
+
emitRunnerEvent(EventCategory$1.ProcessRestartScheduled, runnerId, {
|
|
92529
92529
|
processId: runnerId,
|
|
92530
92530
|
delayMs: decision.backoffMs
|
|
92531
92531
|
});
|
|
@@ -93241,4 +93241,4 @@ async function stageFrameworkLockstep(input) {
|
|
|
93241
93241
|
return results;
|
|
93242
93242
|
}
|
|
93243
93243
|
//#endregion
|
|
93244
|
-
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, 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, getMoleculerEventStats, 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, setNodeEventInterest, stageFrameworkLockstep, stripCamstackDeps, subscribePassthrough, udsChildLogToWorkerEntry, validateProviderRegistrations, writePendingRestart };
|
|
93244
|
+
export { AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, ALL_CAPABILITY_DEFINITIONS, 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, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, 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, METHOD_ACCESS_MAP, 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, addonSettingsCapability, 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, 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, expandCapMethods, fetchJson, findInPath, formatLogLine, getBrokerEventBus, getCapUsageRegistry, getFfmpegDownloadUrl, getModelFilePath, getMoleculerEventStats, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getWorkerDeviceRegistry, hashClusterSecret, installManifestNativeDeps, installManifestPythonDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcChildLink, ipcParentLink, isAddonDeploySource, isArrayOutputSchema, isClusterSecretMismatchError, isInfraCapability, isModelDownloaded, isSourceNewer, loadTlsCert, localEndpointPath, localProviderLink, mountNativeCapService, parseCapAction, parseRangeHeader, parseTokenizedUrl, proxyToUpstream, readPendingRestart, readinessKey, registerEventBusService, resolveFilePath, resolveHwAccel, scheduleSelfRestart, scopeKey, scopesAllowDeviceCap, serializeTypedArrays, setHubConnected, setNodeEventInterest, stageFrameworkLockstep, stripCamstackDeps, subscribePassthrough, udsChildLogToWorkerEntry, validateProviderRegistrations, writePendingRestart };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { H as readNodePin } from "./dist-DlGZpWo8.mjs";
|
|
1
2
|
import { ensureBinary, ensureFfmpeg, ensurePython, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
|
|
2
3
|
import { createServer } from "node:http";
|
|
3
4
|
import * as fs from "node:fs";
|
|
4
5
|
import * as path$1 from "node:path";
|
|
5
6
|
import { isAbsolute, join } from "node:path";
|
|
6
|
-
import { readNodePin } from "@camstack/types";
|
|
7
7
|
import * as crypto$1 from "node:crypto";
|
|
8
8
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
9
9
|
import { execFile } from "node:child_process";
|
|
@@ -11,7 +11,7 @@ import { promisify } from "node:util";
|
|
|
11
11
|
import * as os from "node:os";
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
13
|
import { unlink } from "node:fs/promises";
|
|
14
|
-
import { DATAPLANE_SECRET_HEADER
|
|
14
|
+
import { DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, scopeKey, sleep } from "@camstack/types/addon";
|
|
15
15
|
import { TRPCClientError, createTRPCClient } from "@trpc/client";
|
|
16
16
|
import { connect, createServer as createServer$1 } from "node:net";
|
|
17
17
|
//#region src/kernel/addon-class-resolver.ts
|
|
@@ -102,7 +102,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry) {
|
|
|
102
102
|
} catch (err) {
|
|
103
103
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
104
104
|
markerFile,
|
|
105
|
-
error: errMsg
|
|
105
|
+
error: errMsg(err)
|
|
106
106
|
} });
|
|
107
107
|
}
|
|
108
108
|
return;
|
|
@@ -129,7 +129,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry) {
|
|
|
129
129
|
timeout: 3e5
|
|
130
130
|
});
|
|
131
131
|
} catch (err) {
|
|
132
|
-
throw new Error(`npm install of native deps failed for ${addonDir}: ${errMsg
|
|
132
|
+
throw new Error(`npm install of native deps failed for ${addonDir}: ${errMsg(err)}`, { cause: err });
|
|
133
133
|
}
|
|
134
134
|
await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger);
|
|
135
135
|
try {
|
|
@@ -137,7 +137,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry) {
|
|
|
137
137
|
} catch (err) {
|
|
138
138
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
139
139
|
markerFile,
|
|
140
|
-
error: errMsg
|
|
140
|
+
error: errMsg(err)
|
|
141
141
|
} });
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -174,7 +174,7 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
|
|
|
174
174
|
logger.warn("Prebuilt native dep copy failed — will try npm install", { meta: {
|
|
175
175
|
name,
|
|
176
176
|
source,
|
|
177
|
-
error: errMsg
|
|
177
|
+
error: errMsg(err)
|
|
178
178
|
} });
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -207,13 +207,13 @@ function candidateHoistedDirs(name, addonDir) {
|
|
|
207
207
|
}
|
|
208
208
|
/** Read & validate `camstack.nativeDependencies`. Returns null when absent. */
|
|
209
209
|
function readNativeDeps(pkgRaw) {
|
|
210
|
-
const camstack = asJsonObject
|
|
210
|
+
const camstack = asJsonObject(pkgRaw["camstack"]);
|
|
211
211
|
if (!camstack) return null;
|
|
212
|
-
const native = asJsonObject
|
|
212
|
+
const native = asJsonObject(camstack["nativeDependencies"]);
|
|
213
213
|
if (!native) return null;
|
|
214
214
|
const out = {};
|
|
215
215
|
for (const [k, v] of Object.entries(native)) {
|
|
216
|
-
const range = asString
|
|
216
|
+
const range = asString(v);
|
|
217
217
|
if (range) out[k] = range;
|
|
218
218
|
}
|
|
219
219
|
return Object.keys(out).length > 0 ? out : null;
|
|
@@ -280,7 +280,7 @@ async function rebuildNativeDeps(addonDir, packageNames, logger) {
|
|
|
280
280
|
} catch (err) {
|
|
281
281
|
logger.warn("Electron rebuild failed (continuing — prebuilt binary may be present)", { meta: {
|
|
282
282
|
addonDir,
|
|
283
|
-
error: errMsg
|
|
283
|
+
error: errMsg(err)
|
|
284
284
|
} });
|
|
285
285
|
}
|
|
286
286
|
return;
|
|
@@ -298,7 +298,7 @@ async function rebuildNativeDeps(addonDir, packageNames, logger) {
|
|
|
298
298
|
} catch (err) {
|
|
299
299
|
logger.warn("npm rebuild failed (continuing — prebuilt binary may be present)", { meta: {
|
|
300
300
|
addonDir,
|
|
301
|
-
error: errMsg
|
|
301
|
+
error: errMsg(err)
|
|
302
302
|
} });
|
|
303
303
|
}
|
|
304
304
|
}
|
|
@@ -925,7 +925,7 @@ var nativeCapReadinessGeneration = typeof crypto !== "undefined" && crypto.rando
|
|
|
925
925
|
function mountNativeCapService(broker, addonId, cap) {
|
|
926
926
|
const serviceName = capServiceName(addonId, cap.name, true);
|
|
927
927
|
if (mountedNativeCapServices.has(serviceName)) return;
|
|
928
|
-
const expandedMethods = expandCapMethods
|
|
928
|
+
const expandedMethods = expandCapMethods(cap);
|
|
929
929
|
if (expandedMethods === void 0 || Object.keys(expandedMethods).length === 0 || typeof broker.createService !== "function") {
|
|
930
930
|
mountedNativeCapServices.add(serviceName);
|
|
931
931
|
return;
|
|
@@ -1031,7 +1031,7 @@ async function callWithServiceDiscoveryRetry(broker, actionName, input) {
|
|
|
1031
1031
|
if (!(err instanceof Error ? err.message : String(err)).includes("is not found")) throw err;
|
|
1032
1032
|
attempt++;
|
|
1033
1033
|
if (attempt === 1) broker.logger.warn(`native-cap-bridge: service not found for "${actionName}", retrying with exponential backoff…`);
|
|
1034
|
-
await sleep
|
|
1034
|
+
await sleep(delay);
|
|
1035
1035
|
delay = Math.min(delay * 2, BACKOFF_MAX_MS);
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
@@ -1136,7 +1136,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
1136
1136
|
parentDeviceId,
|
|
1137
1137
|
logger: (() => {
|
|
1138
1138
|
const base = opts.logger.child(stableId);
|
|
1139
|
-
const containerDeviceId = parentDeviceId ?? (deviceMeta?.type === DeviceType
|
|
1139
|
+
const containerDeviceId = parentDeviceId ?? (deviceMeta?.type === DeviceType.Container ? id : null);
|
|
1140
1140
|
return base.withTags(containerDeviceId !== null ? {
|
|
1141
1141
|
deviceId: id,
|
|
1142
1142
|
containerDeviceId
|
|
@@ -1162,7 +1162,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
1162
1162
|
id,
|
|
1163
1163
|
stableId,
|
|
1164
1164
|
addonId,
|
|
1165
|
-
type: DeviceType
|
|
1165
|
+
type: DeviceType.Camera,
|
|
1166
1166
|
name: stableId,
|
|
1167
1167
|
location: null,
|
|
1168
1168
|
disabled: false,
|
|
@@ -1228,7 +1228,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
1228
1228
|
type: "device",
|
|
1229
1229
|
id
|
|
1230
1230
|
},
|
|
1231
|
-
category: EventCategory
|
|
1231
|
+
category: EventCategory.DeviceBindingsChanged,
|
|
1232
1232
|
data: {
|
|
1233
1233
|
deviceId: id,
|
|
1234
1234
|
capName: cap.name,
|
|
@@ -1237,7 +1237,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
1237
1237
|
nodeId
|
|
1238
1238
|
}
|
|
1239
1239
|
});
|
|
1240
|
-
emitReadiness
|
|
1240
|
+
emitReadiness(eventBus, {
|
|
1241
1241
|
capName: cap.name,
|
|
1242
1242
|
scope: {
|
|
1243
1243
|
type: "device",
|
|
@@ -1632,7 +1632,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
1632
1632
|
type: "device",
|
|
1633
1633
|
id: device.id
|
|
1634
1634
|
},
|
|
1635
|
-
category: EventCategory
|
|
1635
|
+
category: EventCategory.DeviceReady,
|
|
1636
1636
|
data: { deviceId: device.id }
|
|
1637
1637
|
});
|
|
1638
1638
|
};
|
|
@@ -1771,7 +1771,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
1771
1771
|
type: "device",
|
|
1772
1772
|
id: deviceId
|
|
1773
1773
|
},
|
|
1774
|
-
category: EventCategory
|
|
1774
|
+
category: EventCategory.DeviceBindingsChanged,
|
|
1775
1775
|
data: {
|
|
1776
1776
|
deviceId,
|
|
1777
1777
|
capName,
|
|
@@ -1780,7 +1780,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
1780
1780
|
nodeId
|
|
1781
1781
|
}
|
|
1782
1782
|
});
|
|
1783
|
-
emitReadiness
|
|
1783
|
+
emitReadiness(eventBus, {
|
|
1784
1784
|
capName,
|
|
1785
1785
|
scope: {
|
|
1786
1786
|
type: "device",
|
|
@@ -5737,7 +5737,7 @@ function createAddonDataPlaneFacility(args) {
|
|
|
5737
5737
|
let server = null;
|
|
5738
5738
|
let baseUrl = "";
|
|
5739
5739
|
const route = (req, res) => {
|
|
5740
|
-
if (req.headers[DATAPLANE_SECRET_HEADER
|
|
5740
|
+
if (req.headers[DATAPLANE_SECRET_HEADER] !== secret) {
|
|
5741
5741
|
res.writeHead(403).end();
|
|
5742
5742
|
return;
|
|
5743
5743
|
}
|
|
@@ -5856,7 +5856,7 @@ function resolveNodeRoot() {
|
|
|
5856
5856
|
var inFlight = /* @__PURE__ */ new Map();
|
|
5857
5857
|
var LOCK_STALE_MS = 10 * 6e4;
|
|
5858
5858
|
var LOCK_POLL_MS = 500;
|
|
5859
|
-
function sleep$
|
|
5859
|
+
function sleep$1(ms) {
|
|
5860
5860
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5861
5861
|
}
|
|
5862
5862
|
/**
|
|
@@ -5875,7 +5875,7 @@ async function withFileLock(lockPath, fn) {
|
|
|
5875
5875
|
} catch {
|
|
5876
5876
|
try {
|
|
5877
5877
|
if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
|
|
5878
|
-
else await sleep$
|
|
5878
|
+
else await sleep$1(LOCK_POLL_MS);
|
|
5879
5879
|
} catch {}
|
|
5880
5880
|
}
|
|
5881
5881
|
try {
|
|
@@ -6725,7 +6725,7 @@ function getWorkerDeviceRegistry() {
|
|
|
6725
6725
|
* the property-access boundary and validate structurally.
|
|
6726
6726
|
*/
|
|
6727
6727
|
function buildRemoteNativeProvider(api, cap, options) {
|
|
6728
|
-
const capNameCamel = kebabToCamel
|
|
6728
|
+
const capNameCamel = kebabToCamel(cap.name);
|
|
6729
6729
|
const provider = {};
|
|
6730
6730
|
for (const [methodName, methodSchema] of Object.entries(cap.methods)) {
|
|
6731
6731
|
const callKind = methodSchema.kind === "mutation" ? "mutate" : "query";
|
|
@@ -6746,7 +6746,7 @@ function buildRemoteNativeProvider(api, cap, options) {
|
|
|
6746
6746
|
}
|
|
6747
6747
|
return provider;
|
|
6748
6748
|
}
|
|
6749
|
-
function kebabToCamel
|
|
6749
|
+
function kebabToCamel(s) {
|
|
6750
6750
|
return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6751
6751
|
}
|
|
6752
6752
|
/**
|
|
@@ -6824,7 +6824,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
6824
6824
|
} });
|
|
6825
6825
|
registerWorkerDisposerChain(nodeId, addonId, workerDisposerChain);
|
|
6826
6826
|
const bindingCache = /* @__PURE__ */ new Map();
|
|
6827
|
-
scopedEventBus.subscribe({ category: EventCategory
|
|
6827
|
+
scopedEventBus.subscribe({ category: EventCategory.DeviceBindingsChanged }, (e) => {
|
|
6828
6828
|
const data = e.data ?? {};
|
|
6829
6829
|
if (typeof data.deviceId === "number") {
|
|
6830
6830
|
bindingCache.delete(data.deviceId);
|
|
@@ -6867,7 +6867,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
6867
6867
|
scopedLogger.warn(`settings write failed (${coll}/${key}) — ${isTrpcError ? "transport error" : "store error"}`, { meta: {
|
|
6868
6868
|
collection: coll,
|
|
6869
6869
|
key,
|
|
6870
|
-
error: errMsg
|
|
6870
|
+
error: errMsg(err)
|
|
6871
6871
|
} });
|
|
6872
6872
|
}
|
|
6873
6873
|
};
|