@yeaft/webchat-agent 0.1.920 → 0.1.922

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.920",
3
+ "version": "0.1.922",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -36,8 +36,9 @@ You are Yeaft, an AI companion that maintains a single continuous conversation w
36
36
  ## Search and Navigation
37
37
 
38
38
  - Prefer `rg` (ripgrep) over `grep` for speed and regex support
39
- - Use `glob` patterns for file discovery
40
- - Read files with offset/limit for large files instead of loading everything
39
+ - A file is "large" only at **>3000 lines**. Read the whole file by default; reach for `offset`/`limit` only above that threshold or when you already know the exact line range you need.
40
+ - If you already know the file path, **skip `glob`** and go straight to `file-read` or `grep`. Reserve `glob` for actual file discovery.
41
+ - When you need multiple independent reads/searches, issue them in **one assistant turn as parallel tool calls** instead of serializing one round-trip per file.
41
42
 
42
43
  ## Frontend Design (when applicable)
43
44
 
@@ -84,8 +85,9 @@ You are Yeaft, an AI companion that maintains a single continuous conversation w
84
85
  ## 搜索与导航
85
86
 
86
87
  - 优先使用 `rg`(ripgrep)而非 `grep`,速度更快且支持正则
87
- - 使用 `glob` 模式发现文件
88
- - 对大文件使用 offset/limit 读取,而非加载全部内容
88
+ - "大文件" 的标准是 **> 3000 行**。默认读整文件,只在超过这个阈值、或你已经知道具体行段的时候才用 `offset` / `limit`。
89
+ - 如果你已经知道文件路径,**不要 `glob`**,直接 `file-read` 或 `grep`。`glob` 留给真的需要发现文件名的场景。
90
+ - 同一个 turn 里有多个互不依赖的读取/搜索时,**在同一个 assistant turn 内并行发起多个 tool call**,不要一次一个回合地串行。
89
91
 
90
92
  ## 前端设计(适用时)
91
93
 
@@ -32,8 +32,9 @@
32
32
  ## Search and Navigation
33
33
 
34
34
  - Prefer `rg` (ripgrep) over `grep` for speed and regex support
35
- - Use `glob` patterns for file discovery
36
- - Read files with offset/limit for large files instead of loading everything
35
+ - A file is "large" only at **>3000 lines**. Read the whole file by default; reach for `offset`/`limit` only above that threshold or when you already know the exact line range you need.
36
+ - If you already know the file path, **skip `glob`** and go straight to `file-read` or `grep`. Reserve `glob` for actual file discovery.
37
+ - When you need multiple independent reads/searches, issue them in **one assistant turn as parallel tool calls** instead of serializing one round-trip per file.
37
38
 
38
39
  ## Frontend Design (when applicable)
39
40
 
@@ -76,8 +77,9 @@
76
77
  ## 搜索与导航
77
78
 
78
79
  - 优先使用 `rg`(ripgrep)而非 `grep`,速度更快且支持正则
79
- - 使用 `glob` 模式发现文件
80
- - 对大文件使用 offset/limit 读取,而非加载全部内容
80
+ - "大文件" 的标准是 **> 3000 行**。默认读整文件,只在超过这个阈值、或你已经知道具体行段的时候才用 `offset` / `limit`。
81
+ - 如果你已经知道文件路径,**不要 `glob`**,直接 `file-read` 或 `grep`。`glob` 留给真的需要发现文件名的场景。
82
+ - 同一个 turn 里有多个互不依赖的读取/搜索时,**在同一个 assistant turn 内并行发起多个 tool call**,不要一次一个回合地串行。
81
83
 
82
84
  ## 前端设计(适用时)
83
85
 
@@ -9,12 +9,14 @@
9
9
  - Prefer editing existing files over creating new ones
10
10
  - Use `bash` for shell commands; avoid interactive commands (no `vim`, no `less`, no `git rebase -i`)
11
11
  - When output is too large, extract the relevant portion rather than dumping everything
12
+ - **Batch independent tool calls in a single turn.** When the next few steps don't depend on each other's output (e.g. reading three sibling files, or running `grep` + `glob` to triangulate), emit them as parallel tool calls in one assistant turn instead of one-per-turn.
12
13
 
13
14
  ## File Operations
14
15
 
15
16
  - For file edits, ensure `old_string` is unique in the file or provide enough surrounding context
16
17
  - When writing code: follow existing patterns, match project style, don't add unnecessary dependencies
17
18
  - Prefer small, targeted edits over full file rewrites
19
+ - **A file is "large" only at >3000 lines.** Below that, read it whole. Don't pre-emptively split a 500-line file into three `offset`/`limit` reads — that's three round-trips for the same content.
18
20
 
19
21
  ## Shell Commands
20
22
 
@@ -26,10 +28,14 @@
26
28
 
27
29
  ## Search Strategy
28
30
 
