@autotest/agent 0.0.2 → 0.0.4

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 (530) hide show
  1. package/README.md +166 -95
  2. package/dist/api/agent_api.d.ts +3 -7
  3. package/dist/api/agent_api.js +12 -12
  4. package/dist/api/autotest_agent.d.ts +0 -1
  5. package/dist/api/autotest_agent.js +0 -1
  6. package/dist/api/types.d.ts +0 -1
  7. package/dist/api/types.js +0 -1
  8. package/dist/autotest-cli.d.ts +0 -1
  9. package/dist/autotest-cli.js +9 -3
  10. package/dist/common/case_manager.d.ts +0 -1
  11. package/dist/common/case_manager.js +0 -1
  12. package/dist/common/collect_case.d.ts +0 -1
  13. package/dist/common/collect_case.js +0 -1
  14. package/dist/common/common_errors.d.ts +0 -1
  15. package/dist/common/common_errors.js +0 -1
  16. package/dist/common/config/config.yaml +134 -113
  17. package/dist/common/config/config_validator.d.ts +0 -1
  18. package/dist/common/config/config_validator.js +0 -1
  19. package/dist/common/config/manager.d.ts +0 -1
  20. package/dist/common/config/manager.js +0 -1
  21. package/dist/common/config/output.d.ts +0 -1
  22. package/dist/common/config/output.js +0 -1
  23. package/dist/common/config/types.d.ts +2243 -2244
  24. package/dist/common/config/types.js +2 -3
  25. package/dist/common/dfx/client_factory.d.ts +0 -1
  26. package/dist/common/dfx/client_factory.js +0 -1
  27. package/dist/common/dfx/context.d.ts +0 -1
  28. package/dist/common/dfx/context.js +0 -1
  29. package/dist/common/dfx/index.d.ts +0 -1
  30. package/dist/common/dfx/index.js +0 -1
  31. package/dist/common/dfx/recorder.d.ts +0 -1
  32. package/dist/common/dfx/recorder.js +0 -1
  33. package/dist/common/dfx/recording_fetch.d.ts +0 -1
  34. package/dist/common/dfx/recording_fetch.js +0 -1
  35. package/dist/common/dfx/source.d.ts +0 -1
  36. package/dist/common/dfx/source.js +0 -1
  37. package/dist/common/image_cacher.d.ts +0 -1
  38. package/dist/common/image_cacher.js +0 -1
  39. package/dist/common/image_helper.d.ts +0 -1
  40. package/dist/common/image_helper.js +0 -1
  41. package/dist/common/image_similarity.d.ts +0 -1
  42. package/dist/common/image_similarity.js +0 -1
  43. package/dist/common/llm_cache/cache_transport.d.ts +2 -1
  44. package/dist/common/llm_cache/cache_transport.js +4 -1
  45. package/dist/common/llm_cache/prompt_cache.d.ts +53 -0
  46. package/dist/common/llm_cache/prompt_cache.js +113 -0
  47. package/dist/common/logger.d.ts +0 -1
  48. package/dist/common/logger.js +0 -1
  49. package/dist/common/model/custom_model.d.ts +0 -1
  50. package/dist/common/model/custom_model.js +57 -6
  51. package/dist/common/model/index.d.ts +0 -1
  52. package/dist/common/model/index.js +0 -1
  53. package/dist/common/path_utils.d.ts +7 -4
  54. package/dist/common/path_utils.js +12 -6
  55. package/dist/common/result_parser.d.ts +0 -1
  56. package/dist/common/result_parser.js +1 -2
  57. package/dist/common/usage/token_usage.d.ts +0 -1
  58. package/dist/common/usage/token_usage.js +0 -1
  59. package/dist/common/utils.d.ts +0 -1
  60. package/dist/common/utils.js +0 -1
  61. package/dist/core/agent/layered_agent/ability_helper.d.ts +0 -1
  62. package/dist/core/agent/layered_agent/ability_helper.js +0 -1
  63. package/dist/core/agent/layered_agent/agent.d.ts +0 -1
  64. package/dist/core/agent/layered_agent/agent.js +0 -1
  65. package/dist/core/agent/layered_agent/agent_registry.d.ts +0 -1
  66. package/dist/core/agent/layered_agent/agent_registry.js +0 -1
  67. package/dist/core/agent/layered_agent/decision.d.ts +0 -1
  68. package/dist/core/agent/layered_agent/decision.js +61 -24
  69. package/dist/core/agent/layered_agent/execute_agent/action_handler.d.ts +0 -1
  70. package/dist/core/agent/layered_agent/execute_agent/action_handler.js +0 -1
  71. package/dist/core/agent/layered_agent/execute_agent/agent_factory.d.ts +1 -2
  72. package/dist/core/agent/layered_agent/execute_agent/agent_factory.js +0 -1
  73. package/dist/core/agent/layered_agent/execute_agent/base_agent.d.ts +0 -1
  74. package/dist/core/agent/layered_agent/execute_agent/base_agent.js +0 -1
  75. package/dist/core/agent/layered_agent/execute_agent/general_agent.d.ts +0 -1
  76. package/dist/core/agent/layered_agent/execute_agent/general_agent.js +0 -1
  77. package/dist/core/agent/layered_agent/execute_agent/glm_agent.d.ts +0 -1
  78. package/dist/core/agent/layered_agent/execute_agent/glm_agent.js +0 -1
  79. package/dist/core/agent/layered_agent/execute_agent/i18n.d.ts +0 -1
  80. package/dist/core/agent/layered_agent/execute_agent/i18n.js +0 -1
  81. package/dist/core/agent/layered_agent/execute_agent/index.d.ts +0 -1
  82. package/dist/core/agent/layered_agent/execute_agent/index.js +0 -1
  83. package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.d.ts +0 -1
  84. package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js +0 -1
  85. package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts +1 -2
  86. package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +5 -6
  87. package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.d.ts +0 -1
  88. package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js +1 -2
  89. package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.d.ts +0 -1
  90. package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js +1 -2
  91. package/dist/core/agent/layered_agent/execute_agent/parser/index.d.ts +0 -1
  92. package/dist/core/agent/layered_agent/execute_agent/parser/index.js +0 -1
  93. package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.d.ts +0 -1
  94. package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js +1 -2
  95. package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts +1 -2
  96. package/dist/core/agent/layered_agent/execute_agent/prompts.js +5 -6
  97. package/dist/core/agent/layered_agent/execute_agent/simple_reporter.d.ts +0 -1
  98. package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js +0 -1
  99. package/dist/core/agent/layered_agent/execute_agent/utils.d.ts +0 -1
  100. package/dist/core/agent/layered_agent/execute_agent/utils.js +0 -1
  101. package/dist/core/agent/report_analyzer_agent/agent.d.ts +0 -1
  102. package/dist/core/agent/report_analyzer_agent/agent.js +0 -1
  103. package/dist/core/agent/report_analyzer_agent/config.d.ts +0 -1
  104. package/dist/core/agent/report_analyzer_agent/config.js +0 -1
  105. package/dist/core/agent/report_analyzer_agent/data_loader.d.ts +0 -1
  106. package/dist/core/agent/report_analyzer_agent/data_loader.js +0 -1
  107. package/dist/core/agent/report_analyzer_agent/guardrails.d.ts +0 -1
  108. package/dist/core/agent/report_analyzer_agent/guardrails.js +0 -1
  109. package/dist/core/agent/report_analyzer_agent/hooks.d.ts +0 -1
  110. package/dist/core/agent/report_analyzer_agent/hooks.js +0 -1
  111. package/dist/core/agent/report_analyzer_agent/index.d.ts +0 -1
  112. package/dist/core/agent/report_analyzer_agent/index.js +0 -1
  113. package/dist/core/agent/report_analyzer_agent/key_steps_builder.d.ts +0 -1
  114. package/dist/core/agent/report_analyzer_agent/key_steps_builder.js +0 -1
  115. package/dist/core/agent/report_analyzer_agent/mapping.d.ts +0 -1
  116. package/dist/core/agent/report_analyzer_agent/mapping.js +0 -1
  117. package/dist/core/agent/report_analyzer_agent/parse.d.ts +0 -1
  118. package/dist/core/agent/report_analyzer_agent/parse.js +0 -1
  119. package/dist/core/agent/report_analyzer_agent/prompt.d.ts +0 -1
  120. package/dist/core/agent/report_analyzer_agent/prompt.js +0 -1
  121. package/dist/core/agent/report_analyzer_agent/report_writer.d.ts +0 -1
  122. package/dist/core/agent/report_analyzer_agent/report_writer.js +0 -1
  123. package/dist/core/agent/report_analyzer_agent/tools.d.ts +0 -1
  124. package/dist/core/agent/report_analyzer_agent/tools.js +0 -1
  125. package/dist/core/agent/report_analyzer_agent/types.d.ts +0 -1
  126. package/dist/core/agent/report_analyzer_agent/types.js +0 -1
  127. package/dist/core/agent/rewrite_agent/agent.d.ts +0 -1
  128. package/dist/core/agent/rewrite_agent/agent.js +0 -1
  129. package/dist/core/agent/rewrite_agent/guardrails.d.ts +0 -1
  130. package/dist/core/agent/rewrite_agent/guardrails.js +0 -1
  131. package/dist/core/agent/rewrite_agent/mapping.d.ts +0 -1
  132. package/dist/core/agent/rewrite_agent/mapping.js +0 -1
  133. package/dist/core/agent/rewrite_agent/parse.d.ts +0 -1
  134. package/dist/core/agent/rewrite_agent/parse.js +0 -1
  135. package/dist/core/agent/rewrite_agent/types.d.ts +0 -1
  136. package/dist/core/agent/rewrite_agent/types.js +0 -1
  137. package/dist/core/agent/single_agent/agent.d.ts +0 -1
  138. package/dist/core/agent/single_agent/agent.js +1 -2
  139. package/dist/core/agent/single_agent/hook_manager.d.ts +0 -1
  140. package/dist/core/agent/single_agent/hook_manager.js +0 -1
  141. package/dist/core/agent/single_agent/hooks.d.ts +0 -1
  142. package/dist/core/agent/single_agent/hooks.js +0 -1
  143. package/dist/core/agent/single_agent/image_utils.d.ts +0 -1
  144. package/dist/core/agent/single_agent/image_utils.js +0 -1
  145. package/dist/core/agent/single_agent/scroll_search_agent.d.ts +0 -1
  146. package/dist/core/agent/single_agent/scroll_search_agent.js +0 -1
  147. package/dist/core/agent/single_agent/subagent_manager.d.ts +0 -1
  148. package/dist/core/agent/single_agent/subagent_manager.js +0 -1
  149. package/dist/core/agent/single_agent/tool_recorder_hook.d.ts +0 -1
  150. package/dist/core/agent/single_agent/tool_recorder_hook.js +0 -1
  151. package/dist/core/agent/types.d.ts +0 -1
  152. package/dist/core/agent/types.js +0 -1
  153. package/dist/core/agent/utils/message_builder.d.ts +0 -1
  154. package/dist/core/agent/utils/message_builder.js +0 -1
  155. package/dist/core/device/device_protocol.d.ts +0 -1
  156. package/dist/core/device/device_protocol.js +0 -1
  157. package/dist/core/device/hdc/apps.d.ts +0 -1
  158. package/dist/core/device/hdc/apps.js +0 -1
  159. package/dist/core/device/hdc/device.d.ts +0 -1
  160. package/dist/core/device/hdc/device.js +0 -1
  161. package/dist/core/device/hdc/index.d.ts +0 -1
  162. package/dist/core/device/hdc/index.js +0 -1
  163. package/dist/core/device/hdc/input.d.ts +0 -1
  164. package/dist/core/device/hdc/input.js +0 -1
  165. package/dist/core/device/hdc/screenshot.d.ts +0 -1
  166. package/dist/core/device/hdc/screenshot.js +0 -1
  167. package/dist/core/device/index.d.ts +0 -1
  168. package/dist/core/device/index.js +0 -1
  169. package/dist/core/device/types.d.ts +0 -1
  170. package/dist/core/device/types.js +0 -1
  171. package/dist/core/knowledge/knowledge_manager.d.ts +0 -1
  172. package/dist/core/knowledge/knowledge_manager.js +0 -1
  173. package/dist/core/knowledge/vectordb.d.ts +0 -1
  174. package/dist/core/knowledge/vectordb.js +0 -1
  175. package/dist/core/mcp/adapter_factory.d.ts +0 -1
  176. package/dist/core/mcp/adapter_factory.js +0 -1
  177. package/dist/core/mcp/android_adapter.d.ts +1 -2
  178. package/dist/core/mcp/android_adapter.js +0 -1
  179. package/dist/core/mcp/base_adapter.d.ts +0 -1
  180. package/dist/core/mcp/base_adapter.js +0 -1
  181. package/dist/core/mcp/harmony_hdc_adapter.d.ts +9 -1
  182. package/dist/core/mcp/harmony_hdc_adapter.js +195 -2
  183. package/dist/core/mcp/ios_adapter.d.ts +1 -2
  184. package/dist/core/mcp/ios_adapter.js +0 -1
  185. package/dist/core/mcp/local_tools.d.ts +0 -1
  186. package/dist/core/mcp/local_tools.js +0 -1
  187. package/dist/core/mcp/mcp_tools.d.ts +19 -3
  188. package/dist/core/mcp/mcp_tools.js +40 -13
  189. package/dist/core/mcp/types.d.ts +0 -1
  190. package/dist/core/mcp/types.js +0 -1
  191. package/dist/core/memory/_utils.d.ts +18 -0
  192. package/dist/core/memory/_utils.js +140 -0
  193. package/dist/core/memory/compressed_session.d.ts +0 -1
  194. package/dist/core/memory/compressed_session.js +0 -1
  195. package/dist/core/memory/context_compressor.d.ts +0 -1
  196. package/dist/core/memory/context_compressor.js +0 -1
  197. package/dist/core/memory/index.d.ts +0 -1
  198. package/dist/core/memory/index.js +0 -1
  199. package/dist/core/memory/memory_manager.d.ts +0 -1
  200. package/dist/core/memory/memory_manager.js +0 -1
  201. package/dist/core/memory/reflector.d.ts +0 -1
  202. package/dist/core/memory/reflector.js +2 -3
  203. package/dist/core/memory/replan_manager.d.ts +9 -0
  204. package/dist/core/memory/replan_manager.js +12 -0
  205. package/dist/core/memory/session_factory.d.ts +0 -1
  206. package/dist/core/memory/session_factory.js +0 -1
  207. package/dist/core/memory/tool_player.d.ts +0 -1
  208. package/dist/core/memory/tool_player.js +0 -1
  209. package/dist/core/memory/tool_player_popup.d.ts +66 -0
  210. package/dist/core/memory/tool_player_popup.js +276 -0
  211. package/dist/core/memory/tool_player_replan.d.ts +49 -0
  212. package/dist/core/memory/tool_player_replan.js +226 -0
  213. package/dist/core/memory/tool_player_xpath.d.ts +52 -0
  214. package/dist/core/memory/tool_player_xpath.js +139 -0
  215. package/dist/core/memory/tool_recorder.d.ts +0 -1
  216. package/dist/core/memory/tool_recorder.js +0 -1
  217. package/dist/core/preprocessor/task_splitter.d.ts +0 -1
  218. package/dist/core/preprocessor/task_splitter.js +0 -1
  219. package/dist/core/prompt/prompt_loader.d.ts +0 -1
  220. package/dist/core/prompt/prompt_loader.js +3 -2
  221. package/dist/core/prompt/templates/debug/hypium/hypium_v2.0_optimize_scroll_search.md +310 -0
  222. package/dist/core/prompt/templates/debug/hypium/hypium_v2.0_relative_1000.md +284 -0
  223. package/dist/core/prompt/templates/debug/planner/planner_v3.0.md +140 -0
  224. package/dist/core/prompt/templates/debug/single/single_v2.0_optimize_scroll_search.md +272 -0
  225. package/dist/core/prompt/templates/debug/single/single_v2.0_relative_1000.md +277 -0
  226. package/dist/core/prompt/templates/single/single_v2.0_0_1000.md +315 -0
  227. package/dist/core/skill/skill_manager.d.ts +0 -1
  228. package/dist/core/skill/skill_manager.js +4 -2
  229. package/dist/core/skill/skills/cancel-all-follows/SKILL.md +23 -0
  230. package/dist/core/skill/skills/create-local-image/SKILL.md +12 -0
  231. package/dist/core/skill/skills/create-local-video/SKILL.md +12 -0
  232. package/dist/core/skill/skills/dismiss-popups/SKILL.md +39 -0
  233. package/dist/core/skill/skills/douyin_test_skills.md +16 -0
  234. package/dist/data_types/action.d.ts +0 -1
  235. package/dist/data_types/action.js +0 -1
  236. package/dist/data_types/agent.d.ts +0 -1
  237. package/dist/data_types/agent.js +0 -1
  238. package/dist/data_types/case.d.ts +32 -0
  239. package/dist/data_types/case.js +57 -0
  240. package/dist/data_types/device.d.ts +0 -1
  241. package/dist/data_types/device.js +0 -1
  242. package/dist/data_types/index.d.ts +2 -1
  243. package/dist/data_types/index.js +6 -2
  244. package/dist/data_types/report.d.ts +0 -1
  245. package/dist/data_types/report.js +0 -1
  246. package/dist/data_types/screen.d.ts +12 -0
  247. package/dist/data_types/screen.js +23 -0
  248. package/dist/data_types/task.d.ts +0 -1
  249. package/dist/data_types/task.js +0 -1
  250. package/dist/index.d.ts +1 -2
  251. package/dist/index.js +37 -9
  252. package/dist/loop/cli.d.ts +0 -1
  253. package/dist/loop/cli.js +0 -1
  254. package/dist/loop/orchestrator.d.ts +0 -1
  255. package/dist/loop/orchestrator.js +0 -1
  256. package/dist/loop/result_writer.d.ts +0 -1
  257. package/dist/loop/result_writer.js +0 -1
  258. package/dist/loop/types.d.ts +0 -1
  259. package/dist/loop/types.js +0 -1
  260. package/dist/mcp-server/server.d.ts +0 -1
  261. package/dist/mcp-server/server.js +88 -24
  262. package/dist/mcp-server/types.d.ts +283 -118
  263. package/dist/mcp-server/types.js +173 -31
  264. package/dist/reporter/batch_summary.d.ts +0 -1
  265. package/dist/reporter/batch_summary.js +0 -1
  266. package/dist/reporter/generator.d.ts +0 -15
  267. package/dist/reporter/generator.js +18 -505
  268. package/dist/reporter/html_template/index.d.ts +56 -0
  269. package/dist/reporter/html_template/index.js +524 -0
  270. package/dist/reporter/json_report.d.ts +1 -0
  271. package/dist/reporter/json_report.js +6 -0
  272. package/dist/reporter/types.d.ts +15 -15
  273. package/dist/reporter/types.js +1 -1
  274. package/dist/tools/batch_runner.d.ts +3 -2
  275. package/dist/tools/batch_runner.js +24 -8
  276. package/dist/tools/case_runner/report.d.ts +9 -0
  277. package/dist/tools/case_runner/report.js +264 -0
  278. package/dist/tools/case_runner/runner.d.ts +57 -0
  279. package/dist/tools/case_runner/runner.js +410 -0
  280. package/dist/tools/config/config_tool.d.ts +13 -0
  281. package/dist/tools/config/config_tool.js +339 -0
  282. package/dist/tools/prompt_compare/compare_runner.d.ts +13 -0
  283. package/dist/tools/prompt_compare/compare_runner.js +360 -0
  284. package/package.json +7 -3
  285. package/dist/api/agent_api.d.ts.map +0 -1
  286. package/dist/api/agent_api.js.map +0 -1
  287. package/dist/api/autotest_agent.d.ts.map +0 -1
  288. package/dist/api/autotest_agent.js.map +0 -1
  289. package/dist/api/types.d.ts.map +0 -1
  290. package/dist/api/types.js.map +0 -1
  291. package/dist/autotest-cli.d.ts.map +0 -1
  292. package/dist/autotest-cli.js.map +0 -1
  293. package/dist/common/case_manager.d.ts.map +0 -1
  294. package/dist/common/case_manager.js.map +0 -1
  295. package/dist/common/collect_case.d.ts.map +0 -1
  296. package/dist/common/collect_case.js.map +0 -1
  297. package/dist/common/common_errors.d.ts.map +0 -1
  298. package/dist/common/common_errors.js.map +0 -1
  299. package/dist/common/config/config_validator.d.ts.map +0 -1
  300. package/dist/common/config/config_validator.js.map +0 -1
  301. package/dist/common/config/manager.d.ts.map +0 -1
  302. package/dist/common/config/manager.js.map +0 -1
  303. package/dist/common/config/output.d.ts.map +0 -1
  304. package/dist/common/config/output.js.map +0 -1
  305. package/dist/common/config/types.d.ts.map +0 -1
  306. package/dist/common/config/types.js.map +0 -1
  307. package/dist/common/dfx/client_factory.d.ts.map +0 -1
  308. package/dist/common/dfx/client_factory.js.map +0 -1
  309. package/dist/common/dfx/context.d.ts.map +0 -1
  310. package/dist/common/dfx/context.js.map +0 -1
  311. package/dist/common/dfx/index.d.ts.map +0 -1
  312. package/dist/common/dfx/index.js.map +0 -1
  313. package/dist/common/dfx/recorder.d.ts.map +0 -1
  314. package/dist/common/dfx/recorder.js.map +0 -1
  315. package/dist/common/dfx/recording_fetch.d.ts.map +0 -1
  316. package/dist/common/dfx/recording_fetch.js.map +0 -1
  317. package/dist/common/dfx/source.d.ts.map +0 -1
  318. package/dist/common/dfx/source.js.map +0 -1
  319. package/dist/common/image_cacher.d.ts.map +0 -1
  320. package/dist/common/image_cacher.js.map +0 -1
  321. package/dist/common/image_helper.d.ts.map +0 -1
  322. package/dist/common/image_helper.js.map +0 -1
  323. package/dist/common/image_similarity.d.ts.map +0 -1
  324. package/dist/common/image_similarity.js.map +0 -1
  325. package/dist/common/llm_cache/cache_transport.d.ts.map +0 -1
  326. package/dist/common/llm_cache/cache_transport.js.map +0 -1
  327. package/dist/common/logger.d.ts.map +0 -1
  328. package/dist/common/logger.js.map +0 -1
  329. package/dist/common/model/custom_model.d.ts.map +0 -1
  330. package/dist/common/model/custom_model.js.map +0 -1
  331. package/dist/common/model/index.d.ts.map +0 -1
  332. package/dist/common/model/index.js.map +0 -1
  333. package/dist/common/path_utils.d.ts.map +0 -1
  334. package/dist/common/path_utils.js.map +0 -1
  335. package/dist/common/result_parser.d.ts.map +0 -1
  336. package/dist/common/result_parser.js.map +0 -1
  337. package/dist/common/usage/token_usage.d.ts.map +0 -1
  338. package/dist/common/usage/token_usage.js.map +0 -1
  339. package/dist/common/utils.d.ts.map +0 -1
  340. package/dist/common/utils.js.map +0 -1
  341. package/dist/core/agent/layered_agent/ability_helper.d.ts.map +0 -1
  342. package/dist/core/agent/layered_agent/ability_helper.js.map +0 -1
  343. package/dist/core/agent/layered_agent/agent.d.ts.map +0 -1
  344. package/dist/core/agent/layered_agent/agent.js.map +0 -1
  345. package/dist/core/agent/layered_agent/agent_registry.d.ts.map +0 -1
  346. package/dist/core/agent/layered_agent/agent_registry.js.map +0 -1
  347. package/dist/core/agent/layered_agent/decision.d.ts.map +0 -1
  348. package/dist/core/agent/layered_agent/decision.js.map +0 -1
  349. package/dist/core/agent/layered_agent/execute_agent/action_handler.d.ts.map +0 -1
  350. package/dist/core/agent/layered_agent/execute_agent/action_handler.js.map +0 -1
  351. package/dist/core/agent/layered_agent/execute_agent/agent_factory.d.ts.map +0 -1
  352. package/dist/core/agent/layered_agent/execute_agent/agent_factory.js.map +0 -1
  353. package/dist/core/agent/layered_agent/execute_agent/base_agent.d.ts.map +0 -1
  354. package/dist/core/agent/layered_agent/execute_agent/base_agent.js.map +0 -1
  355. package/dist/core/agent/layered_agent/execute_agent/general_agent.d.ts.map +0 -1
  356. package/dist/core/agent/layered_agent/execute_agent/general_agent.js.map +0 -1
  357. package/dist/core/agent/layered_agent/execute_agent/glm_agent.d.ts.map +0 -1
  358. package/dist/core/agent/layered_agent/execute_agent/glm_agent.js.map +0 -1
  359. package/dist/core/agent/layered_agent/execute_agent/i18n.d.ts.map +0 -1
  360. package/dist/core/agent/layered_agent/execute_agent/i18n.js.map +0 -1
  361. package/dist/core/agent/layered_agent/execute_agent/index.d.ts.map +0 -1
  362. package/dist/core/agent/layered_agent/execute_agent/index.js.map +0 -1
  363. package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.d.ts.map +0 -1
  364. package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js.map +0 -1
  365. package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts.map +0 -1
  366. package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js.map +0 -1
  367. package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.d.ts.map +0 -1
  368. package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js.map +0 -1
  369. package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.d.ts.map +0 -1
  370. package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js.map +0 -1
  371. package/dist/core/agent/layered_agent/execute_agent/parser/index.d.ts.map +0 -1
  372. package/dist/core/agent/layered_agent/execute_agent/parser/index.js.map +0 -1
  373. package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.d.ts.map +0 -1
  374. package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js.map +0 -1
  375. package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts.map +0 -1
  376. package/dist/core/agent/layered_agent/execute_agent/prompts.js.map +0 -1
  377. package/dist/core/agent/layered_agent/execute_agent/simple_reporter.d.ts.map +0 -1
  378. package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js.map +0 -1
  379. package/dist/core/agent/layered_agent/execute_agent/utils.d.ts.map +0 -1
  380. package/dist/core/agent/layered_agent/execute_agent/utils.js.map +0 -1
  381. package/dist/core/agent/report_analyzer_agent/agent.d.ts.map +0 -1
  382. package/dist/core/agent/report_analyzer_agent/agent.js.map +0 -1
  383. package/dist/core/agent/report_analyzer_agent/config.d.ts.map +0 -1
  384. package/dist/core/agent/report_analyzer_agent/config.js.map +0 -1
  385. package/dist/core/agent/report_analyzer_agent/data_loader.d.ts.map +0 -1
  386. package/dist/core/agent/report_analyzer_agent/data_loader.js.map +0 -1
  387. package/dist/core/agent/report_analyzer_agent/guardrails.d.ts.map +0 -1
  388. package/dist/core/agent/report_analyzer_agent/guardrails.js.map +0 -1
  389. package/dist/core/agent/report_analyzer_agent/hooks.d.ts.map +0 -1
  390. package/dist/core/agent/report_analyzer_agent/hooks.js.map +0 -1
  391. package/dist/core/agent/report_analyzer_agent/index.d.ts.map +0 -1
  392. package/dist/core/agent/report_analyzer_agent/index.js.map +0 -1
  393. package/dist/core/agent/report_analyzer_agent/key_steps_builder.d.ts.map +0 -1
  394. package/dist/core/agent/report_analyzer_agent/key_steps_builder.js.map +0 -1
  395. package/dist/core/agent/report_analyzer_agent/mapping.d.ts.map +0 -1
  396. package/dist/core/agent/report_analyzer_agent/mapping.js.map +0 -1
  397. package/dist/core/agent/report_analyzer_agent/parse.d.ts.map +0 -1
  398. package/dist/core/agent/report_analyzer_agent/parse.js.map +0 -1
  399. package/dist/core/agent/report_analyzer_agent/prompt.d.ts.map +0 -1
  400. package/dist/core/agent/report_analyzer_agent/prompt.js.map +0 -1
  401. package/dist/core/agent/report_analyzer_agent/report_writer.d.ts.map +0 -1
  402. package/dist/core/agent/report_analyzer_agent/report_writer.js.map +0 -1
  403. package/dist/core/agent/report_analyzer_agent/tools.d.ts.map +0 -1
  404. package/dist/core/agent/report_analyzer_agent/tools.js.map +0 -1
  405. package/dist/core/agent/report_analyzer_agent/types.d.ts.map +0 -1
  406. package/dist/core/agent/report_analyzer_agent/types.js.map +0 -1
  407. package/dist/core/agent/rewrite_agent/agent.d.ts.map +0 -1
  408. package/dist/core/agent/rewrite_agent/agent.js.map +0 -1
  409. package/dist/core/agent/rewrite_agent/guardrails.d.ts.map +0 -1
  410. package/dist/core/agent/rewrite_agent/guardrails.js.map +0 -1
  411. package/dist/core/agent/rewrite_agent/mapping.d.ts.map +0 -1
  412. package/dist/core/agent/rewrite_agent/mapping.js.map +0 -1
  413. package/dist/core/agent/rewrite_agent/parse.d.ts.map +0 -1
  414. package/dist/core/agent/rewrite_agent/parse.js.map +0 -1
  415. package/dist/core/agent/rewrite_agent/types.d.ts.map +0 -1
  416. package/dist/core/agent/rewrite_agent/types.js.map +0 -1
  417. package/dist/core/agent/single_agent/agent.d.ts.map +0 -1
  418. package/dist/core/agent/single_agent/agent.js.map +0 -1
  419. package/dist/core/agent/single_agent/hook_manager.d.ts.map +0 -1
  420. package/dist/core/agent/single_agent/hook_manager.js.map +0 -1
  421. package/dist/core/agent/single_agent/hooks.d.ts.map +0 -1
  422. package/dist/core/agent/single_agent/hooks.js.map +0 -1
  423. package/dist/core/agent/single_agent/image_utils.d.ts.map +0 -1
  424. package/dist/core/agent/single_agent/image_utils.js.map +0 -1
  425. package/dist/core/agent/single_agent/scroll_search_agent.d.ts.map +0 -1
  426. package/dist/core/agent/single_agent/scroll_search_agent.js.map +0 -1
  427. package/dist/core/agent/single_agent/subagent_manager.d.ts.map +0 -1
  428. package/dist/core/agent/single_agent/subagent_manager.js.map +0 -1
  429. package/dist/core/agent/single_agent/tool_recorder_hook.d.ts.map +0 -1
  430. package/dist/core/agent/single_agent/tool_recorder_hook.js.map +0 -1
  431. package/dist/core/agent/types.d.ts.map +0 -1
  432. package/dist/core/agent/types.js.map +0 -1
  433. package/dist/core/agent/utils/message_builder.d.ts.map +0 -1
  434. package/dist/core/agent/utils/message_builder.js.map +0 -1
  435. package/dist/core/device/device_protocol.d.ts.map +0 -1
  436. package/dist/core/device/device_protocol.js.map +0 -1
  437. package/dist/core/device/hdc/apps.d.ts.map +0 -1
  438. package/dist/core/device/hdc/apps.js.map +0 -1
  439. package/dist/core/device/hdc/device.d.ts.map +0 -1
  440. package/dist/core/device/hdc/device.js.map +0 -1
  441. package/dist/core/device/hdc/index.d.ts.map +0 -1
  442. package/dist/core/device/hdc/index.js.map +0 -1
  443. package/dist/core/device/hdc/input.d.ts.map +0 -1
  444. package/dist/core/device/hdc/input.js.map +0 -1
  445. package/dist/core/device/hdc/screenshot.d.ts.map +0 -1
  446. package/dist/core/device/hdc/screenshot.js.map +0 -1
  447. package/dist/core/device/index.d.ts.map +0 -1
  448. package/dist/core/device/index.js.map +0 -1
  449. package/dist/core/device/types.d.ts.map +0 -1
  450. package/dist/core/device/types.js.map +0 -1
  451. package/dist/core/knowledge/knowledge_manager.d.ts.map +0 -1
  452. package/dist/core/knowledge/knowledge_manager.js.map +0 -1
  453. package/dist/core/knowledge/vectordb.d.ts.map +0 -1
  454. package/dist/core/knowledge/vectordb.js.map +0 -1
  455. package/dist/core/mcp/adapter_factory.d.ts.map +0 -1
  456. package/dist/core/mcp/adapter_factory.js.map +0 -1
  457. package/dist/core/mcp/android_adapter.d.ts.map +0 -1
  458. package/dist/core/mcp/android_adapter.js.map +0 -1
  459. package/dist/core/mcp/base_adapter.d.ts.map +0 -1
  460. package/dist/core/mcp/base_adapter.js.map +0 -1
  461. package/dist/core/mcp/harmony_hdc_adapter.d.ts.map +0 -1
  462. package/dist/core/mcp/harmony_hdc_adapter.js.map +0 -1
  463. package/dist/core/mcp/ios_adapter.d.ts.map +0 -1
  464. package/dist/core/mcp/ios_adapter.js.map +0 -1
  465. package/dist/core/mcp/local_tools.d.ts.map +0 -1
  466. package/dist/core/mcp/local_tools.js.map +0 -1
  467. package/dist/core/mcp/mcp_tools.d.ts.map +0 -1
  468. package/dist/core/mcp/mcp_tools.js.map +0 -1
  469. package/dist/core/mcp/types.d.ts.map +0 -1
  470. package/dist/core/mcp/types.js.map +0 -1
  471. package/dist/core/memory/compressed_session.d.ts.map +0 -1
  472. package/dist/core/memory/compressed_session.js.map +0 -1
  473. package/dist/core/memory/context_compressor.d.ts.map +0 -1
  474. package/dist/core/memory/context_compressor.js.map +0 -1
  475. package/dist/core/memory/index.d.ts.map +0 -1
  476. package/dist/core/memory/index.js.map +0 -1
  477. package/dist/core/memory/memory_manager.d.ts.map +0 -1
  478. package/dist/core/memory/memory_manager.js.map +0 -1
  479. package/dist/core/memory/reflector.d.ts.map +0 -1
  480. package/dist/core/memory/reflector.js.map +0 -1
  481. package/dist/core/memory/session_factory.d.ts.map +0 -1
  482. package/dist/core/memory/session_factory.js.map +0 -1
  483. package/dist/core/memory/tool_player.d.ts.map +0 -1
  484. package/dist/core/memory/tool_player.js.map +0 -1
  485. package/dist/core/memory/tool_recorder.d.ts.map +0 -1
  486. package/dist/core/memory/tool_recorder.js.map +0 -1
  487. package/dist/core/preprocessor/task_splitter.d.ts.map +0 -1
  488. package/dist/core/preprocessor/task_splitter.js.map +0 -1
  489. package/dist/core/prompt/prompt_loader.d.ts.map +0 -1
  490. package/dist/core/prompt/prompt_loader.js.map +0 -1
  491. package/dist/core/skill/skill_manager.d.ts.map +0 -1
  492. package/dist/core/skill/skill_manager.js.map +0 -1
  493. package/dist/data_types/action.d.ts.map +0 -1
  494. package/dist/data_types/action.js.map +0 -1
  495. package/dist/data_types/agent.d.ts.map +0 -1
  496. package/dist/data_types/agent.js.map +0 -1
  497. package/dist/data_types/device.d.ts.map +0 -1
  498. package/dist/data_types/device.js.map +0 -1
  499. package/dist/data_types/index.d.ts.map +0 -1
  500. package/dist/data_types/index.js.map +0 -1
  501. package/dist/data_types/report.d.ts.map +0 -1
  502. package/dist/data_types/report.js.map +0 -1
  503. package/dist/data_types/task.d.ts.map +0 -1
  504. package/dist/data_types/task.js.map +0 -1
  505. package/dist/hypium_generator/generator.d.ts +0 -38
  506. package/dist/hypium_generator/generator.d.ts.map +0 -1
  507. package/dist/hypium_generator/generator.js +0 -847
  508. package/dist/hypium_generator/generator.js.map +0 -1
  509. package/dist/index.d.ts.map +0 -1
  510. package/dist/index.js.map +0 -1
  511. package/dist/loop/cli.d.ts.map +0 -1
  512. package/dist/loop/cli.js.map +0 -1
  513. package/dist/loop/orchestrator.d.ts.map +0 -1
  514. package/dist/loop/orchestrator.js.map +0 -1
  515. package/dist/loop/result_writer.d.ts.map +0 -1
  516. package/dist/loop/result_writer.js.map +0 -1
  517. package/dist/loop/types.d.ts.map +0 -1
  518. package/dist/loop/types.js.map +0 -1
  519. package/dist/mcp-server/server.d.ts.map +0 -1
  520. package/dist/mcp-server/server.js.map +0 -1
  521. package/dist/mcp-server/types.d.ts.map +0 -1
  522. package/dist/mcp-server/types.js.map +0 -1
  523. package/dist/reporter/batch_summary.d.ts.map +0 -1
  524. package/dist/reporter/batch_summary.js.map +0 -1
  525. package/dist/reporter/generator.d.ts.map +0 -1
  526. package/dist/reporter/generator.js.map +0 -1
  527. package/dist/reporter/types.d.ts.map +0 -1
  528. package/dist/reporter/types.js.map +0 -1
  529. package/dist/tools/batch_runner.d.ts.map +0 -1
  530. package/dist/tools/batch_runner.js.map +0 -1
