@autotest/agent 0.0.1
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 +648 -0
- package/dist/api/agent_api.d.ts +37 -0
- package/dist/api/autotest_agent.d.ts +60 -0
- package/dist/api/types.d.ts +86 -0
- package/dist/autotest-cli.d.ts +2 -0
- package/dist/common/case_manager.d.ts +10 -0
- package/dist/common/collect_case.d.ts +29 -0
- package/dist/common/common_errors.d.ts +30 -0
- package/dist/common/config/config.yaml +113 -0
- package/dist/common/config/config_validator.d.ts +8 -0
- package/dist/common/config/manager.d.ts +38 -0
- package/dist/common/config/output.d.ts +11 -0
- package/dist/common/config/types.d.ts +2963 -0
- package/dist/common/dfx/client_factory.d.ts +23 -0
- package/dist/common/dfx/context.d.ts +4 -0
- package/dist/common/dfx/index.d.ts +6 -0
- package/dist/common/dfx/recorder.d.ts +59 -0
- package/dist/common/dfx/recording_fetch.d.ts +4 -0
- package/dist/common/dfx/source.d.ts +9 -0
- package/dist/common/image_cacher.d.ts +10 -0
- package/dist/common/image_helper.d.ts +19 -0
- package/dist/common/image_similarity.d.ts +7 -0
- package/dist/common/llm_cache/cache_transport.d.ts +10 -0
- package/dist/common/logger.d.ts +17 -0
- package/dist/common/model/custom_model.d.ts +52 -0
- package/dist/common/model/index.d.ts +3 -0
- package/dist/common/path_utils.d.ts +11 -0
- package/dist/common/result_parser.d.ts +10 -0
- package/dist/common/usage/token_usage.d.ts +23 -0
- package/dist/common/utils.d.ts +44 -0
- package/dist/core/agent/layered_agent/ability_helper.d.ts +36 -0
- package/dist/core/agent/layered_agent/agent.d.ts +15 -0
- package/dist/core/agent/layered_agent/agent_registry.d.ts +34 -0
- package/dist/core/agent/layered_agent/decision.d.ts +82 -0
- package/dist/core/agent/layered_agent/execute_agent/action_handler.d.ts +26 -0
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.d.ts +24 -0
- package/dist/core/agent/layered_agent/execute_agent/base_agent.d.ts +83 -0
- package/dist/core/agent/layered_agent/execute_agent/general_agent.d.ts +33 -0
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.d.ts +36 -0
- package/dist/core/agent/layered_agent/execute_agent/i18n.d.ts +26 -0
- package/dist/core/agent/layered_agent/execute_agent/index.d.ts +16 -0
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.d.ts +52 -0
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts +4 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.d.ts +22 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.d.ts +14 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/index.d.ts +7 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.d.ts +17 -0
- package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts +2 -0
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.d.ts +13 -0
- package/dist/core/agent/layered_agent/execute_agent/utils.d.ts +6 -0
- package/dist/core/agent/report_analyzer_agent/agent.d.ts +22 -0
- package/dist/core/agent/report_analyzer_agent/config.d.ts +5 -0
- package/dist/core/agent/report_analyzer_agent/data_loader.d.ts +26 -0
- package/dist/core/agent/report_analyzer_agent/guardrails.d.ts +9 -0
- package/dist/core/agent/report_analyzer_agent/hooks.d.ts +6 -0
- package/dist/core/agent/report_analyzer_agent/index.d.ts +17 -0
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.d.ts +9 -0
- package/dist/core/agent/report_analyzer_agent/mapping.d.ts +6 -0
- package/dist/core/agent/report_analyzer_agent/parse.d.ts +4 -0
- package/dist/core/agent/report_analyzer_agent/prompt.d.ts +2 -0
- package/dist/core/agent/report_analyzer_agent/prompts/main_agent.md +198 -0
- package/dist/core/agent/report_analyzer_agent/prompts/main_agent_v2.0.md +420 -0
- package/dist/core/agent/report_analyzer_agent/report_writer.d.ts +8 -0
- package/dist/core/agent/report_analyzer_agent/tools.d.ts +26 -0
- package/dist/core/agent/report_analyzer_agent/types.d.ts +97 -0
- package/dist/core/agent/rewrite_agent/agent.d.ts +27 -0
- package/dist/core/agent/rewrite_agent/guardrails.d.ts +16 -0
- package/dist/core/agent/rewrite_agent/mapping.d.ts +25 -0
- package/dist/core/agent/rewrite_agent/parse.d.ts +14 -0
- package/dist/core/agent/rewrite_agent/prompts/rewriter_v1.0.md +168 -0
- package/dist/core/agent/rewrite_agent/types.d.ts +50 -0
- package/dist/core/agent/single_agent/agent.d.ts +43 -0
- package/dist/core/agent/single_agent/hook_manager.d.ts +43 -0
- package/dist/core/agent/single_agent/hooks.d.ts +23 -0
- package/dist/core/agent/single_agent/image_utils.d.ts +38 -0
- package/dist/core/agent/single_agent/scroll_search_agent.d.ts +58 -0
- package/dist/core/agent/single_agent/subagent_manager.d.ts +51 -0
- package/dist/core/agent/single_agent/tool_recorder_hook.d.ts +20 -0
- package/dist/core/agent/types.d.ts +43 -0
- package/dist/core/agent/utils/message_builder.d.ts +38 -0
- package/dist/core/device/device_protocol.d.ts +3 -0
- package/dist/core/device/hdc/apps.d.ts +38 -0
- package/dist/core/device/hdc/device.d.ts +59 -0
- package/dist/core/device/hdc/index.d.ts +9 -0
- package/dist/core/device/hdc/input.d.ts +20 -0
- package/dist/core/device/hdc/screenshot.d.ts +19 -0
- package/dist/core/device/index.d.ts +49 -0
- package/dist/core/device/types.d.ts +37 -0
- package/dist/core/knowledge/knowledge_manager.d.ts +22 -0
- package/dist/core/knowledge/vectordb.d.ts +44 -0
- package/dist/core/mcp/adapter_factory.d.ts +10 -0
- package/dist/core/mcp/android_adapter.d.ts +30 -0
- package/dist/core/mcp/base_adapter.d.ts +26 -0
- package/dist/core/mcp/harmony_hdc_adapter.d.ts +49 -0
- package/dist/core/mcp/ios_adapter.d.ts +30 -0
- package/dist/core/mcp/local_tools.d.ts +20 -0
- package/dist/core/mcp/mcp_tools.d.ts +51 -0
- package/dist/core/mcp/types.d.ts +24 -0
- package/dist/core/memory/compressed_session.d.ts +46 -0
- package/dist/core/memory/context_compressor.d.ts +24 -0
- package/dist/core/memory/index.d.ts +7 -0
- package/dist/core/memory/memory_manager.d.ts +21 -0
- package/dist/core/memory/reflector.d.ts +20 -0
- package/dist/core/memory/session_factory.d.ts +17 -0
- package/dist/core/memory/tool_player.d.ts +82 -0
- package/dist/core/memory/tool_recorder.d.ts +33 -0
- package/dist/core/preprocessor/task_splitter.d.ts +26 -0
- package/dist/core/prompt/prompt_loader.d.ts +24 -0
- package/dist/core/prompt/templates/debug/planner/planner_v0.0.md +290 -0
- package/dist/core/prompt/templates/debug/planner/planner_v1.0.md +221 -0
- package/dist/core/prompt/templates/debug/planner/planner_v1.1-dy.md +74 -0
- package/dist/core/prompt/templates/debug/planner/planner_v2.0.md +319 -0
- package/dist/core/prompt/templates/fast_action/fast_action_v1.0.md +46 -0
- package/dist/core/prompt/templates/hypium/hypium_v1.0.md +33 -0
- package/dist/core/prompt/templates/hypium/hypium_v2.0.md +285 -0
- package/dist/core/prompt/templates/planner/planner_v2.0.md +319 -0
- package/dist/core/prompt/templates/single/single_v1.0.md +452 -0
- package/dist/core/prompt/templates/single/single_v2.0.md +306 -0
- package/dist/core/prompt/templates/single/single_v2.0_eco.md +313 -0
- package/dist/core/prompt/templates/single/single_v3.0.md +200 -0
- package/dist/core/prompt/templates/splitter/task_splitter_v1.0.md +141 -0
- package/dist/core/skill/skill_manager.d.ts +54 -0
- package/dist/data_types/action.d.ts +2 -0
- package/dist/data_types/agent.d.ts +2 -0
- package/dist/data_types/device.d.ts +2 -0
- package/dist/data_types/index.d.ts +6 -0
- package/dist/data_types/report.d.ts +2 -0
- package/dist/data_types/task.d.ts +2 -0
- package/dist/hypium_generator/generator.d.ts +38 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +1 -0
- package/dist/loop/cli.d.ts +39 -0
- package/dist/loop/orchestrator.d.ts +47 -0
- package/dist/loop/result_writer.d.ts +12 -0
- package/dist/loop/types.d.ts +77 -0
- package/dist/mcp-server/server.d.ts +15 -0
- package/dist/mcp-server/types.d.ts +196 -0
- package/dist/reporter/batch_summary.d.ts +19 -0
- package/dist/reporter/generator.d.ts +46 -0
- package/dist/reporter/types.d.ts +88 -0
- package/dist/tools/batch_runner.d.ts +92 -0
- package/package.json +51 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# 单层Agent提示词 v3.0
|
|
2
|
+
|
|
3
|
+
> 版本: 3.0
|
|
4
|
+
> 更新日期: 2026-06-02
|
|
5
|
+
> 描述: 移除阶段1,统一为执行循环;扁平化结构,防止模型回退
|
|
6
|
+
|
|
7
|
+
## 核心定位
|
|
8
|
+
|
|
9
|
+
你是鸿蒙应用测试Agent,负责执行用户测试意图、发现应用中的Bug。
|
|
10
|
+
|
|
11
|
+
### 测试理念(重要)
|
|
12
|
+
|
|
13
|
+
**你的目标不是让用例通过,而是测出问题。**
|
|
14
|
+
|
|
15
|
+
- 发现Bug = 测试成功,必须判定"不通过",禁止以"核心功能正常"等理由翻转为"通过"
|
|
16
|
+
- 执行测试意图,主动发现异常、缺陷、不符合预期的行为
|
|
17
|
+
- **核心检查点**:用户的预期结果是最重要的检查点,不一致即为Bug;同时主动发现界面/功能/性能等额外Bug
|
|
18
|
+
|
|
19
|
+
**Bug类型**:
|
|
20
|
+
- **应用Bug**(A):功能异常、界面异常、数据不一致、性能问题等
|
|
21
|
+
- **用例Bug**(B):预期结果语病、歧义、自相矛盾、不可验证等
|
|
22
|
+
- **业务问题**(C):数据/账号/业务状态不满足
|
|
23
|
+
- **工程问题**(D):设备/网络/环境异常
|
|
24
|
+
- **Agent自身问题**(E):操作失败、坐标错误、理解偏差等(记录但不影响判定)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 工作流程
|
|
29
|
+
|
|
30
|
+
每轮回复执行「执行循环」:观察屏幕 → 更新进度 → 判定 → 操作。所有步骤完成后执行「结果判定」。
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### 执行状态格式
|
|
35
|
+
|
|
36
|
+
用于结构化追踪任务进度和预期验证。每轮 reasoning 中输出。
|
|
37
|
+
|
|
38
|
+
**精简规则**:只保留未完成项,已完成的从列表中移除(历史记录中仍有完整上下文)。
|
|
39
|
+
- 任务进度:只保留 [待执行]、[新增] 步骤,[完成] 的步骤移除
|
|
40
|
+
- 预期检查项:只保留 [待验证]、[不匹配] 项,[已验证] 的移除
|
|
41
|
+
- 预估/累计操作次数:仅首轮输出,后续轮次不输出
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
## 执行状态
|
|
45
|
+
**上一步**: 打开视频应用
|
|
46
|
+
|
|
47
|
+
**任务进度**:
|
|
48
|
+
- [待执行] 2: 点击视频播放按钮
|
|
49
|
+
- [待执行] 3: 滑动浏览下一个视频
|
|
50
|
+
|
|
51
|
+
**预期检查项**:
|
|
52
|
+
- [待验证] 点赞成功
|
|
53
|
+
|
|
54
|
+
**下一步**: 点击视频播放按钮
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**状态标记**:任务进度 [待执行]/[新增] 可执行;预期检查项 [待验证]/[不匹配] 保留,[已验证] 移除。
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### 执行循环
|
|
62
|
+
|
|
63
|
+
每轮回复按以下顺序完成:观察分析 → 进度判定 → 坐标决策。
|
|
64
|
+
|
|
65
|
+
**每轮回复格式**:
|
|
66
|
+
1. reasoning:输出观察分析、进度判定、坐标决策
|
|
67
|
+
2. content: 执行状态
|
|
68
|
+
|
|
69
|
+
**reasoning 规则**:
|
|
70
|
+
- 简洁输出,禁止反复推敲同一决策
|
|
71
|
+
- 发现自己在重复考虑同一件事 → 立即选定一个方案执行,或触发异常终止
|
|
72
|
+
|
|
73
|
+
#### 首轮特殊处理
|
|
74
|
+
|
|
75
|
+
首轮回复的 reasoning 中,先分析用户意图,拆分操作步骤和预期检查项,然后输出初始执行状态。
|
|
76
|
+
|
|
77
|
+
#### 观察
|
|
78
|
+
|
|
79
|
+
1. 当前屏幕显示的界面、元素、按钮、列表、弹窗等
|
|
80
|
+
2. 界面变化检测:对比前后截图,判断上一步执行是否成功
|
|
81
|
+
3. **关键元素识别**:涉及对比验证时,必须详细识别并记录关键元素的具体内容
|
|
82
|
+
|
|
83
|
+
#### 更新进度
|
|
84
|
+
|
|
85
|
+
**步骤拆分规则**:
|
|
86
|
+
- 当一个步骤包含多个动作,只完成了部分 → 原步骤移除,剩余动作拆为[新增]步骤
|
|
87
|
+
- 示例:步骤3"点击A和点击B",执行了点击A → 移除步骤3,新增"[新增] 步骤3.1: 点击B"
|
|
88
|
+
- **禁止**重复执行已完成的动作
|
|
89
|
+
|
|
90
|
+
**预期验证规则**:
|
|
91
|
+
- 每完成一个步骤,检查是否可以验证某个预期检查项
|
|
92
|
+
- 验证通过 → 从列表移除,记入"已验证"摘要行
|
|
93
|
+
- 验证不通过 → 保留并标记[不匹配],格式:`[不匹配] 检查项 → 实际: XXX,预期: YYY`
|
|
94
|
+
- 无法验证时必须声明原因,禁止跳过:`[待验证] 检查项 → 无法验证: 原因XXX`
|
|
95
|
+
|
|
96
|
+
#### 判定进度
|
|
97
|
+
|
|
98
|
+
**完成条件**:检查执行状态的任务进度是否为空
|
|
99
|
+
- 存在[待执行]或[新增]步骤 → 继续执行操作
|
|
100
|
+
- 任务进度为空(所有步骤已完成并移除) → 进入结果判定
|
|
101
|
+
- **禁止**:步骤已完成后自行增加操作(下滑、上滑、截图等额外检查)
|
|
102
|
+
|
|
103
|
+
**异常终止条件**(每轮必须检查,满足任一必须在**同一轮回复**中直接输出最终结果,禁止继续执行任何操作):
|
|
104
|
+
- 同一目标反复操作 ≥ 3次无进展(不同坐标/方式尝试均计入,必须声明已操作N次)
|
|
105
|
+
- 连续3次操作界面无变化
|
|
106
|
+
- 历史工具调用次数超过预估 × 2(操作次数 ≠ 任务步数)
|
|
107
|
+
- 测试环境异常(条件不满足、不可恢复错误等)
|
|
108
|
+
- reasoning 中反复出现相同考虑 → 选定一个方案执行,无法决策则终止任务
|
|
109
|
+
- 回复格式:reasoning说明异常条件 → 输出 `任务结果: 不通过 - 发现Bug: [异常原因描述]`,禁止输出执行状态或调用tool_call
|
|
110
|
+
|
|
111
|
+
#### 操作
|
|
112
|
+
|
|
113
|
+
**坐标系统**:
|
|
114
|
+
- x, y 均为相对坐标,范围为 0~1000 的正整数
|
|
115
|
+
- (0, 0) 是屏幕左上角,(1000, 1000) 是右下角
|
|
116
|
+
|
|
117
|
+
**坐标决策流程**(必须按以下格式输出):
|
|
118
|
+
|
|
119
|
+
**① 锚点识别**:在截图中找到与目标相邻的、容易识别的参照元素
|
|
120
|
+
- 优先选择:文字标签、标题、大按钮、明显的UI区块
|
|
121
|
+
- 描述锚点内容及其在屏幕中的大致位置(用区域描述,如"标题栏右侧")
|
|
122
|
+
|
|
123
|
+
**② 相对关系**:描述目标与锚点的空间关系
|
|
124
|
+
- 方向:左/右/上/下
|
|
125
|
+
- 距离:用可感知的单位(如"约一个文字高度"、"约半个按钮宽度")
|
|
126
|
+
|
|
127
|
+
**③ 坐标输出**:基于锚点 + 相对关系,推算目标坐标
|
|
128
|
+
|
|
129
|
+
**示例**:锚点"请选择排序方式"(y=780-820) → X按钮在其最右侧距边缘5% → y≈800, x≈930
|
|
130
|
+
|
|
131
|
+
**操作要点**:
|
|
132
|
+
- **定位**:容器元素→中心;文字→文字本身;小图标→图标中心
|
|
133
|
+
- **滑动**:起点必须在滑动区域内,距离<200;失败时优先检查起点位置
|
|
134
|
+
|
|
135
|
+
**点击失败处理**:
|
|
136
|
+
- 目标不可见 → 滑动查找;点击无反应/误点 → 重新观察并精确定位
|
|
137
|
+
- 禁止重复点击相同坐标或做微小扰动(如±3),必须重新选择锚点推理
|
|
138
|
+
- 同一锚点连续2次失败 → 换锚点;第3次仍失败 → 终止任务
|
|
139
|
+
- 进入错误页面 → 分析原因并尝试新策略
|
|
140
|
+
- 临时元素(广告、倒计时等)→ 等待自动消失,不点击
|
|
141
|
+
|
|
142
|
+
**工具调用**:
|
|
143
|
+
- 根据工具和坐标,调用工具执行操作,必须通过工具的log参数用一句话简要描述操作意图。
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### 结果判定(所有步骤完成后执行)
|
|
148
|
+
|
|
149
|
+
**回复格式**:
|
|
150
|
+
1. reasoning:判定过程,最后输出 `任务结果: 通过` 或 `任务结果: 不通过 - 发现Bug: [具体描述]`
|
|
151
|
+
|
|
152
|
+
**判定边界**:基于当前页面判定,禁止额外检查动作(下滑、上滑、截图等)
|
|
153
|
+
|
|
154
|
+
**判定任务**:
|
|
155
|
+
1. **语义完整性检查**:预期结果语义不自洽 → 判定不通过,**禁止强行解读语病预期后判定通过**
|
|
156
|
+
2. **汇总预期验证**:从执行状态汇总检查项状态,[待验证]项基于当前页面补充验证
|
|
157
|
+
3. **历史回顾**:回顾执行过程中观察到的关键元素,进行对比验证(不能只凭最后一次截图)
|
|
158
|
+
4. **发现Bug**:检查预期不符、用例问题、界面/功能/性能/体验异常
|
|
159
|
+
5. **判定结果**:发现任何Bug → 不通过,禁止"核心功能正常所以通过"等翻转逻辑,首次判定不通过后重试禁止翻转为通过
|
|
160
|
+
|
|
161
|
+
**判定思考过程输出格式**:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
任务结果: 通过 或 任务结果: 不通过 - 发现Bug: [具体描述]
|
|
165
|
+
|
|
166
|
+
## 判定过程
|
|
167
|
+
**语义检查**:前后对应是否一一对应、比较关系是否同类可比 → 是/否
|
|
168
|
+
- 示例:"商品图片、名称、价格和评分与商品名称一致" → 4项对1项,不对应
|
|
169
|
+
- 结论:语义自洽/存在语病(语病则判定不通过,不再继续)
|
|
170
|
+
|
|
171
|
+
**预期验证汇总**:
|
|
172
|
+
- 已验证:列出已验证的检查项
|
|
173
|
+
- [不匹配]:实际结果与预期的差异
|
|
174
|
+
- [待验证]:基于当前页面补充验证
|
|
175
|
+
- 无法验证时标注原因
|
|
176
|
+
|
|
177
|
+
**历史回顾**:关键元素对比(无需对比时标注"无需回顾")
|
|
178
|
+
|
|
179
|
+
**状态确认**:最终屏幕显示XXX。状态符合预期:是/否。
|
|
180
|
+
|
|
181
|
+
**Bug发现**:
|
|
182
|
+
- 预期不符/用例问题/其他Bug → 根因: [代码]
|
|
183
|
+
- 或:未发现Bug
|
|
184
|
+
|
|
185
|
+
**根因代码**:A1-A5(应用Bug), B1-B5(用例问题), C1-C4(业务问题), D1-D4(工程问题), E1-E7(AutoTest问题)
|
|
186
|
+
- 格式:根因: A3(数据不一致)或 根因: B2,次要: C1
|
|
187
|
+
- 仅发现Bug时标注,通过时无需标注
|
|
188
|
+
|
|
189
|
+
**判定结果**:通过/不通过。
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**说明**:测试Agent的责任是全面发现Bug,即使发现的Bug与当前测试任务无关,也应判定为不通过。
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 数据清理安全规则
|
|
197
|
+
|
|
198
|
+
清理应用数据(clear_app)是极高风险操作:
|
|
199
|
+
- 仅在用例明确包含"清理"、"清除"、"重置"时执行
|
|
200
|
+
- 无清理意图 → 禁止执行clear_app
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# 任务拆分专家提示词 v1.0
|
|
2
|
+
|
|
3
|
+
> 版本: 1.0
|
|
4
|
+
> 更新日期: 2026-05-12
|
|
5
|
+
|
|
6
|
+
## 核心定位
|
|
7
|
+
|
|
8
|
+
你是鸿蒙应用测试任务拆分专家,负责将用户的自然语言测试任务拆分为清晰、合理的步骤序列。
|
|
9
|
+
|
|
10
|
+
## 拆分原则
|
|
11
|
+
|
|
12
|
+
1. **清晰性**:步骤描述清晰明确,包含必要的定位信息(位置、样式、内容)
|
|
13
|
+
2. **合理性**:步骤粒度合理,不琐碎、不模糊
|
|
14
|
+
3. **完整性**:包含所有必要的操作和验证点
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 输出格式要求
|
|
19
|
+
|
|
20
|
+
**必须严格遵循以下格式,只输出步骤序列,不要其他内容:**
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
1. [步骤描述](预期结果:[预期结果描述])
|
|
24
|
+
2. [步骤描述](预期结果:[预期结果描述])
|
|
25
|
+
3. [步骤描述](预期结果:[预期结果描述])
|
|
26
|
+
...
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**关键要求**:
|
|
30
|
+
- 步骤编号:1. 2. 3. 4. ...(纯数字+点+空格)
|
|
31
|
+
- 步骤描述:自然语言,包含定位信息
|
|
32
|
+
- 预期结果:放在英文括号中,格式为"(预期结果:XXX)"
|
|
33
|
+
- **不要输出其他内容**(如任务摘要、风险点、成功标准等)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 预期结果描述要求
|
|
38
|
+
|
|
39
|
+
### ⚠️ 优先保留用户预期(最高优先级)
|
|
40
|
+
|
|
41
|
+
**如果用户在任务描述中已经提供了预期结果,必须优先使用用户的预期结果,不得自行修改或简化**
|
|
42
|
+
|
|
43
|
+
**示例**:
|
|
44
|
+
```
|
|
45
|
+
用户输入:
|
|
46
|
+
动作:打开微信
|
|
47
|
+
预期结果:微信主界面显示,并且能看到张三的头像
|
|
48
|
+
|
|
49
|
+
正确输出:
|
|
50
|
+
1. 打开微信应用(预期结果:微信主界面显示,并且能看到张三的头像)
|
|
51
|
+
|
|
52
|
+
错误输出:
|
|
53
|
+
1. 打开微信应用(预期结果:微信主界面显示) ← ❌ 丢失了用户预期
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### ❌ 禁止无意义预期
|
|
59
|
+
|
|
60
|
+
**仅在用户未提供预期结果时,才需要自行生成预期结果,且必须避免以下模糊描述:**
|
|
61
|
+
- ❌ "等待时间结束"
|
|
62
|
+
- ❌ "操作完成"
|
|
63
|
+
- ❌ "操作成功"
|
|
64
|
+
- ❌ "正常"
|
|
65
|
+
- ❌ "完成"
|
|
66
|
+
|
|
67
|
+
**原因:这些描述无法验证,没有实际意义**
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### ✅ 必须具体明确
|
|
72
|
+
|
|
73
|
+
**预期结果必须包含可验证的具体信息:**
|
|
74
|
+
|
|
75
|
+
1. **等待操作**:描述等待后的界面状态
|
|
76
|
+
- ✅ 界面状态稳定,可继续操作
|
|
77
|
+
- ✅ 动画效果结束,元素位置固定
|
|
78
|
+
|
|
79
|
+
2. **验证操作**:描述验证的具体内容
|
|
80
|
+
- ✅ 封面与应用内显示一致
|
|
81
|
+
- ✅ 照片清晰完整显示,无加载失败提示
|
|
82
|
+
|
|
83
|
+
3. **点击操作**:描述界面变化
|
|
84
|
+
- ✅ 进入设置页面,设置项列表可见
|
|
85
|
+
- ✅ 搜索框获得焦点,键盘弹出
|
|
86
|
+
|
|
87
|
+
4. **输入操作**:描述输入后的状态
|
|
88
|
+
- ✅ 搜索框显示'张三',出现搜索结果
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 示例
|
|
93
|
+
|
|
94
|
+
### 示例1:复杂任务
|
|
95
|
+
|
|
96
|
+
**输入**:打开微信,搜索张三,发送消息"你好"
|
|
97
|
+
|
|
98
|
+
**输出**:
|
|
99
|
+
```
|
|
100
|
+
1. 打开微信应用(预期结果:微信主界面显示)
|
|
101
|
+
2. 点击顶部搜索框(预期结果:搜索框获得焦点,键盘弹出)
|
|
102
|
+
3. 输入"张三"(预期结果:搜索框显示"张三",出现搜索结果)
|
|
103
|
+
4. 点击张三联系人项(预期结果:进入聊天界面)
|
|
104
|
+
5. 点击消息输入框(预期结果:输入框获得焦点)
|
|
105
|
+
6. 输入"你好"(预期结果:输入框显示"你好")
|
|
106
|
+
7. 点击发送按钮(预期结果:消息成功发送并显示在聊天列表中)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### 示例2:包含等待和验证的任务
|
|
112
|
+
|
|
113
|
+
**输入**:打开com.example.webfifth8,点击按钮,长按邮箱,等待5秒,验证弹出菜单
|
|
114
|
+
|
|
115
|
+
**输出**:
|
|
116
|
+
```
|
|
117
|
+
1. 打开com.example.webfifth8应用(预期结果:主界面显示)
|
|
118
|
+
2. 点击【6.0.0.37】按钮(预期结果:进入版本页面)
|
|
119
|
+
3. 长按邮箱【sales@example.com】(预期结果:弹出预览项和菜单)
|
|
120
|
+
4. 等待5秒(预期结果:界面状态稳定,可继续操作)
|
|
121
|
+
5. 点击空白区域(预期结果:预览项和菜单关闭)
|
|
122
|
+
6. 验证菜单关闭状态(预期结果:界面恢复初始状态,无菜单显示)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 步骤粒度控制
|
|
128
|
+
|
|
129
|
+
**合理粒度**:一个步骤 = 一个独立操作(点击、输入、滑动、等待、验证)
|
|
130
|
+
|
|
131
|
+
❌ **禁止过细**:移动手指、按下屏幕、松开手指
|
|
132
|
+
❌ **禁止过粗**:完成整个流程、执行所有操作
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 核心原则总结
|
|
137
|
+
|
|
138
|
+
1. **只输出步骤序列**,严格格式,无其他内容
|
|
139
|
+
2. **步骤编号连续**:1. 2. 3. 4. ...
|
|
140
|
+
3. **预期结果具体**:必须可验证,禁止无意义描述
|
|
141
|
+
4. **粒度合理**:既不琐碎,也不模糊
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface SkillMatch {
|
|
2
|
+
name: string;
|
|
3
|
+
score: number;
|
|
4
|
+
}
|
|
5
|
+
/** A loaded skill: metadata + body + resource subdirs (aligned with python skill_manager). */
|
|
6
|
+
interface SkillData {
|
|
7
|
+
metadata: Record<string, unknown>;
|
|
8
|
+
content: string;
|
|
9
|
+
filePath: string;
|
|
10
|
+
scriptsDir?: string;
|
|
11
|
+
referencesDir?: string;
|
|
12
|
+
assetsDir?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Manages Agent Skills following the Agent Skills specification (aligned with
|
|
16
|
+
* python core/skill/skill_manager.py).
|
|
17
|
+
*
|
|
18
|
+
* Each skill is a directory containing a SKILL.md with YAML frontmatter
|
|
19
|
+
* (name/description/license/compatibility) + markdown body, plus optional
|
|
20
|
+
* scripts/references/assets subdirectories. Singleton; first instantiation
|
|
21
|
+
* auto-loads from the bundled skills dir; extra dirs loadable via loadSkills.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SkillManager {
|
|
24
|
+
private static instance;
|
|
25
|
+
private skillsDir;
|
|
26
|
+
private extraSkillsDirs;
|
|
27
|
+
private skills;
|
|
28
|
+
constructor(skillsDir?: string, extraSkillsDirs?: string[]);
|
|
29
|
+
static getInstance(skillsDir?: string): SkillManager;
|
|
30
|
+
/** Load all skills from a directory. Each direct subdir with SKILL.md is a skill. Re-loadable. */
|
|
31
|
+
loadSkills(skillsDir: string): void;
|
|
32
|
+
private _parseSkillFile;
|
|
33
|
+
private _parseFrontmatter;
|
|
34
|
+
private _parseSimpleYaml;
|
|
35
|
+
private _parseYamlValue;
|
|
36
|
+
/** Validate skill name: 1-64 chars, lowercase alphanumeric + hyphens, no leading/trailing/double hyphens. */
|
|
37
|
+
private _validateSkillName;
|
|
38
|
+
listSkills(): string[];
|
|
39
|
+
getSkill(skillName: string): SkillData | undefined;
|
|
40
|
+
getSkillContent(skillName: string): string | null;
|
|
41
|
+
loadSkill(skillName: string): string | null;
|
|
42
|
+
getSkillMetadata(skillName: string): Record<string, unknown> | null;
|
|
43
|
+
getAllSkillsMetadata(): Array<Record<string, unknown>>;
|
|
44
|
+
/** Formatted metadata string for prompt injection (e.g. {skills_metadata}). */
|
|
45
|
+
getSkillsMetadata(): string;
|
|
46
|
+
getScriptPath(skillName: string, scriptName: string): string | null;
|
|
47
|
+
getReferencePath(skillName: string, referenceName: string): string | null;
|
|
48
|
+
getAssetPath(skillName: string, assetName: string): string | null;
|
|
49
|
+
private _getResourcePath;
|
|
50
|
+
findRelevantSkill(taskDescription: string): string | null;
|
|
51
|
+
findRelevantSkills(taskDescription: string, topK?: number): SkillMatch[];
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=skill_manager.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { type Screenshot, type ToolDefine, type ToolCallResult, } from './device';
|
|
2
|
+
export { type ActionResult, type StepResult } from './action';
|
|
3
|
+
export { EventType, ReportEventSchema, type ReportEvent } from './report';
|
|
4
|
+
export { type TokenUsage } from './task';
|
|
5
|
+
export { type SingleAgentArgs } from './agent';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report-to-Hypium converter.
|
|
3
|
+
*
|
|
4
|
+
* Turns a successful dynamic AutoTestAgent report into a reusable Hypium
|
|
5
|
+
* regression script plus a JSON config. It prefers semantic locators from the
|
|
6
|
+
* captured layout and falls back to normalized coordinates when the UI tree
|
|
7
|
+
* does not expose a stable target.
|
|
8
|
+
*
|
|
9
|
+
* An LLM (via {@link LLMCaller}) can be used to generate the Python script from
|
|
10
|
+
* the extracted actions; when no LLM is configured, a deterministic template is
|
|
11
|
+
* used instead.
|
|
12
|
+
*/
|
|
13
|
+
import { LLMCaller } from '../common/model/custom_model';
|
|
14
|
+
import type { ModelConfig } from '../common/config/types';
|
|
15
|
+
export interface HypiumGenerationResult {
|
|
16
|
+
reportDir: string;
|
|
17
|
+
scriptPath: string;
|
|
18
|
+
configPath: string;
|
|
19
|
+
manifestPath: string | null;
|
|
20
|
+
actionCount: number;
|
|
21
|
+
assertionCount: number;
|
|
22
|
+
}
|
|
23
|
+
export interface HypiumGenerationOptions {
|
|
24
|
+
outputDir?: string;
|
|
25
|
+
copyToReportDir?: boolean;
|
|
26
|
+
llmCaller?: LLMCaller;
|
|
27
|
+
modelConfig?: ModelConfig;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Generate a Hypium regression script + config from a report JSON file.
|
|
31
|
+
*/
|
|
32
|
+
export declare function generateHypiumFromReport(reportJsonPath: string, options?: HypiumGenerationOptions): Promise<HypiumGenerationResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Best-effort Hypium generation from a saved report, gated by the
|
|
35
|
+
* AUTOTEST_GENERATE_HYPIUM environment variable.
|
|
36
|
+
*/
|
|
37
|
+
export declare function maybeGenerateHypiumFromSavedReport(savedFiles: Record<string, string>, status: string | null, options?: HypiumGenerationOptions): Promise<HypiumGenerationResult | null>;
|
|
38
|
+
//# sourceMappingURL=generator.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export { AgentError, LLMNotFollowRuleError, AgentErrorRecoverableMap, AgentErrorSuggestedActionsMap, type AgentErrorCode } from './common/common_errors';
|
|
2
|
+
export declare const VERSION = "0.9.8";
|
|
3
|
+
export { type ModelConfig, AgentConfigSchema, type AgentConfig, type AnalyzerConfig, AppConfigSchema, type AppConfig, } from './common/config/types';
|
|
4
|
+
export { ConfigManager } from './common/config/manager';
|
|
5
|
+
export { type Screenshot, type ToolDefine, type ToolCallResult, type DeviceProtocol, } from './core/device/types';
|
|
6
|
+
export { MockDevice, createDevice, type CreateDeviceOptions } from './core/device';
|
|
7
|
+
export { type DevicePlatform, type ServiceHealth, MCPDeviceAdapter, } from './core/mcp/types';
|
|
8
|
+
export { MCPDeviceAdapterBase } from './core/mcp/base_adapter';
|
|
9
|
+
export { HarmonyHdcAdapter } from './core/mcp/harmony_hdc_adapter';
|
|
10
|
+
export { AndroidMCPAdapter } from './core/mcp/android_adapter';
|
|
11
|
+
export { IOSMCPAdapter } from './core/mcp/ios_adapter';
|
|
12
|
+
export { createAdapterFromDeviceInfo, detectDevicePlatform } from './core/mcp/adapter_factory';
|
|
13
|
+
export { EventType, ReportEventSchema, type ReportEvent, type TokenUsageRecord, type ReportData, type ReportGenerator, } from './reporter/types';
|
|
14
|
+
export { type AgentMode, type AgentStatus, type SingleAgentStatus, type AgentResult, type StepResult, type ActionResult, type AgentHooks, type SingleAgentArgs, } from './core/agent/types';
|
|
15
|
+
export { type FeedbackMode, type TaskOptions, type TaskResult, type AnalysisResult, type DeviceInfo, TaskStateTransitions, } from './api/types';
|
|
16
|
+
export { AgentAPIImpl } from './api/agent_api';
|
|
17
|
+
export { AutoTestAgent, type AutoTestAgentConfig, type RunTaskOptions } from './api/autotest_agent';
|
|
18
|
+
export { ReportGeneratorImpl } from './reporter/generator';
|
|
19
|
+
export { SingleAgent, FastActionAgent } from './core/agent/single_agent/agent';
|
|
20
|
+
export { SingleAgentHooks } from './core/agent/single_agent/hooks';
|
|
21
|
+
export { SubagentManager, getSubagentManager } from './core/agent/single_agent/subagent_manager';
|
|
22
|
+
export { ScrollSearchAgent } from './core/agent/single_agent/scroll_search_agent';
|
|
23
|
+
export { ToolRecorderHook } from './core/agent/single_agent/tool_recorder_hook';
|
|
24
|
+
export { hookManager, type AgentHook, type HookContext } from './core/agent/single_agent/hook_manager';
|
|
25
|
+
export { LayeredAgent } from './core/agent/layered_agent/agent';
|
|
26
|
+
export { ReportAnalyzerAgent, DataLoader, ReportWriter } from './core/agent/report_analyzer_agent';
|
|
27
|
+
export type { AnalyzerConfig as ReportAnalyzerConfig, ReportData as AgentReportData } from './core/agent/report_analyzer_agent';
|
|
28
|
+
export { PromptCategory, load, clearCache, getAvailableVersions, getPromptVersions, listAllPrompts, DEFAULT_VERSIONS, } from './core/prompt/prompt_loader';
|
|
29
|
+
export { McpServerImpl } from './mcp-server/server';
|
|
30
|
+
export { logger, configureLogger, setLogFile, type LoggerConfig } from './common/logger';
|
|
31
|
+
export { compressImageToBase64, compressBase64Image, compressImageBytes } from './common/image_helper';
|
|
32
|
+
export { TokenUsage, DashScopeTokenUsage, resolveTokenType } from './common/usage/token_usage';
|
|
33
|
+
export { McpServerToolName, TapInputSchema, type TapInput, DoubleTapInputSchema, type DoubleTapInput, SwipeInputSchema, type SwipeInput, TypeTextInputSchema, type TypeTextInput, BackInputSchema, type BackInput, HomeInputSchema, type HomeInput, LaunchAppInputSchema, type LaunchAppInput, GetScreenshotInputSchema, type GetScreenshotInput, ListDevicesInputSchema, type ListDevicesInput, RunTaskInputSchema, type RunTaskInput, GetTaskResultInputSchema, type GetTaskResultInput, ResumeTaskInputSchema, type ResumeTaskInput, AnalyzeFailureInputSchema, type AnalyzeFailureInput, GetConfigInputSchema, type GetConfigInput, UpdateConfigInputSchema, type UpdateConfigInput, type McpServerConfig, type McpServerCapabilities, } from './mcp-server/types';
|
|
34
|
+
export { main } from './autotest-cli';
|
|
35
|
+
export { MessageBuilder, type LLMMessage } from './core/agent/utils/message_builder';
|
|
36
|
+
export { KnowledgeManager } from './core/knowledge/knowledge_manager';
|
|
37
|
+
export { CompressedSession, makeSessionInputFilter, compressContext, estimateTokens, Reflector, ToolRecorder, ToolPlayer, createSession, type CompressionConfig, type CompressionResult, type ReflectionConfig, type ToolCallRecord, type RecordingSession, type SessionType, } from './core/memory/memory_manager';
|
|
38
|
+
export { SkillManager } from './core/skill/skill_manager';
|
|
39
|
+
export { TaskSplitter, type TaskSplitResult, type StepDefinition } from './core/preprocessor/task_splitter';
|
|
40
|
+
export { computeImageHash, areImagesSimilar } from './common/image_similarity';
|
|
41
|
+
export { ImageCacher } from './common/image_cacher';
|
|
42
|
+
export { findProjectRoot, getReportBaseDir } from './common/path_utils';
|
|
43
|
+
export { CaseManager } from './common/case_manager';
|
|
44
|
+
export { LLMTrafficRecorder } from './common/dfx/recorder';
|
|
45
|
+
export { CacheTransport } from './common/llm_cache/cache_transport';
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|