deepfish-ai 2.0.8 → 2.0.11
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 +120 -0
- package/dist/index.js +433 -227
- package/dist/serve/pm2-server.js +176 -58
- 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 fs22 = (0, node_1.default)();
|
|
8407
8407
|
const handler = (err, buffer) => {
|
|
8408
8408
|
if (fd) {
|
|
8409
|
-
|
|
8409
|
+
fs22.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 = fs22.openSync(filepath, "r");
|
|
8422
8422
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
8423
|
-
|
|
8423
|
+
fs22.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
|
+
fs22.readFile(filepath, handler);
|
|
8436
8436
|
});
|
|
8437
8437
|
exports2.detectFile = detectFile;
|
|
8438
8438
|
var detectFileSync = (filepath, opts = {}) => {
|
|
8439
|
-
const
|
|
8439
|
+
const fs22 = (0, node_1.default)();
|
|
8440
8440
|
if (opts && opts.sampleSize) {
|
|
8441
|
-
const fd =
|
|
8441
|
+
const fd = fs22.openSync(filepath, "r");
|
|
8442
8442
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
8443
|
-
const bytesRead =
|
|
8443
|
+
const bytesRead = fs22.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
|
+
fs22.closeSync(fd);
|
|
8448
8448
|
return (0, exports2.detect)(sample);
|
|
8449
8449
|
}
|
|
8450
|
-
return (0, exports2.detect)(
|
|
8450
|
+
return (0, exports2.detect)(fs22.readFileSync(filepath));
|
|
8451
8451
|
};
|
|
8452
8452
|
exports2.detectFileSync = detectFileSync;
|
|
8453
8453
|
exports2.default = {
|
|
@@ -8542,6 +8542,13 @@ var ADD_MODEL_Config = {
|
|
|
8542
8542
|
// src/cli/cli-utils/getGlobalPath.ts
|
|
8543
8543
|
var import_path2 = __toESM(require("path"));
|
|
8544
8544
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
8545
|
+
|
|
8546
|
+
// src/cli/cli-utils/node-root.ts
|
|
8547
|
+
var { execSync } = require("child_process");
|
|
8548
|
+
var path2 = require("path");
|
|
8549
|
+
var fs = require("fs");
|
|
8550
|
+
|
|
8551
|
+
// src/cli/cli-utils/getGlobalPath.ts
|
|
8545
8552
|
var getDirname = () => __dirname;
|
|
8546
8553
|
function getCodePath() {
|
|
8547
8554
|
let dir = getDirname();
|
|
@@ -8699,11 +8706,11 @@ async function startServer(options = {}) {
|
|
|
8699
8706
|
var import_ws2 = require("ws");
|
|
8700
8707
|
|
|
8701
8708
|
// src/cli/cli-utils/init-agent.ts
|
|
8702
|
-
var
|
|
8703
|
-
var
|
|
8709
|
+
var import_fs_extra18 = __toESM(require("fs-extra"));
|
|
8710
|
+
var import_path13 = __toESM(require("path"));
|
|
8704
8711
|
|
|
8705
8712
|
// src/agent/AIAgent/index.ts
|
|
8706
|
-
var
|
|
8713
|
+
var import_langchain19 = require("langchain");
|
|
8707
8714
|
var import_deepagents2 = require("deepagents");
|
|
8708
8715
|
|
|
8709
8716
|
// src/agent/AIAgent/utils/langgraph-checkpoint-filesystem/filesystem-saver.ts
|
|
@@ -9516,10 +9523,10 @@ function mergeDefs(...defs) {
|
|
|
9516
9523
|
function cloneDef(schema) {
|
|
9517
9524
|
return mergeDefs(schema._zod.def);
|
|
9518
9525
|
}
|
|
9519
|
-
function getElementAtPath(obj,
|
|
9520
|
-
if (!
|
|
9526
|
+
function getElementAtPath(obj, path16) {
|
|
9527
|
+
if (!path16)
|
|
9521
9528
|
return obj;
|
|
9522
|
-
return
|
|
9529
|
+
return path16.reduce((acc, key) => acc?.[key], obj);
|
|
9523
9530
|
}
|
|
9524
9531
|
function promiseAllObject(promisesObj) {
|
|
9525
9532
|
const keys = Object.keys(promisesObj);
|
|
@@ -9928,11 +9935,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
9928
9935
|
}
|
|
9929
9936
|
return false;
|
|
9930
9937
|
}
|
|
9931
|
-
function prefixIssues(
|
|
9938
|
+
function prefixIssues(path16, issues) {
|
|
9932
9939
|
return issues.map((iss) => {
|
|
9933
9940
|
var _a3;
|
|
9934
9941
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
9935
|
-
iss.path.unshift(
|
|
9942
|
+
iss.path.unshift(path16);
|
|
9936
9943
|
return iss;
|
|
9937
9944
|
});
|
|
9938
9945
|
}
|
|
@@ -10079,16 +10086,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10079
10086
|
}
|
|
10080
10087
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
10081
10088
|
const fieldErrors = { _errors: [] };
|
|
10082
|
-
const processError = (error52,
|
|
10089
|
+
const processError = (error52, path16 = []) => {
|
|
10083
10090
|
for (const issue2 of error52.issues) {
|
|
10084
10091
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
10085
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
10092
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
10086
10093
|
} else if (issue2.code === "invalid_key") {
|
|
10087
|
-
processError({ issues: issue2.issues }, [...
|
|
10094
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
10088
10095
|
} else if (issue2.code === "invalid_element") {
|
|
10089
|
-
processError({ issues: issue2.issues }, [...
|
|
10096
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
10090
10097
|
} else {
|
|
10091
|
-
const fullpath = [...
|
|
10098
|
+
const fullpath = [...path16, ...issue2.path];
|
|
10092
10099
|
if (fullpath.length === 0) {
|
|
10093
10100
|
fieldErrors._errors.push(mapper(issue2));
|
|
10094
10101
|
} else {
|
|
@@ -10115,17 +10122,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10115
10122
|
}
|
|
10116
10123
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
10117
10124
|
const result = { errors: [] };
|
|
10118
|
-
const processError = (error52,
|
|
10125
|
+
const processError = (error52, path16 = []) => {
|
|
10119
10126
|
var _a3, _b;
|
|
10120
10127
|
for (const issue2 of error52.issues) {
|
|
10121
10128
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
10122
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
10129
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
10123
10130
|
} else if (issue2.code === "invalid_key") {
|
|
10124
|
-
processError({ issues: issue2.issues }, [...
|
|
10131
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
10125
10132
|
} else if (issue2.code === "invalid_element") {
|
|
10126
|
-
processError({ issues: issue2.issues }, [...
|
|
10133
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
10127
10134
|
} else {
|
|
10128
|
-
const fullpath = [...
|
|
10135
|
+
const fullpath = [...path16, ...issue2.path];
|
|
10129
10136
|
if (fullpath.length === 0) {
|
|
10130
10137
|
result.errors.push(mapper(issue2));
|
|
10131
10138
|
continue;
|
|
@@ -10157,8 +10164,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10157
10164
|
}
|
|
10158
10165
|
function toDotPath(_path) {
|
|
10159
10166
|
const segs = [];
|
|
10160
|
-
const
|
|
10161
|
-
for (const seg of
|
|
10167
|
+
const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
10168
|
+
for (const seg of path16) {
|
|
10162
10169
|
if (typeof seg === "number")
|
|
10163
10170
|
segs.push(`[${seg}]`);
|
|
10164
10171
|
else if (typeof seg === "symbol")
|
|
@@ -22850,13 +22857,13 @@ function resolveRef(ref, ctx) {
|
|
|
22850
22857
|
if (!ref.startsWith("#")) {
|
|
22851
22858
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
22852
22859
|
}
|
|
22853
|
-
const
|
|
22854
|
-
if (
|
|
22860
|
+
const path16 = ref.slice(1).split("/").filter(Boolean);
|
|
22861
|
+
if (path16.length === 0) {
|
|
22855
22862
|
return ctx.rootSchema;
|
|
22856
22863
|
}
|
|
22857
22864
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
22858
|
-
if (
|
|
22859
|
-
const key =
|
|
22865
|
+
if (path16[0] === defsKey) {
|
|
22866
|
+
const key = path16[1];
|
|
22860
22867
|
if (!key || !ctx.defs[key]) {
|
|
22861
22868
|
throw new Error(`Reference not found: ${ref}`);
|
|
22862
22869
|
}
|
|
@@ -23269,10 +23276,11 @@ var import_eventemitter_super2 = require("eventemitter-super");
|
|
|
23269
23276
|
|
|
23270
23277
|
// src/agent/AIAgent/middleware/eventEmitMiddleware.ts
|
|
23271
23278
|
var import_langchain = require("langchain");
|
|
23279
|
+
var import_messages = require("@langchain/core/messages");
|
|
23272
23280
|
|
|
23273
23281
|
// src/agent/AIAgent/utils/skill-parser.ts
|
|
23274
|
-
var
|
|
23275
|
-
var
|
|
23282
|
+
var fs6 = require("fs-extra");
|
|
23283
|
+
var path6 = require("path");
|
|
23276
23284
|
var yaml = require_js_yaml();
|
|
23277
23285
|
|
|
23278
23286
|
// src/agent/AIAgent/system-prompt.ts
|
|
@@ -23864,15 +23872,15 @@ async function grepFiles(query, cwd, includePattern = "**/*", isRegexp = false,
|
|
|
23864
23872
|
}
|
|
23865
23873
|
var grepTool = (0, import_langchain10.tool)(
|
|
23866
23874
|
async ({ query, pattern, cwd, includePattern, isRegexp, maxResults, includeHidden }) => safeTool(() => {
|
|
23867
|
-
const searchQuery = query
|
|
23875
|
+
const searchQuery = (query ?? pattern ?? "").trim();
|
|
23868
23876
|
if (!searchQuery) {
|
|
23869
|
-
|
|
23877
|
+
return '\u8BF7\u63D0\u4F9B query \u6216 pattern \u4E4B\u4E00\uFF1B\u4F8B\u5982 query: "foo" \u6216 pattern: "foo"';
|
|
23870
23878
|
}
|
|
23871
23879
|
return grepFiles(searchQuery, cwd, includePattern, isRegexp, maxResults, includeHidden);
|
|
23872
23880
|
}),
|
|
23873
23881
|
{
|
|
23874
23882
|
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",
|
|
23883
|
+
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
23884
|
schema: external_exports.object({
|
|
23877
23885
|
query: external_exports.string().optional().describe("\u8981\u641C\u7D22\u7684\u5B57\u7B26\u4E32\u6216\u6B63\u5219\u8868\u8FBE\u5F0F"),
|
|
23878
23886
|
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 +23889,6 @@ var grepTool = (0, import_langchain10.tool)(
|
|
|
23881
23889
|
isRegexp: external_exports.boolean().default(false).describe("query/pattern \u662F\u5426\u4E3A\u6B63\u5219\u8868\u8FBE\u5F0F"),
|
|
23882
23890
|
maxResults: external_exports.number().default(100).describe("\u6700\u5927\u8FD4\u56DE\u5339\u914D\u6570\u91CF"),
|
|
23883
23891
|
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
23892
|
})
|
|
23888
23893
|
}
|
|
23889
23894
|
);
|
|
@@ -24180,6 +24185,118 @@ var writeFileTool = (0, import_langchain16.tool)(async ({ filePath, content, mod
|
|
|
24180
24185
|
})
|
|
24181
24186
|
});
|
|
24182
24187
|
|
|
24188
|
+
// src/agent/tools/getFishInfo.ts
|
|
24189
|
+
var import_langchain17 = require("langchain");
|
|
24190
|
+
|
|
24191
|
+
// src/cli/cli-help.ts
|
|
24192
|
+
var import_commander = require("commander");
|
|
24193
|
+
function helpInformation() {
|
|
24194
|
+
return `Usage: ai [options] [command]
|
|
24195
|
+
|
|
24196
|
+
Commands:
|
|
24197
|
+
ai "xxx" \u76F4\u63A5\u5411 AI \u53D1\u8D77\u4E00\u6B21\u4EFB\u52A1\u6216\u5BF9\u8BDD
|
|
24198
|
+
|
|
24199
|
+
# Configuration commands
|
|
24200
|
+
ai config edit \u6253\u5F00\u5168\u5C40\u914D\u7F6E\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91
|
|
24201
|
+
ai config view \u67E5\u770B\u5F53\u524D\u5168\u5C40\u914D\u7F6E\u5185\u5BB9
|
|
24202
|
+
ai config reset \u91CD\u7F6E\u5168\u5C40\u914D\u7F6E\u4E3A\u9ED8\u8BA4\u503C
|
|
24203
|
+
ai config dir \u6253\u5F00\u6216\u8F93\u51FA\u5168\u5C40\u914D\u7F6E\u76EE\u5F55
|
|
24204
|
+
|
|
24205
|
+
# Model commands
|
|
24206
|
+
ai models add \u6DFB\u52A0\u4E00\u4E2A\u65B0\u7684\u6A21\u578B\u914D\u7F6E
|
|
24207
|
+
ai models ls \u67E5\u770B\u5DF2\u914D\u7F6E\u7684\u6A21\u578B\u5217\u8868
|
|
24208
|
+
ai models use <name> \u5207\u6362\u5F53\u524D\u9ED8\u8BA4\u4F7F\u7528\u7684\u6A21\u578B
|
|
24209
|
+
ai models del <name> \u5220\u9664\u6307\u5B9A\u540D\u79F0\u7684\u6A21\u578B\u914D\u7F6E
|
|
24210
|
+
|
|
24211
|
+
# Skill commands
|
|
24212
|
+
ai skills ls \u67E5\u770B\u5DF2\u5B89\u88C5\u6216\u5DF2\u914D\u7F6E\u7684\u6280\u80FD\u5217\u8868
|
|
24213
|
+
ai skills add <name> \u6DFB\u52A0\u6307\u5B9A\u540D\u79F0\u7684\u6280\u80FD
|
|
24214
|
+
ai skills del <index> \u5220\u9664\u6307\u5B9A\u5E8F\u53F7\u7684\u6280\u80FD
|
|
24215
|
+
ai skills enable <name|index> \u542F\u7528\u6307\u5B9A\u540D\u79F0\u6216\u5E8F\u53F7\u7684\u6280\u80FD
|
|
24216
|
+
ai skills disable <name|index> \u7981\u7528\u6307\u5B9A\u540D\u79F0\u6216\u5E8F\u53F7\u7684\u6280\u80FD
|
|
24217
|
+
ai skills dir \u6253\u5F00\u6216\u8F93\u51FA\u6280\u80FD\u76EE\u5F55
|
|
24218
|
+
ai skills generate xxx \u6839\u636E\u63CF\u8FF0\u751F\u6210\u4E00\u4E2A\u65B0\u7684\u6280\u80FD\u6A21\u677F
|
|
24219
|
+
|
|
24220
|
+
# Tools commands
|
|
24221
|
+
ai tools dir \u6253\u5F00\u6216\u8F93\u51FA\u7528\u6237\u81EA\u5B9A\u4E49\u5DE5\u5177\u76EE\u5F55
|
|
24222
|
+
ai tools generate xxx \u6839\u636E\u63CF\u8FF0\u751F\u6210\u4E00\u4E2A\u65B0\u7684\u5DE5\u5177\u6A21\u677F
|
|
24223
|
+
|
|
24224
|
+
# Session commands
|
|
24225
|
+
ai session clear \u6E05\u7A7A\u5F53\u524D\u4F1A\u8BDD\u8BB0\u5F55
|
|
24226
|
+
ai session dir \u6253\u5F00\u6216\u8F93\u51FA\u4F1A\u8BDD\u6570\u636E\u76EE\u5F55
|
|
24227
|
+
|
|
24228
|
+
# Task commands
|
|
24229
|
+
ai task ls \u67E5\u770B\u5F53\u524D\u4EFB\u52A1\u961F\u5217
|
|
24230
|
+
ai task add <task> \u5411\u4EFB\u52A1\u961F\u5217\u6DFB\u52A0\u4E00\u4E2A\u540E\u7EED\u4EFB\u52A1
|
|
24231
|
+
ai task del <index> \u5220\u9664\u6307\u5B9A\u5E8F\u53F7\u7684\u4EFB\u52A1
|
|
24232
|
+
ai task clear \u6E05\u7A7A\u5F53\u524D\u4EFB\u52A1\u961F\u5217
|
|
24233
|
+
|
|
24234
|
+
# MCP commands
|
|
24235
|
+
ai mcp edit \u6253\u5F00 MCP \u914D\u7F6E\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91
|
|
24236
|
+
|
|
24237
|
+
# Serve commands
|
|
24238
|
+
ai serve \u542F\u52A8\u670D\u52A1\u6216\u8FDB\u5165\u670D\u52A1\u7BA1\u7406\u5165\u53E3
|
|
24239
|
+
ai serve start \u542F\u52A8\u540E\u53F0\u670D\u52A1
|
|
24240
|
+
ai serve stop \u505C\u6B62\u540E\u53F0\u670D\u52A1
|
|
24241
|
+
ai serve restart \u91CD\u542F\u540E\u53F0\u670D\u52A1
|
|
24242
|
+
|
|
24243
|
+
# Cache commands
|
|
24244
|
+
ai cache ls \u67E5\u770B\u5DF2\u7F13\u5B58\u7684\u5B66\u4E60\u5185\u5BB9\u5217\u8868
|
|
24245
|
+
ai cache edit <index|id> \u7F16\u8F91\u6307\u5B9A\u5E8F\u53F7\u6216 ID \u7684\u7F13\u5B58\u5185\u5BB9
|
|
24246
|
+
ai cache del <index|id> \u5220\u9664\u6307\u5B9A\u5E8F\u53F7\u6216 ID \u7684\u7F13\u5B58\u5185\u5BB9
|
|
24247
|
+
`;
|
|
24248
|
+
}
|
|
24249
|
+
|
|
24250
|
+
// src/agent/tools/getFishInfo.ts
|
|
24251
|
+
var import_path12 = __toESM(require("path"));
|
|
24252
|
+
var import_fs_extra16 = __toESM(require("fs-extra"));
|
|
24253
|
+
var getFishCodePathTool = (0, import_langchain17.tool)(
|
|
24254
|
+
async () => safeTool(() => {
|
|
24255
|
+
const codePath = getCodePath();
|
|
24256
|
+
return { codePath };
|
|
24257
|
+
}),
|
|
24258
|
+
{
|
|
24259
|
+
name: "get_fish_code_path",
|
|
24260
|
+
description: "\u83B7\u53D6 Deepfish CLI \u7CFB\u7EDF\u7684\u4EE3\u7801\u6839\u76EE\u5F55\u8DEF\u5F84",
|
|
24261
|
+
schema: external_exports.object({})
|
|
24262
|
+
}
|
|
24263
|
+
);
|
|
24264
|
+
var getFishReadmeTool = (0, import_langchain17.tool)(
|
|
24265
|
+
async ({ lang }) => safeTool(() => {
|
|
24266
|
+
const codePath = getCodePath();
|
|
24267
|
+
const readmePath = lang === "en" ? import_path12.default.join(codePath, "README_EN.md") : import_path12.default.join(codePath, "README.md");
|
|
24268
|
+
const fallbackPath = lang === "en" ? import_path12.default.join(codePath, "README.md") : import_path12.default.join(codePath, "README_EN.md");
|
|
24269
|
+
let targetPath = readmePath;
|
|
24270
|
+
if (!import_fs_extra16.default.existsSync(targetPath)) {
|
|
24271
|
+
targetPath = fallbackPath;
|
|
24272
|
+
}
|
|
24273
|
+
if (!import_fs_extra16.default.existsSync(targetPath)) {
|
|
24274
|
+
return { error: "\u672A\u627E\u5230 README \u6587\u4EF6", readmePath: targetPath };
|
|
24275
|
+
}
|
|
24276
|
+
const content = import_fs_extra16.default.readFileSync(targetPath, "utf-8");
|
|
24277
|
+
return { readmePath: targetPath, content };
|
|
24278
|
+
}),
|
|
24279
|
+
{
|
|
24280
|
+
name: "get_fish_readme",
|
|
24281
|
+
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",
|
|
24282
|
+
schema: external_exports.object({
|
|
24283
|
+
lang: external_exports.string().optional().default("zh").describe("\u8BED\u8A00\uFF0Czh \u4E3A\u4E2D\u6587 README\uFF0Cen \u4E3A\u82F1\u6587 README")
|
|
24284
|
+
})
|
|
24285
|
+
}
|
|
24286
|
+
);
|
|
24287
|
+
var getFishHelpTool = (0, import_langchain17.tool)(
|
|
24288
|
+
async () => safeTool(() => {
|
|
24289
|
+
const help = helpInformation();
|
|
24290
|
+
return { help };
|
|
24291
|
+
}),
|
|
24292
|
+
{
|
|
24293
|
+
name: "get_fish_help",
|
|
24294
|
+
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",
|
|
24295
|
+
schema: external_exports.object({})
|
|
24296
|
+
}
|
|
24297
|
+
);
|
|
24298
|
+
var fishInfoTools = [getFishCodePathTool, getFishReadmeTool, getFishHelpTool];
|
|
24299
|
+
|
|
24183
24300
|
// src/agent/tools/index.ts
|
|
24184
24301
|
var builtinTools = [
|
|
24185
24302
|
taskTool,
|
|
@@ -24194,15 +24311,16 @@ var builtinTools = [
|
|
|
24194
24311
|
webFetchTool,
|
|
24195
24312
|
...packageTools,
|
|
24196
24313
|
...semanticMemoryTools,
|
|
24197
|
-
...learnTools
|
|
24314
|
+
...learnTools,
|
|
24315
|
+
...fishInfoTools
|
|
24198
24316
|
];
|
|
24199
24317
|
|
|
24200
24318
|
// src/cli/cli-core/skills.ts
|
|
24201
24319
|
var import_inquirer2 = __toESM(require("inquirer"));
|
|
24202
|
-
var
|
|
24320
|
+
var import_fs_extra17 = __toESM(require("fs-extra"));
|
|
24203
24321
|
|
|
24204
24322
|
// src/agent/AIAgent/SubAgents/SubAIAgent.ts
|
|
24205
|
-
var
|
|
24323
|
+
var import_langchain18 = require("langchain");
|
|
24206
24324
|
var import_deepagents = require("deepagents");
|
|
24207
24325
|
var import_eventemitter_super = require("eventemitter-super");
|
|
24208
24326
|
var import_lodash = require("lodash");
|
|
@@ -24223,30 +24341,30 @@ function removeSessionById(agentId) {
|
|
|
24223
24341
|
return;
|
|
24224
24342
|
}
|
|
24225
24343
|
const sessionDir = getSessionPath(agentId);
|
|
24226
|
-
|
|
24344
|
+
import_fs_extra18.default.removeSync(sessionDir);
|
|
24227
24345
|
const sessionsPath = getSessionsPath();
|
|
24228
|
-
const sessionsFilePath =
|
|
24229
|
-
if (!
|
|
24346
|
+
const sessionsFilePath = import_path13.default.join(sessionsPath, "sessions.json");
|
|
24347
|
+
if (!import_fs_extra18.default.pathExistsSync(sessionsFilePath)) {
|
|
24230
24348
|
logSuccess("Current session history cleared");
|
|
24231
24349
|
return;
|
|
24232
24350
|
}
|
|
24233
|
-
const content =
|
|
24351
|
+
const content = import_fs_extra18.default.readFileSync(sessionsFilePath, "utf-8");
|
|
24234
24352
|
const parsed = JSON.parse(content);
|
|
24235
24353
|
const sessions = Array.isArray(parsed) ? parsed : [];
|
|
24236
24354
|
const existingSessionIndex = sessions.findIndex((s) => s.id === agentId);
|
|
24237
24355
|
if (existingSessionIndex !== -1) {
|
|
24238
24356
|
sessions.splice(existingSessionIndex, 1);
|
|
24239
|
-
|
|
24357
|
+
import_fs_extra18.default.writeFileSync(sessionsFilePath, JSON.stringify(sessions, null, 2), "utf-8");
|
|
24240
24358
|
}
|
|
24241
24359
|
logSuccess("Current session history cleared");
|
|
24242
24360
|
}
|
|
24243
24361
|
function getAgentId() {
|
|
24244
24362
|
const sessionsPath = getSessionsPath();
|
|
24245
|
-
const sessionsFilePath =
|
|
24246
|
-
if (!
|
|
24363
|
+
const sessionsFilePath = import_path13.default.join(sessionsPath, "sessions.json");
|
|
24364
|
+
if (!import_fs_extra18.default.pathExistsSync(sessionsFilePath)) {
|
|
24247
24365
|
return;
|
|
24248
24366
|
}
|
|
24249
|
-
const content =
|
|
24367
|
+
const content = import_fs_extra18.default.readFileSync(sessionsFilePath, "utf-8");
|
|
24250
24368
|
const parsed = JSON.parse(content);
|
|
24251
24369
|
const sessions = Array.isArray(parsed) ? parsed : [];
|
|
24252
24370
|
const workspace = getWorkspacePath();
|
|
@@ -24427,14 +24545,14 @@ function startAgentRoomServer(opts = {}) {
|
|
|
24427
24545
|
logWarning("[agent-room] Service already running");
|
|
24428
24546
|
return wss;
|
|
24429
24547
|
}
|
|
24430
|
-
const
|
|
24548
|
+
const path16 = opts.path ?? "/agent-room";
|
|
24431
24549
|
if (opts.httpServer) {
|
|
24432
|
-
wss = new import_ws2.WebSocketServer({ server: opts.httpServer, path:
|
|
24433
|
-
logSuccess(`[agent-room] started, path=${
|
|
24550
|
+
wss = new import_ws2.WebSocketServer({ server: opts.httpServer, path: path16 });
|
|
24551
|
+
logSuccess(`[agent-room] started, path=${path16}`);
|
|
24434
24552
|
} else {
|
|
24435
24553
|
const port = opts.port ?? PORT2;
|
|
24436
|
-
wss = new import_ws2.WebSocketServer({ port, path:
|
|
24437
|
-
logSuccess(`[agent-room] started: ws://localhost:${port}${
|
|
24554
|
+
wss = new import_ws2.WebSocketServer({ port, path: path16 });
|
|
24555
|
+
logSuccess(`[agent-room] started: ws://localhost:${port}${path16}`);
|
|
24438
24556
|
}
|
|
24439
24557
|
wss.on("connection", handleConnection);
|
|
24440
24558
|
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.11",
|
|
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": {
|