@@ -46,6 +46,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.HarmonyHdcAdapter = void 0;
47
47
  const child_process_1 = require("child_process");
48
48
  const fs = __importStar(require("fs"));
49
+ const os = __importStar(require("os"));
49
50
  const path = __importStar(require("path"));
50
51
  const base_adapter_1 = require("./base_adapter");
51
52
  const hdc_1 = require("../device/hdc");
@@ -123,6 +124,9 @@ class HarmonyHdcAdapter extends base_adapter_1.MCPDeviceAdapterBase {
123
124
  deviceResetDevice;
124
125
  deviceScreenAlwaysOn;
125
126
  deviceOperationMode;
127
+ toastListener = null;
128
+ toastBuffer = [];
129
+ toastListening = false;
126
130
  constructor(hdcPath, configManager) {
127
131
  super(configManager);
128
132
  this.hdcPath = hdcPath || DEFAULT_HDC_PATH;
@@ -215,6 +219,7 @@ class HarmonyHdcAdapter extends base_adapter_1.MCPDeviceAdapterBase {
215
219
  logger_1.logger.info('HarmonyHdcAdapter connected');
216
220
  }
217
221
  async disconnect() {
222
+ this.stopToastListener();
218
223
  if (this.deviceScreenAlwaysOn) {
219
224
  try {
220
225
  await this.setScreenAlwaysOn(false);
@@ -386,7 +391,7 @@ class HarmonyHdcAdapter extends base_adapter_1.MCPDeviceAdapterBase {
386
391
  return `clear_app_data ${bundle} successfully`;
387
392
  }
388
393
  case 'wait': {
389
- const duration = typeof a.duration === 'number' ? Math.min(a.duration, 120) : 3;
394
+ const duration = typeof a.duration === 'number' ? Math.min(a.duration, 200) : 3;
390
395
  await sleepSync(duration);
391
396
  return `Already wait ${duration} s`;
392
397
  }
@@ -462,6 +467,80 @@ class HarmonyHdcAdapter extends base_adapter_1.MCPDeviceAdapterBase {
462
467
  const shot = await (0, hdc_1.getScreenshot)(this.driver, true);
463
468
  return shot.layoutData || '';
464
469
  }
470
+ case 'open_control_center': {
471
+ const times = a.full_screen ? 2 : 1;
472
+ for (let i = 0; i < times; i++) {
473
+ const [sx, sy] = this.toAbsolute([0.8, 0]);
474
+ const [ex, ey] = this.toAbsolute([0.8, 0.4]);
475
+ await (0, hdc_1.swipe)(this.driver, sx, sy, ex, ey);
476
+ }
477
+ return `open_control_center successfully`;
478
+ }
479
+ case 'open_notification_center': {
480
+ const times = a.full_screen ? 2 : 1;
481
+ for (let i = 0; i < times; i++) {
482
+ const [sx, sy] = this.toAbsolute([0.3, 0]);
483
+ const [ex, ey] = this.toAbsolute([0.3, 0.4]);
484
+ await (0, hdc_1.swipe)(this.driver, sx, sy, ex, ey);
485
+ }
486
+ return `open_notification_center successfully`;
487
+ }
488
+ case 'pinch_in': {
489
+ const rel = this.extractPoint(a, ['pos'], ['x', 'y']);
490
+ const [cx, cy] = this.toAbsolute(rel);
491
+ const radius = typeof a.radius === 'number' ? a.radius : 300;
492
+ const scale = typeof a.scale === 'number' ? a.scale : 0.2;
493
+ await this.pinchGesture(cx, cy, radius, scale);
494
+ return `pinch_in (${this.fmt(rel)}) successfully`;
495
+ }
496
+ case 'pinch_out': {
497
+ const rel = this.extractPoint(a, ['pos'], ['x', 'y']);
498
+ const [cx, cy] = this.toAbsolute(rel);
499
+ const radius = typeof a.radius === 'number' ? a.radius : 300;
500
+ const scale = typeof a.scale === 'number' ? a.scale : 1.6;
501
+ await this.pinchGesture(cx, cy, radius, scale);
502
+ return `pinch_out (${this.fmt(rel)}) successfully`;
503
+ }
504
+ case 'rotate_gesture': {
505
+ const rel = this.extractPoint(a, ['pos', 'center'], ['center_x', 'center_y']);
506
+ const [cx, cy] = this.toAbsolute(rel);
507
+ const angle = typeof a.angle === 'number' ? a.angle : 90;
508
+ const clockwise = a.clockwise !== false;
509
+ const radius = typeof a.radius === 'number' ? a.radius : 300;
510
+ await this.rotateGesture(cx, cy, angle, clockwise, radius);
511
+ return `rotate_gesture (${this.fmt(rel)}, angle=${angle}, clockwise=${clockwise}) successfully`;
512
+ }
513
+ case 'rotate_screen': {
514
+ const direction = typeof a.direction === 'string' ? a.direction.toLowerCase() : 'portrait';
515
+ const angle = direction === 'landscape' ? 270 : 0;
516
+ let out = await this.driver.shell(`uitest uiInput setDisplayRotation ${angle}`);
517
+ if (/error|fail|not found|not support/i.test(out)) {
518
+ const orient = direction === 'landscape' ? 3 : 0;
519
+ out = await this.driver.shell(`hidumper -s DisplayManagerService -a "-s 0 -o ${orient}"`);
520
+ }
521
+ return `rotate_screen ${direction} (angle=${angle}) result: ${out.trim() || 'ok'}`;
522
+ }
523
+ case 'stop_all_app': {
524
+ await this.clearRecentTasks();
525
+ return `stop_all_app successfully`;
526
+ }
527
+ case 'start_listen_toast': {
528
+ this.startToastListener();
529
+ return `start_listen_toast successfully`;
530
+ }
531
+ case 'get_toast': {
532
+ const timeout = typeof a.timeout === 'number' ? a.timeout : 3;
533
+ return await this.getLatestToast(timeout);
534
+ }
535
+ case 'start_data_collect': {
536
+ return `start_data_collect acknowledged (no-op: collection not enabled in nodejs adapter)`;
537
+ }
538
+ case 'stop_data_collect': {
539
+ return `stop_data_collect acknowledged (no-op: collection not enabled in nodejs adapter)`;
540
+ }
541
+ case 'generate_report': {
542
+ return `generate_report acknowledged (nodejs uses reporter module)`;
543
+ }
465
544
  case 'mcp_clean_up':
466
545
  case 'finish': {
467
546
  return `${name} acknowledged`;
@@ -584,6 +663,120 @@ class HarmonyHdcAdapter extends base_adapter_1.MCPDeviceAdapterBase {
584
663
  }
585
664
  }
586
665
  }
666
+ async pinchGesture(cx, cy, radius, scale) {
667
+ const segments = 8;
668
+ const startRadius = scale < 1 ? radius : Math.round(radius / scale);
669
+ const endRadius = Math.round(startRadius * scale);
670
+ const duration = 0.5;
671
+ const intervalMs = Math.max(20, Math.round((duration / segments) * 1000));
672
+ const pts0 = [];
673
+ const pts1 = [];
674
+ for (let i = 0; i <= segments; i++) {
675
+ const t = i / segments;
676
+ const r = startRadius + (endRadius - startRadius) * t;
677
+ pts0.push([Math.round(cx - r), Math.round(cy)]);
678
+ pts1.push([Math.round(cx + r), Math.round(cy)]);
679
+ }
680
+ await this.driver.shell(`uinput -T -d ${pts0[0][0]} ${pts0[0][1]} -i 0`);
681
+ await this.driver.shell(`uinput -T -d ${pts1[0][0]} ${pts1[0][1]} -i 1`);
682
+ for (let i = 1; i <= segments; i++) {
683
+ await this.driver.shell(`uinput -T -m ${pts0[i - 1][0]} ${pts0[i - 1][1]} ${pts0[i][0]} ${pts0[i][1]} ${intervalMs} -i 0`);
684
+ await this.driver.shell(`uinput -T -m ${pts1[i - 1][0]} ${pts1[i - 1][1]} ${pts1[i][0]} ${pts1[i][1]} ${intervalMs} -i 1`);
685
+ }
686
+ await this.driver.shell(`uinput -T -u ${pts0[segments][0]} ${pts0[segments][1]} -i 0`);
687
+ await this.driver.shell(`uinput -T -u ${pts1[segments][0]} ${pts1[segments][1]} -i 1`);
688
+ }
689
+ async rotateGesture(cx, cy, angle, clockwise, radius) {
690
+ const segments = 8;
691
+ const angleRad = (angle * Math.PI) / 180;
692
+ const speed = 600;
693
+ const arcLength = Math.abs(angleRad) * radius;
694
+ const duration = arcLength / speed;
695
+ const intervalMs = Math.max(20, Math.round((duration / segments) * 1000));
696
+ const startAngle0 = clockwise ? 0 : Math.PI;
697
+ const startAngle1 = clockwise ? Math.PI : 0;
698
+ const pts0 = [];
699
+ const pts1 = [];
700
+ for (let i = 0; i <= segments; i++) {
701
+ const t = i / segments;
702
+ const a0 = startAngle0 + angleRad * t;
703
+ const a1 = startAngle1 + angleRad * t;
704
+ pts0.push([Math.round(cx + radius * Math.cos(a0)), Math.round(cy + radius * Math.sin(a0))]);
705
+ pts1.push([Math.round(cx + radius * Math.cos(a1)), Math.round(cy + radius * Math.sin(a1))]);
706
+ }
707
+ await this.driver.shell(`uinput -T -d ${pts0[0][0]} ${pts0[0][1]} -i 0`);
708
+ await this.driver.shell(`uinput -T -d ${pts1[0][0]} ${pts1[0][1]} -i 1`);
709
+ for (let i = 1; i <= segments; i++) {
710
+ await this.driver.shell(`uinput -T -m ${pts0[i - 1][0]} ${pts0[i - 1][1]} ${pts0[i][0]} ${pts0[i][1]} ${intervalMs} -i 0`);
711
+ await this.driver.shell(`uinput -T -m ${pts1[i - 1][0]} ${pts1[i - 1][1]} ${pts1[i][0]} ${pts1[i][1]} ${intervalMs} -i 1`);
712
+ }
713
+ await this.driver.shell(`uinput -T -u ${pts0[segments][0]} ${pts0[segments][1]} -i 0`);
714
+ await this.driver.shell(`uinput -T -u ${pts1[segments][0]} ${pts1[segments][1]} -i 1`);
715
+ }
716
+ startToastListener() {
717
+ this.stopToastListener();
718
+ this.toastBuffer = [];
719
+ this.toastListening = true;
720
+ try {
721
+ this.toastListener = (0, child_process_1.spawn)(this.hdcPath, [
722
+ '-s', `${this.ip}:${this.port}`, '-t', this.driver.deviceSn,
723
+ 'shell', 'hilog',
724
+ ], {
725
+ stdio: ['ignore', 'pipe', 'pipe'],
726
+ windowsHide: true,
727
+ });
728
+ this.toastListener.stdout?.on('data', (chunk) => {
729
+ const lines = chunk.toString('utf-8').split('\n');
730
+ for (const line of lines) {
731
+ if (/toast/i.test(line)) {
732
+ this.toastBuffer.push(line.trim());
733
+ if (this.toastBuffer.length > 50)
734
+ this.toastBuffer.shift();
735
+ }
736
+ }
737
+ });
738
+ this.toastListener.on('error', (err) => {
739
+ logger_1.logger.warn(`toast listener error: ${err.message}`);
740
+ });
741
+ }
742
+ catch (e) {
743
+ logger_1.logger.warn(`start_listen_toast failed: ${e instanceof Error ? e.message : String(e)}`);
744
+ }
745
+ }
746
+ stopToastListener() {
747
+ if (this.toastListener) {
748
+ const pid = this.toastListener.pid;
749
+ try {
750
+ if (os.platform() === 'win32' && pid) {
751
+ // Windows: kill the entire process tree (hdc may spawn child processes)
752
+ (0, child_process_1.execSync)(`taskkill /F /T /PID ${pid}`, { timeout: 5000, windowsHide: true });
753
+ }
754
+ else {
755
+ this.toastListener.kill('SIGTERM');
756
+ }
757
+ }
758
+ catch { /* best-effort */ }
759
+ this.toastListener = null;
760
+ }
761
+ this.toastListening = false;
762
+ }
763
+ async getLatestToast(timeout) {
764
+ const deadline = Date.now() + timeout * 1000;
765
+ while (Date.now() < deadline) {
766
+ if (this.toastBuffer.length > 0) {
767
+ const latest = this.toastBuffer[this.toastBuffer.length - 1];
768
+ this.toastBuffer = [];
769
+ this.toastListening = false;
770
+ return this.extractToastText(latest);
771
+ }
772
+ await sleepSync(0.3);
773
+ }
774
+ this.toastListening = false;
775
+ return '';
776
+ }
777
+ extractToastText(line) {
778
+ const match = line.match(/["']([^"']+)["']/);
779
+ return match?.[1] ?? line;
780
+ }
587
781
  }
588
782
  exports.HarmonyHdcAdapter = HarmonyHdcAdapter;
589
- //# sourceMappingURL=harmony_hdc_adapter.js.map
@@ -12,7 +12,7 @@ export declare class IOSMCPAdapter extends MCPDeviceAdapterBase {
12
12
  private static readonly MCP_SERVICE_PORT;
13
13
  private static readonly SCREENSHOT_TOOL_NAME;
14
14
  private static readonly PRESS_BUTTON_TOOL;
15
- constructor(devicectlPath: string | undefined, configManager: ConfigManager);
15
+ constructor(devicectlPath: string, configManager: ConfigManager);
16
16
  getDefaultServerUrl(): string;
17
17
  getMcpServicePort(): number;
18
18
  useSseTransport(): boolean;
@@ -27,4 +27,3 @@ export declare class IOSMCPAdapter extends MCPDeviceAdapterBase {
27
27
  private closeLogStream;
28
28
  private isPortListening;
29
29
  }
30
- //# sourceMappingURL=ios_adapter.d.ts.map
@@ -284,4 +284,3 @@ class IOSMCPAdapter extends base_adapter_1.MCPDeviceAdapterBase {
284
284
  }
285
285
  }
286
286
  exports.IOSMCPAdapter = IOSMCPAdapter;
287
- //# sourceMappingURL=ios_adapter.js.map
@@ -17,4 +17,3 @@ export declare function wait(seconds: number): Promise<string>;
17
17
  * @returns The skill content, or a not-found message.
18
18
  */
19
19
  export declare function loadSkill(skillName: string): Promise<string>;
20
- //# sourceMappingURL=local_tools.d.ts.map
@@ -39,4 +39,3 @@ async function loadSkill(skillName) {
39
39
  function sleep(seconds) {
40
40
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, seconds) * 1000));
41
41
  }
42
- //# sourceMappingURL=local_tools.js.map
@@ -7,12 +7,29 @@
7
7
  */
8
8
  /** A registered async tool function. */
9
9
  export type ToolFunction = (...args: any[]) => Promise<string>;
10
+ /** Metadata for a registered tool (aligned with python GlobalToolEntry). */
11
+ export interface ToolEntry {
12
+ name: string;
13
+ description: string;
14
+ parameters: Record<string, string>;
15
+ fn: ToolFunction;
16
+ }
10
17
  /** Registry of all collected tool functions, keyed by name. */
11
18
  export declare const TOOL_REGISTRY: Record<string, ToolFunction>;
19
+ /** Add tool names to the blacklist. */
20
+ export declare function addToBlacklist(...names: string[]): void;
12
21
  /**
13
- * Register a tool function into {@link TOOL_REGISTRY} and return it.
22
+ * Register a tool function with metadata into the registry.
23
+ * Aligned with python collect_function_tool — stores both the function and
24
+ * its description/parameters so collectAllTools can build the Available Tools
25
+ * list dynamically instead of a hardcoded array.
14
26
  */
15
- export declare function collectFunctionTool<T extends ToolFunction>(name: string, fn: T): T;
27
+ export declare function collectFunctionTool<T extends ToolFunction>(name: string, fn: T, meta?: {
28
+ description?: string;
29
+ parameters?: Record<string, string>;
30
+ }): T;
31
+ /** Get all registered tool entries, excluding blacklisted ones. */
32
+ export declare function getToolEntries(): ToolEntry[];
16
33
  /** Get all registered tool functions. */
17
34
  export declare function getRegisteredTools(): ToolFunction[];
18
35
  export declare const chat: (message: string) => Promise<string>;
@@ -48,4 +65,3 @@ export declare const loadSkill: (skillName: string) => Promise<string>;
48
65
  * @returns JSON with `verified` (boolean) and `reason` (string).
49
66
  */
50
67
  export declare function verify(verificationDescription: string): Promise<string>;
51
- //# sourceMappingURL=mcp_tools.d.ts.map
@@ -41,7 +41,9 @@ var __importStar = (this && this.__importStar) || (function () {
41
41
  })();
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.loadSkill = exports.login = exports.goHome = exports.wait = exports.goBackTwice = exports.goBack = exports.clearApp = exports.stopApp = exports.startApp = exports.chat = exports.TOOL_REGISTRY = void 0;
44
+ exports.addToBlacklist = addToBlacklist;
44
45
  exports.collectFunctionTool = collectFunctionTool;
46
+ exports.getToolEntries = getToolEntries;
45
47
  exports.getRegisteredTools = getRegisteredTools;
46
48
  exports.getPackageNameMap = getPackageNameMap;
47
49
  exports.getMainAbilityForBundle = getMainAbilityForBundle;
@@ -55,13 +57,39 @@ const types_1 = require("../../reporter/types");
55
57
  const custom_model_1 = require("../../common/model/custom_model");
56
58
  /** Registry of all collected tool functions, keyed by name. */
57
59
  exports.TOOL_REGISTRY = {};
60
+ /** Ordered list of tool entries with metadata (aligned with python _GLOBAL_TOOL_REGISTRY). */
61
+ const _TOOL_ENTRIES = [];
62
+ /** Tool blacklist — names excluded from getToolEntries() (aligned with python _TOOL_BLACKLIST). */
63
+ const _TOOL_BLACKLIST = new Set(['login']);
64
+ /** Add tool names to the blacklist. */
65
+ function addToBlacklist(...names) {
66
+ for (const n of names)
67
+ _TOOL_BLACKLIST.add(n);
68
+ logger_1.logger.debug(`[ToolRegistry] Blacklisted: ${names.join(', ')}`);
69
+ }
58
70
  /**
59
- * Register a tool function into {@link TOOL_REGISTRY} and return it.
71
+ * Register a tool function with metadata into the registry.
72
+ * Aligned with python collect_function_tool — stores both the function and
73
+ * its description/parameters so collectAllTools can build the Available Tools
74
+ * list dynamically instead of a hardcoded array.
60
75
  */
61
- function collectFunctionTool(name, fn) {
76
+ function collectFunctionTool(name, fn, meta) {
62
77
  exports.TOOL_REGISTRY[name] = fn;
78
+ _TOOL_ENTRIES.push({
79
+ name,
80
+ description: meta?.description ?? `${name} tool`,
81
+ parameters: meta?.parameters ?? {},
82
+ fn,
83
+ });
84
+ logger_1.logger.debug(`[ToolRegistry] Registered: ${name}`);
63
85
  return fn;
64
86
  }
87
+ /** Get all registered tool entries, excluding blacklisted ones. */
88
+ function getToolEntries() {
89
+ if (_TOOL_BLACKLIST.size === 0)
90
+ return [..._TOOL_ENTRIES];
91
+ return _TOOL_ENTRIES.filter((e) => !_TOOL_BLACKLIST.has(e.name));
92
+ }
65
93
  /** Get all registered tool functions. */
66
94
  function getRegisteredTools() {
67
95
  return Object.values(exports.TOOL_REGISTRY);
@@ -108,7 +136,7 @@ exports.chat = collectFunctionTool('chat', async (message) => {
108
136
  _chatLock = null;
109
137
  resolveLock('');
110
138
  }
111
- });
139
+ }, { description: 'Send a sub-task instruction to the executor (describe what to do in natural language, e.g. click a button, swipe, input text). The executor will look at the screen and perform the actual operation', parameters: { message: 'string' } });
112
140
  async function _doChat(message) {
113
141
  logger_1.logger.info(`\n[Executor] Running: ${message}`);
114
142
  const executorAgent = getExecutorAgent();
@@ -207,7 +235,7 @@ async function doStartApp(appName) {
207
235
  /** Start an app by display name or bundle name. */
208
236
  exports.startApp = collectFunctionTool('start_app', async (appName) => {
209
237
  return doStartApp(appName);
210
- });
238
+ }, { description: 'Start an application by display name or bundle name', parameters: { app_name: 'string' } });
211
239
  /** Stop an app by display name or bundle name. */
