@autotest/agent 0.0.5 → 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 (192) hide show
  1. package/README.md +10 -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 +5 -0
  5. package/dist/common/config/manager.d.ts +7 -7
  6. package/dist/common/config/types.d.ts +33 -1
  7. package/dist/common/dfx/index.d.ts +1 -1
  8. package/dist/common/image_helper.d.ts +2 -2
  9. package/dist/common/llm_cache/cache_transport.d.ts +1 -1
  10. package/dist/common/llm_cache/prompt_cache.d.ts +2 -2
  11. package/dist/common/utils.d.ts +5 -5
  12. package/dist/core/agent/layered_agent/agent_registry.d.ts +3 -1
  13. package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts +1 -1
  14. package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts +1 -1
  15. package/dist/core/agent/report_analyzer_agent/prompt.d.ts +1 -1
  16. package/dist/core/agent/report_analyzer_agent/tools.d.ts +1 -1
  17. package/dist/core/agent/rewrite_agent/agent.d.ts +5 -5
  18. package/dist/core/agent/rewrite_agent/guardrails.d.ts +1 -1
  19. package/dist/core/agent/rewrite_agent/mapping.d.ts +1 -1
  20. package/dist/core/agent/rewrite_agent/parse.d.ts +1 -1
  21. package/dist/core/agent/rewrite_agent/types.d.ts +1 -1
  22. package/dist/core/agent/single_agent/agent.d.ts +2 -2
  23. package/dist/core/agent/single_agent/hook_manager.d.ts +1 -2
  24. package/dist/core/agent/single_agent/image_utils.d.ts +1 -2
  25. package/dist/core/agent/single_agent/scroll_search_agent.d.ts +5 -5
  26. package/dist/core/agent/single_agent/subagent_manager.d.ts +1 -2
  27. package/dist/core/agent/single_agent/tool_recorder_hook.d.ts +3 -3
  28. package/dist/core/device/device_protocol.d.ts +1 -1
  29. package/dist/core/device/hdc/device.d.ts +1 -1
  30. package/dist/core/device/index.d.ts +2 -2
  31. package/dist/core/knowledge/knowledge_manager.d.ts +1 -1
  32. package/dist/core/knowledge/vectordb.d.ts +1 -1
  33. package/dist/core/mcp/harmony_hdc_adapter.d.ts +1 -0
  34. package/dist/core/mcp/mcp_tools.d.ts +11 -2
  35. package/dist/core/mcp/verify_tool.d.ts +12 -0
  36. package/dist/core/memory/_utils.d.ts +1 -1
  37. package/dist/core/memory/index.d.ts +1 -1
  38. package/dist/core/memory/memory_manager.d.ts +1 -1
  39. package/dist/core/memory/replan_manager.d.ts +1 -1
  40. package/dist/core/memory/tool_player.d.ts +5 -5
  41. package/dist/core/memory/tool_player_popup.d.ts +1 -1
  42. package/dist/core/memory/tool_player_replan.d.ts +1 -1
  43. package/dist/core/memory/tool_player_xpath.d.ts +3 -3
  44. package/dist/core/prompt/prompt_loader.d.ts +1 -1
  45. package/dist/core/prompt/templates/single/single_v2.0.md +15 -0
  46. package/dist/core/skill/skill_manager.d.ts +2 -2
  47. package/dist/data_types/device.d.ts +1 -1
  48. package/dist/data_types/index.d.ts +1 -1
  49. package/dist/index.d.ts +5 -5
  50. package/dist/index.js +1 -164
  51. package/dist/loop/cli.d.ts +4 -4
  52. package/dist/loop/orchestrator.d.ts +6 -6
  53. package/dist/loop/result_writer.d.ts +1 -1
  54. package/dist/loop/types.d.ts +1 -1
  55. package/dist/tools/batch_runner.js +1 -745
  56. package/dist/tools/case_runner/report.d.ts +1 -1
  57. package/dist/tools/case_runner/runner.d.ts +3 -3
  58. package/dist/tools/case_runner/runner.js +1 -410
  59. package/dist/tools/config/config_tool.d.ts +6 -6
  60. package/dist/tools/config/config_tool.js +1 -339
  61. package/dist/tools/prompt_compare/compare_runner.d.ts +2 -2
  62. package/dist/tools/prompt_compare/compare_runner.js +1 -360
  63. package/package.json +2 -2
  64. package/dist/api/agent_api.js +0 -550
  65. package/dist/api/autotest_agent.js +0 -205
  66. package/dist/api/types.js +0 -11
  67. package/dist/common/case_manager.js +0 -91
  68. package/dist/common/collect_case.js +0 -128
  69. package/dist/common/common_errors.js +0 -66
  70. package/dist/common/config/config_validator.js +0 -28
  71. package/dist/common/config/manager.js +0 -257
  72. package/dist/common/config/output.js +0 -59
  73. package/dist/common/config/types.js +0 -184
  74. package/dist/common/dfx/client_factory.js +0 -62
  75. package/dist/common/dfx/context.js +0 -23
  76. package/dist/common/dfx/index.js +0 -15
  77. package/dist/common/dfx/recorder.js +0 -191
  78. package/dist/common/dfx/recording_fetch.js +0 -228
  79. package/dist/common/dfx/source.js +0 -13
  80. package/dist/common/image_cacher.js +0 -36
  81. package/dist/common/image_helper.js +0 -128
  82. package/dist/common/image_similarity.js +0 -171
  83. package/dist/common/llm_cache/cache_transport.js +0 -102
  84. package/dist/common/llm_cache/prompt_cache.js +0 -113
  85. package/dist/common/logger.js +0 -158
  86. package/dist/common/model/custom_model.js +0 -525
  87. package/dist/common/model/index.js +0 -5
  88. package/dist/common/path_utils.js +0 -88
  89. package/dist/common/result_parser.js +0 -49
  90. package/dist/common/usage/token_usage.js +0 -117
  91. package/dist/common/utils.js +0 -125
  92. package/dist/core/agent/layered_agent/ability_helper.js +0 -125
  93. package/dist/core/agent/layered_agent/agent.js +0 -37
  94. package/dist/core/agent/layered_agent/agent_registry.js +0 -75
  95. package/dist/core/agent/layered_agent/decision.js +0 -516
  96. package/dist/core/agent/layered_agent/execute_agent/action_handler.js +0 -155
  97. package/dist/core/agent/layered_agent/execute_agent/agent_factory.js +0 -41
  98. package/dist/core/agent/layered_agent/execute_agent/base_agent.js +0 -112
  99. package/dist/core/agent/layered_agent/execute_agent/general_agent.js +0 -207
  100. package/dist/core/agent/layered_agent/execute_agent/glm_agent.js +0 -241
  101. package/dist/core/agent/layered_agent/execute_agent/i18n.js +0 -34
  102. package/dist/core/agent/layered_agent/execute_agent/index.js +0 -67
  103. package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js +0 -316
  104. package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +0 -154
  105. package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js +0 -243
  106. package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js +0 -139
  107. package/dist/core/agent/layered_agent/execute_agent/parser/index.js +0 -9
  108. package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js +0 -94
  109. package/dist/core/agent/layered_agent/execute_agent/prompts.js +0 -109
  110. package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js +0 -33
  111. package/dist/core/agent/layered_agent/execute_agent/utils.js +0 -52
  112. package/dist/core/agent/report_analyzer_agent/agent.js +0 -565
  113. package/dist/core/agent/report_analyzer_agent/config.js +0 -22
  114. package/dist/core/agent/report_analyzer_agent/data_loader.js +0 -255
  115. package/dist/core/agent/report_analyzer_agent/guardrails.js +0 -99
  116. package/dist/core/agent/report_analyzer_agent/hooks.js +0 -31
  117. package/dist/core/agent/report_analyzer_agent/index.js +0 -52
  118. package/dist/core/agent/report_analyzer_agent/key_steps_builder.js +0 -42
  119. package/dist/core/agent/report_analyzer_agent/mapping.js +0 -133
  120. package/dist/core/agent/report_analyzer_agent/parse.js +0 -375
  121. package/dist/core/agent/report_analyzer_agent/prompt.js +0 -300
  122. package/dist/core/agent/report_analyzer_agent/report_writer.js +0 -558
  123. package/dist/core/agent/report_analyzer_agent/tools.js +0 -150
  124. package/dist/core/agent/report_analyzer_agent/types.js +0 -274
  125. package/dist/core/agent/rewrite_agent/agent.js +0 -209
  126. package/dist/core/agent/rewrite_agent/guardrails.js +0 -95
  127. package/dist/core/agent/rewrite_agent/mapping.js +0 -56
  128. package/dist/core/agent/rewrite_agent/parse.js +0 -121
  129. package/dist/core/agent/rewrite_agent/types.js +0 -37
  130. package/dist/core/agent/single_agent/agent.js +0 -798
  131. package/dist/core/agent/single_agent/hook_manager.js +0 -60
  132. package/dist/core/agent/single_agent/hooks.js +0 -288
  133. package/dist/core/agent/single_agent/image_utils.js +0 -159
  134. package/dist/core/agent/single_agent/scroll_search_agent.js +0 -376
  135. package/dist/core/agent/single_agent/subagent_manager.js +0 -73
  136. package/dist/core/agent/single_agent/tool_recorder_hook.js +0 -42
  137. package/dist/core/agent/types.js +0 -2
  138. package/dist/core/agent/utils/message_builder.js +0 -138
  139. package/dist/core/device/device_protocol.js +0 -2
  140. package/dist/core/device/hdc/apps.js +0 -437
  141. package/dist/core/device/hdc/device.js +0 -219
  142. package/dist/core/device/hdc/index.js +0 -31
  143. package/dist/core/device/hdc/input.js +0 -74
  144. package/dist/core/device/hdc/screenshot.js +0 -171
  145. package/dist/core/device/index.js +0 -70
  146. package/dist/core/device/types.js +0 -2
  147. package/dist/core/knowledge/knowledge_manager.js +0 -70
  148. package/dist/core/knowledge/vectordb.js +0 -283
  149. package/dist/core/mcp/adapter_factory.js +0 -99
  150. package/dist/core/mcp/android_adapter.js +0 -286
  151. package/dist/core/mcp/base_adapter.js +0 -86
  152. package/dist/core/mcp/harmony_hdc_adapter.js +0 -782
  153. package/dist/core/mcp/ios_adapter.js +0 -286
  154. package/dist/core/mcp/local_tools.js +0 -41
  155. package/dist/core/mcp/mcp_tools.js +0 -410
  156. package/dist/core/mcp/types.js +0 -6
  157. package/dist/core/memory/_utils.js +0 -140
  158. package/dist/core/memory/compressed_session.js +0 -182
  159. package/dist/core/memory/context_compressor.js +0 -176
  160. package/dist/core/memory/index.js +0 -22
  161. package/dist/core/memory/memory_manager.js +0 -28
  162. package/dist/core/memory/reflector.js +0 -95
  163. package/dist/core/memory/replan_manager.js +0 -12
  164. package/dist/core/memory/session_factory.js +0 -29
  165. package/dist/core/memory/tool_player.js +0 -225
  166. package/dist/core/memory/tool_player_popup.js +0 -276
  167. package/dist/core/memory/tool_player_replan.js +0 -226
  168. package/dist/core/memory/tool_player_xpath.js +0 -139
  169. package/dist/core/memory/tool_recorder.js +0 -126
  170. package/dist/core/preprocessor/task_splitter.js +0 -112
  171. package/dist/core/prompt/prompt_loader.js +0 -315
  172. package/dist/core/skill/skill_manager.js +0 -302
  173. package/dist/data_types/action.js +0 -2
  174. package/dist/data_types/agent.js +0 -2
  175. package/dist/data_types/case.js +0 -57
  176. package/dist/data_types/device.js +0 -2
  177. package/dist/data_types/index.js +0 -11
  178. package/dist/data_types/report.js +0 -6
  179. package/dist/data_types/screen.js +0 -23
  180. package/dist/data_types/task.js +0 -2
  181. package/dist/loop/cli.js +0 -127
  182. package/dist/loop/orchestrator.js +0 -314
  183. package/dist/loop/result_writer.js +0 -260
  184. package/dist/loop/types.js +0 -82
  185. package/dist/mcp-server/server.js +0 -341
  186. package/dist/mcp-server/types.js +0 -224
  187. package/dist/reporter/batch_summary.js +0 -197
  188. package/dist/reporter/generator.js +0 -286
  189. package/dist/reporter/html_template/index.js +0 -524
  190. package/dist/reporter/json_report.js +0 -6
  191. package/dist/reporter/types.js +0 -45
  192. package/dist/tools/case_runner/report.js +0 -264
