@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
@@ -63,6 +63,7 @@ agent:
63
63
  screenshot_max_pixels: 1500
64
64
  include_previous_screenshot: true
65
65
  previous_screenshot_compress_ratio: 0.7
66
+ action_markers: false
66
67
  max_history_actions: 10
67
68
  role: null
68
69
  session_type: "compressed"
@@ -102,6 +103,10 @@ device:
102
103
  device_impl: "HDCDevice"
103
104
  app_config: ""
104
105
  operation_mode: "phone"
106
+ keepalive_process_whitelist: []
107
+ # keepalive_process_whitelist:
108
+ # - "com.hmos.xxx"
109
+ # - "com.example.xxx"
105
110
 
106
111
  network:
107
112
  timeout: 600
@@ -6,7 +6,7 @@ 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, aligned with python
9
+ * Layer 4: Load a --config override file (highest priority,
10
10
  * ConfigManager Layer 4). Merges after loadDefaultConfig, prints loaded file,
11
11
  * and validates.
12
12
  */
@@ -19,11 +19,11 @@ export declare class ConfigManager {
19
19
  }
20
20
  /**
21
21
  * Resolve a model config by agent name with unified fallback.
22
- * Mirrors python ModelGroupConfig.get_model:
23
- * 1. direct slot match (unified/execute/decision/verify/reflection/analyze)
24
- * 2. `_agent` suffix aliasing (e.g. `execute_agent` → `execute` slot)
25
- * 3. extra_models[name]
26
- * 4. fallback to `unified`
22
+ * Mirrors ModelGroupConfig.get_model:
23
+ * 1. direct slot match (unified/execute/decision/verify/reflection/analyze)
24
+ * 2. `_agent` suffix aliasing (e.g. `execute_agent` → `execute` slot)
25
+ * 3. extra_models[name]
26
+ * 4. fallback to `unified`
27
27
  */
28
28
  export declare function getModel(group: ModelGroupConfig, name: string): ModelConfig;
29
29
  /** Resolve a model config for an agent name from the app config. */
@@ -31,7 +31,7 @@ export declare function resolveModelConfig(config: AppConfig, agentName: string)
31
31
  /**
32
32
  * Resolve an agent config by name. Node's config.agent is currently a flat
33
33
  * AgentConfig (AgentGroupConfig restructure deferred), so this returns the
34
- * flat config for any name — kept for API parity with python
34
+ * flat config for any name — kept for API parity with
35
35
  * resolve_agent_config until extra_agents support lands.
36
36
  */
37
37
  export declare function resolveAgentConfig(config: AppConfig, _agentName: string): AgentConfig;
@@ -732,6 +732,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
732
732
  maxResultRetries: z.ZodDefault<z.ZodNumber>;
733
733
  includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
734
734
  previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
735
+ actionMarkers: z.ZodDefault<z.ZodBoolean>;
735
736
  enableCache: z.ZodDefault<z.ZodBoolean>;
736
737
  parseMode: z.ZodDefault<z.ZodString>;
737
738
  toolProvider: z.ZodDefault<z.ZodString>;
@@ -765,6 +766,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
765
766
  maxResultRetries?: number;
766
767
  includePreviousScreenshot?: boolean;
767
768
  previousScreenshotCompressRatio?: number;
769
+ actionMarkers?: boolean;
768
770
  enableCache?: boolean;
769
771
  parseMode?: string;
770
772
  toolProvider?: string;
@@ -798,6 +800,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
798
800
  maxResultRetries?: number;
799
801
  includePreviousScreenshot?: boolean;
800
802
  previousScreenshotCompressRatio?: number;
803
+ actionMarkers?: boolean;
801
804
  enableCache?: boolean;
802
805
  parseMode?: string;
803
806
  toolProvider?: string;
@@ -813,7 +816,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
813
816
  }>;
814
817
  export type AgentConfig = z.infer<typeof AgentConfigSchema>;