212
240
  exports.stopApp = collectFunctionTool('stop_app', async (appName) => {
213
241
  const device = getExecutorDevice();
@@ -219,7 +247,7 @@ exports.stopApp = collectFunctionTool('stop_app', async (appName) => {
219
247
  await device.home();
220
248
  }
221
249
  return `stop ${appName} successfully. Task finished. Please output the final result now.`;
222
- });
250
+ }, { description: 'Stop an application by display name or bundle name', parameters: { app_name: 'string' } });
223
251
  /** Clear an app's data to simulate a first-install state. */
224
252
  exports.clearApp = collectFunctionTool('clear_app', async (appName) => {
225
253
  const device = getExecutorDevice();
@@ -230,12 +258,12 @@ exports.clearApp = collectFunctionTool('clear_app', async (appName) => {
230
258
  // ignore
231
259
  }
232
260
  return `clear ${appName} successfully`;
233
- });
261
+ }, { description: 'Clear an application data to simulate first-install state', parameters: { app_name: 'string' } });
234
262
  /** Press the back button once. */
235
263
  exports.goBack = collectFunctionTool('go_back', async () => {
236
264
  await getExecutorDevice().back();
237
265
  return 'go back successfully';
238
- });
266
+ }, { description: 'Press the back button once', parameters: {} });
239
267
  /** Press the back button twice. */
