@camstack/system 1.1.16 → 1.1.18

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.
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_manifest_python_deps = require("./manifest-python-deps-D-LSp57v.js");
2
+ const require_manifest_python_deps = require("./manifest-python-deps-lZd5B4FS.js");
3
3
  const require_custom_action_registry = require("./custom-action-registry-vLYEFTtv.js");
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_chunk.__toESM(node_fs);
@@ -1,4 +1,4 @@
1
- import { $ as getWorkerNativeCapProvider, N as createUdsLoggerWithControl, P as LocalChildClient, _t as resolveAddonClass, et as getWorkerNativeCapSnapshot, gt as installManifestNativeDeps, i as createUdsAddonContext, it as validateProviderRegistrations, nt as setWorkerNativeCapsChangeListener, t as installManifestPythonDeps } from "./manifest-python-deps-D-mT3V97.mjs";
1
+ import { $ as getWorkerNativeCapProvider, N as createUdsLoggerWithControl, P as LocalChildClient, _t as resolveAddonClass, et as getWorkerNativeCapSnapshot, gt as installManifestNativeDeps, i as createUdsAddonContext, it as validateProviderRegistrations, nt as setWorkerNativeCapsChangeListener, t as installManifestPythonDeps } from "./manifest-python-deps-DOAh19rY.mjs";
2
2
  import { t as CustomActionRegistry } from "./custom-action-registry-BEXwC-oo.mjs";
3
3
  import { register } from "node:module";
4
4
  import * as fs from "node:fs";
