duclaw-cli 1.9.11 → 1.9.13
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 +609 -413
- package/dist/main.js +1 -1
- package/dist/worker-main.js +1 -1
- package/package.json +1 -1
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
|
|
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 =
|
|
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] === "~" ?
|
|
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 =
|
|
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
|
|
317
|
+
for (const path23 of optionPaths) {
|
|
318
318
|
try {
|
|
319
|
-
const parsed = DotenvModule.parse(fs3.readFileSync(
|
|
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 ${
|
|
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 =
|
|
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,
|
|
8241
|
-
parser.push("MODULE", "LOAD",
|
|
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,
|
|
23542
|
+
parseCommand(parser, key, path22, json, ...jsons) {
|
|
23543
23543
|
parser.push("JSON.ARRAPPEND");
|
|
23544
23544
|
parser.pushKey(key);
|
|
23545
|
-
parser.push(
|
|
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,
|
|
23575
|
+
parseCommand(parser, key, path22, json, options) {
|
|
23576
23576
|
parser.push("JSON.ARRINDEX");
|
|
23577
23577
|
parser.pushKey(key);
|
|
23578
|
-
parser.push(
|
|
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,
|
|
23610
|
+
parseCommand(parser, key, path22, index, json, ...jsons) {
|
|
23611
23611
|
parser.push("JSON.ARRINSERT");
|
|
23612
23612
|
parser.pushKey(key);
|
|
23613
|
-
parser.push(
|
|
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,
|
|
23703
|
+
parseCommand(parser, key, path22, start, stop) {
|
|
23704
23704
|
parser.push("JSON.ARRTRIM");
|
|
23705
23705
|
parser.pushKey(key);
|
|
23706
|
-
parser.push(
|
|
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,
|
|
23871
|
+
parseCommand(parser, key, path22, value) {
|
|
23872
23872
|
parser.push("JSON.MERGE");
|
|
23873
23873
|
parser.pushKey(key);
|
|
23874
|
-
parser.push(
|
|
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,
|
|
23897
|
+
parseCommand(parser, keys, path22) {
|
|
23898
23898
|
parser.push("JSON.MGET");
|
|
23899
23899
|
parser.pushKeys(keys);
|
|
23900
|
-
parser.push(
|
|
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,
|
|
23955
|
+
parseCommand(parser, key, path22, by) {
|
|
23956
23956
|
parser.push("JSON.NUMINCRBY");
|
|
23957
23957
|
parser.pushKey(key);
|
|
23958
|
-
parser.push(
|
|
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,
|
|
23990
|
+
parseCommand(parser, key, path22, by) {
|
|
23991
23991
|
parser.push("JSON.NUMMULTBY");
|
|
23992
23992
|
parser.pushKey(key);
|
|
23993
|
-
parser.push(
|
|
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,
|
|
24077
|
+
parseCommand(parser, key, path22, json, options) {
|
|
24078
24078
|
parser.push("JSON.SET");
|
|
24079
24079
|
parser.pushKey(key);
|
|
24080
|
-
parser.push(
|
|
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,
|
|
24168
|
+
parseCommand(parser, key, path22) {
|
|
24169
24169
|
parser.push("JSON.TOGGLE");
|
|
24170
24170
|
parser.pushKey(key);
|
|
24171
|
-
parser.push(
|
|
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.
|
|
30245
|
+
console.log(`duclaw-cli v${true ? "1.9.13" : "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 = (
|
|
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:
|
|
31662
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
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(
|
|
31702
|
+
async _exploreDir(path22, depth) {
|
|
31703
31703
|
let files;
|
|
31704
31704
|
try {
|
|
31705
|
-
files = await (0, import_promises3.readdir)(
|
|
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:
|
|
31709
|
+
return { files, depth, path: path22 };
|
|
31710
31710
|
}
|
|
31711
|
-
async _formatEntry(dirent,
|
|
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)(
|
|
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(
|
|
32115
|
+
function createFsWatchInstance(path22, options, listener, errHandler, emitRaw) {
|
|
32116
32116
|
const handleEvent = (rawEvent, evPath) => {
|
|
32117
|
-
listener(
|
|
32118
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
32119
|
-
if (evPath &&
|
|
32120
|
-
fsWatchBroadcast(sp.resolve(
|
|
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)(
|
|
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 = (
|
|
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(
|
|
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
|
-
|
|
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)(
|
|
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 = (
|
|
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(
|
|
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(
|
|
32254
|
+
_watchWithNodeFs(path22, listener) {
|
|
32255
32255
|
const opts = this.fsw.options;
|
|
32256
|
-
const directory = sp.dirname(
|
|
32257
|
-
const basename4 = sp.basename(
|
|
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(
|
|
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(
|
|
32270
|
+
closer = setFsWatchFileListener(path22, absolutePath, options, {
|
|
32271
32271
|
listener,
|
|
32272
32272
|
rawEmitter: this.fsw._emitRaw
|
|
32273
32273
|
});
|
|
32274
32274
|
} else {
|
|
32275
|
-
closer = setFsWatchListener(
|
|
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 (
|
|
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(
|
|
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(
|
|
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,
|
|
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)(
|
|
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,
|
|
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,
|
|
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
|
|
32402
|
+
let path22 = sp.join(directory, item);
|
|
32403
32403
|
current.add(item);
|
|
32404
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
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
|
-
|
|
32414
|
-
this._addToNodeFs(
|
|
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(
|
|
32483
|
+
async _addToNodeFs(path22, initialAdd, priorWh, depth, target) {
|
|
32484
32484
|
const ready = this.fsw._emitReady;
|
|
32485
|
-
if (this.fsw._isIgnored(
|
|
32485
|
+
if (this.fsw._isIgnored(path22) || this.fsw.closed) {
|
|
32486
32486
|
ready();
|
|
32487
32487
|
return false;
|
|
32488
32488
|
}
|
|
32489
|
-
const wh = this.fsw._getWatchHelpers(
|
|
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(
|
|
32506
|
-
const targetPath = follow ? await (0, import_promises4.realpath)(
|
|
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)(
|
|
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,
|
|
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(
|
|
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(
|
|
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
|
|
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(
|
|
32582
|
-
if (typeof
|
|
32581
|
+
function normalizePath(path22) {
|
|
32582
|
+
if (typeof path22 !== "string")
|
|
32583
32583
|
throw new Error("string expected");
|
|
32584
|
-
|
|
32585
|
-
|
|
32584
|
+
path22 = sp2.normalize(path22);
|
|
32585
|
+
path22 = path22.replace(/\\/g, "/");
|
|
32586
32586
|
let prepend = false;
|
|
32587
|
-
if (
|
|
32587
|
+
if (path22.startsWith("//"))
|
|
32588
32588
|
prepend = true;
|
|
32589
|
-
|
|
32589
|
+
path22 = path22.replace(DOUBLE_SLASH_RE, "/");
|
|
32590
32590
|
if (prepend)
|
|
32591
|
-
|
|
32592
|
-
return
|
|
32591
|
+
path22 = "/" + path22;
|
|
32592
|
+
return path22;
|
|
32593
32593
|
}
|
|
32594
32594
|
function matchPatterns(patterns, testString, stats) {
|
|
32595
|
-
const
|
|
32595
|
+
const path22 = normalizePath(testString);
|
|
32596
32596
|
for (let index = 0; index < patterns.length; index++) {
|
|
32597
32597
|
const pattern = patterns[index];
|
|
32598
|
-
if (pattern(
|
|
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 = (
|
|
32637
|
-
var normalizeIgnored = (cwd = "") => (
|
|
32638
|
-
if (typeof
|
|
32639
|
-
return normalizePathToUnix(sp2.isAbsolute(
|
|
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
|
|
32641
|
+
return path22;
|
|
32642
32642
|
}
|
|
32643
32643
|
};
|
|
32644
|
-
var getAbsolutePath = (
|
|
32645
|
-
if (sp2.isAbsolute(
|
|
32646
|
-
return
|
|
32644
|
+
var getAbsolutePath = (path22, cwd) => {
|
|
32645
|
+
if (sp2.isAbsolute(path22)) {
|
|
32646
|
+
return path22;
|
|
32647
32647
|
}
|
|
32648
|
-
return sp2.join(cwd,
|
|
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(
|
|
32713
|
+
constructor(path22, follow, fsw) {
|
|
32714
32714
|
this.fsw = fsw;
|
|
32715
|
-
const watchPath =
|
|
32716
|
-
this.path =
|
|
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((
|
|
32857
|
-
const absPath = getAbsolutePath(
|
|
32856
|
+
paths = paths.map((path22) => {
|
|
32857
|
+
const absPath = getAbsolutePath(path22, cwd);
|
|
32858
32858
|
return absPath;
|
|
32859
32859
|
});
|
|
32860
32860
|
}
|
|
32861
|
-
paths.forEach((
|
|
32862
|
-
this._removeIgnoredPath(
|
|
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 (
|
|
32869
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
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((
|
|
32892
|
-
if (!sp2.isAbsolute(
|
|
32891
|
+
paths.forEach((path22) => {
|
|
32892
|
+
if (!sp2.isAbsolute(path22) && !this._closers.has(path22)) {
|
|
32893
32893
|
if (cwd)
|
|
32894
|
-
|
|
32895
|
-
|
|
32894
|
+
path22 = sp2.join(cwd, path22);
|
|
32895
|
+
path22 = sp2.resolve(path22);
|
|
32896
32896
|
}
|
|
32897
|
-
this._closePath(
|
|
32898
|
-
this._addIgnoredPath(
|
|
32899
|
-
if (this._watched.has(
|
|
32897
|
+
this._closePath(path22);
|
|
32898
|
+
this._addIgnoredPath(path22);
|
|
32899
|
+
if (this._watched.has(path22)) {
|
|
32900
32900
|
this._addIgnoredPath({
|
|
32901
|
-
path:
|
|
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,
|
|
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
|
-
|
|
32970
|
+
path22 = sp2.normalize(path22);
|
|
32971
32971
|
if (opts.cwd)
|
|
32972
|
-
|
|
32973
|
-
const args = [
|
|
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(
|
|
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(
|
|
32984
|
+
this._pendingUnlinks.set(path22, [event, ...args]);
|
|
32985
32985
|
setTimeout(() => {
|
|
32986
|
-
this._pendingUnlinks.forEach((entry,
|
|
32986
|
+
this._pendingUnlinks.forEach((entry, path23) => {
|
|
32987
32987
|
this.emit(...entry);
|
|
32988
32988
|
this.emit(EVENTS.ALL, ...entry);
|
|
32989
|
-
this._pendingUnlinks.delete(
|
|
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(
|
|
32994
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path22)) {
|
|
32995
32995
|
event = EVENTS.CHANGE;
|
|
32996
|
-
this._pendingUnlinks.delete(
|
|
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(
|
|
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,
|
|
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,
|
|
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,
|
|
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(
|
|
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(
|
|
33068
|
+
const item = action.get(path22);
|
|
33069
33069
|
const count = item ? item.count : 0;
|
|
33070
|
-
action.delete(
|
|
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(
|
|
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(
|
|
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 =
|
|
33099
|
-
if (this.options.cwd && !sp2.isAbsolute(
|
|
33100
|
-
fullPath = sp2.join(this.options.cwd,
|
|
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(
|
|
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(
|
|
33113
|
+
writes.get(path22).lastChange = now2;
|
|
33114
33114
|
}
|
|
33115
|
-
const pw = writes.get(
|
|
33115
|
+
const pw = writes.get(path22);
|
|
33116
33116
|
const df = now2 - pw.lastChange;
|
|
33117
33117
|
if (df >= threshold) {
|
|
33118
|
-
writes.delete(
|
|
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(
|
|
33126
|
-
writes.set(
|
|
33125
|
+
if (!writes.has(path22)) {
|
|
33126
|
+
writes.set(path22, {
|
|
33127
33127
|
lastChange: now,
|
|
33128
33128
|
cancelWait: () => {
|
|
33129
|
-
writes.delete(
|
|
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(
|
|
33141
|
-
if (this.options.atomic && DOT_RE.test(
|
|
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(
|
|
33151
|
+
return this._userIgnored(path22, stats);
|
|
33152
33152
|
}
|
|
33153
|
-
_isntIgnored(
|
|
33154
|
-
return !this._isIgnored(
|
|
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(
|
|
33161
|
-
return new WatchHelper(
|
|
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
|
|
33194
|
-
const fullPath = sp2.resolve(
|
|
33195
|
-
isDirectory = isDirectory != null ? isDirectory : this._watched.has(
|
|
33196
|
-
if (!this._throttle("remove",
|
|
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(
|
|
33201
|
+
const wp = this._getWatchedDir(path22);
|
|
33202
33202
|
const nestedDirectoryChildren = wp.getChildren();
|
|
33203
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
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 =
|
|
33210
|
+
let relPath = path22;
|
|
33211
33211
|
if (this.options.cwd)
|
|
33212
|
-
relPath = sp2.relative(this.options.cwd,
|
|
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(
|
|
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(
|
|
33222
|
-
this._emit(eventName,
|
|
33223
|
-
this._closePath(
|
|
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(
|
|
33229
|
-
this._closeFile(
|
|
33230
|
-
const dir = sp2.dirname(
|
|
33231
|
-
this._getWatchedDir(dir).remove(sp2.basename(
|
|
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(
|
|
33237
|
-
const closers = this._closers.get(
|
|
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(
|
|
33241
|
+
this._closers.delete(path22);
|
|
33242
33242
|
}
|
|
33243
|
-
_addPathCloser(
|
|
33243
|
+
_addPathCloser(path22, closer) {
|
|
33244
33244
|
if (!closer)
|
|
33245
33245
|
return;
|
|
33246
|
-
let list = this._closers.get(
|
|
33246
|
+
let list = this._closers.get(path22);
|
|
33247
33247
|
if (!list) {
|
|
33248
33248
|
list = [];
|
|
33249
|
-
this._closers.set(
|
|
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
|
|
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
|
|
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 =
|
|
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
|
-
${
|
|
34756
|
+
${path23}
|
|
34757
34757
|
${underline}`);
|
|
34758
34758
|
}
|
|
34759
|
-
return
|
|
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(
|
|
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(
|
|
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(
|
|
37904
|
-
return this.methodRequest("get",
|
|
37903
|
+
get(path22, opts) {
|
|
37904
|
+
return this.methodRequest("get", path22, opts);
|
|
37905
37905
|
}
|
|
37906
|
-
post(
|
|
37907
|
-
return this.methodRequest("post",
|
|
37906
|
+
post(path22, opts) {
|
|
37907
|
+
return this.methodRequest("post", path22, opts);
|
|
37908
37908
|
}
|
|
37909
|
-
patch(
|
|
37910
|
-
return this.methodRequest("patch",
|
|
37909
|
+
patch(path22, opts) {
|
|
37910
|
+
return this.methodRequest("patch", path22, opts);
|
|
37911
37911
|
}
|
|
37912
|
-
put(
|
|
37913
|
-
return this.methodRequest("put",
|
|
37912
|
+
put(path22, opts) {
|
|
37913
|
+
return this.methodRequest("put", path22, opts);
|
|
37914
37914
|
}
|
|
37915
|
-
delete(
|
|
37916
|
-
return this.methodRequest("delete",
|
|
37915
|
+
delete(path22, opts) {
|
|
37916
|
+
return this.methodRequest("delete", path22, opts);
|
|
37917
37917
|
}
|
|
37918
|
-
methodRequest(method,
|
|
37918
|
+
methodRequest(method, path22, opts) {
|
|
37919
37919
|
return this.request(Promise.resolve(opts).then((opts2) => {
|
|
37920
|
-
return { method, path:
|
|
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(
|
|
38025
|
-
return this.requestAPIList(Page2, opts && "then" in opts ? opts.then((opts2) => ({ method: "get", path:
|
|
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:
|
|
38114
|
-
const url = this.buildURL(
|
|
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(
|
|
40325
|
-
const last =
|
|
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:
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
43905
|
+
description: DESCRIPTION28,
|
|
43716
43906
|
input_schema: {
|
|
43717
43907
|
type: `object`,
|
|
43718
43908
|
properties: {
|
|
@@ -43750,10 +43940,10 @@ var checkDepartmentReplies = {
|
|
|
43750
43940
|
``,
|
|
43751
43941
|
`\u51E0\u53E5\u63D0\u9192\uFF1A`,
|
|
43752
43942
|
`- \u8FD9\u4E0D\u4EE3\u8868\u8981\u4F60\u4EB2\u81EA\u4E0B\u573A read/bash/\u6D4B\u8BD5/\u6539\u4EE3\u7801\u2014\u2014\u56E2\u961F\u6CA1\u56DE\uFF0C\u4E0D\u662F\u4F60\u8BE5\u63A5\u624B\u7684\u4FE1\u53F7\u3002`,
|
|
43753
|
-
`- \u8001\u677F\u8981\u662F\u6B63\u7B49\u7740\uFF0C\u5148\u7528 send_message \u5982\u5B9E\u8DDF\u4ED6\u8BF4\u4E00\u53E5\u201C\u8D1F\u8D23\u4EBA\
|
|
43943
|
+
`- \u8001\u677F\u8981\u662F\u6B63\u7B49\u7740\uFF0C\u5148\u7528 send_message \u5982\u5B9E\u8DDF\u4ED6\u8BF4\u4E00\u53E5\u201C\u5DF2\u5B89\u6392\u7ED9\u8D1F\u8D23\u4EBA\u5904\u7406\uFF0C\u6211\u7B49\u56DE\u4FE1\u540E\u540C\u6B65\u201D\u3002`,
|
|
43754
43944
|
`- \u5982\u679C\u4EFB\u52A1\u521A\u6D3E\u51FA\u53BB\uFF0C\u4E0D\u8981\u5728\u540C\u4E00\u8F6E\u9A6C\u4E0A\u50AC\u529E\uFF1B\u7ED9\u8D1F\u8D23\u4EBA\u5408\u7406\u5904\u7406\u65F6\u95F4\u3002`,
|
|
43755
|
-
`- \u5DF2\u7ECF\u7B49\u4E86\u4E00\u9635\u3001\u8001\u677F\u53C8\u8FFD\u95EE\uFF0C\u6216\u53D1\u73B0\u660E\u786E\u98CE\u9669\u65F6\uFF0C\u518D\u7528 mailbox_followup \u6216
|
|
43756
|
-
`- \u522B\u5728\u8FD9\u4E00\u8F6E\u91CC\u53CD\u590D\u7A7A\u67E5 check_department_replies\uFF1B\u7B49\u56E2\u961F\u56DE\u4FE1\u3001\u8001\u677F\u8FFD\u95EE\u6216\
|
|
43945
|
+
`- \u5DF2\u7ECF\u7B49\u4E86\u4E00\u9635\u3001\u8001\u677F\u53C8\u8FFD\u95EE\uFF0C\u6216\u53D1\u73B0\u660E\u786E\u98CE\u9669\u65F6\uFF0C\u518D\u7528 mailbox_followup \u53BB\u8865\u5145\u4E0A\u4E0B\u6587\u6216\u8BE2\u95EE\u5BF9\u5E94 Department Head \u7684\u771F\u5B9E\u72B6\u6001\u3002`,
|
|
43946
|
+
`- \u522B\u5728\u8FD9\u4E00\u8F6E\u91CC\u53CD\u590D\u7A7A\u67E5 check_department_replies\uFF1B\u7B49\u56E2\u961F\u56DE\u4FE1\u3001\u8001\u677F\u8FFD\u95EE\u6216\u786E\u6709\u65B0\u80CC\u666F\uFF0C\u518D\u6765\u770B\u3002`
|
|
43757
43947
|
].join("\n");
|
|
43758
43948
|
}
|
|
43759
43949
|
const updateStmt = db3.prepare(`UPDATE mailbox SET status = 'read' WHERE id = ?`);
|
|
@@ -43778,12 +43968,12 @@ ${replies}`;
|
|
|
43778
43968
|
|
|
43779
43969
|
// src/department/learning.ts
|
|
43780
43970
|
var import_node_fs4 = require("node:fs");
|
|
43781
|
-
var
|
|
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
|
|
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 =
|
|
43813
|
-
const target =
|
|
43814
|
-
if (target !==
|
|
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 =
|
|
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 =
|
|
43892
|
-
if (!target.startsWith(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 =
|
|
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 =
|
|
43922
|
-
const skillMdPath =
|
|
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 ??
|
|
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(
|
|
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
|
|
44185
|
+
return import_node_path14.default.join(getDepartmentWorkSpaceDir(departmentName), "department-memory.json");
|
|
43996
44186
|
};
|
|
43997
44187
|
var departmentSkillPath = (departmentName) => {
|
|
43998
|
-
return
|
|
44188
|
+
return import_node_path14.default.join(getDepartmentWorkSpaceDir(departmentName), "department-skills.json");
|
|
43999
44189
|
};
|
|
44000
44190
|
var departmentSkillDir = (departmentName, skillName) => {
|
|
44001
|
-
return assertSafeSkillTarget(
|
|
44191
|
+
return assertSafeSkillTarget(import_node_path14.default.join(getDepartmentWorkSpaceDir(departmentName), "skills"), skillName);
|
|
44002
44192
|
};
|
|
44003
44193
|
var proposalsPath = () => {
|
|
44004
|
-
return
|
|
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)(
|
|
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,17 +44551,17 @@ 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
|
|
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
|
-
\u5B83\u5728\u7EC4\u7EC7\u91CC\u7684\u542B\u4E49\u66F4\u63A5\u8FD1\u201C\u540C\u4E00\u4EF6\u4E8B\u7684\u7EE7\u7EED\u6C9F\u901A\u201D\uFF1A\
|
|
44368
|
-
\u7279\u522B\u662F\u7ED9 CEO/manager \u540C\u6B65\u201C\u5DF2\u59D4\u6D3E\u3001\u6B63\u5728\u68C0\u67E5\u3001\u7B49\u5F85\u4E0B\u5C5E\u7ED3\u679C\u3001\u5DF2\
|
|
44557
|
+
\u5B83\u5728\u7EC4\u7EC7\u91CC\u7684\u542B\u4E49\u66F4\u63A5\u8FD1\u201C\u540C\u4E00\u4EF6\u4E8B\u7684\u7EE7\u7EED\u6C9F\u901A\u201D\uFF1A\u8865\u5145\u65B0\u80CC\u666F\u3001\u540C\u6B65\u5F53\u524D\u72B6\u6001\u3001\u8BF4\u660E\u6B63\u5728\u7B49\u5F85\u54EA\u90E8\u5206\u7ED3\u679C\uFF0C\u6216\u9700\u8981\u5BF9\u65B9\u8865\u5145\u4EC0\u4E48\u3002
|
|
44558
|
+
\u7279\u522B\u662F\u7ED9 CEO/manager \u540C\u6B65\u201C\u5DF2\u59D4\u6D3E\u3001\u6B63\u5728\u68C0\u67E5\u3001\u7B49\u5F85\u4E0B\u5C5E\u7ED3\u679C\u3001\u5DF2\u6709\u90E8\u5206\u53D1\u73B0\u201D\u8FD9\u7C7B\u8FDB\u5EA6\u65F6\uFF0C\u4F18\u5148\u4F7F\u7528\u5B83\uFF1B\u7B49\u4F60\u9A8C\u6536\u5B8C\u771F\u5B9E\u7ED3\u679C\u3001\u53EF\u4EE5\u4EA4\u4ED8\u6700\u7EC8\u7ED3\u8BBA\u65F6\uFF0C\u518D\u4F7F\u7528 reply_mailbox\u3002
|
|
44369
44559
|
|
|
44370
44560
|
\u9002\u7528\u573A\u666F\uFF1A
|
|
44371
44561
|
- \u540C\u6B65\u9636\u6BB5\u6027\u8FDB\u5C55
|
|
44372
44562
|
- \u4E3B\u52A8\u8FFD\u95EE\u6F84\u6E05\u4FE1\u606F
|
|
44373
44563
|
- \u5148\u53D1\u51FA\u90E8\u5206\u7ED3\u679C\uFF0C\u7A0D\u540E\u7EE7\u7EED\u8865\u5145
|
|
44374
|
-
- \u544A\u77E5\u4E0A\u6E38\u5DF2\u5B89\u6392\u4E0B\u5C5E\u3001\u6B63\u5728\u7B49\u5F85\u4E0B\u5C5E\u7ED3\u679C\uFF0C\u6216\u5DF2\
|
|
44564
|
+
- \u544A\u77E5\u4E0A\u6E38\u5DF2\u5B89\u6392\u4E0B\u5C5E\u3001\u6B63\u5728\u7B49\u5F85\u4E0B\u5C5E\u7ED3\u679C\uFF0C\u6216\u5DF2\u6709\u90E8\u5206\u53D1\u73B0
|
|
44375
44565
|
- CEO \u6536\u5230\u67D0\u4E2A\u90E8\u95E8\u6210\u5458\u7684\u7ED3\u679C\u540E\uFF0C\u82E5\u7528\u6237\u7EE7\u7EED\u63D0\u4FEE\u6539\u610F\u89C1\u3001bug \u53CD\u9988\u3001\u6253\u4E0D\u5F00\u7B49\u95EE\u9898\uFF0C\u5E94\u4F18\u5148\u5BF9\u8BE5\u6210\u5458\u4E0A\u4E00\u6761\u76F8\u5173\u56DE\u4FE1\u8C03\u7528 mailbox_followup\uFF0C\u628A\u53CD\u9988\u6CBF\u539F\u7EBF\u7A0B\u53D1\u56DE\u539F\u8D23\u4EFB\u4EBA
|
|
44376
44566
|
|
|
44377
44567
|
\u53C2\u6570\uFF1A
|
|
@@ -44383,6 +44573,7 @@ var DESCRIPTION28 = `
|
|
|
44383
44573
|
- \u6B64\u5DE5\u5177\u4E0D\u4F1A\u4FEE\u6539\u539F\u6D88\u606F\u72B6\u6001
|
|
44384
44574
|
- \u5982\u679C\u4F60\u5DF2\u7ECF\u5F62\u6210\u5BF9\u5F53\u524D\u6D88\u606F\u7684\u6B63\u5F0F\u7B54\u590D\uFF0C\u5E94\u4F7F\u7528 reply_mailbox
|
|
44385
44575
|
- \u5BF9 CEO \u800C\u8A00\uFF0C\u8FD9\u901A\u5E38\u662F\u201C\u628A\u8FD4\u5DE5\u9700\u6C42\u9000\u56DE\u539F\u8D23\u4EFB\u6210\u5458\u201D\u7684\u9996\u9009\u5DE5\u5177\uFF0C\u800C\u4E0D\u662F\u81EA\u5DF1\u76F4\u63A5\u91CD\u505A
|
|
44576
|
+
- \u5BF9 CEO \u800C\u8A00\uFF0C\u521A\u59D4\u6D3E\u540E\u4E0D\u8981\u7528\u6B64\u5DE5\u5177\u50AC\u8D1F\u8D23\u4EBA\uFF0C\u4E5F\u4E0D\u8981\u5BF9\u8001\u677F\u8BF4\u201C\u6211\u53BB\u50AC/\u5DF2\u50AC/\u4F1A\u76EF\u7740\u201D\u3002\u9ED8\u8BA4\u53EA\u540C\u6B65\u201C\u5DF2\u5B89\u6392\uFF0C\u7B49\u56DE\u4FE1\u540E\u540C\u6B65\u201D\u3002
|
|
44386
44577
|
`;
|
|
44387
44578
|
var looksLikeCeoNudge = (content, kind) => {
|
|
44388
44579
|
if (kind === `nudge`) return true;
|
|
@@ -44390,7 +44581,7 @@ var looksLikeCeoNudge = (content, kind) => {
|
|
|
44390
44581
|
};
|
|
44391
44582
|
var mailboxFollowup = {
|
|
44392
44583
|
name: `mailbox_followup`,
|
|
44393
|
-
description:
|
|
44584
|
+
description: DESCRIPTION29,
|
|
44394
44585
|
input_schema: {
|
|
44395
44586
|
type: `object`,
|
|
44396
44587
|
properties: {
|
|
@@ -44480,7 +44671,7 @@ var mailboxFollowup = {
|
|
|
44480
44671
|
var import_node_child_process = require("node:child_process");
|
|
44481
44672
|
var import_node_crypto11 = require("node:crypto");
|
|
44482
44673
|
var import_node_fs5 = require("node:fs");
|
|
44483
|
-
var
|
|
44674
|
+
var DESCRIPTION30 = `\u5728\u7CFB\u7EDF shell \u4E2D\u6267\u884C\u547D\u4EE4\u3002
|
|
44484
44675
|
|
|
44485
44676
|
\u7528\u9014\uFF1A
|
|
44486
44677
|
- \u8FD0\u884C shell \u547D\u4EE4\uFF08\u5982 ls\u3001mkdir\u3001npm\u3001git\u3001rg \u7B49\uFF09
|
|
@@ -44684,7 +44875,7 @@ function waitForClose(session, waitMs) {
|
|
|
44684
44875
|
}
|
|
44685
44876
|
var bashTool = {
|
|
44686
44877
|
name: `bash`,
|
|
44687
|
-
description:
|
|
44878
|
+
description: DESCRIPTION30,
|
|
44688
44879
|
input_schema: {
|
|
44689
44880
|
type: `object`,
|
|
44690
44881
|
properties: {
|
|
@@ -44821,7 +45012,7 @@ var bashTool = {
|
|
|
44821
45012
|
};
|
|
44822
45013
|
|
|
44823
45014
|
// src/tools/tools/SendFile.ts
|
|
44824
|
-
var
|
|
45015
|
+
var DESCRIPTION31 = `
|
|
44825
45016
|
\u53D1\u9001\u6587\u4EF6\u7ED9\u7528\u6237\u3002\u652F\u6301\u4E24\u79CD\u65B9\u5F0F\uFF1A
|
|
44826
45017
|
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
45018
|
2. \u8FDC\u7A0B URL\uFF08url\uFF09\uFF1A\u9002\u7528\u4E8E\u4ECE\u7F51\u7EDC\u83B7\u53D6\u7684\u6587\u4EF6
|
|
@@ -44846,7 +45037,7 @@ var inferFileType = (fileName) => {
|
|
|
44846
45037
|
};
|
|
44847
45038
|
var sendFile = {
|
|
44848
45039
|
name: `send_file`,
|
|
44849
|
-
description:
|
|
45040
|
+
description: DESCRIPTION31,
|
|
44850
45041
|
input_schema: {
|
|
44851
45042
|
type: `object`,
|
|
44852
45043
|
properties: {
|
|
@@ -45076,6 +45267,7 @@ var createDefaultTools = (bg, hookPlugins = []) => {
|
|
|
45076
45267
|
registerTool(registry2, webSearchTool);
|
|
45077
45268
|
registerTool(registry2, webFetchTool);
|
|
45078
45269
|
registerTool(registry2, imageUnderstand);
|
|
45270
|
+
registerTool(registry2, imageGenerate);
|
|
45079
45271
|
registerTool(registry2, skillTool);
|
|
45080
45272
|
registerTool(registry2, goalCreate);
|
|
45081
45273
|
registerTool(registry2, goalGet);
|
|
@@ -45179,7 +45371,7 @@ var searchRecallIndex = async (storage, userId, query, date, limit = 8) => {
|
|
|
45179
45371
|
};
|
|
45180
45372
|
|
|
45181
45373
|
// src/tools/tools/RecallChatHistory.ts
|
|
45182
|
-
var
|
|
45374
|
+
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
45375
|
|
|
45184
45376
|
\u4F7F\u7528\u6307\u5357\uFF1A
|
|
45185
45377
|
- 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 +45426,7 @@ var formatRecallResult = (result, indexResult) => {
|
|
|
45234
45426
|
};
|
|
45235
45427
|
var recallChatHistory = (messageStorage, topicStorage, recallIndexStorage) => ({
|
|
45236
45428
|
name: "recall_chat_history",
|
|
45237
|
-
description:
|
|
45429
|
+
description: DESCRIPTION32,
|
|
45238
45430
|
input_schema: {
|
|
45239
45431
|
type: "object",
|
|
45240
45432
|
properties: {
|
|
@@ -45543,7 +45735,7 @@ var readDreamHistoryLimit = () => {
|
|
|
45543
45735
|
// src/skillForge/SkillForgeEngine.ts
|
|
45544
45736
|
var import_node_fs6 = require("node:fs");
|
|
45545
45737
|
var import_node_os2 = require("node:os");
|
|
45546
|
-
var
|
|
45738
|
+
var import_node_path15 = require("node:path");
|
|
45547
45739
|
var import_node_crypto12 = require("node:crypto");
|
|
45548
45740
|
var SkillForgeEngine = class {
|
|
45549
45741
|
proposalStorage;
|
|
@@ -45552,8 +45744,8 @@ var SkillForgeEngine = class {
|
|
|
45552
45744
|
constructor(deps) {
|
|
45553
45745
|
this.proposalStorage = deps.proposalStorage;
|
|
45554
45746
|
const opt = deps.options ?? {};
|
|
45555
|
-
this.draftRoot = opt.draftRoot ?? (0,
|
|
45556
|
-
this.skillsInstallDir = opt.skillsInstallDir ?? (0,
|
|
45747
|
+
this.draftRoot = opt.draftRoot ?? (0, import_node_path15.join)((0, import_node_os2.homedir)(), ".duclaw", "skill-proposals");
|
|
45748
|
+
this.skillsInstallDir = opt.skillsInstallDir ?? (0, import_node_path15.join)((0, import_node_os2.homedir)(), ".agents", "skills");
|
|
45557
45749
|
}
|
|
45558
45750
|
// ---------- 公开方法 ----------
|
|
45559
45751
|
/**
|
|
@@ -45579,9 +45771,9 @@ ${formatSkillValidationIssues(validation)}`);
|
|
|
45579
45771
|
return null;
|
|
45580
45772
|
}
|
|
45581
45773
|
const id = (0, import_node_crypto12.randomBytes)(4).toString("hex");
|
|
45582
|
-
const draftDir = (0,
|
|
45774
|
+
const draftDir = (0, import_node_path15.join)(this.draftRoot, userId, id);
|
|
45583
45775
|
(0, import_node_fs6.mkdirSync)(draftDir, { recursive: true });
|
|
45584
|
-
(0, import_node_fs6.writeFileSync)((0,
|
|
45776
|
+
(0, import_node_fs6.writeFileSync)((0, import_node_path15.join)(draftDir, "SKILL.md"), skillMd, "utf-8");
|
|
45585
45777
|
const directoryValidation = validateSkillDirectory(draftDir, { expectedName: skillName });
|
|
45586
45778
|
if (!directoryValidation.ok) {
|
|
45587
45779
|
try {
|
|
@@ -45680,7 +45872,7 @@ ${formatSkillValidationIssues(smokeTest)}`);
|
|
|
45680
45872
|
};
|
|
45681
45873
|
|
|
45682
45874
|
// src/tools/tools/skillforge/SkillForgePropose.ts
|
|
45683
|
-
var
|
|
45875
|
+
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
45876
|
|
|
45685
45877
|
\u4F55\u65F6\u8C03\u7528\uFF1A
|
|
45686
45878
|
\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 +45908,7 @@ description: <\u4E0E\u53C2\u6570 description \u4E00\u81F4>
|
|
|
45716
45908
|
`;
|
|
45717
45909
|
var skillForgePropose = (engine) => ({
|
|
45718
45910
|
name: `skill_forge_propose`,
|
|
45719
|
-
description:
|
|
45911
|
+
description: DESCRIPTION33,
|
|
45720
45912
|
input_schema: {
|
|
45721
45913
|
type: `object`,
|
|
45722
45914
|
properties: {
|
|
@@ -45758,7 +45950,7 @@ var skillForgePropose = (engine) => ({
|
|
|
45758
45950
|
});
|
|
45759
45951
|
|
|
45760
45952
|
// src/tools/tools/skillforge/SkillForgeKeep.ts
|
|
45761
|
-
var
|
|
45953
|
+
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
45954
|
\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
45955
|
\u53C2\u6570 proposalId \u53EF\u9009\uFF1A
|
|
45764
45956
|
- \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 +45971,7 @@ var pickProposal = (pending, hint) => {
|
|
|
45779
45971
|
};
|
|
45780
45972
|
var skillForgeKeep = (engine) => ({
|
|
45781
45973
|
name: `skill_forge_keep`,
|
|
45782
|
-
description:
|
|
45974
|
+
description: DESCRIPTION34,
|
|
45783
45975
|
input_schema: {
|
|
45784
45976
|
type: `object`,
|
|
45785
45977
|
properties: {
|
|
@@ -45811,7 +46003,7 @@ var skillForgeKeep = (engine) => ({
|
|
|
45811
46003
|
});
|
|
45812
46004
|
|
|
45813
46005
|
// src/tools/tools/skillforge/SkillForgeDrop.ts
|
|
45814
|
-
var
|
|
46006
|
+
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
46007
|
\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
46008
|
\u53C2\u6570 proposalId \u53EF\u9009\uFF1A
|
|
45817
46009
|
- \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 +46024,7 @@ var pickProposal2 = (pending, hint) => {
|
|
|
45832
46024
|
};
|
|
45833
46025
|
var skillForgeDrop = (engine) => ({
|
|
45834
46026
|
name: `skill_forge_drop`,
|
|
45835
|
-
description:
|
|
46027
|
+
description: DESCRIPTION35,
|
|
45836
46028
|
input_schema: {
|
|
45837
46029
|
type: `object`,
|
|
45838
46030
|
properties: {
|
|
@@ -45978,7 +46170,7 @@ ${memory.content}`),
|
|
|
45978
46170
|
};
|
|
45979
46171
|
|
|
45980
46172
|
// src/tools/tools/memory/MemoryCreate.ts
|
|
45981
|
-
var
|
|
46173
|
+
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
46174
|
|
|
45983
46175
|
\u4F55\u65F6\u8C03\u7528\uFF1A
|
|
45984
46176
|
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 +46190,7 @@ var DESCRIPTION35 = `\u628A\u4E00\u6761\u503C\u5F97\u957F\u671F\u8BB0\u4F4F\u768
|
|
|
45998
46190
|
`;
|
|
45999
46191
|
var memoryCreate = (engine) => ({
|
|
46000
46192
|
name: `memory_create`,
|
|
46001
|
-
description:
|
|
46193
|
+
description: DESCRIPTION36,
|
|
46002
46194
|
input_schema: {
|
|
46003
46195
|
type: `object`,
|
|
46004
46196
|
properties: {
|
|
@@ -46030,7 +46222,7 @@ var memoryCreate = (engine) => ({
|
|
|
46030
46222
|
});
|
|
46031
46223
|
|
|
46032
46224
|
// src/tools/tools/memory/MemoryUpdate.ts
|
|
46033
|
-
var
|
|
46225
|
+
var DESCRIPTION37 = `\u66F4\u65B0\u4E00\u6761\u5DF2\u5B58\u5728\u7684\u957F\u671F\u8BB0\u5FC6\uFF08\u6309 id \u5B9A\u4F4D\uFF09\u3002
|
|
46034
46226
|
|
|
46035
46227
|
\u4F55\u65F6\u8C03\u7528\uFF1A
|
|
46036
46228
|
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 +46236,7 @@ var DESCRIPTION36 = `\u66F4\u65B0\u4E00\u6761\u5DF2\u5B58\u5728\u7684\u957F\u671
|
|
|
46044
46236
|
`;
|
|
46045
46237
|
var memoryUpdate = (engine) => ({
|
|
46046
46238
|
name: `memory_update`,
|
|
46047
|
-
description:
|
|
46239
|
+
description: DESCRIPTION37,
|
|
46048
46240
|
input_schema: {
|
|
46049
46241
|
type: `object`,
|
|
46050
46242
|
properties: {
|
|
@@ -46081,7 +46273,7 @@ var memoryUpdate = (engine) => ({
|
|
|
46081
46273
|
});
|
|
46082
46274
|
|
|
46083
46275
|
// src/tools/tools/memory/MemoryDelete.ts
|
|
46084
|
-
var
|
|
46276
|
+
var DESCRIPTION38 = `\u5220\u9664\u4E00\u6761\u957F\u671F\u8BB0\u5FC6\uFF08\u6309 id \u5B9A\u4F4D\uFF09\u3002
|
|
46085
46277
|
|
|
46086
46278
|
\u4F55\u65F6\u8C03\u7528\uFF1A
|
|
46087
46279
|
1. \u7528\u6237\u660E\u786E\u8981\u6C42"\u5FD8\u6389 / \u522B\u518D\u8BB0 / \u5220\u6389\u5173\u4E8E X \u7684\u8BB0\u5FC6"
|
|
@@ -46094,7 +46286,7 @@ var DESCRIPTION37 = `\u5220\u9664\u4E00\u6761\u957F\u671F\u8BB0\u5FC6\uFF08\u630
|
|
|
46094
46286
|
`;
|
|
46095
46287
|
var memoryDelete = (engine) => ({
|
|
46096
46288
|
name: `memory_delete`,
|
|
46097
|
-
description:
|
|
46289
|
+
description: DESCRIPTION38,
|
|
46098
46290
|
input_schema: {
|
|
46099
46291
|
type: `object`,
|
|
46100
46292
|
properties: {
|
|
@@ -46641,13 +46833,15 @@ ${RUNTIME_PROCESS_SAFETY_PROMPT}
|
|
|
46641
46833
|
|
|
46642
46834
|
\u516C\u53F8\u91CC\u6709\u5404\u4E2A\u90E8\u95E8\u548C\u5B83\u4EEC\u7684\u8D1F\u8D23\u4EBA\uFF08Department Head\uFF09\u3002\u4E13\u4E1A\u7684\u6D3B\u2014\u2014\u5199\u4EE3\u7801\u3001\u8BFB\u4EE3\u7801\u5B9A\u4F4D\u95EE\u9898\u3001\u6539\u6587\u4EF6\u3001\u8DD1\u6D4B\u8BD5\u3001\u8C03\u8BD5\u3001\u90E8\u7F72\uFF0C\u5904\u7406\u6570\u636E/\u6587\u6863/\u97F3\u89C6\u9891/\u56FE\u7247\uFF0C\u67E5\u8BC1\u5916\u90E8 API\uFF0C\u751F\u6210\u590D\u6742\u4EA7\u7269\u7B49\u2014\u2014\u4F60\u7684\u7B2C\u4E00\u53CD\u5E94\u662F\u627E\u5BF9\u5E94\u56E2\u961F\u7684 Head\uFF0C\u800C\u4E0D\u662F\u81EA\u5DF1\u4E0A\u624B\u3002\u4F60\u80FD\u770B\u5230\u7684\u53EA\u6709\u90E8\u95E8\u548C\u5B83\u4EEC\u7684 Head\uFF1BExecutor \u7531\u5404 Head \u81EA\u5DF1\u7BA1\u7406\uFF0C\u9ED8\u8BA4\u4E0D\u5728\u4F60\u7684\u89C6\u91CE\u91CC\u3002
|
|
46643
46835
|
|
|
46644
|
-
\u4F60\u548C\u56E2\u961F\u534F\u4F5C\u7684\u65B9\u5F0F\u5F88\u81EA\u7136\uFF1A\u9700\u8981\u56E2\u961F\u505A\u4E8B\uFF0C\u5C31\u7ED9\u5BF9\u5E94 Head \u53D1\u6D88\u606F\uFF08department_communicate\uFF09\uFF1B\u6709\u65B0\u7684\u80CC\u666F\u3001\u4FEE\u6B63\u8981\u6C42\u3001\u7528\u6237\u53CD\u9988\u6216\u5DF2\u7ECF\u8FC7\u4E86\u5408\u7406\u7B49\u5F85\u65F6\u95F4\
|
|
46836
|
+
\u4F60\u548C\u56E2\u961F\u534F\u4F5C\u7684\u65B9\u5F0F\u5F88\u81EA\u7136\uFF1A\u9700\u8981\u56E2\u961F\u505A\u4E8B\uFF0C\u5C31\u7ED9\u5BF9\u5E94 Head \u53D1\u6D88\u606F\uFF08department_communicate\uFF09\uFF1B\u6709\u65B0\u7684\u80CC\u666F\u3001\u4FEE\u6B63\u8981\u6C42\u3001\u7528\u6237\u53CD\u9988\uFF0C\u6216\u5DF2\u7ECF\u8FC7\u4E86\u5408\u7406\u7B49\u5F85\u65F6\u95F4\u4E14\u786E\u5B9E\u9700\u8981\u8865\u5145\u8BE2\u95EE\u65F6\uFF0C\u7528 mailbox_followup \u63A5\u56DE\u539F\u6765\u7684\u7EBF\u7A0B\uFF1B\u60F3\u770B\u56E2\u961F\u56DE\u4E86\u4EC0\u4E48\uFF0C\u7528 check_department_replies \u6536\u4E00\u4E0B\u3002\u7EC4\u7EC7\u91CC\u8FD8\u6CA1\u6709\u5BF9\u53E3\u7684\u56E2\u961F\u65F6\uFF0C\u4F60\u624D\u5F20\u7F57\u7740\u5EFA\u90E8\u95E8\u3001\u62DB Head\uFF08\u5EFA\u597D\u90E8\u95E8\u5148\u7528 department_member_create \u51FA\u4E00\u4E2A Head\uFF0C\u518D\u628A\u5177\u4F53\u4EFB\u52A1\u6D3E\u7ED9\u4ED6\uFF09\u3002
|
|
46645
46837
|
|
|
46646
46838
|
\u8001\u677F\u95EE\u4F60\u4EFB\u4F55\u4E8B\u2014\u2014\u5305\u62EC\u201C\u73B0\u5728\u8FDB\u5EA6\u5982\u4F55\u201D\u201C\u6D4B\u8BD5\u5F97\u600E\u4E48\u6837\u201D\u201C\u90A3\u8FB9\u9760\u8C31\u5417\u201D\u201C\u5361\u5728\u54EA\u4E86\u201D\u8FD9\u7C7B\u2014\u2014\u4F60\u7ED9\u7684\u90FD\u662F\u4F60\u5411\u56E2\u961F\u6838\u5B9E\u8FC7\u7684\u771F\u5B9E\u60C5\u51B5\uFF0C\u7EDD\u4E0D\u662F\u51ED\u5370\u8C61\u7F16\u51FA\u6765\u7684\u3002\u5982\u679C\u8FD9\u4F1A\u513F\u8FD8\u6CA1\u62FF\u5230\u51C6\u4FE1\uFF0C\u4F60\u5B81\u53EF\u5148\u56DE\u8001\u677F\u4E00\u53E5\u201C\u6211\u53BB\u8DDF\u56E2\u961F\u786E\u8BA4\uFF0C\u7A0D\u540E\u7ED9\u4F60\u56DE\u201D\uFF0C\u4E5F\u4E0D\u7CCA\u5F04\u4E00\u4E2A\u7B54\u6848\u3002\u5728\u4F60\u628A\u771F\u5B9E\u7ED3\u8BBA\u4EA4\u5230\u8001\u677F\u624B\u4E0A\u4E4B\u524D\uFF0C\u8FD9\u4EF6\u4E8B\u5BF9\u4F60\u90FD\u6CA1\u7B97\u5B8C\u3002
|
|
46647
46839
|
|
|
46648
46840
|
\u67D0\u4E2A Head \u5DF2\u7ECF\u8D1F\u8D23\u7684\u4EA7\u51FA\uFF0C\u540E\u7EED\u7684\u8FD4\u5DE5\u3001bug \u4FEE\u590D\u3001\u201C\u6253\u4E0D\u5F00\u201D\u201C\u5E2E\u6211\u6539\u4E00\u4E0B\u201D\u201C\u518D\u51FA\u4E00\u7248\u201D\uFF0C\u9ED8\u8BA4\u8FD8\u5F52\u4ED6\u2014\u2014\u4F60\u987A\u7740\u539F\u6765\u7684\u7EBF\u7A0B\u628A\u53CD\u9988\u8FFD\u52A0\u7ED9\u4ED6\uFF08mailbox_followup\uFF09\uFF0C\u800C\u4E0D\u662F\u81EA\u5DF1\u63A5\u624B\u91CD\u505A\u3002
|
|
46649
46841
|
|
|
46650
|
-
\u53EA\u6709\u8FD9\u51E0\u79CD\u60C5\u51B5\u4F60\u624D\u81EA\u5DF1\u4E0A\u624B\uFF1A\u8001\u677F\u660E\u786E\u8981\u4F60\u4EB2\u81EA\u505A\u3001\u7EC4\u7EC7\u91CC\u786E\u5B9E\u6CA1\u6709\u4E5F\u6765\u4E0D\u53CA\u7EC4\u5EFA\u5BF9\u53E3\u56E2\u961F\u3001\u6216\u56E2\u961F\u660E\u786E\u505A\u4E0D\u6210\u4E14\u8001\u677F\u540C\u610F\u4F60\u63A5\u7BA1\u3002\u9664\u6B64\u4E4B\u5916\uFF0C\u56E2\u961F\u56DE\u5F97\u6162\u3001\u6682\u65F6\u6CA1\u56DE\u3001check \u8FD8\u6CA1\u7ED3\u679C\uFF0C\u90FD\u4E0D\u662F\u4F60\u4E0B\u573A\u5E72\u6D3B\u7684\u7406\u7531\u3002\u521A\u628A\u4EFB\u52A1\u6D3E\u51FA\u53BB\u65F6\uFF0C\u4E0D\u8981\u7ACB\u523B\u50AC\u529E\uFF0C\u4E5F\u4E0D\u8981\u5728\u540C\u4E00\u8F6E\u8FDE\u7EED\u8FFD\u95EE\uFF1B\u8BE5\u505A\u7684\u662F\u5982\u5B9E\u8DDF\u8001\u677F\u8BF4\u201C\u5DF2\u5B89\u6392\u56E2\u961F\u5904\u7406\uFF0C\u6211\u62FF\u5230\u7ED3\u679C\u5C31\u540C\u6B65\u201D\uFF0C\u7136\u540E\u628A\u8FD9\u4E00\u8F6E\u6536\u4F4F\u3002\u53EA\u6709\u5DF2\u7ECF\u7B49\u5F85\u8FC7\u5408\u7406\u65F6\u95F4\u3001\u8001\u677F\u53C8\u8FFD\u95EE\u8FDB\u5EA6\u3001\u6216\u4F60\u53D1\u73B0\u660E\u786E\u98CE\u9669/\u963B\u585E\u65F6\uFF0C\u624D\u6CBF\u539F\u7EBF\u7A0B\u9002\u5EA6\
|
|
46842
|
+
\u53EA\u6709\u8FD9\u51E0\u79CD\u60C5\u51B5\u4F60\u624D\u81EA\u5DF1\u4E0A\u624B\uFF1A\u8001\u677F\u660E\u786E\u8981\u4F60\u4EB2\u81EA\u505A\u3001\u7EC4\u7EC7\u91CC\u786E\u5B9E\u6CA1\u6709\u4E5F\u6765\u4E0D\u53CA\u7EC4\u5EFA\u5BF9\u53E3\u56E2\u961F\u3001\u6216\u56E2\u961F\u660E\u786E\u505A\u4E0D\u6210\u4E14\u8001\u677F\u540C\u610F\u4F60\u63A5\u7BA1\u3002\u9664\u6B64\u4E4B\u5916\uFF0C\u56E2\u961F\u56DE\u5F97\u6162\u3001\u6682\u65F6\u6CA1\u56DE\u3001check \u8FD8\u6CA1\u7ED3\u679C\uFF0C\u90FD\u4E0D\u662F\u4F60\u4E0B\u573A\u5E72\u6D3B\u7684\u7406\u7531\u3002\u521A\u628A\u4EFB\u52A1\u6D3E\u51FA\u53BB\u65F6\uFF0C\u4E0D\u8981\u7ACB\u523B\u50AC\u529E\uFF0C\u4E5F\u4E0D\u8981\u5728\u540C\u4E00\u8F6E\u8FDE\u7EED\u8FFD\u95EE\uFF1B\u8BE5\u505A\u7684\u662F\u5982\u5B9E\u8DDF\u8001\u677F\u8BF4\u201C\u5DF2\u5B89\u6392\u56E2\u961F\u5904\u7406\uFF0C\u6211\u62FF\u5230\u7ED3\u679C\u5C31\u540C\u6B65\u201D\uFF0C\u7136\u540E\u628A\u8FD9\u4E00\u8F6E\u6536\u4F4F\u3002\u53EA\u6709\u5DF2\u7ECF\u7B49\u5F85\u8FC7\u5408\u7406\u65F6\u95F4\u3001\u8001\u677F\u53C8\u8FFD\u95EE\u8FDB\u5EA6\u3001\u6216\u4F60\u53D1\u73B0\u660E\u786E\u98CE\u9669/\u963B\u585E\u65F6\uFF0C\u624D\u6CBF\u539F\u7EBF\u7A0B\u9002\u5EA6\u8BE2\u95EE\u8D1F\u8D23\u4EBA\u3002
|
|
46843
|
+
|
|
46844
|
+
\u5BF9\u8001\u677F\u6C47\u62A5\u65F6\u4E0D\u8981\u4F7F\u7528\u201C\u6211\u53BB\u50AC\u4E00\u4E0B / \u6211\u4F1A\u76EF\u7740 / \u5DF2\u7ECF\u50AC\u4E86 / \u7EE7\u7EED\u50AC\u8D1F\u8D23\u4EBA / \u8BA9\u4ED6\u5C3D\u5FEB\u56DE\u590D\u201D\u8FD9\u7C7B\u7BA1\u7406\u538B\u8FEB\u8BDD\u672F\u3002\u9ED8\u8BA4\u4F7F\u7528\u514B\u5236\u8868\u8FF0\uFF1A\u201C\u5DF2\u5B89\u6392\u7ED9\u8D1F\u8D23\u4EBA\u5904\u7406\uFF0C\u6211\u7B49\u56DE\u4FE1\u540E\u540C\u6B65\u201D\uFF1B\u9664\u975E\u786E\u5B9E\u5DF2\u7ECF\u8FC7\u4E86\u5408\u7406\u7B49\u5F85\u65F6\u95F4\u5E76\u4E14\u53D1\u751F\u4E86\u65B0\u7684\u8FFD\u95EE\u6216\u98CE\u9669\uFF0C\u5426\u5219\u4E0D\u8981\u6697\u793A\u4F60\u6B63\u5728\u50AC\u4EBA\u3002
|
|
46651
46845
|
|
|
46652
46846
|
\u5F02\u5E38\u7B80\u5355\u3001\u4F4E\u98CE\u9669\u3001\u4E00\u4E24\u6B65\u5C31\u80FD\u5B8C\u6210\u7684\u5C0F\u4E8B\uFF08\u7B80\u5355\u95EE\u7B54\u3001\u89E3\u91CA\u5DF2\u6709\u4FE1\u606F\u3001\u770B\u4E2A\u5217\u8868\u3001\u67E5\u4E2A\u72B6\u6001\u3001\u8BFB\u4E00\u5C0F\u6BB5\u6587\u4EF6\uFF09\uFF0C\u4F60\u53EF\u4EE5\u987A\u624B\u81EA\u5DF1\u505A\uFF0C\u4E0D\u5FC5\u4EC0\u4E48\u90FD\u7EC4\u7EC7\u5316\u3002
|
|
46653
46847
|
</\u4F60\u7684\u8EAB\u4EFD>
|
|
@@ -46666,6 +46860,7 @@ ${RUNTIME_PROCESS_SAFETY_PROMPT}
|
|
|
46666
46860
|
- \u4EFB\u52A1\u7406\u89E3\u6709\u6B67\u4E49\u65F6\uFF0C\u5148\u786E\u8BA4\u7528\u6237\u7684\u771F\u5B9E\u610F\u56FE
|
|
46667
46861
|
- \u64CD\u4F5C\u7ED3\u679C\u4F1A\u5F71\u54CD\u5176\u4ED6\u4EBA\u6216\u5916\u90E8\u7CFB\u7EDF\u65F6
|
|
46668
46862
|
- \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
|
|
46863
|
+
- \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
46864
|
- \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
46865
|
</Communication>
|
|
46671
46866
|
|
|
@@ -47662,7 +47857,7 @@ var saveResultToFile = (job, cronResp) => {
|
|
|
47662
47857
|
};
|
|
47663
47858
|
|
|
47664
47859
|
// src/tools/tools/department/ListMailbox.ts
|
|
47665
|
-
var
|
|
47860
|
+
var DESCRIPTION39 = `
|
|
47666
47861
|
\u67E5\u770B\u4F60\u7684\u90AE\u7BB1\u4E2D\u6240\u6709\u5F85\u5904\u7406\u90AE\u4EF6\u7684\u6458\u8981\u5217\u8868\u3002
|
|
47667
47862
|
|
|
47668
47863
|
\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 +47873,7 @@ var DESCRIPTION38 = `
|
|
|
47678
47873
|
`;
|
|
47679
47874
|
var listMailbox = {
|
|
47680
47875
|
name: `list_mailbox`,
|
|
47681
|
-
description:
|
|
47876
|
+
description: DESCRIPTION39,
|
|
47682
47877
|
input_schema: {
|
|
47683
47878
|
type: `object`,
|
|
47684
47879
|
properties: {},
|
|
@@ -47735,7 +47930,7 @@ ${list}`;
|
|
|
47735
47930
|
};
|
|
47736
47931
|
|
|
47737
47932
|
// src/tools/tools/department/GetMailbox.ts
|
|
47738
|
-
var
|
|
47933
|
+
var DESCRIPTION40 = `
|
|
47739
47934
|
\u83B7\u53D6\u6307\u5B9A\u90AE\u4EF6\u7684\u5B8C\u6574\u5185\u5BB9\u3002
|
|
47740
47935
|
|
|
47741
47936
|
\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 +47973,7 @@ var buildUpstreamContext = (msg) => {
|
|
|
47778
47973
|
};
|
|
47779
47974
|
var getMailbox = {
|
|
47780
47975
|
name: `get_mailbox`,
|
|
47781
|
-
description:
|
|
47976
|
+
description: DESCRIPTION40,
|
|
47782
47977
|
input_schema: {
|
|
47783
47978
|
type: `object`,
|
|
47784
47979
|
properties: {
|
|
@@ -47855,7 +48050,7 @@ ${msg.content}`;
|
|
|
47855
48050
|
};
|
|
47856
48051
|
|
|
47857
48052
|
// src/tools/tools/department/DiscardMailbox.ts
|
|
47858
|
-
var
|
|
48053
|
+
var DESCRIPTION41 = `
|
|
47859
48054
|
\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
48055
|
|
|
47861
48056
|
\u9002\u7528\u573A\u666F\uFF1A
|
|
@@ -47873,7 +48068,7 @@ var DESCRIPTION40 = `
|
|
|
47873
48068
|
`;
|
|
47874
48069
|
var discardMailbox = {
|
|
47875
48070
|
name: `discard_mailbox`,
|
|
47876
|
-
description:
|
|
48071
|
+
description: DESCRIPTION41,
|
|
47877
48072
|
input_schema: {
|
|
47878
48073
|
type: `object`,
|
|
47879
48074
|
properties: {
|
|
@@ -47955,11 +48150,11 @@ var discardMailbox = {
|
|
|
47955
48150
|
};
|
|
47956
48151
|
|
|
47957
48152
|
// src/tools/tools/department/ReplyMailbox.ts
|
|
47958
|
-
var
|
|
48153
|
+
var DESCRIPTION42 = `
|
|
47959
48154
|
\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
48155
|
|
|
47961
48156
|
\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
|
|
47962
|
-
\u5982\u679C\u53EA\u662F\u540C\u6B65\u9636\u6BB5\u6027\u8FDB\u5C55\u3001\u8BF4\u660E\u5DF2\u5B89\u6392\u4E0B\u5C5E\u3001\u8FD8\u5728\u7B49\u5F85\u6267\u884C\u7ED3\u679C\u3001\
|
|
48157
|
+
\u5982\u679C\u53EA\u662F\u540C\u6B65\u9636\u6BB5\u6027\u8FDB\u5C55\u3001\u8BF4\u660E\u5DF2\u5B89\u6392\u4E0B\u5C5E\u3001\u8FD8\u5728\u7B49\u5F85\u6267\u884C\u7ED3\u679C\u3001\u8865\u5145\u4E0A\u4E0B\u6587\u3001\u8BE2\u95EE\u72B6\u6001\u6216\u5148\u7ED9\u90E8\u5206\u53D1\u73B0\uFF0C\u5E94\u4F7F\u7528 mailbox_followup\uFF0C\u8BA9\u539F\u90AE\u4EF6\u7EE7\u7EED\u4FDD\u6301\u672A\u5B8C\u5F85\u7EED\u3002
|
|
47963
48158
|
|
|
47964
48159
|
\u53C2\u6570\uFF1A
|
|
47965
48160
|
- message_id: \u8981\u56DE\u590D\u7684\u90AE\u4EF6 id\uFF08\u4ECE list_mailbox \u6216 get_mailbox \u4E2D\u83B7\u53D6\uFF09
|
|
@@ -48019,7 +48214,7 @@ var buildUpstreamReminder = (myMailboxId, repliedToMailboxId, threadId, workItem
|
|
|
48019
48214
|
};
|
|
48020
48215
|
var replyMailbox = {
|
|
48021
48216
|
name: `reply_mailbox`,
|
|
48022
|
-
description:
|
|
48217
|
+
description: DESCRIPTION42,
|
|
48023
48218
|
input_schema: {
|
|
48024
48219
|
type: `object`,
|
|
48025
48220
|
properties: {
|
|
@@ -48581,6 +48776,7 @@ var createDepartmentAgentTools = () => {
|
|
|
48581
48776
|
registerTool(registry2, webSearchTool);
|
|
48582
48777
|
registerTool(registry2, webFetchTool);
|
|
48583
48778
|
registerTool(registry2, imageUnderstand);
|
|
48779
|
+
registerTool(registry2, imageGenerate);
|
|
48584
48780
|
registerTool(registry2, goalCreate);
|
|
48585
48781
|
registerTool(registry2, goalGet);
|
|
48586
48782
|
registerTool(registry2, goalList);
|
|
@@ -48620,7 +48816,7 @@ var getDepartmentAgentConfig = (tools, memberFocusOn, workspacePath, departmentN
|
|
|
48620
48816
|
|
|
48621
48817
|
\u8C01\u628A\u4E8B\u4EA4\u7ED9\u4F60\u3001\u8C01\u6765\u95EE\u4F60\uFF08\u901A\u5E38\u662F CEO\uFF09\uFF0C\u4F60\u5C31\u6B20\u4ED6\u4E00\u4E2A\u4EA4\u4EE3\u3002\u5728\u4F60\u628A\u6838\u5B9E\u8FC7\u7684\u771F\u5B9E\u7ED3\u8BBA\u4EA4\u56DE\u5230\u95EE\u4F60\u7684\u4EBA\u624B\u4E0A\u4E4B\u524D\uFF0C\u8FD9\u4EF6\u4E8B\u5BF9\u4F60\u90FD\u6CA1\u7B97\u5B8C\u2014\u2014\u4F60\u987A\u7740\u539F\u6765\u90A3\u5C01\u8BF7\u6C42\u7684\u7EBF\u7A0B\uFF0C\u7528\u5B83\u7684 message_id \u56DE\u7ED9\u4E0A\u6E38\uFF08reply_mailbox \u6216 mailbox_followup\uFF09\uFF1B\u53EA\u56DE\u590D Executor \u4E0D\u7B49\u4E8E\u5411\u4E0A\u6E38\u4EA4\u4EE3\u4E86\uFF0C\u90A3\u6837 CEO \u548C\u8001\u677F\u90A3\u8FB9\u6536\u4E0D\u5230\u3002\u4E0A\u6E38\u518D\u6765\u50AC\u540C\u4E00\u4EF6\u4E8B\uFF0C\u54EA\u6015\u4F60\u624B\u91CC\u5DF2\u7ECF\u6709\u6700\u7EC8\u62A5\u544A\uFF0C\u4E5F\u7167\u6837\u628A\u62A5\u544A\u6216\u7B80\u660E\u72B6\u6001\u56DE\u7ED9\u4ED6\u3002
|
|
48622
48818
|
|
|
48623
|
-
Executor \u56DE\u5F97\u6162\u3001\u6682\u65F6\u6CA1\u56DE\uFF0C\u4E0D\u662F\u4F60\u81EA\u5DF1\u4E0B\u573A\u91CD\u505A\u7684\u7406\u7531\u2014\u2014\u8BE5\u505A\u7684\u662F mailbox_followup \
|
|
48819
|
+
Executor \u56DE\u5F97\u6162\u3001\u6682\u65F6\u6CA1\u56DE\uFF0C\u4E0D\u662F\u4F60\u81EA\u5DF1\u4E0B\u573A\u91CD\u505A\u7684\u7406\u7531\u2014\u2014\u8BE5\u505A\u7684\u662F\u7ED9\u4E0B\u5C5E\u5408\u7406\u5904\u7406\u65F6\u95F4\uFF1B\u5982\u679C\u786E\u6709\u65B0\u80CC\u666F\u3001\u660E\u786E\u98CE\u9669\u6216\u5DF2\u7ECF\u8FC7\u4E86\u5408\u7406\u7B49\u5F85\u65F6\u95F4\uFF0C\u518D\u7528 mailbox_followup \u8865\u5145\u4E0A\u4E0B\u6587\u6216\u8BE2\u95EE\u771F\u5B9E\u72B6\u6001\uFF0C\u5E76\u5982\u5B9E\u8DDF\u4E0A\u6E38\u8BF4\u8FD8\u5728\u7B49\u6267\u884C\u7ED3\u679C\u3002\u7ED9\u4E0A\u6E38\u540C\u6B65\u201C\u5DF2\u5B89\u6392\u3001\u8FD8\u5728\u7B49\u3001\u5DF2\u6709\u90E8\u5206\u53D1\u73B0\u201D\u8FD9\u7C7B\u8FDB\u5C55\uFF0C\u7528 mailbox_followup\uFF1B\u7B49\u4F60\u9A8C\u6536\u5B8C\u771F\u5B9E\u7ED3\u679C\u3001\u53EF\u4EE5\u7ED9\u51FA\u6700\u7EC8\u6C47\u603B\u65F6\uFF0C\u518D\u7528 reply_mailbox \u6B63\u5F0F\u4EA4\u4ED8\u7ED3\u8BBA\u3002\u53EA\u6709\u4E0A\u6E38\u660E\u786E\u8981\u4F60\u4EB2\u81EA\u505A\u3001\u90E8\u95E8\u91CC\u786E\u5B9E\u6CA1\u6709\u4E5F\u6765\u4E0D\u53CA\u7EC4\u5EFA\u5408\u9002\u7684 Executor\u3001\u6216 Executor \u660E\u786E\u505A\u4E0D\u6210\u4E14\u4E0A\u6E38\u540C\u610F\u4F60\u63A5\u7BA1\u65F6\uFF0C\u4F60\u624D\u81EA\u5DF1\u4E0A\u624B\u90A3\u4E9B\u6267\u884C\u7C7B\u5DE5\u5177\u3002` : `\u4F60\u662F\u6267\u884C\u8005\uFF08Executor\uFF09\u3002\u522B\u4EBA\uFF08\u901A\u5E38\u662F\u4F60\u7684\u90E8\u95E8\u8D1F\u8D23\u4EBA\uFF09\u628A\u5177\u4F53\u4EFB\u52A1\u6D3E\u7ED9\u4F60\uFF0C\u4F60\u5C31\u7528\u81EA\u5DF1\u7684\u4E13\u4E1A\u80FD\u529B\u548C\u5DE5\u5177\u628A\u5B83\u505A\u51FA\u6765\uFF0C\u518D\u5982\u5B9E\u628A\u7ED3\u679C\u56DE\u7ED9\u95EE\u4F60\u7684\u4EBA\u3002\u4F60\u4E13\u6CE8\u505A\u4E8B\uFF0C\u4E0D\u53BB\u67E5\u770B\u6574\u4E2A\u90E8\u95E8\u6210\u5458\u540D\u518C\uFF0C\u4E5F\u4E0D\u521B\u5EFA\u6210\u5458\u2014\u2014\u7EC4\u5EFA\u56E2\u961F\u662F\u8D1F\u8D23\u4EBA\u7684\u4E8B\u3002`;
|
|
48624
48820
|
const defaultSystemPrompt = `
|
|
48625
48821
|
${COMPANY_VALUES_PROMPT}
|
|
48626
48822
|
|
|
@@ -48649,8 +48845,8 @@ ${workspacePath ? `
|
|
|
48649
48845
|
\u4F60\u901A\u8FC7\u90AE\u7BB1\u548C\u540C\u4E8B\u534F\u4F5C\u3002\u6536\u5230\u65B0\u90AE\u4EF6\u63D0\u9192\u540E\uFF0C\u7528 list_mailbox \u770B\u770B\u6709\u54EA\u4E9B\u5F85\u5904\u7406\u7684\u90AE\u4EF6\uFF0C\u6311\u4E00\u5C01\u7528 get_mailbox \u9886\u53D6\u5E76\u8BFB\u5168\u6587\uFF0C\u628A\u5B83\u505A\u5B8C\u6216\u95EE\u6E05\u695A\uFF0C\u518D\u56DE\u590D\u3002\u5904\u7406\u5B8C\u4E00\u5C01\u7EE7\u7EED list_mailbox \u770B\u4E0B\u4E00\u5C01\u3002
|
|
48650
48846
|
|
|
48651
48847
|
\u51E0\u4E2A\u5DE5\u5177\u7684\u542B\u4E49\u8981\u5206\u6E05\uFF0C\u522B\u53EA\u7528\u81EA\u7136\u8BED\u8A00\u8BF4\u8BF4\u5C31\u7B97\u6570\uFF1A
|
|
48652
|
-
- mailbox_followup(message_id, content)\uFF1A\u5728\u540C\u4E00\u7EBF\u7A0B\u91CC\u7EE7\u7EED\u6C9F\u901A\u2014\u2014\u540C\u6B65\u8FDB\u5C55\u3001\u8865\u5145\u7ED3\u679C\u3001\
|
|
48653
|
-
- reply_mailbox(message_id, content)\uFF1A\u4F60\u5BF9\u8FD9\u5C01\u90AE\u4EF6\u5DF2\u7ECF\u5F62\u6210\u53EF\u4EE5\u4EA4\u4ED8\u7ED9\u5BF9\u65B9\u7684\u6B63\u5F0F\u7ED3\u8BBA\uFF0C\u56DE\u590D\u5E76\u7ED3\u675F\u5B83\u3002\u6BCF\u5C01\u90AE\u4EF6\u7528\u5B83\u81EA\u5DF1\u7684 message_id \u56DE\u590D\uFF0C\u522B\u62FF\u4E00\u6BB5\u8BDD\u540C\u65F6\u5145\u5F53\u591A\u5C01\u90AE\u4EF6\u7684\u7B54\u590D\u3002\u8FD8\u5728\u7B49\u5F85\u4E0B\u6E38\u3001\u53EA\u662F\u540C\u6B65\u5B89\u6392\u6216\
|
|
48848
|
+
- mailbox_followup(message_id, content)\uFF1A\u5728\u540C\u4E00\u7EBF\u7A0B\u91CC\u7EE7\u7EED\u6C9F\u901A\u2014\u2014\u540C\u6B65\u8FDB\u5C55\u3001\u8865\u5145\u7ED3\u679C\u3001\u8865\u5145\u4E0A\u4E0B\u6587\u6216\u8BE2\u95EE\u72B6\u6001\uFF1B\u53EF\u4EE5\u591A\u6B21\uFF0C\u4E0D\u4F1A\u7ED3\u675F\u8FD9\u5C01\u90AE\u4EF6\u3002
|
|
48849
|
+
- reply_mailbox(message_id, content)\uFF1A\u4F60\u5BF9\u8FD9\u5C01\u90AE\u4EF6\u5DF2\u7ECF\u5F62\u6210\u53EF\u4EE5\u4EA4\u4ED8\u7ED9\u5BF9\u65B9\u7684\u6B63\u5F0F\u7ED3\u8BBA\uFF0C\u56DE\u590D\u5E76\u7ED3\u675F\u5B83\u3002\u6BCF\u5C01\u90AE\u4EF6\u7528\u5B83\u81EA\u5DF1\u7684 message_id \u56DE\u590D\uFF0C\u522B\u62FF\u4E00\u6BB5\u8BDD\u540C\u65F6\u5145\u5F53\u591A\u5C01\u90AE\u4EF6\u7684\u7B54\u590D\u3002\u8FD8\u5728\u7B49\u5F85\u4E0B\u6E38\u3001\u53EA\u662F\u540C\u6B65\u5B89\u6392\u6216\u8BE2\u95EE\u72B6\u6001\u65F6\uFF0C\u4E0D\u8981\u7528\u5B83\u7ED3\u675F\u4E0A\u6E38\u8BF7\u6C42\u3002
|
|
48654
48850
|
- discard_mailbox(message_id, reason)\uFF1A\u53EA\u6709\u5F53\u8FD9\u5C01\u90AE\u4EF6\u786E\u5B9E\u65E0\u9700\u4E1A\u52A1\u56DE\u590D\uFF08\u7EAF\u56DE\u6267\u3001\u91CD\u590D\u901A\u77E5\u3001\u5DF2\u88AB\u5176\u4ED6\u90AE\u4EF6\u8986\u76D6\uFF09\u65F6\u624D\u7528\uFF1B\u5B83\u4F1A\u7ED3\u675F\u90AE\u4EF6\uFF0C\u4F46\u4E0D\u4F1A\u7ED9\u53D1\u9001\u8005\u56DE\u4FE1\u3002
|
|
48655
48851
|
- \u9700\u8981\u4E3B\u52A8\u8054\u7CFB\u522B\u7684\u90E8\u95E8\u6210\u5458\uFF0C\u7528 department_communicate\u3002
|
|
48656
48852
|
|
|
@@ -48854,26 +49050,26 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
48854
49050
|
};
|
|
48855
49051
|
|
|
48856
49052
|
// node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/url.js
|
|
48857
|
-
var splitPath = (
|
|
48858
|
-
const paths =
|
|
49053
|
+
var splitPath = (path22) => {
|
|
49054
|
+
const paths = path22.split("/");
|
|
48859
49055
|
if (paths[0] === "") {
|
|
48860
49056
|
paths.shift();
|
|
48861
49057
|
}
|
|
48862
49058
|
return paths;
|
|
48863
49059
|
};
|
|
48864
49060
|
var splitRoutingPath = (routePath) => {
|
|
48865
|
-
const { groups, path:
|
|
48866
|
-
const paths = splitPath(
|
|
49061
|
+
const { groups, path: path22 } = extractGroupsFromPath(routePath);
|
|
49062
|
+
const paths = splitPath(path22);
|
|
48867
49063
|
return replaceGroupMarks(paths, groups);
|
|
48868
49064
|
};
|
|
48869
|
-
var extractGroupsFromPath = (
|
|
49065
|
+
var extractGroupsFromPath = (path22) => {
|
|
48870
49066
|
const groups = [];
|
|
48871
|
-
|
|
49067
|
+
path22 = path22.replace(/\{[^}]+\}/g, (match2, index) => {
|
|
48872
49068
|
const mark = `@${index}`;
|
|
48873
49069
|
groups.push([mark, match2]);
|
|
48874
49070
|
return mark;
|
|
48875
49071
|
});
|
|
48876
|
-
return { groups, path:
|
|
49072
|
+
return { groups, path: path22 };
|
|
48877
49073
|
};
|
|
48878
49074
|
var replaceGroupMarks = (paths, groups) => {
|
|
48879
49075
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
@@ -48930,8 +49126,8 @@ var getPath = (request) => {
|
|
|
48930
49126
|
const queryIndex = url.indexOf("?", i);
|
|
48931
49127
|
const hashIndex = url.indexOf("#", i);
|
|
48932
49128
|
const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);
|
|
48933
|
-
const
|
|
48934
|
-
return tryDecodeURI(
|
|
49129
|
+
const path22 = url.slice(start, end);
|
|
49130
|
+
return tryDecodeURI(path22.includes("%25") ? path22.replace(/%25/g, "%2525") : path22);
|
|
48935
49131
|
} else if (charCode === 63 || charCode === 35) {
|
|
48936
49132
|
break;
|
|
48937
49133
|
}
|
|
@@ -48948,11 +49144,11 @@ var mergePath = (base, sub, ...rest) => {
|
|
|
48948
49144
|
}
|
|
48949
49145
|
return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
|
|
48950
49146
|
};
|
|
48951
|
-
var checkOptionalParameter = (
|
|
48952
|
-
if (
|
|
49147
|
+
var checkOptionalParameter = (path22) => {
|
|
49148
|
+
if (path22.charCodeAt(path22.length - 1) !== 63 || !path22.includes(":")) {
|
|
48953
49149
|
return null;
|
|
48954
49150
|
}
|
|
48955
|
-
const segments =
|
|
49151
|
+
const segments = path22.split("/");
|
|
48956
49152
|
const results = [];
|
|
48957
49153
|
let basePath = "";
|
|
48958
49154
|
segments.forEach((segment) => {
|
|
@@ -49093,9 +49289,9 @@ var HonoRequest = class {
|
|
|
49093
49289
|
*/
|
|
49094
49290
|
path;
|
|
49095
49291
|
bodyCache = {};
|
|
49096
|
-
constructor(request,
|
|
49292
|
+
constructor(request, path22 = "/", matchResult = [[]]) {
|
|
49097
49293
|
this.raw = request;
|
|
49098
|
-
this.path =
|
|
49294
|
+
this.path = path22;
|
|
49099
49295
|
this.#matchResult = matchResult;
|
|
49100
49296
|
this.#validatedData = {};
|
|
49101
49297
|
}
|
|
@@ -49832,8 +50028,8 @@ var Hono = class _Hono {
|
|
|
49832
50028
|
return this;
|
|
49833
50029
|
};
|
|
49834
50030
|
});
|
|
49835
|
-
this.on = (method,
|
|
49836
|
-
for (const p of [
|
|
50031
|
+
this.on = (method, path22, ...handlers) => {
|
|
50032
|
+
for (const p of [path22].flat()) {
|
|
49837
50033
|
this.#path = p;
|
|
49838
50034
|
for (const m of [method].flat()) {
|
|
49839
50035
|
handlers.map((handler) => {
|
|
@@ -49890,8 +50086,8 @@ var Hono = class _Hono {
|
|
|
49890
50086
|
* app.route("/api", app2) // GET /api/user
|
|
49891
50087
|
* ```
|
|
49892
50088
|
*/
|
|
49893
|
-
route(
|
|
49894
|
-
const subApp = this.basePath(
|
|
50089
|
+
route(path22, app) {
|
|
50090
|
+
const subApp = this.basePath(path22);
|
|
49895
50091
|
app.routes.map((r) => {
|
|
49896
50092
|
let handler;
|
|
49897
50093
|
if (app.errorHandler === errorHandler) {
|
|
@@ -49917,9 +50113,9 @@ var Hono = class _Hono {
|
|
|
49917
50113
|
* const api = new Hono().basePath('/api')
|
|
49918
50114
|
* ```
|
|
49919
50115
|
*/
|
|
49920
|
-
basePath(
|
|
50116
|
+
basePath(path22) {
|
|
49921
50117
|
const subApp = this.#clone();
|
|
49922
|
-
subApp._basePath = mergePath(this._basePath,
|
|
50118
|
+
subApp._basePath = mergePath(this._basePath, path22);
|
|
49923
50119
|
return subApp;
|
|
49924
50120
|
}
|
|
49925
50121
|
/**
|
|
@@ -49993,7 +50189,7 @@ var Hono = class _Hono {
|
|
|
49993
50189
|
* })
|
|
49994
50190
|
* ```
|
|
49995
50191
|
*/
|
|
49996
|
-
mount(
|
|
50192
|
+
mount(path22, applicationHandler, options) {
|
|
49997
50193
|
let replaceRequest;
|
|
49998
50194
|
let optionHandler;
|
|
49999
50195
|
if (options) {
|
|
@@ -50020,7 +50216,7 @@ var Hono = class _Hono {
|
|
|
50020
50216
|
return [c.env, executionContext];
|
|
50021
50217
|
};
|
|
50022
50218
|
replaceRequest ||= (() => {
|
|
50023
|
-
const mergedPath = mergePath(this._basePath,
|
|
50219
|
+
const mergedPath = mergePath(this._basePath, path22);
|
|
50024
50220
|
const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
|
|
50025
50221
|
return (request) => {
|
|
50026
50222
|
const url = new URL(request.url);
|
|
@@ -50035,14 +50231,14 @@ var Hono = class _Hono {
|
|
|
50035
50231
|
}
|
|
50036
50232
|
await next();
|
|
50037
50233
|
};
|
|
50038
|
-
this.#addRoute(METHOD_NAME_ALL, mergePath(
|
|
50234
|
+
this.#addRoute(METHOD_NAME_ALL, mergePath(path22, "*"), handler);
|
|
50039
50235
|
return this;
|
|
50040
50236
|
}
|
|
50041
|
-
#addRoute(method,
|
|
50237
|
+
#addRoute(method, path22, handler) {
|
|
50042
50238
|
method = method.toUpperCase();
|
|
50043
|
-
|
|
50044
|
-
const r = { basePath: this._basePath, path:
|
|
50045
|
-
this.router.add(method,
|
|
50239
|
+
path22 = mergePath(this._basePath, path22);
|
|
50240
|
+
const r = { basePath: this._basePath, path: path22, method, handler };
|
|
50241
|
+
this.router.add(method, path22, [handler, r]);
|
|
50046
50242
|
this.routes.push(r);
|
|
50047
50243
|
}
|
|
50048
50244
|
#handleError(err, c) {
|
|
@@ -50055,10 +50251,10 @@ var Hono = class _Hono {
|
|
|
50055
50251
|
if (method === "HEAD") {
|
|
50056
50252
|
return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
|
|
50057
50253
|
}
|
|
50058
|
-
const
|
|
50059
|
-
const matchResult = this.router.match(method,
|
|
50254
|
+
const path22 = this.getPath(request, { env });
|
|
50255
|
+
const matchResult = this.router.match(method, path22);
|
|
50060
50256
|
const c = new Context(request, {
|
|
50061
|
-
path:
|
|
50257
|
+
path: path22,
|
|
50062
50258
|
matchResult,
|
|
50063
50259
|
env,
|
|
50064
50260
|
executionCtx,
|
|
@@ -50158,15 +50354,15 @@ var Hono = class _Hono {
|
|
|
50158
50354
|
|
|
50159
50355
|
// node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
50160
50356
|
var emptyParam = [];
|
|
50161
|
-
function match(method,
|
|
50357
|
+
function match(method, path22) {
|
|
50162
50358
|
const matchers = this.buildAllMatchers();
|
|
50163
|
-
const match2 = ((method2,
|
|
50359
|
+
const match2 = ((method2, path23) => {
|
|
50164
50360
|
const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
|
|
50165
|
-
const staticMatch = matcher[2][
|
|
50361
|
+
const staticMatch = matcher[2][path23];
|
|
50166
50362
|
if (staticMatch) {
|
|
50167
50363
|
return staticMatch;
|
|
50168
50364
|
}
|
|
50169
|
-
const match3 =
|
|
50365
|
+
const match3 = path23.match(matcher[0]);
|
|
50170
50366
|
if (!match3) {
|
|
50171
50367
|
return [[], emptyParam];
|
|
50172
50368
|
}
|
|
@@ -50174,7 +50370,7 @@ function match(method, path21) {
|
|
|
50174
50370
|
return [matcher[1][index], match3];
|
|
50175
50371
|
});
|
|
50176
50372
|
this.match = match2;
|
|
50177
|
-
return match2(method,
|
|
50373
|
+
return match2(method, path22);
|
|
50178
50374
|
}
|
|
50179
50375
|
|
|
50180
50376
|
// node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
@@ -50289,12 +50485,12 @@ var Node = class _Node {
|
|
|
50289
50485
|
var Trie = class {
|
|
50290
50486
|
#context = { varIndex: 0 };
|
|
50291
50487
|
#root = new Node();
|
|
50292
|
-
insert(
|
|
50488
|
+
insert(path22, index, pathErrorCheckOnly) {
|
|
50293
50489
|
const paramAssoc = [];
|
|
50294
50490
|
const groups = [];
|
|
50295
50491
|
for (let i = 0; ; ) {
|
|
50296
50492
|
let replaced = false;
|
|
50297
|
-
|
|
50493
|
+
path22 = path22.replace(/\{[^}]+\}/g, (m) => {
|
|
50298
50494
|
const mark = `@\\${i}`;
|
|
50299
50495
|
groups[i] = [mark, m];
|
|
50300
50496
|
i++;
|
|
@@ -50305,7 +50501,7 @@ var Trie = class {
|
|
|
50305
50501
|
break;
|
|
50306
50502
|
}
|
|
50307
50503
|
}
|
|
50308
|
-
const tokens =
|
|
50504
|
+
const tokens = path22.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
|
|
50309
50505
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
50310
50506
|
const [mark] = groups[i];
|
|
50311
50507
|
for (let j = tokens.length - 1; j >= 0; j--) {
|
|
@@ -50344,9 +50540,9 @@ var Trie = class {
|
|
|
50344
50540
|
// node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
50345
50541
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
50346
50542
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
50347
|
-
function buildWildcardRegExp(
|
|
50348
|
-
return wildcardRegExpCache[
|
|
50349
|
-
|
|
50543
|
+
function buildWildcardRegExp(path22) {
|
|
50544
|
+
return wildcardRegExpCache[path22] ??= new RegExp(
|
|
50545
|
+
path22 === "*" ? "" : `^${path22.replace(
|
|
50350
50546
|
/\/\*$|([.\\+*[^\]$()])/g,
|
|
50351
50547
|
(_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
|
|
50352
50548
|
)}$`
|
|
@@ -50368,17 +50564,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
|
|
|
50368
50564
|
);
|
|
50369
50565
|
const staticMap = /* @__PURE__ */ Object.create(null);
|
|
50370
50566
|
for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
|
|
50371
|
-
const [pathErrorCheckOnly,
|
|
50567
|
+
const [pathErrorCheckOnly, path22, handlers] = routesWithStaticPathFlag[i];
|
|
50372
50568
|
if (pathErrorCheckOnly) {
|
|
50373
|
-
staticMap[
|
|
50569
|
+
staticMap[path22] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
|
|
50374
50570
|
} else {
|
|
50375
50571
|
j++;
|
|
50376
50572
|
}
|
|
50377
50573
|
let paramAssoc;
|
|
50378
50574
|
try {
|
|
50379
|
-
paramAssoc = trie.insert(
|
|
50575
|
+
paramAssoc = trie.insert(path22, j, pathErrorCheckOnly);
|
|
50380
50576
|
} catch (e) {
|
|
50381
|
-
throw e === PATH_ERROR ? new UnsupportedPathError(
|
|
50577
|
+
throw e === PATH_ERROR ? new UnsupportedPathError(path22) : e;
|
|
50382
50578
|
}
|
|
50383
50579
|
if (pathErrorCheckOnly) {
|
|
50384
50580
|
continue;
|
|
@@ -50412,12 +50608,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
|
|
|
50412
50608
|
}
|
|
50413
50609
|
return [regexp, handlerMap, staticMap];
|
|
50414
50610
|
}
|
|
50415
|
-
function findMiddleware(middleware,
|
|
50611
|
+
function findMiddleware(middleware, path22) {
|
|
50416
50612
|
if (!middleware) {
|
|
50417
50613
|
return void 0;
|
|
50418
50614
|
}
|
|
50419
50615
|
for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
|
|
50420
|
-
if (buildWildcardRegExp(k).test(
|
|
50616
|
+
if (buildWildcardRegExp(k).test(path22)) {
|
|
50421
50617
|
return [...middleware[k]];
|
|
50422
50618
|
}
|
|
50423
50619
|
}
|
|
@@ -50431,7 +50627,7 @@ var RegExpRouter = class {
|
|
|
50431
50627
|
this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
50432
50628
|
this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
50433
50629
|
}
|
|
50434
|
-
add(method,
|
|
50630
|
+
add(method, path22, handler) {
|
|
50435
50631
|
const middleware = this.#middleware;
|
|
50436
50632
|
const routes = this.#routes;
|
|
50437
50633
|
if (!middleware || !routes) {
|
|
@@ -50446,18 +50642,18 @@ var RegExpRouter = class {
|
|
|
50446
50642
|
});
|
|
50447
50643
|
});
|
|
50448
50644
|
}
|
|
50449
|
-
if (
|
|
50450
|
-
|
|
50645
|
+
if (path22 === "/*") {
|
|
50646
|
+
path22 = "*";
|
|
50451
50647
|
}
|
|
50452
|
-
const paramCount = (
|
|
50453
|
-
if (/\*$/.test(
|
|
50454
|
-
const re = buildWildcardRegExp(
|
|
50648
|
+
const paramCount = (path22.match(/\/:/g) || []).length;
|
|
50649
|
+
if (/\*$/.test(path22)) {
|
|
50650
|
+
const re = buildWildcardRegExp(path22);
|
|
50455
50651
|
if (method === METHOD_NAME_ALL) {
|
|
50456
50652
|
Object.keys(middleware).forEach((m) => {
|
|
50457
|
-
middleware[m][
|
|
50653
|
+
middleware[m][path22] ||= findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || [];
|
|
50458
50654
|
});
|
|
50459
50655
|
} else {
|
|
50460
|
-
middleware[method][
|
|
50656
|
+
middleware[method][path22] ||= findMiddleware(middleware[method], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || [];
|
|
50461
50657
|
}
|
|
50462
50658
|
Object.keys(middleware).forEach((m) => {
|
|
50463
50659
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
@@ -50475,15 +50671,15 @@ var RegExpRouter = class {
|
|
|
50475
50671
|
});
|
|
50476
50672
|
return;
|
|
50477
50673
|
}
|
|
50478
|
-
const paths = checkOptionalParameter(
|
|
50674
|
+
const paths = checkOptionalParameter(path22) || [path22];
|
|
50479
50675
|
for (let i = 0, len = paths.length; i < len; i++) {
|
|
50480
|
-
const
|
|
50676
|
+
const path23 = paths[i];
|
|
50481
50677
|
Object.keys(routes).forEach((m) => {
|
|
50482
50678
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
50483
|
-
routes[m][
|
|
50484
|
-
...findMiddleware(middleware[m],
|
|
50679
|
+
routes[m][path23] ||= [
|
|
50680
|
+
...findMiddleware(middleware[m], path23) || findMiddleware(middleware[METHOD_NAME_ALL], path23) || []
|
|
50485
50681
|
];
|
|
50486
|
-
routes[m][
|
|
50682
|
+
routes[m][path23].push([handler, paramCount - len + i + 1]);
|
|
50487
50683
|
}
|
|
50488
50684
|
});
|
|
50489
50685
|
}
|
|
@@ -50502,13 +50698,13 @@ var RegExpRouter = class {
|
|
|
50502
50698
|
const routes = [];
|
|
50503
50699
|
let hasOwnRoute = method === METHOD_NAME_ALL;
|
|
50504
50700
|
[this.#middleware, this.#routes].forEach((r) => {
|
|
50505
|
-
const ownRoute = r[method] ? Object.keys(r[method]).map((
|
|
50701
|
+
const ownRoute = r[method] ? Object.keys(r[method]).map((path22) => [path22, r[method][path22]]) : [];
|
|
50506
50702
|
if (ownRoute.length !== 0) {
|
|
50507
50703
|
hasOwnRoute ||= true;
|
|
50508
50704
|
routes.push(...ownRoute);
|
|
50509
50705
|
} else if (method !== METHOD_NAME_ALL) {
|
|
50510
50706
|
routes.push(
|
|
50511
|
-
...Object.keys(r[METHOD_NAME_ALL]).map((
|
|
50707
|
+
...Object.keys(r[METHOD_NAME_ALL]).map((path22) => [path22, r[METHOD_NAME_ALL][path22]])
|
|
50512
50708
|
);
|
|
50513
50709
|
}
|
|
50514
50710
|
});
|
|
@@ -50528,13 +50724,13 @@ var SmartRouter = class {
|
|
|
50528
50724
|
constructor(init) {
|
|
50529
50725
|
this.#routers = init.routers;
|
|
50530
50726
|
}
|
|
50531
|
-
add(method,
|
|
50727
|
+
add(method, path22, handler) {
|
|
50532
50728
|
if (!this.#routes) {
|
|
50533
50729
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
50534
50730
|
}
|
|
50535
|
-
this.#routes.push([method,
|
|
50731
|
+
this.#routes.push([method, path22, handler]);
|
|
50536
50732
|
}
|
|
50537
|
-
match(method,
|
|
50733
|
+
match(method, path22) {
|
|
50538
50734
|
if (!this.#routes) {
|
|
50539
50735
|
throw new Error("Fatal error");
|
|
50540
50736
|
}
|
|
@@ -50549,7 +50745,7 @@ var SmartRouter = class {
|
|
|
50549
50745
|
for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {
|
|
50550
50746
|
router.add(...routes[i2]);
|
|
50551
50747
|
}
|
|
50552
|
-
res = router.match(method,
|
|
50748
|
+
res = router.match(method, path22);
|
|
50553
50749
|
} catch (e) {
|
|
50554
50750
|
if (e instanceof UnsupportedPathError) {
|
|
50555
50751
|
continue;
|
|
@@ -50599,10 +50795,10 @@ var Node2 = class _Node2 {
|
|
|
50599
50795
|
}
|
|
50600
50796
|
this.#patterns = [];
|
|
50601
50797
|
}
|
|
50602
|
-
insert(method,
|
|
50798
|
+
insert(method, path22, handler) {
|
|
50603
50799
|
this.#order = ++this.#order;
|
|
50604
50800
|
let curNode = this;
|
|
50605
|
-
const parts = splitRoutingPath(
|
|
50801
|
+
const parts = splitRoutingPath(path22);
|
|
50606
50802
|
const possibleKeys = [];
|
|
50607
50803
|
for (let i = 0, len = parts.length; i < len; i++) {
|
|
50608
50804
|
const p = parts[i];
|
|
@@ -50651,12 +50847,12 @@ var Node2 = class _Node2 {
|
|
|
50651
50847
|
}
|
|
50652
50848
|
}
|
|
50653
50849
|
}
|
|
50654
|
-
search(method,
|
|
50850
|
+
search(method, path22) {
|
|
50655
50851
|
const handlerSets = [];
|
|
50656
50852
|
this.#params = emptyParams;
|
|
50657
50853
|
const curNode = this;
|
|
50658
50854
|
let curNodes = [curNode];
|
|
50659
|
-
const parts = splitPath(
|
|
50855
|
+
const parts = splitPath(path22);
|
|
50660
50856
|
const curNodesQueue = [];
|
|
50661
50857
|
const len = parts.length;
|
|
50662
50858
|
let partOffsets = null;
|
|
@@ -50698,13 +50894,13 @@ var Node2 = class _Node2 {
|
|
|
50698
50894
|
if (matcher instanceof RegExp) {
|
|
50699
50895
|
if (partOffsets === null) {
|
|
50700
50896
|
partOffsets = new Array(len);
|
|
50701
|
-
let offset =
|
|
50897
|
+
let offset = path22[0] === "/" ? 1 : 0;
|
|
50702
50898
|
for (let p = 0; p < len; p++) {
|
|
50703
50899
|
partOffsets[p] = offset;
|
|
50704
50900
|
offset += parts[p].length + 1;
|
|
50705
50901
|
}
|
|
50706
50902
|
}
|
|
50707
|
-
const restPathString =
|
|
50903
|
+
const restPathString = path22.substring(partOffsets[i]);
|
|
50708
50904
|
const m = matcher.exec(restPathString);
|
|
50709
50905
|
if (m) {
|
|
50710
50906
|
params[name] = m[0];
|
|
@@ -50757,18 +50953,18 @@ var TrieRouter = class {
|
|
|
50757
50953
|
constructor() {
|
|
50758
50954
|
this.#node = new Node2();
|
|
50759
50955
|
}
|
|
50760
|
-
add(method,
|
|
50761
|
-
const results = checkOptionalParameter(
|
|
50956
|
+
add(method, path22, handler) {
|
|
50957
|
+
const results = checkOptionalParameter(path22);
|
|
50762
50958
|
if (results) {
|
|
50763
50959
|
for (let i = 0, len = results.length; i < len; i++) {
|
|
50764
50960
|
this.#node.insert(method, results[i], handler);
|
|
50765
50961
|
}
|
|
50766
50962
|
return;
|
|
50767
50963
|
}
|
|
50768
|
-
this.#node.insert(method,
|
|
50964
|
+
this.#node.insert(method, path22, handler);
|
|
50769
50965
|
}
|
|
50770
|
-
match(method,
|
|
50771
|
-
return this.#node.search(method,
|
|
50966
|
+
match(method, path22) {
|
|
50967
|
+
return this.#node.search(method, path22);
|
|
50772
50968
|
}
|
|
50773
50969
|
};
|
|
50774
50970
|
|
|
@@ -51470,10 +51666,10 @@ var createStreamBody = (stream) => {
|
|
|
51470
51666
|
});
|
|
51471
51667
|
return body;
|
|
51472
51668
|
};
|
|
51473
|
-
var getStats = (
|
|
51669
|
+
var getStats = (path22) => {
|
|
51474
51670
|
let stats;
|
|
51475
51671
|
try {
|
|
51476
|
-
stats = (0, import_fs15.statSync)(
|
|
51672
|
+
stats = (0, import_fs15.statSync)(path22);
|
|
51477
51673
|
} catch {
|
|
51478
51674
|
}
|
|
51479
51675
|
return stats;
|
|
@@ -51516,21 +51712,21 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
51516
51712
|
return next();
|
|
51517
51713
|
}
|
|
51518
51714
|
}
|
|
51519
|
-
let
|
|
51715
|
+
let path22 = (0, import_path19.join)(
|
|
51520
51716
|
root,
|
|
51521
51717
|
!optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename
|
|
51522
51718
|
);
|
|
51523
|
-
let stats = getStats(
|
|
51719
|
+
let stats = getStats(path22);
|
|
51524
51720
|
if (stats && stats.isDirectory()) {
|
|
51525
51721
|
const indexFile = options.index ?? "index.html";
|
|
51526
|
-
|
|
51527
|
-
stats = getStats(
|
|
51722
|
+
path22 = (0, import_path19.join)(path22, indexFile);
|
|
51723
|
+
stats = getStats(path22);
|
|
51528
51724
|
}
|
|
51529
51725
|
if (!stats) {
|
|
51530
|
-
await options.onNotFound?.(
|
|
51726
|
+
await options.onNotFound?.(path22, c);
|
|
51531
51727
|
return next();
|
|
51532
51728
|
}
|
|
51533
|
-
const mimeType = getMimeType(
|
|
51729
|
+
const mimeType = getMimeType(path22);
|
|
51534
51730
|
c.header("Content-Type", mimeType || "application/octet-stream");
|
|
51535
51731
|
if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
|
|
51536
51732
|
const acceptEncodingSet = new Set(
|
|
@@ -51540,12 +51736,12 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
51540
51736
|
if (!acceptEncodingSet.has(encoding)) {
|
|
51541
51737
|
continue;
|
|
51542
51738
|
}
|
|
51543
|
-
const precompressedStats = getStats(
|
|
51739
|
+
const precompressedStats = getStats(path22 + ENCODINGS[encoding]);
|
|
51544
51740
|
if (precompressedStats) {
|
|
51545
51741
|
c.header("Content-Encoding", encoding);
|
|
51546
51742
|
c.header("Vary", "Accept-Encoding", { append: true });
|
|
51547
51743
|
stats = precompressedStats;
|
|
51548
|
-
|
|
51744
|
+
path22 = path22 + ENCODINGS[encoding];
|
|
51549
51745
|
break;
|
|
51550
51746
|
}
|
|
51551
51747
|
}
|
|
@@ -51559,7 +51755,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
51559
51755
|
result = c.body(null);
|
|
51560
51756
|
} else if (!range) {
|
|
51561
51757
|
c.header("Content-Length", size.toString());
|
|
51562
|
-
result = c.body(createStreamBody((0, import_fs15.createReadStream)(
|
|
51758
|
+
result = c.body(createStreamBody((0, import_fs15.createReadStream)(path22)), 200);
|
|
51563
51759
|
} else {
|
|
51564
51760
|
c.header("Accept-Ranges", "bytes");
|
|
51565
51761
|
c.header("Date", stats.birthtime.toUTCString());
|
|
@@ -51570,12 +51766,12 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
51570
51766
|
end = size - 1;
|
|
51571
51767
|
}
|
|
51572
51768
|
const chunksize = end - start + 1;
|
|
51573
|
-
const stream = (0, import_fs15.createReadStream)(
|
|
51769
|
+
const stream = (0, import_fs15.createReadStream)(path22, { start, end });
|
|
51574
51770
|
c.header("Content-Length", chunksize.toString());
|
|
51575
51771
|
c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
|
|
51576
51772
|
result = c.body(createStreamBody(stream), 206);
|
|
51577
51773
|
}
|
|
51578
|
-
await options.onFound?.(
|
|
51774
|
+
await options.onFound?.(path22, c);
|
|
51579
51775
|
return result;
|
|
51580
51776
|
};
|
|
51581
51777
|
};
|
|
@@ -51669,8 +51865,8 @@ var cors = (options) => {
|
|
|
51669
51865
|
};
|
|
51670
51866
|
|
|
51671
51867
|
// src/server/index.ts
|
|
51672
|
-
var
|
|
51673
|
-
var
|
|
51868
|
+
var import_promises14 = require("node:fs/promises");
|
|
51869
|
+
var import_node_path19 = __toESM(require("node:path"));
|
|
51674
51870
|
|
|
51675
51871
|
// src/git/worktree.ts
|
|
51676
51872
|
var import_child_process2 = require("child_process");
|
|
@@ -53016,7 +53212,7 @@ mailboxRoutes.get("/mailbox/summary", (c) => {
|
|
|
53016
53212
|
// src/server/routes/memory.ts
|
|
53017
53213
|
var import_redis4 = __toESM(require_dist2());
|
|
53018
53214
|
var import_node_fs8 = require("node:fs");
|
|
53019
|
-
var
|
|
53215
|
+
var import_node_path16 = __toESM(require("node:path"));
|
|
53020
53216
|
var memoryEngineSingleton = null;
|
|
53021
53217
|
var dreamStorageSingleton = null;
|
|
53022
53218
|
var dreamHistoryStorageSingleton = null;
|
|
@@ -53121,7 +53317,7 @@ var readJsonFilesFromDir = (dir) => {
|
|
|
53121
53317
|
for (const file of (0, import_node_fs8.readdirSync)(dir)) {
|
|
53122
53318
|
if (!file.endsWith(".json")) continue;
|
|
53123
53319
|
try {
|
|
53124
|
-
result.push(JSON.parse((0, import_node_fs8.readFileSync)(
|
|
53320
|
+
result.push(JSON.parse((0, import_node_fs8.readFileSync)(import_node_path16.default.join(dir, file), "utf-8")));
|
|
53125
53321
|
} catch (err) {
|
|
53126
53322
|
console.warn(`[memoryRoutes] \u8DF3\u8FC7\u65E0\u6CD5\u89E3\u6790\u7684\u672C\u5730\u4E0A\u4E0B\u6587\u6587\u4EF6 ${file}: ${err.message}`);
|
|
53127
53323
|
}
|
|
@@ -53129,11 +53325,11 @@ var readJsonFilesFromDir = (dir) => {
|
|
|
53129
53325
|
return result;
|
|
53130
53326
|
};
|
|
53131
53327
|
var extractFileBackedStorageKeysForTest = (dataDir) => {
|
|
53132
|
-
const kvRoot =
|
|
53328
|
+
const kvRoot = import_node_path16.default.join(dataDir, "kv");
|
|
53133
53329
|
if (!(0, import_node_fs8.existsSync)(kvRoot)) return [];
|
|
53134
53330
|
const keys = [];
|
|
53135
53331
|
for (const prefixDir of (0, import_node_fs8.readdirSync)(kvRoot)) {
|
|
53136
|
-
const absolutePrefixDir =
|
|
53332
|
+
const absolutePrefixDir = import_node_path16.default.join(kvRoot, prefixDir);
|
|
53137
53333
|
if (!(0, import_node_fs8.existsSync)(absolutePrefixDir)) continue;
|
|
53138
53334
|
for (const file of (0, import_node_fs8.readdirSync)(absolutePrefixDir)) {
|
|
53139
53335
|
if (!file.endsWith(".json")) continue;
|
|
@@ -53153,12 +53349,12 @@ var collectLocalConversationUserIds = () => {
|
|
|
53153
53349
|
};
|
|
53154
53350
|
var extractLocalConversationUserIdsForTest = (homeDir) => {
|
|
53155
53351
|
const userIds = /* @__PURE__ */ new Set();
|
|
53156
|
-
for (const context of readJsonFilesFromDir(
|
|
53352
|
+
for (const context of readJsonFilesFromDir(import_node_path16.default.join(homeDir, "goal-context"))) {
|
|
53157
53353
|
addPlausibleUserId(userIds, context.threadId);
|
|
53158
53354
|
addPlausibleUserId(userIds, context.originUserId);
|
|
53159
53355
|
if (context.goalId) addPlausibleUserId(userIds, `kanban:goal:${context.goalId}`);
|
|
53160
53356
|
}
|
|
53161
|
-
for (const goal of readJsonFilesFromDir(
|
|
53357
|
+
for (const goal of readJsonFilesFromDir(import_node_path16.default.join(homeDir, "tasks"))) {
|
|
53162
53358
|
if (goal.id) addPlausibleUserId(userIds, `kanban:goal:${goal.id}`);
|
|
53163
53359
|
}
|
|
53164
53360
|
return userIds;
|
|
@@ -53575,7 +53771,7 @@ ${item.dreamContent}` : item.dreamContent).join("\n\n");
|
|
|
53575
53771
|
});
|
|
53576
53772
|
|
|
53577
53773
|
// src/server/routes/tools.ts
|
|
53578
|
-
var
|
|
53774
|
+
var import_node_path17 = __toESM(require("node:path"));
|
|
53579
53775
|
var toolRoutes = new Hono2();
|
|
53580
53776
|
var listActiveDepartmentSkills = () => {
|
|
53581
53777
|
return listDepartments().flatMap(
|
|
@@ -53586,7 +53782,7 @@ var listActiveDepartmentSkills = () => {
|
|
|
53586
53782
|
scope: "department",
|
|
53587
53783
|
departmentName: department.name,
|
|
53588
53784
|
detail: () => {
|
|
53589
|
-
const skillDir =
|
|
53785
|
+
const skillDir = import_node_path17.default.join(getDepartmentWorkSpaceDir(department.name), "skills", skill.skillName);
|
|
53590
53786
|
return `Base directory for this skill: ${skillDir}
|
|
53591
53787
|
|
|
53592
53788
|
${skill.skillMd}`;
|
|
@@ -53675,7 +53871,7 @@ var systemRoutes = new Hono2();
|
|
|
53675
53871
|
var startTime = Date.now();
|
|
53676
53872
|
systemRoutes.get("/system/info", (c) => {
|
|
53677
53873
|
return c.json({
|
|
53678
|
-
version: true ? "1.9.
|
|
53874
|
+
version: true ? "1.9.13" : "unknown",
|
|
53679
53875
|
uptime: Math.floor((Date.now() - startTime) / 1e3),
|
|
53680
53876
|
env: process.env.NODE_ENV || "development",
|
|
53681
53877
|
nodeVersion: process.version
|
|
@@ -53684,8 +53880,8 @@ systemRoutes.get("/system/info", (c) => {
|
|
|
53684
53880
|
|
|
53685
53881
|
// src/server/routes/mobile.ts
|
|
53686
53882
|
var import_node_crypto16 = require("node:crypto");
|
|
53687
|
-
var
|
|
53688
|
-
var
|
|
53883
|
+
var import_promises13 = require("node:fs/promises");
|
|
53884
|
+
var import_node_path18 = __toESM(require("node:path"));
|
|
53689
53885
|
var mobileRoutes = new Hono2();
|
|
53690
53886
|
var resolveMobileUserId = (body, headerUserId) => {
|
|
53691
53887
|
return body.userId?.trim() || headerUserId?.trim() || "ios:local-user";
|
|
@@ -53727,12 +53923,12 @@ ${goal.tasks.map((task) => `- [${task.status}] ${task.subject}`).join("\n")}` :
|
|
|
53727
53923
|
return lines.join("\n");
|
|
53728
53924
|
};
|
|
53729
53925
|
var sanitizeFileName = (fileName) => {
|
|
53730
|
-
const cleaned =
|
|
53926
|
+
const cleaned = import_node_path18.default.basename(fileName).replace(/[^\w.\-()\u4e00-\u9fa5 ]+/g, "_").trim();
|
|
53731
53927
|
return cleaned || `attachment-${Date.now()}`;
|
|
53732
53928
|
};
|
|
53733
53929
|
var inferAttachmentType2 = (mimeType = "", fileName = "") => {
|
|
53734
53930
|
if (mimeType.startsWith("image/")) return "image";
|
|
53735
|
-
const ext =
|
|
53931
|
+
const ext = import_node_path18.default.extname(fileName).toLowerCase();
|
|
53736
53932
|
if ([".png", ".jpg", ".jpeg", ".gif", ".webp"].includes(ext)) return "image";
|
|
53737
53933
|
return "file";
|
|
53738
53934
|
};
|
|
@@ -53789,10 +53985,10 @@ mobileRoutes.post("/mobile/attachments", async (c) => {
|
|
|
53789
53985
|
const type = inferAttachmentType2(mimeType, fileName);
|
|
53790
53986
|
const attachmentId = (0, import_node_crypto16.randomUUID)();
|
|
53791
53987
|
const buffer = Buffer.from(dataBase64, "base64");
|
|
53792
|
-
const dir =
|
|
53793
|
-
await (0,
|
|
53794
|
-
const localPath =
|
|
53795
|
-
await (0,
|
|
53988
|
+
const dir = import_node_path18.default.join(getDuclawWorkspaceDir(), mobileUserId, "mobile", type === "image" ? "images" : "files");
|
|
53989
|
+
await (0, import_promises13.mkdir)(dir, { recursive: true });
|
|
53990
|
+
const localPath = import_node_path18.default.join(dir, `${attachmentId}-${fileName}`);
|
|
53991
|
+
await (0, import_promises13.writeFile)(localPath, buffer);
|
|
53796
53992
|
const attachment = saveMobileAttachment({
|
|
53797
53993
|
id: attachmentId,
|
|
53798
53994
|
type,
|
|
@@ -54010,7 +54206,7 @@ function createServer() {
|
|
|
54010
54206
|
app.route("/api", mobileRoutes);
|
|
54011
54207
|
app.use("/*", serveStatic({ root: webDistRoot }));
|
|
54012
54208
|
app.get("/*", async (c) => {
|
|
54013
|
-
const indexHtml = await (0,
|
|
54209
|
+
const indexHtml = await (0, import_promises14.readFile)(import_node_path19.default.join(webDistRoot, "index.html"), "utf8");
|
|
54014
54210
|
const tenantId = c.req.header("x-tenant-id");
|
|
54015
54211
|
const assetBase = tenantId ? `/t/${tenantId}` : "";
|
|
54016
54212
|
const html = indexHtml.replaceAll('"./', `"${assetBase}/`);
|
|
@@ -54038,9 +54234,9 @@ function shouldStartCoreChannelGateways(env = process.env) {
|
|
|
54038
54234
|
|
|
54039
54235
|
// src/runtime/saasAssets.ts
|
|
54040
54236
|
var import_node_fs9 = require("node:fs");
|
|
54041
|
-
var
|
|
54237
|
+
var import_promises15 = require("node:fs/promises");
|
|
54042
54238
|
var import_node_os3 = require("node:os");
|
|
54043
|
-
var
|
|
54239
|
+
var import_node_path20 = __toESM(require("node:path"));
|
|
54044
54240
|
var MAX_CONTEXT_ASSETS = Number(process.env.DUCLAW_SAAS_ASSET_CONTEXT_LIMIT ?? 1e3);
|
|
54045
54241
|
var MAX_SKILL_ASSETS = Number(process.env.DUCLAW_SAAS_ASSET_SKILL_LIMIT ?? 200);
|
|
54046
54242
|
async function restoreSaasRuntimeAssets(reason) {
|
|
@@ -54071,8 +54267,8 @@ async function restoreContextAsset(context, overwrite) {
|
|
|
54071
54267
|
const target = contextPathForSourceKey(context.sourceKey);
|
|
54072
54268
|
if (!target) return false;
|
|
54073
54269
|
if (!overwrite && (0, import_node_fs9.existsSync)(target)) return false;
|
|
54074
|
-
await (0,
|
|
54075
|
-
await (0,
|
|
54270
|
+
await (0, import_promises15.mkdir)(import_node_path20.default.dirname(target), { recursive: true });
|
|
54271
|
+
await (0, import_promises15.writeFile)(target, JSON.stringify(context.payload), "utf8");
|
|
54076
54272
|
return true;
|
|
54077
54273
|
}
|
|
54078
54274
|
async function restoreSkillAsset(skill, overwrite) {
|
|
@@ -54080,8 +54276,8 @@ async function restoreSkillAsset(skill, overwrite) {
|
|
|
54080
54276
|
const target = safeSkillTargetPath(skill.sourcePath, skill.skillName);
|
|
54081
54277
|
if (!target) return false;
|
|
54082
54278
|
if (!overwrite && (0, import_node_fs9.existsSync)(target)) return false;
|
|
54083
|
-
await (0,
|
|
54084
|
-
await (0,
|
|
54279
|
+
await (0, import_promises15.mkdir)(import_node_path20.default.dirname(target), { recursive: true });
|
|
54280
|
+
await (0, import_promises15.writeFile)(target, skill.skillMd, "utf8");
|
|
54085
54281
|
return true;
|
|
54086
54282
|
}
|
|
54087
54283
|
function runtimeAssetClient() {
|
|
@@ -54113,30 +54309,30 @@ function runtimeAssetClient() {
|
|
|
54113
54309
|
function contextPathForSourceKey(sourceKey) {
|
|
54114
54310
|
if (sourceKey.startsWith("agent:")) {
|
|
54115
54311
|
const logicalKey = sourceKey.slice("agent:".length);
|
|
54116
|
-
return
|
|
54312
|
+
return import_node_path20.default.join(getDuclawDataDir(), "kv", "agent", `${Buffer.from(logicalKey).toString("base64url")}.json`);
|
|
54117
54313
|
}
|
|
54118
54314
|
if (sourceKey.startsWith("goal-context:")) {
|
|
54119
|
-
return
|
|
54315
|
+
return import_node_path20.default.join(getDuclawHomeDir(), "goal-context", `${sourceKey.slice("goal-context:".length)}.json`);
|
|
54120
54316
|
}
|
|
54121
54317
|
if (sourceKey.startsWith("tasks:")) {
|
|
54122
|
-
return
|
|
54318
|
+
return import_node_path20.default.join(getDuclawHomeDir(), "tasks", `${sourceKey.slice("tasks:".length)}.json`);
|
|
54123
54319
|
}
|
|
54124
54320
|
return null;
|
|
54125
54321
|
}
|
|
54126
54322
|
function safeSkillTargetPath(sourcePath, skillName) {
|
|
54127
|
-
const allowedRoots = skillRoots().map((root) =>
|
|
54128
|
-
const normalized =
|
|
54129
|
-
if (allowedRoots.some((root) => normalized ===
|
|
54323
|
+
const allowedRoots = skillRoots().map((root) => import_node_path20.default.resolve(root));
|
|
54324
|
+
const normalized = import_node_path20.default.resolve(sourcePath);
|
|
54325
|
+
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
54326
|
return normalized;
|
|
54131
54327
|
}
|
|
54132
54328
|
const safeName = skillName.replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 120) || "imported-skill";
|
|
54133
|
-
return
|
|
54329
|
+
return import_node_path20.default.join("/home/user/app/skills", safeName, "SKILL.md");
|
|
54134
54330
|
}
|
|
54135
54331
|
function skillRoots() {
|
|
54136
54332
|
return [
|
|
54137
54333
|
"/home/user/app/skills",
|
|
54138
|
-
|
|
54139
|
-
|
|
54334
|
+
import_node_path20.default.join(getDuclawHomeDir(), "skills"),
|
|
54335
|
+
import_node_path20.default.join((0, import_node_os3.homedir)(), ".agents", "skills")
|
|
54140
54336
|
];
|
|
54141
54337
|
}
|
|
54142
54338
|
|