@camstack/system 1.1.34 → 1.1.36

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.
Files changed (49) hide show
  1. package/dist/addon-runner.js +87 -35
  2. package/dist/addon-runner.mjs +87 -35
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +6 -6
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +6 -6
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +12 -12
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +5 -5
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +3 -3
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +69 -69
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  15. package/dist/builtins/hub-forwarder/index.js +3 -3
  16. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  17. package/dist/builtins/local-auth/local-auth.addon.js +7 -7
  18. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  19. package/dist/builtins/local-network/local-network.addon.js +7 -7
  20. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  21. package/dist/builtins/native-metrics/native-metrics.addon.js +5 -5
  22. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  23. package/dist/builtins/platform-probe/index.js +13 -13
  24. package/dist/builtins/platform-probe/index.mjs +1 -1
  25. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
  26. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  27. package/dist/builtins/snapshot/index.js +13 -13
  28. package/dist/builtins/snapshot/index.mjs +1 -1
  29. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +4 -4
  30. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  31. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +9 -9
  32. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  33. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +5 -5
  34. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  35. package/dist/builtins/system-config/system-config.addon.js +5 -5
  36. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  37. package/dist/builtins/winston-logging/index.js +3 -3
  38. package/dist/builtins/winston-logging/index.mjs +1 -1
  39. package/dist/dist-C7oOY4iL.mjs +24559 -0
  40. package/dist/dist-COIhbSao.js +25032 -0
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.js +92 -115
  43. package/dist/index.mjs +52 -52
  44. package/dist/kernel/moleculer/child-cap-descriptors.d.ts +34 -0
  45. package/dist/kernel/moleculer/child-cap-dispatch.d.ts +10 -2
  46. package/dist/kernel/transport/child-cap-protocol.d.ts +20 -0
  47. package/dist/{manifest-python-deps-u-AQBQY6.mjs → manifest-python-deps-BYIV8-rc.mjs} +31 -29
  48. package/dist/{manifest-python-deps-CAnO1wPx.js → manifest-python-deps-CZFqI4wp.js} +7 -5
  49. 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-C7oOY4iL.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-u-AQBQY6.mjs";
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-BYIV8-rc.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 { z } from "zod";
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$1(rawYaml) ?? {});
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$1(this.getFromRuntimeDefaults(section));
7666
+ const defaults = asJsonObject(this.getFromRuntimeDefaults(section));
7667
7667
  if (defaults) Object.assign(merged, defaults);
7668
- const bootstrapSection = asJsonObject$1({ ...this.bootstrapConfig }[section]);
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$1(this.getFromBootstrap(`addons.${addonId}`)) ?? {};
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$1(load$1(fs$17.readFileSync(this.configPath, "utf-8"))) ?? {};
7926
- const existing = asJsonObject$1(raw[section]) ?? {};
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$1(parseJsonUnknown$1(fs$17.readFileSync(this.runtimeStatePath, "utf-8")));
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$1(parsed.systemActivation) ?? {};
8030
- const deviceActivationRaw = asJsonObject$1(parsed.deviceActivation) ?? {};
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$1(entry);
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 };
@@ -0,0 +1,34 @@
1
+ import { ChildCapDescriptor } from '../transport/child-cap-protocol.js';
2
+ /** One hosted addon's contribution to the runner UNION manifest. */
3
+ export interface RunnerManifestEntry {
4
+ readonly addonId: string;
5
+ readonly capabilities: readonly string[];
6
+ }
7
+ /** One native-cap snapshot row — a device-scoped cap and the devices it covers. */
8
+ export interface NativeCapSnapshotEntry {
9
+ readonly capName: string;
10
+ readonly addonId: string;
11
+ readonly deviceIds: readonly number[];
12
+ }
13
+ /**
14
+ * Builds the {@link ChildCapDescriptor} array that the UDS child transport
15
+ * sends to the parent on registration.
16
+ *
17
+ * - Singleton caps come from the runner UNION manifest (all caps registered by
18
+ * every addon in this runner). One descriptor per unique (addonId, capName)
19
+ * pair, mode `'singleton'` and no `deviceId`. The `addonId` stamp lets the
20
+ * parent's manifest builder register each hosted addon's caps under the
21
+ * REAL addon id — a GROUPED runner (`execution.group`) hosts several addons,
22
+ * and deduplicating by capName alone would collapse two co-located providers
23
+ * of the same collection cap (e.g. `network-access` from cloudflare-tunnel
24
+ * AND tailscale-ingress) into one descriptor registered under a synthetic
25
+ * `addonId = childId` (the group name) — the "@camstack/addon-net-access"
26
+ * admin-UI bug.
27
+ * - Device-scoped caps come from the native-cap snapshot — one descriptor per
28
+ * (capName, deviceId) pair, mode `'collection'`, stamped with the owning
29
+ * addon's id.
30
+ *
31
+ * Pure module — extracted from `addon-runner.ts` (whose `main()` runs at
32
+ * import time) so it is unit-testable.
33
+ */
34
+ export declare function buildChildCapDescriptors(manifest: readonly RunnerManifestEntry[], nativeCapSnapshot: readonly NativeCapSnapshotEntry[]): ChildCapDescriptor[];
@@ -6,8 +6,16 @@ import { CapCallInput } from '../transport/child-cap-protocol.js';
6
6
  * registered".
