@autotest/agent 0.0.1 → 0.0.3
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 +43 -27
- package/dist/api/agent_api.d.ts +1 -1
- package/dist/api/agent_api.js +555 -0
- package/dist/api/autotest_agent.d.ts +0 -1
- package/dist/api/autotest_agent.js +205 -0
- package/dist/api/types.d.ts +0 -1
- package/dist/api/types.js +11 -0
- package/dist/autotest-cli.d.ts +1 -1
- package/dist/autotest-cli.js +391 -0
- package/dist/common/case_manager.d.ts +0 -1
- package/dist/common/case_manager.js +91 -0
- package/dist/common/collect_case.d.ts +0 -1
- package/dist/common/collect_case.js +128 -0
- package/dist/common/common_errors.d.ts +0 -1
- package/dist/common/common_errors.js +66 -0
- package/dist/common/config/config_validator.d.ts +0 -1
- package/dist/common/config/config_validator.js +28 -0
- package/dist/common/config/manager.d.ts +0 -1
- package/dist/common/config/manager.js +257 -0
- package/dist/common/config/output.d.ts +0 -1
- package/dist/common/config/output.js +59 -0
- package/dist/common/config/types.d.ts +2243 -2244
- package/dist/common/config/types.js +184 -0
- package/dist/common/dfx/client_factory.d.ts +0 -1
- package/dist/common/dfx/client_factory.js +62 -0
- package/dist/common/dfx/context.d.ts +0 -1
- package/dist/common/dfx/context.js +23 -0
- package/dist/common/dfx/index.d.ts +0 -1
- package/dist/common/dfx/index.js +15 -0
- package/dist/common/dfx/recorder.d.ts +0 -1
- package/dist/common/dfx/recorder.js +191 -0
- package/dist/common/dfx/recording_fetch.d.ts +0 -1
- package/dist/common/dfx/recording_fetch.js +228 -0
- package/dist/common/dfx/source.d.ts +0 -1
- package/dist/common/dfx/source.js +13 -0
- package/dist/common/image_cacher.d.ts +0 -1
- package/dist/common/image_cacher.js +36 -0
- package/dist/common/image_helper.d.ts +0 -1
- package/dist/common/image_helper.js +128 -0
- package/dist/common/image_similarity.d.ts +0 -1
- package/dist/common/image_similarity.js +171 -0
- package/dist/common/llm_cache/cache_transport.d.ts +2 -1
- package/dist/common/llm_cache/cache_transport.js +102 -0
- package/dist/common/llm_cache/prompt_cache.d.ts +53 -0
- package/dist/common/llm_cache/prompt_cache.js +113 -0
- package/dist/common/logger.d.ts +0 -1
- package/dist/common/logger.js +158 -0
- package/dist/common/model/custom_model.d.ts +0 -1
- package/dist/common/model/custom_model.js +467 -0
- package/dist/common/model/index.d.ts +0 -1
- package/dist/common/model/index.js +5 -0
- package/dist/common/path_utils.d.ts +0 -1
- package/dist/common/path_utils.js +81 -0
- package/dist/common/result_parser.d.ts +0 -1
- package/dist/common/result_parser.js +49 -0
- package/dist/common/usage/token_usage.d.ts +0 -1
- package/dist/common/usage/token_usage.js +117 -0
- package/dist/common/utils.d.ts +0 -1
- package/dist/common/utils.js +125 -0
- package/dist/core/agent/layered_agent/ability_helper.d.ts +0 -1
- package/dist/core/agent/layered_agent/ability_helper.js +125 -0
- package/dist/core/agent/layered_agent/agent.d.ts +0 -1
- package/dist/core/agent/layered_agent/agent.js +37 -0
- package/dist/core/agent/layered_agent/agent_registry.d.ts +0 -1
- package/dist/core/agent/layered_agent/agent_registry.js +75 -0
- package/dist/core/agent/layered_agent/decision.d.ts +0 -1
- package/dist/core/agent/layered_agent/decision.js +478 -0
- package/dist/core/agent/layered_agent/execute_agent/action_handler.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/action_handler.js +155 -0
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.d.ts +1 -2
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.js +41 -0
- package/dist/core/agent/layered_agent/execute_agent/base_agent.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/base_agent.js +112 -0
- package/dist/core/agent/layered_agent/execute_agent/general_agent.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/general_agent.js +207 -0
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.js +241 -0
- package/dist/core/agent/layered_agent/execute_agent/i18n.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/i18n.js +34 -0
- package/dist/core/agent/layered_agent/execute_agent/index.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/index.js +67 -0
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js +316 -0
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +154 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js +243 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js +139 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/index.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/parser/index.js +9 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js +94 -0
- package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/prompts.js +109 -0
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js +33 -0
- package/dist/core/agent/layered_agent/execute_agent/utils.d.ts +0 -1
- package/dist/core/agent/layered_agent/execute_agent/utils.js +52 -0
- package/dist/core/agent/report_analyzer_agent/agent.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/agent.js +565 -0
- package/dist/core/agent/report_analyzer_agent/config.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/config.js +22 -0
- package/dist/core/agent/report_analyzer_agent/data_loader.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/data_loader.js +255 -0
- package/dist/core/agent/report_analyzer_agent/guardrails.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/guardrails.js +99 -0
- package/dist/core/agent/report_analyzer_agent/hooks.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/hooks.js +31 -0
- package/dist/core/agent/report_analyzer_agent/index.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/index.js +52 -0
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.js +42 -0
- package/dist/core/agent/report_analyzer_agent/mapping.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/mapping.js +133 -0
- package/dist/core/agent/report_analyzer_agent/parse.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/parse.js +375 -0
- package/dist/core/agent/report_analyzer_agent/prompt.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/prompt.js +300 -0
- package/dist/core/agent/report_analyzer_agent/report_writer.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/report_writer.js +558 -0
- package/dist/core/agent/report_analyzer_agent/tools.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/tools.js +150 -0
- package/dist/core/agent/report_analyzer_agent/types.d.ts +0 -1
- package/dist/core/agent/report_analyzer_agent/types.js +274 -0
- package/dist/core/agent/rewrite_agent/agent.d.ts +0 -1
- package/dist/core/agent/rewrite_agent/agent.js +209 -0
- package/dist/core/agent/rewrite_agent/guardrails.d.ts +0 -1
- package/dist/core/agent/rewrite_agent/guardrails.js +95 -0
- package/dist/core/agent/rewrite_agent/mapping.d.ts +0 -1
- package/dist/core/agent/rewrite_agent/mapping.js +56 -0
- package/dist/core/agent/rewrite_agent/parse.d.ts +0 -1
- package/dist/core/agent/rewrite_agent/parse.js +121 -0
- package/dist/core/agent/rewrite_agent/types.d.ts +0 -1
- package/dist/core/agent/rewrite_agent/types.js +37 -0
- package/dist/core/agent/single_agent/agent.d.ts +0 -1
- package/dist/core/agent/single_agent/agent.js +798 -0
- package/dist/core/agent/single_agent/hook_manager.d.ts +0 -1
- package/dist/core/agent/single_agent/hook_manager.js +60 -0
- package/dist/core/agent/single_agent/hooks.d.ts +0 -1
- package/dist/core/agent/single_agent/hooks.js +288 -0
- package/dist/core/agent/single_agent/image_utils.d.ts +0 -1
- package/dist/core/agent/single_agent/image_utils.js +159 -0
- package/dist/core/agent/single_agent/scroll_search_agent.d.ts +0 -1
- package/dist/core/agent/single_agent/scroll_search_agent.js +376 -0
- package/dist/core/agent/single_agent/subagent_manager.d.ts +0 -1
- package/dist/core/agent/single_agent/subagent_manager.js +73 -0
- package/dist/core/agent/single_agent/tool_recorder_hook.d.ts +0 -1
- package/dist/core/agent/single_agent/tool_recorder_hook.js +42 -0
- package/dist/core/agent/types.d.ts +0 -1
- package/dist/core/agent/types.js +2 -0
- package/dist/core/agent/utils/message_builder.d.ts +0 -1
- package/dist/core/agent/utils/message_builder.js +138 -0
- package/dist/core/device/device_protocol.d.ts +0 -1
- package/dist/core/device/device_protocol.js +2 -0
- package/dist/core/device/hdc/apps.d.ts +0 -1
- package/dist/core/device/hdc/apps.js +437 -0
- package/dist/core/device/hdc/device.d.ts +0 -1
- package/dist/core/device/hdc/device.js +219 -0
- package/dist/core/device/hdc/index.d.ts +0 -1
- package/dist/core/device/hdc/index.js +31 -0
- package/dist/core/device/hdc/input.d.ts +0 -1
- package/dist/core/device/hdc/input.js +74 -0
- package/dist/core/device/hdc/screenshot.d.ts +0 -1
- package/dist/core/device/hdc/screenshot.js +171 -0
- package/dist/core/device/index.d.ts +0 -1
- package/dist/core/device/index.js +70 -0
- package/dist/core/device/types.d.ts +0 -1
- package/dist/core/device/types.js +2 -0
- package/dist/core/knowledge/knowledge_manager.d.ts +0 -1
- package/dist/core/knowledge/knowledge_manager.js +70 -0
- package/dist/core/knowledge/vectordb.d.ts +0 -1
- package/dist/core/knowledge/vectordb.js +283 -0
- package/dist/core/mcp/adapter_factory.d.ts +0 -1
- package/dist/core/mcp/adapter_factory.js +99 -0
- package/dist/core/mcp/android_adapter.d.ts +1 -2
- package/dist/core/mcp/android_adapter.js +286 -0
- package/dist/core/mcp/base_adapter.d.ts +0 -1
- package/dist/core/mcp/base_adapter.js +86 -0
- package/dist/core/mcp/harmony_hdc_adapter.d.ts +9 -1
- package/dist/core/mcp/harmony_hdc_adapter.js +782 -0
- package/dist/core/mcp/ios_adapter.d.ts +1 -2
- package/dist/core/mcp/ios_adapter.js +286 -0
- package/dist/core/mcp/local_tools.d.ts +0 -1
- package/dist/core/mcp/local_tools.js +41 -0
- package/dist/core/mcp/mcp_tools.d.ts +0 -1
- package/dist/core/mcp/mcp_tools.js +382 -0
- package/dist/core/mcp/types.d.ts +0 -1
- package/dist/core/mcp/types.js +6 -0
- package/dist/core/memory/compressed_session.d.ts +0 -1
- package/dist/core/memory/compressed_session.js +182 -0
- package/dist/core/memory/context_compressor.d.ts +0 -1
- package/dist/core/memory/context_compressor.js +176 -0
- package/dist/core/memory/index.d.ts +0 -1
- package/dist/core/memory/index.js +22 -0
- package/dist/core/memory/memory_manager.d.ts +0 -1
- package/dist/core/memory/memory_manager.js +28 -0
- package/dist/core/memory/reflector.d.ts +0 -1
- package/dist/core/memory/reflector.js +95 -0
- package/dist/core/memory/session_factory.d.ts +0 -1
- package/dist/core/memory/session_factory.js +29 -0
- package/dist/core/memory/tool_player.d.ts +0 -1
- package/dist/core/memory/tool_player.js +225 -0
- package/dist/core/memory/tool_recorder.d.ts +0 -1
- package/dist/core/memory/tool_recorder.js +126 -0
- package/dist/core/preprocessor/task_splitter.d.ts +0 -1
- package/dist/core/preprocessor/task_splitter.js +112 -0
- package/dist/core/prompt/prompt_loader.d.ts +0 -1
- package/dist/core/prompt/prompt_loader.js +313 -0
- package/dist/core/skill/skill_manager.d.ts +0 -1
- package/dist/core/skill/skill_manager.js +299 -0
- package/dist/data_types/action.d.ts +0 -1
- package/dist/data_types/action.js +2 -0
- package/dist/data_types/agent.d.ts +0 -1
- package/dist/data_types/agent.js +2 -0
- package/dist/data_types/device.d.ts +0 -1
- package/dist/data_types/device.js +2 -0
- package/dist/data_types/index.d.ts +0 -1
- package/dist/data_types/index.js +6 -0
- package/dist/data_types/report.d.ts +0 -1
- package/dist/data_types/report.js +6 -0
- package/dist/data_types/task.d.ts +0 -1
- package/dist/data_types/task.js +2 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +164 -1
- package/dist/loop/cli.d.ts +0 -1
- package/dist/loop/cli.js +127 -0
- package/dist/loop/orchestrator.d.ts +0 -1
- package/dist/loop/orchestrator.js +314 -0
- package/dist/loop/result_writer.d.ts +0 -1
- package/dist/loop/result_writer.js +260 -0
- package/dist/loop/types.d.ts +0 -1
- package/dist/loop/types.js +82 -0
- package/dist/mcp-server/server.d.ts +0 -1
- package/dist/mcp-server/server.js +341 -0
- package/dist/mcp-server/types.d.ts +283 -118
- package/dist/mcp-server/types.js +202 -0
- package/dist/reporter/batch_summary.d.ts +0 -1
- package/dist/reporter/batch_summary.js +197 -0
- package/dist/reporter/generator.d.ts +0 -1
- package/dist/reporter/generator.js +772 -0
- package/dist/reporter/types.d.ts +14 -15
- package/dist/reporter/types.js +44 -0
- package/dist/tools/batch_runner.d.ts +1 -1
- package/dist/tools/batch_runner.js +731 -0
- package/package.json +5 -3
- package/dist/common/config/config.yaml +0 -113
- package/dist/hypium_generator/generator.d.ts +0 -38
package/README.md
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
## 项目简介
|
|
6
6
|
|
|
7
|
-
AutoTest Agent 是一个智能化的移动设备自动化测试框架,支持 **单层 Agent**、**双层 Agent
|
|
7
|
+
AutoTest Agent 是一个智能化的移动设备自动化测试框架,支持 **单层 Agent**、**双层 Agent** 两种架构模式,能够理解自然语言指令,通过多模态模型自主执行测试操作、发现 Bug、分析失败根因并生成测试报告。
|
|
8
8
|
|
|
9
9
|
### 核心特性
|
|
10
10
|
|
|
11
|
-
- **多架构模式**:`single`(统一 Agent)、`layered`(Planner + Executor
|
|
11
|
+
- **多架构模式**:`single`(统一 Agent)、`layered`(Planner + Executor)两种模式可切换
|
|
12
12
|
- **多模态视觉理解**:通过多模态模型观察屏幕截图、定位 UI 元素、判断操作结果
|
|
13
13
|
- **自然语言交互**:中文描述测试步骤,自动转换为设备操作
|
|
14
14
|
- **多平台支持**:HarmonyOS(纯 TS 直驱 HDC)、Android、iOS
|
|
@@ -47,25 +47,25 @@ AutoTest/
|
|
|
47
47
|
│ ├── core/
|
|
48
48
|
│ │ ├── agent/ # Agent 实现
|
|
49
49
|
│ │ │ ├── single_agent/ # 单层 Agent
|
|
50
|
+
│ │ │ │ ├── agent.ts
|
|
51
|
+
│ │ │ │ ├── hooks.ts / hook_manager.ts
|
|
52
|
+
│ │ │ │ ├── image_utils.ts
|
|
53
|
+
│ │ │ │ ├── scroll_search_agent.ts # 滚动搜索子 Agent
|
|
54
|
+
│ │ │ │ ├── subagent_manager.ts # 子 Agent 管理
|
|
55
|
+
│ │ │ │ └── tool_recorder_hook.ts
|
|
50
56
|
│ │ │ ├── layered_agent/ # 双层 Agent(Planner + Executor)
|
|
51
57
|
│ │ │ │ ├── decision.ts # Planner 决策
|
|
52
58
|
│ │ │ │ ├── agent_registry.ts # Agent 注册表
|
|
53
59
|
│ │ │ │ ├── ability_helper.ts # 能力辅助
|
|
54
60
|
│ │ │ │ └── execute_agent/ # Executor 执行
|
|
55
|
-
│ │ │ ├── hypium_agent/ # Hypium Agent(自定义循环 + 子Agent)
|
|
56
|
-
│ │ │ │ ├── basic_agent.ts # 基础 Agent
|
|
57
|
-
│ │ │ │ ├── context.ts # 上下文
|
|
58
|
-
│ │ │ │ ├── hooks.ts # 钩子
|
|
59
|
-
│ │ │ │ ├── model_adapter/ # LLM 输出格式适配
|
|
60
|
-
│ │ │ │ ├── subagent/ # 滚动搜索 / 时间选择等
|
|
61
|
-
│ │ │ │ ├── tool_filter.ts # 工具过滤
|
|
62
|
-
│ │ │ │ └── report_adapter.ts # 报告适配
|
|
63
61
|
│ │ │ ├── report_analyzer_agent/ # 失败根因分析 Agent
|
|
62
|
+
│ │ │ ├── rewrite_agent/ # 报告改写 Agent(agent / guardrails / parse / mapping / prompts)
|
|
64
63
|
│ │ │ ├── utils/
|
|
65
64
|
│ │ │ └── types.ts
|
|
66
65
|
│ │ ├── device/ # 设备抽象层
|
|
67
66
|
│ │ │ ├── device_protocol.ts # 设备协议抽象
|
|
68
|
-
│ │ │ ├──
|
|
67
|
+
│ │ │ ├── index.ts # HDC 设备实现(封装 hdc/ 模块)
|
|
68
|
+
│ │ │ ├── types.ts
|
|
69
69
|
│ │ │ └── hdc/ # HDC 协议(device/input/screenshot/apps)
|
|
70
70
|
│ │ ├── mcp/ # MCP 适配器
|
|
71
71
|
│ │ │ ├── base_adapter.ts
|
|
@@ -77,18 +77,18 @@ AutoTest/
|
|
|
77
77
|
│ │ │ └── local_tools.ts # 本地工具(wait / load_skill)
|
|
78
78
|
│ │ ├── prompt/ # 版本化提示词
|
|
79
79
|
│ │ │ ├── prompt_loader.ts
|
|
80
|
-
│ │ │ └── templates/ # single / hypium / planner / splitter 模板
|
|
80
|
+
│ │ │ └── templates/ # single / hypium / planner / debug / fast_action / splitter 模板
|
|
81
81
|
│ │ ├── skill/ # Skills 系统(skill_manager.ts)
|
|
82
82
|
│ │ ├── knowledge/ # 知识库(knowledge_manager.ts / vectordb.ts)
|
|
83
|
-
│ │ ├── memory/ #
|
|
84
|
-
│ │
|
|
85
|
-
│ │ └── script_generator/ # 测试脚本生成
|
|
83
|
+
│ │ ├── memory/ # 记忆系统(memory_manager / compressed_session / context_compressor / reflector / tool_player / tool_recorder / session_factory)
|
|
84
|
+
│ │ └── preprocessor/ # 任务预处理
|
|
86
85
|
│ ├── data_types/ # 数据模型
|
|
87
|
-
│ ├── reporter/ # 报告生成(generator.ts / types.ts)
|
|
86
|
+
│ ├── reporter/ # 报告生成(generator.ts / batch_summary.ts / types.ts)
|
|
88
87
|
│ ├── hypium_generator/ # Hypium 回归脚本生成
|
|
88
|
+
│ ├── loop/ # 批量循环编排(cli / orchestrator / result_writer / types)
|
|
89
89
|
│ ├── mcp-server/ # MCP server 暴露
|
|
90
90
|
│ └── tools/ # 工具
|
|
91
|
-
│ ├── batch_runner.ts #
|
|
91
|
+
│ ├── batch_runner.ts # 批量执行(发布为 autotest-batch 二进制)
|
|
92
92
|
│ └── runner.mjs # caseTest/batchCaseTest 一键封装(自动 install/build)
|
|
93
93
|
├── tests/ # 单元测试(vitest,172 个)
|
|
94
94
|
├── app_config.json # App bundle/ability 映射
|
|
@@ -103,7 +103,8 @@ AutoTest/
|
|
|
103
103
|
|----------|--------------|------|
|
|
104
104
|
| **单层 Agent** | `single`(默认) | 统一 Agent 处理规划与执行,基于 AI SDK,效率高 |
|
|
105
105
|
| **双层 Agent** | `layered` | Planner 决策 + Executor 执行,适合复杂任务拆解 |
|
|
106
|
-
|
|
106
|
+
|
|
107
|
+
> 历史的 `hypium` 模式已移除(`hypium_agent` 包删除);如需生成 Hypium 回归脚本,使用 `agent.enable_hypium_generation` 配置项,由 `hypium_generator/` 在执行成功后产出。
|
|
107
108
|
|
|
108
109
|
### 单层 Agent 工作流程
|
|
109
110
|
|
|
@@ -152,7 +153,13 @@ Android/iOS 平台使用 `@mobilenext/mobile-mcp`(通过 npx 自动安装)
|
|
|
152
153
|
|
|
153
154
|
## 配置说明
|
|
154
155
|
|
|
155
|
-
配置文件位于 `src/common/config/config.yaml
|
|
156
|
+
配置文件位于 `src/common/config/config.yaml`(构建后随包发布到 `dist/common/config/config.yaml`)。ConfigManager 按以下顺序分层加载并合并(后者覆盖前者):
|
|
157
|
+
|
|
158
|
+
1. 包内默认 `config.yaml`
|
|
159
|
+
2. 包内 `config.local.yaml`(可选)
|
|
160
|
+
3. 当前工作目录(项目根目录)`config.yaml`(可选,适合本地覆盖 API Key / 模型)
|
|
161
|
+
4. 当前工作目录 `config.local.yaml`(可选)
|
|
162
|
+
5. CLI `--config <path>` 指定的文件(最高优先级)
|
|
156
163
|
|
|
157
164
|
### 模型配置
|
|
158
165
|
|
|
@@ -198,7 +205,7 @@ model:
|
|
|
198
205
|
|
|
199
206
|
```yaml
|
|
200
207
|
agent:
|
|
201
|
-
mode: "single" # single / layered
|
|
208
|
+
mode: "single" # single / layered
|
|
202
209
|
max_steps: 50 # 最大执行步数
|
|
203
210
|
lang: "zh" # 语言
|
|
204
211
|
enable_preprocess: false # 任务预处理
|
|
@@ -371,6 +378,13 @@ npm run batchCaseTest cases.jsonl smoke
|
|
|
371
378
|
npm run batchCaseTest -- --testcases cases.jsonl --category smoke
|
|
372
379
|
```
|
|
373
380
|
|
|
381
|
+
作为已安装的 npm 包使用时,也可调用发布的 `autotest-batch` 二进制:
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
npx autotest-batch cases.jsonl
|
|
385
|
+
npx autotest-batch cases.jsonl smoke
|
|
386
|
+
```
|
|
387
|
+
|
|
374
388
|
#### 批量执行特性
|
|
375
389
|
|
|
376
390
|
- 支持断点续执行(自动跳过已完成用例)
|
|
@@ -405,7 +419,7 @@ Run options:
|
|
|
405
419
|
--case-index <n> 1-based case index in the file
|
|
406
420
|
--device <sn> Device serial number
|
|
407
421
|
--platform <p> Platform: harmony | android | ios
|
|
408
|
-
--mode <m> Agent mode: single | layered
|
|
422
|
+
--mode <m> Agent mode: single | layered
|
|
409
423
|
--ip <addr> Device IP address
|
|
410
424
|
--port <num> Device port number
|
|
411
425
|
--task-name <name> Test case name
|
|
@@ -504,15 +518,17 @@ console.log(result.reportDir); // 报告目录路径
|
|
|
504
518
|
|
|
505
519
|
| 参数 | 类型 | 必填 | 说明 |
|
|
506
520
|
|------|------|------|------|
|
|
507
|
-
| `apiKey` | `string` | 是 | LLM API Key |
|
|
521
|
+
| `apiKey` | `string` | 是 | LLM API Key(`unified` 模型使用) |
|
|
508
522
|
| `modelName` | `string` | 是 | 模型名称 |
|
|
509
523
|
| `baseUrl` | `string` | 是 | LLM API 地址 |
|
|
510
524
|
| `provider` | `string` | 否 | 模型提供商,默认 `'openai'` |
|
|
525
|
+
| `executeModel` | `ModelSlotConfig` | 否 | 双层模式 Execute 模型配置(apiKey/modelName/baseUrl/provider/temperature/topP/maxTokens);未设置时回退到 `unified` |
|
|
526
|
+
| `decisionModel` | `ModelSlotConfig` | 否 | 双层模式 Decision 模型配置;未设置时回退到 `unified` |
|
|
511
527
|
| `deviceSn` | `string` | 否 | 设备序列号,留空自动检测 |
|
|
512
528
|
| `ip` | `string` | 否 | 设备 IP,默认 `127.0.0.1` |
|
|
513
529
|
| `port` | `number` | 否 | 设备端口,默认 `8710` |
|
|
514
530
|
| `platform` | `'harmony' \| 'android' \| 'ios'` | 否 | 指定平台,跳过自动检测 |
|
|
515
|
-
| `agentMode` | `'single' \| 'layered'
|
|
531
|
+
| `agentMode` | `'single' \| 'layered'` | 否 | Agent 模式,默认 `'single'` |
|
|
516
532
|
| `maxSteps` | `number` | 否 | 最大执行步数,默认 `100` |
|
|
517
533
|
| `reportDir` | `string` | 否 | 报告输出目录,默认 `reports` |
|
|
518
534
|
| `enableCache` | `boolean` | 否 | 启用 LLM 缓存,默认 `true` |
|
|
@@ -587,7 +603,7 @@ npm run typecheck # 类型检查(tsc --noEmit)
|
|
|
587
603
|
|
|
588
604
|
## 单元测试
|
|
589
605
|
|
|
590
|
-
单元测试位于 `tests/`,使用 vitest,共
|
|
606
|
+
单元测试位于 `tests/`,使用 vitest,共 174 个测试(13 个文件):
|
|
591
607
|
|
|
592
608
|
| 测试文件 | 覆盖模块 | 测试数 |
|
|
593
609
|
|---------|---------|-------|
|
|
@@ -601,7 +617,7 @@ npm run typecheck # 类型检查(tsc --noEmit)
|
|
|
601
617
|
| `single-agent.test.ts` | Agent 执行/截图注入/abort | 9 |
|
|
602
618
|
| `key-steps-builder.test.ts` | 关键步骤构建 | 9 |
|
|
603
619
|
| `data-loader.test.ts` | 数据加载 | 9 |
|
|
604
|
-
| `hdc-adapter.test.ts` | HarmonyHdcAdapter 命令派发/坐标转换 |
|
|
620
|
+
| `hdc-adapter.test.ts` | HarmonyHdcAdapter 命令派发/坐标转换 | 11 |
|
|
605
621
|
| `autotest-agent.test.ts` | 门面类(mock adapter_factory,密闭) | 8 |
|
|
606
622
|
| `logger.test.ts` | 文件日志/格式 | 5 |
|
|
607
623
|
|
|
@@ -615,7 +631,7 @@ npx vitest run tests/config-manager.test.ts # 运行单个文件
|
|
|
615
631
|
|
|
616
632
|
### 自定义提示词
|
|
617
633
|
|
|
618
|
-
编辑提示词模板:`src/core/prompt/templates/`(`single/` · `hypium/` · `planner/` · `splitter/`)。
|
|
634
|
+
编辑提示词模板:`src/core/prompt/templates/`(`single/` · `hypium/` · `planner/` · `debug/` · `fast_action/` · `splitter/`)。
|
|
619
635
|
|
|
620
636
|
### 添加新的 MCP 工具
|
|
621
637
|
|
|
@@ -641,7 +657,7 @@ npx vitest run tests/config-manager.test.ts # 运行单个文件
|
|
|
641
657
|
### Q3: 如何切换 Agent 架构模式?
|
|
642
658
|
|
|
643
659
|
- 修改 `config.yaml` 的 `agent.mode`
|
|
644
|
-
- 或命令行 `--mode single|layered
|
|
660
|
+
- 或命令行 `--mode single|layered`
|
|
645
661
|
|
|
646
662
|
### Q4: 如何查看测试报告?
|
|
647
663
|
|
package/dist/api/agent_api.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare class AgentAPIImpl {
|
|
|
26
26
|
analyzeFailure(taskId: string, caseIdx: number): Promise<AnalysisResult>;
|
|
27
27
|
getConfig(): AppConfig;
|
|
28
28
|
updateConfig(partial: Record<string, unknown>): AppConfig;
|
|
29
|
+
callDeviceTool(toolName: string, args: Record<string, unknown>): Promise<unknown>;
|
|
29
30
|
getPromptVersions(category: string): string[];
|
|
30
31
|
private generateTaskId;
|
|
31
32
|
private transitionTask;
|
|
@@ -34,4 +35,3 @@ export declare class AgentAPIImpl {
|
|
|
34
35
|
private createLLMCaller;
|
|
35
36
|
private createRecordingHooks;
|
|
36
37
|
}
|
|
37
|
-
//# sourceMappingURL=agent_api.d.ts.map
|