duclaw-cli 1.8.9 → 1.8.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -115,7 +115,7 @@ var require_package = __commonJS({
115
115
  var require_main = __commonJS({
116
116
  "node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.js"(exports2, module2) {
117
117
  var fs3 = require("fs");
118
- var path17 = require("path");
118
+ var path18 = require("path");
119
119
  var os = require("os");
120
120
  var crypto2 = require("crypto");
121
121
  var packageJson = require_package();
@@ -261,7 +261,7 @@ var require_main = __commonJS({
261
261
  possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
262
262
  }
263
263
  } else {
264
- possibleVaultPath = path17.resolve(process.cwd(), ".env.vault");
264
+ possibleVaultPath = path18.resolve(process.cwd(), ".env.vault");
265
265
  }
266
266
  if (fs3.existsSync(possibleVaultPath)) {
267
267
  return possibleVaultPath;
@@ -269,7 +269,7 @@ var require_main = __commonJS({
269
269
  return null;
270
270
  }
271
271
  function _resolveHome(envPath) {
272
- return envPath[0] === "~" ? path17.join(os.homedir(), envPath.slice(1)) : envPath;
272
+ return envPath[0] === "~" ? path18.join(os.homedir(), envPath.slice(1)) : envPath;
273
273
  }
274
274
  function _configVault(options) {
275
275
  const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
@@ -286,7 +286,7 @@ var require_main = __commonJS({
286
286
  return { parsed };
287
287
  }
288
288
  function configDotenv(options) {
289
- const dotenvPath = path17.resolve(process.cwd(), ".env");
289
+ const dotenvPath = path18.resolve(process.cwd(), ".env");
290
290
  let encoding = "utf8";
291
291
  let processEnv = process.env;
292
292
  if (options && options.processEnv != null) {
@@ -314,13 +314,13 @@ var require_main = __commonJS({
314
314
  }
315
315
  let lastError;
316
316
  const parsedAll = {};
317
- for (const path18 of optionPaths) {
317
+ for (const path19 of optionPaths) {
318
318
  try {
319
- const parsed = DotenvModule.parse(fs3.readFileSync(path18, { encoding }));
319
+ const parsed = DotenvModule.parse(fs3.readFileSync(path19, { encoding }));
320
320
  DotenvModule.populate(parsedAll, parsed, options);
321
321
  } catch (e) {
322
322
  if (debug) {
323
- _debug(`Failed to load ${path18} ${e.message}`);
323
+ _debug(`Failed to load ${path19} ${e.message}`);
324
324
  }
325
325
  lastError = e;
326
326
  }
@@ -333,7 +333,7 @@ var require_main = __commonJS({
333
333
  const shortPaths = [];
334
334
  for (const filePath of optionPaths) {
335
335
  try {
336
- const relative4 = path17.relative(process.cwd(), filePath);
336
+ const relative4 = path18.relative(process.cwd(), filePath);
337
337
  shortPaths.push(relative4);
338
338
  } catch (e) {
339
339
  if (debug) {
@@ -8237,8 +8237,8 @@ var require_MODULE_LOAD = __commonJS({
8237
8237
  * @param moduleArguments - Optional arguments to pass to the module
8238
8238
  * @see https://redis.io/commands/module-load/
8239
8239
  */
8240
- parseCommand(parser, path17, moduleArguments) {
8241
- parser.push("MODULE", "LOAD", path17);
8240
+ parseCommand(parser, path18, moduleArguments) {
8241
+ parser.push("MODULE", "LOAD", path18);
8242
8242
  if (moduleArguments) {
8243
8243
  parser.push(...moduleArguments);
8244
8244
  }
@@ -23539,10 +23539,10 @@ var require_ARRAPPEND = __commonJS({
23539
23539
  * @param json - The first value to append
23540
23540
  * @param jsons - Additional values to append
23541
23541
  */
23542
- parseCommand(parser, key, path17, json, ...jsons) {
23542
+ parseCommand(parser, key, path18, json, ...jsons) {
23543
23543
  parser.push("JSON.ARRAPPEND");
23544
23544
  parser.pushKey(key);
23545
- parser.push(path17, (0, generic_transformers_1.transformRedisJsonArgument)(json));
23545
+ parser.push(path18, (0, generic_transformers_1.transformRedisJsonArgument)(json));
23546
23546
  for (let i = 0; i < jsons.length; i++) {
23547
23547
  parser.push((0, generic_transformers_1.transformRedisJsonArgument)(jsons[i]));
23548
23548
  }
@@ -23572,10 +23572,10 @@ var require_ARRINDEX = __commonJS({
23572
23572
  * @param options.range.start - Starting index for the search
23573
23573
  * @param options.range.stop - Optional ending index for the search
23574
23574
  */
23575
- parseCommand(parser, key, path17, json, options) {
23575
+ parseCommand(parser, key, path18, json, options) {
23576
23576
  parser.push("JSON.ARRINDEX");
23577
23577
  parser.pushKey(key);
23578
- parser.push(path17, (0, generic_transformers_1.transformRedisJsonArgument)(json));
23578
+ parser.push(path18, (0, generic_transformers_1.transformRedisJsonArgument)(json));
23579
23579
  if (options?.range) {
23580
23580
  parser.push(options.range.start.toString());
23581
23581
  if (options.range.stop !== void 0) {
@@ -23607,10 +23607,10 @@ var require_ARRINSERT = __commonJS({
23607
23607
  * @param json - The first value to insert
23608
23608
  * @param jsons - Additional values to insert
23609
23609
  */
23610
- parseCommand(parser, key, path17, index, json, ...jsons) {
23610
+ parseCommand(parser, key, path18, index, json, ...jsons) {
23611
23611
  parser.push("JSON.ARRINSERT");
23612
23612
  parser.pushKey(key);
23613
- parser.push(path17, index.toString(), (0, generic_transformers_1.transformRedisJsonArgument)(json));
23613
+ parser.push(path18, index.toString(), (0, generic_transformers_1.transformRedisJsonArgument)(json));
23614
23614
  for (let i = 0; i < jsons.length; i++) {
23615
23615
  parser.push((0, generic_transformers_1.transformRedisJsonArgument)(jsons[i]));
23616
23616
  }
@@ -23700,10 +23700,10 @@ var require_ARRTRIM = __commonJS({
23700
23700
  * @param start - Starting index (inclusive)
23701
23701
  * @param stop - Ending index (inclusive)
23702
23702
  */
23703
- parseCommand(parser, key, path17, start, stop) {
23703
+ parseCommand(parser, key, path18, start, stop) {
23704
23704
  parser.push("JSON.ARRTRIM");
23705
23705
  parser.pushKey(key);
23706
- parser.push(path17, start.toString(), stop.toString());
23706
+ parser.push(path18, start.toString(), stop.toString());
23707
23707
  },
23708
23708
  transformReply: void 0
23709
23709
  };
@@ -23868,10 +23868,10 @@ var require_MERGE3 = __commonJS({
23868
23868
  * @param path - Path to merge into
23869
23869
  * @param value - JSON value to merge
23870
23870
  */
23871
- parseCommand(parser, key, path17, value) {
23871
+ parseCommand(parser, key, path18, value) {
23872
23872
  parser.push("JSON.MERGE");
23873
23873
  parser.pushKey(key);
23874
- parser.push(path17, (0, generic_transformers_1.transformRedisJsonArgument)(value));
23874
+ parser.push(path18, (0, generic_transformers_1.transformRedisJsonArgument)(value));
23875
23875
  },
23876
23876
  transformReply: void 0
23877
23877
  };
@@ -23894,10 +23894,10 @@ var require_MGET2 = __commonJS({
23894
23894
  * @param keys - Array of keys containing JSON documents
23895
23895
  * @param path - Path to retrieve from each document
23896
23896
  */
23897
- parseCommand(parser, keys, path17) {
23897
+ parseCommand(parser, keys, path18) {
23898
23898
  parser.push("JSON.MGET");
23899
23899
  parser.pushKeys(keys);
23900
- parser.push(path17);
23900
+ parser.push(path18);
23901
23901
  },
23902
23902
  transformReply(reply) {
23903
23903
  return reply.map((json) => (0, generic_transformers_1.transformRedisJsonNullReply)(json));
@@ -23952,10 +23952,10 @@ var require_NUMINCRBY = __commonJS({
23952
23952
  * @param path - Path to the numeric value
23953
23953
  * @param by - Amount to increment by
23954
23954
  */
23955
- parseCommand(parser, key, path17, by) {
23955
+ parseCommand(parser, key, path18, by) {
23956
23956
  parser.push("JSON.NUMINCRBY");
23957
23957
  parser.pushKey(key);
23958
- parser.push(path17, by.toString());
23958
+ parser.push(path18, by.toString());
23959
23959
  },
23960
23960
  transformReply: {
23961
23961
  2: (reply) => {
@@ -23987,10 +23987,10 @@ var require_NUMMULTBY = __commonJS({
23987
23987
  * @param path - Path to the numeric value
23988
23988
  * @param by - Amount to multiply by
23989
23989
  */
23990
- parseCommand(parser, key, path17, by) {
23990
+ parseCommand(parser, key, path18, by) {
23991
23991
  parser.push("JSON.NUMMULTBY");
23992
23992
  parser.pushKey(key);
23993
- parser.push(path17, by.toString());
23993
+ parser.push(path18, by.toString());
23994
23994
  },
23995
23995
  transformReply: NUMINCRBY_1.default.transformReply
23996
23996
  };
@@ -24074,10 +24074,10 @@ var require_SET2 = __commonJS({
24074
24074
  * @deprecated options.NX - Use options.condition instead
24075
24075
  * @deprecated options.XX - Use options.condition instead
24076
24076
  */
24077
- parseCommand(parser, key, path17, json, options) {
24077
+ parseCommand(parser, key, path18, json, options) {
24078
24078
  parser.push("JSON.SET");
24079
24079
  parser.pushKey(key);
24080
- parser.push(path17, (0, generic_transformers_1.transformRedisJsonArgument)(json));
24080
+ parser.push(path18, (0, generic_transformers_1.transformRedisJsonArgument)(json));
24081
24081
  if (options?.condition) {
24082
24082
  parser.push(options?.condition);
24083
24083
  } else if (options?.NX) {
@@ -24165,10 +24165,10 @@ var require_TOGGLE = __commonJS({
24165
24165
  * @param key - The key containing the JSON document
24166
24166
  * @param path - Path to the boolean value
24167
24167
  */
24168
- parseCommand(parser, key, path17) {
24168
+ parseCommand(parser, key, path18) {
24169
24169
  parser.push("JSON.TOGGLE");
24170
24170
  parser.pushKey(key);
24171
- parser.push(path17);
24171
+ parser.push(path18);
24172
24172
  },
24173
24173
  transformReply: void 0
24174
24174
  };
@@ -30242,7 +30242,7 @@ function printHelp() {
30242
30242
  `);
30243
30243
  }
30244
30244
  function printVersion() {
30245
- console.log(`duclaw-cli v${true ? "1.8.9" : "unknown"}`);
30245
+ console.log(`duclaw-cli v${true ? "1.8.10" : "unknown"}`);
30246
30246
  }
30247
30247
  function getDuclawTemplate() {
30248
30248
  return {
@@ -30970,7 +30970,7 @@ var ReaddirpStream = class extends import_node_stream.Readable {
30970
30970
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
30971
30971
  const statMethod = opts.lstat ? import_promises2.lstat : import_promises2.stat;
30972
30972
  if (wantBigintFsStats) {
30973
- this._stat = (path17) => statMethod(path17, { bigint: true });
30973
+ this._stat = (path18) => statMethod(path18, { bigint: true });
30974
30974
  } else {
30975
30975
  this._stat = statMethod;
30976
30976
  }
@@ -30995,8 +30995,8 @@ var ReaddirpStream = class extends import_node_stream.Readable {
30995
30995
  const par = this.parent;
30996
30996
  const fil = par && par.files;
30997
30997
  if (fil && fil.length > 0) {
30998
- const { path: path17, depth } = par;
30999
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path17));
30998
+ const { path: path18, depth } = par;
30999
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path18));
31000
31000
  const awaited = await Promise.all(slice);
31001
31001
  for (const entry of awaited) {
31002
31002
  if (!entry)
@@ -31036,20 +31036,20 @@ var ReaddirpStream = class extends import_node_stream.Readable {
31036
31036
  this.reading = false;
31037
31037
  }
31038
31038
  }
31039
- async _exploreDir(path17, depth) {
31039
+ async _exploreDir(path18, depth) {
31040
31040
  let files;
31041
31041
  try {
31042
- files = await (0, import_promises2.readdir)(path17, this._rdOptions);
31042
+ files = await (0, import_promises2.readdir)(path18, this._rdOptions);
31043
31043
  } catch (error) {
31044
31044
  this._onError(error);
31045
31045
  }
31046
- return { files, depth, path: path17 };
31046
+ return { files, depth, path: path18 };
31047
31047
  }
31048
- async _formatEntry(dirent, path17) {
31048
+ async _formatEntry(dirent, path18) {
31049
31049
  let entry;
31050
31050
  const basename4 = this._isDirent ? dirent.name : dirent;
31051
31051
  try {
31052
- const fullPath = (0, import_node_path2.resolve)((0, import_node_path2.join)(path17, basename4));
31052
+ const fullPath = (0, import_node_path2.resolve)((0, import_node_path2.join)(path18, basename4));
31053
31053
  entry = { path: (0, import_node_path2.relative)(this._root, fullPath), fullPath, basename: basename4 };
31054
31054
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
31055
31055
  } catch (err) {
@@ -31449,16 +31449,16 @@ var delFromSet = (main2, prop, item) => {
31449
31449
  };
31450
31450
  var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
31451
31451
  var FsWatchInstances = /* @__PURE__ */ new Map();
31452
- function createFsWatchInstance(path17, options, listener, errHandler, emitRaw) {
31452
+ function createFsWatchInstance(path18, options, listener, errHandler, emitRaw) {
31453
31453
  const handleEvent = (rawEvent, evPath) => {
31454
- listener(path17);
31455
- emitRaw(rawEvent, evPath, { watchedPath: path17 });
31456
- if (evPath && path17 !== evPath) {
31457
- fsWatchBroadcast(sp.resolve(path17, evPath), KEY_LISTENERS, sp.join(path17, evPath));
31454
+ listener(path18);
31455
+ emitRaw(rawEvent, evPath, { watchedPath: path18 });
31456
+ if (evPath && path18 !== evPath) {
31457
+ fsWatchBroadcast(sp.resolve(path18, evPath), KEY_LISTENERS, sp.join(path18, evPath));
31458
31458
  }
31459
31459
  };
31460
31460
  try {
31461
- return (0, import_node_fs.watch)(path17, {
31461
+ return (0, import_node_fs.watch)(path18, {
31462
31462
  persistent: options.persistent
31463
31463
  }, handleEvent);
31464
31464
  } catch (error) {
@@ -31474,12 +31474,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
31474
31474
  listener(val1, val2, val3);
31475
31475
  });
31476
31476
  };
31477
- var setFsWatchListener = (path17, fullPath, options, handlers) => {
31477
+ var setFsWatchListener = (path18, fullPath, options, handlers) => {
31478
31478
  const { listener, errHandler, rawEmitter } = handlers;
31479
31479
  let cont = FsWatchInstances.get(fullPath);
31480
31480
  let watcher;
31481
31481
  if (!options.persistent) {
31482
- watcher = createFsWatchInstance(path17, options, listener, errHandler, rawEmitter);
31482
+ watcher = createFsWatchInstance(path18, options, listener, errHandler, rawEmitter);
31483
31483
  if (!watcher)
31484
31484
  return;
31485
31485
  return watcher.close.bind(watcher);
@@ -31490,7 +31490,7 @@ var setFsWatchListener = (path17, fullPath, options, handlers) => {
31490
31490
  addAndConvert(cont, KEY_RAW, rawEmitter);
31491
31491
  } else {
31492
31492
  watcher = createFsWatchInstance(
31493
- path17,
31493
+ path18,
31494
31494
  options,
31495
31495
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
31496
31496
  errHandler,
@@ -31505,7 +31505,7 @@ var setFsWatchListener = (path17, fullPath, options, handlers) => {
31505
31505
  cont.watcherUnusable = true;
31506
31506
  if (isWindows && error.code === "EPERM") {
31507
31507
  try {
31508
- const fd = await (0, import_promises3.open)(path17, "r");
31508
+ const fd = await (0, import_promises3.open)(path18, "r");
31509
31509
  await fd.close();
31510
31510
  broadcastErr(error);
31511
31511
  } catch (err) {
@@ -31536,7 +31536,7 @@ var setFsWatchListener = (path17, fullPath, options, handlers) => {
31536
31536
  };
31537
31537
  };
31538
31538
  var FsWatchFileInstances = /* @__PURE__ */ new Map();
31539
- var setFsWatchFileListener = (path17, fullPath, options, handlers) => {
31539
+ var setFsWatchFileListener = (path18, fullPath, options, handlers) => {
31540
31540
  const { listener, rawEmitter } = handlers;
31541
31541
  let cont = FsWatchFileInstances.get(fullPath);
31542
31542
  const copts = cont && cont.options;
@@ -31558,7 +31558,7 @@ var setFsWatchFileListener = (path17, fullPath, options, handlers) => {
31558
31558
  });
31559
31559
  const currmtime = curr.mtimeMs;
31560
31560
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
31561
- foreach(cont.listeners, (listener2) => listener2(path17, curr));
31561
+ foreach(cont.listeners, (listener2) => listener2(path18, curr));
31562
31562
  }
31563
31563
  })
31564
31564
  };
@@ -31588,13 +31588,13 @@ var NodeFsHandler = class {
31588
31588
  * @param listener on fs change
31589
31589
  * @returns closer for the watcher instance
31590
31590
  */
31591
- _watchWithNodeFs(path17, listener) {
31591
+ _watchWithNodeFs(path18, listener) {
31592
31592
  const opts = this.fsw.options;
31593
- const directory = sp.dirname(path17);
31594
- const basename4 = sp.basename(path17);
31593
+ const directory = sp.dirname(path18);
31594
+ const basename4 = sp.basename(path18);
31595
31595
  const parent = this.fsw._getWatchedDir(directory);
31596
31596
  parent.add(basename4);
31597
- const absolutePath = sp.resolve(path17);
31597
+ const absolutePath = sp.resolve(path18);
31598
31598
  const options = {
31599
31599
  persistent: opts.persistent
31600
31600
  };
@@ -31604,12 +31604,12 @@ var NodeFsHandler = class {
31604
31604
  if (opts.usePolling) {
31605
31605
  const enableBin = opts.interval !== opts.binaryInterval;
31606
31606
  options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
31607
- closer = setFsWatchFileListener(path17, absolutePath, options, {
31607
+ closer = setFsWatchFileListener(path18, absolutePath, options, {
31608
31608
  listener,
31609
31609
  rawEmitter: this.fsw._emitRaw
31610
31610
  });
31611
31611
  } else {
31612
- closer = setFsWatchListener(path17, absolutePath, options, {
31612
+ closer = setFsWatchListener(path18, absolutePath, options, {
31613
31613
  listener,
31614
31614
  errHandler: this._boundHandleError,
31615
31615
  rawEmitter: this.fsw._emitRaw
@@ -31631,7 +31631,7 @@ var NodeFsHandler = class {
31631
31631
  let prevStats = stats;
31632
31632
  if (parent.has(basename4))
31633
31633
  return;
31634
- const listener = async (path17, newStats) => {
31634
+ const listener = async (path18, newStats) => {
31635
31635
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
31636
31636
  return;
31637
31637
  if (!newStats || newStats.mtimeMs === 0) {
@@ -31645,11 +31645,11 @@ var NodeFsHandler = class {
31645
31645
  this.fsw._emit(EV.CHANGE, file, newStats2);
31646
31646
  }
31647
31647
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
31648
- this.fsw._closeFile(path17);
31648
+ this.fsw._closeFile(path18);
31649
31649
  prevStats = newStats2;
31650
31650
  const closer2 = this._watchWithNodeFs(file, listener);
31651
31651
  if (closer2)
31652
- this.fsw._addPathCloser(path17, closer2);
31652
+ this.fsw._addPathCloser(path18, closer2);
31653
31653
  } else {
31654
31654
  prevStats = newStats2;
31655
31655
  }
@@ -31681,7 +31681,7 @@ var NodeFsHandler = class {
31681
31681
  * @param item basename of this item
31682
31682
  * @returns true if no more processing is needed for this entry.
31683
31683
  */
31684
- async _handleSymlink(entry, directory, path17, item) {
31684
+ async _handleSymlink(entry, directory, path18, item) {
31685
31685
  if (this.fsw.closed) {
31686
31686
  return;
31687
31687
  }
@@ -31691,7 +31691,7 @@ var NodeFsHandler = class {
31691
31691
  this.fsw._incrReadyCount();
31692
31692
  let linkPath;
31693
31693
  try {
31694
- linkPath = await (0, import_promises3.realpath)(path17);
31694
+ linkPath = await (0, import_promises3.realpath)(path18);
31695
31695
  } catch (e) {
31696
31696
  this.fsw._emitReady();
31697
31697
  return true;
@@ -31701,12 +31701,12 @@ var NodeFsHandler = class {
31701
31701
  if (dir.has(item)) {
31702
31702
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
31703
31703
  this.fsw._symlinkPaths.set(full, linkPath);
31704
- this.fsw._emit(EV.CHANGE, path17, entry.stats);
31704
+ this.fsw._emit(EV.CHANGE, path18, entry.stats);
31705
31705
  }
31706
31706
  } else {
31707
31707
  dir.add(item);
31708
31708
  this.fsw._symlinkPaths.set(full, linkPath);
31709
- this.fsw._emit(EV.ADD, path17, entry.stats);
31709
+ this.fsw._emit(EV.ADD, path18, entry.stats);
31710
31710
  }
31711
31711
  this.fsw._emitReady();
31712
31712
  return true;
@@ -31736,9 +31736,9 @@ var NodeFsHandler = class {
31736
31736
  return;
31737
31737
  }
31738
31738
  const item = entry.path;
31739
- let path17 = sp.join(directory, item);
31739
+ let path18 = sp.join(directory, item);
31740
31740
  current.add(item);
31741
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path17, item)) {
31741
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path18, item)) {
31742
31742
  return;
31743
31743
  }
31744
31744
  if (this.fsw.closed) {
@@ -31747,8 +31747,8 @@ var NodeFsHandler = class {
31747
31747
  }
31748
31748
  if (item === target || !target && !previous.has(item)) {
31749
31749
  this.fsw._incrReadyCount();
31750
- path17 = sp.join(dir, sp.relative(dir, path17));
31751
- this._addToNodeFs(path17, initialAdd, wh, depth + 1);
31750
+ path18 = sp.join(dir, sp.relative(dir, path18));
31751
+ this._addToNodeFs(path18, initialAdd, wh, depth + 1);
31752
31752
  }
31753
31753
  }).on(EV.ERROR, this._boundHandleError);
31754
31754
  return new Promise((resolve11, reject) => {
@@ -31817,13 +31817,13 @@ var NodeFsHandler = class {
31817
31817
  * @param depth Child path actually targeted for watch
31818
31818
  * @param target Child path actually targeted for watch
31819
31819
  */
31820
- async _addToNodeFs(path17, initialAdd, priorWh, depth, target) {
31820
+ async _addToNodeFs(path18, initialAdd, priorWh, depth, target) {
31821
31821
  const ready = this.fsw._emitReady;
31822
- if (this.fsw._isIgnored(path17) || this.fsw.closed) {
31822
+ if (this.fsw._isIgnored(path18) || this.fsw.closed) {
31823
31823
  ready();
31824
31824
  return false;
31825
31825
  }
31826
- const wh = this.fsw._getWatchHelpers(path17);
31826
+ const wh = this.fsw._getWatchHelpers(path18);
31827
31827
  if (priorWh) {
31828
31828
  wh.filterPath = (entry) => priorWh.filterPath(entry);
31829
31829
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -31839,8 +31839,8 @@ var NodeFsHandler = class {
31839
31839
  const follow = this.fsw.options.followSymlinks;
31840
31840
  let closer;
31841
31841
  if (stats.isDirectory()) {
31842
- const absPath = sp.resolve(path17);
31843
- const targetPath = follow ? await (0, import_promises3.realpath)(path17) : path17;
31842
+ const absPath = sp.resolve(path18);
31843
+ const targetPath = follow ? await (0, import_promises3.realpath)(path18) : path18;
31844
31844
  if (this.fsw.closed)
31845
31845
  return;
31846
31846
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -31850,29 +31850,29 @@ var NodeFsHandler = class {
31850
31850
  this.fsw._symlinkPaths.set(absPath, targetPath);
31851
31851
  }
31852
31852
  } else if (stats.isSymbolicLink()) {
31853
- const targetPath = follow ? await (0, import_promises3.realpath)(path17) : path17;
31853
+ const targetPath = follow ? await (0, import_promises3.realpath)(path18) : path18;
31854
31854
  if (this.fsw.closed)
31855
31855
  return;
31856
31856
  const parent = sp.dirname(wh.watchPath);
31857
31857
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
31858
31858
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
31859
- closer = await this._handleDir(parent, stats, initialAdd, depth, path17, wh, targetPath);
31859
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path18, wh, targetPath);
31860
31860
  if (this.fsw.closed)
31861
31861
  return;
31862
31862
  if (targetPath !== void 0) {
31863
- this.fsw._symlinkPaths.set(sp.resolve(path17), targetPath);
31863
+ this.fsw._symlinkPaths.set(sp.resolve(path18), targetPath);
31864
31864
  }
31865
31865
  } else {
31866
31866
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
31867
31867
  }
31868
31868
  ready();
31869
31869
  if (closer)
31870
- this.fsw._addPathCloser(path17, closer);
31870
+ this.fsw._addPathCloser(path18, closer);
31871
31871
  return false;
31872
31872
  } catch (error) {
31873
31873
  if (this.fsw._handleError(error)) {
31874
31874
  ready();
31875
- return path17;
31875
+ return path18;
31876
31876
  }
31877
31877
  }
31878
31878
  }
@@ -31915,24 +31915,24 @@ function createPattern(matcher) {
31915
31915
  }
31916
31916
  return () => false;
31917
31917
  }
31918
- function normalizePath(path17) {
31919
- if (typeof path17 !== "string")
31918
+ function normalizePath(path18) {
31919
+ if (typeof path18 !== "string")
31920
31920
  throw new Error("string expected");
31921
- path17 = sp2.normalize(path17);
31922
- path17 = path17.replace(/\\/g, "/");
31921
+ path18 = sp2.normalize(path18);
31922
+ path18 = path18.replace(/\\/g, "/");
31923
31923
  let prepend = false;
31924
- if (path17.startsWith("//"))
31924
+ if (path18.startsWith("//"))
31925
31925
  prepend = true;
31926
- path17 = path17.replace(DOUBLE_SLASH_RE, "/");
31926
+ path18 = path18.replace(DOUBLE_SLASH_RE, "/");
31927
31927
  if (prepend)
31928
- path17 = "/" + path17;
31929
- return path17;
31928
+ path18 = "/" + path18;
31929
+ return path18;
31930
31930
  }
31931
31931
  function matchPatterns(patterns, testString, stats) {
31932
- const path17 = normalizePath(testString);
31932
+ const path18 = normalizePath(testString);
31933
31933
  for (let index = 0; index < patterns.length; index++) {
31934
31934
  const pattern = patterns[index];
31935
- if (pattern(path17, stats)) {
31935
+ if (pattern(path18, stats)) {
31936
31936
  return true;
31937
31937
  }
31938
31938
  }
@@ -31970,19 +31970,19 @@ var toUnix = (string) => {
31970
31970
  }
31971
31971
  return str;
31972
31972
  };
31973
- var normalizePathToUnix = (path17) => toUnix(sp2.normalize(toUnix(path17)));
31974
- var normalizeIgnored = (cwd = "") => (path17) => {
31975
- if (typeof path17 === "string") {
31976
- return normalizePathToUnix(sp2.isAbsolute(path17) ? path17 : sp2.join(cwd, path17));
31973
+ var normalizePathToUnix = (path18) => toUnix(sp2.normalize(toUnix(path18)));
31974
+ var normalizeIgnored = (cwd = "") => (path18) => {
31975
+ if (typeof path18 === "string") {
31976
+ return normalizePathToUnix(sp2.isAbsolute(path18) ? path18 : sp2.join(cwd, path18));
31977
31977
  } else {
31978
- return path17;
31978
+ return path18;
31979
31979
  }
31980
31980
  };
31981
- var getAbsolutePath = (path17, cwd) => {
31982
- if (sp2.isAbsolute(path17)) {
31983
- return path17;
31981
+ var getAbsolutePath = (path18, cwd) => {
31982
+ if (sp2.isAbsolute(path18)) {
31983
+ return path18;
31984
31984
  }
31985
- return sp2.join(cwd, path17);
31985
+ return sp2.join(cwd, path18);
31986
31986
  };
31987
31987
  var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
31988
31988
  var DirEntry = class {
@@ -32047,10 +32047,10 @@ var WatchHelper = class {
32047
32047
  dirParts;
32048
32048
  followSymlinks;
32049
32049
  statMethod;
32050
- constructor(path17, follow, fsw) {
32050
+ constructor(path18, follow, fsw) {
32051
32051
  this.fsw = fsw;
32052
- const watchPath = path17;
32053
- this.path = path17 = path17.replace(REPLACER_RE, "");
32052
+ const watchPath = path18;
32053
+ this.path = path18 = path18.replace(REPLACER_RE, "");
32054
32054
  this.watchPath = watchPath;
32055
32055
  this.fullWatchPath = sp2.resolve(watchPath);
32056
32056
  this.dirParts = [];
@@ -32190,20 +32190,20 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32190
32190
  this._closePromise = void 0;
32191
32191
  let paths = unifyPaths(paths_);
32192
32192
  if (cwd) {
32193
- paths = paths.map((path17) => {
32194
- const absPath = getAbsolutePath(path17, cwd);
32193
+ paths = paths.map((path18) => {
32194
+ const absPath = getAbsolutePath(path18, cwd);
32195
32195
  return absPath;
32196
32196
  });
32197
32197
  }
32198
- paths.forEach((path17) => {
32199
- this._removeIgnoredPath(path17);
32198
+ paths.forEach((path18) => {
32199
+ this._removeIgnoredPath(path18);
32200
32200
  });
32201
32201
  this._userIgnored = void 0;
32202
32202
  if (!this._readyCount)
32203
32203
  this._readyCount = 0;
32204
32204
  this._readyCount += paths.length;
32205
- Promise.all(paths.map(async (path17) => {
32206
- const res = await this._nodeFsHandler._addToNodeFs(path17, !_internal, void 0, 0, _origAdd);
32205
+ Promise.all(paths.map(async (path18) => {
32206
+ const res = await this._nodeFsHandler._addToNodeFs(path18, !_internal, void 0, 0, _origAdd);
32207
32207
  if (res)
32208
32208
  this._emitReady();
32209
32209
  return res;
@@ -32225,17 +32225,17 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32225
32225
  return this;
32226
32226
  const paths = unifyPaths(paths_);
32227
32227
  const { cwd } = this.options;
32228
- paths.forEach((path17) => {
32229
- if (!sp2.isAbsolute(path17) && !this._closers.has(path17)) {
32228
+ paths.forEach((path18) => {
32229
+ if (!sp2.isAbsolute(path18) && !this._closers.has(path18)) {
32230
32230
  if (cwd)
32231
- path17 = sp2.join(cwd, path17);
32232
- path17 = sp2.resolve(path17);
32231
+ path18 = sp2.join(cwd, path18);
32232
+ path18 = sp2.resolve(path18);
32233
32233
  }
32234
- this._closePath(path17);
32235
- this._addIgnoredPath(path17);
32236
- if (this._watched.has(path17)) {
32234
+ this._closePath(path18);
32235
+ this._addIgnoredPath(path18);
32236
+ if (this._watched.has(path18)) {
32237
32237
  this._addIgnoredPath({
32238
- path: path17,
32238
+ path: path18,
32239
32239
  recursive: true
32240
32240
  });
32241
32241
  }
@@ -32299,38 +32299,38 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32299
32299
  * @param stats arguments to be passed with event
32300
32300
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
32301
32301
  */
32302
- async _emit(event, path17, stats) {
32302
+ async _emit(event, path18, stats) {
32303
32303
  if (this.closed)
32304
32304
  return;
32305
32305
  const opts = this.options;
32306
32306
  if (isWindows)
32307
- path17 = sp2.normalize(path17);
32307
+ path18 = sp2.normalize(path18);
32308
32308
  if (opts.cwd)
32309
- path17 = sp2.relative(opts.cwd, path17);
32310
- const args = [path17];
32309
+ path18 = sp2.relative(opts.cwd, path18);
32310
+ const args = [path18];
32311
32311
  if (stats != null)
32312
32312
  args.push(stats);
32313
32313
  const awf = opts.awaitWriteFinish;
32314
32314
  let pw;
32315
- if (awf && (pw = this._pendingWrites.get(path17))) {
32315
+ if (awf && (pw = this._pendingWrites.get(path18))) {
32316
32316
  pw.lastChange = /* @__PURE__ */ new Date();
32317
32317
  return this;
32318
32318
  }
32319
32319
  if (opts.atomic) {
32320
32320
  if (event === EVENTS.UNLINK) {
32321
- this._pendingUnlinks.set(path17, [event, ...args]);
32321
+ this._pendingUnlinks.set(path18, [event, ...args]);
32322
32322
  setTimeout(() => {
32323
- this._pendingUnlinks.forEach((entry, path18) => {
32323
+ this._pendingUnlinks.forEach((entry, path19) => {
32324
32324
  this.emit(...entry);
32325
32325
  this.emit(EVENTS.ALL, ...entry);
32326
- this._pendingUnlinks.delete(path18);
32326
+ this._pendingUnlinks.delete(path19);
32327
32327
  });
32328
32328
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
32329
32329
  return this;
32330
32330
  }
32331
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path17)) {
32331
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path18)) {
32332
32332
  event = EVENTS.CHANGE;
32333
- this._pendingUnlinks.delete(path17);
32333
+ this._pendingUnlinks.delete(path18);
32334
32334
  }
32335
32335
  }
32336
32336
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -32348,16 +32348,16 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32348
32348
  this.emitWithAll(event, args);
32349
32349
  }
32350
32350
  };
32351
- this._awaitWriteFinish(path17, awf.stabilityThreshold, event, awfEmit);
32351
+ this._awaitWriteFinish(path18, awf.stabilityThreshold, event, awfEmit);
32352
32352
  return this;
32353
32353
  }
32354
32354
  if (event === EVENTS.CHANGE) {
32355
- const isThrottled = !this._throttle(EVENTS.CHANGE, path17, 50);
32355
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path18, 50);
32356
32356
  if (isThrottled)
32357
32357
  return this;
32358
32358
  }
32359
32359
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
32360
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path17) : path17;
32360
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path18) : path18;
32361
32361
  let stats2;
32362
32362
  try {
32363
32363
  stats2 = await (0, import_promises4.stat)(fullPath);
@@ -32388,23 +32388,23 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32388
32388
  * @param timeout duration of time to suppress duplicate actions
32389
32389
  * @returns tracking object or false if action should be suppressed
32390
32390
  */
32391
- _throttle(actionType, path17, timeout) {
32391
+ _throttle(actionType, path18, timeout) {
32392
32392
  if (!this._throttled.has(actionType)) {
32393
32393
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
32394
32394
  }
32395
32395
  const action = this._throttled.get(actionType);
32396
32396
  if (!action)
32397
32397
  throw new Error("invalid throttle");
32398
- const actionPath = action.get(path17);
32398
+ const actionPath = action.get(path18);
32399
32399
  if (actionPath) {
32400
32400
  actionPath.count++;
32401
32401
  return false;
32402
32402
  }
32403
32403
  let timeoutObject;
32404
32404
  const clear = () => {
32405
- const item = action.get(path17);
32405
+ const item = action.get(path18);
32406
32406
  const count = item ? item.count : 0;
32407
- action.delete(path17);
32407
+ action.delete(path18);
32408
32408
  clearTimeout(timeoutObject);
32409
32409
  if (item)
32410
32410
  clearTimeout(item.timeoutObject);
@@ -32412,7 +32412,7 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32412
32412
  };
32413
32413
  timeoutObject = setTimeout(clear, timeout);
32414
32414
  const thr = { timeoutObject, clear, count: 0 };
32415
- action.set(path17, thr);
32415
+ action.set(path18, thr);
32416
32416
  return thr;
32417
32417
  }
32418
32418
  _incrReadyCount() {
@@ -32426,44 +32426,44 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32426
32426
  * @param event
32427
32427
  * @param awfEmit Callback to be called when ready for event to be emitted.
32428
32428
  */
32429
- _awaitWriteFinish(path17, threshold, event, awfEmit) {
32429
+ _awaitWriteFinish(path18, threshold, event, awfEmit) {
32430
32430
  const awf = this.options.awaitWriteFinish;
32431
32431
  if (typeof awf !== "object")
32432
32432
  return;
32433
32433
  const pollInterval = awf.pollInterval;
32434
32434
  let timeoutHandler;
32435
- let fullPath = path17;
32436
- if (this.options.cwd && !sp2.isAbsolute(path17)) {
32437
- fullPath = sp2.join(this.options.cwd, path17);
32435
+ let fullPath = path18;
32436
+ if (this.options.cwd && !sp2.isAbsolute(path18)) {
32437
+ fullPath = sp2.join(this.options.cwd, path18);
32438
32438
  }
32439
32439
  const now = /* @__PURE__ */ new Date();
32440
32440
  const writes = this._pendingWrites;
32441
32441
  function awaitWriteFinishFn(prevStat) {
32442
32442
  (0, import_node_fs2.stat)(fullPath, (err, curStat) => {
32443
- if (err || !writes.has(path17)) {
32443
+ if (err || !writes.has(path18)) {
32444
32444
  if (err && err.code !== "ENOENT")
32445
32445
  awfEmit(err);
32446
32446
  return;
32447
32447
  }
32448
32448
  const now2 = Number(/* @__PURE__ */ new Date());
32449
32449
  if (prevStat && curStat.size !== prevStat.size) {
32450
- writes.get(path17).lastChange = now2;
32450
+ writes.get(path18).lastChange = now2;
32451
32451
  }
32452
- const pw = writes.get(path17);
32452
+ const pw = writes.get(path18);
32453
32453
  const df = now2 - pw.lastChange;
32454
32454
  if (df >= threshold) {
32455
- writes.delete(path17);
32455
+ writes.delete(path18);
32456
32456
  awfEmit(void 0, curStat);
32457
32457
  } else {
32458
32458
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
32459
32459
  }
32460
32460
  });
32461
32461
  }
32462
- if (!writes.has(path17)) {
32463
- writes.set(path17, {
32462
+ if (!writes.has(path18)) {
32463
+ writes.set(path18, {
32464
32464
  lastChange: now,
32465
32465
  cancelWait: () => {
32466
- writes.delete(path17);
32466
+ writes.delete(path18);
32467
32467
  clearTimeout(timeoutHandler);
32468
32468
  return event;
32469
32469
  }
@@ -32474,8 +32474,8 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32474
32474
  /**
32475
32475
  * Determines whether user has asked to ignore this path.
32476
32476
  */
32477
- _isIgnored(path17, stats) {
32478
- if (this.options.atomic && DOT_RE.test(path17))
32477
+ _isIgnored(path18, stats) {
32478
+ if (this.options.atomic && DOT_RE.test(path18))
32479
32479
  return true;
32480
32480
  if (!this._userIgnored) {
32481
32481
  const { cwd } = this.options;
@@ -32485,17 +32485,17 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32485
32485
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
32486
32486
  this._userIgnored = anymatch(list, void 0);
32487
32487
  }
32488
- return this._userIgnored(path17, stats);
32488
+ return this._userIgnored(path18, stats);
32489
32489
  }
32490
- _isntIgnored(path17, stat9) {
32491
- return !this._isIgnored(path17, stat9);
32490
+ _isntIgnored(path18, stat10) {
32491
+ return !this._isIgnored(path18, stat10);
32492
32492
  }
32493
32493
  /**
32494
32494
  * Provides a set of common helpers and properties relating to symlink handling.
32495
32495
  * @param path file or directory pattern being watched
32496
32496
  */
32497
- _getWatchHelpers(path17) {
32498
- return new WatchHelper(path17, this.options.followSymlinks, this);
32497
+ _getWatchHelpers(path18) {
32498
+ return new WatchHelper(path18, this.options.followSymlinks, this);
32499
32499
  }
32500
32500
  // Directory helpers
32501
32501
  // -----------------
@@ -32527,63 +32527,63 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32527
32527
  * @param item base path of item/directory
32528
32528
  */
32529
32529
  _remove(directory, item, isDirectory) {
32530
- const path17 = sp2.join(directory, item);
32531
- const fullPath = sp2.resolve(path17);
32532
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path17) || this._watched.has(fullPath);
32533
- if (!this._throttle("remove", path17, 100))
32530
+ const path18 = sp2.join(directory, item);
32531
+ const fullPath = sp2.resolve(path18);
32532
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path18) || this._watched.has(fullPath);
32533
+ if (!this._throttle("remove", path18, 100))
32534
32534
  return;
32535
32535
  if (!isDirectory && this._watched.size === 1) {
32536
32536
  this.add(directory, item, true);
32537
32537
  }
32538
- const wp = this._getWatchedDir(path17);
32538
+ const wp = this._getWatchedDir(path18);
32539
32539
  const nestedDirectoryChildren = wp.getChildren();
32540
- nestedDirectoryChildren.forEach((nested) => this._remove(path17, nested));
32540
+ nestedDirectoryChildren.forEach((nested) => this._remove(path18, nested));
32541
32541
  const parent = this._getWatchedDir(directory);
32542
32542
  const wasTracked = parent.has(item);
32543
32543
  parent.remove(item);
32544
32544
  if (this._symlinkPaths.has(fullPath)) {
32545
32545
  this._symlinkPaths.delete(fullPath);
32546
32546
  }
32547
- let relPath = path17;
32547
+ let relPath = path18;
32548
32548
  if (this.options.cwd)
32549
- relPath = sp2.relative(this.options.cwd, path17);
32549
+ relPath = sp2.relative(this.options.cwd, path18);
32550
32550
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
32551
32551
  const event = this._pendingWrites.get(relPath).cancelWait();
32552
32552
  if (event === EVENTS.ADD)
32553
32553
  return;
32554
32554
  }
32555
- this._watched.delete(path17);
32555
+ this._watched.delete(path18);
32556
32556
  this._watched.delete(fullPath);
32557
32557
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
32558
- if (wasTracked && !this._isIgnored(path17))
32559
- this._emit(eventName, path17);
32560
- this._closePath(path17);
32558
+ if (wasTracked && !this._isIgnored(path18))
32559
+ this._emit(eventName, path18);
32560
+ this._closePath(path18);
32561
32561
  }
32562
32562
  /**
32563
32563
  * Closes all watchers for a path
32564
32564
  */
32565
- _closePath(path17) {
32566
- this._closeFile(path17);
32567
- const dir = sp2.dirname(path17);
32568
- this._getWatchedDir(dir).remove(sp2.basename(path17));
32565
+ _closePath(path18) {
32566
+ this._closeFile(path18);
32567
+ const dir = sp2.dirname(path18);
32568
+ this._getWatchedDir(dir).remove(sp2.basename(path18));
32569
32569
  }
32570
32570
  /**
32571
32571
  * Closes only file-specific watchers
32572
32572
  */
32573
- _closeFile(path17) {
32574
- const closers = this._closers.get(path17);
32573
+ _closeFile(path18) {
32574
+ const closers = this._closers.get(path18);
32575
32575
  if (!closers)
32576
32576
  return;
32577
32577
  closers.forEach((closer) => closer());
32578
- this._closers.delete(path17);
32578
+ this._closers.delete(path18);
32579
32579
  }
32580
- _addPathCloser(path17, closer) {
32580
+ _addPathCloser(path18, closer) {
32581
32581
  if (!closer)
32582
32582
  return;
32583
- let list = this._closers.get(path17);
32583
+ let list = this._closers.get(path18);
32584
32584
  if (!list) {
32585
32585
  list = [];
32586
- this._closers.set(path17, list);
32586
+ this._closers.set(path18, list);
32587
32587
  }
32588
32588
  list.push(closer);
32589
32589
  }
@@ -34047,12 +34047,12 @@ function encodeURIPath(str) {
34047
34047
  return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
34048
34048
  }
34049
34049
  var EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
34050
- var createPathTagFunction = (pathEncoder = encodeURIPath) => function path17(statics, ...params) {
34050
+ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path18(statics, ...params) {
34051
34051
  if (statics.length === 1)
34052
34052
  return statics[0];
34053
34053
  let postPath = false;
34054
34054
  const invalidSegments = [];
34055
- const path18 = statics.reduce((previousValue, currentValue, index) => {
34055
+ const path19 = statics.reduce((previousValue, currentValue, index) => {
34056
34056
  if (/[?#]/.test(currentValue)) {
34057
34057
  postPath = true;
34058
34058
  }
@@ -34069,7 +34069,7 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path17(sta
34069
34069
  }
34070
34070
  return previousValue + currentValue + (index === params.length ? "" : encoded);
34071
34071
  }, "");
34072
- const pathOnly = path18.split(/[?#]/, 1)[0];
34072
+ const pathOnly = path19.split(/[?#]/, 1)[0];
34073
34073
  const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
34074
34074
  let match2;
34075
34075
  while ((match2 = invalidSegmentPattern.exec(pathOnly)) !== null) {
@@ -34090,10 +34090,10 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path17(sta
34090
34090
  }, "");
34091
34091
  throw new AnthropicError(`Path parameters result in path with invalid segments:
34092
34092
  ${invalidSegments.map((e) => e.error).join("\n")}
34093
- ${path18}
34093
+ ${path19}
34094
34094
  ${underline}`);
34095
34095
  }
34096
- return path18;
34096
+ return path19;
34097
34097
  };
34098
34098
  var path4 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
34099
34099
 
@@ -37204,9 +37204,9 @@ var BaseAnthropic = class {
37204
37204
  makeStatusError(status, error, message, headers) {
37205
37205
  return APIError.generate(status, error, message, headers);
37206
37206
  }
37207
- buildURL(path17, query, defaultBaseURL) {
37207
+ buildURL(path18, query, defaultBaseURL) {
37208
37208
  const baseURL = !__classPrivateFieldGet(this, _BaseAnthropic_instances, "m", _BaseAnthropic_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
37209
- const url = isAbsoluteURL(path17) ? new URL(path17) : new URL(baseURL + (baseURL.endsWith("/") && path17.startsWith("/") ? path17.slice(1) : path17));
37209
+ const url = isAbsoluteURL(path18) ? new URL(path18) : new URL(baseURL + (baseURL.endsWith("/") && path18.startsWith("/") ? path18.slice(1) : path18));
37210
37210
  const defaultQuery = this.defaultQuery();
37211
37211
  if (!isEmptyObj(defaultQuery)) {
37212
37212
  query = { ...defaultQuery, ...query };
@@ -37237,24 +37237,24 @@ var BaseAnthropic = class {
37237
37237
  */
37238
37238
  async prepareRequest(request, { url, options }) {
37239
37239
  }
37240
- get(path17, opts) {
37241
- return this.methodRequest("get", path17, opts);
37240
+ get(path18, opts) {
37241
+ return this.methodRequest("get", path18, opts);
37242
37242
  }
37243
- post(path17, opts) {
37244
- return this.methodRequest("post", path17, opts);
37243
+ post(path18, opts) {
37244
+ return this.methodRequest("post", path18, opts);
37245
37245
  }
37246
- patch(path17, opts) {
37247
- return this.methodRequest("patch", path17, opts);
37246
+ patch(path18, opts) {
37247
+ return this.methodRequest("patch", path18, opts);
37248
37248
  }
37249
- put(path17, opts) {
37250
- return this.methodRequest("put", path17, opts);
37249
+ put(path18, opts) {
37250
+ return this.methodRequest("put", path18, opts);
37251
37251
  }
37252
- delete(path17, opts) {
37253
- return this.methodRequest("delete", path17, opts);
37252
+ delete(path18, opts) {
37253
+ return this.methodRequest("delete", path18, opts);
37254
37254
  }
37255
- methodRequest(method, path17, opts) {
37255
+ methodRequest(method, path18, opts) {
37256
37256
  return this.request(Promise.resolve(opts).then((opts2) => {
37257
- return { method, path: path17, ...opts2 };
37257
+ return { method, path: path18, ...opts2 };
37258
37258
  }));
37259
37259
  }
37260
37260
  request(options, remainingRetries = null) {
@@ -37358,8 +37358,8 @@ var BaseAnthropic = class {
37358
37358
  }));
37359
37359
  return { response, options, controller, requestLogID, retryOfRequestLogID, startTime: startTime2 };
37360
37360
  }
37361
- getAPIList(path17, Page2, opts) {
37362
- return this.requestAPIList(Page2, opts && "then" in opts ? opts.then((opts2) => ({ method: "get", path: path17, ...opts2 })) : { method: "get", path: path17, ...opts });
37361
+ getAPIList(path18, Page2, opts) {
37362
+ return this.requestAPIList(Page2, opts && "then" in opts ? opts.then((opts2) => ({ method: "get", path: path18, ...opts2 })) : { method: "get", path: path18, ...opts });
37363
37363
  }
37364
37364
  requestAPIList(Page2, options) {
37365
37365
  const request = this.makeRequest(options, null, void 0);
@@ -37447,8 +37447,8 @@ var BaseAnthropic = class {
37447
37447
  }
37448
37448
  async buildRequest(inputOptions, { retryCount = 0 } = {}) {
37449
37449
  const options = { ...inputOptions };
37450
- const { method, path: path17, query, defaultBaseURL } = options;
37451
- const url = this.buildURL(path17, query, defaultBaseURL);
37450
+ const { method, path: path18, query, defaultBaseURL } = options;
37451
+ const url = this.buildURL(path18, query, defaultBaseURL);
37452
37452
  if ("timeout" in options)
37453
37453
  validatePositiveInteger("timeout", options.timeout);
37454
37454
  options.timeout = options.timeout ?? this.timeout;
@@ -39482,16 +39482,16 @@ var Diff = class {
39482
39482
  }
39483
39483
  }
39484
39484
  }
39485
- addToPath(path17, added, removed, oldPosInc, options) {
39486
- const last = path17.lastComponent;
39485
+ addToPath(path18, added, removed, oldPosInc, options) {
39486
+ const last = path18.lastComponent;
39487
39487
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
39488
39488
  return {
39489
- oldPos: path17.oldPos + oldPosInc,
39489
+ oldPos: path18.oldPos + oldPosInc,
39490
39490
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
39491
39491
  };
39492
39492
  } else {
39493
39493
  return {
39494
- oldPos: path17.oldPos + oldPosInc,
39494
+ oldPos: path18.oldPos + oldPosInc,
39495
39495
  lastComponent: { count: 1, added, removed, previousComponent: last }
39496
39496
  };
39497
39497
  }
@@ -42872,8 +42872,8 @@ function findExecutableShell2() {
42872
42872
  }
42873
42873
  function validateCwd(cwd) {
42874
42874
  try {
42875
- const stat9 = (0, import_node_fs4.statSync)(cwd);
42876
- if (!stat9.isDirectory()) {
42875
+ const stat10 = (0, import_node_fs4.statSync)(cwd);
42876
+ if (!stat10.isDirectory()) {
42877
42877
  return `[bash] \u9519\u8BEF: cwd \u4E0D\u662F\u76EE\u5F55: ${cwd}`;
42878
42878
  }
42879
42879
  (0, import_node_fs4.accessSync)(cwd, import_node_fs4.constants.R_OK | import_node_fs4.constants.X_OK);
@@ -46111,26 +46111,26 @@ var handleParsingNestedValues = (form, key, value) => {
46111
46111
  };
46112
46112
 
46113
46113
  // node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/url.js
46114
- var splitPath = (path17) => {
46115
- const paths = path17.split("/");
46114
+ var splitPath = (path18) => {
46115
+ const paths = path18.split("/");
46116
46116
  if (paths[0] === "") {
46117
46117
  paths.shift();
46118
46118
  }
46119
46119
  return paths;
46120
46120
  };
46121
46121
  var splitRoutingPath = (routePath) => {
46122
- const { groups, path: path17 } = extractGroupsFromPath(routePath);
46123
- const paths = splitPath(path17);
46122
+ const { groups, path: path18 } = extractGroupsFromPath(routePath);
46123
+ const paths = splitPath(path18);
46124
46124
  return replaceGroupMarks(paths, groups);
46125
46125
  };
46126
- var extractGroupsFromPath = (path17) => {
46126
+ var extractGroupsFromPath = (path18) => {
46127
46127
  const groups = [];
46128
- path17 = path17.replace(/\{[^}]+\}/g, (match2, index) => {
46128
+ path18 = path18.replace(/\{[^}]+\}/g, (match2, index) => {
46129
46129
  const mark = `@${index}`;
46130
46130
  groups.push([mark, match2]);
46131
46131
  return mark;
46132
46132
  });
46133
- return { groups, path: path17 };
46133
+ return { groups, path: path18 };
46134
46134
  };
46135
46135
  var replaceGroupMarks = (paths, groups) => {
46136
46136
  for (let i = groups.length - 1; i >= 0; i--) {
@@ -46187,8 +46187,8 @@ var getPath = (request) => {
46187
46187
  const queryIndex = url.indexOf("?", i);
46188
46188
  const hashIndex = url.indexOf("#", i);
46189
46189
  const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);
46190
- const path17 = url.slice(start, end);
46191
- return tryDecodeURI(path17.includes("%25") ? path17.replace(/%25/g, "%2525") : path17);
46190
+ const path18 = url.slice(start, end);
46191
+ return tryDecodeURI(path18.includes("%25") ? path18.replace(/%25/g, "%2525") : path18);
46192
46192
  } else if (charCode === 63 || charCode === 35) {
46193
46193
  break;
46194
46194
  }
@@ -46205,11 +46205,11 @@ var mergePath = (base, sub, ...rest) => {
46205
46205
  }
46206
46206
  return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
46207
46207
  };
46208
- var checkOptionalParameter = (path17) => {
46209
- if (path17.charCodeAt(path17.length - 1) !== 63 || !path17.includes(":")) {
46208
+ var checkOptionalParameter = (path18) => {
46209
+ if (path18.charCodeAt(path18.length - 1) !== 63 || !path18.includes(":")) {
46210
46210
  return null;
46211
46211
  }
46212
- const segments = path17.split("/");
46212
+ const segments = path18.split("/");
46213
46213
  const results = [];
46214
46214
  let basePath = "";
46215
46215
  segments.forEach((segment) => {
@@ -46350,9 +46350,9 @@ var HonoRequest = class {
46350
46350
  */
46351
46351
  path;
46352
46352
  bodyCache = {};
46353
- constructor(request, path17 = "/", matchResult = [[]]) {
46353
+ constructor(request, path18 = "/", matchResult = [[]]) {
46354
46354
  this.raw = request;
46355
- this.path = path17;
46355
+ this.path = path18;
46356
46356
  this.#matchResult = matchResult;
46357
46357
  this.#validatedData = {};
46358
46358
  }
@@ -47089,8 +47089,8 @@ var Hono = class _Hono {
47089
47089
  return this;
47090
47090
  };
47091
47091
  });
47092
- this.on = (method, path17, ...handlers) => {
47093
- for (const p of [path17].flat()) {
47092
+ this.on = (method, path18, ...handlers) => {
47093
+ for (const p of [path18].flat()) {
47094
47094
  this.#path = p;
47095
47095
  for (const m of [method].flat()) {
47096
47096
  handlers.map((handler) => {
@@ -47147,8 +47147,8 @@ var Hono = class _Hono {
47147
47147
  * app.route("/api", app2) // GET /api/user
47148
47148
  * ```
47149
47149
  */
47150
- route(path17, app) {
47151
- const subApp = this.basePath(path17);
47150
+ route(path18, app) {
47151
+ const subApp = this.basePath(path18);
47152
47152
  app.routes.map((r) => {
47153
47153
  let handler;
47154
47154
  if (app.errorHandler === errorHandler) {
@@ -47174,9 +47174,9 @@ var Hono = class _Hono {
47174
47174
  * const api = new Hono().basePath('/api')
47175
47175
  * ```
47176
47176
  */
47177
- basePath(path17) {
47177
+ basePath(path18) {
47178
47178
  const subApp = this.#clone();
47179
- subApp._basePath = mergePath(this._basePath, path17);
47179
+ subApp._basePath = mergePath(this._basePath, path18);
47180
47180
  return subApp;
47181
47181
  }
47182
47182
  /**
@@ -47250,7 +47250,7 @@ var Hono = class _Hono {
47250
47250
  * })
47251
47251
  * ```
47252
47252
  */
47253
- mount(path17, applicationHandler, options) {
47253
+ mount(path18, applicationHandler, options) {
47254
47254
  let replaceRequest;
47255
47255
  let optionHandler;
47256
47256
  if (options) {
@@ -47277,7 +47277,7 @@ var Hono = class _Hono {
47277
47277
  return [c.env, executionContext];
47278
47278
  };
47279
47279
  replaceRequest ||= (() => {
47280
- const mergedPath = mergePath(this._basePath, path17);
47280
+ const mergedPath = mergePath(this._basePath, path18);
47281
47281
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
47282
47282
  return (request) => {
47283
47283
  const url = new URL(request.url);
@@ -47292,14 +47292,14 @@ var Hono = class _Hono {
47292
47292
  }
47293
47293
  await next();
47294
47294
  };
47295
- this.#addRoute(METHOD_NAME_ALL, mergePath(path17, "*"), handler);
47295
+ this.#addRoute(METHOD_NAME_ALL, mergePath(path18, "*"), handler);
47296
47296
  return this;
47297
47297
  }
47298
- #addRoute(method, path17, handler) {
47298
+ #addRoute(method, path18, handler) {
47299
47299
  method = method.toUpperCase();
47300
- path17 = mergePath(this._basePath, path17);
47301
- const r = { basePath: this._basePath, path: path17, method, handler };
47302
- this.router.add(method, path17, [handler, r]);
47300
+ path18 = mergePath(this._basePath, path18);
47301
+ const r = { basePath: this._basePath, path: path18, method, handler };
47302
+ this.router.add(method, path18, [handler, r]);
47303
47303
  this.routes.push(r);
47304
47304
  }
47305
47305
  #handleError(err, c) {
@@ -47312,10 +47312,10 @@ var Hono = class _Hono {
47312
47312
  if (method === "HEAD") {
47313
47313
  return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
47314
47314
  }
47315
- const path17 = this.getPath(request, { env });
47316
- const matchResult = this.router.match(method, path17);
47315
+ const path18 = this.getPath(request, { env });
47316
+ const matchResult = this.router.match(method, path18);
47317
47317
  const c = new Context(request, {
47318
- path: path17,
47318
+ path: path18,
47319
47319
  matchResult,
47320
47320
  env,
47321
47321
  executionCtx,
@@ -47415,7 +47415,7 @@ var Hono = class _Hono {
47415
47415
 
47416
47416
  // node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/matcher.js
47417
47417
  var emptyParam = [];
47418
- function match(method, path17) {
47418
+ function match(method, path18) {
47419
47419
  const matchers = this.buildAllMatchers();
47420
47420
  const match2 = ((method2, path22) => {
47421
47421
  const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
@@ -47431,7 +47431,7 @@ function match(method, path17) {
47431
47431
  return [matcher[1][index], match3];
47432
47432
  });
47433
47433
  this.match = match2;
47434
- return match2(method, path17);
47434
+ return match2(method, path18);
47435
47435
  }
47436
47436
 
47437
47437
  // node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/node.js
@@ -47546,12 +47546,12 @@ var Node = class _Node {
47546
47546
  var Trie = class {
47547
47547
  #context = { varIndex: 0 };
47548
47548
  #root = new Node();
47549
- insert(path17, index, pathErrorCheckOnly) {
47549
+ insert(path18, index, pathErrorCheckOnly) {
47550
47550
  const paramAssoc = [];
47551
47551
  const groups = [];
47552
47552
  for (let i = 0; ; ) {
47553
47553
  let replaced = false;
47554
- path17 = path17.replace(/\{[^}]+\}/g, (m) => {
47554
+ path18 = path18.replace(/\{[^}]+\}/g, (m) => {
47555
47555
  const mark = `@\\${i}`;
47556
47556
  groups[i] = [mark, m];
47557
47557
  i++;
@@ -47562,7 +47562,7 @@ var Trie = class {
47562
47562
  break;
47563
47563
  }
47564
47564
  }
47565
- const tokens = path17.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
47565
+ const tokens = path18.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
47566
47566
  for (let i = groups.length - 1; i >= 0; i--) {
47567
47567
  const [mark] = groups[i];
47568
47568
  for (let j = tokens.length - 1; j >= 0; j--) {
@@ -47601,9 +47601,9 @@ var Trie = class {
47601
47601
  // node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/router.js
47602
47602
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
47603
47603
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
47604
- function buildWildcardRegExp(path17) {
47605
- return wildcardRegExpCache[path17] ??= new RegExp(
47606
- path17 === "*" ? "" : `^${path17.replace(
47604
+ function buildWildcardRegExp(path18) {
47605
+ return wildcardRegExpCache[path18] ??= new RegExp(
47606
+ path18 === "*" ? "" : `^${path18.replace(
47607
47607
  /\/\*$|([.\\+*[^\]$()])/g,
47608
47608
  (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
47609
47609
  )}$`
@@ -47625,17 +47625,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
47625
47625
  );
47626
47626
  const staticMap = /* @__PURE__ */ Object.create(null);
47627
47627
  for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
47628
- const [pathErrorCheckOnly, path17, handlers] = routesWithStaticPathFlag[i];
47628
+ const [pathErrorCheckOnly, path18, handlers] = routesWithStaticPathFlag[i];
47629
47629
  if (pathErrorCheckOnly) {
47630
- staticMap[path17] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
47630
+ staticMap[path18] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
47631
47631
  } else {
47632
47632
  j++;
47633
47633
  }
47634
47634
  let paramAssoc;
47635
47635
  try {
47636
- paramAssoc = trie.insert(path17, j, pathErrorCheckOnly);
47636
+ paramAssoc = trie.insert(path18, j, pathErrorCheckOnly);
47637
47637
  } catch (e) {
47638
- throw e === PATH_ERROR ? new UnsupportedPathError(path17) : e;
47638
+ throw e === PATH_ERROR ? new UnsupportedPathError(path18) : e;
47639
47639
  }
47640
47640
  if (pathErrorCheckOnly) {
47641
47641
  continue;
@@ -47669,12 +47669,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
47669
47669
  }
47670
47670
  return [regexp, handlerMap, staticMap];
47671
47671
  }
47672
- function findMiddleware(middleware, path17) {
47672
+ function findMiddleware(middleware, path18) {
47673
47673
  if (!middleware) {
47674
47674
  return void 0;
47675
47675
  }
47676
47676
  for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
47677
- if (buildWildcardRegExp(k).test(path17)) {
47677
+ if (buildWildcardRegExp(k).test(path18)) {
47678
47678
  return [...middleware[k]];
47679
47679
  }
47680
47680
  }
@@ -47688,7 +47688,7 @@ var RegExpRouter = class {
47688
47688
  this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
47689
47689
  this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
47690
47690
  }
47691
- add(method, path17, handler) {
47691
+ add(method, path18, handler) {
47692
47692
  const middleware = this.#middleware;
47693
47693
  const routes = this.#routes;
47694
47694
  if (!middleware || !routes) {
@@ -47703,18 +47703,18 @@ var RegExpRouter = class {
47703
47703
  });
47704
47704
  });
47705
47705
  }
47706
- if (path17 === "/*") {
47707
- path17 = "*";
47706
+ if (path18 === "/*") {
47707
+ path18 = "*";
47708
47708
  }
47709
- const paramCount = (path17.match(/\/:/g) || []).length;
47710
- if (/\*$/.test(path17)) {
47711
- const re = buildWildcardRegExp(path17);
47709
+ const paramCount = (path18.match(/\/:/g) || []).length;
47710
+ if (/\*$/.test(path18)) {
47711
+ const re = buildWildcardRegExp(path18);
47712
47712
  if (method === METHOD_NAME_ALL) {
47713
47713
  Object.keys(middleware).forEach((m) => {
47714
- middleware[m][path17] ||= findMiddleware(middleware[m], path17) || findMiddleware(middleware[METHOD_NAME_ALL], path17) || [];
47714
+ middleware[m][path18] ||= findMiddleware(middleware[m], path18) || findMiddleware(middleware[METHOD_NAME_ALL], path18) || [];
47715
47715
  });
47716
47716
  } else {
47717
- middleware[method][path17] ||= findMiddleware(middleware[method], path17) || findMiddleware(middleware[METHOD_NAME_ALL], path17) || [];
47717
+ middleware[method][path18] ||= findMiddleware(middleware[method], path18) || findMiddleware(middleware[METHOD_NAME_ALL], path18) || [];
47718
47718
  }
47719
47719
  Object.keys(middleware).forEach((m) => {
47720
47720
  if (method === METHOD_NAME_ALL || method === m) {
@@ -47732,7 +47732,7 @@ var RegExpRouter = class {
47732
47732
  });
47733
47733
  return;
47734
47734
  }
47735
- const paths = checkOptionalParameter(path17) || [path17];
47735
+ const paths = checkOptionalParameter(path18) || [path18];
47736
47736
  for (let i = 0, len = paths.length; i < len; i++) {
47737
47737
  const path22 = paths[i];
47738
47738
  Object.keys(routes).forEach((m) => {
@@ -47759,13 +47759,13 @@ var RegExpRouter = class {
47759
47759
  const routes = [];
47760
47760
  let hasOwnRoute = method === METHOD_NAME_ALL;
47761
47761
  [this.#middleware, this.#routes].forEach((r) => {
47762
- const ownRoute = r[method] ? Object.keys(r[method]).map((path17) => [path17, r[method][path17]]) : [];
47762
+ const ownRoute = r[method] ? Object.keys(r[method]).map((path18) => [path18, r[method][path18]]) : [];
47763
47763
  if (ownRoute.length !== 0) {
47764
47764
  hasOwnRoute ||= true;
47765
47765
  routes.push(...ownRoute);
47766
47766
  } else if (method !== METHOD_NAME_ALL) {
47767
47767
  routes.push(
47768
- ...Object.keys(r[METHOD_NAME_ALL]).map((path17) => [path17, r[METHOD_NAME_ALL][path17]])
47768
+ ...Object.keys(r[METHOD_NAME_ALL]).map((path18) => [path18, r[METHOD_NAME_ALL][path18]])
47769
47769
  );
47770
47770
  }
47771
47771
  });
@@ -47785,13 +47785,13 @@ var SmartRouter = class {
47785
47785
  constructor(init) {
47786
47786
  this.#routers = init.routers;
47787
47787
  }
47788
- add(method, path17, handler) {
47788
+ add(method, path18, handler) {
47789
47789
  if (!this.#routes) {
47790
47790
  throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
47791
47791
  }
47792
- this.#routes.push([method, path17, handler]);
47792
+ this.#routes.push([method, path18, handler]);
47793
47793
  }
47794
- match(method, path17) {
47794
+ match(method, path18) {
47795
47795
  if (!this.#routes) {
47796
47796
  throw new Error("Fatal error");
47797
47797
  }
@@ -47806,7 +47806,7 @@ var SmartRouter = class {
47806
47806
  for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {
47807
47807
  router.add(...routes[i2]);
47808
47808
  }
47809
- res = router.match(method, path17);
47809
+ res = router.match(method, path18);
47810
47810
  } catch (e) {
47811
47811
  if (e instanceof UnsupportedPathError) {
47812
47812
  continue;
@@ -47856,10 +47856,10 @@ var Node2 = class _Node2 {
47856
47856
  }
47857
47857
  this.#patterns = [];
47858
47858
  }
47859
- insert(method, path17, handler) {
47859
+ insert(method, path18, handler) {
47860
47860
  this.#order = ++this.#order;
47861
47861
  let curNode = this;
47862
- const parts = splitRoutingPath(path17);
47862
+ const parts = splitRoutingPath(path18);
47863
47863
  const possibleKeys = [];
47864
47864
  for (let i = 0, len = parts.length; i < len; i++) {
47865
47865
  const p = parts[i];
@@ -47908,12 +47908,12 @@ var Node2 = class _Node2 {
47908
47908
  }
47909
47909
  }
47910
47910
  }
47911
- search(method, path17) {
47911
+ search(method, path18) {
47912
47912
  const handlerSets = [];
47913
47913
  this.#params = emptyParams;
47914
47914
  const curNode = this;
47915
47915
  let curNodes = [curNode];
47916
- const parts = splitPath(path17);
47916
+ const parts = splitPath(path18);
47917
47917
  const curNodesQueue = [];
47918
47918
  const len = parts.length;
47919
47919
  let partOffsets = null;
@@ -47955,13 +47955,13 @@ var Node2 = class _Node2 {
47955
47955
  if (matcher instanceof RegExp) {
47956
47956
  if (partOffsets === null) {
47957
47957
  partOffsets = new Array(len);
47958
- let offset = path17[0] === "/" ? 1 : 0;
47958
+ let offset = path18[0] === "/" ? 1 : 0;
47959
47959
  for (let p = 0; p < len; p++) {
47960
47960
  partOffsets[p] = offset;
47961
47961
  offset += parts[p].length + 1;
47962
47962
  }
47963
47963
  }
47964
- const restPathString = path17.substring(partOffsets[i]);
47964
+ const restPathString = path18.substring(partOffsets[i]);
47965
47965
  const m = matcher.exec(restPathString);
47966
47966
  if (m) {
47967
47967
  params[name] = m[0];
@@ -48014,18 +48014,18 @@ var TrieRouter = class {
48014
48014
  constructor() {
48015
48015
  this.#node = new Node2();
48016
48016
  }
48017
- add(method, path17, handler) {
48018
- const results = checkOptionalParameter(path17);
48017
+ add(method, path18, handler) {
48018
+ const results = checkOptionalParameter(path18);
48019
48019
  if (results) {
48020
48020
  for (let i = 0, len = results.length; i < len; i++) {
48021
48021
  this.#node.insert(method, results[i], handler);
48022
48022
  }
48023
48023
  return;
48024
48024
  }
48025
- this.#node.insert(method, path17, handler);
48025
+ this.#node.insert(method, path18, handler);
48026
48026
  }
48027
- match(method, path17) {
48028
- return this.#node.search(method, path17);
48027
+ match(method, path18) {
48028
+ return this.#node.search(method, path18);
48029
48029
  }
48030
48030
  };
48031
48031
 
@@ -48727,10 +48727,10 @@ var createStreamBody = (stream) => {
48727
48727
  });
48728
48728
  return body;
48729
48729
  };
48730
- var getStats = (path17) => {
48730
+ var getStats = (path18) => {
48731
48731
  let stats;
48732
48732
  try {
48733
- stats = (0, import_fs15.statSync)(path17);
48733
+ stats = (0, import_fs15.statSync)(path18);
48734
48734
  } catch {
48735
48735
  }
48736
48736
  return stats;
@@ -48773,21 +48773,21 @@ var serveStatic = (options = { root: "" }) => {
48773
48773
  return next();
48774
48774
  }
48775
48775
  }
48776
- let path17 = (0, import_path20.join)(
48776
+ let path18 = (0, import_path20.join)(
48777
48777
  root,
48778
48778
  !optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename
48779
48779
  );
48780
- let stats = getStats(path17);
48780
+ let stats = getStats(path18);
48781
48781
  if (stats && stats.isDirectory()) {
48782
48782
  const indexFile = options.index ?? "index.html";
48783
- path17 = (0, import_path20.join)(path17, indexFile);
48784
- stats = getStats(path17);
48783
+ path18 = (0, import_path20.join)(path18, indexFile);
48784
+ stats = getStats(path18);
48785
48785
  }
48786
48786
  if (!stats) {
48787
- await options.onNotFound?.(path17, c);
48787
+ await options.onNotFound?.(path18, c);
48788
48788
  return next();
48789
48789
  }
48790
- const mimeType = getMimeType(path17);
48790
+ const mimeType = getMimeType(path18);
48791
48791
  c.header("Content-Type", mimeType || "application/octet-stream");
48792
48792
  if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
48793
48793
  const acceptEncodingSet = new Set(
@@ -48797,12 +48797,12 @@ var serveStatic = (options = { root: "" }) => {
48797
48797
  if (!acceptEncodingSet.has(encoding)) {
48798
48798
  continue;
48799
48799
  }
48800
- const precompressedStats = getStats(path17 + ENCODINGS[encoding]);
48800
+ const precompressedStats = getStats(path18 + ENCODINGS[encoding]);
48801
48801
  if (precompressedStats) {
48802
48802
  c.header("Content-Encoding", encoding);
48803
48803
  c.header("Vary", "Accept-Encoding", { append: true });
48804
48804
  stats = precompressedStats;
48805
- path17 = path17 + ENCODINGS[encoding];
48805
+ path18 = path18 + ENCODINGS[encoding];
48806
48806
  break;
48807
48807
  }
48808
48808
  }
@@ -48816,7 +48816,7 @@ var serveStatic = (options = { root: "" }) => {
48816
48816
  result = c.body(null);
48817
48817
  } else if (!range) {
48818
48818
  c.header("Content-Length", size.toString());
48819
- result = c.body(createStreamBody((0, import_fs15.createReadStream)(path17)), 200);
48819
+ result = c.body(createStreamBody((0, import_fs15.createReadStream)(path18)), 200);
48820
48820
  } else {
48821
48821
  c.header("Accept-Ranges", "bytes");
48822
48822
  c.header("Date", stats.birthtime.toUTCString());
@@ -48827,12 +48827,12 @@ var serveStatic = (options = { root: "" }) => {
48827
48827
  end = size - 1;
48828
48828
  }
48829
48829
  const chunksize = end - start + 1;
48830
- const stream = (0, import_fs15.createReadStream)(path17, { start, end });
48830
+ const stream = (0, import_fs15.createReadStream)(path18, { start, end });
48831
48831
  c.header("Content-Length", chunksize.toString());
48832
48832
  c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
48833
48833
  result = c.body(createStreamBody(stream), 206);
48834
48834
  }
48835
- await options.onFound?.(path17, c);
48835
+ await options.onFound?.(path18, c);
48836
48836
  return result;
48837
48837
  };
48838
48838
  };
@@ -50753,7 +50753,7 @@ var systemRoutes = new Hono2();
50753
50753
  var startTime = Date.now();
50754
50754
  systemRoutes.get("/system/info", (c) => {
50755
50755
  return c.json({
50756
- version: true ? "1.8.9" : "unknown",
50756
+ version: true ? "1.8.10" : "unknown",
50757
50757
  uptime: Math.floor((Date.now() - startTime) / 1e3),
50758
50758
  env: process.env.NODE_ENV || "development",
50759
50759
  nodeVersion: process.version
@@ -50803,6 +50803,110 @@ function shouldStartCoreChannelGateways(env = process.env) {
50803
50803
  return normalizeChannelGatewayOwner(env.CHANNEL_GATEWAY_OWNER) === "core";
50804
50804
  }
50805
50805
 
50806
+ // src/runtime/saasAssets.ts
50807
+ var import_node_fs8 = require("node:fs");
50808
+ var import_promises12 = require("node:fs/promises");
50809
+ var import_node_os3 = require("node:os");
50810
+ var import_node_path15 = __toESM(require("node:path"));
50811
+ var MAX_CONTEXT_ASSETS = Number(process.env.DUCLAW_SAAS_ASSET_CONTEXT_LIMIT ?? 1e3);
50812
+ var MAX_SKILL_ASSETS = Number(process.env.DUCLAW_SAAS_ASSET_SKILL_LIMIT ?? 200);
50813
+ async function restoreSaasRuntimeAssets(reason) {
50814
+ const client2 = runtimeAssetClient();
50815
+ if (!client2) return;
50816
+ try {
50817
+ const [contextResult, skillResult] = await Promise.all([
50818
+ client2.get(`/internal/runtime/assets/context?tenantId=${encodeURIComponent(client2.tenantId)}&limit=${MAX_CONTEXT_ASSETS}`),
50819
+ client2.get(`/internal/runtime/assets/skills?tenantId=${encodeURIComponent(client2.tenantId)}&limit=${MAX_SKILL_ASSETS}`)
50820
+ ]);
50821
+ const overwrite = process.env.DUCLAW_SAAS_ASSET_OVERWRITE === "true";
50822
+ let restoredContexts = 0;
50823
+ let restoredSkills = 0;
50824
+ for (const context of contextResult.contexts ?? []) {
50825
+ if (await restoreContextAsset(context, overwrite)) restoredContexts += 1;
50826
+ }
50827
+ for (const skill of skillResult.skills ?? []) {
50828
+ if (await restoreSkillAsset(skill, overwrite)) restoredSkills += 1;
50829
+ }
50830
+ if (restoredContexts || restoredSkills) {
50831
+ console.log(`[saasAssets] \u5DF2\u4ECE SaaS mirror \u6062\u590D\u8D44\u4EA7 reason=${reason} contexts=${restoredContexts} skills=${restoredSkills}`);
50832
+ }
50833
+ } catch (err) {
50834
+ console.warn(`[saasAssets] \u4ECE SaaS mirror \u6062\u590D\u8D44\u4EA7\u5931\u8D25 reason=${reason}:`, err);
50835
+ }
50836
+ }
50837
+ async function restoreContextAsset(context, overwrite) {
50838
+ const target = contextPathForSourceKey(context.sourceKey);
50839
+ if (!target) return false;
50840
+ if (!overwrite && (0, import_node_fs8.existsSync)(target)) return false;
50841
+ await (0, import_promises12.mkdir)(import_node_path15.default.dirname(target), { recursive: true });
50842
+ await (0, import_promises12.writeFile)(target, JSON.stringify(context.payload), "utf8");
50843
+ return true;
50844
+ }
50845
+ async function restoreSkillAsset(skill, overwrite) {
50846
+ if (!skill.skillMd) return false;
50847
+ const target = safeSkillTargetPath(skill.sourcePath, skill.skillName);
50848
+ if (!target) return false;
50849
+ if (!overwrite && (0, import_node_fs8.existsSync)(target)) return false;
50850
+ await (0, import_promises12.mkdir)(import_node_path15.default.dirname(target), { recursive: true });
50851
+ await (0, import_promises12.writeFile)(target, skill.skillMd, "utf8");
50852
+ return true;
50853
+ }
50854
+ function runtimeAssetClient() {
50855
+ const baseUrl = process.env.DUCLAW_CONTROL_PLANE_BASE_URL?.replace(/\/$/, "");
50856
+ const token = process.env.DUCLAW_CONTROL_PLANE_METERING_TOKEN;
50857
+ const tenantId = process.env.DUCLAW_TENANT_ID;
50858
+ if (!baseUrl || !token || !tenantId) return null;
50859
+ const request = async (pathName, init = {}) => {
50860
+ const response = await fetch(`${baseUrl}${pathName}`, {
50861
+ ...init,
50862
+ headers: {
50863
+ authorization: `Bearer ${token}`,
50864
+ "content-type": "application/json",
50865
+ ...init.headers ?? {}
50866
+ }
50867
+ });
50868
+ if (!response.ok) {
50869
+ const text2 = await response.text().catch(() => "");
50870
+ throw new Error(`runtime asset request failed: ${response.status} ${text2}`);
50871
+ }
50872
+ return response.json();
50873
+ };
50874
+ return {
50875
+ tenantId,
50876
+ get: request,
50877
+ post: (pathName, body) => request(pathName, { method: "POST", body: JSON.stringify(body) })
50878
+ };
50879
+ }
50880
+ function contextPathForSourceKey(sourceKey) {
50881
+ if (sourceKey.startsWith("agent:")) {
50882
+ const logicalKey = sourceKey.slice("agent:".length);
50883
+ return import_node_path15.default.join(getDuclawDataDir(), "kv", "agent", `${Buffer.from(logicalKey).toString("base64url")}.json`);
50884
+ }
50885
+ if (sourceKey.startsWith("goal-context:")) {
50886
+ return import_node_path15.default.join(getDuclawHomeDir(), "goal-context", `${sourceKey.slice("goal-context:".length)}.json`);
50887
+ }
50888
+ if (sourceKey.startsWith("tasks:")) {
50889
+ return import_node_path15.default.join(getDuclawHomeDir(), "tasks", `${sourceKey.slice("tasks:".length)}.json`);
50890
+ }
50891
+ return null;
50892
+ }
50893
+ function safeSkillTargetPath(sourcePath, skillName) {
50894
+ const allowedRoots = skillRoots().map((root) => import_node_path15.default.resolve(root));
50895
+ const normalized = import_node_path15.default.resolve(sourcePath);
50896
+ if (allowedRoots.some((root) => normalized === import_node_path15.default.join(root, import_node_path15.default.basename(import_node_path15.default.dirname(normalized)), "SKILL.md"))) {
50897
+ return normalized;
50898
+ }
50899
+ const safeName = skillName.replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 120) || "imported-skill";
50900
+ return import_node_path15.default.join("/home/user/app/skills", safeName, "SKILL.md");
50901
+ }
50902
+ function skillRoots() {
50903
+ return [
50904
+ "/home/user/app/skills",
50905
+ import_node_path15.default.join(getDuclawHomeDir(), "skills"),
50906
+ import_node_path15.default.join((0, import_node_os3.homedir)(), ".agents", "skills")
50907
+ ];
50908
+ }
50909
+
50806
50910
  // src/main.ts
50807
50911
  var cliResult = handleCliCommand(process.argv.slice(2));
50808
50912
  if (cliResult !== void 0) {
@@ -50833,6 +50937,7 @@ ${errors.join("\n")}
50833
50937
  async function main() {
50834
50938
  loadEnv();
50835
50939
  validateEnv();
50940
+ await restoreSaasRuntimeAssets("gateway_start");
50836
50941
  const cfg = loadConfig();
50837
50942
  const { registry: registry2 } = createDefaultChannels();
50838
50943
  const channels = getAllChannels(registry2);