@camstack/server 1.2.753 → 1.2.754

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.
@@ -35,12 +35,12 @@ import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT
35
35
  import { $ as caFingerprintCompact, A as getProcessNodeMeshTransport, B as MESH_NODE_CERTIFICATES_COLLECTION, C as MESH_TLS_PORT_HELLO_FIELD, Ct as readOriginSetting, D as setProcessMeshTlsEnabler, Dt as readCidrSetting, E as ServiceBroker, Et as parseCidrList, F as renewMeshCertificate, G as getProcessMeshCertificateRegistry, H as MeshCertificateRegistry, I as revokeMeshCertificate, J as processMeshCrl, K as setProcessMeshCertificateRegistry, L as getProcessMeshTlsListenerState, M as isProcessVerifiedMeshPeer, N as onProcessNodeRegistered, O as dropProcessPeer, P as setProcessMeshPeerTransportLookup, Q as caFingerprint, R as openMeshTlsWhenRevocationsLoaded, S as verifyMembershipAnswer, St as parseOriginList, SystemConfigAddon, T as Errors, Tt as normalizeIp, U as RENEWAL_ABANDONED, V as MESH_NODE_CERTIFICATES_COLUMNS, W as describeMeshLeaf, X as getProcessMeshCaState, Y as MeshCaKeeper, Z as requireProcessMeshCa, _ as signPairingProof, _t as verifyAgentUiUnlockTicket, a as hubHostFromMeshAddress, at as issueMeshLeafForNode, b as MembershipResponder, bt as isInsecureOrigin, c as PAIRING_MAX_SESSIONS, ct as AGENT_DASHBOARD_ORIGINS_FIELD, d as PAIRING_PROTOCOL, dt as AGENT_UI_UNLOCK_USE, et as createMeshCsrPem, f as PAIRING_TTL_MS, ft as AGENT_UI_UNLOCK_VERSION, g as keyFingerprintShort, gt as parseAgentDashboardOrigins, h as describeCsr, ht as mintAgentUiUnlockTicket, i as AgentPairing, it as isValidAgentNodeId, j as getProcessPeerLeaf, k as emitProcessNodeRegistered, l as PAIRING_PATHS, lt as AGENT_UI_UNLOCK_TTL_MS, m as computePairingSas, mt as isAllowedAgentDashboardReturnTo, n as HubPairing, nt as generateMeshCa, o as PAIRING_CODE_DIGITS, ot as issueMeshLeafFromCsr, p as computePairingCommitment, pt as UnlockTicketJtiStore, q as MeshCrl, r as PairingHttpError, rt as generateMeshKeyPair, s as PAIRING_MAX_CODE_ATTEMPTS, st as loadMeshCa, tt as exportMeshPrivateKeyPem, u as PAIRING_PIN_DIGITS, ut as AGENT_UI_UNLOCK_TYP, v as verifyPairingProof, vt as InvalidCorsOriginError, w as TlsTcpTransporter, wt as createCidrMatcher, x as signMembershipProof, xt as normalizeOrigin, y as MEMBERSHIP_PATHS, yt as OPAQUE_ORIGIN, z as setProcessMeshTlsListenerState } from "./builtins/system-config/system-config.addon.mjs";
36
36
  import "./builtins/system-config/index.mjs";
37
37
  import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
38
- import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-oHl1xltx.mjs";
38
+ import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-BIJZBObd.mjs";
39
39
  import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-DW_g42El.mjs";
40
40
  import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
41
41
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
42
- import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-CFGGJCfV.mjs";
43
- import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-DBlgWB8k.mjs";
42
+ import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-D8ZIN10X.mjs";
43
+ import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-BW3OcrLD.mjs";
44
44
  import { z } from "zod";
45
45
  import * as crypto$1 from "node:crypto";
