xypriss 9.14.25 → 9.14.27

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/cjs/index.js CHANGED
@@ -145,7 +145,7 @@ const DEFAULT_LOGGER_CONFIG = {
145
145
  },
146
146
  };
147
147
 
148
- function getSysApi() {
148
+ function getSysApi$1() {
149
149
  if (typeof globalThis !== "undefined" && globalThis.__sys__) {
150
150
  return globalThis.__sys__;
151
151
  }
@@ -983,7 +983,7 @@ function initializeLogger(config) {
983
983
  * in the `.env` file — useful for staging environments that mimic dev but
984
984
  * must not relax CSP/HSTS/COEP.
985
985
  */
986
- const sys = getSysApi();
986
+ const sys = getSysApi$1();
987
987
  const isDev = sys?.__env__
988
988
  ? sys.__env__.isDevelopment() &&
989
989
  sys.__env__.get("XSEC_TRUST", "true") === "true"
@@ -1096,8 +1096,8 @@ const xemsKeyPlaceholder = "CHANGE_ME_TO_A_SECURE_32_CHAR_KEY";
1096
1096
  * This configuration is used when no custom configuration is provided.
1097
1097
  *
1098
1098
  */
1099
- const DEFAULT_HOST = getSysApi()?.__env__?.get("XYPRISS_HOST") || "localhost";
1100
- const DEFAULT_PORT = (getSysApi()?.__env__?.get("XYPRISS_PORT") ||
1099
+ const DEFAULT_HOST = getSysApi$1()?.__env__?.get("XYPRISS_HOST") || "localhost";
1100
+ const DEFAULT_PORT = (getSysApi$1()?.__env__?.get("XYPRISS_PORT") ||
1101
1101
  8085);
1102
1102
  // Default configuration
1103
1103
  const DEFAULT_OPTIONS = {
@@ -1314,7 +1314,7 @@ const DEFAULT_OPTIONS = {
1314
1314
  * once `__sys__` is initialized, deliberately avoiding reliance on Node.js core modules (`node:os`).
1315
1315
  */
1316
1316
  get tempFileDir() {
1317
- return getSysApi()?.path.tmpUserDir + "/.uploads/";
1317
+ return getSysApi$1()?.path.tmpUserDir + "/.uploads/";
1318
1318
  },
1319
1319
  createParentPath: true,
1320
1320
  preservePath: false,
@@ -1872,7 +1872,7 @@ class FileUploadManager {
1872
1872
  return;
1873
1873
  if (this.config?.storage === "memory" && file.path) {
1874
1874
  try {
1875
- const sys = getSysApi();
1875
+ const sys = getSysApi$1();
1876
1876
  if (sys.fs.exist(file.path)) {
1877
1877
  file.buffer = await sys.fs.readBytes(file.path);
1878
1878
  sys.fs.rm(file.path, { force: true });
@@ -1904,7 +1904,7 @@ class FileUploadManager {
1904
1904
  }
1905
1905
  if (file.path) {
1906
1906
  try {
1907
- const sys = getSysApi();
1907
+ const sys = getSysApi$1();
1908
1908
  if (sys.fs.exist(file.path)) {
1909
1909
  _cachedBuffer = sys.fs.readBytesSync(file.path);
1910
1910
  return _cachedBuffer;
@@ -1924,7 +1924,7 @@ class FileUploadManager {
1924
1924
  if (!file.toBuffer) {
1925
1925
  file.toBuffer = async function () {
1926
1926
  if (file.path) {
1927
- const sys = getSysApi();
1927
+ const sys = getSysApi$1();
1928
1928
  if (sys.fs.exist(file.path)) {
1929
1929
  return await sys.fs.readBytes(file.path);
1930
1930
  }
@@ -1935,7 +1935,7 @@ class FileUploadManager {
1935
1935
  }
1936
1936
  if (!file.getStream) {
1937
1937
  file.getStream = function () {
1938
- const sys = getSysApi();
1938
+ const sys = getSysApi$1();
1939
1939
  if (file.path && sys.fs.exist(file.path)) {
1940
1940
  return sys.fs.createReadStream(file.path);
1941
1941
  }
@@ -1999,7 +1999,7 @@ class FileUploadManager {
1999
1999
  }
2000
2000
  }
2001
2001
  if (this.config?.allowedExtensions) {
2002
- const sys = getSysApi();
2002
+ const sys = getSysApi$1();
2003
2003
  const ext = sys.path.extname(file.originalname).toLowerCase();
2004
2004
  this.logger.debug("server", `Checking extensions: ${this.config.allowedExtensions.join(", ")}, file ext: ${ext}`);
2005
2005
  if (!this.config.allowedExtensions.includes(ext)) {
@@ -4181,7 +4181,7 @@ class ConfigSyntaxParser {
4181
4181
  }
4182
4182
  getFile(filePath) {
4183
4183
  try {
4184
- const sys = getSysApi();
4184
+ const sys = getSysApi$1();
4185
4185
  // In XyPriss config, a leading / is often intended as project-root relative
4186
4186
  // especially when the separator dot consumes the '.' of './path'
4187
4187
  const cleanPath = filePath.startsWith("/")
@@ -4508,13 +4508,15 @@ function identifyProjectRoot(filePath) {
4508
4508
  if (manifest?.roots) {
4509
4509
  for (const [pluginRoot, _pluginName] of Object.entries(manifest.roots)) {
4510
4510
  const normPluginRoot = pluginRoot.replace(/\\/g, "/");
4511
- if (normalized === normPluginRoot || normalized.startsWith(normPluginRoot + "/")) {
4511
+ if (normalized === normPluginRoot ||
4512
+ normalized.startsWith(normPluginRoot + "/")) {
4512
4513
  return pluginRoot;
4513
4514
  }
4514
4515
  }
4515
4516
  }
4516
4517
  // 2. Direct match against primary project root
4517
- if (normalized === primaryRoot || normalized.startsWith(primaryRoot + "/")) {
4518
+ if (normalized === primaryRoot ||
4519
+ normalized.startsWith(primaryRoot + "/")) {
4518
4520
  // If inside node_modules, it is an undeclared/untrusted dependency, NOT the application root!
4519
4521
  if (normalized.includes("/node_modules/")) {
4520
4522
  return undefined;
@@ -4589,7 +4591,9 @@ function captureNativeFrames() {
4589
4591
  const fnName = typeof site.getFunctionName === "function"
4590
4592
  ? site.getFunctionName() || ""
4591
4593
  : "";
4592
- const isEval = typeof site.isEval === "function" ? Boolean(site.isEval()) : false;
4594
+ const isEval = typeof site.isEval === "function"
4595
+ ? Boolean(site.isEval())
4596
+ : false;
4593
4597
  frames.push({
4594
4598
  filePath: normalizeScriptName(rawFile),
4595
4599
  fnName,
@@ -4612,7 +4616,8 @@ function captureNativeFrames() {
4612
4616
  frames.push({
4613
4617
  filePath: normalizeScriptName(rawScript),
4614
4618
  fnName,
4615
- isEval: !rawScript && (fnName === "eval" || fnName === "anonymous"),
4619
+ isEval: !rawScript &&
4620
+ (fnName === "eval" || fnName === "anonymous"),
4616
4621
  });
4617
4622
  }
4618
4623
  }
@@ -4656,7 +4661,15 @@ function isImmediateInternalEngineCall() {
4656
4661
  fnName === "call" ||
4657
4662
  fnName === "callSync" ||
4658
4663
  fnName === "callSyncSubprocess" ||
4659
- fnName === "executeEnvCall") {
4664
+ fnName === "executeEnvCall" ||
4665
+ // Issue #52 (https://github.com/Nehonix-Team/XyPriss/issues/52)
4666
+ // When code accesses `process.env[prop]`, the proxy trap handler executes inside `EnvApi.ts`.
4667
+ // If EnvApi frames are not skipped, `isImmediateInternalEngineCall()` would treat the Proxy
4668
+ // handler itself as the "caller", erroneously considering every process.env access as an
4669
+ // internal engine call and bypassing the shield. Skipping EnvApi frames ensures we inspect
4670
+ // the real consumer (project code, plugins, or third-party dependencies).
4671
+ norm.endsWith("/EnvApi.ts") ||
4672
+ norm.endsWith("/EnvApi.js")) {
4660
4673
  continue;
4661
4674
  }
4662
4675
  }
@@ -4759,7 +4772,9 @@ function loadXyConfig(projectRoot) {
4759
4772
  try {
4760
4773
  pkgJson = JSON.parse(fs$1.readFileSync(pkgPath, "utf-8"));
4761
4774
  }
4762
- catch { /* ignore */ }
4775
+ catch {
4776
+ /* ignore */
4777
+ }
4763
4778
  }
4764
4779
  // Resolve references &(pkg), &(env), etc.
4765
4780
  const sys = globalThis.__sys__;
@@ -4769,7 +4784,7 @@ function loadXyConfig(projectRoot) {
4769
4784
  if (sys?.__env__?.[XY_ENV_INTERNAL_GET_FOR_ROOT]) {
4770
4785
  envProvider = {
4771
4786
  has: (key) => sys.__env__[XY_ENV_INTERNAL_GET_FOR_ROOT](key, projectRoot) !== undefined,
4772
- get: (key) => sys.__env__[XY_ENV_INTERNAL_GET_FOR_ROOT](key, projectRoot)
4787
+ get: (key) => sys.__env__[XY_ENV_INTERNAL_GET_FOR_ROOT](key, projectRoot),
4773
4788
  };
4774
4789
  }
4775
4790
  const parser = new ConfigSyntaxParser(pkgJson, envProvider);
@@ -5616,7 +5631,7 @@ class XyPrissRunner {
5616
5631
  * @returns {string} Path to `<os.tmpdir>/nehonix.xypriss.data`
5617
5632
  */
5618
5633
  function getXyprissTempDir() {
5619
- const sys = getSysApi();
5634
+ const sys = getSysApi$1();
5620
5635
  return sys.path.join(sys.path.tempDir(), "nehonix.xypriss.data");
5621
5636
  }
5622
5637
  /**
@@ -5626,7 +5641,7 @@ function getXyprissTempDir() {
5626
5641
  * @returns {string} The absolute resolved temp sub-path.
5627
5642
  */
5628
5643
  function createXyprissTempDir(_p) {
5629
- const sys = getSysApi();
5644
+ const sys = getSysApi$1();
5630
5645
  const base = getXyprissTempDir();
5631
5646
  const segment = typeof _p === "string"
5632
5647
  ? _p
@@ -5666,7 +5681,7 @@ function generateXUserTmpDir() {
5666
5681
  if (_sessionTmpDir !== null) {
5667
5682
  return _sessionTmpDir;
5668
5683
  }
5669
- const sys = getSysApi();
5684
+ const sys = getSysApi$1();
5670
5685
  // 1. Adopt the session directory allocated exclusively by the libProc supervisor
5671
5686
  const envSession = sys?.__env__?.get("XYPRISS_USER_TMP") ||
5672
5687
  sys?.__env__?.get("XESS_SESSION_TMP") ||
@@ -5688,7 +5703,7 @@ function generateXUserTmpDir() {
5688
5703
  * Delegated exclusively to the libProc supervisor (Single Source of Truth).
5689
5704
  */
5690
5705
  function getSessionHash() {
5691
- const sys = getSysApi();
5706
+ const sys = getSysApi$1();
5692
5707
  const envHash = sys?.__env__?.get("XYPRISS_SESSION_HASH") ||
5693
5708
  (typeof process !== "undefined" ? process.env?.XYPRISS_SESSION_HASH : undefined);
5694
5709
  if (envHash && typeof envHash === "string") {
@@ -6589,7 +6604,7 @@ class QuickLogger {
6589
6604
  return new QuickLogger(context);
6590
6605
  }
6591
6606
  static shouldLog(level) {
6592
- const sys = getSysApi();
6607
+ const sys = getSysApi$1();
6593
6608
  let isDebug = false;
6594
6609
  if (sys?.__env__) {
6595
6610
  isDebug =
@@ -6745,7 +6760,7 @@ class TempFileManager {
6745
6760
  * Track a temporary file for automatic TTL expiration and process exit cleanup.
6746
6761
  */
6747
6762
  track(filePath, options = {}) {
6748
- const sys = getSysApi();
6763
+ const sys = getSysApi$1();
6749
6764
  const ttlMs = TempFileManager.parseTTL(options.ttl);
6750
6765
  const autoCleanup = options.autoCleanupOnExit !== false;
6751
6766
  const now = Date.now();
@@ -6787,7 +6802,7 @@ class TempFileManager {
6787
6802
  * Remove a single tracked temporary file safely using native XyPriss FS API.
6788
6803
  */
6789
6804
  removeFile(filePath) {
6790
- const sys = getSysApi();
6805
+ const sys = getSysApi$1();
6791
6806
  const entry = this.trackedFiles.get(filePath);
6792
6807
  if (entry?.timer) {
6793
6808
  clearTimeout(entry.timer);
@@ -6809,7 +6824,7 @@ class TempFileManager {
6809
6824
  * Clean up all active tracked temporary files.
6810
6825
  */
6811
6826
  cleanupAll() {
6812
- const sys = getSysApi();
6827
+ const sys = getSysApi$1();
6813
6828
  let count = 0;
6814
6829
  for (const [filePath, entry] of this.trackedFiles.entries()) {
6815
6830
  if (entry.timer)
@@ -6833,7 +6848,7 @@ class TempFileManager {
6833
6848
  return;
6834
6849
  this.exitHooksRegistered = true;
6835
6850
  const performExitCleanup = () => {
6836
- const sys = getSysApi();
6851
+ const sys = getSysApi$1();
6837
6852
  for (const [filePath, entry] of this.trackedFiles.entries()) {
6838
6853
  if (entry.autoCleanupOnExit) {
6839
6854
  try {
@@ -8849,6 +8864,8 @@ class VarsApi extends BaseApi {
8849
8864
 
8850
8865
  const _envRunnerStore = new WeakMap();
8851
8866
  const _sealKeyStore = new WeakMap();
8867
+ const _shieldedInstances = new WeakSet();
8868
+ const SHIELD_MARKER = Symbol("xypriss.internal.env.shielded");
8852
8869
  class EnvApi {
8853
8870
  /**
8854
8871
  * @param runner - The XyPrissRunner used to invoke native Go binaries.
@@ -9418,9 +9435,9 @@ class EnvApi {
9418
9435
  * @internal
9419
9436
  */
9420
9437
  applyShield() {
9421
- // Issue #43: Guard against multi-server sequential startup re-wrapping process.env in nested proxies.
9422
- const SHIELD_MARKER = Symbol.for("xypriss.env.shielded");
9423
- if (process.env[SHIELD_MARKER]) {
9438
+ // Issue #43 / XSA-008: Guard against multi-server sequential startup re-wrapping process.env.
9439
+ // Uses unforgeable private Symbol and WeakSet to defeat pre-bootstrap spoofing attacks.
9440
+ if (_shieldedInstances.has(process.env) || process.env[SHIELD_MARKER] === true) {
9424
9441
  return;
9425
9442
  }
9426
9443
  // Per-key deduplication: every distinct blocked key gets exactly one
@@ -9639,6 +9656,8 @@ class EnvApi {
9639
9656
  return false;
9640
9657
  },
9641
9658
  });
9659
+ _shieldedInstances.add(envShield);
9660
+ _shieldedInstances.add(process.env);
9642
9661
  try {
9643
9662
  Object.defineProperty(process, "env", {
9644
9663
  value: envShield,
@@ -9647,11 +9666,13 @@ class EnvApi {
9647
9666
  enumerable: true,
9648
9667
  });
9649
9668
  }
9650
- catch {
9651
- // Silently degrade — the Shield could not be applied (e.g., inside
9652
- // certain container or VM environments with locked descriptors).
9653
- // The Symbol-keyed internal store remains the authoritative and
9654
- // isolated source for all EnvApi reads.
9669
+ catch (err) {
9670
+ // Issue #52 (https://github.com/Nehonix-Team/XyPriss/issues/52)
9671
+ // Emits an explicit diagnostic notice if the host runtime, sandbox, or
9672
+ // strict VM has locked the process.env descriptor beforehand.
9673
+ // Avoids silent degradation so operators immediately know when the JS
9674
+ // proxy layer cannot replace process.env on the global object.
9675
+ process.stderr.write(`\x1b[33m[SECURITY] WARNING:\x1b[0m Unable to lock process.env descriptor: ${err?.message || err}. Shield proxy degradation active.\n`);
9655
9676
  }
9656
9677
  }
9657
9678
  isCallerProjectCode() {
@@ -16384,7 +16405,7 @@ class MetaConfigRunner {
16384
16405
  * Executes a specific meta configuration file
16385
16406
  */
16386
16407
  runMetaFile(metaPath) {
16387
- const sys = getSysApi();
16408
+ const sys = getSysApi$1();
16388
16409
  const absolutePath = sys.path.resolve(metaPath);
16389
16410
  if (this.executedMetas.has(absolutePath))
16390
16411
  return;
@@ -16411,7 +16432,7 @@ class MetaConfigRunner {
16411
16432
  * Discovers and executes meta configuration files based on priority
16412
16433
  */
16413
16434
  executeMetaConfig(searchDir) {
16414
- const sys = getSysApi();
16435
+ const sys = getSysApi$1();
16415
16436
  const root = searchDir || getCallerProjectRoot() || __sys__$1.__root__;
16416
16437
  const metaFiles = searchDir
16417
16438
  ? [
@@ -16461,7 +16482,7 @@ class ConfigLoader {
16461
16482
  this.isConfigApplied = false;
16462
16483
  this.packageJson = null;
16463
16484
  this.metaRunner = new MetaConfigRunner();
16464
- this.sys = getSysApi();
16485
+ this.sys = getSysApi$1();
16465
16486
  }
16466
16487
  /**
16467
16488
  * Load all xypriss.config.json files found in the project and apply configurations
@@ -18535,7 +18556,7 @@ const MIME_MAP = {
18535
18556
  function resolveMime(ext) {
18536
18557
  return MIME_MAP[ext.toLowerCase()] ?? "application/octet-stream";
18537
18558
  }
18538
- getSysApi();
18559
+ getSysApi$1();
18539
18560
  class SendFileHandler {
18540
18561
  constructor(res, logger) {
18541
18562
  this.res = res;
@@ -26776,7 +26797,7 @@ class XHSCWorker {
26776
26797
  app.logger || initializeLogger(ConfigurationManager.get("logging"));
26777
26798
  // Issue #43: Access system environment variables through getSysApi()
26778
26799
  // to maintain compatibility with the XyPriss zero-trust model and shielded process.env
26779
- const sys = getSysApi();
26800
+ const sys = getSysApi$1();
26780
26801
  this.workerId =
26781
26802
  options?.workerId ||
26782
26803
  sys?.__env__?.get("XYPRISS_WORKER_ID") ||
@@ -27410,7 +27431,7 @@ class EngineManager {
27410
27431
  ? ["--plugins", uniquePluginPaths.join(",")]
27411
27432
  : [];
27412
27433
  // Access project root lazily via getSysApi() to break circular imports
27413
- const sys = getSysApi();
27434
+ const sys = getSysApi$1();
27414
27435
  const projectRoot = sys?.__root__ ||
27415
27436
  getCallerProjectRoot() ||
27416
27437
  identifyProjectRoot(process.cwd()) ||
@@ -27586,7 +27607,7 @@ class XHSCBridge {
27586
27607
  // 0. Check if we are a worker spawned by Go (Clustering mode)
27587
27608
  // Auxiliary servers should NEVER act as cluster workers for the primary instance.
27588
27609
  // Issue #43: Access workerId via getSysApi() to adhere to XyPriss zero-trust environment model
27589
- const sysApi = getSysApi();
27610
+ const sysApi = getSysApi$1();
27590
27611
  const currentWorkerId = sysApi?.__env__?.get("XYPRISS_WORKER_ID");
27591
27612
  if (currentWorkerId && currentWorkerId !== "master" && !this.app.configs?.isAuxiliary) {
27592
27613
  this.logger.info("cluster", `Worker ${currentWorkerId} starting...`);
@@ -27625,7 +27646,7 @@ class XHSCBridge {
27625
27646
  // Issue #43: Use getSysApi().__env__.set() instead of assigning to process.env directly.
27626
27647
  // In strict JS runtimes like Bun (multi-server mode), mutating process.env when wrapped
27627
27648
  // in an immutable descriptor causes fatal descriptor rejection exceptions.
27628
- const sys = getSysApi();
27649
+ const sys = getSysApi$1();
27629
27650
  sys?.__env__?.set("XYPRISS_WORKER_ID", "master");
27630
27651
  sys?.__env__?.set("XYPRISS_IPC_PATH", this.socketPath);
27631
27652
  }
@@ -28241,7 +28262,7 @@ class ConsoleInterceptor {
28241
28262
  isActive: false,
28242
28263
  };
28243
28264
  // Issue #43: Access XYPRISS_IPC_PATH via getSysApi()
28244
- this.ipcPath = getSysApi()?.__env__?.get("XYPRISS_IPC_PATH");
28265
+ this.ipcPath = getSysApi$1()?.__env__?.get("XYPRISS_IPC_PATH");
28245
28266
  }
28246
28267
  /**
28247
28268
  * Decides whether a log line should be displayed given the current displayLimit config.
@@ -28301,7 +28322,7 @@ class ConsoleInterceptor {
28301
28322
  this.stats.isActive = true;
28302
28323
  // Try to sync config if IPC is already available (Issue #43)
28303
28324
  this.ipcPath =
28304
- this.ipcPath || getSysApi()?.__env__?.get("XYPRISS_IPC_PATH");
28325
+ this.ipcPath || getSysApi$1()?.__env__?.get("XYPRISS_IPC_PATH");
28305
28326
  if (this.ipcPath) {
28306
28327
  const ipc = new XHSCDirectIPC(this.ipcPath);
28307
28328
  await ipc.sendCommand("console", "update-config", this.config);
@@ -28691,7 +28712,7 @@ class XyLifecycleManager {
28691
28712
  async handleServerStartup(serverPort, host, callback) {
28692
28713
  // Rust/Go-Managed Clustering Mode
28693
28714
  // Issue #43: Retrieve workerId and ipcPath via getSysApi() rather than raw process.env
28694
- const sys = getSysApi();
28715
+ const sys = getSysApi$1();
28695
28716
  const workerId = sys?.__env__?.get("XYPRISS_WORKER_ID") ||
28696
28717
  (typeof process !== "undefined"
28697
28718
  ? process.env?.XYPRISS_WORKER_ID
@@ -29177,12 +29198,12 @@ class XyprissApp {
29177
29198
  this.settings = {
29178
29199
  "x-powered-by": false,
29179
29200
  etag: "weak",
29180
- env: getSysApi()?.__env__?.get("NODE_ENV") || "development",
29201
+ env: getSysApi$1()?.__env__?.get("NODE_ENV") || "development",
29181
29202
  "subdomain offset": 2,
29182
29203
  "trust proxy": false,
29183
29204
  "view cache": true,
29184
29205
  "view engine": false,
29185
- views: getSysApi()?.__env__?.get("XYPRISS_VIEWS") || process.cwd() + "/views",
29206
+ views: getSysApi$1()?.__env__?.get("XYPRISS_VIEWS") || process.cwd() + "/views",
29186
29207
  };
29187
29208
  }
29188
29209
  // ===== HTTP METHOD IMPLEMENTATIONS =====
@@ -31205,7 +31226,7 @@ class SecurityMiddleware {
31205
31226
  cookieOptions: {
31206
31227
  httpOnly: true,
31207
31228
  sameSite: "strict",
31208
- secure: getSysApi().__env__.isProduction(),
31229
+ secure: getSysApi$1().__env__.isProduction(),
31209
31230
  maxAge: 24 * 60 * 60 * 1000, // 24 hours
31210
31231
  ...(csrfConfig.cookieOptions || {}),
31211
31232
  },
@@ -32490,7 +32511,7 @@ class WorkerPoolComponent {
32490
32511
  // Add task execution method via IPC
32491
32512
  // Issue #43: Access XYPRISS_IPC_PATH through getSysApi()
32492
32513
  app.executeTask = (task) => {
32493
- const ipcPath = getSysApi()?.__env__?.get("XYPRISS_IPC_PATH");
32514
+ const ipcPath = getSysApi$1()?.__env__?.get("XYPRISS_IPC_PATH");
32494
32515
  if (this.isXHSC && ipcPath) {
32495
32516
  // In worker mode, we send the task to Go via the global IPC handler
32496
32517
  // We'll assume the XHSCWorker instance is available or
@@ -32577,7 +32598,7 @@ class ComponentManager {
32577
32598
  }
32578
32599
  async initializeWorkerPool() {
32579
32600
  // Issue #43: Retrieve XYPRISS_WORKER_ID via getSysApi()
32580
- const workerId = getSysApi()?.__env__?.get("XYPRISS_WORKER_ID");
32601
+ const workerId = getSysApi$1()?.__env__?.get("XYPRISS_WORKER_ID");
32581
32602
  const isWorker = !!workerId && workerId !== "master";
32582
32603
  if (this.options.workerPool?.enabled) {
32583
32604
  this.refs.workerPoolComponent = new WorkerPoolComponent({ workerPool: this.options.workerPool }, { app: this.app, serverOptions: this.options });
@@ -32907,7 +32928,7 @@ class XyPrissServer {
32907
32928
  * the XyPriss zero-trust model and avoid process.env shield traps.
32908
32929
  */
32909
32930
  function handleWorkerMode(options) {
32910
- const sys = getSysApi();
32931
+ const sys = getSysApi$1();
32911
32932
  const env = sys?.__env__;
32912
32933
  // Check if running in worker mode
32913
32934
  const clusterMode = env?.get("XYPRISS_CLUSTER_MODE") ||
@@ -36713,7 +36734,7 @@ class XyServerCreator {
36713
36734
  // 3. Setup environment
36714
36735
  // Issue #43: Apply NODE_ENV through getSysApi().__env__.set() to avoid strict descriptor exceptions under Bun
36715
36736
  if (options.env) {
36716
- const sys = getSysApi();
36737
+ const sys = getSysApi$1();
36717
36738
  if (sys?.__env__) {
36718
36739
  sys.__env__.set("NODE_ENV", options.env);
36719
36740
  }
@@ -36839,7 +36860,7 @@ class XMSStartupUI {
36839
36860
  quiet: options.quiet !== false,
36840
36861
  silent: options.silent === true,
36841
36862
  };
36842
- const sysEnv = getSysApi()?.__env__;
36863
+ const sysEnv = getSysApi$1()?.__env__;
36843
36864
  const isCI = sysEnv ? sysEnv.get("CI") : (typeof process !== "undefined" && process.env?.CI);
36844
36865
  const noColor = sysEnv ? sysEnv.get("NO_COLOR") : (typeof process !== "undefined" && process.env?.NO_COLOR);
36845
36866
  const disableColors = sysEnv ? sysEnv.get("NODE_DISABLE_COLORS") : (typeof process !== "undefined" && process.env?.NODE_DISABLE_COLORS);
@@ -39009,6 +39030,9 @@ function getIp(req, enriched) {
39009
39030
  if (typeof globalThis !== "undefined") {
39010
39031
  configLoader.loadAndApplySysConfig();
39011
39032
  }
39033
+ function getSysApi() {
39034
+ return __sys__$1;
39035
+ }
39012
39036
  /**
39013
39037
  * Default router instance for quick start
39014
39038
  */
@@ -39047,6 +39071,7 @@ exports.getInstanceId = getInstanceId;
39047
39071
  exports.getIp = getIp;
39048
39072
  exports.getMime = getMime;
39049
39073
  exports.getMimes = getMimes;
39074
+ exports.getSysApi = getSysApi;
39050
39075
  exports.identifyProjectRoot = identifyProjectRoot;
39051
39076
  exports.initializeFileUpload = initializeFileUpload;
39052
39077
  exports.mergeWithDefaults = mergeWithDefaults;