@yeaft/webchat-agent 0.1.1016 → 0.1.1018
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 +1 -1
- package/yeaft/tools/agent.js +67 -11
- package/yeaft/tools/apply-patch.js +15 -2
- package/yeaft/tools/ask-user.js +20 -3
- package/yeaft/tools/bash.js +27 -4
- package/yeaft/tools/close-agent.js +17 -3
- package/yeaft/tools/enter-worktree.js +19 -3
- package/yeaft/tools/exit-worktree.js +22 -4
- package/yeaft/tools/file-edit.js +29 -5
- package/yeaft/tools/file-read.js +25 -4
- package/yeaft/tools/file-write.js +20 -3
- package/yeaft/tools/glob.js +24 -4
- package/yeaft/tools/grep.js +61 -12
- package/yeaft/tools/history-search.js +16 -3
- package/yeaft/tools/image-generation.js +23 -4
- package/yeaft/tools/js-repl.js +26 -4
- package/yeaft/tools/list-agents.js +19 -3
- package/yeaft/tools/list-dir.js +16 -3
- package/yeaft/tools/mcp-tools.js +39 -6
- package/yeaft/tools/notebook-edit.js +32 -6
- package/yeaft/tools/registry.js +19 -32
- package/yeaft/tools/route-forward.js +32 -4
- package/yeaft/tools/send-message.js +22 -3
- package/yeaft/tools/skill.js +34 -6
- package/yeaft/tools/start-plan.js +43 -6
- package/yeaft/tools/todo-write.js +34 -5
- package/yeaft/tools/types.js +2 -2
- package/yeaft/tools/view-image.js +28 -2
- package/yeaft/tools/wait-agent.js +30 -3
- package/yeaft/tools/web-fetch.js +24 -4
- package/yeaft/tools/web-search.js +19 -3
- package/yeaft/tools/localized-descriptions.js +0 -237
|
@@ -27,7 +27,8 @@ import { defineTool } from './types.js';
|
|
|
27
27
|
|
|
28
28
|
export default defineTool({
|
|
29
29
|
name: 'RouteForward',
|
|
30
|
-
description:
|
|
30
|
+
description: {
|
|
31
|
+
en: `Hand this turn off to another VP in the same session.
|
|
31
32
|
|
|
32
33
|
Use this tool — NOT free-text @mentions — to route a question or task to
|
|
33
34
|
another VP. VP-authored @mentions in chat text are NOT automatically routed
|
|
@@ -55,20 +56,47 @@ Rules:
|
|
|
55
56
|
per session (throttled).
|
|
56
57
|
|
|
57
58
|
Returns JSON: { ok, dispatched?, error?, detail? }.`,
|
|
59
|
+
zh: `将当前 turn 转发给同一 Session 中的其他 VP。
|
|
60
|
+
|
|
61
|
+
使用此工具——而非自由文本 @mention——将问题或任务路由给其他 VP。VP 在聊天文本中写的 @mention
|
|
62
|
+
不会自动路由(Session 协调器仅对用户消息做文本路由);你必须调用 RouteForward 才能完成转交。
|
|
63
|
+
|
|
64
|
+
参数:
|
|
65
|
+
- to(字符串):目标 vpId,或字面量 "all" 向 Session 中所有其他成员广播(受 Session fan-out 上限限制)。
|
|
66
|
+
- text(字符串):以你名义发送的消息正文。
|
|
67
|
+
- reason(字符串,可选):转发原因的简短说明,记录在消息元数据中用于审计/界面显示。
|
|
68
|
+
|
|
69
|
+
规则:
|
|
70
|
+
- 转发给自己会被拒绝(self_forward_rejected)。
|
|
71
|
+
- 转发给非成员会被拒绝(target_not_in_roster)。
|
|
72
|
+
- 转发带有 causedBy 链;超过 10 跳的链会被阻止(chain_depth_exceeded)。
|
|
73
|
+
- 同一目标在每 5 秒窗口内最多被转发 8 次(节流限制)。
|
|
74
|
+
|
|
75
|
+
返回 JSON:{ ok, dispatched?, error?, detail? }。`
|
|
76
|
+
},
|
|
58
77
|
parameters: {
|
|
59
78
|
type: 'object',
|
|
60
79
|
properties: {
|
|
61
80
|
to: {
|
|
62
81
|
type: 'string',
|
|
63
|
-
description:
|
|
82
|
+
description: {
|
|
83
|
+
en: 'Target vpId, or "all" for broadcast',
|
|
84
|
+
zh: '目标 vpId,或 "all" 广播给所有人',
|
|
85
|
+
},
|
|
64
86
|
},
|
|
65
87
|
text: {
|
|
66
88
|
type: 'string',
|
|
67
|
-
description:
|
|
89
|
+
description: {
|
|
90
|
+
en: 'The message body to forward',
|
|
91
|
+
zh: '要转发的消息正文',
|
|
92
|
+
},
|
|
68
93
|
},
|
|
69
94
|
reason: {
|
|
70
95
|
type: 'string',
|
|
71
|
-
description:
|
|
96
|
+
description: {
|
|
97
|
+
en: 'Optional: short rationale for the forward',
|
|
98
|
+
zh: '可选:转交的简短原因',
|
|
99
|
+
},
|
|
72
100
|
},
|
|
73
101
|
},
|
|
74
102
|
required: ['to', 'text'],
|
|
@@ -12,7 +12,8 @@ import { isTerminalAgentStatus, isPromptableAgentStatus, STATUS, describeAgentSt
|
|
|
12
12
|
export default defineTool({
|
|
13
13
|
name: 'PromptAgent',
|
|
14
14
|
aliases: ['SendMessage'],
|
|
15
|
-
description:
|
|
15
|
+
description: {
|
|
16
|
+
en: `Send a follow-up prompt to a sub-agent you previously spawned.
|
|
16
17
|
|
|
17
18
|
Use this to give the sub-agent more work, additional instructions, or relay
|
|
18
19
|
information. The prompt is queued for the agent to process on its next turn.
|
|
@@ -26,16 +27,34 @@ SpawnAgent → (PromptAgent ↔ WaitAgent)+ → CloseAgent → final reply to us
|
|
|
26
27
|
|
|
27
28
|
PromptAgent is rejected if the sub-agent is in a terminal state
|
|
28
29
|
(completed/failed/closed/abandoned). Use SpawnAgent to start a fresh one.`,
|
|
30
|
+
zh: `向之前创建的子 Agent 发送后续提示。
|
|
31
|
+
|
|
32
|
+
用于给子 Agent 更多工作、额外指令或传递信息。提示会排队等待子 Agent 在其下一个 turn 处理。
|
|
33
|
+
|
|
34
|
+
重要——PromptAgent 仅将消息排队,不阻塞。返回后你通常需要立即调用 WaitAgent 来收集回复。
|
|
35
|
+
不要在 PromptAgent 后直接结束 turn,除非:(a) 调用 WaitAgent,(b) 向用户说明你刚让子 Agent
|
|
36
|
+
做了什么,或 (c) 调用 CloseAgent。编排循环为:
|
|
37
|
+
SpawnAgent -> (PromptAgent <-> WaitAgent)+ -> CloseAgent -> 最终回复给用户。
|
|
38
|
+
|
|
39
|
+
如果子 Agent 处于终止状态(completed/failed/closed/abandoned),PromptAgent 会被拒绝。
|
|
40
|
+
用 SpawnAgent 启动新的。`
|
|
41
|
+
},
|
|
29
42
|
parameters: {
|
|
30
43
|
type: 'object',
|
|
31
44
|
properties: {
|
|
32
45
|
agent_id: {
|
|
33
46
|
type: 'string',
|
|
34
|
-
description:
|
|
47
|
+
description: {
|
|
48
|
+
en: 'The sub-agent ID (returned by Agent tool)',
|
|
49
|
+
zh: '子 Agent ID(由 Agent 工具返回)',
|
|
50
|
+
},
|
|
35
51
|
},
|
|
36
52
|
message: {
|
|
37
53
|
type: 'string',
|
|
38
|
-
description:
|
|
54
|
+
description: {
|
|
55
|
+
en: 'The message to send to the agent',
|
|
56
|
+
zh: '要发送给 Agent 的消息',
|
|
57
|
+
},
|
|
39
58
|
},
|
|
40
59
|
},
|
|
41
60
|
required: ['agent_id', 'message'],
|
package/yeaft/tools/skill.js
CHANGED
|
@@ -17,7 +17,8 @@ import { defineTool } from './types.js';
|
|
|
17
17
|
|
|
18
18
|
export default defineTool({
|
|
19
19
|
name: 'Skill',
|
|
20
|
-
description:
|
|
20
|
+
description: {
|
|
21
|
+
en: `Load and query skills from the Yeaft skill library.
|
|
21
22
|
|
|
22
23
|
Skills are specialized behaviors or workflows in ~/.yeaft/skills/.
|
|
23
24
|
Two formats supported:
|
|
@@ -29,29 +30,56 @@ Actions:
|
|
|
29
30
|
- "view" — view a skill's full content. For directory skills, also lists linked files. Pass filePath to read a specific reference/template.
|
|
30
31
|
- "search" — find relevant skills for a query string
|
|
31
32
|
- "load" — alias for "view" (backward compatible)`,
|
|
33
|
+
zh: `从 Yeaft 技能库加载和查询技能。
|
|
34
|
+
|
|
35
|
+
技能是 ~/.yeaft/skills/ 中的专业化行为或工作流。支持两种格式:
|
|
36
|
+
- 单文件:skills/my-skill.md
|
|
37
|
+
- 目录:skills/my-skill/SKILL.md + references/ + templates/
|
|
38
|
+
|
|
39
|
+
操作:
|
|
40
|
+
- "list" — 列出所有技能(仅元数据:名称、描述、分类)
|
|
41
|
+
- "view" — 查看技能的完整内容。对目录型技能同时列出关联文件。传 filePath 可读取特定引用/模板。
|
|
42
|
+
- "search" — 为查询字符串查找相关技能
|
|
43
|
+
- "load" — "view" 的别名(向后兼容)`
|
|
44
|
+
},
|
|
32
45
|
parameters: {
|
|
33
46
|
type: 'object',
|
|
34
47
|
properties: {
|
|
35
48
|
action: {
|
|
36
49
|
type: 'string',
|
|
37
50
|
enum: ['list', 'view', 'load', 'search'],
|
|
38
|
-
description:
|
|
51
|
+
description: {
|
|
52
|
+
en: '"list" lists all skills, "view"/"load" loads a specific skill, "search" finds relevant skills',
|
|
53
|
+
zh: '"list" 列出所有 skill,"view"/"load" 加载特定 skill,"search" 查找相关 skill',
|
|
54
|
+
},
|
|
39
55
|
},
|
|
40
56
|
name: {
|
|
41
57
|
type: 'string',
|
|
42
|
-
description:
|
|
58
|
+
description: {
|
|
59
|
+
en: 'Skill name (for "view"/"load" action)',
|
|
60
|
+
zh: 'Skill 名称(用于 "view"/"load" 动作)',
|
|
61
|
+
},
|
|
43
62
|
},
|
|
44
63
|
query: {
|
|
45
64
|
type: 'string',
|
|
46
|
-
description:
|
|
65
|
+
description: {
|
|
66
|
+
en: 'Search query (for "search" action)',
|
|
67
|
+
zh: '搜索查询(用于 "search" 动作)',
|
|
68
|
+
},
|
|
47
69
|
},
|
|
48
70
|
filePath: {
|
|
49
71
|
type: 'string',
|
|
50
|
-
description:
|
|
72
|
+
description: {
|
|
73
|
+
en: 'Read a linked file from a directory skill (e.g. "references/style-guide.md")',
|
|
74
|
+
zh: '读取目录式 skill 的关联文件(如 "references/style-guide.md")',
|
|
75
|
+
},
|
|
51
76
|
},
|
|
52
77
|
category: {
|
|
53
78
|
type: 'string',
|
|
54
|
-
description:
|
|
79
|
+
description: {
|
|
80
|
+
en: 'Filter by category (for "list" action)',
|
|
81
|
+
zh: '按分类过滤(用于 "list" 动作)',
|
|
82
|
+
},
|
|
55
83
|
},
|
|
56
84
|
},
|
|
57
85
|
required: ['action'],
|
|
@@ -40,7 +40,8 @@ import { getDefaultPlanInstruction } from '../prompts.js';
|
|
|
40
40
|
|
|
41
41
|
export default defineTool({
|
|
42
42
|
name: 'StartPlan',
|
|
43
|
-
description:
|
|
43
|
+
description: {
|
|
44
|
+
en: `Enter planning mode for a non-trivial task. Use BEFORE you start working when the request needs multiple steps, has unclear scope, or the user said "make a plan" / "think through this first".
|
|
44
45
|
|
|
45
46
|
This tool returns a planning instruction. Use it to land a structured plan, then keep working in the same turn. The expected flow is:
|
|
46
47
|
1. Produce a short prose plan (problem, approach, risks).
|
|
@@ -59,28 +60,64 @@ WHEN NOT TO USE:
|
|
|
59
60
|
EXCEPTION — stop after the plan only if the first step is genuinely "ask the user" (an unresolved unknown that blocks every other step). Otherwise keep moving.
|
|
60
61
|
|
|
61
62
|
The tool takes the topic plus optional guiding fields (stuckAt, userProblem, expectedScale, additionalContext) that help you think; they're echoed back verbatim, so don't repeat the full user request in \`topic\`.`,
|
|
63
|
+
zh: `进入规划模式,用于非平凡任务。在开始工作之前使用——当需求涉及多步骤、范围不明确,或用户说"先做个计划"/"先想清楚"时。
|
|
64
|
+
|
|
65
|
+
此工具返回规划指令。用它产出一份结构化计划,然后在同一个 turn 中继续工作。预期流程是:
|
|
66
|
+
1. 产出简短文字计划(问题、方法、风险)。
|
|
67
|
+
2. 调用 TodoWrite 写出有序步骤。将第一个具体步骤标记为 "in_progress",其余标记为 "pending"。
|
|
68
|
+
3. 开始执行第一个步骤——调用工作所需的任何工具。不要因为计划写完了就结束 turn;计划是跑道。
|
|
69
|
+
|
|
70
|
+
何时使用:
|
|
71
|
+
- 多步骤实现(3+ 步)、重构或开放式调查。
|
|
72
|
+
- 用户明确要求计划、TODO 列表或"想清楚"再动手。
|
|
73
|
+
- 你即将开始一个大型改动,想在动手前有个检查点。
|
|
74
|
+
|
|
75
|
+
何时不使用:
|
|
76
|
+
- 单个琐碎改动、单个命令执行、查询式问题。
|
|
77
|
+
- 中途执行——一旦过了第一步,直接用 TodoWrite。
|
|
78
|
+
|
|
79
|
+
例外——只有当第一步确实是"询问用户"(一个未解决的未知因素,阻塞所有其他步骤)时才在计划后停止。否则继续前进。
|
|
80
|
+
|
|
81
|
+
此工具接收 topic 加上可选引导字段(stuckAt、userProblem、expectedScale、additionalContext)
|
|
82
|
+
帮助你思考;它们会被原样回显,所以不要在 topic 中重复完整的用户请求。`
|
|
83
|
+
},
|
|
62
84
|
parameters: {
|
|
63
85
|
type: 'object',
|
|
64
86
|
properties: {
|
|
65
87
|
topic: {
|
|
66
88
|
type: 'string',
|
|
67
|
-
description:
|
|
89
|
+
description: {
|
|
90
|
+
en: 'One-sentence statement of what is being planned (e.g. "Add dark-mode toggle to YeaftPage settings").',
|
|
91
|
+
zh: '用一句话说明要规划什么(如"为 YeaftPage 设置添加深色模式切换")',
|
|
92
|
+
},
|
|
68
93
|
},
|
|
69
94
|
userProblem: {
|
|
70
95
|
type: 'string',
|
|
71
|
-
description:
|
|
96
|
+
description: {
|
|
97
|
+
en: 'Optional. The underlying problem the user is trying to solve (often broader than the immediate ask).',
|
|
98
|
+
zh: '可选。用户试图解决的根本问题(通常比即时请求更宽泛)',
|
|
99
|
+
},
|
|
72
100
|
},
|
|
73
101
|
stuckAt: {
|
|
74
102
|
type: 'string',
|
|
75
|
-
description:
|
|
103
|
+
description: {
|
|
104
|
+
en: 'Optional. If you are blocked or unsure, the specific decision or unknown that needs resolving first.',
|
|
105
|
+
zh: '可选。如果你被阻塞或不确定,需要首先解决的具体决策或未知点',
|
|
106
|
+
},
|
|
76
107
|
},
|
|
77
108
|
expectedScale: {
|
|
78
109
|
type: 'string',
|
|
79
|
-
description:
|
|
110
|
+
description: {
|
|
111
|
+
en: 'Optional. Rough scope estimate — number of files touched, lines of code, time horizon, etc.',
|
|
112
|
+
zh: '可选。粗略范围估计 — 涉及文件数、代码行数、时间预期等',
|
|
113
|
+
},
|
|
80
114
|
},
|
|
81
115
|
additionalContext: {
|
|
82
116
|
type: 'string',
|
|
83
|
-
description:
|
|
117
|
+
description: {
|
|
118
|
+
en: 'Optional. Any other facts that shape the plan (constraints, deadlines, related prior work).',
|
|
119
|
+
zh: '可选。影响计划的其他事实(约束、截止日期、相关先前工作)',
|
|
120
|
+
},
|
|
84
121
|
},
|
|
85
122
|
},
|
|
86
123
|
required: ['topic'],
|
|
@@ -25,7 +25,8 @@ const VALID_STATUS = new Set(['pending', 'in_progress', 'completed']);
|
|
|
25
25
|
|
|
26
26
|
export default defineTool({
|
|
27
27
|
name: 'TodoWrite',
|
|
28
|
-
description:
|
|
28
|
+
description: {
|
|
29
|
+
en: `Track multi-step task progress with a checklist that the user can see ticked off in real time.
|
|
29
30
|
|
|
30
31
|
WHEN TO USE:
|
|
31
32
|
- The task has 3+ meaningful steps, or
|
|
@@ -40,27 +41,55 @@ HOW TO USE:
|
|
|
40
41
|
|
|
41
42
|
WHEN NOT TO USE:
|
|
42
43
|
- Single trivial change, single command run, pure conversation/question.`,
|
|
44
|
+
zh: `用 checklist 跟踪多步骤任务进度,用户可以实时看到勾选。
|
|
45
|
+
|
|
46
|
+
何时使用:
|
|
47
|
+
- 任务有 3 步或以上有意义步骤,或
|
|
48
|
+
- 用户给了你一份待办列表(编号/逗号分隔),或
|
|
49
|
+
- 你即将开始一个非平凡的多文件改动。
|
|
50
|
+
|
|
51
|
+
如何使用:
|
|
52
|
+
- 首次调用:枚举所有 todo,状态为 "pending",将其中恰好一个设为 "in_progress"。
|
|
53
|
+
- 每次后续调用:重写完整列表——将刚完成的项标记为 "completed",将下一项标记为 "in_progress"。
|
|
54
|
+
- 任何时候最多只能有一个 "in_progress"。
|
|
55
|
+
- content 是祈使形式(如 "Run tests");activeForm 是执行时显示的进行时态(如 "Running tests")。
|
|
56
|
+
|
|
57
|
+
何时不使用:
|
|
58
|
+
- 单个琐碎改动、单个命令执行、纯对话/提问。`
|
|
59
|
+
},
|
|
43
60
|
parameters: {
|
|
44
61
|
type: 'object',
|
|
45
62
|
properties: {
|
|
46
63
|
todos: {
|
|
47
64
|
type: 'array',
|
|
48
|
-
description:
|
|
65
|
+
description: {
|
|
66
|
+
en: 'The full current todo list. Always send the entire list, not a diff.',
|
|
67
|
+
zh: '当前完整的待办清单。始终发送整个列表,而非增量。',
|
|
68
|
+
},
|
|
49
69
|
items: {
|
|
50
70
|
type: 'object',
|
|
51
71
|
properties: {
|
|
52
72
|
content: {
|
|
53
73
|
type: 'string',
|
|
54
|
-
description:
|
|
74
|
+
description: {
|
|
75
|
+
en: 'Imperative description of the step (e.g. "Run tests").',
|
|
76
|
+
zh: '步骤的命令式描述(如 "Run tests")。',
|
|
77
|
+
},
|
|
55
78
|
},
|
|
56
79
|
status: {
|
|
57
80
|
type: 'string',
|
|
58
81
|
enum: ['pending', 'in_progress', 'completed'],
|
|
59
|
-
description:
|
|
82
|
+
description: {
|
|
83
|
+
en: 'Current state. At most one item may be "in_progress".',
|
|
84
|
+
zh: '当前状态。最多只能有一项为 "in_progress"。',
|
|
85
|
+
},
|
|
60
86
|
},
|
|
61
87
|
activeForm: {
|
|
62
88
|
type: 'string',
|
|
63
|
-
description:
|
|
89
|
+
description: {
|
|
90
|
+
en: 'Present-continuous form shown while executing (e.g. "Running tests").',
|
|
91
|
+
zh: '执行中展示的进行时描述(如 "Running tests")。',
|
|
92
|
+
},
|
|
64
93
|
},
|
|
65
94
|
},
|
|
66
95
|
required: ['content', 'status', 'activeForm'],
|
package/yeaft/tools/types.js
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
/**
|
|
52
52
|
* @typedef {Object} ToolDef
|
|
53
53
|
* @property {string} name — unique tool name (e.g. 'Bash', 'FileRead')
|
|
54
|
-
* @property {string} description — LLM-facing description
|
|
54
|
+
* @property {string | { en: string, zh: string, default?: string }} description — LLM-facing localized description
|
|
55
55
|
* @property {object} parameters — JSON Schema for input
|
|
56
56
|
* @property {(input: object, ctx?: ToolContext) => Promise<string>} execute — execution function
|
|
57
57
|
* @property {(input?: object) => boolean} [isConcurrencySafe] — can run in parallel?
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
*
|
|
65
65
|
* @param {{
|
|
66
66
|
* name: string,
|
|
67
|
-
* description: string,
|
|
67
|
+
* description: string | { en: string, zh: string, default?: string },
|
|
68
68
|
* parameters: object,
|
|
69
69
|
* execute: (input: object, ctx?: ToolContext) => Promise<string>,
|
|
70
70
|
* isConcurrencySafe?: (input?: object) => boolean,
|
|
@@ -119,7 +119,8 @@ function formatBytes(n) {
|
|
|
119
119
|
|
|
120
120
|
export default defineTool({
|
|
121
121
|
name: 'ViewImage',
|
|
122
|
-
description:
|
|
122
|
+
description: {
|
|
123
|
+
en: `Load a local image file and attach it to the conversation so the LLM can see it.
|
|
123
124
|
|
|
124
125
|
Returns a base64 data URI (\`image\` field) plus metadata (format, dimensions,
|
|
125
126
|
size). The caller/bridge is responsible for turning the data URI into the
|
|
@@ -148,12 +149,37 @@ Path examples:
|
|
|
148
149
|
Supported formats: PNG, JPEG (.jpg/.jpeg/.jfif), GIF, WebP.
|
|
149
150
|
Max size: 20 MiB by default (configurable via ctx.maxImageBytes).
|
|
150
151
|
Path must live under the project directory or an explicit host allowlist.`,
|
|
152
|
+
zh: `加载本地图片文件并附加到对话中,使 LLM 可以查看。
|
|
153
|
+
|
|
154
|
+
返回 base64 data URI(image 字段)及元数据(格式、尺寸、大小)。调用方/桥接层负责将 data URI 转换为
|
|
155
|
+
provider 特定的图片内容块。
|
|
156
|
+
|
|
157
|
+
何时调用:
|
|
158
|
+
- 用户引用本地图片路径(截图、设计稿、日志/图表)并要求你读取、分析或描述它。
|
|
159
|
+
- 用户说"看看这个文件"/"检查 xxx 处的截图"/"docs/assets/arch.png 里有什么?"。
|
|
160
|
+
|
|
161
|
+
何时不调用:
|
|
162
|
+
- 图片已附加到当前消息中(宿主已上传——你无需此工具即可看到)。
|
|
163
|
+
- 图片是远程 URL(http/https)。ViewImage 只读本地文件;对 URL 使用抓取类工具。
|
|
164
|
+
- 你只需要文件的存续/修改时间/大小——用 Read 或文件系统工具;ViewImage 会将完整文件字节加载到内存。
|
|
165
|
+
|
|
166
|
+
路径示例:
|
|
167
|
+
- 相对路径(相对项目 cwd 解析):"./screenshots/bug.png"、"docs/assets/arch.png"
|
|
168
|
+
- 白名单目录内的绝对路径:"/home/user/Downloads/error.png"(仅当宿主将该目录加入 ctx.imageAllowlist 时有效)
|
|
169
|
+
|
|
170
|
+
支持格式:PNG、JPEG(.jpg/.jpeg/.jfif)、GIF、WebP。
|
|
171
|
+
最大文件:默认 20 MiB(可通过 ctx.maxImageBytes 配置)。
|
|
172
|
+
路径必须在项目目录下或已加入宿主白名单。`
|
|
173
|
+
},
|
|
151
174
|
parameters: {
|
|
152
175
|
type: 'object',
|
|
153
176
|
properties: {
|
|
154
177
|
file_path: {
|
|
155
178
|
type: 'string',
|
|
156
|
-
description:
|
|
179
|
+
description: {
|
|
180
|
+
en: 'Path to the image file. Relative paths are resolved against the project cwd.',
|
|
181
|
+
zh: '图片文件路径。相对路径相对于项目工作目录解析。',
|
|
182
|
+
},
|
|
157
183
|
},
|
|
158
184
|
},
|
|
159
185
|
required: ['file_path'],
|
|
@@ -173,7 +173,8 @@ function buildEnvelope(agent, { timedOut = false } = {}) {
|
|
|
173
173
|
|
|
174
174
|
export default defineTool({
|
|
175
175
|
name: 'WaitAgent',
|
|
176
|
-
description:
|
|
176
|
+
description: {
|
|
177
|
+
en: `Wait for a sub-agent's next state change (turn end, terminal, or wait-timeout) and retrieve a status envelope.
|
|
177
178
|
|
|
178
179
|
Returns JSON with explicit \`status\`, latest \`result\` text, \`liveness\`
|
|
179
180
|
counters (toolUseCount, tokenCount, msSinceLastEvent, recentTools), the
|
|
@@ -200,18 +201,44 @@ the sub-agent's reply yet; only you have. The orchestration loop is
|
|
|
200
201
|
SpawnAgent → (PromptAgent ↔ WaitAgent)+ → CloseAgent → final reply to user.
|
|
201
202
|
|
|
202
203
|
Compatibility tool. The default wait is a short 5000ms poll. Callers may request up to 300000ms (5 minutes), but this is no longer the primary sub-agent workflow; prefer SpawnAgent + ListAgents + completion notifications for async background work.`,
|
|
204
|
+
zh: `等待子 Agent 的下一次状态变更(turn 结束、终止或等待超时)并获取状态信封。
|
|
205
|
+
|
|
206
|
+
返回 JSON,含明确的 status、最新的 result 文本、liveness 计数器(toolUseCount、tokenCount、
|
|
207
|
+
msSinceLastEvent、recentTools)、可随时 Read 的持久化 outputFile 路径,以及状态相关的 next_steps
|
|
208
|
+
指令告诉你下一步该调用什么。
|
|
209
|
+
|
|
210
|
+
状态语义:
|
|
211
|
+
- completed / closed / failed / abandoned -> 终止。子 Agent 不再做任何事。将结果传达给用户
|
|
212
|
+
(或重试/报告失败)。
|
|
213
|
+
- idle -> 子 Agent 完成了一个 turn 并停在空队列。你可以 PromptAgent 继续或 CloseAgent 结束。
|
|
214
|
+
- timedOut=true(status='running' 且 runningInBackground=true)-> 等待时间耗尽但子 Agent
|
|
215
|
+
仍在运行。不需要再 PromptAgent。要么用更大 timeout 再次 WaitAgent,要么 CloseAgent 中断,
|
|
216
|
+
要么告知用户它仍在工作。
|
|
217
|
+
|
|
218
|
+
关键——如果信封显示 stale/stalled,子 Agent 可能卡死或空转。不要反复调用 WaitAgent——向用户
|
|
219
|
+
报告情况,决定是 CloseAgent(带 close_reason)还是重试。
|
|
220
|
+
|
|
221
|
+
此工具保留用于向后兼容。现代异步流程请用 ListAgents 做非阻塞状态检查,依赖 turn 开始时的
|
|
222
|
+
notification 获取完成事件。`
|
|
223
|
+
},
|
|
203
224
|
parameters: {
|
|
204
225
|
type: 'object',
|
|
205
226
|
properties: {
|
|
206
227
|
agent_id: {
|
|
207
228
|
type: 'string',
|
|
208
|
-
description:
|
|
229
|
+
description: {
|
|
230
|
+
en: 'The sub-agent ID to wait for',
|
|
231
|
+
zh: '要等待的子 Agent ID',
|
|
232
|
+
},
|
|
209
233
|
},
|
|
210
234
|
timeout_ms: {
|
|
211
235
|
type: 'number',
|
|
212
236
|
minimum: 0,
|
|
213
237
|
maximum: 300000,
|
|
214
|
-
description:
|
|
238
|
+
description: {
|
|
239
|
+
en: 'Maximum time to wait in milliseconds (default: 5000 short poll, max: 300000 / 5 minutes)',
|
|
240
|
+
zh: '最长等待时间,单位毫秒(默认 5000 短轮询,最大 300000 / 5 分钟)',
|
|
241
|
+
},
|
|
215
242
|
},
|
|
216
243
|
},
|
|
217
244
|
required: ['agent_id'],
|
package/yeaft/tools/web-fetch.js
CHANGED
|
@@ -34,7 +34,8 @@ function htmlToText(html) {
|
|
|
34
34
|
|
|
35
35
|
export default defineTool({
|
|
36
36
|
name: 'WebFetch',
|
|
37
|
-
description:
|
|
37
|
+
description: {
|
|
38
|
+
en: `Fetch and read the content of a web page.
|
|
38
39
|
|
|
39
40
|
Retrieves the URL content, strips HTML tags, and returns readable text.
|
|
40
41
|
Use this to read documentation, articles, or any web page.
|
|
@@ -44,20 +45,39 @@ Guidelines:
|
|
|
44
45
|
- Large pages will be truncated — use the offset parameter for pagination
|
|
45
46
|
- For APIs, the raw response body is returned as-is
|
|
46
47
|
- Respects the abort signal for cancellation`,
|
|
48
|
+
zh: `获取并读取网页内容。
|
|
49
|
+
|
|
50
|
+
获取 URL 内容,去除 HTML 标签,返回可读文本。用于阅读文档、文章或任何网页。
|
|
51
|
+
|
|
52
|
+
使用指南:
|
|
53
|
+
- 提供完整 URL 含协议(https://)
|
|
54
|
+
- 大页面会截断——用 offset 参数做分页
|
|
55
|
+
- 对 API 请求,原始响应体原样返回
|
|
56
|
+
- 尊重取消信号`
|
|
57
|
+
},
|
|
47
58
|
parameters: {
|
|
48
59
|
type: 'object',
|
|
49
60
|
properties: {
|
|
50
61
|
url: {
|
|
51
62
|
type: 'string',
|
|
52
|
-
description:
|
|
63
|
+
description: {
|
|
64
|
+
en: 'The URL to fetch',
|
|
65
|
+
zh: '要获取的 URL',
|
|
66
|
+
},
|
|
53
67
|
},
|
|
54
68
|
max_length: {
|
|
55
69
|
type: 'number',
|
|
56
|
-
description:
|
|
70
|
+
description: {
|
|
71
|
+
en: 'Maximum content length in characters (default: 50000)',
|
|
72
|
+
zh: '最大内容长度,单位字符(默认 50000)',
|
|
73
|
+
},
|
|
57
74
|
},
|
|
58
75
|
raw: {
|
|
59
76
|
type: 'boolean',
|
|
60
|
-
description:
|
|
77
|
+
description: {
|
|
78
|
+
en: 'If true, return raw response without HTML stripping (for APIs)',
|
|
79
|
+
zh: '如果为 true,返回原始响应不去除 HTML(用于 API)',
|
|
80
|
+
},
|
|
61
81
|
},
|
|
62
82
|
},
|
|
63
83
|
required: ['url'],
|
|
@@ -25,7 +25,8 @@ import { defineTool } from './types.js';
|
|
|
25
25
|
|
|
26
26
|
export default defineTool({
|
|
27
27
|
name: 'WebSearch',
|
|
28
|
-
description:
|
|
28
|
+
description: {
|
|
29
|
+
en: `Search the web for current information.
|
|
29
30
|
|
|
30
31
|
Use this when you need up-to-date information that may not be in your training data.
|
|
31
32
|
Returns search results with titles, URLs, and snippets.
|
|
@@ -34,16 +35,31 @@ Guidelines:
|
|
|
34
35
|
- Use specific, targeted search queries
|
|
35
36
|
- Include the current year for time-sensitive queries
|
|
36
37
|
- Combine with WebFetch to read full page content from results`,
|
|
38
|
+
zh: `搜索网页获取最新信息。
|
|
39
|
+
|
|
40
|
+
当你需要训练数据中可能没有的最新信息时使用。返回搜索结果,含标题、URL 和摘要。
|
|
41
|
+
|
|
42
|
+
使用指南:
|
|
43
|
+
- 使用具体、有针对性的搜索关键词
|
|
44
|
+
- 时间敏感的查询要包含当前年份
|
|
45
|
+
- 配合 WebFetch 读取搜索结果中的完整页面内容`
|
|
46
|
+
},
|
|
37
47
|
parameters: {
|
|
38
48
|
type: 'object',
|
|
39
49
|
properties: {
|
|
40
50
|
query: {
|
|
41
51
|
type: 'string',
|
|
42
|
-
description:
|
|
52
|
+
description: {
|
|
53
|
+
en: 'The search query',
|
|
54
|
+
zh: '搜索查询词',
|
|
55
|
+
},
|
|
43
56
|
},
|
|
44
57
|
limit: {
|
|
45
58
|
type: 'number',
|
|
46
|
-
description:
|
|
59
|
+
description: {
|
|
60
|
+
en: 'Maximum number of results (default: 5)',
|
|
61
|
+
zh: '最多返回结果数(默认 5)',
|
|
62
|
+
},
|
|
47
63
|
},
|
|
48
64
|
},
|
|
49
65
|
required: ['query'],
|