blun-king-cli 9.1.618 → 9.1.620

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/blun.mjs CHANGED
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env node
2
- // BLUN_BUILD_INPUT_SHA256:136619430389be9d0388c81121dbf3721ce107f6a770cab9494fa3ffee3aade3
2
+ // BLUN_BUILD_INPUT_SHA256:2b68008c167498735f1058c26d451ab91cc9a391df328f4c5ee215fd7a2da994
3
3
  import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
4
4
  import { dirname as __cjsShimDirname } from 'node:path';
5
5
  const __filename = __cjsShimFileURLToPath(import.meta.url);
6
6
  const __dirname = __cjsShimDirname(__filename);
7
7
  import { createRequire } from "node:module";
8
8
  import crypto$1, { createHash, createHmac, randomBytes, randomInt, randomUUID, timingSafeEqual } from "node:crypto";
9
- import * as fs$19 from "node:fs";
9
+ import * as fs$18 from "node:fs";
10
10
  import Kt, { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, fstatSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, opendirSync, promises, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
11
- import * as path$19 from "node:path";
11
+ import * as path$18 from "node:path";
12
12
  import path, { basename, dirname, extname, isAbsolute, join, normalize, parse, posix, relative, resolve, sep, win32 } from "node:path";
13
13
  import { Blob as Blob$1, Buffer as Buffer$1, File as File$1 } from "node:buffer";
14
- import fs, { access, appendFile, chmod, constants as constants$1, copyFile, cp, link, lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, realpath, rename, rm, rmdir, stat, unlink, writeFile } from "node:fs/promises";
14
+ import ro, { access, appendFile, chmod, constants as constants$1, copyFile, cp, link, lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, realpath, rename, rm, rmdir, stat, unlink, writeFile } from "node:fs/promises";
15
15
  import { AsyncLocalStorage } from "node:async_hooks";
16
16
  import * as nodeOs from "node:os";
17
17
  import os, { arch, homedir, hostname, networkInterfaces, platform, release, tmpdir, type, userInfo } from "node:os";
18
18
  import { execFile, execFileSync, execSync, spawn, spawnSync } from "node:child_process";
19
19
  import { Worker } from "node:worker_threads";
20
20
  import * as sysPath from "path";
21
- import path$1, { basename as basename$1, dirname as dirname$1, join as join$1, parse as parse$1 } from "path";
21
+ import js, { basename as basename$1, dirname as dirname$1, join as join$1, parse as parse$1 } from "path";
22
22
  import I, { existsSync as existsSync$1, promises as promises$1, readdirSync as readdirSync$1, stat as stat$1, statSync as statSync$1, unwatchFile, watch, watchFile } from "fs";
23
23
  import { Readable } from "stream";
24
24
  import zi from "assert";
@@ -2271,11 +2271,11 @@ var init_blun_files = __esmMin((() => {
2271
2271
  async uploadVideo(input, options) {
2272
2272
  let file;
2273
2273
  if (typeof input === "string") {
2274
- if (!fs$19.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
2275
- const filename = path$19.basename(input);
2274
+ if (!fs$18.existsSync(input)) throw new ChatProviderError(`Video file not found: ${input}`);
2275
+ const filename = path$18.basename(input);
2276
2276
  const mimeType = guessMimeTypeFromExt(filename);
2277
2277
  if (mimeType === void 0 || !mimeType.startsWith("video/")) throw new ChatProviderError(`BlunFiles.uploadVideo: file extension does not indicate a video type: ${filename}`);
2278
- const data = await fs$19.promises.readFile(input);
2278
+ const data = await fs$18.promises.readFile(input);
2279
2279
  file = new File$1([new Blob$1([new Uint8Array(data)], { type: mimeType })], filename, { type: mimeType });
2280
2280
  } else {
2281
2281
  if (!input.mimeType.startsWith("video/")) throw new ChatProviderError(`Expected a video mime type, got ${input.mimeType}`);
@@ -12202,7 +12202,7 @@ var require_clone$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12202
12202
  //#endregion
12203
12203
  //#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
12204
12204
  var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12205
- var fs$18 = __require("fs");
12205
+ var fs$17 = __require("fs");
12206
12206
  var polyfills = require_polyfills();
12207
12207
  var legacy = require_legacy_streams();
12208
12208
  var clone = require_clone$1();
@@ -12231,36 +12231,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12231
12231
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
12232
12232
  console.error(m);
12233
12233
  };
12234
- if (!fs$18[gracefulQueue]) {
12235
- publishQueue(fs$18, global[gracefulQueue] || []);
12236
- fs$18.close = (function(fs$close) {
12234
+ if (!fs$17[gracefulQueue]) {
12235
+ publishQueue(fs$17, global[gracefulQueue] || []);
12236
+ fs$17.close = (function(fs$close) {
12237
12237
  function close(fd, cb) {
12238
- return fs$close.call(fs$18, fd, function(err) {
12238
+ return fs$close.call(fs$17, fd, function(err) {
12239
12239
  if (!err) resetQueue();
12240
12240
  if (typeof cb === "function") cb.apply(this, arguments);
12241
12241
  });
12242
12242
  }
12243
12243
  Object.defineProperty(close, previousSymbol, { value: fs$close });
12244
12244
  return close;
12245
- })(fs$18.close);
12246
- fs$18.closeSync = (function(fs$closeSync) {
12245
+ })(fs$17.close);
12246
+ fs$17.closeSync = (function(fs$closeSync) {
12247
12247
  function closeSync(fd) {
12248
- fs$closeSync.apply(fs$18, arguments);
12248
+ fs$closeSync.apply(fs$17, arguments);
12249
12249
  resetQueue();
12250
12250
  }
12251
12251
  Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
12252
12252
  return closeSync;
12253
- })(fs$18.closeSync);
12253
+ })(fs$17.closeSync);
12254
12254
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
12255
- debug(fs$18[gracefulQueue]);
12256
- __require("assert").equal(fs$18[gracefulQueue].length, 0);
12255
+ debug(fs$17[gracefulQueue]);
12256
+ __require("assert").equal(fs$17[gracefulQueue].length, 0);
12257
12257
  });
12258
12258
  }
12259
- if (!global[gracefulQueue]) publishQueue(global, fs$18[gracefulQueue]);
12260
- module.exports = patch(clone(fs$18));
12261
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$18.__patched) {
12262
- module.exports = patch(fs$18);
12263
- fs$18.__patched = true;
12259
+ if (!global[gracefulQueue]) publishQueue(global, fs$17[gracefulQueue]);
12260
+ module.exports = patch(clone(fs$17));
12261
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$17.__patched) {
12262
+ module.exports = patch(fs$17);
12263
+ fs$17.__patched = true;
12264
12264
  }
12265
12265
  function patch(fs) {
12266
12266
  polyfills(fs);
@@ -12515,23 +12515,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12515
12515
  }
12516
12516
  function enqueue(elem) {
12517
12517
  debug("ENQUEUE", elem[0].name, elem[1]);
12518
- fs$18[gracefulQueue].push(elem);
12518
+ fs$17[gracefulQueue].push(elem);
12519
12519
  retry();
12520
12520
  }
12521
12521
  var retryTimer;
12522
12522
  function resetQueue() {
12523
12523
  var now = Date.now();
12524
- for (var i = 0; i < fs$18[gracefulQueue].length; ++i) if (fs$18[gracefulQueue][i].length > 2) {
12525
- fs$18[gracefulQueue][i][3] = now;
12526
- fs$18[gracefulQueue][i][4] = now;
12524
+ for (var i = 0; i < fs$17[gracefulQueue].length; ++i) if (fs$17[gracefulQueue][i].length > 2) {
12525
+ fs$17[gracefulQueue][i][3] = now;
12526
+ fs$17[gracefulQueue][i][4] = now;
12527
12527
  }
12528
12528
  retry();
12529
12529
  }
12530
12530
  function retry() {
12531
12531
  clearTimeout(retryTimer);
12532
12532
  retryTimer = void 0;
12533
- if (fs$18[gracefulQueue].length === 0) return;
12534
- var elem = fs$18[gracefulQueue].shift();
12533
+ if (fs$17[gracefulQueue].length === 0) return;
12534
+ var elem = fs$17[gracefulQueue].shift();
12535
12535
  var fn = elem[0];
12536
12536
  var args = elem[1];
12537
12537
  var err = elem[2];
@@ -12550,7 +12550,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12550
12550
  if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
12551
12551
  debug("RETRY", fn.name, args);
12552
12552
  fn.apply(null, args.concat([startTime]));
12553
- } else fs$18[gracefulQueue].push(elem);
12553
+ } else fs$17[gracefulQueue].push(elem);
12554
12554
  }
12555
12555
  if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
12556
12556
  }
@@ -12902,7 +12902,7 @@ var require_mtime_precision = /* @__PURE__ */ __commonJSMin(((exports, module) =
12902
12902
  //#endregion
12903
12903
  //#region ../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
12904
12904
  var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12905
- const path$18 = __require("path");
12905
+ const path$17 = __require("path");
12906
12906
  const fs = require_graceful_fs();
12907
12907
  const retry = require_retry$3();
12908
12908
  const onExit = require_signal_exit();
@@ -12912,7 +12912,7 @@ var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12912
12912
  return options.lockfilePath || `${file}.lock`;
12913
12913
  }
12914
12914
  function resolveCanonicalPath(file, options, callback) {
12915
- if (!options.realpath) return callback(null, path$18.resolve(file));
12915
+ if (!options.realpath) return callback(null, path$17.resolve(file));
12916
12916
  options.fs.realpath(file, callback);
12917
12917
  }
12918
12918
  function acquireLock(file, options, callback) {
@@ -15475,7 +15475,7 @@ async function syncDir(dirPath) {
15475
15475
  */
15476
15476
  function syncFd(fd) {
15477
15477
  return new Promise((resolve, reject) => {
15478
- fs$19.fsync(fd, (err) => {
15478
+ fs$18.fsync(fd, (err) => {
15479
15479
  if (err) {
15480
15480
  reject(err);
15481
15481
  return;
@@ -26429,7 +26429,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26429
26429
  };
26430
26430
  return _setPrototypeOf(o, p);
26431
26431
  }
26432
- var path$17 = __require("path");
26432
+ var path$16 = __require("path");
26433
26433
  module.exports = /* @__PURE__ */ function(_EmitterObj) {
26434
26434
  _inheritsLoose(Loader, _EmitterObj);
26435
26435
  function Loader() {
@@ -26437,7 +26437,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26437
26437
  }
26438
26438
  var _proto = Loader.prototype;
26439
26439
  _proto.resolve = function resolve(from, to) {
26440
- return path$17.resolve(path$17.dirname(from), to);
26440
+ return path$16.resolve(path$16.dirname(from), to);
26441
26441
  };
26442
26442
  _proto.isRelative = function isRelative(filename) {
26443
26443
  return filename.indexOf("./") === 0 || filename.indexOf("../") === 0;
@@ -28093,8 +28093,8 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28093
28093
  };
28094
28094
  return _setPrototypeOf(o, p);
28095
28095
  }
28096
- var fs$17 = __require("fs");
28097
- var path$16 = __require("path");
28096
+ var fs$16 = __require("fs");
28097
+ var path$15 = __require("path");
28098
28098
  var Loader = require_loader();
28099
28099
  var PrecompiledLoader = require_precompiled_loader().PrecompiledLoader;
28100
28100
  var chokidar;
@@ -28109,7 +28109,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28109
28109
  _this.noCache = !!opts.noCache;
28110
28110
  if (searchPaths) {
28111
28111
  searchPaths = Array.isArray(searchPaths) ? searchPaths : [searchPaths];
28112
- _this.searchPaths = searchPaths.map(path$16.normalize);
28112
+ _this.searchPaths = searchPaths.map(path$15.normalize);
28113
28113
  } else _this.searchPaths = ["."];
28114
28114
  if (opts.watch) {
28115
28115
  try {
@@ -28117,10 +28117,10 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28117
28117
  } catch (e) {
28118
28118
  throw new Error("watch requires chokidar to be installed");
28119
28119
  }
28120
- var paths = _this.searchPaths.filter(fs$17.existsSync);
28120
+ var paths = _this.searchPaths.filter(fs$16.existsSync);
28121
28121
  var watcher = chokidar.watch(paths);
28122
28122
  watcher.on("all", function(event, fullname) {
28123
- fullname = path$16.resolve(fullname);
28123
+ fullname = path$15.resolve(fullname);
28124
28124
  if (event === "change" && fullname in _this.pathsToNames) _this.emit("update", _this.pathsToNames[fullname], fullname);
28125
28125
  });
28126
28126
  watcher.on("error", function(error) {
@@ -28134,9 +28134,9 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28134
28134
  var fullpath = null;
28135
28135
  var paths = this.searchPaths;
28136
28136
  for (var i = 0; i < paths.length; i++) {
28137
- var basePath = path$16.resolve(paths[i]);
28138
- var p = path$16.resolve(paths[i], name);
28139
- if (p.indexOf(basePath) === 0 && fs$17.existsSync(p)) {
28137
+ var basePath = path$15.resolve(paths[i]);
28138
+ var p = path$15.resolve(paths[i], name);
28139
+ if (p.indexOf(basePath) === 0 && fs$16.existsSync(p)) {
28140
28140
  fullpath = p;
28141
28141
  break;
28142
28142
  }
@@ -28144,7 +28144,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28144
28144
  if (!fullpath) return null;
28145
28145
  this.pathsToNames[fullpath] = name;
28146
28146
  var source = {
28147
- src: fs$17.readFileSync(fullpath, "utf-8"),
28147
+ src: fs$16.readFileSync(fullpath, "utf-8"),
28148
28148
  path: fullpath,
28149
28149
  noCache: this.noCache
28150
28150
  };
@@ -28192,7 +28192,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28192
28192
  }
28193
28193
  this.pathsToNames[fullpath] = name;
28194
28194
  var source = {
28195
- src: fs$17.readFileSync(fullpath, "utf-8"),
28195
+ src: fs$16.readFileSync(fullpath, "utf-8"),
28196
28196
  path: fullpath,
28197
28197
  noCache: this.noCache
28198
28198
  };
@@ -28494,13 +28494,13 @@ var require_globals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28494
28494
  //#endregion
28495
28495
  //#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/express-app.js
28496
28496
  var require_express_app = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28497
- var path$15 = __require("path");
28497
+ var path$14 = __require("path");
28498
28498
  module.exports = function express(env, app) {
28499
28499
  function NunjucksView(name, opts) {
28500
28500
  this.name = name;
28501
28501
  this.path = name;
28502
28502
  this.defaultEngine = opts.defaultEngine;
28503
- this.ext = path$15.extname(name);
28503
+ this.ext = path$14.extname(name);
28504
28504
  if (!this.ext && !this.defaultEngine) throw new Error("No default engine was specified and no extension was provided.");
28505
28505
  if (!this.ext) this.name += this.ext = (this.defaultEngine[0] !== "." ? "." : "") + this.defaultEngine;
28506
28506
  }
@@ -28936,8 +28936,8 @@ var require_precompile_global = /* @__PURE__ */ __commonJSMin(((exports, module)
28936
28936
  //#endregion
28937
28937
  //#region ../../node_modules/.pnpm/nunjucks@3.2.4_chokidar@4.0.3/node_modules/nunjucks/src/precompile.js
28938
28938
  var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28939
- var fs$16 = __require("fs");
28940
- var path$14 = __require("path");
28939
+ var fs$15 = __require("fs");
28940
+ var path$13 = __require("path");
28941
28941
  var _prettifyError = require_lib$8()._prettifyError;
28942
28942
  var compiler = require_compiler();
28943
28943
  var Environment = require_environment().Environment;
@@ -28961,27 +28961,27 @@ var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28961
28961
  var env = opts.env || new Environment([]);
28962
28962
  var wrapper = opts.wrapper || precompileGlobal;
28963
28963
  if (opts.isString) return precompileString(input, opts);
28964
- var pathStats = fs$16.existsSync(input) && fs$16.statSync(input);
28964
+ var pathStats = fs$15.existsSync(input) && fs$15.statSync(input);
28965
28965
  var precompiled = [];
28966
28966
  var templates = [];
28967
28967
  function addTemplates(dir) {
28968
- fs$16.readdirSync(dir).forEach(function(file) {
28969
- var filepath = path$14.join(dir, file);
28970
- var subpath = filepath.substr(path$14.join(input, "/").length);
28971
- var stat = fs$16.statSync(filepath);
28968
+ fs$15.readdirSync(dir).forEach(function(file) {
28969
+ var filepath = path$13.join(dir, file);
28970
+ var subpath = filepath.substr(path$13.join(input, "/").length);
28971
+ var stat = fs$15.statSync(filepath);
28972
28972
  if (stat && stat.isDirectory()) {
28973
28973
  subpath += "/";
28974
28974
  if (!match(subpath, opts.exclude)) addTemplates(filepath);
28975
28975
  } else if (match(subpath, opts.include)) templates.push(filepath);
28976
28976
  });
28977
28977
  }
28978
- if (pathStats.isFile()) precompiled.push(_precompile(fs$16.readFileSync(input, "utf-8"), opts.name || input, env));
28978
+ if (pathStats.isFile()) precompiled.push(_precompile(fs$15.readFileSync(input, "utf-8"), opts.name || input, env));
28979
28979
  else if (pathStats.isDirectory()) {
28980
28980
  addTemplates(input);
28981
28981
  for (var i = 0; i < templates.length; i++) {
28982
- var name = templates[i].replace(path$14.join(input, "/"), "");
28982
+ var name = templates[i].replace(path$13.join(input, "/"), "");
28983
28983
  try {
28984
- precompiled.push(_precompile(fs$16.readFileSync(templates[i], "utf-8"), name, env));
28984
+ precompiled.push(_precompile(fs$15.readFileSync(templates[i], "utf-8"), name, env));
28985
28985
  } catch (e) {
28986
28986
  if (opts.force) console.error(e);
28987
28987
  else throw e;
@@ -33182,7 +33182,7 @@ var require_buffer_from = /* @__PURE__ */ __commonJSMin(((exports, module) => {
33182
33182
  //#region ../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js
33183
33183
  var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module) => {
33184
33184
  var SourceMapConsumer = require_source_map().SourceMapConsumer;
33185
- var path$13 = __require("path");
33185
+ var path$12 = __require("path");
33186
33186
  var fs;
33187
33187
  try {
33188
33188
  fs = __require("fs");
@@ -33259,15 +33259,15 @@ var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module
33259
33259
  });
33260
33260
  function supportRelativeURL(file, url) {
33261
33261
  if (!file) return url;
33262
- var dir = path$13.dirname(file);
33262
+ var dir = path$12.dirname(file);
33263
33263
  var match = /^\w+:\/\/[^\/]*/.exec(dir);
33264
33264
  var protocol = match ? match[0] : "";
33265
33265
  var startPath = dir.slice(protocol.length);
33266
33266
  if (protocol && /^\/\w\:/.test(startPath)) {
33267
33267
  protocol += "/";
33268
- return protocol + path$13.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
33268
+ return protocol + path$12.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
33269
33269
  }
33270
- return protocol + path$13.resolve(dir.slice(protocol.length), url);
33270
+ return protocol + path$12.resolve(dir.slice(protocol.length), url);
33271
33271
  }
33272
33272
  function retrieveSourceMapURL(source) {
33273
33273
  var fileData;
@@ -192717,7 +192717,7 @@ var require_gifframe = /* @__PURE__ */ __commonJSMin(((exports) => {
192717
192717
  //#region ../../node_modules/.pnpm/gifwrap@0.10.1/node_modules/gifwrap/src/gifutil.js
192718
192718
  var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
192719
192719
  /** @namespace GifUtil */
192720
- const fs$15 = __require("fs");
192720
+ const fs$14 = __require("fs");
192721
192721
  const ImageQ = require_image_q();
192722
192722
  const BitmapImage = require_bitmapimage();
192723
192723
  const { GifFrame } = require_gifframe();
@@ -192984,7 +192984,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
192984
192984
  }
192985
192985
  function _readBinary(path) {
192986
192986
  return new Promise((resolve, reject) => {
192987
- fs$15.readFile(path, (err, buffer) => {
192987
+ fs$14.readFile(path, (err, buffer) => {
192988
192988
  if (err) return reject(err);
192989
192989
  return resolve(buffer);
192990
192990
  });
@@ -192992,7 +192992,7 @@ var require_gifutil = /* @__PURE__ */ __commonJSMin(((exports) => {
192992
192992
  }
192993
192993
  function _writeBinary(path, buffer) {
192994
192994
  return new Promise((resolve, reject) => {
192995
- fs$15.writeFile(path, buffer, (err) => {
192995
+ fs$14.writeFile(path, buffer, (err) => {
192996
192996
  if (err) return reject(err);
192997
192997
  return resolve();
192998
192998
  });
@@ -218810,7 +218810,7 @@ var init_file_type = __esmMin((() => {
218810
218810
  }
218811
218811
  async fromFile(path) {
218812
218812
  this.options.signal?.throwIfAborted();
218813
- const fileHandle = await fs.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
218813
+ const fileHandle = await ro.open(path, constants.O_RDONLY | constants.O_NONBLOCK);
218814
218814
  const fileStat = await fileHandle.stat();
218815
218815
  if (!fileStat.isFile()) {
218816
218816
  await fileHandle.close();
@@ -229315,7 +229315,7 @@ async function processBitmapFont(file, font) {
229315
229315
  ...font,
229316
229316
  chars,
229317
229317
  kernings,
229318
- pages: await Promise.all(font.pages.map(async (page) => CharacterJimp.read(path$1.join(path$1.dirname(file), page))))
229318
+ pages: await Promise.all(font.pages.map(async (page) => CharacterJimp.read(js.join(js.dirname(file), page))))
229319
229319
  };
229320
229320
  }
229321
229321
  var import_parse_bmfont_ascii, import_lib$1, import_parse_bmfont_binary, convertXML, isWebWorker, CharacterJimp, HEADER;
@@ -231952,7 +231952,7 @@ var init_full = __esmMin((() => {
231952
231952
  }
231953
231953
  restoreResumeState(state) {
231954
231954
  if (!Number.isSafeInteger(state.sessionCompactionFailures) || state.sessionCompactionFailures < 0) throw new Error("Invalid session compaction failure count");
231955
- this.sessionCompactionFailures = Math.max(this.sessionCompactionFailures, state.sessionCompactionFailures);
231955
+ this.sessionCompactionFailures = state.sessionCompactionFailures;
231956
231956
  }
231957
231957
  async handleOverflowError(signal, error) {
231958
231958
  this.consecutiveOverflowCompactions += 1;
@@ -232051,7 +232051,7 @@ var init_full = __esmMin((() => {
232051
232051
  beginAutoCompaction(throwOnLimit = true) {
232052
232052
  if (this.compacting) return true;
232053
232053
  if (this.sessionCompactionFailures >= MAX_SESSION_COMPACTION_FAILURES) {
232054
- if (throwOnLimit) throw this.sessionStoppedError(ErrorCodes.CONTEXT_OVERFLOW);
232054
+ if (throwOnLimit) throw this.sessionStoppedError(ErrorCodes.COMPACTION_FAILED);
232055
232055
  return false;
232056
232056
  }
232057
232057
  const maxCompactions = this.strategy.maxCompactionPerTurn;
@@ -232067,12 +232067,35 @@ var init_full = __esmMin((() => {
232067
232067
  }
232068
232068
  sessionStoppedError(code, cause) {
232069
232069
  const action = "Start a fresh session after saving any pending work.";
232070
- return new BlunError(code, `Compaction stopped after ${String(this.sessionCompactionFailures)} failures in this session. ${action}`, {
232070
+ let lastFailure;
232071
+ if (cause !== void 0) {
232072
+ const failure = toBlunErrorPayload(cause);
232073
+ lastFailure = { code: failure.code };
232074
+ for (const key of [
232075
+ "statusCode",
232076
+ "estimatedRequestTokens",
232077
+ "maxContextTokens",
232078
+ "requestBudgetTokens",
232079
+ "estimatedRequestBytes",
232080
+ "requestBudgetBytes",
232081
+ "summaryReserveTokens",
232082
+ "hierarchicalPassCount"
232083
+ ]) {
232084
+ const value = failure.details?.[key];
232085
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0) lastFailure[key] = value;
232086
+ }
232087
+ for (const key of ["contextBrakeBlocked", "contextUnchanged"]) {
232088
+ const value = failure.details?.[key];
232089
+ if (typeof value === "boolean") lastFailure[key] = value;
232090
+ }
232091
+ }
232092
+ return new BlunError(code, `Compaction paused after ${String(this.sessionCompactionFailures)} consecutive failed attempts. This does not mean the context window is full. ${action}`, {
232071
232093
  cause: cause instanceof Error ? cause : void 0,
232072
232094
  details: {
232073
232095
  compactionSessionStopped: true,
232074
232096
  failures: this.sessionCompactionFailures,
232075
- action
232097
+ action,
232098
+ ...lastFailure === void 0 ? {} : { lastFailure }
232076
232099
  }
232077
232100
  });
232078
232101
  }
@@ -232107,6 +232130,13 @@ var init_full = __esmMin((() => {
232107
232130
  modelAlias: this.agent.activeResponderModel ?? this.agent.config.modelAlias,
232108
232131
  maxContextTokens: this.getEffectiveMaxContextTokens()
232109
232132
  };
232133
+ if (this.sessionCompactionFailures > 0) {
232134
+ this.sessionCompactionFailures = 0;
232135
+ this.agent.records.logRecord({
232136
+ type: "full_compaction.session_failures",
232137
+ count: 0
232138
+ });
232139
+ }
232110
232140
  this.markCompleted();
232111
232141
  const { contextSummary: _contextSummary, ...eventResult } = result;
232112
232142
  const projectedContextTokens = this.estimateCurrentRequestTokens();
@@ -260353,7 +260383,7 @@ function Yn(s, t) {
260353
260383
  function Kn(s, t) {
260354
260384
  s.head = new ue$1(t, void 0, s.head, s), s.tail || (s.tail = s.head), s.length++;
260355
260385
  }
260356
- var zr, Ur, Ds, Wr, Gr, Zr, Q$1, J$1, nt$1, De$1, qt, Ne$1, Ns, Ae$1, As, z$1, Mt, g$1, Qt, Bt, b$1, N$1, _$1, bi, Ie$1, L$1, S, _i, Oi, Is, Ti, Z$1, xi, Ce$1, Jt$1, Rt, C, jt, Yr, Kr, Vr, $r, Fe$1, Li, Xr, qr, A$1, Jr, ht, H$1, te, m$1, Ni, tt$1, Ai, ki, vi, ie$1, ke$1, Ut$1, Ht, Ii, Pt, at, U$1, ot, Y$1, zt, Ci, j$1, ee$1, Fi, ve$1, gt$2, Me, bt, _t, Be$1, et$1, Wt$1, jr, Fs, ks, vs, Ms, Bs, tn, se$1, K$1, sn, M$1, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ke$1, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe$1, Ve$1, un, F$1, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, f, $e$1, Dt, Nn, Xi, qi, An, B$1, Nt, it, Zi, Zs, V$1, he$1, dt, Ys, p, st$1, ut, Yi, At, w$1, Xe$1, qe$1, Ki, Ks, Vs, ae$1, Vi, Qe$1, Yt$1, $$1, Je$1, It, je$1, ti, $s, In, le$1, $i, Xs, Cn, rt$1, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce$1, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is$2, sr, fe$1, ii, ss, si, rs, ns, os$6, hs, pt, ri, as, es, q$1, de$1, ni, oi, Gn, hi, ue$1, pi, nr, li, me$1, W$1, pe$2, Et, Ft$1, Ee$1, ai, G, ls, ci, or, ds, us, fi, di, hr, cs, ui, lr, fs$14, wt, kt, Vn, $n, fr, dr, Xn, qn, Er, wr, ur, Sr, yr, Rr, jn, to, eo, mr, ms, ps, Ei, io, Es, so, ws, Se$1, St, no, gr, Ss, br, oo, _r, ys, Or, Vt$1, Tr, ao, lo, yi, Lr, Dr, _s, Nr, Os, P$1, Ts, xs, gi, Ar, Ir, Re, Cr, Fr, Rs, yt, O$1, Ri, kr, $t, gs, bs, Ls, ge$1, be, _e$1, Oe$1, Te$1, uo, mo, po, vr, Xt$1, ye$1, xe$1, Eo, wo, So, yo, Ro, go, bo, _o, vt, To;
260386
+ var zr, Ur, Ds, Wr, Gr, Zr, Q$1, J$1, nt$1, De$1, qt, Ne$1, Ns, Ae$1, As, z$1, Mt, g$1, Qt, Bt, b$1, N$1, _$1, bi, Ie$1, L$1, S, _i, Oi, Is, Ti, Z$1, xi, Ce$1, Jt$1, Rt, C, jt, Yr, Kr, Vr, $r, Fe$1, Li, Xr, qr, A$1, Jr, ht, H$1, te, m$1, Ni, tt$1, Ai, ki, vi, ie$1, ke$1, Ut$1, Ht, Ii, Pt, at, U$1, ot, Y$1, zt, Ci, j$1, ee$1, Fi, ve$1, gt$2, Me, bt, _t, Be$1, et$1, Wt$1, jr, Fs, ks, vs, Ms, Bs, tn, se$1, K$1, sn, M$1, rn, zs, nn, Bi, Tt, Gt, Pi, re, Pe$1, ze$1, Ue, He$1, We$1, Ge$1, Ze$1, Ye$1, Ke$1, Us, hn, an, Hs, ln, cn, Ws, Gs, Hi, ne, dn, Ui, oe$1, Ve$1, un, F$1, mn, xt, Wi, pn, lt, En, wn, Sn, ct, yn, Rn, gn, Gi, bn, Lt, ft, On, Tn, xn, f, $e$1, Dt, Nn, Xi, qi, An, B$1, Nt, it, Zi, Zs, V$1, he$1, dt, Ys, p, st$1, ut, Yi, At, w$1, Xe$1, qe$1, Ki, Ks, Vs, ae$1, Vi, Qe$1, Yt$1, $$1, Je$1, It, je$1, ti, $s, In, le$1, $i, Xs, Cn, rt$1, mt, vn, Qi, Mn, Bn, Ct, Ji, zn, qs, ce$1, ei, ji, Un, Hn, ts, Qs, rr, Wn, tr, er, ir, is$2, sr, fe$1, ii, ss, si, rs, ns, os$6, hs, pt, ri, as, es, q$1, de$1, ni, oi, Gn, hi, ue$1, pi, nr, li, me$1, W$1, pe$2, Et, Ft$1, Ee$1, ai, G, ls, ci, or, ds, us, fi, di, hr, cs, ui, lr, fs$13, wt, kt, Vn, $n, fr, dr, Xn, qn, Er, wr, ur, Sr, yr, Rr, jn, to, eo, mr, ms, ps, Ei, io, Es, so, ws, Se$1, St, no, gr, Ss, br, oo, _r, ys, Or, Vt$1, Tr, ao, lo, yi, Lr, Dr, _s, Nr, Os, P$1, Ts, xs, gi, Ar, Ir, Re, Cr, Fr, Rs, yt, O$1, Ri, kr, $t, gs, bs, Ls, ge$1, be, _e$1, Oe$1, Te$1, uo, mo, po, vr, Xt$1, ye$1, xe$1, Eo, wo, So, yo, Ro, go, bo, _o, vt, To;
260357
260387
  var init_index_min = __esmMin((() => {
260358
260388
  zr = Object.defineProperty;
260359
260389
  Ur = (s, t) => {
@@ -261881,7 +261911,7 @@ while (this[Zs](this[st$1].shift()));
261881
261911
  let [o, h] = ce$1(this.path);
261882
261912
  o && typeof h == "string" && (this.path = h, r = o);
261883
261913
  }
261884
- this.win32 = !!i.win32 || process.platform === "win32", this.win32 && (this.path = Qs(this.path.replaceAll(/\\/g, "/")), t = t.replaceAll(/\\/g, "/")), this.absolute = f(i.absolute || path$1.resolve(this.cwd, t)), this.path === "" && (this.path = "./"), r && this.warn("TAR_ENTRY_INFO", `stripping ${r} from absolute path`, {
261914
+ this.win32 = !!i.win32 || process.platform === "win32", this.win32 && (this.path = Qs(this.path.replaceAll(/\\/g, "/")), t = t.replaceAll(/\\/g, "/")), this.absolute = f(i.absolute || js.resolve(this.cwd, t)), this.path === "" && (this.path = "./"), r && this.warn("TAR_ENTRY_INFO", `stripping ${r} from absolute path`, {
261885
261915
  entry: this,
261886
261916
  path: r + this.path
261887
261917
  });
@@ -261964,7 +261994,7 @@ while (this[Zs](this[st$1].shift()));
261964
261994
  }
261965
261995
  [sr](t) {
261966
261996
  if (!this.stat) throw new Error("cannot create link entry without stat");
261967
- this.type = "Link", this.linkpath = f(path$1.relative(this.cwd, t)), this.stat.size = 0, this[fe$1](), this.end();
261997
+ this.type = "Link", this.linkpath = f(js.relative(this.cwd, t)), this.stat.size = 0, this[fe$1](), this.end();
261968
261998
  }
261969
261999
  [er]() {
261970
262000
  if (!this.stat) throw new Error("cannot create file entry without stat");
@@ -262323,7 +262353,7 @@ while (this[Zs](this[st$1].shift()));
262323
262353
  constructor(t, e) {
262324
262354
  this.path = t || "./", this.absolute = e;
262325
262355
  }
262326
- }, nr = Buffer.alloc(1024), li = Symbol("onStat"), me$1 = Symbol("ended"), W$1 = Symbol("queue"), pe$2 = Symbol("pendingLinks"), Et = Symbol("current"), Ft$1 = Symbol("process"), Ee$1 = Symbol("processing"), ai = Symbol("processJob"), G = Symbol("jobs"), ls = Symbol("jobDone"), ci = Symbol("addFSEntry"), or = Symbol("addTarEntry"), ds = Symbol("stat"), us = Symbol("readdir"), fi = Symbol("onreaddir"), di = Symbol("pipe"), hr = Symbol("entry"), cs = Symbol("entryOpt"), ui = Symbol("writeEntryClass"), lr = Symbol("write"), fs$14 = Symbol("ondrain"), wt = class extends A$1 {
262356
+ }, nr = Buffer.alloc(1024), li = Symbol("onStat"), me$1 = Symbol("ended"), W$1 = Symbol("queue"), pe$2 = Symbol("pendingLinks"), Et = Symbol("current"), Ft$1 = Symbol("process"), Ee$1 = Symbol("processing"), ai = Symbol("processJob"), G = Symbol("jobs"), ls = Symbol("jobDone"), ci = Symbol("addFSEntry"), or = Symbol("addTarEntry"), ds = Symbol("stat"), us = Symbol("readdir"), fi = Symbol("onreaddir"), di = Symbol("pipe"), hr = Symbol("entry"), cs = Symbol("entryOpt"), ui = Symbol("writeEntryClass"), lr = Symbol("write"), fs$13 = Symbol("ondrain"), wt = class extends A$1 {
262327
262357
  sync = !1;
262328
262358
  opt;
262329
262359
  cwd;
@@ -262356,8 +262386,8 @@ while (this[Zs](this[st$1].shift()));
262356
262386
  if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
262357
262387
  if (t.gzip && (typeof t.gzip != "object" && (t.gzip = {}), this.portable && (t.gzip.portable = !0), this.zip = new ze$1(t.gzip)), t.brotli && (typeof t.brotli != "object" && (t.brotli = {}), this.zip = new We$1(t.brotli)), t.zstd && (typeof t.zstd != "object" && (t.zstd = {}), this.zip = new Ye$1(t.zstd)), !this.zip) throw new Error("impossible");
262358
262388
  let e = this.zip;
262359
- e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$14]()), this.on("resume", () => e.resume());
262360
- } else this.on("drain", this[fs$14]);
262389
+ e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs$13]()), this.on("resume", () => e.resume());
262390
+ } else this.on("drain", this[fs$13]);
262361
262391
  this.noDirRecurse = !!t.noDirRecurse, this.follow = !!t.follow, this.noMtime = !!t.noMtime, t.mtime && (this.mtime = t.mtime), this.filter = typeof t.filter == "function" ? t.filter : () => !0, this[W$1] = new hi(), this[G] = 0, this.jobs = Number(t.jobs) || 4, this[Ee$1] = !1, this[me$1] = !1;
262362
262392
  }
262363
262393
  [lr](t) {
@@ -262374,7 +262404,7 @@ while (this[Zs](this[st$1].shift()));
262374
262404
  return typeof t == "string" ? this[ci](t) : this[or](t), this.flowing;
262375
262405
  }
262376
262406
  [or](t) {
262377
- let e = f(path$1.resolve(this.cwd, t.path));
262407
+ let e = f(js.resolve(this.cwd, t.path));
262378
262408
  if (!this.filter(t.path, t)) t.resume();
262379
262409
  else {
262380
262410
  let i = new pi(t.path, e);
@@ -262383,7 +262413,7 @@ while (this[Zs](this[st$1].shift()));
262383
262413
  this[Ft$1]();
262384
262414
  }
262385
262415
  [ci](t) {
262386
- let e = f(path$1.resolve(this.cwd, t));
262416
+ let e = f(js.resolve(this.cwd, t));
262387
262417
  this[W$1].push(new pi(t, e)), this[Ft$1]();
262388
262418
  }
262389
262419
  [ds](t) {
@@ -262484,7 +262514,7 @@ while (this[Zs](this[st$1].shift()));
262484
262514
  this.emit("error", e);
262485
262515
  }
262486
262516
  }
262487
- [fs$14]() {
262517
+ [fs$13]() {
262488
262518
  this[Et] && this[Et].entry && this[Et].entry.resume();
262489
262519
  }
262490
262520
  [di](t) {
@@ -262650,7 +262680,7 @@ while (this[Zs](this[st$1].shift()));
262650
262680
  E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? Kt.chmod(s, r, e) : e();
262651
262681
  };
262652
262682
  if (s === d) return no(s, y);
262653
- if (l) return fs.mkdir(s, {
262683
+ if (l) return ro.mkdir(s, {
262654
262684
  mode: r,
262655
262685
  recursive: !0
262656
262686
  }).then((E) => y(null, E ?? void 0), y);
@@ -263409,7 +263439,7 @@ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
263409
263439
  //#endregion
263410
263440
  //#region ../../node_modules/.pnpm/yauzl@3.3.0/node_modules/yauzl/fd-slicer.js
263411
263441
  var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
263412
- var fs$13 = __require("fs");
263442
+ var fs$12 = __require("fs");
263413
263443
  var util$6 = __require("util");
263414
263444
  var stream$2 = __require("stream");
263415
263445
  var Readable = stream$2.Readable;
@@ -263434,7 +263464,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
263434
263464
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
263435
263465
  var self = this;
263436
263466
  self.pend.go(function(cb) {
263437
- fs$13.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
263467
+ fs$12.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
263438
263468
  cb();
263439
263469
  callback(err, bytesRead, buffer);
263440
263470
  });
@@ -263443,7 +263473,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
263443
263473
  FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
263444
263474
  var self = this;
263445
263475
  self.pend.go(function(cb) {
263446
- fs$13.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
263476
+ fs$12.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
263447
263477
  cb();
263448
263478
  callback(err, written, buffer);
263449
263479
  });
@@ -263463,7 +263493,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
263463
263493
  self.refCount -= 1;
263464
263494
  if (self.refCount > 0) return;
263465
263495
  if (self.refCount < 0) throw new Error("invalid unref");
263466
- if (self.autoClose) fs$13.close(self.fd, onCloseDone);
263496
+ if (self.autoClose) fs$12.close(self.fd, onCloseDone);
263467
263497
  function onCloseDone(err) {
263468
263498
  if (err) self.emit("error", err);
263469
263499
  else self.emit("close");
@@ -263494,7 +263524,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
263494
263524
  self.context.pend.go(function(cb) {
263495
263525
  if (self.destroyed) return cb();
263496
263526
  var buffer = Buffer.allocUnsafe(toRead);
263497
- fs$13.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
263527
+ fs$12.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
263498
263528
  if (err) self.destroy(err);
263499
263529
  else if (bytesRead === 0) {
263500
263530
  self.destroyed = true;
@@ -263540,7 +263570,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
263540
263570
  }
263541
263571
  self.context.pend.go(function(cb) {
263542
263572
  if (self.destroyed) return cb();
263543
- fs$13.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
263573
+ fs$12.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
263544
263574
  if (err) {
263545
263575
  self.destroy();
263546
263576
  cb();
@@ -267481,14 +267511,14 @@ async function readGitExecPath(deps, gitExe) {
267481
267511
  }
267482
267512
  }
267483
267513
  function gitBashCandidatesFromGitExe(gitExe) {
267484
- const normalizedGitExe = path$19.win32.normalize(normalizeWindowsPath(gitExe));
267485
- const gitDir = path$19.win32.dirname(normalizedGitExe);
267486
- const gitDirName = path$19.win32.basename(gitDir).toLowerCase();
267514
+ const normalizedGitExe = path$18.win32.normalize(normalizeWindowsPath(gitExe));
267515
+ const gitDir = path$18.win32.dirname(normalizedGitExe);
267516
+ const gitDirName = path$18.win32.basename(gitDir).toLowerCase();
267487
267517
  if (gitDirName !== "cmd" && gitDirName !== "bin") return;
267488
- return gitBashCandidatesFromGitRoot(path$19.win32.dirname(gitDir));
267518
+ return gitBashCandidatesFromGitRoot(path$18.win32.dirname(gitDir));
267489
267519
  }
267490
267520
  function gitBashCandidatesFromGitExecPath(execPath) {
267491
- const normalized = path$19.win32.normalize(normalizeWindowsPath(execPath));
267521
+ const normalized = path$18.win32.normalize(normalizeWindowsPath(execPath));
267492
267522
  const parts = normalized.split("\\");
267493
267523
  for (let i = parts.length - 1; i >= 0; i -= 1) {
267494
267524
  const segment = parts[i]?.toLowerCase();
@@ -267497,16 +267527,16 @@ function gitBashCandidatesFromGitExecPath(execPath) {
267497
267527
  if (root.length > 0) return gitBashCandidatesFromGitRoot(root);
267498
267528
  }
267499
267529
  }
267500
- return gitBashCandidatesFromGitRoot(path$19.win32.join(normalized, "..", ".."));
267530
+ return gitBashCandidatesFromGitRoot(path$18.win32.join(normalized, "..", ".."));
267501
267531
  }
267502
267532
  function gitBashCandidatesFromGitRoot(root) {
267503
- return [path$19.win32.normalize(path$19.win32.join(root, "bin", "bash.exe")), path$19.win32.normalize(path$19.win32.join(root, "usr", "bin", "bash.exe"))];
267533
+ return [path$18.win32.normalize(path$18.win32.join(root, "bin", "bash.exe")), path$18.win32.normalize(path$18.win32.join(root, "usr", "bin", "bash.exe"))];
267504
267534
  }
267505
267535
  function normalizeWindowsPath(path) {
267506
267536
  return path.replaceAll("/", "\\");
267507
267537
  }
267508
267538
  function isAbsoluteWindowsPath(path) {
267509
- return path$19.win32.isAbsolute(normalizeWindowsPath(path));
267539
+ return path$18.win32.isAbsolute(normalizeWindowsPath(path));
267510
267540
  }
267511
267541
  function dedupeWindowsPaths(paths) {
267512
267542
  const deduped = [];
@@ -304832,7 +304862,7 @@ var init_proxy = __esmMin((() => {
304832
304862
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304833
304863
  module.exports = isexe;
304834
304864
  isexe.sync = sync;
304835
- var fs$11 = __require("fs");
304865
+ var fs$10 = __require("fs");
304836
304866
  function checkPathExt(path, options) {
304837
304867
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
304838
304868
  if (!pathext) return true;
@@ -304849,12 +304879,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304849
304879
  return checkPathExt(path, options);
304850
304880
  }
304851
304881
  function isexe(path, options, cb) {
304852
- fs$11.stat(path, function(er, stat) {
304882
+ fs$10.stat(path, function(er, stat) {
304853
304883
  cb(er, er ? false : checkStat(stat, path, options));
304854
304884
  });
304855
304885
  }
304856
304886
  function sync(path, options) {
304857
- return checkStat(fs$11.statSync(path), path, options);
304887
+ return checkStat(fs$10.statSync(path), path, options);
304858
304888
  }
304859
304889
  }));
304860
304890
  //#endregion
@@ -304862,14 +304892,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304862
304892
  var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304863
304893
  module.exports = isexe;
304864
304894
  isexe.sync = sync;
304865
- var fs$10 = __require("fs");
304895
+ var fs$9 = __require("fs");
304866
304896
  function isexe(path, options, cb) {
304867
- fs$10.stat(path, function(er, stat) {
304897
+ fs$9.stat(path, function(er, stat) {
304868
304898
  cb(er, er ? false : checkStat(stat, options));
304869
304899
  });
304870
304900
  }
304871
304901
  function sync(path, options) {
304872
- return checkStat(fs$10.statSync(path), options);
304902
+ return checkStat(fs$9.statSync(path), options);
304873
304903
  }
304874
304904
  function checkStat(stat, options) {
304875
304905
  return stat.isFile() && checkMode(stat, options);
@@ -304933,7 +304963,7 @@ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304933
304963
  //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
304934
304964
  var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304935
304965
  const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
304936
- const path$12 = __require("path");
304966
+ const path$11 = __require("path");
304937
304967
  const COLON = isWindows ? ";" : ":";
304938
304968
  const isexe = require_isexe();
304939
304969
  const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -304963,7 +304993,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304963
304993
  if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
304964
304994
  const ppRaw = pathEnv[i];
304965
304995
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
304966
- const pCmd = path$12.join(pathPart, cmd);
304996
+ const pCmd = path$11.join(pathPart, cmd);
304967
304997
  resolve(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i, 0));
304968
304998
  });
304969
304999
  const subStep = (p, i, ii) => new Promise((resolve, reject) => {
@@ -304984,7 +305014,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304984
305014
  for (let i = 0; i < pathEnv.length; i++) {
304985
305015
  const ppRaw = pathEnv[i];
304986
305016
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
304987
- const pCmd = path$12.join(pathPart, cmd);
305017
+ const pCmd = path$11.join(pathPart, cmd);
304988
305018
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
304989
305019
  for (let j = 0; j < pathExt.length; j++) {
304990
305020
  const cur = p + pathExt[j];
@@ -305015,7 +305045,7 @@ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
305015
305045
  //#endregion
305016
305046
  //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
305017
305047
  var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
305018
- const path$11 = __require("path");
305048
+ const path$10 = __require("path");
305019
305049
  const which = require_which();
305020
305050
  const getPathKey = require_path_key();
305021
305051
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -305030,12 +305060,12 @@ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) =>
305030
305060
  try {
305031
305061
  resolved = which.sync(parsed.command, {
305032
305062
  path: env[getPathKey({ env })],
305033
- pathExt: withoutPathExt ? path$11.delimiter : void 0
305063
+ pathExt: withoutPathExt ? path$10.delimiter : void 0
305034
305064
  });
305035
305065
  } catch (e) {} finally {
305036
305066
  if (shouldSwitchCwd) process.chdir(cwd);
305037
305067
  }
305038
- if (resolved) resolved = path$11.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
305068
+ if (resolved) resolved = path$10.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
305039
305069
  return resolved;
305040
305070
  }
305041
305071
  function resolveCommand(parsed) {
@@ -305084,16 +305114,16 @@ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) =
305084
305114
  //#endregion
305085
305115
  //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
305086
305116
  var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
305087
- const fs$9 = __require("fs");
305117
+ const fs$8 = __require("fs");
305088
305118
  const shebangCommand = require_shebang_command();
305089
305119
  function readShebang(command) {
305090
305120
  const size = 150;
305091
305121
  const buffer = Buffer.alloc(size);
305092
305122
  let fd;
305093
305123
  try {
305094
- fd = fs$9.openSync(command, "r");
305095
- fs$9.readSync(fd, buffer, 0, size, 0);
305096
- fs$9.closeSync(fd);
305124
+ fd = fs$8.openSync(command, "r");
305125
+ fs$8.readSync(fd, buffer, 0, size, 0);
305126
+ fs$8.closeSync(fd);
305097
305127
  } catch (e) {}
305098
305128
  return shebangCommand(buffer.toString());
305099
305129
  }
@@ -305102,7 +305132,7 @@ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
305102
305132
  //#endregion
305103
305133
  //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
305104
305134
  var require_parse$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
305105
- const path$10 = __require("path");
305135
+ const path$9 = __require("path");
305106
305136
  const resolveCommand = require_resolveCommand();
305107
305137
  const escape = require_escape();
305108
305138
  const readShebang = require_readShebang();
@@ -305125,7 +305155,7 @@ var require_parse$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
305125
305155
  const needsShell = !isExecutableRegExp.test(commandFile);
305126
305156
  if (parsed.options.forceShell || needsShell) {
305127
305157
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
305128
- parsed.command = path$10.normalize(parsed.command);
305158
+ parsed.command = path$9.normalize(parsed.command);
305129
305159
  parsed.command = escape.command(parsed.command);
305130
305160
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
305131
305161
  parsed.args = [
@@ -339720,7 +339750,7 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
339720
339750
  //#endregion
339721
339751
  //#region ../../node_modules/.pnpm/yazl@3.3.1/node_modules/yazl/index.js
339722
339752
  var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
339723
- var fs$8 = __require("fs");
339753
+ var fs$7 = __require("fs");
339724
339754
  var Transform$2 = __require("stream").Transform;
339725
339755
  var PassThrough$2 = __require("stream").PassThrough;
339726
339756
  var zlib$1 = __require("zlib");
@@ -339749,14 +339779,14 @@ var require_yazl = /* @__PURE__ */ __commonJSMin(((exports) => {
339749
339779
  if (shouldIgnoreAdding(self)) return;
339750
339780
  var entry = new Entry(metadataPath, false, options);
339751
339781
  self.entries.push(entry);
339752
- fs$8.stat(realPath, function(err, stats) {
339782
+ fs$7.stat(realPath, function(err, stats) {
339753
339783
  if (err) return self.emit("error", err);
339754
339784
  if (!stats.isFile()) return self.emit("error", /* @__PURE__ */ new Error("not a file: " + realPath));
339755
339785
  entry.uncompressedSize = stats.size;
339756
339786
  if (options.mtime == null) entry.setLastModDate(stats.mtime);
339757
339787
  if (options.mode == null) entry.setFileAttributesMode(stats.mode);
339758
339788
  entry.setFileDataPumpFunction(function() {
339759
- var readStream = fs$8.createReadStream(realPath);
339789
+ var readStream = fs$7.createReadStream(realPath);
339760
339790
  entry.state = Entry.FILE_DATA_IN_PROGRESS;
339761
339791
  readStream.on("error", function(err) {
339762
339792
  self.emit("error", err);
@@ -356304,8 +356334,8 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
356304
356334
  var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
356305
356335
  const EventEmitter$12 = __require("node:events").EventEmitter;
356306
356336
  const childProcess = __require("node:child_process");
356307
- const path$9 = __require("node:path");
356308
- const fs$7 = __require("node:fs");
356337
+ const path$8 = __require("node:path");
356338
+ const fs$6 = __require("node:fs");
356309
356339
  const process$2 = __require("node:process");
356310
356340
  const { Argument, humanReadableArgName } = require_argument();
356311
356341
  const { CommanderError } = require_error$2();
@@ -357188,7 +357218,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
357188
357218
  * @param {string} subcommandName
357189
357219
  */
357190
357220
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
357191
- if (fs$7.existsSync(executableFile)) return;
357221
+ if (fs$6.existsSync(executableFile)) return;
357192
357222
  const executableMissing = `'${executableFile}' does not exist
357193
357223
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
357194
357224
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
@@ -357211,10 +357241,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
357211
357241
  ".cjs"
357212
357242
  ];
357213
357243
  function findFile(baseDir, baseName) {
357214
- const localBin = path$9.resolve(baseDir, baseName);
357215
- if (fs$7.existsSync(localBin)) return localBin;
357216
- if (sourceExt.includes(path$9.extname(baseName))) return void 0;
357217
- const foundExt = sourceExt.find((ext) => fs$7.existsSync(`${localBin}${ext}`));
357244
+ const localBin = path$8.resolve(baseDir, baseName);
357245
+ if (fs$6.existsSync(localBin)) return localBin;
357246
+ if (sourceExt.includes(path$8.extname(baseName))) return void 0;
357247
+ const foundExt = sourceExt.find((ext) => fs$6.existsSync(`${localBin}${ext}`));
357218
357248
  if (foundExt) return `${localBin}${foundExt}`;
357219
357249
  }
357220
357250
  this._checkForMissingMandatoryOptions();
@@ -357224,21 +357254,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
357224
357254
  if (this._scriptPath) {
357225
357255
  let resolvedScriptPath;
357226
357256
  try {
357227
- resolvedScriptPath = fs$7.realpathSync(this._scriptPath);
357257
+ resolvedScriptPath = fs$6.realpathSync(this._scriptPath);
357228
357258
  } catch {
357229
357259
  resolvedScriptPath = this._scriptPath;
357230
357260
  }
357231
- executableDir = path$9.resolve(path$9.dirname(resolvedScriptPath), executableDir);
357261
+ executableDir = path$8.resolve(path$8.dirname(resolvedScriptPath), executableDir);
357232
357262
  }
357233
357263
  if (executableDir) {
357234
357264
  let localFile = findFile(executableDir, executableFile);
357235
357265
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
357236
- const legacyName = path$9.basename(this._scriptPath, path$9.extname(this._scriptPath));
357266
+ const legacyName = path$8.basename(this._scriptPath, path$8.extname(this._scriptPath));
357237
357267
  if (legacyName !== this._name) localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
357238
357268
  }
357239
357269
  executableFile = localFile || executableFile;
357240
357270
  }
357241
- launchWithNode = sourceExt.includes(path$9.extname(executableFile));
357271
+ launchWithNode = sourceExt.includes(path$8.extname(executableFile));
357242
357272
  let proc;
357243
357273
  if (process$2.platform !== "win32") if (launchWithNode) {
357244
357274
  args.unshift(executableFile);
@@ -357942,7 +357972,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
357942
357972
  * @return {Command}
357943
357973
  */
357944
357974
  nameFromFilename(filename) {
357945
- this._name = path$9.basename(filename, path$9.extname(filename));
357975
+ this._name = path$8.basename(filename, path$8.extname(filename));
357946
357976
  return this;
357947
357977
  }
357948
357978
  /**
@@ -375804,10 +375834,10 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
375804
375834
  //#endregion
375805
375835
  //#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
375806
375836
  var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
375807
- const fs$6 = __require("fs");
375837
+ const fs$5 = __require("fs");
375808
375838
  const EventEmitter$10 = __require("events");
375809
375839
  const inherits$6 = __require("util").inherits;
375810
- const path$8 = __require("path");
375840
+ const path$7 = __require("path");
375811
375841
  const sleep = require_atomic_sleep();
375812
375842
  const assert$8 = __require("assert");
375813
375843
  const BUSY_WRITE_TIMEOUT = 100;
@@ -375847,17 +375877,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
375847
375877
  const flags = sonic.append ? "a" : "w";
375848
375878
  const mode = sonic.mode;
375849
375879
  if (sonic.sync) try {
375850
- if (sonic.mkdir) fs$6.mkdirSync(path$8.dirname(file), { recursive: true });
375851
- fileOpened(null, fs$6.openSync(file, flags, mode));
375880
+ if (sonic.mkdir) fs$5.mkdirSync(path$7.dirname(file), { recursive: true });
375881
+ fileOpened(null, fs$5.openSync(file, flags, mode));
375852
375882
  } catch (err) {
375853
375883
  fileOpened(err);
375854
375884
  throw err;
375855
375885
  }
375856
- else if (sonic.mkdir) fs$6.mkdir(path$8.dirname(file), { recursive: true }, (err) => {
375886
+ else if (sonic.mkdir) fs$5.mkdir(path$7.dirname(file), { recursive: true }, (err) => {
375857
375887
  if (err) return fileOpened(err);
375858
- fs$6.open(file, flags, mode, fileOpened);
375888
+ fs$5.open(file, flags, mode, fileOpened);
375859
375889
  });
375860
- else fs$6.open(file, flags, mode, fileOpened);
375890
+ else fs$5.open(file, flags, mode, fileOpened);
375861
375891
  }
375862
375892
  function SonicBoom(opts) {
375863
375893
  if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
@@ -375895,8 +375925,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
375895
375925
  this.flush = flushBuffer;
375896
375926
  this.flushSync = flushBufferSync;
375897
375927
  this._actualWrite = actualWriteBuffer;
375898
- fsWriteSync = () => fs$6.writeSync(this.fd, this._writingBuf);
375899
- fsWrite = () => fs$6.write(this.fd, this._writingBuf, this.release);
375928
+ fsWriteSync = () => fs$5.writeSync(this.fd, this._writingBuf);
375929
+ fsWrite = () => fs$5.write(this.fd, this._writingBuf, this.release);
375900
375930
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
375901
375931
  this._writingBuf = "";
375902
375932
  this.write = write;
@@ -375904,12 +375934,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
375904
375934
  this.flushSync = flushSync;
375905
375935
  this._actualWrite = actualWrite;
375906
375936
  fsWriteSync = () => {
375907
- if (Buffer.isBuffer(this._writingBuf)) return fs$6.writeSync(this.fd, this._writingBuf);
375908
- return fs$6.writeSync(this.fd, this._writingBuf, "utf8");
375937
+ if (Buffer.isBuffer(this._writingBuf)) return fs$5.writeSync(this.fd, this._writingBuf);
375938
+ return fs$5.writeSync(this.fd, this._writingBuf, "utf8");
375909
375939
  };
375910
375940
  fsWrite = () => {
375911
- if (Buffer.isBuffer(this._writingBuf)) return fs$6.write(this.fd, this._writingBuf, this.release);
375912
- return fs$6.write(this.fd, this._writingBuf, "utf8", this.release);
375941
+ if (Buffer.isBuffer(this._writingBuf)) return fs$5.write(this.fd, this._writingBuf, this.release);
375942
+ return fs$5.write(this.fd, this._writingBuf, "utf8", this.release);
375913
375943
  };
375914
375944
  } else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
375915
375945
  if (typeof fd === "number") {
@@ -375954,7 +375984,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
375954
375984
  return;
375955
375985
  }
375956
375986
  }
375957
- if (this._fsync) fs$6.fsyncSync(this.fd);
375987
+ if (this._fsync) fs$5.fsyncSync(this.fd);
375958
375988
  const len = this._len;
375959
375989
  if (this._reopening) {
375960
375990
  this._writing = false;
@@ -376051,7 +376081,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
376051
376081
  this._flushPending = true;
376052
376082
  const onDrain = () => {
376053
376083
  if (!this._fsync) try {
376054
- fs$6.fsync(this.fd, (err) => {
376084
+ fs$5.fsync(this.fd, (err) => {
376055
376085
  this._flushPending = false;
376056
376086
  cb(err);
376057
376087
  });
@@ -376128,7 +376158,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
376128
376158
  if (this._writing) return;
376129
376159
  const fd = this.fd;
376130
376160
  this.once("ready", () => {
376131
- if (fd !== this.fd) fs$6.close(fd, (err) => {
376161
+ if (fd !== this.fd) fs$5.close(fd, (err) => {
376132
376162
  if (err) return this.emit("error", err);
376133
376163
  });
376134
376164
  });
@@ -376159,7 +376189,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
376159
376189
  while (this._bufs.length || buf.length) {
376160
376190
  if (buf.length <= 0) buf = this._bufs[0];
376161
376191
  try {
376162
- const n = Buffer.isBuffer(buf) ? fs$6.writeSync(this.fd, buf) : fs$6.writeSync(this.fd, buf, "utf8");
376192
+ const n = Buffer.isBuffer(buf) ? fs$5.writeSync(this.fd, buf) : fs$5.writeSync(this.fd, buf, "utf8");
376163
376193
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
376164
376194
  buf = releasedBufObj.writingBuf;
376165
376195
  this._len = releasedBufObj.len;
@@ -376170,7 +376200,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
376170
376200
  }
376171
376201
  }
376172
376202
  try {
376173
- fs$6.fsyncSync(this.fd);
376203
+ fs$5.fsyncSync(this.fd);
376174
376204
  } catch {}
376175
376205
  }
376176
376206
  function flushBufferSync() {
@@ -376184,7 +376214,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
376184
376214
  while (this._bufs.length || buf.length) {
376185
376215
  if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
376186
376216
  try {
376187
- const n = fs$6.writeSync(this.fd, buf);
376217
+ const n = fs$5.writeSync(this.fd, buf);
376188
376218
  buf = buf.subarray(n);
376189
376219
  this._len = Math.max(this._len - n, 0);
376190
376220
  if (buf.length <= 0) {
@@ -376206,24 +376236,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
376206
376236
  this._writing = true;
376207
376237
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
376208
376238
  if (this.sync) try {
376209
- release(null, Buffer.isBuffer(this._writingBuf) ? fs$6.writeSync(this.fd, this._writingBuf) : fs$6.writeSync(this.fd, this._writingBuf, "utf8"));
376239
+ release(null, Buffer.isBuffer(this._writingBuf) ? fs$5.writeSync(this.fd, this._writingBuf) : fs$5.writeSync(this.fd, this._writingBuf, "utf8"));
376210
376240
  } catch (err) {
376211
376241
  release(err);
376212
376242
  }
376213
- else fs$6.write(this.fd, this._writingBuf, release);
376243
+ else fs$5.write(this.fd, this._writingBuf, release);
376214
376244
  }
376215
376245
  function actualWriteBuffer() {
376216
376246
  const release = this.release;
376217
376247
  this._writing = true;
376218
376248
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
376219
376249
  if (this.sync) try {
376220
- release(null, fs$6.writeSync(this.fd, this._writingBuf));
376250
+ release(null, fs$5.writeSync(this.fd, this._writingBuf));
376221
376251
  } catch (err) {
376222
376252
  release(err);
376223
376253
  }
376224
376254
  else {
376225
376255
  if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
376226
- fs$6.write(this.fd, this._writingBuf, release);
376256
+ fs$5.write(this.fd, this._writingBuf, release);
376227
376257
  }
376228
376258
  }
376229
376259
  function actualClose(sonic) {
@@ -376237,10 +376267,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
376237
376267
  sonic._lens = [];
376238
376268
  assert$8(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
376239
376269
  try {
376240
- fs$6.fsync(sonic.fd, closeWrapped);
376270
+ fs$5.fsync(sonic.fd, closeWrapped);
376241
376271
  } catch {}
376242
376272
  function closeWrapped() {
376243
- if (sonic.fd !== 1 && sonic.fd !== 2) fs$6.close(sonic.fd, done);
376273
+ if (sonic.fd !== 1 && sonic.fd !== 2) fs$5.close(sonic.fd, done);
376244
376274
  else done();
376245
376275
  }
376246
376276
  function done(err) {
@@ -405880,7 +405910,7 @@ var import_multipart = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
405880
405910
  const fp = require_plugin();
405881
405911
  const { createWriteStream: createWriteStream$1 } = __require("node:fs");
405882
405912
  const { unlink: unlink$1 } = __require("node:fs/promises");
405883
- const path$7 = __require("node:path");
405913
+ const path$6 = __require("node:path");
405884
405914
  const { generateId } = require_generateId();
405885
405915
  const createError = require_error$1();
405886
405916
  const streamToNull = require_stream_consumer();
@@ -406175,7 +406205,7 @@ var import_multipart = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
406175
406205
  for await (const part of parts) {
406176
406206
  values = part.fields;
406177
406207
  if (!part.file) continue;
406178
- const filepath = path$7.join(tmpdir, generateId() + path$7.extname(part.filename || "file" + i++));
406208
+ const filepath = path$6.join(tmpdir, generateId() + path$6.extname(part.filename || "file" + i++));
406179
406209
  const target = createWriteStream$1(filepath);
406180
406210
  try {
406181
406211
  this.tmpUploads.push(filepath);
@@ -418916,8 +418946,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
418916
418946
  //#endregion
418917
418947
  //#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/mode/static.js
418918
418948
  var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
418919
- const path$6 = __require("node:path");
418920
- const fs$5 = __require("node:fs");
418949
+ const path$5 = __require("node:path");
418950
+ const fs$4 = __require("node:fs");
418921
418951
  const yaml = require_dist$1();
418922
418952
  module.exports = function(fastify, opts, done) {
418923
418953
  if (!opts.specification) return done(/* @__PURE__ */ new Error("specification is missing in the module options"));
@@ -418926,14 +418956,14 @@ var require_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
418926
418956
  if (!opts.specification.path && !opts.specification.document) return done(/* @__PURE__ */ new Error("both specification.path and specification.document are missing, should be path to the file or swagger document spec"));
418927
418957
  else if (opts.specification.path) {
418928
418958
  if (typeof opts.specification.path !== "string") return done(/* @__PURE__ */ new Error("specification.path is not a string"));
418929
- if (!fs$5.existsSync(path$6.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
418930
- const extName = path$6.extname(opts.specification.path).toLowerCase();
418959
+ if (!fs$4.existsSync(path$5.resolve(opts.specification.path))) return done(/* @__PURE__ */ new Error(`${opts.specification.path} does not exist`));
418960
+ const extName = path$5.extname(opts.specification.path).toLowerCase();
418931
418961
  if ([".yaml", ".json"].indexOf(extName) === -1) return done(/* @__PURE__ */ new Error("specification.path extension name is not supported, should be one from ['.yaml', '.json']"));
418932
418962
  if (opts.specification.postProcessor && typeof opts.specification.postProcessor !== "function") return done(/* @__PURE__ */ new Error("specification.postProcessor should be a function"));
418933
418963
  if (opts.specification.baseDir && typeof opts.specification.baseDir !== "string") return done(/* @__PURE__ */ new Error("specification.baseDir should be string"));
418934
- if (!opts.specification.baseDir) opts.specification.baseDir = path$6.resolve(path$6.dirname(opts.specification.path));
418964
+ if (!opts.specification.baseDir) opts.specification.baseDir = path$5.resolve(path$5.dirname(opts.specification.path));
418935
418965
  else while (opts.specification.baseDir.endsWith("/")) opts.specification.baseDir = opts.specification.baseDir.slice(0, -1);
418936
- const source = fs$5.readFileSync(path$6.resolve(opts.specification.path), "utf8");
418966
+ const source = fs$4.readFileSync(path$5.resolve(opts.specification.path), "utf8");
418937
418967
  switch (extName) {
418938
418968
  case ".yaml":
418939
418969
  swaggerObject = yaml.parse(source);
@@ -419200,11 +419230,11 @@ var require_should_route_hide = /* @__PURE__ */ __commonJSMin(((exports, module)
419200
419230
  //#endregion
419201
419231
  //#region ../../node_modules/.pnpm/@fastify+swagger@9.7.0/node_modules/@fastify/swagger/lib/util/read-package-json.js
419202
419232
  var require_read_package_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
419203
- const fs$4 = __require("node:fs");
419204
- const path$5 = __require("node:path");
419233
+ const fs$3 = __require("node:fs");
419234
+ const path$4 = __require("node:path");
419205
419235
  function readPackageJson() {
419206
419236
  try {
419207
- return JSON.parse(fs$4.readFileSync(path$5.join(__dirname, "..", "..", "package.json")));
419237
+ return JSON.parse(fs$3.readFileSync(path$4.join(__dirname, "..", "..", "package.json")));
419208
419238
  } catch {
419209
419239
  return {};
419210
419240
  }
@@ -436187,9 +436217,9 @@ var TUI = class TUI extends Container {
436187
436217
  const debugRedraw = process.env["PI_DEBUG_REDRAW"] === "1";
436188
436218
  const logRedraw = (reason) => {
436189
436219
  if (!debugRedraw) return;
436190
- const logPath = path$19.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
436220
+ const logPath = path$18.join(nodeOs.homedir(), ".pi", "agent", "pi-debug.log");
436191
436221
  const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\n`;
436192
- fs$19.appendFileSync(logPath, msg);
436222
+ fs$18.appendFileSync(logPath, msg);
436193
436223
  };
436194
436224
  if (this.previousLines.length === 0 && !widthChanged && !heightChanged) {
436195
436225
  logRedraw("first render");
@@ -436336,8 +436366,8 @@ var TUI = class TUI extends Container {
436336
436366
  buffer += "\x1B[?2026l";
436337
436367
  if (process.env["PI_TUI_DEBUG"] === "1") {
436338
436368
  const debugDir = "/tmp/tui";
436339
- fs$19.mkdirSync(debugDir, { recursive: true });
436340
- const debugPath = path$19.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
436369
+ fs$18.mkdirSync(debugDir, { recursive: true });
436370
+ const debugPath = path$18.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);
436341
436371
  const debugData = [
436342
436372
  `firstChanged: ${firstChanged}`,
436343
436373
  `viewportTop: ${viewportTop}`,
@@ -436360,7 +436390,7 @@ var TUI = class TUI extends Container {
436360
436390
  "=== buffer ===",
436361
436391
  JSON.stringify(buffer)
436362
436392
  ].join("\n");
436363
- fs$19.writeFileSync(debugPath, debugData);
436393
+ fs$18.writeFileSync(debugPath, debugData);
436364
436394
  }
436365
436395
  this.terminal.write(buffer);
436366
436396
  this.cursorRow = Math.max(0, newLines.length - 1);
@@ -440946,12 +440976,12 @@ function loadNativeModifiersHelper() {
440946
440976
  if (process.platform !== "darwin") return void 0;
440947
440977
  const arch = process.arch;
440948
440978
  if (arch !== "x64" && arch !== "arm64") return void 0;
440949
- const moduleDir = path$19.dirname(fileURLToPath(import.meta.url));
440950
- const nativePath = path$19.join("native", "darwin", "prebuilds", `darwin-${arch}`, "darwin-modifiers.node");
440979
+ const moduleDir = path$18.dirname(fileURLToPath(import.meta.url));
440980
+ const nativePath = path$18.join("native", "darwin", "prebuilds", `darwin-${arch}`, "darwin-modifiers.node");
440951
440981
  const candidates = [
440952
- path$19.join(moduleDir, "..", nativePath),
440953
- path$19.join(moduleDir, nativePath),
440954
- path$19.join(path$19.dirname(process.execPath), nativePath)
440982
+ path$18.join(moduleDir, "..", nativePath),
440983
+ path$18.join(moduleDir, nativePath),
440984
+ path$18.join(path$18.dirname(process.execPath), nativePath)
440955
440985
  ];
440956
440986
  for (const modulePath of candidates) try {
440957
440987
  const helper = cjsRequire$1(modulePath);
@@ -441024,10 +441054,10 @@ var ProcessTerminal = class {
441024
441054
  const env = process.env["PI_TUI_WRITE_LOG"] || "";
441025
441055
  if (!env) return "";
441026
441056
  try {
441027
- if (fs$19.statSync(env).isDirectory()) {
441057
+ if (fs$18.statSync(env).isDirectory()) {
441028
441058
  const now = /* @__PURE__ */ new Date();
441029
441059
  const ts = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}_${String(now.getHours()).padStart(2, "0")}-${String(now.getMinutes()).padStart(2, "0")}-${String(now.getSeconds()).padStart(2, "0")}`;
441030
- return path$19.join(env, `tui-${ts}-${process.pid}.log`);
441060
+ return path$18.join(env, `tui-${ts}-${process.pid}.log`);
441031
441061
  }
441032
441062
  } catch {}
441033
441063
  return env;
@@ -441230,12 +441260,12 @@ var ProcessTerminal = class {
441230
441260
  try {
441231
441261
  const arch = process.arch;
441232
441262
  if (arch !== "x64" && arch !== "arm64") return;
441233
- const moduleDir = path$19.dirname(fileURLToPath(import.meta.url));
441234
- const nativePath = path$19.join("native", "win32", "prebuilds", `win32-${arch}`, "win32-console-mode.node");
441263
+ const moduleDir = path$18.dirname(fileURLToPath(import.meta.url));
441264
+ const nativePath = path$18.join("native", "win32", "prebuilds", `win32-${arch}`, "win32-console-mode.node");
441235
441265
  const candidates = [
441236
- path$19.join(moduleDir, "..", nativePath),
441237
- path$19.join(moduleDir, nativePath),
441238
- path$19.join(path$19.dirname(process.execPath), nativePath)
441266
+ path$18.join(moduleDir, "..", nativePath),
441267
+ path$18.join(moduleDir, nativePath),
441268
+ path$18.join(path$18.dirname(process.execPath), nativePath)
441239
441269
  ];
441240
441270
  for (const modulePath of candidates) try {
441241
441271
  cjsRequire(modulePath).enableVirtualTerminalInput?.();
@@ -441307,7 +441337,7 @@ var ProcessTerminal = class {
441307
441337
  write(data) {
441308
441338
  process.stdout.write(data);
441309
441339
  if (this.writeLogPath) try {
441310
- fs$19.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
441340
+ fs$18.appendFileSync(this.writeLogPath, data, { encoding: "utf8" });
441311
441341
  } catch {}
441312
441342
  }
441313
441343
  get columns() {
@@ -528093,8 +528123,8 @@ function formatTurnEndedFailure(event) {
528093
528123
  //#endregion
528094
528124
  //#region ../../packaging/npm/bin/profile-launch.cjs
528095
528125
  var require_profile_launch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
528096
- const path$4 = __require("node:path");
528097
- const fs$3 = __require("node:fs");
528126
+ const path$3 = __require("node:path");
528127
+ const fs$2 = __require("node:fs");
528098
528128
  const PROFILE_NAME = /^[a-z0-9][a-z0-9_-]{0,31}$/u;
528099
528129
  const RESERVED = new Set([
528100
528130
  "doctor",
@@ -528147,7 +528177,7 @@ var require_profile_launch = /* @__PURE__ */ __commonJSMin(((exports, module) =>
528147
528177
  name: void 0
528148
528178
  };
528149
528179
  }
528150
- function resolveSelectedProfile(sharedHome, name, pathImpl = path$4) {
528180
+ function resolveSelectedProfile(sharedHome, name, pathImpl = path$3) {
528151
528181
  return pathImpl.join(sharedHome, "profile", profileName(name));
528152
528182
  }
528153
528183
  function catalogUnavailable() {
@@ -528165,12 +528195,12 @@ var require_profile_launch = /* @__PURE__ */ __commonJSMin(((exports, module) =>
528165
528195
  return stat;
528166
528196
  }
528167
528197
  function homeIdentity(home, fsImpl) {
528168
- const root = path$4.parse(home).root;
528198
+ const root = path$3.parse(home).root;
528169
528199
  let current = root;
528170
528200
  let stat = directoryIdentity(current, fsImpl);
528171
- for (const part of home.slice(root.length).split(path$4.sep).filter(Boolean)) {
528201
+ for (const part of home.slice(root.length).split(path$3.sep).filter(Boolean)) {
528172
528202
  if (stat === void 0) return void 0;
528173
- current = path$4.join(current, part);
528203
+ current = path$3.join(current, part);
528174
528204
  stat = directoryIdentity(current, fsImpl);
528175
528205
  }
528176
528206
  return stat;
@@ -528180,14 +528210,14 @@ var require_profile_launch = /* @__PURE__ */ __commonJSMin(((exports, module) =>
528180
528210
  }
528181
528211
  /** Directory names only; selection must revalidate them before changing owner. */
528182
528212
  function listExistingProfiles(sharedHome, options = {}) {
528183
- const fsImpl = options.fsImpl || fs$3;
528213
+ const fsImpl = options.fsImpl || fs$2;
528184
528214
  try {
528185
- if (typeof sharedHome !== "string" || !path$4.isAbsolute(sharedHome)) throw catalogUnavailable();
528186
- const home = path$4.resolve(sharedHome);
528215
+ if (typeof sharedHome !== "string" || !path$3.isAbsolute(sharedHome)) throw catalogUnavailable();
528216
+ const home = path$3.resolve(sharedHome);
528187
528217
  if (process.platform === "win32" && home.startsWith("\\\\")) throw catalogUnavailable();
528188
528218
  const beforeHome = homeIdentity(home, fsImpl);
528189
528219
  if (beforeHome === void 0) return [];
528190
- const profileRoot = path$4.join(home, "profile");
528220
+ const profileRoot = path$3.join(home, "profile");
528191
528221
  const beforeProfiles = directoryIdentity(profileRoot, fsImpl);
528192
528222
  if (beforeProfiles === void 0) {
528193
528223
  if (!sameDirectory(beforeHome, homeIdentity(home, fsImpl))) throw catalogUnavailable();
@@ -528235,8 +528265,8 @@ var require_profile_launch = /* @__PURE__ */ __commonJSMin(((exports, module) =>
528235
528265
  //#endregion
528236
528266
  //#region src/customer-mistake/client-state.ts
528237
528267
  var import_profile_handoff = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
528238
- const fs$2 = __require("node:fs");
528239
- const path$3 = __require("node:path");
528268
+ const fs$1 = __require("node:fs");
528269
+ const path$2 = __require("node:path");
528240
528270
  const { randomUUID: randomUUID$1 } = __require("node:crypto");
528241
528271
  const { listExistingProfiles, resolveSelectedProfile } = require_profile_launch();
528242
528272
  const PROFILE_HANDOFF_REQUEST = "blun-profile-handoff-request";
@@ -528251,12 +528281,12 @@ var import_profile_handoff = (/* @__PURE__ */ __commonJSMin(((exports, module) =
528251
528281
  function createProfileHandoff(env, isBusy = () => false) {
528252
528282
  let pending;
528253
528283
  const validate = (name) => {
528254
- if (typeof env.BLUN_HOME !== "string" || !path$3.isAbsolute(env.BLUN_HOME) || env.BLUN_SHARED_HOME !== void 0 && !path$3.isAbsolute(env.BLUN_SHARED_HOME)) throw unavailable();
528255
- const sharedHome = path$3.resolve(env.BLUN_SHARED_HOME || env.BLUN_HOME);
528256
- const homeDir = path$3.resolve(env.BLUN_HOME);
528284
+ if (typeof env.BLUN_HOME !== "string" || !path$2.isAbsolute(env.BLUN_HOME) || env.BLUN_SHARED_HOME !== void 0 && !path$2.isAbsolute(env.BLUN_SHARED_HOME)) throw unavailable();
528285
+ const sharedHome = path$2.resolve(env.BLUN_SHARED_HOME || env.BLUN_HOME);
528286
+ const homeDir = path$2.resolve(env.BLUN_HOME);
528257
528287
  const current = env.BLUN_PROFILE;
528258
528288
  if (current !== void 0) {
528259
- if (!env.BLUN_SHARED_HOME || path$3.basename(resolveSelectedProfile(sharedHome, current)) !== current || !samePath(homeDir, resolveSelectedProfile(sharedHome, current))) throw unavailable();
528289
+ if (!env.BLUN_SHARED_HOME || path$2.basename(resolveSelectedProfile(sharedHome, current)) !== current || !samePath(homeDir, resolveSelectedProfile(sharedHome, current))) throw unavailable();
528260
528290
  } else if (!samePath(homeDir, sharedHome)) throw unavailable();
528261
528291
  const names = listExistingProfiles(sharedHome);
528262
528292
  if (typeof name !== "string" || !names.includes(name) || name === current || current !== void 0 && !names.includes(current)) throw unavailable();
@@ -528264,12 +528294,12 @@ var import_profile_handoff = (/* @__PURE__ */ __commonJSMin(((exports, module) =
528264
528294
  if (isBusy(target)) throw unavailable();
528265
528295
  const identities = [
528266
528296
  sharedHome,
528267
- path$3.join(sharedHome, "profile"),
528297
+ path$2.join(sharedHome, "profile"),
528268
528298
  homeDir,
528269
528299
  target
528270
528300
  ].map((file) => ({
528271
528301
  file,
528272
- stat: fs$2.lstatSync(file, { bigint: true })
528302
+ stat: fs$1.lstatSync(file, { bigint: true })
528273
528303
  }));
528274
528304
  if (identities.some(({ stat }) => !stat.isDirectory() || stat.isSymbolicLink())) throw unavailable();
528275
528305
  return {
@@ -528362,7 +528392,7 @@ var import_profile_handoff = (/* @__PURE__ */ __commonJSMin(((exports, module) =
528362
528392
  /** @param {string} name @param {{ signal?: AbortSignal, timeoutMs?: number, sourceSessionId?: string }} [options] */
528363
528393
  prepare(name, { signal, timeoutMs = 5e3, sourceSessionId } = {}) {
528364
528394
  try {
528365
- if (!available() || pending || signal?.aborted || typeof name !== "string" || path$3.basename(resolveSelectedProfile(path$3.parse(__dirname).root, name)) !== name || !Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 3e4 || sourceSessionId !== void 0 && (typeof sourceSessionId !== "string" || !SESSION_ID.test(sourceSessionId))) return Promise.resolve(false);
528395
+ if (!available() || pending || signal?.aborted || typeof name !== "string" || path$2.basename(resolveSelectedProfile(path$2.parse(__dirname).root, name)) !== name || !Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 3e4 || sourceSessionId !== void 0 && (typeof sourceSessionId !== "string" || !SESSION_ID.test(sourceSessionId))) return Promise.resolve(false);
528366
528396
  } catch {
528367
528397
  return Promise.resolve(false);
528368
528398
  }
@@ -550965,13 +550995,13 @@ var BlunTUI = class {
550965
550995
  //#endregion
550966
550996
  //#region src/constant/update.ts
550967
550997
  var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
550968
- const fs$1 = __require("node:fs");
550998
+ const fs = __require("node:fs");
550969
550999
  const os$1 = __require("node:os");
550970
- const path$2 = __require("node:path");
551000
+ const path$1 = __require("node:path");
550971
551001
  const DEFAULT_MAX_BYTES = 1024 * 1024;
550972
551002
  const DEFAULT_RETAIN_BYTES = 512 * 1024;
550973
551003
  function runtimeExitLedgerPath(homeDir) {
550974
- return path$2.join(homeDir, "diagnostics", "runtime-exits.jsonl");
551004
+ return path$1.join(homeDir, "diagnostics", "runtime-exits.jsonl");
550975
551005
  }
550976
551006
  function sanitizeExitText(input, maxChars = 2048) {
550977
551007
  let value = String(input ?? "");
@@ -550980,7 +551010,7 @@ var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, modul
550980
551010
  process.env.USERPROFILE,
550981
551011
  process.env.HOME
550982
551012
  ].filter((entry) => typeof entry === "string" && entry.length > 2));
550983
- for (const home of homes) for (const variant of [path$2.normalize(home), home.replaceAll("\\", "/")]) {
551013
+ for (const home of homes) for (const variant of [path$1.normalize(home), home.replaceAll("\\", "/")]) {
550984
551014
  const escaped = variant.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
550985
551015
  value = value.replace(new RegExp(escaped, process.platform === "win32" ? "giu" : "gu"), "$HOME");
550986
551016
  }
@@ -551019,7 +551049,7 @@ var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, modul
551019
551049
  return record;
551020
551050
  }
551021
551051
  function directoryIdentity(directory) {
551022
- const stat = fs$1.lstatSync(directory, { bigint: true });
551052
+ const stat = fs.lstatSync(directory, { bigint: true });
551023
551053
  if (!stat.isDirectory() || stat.isSymbolicLink()) throw new Error("Unsafe exit directory");
551024
551054
  return stat;
551025
551055
  }
@@ -551031,46 +551061,46 @@ var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, modul
551031
551061
  return stat;
551032
551062
  }
551033
551063
  function trimLedger(descriptor, maxBytes, retainBytes, incomingBytes) {
551034
- const size = Number(regularLedger(fs$1.fstatSync(descriptor, { bigint: true })).size);
551064
+ const size = Number(regularLedger(fs.fstatSync(descriptor, { bigint: true })).size);
551035
551065
  if (!Number.isSafeInteger(size)) throw new Error("Invalid exit ledger size");
551036
551066
  if (size + incomingBytes <= maxBytes) return;
551037
551067
  const keepBytes = Math.max(0, Math.min(size, retainBytes, maxBytes - incomingBytes));
551038
551068
  const contents = Buffer.alloc(keepBytes);
551039
- const read = fs$1.readSync(descriptor, contents, 0, keepBytes, size - keepBytes);
551069
+ const read = fs.readSync(descriptor, contents, 0, keepBytes, size - keepBytes);
551040
551070
  const tail = contents.subarray(0, read);
551041
551071
  const lineStart = size > keepBytes ? tail.indexOf(10) + 1 : 0;
551042
- fs$1.ftruncateSync(descriptor, 0);
551043
- fs$1.writeFileSync(descriptor, lineStart > 0 || size === keepBytes ? tail.subarray(lineStart) : "");
551072
+ fs.ftruncateSync(descriptor, 0);
551073
+ fs.writeFileSync(descriptor, lineStart > 0 || size === keepBytes ? tail.subarray(lineStart) : "");
551044
551074
  }
551045
551075
  function recordRuntimeExit(input = {}) {
551046
551076
  let descriptor;
551047
551077
  let appendDescriptor;
551048
551078
  try {
551049
551079
  const homeDir = typeof input.homeDir === "string" ? input.homeDir.trim() : "";
551050
- if (!homeDir || !path$2.isAbsolute(homeDir)) return false;
551051
- fs$1.mkdirSync(homeDir, {
551080
+ if (!homeDir || !path$1.isAbsolute(homeDir)) return false;
551081
+ fs.mkdirSync(homeDir, {
551052
551082
  recursive: true,
551053
551083
  mode: 448
551054
551084
  });
551055
551085
  const homeIdentity = directoryIdentity(homeDir);
551056
551086
  const file = runtimeExitLedgerPath(homeDir);
551057
- const directory = path$2.dirname(file);
551087
+ const directory = path$1.dirname(file);
551058
551088
  try {
551059
- fs$1.mkdirSync(directory, { mode: 448 });
551089
+ fs.mkdirSync(directory, { mode: 448 });
551060
551090
  } catch (error) {
551061
551091
  if (error.code !== "EEXIST") throw error;
551062
551092
  }
551063
551093
  const directoryStat = directoryIdentity(directory);
551064
551094
  let before;
551065
551095
  try {
551066
- before = regularLedger(fs$1.lstatSync(file, { bigint: true }));
551096
+ before = regularLedger(fs.lstatSync(file, { bigint: true }));
551067
551097
  } catch (error) {
551068
551098
  if (error.code !== "ENOENT") throw error;
551069
551099
  }
551070
- const flags = fs$1.constants.O_RDWR | (fs$1.constants.O_NOFOLLOW ?? 0) | (fs$1.constants.O_NONBLOCK ?? 0) | (before ? 0 : fs$1.constants.O_CREAT | fs$1.constants.O_EXCL);
551071
- descriptor = fs$1.openSync(file, flags, 384);
551072
- const opened = regularLedger(fs$1.fstatSync(descriptor, { bigint: true }));
551073
- if (before && !sameIdentity(before, opened) || !sameIdentity(opened, regularLedger(fs$1.lstatSync(file, { bigint: true }))) || !sameIdentity(homeIdentity, directoryIdentity(homeDir)) || !sameIdentity(directoryStat, directoryIdentity(directory))) throw new Error("Exit ledger changed");
551100
+ const flags = fs.constants.O_RDWR | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0) | (before ? 0 : fs.constants.O_CREAT | fs.constants.O_EXCL);
551101
+ descriptor = fs.openSync(file, flags, 384);
551102
+ const opened = regularLedger(fs.fstatSync(descriptor, { bigint: true }));
551103
+ if (before && !sameIdentity(before, opened) || !sameIdentity(opened, regularLedger(fs.lstatSync(file, { bigint: true }))) || !sameIdentity(homeIdentity, directoryIdentity(homeDir)) || !sameIdentity(directoryStat, directoryIdentity(directory))) throw new Error("Exit ledger changed");
551074
551104
  const maxBytes = Math.max(1024, Number.isInteger(input.maxBytes) ? input.maxBytes : DEFAULT_MAX_BYTES);
551075
551105
  const retainBytes = Math.max(0, Number.isInteger(input.retainBytes) ? input.retainBytes : DEFAULT_RETAIN_BYTES);
551076
551106
  const record = buildRuntimeExitRecord(input);
@@ -551093,21 +551123,21 @@ var import_runtime_exit_ledger = (/* @__PURE__ */ __commonJSMin(((exports, modul
551093
551123
  line = `${JSON.stringify(record)}\n`;
551094
551124
  }
551095
551125
  trimLedger(descriptor, maxBytes, retainBytes, Buffer.byteLength(line));
551096
- appendDescriptor = fs$1.openSync(file, fs$1.constants.O_WRONLY | fs$1.constants.O_APPEND | (fs$1.constants.O_NOFOLLOW ?? 0) | (fs$1.constants.O_NONBLOCK ?? 0));
551097
- if (!sameIdentity(opened, regularLedger(fs$1.fstatSync(appendDescriptor, { bigint: true }))) || !sameIdentity(opened, regularLedger(fs$1.lstatSync(file, { bigint: true }))) || !sameIdentity(homeIdentity, directoryIdentity(homeDir)) || !sameIdentity(directoryStat, directoryIdentity(directory))) throw new Error("Exit ledger changed");
551098
- fs$1.appendFileSync(appendDescriptor, line, { encoding: "utf8" });
551126
+ appendDescriptor = fs.openSync(file, fs.constants.O_WRONLY | fs.constants.O_APPEND | (fs.constants.O_NOFOLLOW ?? 0) | (fs.constants.O_NONBLOCK ?? 0));
551127
+ if (!sameIdentity(opened, regularLedger(fs.fstatSync(appendDescriptor, { bigint: true }))) || !sameIdentity(opened, regularLedger(fs.lstatSync(file, { bigint: true }))) || !sameIdentity(homeIdentity, directoryIdentity(homeDir)) || !sameIdentity(directoryStat, directoryIdentity(directory))) throw new Error("Exit ledger changed");
551128
+ fs.appendFileSync(appendDescriptor, line, { encoding: "utf8" });
551099
551129
  try {
551100
- fs$1.fchmodSync(descriptor, 384);
551130
+ fs.fchmodSync(descriptor, 384);
551101
551131
  } catch {}
551102
551132
  return true;
551103
551133
  } catch {
551104
551134
  return false;
551105
551135
  } finally {
551106
551136
  if (appendDescriptor !== void 0) try {
551107
- fs$1.closeSync(appendDescriptor);
551137
+ fs.closeSync(appendDescriptor);
551108
551138
  } catch {}
551109
551139
  if (descriptor !== void 0) try {
551110
- fs$1.closeSync(descriptor);
551140
+ fs.closeSync(descriptor);
551111
551141
  } catch {}
551112
551142
  }
551113
551143
  }