@autotest/agent 0.0.6 → 0.0.7

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.
Files changed (153) hide show
  1. package/README.md +7 -0
  2. package/dist/api/agent_api.d.ts +2 -2
  3. package/dist/autotest-cli.js +1 -397
  4. package/dist/common/config/config.yaml +4 -0
  5. package/dist/common/config/manager.d.ts +4 -4
  6. package/dist/common/config/types.d.ts +5 -0
  7. package/dist/common/dfx/index.d.ts +1 -1
  8. package/dist/core/agent/single_agent/agent.d.ts +1 -0
  9. package/dist/core/device/device_protocol.d.ts +1 -1
  10. package/dist/core/knowledge/knowledge_manager.d.ts +3 -3
  11. package/dist/core/knowledge/vectordb.d.ts +5 -5
  12. package/dist/core/mcp/harmony_hdc_adapter.d.ts +1 -0
  13. package/dist/core/mcp/mcp_tools.d.ts +1 -0
  14. package/dist/core/mcp/verify_tool.d.ts +12 -0
  15. package/dist/core/prompt/templates/single/single_v2.0.md +15 -0
  16. package/dist/data_types/device.d.ts +1 -1
  17. package/dist/data_types/index.d.ts +1 -1
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +1 -163
  20. package/dist/tools/batch_runner.js +1 -745
  21. package/dist/tools/case_runner/runner.js +1 -410
  22. package/dist/tools/config/config_tool.js +1 -339
  23. package/dist/tools/prompt_compare/compare_runner.js +1 -360
  24. package/package.json +2 -2
  25. package/dist/api/agent_api.js +0 -550
  26. package/dist/api/autotest_agent.js +0 -205
  27. package/dist/api/types.js +0 -11
  28. package/dist/common/case_manager.js +0 -91
  29. package/dist/common/collect_case.js +0 -128
  30. package/dist/common/common_errors.js +0 -66
  31. package/dist/common/config/config_validator.js +0 -28
  32. package/dist/common/config/manager.js +0 -257
  33. package/dist/common/config/output.js +0 -59
  34. package/dist/common/config/types.js +0 -185
  35. package/dist/common/dfx/client_factory.js +0 -62
  36. package/dist/common/dfx/context.js +0 -23
  37. package/dist/common/dfx/index.js +0 -15
  38. package/dist/common/dfx/recorder.js +0 -191
  39. package/dist/common/dfx/recording_fetch.js +0 -228
  40. package/dist/common/dfx/source.js +0 -13
  41. package/dist/common/image_cacher.js +0 -36
  42. package/dist/common/image_helper.js +0 -128
  43. package/dist/common/image_similarity.js +0 -171
  44. package/dist/common/llm_cache/cache_transport.js +0 -102
  45. package/dist/common/llm_cache/prompt_cache.js +0 -113
  46. package/dist/common/logger.js +0 -158
  47. package/dist/common/model/custom_model.js +0 -487
  48. package/dist/common/model/index.js +0 -5
  49. package/dist/common/path_utils.js +0 -88
  50. package/dist/common/result_parser.js +0 -49
  51. package/dist/common/usage/token_usage.js +0 -117
  52. package/dist/common/utils.js +0 -125
  53. package/dist/core/agent/layered_agent/ability_helper.js +0 -125
  54. package/dist/core/agent/layered_agent/agent.js +0 -37
  55. package/dist/core/agent/layered_agent/agent_registry.js +0 -82
  56. package/dist/core/agent/layered_agent/decision.js +0 -518
  57. package/dist/core/agent/layered_agent/execute_agent/action_handler.js +0 -155
  58. package/dist/core/agent/layered_agent/execute_agent/agent_factory.js +0 -41
  59. package/dist/core/agent/layered_agent/execute_agent/base_agent.js +0 -112
  60. package/dist/core/agent/layered_agent/execute_agent/general_agent.js +0 -207
  61. package/dist/core/agent/layered_agent/execute_agent/glm_agent.js +0 -241
  62. package/dist/core/agent/layered_agent/execute_agent/i18n.js +0 -34
  63. package/dist/core/agent/layered_agent/execute_agent/index.js +0 -67
  64. package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js +0 -316
  65. package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +0 -154
  66. package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js +0 -243
  67. package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js +0 -139
  68. package/dist/core/agent/layered_agent/execute_agent/parser/index.js +0 -9
  69. package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js +0 -94
  70. package/dist/core/agent/layered_agent/execute_agent/prompts.js +0 -109
  71. package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js +0 -33
  72. package/dist/core/agent/layered_agent/execute_agent/utils.js +0 -52
  73. package/dist/core/agent/report_analyzer_agent/agent.js +0 -565
  74. package/dist/core/agent/report_analyzer_agent/config.js +0 -22
  75. package/dist/core/agent/report_analyzer_agent/data_loader.js +0 -255
  76. package/dist/core/agent/report_analyzer_agent/guardrails.js +0 -99
  77. package/dist/core/agent/report_analyzer_agent/hooks.js +0 -31
  78. package/dist/core/agent/report_analyzer_agent/index.js +0 -52
  79. package/dist/core/agent/report_analyzer_agent/key_steps_builder.js +0 -42
  80. package/dist/core/agent/report_analyzer_agent/mapping.js +0 -133
  81. package/dist/core/agent/report_analyzer_agent/parse.js +0 -375
  82. package/dist/core/agent/report_analyzer_agent/prompt.js +0 -300
  83. package/dist/core/agent/report_analyzer_agent/report_writer.js +0 -558
  84. package/dist/core/agent/report_analyzer_agent/tools.js +0 -150
  85. package/dist/core/agent/report_analyzer_agent/types.js +0 -274
  86. package/dist/core/agent/rewrite_agent/agent.js +0 -209
  87. package/dist/core/agent/rewrite_agent/guardrails.js +0 -95
  88. package/dist/core/agent/rewrite_agent/mapping.js +0 -56
  89. package/dist/core/agent/rewrite_agent/parse.js +0 -121
  90. package/dist/core/agent/rewrite_agent/types.js +0 -37
  91. package/dist/core/agent/single_agent/agent.js +0 -801
  92. package/dist/core/agent/single_agent/hook_manager.js +0 -59
  93. package/dist/core/agent/single_agent/hooks.js +0 -288
  94. package/dist/core/agent/single_agent/image_utils.js +0 -158
  95. package/dist/core/agent/single_agent/scroll_search_agent.js +0 -405
  96. package/dist/core/agent/single_agent/subagent_manager.js +0 -72
  97. package/dist/core/agent/single_agent/tool_recorder_hook.js +0 -42
  98. package/dist/core/agent/types.js +0 -2
  99. package/dist/core/agent/utils/message_builder.js +0 -138
  100. package/dist/core/device/device_protocol.js +0 -2
  101. package/dist/core/device/hdc/apps.js +0 -437
  102. package/dist/core/device/hdc/device.js +0 -219
  103. package/dist/core/device/hdc/index.js +0 -31
  104. package/dist/core/device/hdc/input.js +0 -74
  105. package/dist/core/device/hdc/screenshot.js +0 -171
  106. package/dist/core/device/index.js +0 -70
  107. package/dist/core/device/types.js +0 -2
  108. package/dist/core/knowledge/knowledge_manager.js +0 -70
  109. package/dist/core/knowledge/vectordb.js +0 -283
  110. package/dist/core/mcp/adapter_factory.js +0 -99
  111. package/dist/core/mcp/android_adapter.js +0 -286
  112. package/dist/core/mcp/base_adapter.js +0 -86
  113. package/dist/core/mcp/harmony_hdc_adapter.js +0 -798
  114. package/dist/core/mcp/ios_adapter.js +0 -286
  115. package/dist/core/mcp/local_tools.js +0 -41
  116. package/dist/core/mcp/mcp_tools.js +0 -473
  117. package/dist/core/mcp/types.js +0 -6
  118. package/dist/core/memory/_utils.js +0 -140
  119. package/dist/core/memory/compressed_session.js +0 -182
  120. package/dist/core/memory/context_compressor.js +0 -176
  121. package/dist/core/memory/index.js +0 -22
  122. package/dist/core/memory/memory_manager.js +0 -28
  123. package/dist/core/memory/reflector.js +0 -95
  124. package/dist/core/memory/replan_manager.js +0 -12
  125. package/dist/core/memory/session_factory.js +0 -29
  126. package/dist/core/memory/tool_player.js +0 -225
  127. package/dist/core/memory/tool_player_popup.js +0 -276
  128. package/dist/core/memory/tool_player_replan.js +0 -226
  129. package/dist/core/memory/tool_player_xpath.js +0 -139
  130. package/dist/core/memory/tool_recorder.js +0 -126
  131. package/dist/core/preprocessor/task_splitter.js +0 -112
  132. package/dist/core/prompt/prompt_loader.js +0 -315
  133. package/dist/core/skill/skill_manager.js +0 -302
  134. package/dist/data_types/action.js +0 -2
  135. package/dist/data_types/agent.js +0 -2
  136. package/dist/data_types/case.js +0 -57
  137. package/dist/data_types/device.js +0 -2
  138. package/dist/data_types/index.js +0 -11
  139. package/dist/data_types/report.js +0 -6
  140. package/dist/data_types/screen.js +0 -23
  141. package/dist/data_types/task.js +0 -2
  142. package/dist/loop/cli.js +0 -127
  143. package/dist/loop/orchestrator.js +0 -314
  144. package/dist/loop/result_writer.js +0 -260
  145. package/dist/loop/types.js +0 -82
  146. package/dist/mcp-server/server.js +0 -341
  147. package/dist/mcp-server/types.js +0 -224
  148. package/dist/reporter/batch_summary.js +0 -197
  149. package/dist/reporter/generator.js +0 -286
  150. package/dist/reporter/html_template/index.js +0 -529
  151. package/dist/reporter/json_report.js +0 -6
  152. package/dist/reporter/types.js +0 -45
  153. package/dist/tools/case_runner/report.js +0 -264
