@dominevo/server 0.1.1 → 0.1.2

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.
@@ -12,7 +12,7 @@ import { s as loadPrefixed } from "./named-entity-store-CLIUOHkl.mjs";
12
12
  import { a as AGENT_MDNS_TXT_KEYS, i as AGENT_MDNS_SERVICE_TYPE } from "./network-access.cap-DcLn1v6p.mjs";
13
13
  import { t as RUNTIME_DEFAULTS } from "./constants-DCLpoF4L.mjs";
14
14
  import { t as bareAddonId } from "./addon-id-CVg1_r5E.mjs";
15
- import { r as nodeCoralFs, s as supportedRuntimes, t as classifyCoralAccelerator } from "./coral-accelerators-CSu5Ahx5.mjs";
15
+ import { r as nodeCoralFs, s as supportedRuntimes, t as classifyCoralAccelerator } from "./coral-accelerators-DXDOGcym.mjs";
16
16
  import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-Du6rfexI.mjs";
17
17
  import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
18
18
  import { a as redactLogText, i as redactLogMeta, r as redactLogEntry, t as isCredentialKeyName } from "./log-redactor-B6FjCuXc.mjs";
@@ -46,22 +46,22 @@ import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.a
46
46
  import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
47
47
  import { StorageOrchestratorAddon, a as createHubCapForwardService, i as HUB_CAP_FWD_SERVICE, o as stripForwardedCaller, r as HUB_CAP_FWD_ACTION, s as buildStorageLocationRegistry, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
48
48
  import "./builtins/storage-orchestrator/index.mjs";
49
- import { A as evaluateExistingCert, B as AGENT_HTTPS_NAMES_COLLECTION, C as localCaCommonName, D as LEAF_RENEWAL_WINDOW_DAYS, E as CA_VALIDITY_DAYS, F as isConstrainedCa, H as AgentHttpsNames, I as isLocalOnlyHostname, L as permitsIdentity, M as PERMITTED_DNS_SUFFIXES, N as PERMITTED_IP_RANGES, O as MAX_LEAF_VALIDITY_DAYS, P as buildNameConstraintSet, R as permitsName, T as systemHostFacts, U as getProcessAgentHttpsNames, V as AGENT_HTTPS_NAMES_COLUMNS, W as setProcessAgentHttpsNames, _ as pemDigest, a as AgentHttpsInstallError, c as certificateNames, d as describeHttpsLeaf, f as installAgentHttps, g as loadAgentHttps, h as issueAgentHttpsLeaf, i as loadOrCreateHubId, k as SERVER_AUTH_OID, l as collectAgentNames, m as isPrivateAddress, n as HUB_IDENTITY_RELATIVE, o as acceptAgentSans, p as isContainerBridgeAddress, r as isAnnouncedHubId, s as agentHttpsPaths, t as HUB_IDENTITY_FILE, u as createAgentHttpsRequest, v as pinnedHttpsCaFingerprint, w as collectCertIdentity, y as CA_COMMON_NAME, z as readNameConstraints } from "./hub-identity-C1lUxisZ.mjs";
49
+ import { A as evaluateExistingCert, B as AGENT_HTTPS_NAMES_COLLECTION, C as localCaCommonName, D as LEAF_RENEWAL_WINDOW_DAYS, E as CA_VALIDITY_DAYS, F as isConstrainedCa, H as AgentHttpsNames, I as isLocalOnlyHostname, L as permitsIdentity, M as PERMITTED_DNS_SUFFIXES, N as PERMITTED_IP_RANGES, O as MAX_LEAF_VALIDITY_DAYS, P as buildNameConstraintSet, R as permitsName, T as systemHostFacts, U as getProcessAgentHttpsNames, V as AGENT_HTTPS_NAMES_COLUMNS, W as setProcessAgentHttpsNames, _ as pemDigest, a as AgentHttpsInstallError, c as certificateNames, d as describeHttpsLeaf, f as installAgentHttps, g as loadAgentHttps, h as issueAgentHttpsLeaf, i as loadOrCreateHubId, k as SERVER_AUTH_OID, l as collectAgentNames, m as isPrivateAddress, n as HUB_IDENTITY_RELATIVE, o as acceptAgentSans, p as isContainerBridgeAddress, r as isAnnouncedHubId, s as agentHttpsPaths, t as HUB_IDENTITY_FILE, u as createAgentHttpsRequest, v as pinnedHttpsCaFingerprint, w as collectCertIdentity, y as CA_COMMON_NAME, z as readNameConstraints } from "./hub-identity-vHr6cT94.mjs";
50
50
  import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-C86EPRS1.mjs";
51
51
  import { $ as getProcessMeshCaState, A as emitProcessNodeRegistered, At as readCidrSetting, B as getProcessMeshTlsListenerState, C as verifyMembershipAnswer, Ct as isInsecureOrigin, D as ServiceBroker, Dt as createCidrMatcher, E as Errors, Et as readOriginSetting, F as onProcessNodeRegistered, G as MeshCertificateRegistry, H as setProcessMeshTlsListenerState, I as setProcessMeshHandshakeReporter, J as getProcessMeshCertificateRegistry, K as RENEWAL_ABANDONED, L as setProcessMeshPeerTransportLookup, M as getProcessNodeMeshTransport, N as getProcessPeerLeaf, O as setProcessMeshTlsEnabler, Ot as normalizeIp, P as isProcessVerifiedMeshPeer, Q as MeshCaKeeper, R as renewMeshCertificate, S as signMembershipProof, St as OPAQUE_ORIGIN, SystemConfigAddon, T as TlsTcpTransporter, Tt as parseOriginList, U as MESH_NODE_CERTIFICATES_COLLECTION, V as openMeshTlsWhenRevocationsLoaded, W as MESH_NODE_CERTIFICATES_COLUMNS, X as MeshCrl, Y as setProcessMeshCertificateRegistry, Z as processMeshCrl, _ as keyFingerprintShort, _t as isAllowedAgentDashboardReturnTo, a as dialableHubHost, at as generateMeshCa, b as MEMBERSHIP_PATHS, bt as verifyAgentUiUnlockTicket, c as PAIRING_MAX_CODE_ATTEMPTS, ct as issueMeshLeafForNode, d as PAIRING_PIN_DIGITS, dt as AGENT_DASHBOARD_ORIGINS_FIELD, et as requireProcessMeshCa, f as PAIRING_PROTOCOL, ft as AGENT_UI_UNLOCK_TTL_MS, g as describeCsr, gt as UnlockTicketJtiStore, h as computePairingSas, ht as AGENT_UI_UNLOCK_VERSION, i as AgentPairing, it as exportMeshPrivateKeyPem, j as getProcessMeshHandshakeReporter, k as dropProcessPeer, kt as parseCidrList, l as PAIRING_MAX_SESSIONS, lt as issueMeshLeafFromCsr, m as computePairingCommitment, mt as AGENT_UI_UNLOCK_USE, n as HubPairing, nt as caFingerprintCompact, o as hubHostFromMeshAddress, ot as generateMeshKeyPair, p as PAIRING_TTL_MS, pt as AGENT_UI_UNLOCK_TYP, q as describeMeshLeaf, r as PairingHttpError, rt as createMeshCsrPem, s as PAIRING_CODE_DIGITS, st as isValidAgentNodeId, tt as caFingerprint, u as PAIRING_PATHS, ut as loadMeshCa, v as signPairingProof, vt as mintAgentUiUnlockTicket, w as MESH_TLS_PORT_HELLO_FIELD, wt as normalizeOrigin, x as MembershipResponder, xt as InvalidCorsOriginError, y as verifyPairingProof, yt as parseAgentDashboardOrigins, z as revokeMeshCertificate } from "./builtins/system-config/system-config.addon.mjs";
52
52
  import "./builtins/system-config/index.mjs";
53
53
  import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
54
- 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-BklzKCJe.mjs";
55
- 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-D5Udd2A_.mjs";
54
+ 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-Ci7Lw1TM.mjs";
55
+ 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-CK1Y4z73.mjs";
56
56
  import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-vw43KkgD.mjs";
57
57
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
58
- 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-DngNk5Yg.mjs";
58
+ 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-CyUiUvKj.mjs";
59
59
  import { z } from "zod";
60
60
  import { PYTHON_VERSION, buildBinaryPath, declaresEdgetpuDelegate, downloadBinary, ensureBinary, ensureBinary as ensureBinary$1, ensureEdgetpuDelegate, ensureFfmpeg, ensureFfmpeg as ensureFfmpeg$1, ensurePython, ensurePython as ensurePython$1, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, implementedMethodsOf, installPythonPackages, installPythonPackages as installPythonPackages$1, installPythonRequirements, installPythonRequirements as installPythonRequirements$1 } from "@dominevo/types/node";
61
61
  import * as crypto$1 from "node:crypto";
62
62
  import { createHash, randomBytes, randomUUID } from "node:crypto";
63
63
  import { connect, createConnection, createServer } from "node:net";
64
- import * as fs from "node:fs";
64
+ import * as fs$1 from "node:fs";
65
65
  import { accessSync, constants, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
66
66
  import * as path$1 from "node:path";
67
67
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
@@ -5700,7 +5700,7 @@ var PythonEnvManager = class {
5700
5700
  async ensure(options) {
5701
5701
  const probe = await this.probe();
5702
5702
  if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
5703
- if (!fs.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
5703
+ if (!fs$1.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
5704
5704
  "-m",
5705
5705
  "venv",
5706
5706
  this.venvPath
@@ -5723,7 +5723,7 @@ var PythonEnvManager = class {
5723
5723
  }
5724
5724
  spawn(script, args) {
5725
5725
  const venvPython = path$1.join(this.venvPath, "bin", "python");
5726
- if (!fs.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
5726
+ if (!fs$1.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
5727
5727
  return spawn(venvPython, [script, ...args]);
5728
5728
  }
5729
5729
  };
@@ -6075,20 +6075,20 @@ var StorageManager = class {
6075
6075
  const basePath = this.locationManager.getBackend(mappedName).basePath;
6076
6076
  location.files = {
6077
6077
  async readFile(p) {
6078
- return fs.promises.readFile(path$1.join(basePath, p));
6078
+ return fs$1.promises.readFile(path$1.join(basePath, p));
6079
6079
  },
6080
6080
  async writeFile(p, data) {
6081
6081
  const full = path$1.join(basePath, p);
6082
- await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
6083
- await fs.promises.writeFile(full, data);
6082
+ await fs$1.promises.mkdir(path$1.dirname(full), { recursive: true });
6083
+ await fs$1.promises.writeFile(full, data);
6084
6084
  },
6085
6085
  async deleteFile(p) {
6086
- await fs.promises.rm(path$1.join(basePath, p), { force: true });
6086
+ await fs$1.promises.rm(path$1.join(basePath, p), { force: true });
6087
6087
  },
6088
6088
  async listFiles(prefix) {
6089
6089
  const dir = prefix ? path$1.join(basePath, prefix) : basePath;
6090
6090
  try {
6091
- return (await fs.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
6091
+ return (await fs$1.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
6092
6092
  } catch {
6093
6093
  return [];
6094
6094
  }
@@ -6098,7 +6098,7 @@ var StorageManager = class {
6098
6098
  },
6099
6099
  async exists(p) {
6100
6100
  try {
6101
- await fs.promises.access(path$1.join(basePath, p));
6101
+ await fs$1.promises.access(path$1.join(basePath, p));
6102
6102
  return true;
6103
6103
  } catch {
6104
6104
  return false;
@@ -6548,7 +6548,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
6548
6548
  function hasDotNode(dir, maxDepth) {
6549
6549
  let entries;
6550
6550
  try {
6551
- entries = fs.readdirSync(dir, { withFileTypes: true });
6551
+ entries = fs$1.readdirSync(dir, { withFileTypes: true });
6552
6552
  } catch {
6553
6553
  return false;
6554
6554
  }
@@ -6559,7 +6559,7 @@ function hasDotNode(dir, maxDepth) {
6559
6559
  }
6560
6560
  /** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
6561
6561
  function resolvePrebuildInstallBin(closureDir, moduleDir) {
6562
- 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;
6562
+ 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;
6563
6563
  }
6564
6564
  /**
6565
6565
  * Default fetcher: run the closure's own `prebuild-install` under the CURRENT
@@ -6612,7 +6612,7 @@ async function ensureNativePrebuilds(closureDir, options) {
6612
6612
  const fetched = [];
6613
6613
  for (const pkg of packages) {
6614
6614
  const moduleDir = path$1.join(nm, pkg);
6615
- if (!fs.existsSync(moduleDir)) continue;
6615
+ if (!fs$1.existsSync(moduleDir)) continue;
6616
6616
  if (hasDotNode(moduleDir, 4)) continue;
6617
6617
  options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
6618
6618
  pkg,
@@ -6675,12 +6675,12 @@ async function ensureNativePrebuilds(closureDir, options) {
6675
6675
  function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
6676
6676
  if (!hasNative(srcModuleDir)) return false;
6677
6677
  try {
6678
- fs.rmSync(dstModuleDir, {
6678
+ fs$1.rmSync(dstModuleDir, {
6679
6679
  recursive: true,
6680
6680
  force: true
6681
6681
  });
6682
- fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
6683
- fs.cpSync(srcModuleDir, dstModuleDir, {
6682
+ fs$1.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
6683
+ fs$1.cpSync(srcModuleDir, dstModuleDir, {
6684
6684
  recursive: true,
6685
6685
  dereference: true
6686
6686
  });
@@ -6709,7 +6709,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
6709
6709
  const missing = [];
6710
6710
  for (const pkg of packages) {
6711
6711
  const moduleDir = path$1.join(nm, pkg);
6712
- if (!fs.existsSync(moduleDir)) continue;
6712
+ if (!fs$1.existsSync(moduleDir)) continue;
6713
6713
  if (hasNative(moduleDir)) {
6714
6714
  results.push({
6715
6715
  pkg,
@@ -6808,7 +6808,7 @@ async function defaultDownloadTarball(url, destTgz) {
6808
6808
  const res = await fetch(url);
6809
6809
  if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
6810
6810
  const bytes = Buffer.from(await res.arrayBuffer());
6811
- await fs.promises.writeFile(destTgz, bytes);
6811
+ await fs$1.promises.writeFile(destTgz, bytes);
6812
6812
  }
6813
6813
  async function defaultExtractTarball(tgzPath, destDir) {
6814
6814
  await execFileAsync$5("tar", [
@@ -6894,7 +6894,7 @@ async function resolveUncached(options) {
6894
6894
  argsPrefix: []
6895
6895
  };
6896
6896
  const cliPath = bootstrappedCliPath(options.cacheDir);
6897
- if (fs.existsSync(cliPath)) {
6897
+ if (fs$1.existsSync(cliPath)) {
6898
6898
  options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
6899
6899
  return {
6900
6900
  command: process.execPath,
@@ -6906,12 +6906,12 @@ async function resolveUncached(options) {
6906
6906
  const registry = (options.registry ?? DEFAULT_REGISTRY$1).replace(/\/+$/, "");
6907
6907
  const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
6908
6908
  if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
6909
- await fs.promises.mkdir(options.cacheDir, { recursive: true });
6909
+ await fs$1.promises.mkdir(options.cacheDir, { recursive: true });
6910
6910
  const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
6911
6911
  await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
6912
6912
  await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
6913
- await fs.promises.rm(tgzPath, { force: true });
6914
- if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
6913
+ await fs$1.promises.rm(tgzPath, { force: true });
6914
+ if (!fs$1.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
6915
6915
  options.logger.info("npm bootstrapped", { meta: { cliPath } });
6916
6916
  return {
6917
6917
  command: process.execPath,
@@ -6977,7 +6977,7 @@ function readOwningPackageVersion(entryPath) {
6977
6977
  let dir = path$1.dirname(entryPath);
6978
6978
  for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
6979
6979
  try {
6980
- const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
6980
+ const version = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
6981
6981
  if (typeof version === "string" && version.length > 0) return version;
6982
6982
  } catch {}
6983
6983
  const parent = path$1.dirname(dir);
@@ -7021,14 +7021,14 @@ function readOwningPackageVersion(entryPath) {
7021
7021
  function addonModuleCacheKey(entryPath) {
7022
7022
  let stat;
7023
7023
  try {
7024
- stat = fs.statSync(entryPath);
7024
+ stat = fs$1.statSync(entryPath);
7025
7025
  } catch {
7026
7026
  return null;
7027
7027
  }
7028
7028
  const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
7029
7029
  let content;
7030
7030
  try {
7031
- content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
7031
+ content = createHash("sha1").update(fs$1.readFileSync(entryPath)).digest("hex").slice(0, 16);
7032
7032
  } catch {
7033
7033
  content = `m${stat.mtimeMs}s${stat.size}`;
7034
7034
  }
@@ -7132,14 +7132,14 @@ var AddonLoader = class {
7132
7132
  * BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
7133
7133
  * the addons-dir `@dominevo/server/system` must NOT be double-loaded here. */
7134
7134
  async loadFromDirectory(addonsDir, skipPackages = []) {
7135
- if (!fs.existsSync(addonsDir)) return;
7135
+ if (!fs$1.existsSync(addonsDir)) return;
7136
7136
  const skip = new Set(skipPackages);
7137
- const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
7137
+ const entries = fs$1.readdirSync(addonsDir, { withFileTypes: true });
7138
7138
  for (const entry of entries) {
7139
7139
  if (!isDirectoryEntry(entry, addonsDir)) continue;
7140
7140
  if (entry.name.startsWith("@")) {
7141
7141
  const scopeDir = path$1.join(addonsDir, entry.name);
7142
- const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
7142
+ const scopeEntries = fs$1.readdirSync(scopeDir, { withFileTypes: true });
7143
7143
  for (const scopeEntry of scopeEntries) {
7144
7144
  if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
7145
7145
  if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
@@ -7153,7 +7153,7 @@ var AddonLoader = class {
7153
7153
  }
7154
7154
  async tryLoadAddon(addonDir) {
7155
7155
  const pkgJsonPath = path$1.join(addonDir, "package.json");
7156
- if (!fs.existsSync(pkgJsonPath)) return;
7156
+ if (!fs$1.existsSync(pkgJsonPath)) return;
7157
7157
  try {
7158
7158
  await this.loadFromAddonDir(addonDir);
7159
7159
  } catch (err) {
@@ -7171,7 +7171,7 @@ var AddonLoader = class {
7171
7171
  /** Load addon from a specific directory (package.json + dist/) */
7172
7172
  async loadFromAddonDir(addonDir) {
7173
7173
  const pkgJsonPath = path$1.join(addonDir, "package.json");
7174
- const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
7174
+ const pkgJson = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
7175
7175
  const packageNameRaw = pkgJson["name"];
7176
7176
  const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
7177
7177
  const packageVersionRaw = pkgJson["version"];
@@ -7219,7 +7219,7 @@ var AddonLoader = class {
7219
7219
  }
7220
7220
  const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
7221
7221
  let entryPath = path$1.resolve(addonDir, entryFile);
7222
- if (!fs.existsSync(entryPath)) {
7222
+ if (!fs$1.existsSync(entryPath)) {
7223
7223
  const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
7224
7224
  entryPath = [
7225
7225
  `${base}.cjs`,
@@ -7228,9 +7228,9 @@ var AddonLoader = class {
7228
7228
  path$1.resolve(addonDir, "dist", "index.cjs"),
7229
7229
  path$1.resolve(addonDir, "dist", "index.mjs"),
7230
7230
  path$1.resolve(addonDir, declaration.entry)
7231
- ].find((p) => fs.existsSync(p)) ?? entryPath;
7231
+ ].find((p) => fs$1.existsSync(p)) ?? entryPath;
7232
7232
  }
7233
- if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
7233
+ if (!fs$1.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
7234
7234
  const modUnknown = await importAddonModuleFresh(entryPath);
7235
7235
  const mod = isRecord$4(modUnknown) ? modUnknown : {};
7236
7236
  const AddonClass = resolveAddonClass(mod);
@@ -7342,7 +7342,7 @@ function isDirectoryEntry(entry, parentDir) {
7342
7342
  if (entry.name.startsWith(".")) return false;
7343
7343
  if (entry.isDirectory()) return true;
7344
7344
  if (entry.isSymbolicLink()) try {
7345
- return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
7345
+ return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
7346
7346
  } catch {
7347
7347
  return false;
7348
7348
  }
@@ -7436,7 +7436,7 @@ var execFileAsync$4 = promisify(execFile);
7436
7436
  * Single source of truth — replaces scattered mkdirSync calls.
7437
7437
  */
7438
7438
  function ensureDir(dirPath) {
7439
- fs.mkdirSync(dirPath, { recursive: true });
7439
+ fs$1.mkdirSync(dirPath, { recursive: true });
7440
7440
  }
7441
7441
  /**
7442
7442
  * Copy a directory recursively — ASYNC so it never blocks the event loop.
@@ -7449,7 +7449,7 @@ function ensureDir(dirPath) {
7449
7449
  * `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
7450
7450
  */
7451
7451
  async function copyDirRecursive(src, dest) {
7452
- await fs.promises.cp(src, dest, {
7452
+ await fs$1.promises.cp(src, dest, {
7453
7453
  recursive: true,
7454
7454
  force: true
7455
7455
  });
@@ -7554,13 +7554,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
7554
7554
  if (typeof fileEntry !== "string") continue;
7555
7555
  if (fileEntry === "dist" || fileEntry.includes("*")) continue;
7556
7556
  const srcPath = path$1.join(sourceDir, fileEntry);
7557
- if (!fs.existsSync(srcPath)) continue;
7557
+ if (!fs$1.existsSync(srcPath)) continue;
7558
7558
  const destPath = path$1.join(destDir, fileEntry);
7559
- const stat = await fs.promises.stat(srcPath);
7559
+ const stat = await fs$1.promises.stat(srcPath);
7560
7560
  if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
7561
7561
  else if (stat.isFile()) {
7562
7562
  ensureDir(path$1.dirname(destPath));
7563
- await fs.promises.copyFile(srcPath, destPath);
7563
+ await fs$1.promises.copyFile(srcPath, destPath);
7564
7564
  }
7565
7565
  }
7566
7566
  }
@@ -7571,10 +7571,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
7571
7571
  function isSourceNewer(packageDir) {
7572
7572
  const srcDir = path$1.join(packageDir, "src");
7573
7573
  const distDir = path$1.join(packageDir, "dist");
7574
- if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
7574
+ if (!fs$1.existsSync(srcDir) || !fs$1.existsSync(distDir)) return true;
7575
7575
  try {
7576
- const distMtime = fs.statSync(distDir).mtimeMs;
7577
- const entries = fs.readdirSync(srcDir, {
7576
+ const distMtime = fs$1.statSync(distDir).mtimeMs;
7577
+ const entries = fs$1.readdirSync(srcDir, {
7578
7578
  withFileTypes: true,
7579
7579
  recursive: true
7580
7580
  });
@@ -7582,7 +7582,7 @@ function isSourceNewer(packageDir) {
7582
7582
  if (!entry.isFile()) continue;
7583
7583
  const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
7584
7584
  const filePath = path$1.join(parentDir, entry.name);
7585
- if (fs.statSync(filePath).mtimeMs > distMtime) return true;
7585
+ if (fs$1.statSync(filePath).mtimeMs > distMtime) return true;
7586
7586
  }
7587
7587
  return false;
7588
7588
  } catch {
@@ -7599,7 +7599,7 @@ function isSourceNewer(packageDir) {
7599
7599
  * `copyDirRecursive` for the wedge this prevents.
7600
7600
  */
7601
7601
  async function installPackageFromNpm(packageName, targetDir) {
7602
- const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "dominevo-install-"));
7602
+ const tmpDir = await fs$1.promises.mkdtemp(path$1.join(os$1.tmpdir(), "dominevo-install-"));
7603
7603
  try {
7604
7604
  const { stdout } = await execFileAsync$4("npm", [
7605
7605
  "pack",
@@ -7622,21 +7622,21 @@ async function installPackageFromNpm(packageName, targetDir) {
7622
7622
  extractDir
7623
7623
  ], { timeout: 3e4 });
7624
7624
  const packageSubDir = path$1.join(extractDir, "package");
7625
- const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
7626
- await fs.promises.rm(targetDir, {
7625
+ const srcPkgJsonDir = fs$1.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
7626
+ await fs$1.promises.rm(targetDir, {
7627
7627
  recursive: true,
7628
7628
  force: true
7629
7629
  });
7630
7630
  ensureDir(targetDir);
7631
- await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
7631
+ await fs$1.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
7632
7632
  const distSrc = path$1.join(srcPkgJsonDir, "dist");
7633
- if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
7633
+ if (fs$1.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
7634
7634
  try {
7635
- const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
7635
+ const npmPkg = asJsonObject$1(parseJsonUnknown(await fs$1.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
7636
7636
  if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
7637
7637
  } catch {}
7638
7638
  } finally {
7639
- await fs.promises.rm(tmpDir, {
7639
+ await fs$1.promises.rm(tmpDir, {
7640
7640
  recursive: true,
7641
7641
  force: true
7642
7642
  });
@@ -7661,7 +7661,7 @@ function packageDirName$1(declaredName) {
7661
7661
  }
7662
7662
  function isDirLike$1(p) {
7663
7663
  try {
7664
- return fs.statSync(p).isDirectory();
7664
+ return fs$1.statSync(p).isDirectory();
7665
7665
  } catch {
7666
7666
  return false;
7667
7667
  }
@@ -7679,12 +7679,12 @@ var AddonManifest = class {
7679
7679
  */
7680
7680
  read() {
7681
7681
  if (this.cache != null) return this.cache;
7682
- if (!fs.existsSync(this.manifestPath)) {
7682
+ if (!fs$1.existsSync(this.manifestPath)) {
7683
7683
  this.cache = this.empty();
7684
7684
  return this.cache;
7685
7685
  }
7686
7686
  try {
7687
- const raw = fs.readFileSync(this.manifestPath, "utf-8");
7687
+ const raw = fs$1.readFileSync(this.manifestPath, "utf-8");
7688
7688
  const parsed = JSON.parse(raw);
7689
7689
  if (parsed.version !== MANIFEST_VERSION) {
7690
7690
  process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
@@ -7705,13 +7705,13 @@ var AddonManifest = class {
7705
7705
  * a half-written file.
7706
7706
  */
7707
7707
  write(manifest) {
7708
- fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
7708
+ fs$1.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
7709
7709
  const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
7710
- fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
7710
+ fs$1.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
7711
7711
  encoding: "utf-8",
7712
7712
  mode: 384
7713
7713
  });
7714
- fs.renameSync(tmp, this.manifestPath);
7714
+ fs$1.renameSync(tmp, this.manifestPath);
7715
7715
  this.cache = manifest;
7716
7716
  }
7717
7717
  /** Lookup a single addon's manifest entry, or `null` if not tracked. */
@@ -7786,22 +7786,22 @@ var AddonManifest = class {
7786
7786
  * exactly what moved. Returns the total number of changes.
7787
7787
  */
7788
7788
  reconcileFromDisk(addonsDir, onChange) {
7789
- if (!fs.existsSync(addonsDir)) return 0;
7789
+ if (!fs$1.existsSync(addonsDir)) return 0;
7790
7790
  const m = this.read();
7791
7791
  let changes = 0;
7792
7792
  const now = (/* @__PURE__ */ new Date()).toISOString();
7793
7793
  /** Package name → version, for every ADDON package actually installed. */
7794
7794
  const onDisk = /* @__PURE__ */ new Map();
7795
- for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
7795
+ for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
7796
7796
  if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
7797
7797
  const scopeDir = path$1.join(addonsDir, scope.name);
7798
- for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
7798
+ for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
7799
7799
  if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
7800
7800
  const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
7801
- if (!fs.existsSync(pkgJsonPath)) continue;
7801
+ if (!fs$1.existsSync(pkgJsonPath)) continue;
7802
7802
  let pkgJson;
7803
7803
  try {
7804
- const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
7804
+ const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
7805
7805
  if (typeof parsed !== "object" || parsed == null) continue;
7806
7806
  pkgJson = parsed;
7807
7807
  } catch {
@@ -7872,28 +7872,28 @@ var AddonManifest = class {
7872
7872
  migrateFromInstallSourceMarkers(addonsDir) {
7873
7873
  const m = this.read();
7874
7874
  if (Object.keys(m.addons).length > 0) return 0;
7875
- if (!fs.existsSync(addonsDir)) return 0;
7875
+ if (!fs$1.existsSync(addonsDir)) return 0;
7876
7876
  let migrated = 0;
7877
7877
  const now = (/* @__PURE__ */ new Date()).toISOString();
7878
- for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
7878
+ for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
7879
7879
  if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
7880
7880
  const scopeDir = path$1.join(addonsDir, scope.name);
7881
- for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
7881
+ for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
7882
7882
  if (!pkg.isDirectory()) continue;
7883
7883
  const pkgDir = path$1.join(scopeDir, pkg.name);
7884
7884
  const markerPath = path$1.join(pkgDir, ".install-source");
7885
7885
  const pkgJsonPath = path$1.join(pkgDir, "package.json");
7886
- if (!fs.existsSync(pkgJsonPath)) continue;
7886
+ if (!fs$1.existsSync(pkgJsonPath)) continue;
7887
7887
  let pkgJson;
7888
7888
  try {
7889
- const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
7889
+ const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
7890
7890
  if (typeof parsed !== "object" || parsed == null) continue;
7891
7891
  pkgJson = parsed;
7892
7892
  } catch {
7893
7893
  continue;
7894
7894
  }
7895
7895
  if (!pkgJson.name || !pkgJson.version) continue;
7896
- const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
7896
+ const source = fs$1.existsSync(markerPath) ? fs$1.readFileSync(markerPath, "utf-8").trim() : "bundled";
7897
7897
  m.addons[pkgJson.name] = {
7898
7898
  name: pkgJson.name,
7899
7899
  version: pkgJson.version,
@@ -8119,7 +8119,7 @@ function planClosureDedupe(input) {
8119
8119
  function readTreeManifest(pkgJsonPath) {
8120
8120
  let raw;
8121
8121
  try {
8122
- raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
8122
+ raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
8123
8123
  } catch {
8124
8124
  return null;
8125
8125
  }
@@ -8144,7 +8144,7 @@ function readTreeManifest(pkgJsonPath) {
8144
8144
  function listTopLevelEntries(nodeModulesDir) {
8145
8145
  let entries;
8146
8146
  try {
8147
- entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
8147
+ entries = fs$1.readdirSync(nodeModulesDir, { withFileTypes: true });
8148
8148
  } catch {
8149
8149
  return [];
8150
8150
  }
@@ -8154,7 +8154,7 @@ function listTopLevelEntries(nodeModulesDir) {
8154
8154
  if (entry.name.startsWith("@")) {
8155
8155
  let inner;
8156
8156
  try {
8157
- inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
8157
+ inner = fs$1.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
8158
8158
  } catch {
8159
8159
  continue;
8160
8160
  }
@@ -8187,14 +8187,14 @@ function collectAddonTreeState(addonDir) {
8187
8187
  const entryDir = path$1.join(nodeModulesDir, name);
8188
8188
  let isLink = false;
8189
8189
  try {
8190
- isLink = fs.lstatSync(entryDir).isSymbolicLink();
8190
+ isLink = fs$1.lstatSync(entryDir).isSymbolicLink();
8191
8191
  } catch {
8192
8192
  continue;
8193
8193
  }
8194
8194
  if (isLink) {
8195
8195
  let target = "";
8196
8196
  try {
8197
- target = fs.readlinkSync(entryDir);
8197
+ target = fs$1.readlinkSync(entryDir);
8198
8198
  } catch {}
8199
8199
  existingLinks.push({
8200
8200
  name,
@@ -8208,7 +8208,7 @@ function collectAddonTreeState(addonDir) {
8208
8208
  version: manifest.version
8209
8209
  });
8210
8210
  for (const [depName, range] of manifest.ranges) {
8211
- if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
8211
+ if (fs$1.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
8212
8212
  addRange(depName, range);
8213
8213
  }
8214
8214
  }
@@ -8238,7 +8238,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
8238
8238
  const frameworkDir = explicitDir ?? process.env["DOMINEVO_FRAMEWORK_DIR"];
8239
8239
  if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
8240
8240
  const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
8241
- return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
8241
+ return fs$1.existsSync(nodeModulesDir) ? nodeModulesDir : null;
8242
8242
  }
8243
8243
  function symlinkType() {
8244
8244
  return process.platform === "win32" ? "junction" : "dir";
@@ -8257,10 +8257,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
8257
8257
  const nodeModulesDir = path$1.join(addonDir, "node_modules");
8258
8258
  const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
8259
8259
  try {
8260
- fs.mkdirSync(nodeModulesDir, { recursive: true });
8261
- fs.rmSync(probePath, { force: true });
8262
- fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
8263
- fs.rmSync(probePath, { force: true });
8260
+ fs$1.mkdirSync(nodeModulesDir, { recursive: true });
8261
+ fs$1.rmSync(probePath, { force: true });
8262
+ fs$1.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
8263
+ fs$1.rmSync(probePath, { force: true });
8264
8264
  } catch (err) {
8265
8265
  logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
8266
8266
  addonDir,
@@ -8282,12 +8282,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
8282
8282
  }
8283
8283
  const entryDir = path$1.join(nodeModulesDir, link.name);
8284
8284
  try {
8285
- fs.rmSync(entryDir, {
8285
+ fs$1.rmSync(entryDir, {
8286
8286
  recursive: true,
8287
8287
  force: true
8288
8288
  });
8289
- fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
8290
- fs.symlinkSync(target, entryDir, symlinkType());
8289
+ fs$1.mkdirSync(path$1.dirname(entryDir), { recursive: true });
8290
+ fs$1.symlinkSync(target, entryDir, symlinkType());
8291
8291
  linked.push(link.name);
8292
8292
  } catch (err) {
8293
8293
  logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
@@ -8363,7 +8363,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
8363
8363
  count: Object.keys(native).length
8364
8364
  } });
8365
8365
  try {
8366
- fs.writeFileSync(markerFile, markerHash);
8366
+ fs$1.writeFileSync(markerFile, markerHash);
8367
8367
  } catch (err) {
8368
8368
  logger.warn("Failed to write native deps marker", { meta: {
8369
8369
  markerFile,
@@ -8401,7 +8401,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
8401
8401
  }
8402
8402
  await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
8403
8403
  try {
8404
- fs.writeFileSync(markerFile, markerHash);
8404
+ fs$1.writeFileSync(markerFile, markerHash);
8405
8405
  } catch (err) {
8406
8406
  logger.warn("Failed to write native deps marker", { meta: {
8407
8407
  markerFile,
@@ -8423,12 +8423,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
8423
8423
  if (source === target) continue;
8424
8424
  if (!hasBuiltBinary(source)) continue;
8425
8425
  try {
8426
- fs.rmSync(target, {
8426
+ fs$1.rmSync(target, {
8427
8427
  recursive: true,
8428
8428
  force: true
8429
8429
  });
8430
- fs.mkdirSync(path$1.dirname(target), { recursive: true });
8431
- fs.cpSync(source, target, {
8430
+ fs$1.mkdirSync(path$1.dirname(target), { recursive: true });
8431
+ fs$1.cpSync(source, target, {
8432
8432
  recursive: true,
8433
8433
  dereference: true
8434
8434
  });
@@ -8464,7 +8464,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
8464
8464
  function hasAnyDotNode(dir, maxDepth) {
8465
8465
  let entries;
8466
8466
  try {
8467
- entries = fs.readdirSync(dir, { withFileTypes: true });
8467
+ entries = fs$1.readdirSync(dir, { withFileTypes: true });
8468
8468
  } catch {
8469
8469
  return false;
8470
8470
  }
@@ -8478,12 +8478,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
8478
8478
  if (!hasAnyDotNode(src, 5)) return;
8479
8479
  if (hasAnyDotNode(dst, 5)) return;
8480
8480
  try {
8481
- fs.rmSync(dst, {
8481
+ fs$1.rmSync(dst, {
8482
8482
  recursive: true,
8483
8483
  force: true
8484
8484
  });
8485
- fs.mkdirSync(path$1.dirname(dst), { recursive: true });
8486
- fs.cpSync(src, dst, {
8485
+ fs$1.mkdirSync(path$1.dirname(dst), { recursive: true });
8486
+ fs$1.cpSync(src, dst, {
8487
8487
  recursive: true,
8488
8488
  dereference: true
8489
8489
  });
@@ -8518,7 +8518,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
8518
8518
  */
8519
8519
  function copyBundledNativeModules(sourceDir, targetDir, logger) {
8520
8520
  const srcNm = path$1.join(sourceDir, "node_modules");
8521
- if (!fs.existsSync(srcNm)) return;
8521
+ if (!fs$1.existsSync(srcNm)) return;
8522
8522
  const dstNm = path$1.join(targetDir, "node_modules");
8523
8523
  for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
8524
8524
  copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
@@ -8526,7 +8526,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
8526
8526
  const scopeSrc = path$1.join(srcNm, scope);
8527
8527
  let siblings;
8528
8528
  try {
8529
- siblings = fs.readdirSync(scopeSrc);
8529
+ siblings = fs$1.readdirSync(scopeSrc);
8530
8530
  } catch {
8531
8531
  continue;
8532
8532
  }
@@ -8536,12 +8536,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
8536
8536
  }
8537
8537
  /** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
8538
8538
  function hasBuiltBinary(pkgDir) {
8539
- if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
8539
+ if (!fs$1.existsSync(path$1.join(pkgDir, "package.json"))) return false;
8540
8540
  const releaseDir = path$1.join(pkgDir, "build", "Release");
8541
8541
  try {
8542
- if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
8542
+ if (fs$1.existsSync(releaseDir) && fs$1.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
8543
8543
  } catch {}
8544
- return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
8544
+ return fs$1.existsSync(path$1.join(pkgDir, "prebuilds"));
8545
8545
  }
8546
8546
  /** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
8547
8547
  function candidateHoistedDirs(name, addonDir) {
@@ -8579,7 +8579,7 @@ function hashDeclaration(deps) {
8579
8579
  }
8580
8580
  function markerMatches(markerFile, expected) {
8581
8581
  try {
8582
- return fs.readFileSync(markerFile, "utf-8").trim() === expected;
8582
+ return fs$1.readFileSync(markerFile, "utf-8").trim() === expected;
8583
8583
  } catch {
8584
8584
  return false;
8585
8585
  }
@@ -8790,7 +8790,7 @@ function parseInstallSource(value) {
8790
8790
  function readPackageJson(pkgJsonPath) {
8791
8791
  let raw;
8792
8792
  try {
8793
- raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
8793
+ raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
8794
8794
  } catch {
8795
8795
  return null;
8796
8796
  }
@@ -8834,7 +8834,7 @@ var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
8834
8834
  var FALLBACK_VERSION_PROBES = 25;
8835
8835
  function readInstalledPackageVersion(addonDir) {
8836
8836
  try {
8837
- const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
8837
+ const raw = JSON.parse(fs$1.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
8838
8838
  if (raw === null || typeof raw !== "object") return null;
8839
8839
  const version = Reflect.get(raw, "version");
8840
8840
  return typeof version === "string" && version.length > 0 ? version : null;
@@ -8982,7 +8982,7 @@ var AddonInstaller = class AddonInstaller {
8982
8982
  } catch {
8983
8983
  return Object.freeze([]);
8984
8984
  }
8985
- const raw = fs.readFileSync(pkgPath, "utf-8");
8985
+ const raw = fs$1.readFileSync(pkgPath, "utf-8");
8986
8986
  const parsed = JSON.parse(raw);
8987
8987
  const deps = Object.keys(parsed.dependencies ?? {});
8988
8988
  const agentOnly = new Set(parsed.dominevo?.agentOnlyBootstrapAddons ?? []);
@@ -9027,7 +9027,7 @@ var AddonInstaller = class AddonInstaller {
9027
9027
  } catch {
9028
9028
  return Object.freeze([]);
9029
9029
  }
9030
- const raw = fs.readFileSync(pkgPath, "utf-8");
9030
+ const raw = fs$1.readFileSync(pkgPath, "utf-8");
9031
9031
  const addons = JSON.parse(raw).dominevo?.agentBootstrapAddons ?? [];
9032
9032
  return Object.freeze(["@dominevo/server", ...addons]);
9033
9033
  }
@@ -9057,7 +9057,7 @@ var AddonInstaller = class AddonInstaller {
9057
9057
  this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
9058
9058
  for (const packageName of pkgList) {
9059
9059
  const addonDir = path$1.join(this.addonsDir, packageName);
9060
- if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
9060
+ if (fs$1.existsSync(path$1.join(addonDir, "package.json"))) {
9061
9061
  if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
9062
9062
  this.logger.debug(`${packageName} — already installed, skipping`);
9063
9063
  continue;
@@ -9308,7 +9308,7 @@ var AddonInstaller = class AddonInstaller {
9308
9308
  const installedPackages = this.listInstalled();
9309
9309
  for (const pkg of installedPackages) {
9310
9310
  try {
9311
- if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
9311
+ if (fs$1.lstatSync(pkg.dir).isSymbolicLink()) continue;
9312
9312
  } catch {
9313
9313
  continue;
9314
9314
  }
@@ -9348,7 +9348,7 @@ var AddonInstaller = class AddonInstaller {
9348
9348
  if (closureNodeModules !== null) for (const link of state.existingLinks) {
9349
9349
  if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
9350
9350
  const linkDir = path$1.join(nodeModulesDir, link.name);
9351
- const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
9351
+ const targetManifest = fs$1.existsSync(path$1.join(linkDir, "package.json"));
9352
9352
  const ranges = state.requirements.get(link.name) ?? [];
9353
9353
  let holds = targetManifest;
9354
9354
  if (holds && ranges.length > 0) {
@@ -9357,14 +9357,14 @@ var AddonInstaller = class AddonInstaller {
9357
9357
  }
9358
9358
  if (!holds) {
9359
9359
  this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
9360
- fs.rmSync(linkDir, { force: true });
9360
+ fs$1.rmSync(linkDir, { force: true });
9361
9361
  needsInstall = true;
9362
9362
  }
9363
9363
  }
9364
9364
  const linked = [];
9365
9365
  for (const [depName, range] of declaredEntries) {
9366
9366
  if (typeof range !== "string") continue;
9367
- if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
9367
+ if (fs$1.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
9368
9368
  const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
9369
9369
  if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
9370
9370
  if (executeClosureDedupe(addonDir, closureNodeModules, {
@@ -9397,7 +9397,7 @@ var AddonInstaller = class AddonInstaller {
9397
9397
  const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
9398
9398
  if (closureNodeModules !== null) {
9399
9399
  const state = collectAddonTreeState(addonDir);
9400
- for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
9400
+ for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs$1.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
9401
9401
  }
9402
9402
  this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
9403
9403
  await runNpm([
@@ -9442,7 +9442,7 @@ var AddonInstaller = class AddonInstaller {
9442
9442
  async realignFromClosure(packageName, closureDir) {
9443
9443
  const targetDir = path$1.join(this.addonsDir, packageName);
9444
9444
  const result = await this.installLocal(packageName, closureDir);
9445
- await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
9445
+ await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
9446
9446
  this.manifest.upsert(result.name, {
9447
9447
  version: result.version,
9448
9448
  source: "closure"
@@ -9458,17 +9458,17 @@ var AddonInstaller = class AddonInstaller {
9458
9458
  async installCopy(packageName, sourceDir, pkgData, targetDir) {
9459
9459
  await this.ensureBuilt(packageName, sourceDir, pkgData);
9460
9460
  const distDir = path$1.join(sourceDir, "dist");
9461
- if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
9462
- await fs.promises.rm(targetDir, {
9461
+ if (!fs$1.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
9462
+ await fs$1.promises.rm(targetDir, {
9463
9463
  recursive: true,
9464
9464
  force: true
9465
9465
  });
9466
9466
  ensureDir(targetDir);
9467
- await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
9467
+ await fs$1.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
9468
9468
  await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
9469
9469
  await copyExtraFileDirs(pkgData, sourceDir, targetDir);
9470
9470
  copyBundledNativeModules(sourceDir, targetDir, this.logger);
9471
- await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
9471
+ await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
9472
9472
  const localPkgVersion = asString$1(pkgData.version, "0.0.0");
9473
9473
  this.manifest.upsert(packageName, {
9474
9474
  version: localPkgVersion,
@@ -9509,7 +9509,7 @@ var AddonInstaller = class AddonInstaller {
9509
9509
  * unusual auth, offline mode, etc).
9510
9510
  */
9511
9511
  async installFromNpm(packageName, version) {
9512
- const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "dominevo-addon-npm-"));
9512
+ const tmpDir = fs$1.mkdtempSync(path$1.join(os$1.tmpdir(), "dominevo-addon-npm-"));
9513
9513
  const packageSpec = version ? `${packageName}@${version}` : packageName;
9514
9514
  this.logger.info(`${packageName} — installing from npm`);
9515
9515
  try {
@@ -9523,19 +9523,19 @@ var AddonInstaller = class AddonInstaller {
9523
9523
  ];
9524
9524
  if (this.registry) args.push("--registry", this.registry);
9525
9525
  const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
9526
- const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
9526
+ const tgzFiles = fs$1.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
9527
9527
  if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
9528
9528
  return path$1.join(tmpDir, tgzFiles[0]);
9529
9529
  });
9530
9530
  const result = await this.installFromTgz(tgzPath);
9531
- fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
9531
+ fs$1.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
9532
9532
  this.manifest.upsert(result.name, {
9533
9533
  version: result.version,
9534
9534
  source: "npm"
9535
9535
  });
9536
9536
  return result;
9537
9537
  } finally {
9538
- fs.rmSync(tmpDir, {
9538
+ fs$1.rmSync(tmpDir, {
9539
9539
  recursive: true,
9540
9540
  force: true
9541
9541
  });
@@ -9573,7 +9573,7 @@ var AddonInstaller = class AddonInstaller {
9573
9573
  if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
9574
9574
  const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
9575
9575
  const buf = Buffer.from(await tarRes.arrayBuffer());
9576
- fs.writeFileSync(tgzPath, buf);
9576
+ fs$1.writeFileSync(tgzPath, buf);
9577
9577
  return tgzPath;
9578
9578
  }
9579
9579
  /**
@@ -9594,7 +9594,7 @@ var AddonInstaller = class AddonInstaller {
9594
9594
  * on the next deploy.
9595
9595
  */
9596
9596
  async evictInstallDir(targetDir) {
9597
- if (!fs.existsSync(targetDir)) return;
9597
+ if (!fs$1.existsSync(targetDir)) return;
9598
9598
  const graveyard = path$1.join(this.addonsDir, ".evicting");
9599
9599
  ensureDir(graveyard);
9600
9600
  await this.sweepGraveyard(graveyard);
@@ -9602,10 +9602,10 @@ var AddonInstaller = class AddonInstaller {
9602
9602
  const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
9603
9603
  const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
9604
9604
  try {
9605
- fs.renameSync(targetDir, asideDir);
9605
+ fs$1.renameSync(targetDir, asideDir);
9606
9606
  } catch (renameErr) {
9607
9607
  if (renameErr.code === "EXDEV") {
9608
- await fs.promises.rm(targetDir, {
9608
+ await fs$1.promises.rm(targetDir, {
9609
9609
  recursive: true,
9610
9610
  force: true
9611
9611
  });
@@ -9613,7 +9613,7 @@ var AddonInstaller = class AddonInstaller {
9613
9613
  }
9614
9614
  throw renameErr;
9615
9615
  }
9616
- await fs.promises.rm(asideDir, {
9616
+ await fs$1.promises.rm(asideDir, {
9617
9617
  recursive: true,
9618
9618
  force: true
9619
9619
  }).catch((cleanupErr) => {
@@ -9634,14 +9634,14 @@ var AddonInstaller = class AddonInstaller {
9634
9634
  async sweepStagingResidue(stagingRoot) {
9635
9635
  let names;
9636
9636
  try {
9637
- names = fs.readdirSync(stagingRoot);
9637
+ names = fs$1.readdirSync(stagingRoot);
9638
9638
  } catch {
9639
9639
  return;
9640
9640
  }
9641
9641
  const now = Date.now();
9642
9642
  const ages = [];
9643
9643
  for (const name of names) try {
9644
- const stat = fs.statSync(path$1.join(stagingRoot, name));
9644
+ const stat = fs$1.statSync(path$1.join(stagingRoot, name));
9645
9645
  ages.push({
9646
9646
  name,
9647
9647
  ageMs: now - stat.mtimeMs
@@ -9652,7 +9652,7 @@ var AddonInstaller = class AddonInstaller {
9652
9652
  stagingRoot,
9653
9653
  entries: sweepable
9654
9654
  } });
9655
- await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
9655
+ await Promise.all(sweepable.map((name) => fs$1.promises.rm(path$1.join(stagingRoot, name), {
9656
9656
  recursive: true,
9657
9657
  force: true
9658
9658
  }).catch(() => void 0)));
@@ -9661,11 +9661,11 @@ var AddonInstaller = class AddonInstaller {
9661
9661
  async sweepGraveyard(graveyard) {
9662
9662
  let entries;
9663
9663
  try {
9664
- entries = fs.readdirSync(graveyard);
9664
+ entries = fs$1.readdirSync(graveyard);
9665
9665
  } catch {
9666
9666
  return;
9667
9667
  }
9668
- await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
9668
+ await Promise.all(entries.map((name) => fs$1.promises.rm(path$1.join(graveyard, name), {
9669
9669
  recursive: true,
9670
9670
  force: true
9671
9671
  }).catch(() => void 0)));
@@ -9716,7 +9716,7 @@ var AddonInstaller = class AddonInstaller {
9716
9716
  return;
9717
9717
  }
9718
9718
  const strippedManifest = stripBundledDeps(pkgView.raw);
9719
- await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
9719
+ await fs$1.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
9720
9720
  const deps = asJsonObject$1(strippedManifest["dependencies"]);
9721
9721
  const depNames = deps ? Object.keys(deps) : [];
9722
9722
  if (depNames.length === 0) return;
@@ -9848,9 +9848,9 @@ var AddonInstaller = class AddonInstaller {
9848
9848
  "-C",
9849
9849
  stagingDir
9850
9850
  ], { timeout: 12e4 });
9851
- const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
9851
+ const pkgDir = fs$1.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
9852
9852
  const pkgJsonPath = path$1.join(pkgDir, "package.json");
9853
- if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
9853
+ if (!fs$1.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
9854
9854
  const pkgView = readPackageJson(pkgJsonPath);
9855
9855
  if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
9856
9856
  if (!pkgView.dominevoAddons) throw new Error(`Package ${pkgView.name} has no dominevo.addons manifest`);
@@ -9860,7 +9860,7 @@ var AddonInstaller = class AddonInstaller {
9860
9860
  this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
9861
9861
  await this.evictInstallDir(targetDir);
9862
9862
  ensureDir(path$1.dirname(targetDir));
9863
- await fs.promises.rename(pkgDir, targetDir);
9863
+ await fs$1.promises.rename(pkgDir, targetDir);
9864
9864
  this.manifest.upsert(pkgView.name, {
9865
9865
  version: pkgView.version,
9866
9866
  source: "bundled"
@@ -9871,7 +9871,7 @@ var AddonInstaller = class AddonInstaller {
9871
9871
  };
9872
9872
  } finally {
9873
9873
  this.inFlightStaging.delete(stagingName);
9874
- await fs.promises.rm(stagingDir, {
9874
+ await fs$1.promises.rm(stagingDir, {
9875
9875
  recursive: true,
9876
9876
  force: true
9877
9877
  }).catch(() => void 0);
@@ -9901,24 +9901,24 @@ var AddonInstaller = class AddonInstaller {
9901
9901
  const current = this.manifest.get(packageName);
9902
9902
  if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
9903
9903
  const addonDir = path$1.join(this.addonsDir, packageName);
9904
- if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
9904
+ if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
9905
9905
  const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
9906
9906
  const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
9907
9907
  ensureDir(backupRoot);
9908
9908
  const backupDir = path$1.join(backupRoot, ts);
9909
9909
  this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
9910
- fs.renameSync(addonDir, backupDir);
9910
+ fs$1.renameSync(addonDir, backupDir);
9911
9911
  let result;
9912
9912
  try {
9913
9913
  result = await this.installFromNpm(packageName, version);
9914
9914
  } catch (installErr) {
9915
9915
  this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
9916
9916
  try {
9917
- if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
9917
+ if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
9918
9918
  recursive: true,
9919
9919
  force: true
9920
9920
  });
9921
- fs.renameSync(backupDir, addonDir);
9921
+ fs$1.renameSync(backupDir, addonDir);
9922
9922
  this.manifest.upsert(packageName, {
9923
9923
  version: current.version,
9924
9924
  source: current.source,
@@ -9979,7 +9979,7 @@ var AddonInstaller = class AddonInstaller {
9979
9979
  const current = this.manifest.get(packageName);
9980
9980
  if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
9981
9981
  const addonDir = path$1.join(this.addonsDir, packageName);
9982
- if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
9982
+ if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
9983
9983
  await this.installRuntimeDependencies(stagedPath, packageName);
9984
9984
  await this.installNativeDependencies(stagedPath, packageName);
9985
9985
  this.dedupeTreeAgainstClosure(stagedPath, packageName);
@@ -9988,14 +9988,14 @@ var AddonInstaller = class AddonInstaller {
9988
9988
  ensureDir(backupRoot);
9989
9989
  const backupDir = path$1.join(backupRoot, ts);
9990
9990
  this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
9991
- fs.renameSync(addonDir, backupDir);
9991
+ fs$1.renameSync(addonDir, backupDir);
9992
9992
  try {
9993
9993
  try {
9994
- fs.renameSync(stagedPath, addonDir);
9994
+ fs$1.renameSync(stagedPath, addonDir);
9995
9995
  } catch (renameErr) {
9996
9996
  if (renameErr.code === "EXDEV") {
9997
- fs.cpSync(stagedPath, addonDir, { recursive: true });
9998
- fs.rmSync(stagedPath, {
9997
+ fs$1.cpSync(stagedPath, addonDir, { recursive: true });
9998
+ fs$1.rmSync(stagedPath, {
9999
9999
  recursive: true,
10000
10000
  force: true
10001
10001
  });
@@ -10004,11 +10004,11 @@ var AddonInstaller = class AddonInstaller {
10004
10004
  } catch (swapErr) {
10005
10005
  this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
10006
10006
  try {
10007
- if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
10007
+ if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
10008
10008
  recursive: true,
10009
10009
  force: true
10010
10010
  });
10011
- fs.renameSync(backupDir, addonDir);
10011
+ fs$1.renameSync(backupDir, addonDir);
10012
10012
  this.manifest.upsert(packageName, {
10013
10013
  version: current.version,
10014
10014
  source: current.source,
@@ -10047,20 +10047,20 @@ var AddonInstaller = class AddonInstaller {
10047
10047
  this.logger.warn(`${packageName} — no backup to rollback to`);
10048
10048
  return null;
10049
10049
  }
10050
- if (!fs.existsSync(entry.lastBackupDir)) {
10050
+ if (!fs$1.existsSync(entry.lastBackupDir)) {
10051
10051
  this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
10052
10052
  return null;
10053
10053
  }
10054
10054
  const addonDir = path$1.join(this.addonsDir, packageName);
10055
- if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
10055
+ if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
10056
10056
  recursive: true,
10057
10057
  force: true
10058
10058
  });
10059
- fs.renameSync(entry.lastBackupDir, addonDir);
10059
+ fs$1.renameSync(entry.lastBackupDir, addonDir);
10060
10060
  const pkgJsonPath = path$1.join(addonDir, "package.json");
10061
10061
  let restoredVersion = entry.version;
10062
- if (fs.existsSync(pkgJsonPath)) try {
10063
- const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
10062
+ if (fs$1.existsSync(pkgJsonPath)) try {
10063
+ const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
10064
10064
  if (typeof parsed === "object" && parsed != null) {
10065
10065
  const v = parsed.version;
10066
10066
  if (typeof v === "string" && v.length > 0) restoredVersion = v;
@@ -10108,7 +10108,7 @@ var AddonInstaller = class AddonInstaller {
10108
10108
  return false;
10109
10109
  }
10110
10110
  try {
10111
- await fs.promises.rm(target, {
10111
+ await fs$1.promises.rm(target, {
10112
10112
  recursive: true,
10113
10113
  force: true
10114
10114
  });
@@ -10126,7 +10126,7 @@ var AddonInstaller = class AddonInstaller {
10126
10126
  listBackupsFor(packageName) {
10127
10127
  const dir = path$1.join(this.backupsRoot, packageName);
10128
10128
  try {
10129
- return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
10129
+ return fs$1.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
10130
10130
  } catch {
10131
10131
  return [];
10132
10132
  }
@@ -10158,7 +10158,7 @@ var AddonInstaller = class AddonInstaller {
10158
10158
  for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
10159
10159
  if (!this.isInsideBackups(dir)) continue;
10160
10160
  try {
10161
- await fs.promises.rmdir(dir);
10161
+ await fs$1.promises.rmdir(dir);
10162
10162
  } catch {
10163
10163
  return;
10164
10164
  }
@@ -10240,7 +10240,7 @@ var AddonInstaller = class AddonInstaller {
10240
10240
  */
10241
10241
  resolveBackupToKeep(packageName, backups) {
10242
10242
  const liveDir = path$1.join(this.addonsDir, packageName);
10243
- if (!fs.existsSync(liveDir)) {
10243
+ if (!fs$1.existsSync(liveDir)) {
10244
10244
  const newest = backups[backups.length - 1] ?? null;
10245
10245
  if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
10246
10246
  liveDir,
@@ -10257,7 +10257,7 @@ var AddonInstaller = class AddonInstaller {
10257
10257
  listBackedUpPackages() {
10258
10258
  let entries;
10259
10259
  try {
10260
- entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
10260
+ entries = fs$1.readdirSync(this.backupsRoot, { withFileTypes: true });
10261
10261
  } catch {
10262
10262
  return [];
10263
10263
  }
@@ -10269,14 +10269,14 @@ var AddonInstaller = class AddonInstaller {
10269
10269
  continue;
10270
10270
  }
10271
10271
  const scopeDir = path$1.join(this.backupsRoot, entry.name);
10272
- for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
10272
+ for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
10273
10273
  }
10274
10274
  return names;
10275
10275
  }
10276
10276
  async uninstall(packageName) {
10277
10277
  const addonDir = path$1.join(this.addonsDir, packageName);
10278
- if (fs.existsSync(addonDir)) {
10279
- fs.rmSync(addonDir, {
10278
+ if (fs$1.existsSync(addonDir)) {
10279
+ fs$1.rmSync(addonDir, {
10280
10280
  recursive: true,
10281
10281
  force: true
10282
10282
  });
@@ -10284,8 +10284,8 @@ var AddonInstaller = class AddonInstaller {
10284
10284
  return;
10285
10285
  }
10286
10286
  const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
10287
- if (fs.existsSync(legacyDir)) {
10288
- fs.rmSync(legacyDir, {
10287
+ if (fs$1.existsSync(legacyDir)) {
10288
+ fs$1.rmSync(legacyDir, {
10289
10289
  recursive: true,
10290
10290
  force: true
10291
10291
  });
@@ -10293,22 +10293,22 @@ var AddonInstaller = class AddonInstaller {
10293
10293
  }
10294
10294
  }
10295
10295
  listInstalled() {
10296
- if (!fs.existsSync(this.addonsDir)) return [];
10296
+ if (!fs$1.existsSync(this.addonsDir)) return [];
10297
10297
  const packageDirs = [];
10298
- for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
10298
+ for (const entry of fs$1.readdirSync(this.addonsDir, { withFileTypes: true })) {
10299
10299
  if (!isDirEntry(entry, this.addonsDir)) continue;
10300
10300
  if (entry.name.startsWith("@")) {
10301
10301
  const scopeDir = path$1.join(this.addonsDir, entry.name);
10302
- for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
10302
+ for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
10303
10303
  } else packageDirs.push(path$1.join(this.addonsDir, entry.name));
10304
10304
  }
10305
10305
  return packageDirs.map((dir) => {
10306
10306
  const pkgPath = path$1.join(dir, "package.json");
10307
- if (!fs.existsSync(pkgPath)) return null;
10307
+ if (!fs$1.existsSync(pkgPath)) return null;
10308
10308
  const pkg = readPackageJson(pkgPath);
10309
10309
  if (!pkg || !pkg.dominevoAddons) return null;
10310
10310
  const sourceFile = path$1.join(dir, ".install-source");
10311
- const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
10311
+ const installSource = fs$1.existsSync(sourceFile) ? parseInstallSource(fs$1.readFileSync(sourceFile, "utf-8").trim()) : void 0;
10312
10312
  return {
10313
10313
  name: pkg.name,
10314
10314
  version: pkg.version,
@@ -10318,13 +10318,13 @@ var AddonInstaller = class AddonInstaller {
10318
10318
  }).filter((item) => item !== null);
10319
10319
  }
10320
10320
  isInstalled(packageName) {
10321
- if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
10322
- return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
10321
+ if (fs$1.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
10322
+ return fs$1.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
10323
10323
  }
10324
10324
  getInstalledPackage(packageName) {
10325
10325
  let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
10326
- if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
10327
- if (!fs.existsSync(pkgPath)) return null;
10326
+ if (!fs$1.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
10327
+ if (!fs$1.existsSync(pkgPath)) return null;
10328
10328
  const pkg = readPackageJson(pkgPath);
10329
10329
  if (!pkg) return null;
10330
10330
  return {
@@ -10343,7 +10343,7 @@ var AddonInstaller = class AddonInstaller {
10343
10343
  ]) {
10344
10344
  const candidate = path$1.join(this.bundledAddonsDir, dirName);
10345
10345
  try {
10346
- const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
10346
+ const pkg = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
10347
10347
  if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
10348
10348
  } catch {}
10349
10349
  }
@@ -10352,7 +10352,7 @@ var AddonInstaller = class AddonInstaller {
10352
10352
  /** Ensure a package is built (dist/ exists and page bundles present) */
10353
10353
  async ensureBuilt(packageName, sourceDir, pkgData) {
10354
10354
  const distDir = path$1.join(sourceDir, "dist");
10355
- if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
10355
+ if (!(!fs$1.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
10356
10356
  this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
10357
10357
  try {
10358
10358
  await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
@@ -10367,7 +10367,7 @@ var AddonInstaller = class AddonInstaller {
10367
10367
  if (!dominevo?.addons) return false;
10368
10368
  for (const addon of dominevo.addons) {
10369
10369
  if (!addon.pages) continue;
10370
- for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
10370
+ for (const page of addon.pages) if (page.bundle && !fs$1.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
10371
10371
  }
10372
10372
  return false;
10373
10373
  }
@@ -10376,7 +10376,7 @@ var AddonInstaller = class AddonInstaller {
10376
10376
  function isDirEntry(entry, parentDir) {
10377
10377
  if (entry.isDirectory()) return true;
10378
10378
  if (entry.isSymbolicLink()) try {
10379
- return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
10379
+ return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
10380
10380
  } catch {
10381
10381
  return false;
10382
10382
  }
@@ -10475,7 +10475,7 @@ function selectAddonResidue(candidates) {
10475
10475
  }
10476
10476
  function readDeclaredName(dir) {
10477
10477
  try {
10478
- const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
10478
+ const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
10479
10479
  if (typeof parsed !== "object" || parsed === null) return null;
10480
10480
  const name = parsed.name;
10481
10481
  return typeof name === "string" ? name : null;
@@ -10485,7 +10485,7 @@ function readDeclaredName(dir) {
10485
10485
  }
10486
10486
  function readDeclaredVersion(dir) {
10487
10487
  try {
10488
- const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
10488
+ const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
10489
10489
  if (typeof parsed !== "object" || parsed === null) return null;
10490
10490
  const version = parsed.version;
10491
10491
  return typeof version === "string" ? version : null;
@@ -10495,7 +10495,7 @@ function readDeclaredVersion(dir) {
10495
10495
  }
10496
10496
  function isDirLike(p) {
10497
10497
  try {
10498
- return fs.statSync(p).isDirectory();
10498
+ return fs$1.statSync(p).isDirectory();
10499
10499
  } catch {
10500
10500
  return false;
10501
10501
  }
@@ -10505,7 +10505,7 @@ function freeQuarantineTarget(store, scope, dirName) {
10505
10505
  const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
10506
10506
  let candidate = path$1.join(store, base);
10507
10507
  let n = 1;
10508
- while (fs.existsSync(candidate)) {
10508
+ while (fs$1.existsSync(candidate)) {
10509
10509
  candidate = path$1.join(store, `${base}-${n}`);
10510
10510
  n += 1;
10511
10511
  }
@@ -10522,7 +10522,7 @@ function freeQuarantineTarget(store, scope, dirName) {
10522
10522
  function quarantineAddonResidue(addonsDir, log) {
10523
10523
  const quarantined = [];
10524
10524
  const failed = [];
10525
- if (!fs.existsSync(addonsDir)) return {
10525
+ if (!fs$1.existsSync(addonsDir)) return {
10526
10526
  quarantined,
10527
10527
  failed
10528
10528
  };
@@ -10530,7 +10530,7 @@ function quarantineAddonResidue(addonsDir, log) {
10530
10530
  const scan = (parent, scope) => {
10531
10531
  let names;
10532
10532
  try {
10533
- names = fs.readdirSync(parent);
10533
+ names = fs$1.readdirSync(parent);
10534
10534
  } catch {
10535
10535
  return;
10536
10536
  }
@@ -10549,8 +10549,8 @@ function quarantineAddonResidue(addonsDir, log) {
10549
10549
  const version = readDeclaredVersion(full);
10550
10550
  const to = freeQuarantineTarget(store, scope, dirName);
10551
10551
  try {
10552
- fs.mkdirSync(store, { recursive: true });
10553
- fs.renameSync(full, to);
10552
+ fs$1.mkdirSync(store, { recursive: true });
10553
+ fs$1.renameSync(full, to);
10554
10554
  } catch (err) {
10555
10555
  const error = err instanceof Error ? err.message : String(err);
10556
10556
  failed.push({
@@ -10608,11 +10608,11 @@ function getRestartMarkerPath(dataDir) {
10608
10608
  * intact or no marker at all (never a half-written file).
10609
10609
  */
10610
10610
  function writePendingRestart(dataDir, marker) {
10611
- fs.mkdirSync(dataDir, { recursive: true });
10611
+ fs$1.mkdirSync(dataDir, { recursive: true });
10612
10612
  const markerPath = getRestartMarkerPath(dataDir);
10613
10613
  const tmpPath = `${markerPath}.tmp`;
10614
- fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
10615
- fs.renameSync(tmpPath, markerPath);
10614
+ fs$1.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
10615
+ fs$1.renameSync(tmpPath, markerPath);
10616
10616
  }
10617
10617
  /**
10618
10618
  * Read + consume the marker. Returns the parsed payload on success and
@@ -10637,10 +10637,10 @@ function writePendingRestart(dataDir, marker) {
10637
10637
  */
10638
10638
  function readPendingRestart(dataDir) {
10639
10639
  const markerPath = getRestartMarkerPath(dataDir);
10640
- if (!fs.existsSync(markerPath)) return null;
10640
+ if (!fs$1.existsSync(markerPath)) return null;
10641
10641
  let raw;
10642
10642
  try {
10643
- raw = fs.readFileSync(markerPath, "utf-8");
10643
+ raw = fs$1.readFileSync(markerPath, "utf-8");
10644
10644
  } catch (err) {
10645
10645
  console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
10646
10646
  return null;
@@ -10679,7 +10679,7 @@ function readPendingRestart(dataDir) {
10679
10679
  /** Remove the marker if present. No-op if missing. */
10680
10680
  function clearPendingRestart(dataDir) {
10681
10681
  const markerPath = getRestartMarkerPath(dataDir);
10682
- fs.rmSync(markerPath, { force: true });
10682
+ fs$1.rmSync(markerPath, { force: true });
10683
10683
  }
10684
10684
  function isRestartKind(value) {
10685
10685
  return value === "framework-update" || value === "manual" || value === "system";
@@ -10691,7 +10691,7 @@ function scheduleSelfRestart(options = {}) {
10691
10691
  const touchTarget = process.env["DOMINEVO_RESTART_TOUCH_FILE"];
10692
10692
  if (touchTarget !== void 0 && touchTarget.length > 0) try {
10693
10693
  const now = /* @__PURE__ */ new Date();
10694
- fs.utimesSync(touchTarget, now, now);
10694
+ fs$1.utimesSync(touchTarget, now, now);
10695
10695
  return;
10696
10696
  } catch (err) {
10697
10697
  console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
@@ -21461,7 +21461,7 @@ async function probeVaapiInit(renderNode) {
21461
21461
  */
21462
21462
  function safeExistsSync(path) {
21463
21463
  try {
21464
- return fs.existsSync(path);
21464
+ return fs$1.existsSync(path);
21465
21465
  } catch {
21466
21466
  return false;
21467
21467
  }
@@ -21480,11 +21480,11 @@ function probeLinuxGpus() {
21480
21480
  if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
21481
21481
  try {
21482
21482
  const drmDir = "/sys/class/drm";
21483
- if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
21483
+ if (fs$1.existsSync(drmDir)) for (const entry of fs$1.readdirSync(drmDir)) {
21484
21484
  if (!entry.startsWith("card")) continue;
21485
21485
  const vendorPath = `${drmDir}/${entry}/device/vendor`;
21486
21486
  if (!safeExistsSync(vendorPath)) continue;
21487
- const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
21487
+ const vendor = fs$1.readFileSync(vendorPath, "utf8").trim().toLowerCase();
21488
21488
  if (vendor === "0x10de") signals.hasNvidiaGpu = true;
21489
21489
  else if (vendor === "0x1002") signals.hasAmdGpu = true;
21490
21490
  else if (vendor === "0x8086") signals.hasIntelGpu = true;
@@ -21707,21 +21707,21 @@ function sleep$1(ms) {
21707
21707
  * crashed holder) is stolen.
21708
21708
  */
21709
21709
  async function withFileLock(lockPath, fn) {
21710
- fs.mkdirSync(join(lockPath, ".."), { recursive: true });
21710
+ fs$1.mkdirSync(join(lockPath, ".."), { recursive: true });
21711
21711
  for (;;) try {
21712
- const fd = fs.openSync(lockPath, "wx");
21713
- fs.closeSync(fd);
21712
+ const fd = fs$1.openSync(lockPath, "wx");
21713
+ fs$1.closeSync(fd);
21714
21714
  break;
21715
21715
  } catch {
21716
21716
  try {
21717
- if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
21717
+ if (Date.now() - fs$1.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs$1.rmSync(lockPath, { force: true });
21718
21718
  else await sleep$1(LOCK_POLL_MS);
21719
21719
  } catch {}
21720
21720
  }
21721
21721
  try {
21722
21722
  return await fn();
21723
21723
  } finally {
21724
- fs.rmSync(lockPath, { force: true });
21724
+ fs$1.rmSync(lockPath, { force: true });
21725
21725
  }
21726
21726
  }
21727
21727
  /** Coalesce in-process + serialize cross-process for one binary id. */
@@ -21779,7 +21779,7 @@ var AddonDepsManager = class {
21779
21779
  * failed or tampered download throws, and provisioning reports it.
21780
21780
  */
21781
21781
  async stageNativeDepsDeclaredBy(requirementsFile) {
21782
- if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
21782
+ if (!declaresEdgetpuDelegate(fs$1.readFileSync(requirementsFile, "utf8"))) return;
21783
21783
  await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
21784
21784
  }
21785
21785
  getDepsDir() {
@@ -22810,7 +22810,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
22810
22810
  const addonId = declaration.id;
22811
22811
  const nodeDataDir = process.env["DOMINEVO_DATA"] ?? dataDir;
22812
22812
  const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
22813
- fs.mkdirSync(addonDataDir, { recursive: true });
22813
+ fs$1.mkdirSync(addonDataDir, { recursive: true });
22814
22814
  if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
22815
22815
  const regs = getRegistries(nodeId);
22816
22816
  const workerResolver = {
@@ -24787,7 +24787,7 @@ var FailedRunnerRetryLedger = class {
24787
24787
  function readRunnerPackageVersions(addonDirs) {
24788
24788
  const out = {};
24789
24789
  for (const dir of addonDirs) try {
24790
- const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
24790
+ const raw = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
24791
24791
  const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
24792
24792
  out[dir] = typeof version === "string" && version.length > 0 ? version : null;
24793
24793
  } catch {
@@ -24848,7 +24848,7 @@ function readAddonHeapDeclaration(spec) {
24848
24848
  if (cached !== void 0) return cached;
24849
24849
  let declaration = EMPTY_HEAP_DECLARATION;
24850
24850
  for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
24851
- const raw = fs.readFileSync(manifestPath, "utf8");
24851
+ const raw = fs$1.readFileSync(manifestPath, "utf8");
24852
24852
  const parsed = JSON.parse(raw);
24853
24853
  const profile = extractHeapProfile(parsed, spec.addonId);
24854
24854
  const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
@@ -26128,17 +26128,17 @@ var JobJournal = class {
26128
26128
  return path$1.join(this.jobsDir, `${id}.json`);
26129
26129
  }
26130
26130
  writeAtomic(filePath, data) {
26131
- fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
26131
+ fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
26132
26132
  const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
26133
- fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
26133
+ fs$1.writeFileSync(tmp, JSON.stringify(data, null, 2), {
26134
26134
  encoding: "utf-8",
26135
26135
  mode: 384
26136
26136
  });
26137
- fs.renameSync(tmp, filePath);
26137
+ fs$1.renameSync(tmp, filePath);
26138
26138
  }
26139
26139
  readIndex() {
26140
26140
  try {
26141
- const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
26141
+ const raw = JSON.parse(fs$1.readFileSync(this.indexPath, "utf-8"));
26142
26142
  if (raw && Array.isArray(raw.jobIds)) return {
26143
26143
  version: 1,
26144
26144
  jobIds: raw.jobIds
@@ -26163,7 +26163,7 @@ var JobJournal = class {
26163
26163
  }
26164
26164
  getJob(id) {
26165
26165
  try {
26166
- const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
26166
+ const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs$1.readFileSync(this.jobPath(id), "utf-8")));
26167
26167
  return parsed.success ? parsed.data : null;
26168
26168
  } catch {
26169
26169
  return null;
@@ -26228,14 +26228,14 @@ var StagingArea = class {
26228
26228
  }
26229
26229
  async fetchAndStage(input) {
26230
26230
  const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
26231
- fs.rmSync(destDir, {
26231
+ fs$1.rmSync(destDir, {
26232
26232
  recursive: true,
26233
26233
  force: true
26234
26234
  });
26235
26235
  const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
26236
26236
  if (input.signal.aborted) throw new Error("staging aborted after fetch");
26237
26237
  await this.deps.extract(tgz, destDir);
26238
- const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
26238
+ const raw = JSON.parse(fs$1.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
26239
26239
  if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
26240
26240
  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}`);
26241
26241
  return {
@@ -26244,7 +26244,7 @@ var StagingArea = class {
26244
26244
  };
26245
26245
  }
26246
26246
  cleanup(jobId) {
26247
- fs.rmSync(path$1.join(this.stagingDir, jobId), {
26247
+ fs$1.rmSync(path$1.join(this.stagingDir, jobId), {
26248
26248
  recursive: true,
26249
26249
  force: true
26250
26250
  });
@@ -26259,13 +26259,13 @@ var StagingArea = class {
26259
26259
  sweepOrphans() {
26260
26260
  let entries;
26261
26261
  try {
26262
- entries = fs.readdirSync(this.stagingDir);
26262
+ entries = fs$1.readdirSync(this.stagingDir);
26263
26263
  } catch {
26264
26264
  return 0;
26265
26265
  }
26266
26266
  let removed = 0;
26267
26267
  for (const name of entries) try {
26268
- fs.rmSync(path$1.join(this.stagingDir, name), {
26268
+ fs$1.rmSync(path$1.join(this.stagingDir, name), {
26269
26269
  recursive: true,
26270
26270
  force: true
26271
26271
  });
@@ -26443,7 +26443,7 @@ var LifecycleJobEngine = class {
26443
26443
  * on failure → `failed`.
26444
26444
  */
26445
26445
  async reconcileJob(job) {
26446
- const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
26446
+ const exists = this.deps.stagedPathExists ?? ((p) => fs$1.existsSync(p));
26447
26447
  for (const task of job.tasks) {
26448
26448
  if (task.target === "framework") {
26449
26449
  if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
@@ -27098,7 +27098,7 @@ var CatalogRegistry = class {
27098
27098
  const file = path$1.join(packageDir, "i18n", `${lang}.json`);
27099
27099
  let text;
27100
27100
  try {
27101
- text = fs.readFileSync(file, "utf8");
27101
+ text = fs$1.readFileSync(file, "utf8");
27102
27102
  } catch {
27103
27103
  continue;
27104
27104
  }