@@ -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;
@@ -33,8 +34,7 @@ export declare class SingleAgent {
33
34
  private parseTextAction;
34
35
  }
35
36
  /**
36
- * FastActionAgent — ≤5-step quick-execute mode (aligned with python
37
- * hybrid_agent/agent/fast_action.py). Applies fast defaults: maxSteps=5,
37
+ * FastActionAgent — ≤5-step quick-execute mode. Applies fast defaults: maxSteps=5,
38
38
  * no retries, no post-tool screenshots, minimal inject, FAST_ACTION prompt.
39
39
  */
40
40
  export declare class FastActionAgent extends SingleAgent {
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Global hook registry for cross-cutting agent hooks (aligned with python
3
- * hybrid_agent/hooks/hook_manager.py).
2
+ * Global hook registry for cross-cutting agent hooks.
4
3
  *
5
4
  * Unlike the per-agent `AgentHooks` interface (wired directly into an agent),
6
5
  * HookManager is a process-wide singleton where cross-cutting hooks (e.g.
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Screenshot injection + action markers (aligned with python
3
- * hybrid_agent/hooks/image_utils.py inject_screenshots_and_history).
2
+ * Screenshot injection + action markers.
4
3
  *
5
4
  * Provides:
6
5
  * - compressScreenshot: resize via sharp for LLM context window
@@ -1,13 +1,13 @@
1
1
  /**
2
- * ScrollSearchAgent — 滚动查找子代理(对齐 python custom_scroll_search)。
2
+ * ScrollSearchAgent — 滚动查找子代理(
3
3
  *
4
4
  * 在列表、导航栏、时间/日期/数字选择器等滚动场景中,
5
5
  * 自动滑动查找目标元素使其进入可见区域。
6
6
  *
7
7
  * 核心流程:
8
- * Phase 1: 截图 → LLM 分析滑动区域/方向/目标
9
- * 主循环: 截图 → LLM 判断(目标找到?内容变化?弹窗?) → 计算滑动距离 → 执行滑动 → 等待稳定 → 边界/区域检查
10
- * 退出: 目标找到 或 达到最大步数
8
+ * Phase 1: 截图 → LLM 分析滑动区域/方向/目标
9
+ * 主循环: 截图 → LLM 判断(目标找到?内容变化?弹窗?) → 计算滑动距离 → 执行滑动 → 等待稳定 → 边界/区域检查
10
+ * 退出: 目标找到 或 达到最大步数
11
11
  */
12
12
  import type { ModelConfig } from '../../../common/config/types';
13
13
  import type { MCPDeviceAdapter } from '../../mcp/types';
@@ -33,7 +33,7 @@ export interface SearchResult {
33
33
  }
34
34
  export declare class ScrollSearchAgent {
35
35
  readonly name = "scroll_search";
36
- readonly description = "\u6ED1\u52A8\u67E5\u627E\u76EE\u6807\u4F7F\u5176\u8FDB\u5165\u53EF\u89C1\u533A\u57DF\uFF0C\u7528\u4E8E\u5217\u8868\u3001\u5BFC\u822A\u680F\u3001\u65F6\u95F4\u9009\u62E9\u5668\u7B49\u6EDA\u52A8\u573A\u666F\u3002";
36
+ readonly description: string;
37
37
  private _llmCaller;
38
38
  private _adapter;
39
39
  private _config;
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Subagent infrastructure (aligned with python hybrid_agent/agent/base.py +
3
- * hybrid_hooks.py register_subagent_hooks).
2
+ * Subagent infrastructure.
4
3
  *
5
4
  * SubagentManager allows the parent agent to delegate work to child agents
6
5
  * via a `run_subagent` tool call. Child steps are offset from the parent's
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * ToolRecorderHook — cross-cutting hook that auto-records every tool call via
3
- * the global HookManager (aligned with python hybrid_agent/hooks/tool_recorder_hook.py).
3
+ * the global HookManager.
4
4
  *
5
5
  * Register once at agent startup:
6
- * const recorder = new ToolRecorder(taskId, storageDir);
7
- * hookManager.register('tool_recorder', new ToolRecorderHook(recorder));
6
+ * const recorder = new ToolRecorder(taskId, storageDir);
7
+ * hookManager.register('tool_recorder', new ToolRecorderHook(recorder));
8
8
  * Call finalize() at agent end to persist.
9
9
  */
10
10
  import type { AgentHook, HookContext } from './hook_manager';
@@ -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 };
@@ -50,7 +50,7 @@ export declare function home(driver: HdcDriver, delay?: number | null): Promise<
50
50
  */
51
51
  export declare function launchApp(driver: HdcDriver, appName: string, delay?: number | null): Promise<boolean>;
52
52
  /**
53
- * Reset the device to a clean home state (aligned with python reset_device).
53
+ * Reset the device to a clean home state.
54
54
  * Light flow: single home + clear recent tasks via aa dump/force-stop.
55
55
  */
56
56
  export declare function resetDevice(driver: HdcDriver): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Device layer entry point (aligned with python core/device/__init__.py).
2
+ * Device layer entry point.
3
3
  *
4
4
  * Re-exports the device protocol types and provides a `createDevice` factory
5
5
  * with a pluggable registry. `MockDevice` is available for offline/test runs.
@@ -40,7 +40,7 @@ export interface CreateDeviceOptions {
40
40
  port?: number;
41
41
  }
42
42
  /**
43
- * Create a device by implementation name (aligned with python create_device).
43
+ * Create a device by implementation name.
44
44
  * 'MockDevice' returns an in-memory mock; real HDC devices are created via the
45
45
  * MCP adapter factory (`createAdapterFromDeviceInfo`), which is the Node
46
46
  * equivalent of HDCDevice.
@@ -7,7 +7,7 @@ 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 (aligned with python knowledge_manager.write_knowledge).
10
+ * Incremental single-doc write.
11
11
  * Delegates to LanceDBManager.addSingle (non-destructive + jsonl fallback).
12
12
  */
13
13
  writeKnowledge(doc: {
@@ -26,7 +26,7 @@ export declare class LanceDBManager {
26
26
  insertDocuments(docs: KnowledgeDoc[]): void;
27
27
  addDocument(doc: KnowledgeDoc): void;
28
28
  /**
29
- * Incremental single-doc write (aligned with python vectordb.add_single).
29
+ * Incremental single-doc write.
30
30
  * Non-destructive: appends to the in-memory store (dedup by text) without
31
31
  * clobbering existing records. Falls back to appending a `_pending.jsonl`
32
32
  * line when persistence fails, so records are never lost.
@@ -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;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  /** A registered async tool function. */
9
9
  export type ToolFunction = (...args: any[]) => Promise<string>;
10
- /** Metadata for a registered tool (aligned with python GlobalToolEntry). */
10
+ /** Metadata for a registered tool. */
11
11
  export interface ToolEntry {
12
12
  name: string;
13
13
  description: string;
@@ -20,7 +20,7 @@ export declare const TOOL_REGISTRY: Record<string, ToolFunction>;
20
20
  export declare function addToBlacklist(...names: string[]): void;
21
21
  /**
22
22
  * Register a tool function with metadata into the registry.
23
- * Aligned with python collect_function_tool — stores both the function and
23
+ *
24
24
  * its description/parameters so collectAllTools can build the Available Tools
25
25
  * list dynamically instead of a hardcoded array.
26
26
  */
@@ -37,6 +37,8 @@ export declare const chat: (message: string) => Promise<string>;
37
37
  export declare function getPackageNameMap(): Promise<Record<string, string>>;
38
38
  /** Start an app by display name or bundle name. */
39
39
  export declare const startApp: (appName: string) => Promise<string>;
40
+ /** Start an app via deeplink URI. */
41
+ export declare const startAppByDeepLink: (uri: string, bundleName?: string, abilityName?: string) => Promise<string>;
40
42
  /** Stop an app by display name or bundle name. */
41
43
  export declare const stopApp: (appName: string) => Promise<string>;
42
44
  /** Clear an app's data to simulate a first-install state. */
@@ -65,3 +67,10 @@ export declare const loadSkill: (skillName: string) => Promise<string>;
65
67
  * @returns JSON with `verified` (boolean) and `reason` (string).
66
68
  */
67
69
  export declare function verify(verificationDescription: string): Promise<string>;
70
+ export interface JudgeResult {
71
+ passed: boolean;
72
+ shouldContinue: boolean;
73
+ reason: string;
74
+ }
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>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal utility functions shared across memory module.
3
3
  *
4
- * Ported from python core/memory/_utils.py.
4
+ *
5
5
  * Provides helpers for response text extraction, message filtering, retry
6
6
  * decoration, and a lightweight TimeCalculate class used by ToolPlayer.
7
7
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Memory subsystem barrel (aligned with python core/memory/__init__.py).
2
+ * Memory subsystem barrel.
3
3
  *
4
4
  * Re-exports the memory facade plus the session input filter helper.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Memory subsystem facade (aligned with python core/memory/memory_manager.py).
2
+ * Memory subsystem facade.
3
3
  *
4
4
  * The legacy monolithic MemoryManager (apps/summary markdown store) was removed
5
5
  * together with the hypium_agent package. This module now re-exports the new
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Replan manager facade.
3
3
  *
4
- * Ported from python core/memory/replan_manager.py.
4
+ *
5
5
  * Re-exports the replan functionality from tool_player_replan so callers
6
6
  * can import it from core/memory/replan_manager.
7
7
  */
@@ -1,17 +1,17 @@
1
1
  import type { RecordingSession } from './tool_recorder';
2
2
  import type { ModelConfig } from '../../common/config/types';
3
- /** Mock tool object for report generator (aligned with python MockTool). */
3
+ /** Mock tool object for report generator. */
4
4
  export interface MockTool {
5
5
  name: string;
6
6
  }
7
- /** Configuration for popup handling during playback (aligned with python PopupHandlingConfig). */
7
+ /** Configuration for popup handling during playback. */
8
8
  export interface PopupHandlingConfig {
9
9
  enabled: boolean;
10
10
  maxRetryAttempts: number;
11
11
  skipPopupSteps: boolean;
12
12
  }
13
13
  export declare const DEFAULT_POPUP_CONFIG: PopupHandlingConfig;
14
- /** Map recorded tool names to device action display names (aligned with python ACTION_MAP). */
14
+ /** Map recorded tool names to device action display names. */
15
15
  export declare const ACTION_MAP: Record<string, string>;
16
16
  export interface ToolPlayerOptions {
17
17
  recording?: RecordingSession;
@@ -74,8 +74,8 @@ export declare class ToolPlayer {
74
74
  private _detectPopup;
75
75
  /** Basic popup close: try pressing back/home to dismiss. */
76
76
  private _tryClosePopup;
77
- /** Judge the playback result with a detailed LLM prompt (aligned with python judge_result). */
77
+ /** Judge the playback result with a detailed LLM prompt. */
78
78
  judgeResult(playbackResult: PlaybackResult): Promise<string>;
79
- /** Build the detailed judge prompt (aligned with python _build_judge_prompt). */
79
+ /** Build the detailed judge prompt. */
80
80
  private _buildJudgePrompt;
81
81
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Popup handling and LLM screenshot analysis mixin for ToolPlayer.
3
3
  *
4
- * Ported from python core/memory/tool_player_popup.py.
4
+ *
5
5
  * Detects unexpected popups during playback via LLM screenshot analysis,
6
6
  * closes them, and retries the failed step. Also handles skipping popup
7
7
  * steps that are no longer relevant.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Replan mixin for ToolPlayer.
3
3
  *
4
- * Ported from python core/memory/tool_player_replan.py.
4
+ *
5
5
  * Contains the replan prompt builder and the triggerReplan method.
6
6
  * Delegates to a replanCallback callable so the host application owns the
7
7
  * replanning lifecycle.
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * XPath-based component finding and tool execution mixin for ToolPlayer.
3
3
  *
4
- * Ported from python core/memory/tool_player_xpath.py.
5
4
  *
6
- * NOTE: The Python version depends on `hypium` (a Python-only HarmonyOS UI
5
+ *
6
+ * NOTE: The version depends on `hypium` (a -only HarmonyOS UI
7
7
  * test framework that provides XPath-based component finding via UiDriver)
8
- * and the Python `agents` SDK (ToolContext/Usage). Neither exists in Node.js.
8
+ * and the `agents` SDK (ToolContext/Usage). Neither exists in Node.js.
9
9
  *
10
10
  * The framework-agnostic helpers (coordinate parsing, normalization, bounds
11
11
  * center calculation) are ported faithfully. The hypium-dependent methods
@@ -16,7 +16,7 @@ export declare function listAllPrompts(category: PromptCategory): Array<{
16
16
  date: string;
17
17
  description: string;
18
18
  }>;
19
- /** Register extra directories to scan for prompts (aligned with python register_scan_paths). */
19
+ /** Register extra directories to scan for prompts. */
20
20
  export declare function registerScanPaths(paths: string[]): void;
21
21
  /** Return the registered extra scan directories. */
22
22
  export declare function getScanDirs(): 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
 
@@ -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 (aligned with python skill_manager). */
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
- * python core/skill/skill_manager.py).
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
@@ -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';
2
- export declare const VERSION = "0.9.8";
1
+ export { AgentError, LLMNotFollowRuleError, AgentErrorRecoverableMap, AgentErrorSuggestedActionsMap, type AgentErrorCode, } from './common/common_errors';
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';