deepfish-ai 2.0.13 → 2.0.15

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/index.js CHANGED
@@ -8704,6 +8704,7 @@ function getGlobalNodeModulesPath() {
8704
8704
  var node_root_default = getGlobalNodeModulesPath;
8705
8705
 
8706
8706
  // src/cli/cli-utils/getGlobalPath.ts
8707
+ var import_os2 = __toESM(require("os"));
8707
8708
  var getDirname = () => __dirname;
8708
8709
  function getHomePath() {
8709
8710
  return HOME_DIR;
@@ -8772,6 +8773,11 @@ function getScanDirPaths() {
8772
8773
  }
8773
8774
  return Array.from(paths);
8774
8775
  }
8776
+ function getScanSkillDirPaths() {
8777
+ const workspacePath = getWorkspacePath();
8778
+ const paths = getScanDirPaths();
8779
+ return [...paths, import_path2.default.join(import_os2.default.homedir(), ".agents"), import_path2.default.join(workspacePath, ".agents")];
8780
+ }
8775
8781
  function getMCPFilePath() {
8776
8782
  const mcpPath = import_path2.default.join(HOME_DIR, "mcp.json");
8777
8783
  if (!import_fs_extra.default.pathExistsSync(mcpPath)) {
@@ -24511,7 +24517,7 @@ ${params.systemPrompt + basePrompt}
24511
24517
  // src/agent/tools/executeCommand.ts
24512
24518
  var import_child_process2 = require("child_process");
24513
24519
  var import_chardet = __toESM(require_lib());
24514
- var import_os2 = __toESM(require("os"));
24520
+ var import_os3 = __toESM(require("os"));
24515
24521
  var import_iconv_lite = __toESM(require("iconv-lite"));
24516
24522
  var import_langchain3 = require("langchain");
24517
24523
 
@@ -24936,7 +24942,7 @@ Command executed successfully`);
24936
24942
  }
24937
24943
  function detectEncoding(buffer) {
24938
24944
  if (!buffer) {
24939
- return import_os2.default.platform() === "win32" ? "gbk" : "utf-8";
24945
+ return import_os3.default.platform() === "win32" ? "gbk" : "utf-8";
24940
24946
  }
24941
24947
  const detected = import_chardet.default.detect(buffer);
24942
24948
  const encoding = detected?.toLowerCase();
@@ -24946,11 +24952,11 @@ function detectEncoding(buffer) {
24946
24952
  if (encoding && ["gbk", "gb2312", "gb18030"].includes(encoding)) {
24947
24953
  return "gbk";
24948
24954
  }
24949
- return import_os2.default.platform() === "win32" ? "gbk" : "utf-8";
24955
+ return import_os3.default.platform() === "win32" ? "gbk" : "utf-8";
24950
24956
  }
24951
24957
  var executeCommandTool = (0, import_langchain3.tool)(({ command, timeout }) => safeTool(() => executeCommand(command, timeout)), {
24952
24958
  name: "execute_command",
24953
- description: `\u5728\u672C\u5730\u7CFB\u7EDF(${import_os2.default.platform()})\u4E0A\u6267\u884C\u4E00\u6761 shell \u547D\u4EE4\u5E76\u8FD4\u56DE\u8F93\u51FA\u7ED3\u679C\u3002\u9002\u7528\u4E8Erunning\u811A\u672C\u3001\u64CD\u4F5C\u6587\u4EF6\u7CFB\u7EDF\u3001\u542F\u52A8\u8FDB\u7A0B\u7B49\u573A\u666F\u3002\u5FC5\u987B\u6CE8\u610F\u64CD\u4F5C\u7CFB\u7EDF\u7684\u517C\u5BB9\u6027\uFF0C\u5F53\u524D\u64CD\u4F5C\u7CFB\u7EDF\u4E3A ${import_os2.default.platform()}\u3002`,
24959
+ description: `\u5728\u672C\u5730\u7CFB\u7EDF(${import_os3.default.platform()})\u4E0A\u6267\u884C\u4E00\u6761 shell \u547D\u4EE4\u5E76\u8FD4\u56DE\u8F93\u51FA\u7ED3\u679C\u3002\u9002\u7528\u4E8Erunning\u811A\u672C\u3001\u64CD\u4F5C\u6587\u4EF6\u7CFB\u7EDF\u3001\u542F\u52A8\u8FDB\u7A0B\u7B49\u573A\u666F\u3002\u5FC5\u987B\u6CE8\u610F\u64CD\u4F5C\u7CFB\u7EDF\u7684\u517C\u5BB9\u6027\uFF0C\u5F53\u524D\u64CD\u4F5C\u7CFB\u7EDF\u4E3A ${import_os3.default.platform()}\u3002`,
24954
24960
  schema: external_exports.object({
24955
24961
  command: external_exports.string().describe("\u8981\u6267\u884C\u7684 shell \u547D\u4EE4"),
24956
24962
  timeout: external_exports.number().default(-1).describe("\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C-1 \u8868\u793A\u4E0D\u9650\u5236")
@@ -25874,13 +25880,13 @@ function getSkills() {
25874
25880
  }
25875
25881
 
25876
25882
  // src/agent/AIAgent/index.ts
25877
- var import_os4 = __toESM(require("os"));
25883
+ var import_os5 = __toESM(require("os"));
25878
25884
 
25879
25885
  // src/agent/AIAgent/SubAgents/SubAIAgent.ts
25880
25886
  var import_langchain18 = require("langchain");
25881
25887
  var import_deepagents = require("deepagents");
25882
25888
  var import_eventemitter_super = require("eventemitter-super");
25883
- var import_os3 = __toESM(require("os"));
25889
+ var import_os4 = __toESM(require("os"));
25884
25890
  var import_crypto4 = require("crypto");
25885
25891
  var import_lodash = require("lodash");
25886
25892
  var SubAIAgent = class _SubAIAgent extends import_eventemitter_super.EventEmitterSuper {
@@ -25944,7 +25950,7 @@ var SubAIAgent = class _SubAIAgent extends import_eventemitter_super.EventEmitte
25944
25950
  const systemPrompt = this.subLevel > 2 ? getSystemPrompt({
25945
25951
  systemPrompt: this.systemPrompt,
25946
25952
  workspace: this.workspace,
25947
- osType: import_os3.default.platform(),
25953
+ osType: import_os4.default.platform(),
25948
25954
  skills: this.skills,
25949
25955
  memoryFilePath: this.memoryFilePath,
25950
25956
  agentRulesPath: this.agentRulesPath,
@@ -25952,7 +25958,7 @@ var SubAIAgent = class _SubAIAgent extends import_eventemitter_super.EventEmitte
25952
25958
  }) : subSystemPrompt({
25953
25959
  systemPrompt: this.systemPrompt,
25954
25960
  workspace: this.workspace,
25955
- osType: import_os3.default.platform(),
25961
+ osType: import_os4.default.platform(),
25956
25962
  skills: this.skills,
25957
25963
  excludeSkills: this.excludeSkills
25958
25964
  });
@@ -26152,7 +26158,7 @@ var AIAgent = class extends import_eventemitter_super2.EventEmitterSuper {
26152
26158
  systemPrompt: getSystemPrompt({
26153
26159
  systemPrompt: this.systemPrompt,
26154
26160
  workspace: this.workspace,
26155
- osType: import_os4.default.platform(),
26161
+ osType: import_os5.default.platform(),
26156
26162
  skills: this.skills,
26157
26163
  memoryFilePath: this.memoryFilePath,
26158
26164
  agentRulesPath: this.agentRulesPath,
@@ -26749,6 +26755,17 @@ async function handleSkillsAdd(name) {
26749
26755
  }
26750
26756
  const targetDir = scope === "local" ? localSkillDir : globalSkillDir;
26751
26757
  const targetPath = import_path20.default.join(targetDir, name);
26758
+ const { action } = await import_inquirer3.default.prompt([
26759
+ {
26760
+ type: "select",
26761
+ name: "action",
26762
+ message: "Select add action:",
26763
+ choices: [
26764
+ { name: "Move (cut)", value: "move" },
26765
+ { name: "Copy", value: "copy" }
26766
+ ]
26767
+ }
26768
+ ]);
26752
26769
  if (import_fs_extra20.default.existsSync(targetPath)) {
26753
26770
  const { overwrite } = await import_inquirer3.default.prompt([
26754
26771
  {
@@ -26764,8 +26781,12 @@ async function handleSkillsAdd(name) {
26764
26781
  }
26765
26782
  import_fs_extra20.default.removeSync(targetPath);
26766
26783
  }
26767
- import_fs_extra20.default.moveSync(skillDir, targetPath, { overwrite: true });
26768
- logSuccess(`Skill ${scope === "local" ? "locally" : "globally"} added: ${targetPath}`);
26784
+ if (action === "move") {
26785
+ import_fs_extra20.default.moveSync(skillDir, targetPath, { overwrite: true });
26786
+ } else {
26787
+ import_fs_extra20.default.copySync(skillDir, targetPath, { overwrite: true });
26788
+ }
26789
+ logSuccess(`Skill ${scope === "local" ? "locally" : "globally"} ${action === "move" ? "moved" : "copied"}: ${targetPath}`);
26769
26790
  _updateRegister(targetDir);
26770
26791
  }
26771
26792
  function handleSkillsDel(index) {
@@ -26914,7 +26935,7 @@ function _updateRegister(skillsDir) {
26914
26935
  import_fs_extra20.default.writeJSONSync(registerPath, register, { spaces: 2 });
26915
26936
  }
26916
26937
  function getRegisteredSkills() {
26917
- const scanPaths = getScanDirPaths();
26938
+ const scanPaths = getScanSkillDirPaths();
26918
26939
  const skills = [];
26919
26940
  scanPaths.forEach((scanPath) => {
26920
26941
  const scanDir = import_path20.default.join(scanPath, "skills");
@@ -26942,7 +26963,7 @@ function _getSkillList(skillsDir) {
26942
26963
  return allSkills;
26943
26964
  }
26944
26965
  function _getAllSkills() {
26945
- const scanPaths = getScanDirPaths();
26966
+ const scanPaths = getScanSkillDirPaths();
26946
26967
  let allSkills = [];
26947
26968
  scanPaths.forEach((scanPath) => {
26948
26969
  const scanDir = import_path20.default.join(scanPath, "skills");
@@ -26958,10 +26979,17 @@ function _getAllSkills() {
26958
26979
  function _getRegisterPath(skillsDir) {
26959
26980
  const normalizedDir = import_path20.default.normalize(skillsDir);
26960
26981
  const baseName = import_path20.default.basename(normalizedDir).toLowerCase();
26982
+ let resultPath = "";
26961
26983
  if (baseName === "@deepfish-ai" || baseName === "skills") {
26962
- return import_path20.default.join(normalizedDir, "register.json");
26984
+ resultPath = import_path20.default.join(normalizedDir, "register.json");
26985
+ } else {
26986
+ resultPath = import_path20.default.join(normalizedDir, "skills", "register.json");
26987
+ }
26988
+ if (import_fs_extra20.default.existsSync(normalizedDir) && !import_fs_extra20.default.existsSync(resultPath)) {
26989
+ import_fs_extra20.default.ensureDirSync(import_path20.default.dirname(resultPath));
26990
+ import_fs_extra20.default.writeJSONSync(resultPath, [], { spaces: 2 });
26963
26991
  }
26964
- return import_path20.default.join(normalizedDir, "skills", "register.json");
26992
+ return resultPath;
26965
26993
  }
26966
26994
 
26967
26995
  // src/cli/cli-skills.ts
@@ -27039,6 +27067,17 @@ async function handleToolsAdd(name) {
27039
27067
  const localToolDir = import_path21.default.join(workspace, ".deepfish-ai", "tools");
27040
27068
  const targetDir = scope === "local" ? localToolDir : globalToolDir;
27041
27069
  const targetPath = import_path21.default.join(targetDir, name);
27070
+ const { action } = await import_inquirer4.default.prompt([
27071
+ {
27072
+ type: "select",
27073
+ name: "action",
27074
+ message: "Select add action:",
27075
+ choices: [
27076
+ { name: "Move (cut)", value: "move" },
27077
+ { name: "Copy", value: "copy" }
27078
+ ]
27079
+ }
27080
+ ]);
27042
27081
  import_fs_extra21.default.ensureDirSync(targetDir);
27043
27082
  if (import_fs_extra21.default.existsSync(targetPath)) {
27044
27083
  const { overwrite } = await import_inquirer4.default.prompt([
@@ -27055,8 +27094,12 @@ async function handleToolsAdd(name) {
27055
27094
  }
27056
27095
  import_fs_extra21.default.removeSync(targetPath);
27057
27096
  }
27058
- import_fs_extra21.default.moveSync(toolDir, targetPath, { overwrite: true });
27059
- logSuccess(`Tool ${scope === "local" ? "locally" : "globally"} added: ${targetPath}`);
27097
+ if (action === "move") {
27098
+ import_fs_extra21.default.moveSync(toolDir, targetPath, { overwrite: true });
27099
+ } else {
27100
+ import_fs_extra21.default.copySync(toolDir, targetPath, { overwrite: true });
27101
+ }
27102
+ logSuccess(`Tool ${scope === "local" ? "locally" : "globally"} ${action === "move" ? "moved" : "copied"}: ${targetPath}`);
27060
27103
  }
27061
27104
  async function handleToolsGenerate(target) {
27062
27105
  if (!target.trim()) {
@@ -27416,7 +27459,7 @@ async function handlePlan(args) {
27416
27459
  }
27417
27460
  async function handlePlanContinue() {
27418
27461
  const skillPrompt = `
27419
- \u76EE\u524D\u4EFB\u52A1\u6267\u884C\u4E86\u4E00\u90E8\u5206\uFF0C\u9700\u8981\u7EE7\u7EED\u6267\u884C\u3002\u4F60\u8D1F\u8D23\u6309\u987A\u5E8F\u8C03\u5EA6\u6267\u884C tmp_tasklist.json \u4E2D\u7684\u5B50\u4EFB\u52A1\uFF0C\u5B8C\u6210 tmp_task_goal.md \u63CF\u8FF0\u7684\u6574\u4F53\u76EE\u6807\u3002
27462
+ \u76EE\u524D\u4EFB\u52A1\u6267\u884C\u4E86\u4E00\u90E8\u5206\uFF0C\u9700\u8981\u7EE7\u7EED\u6267\u884C\u3002\u4F60\u8D1F\u8D23\u6309\u987A\u5E8F\u8C03\u5EA6\u6267\u884C\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u6587\u4EF6 tmp_tasklist.json \u4E2D\u7684\u5B50\u4EFB\u52A1\uFF0C\u5B8C\u6210\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u6587\u4EF6 tmp_task_goal.md \u63CF\u8FF0\u7684\u6574\u4F53\u76EE\u6807\u3002
27420
27463
 
27421
27464
  \u6267\u884C\u89C4\u5219\uFF1A
27422
27465
  1. \u5148\u8BFB\u53D6 tmp_task_goal.md \u4E86\u89E3\u6574\u4F53\u76EE\u6807\uFF1B
@@ -29,8 +29,8 @@ homepage: ''
29
29
  - 一次最多问8个问题,避免一次性问太多
30
30
  - 持续交互直到需求足够清晰,能够拆解为具体的子任务
31
31
  3. 将收敛后的完整需求作为用户的原始任务描述;
32
- 4. 在当前目录创建 tmp_task_goal.md,记录收敛后的完整需求描述;
33
- 5. 创建 tmp_tasklist.json,包含拆解后的子任务列表。
32
+ 4. 在当前工作目录创建文件 tmp_task_goal.md,记录收敛后的完整需求描述;
33
+ 5. 在当前工作目录创建文件 tmp_tasklist.json,包含拆解后的子任务列表。
34
34
 
35
35
  tmp_tasklist.json 格式要求:
36
36
  - 必须是合法的 JSON 数组
@@ -60,7 +60,7 @@ tmp_tasklist.json 格式要求:
60
60
  **调度管理器子Agent提示词:**
61
61
 
62
62
  ```
63
- 你负责按顺序调度执行 tmp_tasklist.json 中的子任务,完成 tmp_task_goal.md 描述的整体目标。
63
+ 你负责按顺序调度执行当前工作目录文件 tmp_tasklist.json 中的子任务,完成当前工作目录文件 tmp_task_goal.md 描述的整体目标。
64
64
 
65
65
  执行规则:
66
66
  1. 先读取 tmp_task_goal.md 了解整体目标;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepfish-ai",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
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": {