omnius 1.0.879 → 1.0.880

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.
@@ -3178,7 +3178,7 @@ var require_util = __commonJS({
3178
3178
  }
3179
3179
  path3 = url.path;
3180
3180
  }
3181
- var isAbsolute6 = exports.isAbsolute(path3);
3181
+ var isAbsolute7 = exports.isAbsolute(path3);
3182
3182
  var parts = path3.split(/\/+/);
3183
3183
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
3184
3184
  part = parts[i];
@@ -3198,7 +3198,7 @@ var require_util = __commonJS({
3198
3198
  }
3199
3199
  path3 = parts.join("/");
3200
3200
  if (path3 === "") {
3201
- path3 = isAbsolute6 ? "/" : ".";
3201
+ path3 = isAbsolute7 ? "/" : ".";
3202
3202
  }
3203
3203
  if (url) {
3204
3204
  url.path = path3;
@@ -3207,7 +3207,7 @@ var require_util = __commonJS({
3207
3207
  return path3;
3208
3208
  }
3209
3209
  exports.normalize = normalize;
3210
- function join18(aRoot, aPath) {
3210
+ function join19(aRoot, aPath) {
3211
3211
  if (aRoot === "") {
3212
3212
  aRoot = ".";
3213
3213
  }
@@ -3239,7 +3239,7 @@ var require_util = __commonJS({
3239
3239
  }
3240
3240
  return joined;
3241
3241
  }
3242
- exports.join = join18;
3242
+ exports.join = join19;
3243
3243
  exports.isAbsolute = function(aPath) {
3244
3244
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
3245
3245
  };
@@ -3412,7 +3412,7 @@ var require_util = __commonJS({
3412
3412
  parsed.path = parsed.path.substring(0, index + 1);
3413
3413
  }
3414
3414
  }
3415
- sourceURL = join18(urlGenerate(parsed), sourceURL);
3415
+ sourceURL = join19(urlGenerate(parsed), sourceURL);
3416
3416
  }
3417
3417
  return normalize(sourceURL);
3418
3418
  }
@@ -13228,7 +13228,7 @@ ${lanes.join("\n")}
13228
13228
  getCurrentDirectory,
13229
13229
  getAccessibleSortedChildDirectories,
13230
13230
  fileSystemEntryExists,
13231
- realpath,
13231
+ realpath: realpath2,
13232
13232
  setTimeout: setTimeout2,
13233
13233
  clearTimeout: clearTimeout2
13234
13234
  }) {
@@ -13404,7 +13404,7 @@ ${lanes.join("\n")}
13404
13404
  function updateChildWatches(parentDir, parentDirPath, options) {
13405
13405
  const parentWatcher = cache.get(parentDirPath);
13406
13406
  if (!parentWatcher) return false;
13407
- const target = normalizePath(realpath(parentDir));
13407
+ const target = normalizePath(realpath2(parentDir));
13408
13408
  let hasChanges;
13409
13409
  let newChildWatches;
13410
13410
  if (filePathComparer(target, parentDir) === 0) {
@@ -13415,7 +13415,7 @@ ${lanes.join("\n")}
13415
13415
  /* Directory */
13416
13416
  ) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
13417
13417
  const childFullName = getNormalizedAbsolutePath(child, parentDir);
13418
- return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath(childFullName))) === 0 ? childFullName : void 0;
13418
+ return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath2(childFullName))) === 0 ? childFullName : void 0;
13419
13419
  }) : emptyArray,
13420
13420
  parentWatcher.childWatches,
13421
13421
  (child, childWatcher) => filePathComparer(child, childWatcher.dirName),
@@ -13499,7 +13499,7 @@ ${lanes.join("\n")}
13499
13499
  getCurrentDirectory,
13500
13500
  fsSupportsRecursiveFsWatch,
13501
13501
  getAccessibleSortedChildDirectories,
13502
- realpath,
13502
+ realpath: realpath2,
13503
13503
  tscWatchFile,
13504
13504
  useNonPollingWatchers,
13505
13505
  tscWatchDirectory,
@@ -13639,7 +13639,7 @@ ${lanes.join("\n")}
13639
13639
  fileSystemEntryExists,
13640
13640
  getAccessibleSortedChildDirectories,
13641
13641
  watchDirectory: nonRecursiveWatchDirectory,
13642
- realpath,
13642
+ realpath: realpath2,
13643
13643
  setTimeout: setTimeout2,
13644
13644
  clearTimeout: clearTimeout2
13645
13645
  });
@@ -13878,7 +13878,7 @@ ${lanes.join("\n")}
13878
13878
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
13879
13879
  fsSupportsRecursiveFsWatch,
13880
13880
  getAccessibleSortedChildDirectories: (path3) => getAccessibleFileSystemEntries(path3).directories,
13881
- realpath,
13881
+ realpath: realpath2,
13882
13882
  tscWatchFile: process.env.TSC_WATCHFILE,
13883
13883
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
13884
13884
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
@@ -13952,7 +13952,7 @@ ${lanes.join("\n")}
13952
13952
  enableCPUProfiler,
13953
13953
  disableCPUProfiler,
13954
13954
  cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"),
13955
- realpath,
13955
+ realpath: realpath2,
13956
13956
  debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
13957
13957
  tryEnableSourceMapsForHost() {
13958
13958
  try {
@@ -14184,7 +14184,7 @@ ${lanes.join("\n")}
14184
14184
  }
14185
14185
  }