240
268
  exports.goBackTwice = collectFunctionTool('go_back_twice', async () => {
241
269
  const device = getExecutorDevice();
@@ -243,7 +271,7 @@ exports.goBackTwice = collectFunctionTool('go_back_twice', async () => {
243
271
  await sleep(1);
244
272
  await device.back();
245
273
  return 'go back twice successfully';
246
- });
274
+ }, { description: 'Press the back button twice', parameters: {} });
247
275
  /** Wait for a number of seconds. */
248
276
  exports.wait = collectFunctionTool('wait', async (times) => {
249
277
  await sleep(times);
@@ -252,16 +280,16 @@ exports.wait = collectFunctionTool('wait', async (times) => {
252
280
  seconds: times,
253
281
  message: `wait ${times} seconds successfully`,
254
282
  });
255
- });
283
+ }, { description: 'Wait for a specified number of seconds', parameters: { times: 'number' } });
256
284
  /** Press the home button to return to the desktop. */
257
285
  exports.goHome = collectFunctionTool('go_home', async () => {
258
286
  await getExecutorDevice().home();
259
287
  return 'go home successfully';
260
- });
288
+ }, { description: 'Press the home button to return to the desktop', parameters: {} });
261
289
  /** Login placeholder tool. */
262
290
  exports.login = collectFunctionTool('login', async () => {
263
291
  return JSON.stringify({ action: 'login', message: 'login successfully' });
264
- });
292
+ }, { description: 'Login placeholder tool', parameters: {} });
265
293
  /** Resolve the main ability name for a bundle name. */