@@ -376,10 +376,14 @@ var StorageOrchestratorService = class {
376
376
  */
377
377
  seedDefaults(input) {
378
378
  let added = 0;
379
- const rootOf = (id) => node_path.join(input.basePath, id);
379
+ const declById = new Map(input.declarations.map((d) => [d.id, d]));
380
+ const rootFor = (d) => {
381
+ const useMedia = d.defaultRoot === "media" && input.mediaBasePath;
382
+ return node_path.join(useMedia ? input.mediaBasePath : input.basePath, d.id);
383
+ };
380
384
  for (const d of input.declarations) {
381
385
  if (this.hasAnyLocationOfType(d.id)) continue;
382
- const base = d.defaultsTo ? this.getLocationById(`${d.defaultsTo}:default`)?.config["basePath"] ?? rootOf(d.defaultsTo) : rootOf(d.id);
386
+ const base = d.defaultsTo ? this.getLocationById(`${d.defaultsTo}:default`)?.config["basePath"] ?? rootFor(declById.get(d.defaultsTo) ?? d) : rootFor(d);
383
387
  this.upsertLocation({
384
388
  id: `${d.id}:default`,
385
389
  type: d.id,
@@ -1074,9 +1078,11 @@ var StorageOrchestratorAddon = class extends _camstack_types.BaseAddon {
1074
1078
  const registry = (0, _camstack_system.buildStorageLocationRegistry)(this.ctx.kernel.listStorageLocationDeclarations?.() ?? []);
1075
1079
  this.service.setRegistry(registry);
1076
1080
  this.service.pruneUndeclaredSystemLocations();
1081
+ const mediaRoot = process.env.CAMSTACK_MEDIA_ROOT?.trim();
1077
1082
  this.service.seedDefaults({
1078
1083
  providerId: "filesystem-storage",
1079
1084
  basePath: this.ctx.nodeDataDir,
1085
+ mediaBasePath: mediaRoot && mediaRoot.length > 0 ? mediaRoot : void 0,
1080
1086
  declarations: registry.list()
1081
1087
  });
1082
1088
  await this.service.backfillNodeIds(HUB_NODE_ID);
@@ -369,10 +369,14 @@ var StorageOrchestratorService = class {
369
369
  */
370
370
  seedDefaults(input) {
371
371
  let added = 0;
372
- const rootOf = (id) => path$1.join(input.basePath, id);
372
+ const declById = new Map(input.declarations.map((d) => [d.id, d]));
373
+ const rootFor = (d) => {
374
+ const useMedia = d.defaultRoot === "media" && input.mediaBasePath;
375
+ return path$1.join(useMedia ? input.mediaBasePath : input.basePath, d.id);
376
+ };
373
377
  for (const d of input.declarations) {
374
378
  if (this.hasAnyLocationOfType(d.id)) continue;
375
- const base = d.defaultsTo ? this.getLocationById(`${d.defaultsTo}:default`)?.config["basePath"] ?? rootOf(d.defaultsTo) : rootOf(d.id);
379
+ const base = d.defaultsTo ? this.getLocationById(`${d.defaultsTo}:default`)?.config["basePath"] ?? rootFor(declById.get(d.defaultsTo) ?? d) : rootFor(d);
376
380
  this.upsertLocation({
377
381
  id: `${d.id}:default`,
378
382
  type: d.id,
@@ -1067,9 +1071,11 @@ var StorageOrchestratorAddon = class extends BaseAddon {
1067
1071
  const registry = buildStorageLocationRegistry(this.ctx.kernel.listStorageLocationDeclarations?.() ?? []);
1068
1072
  this.service.setRegistry(registry);
1069
1073
  this.service.pruneUndeclaredSystemLocations();
1074
+ const mediaRoot = process.env.CAMSTACK_MEDIA_ROOT?.trim();
1070
1075
  this.service.seedDefaults({
1071
1076
  providerId: "filesystem-storage",
1072
1077
  basePath: this.ctx.nodeDataDir,
1078
+ mediaBasePath: mediaRoot && mediaRoot.length > 0 ? mediaRoot : void 0,
1073
1079
  declarations: registry.list()
1074
1080
  });
1075
1081
  await this.service.backfillNodeIds(HUB_NODE_ID);
@@ -229,6 +229,12 @@ export declare class StorageOrchestratorService {
229
229
  seedDefaults(input: {
230
230
  readonly providerId: string;
231
231
  readonly basePath: string;
232
+ /**
233
+ * Root for declarations marked `defaultRoot: 'media'` (the dedicated media
234
+ * volume, `CAMSTACK_MEDIA_ROOT`). Absent → media declarations fall back to
235
+ * `basePath` like everything else.
236
+ */
237
+ readonly mediaBasePath?: string;
232
238
  readonly declarations: readonly StorageLocationDeclaration[];
233
239
  }): void;
234
240
  /** Internal: check whether any location of the given type exists. */
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ const require_builtins_local_auth_local_auth_addon = require("./builtins/local-a
20
20
  require("./builtins/local-auth/index.js");
21
21
  const require_builtins_device_manager_device_manager_addon = require("./builtins/device-manager/device-manager.addon.js");
22
22
  require("./builtins/device-manager/index.js");
23
- const require_manifest_python_deps = require("./manifest-python-deps-D-LSp57v.js");
23
+ const require_manifest_python_deps = require("./manifest-python-deps-lZd5B4FS.js");
24
24
  const require_custom_action_registry = require("./custom-action-registry-vLYEFTtv.js");
25
25
  let _camstack_types_node = require("@camstack/types/node");
26
26
  let node_http = require("node:http");
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ import { LocalAuthAddon, a as require_ms, c as __esmMin, d as __toCommonJS, f as
18
18
  import "./builtins/local-auth/index.mjs";
19
19
  import { DeviceManagerAddon } from "./builtins/device-manager/device-manager.addon.mjs";
20
20
  import "./builtins/device-manager/index.mjs";
21
- import { A as createUdsEventBus, B as CapRouteError, C as ipcParentLink, D as createHubCapForwardService, E as HUB_CAP_FWD_SERVICE, F as LocalChildRegistry, G as UdsLocalTransportServer, H as callWithServiceDiscovery, I as UDS_NO_ROUTE_PREFIX, J as FrameDecoder, K as SocketChannel, L as AGENT_CAP_FWD_ACTION, M as createUdsLogger, N as createUdsLoggerWithControl, O as createParentUnownedCallHandler, P as LocalChildClient, Q as createBrokerDeviceManagerApi, R as AGENT_CAP_FWD_SERVICE, S as ipcChildLink, T as HUB_CAP_FWD_ACTION, U as createLocalTransport, V as classifyCapRoute, W as UdsLocalTransportClient, X as buildNativeCapProxy, Y as encodeFrame, Z as buildUdsNativeCapProxy, _ as __resetCapUsageRegistryForTests, _t as resolveAddonClass, a as getWorkerDeviceRegistry, at as NATIVE_PROVIDER_SERVICE_INFIX, b as brokerTransportLink, c as setHubConnected, ct as capBareAction, d as registerEventBusService, dt as deserializeTypedArrays, f as AddonDepsManager, ft as serializeTypedArrays, g as CapUsageRegistry, gt as installManifestNativeDeps, h as createHwAccelService, ht as CapabilityUnavailableError, i as createUdsAddonContext, it as validateProviderRegistrations, j as udsChildLogToWorkerEntry, k as createUdsEventBridge, l as EVENT_TOPIC_PREFIX, lt as capServiceName, m as resolveHwAccel, mt as CapabilityHandle, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as capActionName, p as createKernelHwAccel, pt as DeviceRegistry, q as localEndpointPath, r as createAddonContext, rt as createAddonService, s as getOrInitReadinessRegistryForClient, st as capActionSuffix, t as installManifestPythonDeps, tt as mountNativeCapService, u as getBrokerEventBus, ut as parseCapAction, v as getCapUsageRegistry, w as localProviderLink, x as buildLinkChain, y as brokerCallForCap, z as CapRouteResolver } from "./manifest-python-deps-D-mT3V97.mjs";
21
+ import { A as createUdsEventBus, B as CapRouteError, C as ipcParentLink, D as createHubCapForwardService, E as HUB_CAP_FWD_SERVICE, F as LocalChildRegistry, G as UdsLocalTransportServer, H as callWithServiceDiscovery, I as UDS_NO_ROUTE_PREFIX, J as FrameDecoder, K as SocketChannel, L as AGENT_CAP_FWD_ACTION, M as createUdsLogger, N as createUdsLoggerWithControl, O as createParentUnownedCallHandler, P as LocalChildClient, Q as createBrokerDeviceManagerApi, R as AGENT_CAP_FWD_SERVICE, S as ipcChildLink, T as HUB_CAP_FWD_ACTION, U as createLocalTransport, V as classifyCapRoute, W as UdsLocalTransportClient, X as buildNativeCapProxy, Y as encodeFrame, Z as buildUdsNativeCapProxy, _ as __resetCapUsageRegistryForTests, _t as resolveAddonClass, a as getWorkerDeviceRegistry, at as NATIVE_PROVIDER_SERVICE_INFIX, b as brokerTransportLink, c as setHubConnected, ct as capBareAction, d as registerEventBusService, dt as deserializeTypedArrays, f as AddonDepsManager, ft as serializeTypedArrays, g as CapUsageRegistry, gt as installManifestNativeDeps, h as createHwAccelService, ht as CapabilityUnavailableError, i as createUdsAddonContext, it as validateProviderRegistrations, j as udsChildLogToWorkerEntry, k as createUdsEventBridge, l as EVENT_TOPIC_PREFIX, lt as capServiceName, m as resolveHwAccel, mt as CapabilityHandle, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as capActionName, p as createKernelHwAccel, pt as DeviceRegistry, q as localEndpointPath, r as createAddonContext, rt as createAddonService, s as getOrInitReadinessRegistryForClient, st as capActionSuffix, t as installManifestPythonDeps, tt as mountNativeCapService, u as getBrokerEventBus, ut as parseCapAction, v as getCapUsageRegistry, w as localProviderLink, x as buildLinkChain, y as brokerCallForCap, z as CapRouteResolver } from "./manifest-python-deps-DOAh19rY.mjs";
22
22
  import { t as CustomActionRegistry } from "./custom-action-registry-BEXwC-oo.mjs";
23
23
  import { PYTHON_VERSION, buildBinaryPath, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
24
24
  import { request } from "node:http";
@@ -72,6 +72,24 @@ export interface ParentUnownedCallDeps {
72
72
  * services. See `hub-cap-forward.ts`.
73
73
  */
74
74
  readonly forwardToHub?: (input: CapCallInput) => Promise<unknown>;
75
+ /**
76
+ * Optional empty-collection fast-path. Returns `[]` (an empty aggregate) when
77
+ * `capName` is a `mode:'collection'` cap whose `method` is array-output AND
78
+ * ZERO providers are registered cluster-wide; `null`/`undefined` otherwise.
79
+ *
80
+ * Why: a collection cap with no providers IS the empty collection — but with
81
+ * nothing registered, the resolver returns `no-provider` and the call falls
82
+ * to the broker fallback, which polls Moleculer service discovery for a
83
+ * `${cap}.${method}` service that will NEVER appear until the discovery
84
+ * deadline (~30s) elapses. That 30s stall hit EVERY WebRTC cold start via the
85
+ * provider-less `turn-provider` (`getTurnServers`). Returning `[]` up front
86
+ * treats a provider-less collection as the empty collection it is — instant,
87
+ * no discovery. A collection WITH ≥1 provider returns `null` here and routes
88
+ * normally (the aggregate fans out across its providers as before). The
89
+ * kernel layer has no cap registry, so the wiring side (which has both the
90
+ * `CapabilityDefinition`s and the registry) injects this.
91
+ */
92
+ readonly resolveEmptyCollection?: (capName: string, method: string) => readonly unknown[] | null;
75
93
  /** Optional logger for the broker-fallback diagnostic line. */
76
94
  readonly logger?: ParentUnownedCallLogger;
77
95
  }
@@ -4619,6 +4619,10 @@ function createParentUnownedCallHandler(deps) {
4619
4619
  return async (input) => {
4620
4620
  const deviceId = input.deviceId ?? extractDeviceId(input.args);
4621
4621
  const nodeId = input.nodeId ?? extractNodeId(input.args);
4622
+ if (nodeId === void 0) {
4623
+ const empty = deps.resolveEmptyCollection?.(input.capName, input.method);
4624
+ if (empty != null) return empty;
4625
+ }
4622
4626
  const resolver = deps.getResolver();
4623
4627
  if (resolver !== null) try {
4624
4628
  const route = resolver.resolveCapRoute(input.capName, {
@@ -4621,6 +4621,10 @@ function createParentUnownedCallHandler(deps) {
4621
4621
  return async (input) => {
4622
4622
  const deviceId = input.deviceId ?? extractDeviceId(input.args);
4623
4623
  const nodeId = input.nodeId ?? extractNodeId(input.args);
4624
+ if (nodeId === void 0) {
4625
+ const empty = deps.resolveEmptyCollection?.(input.capName, input.method);
4626
+ if (empty != null) return empty;
4627
+ }
4624
4628
  const resolver = deps.getResolver();
4625
4629
  if (resolver !== null) try {
4626
4630
  const route = resolver.resolveCapRoute(input.capName, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",