14186
14186
  function readDirectory(path3, extensions, excludes, includes, depth) {
14187
- return matchFiles(path3, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
14187
+ return matchFiles(path3, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath2);
14188
14188
  }
14189
14189
  function fileSystemEntryExists(path3, entryKind) {
14190
14190
  const stat = statSync4(path3);
@@ -14220,7 +14220,7 @@ ${lanes.join("\n")}
14220
14220
  function fsRealPathHandlingLongPath(path3) {
14221
14221
  return path3.length < 260 ? _fs.realpathSync.native(path3) : _fs.realpathSync(path3);
14222
14222
  }
14223
- function realpath(path3) {
14223
+ function realpath2(path3) {
14224
14224
  try {
14225
14225
  return fsRealpath(path3);
14226
14226
  } catch {
@@ -28370,7 +28370,7 @@ ${lanes.join("\n")}
28370
28370
  function getRegexFromPattern(pattern, useCaseSensitiveFileNames2) {
28371
28371
  return new RegExp(pattern, useCaseSensitiveFileNames2 ? "" : "i");
28372
28372
  }
28373
- function matchFiles(path3, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath) {
28373
+ function matchFiles(path3, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath2) {
28374
28374
  path3 = normalizePath(path3);
28375
28375
  currentDirectory = normalizePath(currentDirectory);
28376
28376
  const patterns = getFileMatcherPatterns(path3, excludes, includes, useCaseSensitiveFileNames2, currentDirectory);
@@ -28385,7 +28385,7 @@ ${lanes.join("\n")}
28385
28385
  }
28386
28386
  return flatten(results);
28387
28387
  function visitDirectory(path22, absolutePath, depth2) {
28388
- const canonicalPath = toCanonical(realpath(absolutePath));
28388
+ const canonicalPath = toCanonical(realpath2(absolutePath));
28389
28389
  if (visited.has(canonicalPath)) return;
28390
28390
  visited.set(canonicalPath, true);
28391
28391
  const { files, directories } = getFileSystemEntries(path22);
@@ -38826,8 +38826,8 @@ ${lanes.join("\n")}
38826
38826
  return void 0;
38827
38827
  }
38828
38828
  function tryRenameExternalModule(factory2, moduleName, sourceFile) {
38829
- const rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text);
38830
- return rename ? factory2.createStringLiteral(rename) : void 0;
38829
+ const rename2 = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text);
38830
+ return rename2 ? factory2.createStringLiteral(rename2) : void 0;
38831
38831
  }
38832
38832
  function tryGetModuleNameFromFile(factory2, file, host, options) {
38833
38833
  if (!file) {
@@ -129580,7 +129580,7 @@ ${lanes.join("\n")}
129580
129580
  }
129581
129581
  }
129582
129582
  function createImportCallExpressionAMD(arg, containsLexicalThis) {
129583
- const resolve10 = factory2.createUniqueName("resolve");
129583
+ const resolve11 = factory2.createUniqueName("resolve");
129584
129584
  const reject = factory2.createUniqueName("reject");
129585
129585
  const parameters = [
129586
129586
  factory2.createParameterDeclaration(
@@ -129589,7 +129589,7 @@ ${lanes.join("\n")}
129589
129589
  /*dotDotDotToken*/
129590
129590
  void 0,
129591
129591
  /*name*/
129592
- resolve10
129592
+ resolve11
129593
129593
  ),
129594
129594
  factory2.createParameterDeclaration(
129595
129595
  /*modifiers*/
@@ -129606,7 +129606,7 @@ ${lanes.join("\n")}
129606
129606
  factory2.createIdentifier("require"),
129607
129607
  /*typeArguments*/
129608
129608
  void 0,
129609
- [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve10, reject]
129609
+ [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve11, reject]
129610
129610
  )
129611
129611
  )
129612
129612
  ]);
@@ -140607,7 +140607,7 @@ ${lanes.join("\n")}
140607
140607
  addOrDeleteFileOrDirectory,
140608
140608
  addOrDeleteFile,
140609
140609
  clearCache,
140610
- realpath: host.realpath && realpath
140610
+ realpath: host.realpath && realpath2
140611
140611
  };
140612
140612
  function toPath3(fileName) {
140613
140613
  return toPath(fileName, currentDirectory, getCanonicalFileName);
@@ -140718,7 +140718,7 @@ ${lanes.join("\n")}
140718
140718
  const rootResult = tryReadDirectory2(rootDir2, rootDirPath);
140719
140719
  let rootSymLinkResult;
140720
140720
  if (rootResult !== void 0) {
140721
- return matchFiles(rootDir2, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath);
140721
+ return matchFiles(rootDir2, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath2);
140722
140722
  }
140723
140723
  return host.readDirectory(rootDir2, extensions, excludes, includes, depth);
140724
140724
  function getFileSystemEntries(dir) {
@@ -140747,7 +140747,7 @@ ${lanes.join("\n")}
140747
140747
  return result;
140748
140748
  }
140749
140749
  }
140750
- function realpath(s) {
140750
+ function realpath2(s) {
140751
140751
  return host.realpath ? host.realpath(s) : s;
140752
140752
  }
140753
140753
  function clearFirstAncestorEntry(fileOrDirectoryPath) {
@@ -141202,7 +141202,7 @@ ${lanes.join("\n")}
141202
141202
  return getDirectoryPath(normalizePath(system.getExecutingFilePath()));
141203
141203
  }
141204
141204
  const newLine = getNewLineCharacter(options);
141205
- const realpath = system.realpath && ((path3) => system.realpath(path3));
141205
+ const realpath2 = system.realpath && ((path3) => system.realpath(path3));
141206
141206
  const compilerHost = {
141207
141207
  getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), setParentNodes),
141208
141208
  getDefaultLibLocation,
@@ -141222,7 +141222,7 @@ ${lanes.join("\n")}
141222
141222
  directoryExists: (directoryName) => system.directoryExists(directoryName),
141223
141223
  getEnvironmentVariable: (name) => system.getEnvironmentVariable ? system.getEnvironmentVariable(name) : "",
141224
141224
  getDirectories: (path3) => system.getDirectories(path3),
141225
- realpath,
141225
+ realpath: realpath2,
141226
141226
  readDirectory: (path3, extensions, include, exclude, depth) => system.readDirectory(path3, extensions, include, exclude, depth),
141227
141227
  createDirectory: (d) => system.createDirectory(d),
141228
141228
  createHash: maybeBind(system, system.createHash)
@@ -142417,9 +142417,9 @@ ${lanes.join("\n")}
142417
142417
  /*ignoreCase*/
142418
142418
  false
142419
142419
  )) {
142420
- const basename9 = getBaseFileName(a.fileName);
142421
- if (basename9 === "lib.d.ts" || basename9 === "lib.es6.d.ts") return 0;
142422
- const name = removeSuffix(removePrefix(basename9, "lib."), ".d.ts");
142420
+ const basename10 = getBaseFileName(a.fileName);
142421
+ if (basename10 === "lib.d.ts" || basename10 === "lib.es6.d.ts") return 0;
142422
+ const name = removeSuffix(removePrefix(basename10, "lib."), ".d.ts");
142423
142423
  const index = libs.indexOf(name);
142424
142424
  if (index !== -1) return index + 1;
142425
142425
  }
@@ -173528,19 +173528,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
173528
173528
  }
