zrocclaw 0.0.11 → 0.0.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/README.md CHANGED
@@ -6,6 +6,14 @@ ZrocClaw 官方命令行工具,用于快速启动和管理你的专属浏览
6
6
 
7
7
  本工具提供了简易的命令,底层依赖 `pm2` 来守护后台进程,帮助你一键启动、停止、或更新 ZrocClaw 服务。
8
8
 
9
+ ## 前置条件
10
+
11
+ 在安装 CLI 工具前,请确保您的系统满足以下要求:
12
+
13
+ - **Node.js**: 版本需 **>= 22.0.0**。
14
+ - **包管理器**: `npm` 或 `pnpm`。
15
+ - **浏览器**: 需本地安装 **Google Chrome** 或 Chromium 浏览器(以支持 ZrocClaw 后台的浏览器自动化操作)。
16
+
9
17
  ## 安装
10
18
 
11
19
  推荐进行全局安装,以便在任何终端路径下均可执行:
package/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "zrocclaw",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "个人专属浏览器AI助手命令行工具",
5
+ "keywords": [
6
+ "zrocclaw",
7
+ "ai",
8
+ "assistant",
9
+ "browser",
10
+ "agent",
11
+ "automation",
12
+ "langchain",
13
+ "playwright",
14
+ "cli",
15
+ "openclaw"
16
+ ],
5
17
  "bin": {
6
18
  "zrocclaw": "bin/zrocclaw.js"
7
19
  },
package/server/server.js CHANGED
@@ -377,7 +377,7 @@ var PlaywrightExecutor = class {
377
377
  }
378
378
  };
379
379
 
380
- // ../../packages/core/dist/chunk-RBTGQCL7.mjs
380
+ // ../../packages/core/dist/chunk-OSSFB5D4.mjs
381
381
  var import_openai = require("@langchain/openai");
382
382
  var import_langchain = require("langchain");
383
383
  var import_messages = require("@langchain/core/messages");
@@ -515,14 +515,28 @@ var readFileTool = (0, import_tools2.tool)(
515
515
  }
516
516
  );
