duclaw-cli 1.9.11 → 1.9.12

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 path21 = require("path");
118
+ var path22 = 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 = path21.resolve(process.cwd(), ".env.vault");
264
+ possibleVaultPath = path22.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] === "~" ? path21.join(os.homedir(), envPath.slice(1)) : envPath;
272
+ return envPath[0] === "~" ? path22.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 = path21.resolve(process.cwd(), ".env");
289
+ const dotenvPath = path22.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 path22 of optionPaths) {
317
+ for (const path23 of optionPaths) {
318
318
  try {
319
- const parsed = DotenvModule.parse(fs3.readFileSync(path22, { encoding }));
319
+ const parsed = DotenvModule.parse(fs3.readFileSync(path23, { encoding }));
320
320
  DotenvModule.populate(parsedAll, parsed, options);
321
321
  } catch (e) {
322
322
  if (debug) {
323
- _debug(`Failed to load ${path22} ${e.message}`);
323
+ _debug(`Failed to load ${path23} ${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 = path21.relative(process.cwd(), filePath);
336
+ const relative4 = path22.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, path21, moduleArguments) {
8241
- parser.push("MODULE", "LOAD", path21);
8240
+ parseCommand(parser, path22, moduleArguments) {
8241
+ parser.push("MODULE", "LOAD", path22);
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, path21, json, ...jsons) {
23542
+ parseCommand(parser, key, path22, json, ...jsons) {
23543
23543
  parser.push("JSON.ARRAPPEND");
23544
23544
  parser.pushKey(key);
23545
- parser.push(path21, (0, generic_transformers_1.transformRedisJsonArgument)(json));
23545
+ parser.push(path22, (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, path21, json, options) {
23575
+ parseCommand(parser, key, path22, json, options) {
23576
23576
  parser.push("JSON.ARRINDEX");
23577
23577
  parser.pushKey(key);
23578
- parser.push(path21, (0, generic_transformers_1.transformRedisJsonArgument)(json));
23578
+ parser.push(path22, (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, path21, index, json, ...jsons) {
23610
+ parseCommand(parser, key, path22, index, json, ...jsons) {
23611
23611
  parser.push("JSON.ARRINSERT");
23612
23612
  parser.pushKey(key);
23613
- parser.push(path21, index.toString(), (0, generic_transformers_1.transformRedisJsonArgument)(json));
23613
+ parser.push(path22, 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, path21, start, stop) {
23703
+ parseCommand(parser, key, path22, start, stop) {
23704
23704
  parser.push("JSON.ARRTRIM");
23705
23705
  parser.pushKey(key);
23706
- parser.push(path21, start.toString(), stop.toString());
23706
+ parser.push(path22, 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, path21, value) {
23871
+ parseCommand(parser, key, path22, value) {
23872
23872
  parser.push("JSON.MERGE");
23873
23873
  parser.pushKey(key);
23874
- parser.push(path21, (0, generic_transformers_1.transformRedisJsonArgument)(value));
23874
+ parser.push(path22, (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, path21) {
23897
+ parseCommand(parser, keys, path22) {
23898
23898
  parser.push("JSON.MGET");
23899
23899
  parser.pushKeys(keys);
23900
- parser.push(path21);
23900
+ parser.push(path22);
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, path21, by) {
23955
+ parseCommand(parser, key, path22, by) {
23956
23956
  parser.push("JSON.NUMINCRBY");
23957
23957
  parser.pushKey(key);
23958
- parser.push(path21, by.toString());
23958
+ parser.push(path22, 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, path21, by) {
23990
+ parseCommand(parser, key, path22, by) {
23991
23991
  parser.push("JSON.NUMMULTBY");
23992
23992
  parser.pushKey(key);
23993
- parser.push(path21, by.toString());
23993
+ parser.push(path22, 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, path21, json, options) {
24077
+ parseCommand(parser, key, path22, json, options) {
24078
24078
  parser.push("JSON.SET");
24079
24079
  parser.pushKey(key);
24080
- parser.push(path21, (0, generic_transformers_1.transformRedisJsonArgument)(json));
24080
+ parser.push(path22, (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, path21) {
24168
+ parseCommand(parser, key, path22) {
24169
24169
  parser.push("JSON.TOGGLE");
24170
24170
  parser.pushKey(key);
24171
- parser.push(path21);
24171
+ parser.push(path22);
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.9.11" : "unknown"}`);
30245
+ console.log(`duclaw-cli v${true ? "1.9.12" : "unknown"}`);
30246
30246
  }
30247
30247
  function getDuclawTemplate() {
30248
30248
  return {
@@ -31633,7 +31633,7 @@ var ReaddirpStream = class extends import_node_stream.Readable {
31633
31633
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
31634
31634
  const statMethod = opts.lstat ? import_promises3.lstat : import_promises3.stat;
31635
31635
  if (wantBigintFsStats) {
31636
- this._stat = (path21) => statMethod(path21, { bigint: true });
31636
+ this._stat = (path22) => statMethod(path22, { bigint: true });
31637
31637
  } else {
31638
31638
  this._stat = statMethod;
31639
31639
  }
@@ -31658,8 +31658,8 @@ var ReaddirpStream = class extends import_node_stream.Readable {
31658
31658
  const par = this.parent;
31659
31659
  const fil = par && par.files;
31660
31660
  if (fil && fil.length > 0) {
31661
- const { path: path21, depth } = par;
31662
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path21));
31661
+ const { path: path22, depth } = par;
31662
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path22));
31663
31663
  const awaited = await Promise.all(slice);
31664
31664
  for (const entry of awaited) {
31665
31665
  if (!entry)
@@ -31699,20 +31699,20 @@ var ReaddirpStream = class extends import_node_stream.Readable {
31699
31699
  this.reading = false;
31700
31700
  }
31701
31701
  }
31702
- async _exploreDir(path21, depth) {
31702
+ async _exploreDir(path22, depth) {
31703
31703
  let files;
31704
31704
  try {
31705
- files = await (0, import_promises3.readdir)(path21, this._rdOptions);
31705
+ files = await (0, import_promises3.readdir)(path22, this._rdOptions);
31706
31706
  } catch (error) {
31707
31707
  this._onError(error);
31708
31708
  }
31709
- return { files, depth, path: path21 };
31709
+ return { files, depth, path: path22 };
31710
31710
  }
31711
- async _formatEntry(dirent, path21) {
31711
+ async _formatEntry(dirent, path22) {
31712
31712
  let entry;
31713
31713
  const basename4 = this._isDirent ? dirent.name : dirent;
31714
31714
  try {
31715
- const fullPath = (0, import_node_path4.resolve)((0, import_node_path4.join)(path21, basename4));
31715
+ const fullPath = (0, import_node_path4.resolve)((0, import_node_path4.join)(path22, basename4));
31716
31716
  entry = { path: (0, import_node_path4.relative)(this._root, fullPath), fullPath, basename: basename4 };
31717
31717
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
31718
31718
  } catch (err) {
@@ -32112,16 +32112,16 @@ var delFromSet = (main2, prop, item) => {
32112
32112
  };
32113
32113
  var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
32114
32114
  var FsWatchInstances = /* @__PURE__ */ new Map();
32115
- function createFsWatchInstance(path21, options, listener, errHandler, emitRaw) {
32115
+ function createFsWatchInstance(path22, options, listener, errHandler, emitRaw) {
32116
32116
  const handleEvent = (rawEvent, evPath) => {
32117
- listener(path21);
32118
- emitRaw(rawEvent, evPath, { watchedPath: path21 });
32119
- if (evPath && path21 !== evPath) {
32120
- fsWatchBroadcast(sp.resolve(path21, evPath), KEY_LISTENERS, sp.join(path21, evPath));
32117
+ listener(path22);
32118
+ emitRaw(rawEvent, evPath, { watchedPath: path22 });
32119
+ if (evPath && path22 !== evPath) {
32120
+ fsWatchBroadcast(sp.resolve(path22, evPath), KEY_LISTENERS, sp.join(path22, evPath));
32121
32121
  }
32122
32122
  };
32123
32123
  try {
32124
- return (0, import_node_fs.watch)(path21, {
32124
+ return (0, import_node_fs.watch)(path22, {
32125
32125
  persistent: options.persistent
32126
32126
  }, handleEvent);
32127
32127
  } catch (error) {
@@ -32137,12 +32137,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
32137
32137
  listener(val1, val2, val3);
32138
32138
  });
32139
32139
  };
32140
- var setFsWatchListener = (path21, fullPath, options, handlers) => {
32140
+ var setFsWatchListener = (path22, fullPath, options, handlers) => {
32141
32141
  const { listener, errHandler, rawEmitter } = handlers;
32142
32142
  let cont = FsWatchInstances.get(fullPath);
32143
32143
  let watcher;
32144
32144
  if (!options.persistent) {
32145
- watcher = createFsWatchInstance(path21, options, listener, errHandler, rawEmitter);
32145
+ watcher = createFsWatchInstance(path22, options, listener, errHandler, rawEmitter);
32146
32146
  if (!watcher)
32147
32147
  return;
32148
32148
  return watcher.close.bind(watcher);
@@ -32153,7 +32153,7 @@ var setFsWatchListener = (path21, fullPath, options, handlers) => {
32153
32153
  addAndConvert(cont, KEY_RAW, rawEmitter);
32154
32154
  } else {
32155
32155
  watcher = createFsWatchInstance(
32156
- path21,
32156
+ path22,
32157
32157
  options,
32158
32158
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
32159
32159
  errHandler,
@@ -32168,7 +32168,7 @@ var setFsWatchListener = (path21, fullPath, options, handlers) => {
32168
32168
  cont.watcherUnusable = true;
32169
32169
  if (isWindows && error.code === "EPERM") {
32170
32170
  try {
32171
- const fd = await (0, import_promises4.open)(path21, "r");
32171
+ const fd = await (0, import_promises4.open)(path22, "r");
32172
32172
  await fd.close();
32173
32173
  broadcastErr(error);
32174
32174
  } catch (err) {
@@ -32199,7 +32199,7 @@ var setFsWatchListener = (path21, fullPath, options, handlers) => {
32199
32199
  };
32200
32200
  };
32201
32201
  var FsWatchFileInstances = /* @__PURE__ */ new Map();
32202
- var setFsWatchFileListener = (path21, fullPath, options, handlers) => {
32202
+ var setFsWatchFileListener = (path22, fullPath, options, handlers) => {
32203
32203
  const { listener, rawEmitter } = handlers;
32204
32204
  let cont = FsWatchFileInstances.get(fullPath);
32205
32205
  const copts = cont && cont.options;
@@ -32221,7 +32221,7 @@ var setFsWatchFileListener = (path21, fullPath, options, handlers) => {
32221
32221
  });
32222
32222
  const currmtime = curr.mtimeMs;
32223
32223
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
32224
- foreach(cont.listeners, (listener2) => listener2(path21, curr));
32224
+ foreach(cont.listeners, (listener2) => listener2(path22, curr));
32225
32225
  }
32226
32226
  })
32227
32227
  };
@@ -32251,13 +32251,13 @@ var NodeFsHandler = class {
32251
32251
  * @param listener on fs change
32252
32252
  * @returns closer for the watcher instance
32253
32253
  */
32254
- _watchWithNodeFs(path21, listener) {
32254
+ _watchWithNodeFs(path22, listener) {
32255
32255
  const opts = this.fsw.options;
32256
- const directory = sp.dirname(path21);
32257
- const basename4 = sp.basename(path21);
32256
+ const directory = sp.dirname(path22);
32257
+ const basename4 = sp.basename(path22);
32258
32258
  const parent = this.fsw._getWatchedDir(directory);
32259
32259
  parent.add(basename4);
32260
- const absolutePath = sp.resolve(path21);
32260
+ const absolutePath = sp.resolve(path22);
32261
32261
  const options = {
32262
32262
  persistent: opts.persistent
32263
32263
  };
@@ -32267,12 +32267,12 @@ var NodeFsHandler = class {
32267
32267
  if (opts.usePolling) {
32268
32268
  const enableBin = opts.interval !== opts.binaryInterval;
32269
32269
  options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
32270
- closer = setFsWatchFileListener(path21, absolutePath, options, {
32270
+ closer = setFsWatchFileListener(path22, absolutePath, options, {
32271
32271
  listener,
32272
32272
  rawEmitter: this.fsw._emitRaw
32273
32273
  });
32274
32274
  } else {
32275
- closer = setFsWatchListener(path21, absolutePath, options, {
32275
+ closer = setFsWatchListener(path22, absolutePath, options, {
32276
32276
  listener,
32277
32277
  errHandler: this._boundHandleError,
32278
32278
  rawEmitter: this.fsw._emitRaw
@@ -32294,7 +32294,7 @@ var NodeFsHandler = class {
32294
32294
  let prevStats = stats;
32295
32295
  if (parent.has(basename4))
32296
32296
  return;
32297
- const listener = async (path21, newStats) => {
32297
+ const listener = async (path22, newStats) => {
32298
32298
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
32299
32299
  return;
32300
32300
  if (!newStats || newStats.mtimeMs === 0) {
@@ -32308,11 +32308,11 @@ var NodeFsHandler = class {
32308
32308
  this.fsw._emit(EV.CHANGE, file, newStats2);
32309
32309
  }
32310
32310
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
32311
- this.fsw._closeFile(path21);
32311
+ this.fsw._closeFile(path22);
32312
32312
  prevStats = newStats2;
32313
32313
  const closer2 = this._watchWithNodeFs(file, listener);
32314
32314
  if (closer2)
32315
- this.fsw._addPathCloser(path21, closer2);
32315
+ this.fsw._addPathCloser(path22, closer2);
32316
32316
  } else {
32317
32317
  prevStats = newStats2;
32318
32318
  }
@@ -32344,7 +32344,7 @@ var NodeFsHandler = class {
32344
32344
  * @param item basename of this item
32345
32345
  * @returns true if no more processing is needed for this entry.
32346
32346
  */
32347
- async _handleSymlink(entry, directory, path21, item) {
32347
+ async _handleSymlink(entry, directory, path22, item) {
32348
32348
  if (this.fsw.closed) {
32349
32349
  return;
32350
32350
  }
@@ -32354,7 +32354,7 @@ var NodeFsHandler = class {
32354
32354
  this.fsw._incrReadyCount();
32355
32355
  let linkPath;
32356
32356
  try {
32357
- linkPath = await (0, import_promises4.realpath)(path21);
32357
+ linkPath = await (0, import_promises4.realpath)(path22);
32358
32358
  } catch (e) {
32359
32359
  this.fsw._emitReady();
32360
32360
  return true;
@@ -32364,12 +32364,12 @@ var NodeFsHandler = class {
32364
32364
  if (dir.has(item)) {
32365
32365
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
32366
32366
  this.fsw._symlinkPaths.set(full, linkPath);
32367
- this.fsw._emit(EV.CHANGE, path21, entry.stats);
32367
+ this.fsw._emit(EV.CHANGE, path22, entry.stats);
32368
32368
  }
32369
32369
  } else {
32370
32370
  dir.add(item);
32371
32371
  this.fsw._symlinkPaths.set(full, linkPath);
32372
- this.fsw._emit(EV.ADD, path21, entry.stats);
32372
+ this.fsw._emit(EV.ADD, path22, entry.stats);
32373
32373
  }
32374
32374
  this.fsw._emitReady();
32375
32375
  return true;
@@ -32399,9 +32399,9 @@ var NodeFsHandler = class {
32399
32399
  return;
32400
32400
  }
32401
32401
  const item = entry.path;
32402
- let path21 = sp.join(directory, item);
32402
+ let path22 = sp.join(directory, item);
32403
32403
  current.add(item);
32404
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path21, item)) {
32404
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path22, item)) {
32405
32405
  return;
32406
32406
  }
32407
32407
  if (this.fsw.closed) {
@@ -32410,8 +32410,8 @@ var NodeFsHandler = class {
32410
32410
  }
32411
32411
  if (item === target || !target && !previous.has(item)) {
32412
32412
  this.fsw._incrReadyCount();
32413
- path21 = sp.join(dir, sp.relative(dir, path21));
32414
- this._addToNodeFs(path21, initialAdd, wh, depth + 1);
32413
+ path22 = sp.join(dir, sp.relative(dir, path22));
32414
+ this._addToNodeFs(path22, initialAdd, wh, depth + 1);
32415
32415
  }
32416
32416
  }).on(EV.ERROR, this._boundHandleError);
32417
32417
  return new Promise((resolve11, reject) => {
@@ -32480,13 +32480,13 @@ var NodeFsHandler = class {
32480
32480
  * @param depth Child path actually targeted for watch
32481
32481
  * @param target Child path actually targeted for watch
32482
32482
  */
32483
- async _addToNodeFs(path21, initialAdd, priorWh, depth, target) {
32483
+ async _addToNodeFs(path22, initialAdd, priorWh, depth, target) {
32484
32484
  const ready = this.fsw._emitReady;
32485
- if (this.fsw._isIgnored(path21) || this.fsw.closed) {
32485
+ if (this.fsw._isIgnored(path22) || this.fsw.closed) {
32486
32486
  ready();
32487
32487
  return false;
32488
32488
  }
32489
- const wh = this.fsw._getWatchHelpers(path21);
32489
+ const wh = this.fsw._getWatchHelpers(path22);
32490
32490
  if (priorWh) {
32491
32491
  wh.filterPath = (entry) => priorWh.filterPath(entry);
32492
32492
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -32502,8 +32502,8 @@ var NodeFsHandler = class {
32502
32502
  const follow = this.fsw.options.followSymlinks;
32503
32503
  let closer;
32504
32504
  if (stats.isDirectory()) {
32505
- const absPath = sp.resolve(path21);
32506
- const targetPath = follow ? await (0, import_promises4.realpath)(path21) : path21;
32505
+ const absPath = sp.resolve(path22);
32506
+ const targetPath = follow ? await (0, import_promises4.realpath)(path22) : path22;
32507
32507
  if (this.fsw.closed)
32508
32508
  return;
32509
32509
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -32513,29 +32513,29 @@ var NodeFsHandler = class {
32513
32513
  this.fsw._symlinkPaths.set(absPath, targetPath);
32514
32514
  }
32515
32515
  } else if (stats.isSymbolicLink()) {
32516
- const targetPath = follow ? await (0, import_promises4.realpath)(path21) : path21;
32516
+ const targetPath = follow ? await (0, import_promises4.realpath)(path22) : path22;
32517
32517
  if (this.fsw.closed)
32518
32518
  return;
32519
32519
  const parent = sp.dirname(wh.watchPath);
32520
32520
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
32521
32521
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
32522
- closer = await this._handleDir(parent, stats, initialAdd, depth, path21, wh, targetPath);
32522
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path22, wh, targetPath);
32523
32523
  if (this.fsw.closed)
32524
32524
  return;
32525
32525
  if (targetPath !== void 0) {
32526
- this.fsw._symlinkPaths.set(sp.resolve(path21), targetPath);
32526
+ this.fsw._symlinkPaths.set(sp.resolve(path22), targetPath);
32527
32527
  }
32528
32528
  } else {
32529
32529
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
32530
32530
  }
32531
32531
  ready();
32532
32532
  if (closer)
32533
- this.fsw._addPathCloser(path21, closer);
32533
+ this.fsw._addPathCloser(path22, closer);
32534
32534
  return false;
32535
32535
  } catch (error) {
32536
32536
  if (this.fsw._handleError(error)) {
32537
32537
  ready();
32538
- return path21;
32538
+ return path22;
32539
32539
  }
32540
32540
  }
32541
32541
  }
@@ -32578,24 +32578,24 @@ function createPattern(matcher) {
32578
32578
  }
32579
32579
  return () => false;
32580
32580
  }
32581
- function normalizePath(path21) {
32582
- if (typeof path21 !== "string")
32581
+ function normalizePath(path22) {
32582
+ if (typeof path22 !== "string")
32583
32583
  throw new Error("string expected");
32584
- path21 = sp2.normalize(path21);
32585
- path21 = path21.replace(/\\/g, "/");
32584
+ path22 = sp2.normalize(path22);
32585
+ path22 = path22.replace(/\\/g, "/");
32586
32586
  let prepend = false;
32587
- if (path21.startsWith("//"))
32587
+ if (path22.startsWith("//"))
32588
32588
  prepend = true;
32589
- path21 = path21.replace(DOUBLE_SLASH_RE, "/");
32589
+ path22 = path22.replace(DOUBLE_SLASH_RE, "/");
32590
32590
  if (prepend)
32591
- path21 = "/" + path21;
32592
- return path21;
32591
+ path22 = "/" + path22;
32592
+ return path22;
32593
32593
  }
32594
32594
  function matchPatterns(patterns, testString, stats) {
32595
- const path21 = normalizePath(testString);
32595
+ const path22 = normalizePath(testString);
32596
32596
  for (let index = 0; index < patterns.length; index++) {
32597
32597
  const pattern = patterns[index];
32598
- if (pattern(path21, stats)) {
32598
+ if (pattern(path22, stats)) {
32599
32599
  return true;
32600
32600
  }
32601
32601
  }
@@ -32633,19 +32633,19 @@ var toUnix = (string) => {
32633
32633
  }
32634
32634
  return str;
32635
32635
  };
32636
- var normalizePathToUnix = (path21) => toUnix(sp2.normalize(toUnix(path21)));
32637
- var normalizeIgnored = (cwd = "") => (path21) => {
32638
- if (typeof path21 === "string") {
32639
- return normalizePathToUnix(sp2.isAbsolute(path21) ? path21 : sp2.join(cwd, path21));
32636
+ var normalizePathToUnix = (path22) => toUnix(sp2.normalize(toUnix(path22)));
32637
+ var normalizeIgnored = (cwd = "") => (path22) => {
32638
+ if (typeof path22 === "string") {
32639
+ return normalizePathToUnix(sp2.isAbsolute(path22) ? path22 : sp2.join(cwd, path22));
32640
32640
  } else {
32641
- return path21;
32641
+ return path22;
32642
32642
  }
32643
32643
  };
32644
- var getAbsolutePath = (path21, cwd) => {
32645
- if (sp2.isAbsolute(path21)) {
32646
- return path21;
32644
+ var getAbsolutePath = (path22, cwd) => {
32645
+ if (sp2.isAbsolute(path22)) {
32646
+ return path22;
32647
32647
  }
32648
- return sp2.join(cwd, path21);
32648
+ return sp2.join(cwd, path22);
32649
32649
  };
32650
32650
  var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
32651
32651
  var DirEntry = class {
@@ -32710,10 +32710,10 @@ var WatchHelper = class {
32710
32710
  dirParts;
32711
32711
  followSymlinks;
32712
32712
  statMethod;
32713
- constructor(path21, follow, fsw) {
32713
+ constructor(path22, follow, fsw) {
32714
32714
  this.fsw = fsw;
32715
- const watchPath = path21;
32716
- this.path = path21 = path21.replace(REPLACER_RE, "");
32715
+ const watchPath = path22;
32716
+ this.path = path22 = path22.replace(REPLACER_RE, "");
32717
32717
  this.watchPath = watchPath;
32718
32718
  this.fullWatchPath = sp2.resolve(watchPath);
32719
32719
  this.dirParts = [];
@@ -32853,20 +32853,20 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32853
32853
  this._closePromise = void 0;
32854
32854
  let paths = unifyPaths(paths_);
32855
32855
  if (cwd) {
32856
- paths = paths.map((path21) => {
32857
- const absPath = getAbsolutePath(path21, cwd);
32856
+ paths = paths.map((path22) => {
32857
+ const absPath = getAbsolutePath(path22, cwd);
32858
32858
  return absPath;
32859
32859
  });
32860
32860
  }
32861
- paths.forEach((path21) => {
32862
- this._removeIgnoredPath(path21);
32861
+ paths.forEach((path22) => {
32862
+ this._removeIgnoredPath(path22);
32863
32863
  });
32864
32864
  this._userIgnored = void 0;
32865
32865
  if (!this._readyCount)
32866
32866
  this._readyCount = 0;
32867
32867
  this._readyCount += paths.length;
32868
- Promise.all(paths.map(async (path21) => {
32869
- const res = await this._nodeFsHandler._addToNodeFs(path21, !_internal, void 0, 0, _origAdd);
32868
+ Promise.all(paths.map(async (path22) => {
32869
+ const res = await this._nodeFsHandler._addToNodeFs(path22, !_internal, void 0, 0, _origAdd);
32870
32870
  if (res)
32871
32871
  this._emitReady();
32872
32872
  return res;
@@ -32888,17 +32888,17 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32888
32888
  return this;
32889
32889
  const paths = unifyPaths(paths_);
32890
32890
  const { cwd } = this.options;
32891
- paths.forEach((path21) => {
32892
- if (!sp2.isAbsolute(path21) && !this._closers.has(path21)) {
32891
+ paths.forEach((path22) => {
32892
+ if (!sp2.isAbsolute(path22) && !this._closers.has(path22)) {
32893
32893
  if (cwd)
32894
- path21 = sp2.join(cwd, path21);
32895
- path21 = sp2.resolve(path21);
32894
+ path22 = sp2.join(cwd, path22);
32895
+ path22 = sp2.resolve(path22);
32896
32896
  }
32897
- this._closePath(path21);
32898
- this._addIgnoredPath(path21);
32899
- if (this._watched.has(path21)) {
32897
+ this._closePath(path22);
32898
+ this._addIgnoredPath(path22);
32899
+ if (this._watched.has(path22)) {
32900
32900
  this._addIgnoredPath({
32901
- path: path21,
32901
+ path: path22,
32902
32902
  recursive: true
32903
32903
  });
32904
32904
  }
@@ -32962,38 +32962,38 @@ var FSWatcher = class extends import_node_events.EventEmitter {
32962
32962
  * @param stats arguments to be passed with event
32963
32963
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
32964
32964
  */
32965
- async _emit(event, path21, stats) {
32965
+ async _emit(event, path22, stats) {
32966
32966
  if (this.closed)
32967
32967
  return;
32968
32968
  const opts = this.options;
32969
32969
  if (isWindows)
32970
- path21 = sp2.normalize(path21);
32970
+ path22 = sp2.normalize(path22);
32971
32971
  if (opts.cwd)
32972
- path21 = sp2.relative(opts.cwd, path21);
32973
- const args = [path21];
32972
+ path22 = sp2.relative(opts.cwd, path22);
32973
+ const args = [path22];
32974
32974
  if (stats != null)
32975
32975
  args.push(stats);
32976
32976
  const awf = opts.awaitWriteFinish;
32977
32977
  let pw;
32978
- if (awf && (pw = this._pendingWrites.get(path21))) {
32978
+ if (awf && (pw = this._pendingWrites.get(path22))) {
32979
32979
  pw.lastChange = /* @__PURE__ */ new Date();
32980
32980
  return this;
32981
32981
  }
32982
32982
  if (opts.atomic) {
32983
32983
  if (event === EVENTS.UNLINK) {
32984
- this._pendingUnlinks.set(path21, [event, ...args]);
32984
+ this._pendingUnlinks.set(path22, [event, ...args]);
32985
32985
  setTimeout(() => {
32986
- this._pendingUnlinks.forEach((entry, path22) => {
32986
+ this._pendingUnlinks.forEach((entry, path23) => {
32987
32987
  this.emit(...entry);
32988
32988
  this.emit(EVENTS.ALL, ...entry);
32989
- this._pendingUnlinks.delete(path22);
32989
+ this._pendingUnlinks.delete(path23);
32990
32990
  });
32991
32991
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
32992
32992
  return this;
32993
32993
  }
32994
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path21)) {
32994
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path22)) {
32995
32995
  event = EVENTS.CHANGE;
32996
- this._pendingUnlinks.delete(path21);
32996
+ this._pendingUnlinks.delete(path22);
32997
32997
  }
32998
32998
  }
32999
32999
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -33011,16 +33011,16 @@ var FSWatcher = class extends import_node_events.EventEmitter {
33011
33011
  this.emitWithAll(event, args);
33012
33012
  }
33013
33013
  };
33014
- this._awaitWriteFinish(path21, awf.stabilityThreshold, event, awfEmit);
33014
+ this._awaitWriteFinish(path22, awf.stabilityThreshold, event, awfEmit);
33015
33015
  return this;
33016
33016
  }
33017
33017
  if (event === EVENTS.CHANGE) {
33018
- const isThrottled = !this._throttle(EVENTS.CHANGE, path21, 50);
33018
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path22, 50);
33019
33019
  if (isThrottled)
33020
33020
  return this;
33021
33021
  }
33022
33022
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
33023
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path21) : path21;
33023
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path22) : path22;
33024
33024
  let stats2;
33025
33025
  try {
33026
33026
  stats2 = await (0, import_promises5.stat)(fullPath);
@@ -33051,23 +33051,23 @@ var FSWatcher = class extends import_node_events.EventEmitter {
33051
33051
  * @param timeout duration of time to suppress duplicate actions
33052
33052
  * @returns tracking object or false if action should be suppressed
33053
33053
  */
33054
- _throttle(actionType, path21, timeout) {
33054
+ _throttle(actionType, path22, timeout) {
33055
33055
  if (!this._throttled.has(actionType)) {
33056
33056
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
33057
33057
  }
33058
33058
  const action = this._throttled.get(actionType);
33059
33059
  if (!action)
33060
33060
  throw new Error("invalid throttle");
33061
- const actionPath = action.get(path21);
33061
+ const actionPath = action.get(path22);
33062
33062
  if (actionPath) {
33063
33063
  actionPath.count++;
33064
33064
  return false;
33065
33065
  }
33066
33066
  let timeoutObject;
33067
33067
  const clear = () => {
33068
- const item = action.get(path21);
33068
+ const item = action.get(path22);
33069
33069
  const count = item ? item.count : 0;
33070
- action.delete(path21);
33070
+ action.delete(path22);
33071
33071
  clearTimeout(timeoutObject);
33072
33072
  if (item)
33073
33073
  clearTimeout(item.timeoutObject);
@@ -33075,7 +33075,7 @@ var FSWatcher = class extends import_node_events.EventEmitter {
33075
33075
  };
33076
33076
  timeoutObject = setTimeout(clear, timeout);
33077
33077
  const thr = { timeoutObject, clear, count: 0 };
33078
- action.set(path21, thr);
33078
+ action.set(path22, thr);
33079
33079
  return thr;
33080
33080
  }
33081
33081
  _incrReadyCount() {
@@ -33089,44 +33089,44 @@ var FSWatcher = class extends import_node_events.EventEmitter {
33089
33089
  * @param event
33090
33090
  * @param awfEmit Callback to be called when ready for event to be emitted.
33091
33091
  */
33092
- _awaitWriteFinish(path21, threshold, event, awfEmit) {
33092
+ _awaitWriteFinish(path22, threshold, event, awfEmit) {
33093
33093
  const awf = this.options.awaitWriteFinish;
33094
33094
  if (typeof awf !== "object")
33095
33095
  return;
33096
33096
  const pollInterval = awf.pollInterval;
33097
33097
  let timeoutHandler;
33098
- let fullPath = path21;
33099
- if (this.options.cwd && !sp2.isAbsolute(path21)) {
33100
- fullPath = sp2.join(this.options.cwd, path21);
33098
+ let fullPath = path22;
33099
+ if (this.options.cwd && !sp2.isAbsolute(path22)) {
33100
+ fullPath = sp2.join(this.options.cwd, path22);
33101
33101
  }
33102
33102
  const now = /* @__PURE__ */ new Date();
33103
33103
  const writes = this._pendingWrites;
33104
33104
  function awaitWriteFinishFn(prevStat) {
33105
33105
  (0, import_node_fs2.stat)(fullPath, (err, curStat) => {
33106
- if (err || !writes.has(path21)) {
33106
+ if (err || !writes.has(path22)) {
33107
33107
  if (err && err.code !== "ENOENT")
33108
33108
  awfEmit(err);
33109
33109
  return;
33110
33110
  }
33111
33111
  const now2 = Number(/* @__PURE__ */ new Date());
33112
33112
  if (prevStat && curStat.size !== prevStat.size) {
33113
- writes.get(path21).lastChange = now2;
33113
+ writes.get(path22).lastChange = now2;
33114
33114
  }
33115
- const pw = writes.get(path21);
33115
+ const pw = writes.get(path22);
33116
33116
  const df = now2 - pw.lastChange;
33117
33117
  if (df >= threshold) {
33118
- writes.delete(path21);
33118
+ writes.delete(path22);
33119
33119
  awfEmit(void 0, curStat);
33120
33120
  } else {
33121
33121
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
33122
33122
  }
33123
33123
  });
33124
33124
  }
33125
- if (!writes.has(path21)) {
33126
- writes.set(path21, {
33125
+ if (!writes.has(path22)) {
33126
+ writes.set(path22, {
33127
33127
  lastChange: now,
33128
33128
  cancelWait: () => {
33129
- writes.delete(path21);
33129
+ writes.delete(path22);
33130
33130
  clearTimeout(timeoutHandler);
33131
33131
  return event;
33132
33132
  }
@@ -33137,8 +33137,8 @@ var FSWatcher = class extends import_node_events.EventEmitter {
33137
33137
  /**
33138
33138
  * Determines whether user has asked to ignore this path.
33139
33139
  */
33140
- _isIgnored(path21, stats) {
33141
- if (this.options.atomic && DOT_RE.test(path21))
33140
+ _isIgnored(path22, stats) {
33141
+ if (this.options.atomic && DOT_RE.test(path22))
33142
33142
  return true;
33143
33143
  if (!this._userIgnored) {
33144
33144
  const { cwd } = this.options;
@@ -33148,17 +33148,17 @@ var FSWatcher = class extends import_node_events.EventEmitter {
33148
33148
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
33149
33149
  this._userIgnored = anymatch(list, void 0);
33150
33150
  }
33151
- return this._userIgnored(path21, stats);
33151
+ return this._userIgnored(path22, stats);
33152
33152
  }
33153
- _isntIgnored(path21, stat11) {
33154
- return !this._isIgnored(path21, stat11);
33153
+ _isntIgnored(path22, stat11) {
33154
+ return !this._isIgnored(path22, stat11);
33155
33155
  }
33156
33156
  /**
33157
33157
  * Provides a set of common helpers and properties relating to symlink handling.
33158
33158
  * @param path file or directory pattern being watched
33159
33159
  */
33160
- _getWatchHelpers(path21) {
33161
- return new WatchHelper(path21, this.options.followSymlinks, this);
33160
+ _getWatchHelpers(path22) {
33161
+ return new WatchHelper(path22, this.options.followSymlinks, this);
33162
33162
  }
33163
33163
  // Directory helpers
33164
33164
  // -----------------
@@ -33190,63 +33190,63 @@ var FSWatcher = class extends import_node_events.EventEmitter {
33190
33190
  * @param item base path of item/directory
33191
33191
  */
33192
33192
  _remove(directory, item, isDirectory) {
33193
- const path21 = sp2.join(directory, item);
33194
- const fullPath = sp2.resolve(path21);
33195
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path21) || this._watched.has(fullPath);
33196
- if (!this._throttle("remove", path21, 100))
33193
+ const path22 = sp2.join(directory, item);
33194
+ const fullPath = sp2.resolve(path22);
33195
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path22) || this._watched.has(fullPath);
33196
+ if (!this._throttle("remove", path22, 100))
33197
33197
  return;
33198
33198
  if (!isDirectory && this._watched.size === 1) {
33199
33199
  this.add(directory, item, true);
33200
33200
  }
33201
- const wp = this._getWatchedDir(path21);
33201
+ const wp = this._getWatchedDir(path22);
33202
33202
  const nestedDirectoryChildren = wp.getChildren();
33203
- nestedDirectoryChildren.forEach((nested) => this._remove(path21, nested));
33203
+ nestedDirectoryChildren.forEach((nested) => this._remove(path22, nested));
33204
33204
  const parent = this._getWatchedDir(directory);
33205
33205
  const wasTracked = parent.has(item);
33206
33206
  parent.remove(item);
33207
33207
  if (this._symlinkPaths.has(fullPath)) {
33208
33208
  this._symlinkPaths.delete(fullPath);
33209
33209
  }
33210
- let relPath = path21;
33210
+ let relPath = path22;
33211
33211
  if (this.options.cwd)
33212
- relPath = sp2.relative(this.options.cwd, path21);
33212
+ relPath = sp2.relative(this.options.cwd, path22);
33213
33213
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
33214
33214
  const event = this._pendingWrites.get(relPath).cancelWait();
33215
33215
  if (event === EVENTS.ADD)
33216
33216
  return;
33217
33217
  }
33218
- this._watched.delete(path21);
33218
+ this._watched.delete(path22);
33219
33219
  this._watched.delete(fullPath);
33220
33220
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
33221
- if (wasTracked && !this._isIgnored(path21))
33222
- this._emit(eventName, path21);
33223
- this._closePath(path21);
33221
+ if (wasTracked && !this._isIgnored(path22))
33222
+ this._emit(eventName, path22);
33223
+ this._closePath(path22);
33224
33224
  }
33225
33225
  /**
33226
33226
  * Closes all watchers for a path
33227
33227
  */
33228
- _closePath(path21) {
33229
- this._closeFile(path21);
33230
- const dir = sp2.dirname(path21);
33231
- this._getWatchedDir(dir).remove(sp2.basename(path21));
33228
+ _closePath(path22) {
33229
+ this._closeFile(path22);
33230
+ const dir = sp2.dirname(path22);
33231
+ this._getWatchedDir(dir).remove(sp2.basename(path22));
33232
33232
  }
33233
33233
  /**
33234
33234
  * Closes only file-specific watchers
33235
33235
  */
33236
- _closeFile(path21) {
33237
- const closers = this._closers.get(path21);
33236
+ _closeFile(path22) {
33237
+ const closers = this._closers.get(path22);
33238
33238
  if (!closers)
33239
33239
  return;
33240
33240
  closers.forEach((closer) => closer());
33241
- this._closers.delete(path21);
33241
+ this._closers.delete(path22);
33242
33242
  }
33243
- _addPathCloser(path21, closer) {
33243
+ _addPathCloser(path22, closer) {
33244
33244
  if (!closer)
33245
33245
  return;
33246
- let list = this._closers.get(path21);
33246
+ let list = this._closers.get(path22);
33247
33247
  if (!list) {
33248
33248
  list = [];
33249
- this._closers.set(path21, list);
33249
+ this._closers.set(path22, list);
33250
33250
  }
33251
33251
  list.push(closer);
33252
33252
  }
@@ -34710,12 +34710,12 @@ function encodeURIPath(str) {
34710
34710
  return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
34711
34711
  }
34712
34712
  var EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
34713
- var createPathTagFunction = (pathEncoder = encodeURIPath) => function path21(statics, ...params) {
34713
+ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path22(statics, ...params) {
34714
34714
  if (statics.length === 1)
34715
34715
  return statics[0];
34716
34716
  let postPath = false;
34717
34717
  const invalidSegments = [];
34718
- const path22 = statics.reduce((previousValue, currentValue, index) => {
34718
+ const path23 = statics.reduce((previousValue, currentValue, index) => {
34719
34719
  if (/[?#]/.test(currentValue)) {
34720
34720
  postPath = true;
34721
34721
  }
@@ -34732,7 +34732,7 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path21(sta
34732
34732
  }
34733
34733
  return previousValue + currentValue + (index === params.length ? "" : encoded);
34734
34734
  }, "");
34735
- const pathOnly = path22.split(/[?#]/, 1)[0];
34735
+ const pathOnly = path23.split(/[?#]/, 1)[0];
34736
34736
  const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
34737
34737
  let match2;
34738
34738
  while ((match2 = invalidSegmentPattern.exec(pathOnly)) !== null) {
@@ -34753,10 +34753,10 @@ var createPathTagFunction = (pathEncoder = encodeURIPath) => function path21(sta
34753
34753
  }, "");
34754
34754
  throw new AnthropicError(`Path parameters result in path with invalid segments:
34755
34755
  ${invalidSegments.map((e) => e.error).join("\n")}
34756
- ${path22}
34756
+ ${path23}
34757
34757
  ${underline}`);
34758
34758
  }
34759
- return path22;
34759
+ return path23;
34760
34760
  };
34761
34761
  var path5 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
34762
34762
 
@@ -37867,9 +37867,9 @@ var BaseAnthropic = class {
37867
37867
  makeStatusError(status, error, message, headers) {
37868
37868
  return APIError.generate(status, error, message, headers);
37869
37869
  }
37870
- buildURL(path21, query, defaultBaseURL) {
37870
+ buildURL(path22, query, defaultBaseURL) {
37871
37871
  const baseURL = !__classPrivateFieldGet(this, _BaseAnthropic_instances, "m", _BaseAnthropic_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
37872
- const url = isAbsoluteURL(path21) ? new URL(path21) : new URL(baseURL + (baseURL.endsWith("/") && path21.startsWith("/") ? path21.slice(1) : path21));
37872
+ const url = isAbsoluteURL(path22) ? new URL(path22) : new URL(baseURL + (baseURL.endsWith("/") && path22.startsWith("/") ? path22.slice(1) : path22));
37873
37873
  const defaultQuery = this.defaultQuery();
37874
37874
  if (!isEmptyObj(defaultQuery)) {
37875
37875
  query = { ...defaultQuery, ...query };
@@ -37900,24 +37900,24 @@ var BaseAnthropic = class {
37900
37900
  */
37901
37901
  async prepareRequest(request, { url, options }) {
37902
37902
  }
37903
- get(path21, opts) {
37904
- return this.methodRequest("get", path21, opts);
37903
+ get(path22, opts) {
37904
+ return this.methodRequest("get", path22, opts);
37905
37905
  }
37906
- post(path21, opts) {
37907
- return this.methodRequest("post", path21, opts);
37906
+ post(path22, opts) {
37907
+ return this.methodRequest("post", path22, opts);
37908
37908
  }
37909
- patch(path21, opts) {
37910
- return this.methodRequest("patch", path21, opts);
37909
+ patch(path22, opts) {
37910
+ return this.methodRequest("patch", path22, opts);
37911
37911
  }
37912
- put(path21, opts) {
37913
- return this.methodRequest("put", path21, opts);
37912
+ put(path22, opts) {
37913
+ return this.methodRequest("put", path22, opts);
37914
37914
  }
37915
- delete(path21, opts) {
37916
- return this.methodRequest("delete", path21, opts);
37915
+ delete(path22, opts) {
37916
+ return this.methodRequest("delete", path22, opts);
37917
37917
  }
37918
- methodRequest(method, path21, opts) {
37918
+ methodRequest(method, path22, opts) {
37919
37919
  return this.request(Promise.resolve(opts).then((opts2) => {
37920
- return { method, path: path21, ...opts2 };
37920
+ return { method, path: path22, ...opts2 };
37921
37921
  }));
37922
37922
  }
37923
37923
  request(options, remainingRetries = null) {
@@ -38021,8 +38021,8 @@ var BaseAnthropic = class {
38021
38021
  }));
38022
38022
  return { response, options, controller, requestLogID, retryOfRequestLogID, startTime: startTime2 };
38023
38023
  }
38024
- getAPIList(path21, Page2, opts) {
38025
- return this.requestAPIList(Page2, opts && "then" in opts ? opts.then((opts2) => ({ method: "get", path: path21, ...opts2 })) : { method: "get", path: path21, ...opts });
38024
+ getAPIList(path22, Page2, opts) {
38025
+ return this.requestAPIList(Page2, opts && "then" in opts ? opts.then((opts2) => ({ method: "get", path: path22, ...opts2 })) : { method: "get", path: path22, ...opts });
38026
38026
  }
38027
38027
  requestAPIList(Page2, options) {
38028
38028
  const request = this.makeRequest(options, null, void 0);
@@ -38110,8 +38110,8 @@ var BaseAnthropic = class {
38110
38110
  }
38111
38111
  async buildRequest(inputOptions, { retryCount = 0 } = {}) {
38112
38112
  const options = { ...inputOptions };
38113
- const { method, path: path21, query, defaultBaseURL } = options;
38114
- const url = this.buildURL(path21, query, defaultBaseURL);
38113
+ const { method, path: path22, query, defaultBaseURL } = options;
38114
+ const url = this.buildURL(path22, query, defaultBaseURL);
38115
38115
  if ("timeout" in options)
38116
38116
  validatePositiveInteger("timeout", options.timeout);
38117
38117
  options.timeout = options.timeout ?? this.timeout;
@@ -40321,16 +40321,16 @@ var Diff = class {
40321
40321
  }
40322
40322
  }
40323
40323
  }
40324
- addToPath(path21, added, removed, oldPosInc, options) {
40325
- const last = path21.lastComponent;
40324
+ addToPath(path22, added, removed, oldPosInc, options) {
40325
+ const last = path22.lastComponent;
40326
40326
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
40327
40327
  return {
40328
- oldPos: path21.oldPos + oldPosInc,
40328
+ oldPos: path22.oldPos + oldPosInc,
40329
40329
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
40330
40330
  };
40331
40331
  } else {
40332
40332
  return {
40333
- oldPos: path21.oldPos + oldPosInc,
40333
+ oldPos: path22.oldPos + oldPosInc,
40334
40334
  lastComponent: { count: 1, added, removed, previousComponent: last }
40335
40335
  };
40336
40336
  }
@@ -41781,6 +41781,196 @@ var imageUnderstand = {
41781
41781
  }
41782
41782
  };
41783
41783
 
41784
+ // src/tools/tools/ImageGenerate.ts
41785
+ var import_promises12 = require("node:fs/promises");
41786
+ var import_node_path12 = __toESM(require("node:path"));
41787
+ var DEFAULT_BASE_URL = "https://direct.shanyiapi.com";
41788
+ var DEFAULT_MODEL = "gpt-image-2";
41789
+ var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([403, 429, 500, 502, 503, 504, 524]);
41790
+ var MAX_RETRIES = 3;
41791
+ var RETRY_BACKOFF_BASE_MS = 5e3;
41792
+ var DESCRIPTION15 = `
41793
+ Generate images with the platform-configured Shanyi/NewAPI image provider.
41794
+
41795
+ Use this when the user asks to create, draw, render, or generate a new image. The tool uses the runtime's SHANYI_API_KEY from the platform environment; never ask the user for this key.
41796
+
41797
+ The tool saves generated images to local files and returns filePath/fileName values. After a successful generation, call send_file with the returned filePath and fileName to deliver the image to the user.
41798
+ `;
41799
+ function sanitizeName(value, fallback = "image") {
41800
+ const cleaned = value.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
41801
+ return cleaned.slice(0, 80) || fallback;
41802
+ }
41803
+ function extensionFromContentType(contentType) {
41804
+ const normalized = (contentType || "").toLowerCase();
41805
+ if (normalized.includes("image/jpeg") || normalized.includes("image/jpg")) return ".jpg";
41806
+ if (normalized.includes("image/png")) return ".png";
41807
+ if (normalized.includes("image/webp")) return ".webp";
41808
+ if (normalized.includes("image/gif")) return ".gif";
41809
+ return ".png";
41810
+ }
41811
+ function extensionFromUrl(url) {
41812
+ try {
41813
+ const ext = import_node_path12.default.extname(new URL(url).pathname).toLowerCase();
41814
+ if ([".png", ".jpg", ".jpeg", ".webp", ".gif"].includes(ext)) return ext;
41815
+ } catch {
41816
+ return "";
41817
+ }
41818
+ return "";
41819
+ }
41820
+ async function sleep2(ms) {
41821
+ await new Promise((resolve11) => setTimeout(resolve11, ms));
41822
+ }
41823
+ async function requestImageGeneration(url, apiKey, payload, timeoutMs) {
41824
+ let lastError;
41825
+ for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
41826
+ const response = await fetch(url, {
41827
+ method: "POST",
41828
+ signal: AbortSignal.timeout(timeoutMs),
41829
+ headers: {
41830
+ authorization: `Bearer ${apiKey}`,
41831
+ "content-type": "application/json"
41832
+ },
41833
+ body: JSON.stringify(payload)
41834
+ }).catch((error) => {
41835
+ throw new Error(`image_generation_network_error:${error instanceof Error ? error.message : String(error)}`);
41836
+ });
41837
+ const requestId = response.headers.get("x-oneapi-request-id") ?? void 0;
41838
+ const raw2 = await response.text();
41839
+ if (!response.ok) {
41840
+ lastError = new Error(`image_generation_http_${response.status}: request_id=${requestId ?? "unknown"} body=${raw2.slice(0, 1e3)}`);
41841
+ if (RETRYABLE_STATUS_CODES.has(response.status) && attempt < MAX_RETRIES) {
41842
+ await sleep2(RETRY_BACKOFF_BASE_MS * attempt);
41843
+ continue;
41844
+ }
41845
+ throw lastError;
41846
+ }
41847
+ try {
41848
+ return {
41849
+ data: JSON.parse(raw2),
41850
+ requestId
41851
+ };
41852
+ } catch {
41853
+ throw new Error(`image_generation_invalid_json: request_id=${requestId ?? "unknown"}`);
41854
+ }
41855
+ }
41856
+ throw lastError ?? new Error("image_generation_failed");
41857
+ }
41858
+ async function downloadImage(url, timeoutMs) {
41859
+ const response = await fetch(url, {
41860
+ method: "GET",
41861
+ signal: AbortSignal.timeout(timeoutMs)
41862
+ });
41863
+ if (!response.ok) {
41864
+ throw new Error(`image_download_failed:${response.status}`);
41865
+ }
41866
+ const contentType = response.headers.get("content-type");
41867
+ const extension = extensionFromUrl(url) || extensionFromContentType(contentType);
41868
+ return {
41869
+ buffer: Buffer.from(await response.arrayBuffer()),
41870
+ extension
41871
+ };
41872
+ }
41873
+ function decodeBase64Image(data) {
41874
+ const match2 = data.match(/^data:(image\/[^;]+);base64,(.+)$/);
41875
+ if (match2) {
41876
+ return {
41877
+ buffer: Buffer.from(match2[2], "base64"),
41878
+ extension: extensionFromContentType(match2[1])
41879
+ };
41880
+ }
41881
+ return {
41882
+ buffer: Buffer.from(data, "base64"),
41883
+ extension: ".png"
41884
+ };
41885
+ }
41886
+ var imageGenerate = {
41887
+ name: "image_generate",
41888
+ description: DESCRIPTION15,
41889
+ input_schema: {
41890
+ type: "object",
41891
+ properties: {
41892
+ prompt: {
41893
+ type: "string",
41894
+ description: "Image prompt. Preserve important user constraints and avoid adding unrelated subjects."
41895
+ },
41896
+ size: {
41897
+ type: "string",
41898
+ description: "Pixel size or aspect ratio. Common values: 1024x1024, 1:1, 16:9, 9:16.",
41899
+ default: "1024x1024"
41900
+ },
41901
+ resolution: {
41902
+ type: "string",
41903
+ description: "Optional resolution tier for ratio-style sizes, such as 1k, 2k, or 4k."
41904
+ },
41905
+ model: {
41906
+ type: "string",
41907
+ description: "Image model. Defaults to SHANYI_IMAGE_MODEL or gpt-image-2.",
41908
+ default: DEFAULT_MODEL
41909
+ },
41910
+ n: {
41911
+ type: "number",
41912
+ description: "Number of image variants to generate. Defaults to 1.",
41913
+ default: 1
41914
+ },
41915
+ filenameStem: {
41916
+ type: "string",
41917
+ description: "Optional filename stem for saved images."
41918
+ }
41919
+ },
41920
+ required: ["prompt"]
41921
+ },
41922
+ async execute(input, userRequest) {
41923
+ const apiKey = process.env.SHANYI_API_KEY;
41924
+ if (!apiKey) {
41925
+ return "\u56FE\u7247\u751F\u6210\u670D\u52A1\u672A\u914D\u7F6E\uFF1A\u7F3A\u5C11 SHANYI_API_KEY\u3002\u8BF7\u5728 control-plane \u73AF\u5883\u53D8\u91CF\u4E2D\u914D\u7F6E\u540E\u91CD\u542F/\u91CD\u65B0\u6CE8\u5165 runtime\u3002";
41926
+ }
41927
+ const prompt = String(input.prompt ?? "").trim();
41928
+ if (!prompt) return "\u9519\u8BEF\uFF1Aprompt \u4E0D\u80FD\u4E3A\u7A7A";
41929
+ const baseUrl = (process.env.SHANYI_BASE_URL || DEFAULT_BASE_URL).replace(/\/$/, "");
41930
+ const model = String(input.model || process.env.SHANYI_IMAGE_MODEL || DEFAULT_MODEL);
41931
+ const size = String(input.size || "1024x1024");
41932
+ const n = Number.isFinite(Number(input.n)) ? Math.max(1, Math.min(4, Number(input.n))) : 1;
41933
+ const timeoutMs = 18e4;
41934
+ const payload = { model, prompt, n, size };
41935
+ if (input.resolution) payload.resolution = String(input.resolution);
41936
+ const started = Date.now();
41937
+ const generated = await requestImageGeneration(`${baseUrl}/v1/images/generations`, apiKey, payload, timeoutMs);
41938
+ const items = generated.data.data ?? [];
41939
+ if (items.length === 0) {
41940
+ return JSON.stringify({
41941
+ ok: false,
41942
+ error: "image_generation_empty_response",
41943
+ requestId: generated.requestId
41944
+ }, null, 2);
41945
+ }
41946
+ const outDir = import_node_path12.default.join(getEffectiveCwd(userRequest), "imagegen");
41947
+ await (0, import_promises12.mkdir)(outDir, { recursive: true });
41948
+ const stem = sanitizeName(String(input.filenameStem || prompt));
41949
+ const savedFiles = [];
41950
+ for (let index = 0; index < items.length; index++) {
41951
+ const item = items[index];
41952
+ const image = item.url ? await downloadImage(item.url, timeoutMs) : item.b64_json ? decodeBase64Image(item.b64_json) : null;
41953
+ if (!image) continue;
41954
+ const fileName = `${stem}-${index + 1}${image.extension}`;
41955
+ const filePath = import_node_path12.default.join(outDir, fileName);
41956
+ await (0, import_promises12.writeFile)(filePath, image.buffer);
41957
+ savedFiles.push({ filePath, fileName });
41958
+ }
41959
+ return JSON.stringify({
41960
+ ok: savedFiles.length > 0,
41961
+ savedFiles,
41962
+ filePath: savedFiles[0]?.filePath,
41963
+ fileName: savedFiles[0]?.fileName,
41964
+ model,
41965
+ size,
41966
+ resolution: payload.resolution,
41967
+ requestId: generated.requestId,
41968
+ elapsedSeconds: Number(((Date.now() - started) / 1e3).toFixed(3)),
41969
+ nextStep: "Call send_file with filePath and fileName to deliver the generated image."
41970
+ }, null, 2);
41971
+ }
41972
+ };
41973
+
41784
41974
  // src/skill/SkillRegistry.ts
41785
41975
  var import_fs11 = require("fs");
41786
41976
  var import_os3 = require("os");
@@ -41957,7 +42147,7 @@ var getSkillDetail = (skillName) => {
41957
42147
  };
41958
42148
 
41959
42149
  // src/tools/tools/Skill.ts
41960
- var DESCRIPTION15 = `
42150
+ var DESCRIPTION16 = `
41961
42151
  Execute a skill within the main conversation
41962
42152
 
41963
42153
  <skills_instructions>
@@ -41984,7 +42174,7 @@ ${getSkillMeta()}
41984
42174
  `;
41985
42175
  var skillTool = {
41986
42176
  name: `skill`,
41987
- description: DESCRIPTION15,
42177
+ description: DESCRIPTION16,
41988
42178
  input_schema: {
41989
42179
  type: `object`,
41990
42180
  properties: {
@@ -42050,12 +42240,12 @@ var goalCreate = {
42050
42240
  };
42051
42241
 
42052
42242
  // src/tools/tools/tasks/GoalGet.ts
42053
- var DESCRIPTION16 = `
42243
+ var DESCRIPTION17 = `
42054
42244
  \u83B7\u53D6\u4EFB\u52A1\u7CFB\u7EDF\u4E2D\u6307\u5B9A\u7684Goal
42055
42245
  `;
42056
42246
  var goalGet = {
42057
42247
  name: `goal_get`,
42058
- description: DESCRIPTION16,
42248
+ description: DESCRIPTION17,
42059
42249
  input_schema: {
42060
42250
  type: `object`,
42061
42251
  properties: {
@@ -42086,12 +42276,12 @@ var goalGet = {
42086
42276
  };
42087
42277
 
42088
42278
  // src/tools/tools/tasks/GoalList.ts
42089
- var DESCRIPTION17 = `
42279
+ var DESCRIPTION18 = `
42090
42280
  \u5728\u4EFB\u52A1\u7CFB\u7EDF\u4E2D\u5217\u51FA\u6240\u6709\u76EE\u6807
42091
42281
  `;
42092
42282
  var goalList = {
42093
42283
  name: `goal_list`,
42094
- description: DESCRIPTION17,
42284
+ description: DESCRIPTION18,
42095
42285
  input_schema: {
42096
42286
  type: `object`,
42097
42287
  properties: {}
@@ -42106,7 +42296,7 @@ var goalList = {
42106
42296
  };
42107
42297
 
42108
42298
  // src/tools/tools/tasks/GoalUpdate.ts
42109
- var DESCRIPTION18 = `
42299
+ var DESCRIPTION19 = `
42110
42300
  \u66F4\u65B0\u4EFB\u52A1\u7CFB\u7EDF\u4E2D\u6307\u5B9A\u7684Goal
42111
42301
 
42112
42302
  \u5DE5\u5177\u4F7F\u7528\u89C4\u5219:
@@ -42115,7 +42305,7 @@ var DESCRIPTION18 = `
42115
42305
  `;
42116
42306
  var goalUpdate = {
42117
42307
  name: `goal_update`,
42118
- description: DESCRIPTION18,
42308
+ description: DESCRIPTION19,
42119
42309
  input_schema: {
42120
42310
  type: `object`,
42121
42311
  properties: {
@@ -42172,7 +42362,7 @@ var goalUpdate = {
42172
42362
  };
42173
42363
 
42174
42364
  // src/tools/tools/tasks/GoalDelete.ts
42175
- var DESCRIPTION19 = `
42365
+ var DESCRIPTION20 = `
42176
42366
  \u5220\u9664\u4EFB\u52A1\u7CFB\u7EDF\u4E2D\u6307\u5B9A\u7684Goal\u53CA\u5176\u5BF9\u5E94\u7684JSON\u6587\u4EF6
42177
42367
 
42178
42368
  \u5DE5\u5177\u4F7F\u7528\u89C4\u5219:
@@ -42181,7 +42371,7 @@ var DESCRIPTION19 = `
42181
42371
  `;
42182
42372
  var goalDelete = {
42183
42373
  name: `goal_delete`,
42184
- description: DESCRIPTION19,
42374
+ description: DESCRIPTION20,
42185
42375
  input_schema: {
42186
42376
  type: `object`,
42187
42377
  properties: {
@@ -43212,7 +43402,7 @@ var updateMailboxMessageStatus = (messageId, nextStatus, options) => {
43212
43402
  };
43213
43403
 
43214
43404
  // src/tools/tools/department/DepartmentCreate.ts
43215
- var DESCRIPTION20 = `
43405
+ var DESCRIPTION21 = `
43216
43406
  \u521B\u5EFA\u90E8\u95E8\u3002Department \u662F\u516C\u53F8\u7EC4\u7EC7\u4E2D\u7684\u957F\u671F\u804C\u8D23\u5355\u5143\uFF0C\u4E0D\u662F\u4E00\u6B21\u6027\u9879\u76EE\u5C0F\u961F\u3002
43217
43407
 
43218
43408
  \u5DE5\u5177\u8C03\u7528\u89C4\u5219\uFF1A
@@ -43222,7 +43412,7 @@ var DESCRIPTION20 = `
43222
43412
  `;
43223
43413
  var departmentCreate = {
43224
43414
  name: `department_create`,
43225
- description: DESCRIPTION20,
43415
+ description: DESCRIPTION21,
43226
43416
  input_schema: {
43227
43417
  type: `object`,
43228
43418
  properties: {
@@ -43303,7 +43493,7 @@ var getActiveMailboxContext = (actorMailboxId, messageId) => {
43303
43493
  ).get(messageId, actorMailboxId, actorMailboxId);
43304
43494
  return row ?? null;
43305
43495
  };
43306
- var DESCRIPTION21 = `
43496
+ var DESCRIPTION22 = `
43307
43497
  \u5411\u90E8\u95E8\u6210\u5458\u53D1\u9001\u6D88\u606F\u6216\u6307\u4EE4\uFF0C\u662F\u516C\u53F8\u5185\u90E8\u5F02\u6B65\u534F\u4F5C\u901A\u4FE1\u6E20\u9053\u3002
43308
43498
 
43309
43499
  \u9ED8\u8BA4\u7EC4\u7EC7\u6CBB\u7406\uFF1A
@@ -43319,7 +43509,7 @@ var DESCRIPTION21 = `
43319
43509
  `;
43320
43510
  var departmentCommunicate = {
43321
43511
  name: `department_communicate`,
43322
- description: DESCRIPTION21,
43512
+ description: DESCRIPTION22,
43323
43513
  input_schema: {
43324
43514
  type: `object`,
43325
43515
  properties: {
@@ -43428,7 +43618,7 @@ var departmentCommunicate = {
43428
43618
  };
43429
43619
 
43430
43620
  // src/tools/tools/department/DepartmentDelete.ts
43431
- var DESCRIPTION22 = `
43621
+ var DESCRIPTION23 = `
43432
43622
  \u5220\u9664\u90E8\u95E8\u3002
43433
43623
 
43434
43624
  \u5DE5\u5177\u8C03\u7528\u89C4\u5219\uFF1A
@@ -43438,7 +43628,7 @@ var DESCRIPTION22 = `
43438
43628
  `;
43439
43629
  var departmentDelete = {
43440
43630
  name: `department_delete`,
43441
- description: DESCRIPTION22,
43631
+ description: DESCRIPTION23,
43442
43632
  input_schema: {
43443
43633
  type: `object`,
43444
43634
  properties: {
@@ -43478,7 +43668,7 @@ var departmentDelete = {
43478
43668
  };
43479
43669
 
43480
43670
  // src/tools/tools/department/DepartmentList.ts
43481
- var DESCRIPTION23 = `
43671
+ var DESCRIPTION24 = `
43482
43672
  \u5217\u51FA\u6240\u6709\u90E8\u95E8\u3002\u8BE5\u5DE5\u5177\u9762\u5411 CEO\uFF0C\u53EA\u8FD4\u56DE\u90E8\u95E8\u4E0E Department Head \u4FE1\u606F\uFF0C\u4E0D\u66B4\u9732 Executor \u660E\u7EC6\u3002
43483
43673
 
43484
43674
  \u5DE5\u5177\u8C03\u7528\u89C4\u5219\uFF1A
@@ -43487,7 +43677,7 @@ var DESCRIPTION23 = `
43487
43677
  `;
43488
43678
  var departmentList = {
43489
43679
  name: `department_list`,
43490
- description: DESCRIPTION23,
43680
+ description: DESCRIPTION24,
43491
43681
  input_schema: {
43492
43682
  type: `object`,
43493
43683
  properties: {},
@@ -43522,7 +43712,7 @@ var departmentList = {
43522
43712
 
43523
43713
  // src/tools/tools/department/DepartmentMemberCreate.ts
43524
43714
  var import_node_crypto9 = require("node:crypto");
43525
- var DESCRIPTION24 = `
43715
+ var DESCRIPTION25 = `
43526
43716
  \u521B\u5EFA\u90E8\u95E8\u6210\u5458\u3002
43527
43717
 
43528
43718
  \u7BA1\u7406\u6743\u9650\uFF1A
@@ -43532,7 +43722,7 @@ var DESCRIPTION24 = `
43532
43722
  `;
43533
43723
  var departmentMemberCreate = {
43534
43724
  name: `department_member_create`,
43535
- description: DESCRIPTION24,
43725
+ description: DESCRIPTION25,
43536
43726
  input_schema: {
43537
43727
  type: `object`,
43538
43728
  properties: {
@@ -43605,7 +43795,7 @@ var departmentMemberCreate = {
43605
43795
  };
43606
43796
 
43607
43797
  // src/tools/tools/department/DepartmentMemberDelete.ts
43608
- var DESCRIPTION25 = `
43798
+ var DESCRIPTION26 = `
43609
43799
  \u5220\u9664\u90E8\u95E8\u6210\u5458\u3002
43610
43800
 
43611
43801
  \u5DE5\u5177\u8C03\u7528\u89C4\u5219\uFF1A
@@ -43615,7 +43805,7 @@ var DESCRIPTION25 = `
43615
43805
  `;
43616
43806
  var departmentMemberDelete = {
43617
43807
  name: `department_member_delete`,
43618
- description: DESCRIPTION25,
43808
+ description: DESCRIPTION26,
43619
43809
  input_schema: {
43620
43810
  type: `object`,
43621
43811
  properties: {
@@ -43660,7 +43850,7 @@ var departmentMemberDelete = {
43660
43850
  };
43661
43851
 
43662
43852
  // src/tools/tools/department/DepartmentMemberList.ts
43663
- var DESCRIPTION26 = `
43853
+ var DESCRIPTION27 = `
43664
43854
  \u67E5\u770B\u5F53\u524D Department Head \u6240\u5C5E\u90E8\u95E8\u7684\u6210\u5458\u76EE\u5F55\u3002
43665
43855
 
43666
43856
  \u4F7F\u7528\u8FB9\u754C\uFF1A
@@ -43670,7 +43860,7 @@ var DESCRIPTION26 = `
43670
43860
  `;
43671
43861
  var departmentMemberList = {
43672
43862
  name: `department_member_list`,
43673
- description: DESCRIPTION26,
43863
+ description: DESCRIPTION27,
43674
43864
  input_schema: {
43675
43865
  type: `object`,
43676
43866
  properties: {},
@@ -43705,14 +43895,14 @@ var departmentMemberList = {
43705
43895
  };
43706
43896
 
43707
43897
  // src/tools/tools/department/CheckDepartmentReplies.ts
43708
- var DESCRIPTION27 = `
43898
+ var DESCRIPTION28 = `
43709
43899
  \u67E5\u770B Department Head \u6216\u90E8\u95E8\u6210\u5458\u53D1\u7ED9 CEO \u7684\u5DE5\u4F5C\u56DE\u590D\u3002
43710
43900
 
43711
43901
  \u5F53 CEO \u5411 Department Head \u6D3E\u53D1\u4EFB\u52A1\u540E\uFF0C\u5BF9\u65B9\u5B8C\u6210\u5DE5\u4F5C\u4F1A\u901A\u8FC7 mailbox \u56DE\u4FE1\u3002\u4F7F\u7528\u6B64\u5DE5\u5177\u53EF\u4EE5\u67E5\u770B\u672A\u8BFB\u7684\u90E8\u95E8\u56DE\u4FE1\u5185\u5BB9\uFF0C\u4E86\u89E3\u5DE5\u4F5C\u8FDB\u5C55\u548C\u6210\u679C\u3002
43712
43902
  `;
43713
43903
  var checkDepartmentReplies = {
43714
43904
  name: `check_department_replies`,
43715
- description: DESCRIPTION27,
43905
+ description: DESCRIPTION28,
43716
43906
  input_schema: {
43717
43907
  type: `object`,
43718
43908
  properties: {
@@ -43778,12 +43968,12 @@ ${replies}`;
43778
43968
 
43779
43969
  // src/department/learning.ts
43780
43970
  var import_node_fs4 = require("node:fs");
43781
- var import_node_path13 = __toESM(require("node:path"));
43971
+ var import_node_path14 = __toESM(require("node:path"));
43782
43972
  var import_node_crypto10 = require("node:crypto");
43783
43973
 
43784
43974
  // src/skill/SkillValidator.ts
43785
43975
  var import_node_fs3 = require("node:fs");
43786
- var import_node_path12 = __toESM(require("node:path"));
43976
+ var import_node_path13 = __toESM(require("node:path"));
43787
43977
  var SKILL_NAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
43788
43978
  var REQUIRED_SECTIONS = [
43789
43979
  /(^|\n)##\s+(when to use|何时使用|trigger|triggers)\b/i,
@@ -43809,9 +43999,9 @@ var assertSafeSkillTarget = (rootDir, skillName) => {
43809
43999
  if (!isValidSkillName(skillName)) {
43810
44000
  throw new Error(`Invalid skill name "${skillName}". Use lowercase letters, digits, and single hyphens only.`);
43811
44001
  }
43812
- const root = import_node_path12.default.resolve(rootDir);
43813
- const target = import_node_path12.default.resolve(root, skillName);
43814
- if (target !== import_node_path12.default.join(root, skillName) || !target.startsWith(root + import_node_path12.default.sep)) {
44002
+ const root = import_node_path13.default.resolve(rootDir);
44003
+ const target = import_node_path13.default.resolve(root, skillName);
44004
+ if (target !== import_node_path13.default.join(root, skillName) || !target.startsWith(root + import_node_path13.default.sep)) {
43815
44005
  throw new Error(`Invalid skill install target for "${skillName}".`);
43816
44006
  }
43817
44007
  return target;
@@ -43884,12 +44074,12 @@ var validateSkillDocument = (input) => {
43884
44074
  }
43885
44075
  }
43886
44076
  if (input.baseDir) {
43887
- const normalizedBase = import_node_path12.default.resolve(input.baseDir);
44077
+ const normalizedBase = import_node_path13.default.resolve(input.baseDir);
43888
44078
  for (const match2 of parsed.body.matchAll(/\]\(([^)]+)\)/g)) {
43889
44079
  const href = match2[1].trim();
43890
44080
  if (!href || /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith(`#`)) continue;
43891
- const target = import_node_path12.default.resolve(normalizedBase, href.split(`#`)[0]);
43892
- if (!target.startsWith(normalizedBase + import_node_path12.default.sep) && target !== normalizedBase) {
44081
+ const target = import_node_path13.default.resolve(normalizedBase, href.split(`#`)[0]);
44082
+ if (!target.startsWith(normalizedBase + import_node_path13.default.sep) && target !== normalizedBase) {
43893
44083
  addError(errors, `unsafe_reference`, `Relative link "${href}" escapes the skill directory.`);
43894
44084
  } else if (!(0, import_node_fs3.existsSync)(target)) {
43895
44085
  addError(errors, `missing_reference`, `Relative link "${href}" does not exist in the skill directory.`);
@@ -43908,7 +44098,7 @@ var mergeIssues = (target, source) => {
43908
44098
  target.warnings.push(...source.warnings);
43909
44099
  };
43910
44100
  var validateScriptsDirectory = (skillDir, warnings) => {
43911
- const scriptsDir = import_node_path12.default.join(skillDir, `scripts`);
44101
+ const scriptsDir = import_node_path13.default.join(skillDir, `scripts`);
43912
44102
  if (!(0, import_node_fs3.existsSync)(scriptsDir)) return;
43913
44103
  const entries = (0, import_node_fs3.readdirSync)(scriptsDir, { withFileTypes: true }).filter((entry) => entry.isFile());
43914
44104
  if (entries.length === 0) {
@@ -43918,8 +44108,8 @@ var validateScriptsDirectory = (skillDir, warnings) => {
43918
44108
  var validateSkillDirectory = (skillDir, options = {}) => {
43919
44109
  const errors = [];
43920
44110
  const warnings = [];
43921
- const normalizedSkillDir = import_node_path12.default.resolve(skillDir);
43922
- const skillMdPath = import_node_path12.default.join(normalizedSkillDir, `SKILL.md`);
44111
+ const normalizedSkillDir = import_node_path13.default.resolve(skillDir);
44112
+ const skillMdPath = import_node_path13.default.join(normalizedSkillDir, `SKILL.md`);
43923
44113
  if (!(0, import_node_fs3.existsSync)(normalizedSkillDir) || !(0, import_node_fs3.statSync)(normalizedSkillDir).isDirectory()) {
43924
44114
  addError(errors, `missing_skill_dir`, `Skill directory does not exist: ${normalizedSkillDir}`);
43925
44115
  return { ok: false, errors, warnings, skillDir: normalizedSkillDir, skillMdPath };
@@ -43930,7 +44120,7 @@ var validateSkillDirectory = (skillDir, options = {}) => {
43930
44120
  }
43931
44121
  const raw2 = (0, import_node_fs3.readFileSync)(skillMdPath, `utf-8`);
43932
44122
  const documentResult = validateSkillDocument({
43933
- skillName: options.expectedName ?? import_node_path12.default.basename(normalizedSkillDir),
44123
+ skillName: options.expectedName ?? import_node_path13.default.basename(normalizedSkillDir),
43934
44124
  skillMd: raw2,
43935
44125
  baseDir: normalizedSkillDir
43936
44126
  });
@@ -43988,20 +44178,20 @@ var readJsonArray = (filePath) => {
43988
44178
  return JSON.parse((0, import_node_fs4.readFileSync)(filePath, "utf-8"));
43989
44179
  };
43990
44180
  var writeJsonArray = (filePath, records) => {
43991
- ensureDir(import_node_path13.default.dirname(filePath));
44181
+ ensureDir(import_node_path14.default.dirname(filePath));
43992
44182
  (0, import_node_fs4.writeFileSync)(filePath, JSON.stringify(records, null, " "), "utf-8");
43993
44183
  };
43994
44184
  var departmentMemoryPath = (departmentName) => {
43995
- return import_node_path13.default.join(getDepartmentWorkSpaceDir(departmentName), "department-memory.json");
44185
+ return import_node_path14.default.join(getDepartmentWorkSpaceDir(departmentName), "department-memory.json");
43996
44186
  };
43997
44187
  var departmentSkillPath = (departmentName) => {
43998
- return import_node_path13.default.join(getDepartmentWorkSpaceDir(departmentName), "department-skills.json");
44188
+ return import_node_path14.default.join(getDepartmentWorkSpaceDir(departmentName), "department-skills.json");
43999
44189
  };
44000
44190
  var departmentSkillDir = (departmentName, skillName) => {
44001
- return assertSafeSkillTarget(import_node_path13.default.join(getDepartmentWorkSpaceDir(departmentName), "skills"), skillName);
44191
+ return assertSafeSkillTarget(import_node_path14.default.join(getDepartmentWorkSpaceDir(departmentName), "skills"), skillName);
44002
44192
  };
44003
44193
  var proposalsPath = () => {
44004
- return import_node_path13.default.join(getDepartmentBaseDir(), "department-proposals.json");
44194
+ return import_node_path14.default.join(getDepartmentBaseDir(), "department-proposals.json");
44005
44195
  };
44006
44196
  var getDepartmentNameForHead = (request) => {
44007
44197
  const mailboxId = request?.departmentAgentId;
@@ -44099,7 +44289,7 @@ var keepDepartmentSkill = (departmentName, id) => {
44099
44289
  ${formatSkillValidationIssues(validation)}`);
44100
44290
  }
44101
44291
  ensureDir(skillDir);
44102
- (0, import_node_fs4.writeFileSync)(import_node_path13.default.join(skillDir, "SKILL.md"), records[idx].skillMd, "utf-8");
44292
+ (0, import_node_fs4.writeFileSync)(import_node_path14.default.join(skillDir, "SKILL.md"), records[idx].skillMd, "utf-8");
44103
44293
  const smokeTest = smokeTestSkillDirectory(skillDir, { expectedName: records[idx].skillName });
44104
44294
  if (!smokeTest.ok) {
44105
44295
  throw new Error(`[departmentSkill] Skill smoke test \u5931\u8D25\uFF1A
@@ -44361,7 +44551,7 @@ var getCeoNudgeCooldownMs = () => {
44361
44551
  const configured = Number(process.env.CEO_MAILBOX_NUDGE_COOLDOWN_MS ?? DEFAULT_CEO_NUDGE_COOLDOWN_MS);
44362
44552
  return Number.isFinite(configured) && configured >= 0 ? configured : DEFAULT_CEO_NUDGE_COOLDOWN_MS;
44363
44553
  };
44364
- var DESCRIPTION28 = `
44554
+ var DESCRIPTION29 = `
44365
44555
  \u5728\u5F53\u524D mailbox \u7EBF\u7A0B\u4E2D\u8FFD\u52A0\u4E00\u6761\u8865\u5145\u6D88\u606F\uFF0C\u4F46\u4E0D\u7ED3\u675F\u539F\u6D88\u606F\u7684\u5904\u7406\u3002
44366
44556
 
44367
44557
  \u5B83\u5728\u7EC4\u7EC7\u91CC\u7684\u542B\u4E49\u66F4\u63A5\u8FD1\u201C\u540C\u4E00\u4EF6\u4E8B\u7684\u7EE7\u7EED\u6C9F\u901A\u201D\uFF1A\u8BA9\u5BF9\u65B9\u77E5\u9053\u4F60\u5DF2\u7ECF\u5B89\u6392\u3001\u6B63\u5728\u7B49\u8C01\u3001\u50AC\u4E86\u8C01\u3001\u76EE\u524D\u770B\u5230\u4E86\u54EA\u4E9B\u90E8\u5206\u7ED3\u679C\uFF0C\u6216\u9700\u8981\u5BF9\u65B9\u8865\u5145\u4EC0\u4E48\u3002
@@ -44390,7 +44580,7 @@ var looksLikeCeoNudge = (content, kind) => {
44390
44580
  };
44391
44581
  var mailboxFollowup = {
44392
44582
  name: `mailbox_followup`,
44393
- description: DESCRIPTION28,
44583
+ description: DESCRIPTION29,
44394
44584
  input_schema: {
44395
44585
  type: `object`,
44396
44586
  properties: {
@@ -44480,7 +44670,7 @@ var mailboxFollowup = {
44480
44670
  var import_node_child_process = require("node:child_process");
44481
44671
  var import_node_crypto11 = require("node:crypto");
44482
44672
  var import_node_fs5 = require("node:fs");
44483
- var DESCRIPTION29 = `\u5728\u7CFB\u7EDF shell \u4E2D\u6267\u884C\u547D\u4EE4\u3002
44673
+ var DESCRIPTION30 = `\u5728\u7CFB\u7EDF shell \u4E2D\u6267\u884C\u547D\u4EE4\u3002
44484
44674
 
44485
44675
  \u7528\u9014\uFF1A
44486
44676
  - \u8FD0\u884C shell \u547D\u4EE4\uFF08\u5982 ls\u3001mkdir\u3001npm\u3001git\u3001rg \u7B49\uFF09
@@ -44684,7 +44874,7 @@ function waitForClose(session, waitMs) {
44684
44874
  }
44685
44875
  var bashTool = {
44686
44876
  name: `bash`,
44687
- description: DESCRIPTION29,
44877
+ description: DESCRIPTION30,
44688
44878
  input_schema: {
44689
44879
  type: `object`,
44690
44880
  properties: {
@@ -44821,7 +45011,7 @@ var bashTool = {
44821
45011
  };
44822
45012
 
44823
45013
  // src/tools/tools/SendFile.ts
44824
- var DESCRIPTION30 = `
45014
+ var DESCRIPTION31 = `
44825
45015
  \u53D1\u9001\u6587\u4EF6\u7ED9\u7528\u6237\u3002\u652F\u6301\u4E24\u79CD\u65B9\u5F0F\uFF1A
44826
45016
  1. \u672C\u5730\u6587\u4EF6\u8DEF\u5F84\uFF08filePath\uFF09\uFF1A\u9002\u7528\u4E8E\u4F60\u901A\u8FC7 Write \u5DE5\u5177\u751F\u6210\u7684\u6587\u4EF6
44827
45017
  2. \u8FDC\u7A0B URL\uFF08url\uFF09\uFF1A\u9002\u7528\u4E8E\u4ECE\u7F51\u7EDC\u83B7\u53D6\u7684\u6587\u4EF6
@@ -44846,7 +45036,7 @@ var inferFileType = (fileName) => {
44846
45036
  };
44847
45037
  var sendFile = {
44848
45038
  name: `send_file`,
44849
- description: DESCRIPTION30,
45039
+ description: DESCRIPTION31,
44850
45040
  input_schema: {
44851
45041
  type: `object`,
44852
45042
  properties: {
@@ -45076,6 +45266,7 @@ var createDefaultTools = (bg, hookPlugins = []) => {
45076
45266
  registerTool(registry2, webSearchTool);
45077
45267
  registerTool(registry2, webFetchTool);
45078
45268
  registerTool(registry2, imageUnderstand);
45269
+ registerTool(registry2, imageGenerate);
45079
45270
  registerTool(registry2, skillTool);
45080
45271
  registerTool(registry2, goalCreate);
45081
45272
  registerTool(registry2, goalGet);
@@ -45179,7 +45370,7 @@ var searchRecallIndex = async (storage, userId, query, date, limit = 8) => {
45179
45370
  };
45180
45371
 
45181
45372
  // src/tools/tools/RecallChatHistory.ts
45182
- var DESCRIPTION31 = `\u641C\u7D22\u7528\u6237\u7684\u5386\u53F2\u804A\u5929\u8BB0\u5F55\u3001compact \u6458\u8981\u3001dream \u957F\u671F\u8BB0\u5FC6\u548C\u663E\u5F0F\u957F\u671F memory\u3002\u5F53\u7528\u6237\u63D0\u5230\u8FC7\u53BB\u7684\u5BF9\u8BDD\u3001\u4E4B\u524D\u7684\u8BF7\u6C42\u3001\u4E0A\u6B21\u4EFB\u52A1\u3001\u6216\u4F60\u9700\u8981\u56DE\u5FC6\u65E9\u671F\u4EA4\u4E92\u5185\u5BB9\u65F6\u4F7F\u7528\u3002
45373
+ var DESCRIPTION32 = `\u641C\u7D22\u7528\u6237\u7684\u5386\u53F2\u804A\u5929\u8BB0\u5F55\u3001compact \u6458\u8981\u3001dream \u957F\u671F\u8BB0\u5FC6\u548C\u663E\u5F0F\u957F\u671F memory\u3002\u5F53\u7528\u6237\u63D0\u5230\u8FC7\u53BB\u7684\u5BF9\u8BDD\u3001\u4E4B\u524D\u7684\u8BF7\u6C42\u3001\u4E0A\u6B21\u4EFB\u52A1\u3001\u6216\u4F60\u9700\u8981\u56DE\u5FC6\u65E9\u671F\u4EA4\u4E92\u5185\u5BB9\u65F6\u4F7F\u7528\u3002
45183
45374
 
45184
45375
  \u4F7F\u7528\u6307\u5357\uFF1A
45185
45376
  - query \u5FC5\u987B\u5177\u4F53\uFF0C\u5305\u542B\u5173\u952E\u8BCD\uFF08\u5982\u6587\u4EF6\u540D\u3001\u529F\u80FD\u540D\u3001\u4E3B\u9898\u8BCD\uFF09
@@ -45234,7 +45425,7 @@ var formatRecallResult = (result, indexResult) => {
45234
45425
  };
45235
45426
  var recallChatHistory = (messageStorage, topicStorage, recallIndexStorage) => ({
45236
45427
  name: "recall_chat_history",
45237
- description: DESCRIPTION31,
45428
+ description: DESCRIPTION32,
45238
45429
  input_schema: {
45239
45430
  type: "object",
45240
45431
  properties: {
@@ -45543,7 +45734,7 @@ var readDreamHistoryLimit = () => {
45543
45734
  // src/skillForge/SkillForgeEngine.ts
45544
45735
  var import_node_fs6 = require("node:fs");
45545
45736
  var import_node_os2 = require("node:os");
45546
- var import_node_path14 = require("node:path");
45737
+ var import_node_path15 = require("node:path");
45547
45738
  var import_node_crypto12 = require("node:crypto");
45548
45739
  var SkillForgeEngine = class {
45549
45740
  proposalStorage;
@@ -45552,8 +45743,8 @@ var SkillForgeEngine = class {
45552
45743
  constructor(deps) {
45553
45744
  this.proposalStorage = deps.proposalStorage;
45554
45745
  const opt = deps.options ?? {};
45555
- this.draftRoot = opt.draftRoot ?? (0, import_node_path14.join)((0, import_node_os2.homedir)(), ".duclaw", "skill-proposals");
45556
- this.skillsInstallDir = opt.skillsInstallDir ?? (0, import_node_path14.join)((0, import_node_os2.homedir)(), ".agents", "skills");
45746
+ this.draftRoot = opt.draftRoot ?? (0, import_node_path15.join)((0, import_node_os2.homedir)(), ".duclaw", "skill-proposals");
45747
+ this.skillsInstallDir = opt.skillsInstallDir ?? (0, import_node_path15.join)((0, import_node_os2.homedir)(), ".agents", "skills");
45557
45748
  }
45558
45749
  // ---------- 公开方法 ----------
45559
45750
  /**
@@ -45579,9 +45770,9 @@ ${formatSkillValidationIssues(validation)}`);
45579
45770
  return null;
45580
45771
  }
45581
45772
  const id = (0, import_node_crypto12.randomBytes)(4).toString("hex");
45582
- const draftDir = (0, import_node_path14.join)(this.draftRoot, userId, id);
45773
+ const draftDir = (0, import_node_path15.join)(this.draftRoot, userId, id);
45583
45774
  (0, import_node_fs6.mkdirSync)(draftDir, { recursive: true });
45584
- (0, import_node_fs6.writeFileSync)((0, import_node_path14.join)(draftDir, "SKILL.md"), skillMd, "utf-8");
45775
+ (0, import_node_fs6.writeFileSync)((0, import_node_path15.join)(draftDir, "SKILL.md"), skillMd, "utf-8");
45585
45776
  const directoryValidation = validateSkillDirectory(draftDir, { expectedName: skillName });
45586
45777
  if (!directoryValidation.ok) {
45587
45778
  try {
@@ -45680,7 +45871,7 @@ ${formatSkillValidationIssues(smokeTest)}`);
45680
45871
  };
45681
45872
 
45682
45873
  // src/tools/tools/skillforge/SkillForgePropose.ts
45683
- var DESCRIPTION32 = `\u63D0\u4EA4\u4E00\u4E2A"\u6280\u80FD\u8349\u7A3F"\u5230 pending \u5217\u8868\uFF08\u7B49\u5F85\u7528\u6237\u786E\u8BA4\u540E\u843D\u5730\u5230 ~/.agents/skills/\uFF09\u3002
45874
+ var DESCRIPTION33 = `\u63D0\u4EA4\u4E00\u4E2A"\u6280\u80FD\u8349\u7A3F"\u5230 pending \u5217\u8868\uFF08\u7B49\u5F85\u7528\u6237\u786E\u8BA4\u540E\u843D\u5730\u5230 ~/.agents/skills/\uFF09\u3002
45684
45875
 
45685
45876
  \u4F55\u65F6\u8C03\u7528\uFF1A
45686
45877
  \u4F60\u521A\u6210\u529F\u5B8C\u6210\u4E86\u4E00\u4E2A\u590D\u6742\u4EFB\u52A1\uFF08\u901A\u5E38\u5305\u542B 5 \u6B21\u4EE5\u4E0A\u5DE5\u5177\u8C03\u7528\uFF09\uFF0C\u5E76\u4E14\u4F60\u5224\u65AD\u8FD9\u4E2A\u64CD\u4F5C\u6D41\u7A0B\uFF1A
@@ -45716,7 +45907,7 @@ description: <\u4E0E\u53C2\u6570 description \u4E00\u81F4>
45716
45907
  `;
45717
45908
  var skillForgePropose = (engine) => ({
45718
45909
  name: `skill_forge_propose`,
45719
- description: DESCRIPTION32,
45910
+ description: DESCRIPTION33,
45720
45911
  input_schema: {
45721
45912
  type: `object`,
45722
45913
  properties: {
@@ -45758,7 +45949,7 @@ var skillForgePropose = (engine) => ({
45758
45949
  });
45759
45950
 
45760
45951
  // src/tools/tools/skillforge/SkillForgeKeep.ts
45761
- var DESCRIPTION33 = `\u4FDD\u7559\u4E00\u4E2A\u7531 agent \u81EA\u52A8\u521B\u5EFA\u7684\u6280\u80FD\u8349\u7A3F\uFF08\u628A\u8349\u7A3F\u4ECE\u6682\u5B58\u76EE\u5F55\u62F7\u8D1D\u5230 ~/.agents/skills/\uFF0C\u4E0B\u6B21\u7C7B\u4F3C\u4EFB\u52A1\u4F1A\u81EA\u52A8\u590D\u7528\uFF09\u3002
45952
+ var DESCRIPTION34 = `\u4FDD\u7559\u4E00\u4E2A\u7531 agent \u81EA\u52A8\u521B\u5EFA\u7684\u6280\u80FD\u8349\u7A3F\uFF08\u628A\u8349\u7A3F\u4ECE\u6682\u5B58\u76EE\u5F55\u62F7\u8D1D\u5230 ~/.agents/skills/\uFF0C\u4E0B\u6B21\u7C7B\u4F3C\u4EFB\u52A1\u4F1A\u81EA\u52A8\u590D\u7528\uFF09\u3002
45762
45953
  \u4EC5\u5F53\u7528\u6237\u5BF9\u4E00\u4E2A pending \u7684\u6280\u80FD\u8349\u7A3F\u660E\u786E\u8868\u8FBE"\u4FDD\u7559/\u53EF\u4EE5/\u540C\u610F/\u597D\u7684"\u4E4B\u7C7B\u80AF\u5B9A\u610F\u56FE\u65F6\uFF0C\u624D\u8C03\u7528\u672C\u5DE5\u5177\u3002
45763
45954
  \u53C2\u6570 proposalId \u53EF\u9009\uFF1A
45764
45955
  - \u5F53\u524D\u53EA\u6709 1 \u4E2A pending \u8349\u7A3F\u65F6\u53EF\u4E0D\u586B\uFF0C\u5DE5\u5177\u4F1A\u81EA\u52A8\u9009\u4E2D\u90A3\u4E00\u6761\uFF1B
@@ -45779,7 +45970,7 @@ var pickProposal = (pending, hint) => {
45779
45970
  };
45780
45971
  var skillForgeKeep = (engine) => ({
45781
45972
  name: `skill_forge_keep`,
45782
- description: DESCRIPTION33,
45973
+ description: DESCRIPTION34,
45783
45974
  input_schema: {
45784
45975
  type: `object`,
45785
45976
  properties: {
@@ -45811,7 +46002,7 @@ var skillForgeKeep = (engine) => ({
45811
46002
  });
45812
46003
 
45813
46004
  // src/tools/tools/skillforge/SkillForgeDrop.ts
45814
- var DESCRIPTION34 = `\u4E22\u5F03\u4E00\u4E2A pending \u7684\u6280\u80FD\u8349\u7A3F\uFF08\u5220\u9664\u6682\u5B58\u76EE\u5F55\u91CC\u7684 SKILL.md\uFF0C\u4ECE pending \u5217\u8868\u79FB\u9664\uFF09\u3002
46005
+ var DESCRIPTION35 = `\u4E22\u5F03\u4E00\u4E2A pending \u7684\u6280\u80FD\u8349\u7A3F\uFF08\u5220\u9664\u6682\u5B58\u76EE\u5F55\u91CC\u7684 SKILL.md\uFF0C\u4ECE pending \u5217\u8868\u79FB\u9664\uFF09\u3002
45815
46006
  \u4EC5\u5F53\u7528\u6237\u5BF9\u6280\u80FD\u8349\u7A3F\u660E\u786E\u8868\u8FBE"\u4E0D\u7528/\u4E0D\u8981/\u7B97\u4E86/\u4E0D\u4FDD\u7559"\u7B49\u5426\u5B9A\u610F\u56FE\u65F6\u8C03\u7528\u3002
45816
46007
  \u53C2\u6570 proposalId \u53EF\u9009\uFF1A
45817
46008
  - \u5F53\u524D\u53EA\u6709 1 \u4E2A pending \u8349\u7A3F\u65F6\u53EF\u4E0D\u586B\uFF0C\u5DE5\u5177\u4F1A\u81EA\u52A8\u9009\u4E2D\u90A3\u4E00\u6761\uFF1B
@@ -45832,7 +46023,7 @@ var pickProposal2 = (pending, hint) => {
45832
46023
  };
45833
46024
  var skillForgeDrop = (engine) => ({
45834
46025
  name: `skill_forge_drop`,
45835
- description: DESCRIPTION34,
46026
+ description: DESCRIPTION35,
45836
46027
  input_schema: {
45837
46028
  type: `object`,
45838
46029
  properties: {
@@ -45978,7 +46169,7 @@ ${memory.content}`),
45978
46169
  };
45979
46170
 
45980
46171
  // src/tools/tools/memory/MemoryCreate.ts
45981
- var DESCRIPTION35 = `\u628A\u4E00\u6761\u503C\u5F97\u957F\u671F\u8BB0\u4F4F\u7684\u4E8B\u5B9E / \u504F\u597D / \u7EA6\u675F\u5199\u5165\u957F\u671F\u8BB0\u5FC6\uFF0C\u4E4B\u540E\u6BCF\u8F6E\u5BF9\u8BDD\u90FD\u4F1A\u81EA\u52A8\u6CE8\u5165\u7ED9\u4F60\u53C2\u8003\u3002
46172
+ var DESCRIPTION36 = `\u628A\u4E00\u6761\u503C\u5F97\u957F\u671F\u8BB0\u4F4F\u7684\u4E8B\u5B9E / \u504F\u597D / \u7EA6\u675F\u5199\u5165\u957F\u671F\u8BB0\u5FC6\uFF0C\u4E4B\u540E\u6BCF\u8F6E\u5BF9\u8BDD\u90FD\u4F1A\u81EA\u52A8\u6CE8\u5165\u7ED9\u4F60\u53C2\u8003\u3002
45982
46173
 
45983
46174
  \u4F55\u65F6\u8C03\u7528\uFF1A
45984
46175
  1. \u7528\u6237\u660E\u786E\u8BF4"\u8BB0\u4F4F / \u4EE5\u540E\u90FD / \u522B\u518D / \u4ECE\u73B0\u5728\u8D77"\u7B49\u6307\u793A\u6027\u63AA\u8F9E
@@ -45998,7 +46189,7 @@ var DESCRIPTION35 = `\u628A\u4E00\u6761\u503C\u5F97\u957F\u671F\u8BB0\u4F4F\u768
45998
46189
  `;
45999
46190
  var memoryCreate = (engine) => ({
46000
46191
  name: `memory_create`,
46001
- description: DESCRIPTION35,
46192
+ description: DESCRIPTION36,
46002
46193
  input_schema: {
46003
46194
  type: `object`,
46004
46195
  properties: {
@@ -46030,7 +46221,7 @@ var memoryCreate = (engine) => ({
46030
46221
  });
46031
46222
 
46032
46223
  // src/tools/tools/memory/MemoryUpdate.ts
46033
- var DESCRIPTION36 = `\u66F4\u65B0\u4E00\u6761\u5DF2\u5B58\u5728\u7684\u957F\u671F\u8BB0\u5FC6\uFF08\u6309 id \u5B9A\u4F4D\uFF09\u3002
46224
+ var DESCRIPTION37 = `\u66F4\u65B0\u4E00\u6761\u5DF2\u5B58\u5728\u7684\u957F\u671F\u8BB0\u5FC6\uFF08\u6309 id \u5B9A\u4F4D\uFF09\u3002
46034
46225
 
46035
46226
  \u4F55\u65F6\u8C03\u7528\uFF1A
46036
46227
  1. <memory-context> \u91CC\u5DF2\u6709\u7684\u8BB0\u5FC6\u4FE1\u606F\u8FC7\u65F6\u3001\u6709\u504F\u5DEE\u3001\u9700\u8981\u8865\u5145\u7EC6\u8282
@@ -46044,7 +46235,7 @@ var DESCRIPTION36 = `\u66F4\u65B0\u4E00\u6761\u5DF2\u5B58\u5728\u7684\u957F\u671
46044
46235
  `;
46045
46236
  var memoryUpdate = (engine) => ({
46046
46237
  name: `memory_update`,
46047
- description: DESCRIPTION36,
46238
+ description: DESCRIPTION37,
46048
46239
  input_schema: {
46049
46240
  type: `object`,
46050
46241
  properties: {
@@ -46081,7 +46272,7 @@ var memoryUpdate = (engine) => ({
46081
46272
  });
46082
46273
 
46083
46274
  // src/tools/tools/memory/MemoryDelete.ts
46084
- var DESCRIPTION37 = `\u5220\u9664\u4E00\u6761\u957F\u671F\u8BB0\u5FC6\uFF08\u6309 id \u5B9A\u4F4D\uFF09\u3002
46275
+ var DESCRIPTION38 = `\u5220\u9664\u4E00\u6761\u957F\u671F\u8BB0\u5FC6\uFF08\u6309 id \u5B9A\u4F4D\uFF09\u3002
46085
46276
 
46086
46277
  \u4F55\u65F6\u8C03\u7528\uFF1A
46087
46278
  1. \u7528\u6237\u660E\u786E\u8981\u6C42"\u5FD8\u6389 / \u522B\u518D\u8BB0 / \u5220\u6389\u5173\u4E8E X \u7684\u8BB0\u5FC6"
@@ -46094,7 +46285,7 @@ var DESCRIPTION37 = `\u5220\u9664\u4E00\u6761\u957F\u671F\u8BB0\u5FC6\uFF08\u630
46094
46285
  `;
46095
46286
  var memoryDelete = (engine) => ({
46096
46287
  name: `memory_delete`,
46097
- description: DESCRIPTION37,
46288
+ description: DESCRIPTION38,
46098
46289
  input_schema: {
46099
46290
  type: `object`,
46100
46291
  properties: {
@@ -46666,6 +46857,7 @@ ${RUNTIME_PROCESS_SAFETY_PROMPT}
46666
46857
  - \u4EFB\u52A1\u7406\u89E3\u6709\u6B67\u4E49\u65F6\uFF0C\u5148\u786E\u8BA4\u7528\u6237\u7684\u771F\u5B9E\u610F\u56FE
46667
46858
  - \u64CD\u4F5C\u7ED3\u679C\u4F1A\u5F71\u54CD\u5176\u4ED6\u4EBA\u6216\u5916\u90E8\u7CFB\u7EDF\u65F6
46668
46859
  - \u98DE\u4E66/Lark \u6388\u6743\u94FE\u63A5\u5FC5\u987B\u4E3B\u52A8\u8F6C\u53D1\uFF1A\u5F53\u5DE5\u5177\u8F93\u51FA\u3001\u90E8\u95E8\u6210\u5458\u56DE\u590D\u6216\u9519\u8BEF\u4FE1\u606F\u4E2D\u51FA\u73B0\u9700\u8981\u7528\u6237\u5728\u6D4F\u89C8\u5668\u5B8C\u6210\u7684\u98DE\u4E66/Lark \u6388\u6743\u3001\u5E94\u7528\u914D\u7F6E\u3001scope \u5F00\u901A\u3001console_url\u3001authorize_url\u3001auth login URL \u7B49\u94FE\u63A5\u65F6\uFF0C\u5FC5\u987B\u901A\u8FC7 send_message \u628A\u5B8C\u6574 URL \u76F4\u63A5\u53D1\u7ED9\u7528\u6237\uFF0C\u5E76\u660E\u786E\u8BF4\u660E\u9700\u8981\u7528\u6237\u6253\u5F00\u8BE5\u94FE\u63A5\u5B8C\u6210\u6388\u6743\u3002\u4E0D\u8981\u53EA\u8BF4\u201C\u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u6388\u6743\u94FE\u63A5\u201D\u800C\u4E0D\u63D0\u4F9B\u94FE\u63A5\u3002
46860
+ - \u98DE\u4E66/Lark \u4E2A\u4EBA\u8D44\u4EA7\u64CD\u4F5C\u5FC5\u987B\u4FDD\u6301\u8EAB\u4EFD\u4E00\u81F4\uFF1A\u641C\u7D22\u3001\u8BFB\u53D6\u3001\u521B\u5EFA\u3001\u7F16\u8F91\u3001\u4E0A\u4F20\u3001\u5220\u9664\u3001\u79FB\u52A8\u4E91\u6587\u6863/\u8868\u683C/\u4E91\u7A7A\u95F4\u6587\u4EF6/\u5999\u8BB0/\u65E5\u5386/\u4EFB\u52A1\u7B49\u7528\u6237\u4E2A\u4EBA\u8D44\u4EA7\u65F6\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u5F53\u524D\u804A\u5929\u7528\u6237\u7684 user \u8EAB\u4EFD\uFF0C\u4E0D\u8981\u9759\u9ED8\u4F7F\u7528 bot \u8EAB\u4EFD\u3002\u6267\u884C\u524D\u786E\u8BA4\u5C06\u4F7F\u7528 user \u8FD8\u662F bot\uFF1B\u5982\u679C\u7F3A user scope\uFF0C\u5148\u53D1\u8D77 user \u6388\u6743\u5E76\u8F6C\u53D1\u5B8C\u6574\u6388\u6743\u94FE\u63A5\u3002\u53EA\u6709\u7528\u6237\u660E\u786E\u8981\u6C42\u3001\u8D44\u6E90\u672C\u6765\u5C5E\u4E8E bot\u3001\u6216 API \u53EA\u80FD\u7531 bot \u6267\u884C\u65F6\u624D\u7528 bot\uFF1B\u5982\u679C bot \u521B\u5EFA\u4E86\u7528\u6237\u671F\u671B\u957F\u671F\u4F7F\u7528\u7684\u8D44\u4EA7\uFF0C\u5FC5\u987B\u5C1D\u8BD5\u7ED9\u5F53\u524D user \u6388\u4E88\u53EF\u7BA1\u7406\u6743\u9650\uFF0C\u5E76\u5411\u7528\u6237\u8BF4\u660E owner \u4E0E\u6388\u6743\u7ED3\u679C\u3002
46669
46861
  - \u4E0D\u8981\u64C5\u81EA\u505A\u91CD\u5927\u51B3\u5B9A\uFF0C\u5B81\u53EF\u591A\u95EE\u4E00\u53E5\u4E5F\u4E0D\u8981\u9ED8\u9ED8\u6267\u884C\u53EF\u80FD\u51FA\u9519\u7684\u64CD\u4F5C\u3002
46670
46862
  </Communication>
46671
46863
 
@@ -47662,7 +47854,7 @@ var saveResultToFile = (job, cronResp) => {
47662
47854
  };
47663
47855
 
47664
47856
  // src/tools/tools/department/ListMailbox.ts
47665
- var DESCRIPTION38 = `
47857
+ var DESCRIPTION39 = `
47666
47858
  \u67E5\u770B\u4F60\u7684\u90AE\u7BB1\u4E2D\u6240\u6709\u5F85\u5904\u7406\u90AE\u4EF6\u7684\u6458\u8981\u5217\u8868\u3002
47667
47859
 
47668
47860
  \u8FD4\u56DE\u6BCF\u5C01\u90AE\u4EF6\u7684\uFF1Aid\u3001\u53D1\u9001\u8005\u3001\u53D1\u9001\u65F6\u95F4\u3001\u72B6\u6001\u3001\u5185\u5BB9\u6458\u8981\uFF08\u524D100\u5B57\uFF09\u3002
@@ -47678,7 +47870,7 @@ var DESCRIPTION38 = `
47678
47870
  `;
47679
47871
  var listMailbox = {
47680
47872
  name: `list_mailbox`,
47681
- description: DESCRIPTION38,
47873
+ description: DESCRIPTION39,
47682
47874
  input_schema: {
47683
47875
  type: `object`,
47684
47876
  properties: {},
@@ -47735,7 +47927,7 @@ ${list}`;
47735
47927
  };
47736
47928
 
47737
47929
  // src/tools/tools/department/GetMailbox.ts
47738
- var DESCRIPTION39 = `
47930
+ var DESCRIPTION40 = `
47739
47931
  \u83B7\u53D6\u6307\u5B9A\u90AE\u4EF6\u7684\u5B8C\u6574\u5185\u5BB9\u3002
47740
47932
 
47741
47933
  \u5728 list_mailbox \u67E5\u770B\u90AE\u4EF6\u5217\u8868\u540E\uFF0C\u4F7F\u7528\u6B64\u5DE5\u5177\u83B7\u53D6\u4F60\u60F3\u8981\u5904\u7406\u7684\u90AE\u4EF6\u7684\u5B8C\u6574\u5185\u5BB9\u3002
@@ -47778,7 +47970,7 @@ var buildUpstreamContext = (msg) => {
47778
47970
  };
47779
47971
  var getMailbox = {
47780
47972
  name: `get_mailbox`,
47781
- description: DESCRIPTION39,
47973
+ description: DESCRIPTION40,
47782
47974
  input_schema: {
47783
47975
  type: `object`,
47784
47976
  properties: {
@@ -47855,7 +48047,7 @@ ${msg.content}`;
47855
48047
  };
47856
48048
 
47857
48049
  // src/tools/tools/department/DiscardMailbox.ts
47858
- var DESCRIPTION40 = `
48050
+ var DESCRIPTION41 = `
47859
48051
  \u4E22\u5F03\u4E00\u5C01\u65E0\u9700\u5904\u7406\u7684 mailbox \u90AE\u4EF6\uFF0C\u5E76\u5C06\u5B83\u4ECE\u5F85\u5904\u7406\u5217\u8868\u4E2D\u79FB\u9664\u3002
47860
48052
 
47861
48053
  \u9002\u7528\u573A\u666F\uFF1A
@@ -47873,7 +48065,7 @@ var DESCRIPTION40 = `
47873
48065
  `;
47874
48066
  var discardMailbox = {
47875
48067
  name: `discard_mailbox`,
47876
- description: DESCRIPTION40,
48068
+ description: DESCRIPTION41,
47877
48069
  input_schema: {
47878
48070
  type: `object`,
47879
48071
  properties: {
@@ -47955,7 +48147,7 @@ var discardMailbox = {
47955
48147
  };
47956
48148
 
47957
48149
  // src/tools/tools/department/ReplyMailbox.ts
47958
- var DESCRIPTION41 = `
48150
+ var DESCRIPTION42 = `
47959
48151
  \u6B63\u5F0F\u56DE\u590D\u4E00\u5C01\u90AE\u4EF6\u3002\u5BF9\u5F53\u524D\u6D88\u606F\u5F62\u6210\u53EF\u4EE5\u4EA4\u4ED8\u7ED9\u5BF9\u65B9\u7684\u6700\u7EC8\u7ED3\u8BBA\u540E\uFF0C\u4F7F\u7528\u6B64\u5DE5\u5177\u5C06\u7ED3\u679C\u53D1\u56DE\u7ED9\u90AE\u4EF6\u53D1\u9001\u8005\uFF0C\u5E76\u7ED3\u675F\u8FD9\u5C01\u6D88\u606F\u7684\u5904\u7406\u3002
47960
48152
 
47961
48153
  \u5B83\u5728\u7EC4\u7EC7\u91CC\u7684\u542B\u4E49\u66F4\u63A5\u8FD1\u201C\u6211\u5DF2\u7ECF\u628A\u8FD9\u4EF6\u4E8B\u9A8C\u6536\u6E05\u695A\uFF0C\u53EF\u4EE5\u7ED9\u4F60\u4E00\u4E2A\u7ED3\u8BBA\u201D\uFF0C\u800C\u4E0D\u662F\u666E\u901A\u804A\u5929\u56DE\u590D\u3002
@@ -48019,7 +48211,7 @@ var buildUpstreamReminder = (myMailboxId, repliedToMailboxId, threadId, workItem
48019
48211
  };
48020
48212
  var replyMailbox = {
48021
48213
  name: `reply_mailbox`,
48022
- description: DESCRIPTION41,
48214
+ description: DESCRIPTION42,
48023
48215
  input_schema: {
48024
48216
  type: `object`,
48025
48217
  properties: {
@@ -48854,26 +49046,26 @@ var handleParsingNestedValues = (form, key, value) => {
48854
49046
  };
48855
49047
 
48856
49048
  // node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/url.js
48857
- var splitPath = (path21) => {
48858
- const paths = path21.split("/");
49049
+ var splitPath = (path22) => {
49050
+ const paths = path22.split("/");
48859
49051
  if (paths[0] === "") {
48860
49052
  paths.shift();
48861
49053
  }
48862
49054
  return paths;
48863
49055
  };
48864
49056
  var splitRoutingPath = (routePath) => {
48865
- const { groups, path: path21 } = extractGroupsFromPath(routePath);
48866
- const paths = splitPath(path21);
49057
+ const { groups, path: path22 } = extractGroupsFromPath(routePath);
49058
+ const paths = splitPath(path22);
48867
49059
  return replaceGroupMarks(paths, groups);
48868
49060
  };
48869
- var extractGroupsFromPath = (path21) => {
49061
+ var extractGroupsFromPath = (path22) => {
48870
49062
  const groups = [];
48871
- path21 = path21.replace(/\{[^}]+\}/g, (match2, index) => {
49063
+ path22 = path22.replace(/\{[^}]+\}/g, (match2, index) => {
48872
49064
  const mark = `@${index}`;
48873
49065
  groups.push([mark, match2]);
48874
49066
  return mark;
48875
49067
  });
48876
- return { groups, path: path21 };
49068
+ return { groups, path: path22 };
48877
49069
  };
48878
49070
  var replaceGroupMarks = (paths, groups) => {
48879
49071
  for (let i = groups.length - 1; i >= 0; i--) {
@@ -48930,8 +49122,8 @@ var getPath = (request) => {
48930
49122
  const queryIndex = url.indexOf("?", i);
48931
49123
  const hashIndex = url.indexOf("#", i);
48932
49124
  const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);
48933
- const path21 = url.slice(start, end);
48934
- return tryDecodeURI(path21.includes("%25") ? path21.replace(/%25/g, "%2525") : path21);
49125
+ const path22 = url.slice(start, end);
49126
+ return tryDecodeURI(path22.includes("%25") ? path22.replace(/%25/g, "%2525") : path22);
48935
49127
  } else if (charCode === 63 || charCode === 35) {
48936
49128
  break;
48937
49129
  }
@@ -48948,11 +49140,11 @@ var mergePath = (base, sub, ...rest) => {
48948
49140
  }
48949
49141
  return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
48950
49142
  };
48951
- var checkOptionalParameter = (path21) => {
48952
- if (path21.charCodeAt(path21.length - 1) !== 63 || !path21.includes(":")) {
49143
+ var checkOptionalParameter = (path22) => {
49144
+ if (path22.charCodeAt(path22.length - 1) !== 63 || !path22.includes(":")) {
48953
49145
  return null;
48954
49146
  }
48955
- const segments = path21.split("/");
49147
+ const segments = path22.split("/");
48956
49148
  const results = [];
48957
49149
  let basePath = "";
48958
49150
  segments.forEach((segment) => {
@@ -49093,9 +49285,9 @@ var HonoRequest = class {
49093
49285
  */
49094
49286
  path;
49095
49287
  bodyCache = {};
49096
- constructor(request, path21 = "/", matchResult = [[]]) {
49288
+ constructor(request, path22 = "/", matchResult = [[]]) {
49097
49289
  this.raw = request;
49098
- this.path = path21;
49290
+ this.path = path22;
49099
49291
  this.#matchResult = matchResult;
49100
49292
  this.#validatedData = {};
49101
49293
  }
@@ -49832,8 +50024,8 @@ var Hono = class _Hono {
49832
50024
  return this;
49833
50025
  };
49834
50026
  });
49835
- this.on = (method, path21, ...handlers) => {
49836
- for (const p of [path21].flat()) {
50027
+ this.on = (method, path22, ...handlers) => {
50028
+ for (const p of [path22].flat()) {
49837
50029
  this.#path = p;
49838
50030
  for (const m of [method].flat()) {
49839
50031
  handlers.map((handler) => {
@@ -49890,8 +50082,8 @@ var Hono = class _Hono {
49890
50082
  * app.route("/api", app2) // GET /api/user
49891
50083
  * ```
49892
50084
  */
49893
- route(path21, app) {
49894
- const subApp = this.basePath(path21);
50085
+ route(path22, app) {
50086
+ const subApp = this.basePath(path22);
49895
50087
  app.routes.map((r) => {
49896
50088
  let handler;
49897
50089
  if (app.errorHandler === errorHandler) {
@@ -49917,9 +50109,9 @@ var Hono = class _Hono {
49917
50109
  * const api = new Hono().basePath('/api')
49918
50110
  * ```
49919
50111
  */
49920
- basePath(path21) {
50112
+ basePath(path22) {
49921
50113
  const subApp = this.#clone();
49922
- subApp._basePath = mergePath(this._basePath, path21);
50114
+ subApp._basePath = mergePath(this._basePath, path22);
49923
50115
  return subApp;
49924
50116
  }
49925
50117
  /**
@@ -49993,7 +50185,7 @@ var Hono = class _Hono {
49993
50185
  * })
49994
50186
  * ```
49995
50187
  */
49996
- mount(path21, applicationHandler, options) {
50188
+ mount(path22, applicationHandler, options) {
49997
50189
  let replaceRequest;
49998
50190
  let optionHandler;
49999
50191
  if (options) {
@@ -50020,7 +50212,7 @@ var Hono = class _Hono {
50020
50212
  return [c.env, executionContext];
50021
50213
  };
50022
50214
  replaceRequest ||= (() => {
50023
- const mergedPath = mergePath(this._basePath, path21);
50215
+ const mergedPath = mergePath(this._basePath, path22);
50024
50216
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
50025
50217
  return (request) => {
50026
50218
  const url = new URL(request.url);
@@ -50035,14 +50227,14 @@ var Hono = class _Hono {
50035
50227
  }
50036
50228
  await next();
50037
50229
  };
50038
- this.#addRoute(METHOD_NAME_ALL, mergePath(path21, "*"), handler);
50230
+ this.#addRoute(METHOD_NAME_ALL, mergePath(path22, "*"), handler);
50039
50231
  return this;
50040
50232
  }
50041
- #addRoute(method, path21, handler) {
50233
+ #addRoute(method, path22, handler) {
50042
50234
  method = method.toUpperCase();
50043
- path21 = mergePath(this._basePath, path21);
50044
- const r = { basePath: this._basePath, path: path21, method, handler };
50045
- this.router.add(method, path21, [handler, r]);
50235
+ path22 = mergePath(this._basePath, path22);
50236
+ const r = { basePath: this._basePath, path: path22, method, handler };
50237
+ this.router.add(method, path22, [handler, r]);
50046
50238
  this.routes.push(r);
50047
50239
  }
50048
50240
  #handleError(err, c) {
@@ -50055,10 +50247,10 @@ var Hono = class _Hono {
50055
50247
  if (method === "HEAD") {
50056
50248
  return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
50057
50249
  }
50058
- const path21 = this.getPath(request, { env });
50059
- const matchResult = this.router.match(method, path21);
50250
+ const path22 = this.getPath(request, { env });
50251
+ const matchResult = this.router.match(method, path22);
50060
50252
  const c = new Context(request, {
50061
- path: path21,
50253
+ path: path22,
50062
50254
  matchResult,
50063
50255
  env,
50064
50256
  executionCtx,
@@ -50158,15 +50350,15 @@ var Hono = class _Hono {
50158
50350
 
50159
50351
  // node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/matcher.js
50160
50352
  var emptyParam = [];
50161
- function match(method, path21) {
50353
+ function match(method, path22) {
50162
50354
  const matchers = this.buildAllMatchers();
50163
- const match2 = ((method2, path22) => {
50355
+ const match2 = ((method2, path23) => {
50164
50356
  const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
50165
- const staticMatch = matcher[2][path22];
50357
+ const staticMatch = matcher[2][path23];
50166
50358
  if (staticMatch) {
50167
50359
  return staticMatch;
50168
50360
  }
50169
- const match3 = path22.match(matcher[0]);
50361
+ const match3 = path23.match(matcher[0]);
50170
50362
  if (!match3) {
50171
50363
  return [[], emptyParam];
50172
50364
  }
@@ -50174,7 +50366,7 @@ function match(method, path21) {
50174
50366
  return [matcher[1][index], match3];
50175
50367
  });
50176
50368
  this.match = match2;
50177
- return match2(method, path21);
50369
+ return match2(method, path22);
50178
50370
  }
50179
50371
 
50180
50372
  // node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/node.js
@@ -50289,12 +50481,12 @@ var Node = class _Node {
50289
50481
  var Trie = class {
50290
50482
  #context = { varIndex: 0 };
50291
50483
  #root = new Node();
50292
- insert(path21, index, pathErrorCheckOnly) {
50484
+ insert(path22, index, pathErrorCheckOnly) {
50293
50485
  const paramAssoc = [];
50294
50486
  const groups = [];
50295
50487
  for (let i = 0; ; ) {
50296
50488
  let replaced = false;
50297
- path21 = path21.replace(/\{[^}]+\}/g, (m) => {
50489
+ path22 = path22.replace(/\{[^}]+\}/g, (m) => {
50298
50490
  const mark = `@\\${i}`;
50299
50491
  groups[i] = [mark, m];
50300
50492
  i++;
@@ -50305,7 +50497,7 @@ var Trie = class {
50305
50497
  break;
50306
50498
  }
50307
50499
  }
50308
- const tokens = path21.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
50500
+ const tokens = path22.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
50309
50501
  for (let i = groups.length - 1; i >= 0; i--) {
50310
50502
  const [mark] = groups[i];
50311
50503
  for (let j = tokens.length - 1; j >= 0; j--) {
@@ -50344,9 +50536,9 @@ var Trie = class {
50344
50536
  // node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/router.js
50345
50537
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
50346
50538
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
50347
- function buildWildcardRegExp(path21) {
50348
- return wildcardRegExpCache[path21] ??= new RegExp(
50349
- path21 === "*" ? "" : `^${path21.replace(
50539
+ function buildWildcardRegExp(path22) {
50540
+ return wildcardRegExpCache[path22] ??= new RegExp(
50541
+ path22 === "*" ? "" : `^${path22.replace(
50350
50542
  /\/\*$|([.\\+*[^\]$()])/g,
50351
50543
  (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
50352
50544
  )}$`
@@ -50368,17 +50560,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
50368
50560
  );
50369
50561
  const staticMap = /* @__PURE__ */ Object.create(null);
50370
50562
  for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
50371
- const [pathErrorCheckOnly, path21, handlers] = routesWithStaticPathFlag[i];
50563
+ const [pathErrorCheckOnly, path22, handlers] = routesWithStaticPathFlag[i];
50372
50564
  if (pathErrorCheckOnly) {
50373
- staticMap[path21] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
50565
+ staticMap[path22] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
50374
50566
  } else {
50375
50567
  j++;
50376
50568
  }
50377
50569
  let paramAssoc;
50378
50570
  try {
50379
- paramAssoc = trie.insert(path21, j, pathErrorCheckOnly);
50571
+ paramAssoc = trie.insert(path22, j, pathErrorCheckOnly);
50380
50572
  } catch (e) {
50381
- throw e === PATH_ERROR ? new UnsupportedPathError(path21) : e;
50573
+ throw e === PATH_ERROR ? new UnsupportedPathError(path22) : e;
50382
50574
  }
50383
50575
  if (pathErrorCheckOnly) {
50384
50576
  continue;
@@ -50412,12 +50604,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
50412
50604
  }
50413
50605
  return [regexp, handlerMap, staticMap];
50414
50606
  }
50415
- function findMiddleware(middleware, path21) {
50607
+ function findMiddleware(middleware, path22) {
50416
50608
  if (!middleware) {
50417
50609
  return void 0;
50418
50610
  }
50419
50611
  for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
50420
- if (buildWildcardRegExp(k).test(path21)) {
50612
+ if (buildWildcardRegExp(k).test(path22)) {
50421
50613
  return [...middleware[k]];
50422
50614
  }
50423
50615
  }
@@ -50431,7 +50623,7 @@ var RegExpRouter = class {
50431
50623
  this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
50432
50624
  this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
50433
50625
  }
50434
- add(method, path21, handler) {
50626
+ add(method, path22, handler) {
50435
50627
  const middleware = this.#middleware;
50436
50628
  const routes = this.#routes;
50437
50629
  if (!middleware || !routes) {
@@ -50446,18 +50638,18 @@ var RegExpRouter = class {
50446
50638
  });
50447
50639
  });
50448
50640
  }
50449
- if (path21 === "/*") {
50450
- path21 = "*";
50641
+ if (path22 === "/*") {
50642
+ path22 = "*";
50451
50643
  }
50452
- const paramCount = (path21.match(/\/:/g) || []).length;
50453
- if (/\*$/.test(path21)) {
50454
- const re = buildWildcardRegExp(path21);
50644
+ const paramCount = (path22.match(/\/:/g) || []).length;
50645
+ if (/\*$/.test(path22)) {
50646
+ const re = buildWildcardRegExp(path22);
50455
50647
  if (method === METHOD_NAME_ALL) {
50456
50648
  Object.keys(middleware).forEach((m) => {
50457
- middleware[m][path21] ||= findMiddleware(middleware[m], path21) || findMiddleware(middleware[METHOD_NAME_ALL], path21) || [];
50649
+ middleware[m][path22] ||= findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || [];
50458
50650
  });
50459
50651
  } else {
50460
- middleware[method][path21] ||= findMiddleware(middleware[method], path21) || findMiddleware(middleware[METHOD_NAME_ALL], path21) || [];
50652
+ middleware[method][path22] ||= findMiddleware(middleware[method], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || [];
50461
50653
  }
50462
50654
  Object.keys(middleware).forEach((m) => {
50463
50655
  if (method === METHOD_NAME_ALL || method === m) {
@@ -50475,15 +50667,15 @@ var RegExpRouter = class {
50475
50667
  });
50476
50668
  return;
50477
50669
  }
50478
- const paths = checkOptionalParameter(path21) || [path21];
50670
+ const paths = checkOptionalParameter(path22) || [path22];
50479
50671
  for (let i = 0, len = paths.length; i < len; i++) {
50480
- const path22 = paths[i];
50672
+ const path23 = paths[i];
50481
50673
  Object.keys(routes).forEach((m) => {
50482
50674
  if (method === METHOD_NAME_ALL || method === m) {
50483
- routes[m][path22] ||= [
50484
- ...findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || []
50675
+ routes[m][path23] ||= [
50676
+ ...findMiddleware(middleware[m], path23) || findMiddleware(middleware[METHOD_NAME_ALL], path23) || []
50485
50677
  ];
50486
- routes[m][path22].push([handler, paramCount - len + i + 1]);
50678
+ routes[m][path23].push([handler, paramCount - len + i + 1]);
50487
50679
  }
50488
50680
  });
50489
50681
  }
@@ -50502,13 +50694,13 @@ var RegExpRouter = class {
50502
50694
  const routes = [];
50503
50695
  let hasOwnRoute = method === METHOD_NAME_ALL;
50504
50696
  [this.#middleware, this.#routes].forEach((r) => {
50505
- const ownRoute = r[method] ? Object.keys(r[method]).map((path21) => [path21, r[method][path21]]) : [];
50697
+ const ownRoute = r[method] ? Object.keys(r[method]).map((path22) => [path22, r[method][path22]]) : [];
50506
50698
  if (ownRoute.length !== 0) {
50507
50699
  hasOwnRoute ||= true;
50508
50700
  routes.push(...ownRoute);
50509
50701
  } else if (method !== METHOD_NAME_ALL) {
50510
50702
  routes.push(
50511
- ...Object.keys(r[METHOD_NAME_ALL]).map((path21) => [path21, r[METHOD_NAME_ALL][path21]])
50703
+ ...Object.keys(r[METHOD_NAME_ALL]).map((path22) => [path22, r[METHOD_NAME_ALL][path22]])
50512
50704
  );
50513
50705
  }
50514
50706
  });
@@ -50528,13 +50720,13 @@ var SmartRouter = class {
50528
50720
  constructor(init) {
50529
50721
  this.#routers = init.routers;
50530
50722
  }
50531
- add(method, path21, handler) {
50723
+ add(method, path22, handler) {
50532
50724
  if (!this.#routes) {
50533
50725
  throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
50534
50726
  }
50535
- this.#routes.push([method, path21, handler]);
50727
+ this.#routes.push([method, path22, handler]);
50536
50728
  }
50537
- match(method, path21) {
50729
+ match(method, path22) {
50538
50730
  if (!this.#routes) {
50539
50731
  throw new Error("Fatal error");
50540
50732
  }
@@ -50549,7 +50741,7 @@ var SmartRouter = class {
50549
50741
  for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {
50550
50742
  router.add(...routes[i2]);
50551
50743
  }
50552
- res = router.match(method, path21);
50744
+ res = router.match(method, path22);
50553
50745
  } catch (e) {
50554
50746
  if (e instanceof UnsupportedPathError) {
50555
50747
  continue;
@@ -50599,10 +50791,10 @@ var Node2 = class _Node2 {
50599
50791
  }
50600
50792
  this.#patterns = [];
50601
50793
  }
50602
- insert(method, path21, handler) {
50794
+ insert(method, path22, handler) {
50603
50795
  this.#order = ++this.#order;
50604
50796
  let curNode = this;
50605
- const parts = splitRoutingPath(path21);
50797
+ const parts = splitRoutingPath(path22);
50606
50798
  const possibleKeys = [];
50607
50799
  for (let i = 0, len = parts.length; i < len; i++) {
50608
50800
  const p = parts[i];
@@ -50651,12 +50843,12 @@ var Node2 = class _Node2 {
50651
50843
  }
50652
50844
  }
50653
50845
  }
50654
- search(method, path21) {
50846
+ search(method, path22) {
50655
50847
  const handlerSets = [];
50656
50848
  this.#params = emptyParams;
50657
50849
  const curNode = this;
50658
50850
  let curNodes = [curNode];
50659
- const parts = splitPath(path21);
50851
+ const parts = splitPath(path22);
50660
50852
  const curNodesQueue = [];
50661
50853
  const len = parts.length;
50662
50854
  let partOffsets = null;
@@ -50698,13 +50890,13 @@ var Node2 = class _Node2 {
50698
50890
  if (matcher instanceof RegExp) {
50699
50891
  if (partOffsets === null) {
50700
50892
  partOffsets = new Array(len);
50701
- let offset = path21[0] === "/" ? 1 : 0;
50893
+ let offset = path22[0] === "/" ? 1 : 0;
50702
50894
  for (let p = 0; p < len; p++) {
50703
50895
  partOffsets[p] = offset;
50704
50896
  offset += parts[p].length + 1;
50705
50897
  }
50706
50898
  }
50707
- const restPathString = path21.substring(partOffsets[i]);
50899
+ const restPathString = path22.substring(partOffsets[i]);
50708
50900
  const m = matcher.exec(restPathString);
50709
50901
  if (m) {
50710
50902
  params[name] = m[0];
@@ -50757,18 +50949,18 @@ var TrieRouter = class {
50757
50949
  constructor() {
50758
50950
  this.#node = new Node2();
50759
50951
  }
50760
- add(method, path21, handler) {
50761
- const results = checkOptionalParameter(path21);
50952
+ add(method, path22, handler) {
50953
+ const results = checkOptionalParameter(path22);
50762
50954
  if (results) {
50763
50955
  for (let i = 0, len = results.length; i < len; i++) {
50764
50956
  this.#node.insert(method, results[i], handler);
50765
50957
  }
50766
50958
  return;
50767
50959
  }
50768
- this.#node.insert(method, path21, handler);
50960
+ this.#node.insert(method, path22, handler);
50769
50961
  }
50770
- match(method, path21) {
50771
- return this.#node.search(method, path21);
50962
+ match(method, path22) {
50963
+ return this.#node.search(method, path22);
50772
50964
  }
50773
50965
  };
50774
50966
 
@@ -51470,10 +51662,10 @@ var createStreamBody = (stream) => {
51470
51662
  });
51471
51663
  return body;
51472
51664
  };
51473
- var getStats = (path21) => {
51665
+ var getStats = (path22) => {
51474
51666
  let stats;
51475
51667
  try {
51476
- stats = (0, import_fs15.statSync)(path21);
51668
+ stats = (0, import_fs15.statSync)(path22);
51477
51669
  } catch {
51478
51670
  }
51479
51671
  return stats;
@@ -51516,21 +51708,21 @@ var serveStatic = (options = { root: "" }) => {
51516
51708
  return next();
51517
51709
  }
51518
51710
  }
51519
- let path21 = (0, import_path19.join)(
51711
+ let path22 = (0, import_path19.join)(
51520
51712
  root,
51521
51713
  !optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename
51522
51714
  );
51523
- let stats = getStats(path21);
51715
+ let stats = getStats(path22);
51524
51716
  if (stats && stats.isDirectory()) {
51525
51717
  const indexFile = options.index ?? "index.html";
51526
- path21 = (0, import_path19.join)(path21, indexFile);
51527
- stats = getStats(path21);
51718
+ path22 = (0, import_path19.join)(path22, indexFile);
51719
+ stats = getStats(path22);
51528
51720
  }
51529
51721
  if (!stats) {
51530
- await options.onNotFound?.(path21, c);
51722
+ await options.onNotFound?.(path22, c);
51531
51723
  return next();
51532
51724
  }
51533
- const mimeType = getMimeType(path21);
51725
+ const mimeType = getMimeType(path22);
51534
51726
  c.header("Content-Type", mimeType || "application/octet-stream");
51535
51727
  if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
51536
51728
  const acceptEncodingSet = new Set(
@@ -51540,12 +51732,12 @@ var serveStatic = (options = { root: "" }) => {
51540
51732
  if (!acceptEncodingSet.has(encoding)) {
51541
51733
  continue;
51542
51734
  }
51543
- const precompressedStats = getStats(path21 + ENCODINGS[encoding]);
51735
+ const precompressedStats = getStats(path22 + ENCODINGS[encoding]);
51544
51736
  if (precompressedStats) {
51545
51737
  c.header("Content-Encoding", encoding);
51546
51738
  c.header("Vary", "Accept-Encoding", { append: true });
51547
51739
  stats = precompressedStats;
51548
- path21 = path21 + ENCODINGS[encoding];
51740
+ path22 = path22 + ENCODINGS[encoding];
51549
51741
  break;
51550
51742
  }
51551
51743
  }
@@ -51559,7 +51751,7 @@ var serveStatic = (options = { root: "" }) => {
51559
51751
  result = c.body(null);
51560
51752
  } else if (!range) {
51561
51753
  c.header("Content-Length", size.toString());
51562
- result = c.body(createStreamBody((0, import_fs15.createReadStream)(path21)), 200);
51754
+ result = c.body(createStreamBody((0, import_fs15.createReadStream)(path22)), 200);
51563
51755
  } else {
51564
51756
  c.header("Accept-Ranges", "bytes");
51565
51757
  c.header("Date", stats.birthtime.toUTCString());
@@ -51570,12 +51762,12 @@ var serveStatic = (options = { root: "" }) => {
51570
51762
  end = size - 1;
51571
51763
  }
51572
51764
  const chunksize = end - start + 1;
51573
- const stream = (0, import_fs15.createReadStream)(path21, { start, end });
51765
+ const stream = (0, import_fs15.createReadStream)(path22, { start, end });
51574
51766
  c.header("Content-Length", chunksize.toString());
51575
51767
  c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
51576
51768
  result = c.body(createStreamBody(stream), 206);
51577
51769
  }
51578
- await options.onFound?.(path21, c);
51770
+ await options.onFound?.(path22, c);
51579
51771
  return result;
51580
51772
  };
51581
51773
  };
@@ -51669,8 +51861,8 @@ var cors = (options) => {
51669
51861
  };
51670
51862
 
51671
51863
  // src/server/index.ts
51672
- var import_promises13 = require("node:fs/promises");
51673
- var import_node_path18 = __toESM(require("node:path"));
51864
+ var import_promises14 = require("node:fs/promises");
51865
+ var import_node_path19 = __toESM(require("node:path"));
51674
51866
 
51675
51867
  // src/git/worktree.ts
51676
51868
  var import_child_process2 = require("child_process");
@@ -53016,7 +53208,7 @@ mailboxRoutes.get("/mailbox/summary", (c) => {
53016
53208
  // src/server/routes/memory.ts
53017
53209
  var import_redis4 = __toESM(require_dist2());
53018
53210
  var import_node_fs8 = require("node:fs");
53019
- var import_node_path15 = __toESM(require("node:path"));
53211
+ var import_node_path16 = __toESM(require("node:path"));
53020
53212
  var memoryEngineSingleton = null;
53021
53213
  var dreamStorageSingleton = null;
53022
53214
  var dreamHistoryStorageSingleton = null;
@@ -53121,7 +53313,7 @@ var readJsonFilesFromDir = (dir) => {
53121
53313
  for (const file of (0, import_node_fs8.readdirSync)(dir)) {
53122
53314
  if (!file.endsWith(".json")) continue;
53123
53315
  try {
53124
- result.push(JSON.parse((0, import_node_fs8.readFileSync)(import_node_path15.default.join(dir, file), "utf-8")));
53316
+ result.push(JSON.parse((0, import_node_fs8.readFileSync)(import_node_path16.default.join(dir, file), "utf-8")));
53125
53317
  } catch (err) {
53126
53318
  console.warn(`[memoryRoutes] \u8DF3\u8FC7\u65E0\u6CD5\u89E3\u6790\u7684\u672C\u5730\u4E0A\u4E0B\u6587\u6587\u4EF6 ${file}: ${err.message}`);
53127
53319
  }
@@ -53129,11 +53321,11 @@ var readJsonFilesFromDir = (dir) => {
53129
53321
  return result;
53130
53322
  };
53131
53323
  var extractFileBackedStorageKeysForTest = (dataDir) => {
53132
- const kvRoot = import_node_path15.default.join(dataDir, "kv");
53324
+ const kvRoot = import_node_path16.default.join(dataDir, "kv");
53133
53325
  if (!(0, import_node_fs8.existsSync)(kvRoot)) return [];
53134
53326
  const keys = [];
53135
53327
  for (const prefixDir of (0, import_node_fs8.readdirSync)(kvRoot)) {
53136
- const absolutePrefixDir = import_node_path15.default.join(kvRoot, prefixDir);
53328
+ const absolutePrefixDir = import_node_path16.default.join(kvRoot, prefixDir);
53137
53329
  if (!(0, import_node_fs8.existsSync)(absolutePrefixDir)) continue;
53138
53330
  for (const file of (0, import_node_fs8.readdirSync)(absolutePrefixDir)) {
53139
53331
  if (!file.endsWith(".json")) continue;
@@ -53153,12 +53345,12 @@ var collectLocalConversationUserIds = () => {
53153
53345
  };
53154
53346
  var extractLocalConversationUserIdsForTest = (homeDir) => {
53155
53347
  const userIds = /* @__PURE__ */ new Set();
53156
- for (const context of readJsonFilesFromDir(import_node_path15.default.join(homeDir, "goal-context"))) {
53348
+ for (const context of readJsonFilesFromDir(import_node_path16.default.join(homeDir, "goal-context"))) {
53157
53349
  addPlausibleUserId(userIds, context.threadId);
53158
53350
  addPlausibleUserId(userIds, context.originUserId);
53159
53351
  if (context.goalId) addPlausibleUserId(userIds, `kanban:goal:${context.goalId}`);
53160
53352
  }
53161
- for (const goal of readJsonFilesFromDir(import_node_path15.default.join(homeDir, "tasks"))) {
53353
+ for (const goal of readJsonFilesFromDir(import_node_path16.default.join(homeDir, "tasks"))) {
53162
53354
  if (goal.id) addPlausibleUserId(userIds, `kanban:goal:${goal.id}`);
53163
53355
  }
53164
53356
  return userIds;
@@ -53575,7 +53767,7 @@ ${item.dreamContent}` : item.dreamContent).join("\n\n");
53575
53767
  });
53576
53768
 
53577
53769
  // src/server/routes/tools.ts
53578
- var import_node_path16 = __toESM(require("node:path"));
53770
+ var import_node_path17 = __toESM(require("node:path"));
53579
53771
  var toolRoutes = new Hono2();
53580
53772
  var listActiveDepartmentSkills = () => {
53581
53773
  return listDepartments().flatMap(
@@ -53586,7 +53778,7 @@ var listActiveDepartmentSkills = () => {
53586
53778
  scope: "department",
53587
53779
  departmentName: department.name,
53588
53780
  detail: () => {
53589
- const skillDir = import_node_path16.default.join(getDepartmentWorkSpaceDir(department.name), "skills", skill.skillName);
53781
+ const skillDir = import_node_path17.default.join(getDepartmentWorkSpaceDir(department.name), "skills", skill.skillName);
53590
53782
  return `Base directory for this skill: ${skillDir}
53591
53783
 
53592
53784
  ${skill.skillMd}`;
@@ -53675,7 +53867,7 @@ var systemRoutes = new Hono2();
53675
53867
  var startTime = Date.now();
53676
53868
  systemRoutes.get("/system/info", (c) => {
53677
53869
  return c.json({
53678
- version: true ? "1.9.11" : "unknown",
53870
+ version: true ? "1.9.12" : "unknown",
53679
53871
  uptime: Math.floor((Date.now() - startTime) / 1e3),
53680
53872
  env: process.env.NODE_ENV || "development",
53681
53873
  nodeVersion: process.version
@@ -53684,8 +53876,8 @@ systemRoutes.get("/system/info", (c) => {
53684
53876
 
53685
53877
  // src/server/routes/mobile.ts
53686
53878
  var import_node_crypto16 = require("node:crypto");
53687
- var import_promises12 = require("node:fs/promises");
53688
- var import_node_path17 = __toESM(require("node:path"));
53879
+ var import_promises13 = require("node:fs/promises");
53880
+ var import_node_path18 = __toESM(require("node:path"));
53689
53881
  var mobileRoutes = new Hono2();
53690
53882
  var resolveMobileUserId = (body, headerUserId) => {
53691
53883
  return body.userId?.trim() || headerUserId?.trim() || "ios:local-user";
@@ -53727,12 +53919,12 @@ ${goal.tasks.map((task) => `- [${task.status}] ${task.subject}`).join("\n")}` :
53727
53919
  return lines.join("\n");
53728
53920
  };
53729
53921
  var sanitizeFileName = (fileName) => {
53730
- const cleaned = import_node_path17.default.basename(fileName).replace(/[^\w.\-()\u4e00-\u9fa5 ]+/g, "_").trim();
53922
+ const cleaned = import_node_path18.default.basename(fileName).replace(/[^\w.\-()\u4e00-\u9fa5 ]+/g, "_").trim();
53731
53923
  return cleaned || `attachment-${Date.now()}`;
53732
53924
  };
53733
53925
  var inferAttachmentType2 = (mimeType = "", fileName = "") => {
53734
53926
  if (mimeType.startsWith("image/")) return "image";
53735
- const ext = import_node_path17.default.extname(fileName).toLowerCase();
53927
+ const ext = import_node_path18.default.extname(fileName).toLowerCase();
53736
53928
  if ([".png", ".jpg", ".jpeg", ".gif", ".webp"].includes(ext)) return "image";
53737
53929
  return "file";
53738
53930
  };
@@ -53789,10 +53981,10 @@ mobileRoutes.post("/mobile/attachments", async (c) => {
53789
53981
  const type = inferAttachmentType2(mimeType, fileName);
53790
53982
  const attachmentId = (0, import_node_crypto16.randomUUID)();
53791
53983
  const buffer = Buffer.from(dataBase64, "base64");
53792
- const dir = import_node_path17.default.join(getDuclawWorkspaceDir(), mobileUserId, "mobile", type === "image" ? "images" : "files");
53793
- await (0, import_promises12.mkdir)(dir, { recursive: true });
53794
- const localPath = import_node_path17.default.join(dir, `${attachmentId}-${fileName}`);
53795
- await (0, import_promises12.writeFile)(localPath, buffer);
53984
+ const dir = import_node_path18.default.join(getDuclawWorkspaceDir(), mobileUserId, "mobile", type === "image" ? "images" : "files");
53985
+ await (0, import_promises13.mkdir)(dir, { recursive: true });
53986
+ const localPath = import_node_path18.default.join(dir, `${attachmentId}-${fileName}`);
53987
+ await (0, import_promises13.writeFile)(localPath, buffer);
53796
53988
  const attachment = saveMobileAttachment({
53797
53989
  id: attachmentId,
53798
53990
  type,
@@ -54010,7 +54202,7 @@ function createServer() {
54010
54202
  app.route("/api", mobileRoutes);
54011
54203
  app.use("/*", serveStatic({ root: webDistRoot }));
54012
54204
  app.get("/*", async (c) => {
54013
- const indexHtml = await (0, import_promises13.readFile)(import_node_path18.default.join(webDistRoot, "index.html"), "utf8");
54205
+ const indexHtml = await (0, import_promises14.readFile)(import_node_path19.default.join(webDistRoot, "index.html"), "utf8");
54014
54206
  const tenantId = c.req.header("x-tenant-id");
54015
54207
  const assetBase = tenantId ? `/t/${tenantId}` : "";
54016
54208
  const html = indexHtml.replaceAll('"./', `"${assetBase}/`);
@@ -54038,9 +54230,9 @@ function shouldStartCoreChannelGateways(env = process.env) {
54038
54230
 
54039
54231
  // src/runtime/saasAssets.ts
54040
54232
  var import_node_fs9 = require("node:fs");
54041
- var import_promises14 = require("node:fs/promises");
54233
+ var import_promises15 = require("node:fs/promises");
54042
54234
  var import_node_os3 = require("node:os");
54043
- var import_node_path19 = __toESM(require("node:path"));
54235
+ var import_node_path20 = __toESM(require("node:path"));
54044
54236
  var MAX_CONTEXT_ASSETS = Number(process.env.DUCLAW_SAAS_ASSET_CONTEXT_LIMIT ?? 1e3);
54045
54237
  var MAX_SKILL_ASSETS = Number(process.env.DUCLAW_SAAS_ASSET_SKILL_LIMIT ?? 200);
54046
54238
  async function restoreSaasRuntimeAssets(reason) {
@@ -54071,8 +54263,8 @@ async function restoreContextAsset(context, overwrite) {
54071
54263
  const target = contextPathForSourceKey(context.sourceKey);
54072
54264
  if (!target) return false;
54073
54265
  if (!overwrite && (0, import_node_fs9.existsSync)(target)) return false;
54074
- await (0, import_promises14.mkdir)(import_node_path19.default.dirname(target), { recursive: true });
54075
- await (0, import_promises14.writeFile)(target, JSON.stringify(context.payload), "utf8");
54266
+ await (0, import_promises15.mkdir)(import_node_path20.default.dirname(target), { recursive: true });
54267
+ await (0, import_promises15.writeFile)(target, JSON.stringify(context.payload), "utf8");
54076
54268
  return true;
54077
54269
  }
54078
54270
  async function restoreSkillAsset(skill, overwrite) {
@@ -54080,8 +54272,8 @@ async function restoreSkillAsset(skill, overwrite) {
54080
54272
  const target = safeSkillTargetPath(skill.sourcePath, skill.skillName);
54081
54273
  if (!target) return false;
54082
54274
  if (!overwrite && (0, import_node_fs9.existsSync)(target)) return false;
54083
- await (0, import_promises14.mkdir)(import_node_path19.default.dirname(target), { recursive: true });
54084
- await (0, import_promises14.writeFile)(target, skill.skillMd, "utf8");
54275
+ await (0, import_promises15.mkdir)(import_node_path20.default.dirname(target), { recursive: true });
54276
+ await (0, import_promises15.writeFile)(target, skill.skillMd, "utf8");
54085
54277
  return true;
54086
54278
  }
54087
54279
  function runtimeAssetClient() {
@@ -54113,30 +54305,30 @@ function runtimeAssetClient() {
54113
54305
  function contextPathForSourceKey(sourceKey) {
54114
54306
  if (sourceKey.startsWith("agent:")) {
54115
54307
  const logicalKey = sourceKey.slice("agent:".length);
54116
- return import_node_path19.default.join(getDuclawDataDir(), "kv", "agent", `${Buffer.from(logicalKey).toString("base64url")}.json`);
54308
+ return import_node_path20.default.join(getDuclawDataDir(), "kv", "agent", `${Buffer.from(logicalKey).toString("base64url")}.json`);
54117
54309
  }
54118
54310
  if (sourceKey.startsWith("goal-context:")) {
54119
- return import_node_path19.default.join(getDuclawHomeDir(), "goal-context", `${sourceKey.slice("goal-context:".length)}.json`);
54311
+ return import_node_path20.default.join(getDuclawHomeDir(), "goal-context", `${sourceKey.slice("goal-context:".length)}.json`);
54120
54312
  }
54121
54313
  if (sourceKey.startsWith("tasks:")) {
54122
- return import_node_path19.default.join(getDuclawHomeDir(), "tasks", `${sourceKey.slice("tasks:".length)}.json`);
54314
+ return import_node_path20.default.join(getDuclawHomeDir(), "tasks", `${sourceKey.slice("tasks:".length)}.json`);
54123
54315
  }
54124
54316
  return null;
54125
54317
  }
54126
54318
  function safeSkillTargetPath(sourcePath, skillName) {
54127
- const allowedRoots = skillRoots().map((root) => import_node_path19.default.resolve(root));
54128
- const normalized = import_node_path19.default.resolve(sourcePath);
54129
- if (allowedRoots.some((root) => normalized === import_node_path19.default.join(root, import_node_path19.default.basename(import_node_path19.default.dirname(normalized)), "SKILL.md"))) {
54319
+ const allowedRoots = skillRoots().map((root) => import_node_path20.default.resolve(root));
54320
+ const normalized = import_node_path20.default.resolve(sourcePath);
54321
+ if (allowedRoots.some((root) => normalized === import_node_path20.default.join(root, import_node_path20.default.basename(import_node_path20.default.dirname(normalized)), "SKILL.md"))) {
54130
54322
  return normalized;
54131
54323
  }
54132
54324
  const safeName = skillName.replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 120) || "imported-skill";
54133
- return import_node_path19.default.join("/home/user/app/skills", safeName, "SKILL.md");
54325
+ return import_node_path20.default.join("/home/user/app/skills", safeName, "SKILL.md");
54134
54326
  }
54135
54327
  function skillRoots() {
54136
54328
  return [
54137
54329
  "/home/user/app/skills",
54138
- import_node_path19.default.join(getDuclawHomeDir(), "skills"),
54139
- import_node_path19.default.join((0, import_node_os3.homedir)(), ".agents", "skills")
54330
+ import_node_path20.default.join(getDuclawHomeDir(), "skills"),
54331
+ import_node_path20.default.join((0, import_node_os3.homedir)(), ".agents", "skills")
54140
54332
  ];
54141
54333
  }
54142
54334