deepfish-ai 2.0.7 → 2.0.9
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/README.md +6 -4
- package/dist/generate-tool.md +124 -3
- package/dist/index.js +384 -236
- package/dist/serve/pm2-server.js +167 -56
- package/package.json +1 -1
package/dist/serve/pm2-server.js
CHANGED
|
@@ -8403,10 +8403,10 @@ var require_lib = __commonJS({
|
|
|
8403
8403
|
exports2.analyse = analyse;
|
|
8404
8404
|
var detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
|
|
8405
8405
|
let fd;
|
|
8406
|
-
const
|
|
8406
|
+
const fs21 = (0, node_1.default)();
|
|
8407
8407
|
const handler = (err, buffer) => {
|
|
8408
8408
|
if (fd) {
|
|
8409
|
-
|
|
8409
|
+
fs21.closeSync(fd);
|
|
8410
8410
|
}
|
|
8411
8411
|
if (err) {
|
|
8412
8412
|
reject(err);
|
|
@@ -8418,9 +8418,9 @@ var require_lib = __commonJS({
|
|
|
8418
8418
|
};
|
|
8419
8419
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
8420
8420
|
if (sampleSize > 0) {
|
|
8421
|
-
fd =
|
|
8421
|
+
fd = fs21.openSync(filepath, "r");
|
|
8422
8422
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
8423
|
-
|
|
8423
|
+
fs21.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
8424
8424
|
if (err) {
|
|
8425
8425
|
handler(err, null);
|
|
8426
8426
|
} else {
|
|
@@ -8432,22 +8432,22 @@ var require_lib = __commonJS({
|
|
|
8432
8432
|
});
|
|
8433
8433
|
return;
|
|
8434
8434
|
}
|
|
8435
|
-
|
|
8435
|
+
fs21.readFile(filepath, handler);
|
|
8436
8436
|
});
|
|
8437
8437
|
exports2.detectFile = detectFile;
|
|
8438
8438
|
var detectFileSync = (filepath, opts = {}) => {
|
|
8439
|
-
const
|
|
8439
|
+
const fs21 = (0, node_1.default)();
|
|
8440
8440
|
if (opts && opts.sampleSize) {
|
|
8441
|
-
const fd =
|
|
8441
|
+
const fd = fs21.openSync(filepath, "r");
|
|
8442
8442
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
8443
|
-
const bytesRead =
|
|
8443
|
+
const bytesRead = fs21.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
8444
8444
|
if (bytesRead < opts.sampleSize) {
|
|
8445
8445
|
sample = sample.subarray(0, bytesRead);
|
|
8446
8446
|
}
|
|
8447
|
-
|
|
8447
|
+
fs21.closeSync(fd);
|
|
8448
8448
|
return (0, exports2.detect)(sample);
|
|
8449
8449
|
}
|
|
8450
|
-
return (0, exports2.detect)(
|
|
8450
|
+
return (0, exports2.detect)(fs21.readFileSync(filepath));
|
|
8451
8451
|
};
|
|
8452
8452
|
exports2.detectFileSync = detectFileSync;
|
|
8453
8453
|
exports2.default = {
|
|
@@ -8699,11 +8699,11 @@ async function startServer(options = {}) {
|
|
|
8699
8699
|
var import_ws2 = require("ws");
|
|
8700
8700
|
|
|
8701
8701
|
// src/cli/cli-utils/init-agent.ts
|
|
8702
|
-
var
|
|
8703
|
-
var
|
|
8702
|
+
var import_fs_extra18 = __toESM(require("fs-extra"));
|
|
8703
|
+
var import_path13 = __toESM(require("path"));
|
|
8704
8704
|
|
|
8705
8705
|
// src/agent/AIAgent/index.ts
|
|
8706
|
-
var
|
|
8706
|
+
var import_langchain19 = require("langchain");
|
|
8707
8707
|
var import_deepagents2 = require("deepagents");
|
|
8708
8708
|
|
|
8709
8709
|
// src/agent/AIAgent/utils/langgraph-checkpoint-filesystem/filesystem-saver.ts
|
|
@@ -9516,10 +9516,10 @@ function mergeDefs(...defs) {
|
|
|
9516
9516
|
function cloneDef(schema) {
|
|
9517
9517
|
return mergeDefs(schema._zod.def);
|
|
9518
9518
|
}
|
|
9519
|
-
function getElementAtPath(obj,
|
|
9520
|
-
if (!
|
|
9519
|
+
function getElementAtPath(obj, path15) {
|
|
9520
|
+
if (!path15)
|
|
9521
9521
|
return obj;
|
|
9522
|
-
return
|
|
9522
|
+
return path15.reduce((acc, key) => acc?.[key], obj);
|
|
9523
9523
|
}
|
|
9524
9524
|
function promiseAllObject(promisesObj) {
|
|
9525
9525
|
const keys = Object.keys(promisesObj);
|
|
@@ -9928,11 +9928,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
9928
9928
|
}
|
|
9929
9929
|
return false;
|
|
9930
9930
|
}
|
|
9931
|
-
function prefixIssues(
|
|
9931
|
+
function prefixIssues(path15, issues) {
|
|
9932
9932
|
return issues.map((iss) => {
|
|
9933
9933
|
var _a3;
|
|
9934
9934
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
9935
|
-
iss.path.unshift(
|
|
9935
|
+
iss.path.unshift(path15);
|
|
9936
9936
|
return iss;
|
|
9937
9937
|
});
|
|
9938
9938
|
}
|
|
@@ -10079,16 +10079,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10079
10079
|
}
|
|
10080
10080
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
10081
10081
|
const fieldErrors = { _errors: [] };
|
|
10082
|
-
const processError = (error52,
|
|
10082
|
+
const processError = (error52, path15 = []) => {
|
|
10083
10083
|
for (const issue2 of error52.issues) {
|
|
10084
10084
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
10085
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
10085
|
+
issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
|
|
10086
10086
|
} else if (issue2.code === "invalid_key") {
|
|
10087
|
-
processError({ issues: issue2.issues }, [...
|
|
10087
|
+
processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
|
|
10088
10088
|
} else if (issue2.code === "invalid_element") {
|
|
10089
|
-
processError({ issues: issue2.issues }, [...
|
|
10089
|
+
processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
|
|
10090
10090
|
} else {
|
|
10091
|
-
const fullpath = [...
|
|
10091
|
+
const fullpath = [...path15, ...issue2.path];
|
|
10092
10092
|
if (fullpath.length === 0) {
|
|
10093
10093
|
fieldErrors._errors.push(mapper(issue2));
|
|
10094
10094
|
} else {
|
|
@@ -10115,17 +10115,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10115
10115
|
}
|
|
10116
10116
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
10117
10117
|
const result = { errors: [] };
|
|
10118
|
-
const processError = (error52,
|
|
10118
|
+
const processError = (error52, path15 = []) => {
|
|
10119
10119
|
var _a3, _b;
|
|
10120
10120
|
for (const issue2 of error52.issues) {
|
|
10121
10121
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
10122
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
10122
|
+
issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
|
|
10123
10123
|
} else if (issue2.code === "invalid_key") {
|
|
10124
|
-
processError({ issues: issue2.issues }, [...
|
|
10124
|
+
processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
|
|
10125
10125
|
} else if (issue2.code === "invalid_element") {
|
|
10126
|
-
processError({ issues: issue2.issues }, [...
|
|
10126
|
+
processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
|
|
10127
10127
|
} else {
|
|
10128
|
-
const fullpath = [...
|
|
10128
|
+
const fullpath = [...path15, ...issue2.path];
|
|
10129
10129
|
if (fullpath.length === 0) {
|
|
10130
10130
|
result.errors.push(mapper(issue2));
|
|
10131
10131
|
continue;
|
|
@@ -10157,8 +10157,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10157
10157
|
}
|
|
10158
10158
|
function toDotPath(_path) {
|
|
10159
10159
|
const segs = [];
|
|
10160
|
-
const
|
|
10161
|
-
for (const seg of
|
|
10160
|
+
const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
10161
|
+
for (const seg of path15) {
|
|
10162
10162
|
if (typeof seg === "number")
|
|
10163
10163
|
segs.push(`[${seg}]`);
|
|
10164
10164
|
else if (typeof seg === "symbol")
|
|
@@ -22850,13 +22850,13 @@ function resolveRef(ref, ctx) {
|
|
|
22850
22850
|
if (!ref.startsWith("#")) {
|
|
22851
22851
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
22852
22852
|
}
|
|
22853
|
-
const
|
|
22854
|
-
if (
|
|
22853
|
+
const path15 = ref.slice(1).split("/").filter(Boolean);
|
|
22854
|
+
if (path15.length === 0) {
|
|
22855
22855
|
return ctx.rootSchema;
|
|
22856
22856
|
}
|
|
22857
22857
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
22858
|
-
if (
|
|
22859
|
-
const key =
|
|
22858
|
+
if (path15[0] === defsKey) {
|
|
22859
|
+
const key = path15[1];
|
|
22860
22860
|
if (!key || !ctx.defs[key]) {
|
|
22861
22861
|
throw new Error(`Reference not found: ${ref}`);
|
|
22862
22862
|
}
|
|
@@ -23269,6 +23269,7 @@ var import_eventemitter_super2 = require("eventemitter-super");
|
|
|
23269
23269
|
|
|
23270
23270
|
// src/agent/AIAgent/middleware/eventEmitMiddleware.ts
|
|
23271
23271
|
var import_langchain = require("langchain");
|
|
23272
|
+
var import_messages = require("@langchain/core/messages");
|
|
23272
23273
|
|
|
23273
23274
|
// src/agent/AIAgent/utils/skill-parser.ts
|
|
23274
23275
|
var fs5 = require("fs-extra");
|
|
@@ -23864,15 +23865,15 @@ async function grepFiles(query, cwd, includePattern = "**/*", isRegexp = false,
|
|
|
23864
23865
|
}
|
|
23865
23866
|
var grepTool = (0, import_langchain10.tool)(
|
|
23866
23867
|
async ({ query, pattern, cwd, includePattern, isRegexp, maxResults, includeHidden }) => safeTool(() => {
|
|
23867
|
-
const searchQuery = query
|
|
23868
|
+
const searchQuery = (query ?? pattern ?? "").trim();
|
|
23868
23869
|
if (!searchQuery) {
|
|
23869
|
-
|
|
23870
|
+
return '\u8BF7\u63D0\u4F9B query \u6216 pattern \u4E4B\u4E00\uFF1B\u4F8B\u5982 query: "foo" \u6216 pattern: "foo"';
|
|
23870
23871
|
}
|
|
23871
23872
|
return grepFiles(searchQuery, cwd, includePattern, isRegexp, maxResults, includeHidden);
|
|
23872
23873
|
}),
|
|
23873
23874
|
{
|
|
23874
23875
|
name: "grep_files",
|
|
23875
|
-
description: "\u5728\u6587\u672C\u6587\u4EF6\u4E2D\u641C\u7D22\u5185\u5BB9\uFF0C\u652F\u6301\u666E\u901A\u5B57\u7B26\u4E32\u6216\u6B63\u5219\u8868\u8FBE\u5F0F\uFF0C\u53EF\u7528 includePattern \u9650\u5B9A\u6587\u4EF6\u8303\u56F4\u3002query \u4E3A\u641C\u7D22\u5185\u5BB9\uFF1B\u517C\u5BB9 pattern \u4F5C\u4E3A query \u7684\u522B\u540D\u3002",
|
|
23876
|
+
description: "\u5728\u6587\u672C\u6587\u4EF6\u4E2D\u641C\u7D22\u5185\u5BB9\uFF0C\u652F\u6301\u666E\u901A\u5B57\u7B26\u4E32\u6216\u6B63\u5219\u8868\u8FBE\u5F0F\uFF0C\u53EF\u7528 includePattern \u9650\u5B9A\u6587\u4EF6\u8303\u56F4\u3002query \u4E3A\u641C\u7D22\u5185\u5BB9\uFF1B\u517C\u5BB9 pattern \u4F5C\u4E3A query \u7684\u522B\u540D\uFF1B\u5982\u679C\u672A\u63D0\u4F9B\u641C\u7D22\u8BCD\uFF0C\u4F1A\u8FD4\u56DE\u63D0\u793A\u3002",
|
|
23876
23877
|
schema: external_exports.object({
|
|
23877
23878
|
query: external_exports.string().optional().describe("\u8981\u641C\u7D22\u7684\u5B57\u7B26\u4E32\u6216\u6B63\u5219\u8868\u8FBE\u5F0F"),
|
|
23878
23879
|
pattern: external_exports.string().optional().describe("query \u7684\u517C\u5BB9\u522B\u540D\uFF0C\u8981\u641C\u7D22\u7684\u5B57\u7B26\u4E32\u6216\u6B63\u5219\u8868\u8FBE\u5F0F"),
|
|
@@ -23881,9 +23882,6 @@ var grepTool = (0, import_langchain10.tool)(
|
|
|
23881
23882
|
isRegexp: external_exports.boolean().default(false).describe("query/pattern \u662F\u5426\u4E3A\u6B63\u5219\u8868\u8FBE\u5F0F"),
|
|
23882
23883
|
maxResults: external_exports.number().default(100).describe("\u6700\u5927\u8FD4\u56DE\u5339\u914D\u6570\u91CF"),
|
|
23883
23884
|
includeHidden: external_exports.boolean().default(false).describe("\u662F\u5426\u5305\u542B\u9690\u85CF\u6587\u4EF6\u6216\u9690\u85CF\u76EE\u5F55")
|
|
23884
|
-
}).refine((input) => input.query || input.pattern, {
|
|
23885
|
-
message: "query \u6216 pattern \u81F3\u5C11\u9700\u8981\u63D0\u4F9B\u4E00\u4E2A",
|
|
23886
|
-
path: ["query"]
|
|
23887
23885
|
})
|
|
23888
23886
|
}
|
|
23889
23887
|
);
|
|
@@ -24180,6 +24178,118 @@ var writeFileTool = (0, import_langchain16.tool)(async ({ filePath, content, mod
|
|
|
24180
24178
|
})
|
|
24181
24179
|
});
|
|
24182
24180
|
|
|
24181
|
+
// src/agent/tools/getFishInfo.ts
|
|
24182
|
+
var import_langchain17 = require("langchain");
|
|
24183
|
+
|
|
24184
|
+
// src/cli/cli-help.ts
|
|
24185
|
+
var import_commander = require("commander");
|
|
24186
|
+
function helpInformation() {
|
|
24187
|
+
return `Usage: ai [options] [command]
|
|
24188
|
+
|
|
24189
|
+
Commands:
|
|
24190
|
+
ai "xxx" \u76F4\u63A5\u5411 AI \u53D1\u8D77\u4E00\u6B21\u4EFB\u52A1\u6216\u5BF9\u8BDD
|
|
24191
|
+
|
|
24192
|
+
# Configuration commands
|
|
24193
|
+
ai config edit \u6253\u5F00\u5168\u5C40\u914D\u7F6E\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91
|
|
24194
|
+
ai config view \u67E5\u770B\u5F53\u524D\u5168\u5C40\u914D\u7F6E\u5185\u5BB9
|
|
24195
|
+
ai config reset \u91CD\u7F6E\u5168\u5C40\u914D\u7F6E\u4E3A\u9ED8\u8BA4\u503C
|
|
24196
|
+
ai config dir \u6253\u5F00\u6216\u8F93\u51FA\u5168\u5C40\u914D\u7F6E\u76EE\u5F55
|
|
24197
|
+
|
|
24198
|
+
# Model commands
|
|
24199
|
+
ai models add \u6DFB\u52A0\u4E00\u4E2A\u65B0\u7684\u6A21\u578B\u914D\u7F6E
|
|
24200
|
+
ai models ls \u67E5\u770B\u5DF2\u914D\u7F6E\u7684\u6A21\u578B\u5217\u8868
|
|
24201
|
+
ai models use <name> \u5207\u6362\u5F53\u524D\u9ED8\u8BA4\u4F7F\u7528\u7684\u6A21\u578B
|
|
24202
|
+
ai models del <name> \u5220\u9664\u6307\u5B9A\u540D\u79F0\u7684\u6A21\u578B\u914D\u7F6E
|
|
24203
|
+
|
|
24204
|
+
# Skill commands
|
|
24205
|
+
ai skills ls \u67E5\u770B\u5DF2\u5B89\u88C5\u6216\u5DF2\u914D\u7F6E\u7684\u6280\u80FD\u5217\u8868
|
|
24206
|
+
ai skills add <name> \u6DFB\u52A0\u6307\u5B9A\u540D\u79F0\u7684\u6280\u80FD
|
|
24207
|
+
ai skills del <index> \u5220\u9664\u6307\u5B9A\u5E8F\u53F7\u7684\u6280\u80FD
|
|
24208
|
+
ai skills enable <name|index> \u542F\u7528\u6307\u5B9A\u540D\u79F0\u6216\u5E8F\u53F7\u7684\u6280\u80FD
|
|
24209
|
+
ai skills disable <name|index> \u7981\u7528\u6307\u5B9A\u540D\u79F0\u6216\u5E8F\u53F7\u7684\u6280\u80FD
|
|
24210
|
+
ai skills dir \u6253\u5F00\u6216\u8F93\u51FA\u6280\u80FD\u76EE\u5F55
|
|
24211
|
+
ai skills generate xxx \u6839\u636E\u63CF\u8FF0\u751F\u6210\u4E00\u4E2A\u65B0\u7684\u6280\u80FD\u6A21\u677F
|
|
24212
|
+
|
|
24213
|
+
# Tools commands
|
|
24214
|
+
ai tools dir \u6253\u5F00\u6216\u8F93\u51FA\u7528\u6237\u81EA\u5B9A\u4E49\u5DE5\u5177\u76EE\u5F55
|
|
24215
|
+
ai tools generate xxx \u6839\u636E\u63CF\u8FF0\u751F\u6210\u4E00\u4E2A\u65B0\u7684\u5DE5\u5177\u6A21\u677F
|
|
24216
|
+
|
|
24217
|
+
# Session commands
|
|
24218
|
+
ai session clear \u6E05\u7A7A\u5F53\u524D\u4F1A\u8BDD\u8BB0\u5F55
|
|
24219
|
+
ai session dir \u6253\u5F00\u6216\u8F93\u51FA\u4F1A\u8BDD\u6570\u636E\u76EE\u5F55
|
|
24220
|
+
|
|
24221
|
+
# Task commands
|
|
24222
|
+
ai task ls \u67E5\u770B\u5F53\u524D\u4EFB\u52A1\u961F\u5217
|
|
24223
|
+
ai task add <task> \u5411\u4EFB\u52A1\u961F\u5217\u6DFB\u52A0\u4E00\u4E2A\u540E\u7EED\u4EFB\u52A1
|
|
24224
|
+
ai task del <index> \u5220\u9664\u6307\u5B9A\u5E8F\u53F7\u7684\u4EFB\u52A1
|
|
24225
|
+
ai task clear \u6E05\u7A7A\u5F53\u524D\u4EFB\u52A1\u961F\u5217
|
|
24226
|
+
|
|
24227
|
+
# MCP commands
|
|
24228
|
+
ai mcp edit \u6253\u5F00 MCP \u914D\u7F6E\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91
|
|
24229
|
+
|
|
24230
|
+
# Serve commands
|
|
24231
|
+
ai serve \u542F\u52A8\u670D\u52A1\u6216\u8FDB\u5165\u670D\u52A1\u7BA1\u7406\u5165\u53E3
|
|
24232
|
+
ai serve start \u542F\u52A8\u540E\u53F0\u670D\u52A1
|
|
24233
|
+
ai serve stop \u505C\u6B62\u540E\u53F0\u670D\u52A1
|
|
24234
|
+
ai serve restart \u91CD\u542F\u540E\u53F0\u670D\u52A1
|
|
24235
|
+
|
|
24236
|
+
# Cache commands
|
|
24237
|
+
ai cache ls \u67E5\u770B\u5DF2\u7F13\u5B58\u7684\u5B66\u4E60\u5185\u5BB9\u5217\u8868
|
|
24238
|
+
ai cache edit <index|id> \u7F16\u8F91\u6307\u5B9A\u5E8F\u53F7\u6216 ID \u7684\u7F13\u5B58\u5185\u5BB9
|
|
24239
|
+
ai cache del <index|id> \u5220\u9664\u6307\u5B9A\u5E8F\u53F7\u6216 ID \u7684\u7F13\u5B58\u5185\u5BB9
|
|
24240
|
+
`;
|
|
24241
|
+
}
|
|
24242
|
+
|
|
24243
|
+
// src/agent/tools/getFishInfo.ts
|
|
24244
|
+
var import_path12 = __toESM(require("path"));
|
|
24245
|
+
var import_fs_extra16 = __toESM(require("fs-extra"));
|
|
24246
|
+
var getFishCodePathTool = (0, import_langchain17.tool)(
|
|
24247
|
+
async () => safeTool(() => {
|
|
24248
|
+
const codePath = getCodePath();
|
|
24249
|
+
return { codePath };
|
|
24250
|
+
}),
|
|
24251
|
+
{
|
|
24252
|
+
name: "get_fish_code_path",
|
|
24253
|
+
description: "\u83B7\u53D6 Deepfish CLI \u7CFB\u7EDF\u7684\u4EE3\u7801\u6839\u76EE\u5F55\u8DEF\u5F84",
|
|
24254
|
+
schema: external_exports.object({})
|
|
24255
|
+
}
|
|
24256
|
+
);
|
|
24257
|
+
var getFishReadmeTool = (0, import_langchain17.tool)(
|
|
24258
|
+
async ({ lang }) => safeTool(() => {
|
|
24259
|
+
const codePath = getCodePath();
|
|
24260
|
+
const readmePath = lang === "en" ? import_path12.default.join(codePath, "README_EN.md") : import_path12.default.join(codePath, "README.md");
|
|
24261
|
+
const fallbackPath = lang === "en" ? import_path12.default.join(codePath, "README.md") : import_path12.default.join(codePath, "README_EN.md");
|
|
24262
|
+
let targetPath = readmePath;
|
|
24263
|
+
if (!import_fs_extra16.default.existsSync(targetPath)) {
|
|
24264
|
+
targetPath = fallbackPath;
|
|
24265
|
+
}
|
|
24266
|
+
if (!import_fs_extra16.default.existsSync(targetPath)) {
|
|
24267
|
+
return { error: "\u672A\u627E\u5230 README \u6587\u4EF6", readmePath: targetPath };
|
|
24268
|
+
}
|
|
24269
|
+
const content = import_fs_extra16.default.readFileSync(targetPath, "utf-8");
|
|
24270
|
+
return { readmePath: targetPath, content };
|
|
24271
|
+
}),
|
|
24272
|
+
{
|
|
24273
|
+
name: "get_fish_readme",
|
|
24274
|
+
description: "\u83B7\u53D6 Deepfish CLI \u7CFB\u7EDF\u7684 README \u6587\u4EF6\u5185\u5BB9\uFF0C\u7528\u4E8E\u4E86\u89E3\u7CFB\u7EDF\u7684\u529F\u80FD\u3001\u7528\u6CD5\u548C\u7279\u6027\u3002\u53EF\u9009\u53C2\u6570 lang \u6307\u5B9A\u8BED\u8A00\uFF08zh \u6216 en\uFF09\uFF0C\u9ED8\u8BA4\u4E2D\u6587\u3002",
|
|
24275
|
+
schema: external_exports.object({
|
|
24276
|
+
lang: external_exports.string().optional().default("zh").describe("\u8BED\u8A00\uFF0Czh \u4E3A\u4E2D\u6587 README\uFF0Cen \u4E3A\u82F1\u6587 README")
|
|
24277
|
+
})
|
|
24278
|
+
}
|
|
24279
|
+
);
|
|
24280
|
+
var getFishHelpTool = (0, import_langchain17.tool)(
|
|
24281
|
+
async () => safeTool(() => {
|
|
24282
|
+
const help = helpInformation();
|
|
24283
|
+
return { help };
|
|
24284
|
+
}),
|
|
24285
|
+
{
|
|
24286
|
+
name: "get_fish_help",
|
|
24287
|
+
description: "\u83B7\u53D6 Deepfish CLI \u7CFB\u7EDF\u7684\u6240\u6709\u53EF\u7528\u547D\u4EE4\u53CA\u4F7F\u7528\u8BF4\u660E\uFF0C\u5305\u62EC\u914D\u7F6E\u3001\u6A21\u578B\u3001\u6280\u80FD\u3001\u5DE5\u5177\u3001\u4F1A\u8BDD\u3001\u4EFB\u52A1\u3001MCP\u3001\u670D\u52A1\u3001\u7F13\u5B58\u7B49\u5B50\u547D\u4EE4\u7684\u8BE6\u7EC6\u7528\u6CD5",
|
|
24288
|
+
schema: external_exports.object({})
|
|
24289
|
+
}
|
|
24290
|
+
);
|
|
24291
|
+
var fishInfoTools = [getFishCodePathTool, getFishReadmeTool, getFishHelpTool];
|
|
24292
|
+
|
|
24183
24293
|
// src/agent/tools/index.ts
|
|
24184
24294
|
var builtinTools = [
|
|
24185
24295
|
taskTool,
|
|
@@ -24194,15 +24304,16 @@ var builtinTools = [
|
|
|
24194
24304
|
webFetchTool,
|
|
24195
24305
|
...packageTools,
|
|
24196
24306
|
...semanticMemoryTools,
|
|
24197
|
-
...learnTools
|
|
24307
|
+
...learnTools,
|
|
24308
|
+
...fishInfoTools
|
|
24198
24309
|
];
|
|
24199
24310
|
|
|
24200
24311
|
// src/cli/cli-core/skills.ts
|
|
24201
24312
|
var import_inquirer2 = __toESM(require("inquirer"));
|
|
24202
|
-
var
|
|
24313
|
+
var import_fs_extra17 = __toESM(require("fs-extra"));
|
|
24203
24314
|
|
|
24204
24315
|
// src/agent/AIAgent/SubAgents/SubAIAgent.ts
|
|
24205
|
-
var
|
|
24316
|
+
var import_langchain18 = require("langchain");
|
|
24206
24317
|
var import_deepagents = require("deepagents");
|
|
24207
24318
|
var import_eventemitter_super = require("eventemitter-super");
|
|
24208
24319
|
var import_lodash = require("lodash");
|
|
@@ -24223,30 +24334,30 @@ function removeSessionById(agentId) {
|
|
|
24223
24334
|
return;
|
|
24224
24335
|
}
|
|
24225
24336
|
const sessionDir = getSessionPath(agentId);
|
|
24226
|
-
|
|
24337
|
+
import_fs_extra18.default.removeSync(sessionDir);
|
|
24227
24338
|
const sessionsPath = getSessionsPath();
|
|
24228
|
-
const sessionsFilePath =
|
|
24229
|
-
if (!
|
|
24339
|
+
const sessionsFilePath = import_path13.default.join(sessionsPath, "sessions.json");
|
|
24340
|
+
if (!import_fs_extra18.default.pathExistsSync(sessionsFilePath)) {
|
|
24230
24341
|
logSuccess("Current session history cleared");
|
|
24231
24342
|
return;
|
|
24232
24343
|
}
|
|
24233
|
-
const content =
|
|
24344
|
+
const content = import_fs_extra18.default.readFileSync(sessionsFilePath, "utf-8");
|
|
24234
24345
|
const parsed = JSON.parse(content);
|
|
24235
24346
|
const sessions = Array.isArray(parsed) ? parsed : [];
|
|
24236
24347
|
const existingSessionIndex = sessions.findIndex((s) => s.id === agentId);
|
|
24237
24348
|
if (existingSessionIndex !== -1) {
|
|
24238
24349
|
sessions.splice(existingSessionIndex, 1);
|
|
24239
|
-
|
|
24350
|
+
import_fs_extra18.default.writeFileSync(sessionsFilePath, JSON.stringify(sessions, null, 2), "utf-8");
|
|
24240
24351
|
}
|
|
24241
24352
|
logSuccess("Current session history cleared");
|
|
24242
24353
|
}
|
|
24243
24354
|
function getAgentId() {
|
|
24244
24355
|
const sessionsPath = getSessionsPath();
|
|
24245
|
-
const sessionsFilePath =
|
|
24246
|
-
if (!
|
|
24356
|
+
const sessionsFilePath = import_path13.default.join(sessionsPath, "sessions.json");
|
|
24357
|
+
if (!import_fs_extra18.default.pathExistsSync(sessionsFilePath)) {
|
|
24247
24358
|
return;
|
|
24248
24359
|
}
|
|
24249
|
-
const content =
|
|
24360
|
+
const content = import_fs_extra18.default.readFileSync(sessionsFilePath, "utf-8");
|
|
24250
24361
|
const parsed = JSON.parse(content);
|
|
24251
24362
|
const sessions = Array.isArray(parsed) ? parsed : [];
|
|
24252
24363
|
const workspace = getWorkspacePath();
|
|
@@ -24427,14 +24538,14 @@ function startAgentRoomServer(opts = {}) {
|
|
|
24427
24538
|
logWarning("[agent-room] Service already running");
|
|
24428
24539
|
return wss;
|
|
24429
24540
|
}
|
|
24430
|
-
const
|
|
24541
|
+
const path15 = opts.path ?? "/agent-room";
|
|
24431
24542
|
if (opts.httpServer) {
|
|
24432
|
-
wss = new import_ws2.WebSocketServer({ server: opts.httpServer, path:
|
|
24433
|
-
logSuccess(`[agent-room] started, path=${
|
|
24543
|
+
wss = new import_ws2.WebSocketServer({ server: opts.httpServer, path: path15 });
|
|
24544
|
+
logSuccess(`[agent-room] started, path=${path15}`);
|
|
24434
24545
|
} else {
|
|
24435
24546
|
const port = opts.port ?? PORT2;
|
|
24436
|
-
wss = new import_ws2.WebSocketServer({ port, path:
|
|
24437
|
-
logSuccess(`[agent-room] started: ws://localhost:${port}${
|
|
24547
|
+
wss = new import_ws2.WebSocketServer({ port, path: path15 });
|
|
24548
|
+
logSuccess(`[agent-room] started: ws://localhost:${port}${path15}`);
|
|
24438
24549
|
}
|
|
24439
24550
|
wss.on("connection", handleConnection);
|
|
24440
24551
|
return wss;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepfish-ai",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An efficient AI-driven command-line tool designed to bridge the gap between natural language and operating system commands, file operations, and more. It enables non-developers to quickly generate executable instructions through simple natural language descriptions, significantly improving terminal operation efficiency.",
|
|
6
6
|
"repository": {
|