266
294
  function getMainAbilityForBundle(bundleName) {
267
295
  return getMainAbility(bundleName);
@@ -278,7 +306,7 @@ exports.loadSkill = collectFunctionTool('load_skill', async (skillName) => {
278
306
  return `Skill '${skillName}' loaded successfully. Content:\n\n${content}`;
279
307
  }
280
308
  return `Skill '${skillName}' not found. Please check the skill name.`;
281
- });
309
+ }, { description: 'Load the detailed steps for a named skill', parameters: { skill_name: 'string' } });
282
310
  /**
283
311
  * Verify the task result based on recent execution history (screenshots + logs).
284
312
  * @param verificationDescription What to verify.
@@ -380,4 +408,3 @@ function getReportEvents(reportGenerator) {
380
408
  function sleep(seconds) {
381
409
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, seconds) * 1000));
382
410
  }
383
- //# sourceMappingURL=mcp_tools.js.map
@@ -21,4 +21,3 @@ export declare abstract class MCPDeviceAdapter {
21
21
  abstract setAbortController(ac: AbortController | null): void;
22
22
  abstract isAborted(): boolean;
23
23
  }
24
- //# sourceMappingURL=types.d.ts.map
@@ -4,4 +4,3 @@ exports.MCPDeviceAdapter = void 0;
4
4
  class MCPDeviceAdapter {
5
5
  }
6
6
  exports.MCPDeviceAdapter = MCPDeviceAdapter;
7
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Internal utility functions shared across memory module.
3
+ *
4
+ * Ported from python core/memory/_utils.py.
5
+ * Provides helpers for response text extraction, message filtering, retry
6
+ * decoration, and a lightweight TimeCalculate class used by ToolPlayer.
7
+ */
8
+ export declare function fallbackToGlobal<T>(config: unknown, extractor: (cfg: unknown) => T, validator?: ((value: T) => boolean) | null, label?: string, globalConfig?: unknown): T | null;
9
+ export declare function isValidModelConfig(modelConfig: unknown): boolean;
10
+ export declare function extractTextFromResponse(response: unknown): string;
11
+ export declare function filterImagesFromMessage(message: unknown): unknown;
12
+ export declare function retryOnException<T>(fn: () => Promise<T>, maxRetries?: number, delay?: number, backoff?: number): Promise<T>;
13
+ export declare class TimeCalculate {
14
+ startTime: Date;
15
+ endTime: Date;
16
+ constructor(startTime?: Date, endTime?: Date);
17
+ get duration(): number;
18
+ }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ /**
3
+ * Internal utility functions shared across memory module.
4
+ *
5
+ * Ported from python core/memory/_utils.py.
6
+ * Provides helpers for response text extraction, message filtering, retry
7
+ * decoration, and a lightweight TimeCalculate class used by ToolPlayer.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.TimeCalculate = void 0;
11
+ exports.fallbackToGlobal = fallbackToGlobal;
12
+ exports.isValidModelConfig = isValidModelConfig;
13
+ exports.extractTextFromResponse = extractTextFromResponse;
14
+ exports.filterImagesFromMessage = filterImagesFromMessage;
15
+ exports.retryOnException = retryOnException;
16
+ const logger_1 = require("../../common/logger");
17
+ function fallbackToGlobal(config, extractor, validator = null, label = '', globalConfig) {
18
+ const isValid = (value) => {
19
+ if (validator)
20
+ return validator(value);
21
+ return value !== null && value !== undefined;
22
+ };
23
+ let result = null;
24
+ if (config !== null && config !== undefined) {
25
+ try {
26
+ result = extractor(config);
27
+ }
28
+ catch (e) {
29
+ logger_1.logger.debug(`Failed to extract ${label} from passed config: ${e instanceof Error ? e.message : String(e)}`);
30
+ }
31
+ }
32
+ if (isValid(result))
33
+ return result;
34
+ if (globalConfig !== null && globalConfig !== undefined && globalConfig !== config) {
35
+ try {
36
+ result = extractor(globalConfig);
37
+ }
38
+ catch (e) {
39
+ logger_1.logger.debug(`Failed to extract ${label} from global config: ${e instanceof Error ? e.message : String(e)}`);
40
+ return null;
41
+ }
42
+ if (isValid(result)) {
43
+ logger_1.logger.info(`${label} not found in passed config, using global config`);
44
+ return result;
45
+ }
46
+ }
47
+ return null;
48
+ }
49
+ function isValidModelConfig(modelConfig) {
50
+ if (!modelConfig || typeof modelConfig !== 'object')
51
+ return false;
52
+ const cfg = modelConfig;
53
+ return Boolean(cfg['name']) && Boolean(cfg['baseUrl'] || cfg['base_url']);
54
+ }
55
+ function extractTextFromResponse(response) {
56
+ if (!response || typeof response !== 'object')
57
+ return '';
58
+ const output = response['output'];
59
+ if (!Array.isArray(output))
60
+ return '';
61
+ const textParts = [];
62
+ for (const item of output) {
63
+ if (!item || typeof item !== 'object')
64
+ continue;
65
+ const itemType = item['type'];
66
+ if (itemType === 'reasoning') {
67
+ const summary = item['summary'];
68
+ if (Array.isArray(summary)) {
69
+ const thinkingParts = [];
70
+ for (const s of summary) {
71
+ if (s && typeof s === 'object' && s['type'] === 'summary_text') {
72
+ thinkingParts.push(String(s['text'] ?? ''));
73
+ }
74
+ }
75
+ if (thinkingParts.length) {
76
+ logger_1.logger.debug(`\n[Model Thinking]\n${thinkingParts.join('')}`);
77
+ }
78
+ }
79
+ }
80
+ if (itemType === 'message' && item['role'] === 'assistant') {
81
+ const content = item['content'];
82
+ if (Array.isArray(content)) {
83
+ for (const c of content) {
84
+ if (c && typeof c === 'object' && c['type'] === 'output_text') {
85
+ textParts.push(String(c['text'] ?? ''));
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ return textParts.join('');
92
+ }
93
+ function filterImagesFromMessage(message) {
94
+ if (!message || typeof message !== 'object')
95
+ return message;
96
+ if (Array.isArray(message))
97
+ return [...message];
98
+ const filtered = { ...message };
99
+ const content = filtered['content'];
100
+ if (Array.isArray(content)) {
101
+ filtered['content'] = content.filter((item) => {
102
+ if (item && typeof item === 'object') {
103
+ const type = item['type'];
104
+ return type !== 'input_image' && type !== 'image_url';
105
+ }
106
+ return true;
107
+ });
108
+ }
109
+ return filtered;
110
+ }
111
+ function retryOnException(fn, maxRetries = 3, delay = 1000, backoff = 2) {
112
+ return (async () => {
113
+ let currentDelay = delay;
114
+ for (let attempt = 0; attempt < maxRetries; attempt++) {
115
+ try {
116
+ return await fn();
117
+ }
118
+ catch (e) {
119
+ if (attempt === maxRetries - 1)
120
+ throw e;
121
+ logger_1.logger.warning(`retry failed (attempt ${attempt + 1}/${maxRetries}): ${e instanceof Error ? e.message : String(e)}`);
122
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
123
+ currentDelay *= backoff;
124
+ }
125
+ }
126
+ throw new Error('unreachable');
127
+ })();
128
+ }
129
+ class TimeCalculate {
130
+ startTime;
131
+ endTime;
132
+ constructor(startTime, endTime) {
133
+ this.startTime = startTime ?? new Date();
134
+ this.endTime = endTime ?? new Date();
135
+ }
136
+ get duration() {
137
+ return (this.endTime.getTime() - this.startTime.getTime()) / 1000;
138
+ }
139
+ }
140
+ exports.TimeCalculate = TimeCalculate;
@@ -43,4 +43,3 @@ export declare function makeSessionInputFilter(session: CompressedSession): (dat
43
43
  input: Array<Record<string, unknown>>;
44
44
  instructions?: string;
45
45
  }>;
46
- //# sourceMappingURL=compressed_session.d.ts.map
@@ -180,4 +180,3 @@ function makeSessionInputFilter(session) {
180
180
  return data;
181
181
  };
182
182
  }
183
- //# sourceMappingURL=compressed_session.js.map
@@ -21,4 +21,3 @@ export declare function compressContext(items: Array<Record<string, unknown>>, c
21
21
  unified?: ModelConfig;
22
22
  };
23
23
  }): Promise<[Array<Record<string, unknown>>, CompressionResult | null]>;
24
- //# sourceMappingURL=context_compressor.d.ts.map
@@ -174,4 +174,3 @@ async function compressContext(items, config) {
174
174
  return [items, null];
175
175
  }
176
176
  }
177
- //# sourceMappingURL=context_compressor.js.map
@@ -4,4 +4,3 @@
4
4
  * Re-exports the memory facade plus the session input filter helper.
5
5
  */
6
6
  export * from './memory_manager';
7
- //# sourceMappingURL=index.d.ts.map
@@ -20,4 +20,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
20
20
  * Re-exports the memory facade plus the session input filter helper.
21
21
  */
22
22
  __exportStar(require("./memory_manager"), exports);
23
- //# sourceMappingURL=index.js.map
@@ -18,4 +18,3 @@ export type { ToolPlayerOptions, PlaybackResult } from './tool_player';
18
18
  export { ToolPlayer } from './tool_player';
19
19
  export type { SessionType } from './session_factory';
20
20
  export { createSession, createSessionFromConfig } from './session_factory';
21
- //# sourceMappingURL=memory_manager.d.ts.map
@@ -26,4 +26,3 @@ Object.defineProperty(exports, "ToolPlayer", { enumerable: true, get: function (
26
26
  var session_factory_1 = require("./session_factory");
27
27
  Object.defineProperty(exports, "createSession", { enumerable: true, get: function () { return session_factory_1.createSession; } });
28
28
  Object.defineProperty(exports, "createSessionFromConfig", { enumerable: true, get: function () { return session_factory_1.createSessionFromConfig; } });
29
- //# sourceMappingURL=memory_manager.js.map