@@ -103,6 +103,10 @@ device:
103
103
  device_impl: "HDCDevice"
104
104
  app_config: ""
105
105
  operation_mode: "phone"
106
+ keepalive_process_whitelist: []
107
+ # keepalive_process_whitelist:
108
+ # - "com.hmos.xxx"
109
+ # - "com.example.xxx"
106
110
 
107
111
  network:
108
112
  timeout: 600
@@ -6,10 +6,10 @@ export declare class ConfigManager {
6
6
  loadYamlFile(filePath: string): void;
7
7
  loadDefaultConfig(): void;
8
8
  /**
9
- * Layer 4: Load a --config override file (highest priority,
10
- * ConfigManager Layer 4). Merges after loadDefaultConfig, prints loaded file,
11
- * and validates.
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, } from './recorder';
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';
@@ -14,6 +14,7 @@ export declare class SingleAgent {
14
14
  private lastScreenshot;
15
15
  private previousScreenshotB64;
16
16
  private lastActionInfo;
17
+ fastScreenshotPath: string | null;
17
18
  private llmCaller;
18
19
  private task;
19
20
  private session;
@@ -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 };
@@ -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
- * Incremental single-doc write.
11
- * Delegates to LanceDBManager.addSingle (non-destructive + jsonl fallback).
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
- * 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
- */
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,7 @@ 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;
27
28
  private toastListener;
28
29
  private toastBuffer;
29
30
  private toastListening;
@@ -73,3 +73,4 @@ export interface JudgeResult {
73
73
  reason: string;
74
74
  }
75
75
  export declare const judge: (conclusion: string) => Promise<string>;
76
+ export declare const verify: (description: string) => Promise<string>;
@@ -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, } from '../core/device/types';
1
+ export { type Screenshot, type ToolDefine, type ToolCallResult } from '../core/device/types';
@@ -1,4 +1,4 @@
1
- export { type Screenshot, type ToolDefine, type ToolCallResult, } from './device';
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, } from './core/device/types';
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, } from './core/mcp/types';
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';