@autotest/agent 0.0.5 → 0.0.6
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 +3 -0
- package/dist/api/agent_api.d.ts +2 -2
- package/dist/api/agent_api.js +7 -7
- package/dist/autotest-cli.js +44 -44
- package/dist/common/config/config.yaml +1 -0
- package/dist/common/config/config_validator.js +1 -1
- package/dist/common/config/manager.d.ts +10 -10
- package/dist/common/config/manager.js +12 -12
- package/dist/common/config/output.js +1 -1
- package/dist/common/config/types.d.ts +28 -1
- package/dist/common/config/types.js +12 -11
- package/dist/common/dfx/recording_fetch.js +1 -1
- package/dist/common/dfx/source.js +1 -1
- package/dist/common/image_helper.d.ts +2 -2
- package/dist/common/image_helper.js +2 -2
- package/dist/common/llm_cache/cache_transport.d.ts +1 -1
- package/dist/common/llm_cache/cache_transport.js +1 -1
- package/dist/common/llm_cache/prompt_cache.d.ts +2 -2
- package/dist/common/llm_cache/prompt_cache.js +2 -2
- package/dist/common/model/custom_model.js +5 -43
- package/dist/common/utils.d.ts +5 -5
- package/dist/common/utils.js +5 -5
- package/dist/core/agent/layered_agent/agent_registry.d.ts +3 -1
- package/dist/core/agent/layered_agent/agent_registry.js +12 -5
- package/dist/core/agent/layered_agent/decision.js +3 -1
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts +1 -1
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +34 -34
- package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts +1 -1
- package/dist/core/agent/layered_agent/execute_agent/prompts.js +8 -8
- package/dist/core/agent/report_analyzer_agent/agent.js +4 -4
- package/dist/core/agent/report_analyzer_agent/prompt.d.ts +1 -1
- package/dist/core/agent/report_analyzer_agent/prompt.js +11 -11
- package/dist/core/agent/report_analyzer_agent/report_writer.js +139 -139
- package/dist/core/agent/report_analyzer_agent/tools.d.ts +1 -1
- package/dist/core/agent/report_analyzer_agent/tools.js +2 -2
- package/dist/core/agent/report_analyzer_agent/types.js +2 -2
- package/dist/core/agent/rewrite_agent/agent.d.ts +5 -5
- package/dist/core/agent/rewrite_agent/agent.js +5 -5
- package/dist/core/agent/rewrite_agent/guardrails.d.ts +1 -1
- package/dist/core/agent/rewrite_agent/guardrails.js +1 -1
- package/dist/core/agent/rewrite_agent/mapping.d.ts +1 -1
- package/dist/core/agent/rewrite_agent/mapping.js +3 -3
- package/dist/core/agent/rewrite_agent/parse.d.ts +1 -1
- package/dist/core/agent/rewrite_agent/parse.js +1 -1
- package/dist/core/agent/rewrite_agent/types.d.ts +1 -1
- package/dist/core/agent/rewrite_agent/types.js +1 -1
- package/dist/core/agent/single_agent/agent.d.ts +1 -2
- package/dist/core/agent/single_agent/agent.js +29 -26
- package/dist/core/agent/single_agent/hook_manager.d.ts +1 -2
- package/dist/core/agent/single_agent/hook_manager.js +1 -2
- package/dist/core/agent/single_agent/image_utils.d.ts +1 -2
- package/dist/core/agent/single_agent/image_utils.js +1 -2
- package/dist/core/agent/single_agent/scroll_search_agent.d.ts +5 -5
- package/dist/core/agent/single_agent/scroll_search_agent.js +39 -10
- package/dist/core/agent/single_agent/subagent_manager.d.ts +1 -2
- package/dist/core/agent/single_agent/subagent_manager.js +2 -3
- package/dist/core/agent/single_agent/tool_recorder_hook.d.ts +3 -3
- package/dist/core/agent/single_agent/tool_recorder_hook.js +3 -3
- package/dist/core/device/hdc/apps.js +1 -1
- package/dist/core/device/hdc/device.d.ts +1 -1
- package/dist/core/device/hdc/device.js +1 -1
- package/dist/core/device/hdc/screenshot.js +1 -1
- package/dist/core/device/index.d.ts +2 -2
- package/dist/core/device/index.js +2 -2
- package/dist/core/knowledge/knowledge_manager.d.ts +3 -3
- package/dist/core/knowledge/knowledge_manager.js +3 -3
- package/dist/core/knowledge/vectordb.d.ts +5 -5
- package/dist/core/knowledge/vectordb.js +5 -5
- package/dist/core/mcp/harmony_hdc_adapter.js +21 -5
- package/dist/core/mcp/mcp_tools.d.ts +10 -2
- package/dist/core/mcp/mcp_tools.js +69 -6
- package/dist/core/memory/_utils.d.ts +1 -1
- package/dist/core/memory/_utils.js +1 -1
- package/dist/core/memory/context_compressor.js +2 -2
- package/dist/core/memory/index.d.ts +1 -1
- package/dist/core/memory/index.js +1 -1
- package/dist/core/memory/memory_manager.d.ts +1 -1
- package/dist/core/memory/memory_manager.js +1 -1
- package/dist/core/memory/replan_manager.d.ts +1 -1
- package/dist/core/memory/replan_manager.js +1 -1
- package/dist/core/memory/tool_player.d.ts +5 -5
- package/dist/core/memory/tool_player.js +5 -5
- package/dist/core/memory/tool_player_popup.d.ts +1 -1
- package/dist/core/memory/tool_player_popup.js +12 -12
- package/dist/core/memory/tool_player_replan.d.ts +1 -1
- package/dist/core/memory/tool_player_replan.js +2 -2
- package/dist/core/memory/tool_player_xpath.d.ts +3 -3
- package/dist/core/memory/tool_player_xpath.js +3 -3
- package/dist/core/prompt/prompt_loader.d.ts +1 -1
- package/dist/core/prompt/prompt_loader.js +3 -3
- package/dist/core/skill/skill_manager.d.ts +2 -2
- package/dist/core/skill/skill_manager.js +1 -1
- package/dist/data_types/case.js +1 -1
- package/dist/data_types/screen.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/loop/cli.d.ts +4 -4
- package/dist/loop/cli.js +4 -4
- package/dist/loop/orchestrator.d.ts +6 -6
- package/dist/loop/orchestrator.js +7 -7
- package/dist/loop/result_writer.d.ts +1 -1
- package/dist/loop/result_writer.js +36 -36
- package/dist/loop/types.d.ts +1 -1
- package/dist/loop/types.js +1 -1
- package/dist/reporter/html_template/index.js +14 -9
- package/dist/tools/batch_runner.js +3 -3
- package/dist/tools/case_runner/report.d.ts +1 -1
- package/dist/tools/case_runner/report.js +59 -59
- package/dist/tools/case_runner/runner.d.ts +3 -3
- package/dist/tools/case_runner/runner.js +8 -8
- package/dist/tools/config/config_tool.d.ts +6 -6
- package/dist/tools/config/config_tool.js +27 -27
- package/dist/tools/prompt_compare/compare_runner.d.ts +2 -2
- package/dist/tools/prompt_compare/compare_runner.js +16 -16
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ export interface SkillMatch {
|
|
|
2
2
|
name: string;
|
|
3
3
|
score: number;
|
|
4
4
|
}
|
|
5
|
-
/** A loaded skill: metadata + body + resource subdirs
|
|
5
|
+
/** A loaded skill: metadata + body + resource subdirs. */
|
|
6
6
|
interface SkillData {
|
|
7
7
|
metadata: Record<string, unknown>;
|
|
8
8
|
content: string;
|
|
@@ -13,7 +13,7 @@ interface SkillData {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Manages Agent Skills following the Agent Skills specification (aligned with
|
|
16
|
-
*
|
|
16
|
+
* core/skill/skill_manager.py).
|
|
17
17
|
*
|
|
18
18
|
* Each skill is a directory containing a SKILL.md with YAML frontmatter
|
|
19
19
|
* (name/description/license/compatibility) + markdown body, plus optional
|
|
@@ -47,7 +47,7 @@ function tokenize(text) {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Manages Agent Skills following the Agent Skills specification (aligned with
|
|
50
|
-
*
|
|
50
|
+
* core/skill/skill_manager.py).
|
|
51
51
|
*
|
|
52
52
|
* Each skill is a directory containing a SKILL.md with YAML frontmatter
|
|
53
53
|
* (name/description/license/compatibility) + markdown body, plus optional
|
package/dist/data_types/case.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
//
|
|
2
|
+
//
|
|
3
3
|
// Used by case_runner (tools/case_runner) and batch runner CaseInfo-mode.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.CaseInfo = exports.AppInfo = void 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
//
|
|
2
|
+
//
|
|
3
3
|
// Standalone screen metadata; distinct from the agent-internal ScreenInfo
|
|
4
4
|
// in core/agent/utils/message_builder.ts (current_app/extra).
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AgentError, LLMNotFollowRuleError, AgentErrorRecoverableMap, AgentErrorSuggestedActionsMap, type AgentErrorCode } from './common/common_errors';
|
|
2
|
-
export declare const VERSION
|
|
2
|
+
export declare const VERSION: any;
|
|
3
3
|
export { type ModelConfig, AgentConfigSchema, type AgentConfig, type AnalyzerConfig, AppConfigSchema, type AppConfig, } from './common/config/types';
|
|
4
4
|
export { ConfigManager } from './common/config/manager';
|
|
5
5
|
export { type Screenshot, type ToolDefine, type ToolCallResult, type DeviceProtocol, } from './core/device/types';
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,7 @@ Object.defineProperty(exports, "AgentError", { enumerable: true, get: function (
|
|
|
8
8
|
Object.defineProperty(exports, "LLMNotFollowRuleError", { enumerable: true, get: function () { return common_errors_1.LLMNotFollowRuleError; } });
|
|
9
9
|
Object.defineProperty(exports, "AgentErrorRecoverableMap", { enumerable: true, get: function () { return common_errors_1.AgentErrorRecoverableMap; } });
|
|
10
10
|
Object.defineProperty(exports, "AgentErrorSuggestedActionsMap", { enumerable: true, get: function () { return common_errors_1.AgentErrorSuggestedActionsMap; } });
|
|
11
|
-
|
|
12
|
-
exports.VERSION = '0.9.8';
|
|
11
|
+
exports.VERSION = require('../package.json').version;
|
|
13
12
|
var types_1 = require("./common/config/types");
|
|
14
13
|
Object.defineProperty(exports, "AgentConfigSchema", { enumerable: true, get: function () { return types_1.AgentConfigSchema; } });
|
|
15
14
|
Object.defineProperty(exports, "AppConfigSchema", { enumerable: true, get: function () { return types_1.AppConfigSchema; } });
|
package/dist/loop/cli.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Loop CLI 分发 —
|
|
2
|
+
* Loop CLI 分发 —
|
|
3
3
|
*
|
|
4
4
|
* resolveMaxLoops / resolveMode / loadAnalyzerSummary / shouldSuppressAnalyzeAfter
|
|
5
5
|
*
|
|
6
|
-
* 与
|
|
6
|
+
* 与 版的差异:args 用普通对象(LoopCliArgs)而非 argparse Namespace;
|
|
7
7
|
* config 读 config.agent.maxLoops(可选,不存在时按 0 处理)。
|
|
8
8
|
*/
|
|
9
9
|
import { LoopMode } from './types';
|
|
@@ -31,8 +31,8 @@ export interface AnalyzerSummary {
|
|
|
31
31
|
summary: Record<string, unknown>;
|
|
32
32
|
originalTask: string;
|
|
33
33
|
}
|
|
34
|
-
/** 读取 analysis_result.json 并裁剪为 summary dict
|
|
35
|
-
* Node.js 与
|
|
34
|
+
/** 读取 analysis_result.json 并裁剪为 summary dict(
|
|
35
|
+
* Node.js 与 的 analysis_result.json 字段集一致(snake_case)。 */
|
|
36
36
|
export declare function loadAnalyzerSummary(reportDir: string): AnalyzerSummary;
|
|
37
37
|
/** 判断是否抑制 --analyze-after(loop 闭环已内部归因时)。 */
|
|
38
38
|
export declare function shouldSuppressAnalyzeAfter(args: LoopCliArgs, mode: LoopMode, cfgAnalyzeAfter: boolean): boolean;
|
package/dist/loop/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Loop CLI 分发 —
|
|
3
|
+
* Loop CLI 分发 —
|
|
4
4
|
*
|
|
5
5
|
* resolveMaxLoops / resolveMode / loadAnalyzerSummary / shouldSuppressAnalyzeAfter
|
|
6
6
|
*
|
|
7
|
-
* 与
|
|
7
|
+
* 与 版的差异:args 用普通对象(LoopCliArgs)而非 argparse Namespace;
|
|
8
8
|
* config 读 config.agent.maxLoops(可选,不存在时按 0 处理)。
|
|
9
9
|
*/
|
|
10
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -86,8 +86,8 @@ function resolveMode(args, configMaxLoops, cfgAnalyzeAfter) {
|
|
|
86
86
|
// 兜底
|
|
87
87
|
return { mode: types_1.LoopMode.EXECUTE_ONLY, maxLoops: 1, inputReportDir: null };
|
|
88
88
|
}
|
|
89
|
-
/** 读取 analysis_result.json 并裁剪为 summary dict
|
|
90
|
-
* Node.js 与
|
|
89
|
+
/** 读取 analysis_result.json 并裁剪为 summary dict(
|
|
90
|
+
* Node.js 与 的 analysis_result.json 字段集一致(snake_case)。 */
|
|
91
91
|
function loadAnalyzerSummary(reportDir) {
|
|
92
92
|
const jsonPath = path.join(reportDir, 'analysis', 'analysis_result.json');
|
|
93
93
|
const data = JSON.parse(fs.readFileSync(jsonPath, 'utf-8'));
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Loop 闭环编排器 — 状态机核心 —
|
|
2
|
+
* Loop 闭环编排器 — 状态机核心 —
|
|
3
3
|
*
|
|
4
4
|
* 实现"执行→归因→改写→重执行"的自愈闭环,包裹三个原语(execute/analyze/rewrite),
|
|
5
5
|
* 零侵入原语签名(依赖注入,避免循环导入)。
|
|
6
6
|
*
|
|
7
7
|
* 5 种执行模式(mode-driven 跳步):
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* FULL_LOOP: Step 1→2→3→4→5→6→7→8→9(完整闭环,多轮)
|
|
9
|
+
* EXECUTE_ANALYZE: Step 1→2(执行+归因,单轮)
|
|
10
|
+
* EXECUTE_ONLY: Step 1(仅执行,单轮)
|
|
11
|
+
* ANALYZE_ONLY: Step 2(仅归因,需 inputReportDir,单轮)
|
|
12
|
+
* REWRITE_ONLY: loadAnalyzerSummary → Step 6→7→8→9(仅改写,单轮)
|
|
13
13
|
*
|
|
14
14
|
* 5 类终止条件:PASSED / UNREWRITEABLE / MAX_LOOPS / DEAD_LOOP / ERROR
|
|
15
15
|
*
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Loop 闭环编排器 — 状态机核心 —
|
|
3
|
+
* Loop 闭环编排器 — 状态机核心 —
|
|
4
4
|
*
|
|
5
5
|
* 实现"执行→归因→改写→重执行"的自愈闭环,包裹三个原语(execute/analyze/rewrite),
|
|
6
6
|
* 零侵入原语签名(依赖注入,避免循环导入)。
|
|
7
7
|
*
|
|
8
8
|
* 5 种执行模式(mode-driven 跳步):
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* FULL_LOOP: Step 1→2→3→4→5→6→7→8→9(完整闭环,多轮)
|
|
10
|
+
* EXECUTE_ANALYZE: Step 1→2(执行+归因,单轮)
|
|
11
|
+
* EXECUTE_ONLY: Step 1(仅执行,单轮)
|
|
12
|
+
* ANALYZE_ONLY: Step 2(仅归因,需 inputReportDir,单轮)
|
|
13
|
+
* REWRITE_ONLY: loadAnalyzerSummary → Step 6→7→8→9(仅改写,单轮)
|
|
14
14
|
*
|
|
15
15
|
* 5 类终止条件:PASSED / UNREWRITEABLE / MAX_LOOPS / DEAD_LOOP / ERROR
|
|
16
16
|
*
|
|
@@ -61,7 +61,7 @@ const types_2 = require("../core/agent/rewrite_agent/types");
|
|
|
61
61
|
const cli_1 = require("./cli");
|
|
62
62
|
// PASS-set:parse_task_result 只产出 PASS/FAIL/UNKNOWN,upper 后比较覆盖 PASS
|
|
63
63
|
const PASS_SET = new Set(['PASS']);
|
|
64
|
-
// 不可改写的根因 category 集合(Node.js 英文标签,对应
|
|
64
|
+
// 不可改写的根因 category 集合(Node.js 英文标签,对应 {应用问题,环境问题,无问题})
|
|
65
65
|
const UNREWRITEABLE_CATEGORIES = new Set([
|
|
66
66
|
'Application Issue', 'Environment Issue', 'No Issue',
|
|
67
67
|
'应用问题', '环境问题', '无问题',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Loop 结果落盘 —
|
|
3
|
+
* Loop 结果落盘 —
|
|
4
4
|
*
|
|
5
5
|
* writeLoopResultJson: 序列化 LoopResult → loop_result.json(写在 finalReportDir 父目录)。
|
|
6
6
|
* writeLoopSummaryHtml: 生成 loop_summary.html(Loop 汇总 + 各轮执行/分析报告 iframe 标签页)。
|
|
@@ -60,7 +60,7 @@ function findReportHtml(reportDir) {
|
|
|
60
60
|
function findAnalysisHtml(reportDir) {
|
|
61
61
|
if (!reportDir || !fs.existsSync(reportDir))
|
|
62
62
|
return null;
|
|
63
|
-
// Node.js analyzer 写 analysis_report/,
|
|
63
|
+
// Node.js analyzer 写 analysis_report/, 写 analysis/,兼容两者
|
|
64
64
|
for (const sub of ['analysis_report', 'analysis']) {
|
|
65
65
|
const dir = path.join(reportDir, sub);
|
|
66
66
|
if (fs.existsSync(dir)) {
|
|
@@ -202,31 +202,31 @@ function writeLoopSummaryHtml(result, finalReportDir) {
|
|
|
202
202
|
<html lang="zh">
|
|
203
203
|
<head><meta charset="utf-8"><title>Loop 汇总报告</title>
|
|
204
204
|
<style>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
205
|
+
body { font-family: -apple-system, "Segoe UI", sans-serif; margin: 0; display: flex; flex-direction: column; height: 100vh; background: #f7f7f7; }
|
|
206
|
+
.header { background: #fff; padding: 16px 20px; border-radius: 8px; margin: 12px 20px 16px 20px; }
|
|
207
|
+
.header h1 { margin: 0 0 12px 0; font-size: 22px; }
|
|
208
|
+
.header p { margin: 4px 0; font-size: 14px; word-break: break-all; }
|
|
209
|
+
.term { color: #c0392b; font-weight: 600; }
|
|
210
|
+
.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }
|
|
211
|
+
.tab { padding: 8px 16px; border: 1px solid #ddd; border-bottom: none; border-radius: 6px 6px 0 0; background: #eee; cursor: pointer; font-size: 14px; color: #555; outline: none; }
|
|
212
|
+
.tab:hover { background: #e0e0e0; }
|
|
213
|
+
.tab.active { background: #fff; color: #2980b9; font-weight: 600; }
|
|
214
|
+
.tab-content { background: #fff; flex: 1; overflow: auto; padding: 0; }
|
|
215
|
+
iframe { width: 100%; height: 100%; border: none; background: #fff; }
|
|
216
|
+
.warn { color: #b8860b; font-style: italic; font-size: 13px; padding: 12px 20px; }
|
|
217
|
+
.iteration-overview, .task-evolution { margin: 0 20px 16px 20px; }
|
|
218
|
+
.iteration-overview h2, .task-evolution h2 { font-size: 18px; margin: 0 0 10px 0; }
|
|
219
|
+
.iter-overview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
220
|
+
.iter-overview-table th, .iter-overview-table td { border: 1px solid #ddd; padding: 6px 10px; text-align: left; }
|
|
221
|
+
.iter-overview-table th { background: #f5f5f5; font-weight: 600; }
|
|
222
|
+
.iter-overview-table .status-pass { color: #27ae60; font-weight: 600; }
|
|
223
|
+
.iter-overview-table .status-fail { color: #c0392b; font-weight: 600; }
|
|
224
|
+
.evolution-timeline { position: relative; padding-left: 24px; border-left: 2px solid #ddd; }
|
|
225
|
+
.evolution-card { position: relative; margin-bottom: 14px; padding: 10px 14px; background: #f9f9f9; border-radius: 6px; border: 1px solid #eee; }
|
|
226
|
+
.evolution-card::before { content: ''; position: absolute; left: -30px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: #3498db; border: 2px solid #fff; }
|
|
227
|
+
.card-label { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
|
|
228
|
+
.card-text { font-size: 13px; word-break: break-all; white-space: pre-wrap; }
|
|
229
|
+
.evolution-note { color: #7f8c8d; font-style: italic; font-size: 13px; margin: 8px 0 0 0; }
|
|
230
230
|
</style>
|
|
231
231
|
</head>
|
|
232
232
|
<body>
|
|
@@ -234,15 +234,15 @@ function writeLoopSummaryHtml(result, finalReportDir) {
|
|
|
234
234
|
${tabContents.join('')}
|
|
235
235
|
<script>
|
|
236
236
|
function showTab(tabId) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
var contents = document.querySelectorAll('.tab-content');
|
|
238
|
+
for (var i = 0; i < contents.length; i++) { contents[i].style.display = 'none'; }
|
|
239
|
+
var target = document.getElementById(tabId);
|
|
240
|
+
if (target) target.style.display = 'block';
|
|
241
|
+
var tabs = document.querySelectorAll('.tab');
|
|
242
|
+
for (var i = 0; i < tabs.length; i++) {
|
|
243
|
+
tabs[i].classList.remove('active');
|
|
244
|
+
if (tabs[i].getAttribute('onclick') === "showTab('" + tabId + "')") { tabs[i].classList.add('active'); }
|
|
245
|
+
}
|
|
246
246
|
}
|
|
247
247
|
showTab(${defaultTab});
|
|
248
248
|
</script>
|
package/dist/loop/types.d.ts
CHANGED
package/dist/loop/types.js
CHANGED
|
@@ -308,22 +308,22 @@ async function generateHtmlFromJson(data, opts) {
|
|
|
308
308
|
if (g.clickPoint) {
|
|
309
309
|
const [cx, cy] = g.clickPoint;
|
|
310
310
|
if (isDoubleTap) {
|
|
311
|
-
return `<div class="double-tap-marker" style="left:${cx
|
|
311
|
+
return `<div class="double-tap-marker" style="left:${cx * 100}%;top:${cy * 100}%" title="双击: ${cx},${cy}"></div>`;
|
|
312
312
|
}
|
|
313
313
|
if (isLongPress) {
|
|
314
|
-
return `<div class="long-press-marker" style="left:${cx
|
|
314
|
+
return `<div class="long-press-marker" style="left:${cx * 100}%;top:${cy * 100}%" title="长按: ${cx},${cy}"></div>`;
|
|
315
315
|
}
|
|
316
|
-
return `<div class="marker marker-click" style="left:${cx
|
|
316
|
+
return `<div class="marker marker-click" style="left:${cx * 100}%;top:${cy * 100}%" title="点击: ${cx},${cy}"><span class="marker-ring"></span><span class="marker-dot"></span></div>`;
|
|
317
317
|
}
|
|
318
318
|
if (g.swipeStart && g.swipeEnd) {
|
|
319
319
|
const [sx, sy] = g.swipeStart;
|
|
320
320
|
const [ex, ey] = g.swipeEnd;
|
|
321
321
|
const aid = `arrow-${g.step}`;
|
|
322
|
-
return `<div class="marker marker-swipe-start" style="left:${sx
|
|
322
|
+
return `<div class="marker marker-swipe-start" style="left:${sx * 100}%;top:${sy * 100}%" title="起点 ${sx},${sy}"><span class="swipe-label swipe-label-start">起</span></div><div class="marker marker-swipe-end" style="left:${ex * 100}%;top:${ey * 100}%" title="终点 ${ex},${ey}"><span class="swipe-label swipe-label-end">终</span></div><svg class="swipe-line-svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><marker id="${aid}" markerWidth="4" markerHeight="4" refX="3" refY="2" orient="auto"><path d="M0,0 L4,2 L0,4 Z" fill="#10b981"></path></marker></defs><line x1="${sx * 100}" y1="${sy * 100}" x2="${ex * 100}" y2="${ey * 100}" stroke="#10b981" stroke-width="0.8" marker-end="url(#${aid})"></line></svg>`;
|
|
323
323
|
}
|
|
324
324
|
return '';
|
|
325
325
|
};
|
|
326
|
-
const ssHtml = ss.length > 0 ? `<div class="screenshots">${ss.map(s => `<div class="screenshot"><div class="screenshot-label">${s.label}</div><div style="position:relative"><img class="screenshot-img" src="${s.path}" alt="Screenshot" loading="lazy" onclick="openFullscreen(
|
|
326
|
+
const ssHtml = ss.length > 0 ? `<div class="screenshots">${ss.map(s => `<div class="screenshot"><div class="screenshot-label">${s.label}</div><div style="position:relative"><img class="screenshot-img" src="${s.path}" alt="Screenshot" loading="lazy" onclick="openFullscreen(this)">${mk(s)}</div></div>`).join('')}</div>` : '';
|
|
327
327
|
const rb = g.toolResult ? `<div class="section"><div class="section-title result">执行结果</div><div class="event mcp"><div class="event-head"><span class="event-type">状态: 完成</span><span class="event-time">${formatTime(g.toolEndTime)}</span></div><div class="event-data">${escapeHtml(g.toolResult)}</div></div></div>` : '';
|
|
328
328
|
const subAgentHtml = g.hasSubAgent && g.subSteps.length > 0
|
|
329
329
|
? `<div class="subagent-section"><div class="subagent-toggle" onclick="this.parentElement.classList.toggle('subagent-expanded')"><span class="subagent-icon">▼</span> 子 Agent 执行 (${g.subSteps.length} 步)</div><div class="subagent-body">${g.subSteps.map((ssg) => {
|
|
@@ -344,7 +344,7 @@ async function generateHtmlFromJson(data, opts) {
|
|
|
344
344
|
</div>`;
|
|
345
345
|
}).join('\n');
|
|
346
346
|
const frScr = fr.screenshot ? resolveSrc(fr.screenshot) : '';
|
|
347
|
-
const jsc = frScr ? `<div class="judgment-card-right"><div class="judgment-screenshot"><div class="judgment-screenshot-label">判定观察</div><img class="judgment-screenshot-img" src="${frScr}" alt="Screenshot" loading="lazy" onclick="openFullscreen(
|
|
347
|
+
const jsc = frScr ? `<div class="judgment-card-right"><div class="judgment-screenshot"><div class="judgment-screenshot-label">判定观察</div><img class="judgment-screenshot-img" src="${frScr}" alt="Screenshot" loading="lazy" onclick="openFullscreen(this)"></div></div>` : '';
|
|
348
348
|
return `<!DOCTYPE html>
|
|
349
349
|
<html lang="zh-CN">
|
|
350
350
|
<head>
|
|
@@ -509,13 +509,18 @@ var a=-1;for(var i=0;i<cards.length;i++){var r=cards[i].getBoundingClientRect();
|
|
|
509
509
|
if(a>=0){var ni=a+1;if(navs[ni])navs[ni].classList.add('active')}else if(navDetail)navDetail.classList.add('active')
|
|
510
510
|
}
|
|
511
511
|
window.addEventListener('scroll',onScroll);onScroll();
|
|
512
|
-
function openFullscreen(
|
|
512
|
+
function openFullscreen(el){
|
|
513
|
+
var src=typeof el==='string'?el:(el&&el.src?el.src:'');
|
|
513
514
|
var o=document.createElement('div');
|
|
514
515
|
o.style.cssText='position:fixed;top:0;left:0;width:100vw;height:100vh;background:rgba(0,0,0,.9);display:flex;align-items:center;justify-content:center;z-index:9999;cursor:pointer';
|
|
516
|
+
var w=document.createElement('div');
|
|
517
|
+
w.style.cssText='position:relative;display:inline-block;line-height:0';
|
|
515
518
|
var img=document.createElement('img');
|
|
516
519
|
img.src=src;img.style.cssText='display:block;max-width:95vw;max-height:95vh;border-radius:8px';
|
|
517
|
-
|
|
518
|
-
|
|
520
|
+
w.appendChild(img);
|
|
521
|
+
if(el&&el.parentElement){el.parentElement.querySelectorAll('.marker,.swipe-line-svg,.double-tap-marker,.long-press-marker').forEach(function(c){w.appendChild(c.cloneNode(true))})}
|
|
522
|
+
o.appendChild(w);
|
|
523
|
+
o.onclick=function(){o.remove()};
|
|
519
524
|
document.body.appendChild(o)
|
|
520
525
|
}
|
|
521
526
|
</script>
|
|
@@ -429,13 +429,13 @@ function printProgressReport(passCount, failCount, unknownCount, executedCount,
|
|
|
429
429
|
const elapsedSeconds = (Date.now() - startTime.getTime()) / 1000;
|
|
430
430
|
console.log('\n' + '='.repeat(60));
|
|
431
431
|
console.log(`Progress report [executed ${executedCount}/${totalCases}]`);
|
|
432
|
-
console.log(`
|
|
433
|
-
console.log(`
|
|
432
|
+
console.log(` Pass: ${passCount}, Fail: ${failCount}, Unknown: ${unknownCount}`);
|
|
433
|
+
console.log(` Elapsed: ${elapsedSeconds.toFixed(0)}s (${(elapsedSeconds / 60).toFixed(1)} min)`);
|
|
434
434
|
if (executedCount > 0) {
|
|
435
435
|
const avgPerCase = elapsedSeconds / executedCount;
|
|
436
436
|
const remaining = (totalCases - executedCount) * avgPerCase;
|
|
437
437
|
if (remaining > 0) {
|
|
438
|
-
console.log(`
|
|
438
|
+
console.log(` Estimated remaining: ${remaining.toFixed(0)}s (${(remaining / 60).toFixed(1)} min)`);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
console.log('='.repeat(60) + '\n');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Case execution summary HTML report generator.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* Generates a sidebar + panel layout with iframe-embedded phase reports.
|
|
7
7
|
*/
|
|
8
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -107,22 +107,22 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica N
|
|
|
107
107
|
const JS = `
|
|
108
108
|
var currentPanel = 'overview';
|
|
109
109
|
function switchPanel(panelId) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
var cur = document.getElementById('panel-' + currentPanel);
|
|
111
|
+
if (cur) cur.classList.remove('active');
|
|
112
|
+
var next = document.getElementById('panel-' + panelId);
|
|
113
|
+
if (next) next.classList.add('active');
|
|
114
|
+
document.querySelectorAll('.nav-icon').forEach(function(btn) {
|
|
115
|
+
btn.classList.remove('active');
|
|
116
|
+
if (btn.getAttribute('data-panel') === panelId) btn.classList.add('active');
|
|
117
|
+
});
|
|
118
|
+
currentPanel = panelId;
|
|
119
119
|
}
|
|
120
120
|
function toggleSidebar() { document.getElementById('sidebar').classList.toggle('expanded'); }
|
|
121
121
|
document.addEventListener('keydown', function(e) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
var panels = ['overview'];
|
|
123
|
+
document.querySelectorAll('.panel.phase-panel').forEach(function(p) { panels.push(p.id.replace('panel-', '')); });
|
|
124
|
+
var num = parseInt(e.key);
|
|
125
|
+
if (num >= 1 && num <= panels.length) switchPanel(panels[num - 1]);
|
|
126
126
|
});
|
|
127
127
|
`;
|
|
128
128
|
const SVG_OVERVIEW = '<svg viewBox="0 0 24 24"><path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"/></svg>';
|
|
@@ -154,20 +154,20 @@ function buildSidebar(caseInfo, result) {
|
|
|
154
154
|
const passed = result.phaseResults.filter((p) => p.status === 'PASS').length;
|
|
155
155
|
const total = result.phaseResults.length;
|
|
156
156
|
return `
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
157
|
+
<div class="sidebar-top">
|
|
158
|
+
<button class="sidebar-toggle" id="sidebarToggle" onclick="toggleSidebar()" title="Toggle sidebar"><svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><rect y="3" width="24" height="2.5" rx="1.2"/><rect y="10.75" width="24" height="2.5" rx="1.2"/><rect y="18.5" width="24" height="2.5" rx="1.2"/></svg></button>
|
|
159
|
+
<span class="status-dot ${sc}"></span>
|
|
160
|
+
<span class="status-text ${sc}">${escapeHtml(status)}</span>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="sidebar-info">
|
|
163
|
+
<div class="sidebar-info-name">${escapeHtml(caseInfo.caseName)}</div>
|
|
164
|
+
<div class="sidebar-info-id">${escapeHtml(caseInfo.caseId)}</div>
|
|
165
|
+
<div class="sidebar-info-row"><span>Duration</span><span class="val">${result.totalDuration.toFixed(1)}s</span></div>
|
|
166
|
+
<div class="sidebar-info-row"><span>Tokens</span><span class="val">${result.totalTokens.toLocaleString()}</span></div>
|
|
167
|
+
<div class="sidebar-info-row"><span>Phases</span><span class="val">${passed}/${total} passed</span></div>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="sidebar-nav">${navItems.join('')}</div>
|
|
170
|
+
`;
|
|
171
171
|
}
|
|
172
172
|
function buildOverviewPanel(caseInfo, result) {
|
|
173
173
|
const status = result.overallStatus || 'UNKNOWN';
|
|
@@ -181,37 +181,37 @@ function buildOverviewPanel(caseInfo, result) {
|
|
|
181
181
|
phaseRows += `<div class="info-row"><span class="info-label">${escapeHtml(label)}</span><span class="info-value" style="color:${color}">${escapeHtml(p.status)} (${p.durationSeconds.toFixed(1)}s)</span></div>`;
|
|
182
182
|
}
|
|
183
183
|
return `
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
184
|
+
<div id="panel-overview" class="panel overview-panel active">
|
|
185
|
+
<div class="overview-header">
|
|
186
|
+
<div>
|
|
187
|
+
<h1>${escapeHtml(caseInfo.caseName)}</h1>
|
|
188
|
+
<div class="subtitle">Case ID: ${escapeHtml(caseInfo.caseId)} | ${escapeHtml(result.startTime)} ~ ${escapeHtml(result.endTime)}</div>
|
|
189
|
+
</div>
|
|
190
|
+
<span class="status-badge ${sc}">${escapeHtml(status)}</span>
|
|
191
|
+
</div>
|
|
192
|
+
<div class="info-grid">
|
|
193
|
+
<div class="info-card">
|
|
194
|
+
<h3>Case Info</h3>
|
|
195
|
+
<div class="info-row"><span class="info-label">Case ID</span><span class="info-value">${escapeHtml(caseInfo.caseId)}</span></div>
|
|
196
|
+
<div class="info-row"><span class="info-label">Case Name</span><span class="info-value">${escapeHtml(caseInfo.caseName)}</span></div>
|
|
197
|
+
<div class="info-row"><span class="info-label">Applications</span><span class="info-value"><div class="app-list">${appTags}</div></span></div>
|
|
198
|
+
<div class="info-row"><span class="info-label">Extend Tools</span><span class="info-value">${caseInfo.extendTools.length ? escapeHtml(caseInfo.extendTools.join(', ')) : 'None'}</span></div>
|
|
199
|
+
</div>
|
|
200
|
+
<div class="info-card">
|
|
201
|
+
<h3>Execution Summary</h3>
|
|
202
|
+
<div class="info-row"><span class="info-label">Duration</span><span class="info-value">${result.totalDuration.toFixed(1)}s</span></div>
|
|
203
|
+
<div class="info-row"><span class="info-label">Total Tokens</span><span class="info-value">${result.totalTokens.toLocaleString()}</span></div>
|
|
204
|
+
${phaseRows}
|
|
205
|
+
</div>
|
|
206
|
+
<div class="info-card">
|
|
207
|
+
<h3>Device Info</h3>
|
|
208
|
+
<div class="info-row"><span class="info-label">Device Type</span><span class="info-value">${escapeHtml(result.deviceType)}</span></div>
|
|
209
|
+
<div class="info-row"><span class="info-label">Device SN</span><span class="info-value">${escapeHtml(result.deviceSn || 'N/A')}</span></div>
|
|
210
|
+
<div class="info-row"><span class="info-label">Start Time</span><span class="info-value">${escapeHtml(result.startTime)}</span></div>
|
|
211
|
+
<div class="info-row"><span class="info-label">End Time</span><span class="info-value">${escapeHtml(result.endTime)}</span></div>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</div>`;
|
|
215
215
|
}
|
|
216
216
|
function buildPhasePanels(result, reportDir) {
|
|
217
217
|
const panels = [];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Structured case runner with setup/process/teardown phase execution.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* Uses AgentAPIImpl (Node.js) instead of
|
|
4
|
+
*
|
|
5
|
+
* Uses AgentAPIImpl (Node.js) instead of HybridAgent/DeviceToolManager.
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
|
-
*
|
|
8
|
+
* node dist/tools/case_runner.js --case case.json [--config config.yaml] [--report-dir reports/]
|
|
9
9
|
*/
|
|
10
10
|
export interface PhaseResult {
|
|
11
11
|
name: string;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Structured case runner with setup/process/teardown phase execution.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* Uses AgentAPIImpl (Node.js) instead of
|
|
5
|
+
*
|
|
6
|
+
* Uses AgentAPIImpl (Node.js) instead of HybridAgent/DeviceToolManager.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
*
|
|
9
|
+
* node dist/tools/case_runner.js --case case.json [--config config.yaml] [--report-dir reports/]
|
|
10
10
|
*/
|
|
11
11
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
12
|
if (k2 === undefined) k2 = k;
|
|
@@ -330,13 +330,13 @@ class CaseRunner {
|
|
|
330
330
|
logger_1.logger.info(`\n${'='.repeat(60)}`);
|
|
331
331
|
logger_1.logger.info(`Case Execution Summary`);
|
|
332
332
|
logger_1.logger.info(`${'='.repeat(60)}`);
|
|
333
|
-
logger_1.logger.info(`
|
|
334
|
-
logger_1.logger.info(`
|
|
335
|
-
logger_1.logger.info(`
|
|
336
|
-
logger_1.logger.info(`
|
|
333
|
+
logger_1.logger.info(` Case: ${result.caseId} - ${result.caseName}`);
|
|
334
|
+
logger_1.logger.info(` Status: ${result.overallStatus}`);
|
|
335
|
+
logger_1.logger.info(` Duration: ${result.totalDuration.toFixed(1)}s`);
|
|
336
|
+
logger_1.logger.info(` Total Tokens: ${result.totalTokens}`);
|
|
337
337
|
for (const p of result.phaseResults) {
|
|
338
338
|
const icon = p.status === 'PASS' ? 'PASS' : p.status === 'FAIL' || p.status === 'ERROR' ? 'FAIL' : p.status;
|
|
339
|
-
logger_1.logger.info(`
|
|
339
|
+
logger_1.logger.info(` [${icon}] ${p.name}: ${p.status} (${p.durationSeconds.toFixed(1)}s)`);
|
|
340
340
|
}
|
|
341
341
|
logger_1.logger.info(`${'='.repeat(60)}`);
|
|
342
342
|
// Generate summary HTML
|