815
818
  /**
816
- * Agent group config (aligned with python AgentGroupConfig).
819
+ * Agent group config.
817
820
  * `unified` is the default agent config; `extraAgents` are per-role overrides.
818
821
  * Backward compat: old flat `agent: { mode: ... }` config is auto-migrated
819
822
  * to `{ unified: { mode: ... } }` by ConfigManager.
@@ -840,6 +843,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
840
843
  maxResultRetries: z.ZodDefault<z.ZodNumber>;
841
844
  includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
842
845
  previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
846
+ actionMarkers: z.ZodDefault<z.ZodBoolean>;
843
847
  enableCache: z.ZodDefault<z.ZodBoolean>;
844
848
  parseMode: z.ZodDefault<z.ZodString>;
845
849
  toolProvider: z.ZodDefault<z.ZodString>;
@@ -873,6 +877,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
873
877
  maxResultRetries?: number;
874
878
  includePreviousScreenshot?: boolean;
875
879
  previousScreenshotCompressRatio?: number;
880
+ actionMarkers?: boolean;
876
881
  enableCache?: boolean;
877
882
  parseMode?: string;
878
883
  toolProvider?: string;
@@ -906,6 +911,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
906
911
  maxResultRetries?: number;
907
912
  includePreviousScreenshot?: boolean;
908
913
  previousScreenshotCompressRatio?: number;
914
+ actionMarkers?: boolean;
909
915
  enableCache?: boolean;
910
916
  parseMode?: string;
911
917
  toolProvider?: string;
@@ -940,6 +946,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
940
946
  maxResultRetries: z.ZodDefault<z.ZodNumber>;
941
947
  includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
942
948
  previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
949
+ actionMarkers: z.ZodDefault<z.ZodBoolean>;
943
950
  enableCache: z.ZodDefault<z.ZodBoolean>;
944
951
  parseMode: z.ZodDefault<z.ZodString>;
945
952
  toolProvider: z.ZodDefault<z.ZodString>;
@@ -973,6 +980,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
973
980
  maxResultRetries?: number;
974
981
  includePreviousScreenshot?: boolean;
975
982
  previousScreenshotCompressRatio?: number;
983
+ actionMarkers?: boolean;
976
984
  enableCache?: boolean;
977
985
  parseMode?: string;
978
986
  toolProvider?: string;
@@ -1006,6 +1014,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
1006
1014
  maxResultRetries?: number;
1007
1015
  includePreviousScreenshot?: boolean;
1008
1016
  previousScreenshotCompressRatio?: number;
1017
+ actionMarkers?: boolean;
1009
1018
  enableCache?: boolean;
1010
1019
  parseMode?: string;
1011
1020
  toolProvider?: string;
@@ -1041,6 +1050,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
1041
1050
  maxResultRetries?: number;
1042
1051
  includePreviousScreenshot?: boolean;
1043
1052
  previousScreenshotCompressRatio?: number;
1053
+ actionMarkers?: boolean;
1044
1054
  enableCache?: boolean;
1045
1055
  parseMode?: string;
1046
1056
  toolProvider?: string;
@@ -1075,6 +1085,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
1075
1085
  maxResultRetries?: number;
1076
1086
  includePreviousScreenshot?: boolean;
1077
1087
  previousScreenshotCompressRatio?: number;
1088
+ actionMarkers?: boolean;
1078
1089
  enableCache?: boolean;
1079
1090
  parseMode?: string;
1080
1091
  toolProvider?: string;
@@ -1110,6 +1121,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
1110
1121
  maxResultRetries?: number;
1111
1122
  includePreviousScreenshot?: boolean;
1112
1123
  previousScreenshotCompressRatio?: number;
1124
+ actionMarkers?: boolean;
1113
1125
  enableCache?: boolean;
1114
1126
  parseMode?: string;
1115
1127
  toolProvider?: string;
@@ -1144,6 +1156,7 @@ declare const AgentGroupConfigSchema: z.ZodObject<{
1144
1156
  maxResultRetries?: number;
1145
1157
  includePreviousScreenshot?: boolean;
1146
1158
  previousScreenshotCompressRatio?: number;
1159
+ actionMarkers?: boolean;
1147
1160
  enableCache?: boolean;
1148
1161
  parseMode?: string;
1149
1162
  toolProvider?: string;
@@ -1878,6 +1891,7 @@ export declare const AppConfigSchema: z.ZodObject<{
1878
1891
  maxResultRetries: z.ZodDefault<z.ZodNumber>;
1879
1892
  includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
1880
1893
  previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
1894
+ actionMarkers: z.ZodDefault<z.ZodBoolean>;
1881
1895
  enableCache: z.ZodDefault<z.ZodBoolean>;
1882
1896
  parseMode: z.ZodDefault<z.ZodString>;
1883
1897
  toolProvider: z.ZodDefault<z.ZodString>;
@@ -1911,6 +1925,7 @@ export declare const AppConfigSchema: z.ZodObject<{
1911
1925
  maxResultRetries?: number;
1912
1926
  includePreviousScreenshot?: boolean;
1913
1927
  previousScreenshotCompressRatio?: number;
1928
+ actionMarkers?: boolean;
1914
1929
  enableCache?: boolean;
1915
1930
  parseMode?: string;
1916
1931
  toolProvider?: string;
@@ -1944,6 +1959,7 @@ export declare const AppConfigSchema: z.ZodObject<{
1944
1959
  maxResultRetries?: number;
1945
1960
  includePreviousScreenshot?: boolean;
1946
1961
  previousScreenshotCompressRatio?: number;
1962
+ actionMarkers?: boolean;
1947
1963
  enableCache?: boolean;
1948
1964
  parseMode?: string;
1949
1965
  toolProvider?: string;
@@ -1978,6 +1994,7 @@ export declare const AppConfigSchema: z.ZodObject<{
1978
1994
  maxResultRetries: z.ZodDefault<z.ZodNumber>;
1979
1995
  includePreviousScreenshot: z.ZodDefault<z.ZodBoolean>;
1980
1996
  previousScreenshotCompressRatio: z.ZodDefault<z.ZodNumber>;
1997
+ actionMarkers: z.ZodDefault<z.ZodBoolean>;
1981
1998
  enableCache: z.ZodDefault<z.ZodBoolean>;
1982
1999
  parseMode: z.ZodDefault<z.ZodString>;
1983
2000
  toolProvider: z.ZodDefault<z.ZodString>;
@@ -2011,6 +2028,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2011
2028
  maxResultRetries?: number;
2012
2029
  includePreviousScreenshot?: boolean;
2013
2030
  previousScreenshotCompressRatio?: number;
2031
+ actionMarkers?: boolean;
2014
2032
  enableCache?: boolean;
2015
2033
  parseMode?: string;
2016
2034
  toolProvider?: string;
@@ -2044,6 +2062,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2044
2062
  maxResultRetries?: number;
2045
2063
  includePreviousScreenshot?: boolean;
2046
2064
  previousScreenshotCompressRatio?: number;
2065
+ actionMarkers?: boolean;
2047
2066
  enableCache?: boolean;
2048
2067
  parseMode?: string;
2049
2068
  toolProvider?: string;
@@ -2079,6 +2098,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2079
2098
  maxResultRetries?: number;
2080
2099
  includePreviousScreenshot?: boolean;
2081
2100
  previousScreenshotCompressRatio?: number;
2101
+ actionMarkers?: boolean;
2082
2102
  enableCache?: boolean;
2083
2103
  parseMode?: string;
2084
2104
  toolProvider?: string;
@@ -2113,6 +2133,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2113
2133
  maxResultRetries?: number;
2114
2134
  includePreviousScreenshot?: boolean;
2115
2135
  previousScreenshotCompressRatio?: number;
2136
+ actionMarkers?: boolean;
2116
2137
  enableCache?: boolean;
2117
2138
  parseMode?: string;
2118
2139
  toolProvider?: string;
@@ -2148,6 +2169,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2148
2169
  maxResultRetries?: number;
2149
2170
  includePreviousScreenshot?: boolean;
2150
2171
  previousScreenshotCompressRatio?: number;
2172
+ actionMarkers?: boolean;
2151
2173
  enableCache?: boolean;
2152
2174
  parseMode?: string;
2153
2175
  toolProvider?: string;
@@ -2182,6 +2204,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2182
2204
  maxResultRetries?: number;
2183
2205
  includePreviousScreenshot?: boolean;
2184
2206
  previousScreenshotCompressRatio?: number;
2207
+ actionMarkers?: boolean;
2185
2208
  enableCache?: boolean;
2186
2209
  parseMode?: string;
2187
2210
  toolProvider?: string;
@@ -2253,6 +2276,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2253
2276
  deviceImpl: z.ZodDefault<z.ZodString>;
2254
2277
  appConfig: z.ZodDefault<z.ZodString>;
2255
2278
  operationMode: z.ZodDefault<z.ZodEnum<["phone", "pc"]>>;
2279
+ keepaliveProcessWhitelist: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2256
2280
  }, "strip", z.ZodTypeAny, {
2257
2281
  deviceSn?: string;
2258
2282
  ip?: string;
@@ -2263,6 +2287,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2263
2287
  deviceImpl?: string;
2264
2288
  appConfig?: string;
2265
2289
  operationMode?: "phone" | "pc";
2290
+ keepaliveProcessWhitelist?: string[];
2266
2291
  }, {
2267
2292
  deviceSn?: string;
2268
2293
  ip?: string;
@@ -2273,6 +2298,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2273
2298
  deviceImpl?: string;
2274
2299
  appConfig?: string;
2275
2300
  operationMode?: "phone" | "pc";
2301
+ keepaliveProcessWhitelist?: string[];
2276
2302
  }>>;
2277
2303
  network: z.ZodDefault<z.ZodObject<{
2278
2304
  timeout: z.ZodDefault<z.ZodNumber>;
@@ -2410,6 +2436,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2410
2436
  deviceImpl?: string;
2411
2437
  appConfig?: string;
2412
2438
  operationMode?: "phone" | "pc";
2439
+ keepaliveProcessWhitelist?: string[];
2413
2440
  };
2414
2441
  reflection?: {
2415
2442
  enabled?: boolean;
@@ -2588,6 +2615,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2588
2615
  maxResultRetries?: number;
2589
2616
  includePreviousScreenshot?: boolean;
2590
2617
  previousScreenshotCompressRatio?: number;
2618
+ actionMarkers?: boolean;
2591
2619
  enableCache?: boolean;
2592
2620
  parseMode?: string;
2593
2621
  toolProvider?: string;
@@ -2622,6 +2650,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2622
2650
  maxResultRetries?: number;
2623
2651
  includePreviousScreenshot?: boolean;
2624
2652
  previousScreenshotCompressRatio?: number;
2653
+ actionMarkers?: boolean;
2625
2654
  enableCache?: boolean;
2626
2655
  parseMode?: string;
2627
2656
  toolProvider?: string;
@@ -2689,6 +2718,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2689
2718
  deviceImpl?: string;
2690
2719
  appConfig?: string;
2691
2720
  operationMode?: "phone" | "pc";
2721
+ keepaliveProcessWhitelist?: string[];
2692
2722
  };
2693
2723
  reflection?: {
2694
2724
  enabled?: boolean;
@@ -2867,6 +2897,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2867
2897
  maxResultRetries?: number;
2868
2898
  includePreviousScreenshot?: boolean;
2869
2899
  previousScreenshotCompressRatio?: number;
2900
+ actionMarkers?: boolean;
2870
2901
  enableCache?: boolean;
2871
2902
  parseMode?: string;
2872
2903
  toolProvider?: string;
@@ -2901,6 +2932,7 @@ export declare const AppConfigSchema: z.ZodObject<{
2901
2932
  maxResultRetries?: number;
2902
2933
  includePreviousScreenshot?: boolean;
2903
2934
  previousScreenshotCompressRatio?: number;
2935
+ actionMarkers?: boolean;
2904
2936
  enableCache?: boolean;
2905
2937
  parseMode?: string;
2906
2938
  toolProvider?: string;
@@ -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';
@@ -7,11 +7,11 @@ export declare function compressImageToBase64(imagePath: string, maxPixels?: num
7
7
  export declare function compressBase64Image(base64Data: string, maxPixels?: number, quality?: number): Promise<string>;
8
8
  /**
9
9
  * Decode a base64 image (with optional `data:` prefix) into a Buffer.
10
- * Aligned with python image_helper.decode_base64_image.
10
+ *
11
11
  */
12
12
  export declare function decodeBase64Image(base64Data: string): Promise<Buffer>;
13
13
  /**
14
- * Encode a Buffer to a base64 string. Aligned with python
14
+ * Encode a Buffer to a base64 string.
15
15
  * image_helper.encode_image_to_base64 (Node buffers encode losslessly; fmt/quality
16
16
  * only apply when re-encoding via sharp, which callers can do via compressBase64Image).
17
17
  */