7
7
  */
8
8
  export interface ChildCapDispatchDeps {
9
- /** Resolve a singleton/system-scoped provider by cap name. */
10
- getSingletonProvider(capName: string): object | null | undefined;
9
+ /**
10
+ * Resolve a singleton/system-scoped provider by cap name. `addonId` is a
11
+ * PROVIDER-SELECTION hint for grouped runners where multiple co-located
12
+ * addons register the SAME cap (e.g. two `network-access` providers in the
13
+ * `net-access` group): when it matches a hosted addon's provider, return
14
+ * that one; otherwise fall back to the cap's sole/first provider (an
15
+ * `addonId` that names no hosted provider is method DATA, not routing —
16
+ * e.g. `addons.restartAddon({ addonId })`).
17
+ */
18
+ getSingletonProvider(capName: string, addonId?: string): object | null | undefined;
11
19
  /** Resolve a device-scoped provider by cap name and device id. */
12
20
  getDeviceProvider(capName: string, deviceId: number): object | null | undefined;
13
21
  }
@@ -9,6 +9,16 @@ export interface ChildCapDescriptor {
9
9
  readonly mode: 'singleton' | 'collection';
10
10
  /** Present for device-scoped caps; absent for singleton/system caps. */
11
11
  readonly deviceId?: number;
12
+ /**
13
+ * The addon that registered this cap. A GROUPED runner (`execution.group`)
14
+ * hosts multiple addons in one child, so the parent can no longer assume
15
+ * `addonId === childId` — this field lets the parent's manifest builder
16
+ * split the descriptor set into one `RegisteredAddonManifest` entry per
17
+ * hosted addon (real provider registryKeys, per-addon settings/logs/UI).
18
+ * OPTIONAL for wire compat: a legacy child omits it and the parent falls
19
+ * back to the childId (identical to the historical single-addon behaviour).
20
+ */
21
+ readonly addonId?: string;
12
22
  }
13
23
  /** First message a child sends after connecting — its complete cap manifest. */
14
24
  export interface RegisterMessage {
@@ -90,6 +100,16 @@ export interface CapCallMessage {
90
100
  readonly deviceId?: number;
91
101
  /** Optional per-call node pin (out-of-band routing hint; see {@link CapCallOutMessage.nodeId}). */
92
102
  readonly nodeId?: string;
103
+ /**
104
+ * Out-of-band PROVIDER-selection hint: the addonId of the provider the hub
105
+ * resolved for this call. Needed for GROUPED runners where two co-located
106
+ * addons register the SAME collection cap (e.g. `network-access` from both
107
+ * cloudflare-tunnel and tailscale-ingress) — the hub's collection mount
108
+ * strips `addonId` from the method args after resolving the provider, so
109
+ * without this hint the child could only pick one-per-capName. Absent →
110
+ * the child dispatch falls back to its sole provider for the cap.
111
+ */
112
+ readonly addonId?: string;
93
113
  }
94
114
  /** Parent → child: a system event delivered by the hub for the child to handle locally. */
95
115
  export interface ParentEventMessage {