517
517
  var writeFileTool = (0, import_tools2.tool)(
518
- async ({ filePath, content }) => {
518
+ async ({ filePath, content, startLine, endLine }) => {
519
519
  const targetPath = resolveSafePath(filePath);
520
520
  try {
521
521
  const stat2 = await fs4.stat(targetPath);
522
522
  if (!stat2.isFile()) {
523
523
  throw new Error("\u76EE\u6807\u8DEF\u5F84\u4E0D\u662F\u6587\u4EF6");
524
524
  }
525
- await fs4.writeFile(targetPath, content || "", { encoding: "utf-8" });
525
+ if (startLine !== void 0) {
526
+ const fileContent = await fs4.readFile(targetPath, "utf-8");
527
+ const lines = fileContent.split("\n");
528
+ const startIdx = Math.max(0, startLine - 1);
529
+ let deleteCount = 1;
530
+ if (endLine !== void 0) {
531
+ const endIdx = endLine - 1;
532
+ deleteCount = Math.max(0, endIdx - startIdx + 1);
533
+ }
534
+ const contentLines = content.split("\n");
535
+ lines.splice(startIdx, deleteCount, ...contentLines);
536
+ await fs4.writeFile(targetPath, lines.join("\n"), { encoding: "utf-8" });
537
+ } else {
538
+ await fs4.writeFile(targetPath, content || "", { encoding: "utf-8" });
539
+ }
526
540
  return JSON.stringify({
527
541
  success: true,
528
542
  operation: "write_file",
@@ -539,10 +553,12 @@ var writeFileTool = (0, import_tools2.tool)(
539
553
  },
540
554
  {
541
555
  name: "write_file",
542
- description: "\u5728\u5DE5\u4F5C\u76EE\u5F55\u5185\u8986\u76D6\u5199\u5165\u5DF2\u6709\u6587\u4EF6\u3002\u6CE8\u610F\uFF1AfilePath\u5FC5\u987B\u662F\u76F8\u5BF9\u5DE5\u4F5C\u76EE\u5F55\u7684\u8DEF\u5F84\u3002",
556
+ description: "\u5728\u5DE5\u4F5C\u76EE\u5F55\u5185\u5199\u5165\u5DF2\u6709\u6587\u4EF6\u3002\u53EF\u4EE5\u5168\u91CF\u8986\u76D6\uFF0C\u4E5F\u53EF\u4EE5\u6307\u5B9A\u884C\u53F7\u8FDB\u884C\u5C40\u90E8\u66FF\u6362/\u63D2\u5165\u4EE5\u8282\u7701 token\u3002\u6CE8\u610F\uFF1AfilePath\u5FC5\u987B\u662F\u76F8\u5BF9\u5DE5\u4F5C\u76EE\u5F55\u7684\u8DEF\u5F84\u3002",
543
557
  schema: z2.object({
544
558
  filePath: z2.string().describe("\u76F8\u5BF9\u5DE5\u4F5C\u76EE\u5F55\u7684\u6587\u4EF6\u8DEF\u5F84"),
545
- content: z2.string().describe("\u8981\u5199\u5165\u7684\u6587\u4EF6\u5185\u5BB9")
559
+ content: z2.string().describe("\u8981\u5199\u5165\u6216\u63D2\u5165\u7684\u6587\u4EF6\u5185\u5BB9"),
560
+ startLine: z2.number().optional().describe("\u8D77\u59CB\u884C\u53F7\uFF08\u4ECE1\u5F00\u59CB\uFF09\u3002\u5982\u679C\u63D0\u4F9B\u6B64\u53C2\u6570\uFF0C\u5219\u5728\u6307\u5B9A\u884C\u8FDB\u884C\u5C40\u90E8\u66FF\u6362\u6216\u63D2\u5165\u3002\u5982\u679C\u672A\u63D0\u4F9B\uFF0C\u5219\u5168\u91CF\u8986\u76D6\u6587\u4EF6\u3002"),
561
+ endLine: z2.number().optional().describe("\u7ED3\u675F\u884C\u53F7\uFF08\u4ECE1\u5F00\u59CB\uFF0C\u5305\u542B\u8BE5\u884C\uFF09\u3002\u5982\u679C\u63D0\u4F9B\u6B64\u53C2\u6570\uFF0C\u5C06\u628A\u4ECE startLine \u5230 endLine \u7684\u5185\u5BB9\u66FF\u6362\u4E3A\u65B0 content\uFF1B\u5982\u679C\u4EC5\u63D0\u4F9B startLine\uFF0C\u5219\u4EC5\u66FF\u6362\u8BE5\u884C\uFF1B\u5982\u679C\u8981\u5728\u67D0\u884C\u524D\u5355\u7EAF\u63D2\u5165\u800C\u4E0D\u5220\u9664\u539F\u5185\u5BB9\uFF0C\u53EF\u5C06 endLine \u8BBE\u4E3A startLine - 1\u3002")
546
562
  })
547
563
  }
548
564
  );
@@ -765,14 +781,14 @@ var PLAYWRIGHT_PROMPT = `
765
781
  * **\u8F93\u5165**: \u53EF\u9009\u683C\u5F0F\u5316\u5B57\u7B26\u4E32\u548C\u65F6\u533A\u3002
766
782
 
767
783
  ### File System & Memory
768
- \u4F60\u62E5\u6709\u5BF9\u5DE5\u4F5C\u76EE\u5F55 \`server/agents/memory\`\uFF08\u6216\u8005\u901A\u8FC7 file_operations \u83B7\u53D6\u7684\u6839\u76EE\u5F55\uFF09\u7684\u6587\u4EF6\u64CD\u4F5C\u6743\u9650\u3002
784
+ \u4F60\u62E5\u6709\u5BF9\u5DE5\u4F5C\u76EE\u5F55\uFF08\u6216\u6587\u4EF6\u64CD\u4F5C\u5DE5\u5177\u6307\u5B9A\u7684\u6839\u76EE\u5F55\uFF09\u7684\u6587\u4EF6\u64CD\u4F5C\u6743\u9650\u3002
769
785
 
770
- 4. **file_operations**: \u7EDF\u4E00\u7684\u6587\u4EF6\u64CD\u4F5C\u5DE5\u5177\uFF0C\u652F\u6301\u901A\u8FC7 \`action\` \u53C2\u6570\u6267\u884C\u4EE5\u4E0B\u64CD\u4F5C\uFF1A
771
- * \`create\`: \u521B\u5EFA\u65B0\u6587\u4EF6\u3002
772
- * \`read\`: \u8BFB\u53D6\u6587\u4EF6\u5185\u5BB9\u3002
773
- * \`write\`: \u8986\u76D6\u5199\u5165\u6587\u4EF6\u5185\u5BB9\u3002
774
- * \`delete\`: \u5220\u9664\u6587\u4EF6\u6216\u76EE\u5F55\u3002
775
- * \`list\`: \u67E5\u770B\u6587\u4EF6\u5939\u4E0B\u6587\u4EF6\u5217\u8868\u3002
786
+ 4. **\u6587\u4EF6\u64CD\u4F5C\u5DE5\u5177\u7EC4**: \u63D0\u4F9B\u4E86\u4E00\u7EC4\u539F\u5B50\u5316\u7684\u6587\u4EF6\u64CD\u4F5C\u5DE5\u5177\uFF1A
787
+ * \`create_file_or_directory\`: \u5728\u5DE5\u4F5C\u76EE\u5F55\u5185\u65B0\u5EFA\u6587\u4EF6\u6216\u76EE\u5F55\u3002
788
+ * \`read_file\`: \u5728\u5DE5\u4F5C\u76EE\u5F55\u5185\u8BFB\u53D6\u5DF2\u6709\u6587\u4EF6\u5185\u5BB9\u3002
789
+ * \`write_file\`: \u5728\u5DE5\u4F5C\u76EE\u5F55\u5185\u5199\u5165\u5DF2\u6709\u6587\u4EF6\u3002\u652F\u6301\u5168\u91CF\u8986\u76D6\uFF0C\u4E5F\u652F\u6301\u901A\u8FC7\u6307\u5B9A\u884C\u53F7 (startLine / endLine) \u8FDB\u884C\u5C40\u90E8\u66FF\u6362\u6216\u63D2\u5165\u4EE5\u8282\u7701 token\u3002
790
+ * \`delete_file_or_directory\`: \u5728\u5DE5\u4F5C\u76EE\u5F55\u5185\u5220\u9664\u6587\u4EF6\u6216\u76EE\u5F55\u3002
791
+ * \`list_files\`: \u5217\u51FA\u5DE5\u4F5C\u76EE\u5F55\u5185\u7684\u76EE\u5F55\u5185\u5BB9\u3002
776
792
 
777
793
  ## Long-term Memory & Skills
778
794