@@ -3,7 +3,7 @@ export declare class CacheTransport {
3
3
  private cacheDir;
4
4
  private cache;
5
5
  constructor(enabled?: boolean, cacheDir?: string);
6
- /** Exposed for prompt-cache injection gating (aligned with python `enable_cache`). */
6
+ /** Exposed for prompt-cache injection gating. */
7
7
  isEnabled(): boolean;
8
8
  getCachedResponse(requestKey: string): Promise<string | null>;
9
9
  setCachedResponse(requestKey: string, response: string): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * DashScope 上下文缓存注入器(移植自 python/AutoTest/core/openai/transports/cache_transport.py)
2
+ * DashScope 上下文缓存注入器(
3
3
  *
4
4
  * 在 HTTP 请求发出前,在 system message 上添加 `cache_control: {"type": "ephemeral"}` 标记,
5
5
  * 使 DashScope 复用前缀 token(节省 system prompt 重复计费)。
@@ -46,7 +46,7 @@ export declare function supportsCacheControl(baseUrl: string, modelName: string)
46
46
  * @param body 请求体(包含 messages 数组)
47
47
  * @param baseUrl LLM API 基础 URL
48
48
  * @param modelName 模型名
49
- * @param enabled 是否启用(受 agent.unified.enableCache 控制,对齐 python)
49
+ * @param enabled 是否启用(受 agent.unified.enableCache 控制,
50
50
  * @returns True 表示修改了 body(调用方需要重新序列化),False 表示不需要缓存
51
51
  */
52
52
  export declare function injectPromptCache(body: RequestBodyLike, baseUrl: string, modelName: string, enabled: boolean): boolean;
@@ -1,10 +1,10 @@
1
1
  /**
2
- * General utility functions ported from python/AutoTest/common/utils.py.
2
+ * General utility functions
3
3
  */
4
4
  /**
5
5
  * Sanitize a string into a safe filename (Windows-compatible).
6
6
  *
7
- * Mirrors python `sanitize_filename`: replaces `/ \ : * ? " < > |` with `_`,
7
+ * Mirrors `sanitize_filename`: replaces `/ \ : * ? " < > |` with `_`,
8
8
  * drops control chars, strips leading/trailing dots and spaces, collapses
9
9
  * repeated underscores, and truncates to `maxLength`.
10
10
  */
@@ -12,7 +12,7 @@ export declare function sanitizeFilename(name: string, maxLength?: number): stri
12
12
  /**
13
13
  * Inject `enable_thinking` into the LLM request `extra_body`.
14
14
  *
15
- * Mirrors python `apply_thinking_config`. Tri-state: `null` = skip (use model
15
+ * Mirrors `apply_thinking_config`. Tri-state: `null` = skip (use model
16
16
  * default), `true`/`false` = explicit value, written into
17
17
  * `chat_template_kwargs.enable_thinking` (vLLM format). Mutates and returns
18
18
  * `extraBody` in place.
@@ -20,14 +20,14 @@ export declare function sanitizeFilename(name: string, maxLength?: number): stri
20
20
  export declare function applyThinkingConfig(extraBody: Record<string, unknown>, enableThinking: boolean | null): Record<string, unknown>;
21
21
  /**
22
22
  * Normalize a single coordinate: keep if already in [0,1], else divide by 1000
23
- * (per-mille → 0-1). Mirrors python `normalize_coord`.
23
+ * (per-mille → 0-1). Mirrors `normalize_coord`.
24
24
  */
25
25
  export declare function normalizeCoord(coord: number): number;
26
26
  /**
27
27
  * Coordinate defense layer: detect per-mille (0-1000) coordinates and
28
28
  * selectively divide >1 values by 1000 to normalize to the 0-1 range.
29
29
  *
30
- * Mirrors python `normalize_tool_coordinates`. Covers both combine format
30
+ * Mirrors `normalize_tool_coordinates`. Covers both combine format
31
31
  * (`pos`/`start`/`end` as [x,y]) and split format (`x`/`y`,
32
32
  * `start_x`/`start_y`, `end_x`/`end_y`). Only values >1 are converted; values
33
33
  * already in [0,1] are preserved (handles mixed output like [0.85, 780]).
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Global agent registry (aligned with python hybrid_agent/utils/agent_registry.py).
2
+ * Global agent registry.
3
3
  *
4
4
  * Singleton for managing cross-module shared state: executor agent, tool
5
5
  * manager (adapter), report generator, last click info, and generic key-value
@@ -26,6 +26,8 @@ declare class AgentRegistryImpl {
26
26
  setLastClickInfo(info: Record<string, unknown> | null): void;
27
27
  getLastClickInfo(): Record<string, unknown> | null;
28
28
  clearLastClickInfo(): void;
29
+ setAppConfig(config: unknown): void;
30
+ getAppConfig<T = unknown>(): T | null;
29
31
  isInitialized(): boolean;
30
32
  clear(): void;
31
33
  }
@@ -1,3 +1,3 @@
1
- export declare const MCP_SYSTEM_PROMPT_BASIC = "You are a GUI operation agent. You will receive a task description, an action history, a screen screenshot, and a set of tools used for device operations. You need to decide the next action to take to complete the task based on the current interface state. Please operate based on the current interface and the given task, do not speculate about user intent.\n\n# Output Format Requirements\n- Must include a thinking section that first summarizes the history of operations, especially repeatedly retried operations, the decision reason for the current operation step, and the operation description.\n- The thinking section should summarize in one sentence.\n\n# Notes\n## Decide based on screenshot and history\n - Please analyze the current interface content based on the provided screenshot and user instruction, and select the most appropriate operation from the tools. Your judgment must be based on visual recognition of the controls on the interface.\n## Retry principle\n - Please pay attention to the operation history; the same operation sequence should be retried at most 2 times. If the operation does not achieve the expected result, terminate execution directly and report the failure reason.\n## Execution conditions\n - Please confirm whether the execution conditions are met before execution. If the execution conditions are not met, terminate execution directly and report the failure reason.\n## Target description\n - Please confirm the operations required by the target description in the task list, and only complete the operations specified in the target description.\n## Expected result\n - Please confirm the expected result before execution. If the expected result has been achieved, report completion directly.\n## Swipe description\n - Swipe from left to right -> right\n - Swipe from top to bottom -> down\n - Swipe from bottom to top -> up\n - Swipe from right to left -> left\n## Coordinate description\n - The coordinate format is (x, y), the coordinate range is (0.000, 1.000), do not exceed the coordinate range.\n\n## Supported MCP Tools\n";
1
+ export declare const MCP_SYSTEM_PROMPT_BASIC = "You are a GUI operation agent. You will receive a task description, an action history, a screen screenshot, and a set of tools used for device operations. You need to decide the next action to take to complete the task based on the current interface state. Please operate based on the current interface and the given task, do not speculate about user intent.\n\n# Output Format Requirements\n- Must include a thinking section that first summarizes the history of operations, especially repeatedly retried operations, the decision reason for the current operation step, and the operation description.\n- The thinking section should summarize in one sentence.\n\n# Notes\n## Decide based on screenshot and history\n - Please analyze the current interface content based on the provided screenshot and user instruction, and select the most appropriate operation from the tools. Your judgment must be based on visual recognition of the controls on the interface.\n## Retry principle\n - Please pay attention to the operation history; the same operation sequence should be retried at most 2 times. If the operation does not achieve the expected result, terminate execution directly and report the failure reason.\n## Execution conditions\n - Please confirm whether the execution conditions are met before execution. If the execution conditions are not met, terminate execution directly and report the failure reason.\n## Target description\n - Please confirm the operations required by the target description in the task list, and only complete the operations specified in the target description.\n## Expected result\n - Please confirm the expected result before execution. If the expected result has been achieved, report completion directly.\n## Swipe description\n - Swipe from left to right -> right\n - Swipe from top to bottom -> down\n - Swipe from bottom to top -> up\n - Swipe from right to left -> left\n## Coordinate description\n - The coordinate format is (x, y), the coordinate range is (0.000, 1.000), do not exceed the coordinate range.\n\n## Supported MCP Tools\n";
2
2
  export declare const MCP_SYSTEM_PROMPT_ALL: string;
3
3
  export declare const MCP_SYSTEM_PROMPT: string;
@@ -1 +1 @@
1
- export declare const SYSTEM_PROMPT = "You are the execution-layer Agent, responsible for strictly executing instructions from the superior (decision layer).\n\n## Core Positioning (Highest Priority)\n\nYou are the execution layer, not the decision layer.\n- Your responsibility: execute instructions from the superior, do not judge whether the instruction is meaningful.\n- Your superior (Planner): responsible for decisions, judging whether the task is complete.\n- Your role: tool executor, not task decision-maker.\n\n---\n\n## Mandatory Execution Rules (Must Follow)\n\nMust execute:\n- Receive an instruction from the superior then must execute, do not judge whether it is meaningful.\n- The superior asks to swipe then must swipe, do not judge whether there is content.\n- The superior asks to click then must click, do not judge whether it is correct.\n\nForbidden autonomous behaviors:\n- Forbidden to autonomously terminate (task completion is judged by the superior).\n- Forbidden to autonomously go back (going back is decided by the superior).\n- Forbidden to autonomously explore (exploration is planned by the superior).\n- Forbidden to judge whether an operation is meaningful.\n- Forbidden to think about whether you should go back to the previous level.\n- Forbidden to think about whether the task is complete.\n\n---\n\n## Output Format\n\nEach operation must contain two parts:\n1. Thinking process: describe observation and localization inside thinking tags.\n2. Action instruction: return a JSON function call inside a json code fence.\n\nExample:\n\n<thinking>\n**Observation**: The current screen shows a short-video playback interface, the superior asks to swipe up.\n**Localization**: The superior asks to swipe in the middle area of the screen, the coordinate area is about [0.3-0.7, 0.4-0.6].\n**Execution**: Swipe from bottom to top in the middle of the screen.\n</thinking>\n```json\n{\"name\": \"swipe\", \"arguments\": {\"direction\": \"up\", \"coordinate\": [0.5, 0.5]}}\n```\n\n---\n\n## Action Space (Strictly Follow)\n\n### Basic Operations\n- Click: {\"name\": \"click\", \"arguments\": {\"coordinate\": [x, y]}}\n Used to click the UI element specified by the superior.\n\n- Long press: {\"name\": \"long_press\", \"arguments\": {\"coordinate\": [x, y]}}\n Used to long-press the element specified by the superior.\n\n- Type text: {\"name\": \"type\", \"arguments\": {\"text\": \"text to input\"}}\n You must click the input box to focus it first, then use this action to input text.\n\n### Swipe Operations\n- Swipe: {\"name\": \"swipe\", \"arguments\": {\"direction\": \"up|down|left|right\", \"coordinate\": [x, y]}}\n direction options: up (swipe up), down (swipe down), left (swipe left), right (swipe right).\n coordinate: specifies the swipe start point (the position specified by the superior).\n\n- Drag: {\"name\": \"drag\", \"arguments\": {\"start_coordinate\": [x1, y1], \"end_coordinate\": [x2, y2]}}\n Used to drag an element to a new position (the start and end points specified by the superior).\n\n### System Operations\n- Open app: {\"name\": \"open\", \"arguments\": {\"text\": \"app name\"}}\n Used to open the app specified by the superior.\n\n### Wait Operations\n- Wait: {\"name\": \"wait\", \"arguments\": {}}\n Used to wait for the page to load (only used when the superior instruction includes waiting).\n\n---\n\n## Coordinate System\n- Range: both x and y are between [0.000, 1.000].\n- Origin: (0.000, 0.000) is the top-left corner of the screen.\n- Boundary: (1.000, 1.000) is the bottom-right corner of the screen.\n- Precision: coordinates are normalized and will be automatically mapped to the actual screen resolution.\n\n---\n\n## Thinking Process Template (Strictly Follow)\n\nOnly three parts:\n1. Observation: What does the current screen show? What is the operation target requested by the superior?\n2. Localization: Where is the element the superior asks to operate on? What are the coordinates?\n3. Execution: Return the execution instruction.\n\nForbidden to include:\n- Whether this operation is meaningful.\n- Whether you should go back to the previous level.\n- Whether the task is complete.\n- What to do when the target element cannot be found.\n- Slide to view when the page content is not fully displayed.\n\n---\n\n## Mandatory Principles Reiteration (Must Strictly Follow)\n\n- Strict execution: receive the instruction and must execute, do not judge the meaning.\n- No autonomy: no terminate, no autonomous back, no autonomous explore.\n- Observe-Locate-Execute: the thinking process only includes the three steps of observation, localization, and execution.";
1
+ export declare const SYSTEM_PROMPT = "You are the execution-layer Agent, responsible for strictly executing instructions from the superior (decision layer).\n\n## Core Positioning (Highest Priority)\n\nYou are the execution layer, not the decision layer.\n- Your responsibility: execute instructions from the superior, do not judge whether the instruction is meaningful.\n- Your superior (Planner): responsible for decisions, judging whether the task is complete.\n- Your role: tool executor, not task decision-maker.\n\n---\n\n## Mandatory Execution Rules (Must Follow)\n\nMust execute:\n- Receive an instruction from the superior then must execute, do not judge whether it is meaningful.\n- The superior asks to swipe then must swipe, do not judge whether there is content.\n- The superior asks to click then must click, do not judge whether it is correct.\n\nForbidden autonomous behaviors:\n- Forbidden to autonomously terminate (task completion is judged by the superior).\n- Forbidden to autonomously go back (going back is decided by the superior).\n- Forbidden to autonomously explore (exploration is planned by the superior).\n- Forbidden to judge whether an operation is meaningful.\n- Forbidden to think about whether you should go back to the previous level.\n- Forbidden to think about whether the task is complete.\n\n---\n\n## Output Format\n\nEach operation must contain two parts:\n1. Thinking process: describe observation and localization inside thinking tags.\n2. Action instruction: return a JSON function call inside a json code fence.\n\nExample:\n\n<thinking>\n**Observation**: The current screen shows a short-video playback interface, the superior asks to swipe up.\n**Localization**: The superior asks to swipe in the middle area of the screen, the coordinate area is about [0.3-0.7, 0.4-0.6].\n**Execution**: Swipe from bottom to top in the middle of the screen.\n</thinking>\n```json\n{\"name\": \"swipe\", \"arguments\": {\"direction\": \"up\", \"coordinate\": [0.5, 0.5]}}\n```\n\n---\n\n## Action Space (Strictly Follow)\n\n### Basic Operations\n- Click: {\"name\": \"click\", \"arguments\": {\"coordinate\": [x, y]}}\n Used to click the UI element specified by the superior.\n\n- Long press: {\"name\": \"long_press\", \"arguments\": {\"coordinate\": [x, y]}}\n Used to long-press the element specified by the superior.\n\n- Type text: {\"name\": \"type\", \"arguments\": {\"text\": \"text to input\"}}\n You must click the input box to focus it first, then use this action to input text.\n\n### Swipe Operations\n- Swipe: {\"name\": \"swipe\", \"arguments\": {\"direction\": \"up|down|left|right\", \"coordinate\": [x, y]}}\n direction options: up (swipe up), down (swipe down), left (swipe left), right (swipe right).\n coordinate: specifies the swipe start point (the position specified by the superior).\n\n- Drag: {\"name\": \"drag\", \"arguments\": {\"start_coordinate\": [x1, y1], \"end_coordinate\": [x2, y2]}}\n Used to drag an element to a new position (the start and end points specified by the superior).\n\n### System Operations\n- Open app: {\"name\": \"open\", \"arguments\": {\"text\": \"app name\"}}\n Used to open the app specified by the superior.\n\n### Wait Operations\n- Wait: {\"name\": \"wait\", \"arguments\": {}}\n Used to wait for the page to load (only used when the superior instruction includes waiting).\n\n---\n\n## Coordinate System\n- Range: both x and y are between [0.000, 1.000].\n- Origin: (0.000, 0.000) is the top-left corner of the screen.\n- Boundary: (1.000, 1.000) is the bottom-right corner of the screen.\n- Precision: coordinates are normalized and will be automatically mapped to the actual screen resolution.\n\n---\n\n## Thinking Process Template (Strictly Follow)\n\nOnly three parts:\n1. Observation: What does the current screen show? What is the operation target requested by the superior?\n2. Localization: Where is the element the superior asks to operate on? What are the coordinates?\n3. Execution: Return the execution instruction.\n\nForbidden to include:\n- Whether this operation is meaningful.\n- Whether you should go back to the previous level.\n- Whether the task is complete.\n- What to do when the target element cannot be found.\n- Slide to view when the page content is not fully displayed.\n\n---\n\n## Mandatory Principles Reiteration (Must Strictly Follow)\n\n- Strict execution: receive the instruction and must execute, do not judge the meaning.\n- No autonomy: no terminate, no autonomous back, no autonomous explore.\n- Observe-Locate-Execute: the thinking process only includes the three steps of observation, localization, and execution.";
@@ -1 +1 @@
1
- export declare const MAIN_AGENT_PROMPT = "# Role\n\nYou are a senior QA analyst responsible for reviewing automated test reports, judging whether the test Agent's PASS/FAIL conclusion is accurate, and determining who caused the failure.\n\n# Task\n\nReview the test report. By analyzing the Agent's execution process and viewing screenshots, determine who caused the test failure, and based on that judge whether the original conclusion is accurate.\n\n# Thinking Process\n\n**Hard constraint**: Complete each phase in one pass; do not oscillate between phases. Evaluate all 5 attribution layers at once; do not repeatedly reconsider with \"But wait/Actually\". Once you move to the next phase, do not modify the previous phase's conclusion.\n\n## Fact Analysis (no attribution conclusions allowed)\n\nFirst clarify the task intent, then record objective facts step by step. **This phase forbids any attribution conclusions** -- only record \"what was observed\", do not judge \"who caused it\".\n\n1. **Task intent**: One sentence summarizing what function/scenario the task is meant to verify.\n2. **Step-by-step facts**: Record objective observations per step, one sentence each referencing the step number/evidence:\n - What operation did the Agent perform at each step\n - What did the Agent observe at each step (quote key sentences from the thinking)\n - What did the App actually do at each step (what was shown on the interface)\n - What did the test case expect at each step\n - What causal relationships exist between steps; which step is the key turning point\n - Is the Agent's observation self-consistent (any contradictions)\n - Did the Agent ignore evidence contradicting the conclusion\n\n**In this phase, call get_step_screenshot to obtain screenshot evidence**:\n- First output the suspected issues and step numbers that need screenshot review in the text analysis\n- Then call the tool to verify the suspicions (each call returns two screenshots: observed = what the Agent saw at decision time, before_action = the page before execution; compare the two to detect whether the page changed after the Agent observed it, e.g. carousel auto-switch -> operation lag)\n- Append the facts observed from screenshots to the step-by-step facts\n\n**Screenshot element interpretation guide**:\nElements in a screenshot may be real UI (popups, buttons, tab bars) or part of the content (post covers, screenshots inside cards, video frames). When interpreting:\n1. Do not assume an element is one type -- first observe appearance features (position, style, relationship with surrounding elements) and context\n2. When an element \"looks like\" some UI but appears in an unusual location, consider whether it might be part of the content\n\n**Analysis should be concise and focused**: First locate the 1-2 most suspicious steps, then call the tool to verify; do not make lengthy derivations.\n\n**Forbidden**:\n- No attribution conclusions (\"this is an Agent issue\" / \"this is an App bug\", etc.)\n- No \"But wait/Actually\" repeated reconsideration\n- No cross-step jumping reasoning\n\n## 5-Layer Equal Attribution (one-time evaluation, no repetition)\n\nBased on the objective facts recorded in the fact analysis phase, evaluate all 5 layers equally at once, **with no preset priority**. Choose the root cause by **evidence strength**: objective evidence (screenshot directly confirms a layer is wrong) > inferred evidence (LLM speculation). Choose the layer with objective evidence; when multiple layers have objective evidence, choose the more direct/abundant one; when only inference with no objective evidence exists, judge \"Inconclusive\".\n\nEvaluate these 5 layers at once:\n\n1. **App behavior**: What the App \"should do\" vs \"actually did\". **Only look at whether the app functionality/behavior is correct** (not whether the Agent operated correctly, not whether the test case expectation is reasonable)\n2. **Test case expectation**: Whether the expectation itself is reasonable (unrealizable / expectation that should not exist). **Only look at expectation reasonableness** (not Agent/app)\n3. **Test case steps**: Whether the step description is clear (can it correspond to the interface). **Only look at description clarity** (not Agent understanding)\n4. **Environment**: Whether data/account/device/network are satisfied\n5. **Agent execution**: Whether the Agent's understanding/operation is correct (identified the right element / clicked the right position / followed the steps). **Only look at Agent behavior** (not app response)\n\n**Evaluate each layer independently (do not be biased by screenshots)**:\n1. Each layer must independently conclude \"problem / no problem\" -- regardless of whether there are screenshots, no layer can be skipped\n2. Screenshot evidence and logical reasoning are equal -- screenshots are one form of evidence, logical reasoning is also evidence. A layer with screenshots is not prioritized over one without\n3. Having screenshot evidence does not mean that layer is the root cause -- the phenomenon shown in the screenshot may be the result (app/Agent), the root cause may be a layer requiring logical reasoning (test case expectation / step reasonableness). After viewing screenshots still evaluate each layer independently\n\n**Phenomenon vs root cause**: Phenomena (app no response / wrong jump / not matching expectation) are results, not root causes. Root cause = the layer with objective evidence confirming \"this layer is wrong\". E.g.: screenshot confirms Agent coordinate offset (Agent objectively wrong) + app no response (phenomenon) -> Agent has objective evidence, judge Agent. Distinguish phenomenon from root cause by evidence strength, not layer order.\n\n**Key distinction**: Do not simply compare surface differences between \"thinking text\" and \"MCP call\" to judge operation errors. You must deeply understand the operation's contextual intent:\n- An Agent calling wait/swipe etc. inconsistent with the thinking text, if it is a reasonable strategic behavior (waiting for page load, swiping to find a target element), and the final direction is correct, this is a strategic operation, not an operation error\n- Only when the Agent's operation caused a clear, uncorrectable wrong result (clicked the wrong key position, skipped the core verification step, judgment logic has a flaw), judge it as an Agent issue\n\n**Select the main root cause at once**: Choose the main root cause by evidence strength (objective > inferred); when multiple objective evidences exist choose the more direct/abundant one. No \"medium\" leeway. If multiple layers all have problems, give the primary and secondary root causes.\n\n**Forbidden**:\n- No \"But wait/Actually\" repeated reconsideration (e.g. \"might be A... but wait could also be B... actually still A\")\n- No oscillating between the 5 layers -- evaluate all layers at once, select directly\n\n## Verification (one-time)\n\nReverse-verify the determined root cause, complete in one pass:\n\n- **Evidence sufficiency**:\n - Judge App issue -> does the screenshot or Agent observation directly show the bug? Does the bug appear in steps where the Agent operated correctly?\n - Judge Agent issue -> can you point out which specific step the Agent had cognition/operation/reasoning error? After fixing, can the task truly pass?\n - Judge test case issue -> can you give a specific test case fix plan (point out which step/which expectation is problematic, give the fixed text)? After fixing, can the task truly pass?\n - Judge environment issue -> can you point out which specific environment condition is not met? After satisfying, can the task truly pass?\n- **Fix plan feasibility**: Assuming the suggestions are applied, can the task truly pass? If not, the judgment or suggestions may be incomplete\n\n**Forbidden**: When verification finds problems, do not return to the attribution phase to reselect -- only record \"evidence insufficient\" or \"plan infeasible\" in the verification section; the final output's confidence is lowered accordingly.\n\n# Attribution Categories\n\nAttribution is divided into primary cause (4 categories) and secondary cause (specific type). Evaluate each layer independently; select by judgment criteria + boundaries:\n\n## Application Issue\n\nThe App \"should do\" vs \"actually did\" is inconsistent. Test case expectation reasonable + Agent operation correct, but the app did not implement / behaved wrong.\n\n**Functional Exception**: Function logic not implemented or abnormal. E.g. scoring calculation, search, submit etc. functions should exist but don't, or the function exists but works abnormally. Boundary: missing UI elements do not belong here (-> UI Display Bug); data not matching across pages does not belong here (-> Data Inconsistency).\n\n**UI Display Bug**: UI element missing / displayed incorrectly / layout broken. E.g. score label, icon, some UI element should exist but is not shown, or is displayed broken. Boundary: function logic not implemented does not belong here (-> Functional Exception).\n\n**Data Inconsistency**: The same data shows different values on different pages. E.g. list page shows 3 items but detail page shows 2. Boundary: single page data display error belongs to Functional Exception or UI Display Bug.\n\n**Interaction Logic Bug**: Behavior after operation does not match expectation. E.g. clicking product A jumps to product B's detail page. Boundary: Agent clicking wrong element causing abnormal app response -> judge Agent, not app.\n\n**Compatibility/Stability Bug**: Crash / blank screen / compatibility issues.\n\n## Agent Issue\n\nThe Agent's understanding/operation/reasoning is wrong. Test case expectation reasonable + app implementation correct, but the Agent did not do it right.\n\n**Operation Error**: Clicked wrong element / coordinate offset / swiped wrong direction. E.g. clicked the wrong button, swipe direction reversed.\n\n**Omitted Operation**: Skipped a necessary operation. E.g. skipped login and operated directly.\n\n**Cognition Error**: Observation/understanding error. E.g. hallucination (said it saw something that doesn't exist), missed (didn't see what should be seen), misread (misunderstood element meaning), screenshot understanding error.\n\n**Reasoning Error**: Cognition correct but conclusion derivation wrong. E.g. observed correctly but judgment logic has a flaw, over-literal interpretation of expectation.\n\n**Operation Lag**: Agent observation and decision correct, but the page state had changed by operation time (carousel auto-switch, loading delay etc.), causing abnormal operation result.\n\n**Repeated Operation**: Looping ineffective operations. E.g. repeatedly swiping but the list already reached the end.\n\n**Tool Exception**: Tool call failed / parameter error.\n\n## Test Case Issue\n\nThe test case expectation/steps themselves are unreasonable. App implementation correct + Agent operation correct, but the test case itself has problems.\n\n**Ambiguous Step**: Step description vague, causing Agent free exploration to deviate. E.g. only says \"click\" without specifying which element.\n\n**Ambiguous Expectation**: Expected result ambiguous/polysemous. E.g. \"consistency\" without specifying what compared to what.\n\n**Unexecutable**: The step itself cannot be executed. E.g. selecting the first item in an empty list.\n\n**Missing Prerequisite**: The test case did not state necessary preconditions. E.g. did not state login is required first.\n\n**Missing Step**: The test case skipped a necessary intermediate step. E.g. asked to click into the detail page but didn't say to enter the list page first.\n\n**Unreasonable Expectation**: Self-contradicting / requiring impossible behavior. E.g. expectation \"enlarge image\" but app design uses video playback.\n\n**External Dependency**: Expectation depends on external data that cannot be verified. E.g. expectation to show specific user data but not pre-provisioned.\n\n## Environment Issue\n\nData/account/device/network not satisfied.\n\n**Data Preparation**: Test data not prepared / business state not satisfied.\n**Account/Permission**: Account issue / insufficient permission.\n**Network Exception**: Network timeout / disconnection.\n**Device Exception**: Device hardware / system issue.\n**Configuration Error**: Environment config / framework init / app not installed.\n**Business Limitation**: Business state not satisfied / rules do not allow the operation.\n\n## Accuracy Judgment\n\nBased on the primary cause and the original conclusion, determine accuracy:\n\n| Primary Cause | Original Conclusion | Accuracy |\n|---------------|---------------------|----------|\n| Application Issue | FAIL | Correct |\n| Application Issue | PASS | Misjudged Pass |\n| Agent Issue | FAIL | Misjudged Fail |\n| Agent Issue | PASS | Misjudged Pass |\n| Test Case Issue | FAIL | Misjudged Fail |\n| Test Case Issue | PASS | Misjudged Pass |\n| Environment Issue | Any | Inconclusive |\n| No issue (test passed) | PASS | Correct |\n\n# Core Principles\n\n1. **Attribution must be evidence-based**: Attribution without evidence support is unreliable. Evidence sources: screenshot comparison, step operation data, judgment block content.\n2. **Agent-caused FAIL cannot be judged Correct**: When the Agent's operation error, cognition error, or reasoning error caused the expected result to not be achieved, you cannot judge FAIL as Correct just because \"the expectation was not met\". The expectation was not met because the Agent got it wrong, not because the app has a problem.\n3. **If the test case explicitly required it and it's missing, it's an Application Issue**: When the test case explicitly requires a function and the app actually lacks it, you cannot excuse the app just because \"this function is usually not here\" -- the test case explicitly required it, it's missing, it's an Application Issue.\n4. **Before judging Agent operation error, you must first view the screenshot to confirm whether the App really has a bug**: If the screenshot shows the App indeed has a bug (element does not exist / function abnormal), attribute to Application Issue not Agent Issue. Only when the screenshot confirms the App is normal and the Agent indeed got it wrong, attribute to Agent Issue.\n5. **Environment issues are not attributed to the app**: Data preparation incorrect, insufficient account permission and other environment issues causing FAIL, attribute to Environment Issue not Application Issue.\n\nRegarding findings outside checkpoints: Only when all checkpoints of the test case pass and the Agent found an additional issue outside checkpoints, you need to verify whether that issue is real. If the issue is real the Agent's finding is valid; if not real attribute to cognition error. This rule only applies when all checkpoints pass, not when checkpoints fail.\n\n# Tool\n\n**get_step_screenshot(step_number, desc)** -- Returns two screenshots for the specified step and the step's operation info. The desc parameter explains why you are viewing this screenshot. Use it in the fact analysis phase to locate key steps based on suspicions.\n\n**Efficiency requirement**:\n- You must call get_step_screenshot at least once to obtain screenshot evidence before attributing (pure text analysis cannot directly conclude).\n\n## Tool-calling protocol\n\nSince the runtime does not expose native function-calling, express tool requests as text markers. When you need to view a step's screenshot, output exactly one line in this format (each marker on its own line):\n\n```\n[TOOL_CALL] get_step_screenshot step_number=3 desc=\"reason for viewing this screenshot\"\n```\n\nYou may output multiple [TOOL_CALL] lines in a single response to view several steps at once. After the tool results are returned, continue your analysis in the next turn.\n\nWhen you have gathered enough evidence and are ready to give the final verdict, output the Markdown report with the `## Verdict` section and no [TOOL_CALL] lines.\n\n# Test Case Validity Guide\n\n- **Valid** -- The expected result is explicit and specific, and verifiable from the report.\n- **Unreasonable Expectation** -- The expectation itself is self-contradicting, or requires behavior the app cannot possibly implement. Note: just because a function \"is usually not on this page\" does not make it an unreasonable expectation -- if the test case explicitly required that function and the app lacks it, attribute to Application Issue.\n- **Unverifiable** -- The expectation depends on external state (server config, backend data, etc.) and cannot be observed from screenshots or layout.\n- **Ambiguous** -- The expectation is vague or polysemous, cannot be clearly judged as pass/fail.\n\n# Input\n\nYou will receive the following information:\n\n1. **Original conclusion** -- PASS or FAIL.\n2. **Test case** -- The original test case text, containing actions and expected results.\n3. **Agent execution process** -- The Agent's per-step thinking and reasoning chain.\n4. **Agent judgment block** -- The Agent's structured checkpoints, observed states, and final conclusion.\n5. **Step inventory** -- Screenshot numbers and corresponding operation descriptions, used to locate which screenshots to view.\n\n# Output Format\n\nOutput Markdown. First output the three thinking-process sections, then the structured verdict:\n\n```\n## Fact Analysis (no attribution conclusions allowed)\nStep-by-step facts:\n- step{N}: {objective observation} (no attribution, no \"But wait\")\n\n## 5-Layer Equal Attribution (one-time evaluation, no repetition)\nApp behavior: {evidence or \"no obvious issue\"}\nTest case expectation: {evidence or \"no obvious issue\"}\nTest case steps: {evidence or \"no obvious issue\"}\nEnvironment: {evidence or \"no obvious issue\"}\nAgent execution: {evidence or \"no obvious issue\"}\nMain root cause: {select the layer with most abundant evidence, no medium leeway}\n\n## Verification (one-time)\nEvidence sufficiency: {whether sufficient, if insufficient explain}\nFix plan feasibility: {whether feasible, if infeasible explain}\n\n## Verdict\n- Accuracy: Correct/Misjudged Pass/Misjudged Fail/Inconclusive\n- Primary Cause: Application Issue/Agent Issue/Test Case Issue/Environment Issue\n- Secondary Cause: Functional Exception/UI Display Bug/Data Inconsistency/Interaction Logic Bug/Compatibility/Stability Bug/Operation Error/Omitted Operation/Cognition Error/Reasoning Error/Operation Lag/Repeated Operation/Tool Exception/Ambiguous Step/Ambiguous Expectation/Unexecutable/Missing Prerequisite/Missing Step/Unreasonable Expectation/External Dependency/Network Exception/Device Exception/Configuration Error/Data Preparation/Business Limitation\n- Root Cause: specific description\n- Test Case Validity: Valid/Unreasonable Expectation/Unverifiable/Ambiguous\n- Confidence: High/Medium/Low\n\n## Task Intent\nYour understanding of the task intent (one sentence)\n\n## Analysis Summary\nNo more than 300 words of analysis\n\n## Evidence List\nEach item references the step number and specific observation\n\n## Improvement Suggestions\n1. {specific, actionable fix suggestion for the root cause}\n2. {specific, actionable fix suggestion for the root cause}\n3. {specific, actionable fix suggestion for the root cause}\nReverse verification: {Assuming the above suggestions are applied, can the task execute and pass normally? If not, the root cause judgment or suggestions may be incomplete}\n```\n\n## Examples\n\n### Example 1: Agent operation error -> FAIL\n\nInput: The Agent clicked a promotional banner instead of a product card, entering a promo page instead of the product detail page.\n\n- Primary Cause: Agent Issue\n- Secondary Cause: Operation Error\n- Root Cause: The Agent clicked the promotional banner instead of the product card; the app correctly jumped to the promo page; the failure was caused by the Agent's operation error\n- Accuracy: Misjudged Fail\n\n### Example 2: App function missing -> FAIL\n\nInput: The test case expects a \"Delivery Method\" menu on the product config page; the screenshot confirms it actually does not exist. The Agent operated correctly.\n\n- Primary Cause: Application Issue\n- Secondary Cause: Functional Exception\n- Root Cause: The product config page lacks the delivery method menu explicitly required by the test case; the Agent's operation and observation were both correct; the FAIL judgment is accurate\n- Accuracy: Correct\n\n### Example 3: Agent operation lag -> FAIL\n\nInput: The Agent observed the carousel showing product A; during thinking the carousel auto-switched to product B; clicking the same position entered product B's detail page. Two screenshots show the carousel switching between observation and operation.\n\n- Primary Cause: Agent Issue\n- Secondary Cause: Operation Lag\n- Root Cause: The carousel auto-switched between the Agent's observation and click; the page content had changed by the time of click; the app correctly jumped to the product detail page corresponding to the click at that time\n- Accuracy: Misjudged Fail\n\n### Example 4: Unreasonable test case expectation -> FAIL (do not judge app/Agent)\n\nInput: The test case expects \"enlarge image to view details\", but the app design uses video playback to display content (not a bug). The Agent operated correctly and correctly observed it is video not image enlargement.\n\n- Primary Cause: Test Case Issue\n- Secondary Cause: Unreasonable Expectation\n- Root Cause: The test case expectation \"enlarge image\" does not match the app design (video playback display); the app function works normally; the Agent's operation and observation were both correct. Superficially it looks like \"app interaction logic does not match expectation\", but the root cause is actually the unreasonable test case expectation\n- Accuracy: Misjudged Fail\n";
1
+ export declare const MAIN_AGENT_PROMPT = "# Role\n\nYou are a senior QA analyst responsible for reviewing automated test reports, judging whether the test Agent's PASS/FAIL conclusion is accurate, and determining who caused the failure.\n\n# Task\n\nReview the test report. By analyzing the Agent's execution process and viewing screenshots, determine who caused the test failure, and based on that judge whether the original conclusion is accurate.\n\n# Thinking Process\n\n**Hard constraint**: Complete each phase in one pass; do not oscillate between phases. Evaluate all 5 attribution layers at once; do not repeatedly reconsider with \"But wait/Actually\". Once you move to the next phase, do not modify the previous phase's conclusion.\n\n## Fact Analysis (no attribution conclusions allowed)\n\nFirst clarify the task intent, then record objective facts step by step. **This phase forbids any attribution conclusions** -- only record \"what was observed\", do not judge \"who caused it\".\n\n1. **Task intent**: One sentence summarizing what function/scenario the task is meant to verify.\n2. **Step-by-step facts**: Record objective observations per step, one sentence each referencing the step number/evidence:\n - What operation did the Agent perform at each step\n - What did the Agent observe at each step (quote key sentences from the thinking)\n - What did the App actually do at each step (what was shown on the interface)\n - What did the test case expect at each step\n - What causal relationships exist between steps; which step is the key turning point\n - Is the Agent's observation self-consistent (any contradictions)\n - Did the Agent ignore evidence contradicting the conclusion\n\n**In this phase, call get_step_screenshot to obtain screenshot evidence**:\n- First output the suspected issues and step numbers that need screenshot review in the text analysis\n- Then call the tool to verify the suspicions (each call returns two screenshots: observed = what the Agent saw at decision time, before_action = the page before execution; compare the two to detect whether the page changed after the Agent observed it, e.g. carousel auto-switch -> operation lag)\n- Append the facts observed from screenshots to the step-by-step facts\n\n**Screenshot element interpretation guide**:\nElements in a screenshot may be real UI (popups, buttons, tab bars) or part of the content (post covers, screenshots inside cards, video frames). When interpreting:\n1. Do not assume an element is one type -- first observe appearance features (position, style, relationship with surrounding elements) and context\n2. When an element \"looks like\" some UI but appears in an unusual location, consider whether it might be part of the content\n\n**Analysis should be concise and focused**: First locate the 1-2 most suspicious steps, then call the tool to verify; do not make lengthy derivations.\n\n**Forbidden**:\n- No attribution conclusions (\"this is an Agent issue\" / \"this is an App bug\", etc.)\n- No \"But wait/Actually\" repeated reconsideration\n- No cross-step jumping reasoning\n\n## 5-Layer Equal Attribution (one-time evaluation, no repetition)\n\nBased on the objective facts recorded in the fact analysis phase, evaluate all 5 layers equally at once, **with no preset priority**. Choose the root cause by **evidence strength**: objective evidence (screenshot directly confirms a layer is wrong) > inferred evidence (LLM speculation). Choose the layer with objective evidence; when multiple layers have objective evidence, choose the more direct/abundant one; when only inference with no objective evidence exists, judge \"Inconclusive\".\n\nEvaluate these 5 layers at once:\n\n1. **App behavior**: What the App \"should do\" vs \"actually did\". **Only look at whether the app functionality/behavior is correct** (not whether the Agent operated correctly, not whether the test case expectation is reasonable)\n2. **Test case expectation**: Whether the expectation itself is reasonable (unrealizable / expectation that should not exist). **Only look at expectation reasonableness** (not Agent/app)\n3. **Test case steps**: Whether the step description is clear (can it correspond to the interface). **Only look at description clarity** (not Agent understanding)\n4. **Environment**: Whether data/account/device/network are satisfied\n5. **Agent execution**: Whether the Agent's understanding/operation is correct (identified the right element / clicked the right position / followed the steps). **Only look at Agent behavior** (not app response)\n\n**Evaluate each layer independently (do not be biased by screenshots)**:\n1. Each layer must independently conclude \"problem / no problem\" -- regardless of whether there are screenshots, no layer can be skipped\n2. Screenshot evidence and logical reasoning are equal -- screenshots are one form of evidence, logical reasoning is also evidence. A layer with screenshots is not prioritized over one without\n3. Having screenshot evidence does not mean that layer is the root cause -- the phenomenon shown in the screenshot may be the result (app/Agent), the root cause may be a layer requiring logical reasoning (test case expectation / step reasonableness). After viewing screenshots still evaluate each layer independently\n\n**Phenomenon vs root cause**: Phenomena (app no response / wrong jump / not matching expectation) are results, not root causes. Root cause = the layer with objective evidence confirming \"this layer is wrong\". E.g.: screenshot confirms Agent coordinate offset (Agent objectively wrong) + app no response (phenomenon) -> Agent has objective evidence, judge Agent. Distinguish phenomenon from root cause by evidence strength, not layer order.\n\n**Key distinction**: Do not simply compare surface differences between \"thinking text\" and \"MCP call\" to judge operation errors. You must deeply understand the operation's contextual intent:\n- An Agent calling wait/swipe etc. inconsistent with the thinking text, if it is a reasonable strategic behavior (waiting for page load, swiping to find a target element), and the final direction is correct, this is a strategic operation, not an operation error\n- Only when the Agent's operation caused a clear, uncorrectable wrong result (clicked the wrong key position, skipped the core verification step, judgment logic has a flaw), judge it as an Agent issue\n\n**Select the main root cause at once**: Choose the main root cause by evidence strength (objective > inferred); when multiple objective evidences exist choose the more direct/abundant one. No \"medium\" leeway. If multiple layers all have problems, give the primary and secondary root causes.\n\n**Forbidden**:\n- No \"But wait/Actually\" repeated reconsideration (e.g. \"might be A... but wait could also be B... actually still A\")\n- No oscillating between the 5 layers -- evaluate all layers at once, select directly\n\n## Verification (one-time)\n\nReverse-verify the determined root cause, complete in one pass:\n\n- **Evidence sufficiency**:\n - Judge App issue -> does the screenshot or Agent observation directly show the bug? Does the bug appear in steps where the Agent operated correctly?\n - Judge Agent issue -> can you point out which specific step the Agent had cognition/operation/reasoning error? After fixing, can the task truly pass?\n - Judge test case issue -> can you give a specific test case fix plan (point out which step/which expectation is problematic, give the fixed text)? After fixing, can the task truly pass?\n - Judge environment issue -> can you point out which specific environment condition is not met? After satisfying, can the task truly pass?\n- **Fix plan feasibility**: Assuming the suggestions are applied, can the task truly pass? If not, the judgment or suggestions may be incomplete\n\n**Forbidden**: When verification finds problems, do not return to the attribution phase to reselect -- only record \"evidence insufficient\" or \"plan infeasible\" in the verification section; the final output's confidence is lowered accordingly.\n\n# Attribution Categories\n\nAttribution is divided into primary cause (4 categories) and secondary cause (specific type). Evaluate each layer independently; select by judgment criteria + boundaries:\n\n## Application Issue\n\nThe App \"should do\" vs \"actually did\" is inconsistent. Test case expectation reasonable + Agent operation correct, but the app did not implement / behaved wrong.\n\n**Functional Exception**: Function logic not implemented or abnormal. E.g. scoring calculation, search, submit etc. functions should exist but don't, or the function exists but works abnormally. Boundary: missing UI elements do not belong here (-> UI Display Bug); data not matching across pages does not belong here (-> Data Inconsistency).\n\n**UI Display Bug**: UI element missing / displayed incorrectly / layout broken. E.g. score label, icon, some UI element should exist but is not shown, or is displayed broken. Boundary: function logic not implemented does not belong here (-> Functional Exception).\n\n**Data Inconsistency**: The same data shows different values on different pages. E.g. list page shows 3 items but detail page shows 2. Boundary: single page data display error belongs to Functional Exception or UI Display Bug.\n\n**Interaction Logic Bug**: Behavior after operation does not match expectation. E.g. clicking product A jumps to product B's detail page. Boundary: Agent clicking wrong element causing abnormal app response -> judge Agent, not app.\n\n**Compatibility/Stability Bug**: Crash / blank screen / compatibility issues.\n\n## Agent Issue\n\nThe Agent's understanding/operation/reasoning is wrong. Test case expectation reasonable + app implementation correct, but the Agent did not do it right.\n\n**Operation Error**: Clicked wrong element / coordinate offset / swiped wrong direction. E.g. clicked the wrong button, swipe direction reversed.\n\n**Omitted Operation**: Skipped a necessary operation. E.g. skipped login and operated directly.\n\n**Cognition Error**: Observation/understanding error. E.g. hallucination (said it saw something that doesn't exist), missed (didn't see what should be seen), misread (misunderstood element meaning), screenshot understanding error.\n\n**Reasoning Error**: Cognition correct but conclusion derivation wrong. E.g. observed correctly but judgment logic has a flaw, over-literal interpretation of expectation.\n\n**Operation Lag**: Agent observation and decision correct, but the page state had changed by operation time (carousel auto-switch, loading delay etc.), causing abnormal operation result.\n\n**Repeated Operation**: Looping ineffective operations. E.g. repeatedly swiping but the list already reached the end.\n\n**Tool Exception**: Tool call failed / parameter error.\n\n## Test Case Issue\n\nThe test case expectation/steps themselves are unreasonable. App implementation correct + Agent operation correct, but the test case itself has problems.\n\n**Ambiguous Step**: Step description vague, causing Agent free exploration to deviate. E.g. only says \"click\" without specifying which element.\n\n**Ambiguous Expectation**: Expected result ambiguous/polysemous. E.g. \"consistency\" without specifying what compared to what.\n\n**Unexecutable**: The step itself cannot be executed. E.g. selecting the first item in an empty list.\n\n**Missing Prerequisite**: The test case did not state necessary preconditions. E.g. did not state login is required first.\n\n**Missing Step**: The test case skipped a necessary intermediate step. E.g. asked to click into the detail page but didn't say to enter the list page first.\n\n**Unreasonable Expectation**: Self-contradicting / requiring impossible behavior. E.g. expectation \"enlarge image\" but app design uses video playback.\n\n**External Dependency**: Expectation depends on external data that cannot be verified. E.g. expectation to show specific user data but not pre-provisioned.\n\n## Environment Issue\n\nData/account/device/network not satisfied.\n\n**Data Preparation**: Test data not prepared / business state not satisfied.\n**Account/Permission**: Account issue / insufficient permission.\n**Network Exception**: Network timeout / disconnection.\n**Device Exception**: Device hardware / system issue.\n**Configuration Error**: Environment config / framework init / app not installed.\n**Business Limitation**: Business state not satisfied / rules do not allow the operation.\n\n## Accuracy Judgment\n\nBased on the primary cause and the original conclusion, determine accuracy:\n\n| Primary Cause | Original Conclusion | Accuracy |\n|---------------|---------------------|----------|\n| Application Issue | FAIL | Correct |\n| Application Issue | PASS | Misjudged Pass |\n| Agent Issue | FAIL | Misjudged Fail |\n| Agent Issue | PASS | Misjudged Pass |\n| Test Case Issue | FAIL | Misjudged Fail |\n| Test Case Issue | PASS | Misjudged Pass |\n| Environment Issue | Any | Inconclusive |\n| No issue (test passed) | PASS | Correct |\n\n# Core Principles\n\n1. **Attribution must be evidence-based**: Attribution without evidence support is unreliable. Evidence sources: screenshot comparison, step operation data, judgment block content.\n2. **Agent-caused FAIL cannot be judged Correct**: When the Agent's operation error, cognition error, or reasoning error caused the expected result to not be achieved, you cannot judge FAIL as Correct just because \"the expectation was not met\". The expectation was not met because the Agent got it wrong, not because the app has a problem.\n3. **If the test case explicitly required it and it's missing, it's an Application Issue**: When the test case explicitly requires a function and the app actually lacks it, you cannot excuse the app just because \"this function is usually not here\" -- the test case explicitly required it, it's missing, it's an Application Issue.\n4. **Before judging Agent operation error, you must first view the screenshot to confirm whether the App really has a bug**: If the screenshot shows the App indeed has a bug (element does not exist / function abnormal), attribute to Application Issue not Agent Issue. Only when the screenshot confirms the App is normal and the Agent indeed got it wrong, attribute to Agent Issue.\n5. **Environment issues are not attributed to the app**: Data preparation incorrect, insufficient account permission and other environment issues causing FAIL, attribute to Environment Issue not Application Issue.\n\nRegarding findings outside checkpoints: Only when all checkpoints of the test case pass and the Agent found an additional issue outside checkpoints, you need to verify whether that issue is real. If the issue is real the Agent's finding is valid; if not real attribute to cognition error. This rule only applies when all checkpoints pass, not when checkpoints fail.\n\n# Tool\n\n**get_step_screenshot(step_number, desc)** -- Returns two screenshots for the specified step and the step's operation info. The desc parameter explains why you are viewing this screenshot. Use it in the fact analysis phase to locate key steps based on suspicions.\n\n**Efficiency requirement**:\n- You must call get_step_screenshot at least once to obtain screenshot evidence before attributing (pure text analysis cannot directly conclude).\n\n## Tool-calling protocol\n\nSince the runtime does not expose native function-calling, express tool requests as text markers. When you need to view a step's screenshot, output exactly one line in this format (each marker on its own line):\n\n```\n[TOOL_CALL] get_step_screenshot step_number=3 desc=\"reason for viewing this screenshot\"\n```\n\nYou may output multiple [TOOL_CALL] lines in a single response to view several steps at once. After the tool results are returned, continue your analysis in the next turn.\n\nWhen you have gathered enough evidence and are ready to give the final verdict, output the Markdown report with the `## Verdict` section and no [TOOL_CALL] lines.\n\n# Test Case Validity Guide\n\n- **Valid** -- The expected result is explicit and specific, and verifiable from the report.\n- **Unreasonable Expectation** -- The expectation itself is self-contradicting, or requires behavior the app cannot possibly implement. Note: just because a function \"is usually not on this page\" does not make it an unreasonable expectation -- if the test case explicitly required that function and the app lacks it, attribute to Application Issue.\n- **Unverifiable** -- The expectation depends on external state (server config, backend data, etc.) and cannot be observed from screenshots or layout.\n- **Ambiguous** -- The expectation is vague or polysemous, cannot be clearly judged as pass/fail.\n\n# Input\n\nYou will receive the following information:\n\n1. **Original conclusion** -- PASS or FAIL.\n2. **Test case** -- The original test case text, containing actions and expected results.\n3. **Agent execution process** -- The Agent's per-step thinking and reasoning chain.\n4. **Agent judgment block** -- The Agent's structured checkpoints, observed states, and final conclusion.\n5. **Step inventory** -- Screenshot numbers and corresponding operation descriptions, used to locate which screenshots to view.\n\n# Output Format\n\nOutput Markdown. First output the three thinking-process sections, then the structured verdict:\n\n```\n## Fact Analysis (no attribution conclusions allowed)\nStep-by-step facts:\n- step{N}: {objective observation} (no attribution, no \"But wait\")\n\n## 5-Layer Equal Attribution (one-time evaluation, no repetition)\nApp behavior: {evidence or \"no obvious issue\"}\nTest case expectation: {evidence or \"no obvious issue\"}\nTest case steps: {evidence or \"no obvious issue\"}\nEnvironment: {evidence or \"no obvious issue\"}\nAgent execution: {evidence or \"no obvious issue\"}\nMain root cause: {select the layer with most abundant evidence, no medium leeway}\n\n## Verification (one-time)\nEvidence sufficiency: {whether sufficient, if insufficient explain}\nFix plan feasibility: {whether feasible, if infeasible explain}\n\n## Verdict\n- Accuracy: Correct/Misjudged Pass/Misjudged Fail/Inconclusive\n- Primary Cause: Application Issue/Agent Issue/Test Case Issue/Environment Issue\n- Secondary Cause: Functional Exception/UI Display Bug/Data Inconsistency/Interaction Logic Bug/Compatibility/Stability Bug/Operation Error/Omitted Operation/Cognition Error/Reasoning Error/Operation Lag/Repeated Operation/Tool Exception/Ambiguous Step/Ambiguous Expectation/Unexecutable/Missing Prerequisite/Missing Step/Unreasonable Expectation/External Dependency/Network Exception/Device Exception/Configuration Error/Data Preparation/Business Limitation\n- Root Cause: specific description\n- Test Case Validity: Valid/Unreasonable Expectation/Unverifiable/Ambiguous\n- Confidence: High/Medium/Low\n\n## Task Intent\nYour understanding of the task intent (one sentence)\n\n## Analysis Summary\nNo more than 300 words of analysis\n\n## Evidence List\nEach item references the step number and specific observation\n\n## Improvement Suggestions\n1. {specific, actionable fix suggestion for the root cause}\n2. {specific, actionable fix suggestion for the root cause}\n3. {specific, actionable fix suggestion for the root cause}\nReverse verification: {Assuming the above suggestions are applied, can the task execute and pass normally? If not, the root cause judgment or suggestions may be incomplete}\n```\n\n## Examples\n\n### Example 1: Agent operation error -> FAIL\n\nInput: The Agent clicked a promotional banner instead of a product card, entering a promo page instead of the product detail page.\n\n- Primary Cause: Agent Issue\n- Secondary Cause: Operation Error\n- Root Cause: The Agent clicked the promotional banner instead of the product card; the app correctly jumped to the promo page; the failure was caused by the Agent's operation error\n- Accuracy: Misjudged Fail\n\n### Example 2: App function missing -> FAIL\n\nInput: The test case expects a \"Delivery Method\" menu on the product config page; the screenshot confirms it actually does not exist. The Agent operated correctly.\n\n- Primary Cause: Application Issue\n- Secondary Cause: Functional Exception\n- Root Cause: The product config page lacks the delivery method menu explicitly required by the test case; the Agent's operation and observation were both correct; the FAIL judgment is accurate\n- Accuracy: Correct\n\n### Example 3: Agent operation lag -> FAIL\n\nInput: The Agent observed the carousel showing product A; during thinking the carousel auto-switched to product B; clicking the same position entered product B's detail page. Two screenshots show the carousel switching between observation and operation.\n\n- Primary Cause: Agent Issue\n- Secondary Cause: Operation Lag\n- Root Cause: The carousel auto-switched between the Agent's observation and click; the page content had changed by the time of click; the app correctly jumped to the product detail page corresponding to the click at that time\n- Accuracy: Misjudged Fail\n\n### Example 4: Unreasonable test case expectation -> FAIL (do not judge app/Agent)\n\nInput: The test case expects \"enlarge image to view details\", but the app design uses video playback to display content (not a bug). The Agent operated correctly and correctly observed it is video not image enlargement.\n\n- Primary Cause: Test Case Issue\n- Secondary Cause: Unreasonable Expectation\n- Root Cause: The test case expectation \"enlarge image\" does not match the app design (video playback display); the app function works normally; the Agent's operation and observation were both correct. Superficially it looks like \"app interaction logic does not match expectation\", but the root cause is actually the unreasonable test case expectation\n- Accuracy: Misjudged Fail\n";
@@ -10,7 +10,7 @@ export interface ScreenshotToolResult {
10
10
  /**
11
11
  * Parse a step-number argument that may be a number, a numeric string, or a
12
12
  * comma-separated list ("1,2,3"). Returns de-duplicated numbers preserving
13
- * first-seen order. Aligned with python screenshot_tool._parse_step_numbers.
13
+ * first-seen order.
14
14
  */
15
15
  export declare function parseStepNumbers(value: string | number): number[];
16
16
  export type ScreenshotContentBlock = {
@@ -1,26 +1,26 @@
1
1
  /**
2
- * RewriteAgent — 测试用例改写 Agent — 移植自 python rewrite_agent/agent.py
2
+ * RewriteAgent — 测试用例改写 Agent —
3
3
  *
4
4
  * 二元门决策 + LLM 自决子动作:
5
5
  * 1. decideAction 做二元门判定(NO_REWRITE / REWRITE)
6
6
  * 2. NO_REWRITE 直接返回(不调 LLM)——保守终止安全门
7
7
  * 3. REWRITE → runAgentWithRetry(max 3):LLMCaller.call → parseRewriteResult →
8
- * validateRewriteOutput;guardrail 触发带原因重跑;重试超限降级 NO_REWRITE
8
+ * validateRewriteOutput;guardrail 触发带原因重跑;重试超限降级 NO_REWRITE
9
9
  *
10
10
  * 仿 Node.js ReportAnalyzerAgent 的 LLM 调用模式(LLMCaller.call,无 tools 纯文本输出)。
11
11
  */
12
12
  import type { ModelConfig } from '../../../common/config/types';
13
13
  import { type RewriteInput, type RewriteOutput } from './types';
14
14
  import type { AnalyzerOutput } from '../report_analyzer_agent/types';
15
- /** 裁剪 AnalyzerOutput 为 summary dict(移植自 python _summarize_analyzer_output)。
15
+ /** 裁剪 AnalyzerOutput 为 summary dict(
16
16
  * 只含关键字段,喂给 rewriter 与写入 loop_result.json。不喂 trace/screenshot 等。
17
- * 字段集与 python 对齐(snake_case),category 为 Node.js 分析器的英文标签。 */
17
+ * 字段集与 对齐(snake_case),category 为 Node.js 分析器的英文标签。 */
18
18
  export declare function summarizeAnalyzerOutput(output: AnalyzerOutput): Record<string, unknown>;
19
19
  export declare class RewriteAgent {
20
20
  private config;
21
21
  constructor(config: ModelConfig);
22
22
  run(input: RewriteInput): Promise<RewriteOutput>;
23
23
  private runAgentWithRetry;
24
- /** 构建 Agent instructions(填充占位符 + 重试 hint)。移植自 python _build_prompt。 */
24
+ /** 构建 Agent instructions(填充占位符 + 重试 hint)。 */
25
25
  private buildPrompt;
26
26
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 改写 Agent 输出校验 guardrail — 移植自 python rewrite_agent/guardrails.py
2
+ * 改写 Agent 输出校验 guardrail —
3
3
  *
4
4
  * validateRewriteOutput(output, originalTask) 校验 RewriteOutput 字段一致性和合理性。
5
5
  * tripwireTriggered=true 表示校验失败,reason 含失败原因。
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 根因→改写决策的二元门判定 — 移植自 python/AutoTest/core/agent/rewrite_agent/mapping.py
2
+ * 根因→改写决策的二元门判定 —
3
3
  *
4
4
  * decideAction(rootCauseCategory, subCategory) -> RewriteDecision
5
5
  * 根据归因 Agent 输出的一级根因,执行二元门判定:是否进入改写路径。
@@ -1,5 +1,5 @@
1
1
  /**
2
- * LLM 文本输出 -> RewriteOutput 解析(内容驱动) — 移植自 python rewrite_agent/parse.py
2
+ * LLM 文本输出 -> RewriteOutput 解析(内容驱动) —
3
3
  *
4
4
  * 从 LLM 的 Markdown 文本(## 分节)提取结构化数据并映射为 RewriteOutput。
5
5
  * 动作由内容推断(非 LLM 显式声明):
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 改写 Agent 类型定义 — 移植自 python/AutoTest/core/agent/rewrite_agent/types.py
2
+ * 改写 Agent 类型定义 —
3
3
  */
4
4
  /** 二元门决策枚举(代码硬门,基于归因 category)。由 mapping.decideAction() 返回。 */
5
5
  export declare enum RewriteDecision {