29
- 1. Start with `glob` to find relevant files by name/pattern
30
- 2. Use `grep` to search content within those files
31
- 3. Use `file-read` to examine specific sections in detail
32
- 4. Only use `bash` + shell commands when dedicated tools cannot do the job
31
+ Pick the shortest path that gets you the answer — don't always start at step 1.
32
+
33
+ 1. **If you already know the file path** → go straight to `file-read` (or `grep` for a pattern within it). Skip `glob`.
34
+ 2. **If you know roughly which directory but not the file** → `grep` directly with a `glob` or `type` filter; that's one tool call, not two.
35
+ 3. **If you have nothing but a pattern of file names** → start with `glob`, then `grep` / `file-read`.
36
+ 4. Use `bash` only when no dedicated tool can do the job.
37
+
38
+ When several of these steps are independent (e.g. reading three files you already know the paths of), issue them as **parallel tool calls in one turn**, not three sequential turns.
33
39
 
34
40
  ## Error Handling
35
41
 
@@ -70,12 +76,14 @@ or pure conversational/question turns — the checklist becomes noise.
70
76
  - 优先编辑现有文件而非创建新文件
71
77
  - 使用 `bash` 执行 shell 命令;避免交互式命令(不用 `vim`、不用 `less`、不用 `git rebase -i`)
72
78
  - 当输出过大时,提取相关部分而非倾倒所有内容
79
+ - **同一个 turn 内并行调用互不依赖的工具。** 接下来几步如果彼此输出不依赖(比如读三个并列文件,或者 `grep` + `glob` 一起定位),就在一个 assistant turn 里并行发出多个 tool call,不要一次一个回合地串行。
73
80
 
74
81
  ## 文件操作
75
82
 
76
83
  - 文件编辑时,确保 `old_string` 在文件中唯一,或提供足够的上下文
77
84
  - 编写代码时:遵循现有模式,匹配项目风格,不添加不必要的依赖
78
85
  - 优先使用小的、有针对性的编辑而非完整文件重写
86
+ - **"大文件" 的标准是 > 3000 行。** 没超过就整文件读完,不要把一个 500 行的文件预先拆成三段 `offset`/`limit` 读 —— 那是三次回合读同一份内容。
79
87
 
80
88
  ## Shell 命令
81
89
 
@@ -87,10 +95,14 @@ or pure conversational/question turns — the checklist becomes noise.
87
95
 
88
96
  ## 搜索策略
89
97
 
90
- 1. 先用 `glob` 通过名称/模式找到相关文件
91
- 2. 用 `grep` 在这些文件中搜索内容
92
- 3. `file-read` 详细查看特定部分
93
- 4. 只有当专用工具无法完成时才使用 `bash` + shell 命令
98
+ 挑能拿到答案的最短路径,不必每次都从第 1 步开始。
99
+
100
+ 1. **已经知道文件路径** → 直接 `file-read`(或在该文件里 `grep` 找模式)。跳过 `glob`。
101
+ 2. **大致知道目录但不知道文件** → 直接 `grep` 配合 `glob` / `type` 过滤;这一步本身就够,不用先 `glob` 再 `grep`。
102
+ 3. **只有文件名模式** → 先 `glob`,再 `grep` / `file-read`。
103
+ 4. 只有当专用工具都做不到的时候才用 `bash`。
104
+
105
+ 如果上面这些步骤里有几个互不依赖(比如要读三个你已经知道路径的文件),**在同一个 turn 里并行调用**,不要串成三个回合。
94
106
 
95
107
  ## 错误处理
96
108
 
@@ -2,7 +2,8 @@
2
2
  * file-read.js — Read file contents with line numbers.
3
3
  *
4
4
  * Reads text files with `cat -n` style line numbering, supports
5
- * offset/limit for large files, and handles binary file detection.
5
+ * `offset`/`limit` for >3000-line files, and handles binary file
6
+ * detection.
6
7
  *
7
8
  * Modeled after Claude Code's Read tool.
8
9
  */
@@ -26,8 +27,12 @@ const BINARY_EXTS = new Set([
26
27
  /** Max file size to read (10 MB). */
27
28
  const MAX_FILE_SIZE = 10 * 1024 * 1024;
28
29
 
29
- /** Default number of lines to read. */
30
- const DEFAULT_LIMIT = 2000;
30
+ /** Default number of lines to read. Aligned with the "large file = >3000
31
+ * lines" rule in templates/{base,common-rules,tool-guidance}.md so a
32
+ * ≤3000-line file is returned in one call (no silent truncation that
33
+ * would trigger a follow-up `offset:3000` call — that's exactly the
34
+ * round-trip this tool's prompt guidance promises to avoid). */
35
+ const DEFAULT_LIMIT = 3000;
31
36
 
32
37
  export default defineTool({
33
38
  name: 'FileRead',
@@ -38,10 +43,10 @@ Supports offset and limit for reading specific portions of large files.
38
43
 
39
44
  Guidelines:
40
45
  - Use absolute paths when possible
41
- - For large files, use offset and limit to read specific sections
46
+ - A file is "large" only at >3000 lines. Read the whole file by default; only use offset/limit above that threshold or when you already know the exact line range you need.
42
47
  - Binary files are detected by extension and rejected
43
48
  - Maximum file size: 10MB
44
- - Default limit: 2000 lines`,
49
+ - Default limit: 3000 lines (matches the "large file = >3000 lines" threshold)`,
45
50
  parameters: {
46
51
  type: 'object',
47
52
  properties: {