46
46
  import { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -55,7 +55,7 @@ import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, DATAPLANE_SECRET
55
55
  import * as os$1 from "node:os";
56
56
  import { tmpdir } from "node:os";
57
57
  import { pathToFileURL } from "node:url";
58
- import * as fs$1 from "node:fs";
58
+ import * as fs from "node:fs";
59
59
  import { accessSync, constants, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
60
60
  import { execFile, spawn } from "node:child_process";
61
61
  import { once } from "node:events";
@@ -5113,7 +5113,7 @@ var PythonEnvManager = class {
5113
5113
  async ensure(options) {
5114
5114
  const probe = await this.probe();
5115
5115
  if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
5116
- if (!fs$1.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
5116
+ if (!fs.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
5117
5117
  "-m",
5118
5118
  "venv",
5119
5119
  this.venvPath
@@ -5136,7 +5136,7 @@ var PythonEnvManager = class {
5136
5136
  }
5137
5137
  spawn(script, args) {
5138
5138
  const venvPython = path$1.join(this.venvPath, "bin", "python");
5139
- if (!fs$1.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
5139
+ if (!fs.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
5140
5140
  return spawn(venvPython, [script, ...args]);
5141
5141
  }
5142
5142
  };
@@ -5488,20 +5488,20 @@ var StorageManager = class {
5488
5488
  const basePath = this.locationManager.getBackend(mappedName).basePath;
5489
5489
  location.files = {
5490
5490
  async readFile(p) {
5491
- return fs$1.promises.readFile(path$1.join(basePath, p));
5491
+ return fs.promises.readFile(path$1.join(basePath, p));
5492
5492
  },
5493
5493
  async writeFile(p, data) {
5494
5494
  const full = path$1.join(basePath, p);
5495
- await fs$1.promises.mkdir(path$1.dirname(full), { recursive: true });
5496
- await fs$1.promises.writeFile(full, data);
5495
+ await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
5496
+ await fs.promises.writeFile(full, data);
5497
5497
  },
5498
5498
  async deleteFile(p) {
5499
- await fs$1.promises.rm(path$1.join(basePath, p), { force: true });
5499
+ await fs.promises.rm(path$1.join(basePath, p), { force: true });
5500
5500
  },
5501
5501
  async listFiles(prefix) {
5502
5502
  const dir = prefix ? path$1.join(basePath, prefix) : basePath;
5503
5503
  try {
5504
- return (await fs$1.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
5504
+ return (await fs.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
5505
5505
  } catch {
5506
5506
  return [];
5507
5507
  }
@@ -5511,7 +5511,7 @@ var StorageManager = class {
5511
5511
  },
5512
5512
  async exists(p) {
5513
5513
  try {
5514
- await fs$1.promises.access(path$1.join(basePath, p));
5514
+ await fs.promises.access(path$1.join(basePath, p));
5515
5515
  return true;
5516
5516
  } catch {
5517
5517
  return false;
@@ -6287,7 +6287,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
6287
6287
  function hasDotNode(dir, maxDepth) {
6288
6288
  let entries;
6289
6289
  try {
6290
- entries = fs$1.readdirSync(dir, { withFileTypes: true });
6290
+ entries = fs.readdirSync(dir, { withFileTypes: true });
6291
6291
  } catch {
6292
6292
  return false;
6293
6293
  }
@@ -6298,7 +6298,7 @@ function hasDotNode(dir, maxDepth) {
6298
6298
  }
6299
6299
  /** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
6300
6300
  function resolvePrebuildInstallBin(closureDir, moduleDir) {
6301
- return [path$1.join(moduleDir, "node_modules", "prebuild-install", "bin.js"), path$1.join(closureDir, "node_modules", "prebuild-install", "bin.js")].find((c) => fs$1.existsSync(c)) ?? null;
6301
+ return [path$1.join(moduleDir, "node_modules", "prebuild-install", "bin.js"), path$1.join(closureDir, "node_modules", "prebuild-install", "bin.js")].find((c) => fs.existsSync(c)) ?? null;
6302
6302
  }
6303
6303
  /**
6304
6304
  * Default fetcher: run the closure's own `prebuild-install` under the CURRENT
@@ -6351,7 +6351,7 @@ async function ensureNativePrebuilds(closureDir, options) {
6351
6351
  const fetched = [];
6352
6352
  for (const pkg of packages) {
6353
6353
  const moduleDir = path$1.join(nm, pkg);
6354
- if (!fs$1.existsSync(moduleDir)) continue;
6354
+ if (!fs.existsSync(moduleDir)) continue;
6355
6355
  if (hasDotNode(moduleDir, 4)) continue;
6356
6356
  options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
6357
6357
  pkg,
@@ -6414,12 +6414,12 @@ async function ensureNativePrebuilds(closureDir, options) {
6414
6414
  function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
6415
6415
  if (!hasNative(srcModuleDir)) return false;
6416
6416
  try {
6417
- fs$1.rmSync(dstModuleDir, {
6417
+ fs.rmSync(dstModuleDir, {
6418
6418
  recursive: true,
6419
6419
  force: true
6420
6420
  });
6421
- fs$1.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
6422
- fs$1.cpSync(srcModuleDir, dstModuleDir, {
6421
+ fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
6422
+ fs.cpSync(srcModuleDir, dstModuleDir, {
6423
6423
  recursive: true,
6424
6424
  dereference: true
6425
6425
  });
@@ -6448,7 +6448,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
6448
6448
  const missing = [];
6449
6449
  for (const pkg of packages) {
6450
6450
  const moduleDir = path$1.join(nm, pkg);
6451
- if (!fs$1.existsSync(moduleDir)) continue;
6451
+ if (!fs.existsSync(moduleDir)) continue;
6452
6452
  if (hasNative(moduleDir)) {
6453
6453
  results.push({
6454
6454
  pkg,
@@ -6547,7 +6547,7 @@ async function defaultDownloadTarball(url, destTgz) {
6547
6547
  const res = await fetch(url);
6548
6548
  if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
6549
6549
  const bytes = Buffer.from(await res.arrayBuffer());
6550
- await fs$1.promises.writeFile(destTgz, bytes);
6550
+ await fs.promises.writeFile(destTgz, bytes);
6551
6551
  }
6552
6552
  async function defaultExtractTarball(tgzPath, destDir) {
6553
6553
  await execFileAsync$5("tar", [
@@ -6633,7 +6633,7 @@ async function resolveUncached(options) {
6633
6633
  argsPrefix: []
6634
6634
  };
6635
6635
  const cliPath = bootstrappedCliPath(options.cacheDir);
6636
- if (fs$1.existsSync(cliPath)) {
6636
+ if (fs.existsSync(cliPath)) {
6637
6637
  options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
6638
6638
  return {
6639
6639
  command: process.execPath,
@@ -6645,12 +6645,12 @@ async function resolveUncached(options) {
6645
6645
  const registry = (options.registry ?? DEFAULT_REGISTRY).replace(/\/+$/, "");
6646
6646
  const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
6647
6647
  if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
6648
- await fs$1.promises.mkdir(options.cacheDir, { recursive: true });
6648
+ await fs.promises.mkdir(options.cacheDir, { recursive: true });
6649
6649
  const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
6650
6650
  await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
6651
6651
  await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
6652
- await fs$1.promises.rm(tgzPath, { force: true });
6653
- if (!fs$1.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
6652
+ await fs.promises.rm(tgzPath, { force: true });
6653
+ if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
6654
6654
  options.logger.info("npm bootstrapped", { meta: { cliPath } });
6655
6655
  return {
6656
6656
  command: process.execPath,
@@ -6716,7 +6716,7 @@ function readOwningPackageVersion(entryPath) {
6716
6716
  let dir = path$1.dirname(entryPath);
6717
6717
  for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
6718
6718
  try {
6719
- const version = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
6719
+ const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
6720
6720
  if (typeof version === "string" && version.length > 0) return version;
6721
6721
  } catch {}
6722
6722
  const parent = path$1.dirname(dir);
@@ -6760,14 +6760,14 @@ function readOwningPackageVersion(entryPath) {
6760
6760
  function addonModuleCacheKey(entryPath) {
6761
6761
  let stat;
6762
6762
  try {
6763
- stat = fs$1.statSync(entryPath);
6763
+ stat = fs.statSync(entryPath);
6764
6764
  } catch {
6765
6765
  return null;
6766
6766
  }
6767
6767
  const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
6768
6768
  let content;
6769
6769
  try {
6770
- content = createHash("sha1").update(fs$1.readFileSync(entryPath)).digest("hex").slice(0, 16);
6770
+ content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
6771
6771
  } catch {
6772
6772
  content = `m${stat.mtimeMs}s${stat.size}`;
6773
6773
  }
@@ -6871,14 +6871,14 @@ var AddonLoader = class {
6871
6871
  * BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
6872
6872
  * the addons-dir `@camstack/server/system` must NOT be double-loaded here. */
6873
6873
  async loadFromDirectory(addonsDir, skipPackages = []) {
6874
- if (!fs$1.existsSync(addonsDir)) return;
6874
+ if (!fs.existsSync(addonsDir)) return;
6875
6875
  const skip = new Set(skipPackages);
6876
- const entries = fs$1.readdirSync(addonsDir, { withFileTypes: true });
6876
+ const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
6877
6877
  for (const entry of entries) {
6878
6878
  if (!isDirectoryEntry(entry, addonsDir)) continue;
6879
6879
  if (entry.name.startsWith("@")) {
6880
6880
  const scopeDir = path$1.join(addonsDir, entry.name);
6881
- const scopeEntries = fs$1.readdirSync(scopeDir, { withFileTypes: true });
6881
+ const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
6882
6882
  for (const scopeEntry of scopeEntries) {
6883
6883
  if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
6884
6884
  if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
@@ -6892,7 +6892,7 @@ var AddonLoader = class {
6892
6892
  }
6893
6893
  async tryLoadAddon(addonDir) {
6894
6894
  const pkgJsonPath = path$1.join(addonDir, "package.json");
6895
- if (!fs$1.existsSync(pkgJsonPath)) return;
6895
+ if (!fs.existsSync(pkgJsonPath)) return;
6896
6896
  try {
6897
6897
  await this.loadFromAddonDir(addonDir);
6898
6898
  } catch (err) {
@@ -6910,7 +6910,7 @@ var AddonLoader = class {
6910
6910
  /** Load addon from a specific directory (package.json + dist/) */
6911
6911
  async loadFromAddonDir(addonDir) {
6912
6912
  const pkgJsonPath = path$1.join(addonDir, "package.json");
6913
- const pkgJson = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
6913
+ const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
6914
6914
  const packageNameRaw = pkgJson["name"];
6915
6915
  const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
6916
6916
  const packageVersionRaw = pkgJson["version"];
@@ -6957,7 +6957,7 @@ var AddonLoader = class {
6957
6957
  }
6958
6958
  const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
6959
6959
  let entryPath = path$1.resolve(addonDir, entryFile);
6960
- if (!fs$1.existsSync(entryPath)) {
6960
+ if (!fs.existsSync(entryPath)) {
6961
6961
  const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
6962
6962
  entryPath = [
6963
6963
  `${base}.cjs`,
@@ -6966,9 +6966,9 @@ var AddonLoader = class {
6966
6966
  path$1.resolve(addonDir, "dist", "index.cjs"),
6967
6967
  path$1.resolve(addonDir, "dist", "index.mjs"),
6968
6968
  path$1.resolve(addonDir, declaration.entry)
6969
- ].find((p) => fs$1.existsSync(p)) ?? entryPath;
6969
+ ].find((p) => fs.existsSync(p)) ?? entryPath;
6970
6970
  }
6971
- if (!fs$1.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
6971
+ if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
6972
6972
  const modUnknown = await importAddonModuleFresh(entryPath);
6973
6973
  const mod = isRecord$4(modUnknown) ? modUnknown : {};
6974
6974
  const AddonClass = resolveAddonClass(mod);
@@ -7053,7 +7053,7 @@ function isDirectoryEntry(entry, parentDir) {
7053
7053
  if (entry.name.startsWith(".")) return false;
7054
7054
  if (entry.isDirectory()) return true;
7055
7055
  if (entry.isSymbolicLink()) try {
7056
- return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
7056
+ return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
7057
7057
  } catch {
7058
7058
  return false;
7059
7059
  }
@@ -7147,7 +7147,7 @@ var execFileAsync$4 = promisify(execFile);
7147
7147
  * Single source of truth — replaces scattered mkdirSync calls.
7148
7148
  */
7149
7149
  function ensureDir(dirPath) {
7150
- fs$1.mkdirSync(dirPath, { recursive: true });
7150
+ fs.mkdirSync(dirPath, { recursive: true });
7151
7151
  }
7152
7152
  /**
7153
7153
  * Copy a directory recursively — ASYNC so it never blocks the event loop.
@@ -7160,7 +7160,7 @@ function ensureDir(dirPath) {
7160
7160
  * `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
7161
7161
  */
7162
7162
  async function copyDirRecursive(src, dest) {
7163
- await fs$1.promises.cp(src, dest, {
7163
+ await fs.promises.cp(src, dest, {
7164
7164
  recursive: true,
7165
7165
  force: true
7166
7166
  });
@@ -7265,13 +7265,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
7265
7265
  if (typeof fileEntry !== "string") continue;
7266
7266
  if (fileEntry === "dist" || fileEntry.includes("*")) continue;
7267
7267
  const srcPath = path$1.join(sourceDir, fileEntry);
7268
- if (!fs$1.existsSync(srcPath)) continue;
7268
+ if (!fs.existsSync(srcPath)) continue;
7269
7269
  const destPath = path$1.join(destDir, fileEntry);
7270
- const stat = await fs$1.promises.stat(srcPath);
7270
+ const stat = await fs.promises.stat(srcPath);
7271
7271
  if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
7272
7272
  else if (stat.isFile()) {
7273
7273
  ensureDir(path$1.dirname(destPath));
7274
- await fs$1.promises.copyFile(srcPath, destPath);
7274
+ await fs.promises.copyFile(srcPath, destPath);
7275
7275
  }
7276
7276
  }
7277
7277
  }
@@ -7282,10 +7282,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
7282
7282
  function isSourceNewer(packageDir) {
7283
7283
  const srcDir = path$1.join(packageDir, "src");
7284
7284
  const distDir = path$1.join(packageDir, "dist");
7285
- if (!fs$1.existsSync(srcDir) || !fs$1.existsSync(distDir)) return true;
7285
+ if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
7286
7286
  try {
7287
- const distMtime = fs$1.statSync(distDir).mtimeMs;
7288
- const entries = fs$1.readdirSync(srcDir, {
7287
+ const distMtime = fs.statSync(distDir).mtimeMs;
7288
+ const entries = fs.readdirSync(srcDir, {
7289
7289
  withFileTypes: true,
7290
7290
  recursive: true
7291
7291
  });
@@ -7293,7 +7293,7 @@ function isSourceNewer(packageDir) {
7293
7293
  if (!entry.isFile()) continue;
7294
7294
  const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
7295
7295
  const filePath = path$1.join(parentDir, entry.name);
7296
- if (fs$1.statSync(filePath).mtimeMs > distMtime) return true;
7296
+ if (fs.statSync(filePath).mtimeMs > distMtime) return true;
7297
7297
  }
7298
7298
  return false;
7299
7299
  } catch {
@@ -7310,7 +7310,7 @@ function isSourceNewer(packageDir) {
7310
7310
  * `copyDirRecursive` for the wedge this prevents.
7311
7311
  */
7312
7312
  async function installPackageFromNpm(packageName, targetDir) {
7313
- const tmpDir = await fs$1.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
7313
+ const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
7314
7314
  try {
7315
7315
  const { stdout } = await execFileAsync$4("npm", [
7316
7316
  "pack",
@@ -7333,21 +7333,21 @@ async function installPackageFromNpm(packageName, targetDir) {
7333
7333
  extractDir
7334
7334
  ], { timeout: 3e4 });
7335
7335
  const packageSubDir = path$1.join(extractDir, "package");
7336
- const srcPkgJsonDir = fs$1.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
7337
- await fs$1.promises.rm(targetDir, {
7336
+ const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
7337
+ await fs.promises.rm(targetDir, {
7338
7338
  recursive: true,
7339
7339
  force: true
7340
7340
  });
7341
7341
  ensureDir(targetDir);
7342
- await fs$1.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
7342
+ await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
7343
7343
  const distSrc = path$1.join(srcPkgJsonDir, "dist");
7344
- if (fs$1.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
7344
+ if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
7345
7345
  try {
7346
- const npmPkg = asJsonObject$1(parseJsonUnknown(await fs$1.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
7346
+ const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
7347
7347
  if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
7348
7348
  } catch {}
7349
7349
  } finally {
7350
- await fs$1.promises.rm(tmpDir, {
7350
+ await fs.promises.rm(tmpDir, {
7351
7351
  recursive: true,
7352
7352
  force: true
7353
7353
  });
@@ -7372,7 +7372,7 @@ function packageDirName$1(declaredName) {
7372
7372
  }
7373
7373
  function isDirLike$1(p) {
7374
7374
  try {
7375
- return fs$1.statSync(p).isDirectory();
7375
+ return fs.statSync(p).isDirectory();
7376
7376
  } catch {
7377
7377
  return false;
7378
7378
  }
@@ -7390,12 +7390,12 @@ var AddonManifest = class {
7390
7390
  */
7391
7391
  read() {
7392
7392
  if (this.cache != null) return this.cache;
7393
- if (!fs$1.existsSync(this.manifestPath)) {
7393
+ if (!fs.existsSync(this.manifestPath)) {
7394
7394
  this.cache = this.empty();
7395
7395
  return this.cache;
7396
7396
  }
7397
7397
  try {
7398
- const raw = fs$1.readFileSync(this.manifestPath, "utf-8");
7398
+ const raw = fs.readFileSync(this.manifestPath, "utf-8");
7399
7399
  const parsed = JSON.parse(raw);
7400
7400
  if (parsed.version !== MANIFEST_VERSION) {
7401
7401
  process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
@@ -7416,13 +7416,13 @@ var AddonManifest = class {
7416
7416
  * a half-written file.
7417
7417
  */
7418
7418
  write(manifest) {
7419
- fs$1.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
7419
+ fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
7420
7420
  const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
7421
- fs$1.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
7421
+ fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
7422
7422
  encoding: "utf-8",
7423
7423
  mode: 384
7424
7424
  });
7425
- fs$1.renameSync(tmp, this.manifestPath);
7425
+ fs.renameSync(tmp, this.manifestPath);
7426
7426
  this.cache = manifest;
7427
7427
  }
7428
7428
  /** Lookup a single addon's manifest entry, or `null` if not tracked. */
@@ -7497,22 +7497,22 @@ var AddonManifest = class {
7497
7497
  * exactly what moved. Returns the total number of changes.
7498
7498
  */
7499
7499
  reconcileFromDisk(addonsDir, onChange) {
7500
- if (!fs$1.existsSync(addonsDir)) return 0;
7500
+ if (!fs.existsSync(addonsDir)) return 0;
7501
7501
  const m = this.read();
7502
7502
  let changes = 0;
7503
7503
  const now = (/* @__PURE__ */ new Date()).toISOString();
7504
7504
  /** Package name → version, for every ADDON package actually installed. */
7505
7505
  const onDisk = /* @__PURE__ */ new Map();
7506
- for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
7506
+ for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
7507
7507
  if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
7508
7508
  const scopeDir = path$1.join(addonsDir, scope.name);
7509
- for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
7509
+ for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
7510
7510
  if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
7511
7511
  const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
7512
- if (!fs$1.existsSync(pkgJsonPath)) continue;
7512
+ if (!fs.existsSync(pkgJsonPath)) continue;
7513
7513
  let pkgJson;
7514
7514
  try {
7515
- const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
7515
+ const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
7516
7516
  if (typeof parsed !== "object" || parsed == null) continue;
7517
7517
  pkgJson = parsed;
7518
7518
  } catch {
@@ -7583,28 +7583,28 @@ var AddonManifest = class {
7583
7583
  migrateFromInstallSourceMarkers(addonsDir) {
7584
7584
  const m = this.read();
7585
7585
  if (Object.keys(m.addons).length > 0) return 0;
7586
- if (!fs$1.existsSync(addonsDir)) return 0;
7586
+ if (!fs.existsSync(addonsDir)) return 0;
7587
7587
  let migrated = 0;
7588
7588
  const now = (/* @__PURE__ */ new Date()).toISOString();
7589
- for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
7589
+ for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
7590
7590
  if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
7591
7591
  const scopeDir = path$1.join(addonsDir, scope.name);
7592
- for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
7592
+ for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
7593
7593
  if (!pkg.isDirectory()) continue;
7594
7594
  const pkgDir = path$1.join(scopeDir, pkg.name);
7595
7595
  const markerPath = path$1.join(pkgDir, ".install-source");
7596
7596
  const pkgJsonPath = path$1.join(pkgDir, "package.json");
7597
- if (!fs$1.existsSync(pkgJsonPath)) continue;
7597
+ if (!fs.existsSync(pkgJsonPath)) continue;
7598
7598
  let pkgJson;
7599
7599
  try {
7600
- const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
7600
+ const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
7601
7601
  if (typeof parsed !== "object" || parsed == null) continue;
7602
7602
  pkgJson = parsed;
7603
7603
  } catch {
7604
7604
  continue;
7605
7605
  }
7606
7606
  if (!pkgJson.name || !pkgJson.version) continue;
7607
- const source = fs$1.existsSync(markerPath) ? fs$1.readFileSync(markerPath, "utf-8").trim() : "bundled";
7607
+ const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
7608
7608
  m.addons[pkgJson.name] = {
7609
7609
  name: pkgJson.name,
7610
7610
  version: pkgJson.version,
@@ -7808,7 +7808,7 @@ function planClosureDedupe(input) {
7808
7808
  function readTreeManifest(pkgJsonPath) {
7809
7809
  let raw;
7810
7810
  try {
7811
- raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
7811
+ raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
7812
7812
  } catch {
7813
7813
  return null;
7814
7814
  }
@@ -7833,7 +7833,7 @@ function readTreeManifest(pkgJsonPath) {
7833
7833
  function listTopLevelEntries(nodeModulesDir) {
7834
7834
  let entries;
7835
7835
  try {
7836
- entries = fs$1.readdirSync(nodeModulesDir, { withFileTypes: true });
7836
+ entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
7837
7837
  } catch {
7838
7838
  return [];
7839
7839
  }
@@ -7843,7 +7843,7 @@ function listTopLevelEntries(nodeModulesDir) {
7843
7843
  if (entry.name.startsWith("@")) {
7844
7844
  let inner;
7845
7845
  try {
7846
- inner = fs$1.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
7846
+ inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
7847
7847
  } catch {
7848
7848
  continue;
7849
7849
  }
@@ -7876,14 +7876,14 @@ function collectAddonTreeState(addonDir) {
7876
7876
  const entryDir = path$1.join(nodeModulesDir, name);
7877
7877
  let isLink = false;
7878
7878
  try {
7879
- isLink = fs$1.lstatSync(entryDir).isSymbolicLink();
7879
+ isLink = fs.lstatSync(entryDir).isSymbolicLink();
7880
7880
  } catch {
7881
7881
  continue;
7882
7882
  }
7883
7883
  if (isLink) {
7884
7884
  let target = "";
7885
7885
  try {
7886
- target = fs$1.readlinkSync(entryDir);
7886
+ target = fs.readlinkSync(entryDir);
7887
7887
  } catch {}
7888
7888
  existingLinks.push({
7889
7889
  name,
@@ -7897,7 +7897,7 @@ function collectAddonTreeState(addonDir) {
7897
7897
  version: manifest.version
7898
7898
  });
7899
7899
  for (const [depName, range] of manifest.ranges) {
7900
- if (fs$1.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
7900
+ if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
7901
7901
  addRange(depName, range);
7902
7902
  }
7903
7903
  }
@@ -7927,7 +7927,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
7927
7927
  const frameworkDir = explicitDir ?? process.env["CAMSTACK_FRAMEWORK_DIR"];
7928
7928
  if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
7929
7929
  const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
7930
- return fs$1.existsSync(nodeModulesDir) ? nodeModulesDir : null;
7930
+ return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
7931
7931
  }
7932
7932
  function symlinkType() {
7933
7933
  return process.platform === "win32" ? "junction" : "dir";
@@ -7946,10 +7946,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
7946
7946
  const nodeModulesDir = path$1.join(addonDir, "node_modules");
7947
7947
  const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
7948
7948
  try {
7949
- fs$1.mkdirSync(nodeModulesDir, { recursive: true });
7950
- fs$1.rmSync(probePath, { force: true });
7951
- fs$1.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
7952
- fs$1.rmSync(probePath, { force: true });
7949
+ fs.mkdirSync(nodeModulesDir, { recursive: true });
7950
+ fs.rmSync(probePath, { force: true });
7951
+ fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
7952
+ fs.rmSync(probePath, { force: true });
7953
7953
  } catch (err) {
7954
7954
  logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
7955
7955
  addonDir,
@@ -7971,12 +7971,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
7971
7971
  }
7972
7972
  const entryDir = path$1.join(nodeModulesDir, link.name);
7973
7973
  try {
7974
- fs$1.rmSync(entryDir, {
7974
+ fs.rmSync(entryDir, {
7975
7975
  recursive: true,
7976
7976
  force: true
7977
7977
  });
7978
- fs$1.mkdirSync(path$1.dirname(entryDir), { recursive: true });
7979
- fs$1.symlinkSync(target, entryDir, symlinkType());
7978
+ fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
7979
+ fs.symlinkSync(target, entryDir, symlinkType());
7980
7980
  linked.push(link.name);
7981
7981
  } catch (err) {
7982
7982
  logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
@@ -8052,7 +8052,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
8052
8052
  count: Object.keys(native).length
8053
8053
  } });
8054
8054
  try {
8055
- fs$1.writeFileSync(markerFile, markerHash);
8055
+ fs.writeFileSync(markerFile, markerHash);
8056
8056
  } catch (err) {
8057
8057
  logger.warn("Failed to write native deps marker", { meta: {
8058
8058
  markerFile,
@@ -8090,7 +8090,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
8090
8090
  }
8091
8091
  await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
8092
8092
  try {
8093
- fs$1.writeFileSync(markerFile, markerHash);
8093
+ fs.writeFileSync(markerFile, markerHash);
8094
8094
  } catch (err) {
8095
8095
  logger.warn("Failed to write native deps marker", { meta: {
8096
8096
  markerFile,
@@ -8112,12 +8112,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
8112
8112
  if (source === target) continue;
8113
8113
  if (!hasBuiltBinary(source)) continue;
8114
8114
  try {
8115
- fs$1.rmSync(target, {
8115
+ fs.rmSync(target, {
8116
8116
  recursive: true,
8117
8117
  force: true
8118
8118
  });
8119
- fs$1.mkdirSync(path$1.dirname(target), { recursive: true });
8120
- fs$1.cpSync(source, target, {
8119
+ fs.mkdirSync(path$1.dirname(target), { recursive: true });
8120
+ fs.cpSync(source, target, {
8121
8121
  recursive: true,
8122
8122
  dereference: true
8123
8123
  });
@@ -8153,7 +8153,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
8153
8153
  function hasAnyDotNode(dir, maxDepth) {
8154
8154
  let entries;
8155
8155
  try {
8156
- entries = fs$1.readdirSync(dir, { withFileTypes: true });
8156
+ entries = fs.readdirSync(dir, { withFileTypes: true });
8157
8157
  } catch {
8158
8158
  return false;
8159
8159
  }
@@ -8167,12 +8167,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
8167
8167
  if (!hasAnyDotNode(src, 5)) return;
8168
8168
  if (hasAnyDotNode(dst, 5)) return;
8169
8169
  try {
8170
- fs$1.rmSync(dst, {
8170
+ fs.rmSync(dst, {
8171
8171
  recursive: true,
8172
8172
  force: true
8173
8173
  });
8174
- fs$1.mkdirSync(path$1.dirname(dst), { recursive: true });
8175
- fs$1.cpSync(src, dst, {
8174
+ fs.mkdirSync(path$1.dirname(dst), { recursive: true });
8175
+ fs.cpSync(src, dst, {
8176
8176
  recursive: true,
8177
8177
  dereference: true
8178
8178
  });
@@ -8207,7 +8207,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
8207
8207
  */
8208
8208
  function copyBundledNativeModules(sourceDir, targetDir, logger) {
8209
8209
  const srcNm = path$1.join(sourceDir, "node_modules");
8210
- if (!fs$1.existsSync(srcNm)) return;
8210
+ if (!fs.existsSync(srcNm)) return;
8211
8211
  const dstNm = path$1.join(targetDir, "node_modules");
8212
8212
  for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
8213
8213
  copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
@@ -8215,7 +8215,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
8215
8215
  const scopeSrc = path$1.join(srcNm, scope);
8216
8216
  let siblings;
8217
8217
  try {
8218
- siblings = fs$1.readdirSync(scopeSrc);
8218
+ siblings = fs.readdirSync(scopeSrc);
8219
8219
  } catch {
8220
8220
  continue;
8221
8221
  }
@@ -8225,12 +8225,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
8225
8225
  }
8226
8226
  /** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
8227
8227
  function hasBuiltBinary(pkgDir) {
8228
- if (!fs$1.existsSync(path$1.join(pkgDir, "package.json"))) return false;
8228
+ if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
8229
8229
  const releaseDir = path$1.join(pkgDir, "build", "Release");
8230
8230
  try {
8231
- if (fs$1.existsSync(releaseDir) && fs$1.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
8231
+ if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
8232
8232
  } catch {}
8233
- return fs$1.existsSync(path$1.join(pkgDir, "prebuilds"));
8233
+ return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
8234
8234
  }
8235
8235
  /** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
8236
8236
  function candidateHoistedDirs(name, addonDir) {
@@ -8268,7 +8268,7 @@ function hashDeclaration(deps) {
8268
8268
  }
8269
8269
  function markerMatches(markerFile, expected) {
8270
8270
  try {
8271
- return fs$1.readFileSync(markerFile, "utf-8").trim() === expected;
8271
+ return fs.readFileSync(markerFile, "utf-8").trim() === expected;
8272
8272
  } catch {
8273
8273
  return false;
8274
8274
  }
@@ -8375,7 +8375,7 @@ function parseInstallSource(value) {
8375
8375
  function readPackageJson(pkgJsonPath) {
8376
8376
  let raw;
8377
8377
  try {
8378
- raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
8378
+ raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
8379
8379
  } catch {
8380
8380
  return null;
8381
8381
  }
@@ -8417,7 +8417,7 @@ function shouldSkipClosureProvidedSeed(packageName, isResolvable) {
8417
8417
  var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
8418
8418
  function readInstalledPackageVersion(addonDir) {
8419
8419
  try {
8420
- const raw = JSON.parse(fs$1.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
8420
+ const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
8421
8421
  if (raw === null || typeof raw !== "object") return null;
8422
8422
  const version = Reflect.get(raw, "version");
8423
8423
  return typeof version === "string" && version.length > 0 ? version : null;
@@ -8558,7 +8558,7 @@ var AddonInstaller = class AddonInstaller {
8558
8558
  } catch {
8559
8559
  return Object.freeze([]);
8560
8560
  }
8561
- const raw = fs$1.readFileSync(pkgPath, "utf-8");
8561
+ const raw = fs.readFileSync(pkgPath, "utf-8");
8562
8562
  const parsed = JSON.parse(raw);
8563
8563
  const deps = Object.keys(parsed.dependencies ?? {});
8564
8564
  const agentOnly = new Set(parsed.camstack?.agentOnlyBootstrapAddons ?? []);
@@ -8603,7 +8603,7 @@ var AddonInstaller = class AddonInstaller {
8603
8603
  } catch {
8604
8604
  return Object.freeze([]);
8605
8605
  }
8606
- const raw = fs$1.readFileSync(pkgPath, "utf-8");
8606
+ const raw = fs.readFileSync(pkgPath, "utf-8");
8607
8607
  const addons = JSON.parse(raw).camstack?.agentBootstrapAddons ?? [];
8608
8608
  return Object.freeze(["@camstack/server", ...addons]);
8609
8609
  }
@@ -8633,7 +8633,7 @@ var AddonInstaller = class AddonInstaller {
8633
8633
  this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
8634
8634
  for (const packageName of pkgList) {
8635
8635
  const addonDir = path$1.join(this.addonsDir, packageName);
8636
- if (fs$1.existsSync(path$1.join(addonDir, "package.json"))) {
8636
+ if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
8637
8637
  if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
8638
8638
  this.logger.debug(`${packageName} — already installed, skipping`);
8639
8639
  continue;
@@ -8777,7 +8777,7 @@ var AddonInstaller = class AddonInstaller {
8777
8777
  const installedPackages = this.listInstalled();
8778
8778
  for (const pkg of installedPackages) {
8779
8779
  try {
8780
- if (fs$1.lstatSync(pkg.dir).isSymbolicLink()) continue;
8780
+ if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
8781
8781
  } catch {
8782
8782
  continue;
8783
8783
  }
@@ -8817,7 +8817,7 @@ var AddonInstaller = class AddonInstaller {
8817
8817
  if (closureNodeModules !== null) for (const link of state.existingLinks) {
8818
8818
  if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
8819
8819
  const linkDir = path$1.join(nodeModulesDir, link.name);
8820
- const targetManifest = fs$1.existsSync(path$1.join(linkDir, "package.json"));
8820
+ const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
8821
8821
  const ranges = state.requirements.get(link.name) ?? [];
8822
8822
  let holds = targetManifest;
8823
8823
  if (holds && ranges.length > 0) {
@@ -8826,14 +8826,14 @@ var AddonInstaller = class AddonInstaller {
8826
8826
  }
8827
8827
  if (!holds) {
8828
8828
  this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
8829
- fs$1.rmSync(linkDir, { force: true });
8829
+ fs.rmSync(linkDir, { force: true });
8830
8830
  needsInstall = true;
8831
8831
  }
8832
8832
  }
8833
8833
  const linked = [];
8834
8834
  for (const [depName, range] of declaredEntries) {
8835
8835
  if (typeof range !== "string") continue;
8836
- if (fs$1.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
8836
+ if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
8837
8837
  const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
8838
8838
  if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
8839
8839
  if (executeClosureDedupe(addonDir, closureNodeModules, {
@@ -8866,7 +8866,7 @@ var AddonInstaller = class AddonInstaller {
8866
8866
  const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
8867
8867
  if (closureNodeModules !== null) {
8868
8868
  const state = collectAddonTreeState(addonDir);
8869
- for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs$1.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
8869
+ for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
8870
8870
  }
8871
8871
  this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
8872
8872
  await runNpm([
@@ -8911,7 +8911,7 @@ var AddonInstaller = class AddonInstaller {
8911
8911
  async realignFromClosure(packageName, closureDir) {
8912
8912
  const targetDir = path$1.join(this.addonsDir, packageName);
8913
8913
  const result = await this.installLocal(packageName, closureDir);
8914
- await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
8914
+ await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
8915
8915
  this.manifest.upsert(result.name, {
8916
8916
  version: result.version,
8917
8917
  source: "closure"
@@ -8927,17 +8927,17 @@ var AddonInstaller = class AddonInstaller {
8927
8927
  async installCopy(packageName, sourceDir, pkgData, targetDir) {
8928
8928
  await this.ensureBuilt(packageName, sourceDir, pkgData);
8929
8929
  const distDir = path$1.join(sourceDir, "dist");
8930
- if (!fs$1.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
8931
- await fs$1.promises.rm(targetDir, {
8930
+ if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
8931
+ await fs.promises.rm(targetDir, {
8932
8932
  recursive: true,
8933
8933
  force: true
8934
8934
  });
8935
8935
  ensureDir(targetDir);
8936
- await fs$1.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
8936
+ await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
8937
8937
  await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
8938
8938
  await copyExtraFileDirs(pkgData, sourceDir, targetDir);
8939
8939
  copyBundledNativeModules(sourceDir, targetDir, this.logger);
8940
- await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
8940
+ await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
8941
8941
  const localPkgVersion = asString$1(pkgData.version, "0.0.0");
8942
8942
  this.manifest.upsert(packageName, {
8943
8943
  version: localPkgVersion,
@@ -8978,7 +8978,7 @@ var AddonInstaller = class AddonInstaller {
8978
8978
  * unusual auth, offline mode, etc).
8979
8979
  */
8980
8980
  async installFromNpm(packageName, version) {
8981
- const tmpDir = fs$1.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
8981
+ const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
8982
8982
  const packageSpec = version ? `${packageName}@${version}` : packageName;
8983
8983
  this.logger.info(`${packageName} — installing from npm`);
8984
8984
  try {
@@ -8992,19 +8992,19 @@ var AddonInstaller = class AddonInstaller {
8992
8992
  ];
8993
8993
  if (this.registry) args.push("--registry", this.registry);
8994
8994
  const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
8995
- const tgzFiles = fs$1.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
8995
+ const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
8996
8996
  if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
8997
8997
  return path$1.join(tmpDir, tgzFiles[0]);
8998
8998
  });
8999
8999
  const result = await this.installFromTgz(tgzPath);
9000
- fs$1.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
9000
+ fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
9001
9001
  this.manifest.upsert(result.name, {
9002
9002
  version: result.version,
9003
9003
  source: "npm"
9004
9004
  });
9005
9005
  return result;
9006
9006
  } finally {
9007
- fs$1.rmSync(tmpDir, {
9007
+ fs.rmSync(tmpDir, {
9008
9008
  recursive: true,
9009
9009
  force: true
9010
9010
  });
@@ -9042,7 +9042,7 @@ var AddonInstaller = class AddonInstaller {
9042
9042
  if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
9043
9043
  const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
9044
9044
  const buf = Buffer.from(await tarRes.arrayBuffer());
9045
- fs$1.writeFileSync(tgzPath, buf);
9045
+ fs.writeFileSync(tgzPath, buf);
9046
9046
  return tgzPath;
9047
9047
  }
9048
9048
  /**
@@ -9063,7 +9063,7 @@ var AddonInstaller = class AddonInstaller {
9063
9063
  * on the next deploy.
9064
9064
  */
9065
9065
  async evictInstallDir(targetDir) {
9066
- if (!fs$1.existsSync(targetDir)) return;
9066
+ if (!fs.existsSync(targetDir)) return;
9067
9067
  const graveyard = path$1.join(this.addonsDir, ".evicting");
9068
9068
  ensureDir(graveyard);
9069
9069
  await this.sweepGraveyard(graveyard);
@@ -9071,10 +9071,10 @@ var AddonInstaller = class AddonInstaller {
9071
9071
  const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
9072
9072
  const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
9073
9073
  try {
9074
- fs$1.renameSync(targetDir, asideDir);
9074
+ fs.renameSync(targetDir, asideDir);
9075
9075
  } catch (renameErr) {
9076
9076
  if (renameErr.code === "EXDEV") {
9077
- await fs$1.promises.rm(targetDir, {
9077
+ await fs.promises.rm(targetDir, {
9078
9078
  recursive: true,
9079
9079
  force: true
9080
9080
  });
@@ -9082,7 +9082,7 @@ var AddonInstaller = class AddonInstaller {
9082
9082
  }
9083
9083
  throw renameErr;
9084
9084
  }
9085
- await fs$1.promises.rm(asideDir, {
9085
+ await fs.promises.rm(asideDir, {
9086
9086
  recursive: true,
9087
9087
  force: true
9088
9088
  }).catch((cleanupErr) => {
@@ -9103,14 +9103,14 @@ var AddonInstaller = class AddonInstaller {
9103
9103
  async sweepStagingResidue(stagingRoot) {
9104
9104
  let names;
9105
9105
  try {
9106
- names = fs$1.readdirSync(stagingRoot);
9106
+ names = fs.readdirSync(stagingRoot);
9107
9107
  } catch {
9108
9108
  return;
9109
9109
  }
9110
9110
  const now = Date.now();
9111
9111
  const ages = [];
9112
9112
  for (const name of names) try {
9113
- const stat = fs$1.statSync(path$1.join(stagingRoot, name));
9113
+ const stat = fs.statSync(path$1.join(stagingRoot, name));
9114
9114
  ages.push({
9115
9115
  name,
9116
9116
  ageMs: now - stat.mtimeMs
@@ -9121,7 +9121,7 @@ var AddonInstaller = class AddonInstaller {
9121
9121
  stagingRoot,
9122
9122
  entries: sweepable
9123
9123
  } });
9124
- await Promise.all(sweepable.map((name) => fs$1.promises.rm(path$1.join(stagingRoot, name), {
9124
+ await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
9125
9125
  recursive: true,
9126
9126
  force: true
9127
9127
  }).catch(() => void 0)));
@@ -9130,11 +9130,11 @@ var AddonInstaller = class AddonInstaller {
9130
9130
  async sweepGraveyard(graveyard) {
9131
9131
  let entries;
9132
9132
  try {
9133
- entries = fs$1.readdirSync(graveyard);
9133
+ entries = fs.readdirSync(graveyard);
9134
9134
  } catch {
9135
9135
  return;
9136
9136
  }
9137
- await Promise.all(entries.map((name) => fs$1.promises.rm(path$1.join(graveyard, name), {
9137
+ await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
9138
9138
  recursive: true,
9139
9139
  force: true
9140
9140
  }).catch(() => void 0)));
@@ -9185,7 +9185,7 @@ var AddonInstaller = class AddonInstaller {
9185
9185
  return;
9186
9186
  }
9187
9187
  const strippedManifest = stripBundledDeps(pkgView.raw);
9188
- await fs$1.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
9188
+ await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
9189
9189
  const deps = asJsonObject$1(strippedManifest["dependencies"]);
9190
9190
  const depNames = deps ? Object.keys(deps) : [];
9191
9191
  if (depNames.length === 0) return;
@@ -9317,9 +9317,9 @@ var AddonInstaller = class AddonInstaller {
9317
9317
  "-C",
9318
9318
  stagingDir
9319
9319
  ], { timeout: 12e4 });
9320
- const pkgDir = fs$1.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
9320
+ const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
9321
9321
  const pkgJsonPath = path$1.join(pkgDir, "package.json");
9322
- if (!fs$1.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
9322
+ if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
9323
9323
  const pkgView = readPackageJson(pkgJsonPath);
9324
9324
  if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
9325
9325
  if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
@@ -9329,7 +9329,7 @@ var AddonInstaller = class AddonInstaller {
9329
9329
  this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
9330
9330
  await this.evictInstallDir(targetDir);
9331
9331
  ensureDir(path$1.dirname(targetDir));
9332
- await fs$1.promises.rename(pkgDir, targetDir);
9332
+ await fs.promises.rename(pkgDir, targetDir);
9333
9333
  this.manifest.upsert(pkgView.name, {
9334
9334
  version: pkgView.version,
9335
9335
  source: "bundled"
@@ -9340,7 +9340,7 @@ var AddonInstaller = class AddonInstaller {
9340
9340
  };
9341
9341
  } finally {
9342
9342
  this.inFlightStaging.delete(stagingName);
9343
- await fs$1.promises.rm(stagingDir, {
9343
+ await fs.promises.rm(stagingDir, {
9344
9344
  recursive: true,
9345
9345
  force: true
9346
9346
  }).catch(() => void 0);
@@ -9370,24 +9370,24 @@ var AddonInstaller = class AddonInstaller {
9370
9370
  const current = this.manifest.get(packageName);
9371
9371
  if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
9372
9372
  const addonDir = path$1.join(this.addonsDir, packageName);
9373
- if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
9373
+ if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
9374
9374
  const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
9375
9375
  const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
9376
9376
  ensureDir(backupRoot);
9377
9377
  const backupDir = path$1.join(backupRoot, ts);
9378
9378
  this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
9379
- fs$1.renameSync(addonDir, backupDir);
9379
+ fs.renameSync(addonDir, backupDir);
9380
9380
  let result;
9381
9381
  try {
9382
9382
  result = await this.installFromNpm(packageName, version);
9383
9383
  } catch (installErr) {
9384
9384
  this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
9385
9385
  try {
9386
- if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
9386
+ if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
9387
9387
  recursive: true,
9388
9388
  force: true
9389
9389
  });
9390
- fs$1.renameSync(backupDir, addonDir);
9390
+ fs.renameSync(backupDir, addonDir);
9391
9391
  this.manifest.upsert(packageName, {
9392
9392
  version: current.version,
9393
9393
  source: current.source,
@@ -9448,7 +9448,7 @@ var AddonInstaller = class AddonInstaller {
9448
9448
  const current = this.manifest.get(packageName);
9449
9449
  if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
9450
9450
  const addonDir = path$1.join(this.addonsDir, packageName);
9451
- if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
9451
+ if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
9452
9452
  await this.installRuntimeDependencies(stagedPath, packageName);
9453
9453
  await this.installNativeDependencies(stagedPath, packageName);
9454
9454
  this.dedupeTreeAgainstClosure(stagedPath, packageName);
@@ -9457,14 +9457,14 @@ var AddonInstaller = class AddonInstaller {
9457
9457
  ensureDir(backupRoot);
9458
9458
  const backupDir = path$1.join(backupRoot, ts);
9459
9459
  this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
9460
- fs$1.renameSync(addonDir, backupDir);
9460
+ fs.renameSync(addonDir, backupDir);
9461
9461
  try {
9462
9462
  try {
9463
- fs$1.renameSync(stagedPath, addonDir);
9463
+ fs.renameSync(stagedPath, addonDir);
9464
9464
  } catch (renameErr) {
9465
9465
  if (renameErr.code === "EXDEV") {
9466
- fs$1.cpSync(stagedPath, addonDir, { recursive: true });
9467
- fs$1.rmSync(stagedPath, {
9466
+ fs.cpSync(stagedPath, addonDir, { recursive: true });
9467
+ fs.rmSync(stagedPath, {
9468
9468
  recursive: true,
9469
9469
  force: true
9470
9470
  });
@@ -9473,11 +9473,11 @@ var AddonInstaller = class AddonInstaller {
9473
9473
  } catch (swapErr) {
9474
9474
  this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
9475
9475
  try {
9476
- if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
9476
+ if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
9477
9477
  recursive: true,
9478
9478
  force: true
9479
9479
  });
9480
- fs$1.renameSync(backupDir, addonDir);
9480
+ fs.renameSync(backupDir, addonDir);
9481
9481
  this.manifest.upsert(packageName, {
9482
9482
  version: current.version,
9483
9483
  source: current.source,
@@ -9516,20 +9516,20 @@ var AddonInstaller = class AddonInstaller {
9516
9516
  this.logger.warn(`${packageName} — no backup to rollback to`);
9517
9517
  return null;
9518
9518
  }
9519
- if (!fs$1.existsSync(entry.lastBackupDir)) {
9519
+ if (!fs.existsSync(entry.lastBackupDir)) {
9520
9520
  this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
9521
9521
  return null;
9522
9522
  }
9523
9523
  const addonDir = path$1.join(this.addonsDir, packageName);
9524
- if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
9524
+ if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
9525
9525
  recursive: true,
9526
9526
  force: true
9527
9527
  });
9528
- fs$1.renameSync(entry.lastBackupDir, addonDir);
9528
+ fs.renameSync(entry.lastBackupDir, addonDir);
9529
9529
  const pkgJsonPath = path$1.join(addonDir, "package.json");
9530
9530
  let restoredVersion = entry.version;
9531
- if (fs$1.existsSync(pkgJsonPath)) try {
9532
- const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
9531
+ if (fs.existsSync(pkgJsonPath)) try {
9532
+ const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
9533
9533
  if (typeof parsed === "object" && parsed != null) {
9534
9534
  const v = parsed.version;
9535
9535
  if (typeof v === "string" && v.length > 0) restoredVersion = v;
@@ -9577,7 +9577,7 @@ var AddonInstaller = class AddonInstaller {
9577
9577
  return false;
9578
9578
  }
9579
9579
  try {
9580
- await fs$1.promises.rm(target, {
9580
+ await fs.promises.rm(target, {
9581
9581
  recursive: true,
9582
9582
  force: true
9583
9583
  });
@@ -9595,7 +9595,7 @@ var AddonInstaller = class AddonInstaller {
9595
9595
  listBackupsFor(packageName) {
9596
9596
  const dir = path$1.join(this.backupsRoot, packageName);
9597
9597
  try {
9598
- return fs$1.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
9598
+ return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
9599
9599
  } catch {
9600
9600
  return [];
9601
9601
  }
@@ -9627,7 +9627,7 @@ var AddonInstaller = class AddonInstaller {
9627
9627
  for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
9628
9628
  if (!this.isInsideBackups(dir)) continue;
9629
9629
  try {
9630
- await fs$1.promises.rmdir(dir);
9630
+ await fs.promises.rmdir(dir);
9631
9631
  } catch {
9632
9632
  return;
9633
9633
  }
@@ -9709,7 +9709,7 @@ var AddonInstaller = class AddonInstaller {
9709
9709
  */
9710
9710
  resolveBackupToKeep(packageName, backups) {
9711
9711
  const liveDir = path$1.join(this.addonsDir, packageName);
9712
- if (!fs$1.existsSync(liveDir)) {
9712
+ if (!fs.existsSync(liveDir)) {
9713
9713
  const newest = backups[backups.length - 1] ?? null;
9714
9714
  if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
9715
9715
  liveDir,
@@ -9726,7 +9726,7 @@ var AddonInstaller = class AddonInstaller {
9726
9726
  listBackedUpPackages() {
9727
9727
  let entries;
9728
9728
  try {
9729
- entries = fs$1.readdirSync(this.backupsRoot, { withFileTypes: true });
9729
+ entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
9730
9730
  } catch {
9731
9731
  return [];
9732
9732
  }
@@ -9738,14 +9738,14 @@ var AddonInstaller = class AddonInstaller {
9738
9738
  continue;
9739
9739
  }
9740
9740
  const scopeDir = path$1.join(this.backupsRoot, entry.name);
9741
- for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
9741
+ for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
9742
9742
  }
9743
9743
  return names;
9744
9744
  }
9745
9745
  async uninstall(packageName) {
9746
9746
  const addonDir = path$1.join(this.addonsDir, packageName);
9747
- if (fs$1.existsSync(addonDir)) {
9748
- fs$1.rmSync(addonDir, {
9747
+ if (fs.existsSync(addonDir)) {
9748
+ fs.rmSync(addonDir, {
9749
9749
  recursive: true,
9750
9750
  force: true
9751
9751
  });
@@ -9753,8 +9753,8 @@ var AddonInstaller = class AddonInstaller {
9753
9753
  return;
9754
9754
  }
9755
9755
  const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
9756
- if (fs$1.existsSync(legacyDir)) {
9757
- fs$1.rmSync(legacyDir, {
9756
+ if (fs.existsSync(legacyDir)) {
9757
+ fs.rmSync(legacyDir, {
9758
9758
  recursive: true,
9759
9759
  force: true
9760
9760
  });
@@ -9762,22 +9762,22 @@ var AddonInstaller = class AddonInstaller {
9762
9762
  }
9763
9763
  }
9764
9764
  listInstalled() {
9765
- if (!fs$1.existsSync(this.addonsDir)) return [];
9765
+ if (!fs.existsSync(this.addonsDir)) return [];
9766
9766
  const packageDirs = [];
9767
- for (const entry of fs$1.readdirSync(this.addonsDir, { withFileTypes: true })) {
9767
+ for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
9768
9768
  if (!isDirEntry(entry, this.addonsDir)) continue;
9769
9769
  if (entry.name.startsWith("@")) {
9770
9770
  const scopeDir = path$1.join(this.addonsDir, entry.name);
9771
- for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
9771
+ for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
9772
9772
  } else packageDirs.push(path$1.join(this.addonsDir, entry.name));
9773
9773
  }
9774
9774
  return packageDirs.map((dir) => {
9775
9775
  const pkgPath = path$1.join(dir, "package.json");
9776
- if (!fs$1.existsSync(pkgPath)) return null;
9776
+ if (!fs.existsSync(pkgPath)) return null;
9777
9777
  const pkg = readPackageJson(pkgPath);
9778
9778
  if (!pkg || !pkg.camstackAddons) return null;
9779
9779
  const sourceFile = path$1.join(dir, ".install-source");
9780
- const installSource = fs$1.existsSync(sourceFile) ? parseInstallSource(fs$1.readFileSync(sourceFile, "utf-8").trim()) : void 0;
9780
+ const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
9781
9781
  return {
9782
9782
  name: pkg.name,
9783
9783
  version: pkg.version,
@@ -9787,13 +9787,13 @@ var AddonInstaller = class AddonInstaller {
9787
9787
  }).filter((item) => item !== null);
9788
9788
  }
9789
9789
  isInstalled(packageName) {
9790
- if (fs$1.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
9791
- return fs$1.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
9790
+ if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
9791
+ return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
9792
9792
  }
9793
9793
  getInstalledPackage(packageName) {
9794
9794
  let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
9795
- if (!fs$1.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
9796
- if (!fs$1.existsSync(pkgPath)) return null;
9795
+ if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
9796
+ if (!fs.existsSync(pkgPath)) return null;
9797
9797
  const pkg = readPackageJson(pkgPath);
9798
9798
  if (!pkg) return null;
9799
9799
  return {
@@ -9812,7 +9812,7 @@ var AddonInstaller = class AddonInstaller {
9812
9812
  ]) {
9813
9813
  const candidate = path$1.join(this.bundledAddonsDir, dirName);
9814
9814
  try {
9815
- const pkg = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
9815
+ const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
9816
9816
  if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
9817
9817
  } catch {}
9818
9818
  }
@@ -9821,7 +9821,7 @@ var AddonInstaller = class AddonInstaller {
9821
9821
  /** Ensure a package is built (dist/ exists and page bundles present) */
9822
9822
  async ensureBuilt(packageName, sourceDir, pkgData) {
9823
9823
  const distDir = path$1.join(sourceDir, "dist");
9824
- if (!(!fs$1.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
9824
+ if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
9825
9825
  this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
9826
9826
  try {
9827
9827
  await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
@@ -9836,7 +9836,7 @@ var AddonInstaller = class AddonInstaller {
9836
9836
  if (!camstack?.addons) return false;
9837
9837
  for (const addon of camstack.addons) {
9838
9838
  if (!addon.pages) continue;
9839
- for (const page of addon.pages) if (page.bundle && !fs$1.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
9839
+ for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
9840
9840
  }
9841
9841
  return false;
9842
9842
  }
@@ -9845,7 +9845,7 @@ var AddonInstaller = class AddonInstaller {
9845
9845
  function isDirEntry(entry, parentDir) {
9846
9846
  if (entry.isDirectory()) return true;
9847
9847
  if (entry.isSymbolicLink()) try {
9848
- return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
9848
+ return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
9849
9849
  } catch {
9850
9850
  return false;
9851
9851
  }
@@ -9944,7 +9944,7 @@ function selectAddonResidue(candidates) {
9944
9944
  }
9945
9945
  function readDeclaredName(dir) {
9946
9946
  try {
9947
- const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
9947
+ const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
9948
9948
  if (typeof parsed !== "object" || parsed === null) return null;
9949
9949
  const name = parsed.name;
9950
9950
  return typeof name === "string" ? name : null;
@@ -9954,7 +9954,7 @@ function readDeclaredName(dir) {
9954
9954
  }
9955
9955
  function readDeclaredVersion(dir) {
9956
9956
  try {
9957
- const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
9957
+ const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
9958
9958
  if (typeof parsed !== "object" || parsed === null) return null;
9959
9959
  const version = parsed.version;
9960
9960
  return typeof version === "string" ? version : null;
@@ -9964,7 +9964,7 @@ function readDeclaredVersion(dir) {
9964
9964
  }
9965
9965
  function isDirLike(p) {
9966
9966
  try {
9967
- return fs$1.statSync(p).isDirectory();
9967
+ return fs.statSync(p).isDirectory();
9968
9968
  } catch {
9969
9969
  return false;
9970
9970
  }
@@ -9974,7 +9974,7 @@ function freeQuarantineTarget(store, scope, dirName) {
9974
9974
  const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
9975
9975
  let candidate = path$1.join(store, base);
9976
9976
  let n = 1;
9977
- while (fs$1.existsSync(candidate)) {
9977
+ while (fs.existsSync(candidate)) {
9978
9978
  candidate = path$1.join(store, `${base}-${n}`);
9979
9979
  n += 1;
9980
9980
  }
@@ -9991,7 +9991,7 @@ function freeQuarantineTarget(store, scope, dirName) {
9991
9991
  function quarantineAddonResidue(addonsDir, log) {
9992
9992
  const quarantined = [];
9993
9993
  const failed = [];
9994
- if (!fs$1.existsSync(addonsDir)) return {
9994
+ if (!fs.existsSync(addonsDir)) return {
9995
9995
  quarantined,
9996
9996
  failed
9997
9997
  };
@@ -9999,7 +9999,7 @@ function quarantineAddonResidue(addonsDir, log) {
9999
9999
  const scan = (parent, scope) => {
10000
10000
  let names;
10001
10001
  try {
10002
- names = fs$1.readdirSync(parent);
10002
+ names = fs.readdirSync(parent);
10003
10003
  } catch {
10004
10004
  return;
10005
10005
  }
@@ -10018,8 +10018,8 @@ function quarantineAddonResidue(addonsDir, log) {
10018
10018
  const version = readDeclaredVersion(full);
10019
10019
  const to = freeQuarantineTarget(store, scope, dirName);
10020
10020
  try {
10021
- fs$1.mkdirSync(store, { recursive: true });
10022
- fs$1.renameSync(full, to);
10021
+ fs.mkdirSync(store, { recursive: true });
10022
+ fs.renameSync(full, to);
10023
10023
  } catch (err) {
10024
10024
  const error = err instanceof Error ? err.message : String(err);
10025
10025
  failed.push({
@@ -10077,11 +10077,11 @@ function getRestartMarkerPath(dataDir) {
10077
10077
  * intact or no marker at all (never a half-written file).
10078
10078
  */
10079
10079
  function writePendingRestart(dataDir, marker) {
10080
- fs$1.mkdirSync(dataDir, { recursive: true });
10080
+ fs.mkdirSync(dataDir, { recursive: true });
10081
10081
  const markerPath = getRestartMarkerPath(dataDir);
10082
10082
  const tmpPath = `${markerPath}.tmp`;
10083
- fs$1.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
10084
- fs$1.renameSync(tmpPath, markerPath);
10083
+ fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
10084
+ fs.renameSync(tmpPath, markerPath);
10085
10085
  }
10086
10086
  /**
10087
10087
  * Read + consume the marker. Returns the parsed payload on success and
@@ -10106,10 +10106,10 @@ function writePendingRestart(dataDir, marker) {
10106
10106
  */
10107
10107
  function readPendingRestart(dataDir) {
10108
10108
  const markerPath = getRestartMarkerPath(dataDir);
10109
- if (!fs$1.existsSync(markerPath)) return null;
10109
+ if (!fs.existsSync(markerPath)) return null;
10110
10110
  let raw;
10111
10111
  try {
10112
- raw = fs$1.readFileSync(markerPath, "utf-8");
10112
+ raw = fs.readFileSync(markerPath, "utf-8");
10113
10113
  } catch (err) {
10114
10114
  console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
10115
10115
  return null;
@@ -10148,7 +10148,7 @@ function readPendingRestart(dataDir) {
10148
10148
  /** Remove the marker if present. No-op if missing. */
10149
10149
  function clearPendingRestart(dataDir) {
10150
10150
  const markerPath = getRestartMarkerPath(dataDir);
10151
- fs$1.rmSync(markerPath, { force: true });
10151
+ fs.rmSync(markerPath, { force: true });
10152
10152
  }
10153
10153
  function isRestartKind(value) {
10154
10154
  return value === "framework-update" || value === "manual" || value === "system";
@@ -10160,7 +10160,7 @@ function scheduleSelfRestart(options = {}) {
10160
10160
  const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
10161
10161
  if (touchTarget !== void 0 && touchTarget.length > 0) try {
10162
10162
  const now = /* @__PURE__ */ new Date();
10163
- fs$1.utimesSync(touchTarget, now, now);
10163
+ fs.utimesSync(touchTarget, now, now);
10164
10164
  return;
10165
10165
  } catch (err) {
10166
10166
  console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
@@ -14524,11 +14524,11 @@ function applyEnvOverrides(raw) {
14524
14524
  return result;
14525
14525
  }
14526
14526
  function loadYaml(configPath) {
14527
- if (!fs$1.existsSync(configPath)) {
14527
+ if (!fs.existsSync(configPath)) {
14528
14528
  console.warn(`[ConfigManager] Config file not found at: ${configPath}\n → Using built-in defaults. Set CONFIG_PATH env var or create the file.\n → Example path from project root: ./server/backend/data/config.yaml`);
14529
14529
  return {};
14530
14530
  }
14531
- const parsed = load(fs$1.readFileSync(configPath, "utf-8")) ?? {};
14531
+ const parsed = load(fs.readFileSync(configPath, "utf-8")) ?? {};
14532
14532
  console.log(`[ConfigManager] Loaded config from: ${configPath}`);
14533
14533
  return parsed;
14534
14534
  }
@@ -22683,7 +22683,7 @@ async function probeVaapiInit(renderNode) {
22683
22683
  */
22684
22684
  function safeExistsSync(path) {
22685
22685
  try {
22686
- return fs$1.existsSync(path);
22686
+ return fs.existsSync(path);
22687
22687
  } catch {
22688
22688
  return false;
22689
22689
  }
@@ -22702,11 +22702,11 @@ function probeLinuxGpus() {
22702
22702
  if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
22703
22703
  try {
22704
22704
  const drmDir = "/sys/class/drm";
22705
- if (fs$1.existsSync(drmDir)) for (const entry of fs$1.readdirSync(drmDir)) {
22705
+ if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
22706
22706
  if (!entry.startsWith("card")) continue;
22707
22707
  const vendorPath = `${drmDir}/${entry}/device/vendor`;
22708
22708
  if (!safeExistsSync(vendorPath)) continue;
22709
- const vendor = fs$1.readFileSync(vendorPath, "utf8").trim().toLowerCase();
22709
+ const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
22710
22710
  if (vendor === "0x10de") signals.hasNvidiaGpu = true;
22711
22711
  else if (vendor === "0x1002") signals.hasAmdGpu = true;
22712
22712
  else if (vendor === "0x8086") signals.hasIntelGpu = true;
@@ -22924,21 +22924,21 @@ function sleep$1(ms) {
22924
22924
  * crashed holder) is stolen.
22925
22925
  */
22926
22926
  async function withFileLock(lockPath, fn) {
22927
- fs$1.mkdirSync(join(lockPath, ".."), { recursive: true });
22927
+ fs.mkdirSync(join(lockPath, ".."), { recursive: true });
22928
22928
  for (;;) try {
22929
- const fd = fs$1.openSync(lockPath, "wx");
22930
- fs$1.closeSync(fd);
22929
+ const fd = fs.openSync(lockPath, "wx");
22930
+ fs.closeSync(fd);
22931
22931
  break;
22932
22932
  } catch {
22933
22933
  try {
22934
- if (Date.now() - fs$1.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs$1.rmSync(lockPath, { force: true });
22934
+ if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
22935
22935
  else await sleep$1(LOCK_POLL_MS);
22936
22936
  } catch {}
22937
22937
  }
22938
22938
  try {
22939
22939
  return await fn();
22940
22940
  } finally {
22941
- fs$1.rmSync(lockPath, { force: true });
22941
+ fs.rmSync(lockPath, { force: true });
22942
22942
  }
22943
22943
  }
22944
22944
  /** Coalesce in-process + serialize cross-process for one binary id. */
@@ -22996,7 +22996,7 @@ var AddonDepsManager = class {
22996
22996
  * failed or tampered download throws, and provisioning reports it.
22997
22997
  */
22998
22998
  async stageNativeDepsDeclaredBy(requirementsFile) {
22999
- if (!declaresEdgetpuDelegate(fs$1.readFileSync(requirementsFile, "utf8"))) return;
22999
+ if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
23000
23000
  await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
23001
23001
  }
23002
23002
  getDepsDir() {
@@ -24027,7 +24027,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
24027
24027
  const addonId = declaration.id;
24028
24028
  const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
24029
24029
  const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
24030
- fs$1.mkdirSync(addonDataDir, { recursive: true });
24030
+ fs.mkdirSync(addonDataDir, { recursive: true });
24031
24031
  if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
24032
24032
  const regs = getRegistries(nodeId);
24033
24033
  const workerResolver = {
@@ -25832,7 +25832,7 @@ var FailedRunnerRetryLedger = class {
25832
25832
  function readRunnerPackageVersions(addonDirs) {
25833
25833
  const out = {};
25834
25834
  for (const dir of addonDirs) try {
25835
- const raw = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
25835
+ const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
25836
25836
  const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
25837
25837
  out[dir] = typeof version === "string" && version.length > 0 ? version : null;
25838
25838
  } catch {
@@ -25893,7 +25893,7 @@ function readAddonHeapDeclaration(spec) {
25893
25893
  if (cached !== void 0) return cached;
25894
25894
  let declaration = EMPTY_HEAP_DECLARATION;
25895
25895
  for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
25896
- const raw = fs$1.readFileSync(manifestPath, "utf8");
25896
+ const raw = fs.readFileSync(manifestPath, "utf8");
25897
25897
  const parsed = JSON.parse(raw);
25898
25898
  const profile = extractHeapProfile(parsed, spec.addonId);
25899
25899
  const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
@@ -27115,17 +27115,17 @@ var JobJournal = class {
27115
27115
  return path$1.join(this.jobsDir, `${id}.json`);
27116
27116
  }
27117
27117
  writeAtomic(filePath, data) {
27118
- fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
27118
+ fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
27119
27119
  const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
27120
- fs$1.writeFileSync(tmp, JSON.stringify(data, null, 2), {
27120
+ fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
27121
27121
  encoding: "utf-8",
27122
27122
  mode: 384
27123
27123
  });
27124
- fs$1.renameSync(tmp, filePath);
27124
+ fs.renameSync(tmp, filePath);
27125
27125
  }
27126
27126
  readIndex() {
27127
27127
  try {
27128
- const raw = JSON.parse(fs$1.readFileSync(this.indexPath, "utf-8"));
27128
+ const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
27129
27129
  if (raw && Array.isArray(raw.jobIds)) return {
27130
27130
  version: 1,
27131
27131
  jobIds: raw.jobIds
@@ -27150,7 +27150,7 @@ var JobJournal = class {
27150
27150
  }
27151
27151
  getJob(id) {
27152
27152
  try {
27153
- const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs$1.readFileSync(this.jobPath(id), "utf-8")));
27153
+ const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
27154
27154
  return parsed.success ? parsed.data : null;
27155
27155
  } catch {
27156
27156
  return null;
@@ -27215,14 +27215,14 @@ var StagingArea = class {
27215
27215
  }
27216
27216
  async fetchAndStage(input) {
27217
27217
  const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
27218
- fs$1.rmSync(destDir, {
27218
+ fs.rmSync(destDir, {
27219
27219
  recursive: true,
27220
27220
  force: true
27221
27221
  });
27222
27222
  const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
27223
27223
  if (input.signal.aborted) throw new Error("staging aborted after fetch");
27224
27224
  await this.deps.extract(tgz, destDir);
27225
- const raw = JSON.parse(fs$1.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
27225
+ const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
27226
27226
  if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
27227
27227
  if (EXACT_SEMVER.test(input.version) && raw.version !== input.version) throw new Error(`staging validation failed: ${input.name} expected version ${input.version}, got ${raw.version}`);
27228
27228
  return {
@@ -27231,7 +27231,7 @@ var StagingArea = class {
27231
27231
  };
27232
27232
  }
27233
27233
  cleanup(jobId) {
27234
- fs$1.rmSync(path$1.join(this.stagingDir, jobId), {
27234
+ fs.rmSync(path$1.join(this.stagingDir, jobId), {
27235
27235
  recursive: true,
27236
27236
  force: true
27237
27237
  });
@@ -27246,13 +27246,13 @@ var StagingArea = class {
27246
27246
  sweepOrphans() {
27247
27247
  let entries;
27248
27248
  try {
27249
- entries = fs$1.readdirSync(this.stagingDir);
27249
+ entries = fs.readdirSync(this.stagingDir);
27250
27250
  } catch {
27251
27251
  return 0;
27252
27252
  }
27253
27253
  let removed = 0;
27254
27254
  for (const name of entries) try {
27255
- fs$1.rmSync(path$1.join(this.stagingDir, name), {
27255
+ fs.rmSync(path$1.join(this.stagingDir, name), {
27256
27256
  recursive: true,
27257
27257
  force: true
27258
27258
  });
@@ -27430,7 +27430,7 @@ var LifecycleJobEngine = class {
27430
27430
  * on failure → `failed`.
27431
27431
  */
27432
27432
  async reconcileJob(job) {
27433
- const exists = this.deps.stagedPathExists ?? ((p) => fs$1.existsSync(p));
27433
+ const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
27434
27434
  for (const task of job.tasks) {
27435
27435
  if (task.target === "framework") {
27436
27436
  if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
@@ -28071,7 +28071,7 @@ var CatalogRegistry = class {
28071
28071
  const file = path$1.join(packageDir, "i18n", `${lang}.json`);
28072
28072
  let text;
28073
28073
  try {
28074
- text = fs$1.readFileSync(file, "utf8");
28074
+ text = fs.readFileSync(file, "utf8");
28075
28075
  } catch {
28076
28076
  continue;
28077
28077
  }