173529
173529
  function convertNamedExport(sourceFile, assignment, changes, exports2) {
173530
173530
  const { text: text2 } = assignment.left.name;
173531
- const rename = exports2.get(text2);
173532
- if (rename !== void 0) {
173531
+ const rename2 = exports2.get(text2);
173532
+ if (rename2 !== void 0) {
173533
173533
  const newNodes = [
173534
173534
  makeConst(
173535
173535
  /*modifiers*/
173536
173536
  void 0,
173537
- rename,
173537
+ rename2,
173538
173538
  assignment.right
173539
173539
  ),
173540
173540
  makeExportDeclaration([factory.createExportSpecifier(
173541
173541
  /*isTypeOnly*/
173542
173542
  false,
173543
- rename,
173543
+ rename2,
173544
173544
  text2
173545
173545
  )])
173546
173546
  ];
@@ -205053,9 +205053,9 @@ ${options.prefix}` : "\n" : options.prefix
205053
205053
  if (this.host.realpath) {
205054
205054
  Debug.assert(!!this.containingProjects.length);
205055
205055
  const project = this.containingProjects[0];
205056
- const realpath = this.host.realpath(this.path);
205057
- if (realpath) {
205058
- this.realpath = project.toPath(realpath);
205056
+ const realpath2 = this.host.realpath(this.path);
205057
+ if (realpath2) {
205058
+ this.realpath = project.toPath(realpath2);
205059
205059
  if (this.realpath !== this.path) {
205060
205060
  project.projectService.realpathToScriptInfos.add(this.realpath, this);
205061
205061
  }
@@ -206345,8 +206345,8 @@ ${options.prefix}` : "\n" : options.prefix
206345
206345
  }
206346
206346
  };
206347
206347
  for (const file of files) {
206348
- const basename9 = getBaseFileName(file);
206349
- if (basename9 === "package.json" || basename9 === "bower.json") {
206348
+ const basename10 = getBaseFileName(file);
206349
+ if (basename10 === "package.json" || basename10 === "bower.json") {
206350
206350
  createProjectWatcher(
206351
206351
  file,
206352
206352
  "FileWatcher"
@@ -209092,9 +209092,9 @@ ${options.prefix}` : "\n" : options.prefix
209092
209092
  this.filenameToScriptInfo.delete(info.path);
209093
209093
  this.filenameToScriptInfoVersion.set(info.path, info.textStorage.version);
209094
209094
  this.stopWatchingScriptInfo(info);
209095
- const realpath = info.getRealpathIfDifferent();
209096
- if (realpath) {
209097
- this.realpathToScriptInfos.remove(realpath, info);
209095
+ const realpath2 = info.getRealpathIfDifferent();
209096
+ if (realpath2) {
209097
+ this.realpathToScriptInfos.remove(realpath2, info);
209098
209098
  }
209099
209099
  info.closeSourceMapFileWatcher();
209100
209100
  }
@@ -209983,9 +209983,9 @@ All files are: ${JSON.stringify(names)}`,
209983
209983
  getSymlinkedProjects(info) {
209984
209984
  let projects;
209985
209985
  if (this.realpathToScriptInfos) {
209986
- const realpath = info.getRealpathIfDifferent();
209987
- if (realpath) {
209988
- forEach(this.realpathToScriptInfos.get(realpath), combineProjects);
209986
+ const realpath2 = info.getRealpathIfDifferent();
209987
+ if (realpath2) {
209988
+ forEach(this.realpathToScriptInfos.get(realpath2), combineProjects);
209989
209989
  }
209990
209990
  forEach(this.realpathToScriptInfos.get(info.path), combineProjects);
209991
209991
  }
@@ -210030,8 +210030,8 @@ All files are: ${JSON.stringify(names)}`,
210030
210030
  var _a3;
210031
210031
  const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
210032
210032
  if (!fileOrDirectoryPath) return;
210033
- const basename9 = getBaseFileName(fileOrDirectoryPath);
210034
- if (((_a3 = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a3.size) && (basename9 === "package.json" || basename9 === "node_modules")) {
210033
+ const basename10 = getBaseFileName(fileOrDirectoryPath);
210034
+ if (((_a3 = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a3.size) && (basename10 === "package.json" || basename10 === "node_modules")) {
210035
210035
  result.affectedModuleSpecifierCacheProjects.forEach((project) => {
210036
210036
  var _a22;
210037
210037
  (_a22 = project.getModuleSpecifierCache()) == null ? void 0 : _a22.clear();
@@ -216517,8 +216517,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
216517
216517
  installPackage(options) {
216518
216518
  this.packageInstallId++;
216519
216519
  const request = { kind: "installPackage", ...options, id: this.packageInstallId };
216520
- const promise = new Promise((resolve10, reject) => {
216521
- (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve10, reject });
216520
+ const promise = new Promise((resolve11, reject) => {
216521
+ (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve11, reject });
216522
216522
  });
216523
216523
  this.installer.send(request);
216524
216524
  return promise;
@@ -218778,7 +218778,7 @@ var require_path_browserify = __commonJS({
218778
218778
  }
218779
218779
  var posix = {
218780
218780
  // path.resolve([from ...], to)
218781
- resolve: function resolve10() {
218781
+ resolve: function resolve11() {
218782
218782
  var resolvedPath = "";
218783
218783
  var resolvedAbsolute = false;
218784
218784
  var cwd;
@@ -218813,19 +218813,19 @@ var require_path_browserify = __commonJS({
218813
218813
  normalize: function normalize(path3) {
218814
218814
  assertPath(path3);
218815
218815
  if (path3.length === 0) return ".";
218816
- var isAbsolute6 = path3.charCodeAt(0) === 47;
218816
+ var isAbsolute7 = path3.charCodeAt(0) === 47;
218817
218817
  var trailingSeparator = path3.charCodeAt(path3.length - 1) === 47;
218818
- path3 = normalizeStringPosix(path3, !isAbsolute6);
218819
- if (path3.length === 0 && !isAbsolute6) path3 = ".";
218818
+ path3 = normalizeStringPosix(path3, !isAbsolute7);
218819
+ if (path3.length === 0 && !isAbsolute7) path3 = ".";
218820
218820
  if (path3.length > 0 && trailingSeparator) path3 += "/";
218821
- if (isAbsolute6) return "/" + path3;
218821
+ if (isAbsolute7) return "/" + path3;
218822
218822
  return path3;
218823
218823
  },
218824
- isAbsolute: function isAbsolute6(path3) {
218824
+ isAbsolute: function isAbsolute7(path3) {
218825
218825
  assertPath(path3);
218826
218826
  return path3.length > 0 && path3.charCodeAt(0) === 47;
218827
218827
  },
218828
- join: function join18() {
218828
+ join: function join19() {
218829
218829
  if (arguments.length === 0)
218830
218830
  return ".";
218831
218831
  var joined;
@@ -218912,7 +218912,7 @@ var require_path_browserify = __commonJS({
218912
218912
  _makeLong: function _makeLong(path3) {
218913
218913
  return path3;
218914
218914
  },
218915
- dirname: function dirname10(path3) {
218915
+ dirname: function dirname11(path3) {
218916
218916
  assertPath(path3);
218917
218917
  if (path3.length === 0) return ".";
218918
218918
  var code = path3.charCodeAt(0);
@@ -218934,7 +218934,7 @@ var require_path_browserify = __commonJS({
218934
218934
  if (hasRoot && end === 1) return "//";
218935
218935
  return path3.slice(0, end);
218936
218936
  },
218937
- basename: function basename9(path3, ext2) {
218937
+ basename: function basename10(path3, ext2) {
218938
218938
  if (ext2 !== void 0 && typeof ext2 !== "string") throw new TypeError('"ext" argument must be a string');
218939
218939
  assertPath(path3);
218940
218940
  var start = 0;
@@ -219035,9 +219035,9 @@ var require_path_browserify = __commonJS({
219035
219035
  var ret = { root: "", dir: "", base: "", ext: "", name: "" };
219036
219036
  if (path3.length === 0) return ret;
219037
219037
  var code = path3.charCodeAt(0);
219038
- var isAbsolute6 = code === 47;
219038
+ var isAbsolute7 = code === 47;
219039
219039
  var start;
219040
- if (isAbsolute6) {
219040
+ if (isAbsolute7) {
219041
219041
  ret.root = "/";
219042
219042
  start = 1;
219043
219043
  } else {
@@ -219073,11 +219073,11 @@ var require_path_browserify = __commonJS({
219073
219073
  preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
219074
219074
  preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
219075
219075
  if (end !== -1) {
219076
- if (startPart === 0 && isAbsolute6) ret.base = ret.name = path3.slice(1, end);
219076
+ if (startPart === 0 && isAbsolute7) ret.base = ret.name = path3.slice(1, end);
219077
219077
  else ret.base = ret.name = path3.slice(startPart, end);
219078
219078
  }
219079
219079
  } else {
219080
- if (startPart === 0 && isAbsolute6) {
219080
+ if (startPart === 0 && isAbsolute7) {
219081
219081
  ret.name = path3.slice(1, startDot);
219082
219082
  ret.base = path3.slice(1, end);
219083
219083
  } else {
@@ -219087,7 +219087,7 @@ var require_path_browserify = __commonJS({
219087
219087
  ret.ext = path3.slice(startDot, end);
219088
219088
  }
219089
219089
  if (startPart > 0) ret.dir = path3.slice(0, startPart - 1);
219090
- else if (isAbsolute6) ret.dir = "/";
219090
+ else if (isAbsolute7) ret.dir = "/";
219091
219091
  return ret;
219092
219092
  },
219093
219093
  sep: "/",
@@ -221980,7 +221980,7 @@ var require_ts_morph_common = __commonJS({
221980
221980
  }
221981
221981
  }
221982
221982
  };
221983
- function matchFiles(path4, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getEntries, realpath, directoryExists) {
221983
+ function matchFiles(path4, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getEntries, realpath2, directoryExists) {
221984
221984
  return ts__namespace.matchFiles.apply(this, arguments);
221985
221985
  }
221986
221986
  function getFileMatcherPatterns(path4, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
@@ -222969,12 +222969,12 @@ ${nodeLocation}` : message;
222969
222969
  };
222970
222970
  var NodeRuntimeFileSystem = class {
222971
222971
  delete(path4) {
222972
- return new Promise((resolve10, reject) => {
222972
+ return new Promise((resolve11, reject) => {
222973
222973
  fs__namespace.rm(path4, { recursive: true }, (err) => {
222974
222974
  if (err)
222975
222975
  reject(err);
222976
222976
  else
222977
- resolve10();
222977
+ resolve11();
222978
222978
  });
222979
222979
  });
222980
222980
  }
@@ -222993,12 +222993,12 @@ ${nodeLocation}` : message;
222993
222993
  }));
222994
222994
  }
222995
222995
  readFile(filePath, encoding = "utf-8") {
222996
- return new Promise((resolve10, reject) => {
222996
+ return new Promise((resolve11, reject) => {
222997
222997
  fs__namespace.readFile(filePath, encoding, (err, data) => {
222998
222998
  if (err)
222999
222999
  reject(err);
223000
223000
  else
223001
- resolve10(data);
223001
+ resolve11(data);
223002
223002
  });
223003
223003
  });
223004
223004
  }
@@ -223006,12 +223006,12 @@ ${nodeLocation}` : message;
223006
223006
  return fs__namespace.readFileSync(filePath, encoding);
223007
223007
  }
223008
223008
  async writeFile(filePath, fileText) {
223009
- await new Promise((resolve10, reject) => {
223009
+ await new Promise((resolve11, reject) => {
223010
223010
  fs__namespace.writeFile(filePath, fileText, (err) => {
223011
223011
  if (err)
223012
223012
  reject(err);
223013
223013
  else
223014
- resolve10();
223014
+ resolve11();
223015
223015
  });
223016
223016
  });
223017
223017
  }
@@ -223025,12 +223025,12 @@ ${nodeLocation}` : message;
223025
223025
  fs__namespace.mkdirSync(dirPath, { recursive: true });
223026
223026
  }
223027
223027
  move(srcPath, destPath) {
223028
- return new Promise((resolve10, reject) => {
223028
+ return new Promise((resolve11, reject) => {
223029
223029
  fs__namespace.rename(srcPath, destPath, (err) => {
223030
223030
  if (err)
223031
223031
  reject(err);
223032
223032
  else
223033
- resolve10();
223033
+ resolve11();
223034
223034
  });
223035
223035
  });
223036
223036
  }
@@ -223038,12 +223038,12 @@ ${nodeLocation}` : message;
223038
223038
  fs__namespace.renameSync(srcPath, destPath);
223039
223039
  }
223040
223040
  copy(srcPath, destPath) {
223041
- return new Promise((resolve10, reject) => {
223041
+ return new Promise((resolve11, reject) => {
223042
223042
  fs__namespace.copyFile(srcPath, destPath, (err) => {
223043
223043
  if (err)
223044
223044
  reject(err);
223045
223045
  else
223046
- resolve10();
223046
+ resolve11();
223047
223047
  });
223048
223048
  });
223049
223049
  }
@@ -223051,15 +223051,15 @@ ${nodeLocation}` : message;
223051
223051
  fs__namespace.copyFileSync(srcPath, destPath);
223052
223052
  }
223053
223053
  stat(path4) {
223054
- return new Promise((resolve10, reject) => {
223054
+ return new Promise((resolve11, reject) => {
223055
223055
  fs__namespace.stat(path4, (err, stat) => {
223056
223056
  if (err) {
223057
223057
  if (err.code === "ENOENT" || err.code === "ENOTDIR")
223058
- resolve10(void 0);
223058
+ resolve11(void 0);
223059
223059
  else
223060
223060
  reject(err);
223061
223061
  } else {
223062
- resolve10(stat);
223062
+ resolve11(stat);
223063
223063
  }
223064
223064
  });
223065
223065
  });
@@ -299674,7 +299674,7 @@ async function getDaemonReportedIdentity(port) {
299674
299674
  async function waitForDaemonReady(port, expectedVersion, attempts = 24) {
299675
299675
  let observedVersion = null;
299676
299676
  for (let attempt = 0; attempt < attempts; attempt++) {
299677
- await new Promise((resolve10) => setTimeout(resolve10, 500));
299677
+ await new Promise((resolve11) => setTimeout(resolve11, 500));
299678
299678
  const identity = await getDaemonReportedIdentity(port);
299679
299679
  if (!identity) continue;
299680
299680
  observedVersion = identity.bootVersion;
@@ -299685,10 +299685,10 @@ async function waitForDaemonReady(port, expectedVersion, attempts = 24) {
299685
299685
  return { ok: false, observedVersion };
299686
299686
  }
299687
299687
  function delay(ms) {
299688
- return new Promise((resolve10) => setTimeout(resolve10, ms));
299688
+ return new Promise((resolve11) => setTimeout(resolve11, ms));
299689
299689
  }
299690
299690
  function runUtilityCommand(command, args, timeout) {
299691
- return new Promise((resolve10) => {
299691
+ return new Promise((resolve11) => {
299692
299692
  let settled = false;
299693
299693
  let stdout = "";
299694
299694
  let stderr = "";
@@ -299698,7 +299698,7 @@ function runUtilityCommand(command, args, timeout) {
299698
299698
  if (settled) return;
299699
299699
  settled = true;
299700
299700
  if (timer) clearTimeout(timer);
299701
- resolve10({ available, code, stdout, stderr });
299701
+ resolve11({ available, code, stdout, stderr });
299702
299702
  };
299703
299703
  let child;
299704
299704
  try {
@@ -299707,7 +299707,7 @@ function runUtilityCommand(command, args, timeout) {
299707
299707
  windowsHide: true
299708
299708
  });
299709
299709
  } catch {
299710
- resolve10({ available: false, code: null, stdout: "", stderr: "" });
299710
+ resolve11({ available: false, code: null, stdout: "", stderr: "" });
299711
299711
  return;
299712
299712
  }
299713
299713
  child.stdout?.setEncoding("utf8");
@@ -299863,13 +299863,13 @@ async function portHolderPids(port) {
299863
299863
  return daemonListenerPids(port);
299864
299864
  }
299865
299865
  async function daemonPortIsFree(port) {
299866
- return new Promise((resolve10) => {
299866
+ return new Promise((resolve11) => {
299867
299867
  const probe = createNetServer();
299868
299868
  let settled = false;
299869
299869
  const finish = (free) => {
299870
299870
  if (settled) return;
299871
299871
  settled = true;
299872
- resolve10(free);
299872
+ resolve11(free);
299873
299873
  };
299874
299874
  probe.once("error", () => finish(false));
299875
299875
  probe.once("listening", () => {
@@ -300176,7 +300176,7 @@ async function quiesceDaemonForUpdate(port = getDaemonPort()) {
300176
300176
 
300177
300177
  // packages/cli/src/update-service.ts
300178
300178
  import { spawn as spawn2 } from "node:child_process";
300179
- import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
300179
+ import { createHash as createHash3, randomUUID as randomUUID3 } from "node:crypto";
300180
300180
  import {
300181
300181
  constants,
300182
300182
  chmodSync,
@@ -300197,7 +300197,7 @@ import {
300197
300197
  writeSync as writeSync2
300198
300198
  } from "node:fs";
300199
300199
  import { homedir as homedir15 } from "node:os";
300200
- import { dirname as dirname8, join as join15 } from "node:path";
300200
+ import { dirname as dirname9, join as join16 } from "node:path";
300201
300201
 
300202
300202
  // packages/cli/src/service-version.ts
300203
300203
  var OmniusVersionError = class extends Error {
@@ -300252,6 +300252,87 @@ function compareOmniusVersions(left, right) {
300252
300252
  return 0;
300253
300253
  }
300254
300254
 
300255
+ // packages/cli/src/npm-install-recovery.ts
300256
+ import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
300257
+ import { lstat, realpath, rename, rm } from "node:fs/promises";
300258
+ import { basename as basename8, dirname as dirname8, isAbsolute as isAbsolute6, join as join15, resolve as resolve10 } from "node:path";
300259
+ function parseNpmRenameCollision(diagnostic) {
300260
+ const fields = /* @__PURE__ */ new Map();
300261
+ let previousPathField = false;
300262
+ for (const line of diagnostic.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").split(/\r?\n/)) {
300263
+ const match2 = /^\s*npm\s+(?:error|ERR!)\s+(code|syscall|path|dest)\s+(.+?)\s*$/.exec(line);
300264
+ if (previousPathField && line.trim() && !/^\s*npm\s+(?:error|ERR!)(?:\s|$)/.test(line)) return null;
300265
+ if (match2) {
300266
+ if (fields.has(match2[1])) return null;
300267
+ fields.set(match2[1], match2[2]);
300268
+ previousPathField = match2[1] === "path" || match2[1] === "dest";
300269
+ } else if (line.trim()) previousPathField = false;
300270
+ }
300271
+ const code = fields.get("code"), path3 = fields.get("path"), dest = fields.get("dest");
300272
+ if (code !== "ENOTEMPTY" && code !== "EEXIST" || fields.get("syscall") !== "rename" || !path3 || !dest || /[\x00-\x1f\x7f]/.test(path3 + dest)) return null;
300273
+ return { code, syscall: "rename", path: path3, dest };
300274
+ }
300275
+ function retiredNpmPackagePath(packagePath) {
300276
+ const suffix = createHash2("sha1").update(packagePath).digest("base64").replace(/[^a-zA-Z0-9]/g, "").slice(0, 8);
300277
+ return join15(dirname8(packagePath), `.${basename8(packagePath)}-${suffix}`);
300278
+ }
300279
+ function assertNotCancelled(signal) {
300280
+ signal?.throwIfAborted();
300281
+ }
300282
+ function sameIdentity(left, right) {
300283
+ return left.dev === right.dev && left.ino === right.ino;
300284
+ }
300285
+ function assertOwnedDirectory(metadata, label) {
300286
+ if (!metadata.isDirectory() || metadata.isSymbolicLink() || process.platform !== "win32" && (metadata.uid !== process.getuid?.() || (metadata.mode & 2) !== 0)) {
300287
+ throw new Error(`Cannot recover npm retirement collision: ${label} must be an owned directory, not a link.`);
300288
+ }
300289
+ }
300290
+ async function recoverNpmRetirementCollision(collision, modulesRoot, options = {}) {
300291
+ const current = () => {
300292
+ assertNotCancelled(options.signal);
300293
+ options.assertOwned?.();
300294
+ assertNotCancelled(options.signal);
300295
+ };
300296
+ current();
300297
+ if (collision.code !== "ENOTEMPTY" && collision.code !== "EEXIST" || collision.syscall !== "rename" || !isAbsolute6(modulesRoot) || /[\x00-\x1f\x7f]/.test(modulesRoot + collision.path + collision.dest)) return null;
300298
+ const root = resolve10(modulesRoot), source = join15(root, "omnius"), retired = retiredNpmPackagePath(source);
300299
+ if (collision.path !== source || collision.dest !== retired || dirname8(retired) !== root) return null;
300300
+ const rootBefore = await lstat(root);
300301
+ assertOwnedDirectory(rootBefore, "global modules root");
300302
+ const canonicalRoot = await realpath(root);
300303
+ let before;
300304
+ try {
300305
+ before = await lstat(retired);
300306
+ } catch (error) {
300307
+ if (error.code === "ENOENT") return null;
300308
+ throw error;
300309
+ }
300310
+ assertOwnedDirectory(before, "retired package");
300311
+ const backup = join15(root, `.omnius-update-recovery-${randomUUID2()}`);
300312
+ current();
300313
+ const [rootNow, candidateNow] = await Promise.all([lstat(root), lstat(retired)]);
300314
+ if (!sameIdentity(rootBefore, rootNow) || !sameIdentity(before, candidateNow) || await realpath(root) !== canonicalRoot) throw new Error("npm retirement directory changed before recovery; no cleanup was attempted.");
300315
+ assertOwnedDirectory(rootNow, "global modules root");
300316
+ assertOwnedDirectory(candidateNow, "retired package");
300317
+ current();
300318
+ await rename(retired, backup);
300319
+ return { modulesRoot: root, retiredPath: retired, backupPath: backup, device: before.dev, inode: before.ino };
300320
+ }
300321
+ async function removeVerifiedNpmRetirementBackup(backup) {
300322
+ const root = resolve10(backup.modulesRoot);
300323
+ if (!isAbsolute6(backup.modulesRoot) || dirname8(backup.backupPath) !== root || !/^\.omnius-update-recovery-[a-f0-9-]{36}$/.test(basename8(backup.backupPath)) || backup.retiredPath !== retiredNpmPackagePath(join15(root, "omnius"))) {
300324
+ throw new Error("Refusing cleanup outside the preserved npm retirement directory.");
300325
+ }
300326
+ const rootMetadata = await lstat(root);
300327
+ assertOwnedDirectory(rootMetadata, "global modules root");
300328
+ const metadata = await lstat(backup.backupPath);
300329
+ assertOwnedDirectory(metadata, "preserved retirement directory");
300330
+ if (metadata.dev !== backup.device || metadata.ino !== backup.inode) {
300331
+ throw new Error("Preserved npm retirement directory identity changed; its contents were retained.");
300332
+ }
300333
+ await rm(backup.backupPath, { recursive: true });
300334
+ }
300335
+
300255
300336
  // packages/cli/src/update-service.ts
300256
300337
  var UpdateCancelledError = class extends Error {
300257
300338
  constructor(message = "Update cancelled. Package changes already made are retained; no rollback is claimed.") {
@@ -300263,7 +300344,7 @@ var UpdateOwnershipBusyError = class extends Error {
300263
300344
  };
300264
300345
  function cancellationPath(operationId, paths) {
300265
300346
  if (!/^[a-zA-Z0-9_-]{1,128}$/.test(operationId)) throw new Error("Invalid update operation identity");
300266
- return join15(paths.stateDir, `cancel-${operationId}.json`);
300347
+ return join16(paths.stateDir, `cancel-${operationId}.json`);
300267
300348
  }
300268
300349
  function watchUpdateCancellation(operationId, paths = resolveUpdatePaths()) {
300269
300350
  const controller = new AbortController();
@@ -300291,16 +300372,16 @@ function watchUpdateCancellation(operationId, paths = resolveUpdatePaths()) {
300291
300372
  } };
300292
300373
  }
300293
300374
  function resolveUpdatePaths(env = process.env, platform2 = process.platform, home = homedir15()) {
300294
- const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join15(home, "AppData", "Local") : platform2 === "darwin" ? join15(home, "Library", "Application Support") : env["XDG_STATE_HOME"] || join15(home, ".local", "state");
300295
- const cacheBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join15(home, "AppData", "Local") : platform2 === "darwin" ? join15(home, "Library", "Caches") : env["XDG_CACHE_HOME"] || join15(home, ".cache");
300296
- const stateDir = join15(stateBase, platform2 === "win32" ? "Omnius" : "omnius", "update");
300297
- const cacheDir = join15(cacheBase, platform2 === "win32" ? "Omnius" : "omnius", "npm-update");
300375
+ const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join16(home, "AppData", "Local") : platform2 === "darwin" ? join16(home, "Library", "Application Support") : env["XDG_STATE_HOME"] || join16(home, ".local", "state");
300376
+ const cacheBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join16(home, "AppData", "Local") : platform2 === "darwin" ? join16(home, "Library", "Caches") : env["XDG_CACHE_HOME"] || join16(home, ".cache");
300377
+ const stateDir = join16(stateBase, platform2 === "win32" ? "Omnius" : "omnius", "update");
300378
+ const cacheDir = join16(cacheBase, platform2 === "win32" ? "Omnius" : "omnius", "npm-update");
300298
300379
  return {
300299
300380
  stateDir,
300300
300381
  cacheDir,
300301
- stateFile: join15(stateDir, "state.json"),
300302
- lockFile: join15(stateDir, "update.lock"),
300303
- logFile: join15(stateDir, "update.log")
300382
+ stateFile: join16(stateDir, "state.json"),
300383
+ lockFile: join16(stateDir, "update.lock"),
300384
+ logFile: join16(stateDir, "update.log")
300304
300385
  };
300305
300386
  }
300306
300387
  function ensurePrivateDirectories(paths) {
@@ -300361,7 +300442,7 @@ function processIdentity(pid) {
300361
300442
  }
300362
300443
  function withUpdateOwnership(paths, mutation) {
300363
300444
  ensurePrivateDirectories(paths);
300364
- const path3 = paths.lockFile + ".guard", nonce = randomUUID2();
300445
+ const path3 = paths.lockFile + ".guard", nonce = randomUUID3();
300365
300446
  let fd;
300366
300447
  try {
300367
300448
  fd = openSync3(path3, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 384);
@@ -300415,7 +300496,7 @@ async function retryUpdateOwnership(attempt, timeoutMs = 2e3) {
300415
300496
  } catch {
300416
300497
  }
300417
300498
  if (!live) throw error;
300418
- await new Promise((resolve10) => setTimeout(resolve10, 25));
300499
+ await new Promise((resolve11) => setTimeout(resolve11, 25));
300419
300500
  }
300420
300501
  }
300421
300502
  }
@@ -300424,7 +300505,7 @@ function releaseMatchingUpdateLock(paths, operationId, pid) {
300424
300505
  if (lock?.operation_id === operationId && (pid === void 0 || lock.pid === pid)) unlinkSync3(paths.lockFile);
300425
300506
  }
300426
300507
  function atomicPrivateJson(path3, value) {
300427
- const temp = `${path3}.${process.pid}.${randomUUID2()}.tmp`;
300508
+ const temp = `${path3}.${process.pid}.${randomUUID3()}.tmp`;
300428
300509
  try {
300429
300510
  writeFileSync4(temp, `${JSON.stringify(value, null, 2)}
300430
300511
  `, {
@@ -300480,8 +300561,8 @@ function assertExactUpdateTarget(targetVersion, fromVersion) {
300480
300561
  return target;
300481
300562
  }
300482
300563
  function npmCandidates(execPath = process.execPath) {
300483
- const nodeDir = dirname8(execPath);
300484
- return process.platform === "win32" ? [join15(nodeDir, "npm.cmd"), join15(nodeDir, "npm.exe"), "npm.cmd", "npm"] : [join15(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm", "npm"];
300564
+ const nodeDir = dirname9(execPath);
300565
+ return process.platform === "win32" ? [join16(nodeDir, "npm.cmd"), join16(nodeDir, "npm.exe"), "npm.cmd", "npm"] : [join16(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm", "npm"];
300485
300566
  }
300486
300567
  function runnableCommand(candidate) {
300487
300568
  return candidate.includes("/") || candidate.includes("\\") ? existsSync6(candidate) : true;
@@ -300499,7 +300580,7 @@ async function runUpdateCommand(command, args, options = {}) {
300499
300580
  if (options.signal?.aborted) {
300500
300581
  return { status: null, stdout: "", stderr: "command cancelled", signal: null, error: new Error("command cancelled") };
300501
300582
  }
300502
- return await new Promise((resolve10) => {
300583
+ return await new Promise((resolve11) => {
300503
300584
  const child = spawn2(command, args, {
300504
300585
  env: options.env ?? process.env,
300505
300586
  cwd: options.cwd,
@@ -300545,7 +300626,7 @@ async function runUpdateCommand(command, args, options = {}) {
300545
300626
  clearTimeout(timer);
300546
300627
  if (forceTimer) clearTimeout(forceTimer);
300547
300628
  options.signal?.removeEventListener("abort", onAbort);
300548
- resolve10(result);
300629
+ resolve11(result);
300549
300630
  };
300550
300631
  const onAbort = () => {
300551
300632
  terminate(new Error("command cancelled"));
@@ -300573,10 +300654,10 @@ async function runUpdateCommand(command, args, options = {}) {
300573
300654
  }
300574
300655
  var runCommand = runUpdateCommand;
300575
300656
  function globalPackageCandidates(prefix) {
300576
- return process.platform === "win32" ? [join15(prefix, "node_modules", "omnius", "package.json"), join15(prefix, "omnius", "package.json")] : [join15(prefix, "lib", "node_modules", "omnius", "package.json"), join15(prefix, "node_modules", "omnius", "package.json")];
300657
+ return process.platform === "win32" ? [join16(prefix, "node_modules", "omnius", "package.json"), join16(prefix, "omnius", "package.json")] : [join16(prefix, "lib", "node_modules", "omnius", "package.json"), join16(prefix, "node_modules", "omnius", "package.json")];
300577
300658
  }
300578
300659
  function globalExecutableCandidates(prefix) {
300579
- return process.platform === "win32" ? [join15(prefix, "omnius.cmd"), join15(prefix, "omnius.exe"), join15(prefix, "bin", "omnius.cmd")] : [join15(prefix, "bin", "omnius")];
300660
+ return process.platform === "win32" ? [join16(prefix, "omnius.cmd"), join16(prefix, "omnius.exe"), join16(prefix, "bin", "omnius.cmd")] : [join16(prefix, "bin", "omnius")];
300580
300661
  }
300581
300662
  async function inspectGlobalOmniusInstall(expectedVersion, options = {}) {
300582
300663
  const npmPath = options.npmPath ?? resolveNpmPath();
@@ -300609,7 +300690,7 @@ ${versionResult.stderr}`) ?? "";
300609
300690
  executablePath,
300610
300691
  installedVersion,
300611
300692
  executableVersion,
300612
- packageHash: createHash2("sha256").update(packageJsonRaw).digest("hex")
300693
+ packageHash: createHash3("sha256").update(packageJsonRaw).digest("hex")
300613
300694
  };
300614
300695
  }
300615
300696
  function transitionOnce(current, patch, paths) {
@@ -300635,7 +300716,7 @@ async function quiesceDaemonWithRetry(quiesce, attempts = 3, pauseMs = 250) {
300635
300716
  } catch {
300636
300717
  }
300637
300718
  if (attempt < boundedAttempts && pauseMs > 0) {
300638
- await new Promise((resolve10) => setTimeout(resolve10, pauseMs));
300719
+ await new Promise((resolve11) => setTimeout(resolve11, pauseMs));
300639
300720
  }
300640
300721
  }
300641
300722
  return false;
@@ -300657,14 +300738,16 @@ async function installGlobalPackageStreaming(input) {
300657
300738
  onStderr: (text2) => process.stderr.write(text2)
300658
300739
  });
300659
300740
  const exitCode = result.status ?? -1;
300741
+ const renameCollision = parseNpmRenameCollision(result.stderr);
300660
300742
  return { exitCode, ...result.error || exitCode !== 0 ? {
300661
300743
  error: result.error?.message || result.stderr.slice(-8e3).trim() || `npm install exited with ${result.signal || exitCode}`
300662
- } : {} };
300744
+ } : {}, ...renameCollision ? { renameCollision } : {} };
300663
300745
  }
300664
300746
  async function runVerifiedUpdateTransaction(initial, dependencies, paths = resolveUpdatePaths()) {
300665
300747
  let state = initial;
300666
300748
  let daemonQuiesced = false;
300667
300749
  let installStarted = false;
300750
+ let retirementBackup = null;
300668
300751
  let cancelPublication;
300669
300752
  const throwIfCancelled = () => {
300670
300753
  if (dependencies.signal?.aborted) throw new UpdateCancelledError();
@@ -300685,7 +300768,7 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
300685
300768
  const npmPath = resolveNpmPath();
300686
300769
  const env = {
300687
300770
  ...process.env,
300688
- PATH: [dirname8(process.execPath), process.env.PATH ?? ""].filter(Boolean).join(process.platform === "win32" ? ";" : ":"),
300771
+ PATH: [dirname9(process.execPath), process.env.PATH ?? ""].filter(Boolean).join(process.platform === "win32" ? ";" : ":"),
300689
300772
  NPM_CONFIG_CACHE: paths.cacheDir,
300690
300773
  npm_config_cache: paths.cacheDir,
300691
300774
  npm_config_prefer_online: "true",
@@ -300714,10 +300797,39 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
300714
300797
  throwIfCancelled();
300715
300798
  const installer = dependencies.install ?? installGlobalPackageStreaming;
300716
300799
  installStarted = true;
300717
- const installResult = await installer({ npmPath, targetVersion: target, env, signal: dependencies.signal });
300718
- state = await transition(state, { installer_exit_code: installResult.exitCode }, paths);
300719
- throwIfCancelled();
300720
- if (installResult.exitCode !== 0) {
300800
+ for (let attempt = 1; attempt <= 2; attempt++) {
300801
+ state = await transition(state, { installer_attempt: attempt }, paths);
300802
+ throwIfCancelled();
300803
+ const installResult = await installer({ npmPath, targetVersion: target, env, signal: dependencies.signal });
300804
+ state = await transition(state, { installer_exit_code: installResult.exitCode }, paths);
300805
+ throwIfCancelled();
300806
+ if (installResult.exitCode === 0) break;
300807
+ const collision = installResult.renameCollision ?? parseNpmRenameCollision(installResult.error ?? "");
300808
+ if (attempt === 1 && collision) {
300809
+ const rootProbe = await runCommand(npmPath, ["root", "-g"], { env, timeout: 1e4, signal: dependencies.signal });
300810
+ throwIfCancelled();
300811
+ if (rootProbe.status === 0 && rootProbe.stdout.trim()) {
300812
+ retirementBackup = await recoverNpmRetirementCollision(collision, rootProbe.stdout.trim(), {
300813
+ signal: dependencies.signal,
300814
+ assertOwned: () => {
300815
+ const persisted = readUpdateState(paths);
300816
+ if (!persisted || persisted.operation_id !== state.operation_id || persisted.status !== "running" || state.worker_adopted_at && !ownsAdoptedWorker(persisted, state.operation_id, state.pid, paths)) {
300817
+ throw new Error("Update ownership changed before npm collision recovery; no directory was moved.");
300818
+ }
300819
+ }
300820
+ });
300821
+ if (retirementBackup) {
300822
+ state = await transition(state, { npm_recovery: {
300823
+ retired_path: retirementBackup.retiredPath,
300824
+ backup_path: retirementBackup.backupPath,
300825
+ status: "retained"
300826
+ } }, paths);
300827
+ process.stderr.write("[omnius update] Preserved the occupied npm retirement directory; retrying the same package once (attempt 2/2).\n");
300828
+ throwIfCancelled();
300829
+ continue;
300830
+ }
300831
+ }
300832
+ }
300721
300833
  throw new Error(installResult.error || `npm install exited with code ${installResult.exitCode}`);
300722
300834
  }
300723
300835
  const evidence = dependencies.inspectInstall ? await dependencies.inspectInstall(target, npmPath, env) : await inspectGlobalOmniusInstall(target, { npmPath, env });
@@ -300742,7 +300854,7 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
300742
300854
  if (daemon?.bootVersion === target && daemon.bootPackageHash === evidence.packageHash) {
300743
300855
  break;
300744
300856
  }
300745
- if (attempt < 3) await new Promise((resolve10) => setTimeout(resolve10, 1e3));
300857
+ if (attempt < 3) await new Promise((resolve11) => setTimeout(resolve11, 1e3));
300746
300858
  }
300747
300859
  if (!daemon || daemon.bootVersion !== target) {
300748
300860
  const observed = daemon?.bootVersion ?? "unreachable";
@@ -300774,6 +300886,21 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
300774
300886
  state = await transition(state, { tray_restarted: true }, paths);
300775
300887
  }
300776
300888
  throwIfCancelled();
300889
+ if (retirementBackup && state.npm_recovery) {
300890
+ const recovery = state.npm_recovery;
300891
+ let cleanupWarning;
300892
+ try {
300893
+ await removeVerifiedNpmRetirementBackup(retirementBackup);
300894
+ } catch (error) {
300895
+ cleanupWarning = error instanceof Error ? error.message : String(error);
300896
+ }
300897
+ state = await transition(state, { npm_recovery: {
300898
+ ...recovery,
300899
+ status: cleanupWarning ? "retained" : "removed",
300900
+ ...cleanupWarning ? { cleanup_warning: cleanupWarning } : {}
300901
+ } }, paths);
300902
+ }
300903
+ throwIfCancelled();
300777
300904
  const now = (/* @__PURE__ */ new Date()).toISOString();
300778
300905
  state = await transition(state, {
300779
300906
  status: "completed",
@@ -300804,6 +300931,7 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
300804
300931
  error: cancelled ? "Update cancelled after the owned operation settled." : message,
300805
300932
  remediation: [
300806
300933
  cancelled && installStarted ? "Package files may have changed. No rollback was performed; verify the installed version before retrying." : void 0,
300934
+ state.npm_recovery?.status === "retained" ? `The prior npm retirement directory is preserved at ${state.npm_recovery.backup_path}.` : void 0,
300807
300935
  permissionRemediation(message),
300808
300936
  recoveryNote
300809
300937
  ].filter(Boolean).join(" ") || void 0
@@ -300833,7 +300961,7 @@ import {
300833
300961
  writeSync as writeSync3
300834
300962
  } from "node:fs";
300835
300963
  import { homedir as homedir16, tmpdir as tmpdir6 } from "node:os";
300836
- import { basename as basename8, delimiter, dirname as dirname9, join as join17 } from "node:path";
300964
+ import { basename as basename9, delimiter, dirname as dirname10, join as join18 } from "node:path";
300837
300965
 
300838
300966
  // packages/cli/src/tray-menu.ts
300839
300967
  import { execFile as execFile4 } from "node:child_process";
@@ -300857,10 +300985,10 @@ var cachedLimit = trayLabelLimit();
300857
300985
  var run = promisify4(execFile4);
300858
300986
 
300859
300987
  // packages/cli/src/updater.ts
300860
- import { join as join16 } from "node:path";
300988
+ import { join as join17 } from "node:path";
300861
300989
  var UPDATE_CHECK_INTERVAL_MS = 60 * 1e3;
300862
300990
  var CACHE_DIR = resolveUpdatePaths().stateDir;
300863
- var CACHE_FILE = join16(CACHE_DIR, "registry-check.json");
300991
+ var CACHE_FILE = join17(CACHE_DIR, "registry-check.json");
300864
300992
 
300865
300993
  // packages/cli/src/tray.ts
300866
300994
  var DEFAULT_ENDPOINT = "http://127.0.0.1:11435";
@@ -300868,19 +300996,19 @@ function uidSuffix() {
300868
300996
  return typeof process.getuid === "function" ? String(process.getuid()) : "user";
300869
300997
  }
300870
300998
  function resolveTrayPaths(env = process.env, platform2 = process.platform, home = homedir16()) {
300871
- const runtimeBase = env["XDG_RUNTIME_DIR"] || join17(tmpdir6(), `omnius-${uidSuffix()}`);
300872
- const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join17(home, "AppData", "Local") : env["XDG_STATE_HOME"] || join17(home, ".local", "state");
300873
- const configBase = platform2 === "win32" ? env["APPDATA"] || join17(home, "AppData", "Roaming") : env["XDG_CONFIG_HOME"] || join17(home, ".config");
300874
- const runtimeDir = join17(runtimeBase, "omnius");
300875
- const stateDir = platform2 === "win32" ? join17(stateBase, "Omnius") : join17(stateBase, "omnius");
300876
- const autostartFile = platform2 === "darwin" ? join17(home, "Library", "LaunchAgents", "ai.omnius.tray.plist") : platform2 === "win32" ? join17(configBase, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "omnius-tray.cmd") : join17(configBase, "autostart", "omnius-tray.desktop");
300999
+ const runtimeBase = env["XDG_RUNTIME_DIR"] || join18(tmpdir6(), `omnius-${uidSuffix()}`);
301000
+ const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join18(home, "AppData", "Local") : env["XDG_STATE_HOME"] || join18(home, ".local", "state");
301001
+ const configBase = platform2 === "win32" ? env["APPDATA"] || join18(home, "AppData", "Roaming") : env["XDG_CONFIG_HOME"] || join18(home, ".config");
301002
+ const runtimeDir = join18(runtimeBase, "omnius");
301003
+ const stateDir = platform2 === "win32" ? join18(stateBase, "Omnius") : join18(stateBase, "omnius");
301004
+ const autostartFile = platform2 === "darwin" ? join18(home, "Library", "LaunchAgents", "ai.omnius.tray.plist") : platform2 === "win32" ? join18(configBase, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "omnius-tray.cmd") : join18(configBase, "autostart", "omnius-tray.desktop");
300877
301005
  return {
300878
301006
  runtimeDir,
300879
301007
  stateDir,
300880
- pidFile: join17(runtimeDir, "tray.pid"),
300881
- stateFile: join17(runtimeDir, "tray-state.json"),
300882
- stdoutLog: join17(stateDir, "tray.log"),
300883
- stderrLog: join17(stateDir, "tray.err.log"),
301008
+ pidFile: join18(runtimeDir, "tray.pid"),
301009
+ stateFile: join18(runtimeDir, "tray-state.json"),
301010
+ stdoutLog: join18(stateDir, "tray.log"),
301011
+ stderrLog: join18(stateDir, "tray.err.log"),
300884
301012
  autostartFile
300885
301013
  };
300886
301014
  }
@@ -300968,7 +301096,7 @@ function readProcessState(path3) {
300968
301096
  }
300969
301097
  }
300970
301098
  async function commandOutput(command, args, timeout = 2e3) {
300971
- return await new Promise((resolve10) => {
301099
+ return await new Promise((resolve11) => {
300972
301100
  const child = spawn3(command, args, { stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
300973
301101
  let stdout = "";
300974
301102
  let settled = false;
@@ -300976,7 +301104,7 @@ async function commandOutput(command, args, timeout = 2e3) {
300976
301104
  if (settled) return;
300977
301105
  settled = true;
300978
301106
  clearTimeout(timer);
300979
- resolve10(stdout);
301107
+ resolve11(stdout);
300980
301108
  };
300981
301109
  child.stdout?.on("data", (chunk) => {
300982
301110
  stdout = `${stdout}${chunk.toString()}`.slice(-64 * 1024);
@@ -301073,7 +301201,7 @@ async function stopTray() {
301073
301201
  }
301074
301202
  return true;
301075
301203
  }
301076
- await new Promise((resolve10) => setTimeout(resolve10, 100));
301204
+ await new Promise((resolve11) => setTimeout(resolve11, 100));
301077
301205
  }
301078
301206
  if (!trayProcessCommandLooksOwned(await processCommandLine(pid))) return false;
301079
301207
  try {
@@ -301092,7 +301220,7 @@ async function stopTray() {
301092
301220
  }
301093
301221
  return true;
301094
301222
  }
301095
- await new Promise((resolve10) => setTimeout(resolve10, 100));
301223
+ await new Promise((resolve11) => setTimeout(resolve11, 100));
301096
301224
  }
301097
301225
  return false;
301098
301226
  }
@@ -301100,7 +301228,7 @@ async function stopTray() {
301100
301228
  // packages/cli/src/update-worker-runtime.ts
301101
301229
  async function restartTrayWithInstalledExecutable(executable, endpoint) {
301102
301230
  await stopTray();
301103
- const launched = await new Promise((resolve10) => {
301231
+ const launched = await new Promise((resolve11) => {
301104
301232
  const child = spawn4(executable, ["tray", "start", "--endpoint", endpoint], {
301105
301233
  stdio: "ignore",
301106
301234
  windowsHide: true
@@ -301110,15 +301238,15 @@ async function restartTrayWithInstalledExecutable(executable, endpoint) {
301110
301238
  child.kill();
301111
301239
  } catch {
301112
301240
  }
301113
- resolve10(false);
301241
+ resolve11(false);
301114
301242
  }, 15e3);
301115
301243
  child.once("error", () => {
301116
301244
  clearTimeout(timer);
301117
- resolve10(false);
301245
+ resolve11(false);
301118
301246
  });
301119
301247
  child.once("close", (code) => {
301120
301248
  clearTimeout(timer);
301121
- resolve10(code === 0);
301249
+ resolve11(code === 0);
301122
301250
  });
301123
301251
  });
301124
301252
  if (!launched) return false;
@@ -301126,7 +301254,7 @@ async function restartTrayWithInstalledExecutable(executable, endpoint) {
301126
301254
  const status = await getTrayStatus(endpoint);
301127
301255
  if (status.running && status.ready && status.endpoint === endpoint)
301128
301256
  return true;
301129
- await new Promise((resolve10) => setTimeout(resolve10, 250));
301257
+ await new Promise((resolve11) => setTimeout(resolve11, 250));
301130
301258
  }
301131
301259
  return false;
301132
301260
  }