@autotest/agent 0.0.6 → 0.0.8
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 +7 -0
- package/dist/.buildstamp +1 -0
- package/dist/api/agent_api.d.ts +2 -2
- package/dist/autotest-cli.js +1 -397
- package/dist/common/config/config.yaml +4 -0
- package/dist/common/config/manager.d.ts +4 -4
- package/dist/common/config/types.d.ts +5 -0
- package/dist/common/dfx/index.d.ts +1 -1
- package/dist/core/agent/single_agent/agent.d.ts +1 -0
- package/dist/core/device/device_protocol.d.ts +1 -1
- package/dist/core/device/hdc/device.d.ts +5 -2
- package/dist/core/knowledge/knowledge_manager.d.ts +3 -3
- package/dist/core/knowledge/vectordb.d.ts +5 -5
- package/dist/core/mcp/harmony_hdc_adapter.d.ts +2 -0
- package/dist/core/mcp/mcp_tools.d.ts +1 -0
- package/dist/core/mcp/verify_tool.d.ts +12 -0
- package/dist/core/prompt/templates/single/single_v2.0.md +15 -0
- package/dist/data_types/device.d.ts +1 -1
- package/dist/data_types/index.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -163
- package/dist/tools/batch_runner.js +1 -745
- package/dist/tools/case_runner/runner.js +1 -410
- package/dist/tools/config/config_tool.js +1 -339
- package/dist/tools/prompt_compare/compare_runner.js +1 -360
- package/package.json +2 -2
- package/dist/api/agent_api.js +0 -550
- package/dist/api/autotest_agent.js +0 -205
- package/dist/api/types.js +0 -11
- package/dist/common/case_manager.js +0 -91
- package/dist/common/collect_case.js +0 -128
- package/dist/common/common_errors.js +0 -66
- package/dist/common/config/config_validator.js +0 -28
- package/dist/common/config/manager.js +0 -257
- package/dist/common/config/output.js +0 -59
- package/dist/common/config/types.js +0 -185
- package/dist/common/dfx/client_factory.js +0 -62
- package/dist/common/dfx/context.js +0 -23
- package/dist/common/dfx/index.js +0 -15
- package/dist/common/dfx/recorder.js +0 -191
- package/dist/common/dfx/recording_fetch.js +0 -228
- package/dist/common/dfx/source.js +0 -13
- package/dist/common/image_cacher.js +0 -36
- package/dist/common/image_helper.js +0 -128
- package/dist/common/image_similarity.js +0 -171
- package/dist/common/llm_cache/cache_transport.js +0 -102
- package/dist/common/llm_cache/prompt_cache.js +0 -113
- package/dist/common/logger.js +0 -158
- package/dist/common/model/custom_model.js +0 -487
- package/dist/common/model/index.js +0 -5
- package/dist/common/path_utils.js +0 -88
- package/dist/common/result_parser.js +0 -49
- package/dist/common/usage/token_usage.js +0 -117
- package/dist/common/utils.js +0 -125
- package/dist/core/agent/layered_agent/ability_helper.js +0 -125
- package/dist/core/agent/layered_agent/agent.js +0 -37
- package/dist/core/agent/layered_agent/agent_registry.js +0 -82
- package/dist/core/agent/layered_agent/decision.js +0 -518
- package/dist/core/agent/layered_agent/execute_agent/action_handler.js +0 -155
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.js +0 -41
- package/dist/core/agent/layered_agent/execute_agent/base_agent.js +0 -112
- package/dist/core/agent/layered_agent/execute_agent/general_agent.js +0 -207
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.js +0 -241
- package/dist/core/agent/layered_agent/execute_agent/i18n.js +0 -34
- package/dist/core/agent/layered_agent/execute_agent/index.js +0 -67
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js +0 -316
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +0 -154
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js +0 -243
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js +0 -139
- package/dist/core/agent/layered_agent/execute_agent/parser/index.js +0 -9
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js +0 -94
- package/dist/core/agent/layered_agent/execute_agent/prompts.js +0 -109
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js +0 -33
- package/dist/core/agent/layered_agent/execute_agent/utils.js +0 -52
- package/dist/core/agent/report_analyzer_agent/agent.js +0 -565
- package/dist/core/agent/report_analyzer_agent/config.js +0 -22
- package/dist/core/agent/report_analyzer_agent/data_loader.js +0 -255
- package/dist/core/agent/report_analyzer_agent/guardrails.js +0 -99
- package/dist/core/agent/report_analyzer_agent/hooks.js +0 -31
- package/dist/core/agent/report_analyzer_agent/index.js +0 -52
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.js +0 -42
- package/dist/core/agent/report_analyzer_agent/mapping.js +0 -133
- package/dist/core/agent/report_analyzer_agent/parse.js +0 -375
- package/dist/core/agent/report_analyzer_agent/prompt.js +0 -300
- package/dist/core/agent/report_analyzer_agent/report_writer.js +0 -558
- package/dist/core/agent/report_analyzer_agent/tools.js +0 -150
- package/dist/core/agent/report_analyzer_agent/types.js +0 -274
- package/dist/core/agent/rewrite_agent/agent.js +0 -209
- package/dist/core/agent/rewrite_agent/guardrails.js +0 -95
- package/dist/core/agent/rewrite_agent/mapping.js +0 -56
- package/dist/core/agent/rewrite_agent/parse.js +0 -121
- package/dist/core/agent/rewrite_agent/types.js +0 -37
- package/dist/core/agent/single_agent/agent.js +0 -801
- package/dist/core/agent/single_agent/hook_manager.js +0 -59
- package/dist/core/agent/single_agent/hooks.js +0 -288
- package/dist/core/agent/single_agent/image_utils.js +0 -158
- package/dist/core/agent/single_agent/scroll_search_agent.js +0 -405
- package/dist/core/agent/single_agent/subagent_manager.js +0 -72
- package/dist/core/agent/single_agent/tool_recorder_hook.js +0 -42
- package/dist/core/agent/types.js +0 -2
- package/dist/core/agent/utils/message_builder.js +0 -138
- package/dist/core/device/device_protocol.js +0 -2
- package/dist/core/device/hdc/apps.js +0 -437
- package/dist/core/device/hdc/device.js +0 -219
- package/dist/core/device/hdc/index.js +0 -31
- package/dist/core/device/hdc/input.js +0 -74
- package/dist/core/device/hdc/screenshot.js +0 -171
- package/dist/core/device/index.js +0 -70
- package/dist/core/device/types.js +0 -2
- package/dist/core/knowledge/knowledge_manager.js +0 -70
- package/dist/core/knowledge/vectordb.js +0 -283
- package/dist/core/mcp/adapter_factory.js +0 -99
- package/dist/core/mcp/android_adapter.js +0 -286
- package/dist/core/mcp/base_adapter.js +0 -86
- package/dist/core/mcp/harmony_hdc_adapter.js +0 -798
- package/dist/core/mcp/ios_adapter.js +0 -286
- package/dist/core/mcp/local_tools.js +0 -41
- package/dist/core/mcp/mcp_tools.js +0 -473
- package/dist/core/mcp/types.js +0 -6
- package/dist/core/memory/_utils.js +0 -140
- package/dist/core/memory/compressed_session.js +0 -182
- package/dist/core/memory/context_compressor.js +0 -176
- package/dist/core/memory/index.js +0 -22
- package/dist/core/memory/memory_manager.js +0 -28
- package/dist/core/memory/reflector.js +0 -95
- package/dist/core/memory/replan_manager.js +0 -12
- package/dist/core/memory/session_factory.js +0 -29
- package/dist/core/memory/tool_player.js +0 -225
- package/dist/core/memory/tool_player_popup.js +0 -276
- package/dist/core/memory/tool_player_replan.js +0 -226
- package/dist/core/memory/tool_player_xpath.js +0 -139
- package/dist/core/memory/tool_recorder.js +0 -126
- package/dist/core/preprocessor/task_splitter.js +0 -112
- package/dist/core/prompt/prompt_loader.js +0 -315
- package/dist/core/skill/skill_manager.js +0 -302
- package/dist/data_types/action.js +0 -2
- package/dist/data_types/agent.js +0 -2
- package/dist/data_types/case.js +0 -57
- package/dist/data_types/device.js +0 -2
- package/dist/data_types/index.js +0 -11
- package/dist/data_types/report.js +0 -6
- package/dist/data_types/screen.js +0 -23
- package/dist/data_types/task.js +0 -2
- package/dist/loop/cli.js +0 -127
- package/dist/loop/orchestrator.js +0 -314
- package/dist/loop/result_writer.js +0 -260
- package/dist/loop/types.js +0 -82
- package/dist/mcp-server/server.js +0 -341
- package/dist/mcp-server/types.js +0 -224
- package/dist/reporter/batch_summary.js +0 -197
- package/dist/reporter/generator.js +0 -286
- package/dist/reporter/html_template/index.js +0 -529
- package/dist/reporter/json_report.js +0 -6
- package/dist/reporter/types.js +0 -45
- package/dist/tools/case_runner/report.js +0 -264
|
@@ -6,10 +6,10 @@ export declare class ConfigManager {
|
|
|
6
6
|
loadYamlFile(filePath: string): void;
|
|
7
7
|
loadDefaultConfig(): void;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
* Layer 4: Load a --config override file (highest priority,
|
|
10
|
+
* ConfigManager Layer 4). Merges after loadDefaultConfig, prints loaded file,
|
|
11
|
+
* and validates.
|
|
12
|
+
*/
|
|
13
13
|
loadFileConfig(configFile: string): void;
|
|
14
14
|
private convertKeysToCamel;
|
|
15
15
|
deepMerge<T extends Record<string, unknown>>(target: T, source: Record<string, unknown>): T;
|
|
@@ -2276,6 +2276,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2276
2276
|
deviceImpl: z.ZodDefault<z.ZodString>;
|
|
2277
2277
|
appConfig: z.ZodDefault<z.ZodString>;
|
|
2278
2278
|
operationMode: z.ZodDefault<z.ZodEnum<["phone", "pc"]>>;
|
|
2279
|
+
keepaliveProcessWhitelist: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2279
2280
|
}, "strip", z.ZodTypeAny, {
|
|
2280
2281
|
deviceSn?: string;
|
|
2281
2282
|
ip?: string;
|
|
@@ -2286,6 +2287,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2286
2287
|
deviceImpl?: string;
|
|
2287
2288
|
appConfig?: string;
|
|
2288
2289
|
operationMode?: "phone" | "pc";
|
|
2290
|
+
keepaliveProcessWhitelist?: string[];
|
|
2289
2291
|
}, {
|
|
2290
2292
|
deviceSn?: string;
|
|
2291
2293
|
ip?: string;
|
|
@@ -2296,6 +2298,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2296
2298
|
deviceImpl?: string;
|
|
2297
2299
|
appConfig?: string;
|
|
2298
2300
|
operationMode?: "phone" | "pc";
|
|
2301
|
+
keepaliveProcessWhitelist?: string[];
|
|
2299
2302
|
}>>;
|
|
2300
2303
|
network: z.ZodDefault<z.ZodObject<{
|
|
2301
2304
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
@@ -2433,6 +2436,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2433
2436
|
deviceImpl?: string;
|
|
2434
2437
|
appConfig?: string;
|
|
2435
2438
|
operationMode?: "phone" | "pc";
|
|
2439
|
+
keepaliveProcessWhitelist?: string[];
|
|
2436
2440
|
};
|
|
2437
2441
|
reflection?: {
|
|
2438
2442
|
enabled?: boolean;
|
|
@@ -2714,6 +2718,7 @@ export declare const AppConfigSchema: z.ZodObject<{
|
|
|
2714
2718
|
deviceImpl?: string;
|
|
2715
2719
|
appConfig?: string;
|
|
2716
2720
|
operationMode?: "phone" | "pc";
|
|
2721
|
+
keepaliveProcessWhitelist?: string[];
|
|
2717
2722
|
};
|
|
2718
2723
|
reflection?: {
|
|
2719
2724
|
enabled?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { LLMTrafficRecorder, type LLMTrafficRecord, type RecordParams, type RecordQueryOptions
|
|
1
|
+
export { LLMTrafficRecorder, type LLMTrafficRecord, type RecordParams, type RecordQueryOptions } from './recorder';
|
|
2
2
|
export { createRecordingFetch, type FetchLike } from './recording_fetch';
|
|
3
3
|
export { setStepNumber, getStepNumber, clearStepNumber } from './context';
|
|
4
4
|
export { RecordingSource } from './source';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DeviceProtocol, Screenshot, ToolDefine, ToolCallResult } from './types';
|
|
2
|
-
export type { DeviceProtocol, Screenshot, ToolDefine, ToolCallResult
|
|
2
|
+
export type { DeviceProtocol, Screenshot, ToolDefine, ToolCallResult };
|
|
@@ -36,8 +36,11 @@ export declare function getCurrentApp(driver: HdcDriver, returnDisplayName?: boo
|
|
|
36
36
|
export declare function tap(driver: HdcDriver, x: number, y: number, delay?: number | null): Promise<void>;
|
|
37
37
|
/** Double tap at the specified coordinates. */
|
|
38
38
|
export declare function doubleTap(driver: HdcDriver, x: number, y: number, delay?: number | null): Promise<void>;
|
|
39
|
-
/** Long press at the specified coordinates.
|
|
40
|
-
|
|
39
|
+
/** Long press at the specified coordinates.
|
|
40
|
+
* Always uses uinput (not uitest) so we can capture a screenshot
|
|
41
|
+
* while the finger is still pressing down (toast/indicator appears during press,
|
|
42
|
+
* disappears on release). */
|
|
43
|
+
export declare function longPress(driver: HdcDriver, x: number, y: number, durationMs?: number, delay?: number | null, onBeforeRelease?: () => Promise<void>): Promise<void>;
|
|
41
44
|
/** Swipe from start to end coordinates. */
|
|
42
45
|
export declare function swipe(driver: HdcDriver, startX: number, startY: number, endX: number, endY: number, durationMs?: number | null, delay?: number | null): Promise<void>;
|
|
43
46
|
/** Press the back button. */
|
|
@@ -7,9 +7,9 @@ declare class KnowledgeManagerImpl {
|
|
|
7
7
|
search(query: string, topK?: number): Promise<string[]>;
|
|
8
8
|
addDocument(doc: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
* Incremental single-doc write.
|
|
11
|
+
* Delegates to LanceDBManager.addSingle (non-destructive + jsonl fallback).
|
|
12
|
+
*/
|
|
13
13
|
writeKnowledge(doc: {
|
|
14
14
|
text: string;
|
|
15
15
|
category?: string;
|
|
@@ -26,11 +26,11 @@ export declare class LanceDBManager {
|
|
|
26
26
|
insertDocuments(docs: KnowledgeDoc[]): void;
|
|
27
27
|
addDocument(doc: KnowledgeDoc): void;
|
|
28
28
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
* Incremental single-doc write.
|
|
30
|
+
* Non-destructive: appends to the in-memory store (dedup by text) without
|
|
31
|
+
* clobbering existing records. Falls back to appending a `_pending.jsonl`
|
|
32
|
+
* line when persistence fails, so records are never lost.
|
|
33
|
+
*/
|
|
34
34
|
addSingle(doc: KnowledgeDoc): void;
|
|
35
35
|
/** Append a single doc to `_pending.jsonl` (crash-safe fallback). */
|
|
36
36
|
private _writeJsonlFallback;
|
|
@@ -24,6 +24,8 @@ export declare class HarmonyHdcAdapter extends MCPDeviceAdapterBase {
|
|
|
24
24
|
private readonly deviceResetDevice;
|
|
25
25
|
private readonly deviceScreenAlwaysOn;
|
|
26
26
|
private readonly deviceOperationMode;
|
|
27
|
+
private readonly keepaliveWhitelist;
|
|
28
|
+
onLongPressScreenshot: (() => Promise<void>) | null;
|
|
27
29
|
private toastListener;
|
|
28
30
|
private toastBuffer;
|
|
29
31
|
private toastListening;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verify tool — ported from Python verify_impl.py + verify_assertions.py.
|
|
3
|
+
*
|
|
4
|
+
* Based on historical screenshots, uses a sub-LLM to:
|
|
5
|
+
* 1. Select the right assertion method (one_image_assert / multi_image_assert)
|
|
6
|
+
* 2. Execute the assertion (call LLM with 1 or 2 images)
|
|
7
|
+
* 3. Return {result: bool, reason: string}
|
|
8
|
+
*
|
|
9
|
+
* No video_assert (Node.js has no screen recording).
|
|
10
|
+
* For toast/提示/弹出 keywords, uses multi_image_assert (before/after comparison).
|
|
11
|
+
*/
|
|
12
|
+
export declare function executeVerify(description: string): Promise<string>;
|
|
@@ -299,6 +299,21 @@ y:0-0.20 │ (1,1) │ (1,2) │ (1,3) │ (1,4) │ (1,5) │
|
|
|
299
299
|
|
|
300
300
|
仅处理真正遮挡界面操作的弹窗,用户发布的图片、内容卡片中的弹窗不要处理,不要被干扰。
|
|
301
301
|
|
|
302
|
+
### Toast/提示验证规则
|
|
303
|
+
|
|
304
|
+
当任务需要验证 toast 提示、弹窗提示、短暂出现又消失的动态元素时(如"验证是否出现toast提示点赞成功"):
|
|
305
|
+
- **禁止**仅靠截图观察 toast(toast 显示时间极短,截图通常抓不到)
|
|
306
|
+
- **必须**调用 verify 工具进行验证,verify 会对比操作前后的截图来判断 toast 是否出现
|
|
307
|
+
- 调用方式:verify("验证是否出现toast提示点赞成功")
|
|
308
|
+
|
|
309
|
+
### verify 工具结果使用规则(严格遵守)
|
|
310
|
+
|
|
311
|
+
verify 工具返回 JSON:`{"result": true/false, "reason": "..."}`
|
|
312
|
+
- **result: true** 表示验证通过(检测到了预期元素),判定结果必须与 verify 一致
|
|
313
|
+
- **result: false** 表示验证不通过(未检测到预期元素),判定结果必须与 verify 一致
|
|
314
|
+
- **禁止**无视 verify 的 result 字段,仅凭自己的截图观察做判断
|
|
315
|
+
- **禁止**根据 verify 的 reason 文本自行解读是否通过,只看 result 字段
|
|
316
|
+
- 如果 result 为 true 但你在当前截图中看不到 toast,仍然判定为通过(toast 已消失是正常的)
|
|
302
317
|
|
|
303
318
|
## 【提醒】子agent调用规则
|
|
304
319
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type Screenshot, type ToolDefine, type ToolCallResult
|
|
1
|
+
export { type Screenshot, type ToolDefine, type ToolCallResult } from '../core/device/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type Screenshot, type ToolDefine, type ToolCallResult
|
|
1
|
+
export { type Screenshot, type ToolDefine, type ToolCallResult } from './device';
|
|
2
2
|
export { type ActionResult, type StepResult } from './action';
|
|
3
3
|
export { EventType, ReportEventSchema, type ReportEvent } from './report';
|
|
4
4
|
export { type TokenUsage } from './task';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { AgentError, LLMNotFollowRuleError, AgentErrorRecoverableMap, AgentErrorSuggestedActionsMap, type AgentErrorCode } from './common/common_errors';
|
|
1
|
+
export { AgentError, LLMNotFollowRuleError, AgentErrorRecoverableMap, AgentErrorSuggestedActionsMap, type AgentErrorCode, } from './common/common_errors';
|
|
2
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
|
-
export { type Screenshot, type ToolDefine, type ToolCallResult, type DeviceProtocol
|
|
5
|
+
export { type Screenshot, type ToolDefine, type ToolCallResult, type DeviceProtocol } from './core/device/types';
|
|
6
6
|
export { MockDevice, createDevice, type CreateDeviceOptions } from './core/device';
|
|
7
|
-
export { type DevicePlatform, type ServiceHealth, MCPDeviceAdapter
|
|
7
|
+
export { type DevicePlatform, type ServiceHealth, MCPDeviceAdapter } from './core/mcp/types';
|
|
8
8
|
export { MCPDeviceAdapterBase } from './core/mcp/base_adapter';
|
|
9
9
|
export { HarmonyHdcAdapter } from './core/mcp/harmony_hdc_adapter';
|
|
10
10
|
export { AndroidMCPAdapter } from './core/mcp/android_adapter';
|
|
@@ -24,7 +24,7 @@ export { ToolRecorderHook } from './core/agent/single_agent/tool_recorder_hook';
|
|
|
24
24
|
export { hookManager, type AgentHook, type HookContext } from './core/agent/single_agent/hook_manager';
|
|
25
25
|
export { LayeredAgent } from './core/agent/layered_agent/agent';
|
|
26
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';
|
|
27
|
+
export type { AnalyzerConfig as ReportAnalyzerConfig, ReportData as AgentReportData, } from './core/agent/report_analyzer_agent';
|
|
28
28
|
export { PromptCategory, load, clearCache, getAvailableVersions, getPromptVersions, listAllPrompts, DEFAULT_VERSIONS, } from './core/prompt/prompt_loader';
|
|
29
29
|
export { McpServerImpl } from './mcp-server/server';
|
|
30
30
|
export { logger, configureLogger, setLogFile, type LoggerConfig } from './common/logger';
|