android-midscene-automation 1.1.10 → 2.0.0

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 (739) hide show
  1. package/README.md +11 -1773
  2. package/bin/android-midscene-automation.js +2 -104
  3. package/package.json +6 -76
  4. package/AI/350/257/206/345/210/253/346/223/215/344/275/234/350/257/264/346/230/216.md +0 -442
  5. package/CHANGELOG.md +0 -284
  6. package/FAQ.md +0 -105
  7. package/USAGE.md +0 -1085
  8. package/artemis-main/.dockerignore +0 -15
  9. package/artemis-main/.env.example +0 -34
  10. package/artemis-main/CONTRIBUTING.md +0 -35
  11. package/artemis-main/Dockerfile +0 -68
  12. package/artemis-main/LICENSE +0 -202
  13. package/artemis-main/Makefile +0 -115
  14. package/artemis-main/README.md +0 -322
  15. package/artemis-main/README_CN.md +0 -320
  16. package/artemis-main/apps/__init__.py +0 -15
  17. package/artemis-main/apps/admin_console/__init__.py +0 -19
  18. package/artemis-main/apps/admin_console/core/__init__.py +0 -13
  19. package/artemis-main/apps/admin_console/core/config.py +0 -43
  20. package/artemis-main/apps/admin_console/core/security.py +0 -178
  21. package/artemis-main/apps/admin_console/core/state.py +0 -243
  22. package/artemis-main/apps/admin_console/database/__init__.py +0 -13
  23. package/artemis-main/apps/admin_console/database/connection.py +0 -60
  24. package/artemis-main/apps/admin_console/database/repositories/__init__.py +0 -13
  25. package/artemis-main/apps/admin_console/database/repositories/session_repository.py +0 -564
  26. package/artemis-main/apps/admin_console/database/repositories/step_repository.py +0 -512
  27. package/artemis-main/apps/admin_console/database/repositories/trace_repository.py +0 -133
  28. package/artemis-main/apps/admin_console/index.html +0 -3787
  29. package/artemis-main/apps/admin_console/replay_manager.py +0 -2585
  30. package/artemis-main/apps/admin_console/routers/__init__.py +0 -13
  31. package/artemis-main/apps/admin_console/routers/media.py +0 -198
  32. package/artemis-main/apps/admin_console/routers/replay.py +0 -91
  33. package/artemis-main/apps/admin_console/routers/sessions.py +0 -239
  34. package/artemis-main/apps/admin_console/routers/steps.py +0 -109
  35. package/artemis-main/apps/admin_console/routers/stream.py +0 -56
  36. package/artemis-main/apps/admin_console/routers/system.py +0 -761
  37. package/artemis-main/apps/admin_console/routers/tasks.py +0 -517
  38. package/artemis-main/apps/admin_console/schemas/__init__.py +0 -13
  39. package/artemis-main/apps/admin_console/schemas/task_schema.py +0 -47
  40. package/artemis-main/apps/admin_console/server.py +0 -541
  41. package/artemis-main/apps/admin_console/services/__init__.py +0 -13
  42. package/artemis-main/apps/admin_console/services/device_stream_service.py +0 -137
  43. package/artemis-main/apps/admin_console/services/ipc_service.py +0 -262
  44. package/artemis-main/apps/admin_console/services/media_service.py +0 -623
  45. package/artemis-main/apps/admin_console/services/model_service.py +0 -148
  46. package/artemis-main/apps/admin_console/services/task_preset_catalog.py +0 -514
  47. package/artemis-main/apps/admin_console/services/task_queue_service.py +0 -1719
  48. package/artemis-main/apps/admin_console/services/worker_process_io.py +0 -144
  49. package/artemis-main/apps/showcase_ui/README.md +0 -31
  50. package/artemis-main/apps/showcase_ui/angular.json +0 -132
  51. package/artemis-main/apps/showcase_ui/package-lock.json +0 -9472
  52. package/artemis-main/apps/showcase_ui/package.json +0 -39
  53. package/artemis-main/apps/showcase_ui/proxy.conf.json +0 -23
  54. package/artemis-main/apps/showcase_ui/public/favicon.ico +0 -0
  55. package/artemis-main/apps/showcase_ui/public/logo.png +0 -0
  56. package/artemis-main/apps/showcase_ui/public/logo.svg +0 -56
  57. package/artemis-main/apps/showcase_ui/src/app/app.component.html +0 -24
  58. package/artemis-main/apps/showcase_ui/src/app/app.component.scss +0 -49
  59. package/artemis-main/apps/showcase_ui/src/app/app.component.spec.ts +0 -42
  60. package/artemis-main/apps/showcase_ui/src/app/app.component.ts +0 -32
  61. package/artemis-main/apps/showcase_ui/src/app/app.config.ts +0 -29
  62. package/artemis-main/apps/showcase_ui/src/app/app.routes.ts +0 -27
  63. package/artemis-main/apps/showcase_ui/src/app/components/agent-stream/agent-stream-startup.spec.ts +0 -108
  64. package/artemis-main/apps/showcase_ui/src/app/components/agent-stream/agent-stream.component.html +0 -1436
  65. package/artemis-main/apps/showcase_ui/src/app/components/agent-stream/agent-stream.component.scss +0 -3973
  66. package/artemis-main/apps/showcase_ui/src/app/components/agent-stream/agent-stream.component.ts +0 -2235
  67. package/artemis-main/apps/showcase_ui/src/app/components/chat-interface/chat-interface.component.html +0 -380
  68. package/artemis-main/apps/showcase_ui/src/app/components/chat-interface/chat-interface.component.scss +0 -1171
  69. package/artemis-main/apps/showcase_ui/src/app/components/chat-interface/chat-interface.component.ts +0 -270
  70. package/artemis-main/apps/showcase_ui/src/app/components/floating-video-player/floating-video-player.component.html +0 -433
  71. package/artemis-main/apps/showcase_ui/src/app/components/floating-video-player/floating-video-player.component.scss +0 -987
  72. package/artemis-main/apps/showcase_ui/src/app/components/floating-video-player/floating-video-player.component.ts +0 -632
  73. package/artemis-main/apps/showcase_ui/src/app/components/legacy-agent-stream/legacy-agent-stream.component.html +0 -130
  74. package/artemis-main/apps/showcase_ui/src/app/components/legacy-agent-stream/legacy-agent-stream.component.scss +0 -406
  75. package/artemis-main/apps/showcase_ui/src/app/components/legacy-agent-stream/legacy-agent-stream.component.ts +0 -74
  76. package/artemis-main/apps/showcase_ui/src/app/components/nav-switcher/nav-switcher.component.scss +0 -115
  77. package/artemis-main/apps/showcase_ui/src/app/components/nav-switcher/nav-switcher.component.ts +0 -52
  78. package/artemis-main/apps/showcase_ui/src/app/core/data/smart-tasks.data.ts +0 -334
  79. package/artemis-main/apps/showcase_ui/src/app/core/i18n/language.service.spec.ts +0 -55
  80. package/artemis-main/apps/showcase_ui/src/app/core/i18n/language.service.ts +0 -61
  81. package/artemis-main/apps/showcase_ui/src/app/core/i18n/translate.pipe.ts +0 -11
  82. package/artemis-main/apps/showcase_ui/src/app/core/i18n/zh-cn.ts +0 -651
  83. package/artemis-main/apps/showcase_ui/src/app/core/models/markdown.model.ts +0 -43
  84. package/artemis-main/apps/showcase_ui/src/app/core/models/pro-tuning.model.spec.ts +0 -47
  85. package/artemis-main/apps/showcase_ui/src/app/core/models/pro-tuning.model.ts +0 -165
  86. package/artemis-main/apps/showcase_ui/src/app/core/models/session.model.ts +0 -85
  87. package/artemis-main/apps/showcase_ui/src/app/core/models/stream.model.ts +0 -246
  88. package/artemis-main/apps/showcase_ui/src/app/core/models/system.model.ts +0 -118
  89. package/artemis-main/apps/showcase_ui/src/app/core/services/task-recommendation.service.ts +0 -111
  90. package/artemis-main/apps/showcase_ui/src/app/pages/home/home.component.html +0 -2130
  91. package/artemis-main/apps/showcase_ui/src/app/pages/home/home.component.scss +0 -5204
  92. package/artemis-main/apps/showcase_ui/src/app/pages/home/home.component.ts +0 -1189
  93. package/artemis-main/apps/showcase_ui/src/app/pages/legacy-workspace/legacy-workspace.component.html +0 -39
  94. package/artemis-main/apps/showcase_ui/src/app/pages/legacy-workspace/legacy-workspace.component.scss +0 -151
  95. package/artemis-main/apps/showcase_ui/src/app/pages/legacy-workspace/legacy-workspace.component.ts +0 -58
  96. package/artemis-main/apps/showcase_ui/src/app/pages/workspace/workspace.component.html +0 -201
  97. package/artemis-main/apps/showcase_ui/src/app/pages/workspace/workspace.component.scss +0 -886
  98. package/artemis-main/apps/showcase_ui/src/app/pages/workspace/workspace.component.ts +0 -324
  99. package/artemis-main/apps/showcase_ui/src/app/services/agent.service.spec.ts +0 -418
  100. package/artemis-main/apps/showcase_ui/src/app/services/agent.service.ts +0 -2012
  101. package/artemis-main/apps/showcase_ui/src/app/services/system.service.spec.ts +0 -173
  102. package/artemis-main/apps/showcase_ui/src/app/services/system.service.ts +0 -620
  103. package/artemis-main/apps/showcase_ui/src/app/utils/action-formatter.util.spec.ts +0 -513
  104. package/artemis-main/apps/showcase_ui/src/app/utils/action-formatter.util.ts +0 -1015
  105. package/artemis-main/apps/showcase_ui/src/app/utils/image-overlay.util.spec.ts +0 -85
  106. package/artemis-main/apps/showcase_ui/src/app/utils/image-overlay.util.ts +0 -662
  107. package/artemis-main/apps/showcase_ui/src/app/utils/markdown-parser.util.spec.ts +0 -70
  108. package/artemis-main/apps/showcase_ui/src/app/utils/markdown-parser.util.ts +0 -383
  109. package/artemis-main/apps/showcase_ui/src/app/utils/recording-timeline.util.spec.ts +0 -107
  110. package/artemis-main/apps/showcase_ui/src/app/utils/recording-timeline.util.ts +0 -123
  111. package/artemis-main/apps/showcase_ui/src/app/utils/run-info.util.spec.ts +0 -92
  112. package/artemis-main/apps/showcase_ui/src/app/utils/run-info.util.ts +0 -116
  113. package/artemis-main/apps/showcase_ui/src/app/utils/stream-aggregator.util.spec.ts +0 -640
  114. package/artemis-main/apps/showcase_ui/src/app/utils/stream-aggregator.util.ts +0 -1021
  115. package/artemis-main/apps/showcase_ui/src/app/utils/tool-formatter.util.spec.ts +0 -375
  116. package/artemis-main/apps/showcase_ui/src/app/utils/tool-formatter.util.ts +0 -1419
  117. package/artemis-main/apps/showcase_ui/src/index.html +0 -37
  118. package/artemis-main/apps/showcase_ui/src/main.ts +0 -22
  119. package/artemis-main/apps/showcase_ui/src/styles.scss +0 -60
  120. package/artemis-main/apps/showcase_ui/tsconfig.app.json +0 -23
  121. package/artemis-main/apps/showcase_ui/tsconfig.json +0 -27
  122. package/artemis-main/apps/showcase_ui/tsconfig.spec.json +0 -23
  123. package/artemis-main/artemis/__init__.py +0 -44
  124. package/artemis-main/artemis/__main__.py +0 -18
  125. package/artemis-main/artemis/_legacy_imports.py +0 -94
  126. package/artemis-main/artemis/_version.py +0 -30
  127. package/artemis-main/artemis/agents/__init__.py +0 -17
  128. package/artemis-main/artemis/agents/checker/checker.json +0 -9
  129. package/artemis-main/artemis/agents/checker/checker.py +0 -859
  130. package/artemis-main/artemis/agents/diagnoser/diagnoser.json +0 -23
  131. package/artemis-main/artemis/agents/diagnoser/diagnoser.py +0 -608
  132. package/artemis-main/artemis/agents/explorer/constants.py +0 -52
  133. package/artemis-main/artemis/agents/explorer/explorer.json +0 -57
  134. package/artemis-main/artemis/agents/explorer/explorer.py +0 -473
  135. package/artemis-main/artemis/agents/explorer/geometry.py +0 -73
  136. package/artemis-main/artemis/agents/explorer/native_runner.py +0 -878
  137. package/artemis-main/artemis/agents/explorer/perception_tools.py +0 -632
  138. package/artemis-main/artemis/agents/explorer/run_setup.py +0 -403
  139. package/artemis-main/artemis/agents/explorer/screen_index.py +0 -266
  140. package/artemis-main/artemis/agents/explorer/tiers.py +0 -110
  141. package/artemis-main/artemis/agents/explorer/tool_declarations.py +0 -394
  142. package/artemis-main/artemis/agents/explorer/universal_runner.py +0 -317
  143. package/artemis-main/artemis/agents/flash/context_compressor.py +0 -452
  144. package/artemis-main/artemis/agents/flash/flash_runner.md +0 -51
  145. package/artemis-main/artemis/agents/flash/flash_summarizer.md +0 -53
  146. package/artemis-main/artemis/agents/flash/flash_summarizer_single.md +0 -54
  147. package/artemis-main/artemis/agents/flash/runner.py +0 -1167
  148. package/artemis-main/artemis/agents/flash/summarizer.py +0 -511
  149. package/artemis-main/artemis/agents/history_analyzer/history_analyzer.md +0 -8
  150. package/artemis-main/artemis/agents/history_analyzer/history_analyzer.py +0 -182
  151. package/artemis-main/artemis/agents/image_processor/image_processor.md +0 -74
  152. package/artemis-main/artemis/agents/image_processor/image_processor.py +0 -322
  153. package/artemis-main/artemis/agents/log_analyzer/log_analyzer.md +0 -15
  154. package/artemis-main/artemis/agents/log_analyzer/log_analyzer.py +0 -403
  155. package/artemis-main/artemis/agents/log_analyzer/log_reader_sub_agent.md +0 -8
  156. package/artemis-main/artemis/agents/log_analyzer/output_analyzer.md +0 -11
  157. package/artemis-main/artemis/agents/log_analyzer/output_analyzer.py +0 -163
  158. package/artemis-main/artemis/agents/object_detector/object_detector.json +0 -9
  159. package/artemis-main/artemis/agents/object_detector/object_detector.py +0 -211
  160. package/artemis-main/artemis/agents/operator/operator.json +0 -3
  161. package/artemis-main/artemis/agents/operator/operator.py +0 -1394
  162. package/artemis-main/artemis/agents/operator/prompts.py +0 -1064
  163. package/artemis-main/artemis/agents/outputter/outputter.md +0 -36
  164. package/artemis-main/artemis/agents/outputter/outputter.py +0 -552
  165. package/artemis-main/artemis/agents/planner/planner.json +0 -32
  166. package/artemis-main/artemis/agents/planner/planner.py +0 -436
  167. package/artemis-main/artemis/agents/prompt_assembly.py +0 -79
  168. package/artemis-main/artemis/agents/summarizer/summarizer.py +0 -190
  169. package/artemis-main/artemis/agents/validator/action_execution.py +0 -98
  170. package/artemis-main/artemis/agents/validator/categories.py +0 -33
  171. package/artemis-main/artemis/agents/validator/execution_loop.py +0 -488
  172. package/artemis-main/artemis/agents/validator/incidents.py +0 -120
  173. package/artemis-main/artemis/agents/validator/pixel_safety_net.md +0 -15
  174. package/artemis-main/artemis/agents/validator/precondition_pixel.py +0 -320
  175. package/artemis-main/artemis/agents/validator/precondition_xml.py +0 -672
  176. package/artemis-main/artemis/agents/validator/tool_declarations.py +0 -332
  177. package/artemis-main/artemis/agents/validator/validator.py +0 -188
  178. package/artemis-main/artemis/agents/video_analyzer/__init__.py +0 -15
  179. package/artemis-main/artemis/agents/video_analyzer/audio_native.py +0 -543
  180. package/artemis-main/artemis/agents/video_analyzer/blackboard.py +0 -821
  181. package/artemis-main/artemis/agents/video_analyzer/chunk_agentic.py +0 -455
  182. package/artemis-main/artemis/agents/video_analyzer/chunk_conversation.py +0 -491
  183. package/artemis-main/artemis/agents/video_analyzer/chunk_native.py +0 -437
  184. package/artemis-main/artemis/agents/video_analyzer/conflict_resolution.py +0 -137
  185. package/artemis-main/artemis/agents/video_analyzer/gemini_files.py +0 -162
  186. package/artemis-main/artemis/agents/video_analyzer/native_coordinator.py +0 -541
  187. package/artemis-main/artemis/agents/video_analyzer/reliability.py +0 -128
  188. package/artemis-main/artemis/agents/video_analyzer/universal_engine.py +0 -487
  189. package/artemis-main/artemis/agents/video_analyzer/universal_tools.py +0 -323
  190. package/artemis-main/artemis/agents/video_analyzer/video_analyzer.md +0 -51
  191. package/artemis-main/artemis/agents/video_analyzer/video_analyzer.py +0 -875
  192. package/artemis-main/artemis/agents/video_analyzer/video_sub_agent.md +0 -15
  193. package/artemis-main/artemis/agents/video_analyzer/video_sub_agent_audio.md +0 -12
  194. package/artemis-main/artemis/clients/accessibility_client.py +0 -438
  195. package/artemis-main/artemis/clients/screen_client_factory.py +0 -403
  196. package/artemis-main/artemis/config/__init__.py +0 -309
  197. package/artemis-main/artemis/config/agent.py +0 -1098
  198. package/artemis-main/artemis/config/constants.py +0 -151
  199. package/artemis-main/artemis/config/core/__init__.py +0 -24
  200. package/artemis-main/artemis/config/core/engine.py +0 -118
  201. package/artemis-main/artemis/config/core/interpolator.py +0 -78
  202. package/artemis-main/artemis/config/llm.py +0 -267
  203. package/artemis-main/artemis/config/paths.py +0 -244
  204. package/artemis-main/artemis/config/runtime.py +0 -197
  205. package/artemis-main/artemis/config/settings.py +0 -315
  206. package/artemis-main/artemis/constants.py +0 -47
  207. package/artemis-main/artemis/context.py +0 -289
  208. package/artemis-main/artemis/controllers/__init__.py +0 -41
  209. package/artemis-main/artemis/controllers/controller_factory.py +0 -41
  210. package/artemis-main/artemis/controllers/device_controller.py +0 -29
  211. package/artemis-main/artemis/controllers/types.py +0 -37
  212. package/artemis-main/artemis/controllers/unified_controller.py +0 -649
  213. package/artemis-main/artemis/core/__init__.py +0 -21
  214. package/artemis-main/artemis/core/diagnostics/__init__.py +0 -90
  215. package/artemis-main/artemis/core/diagnostics/adb_keys.py +0 -270
  216. package/artemis-main/artemis/core/diagnostics/adb_server_connection.py +0 -330
  217. package/artemis-main/artemis/core/diagnostics/device_smoke.py +0 -364
  218. package/artemis-main/artemis/core/diagnostics/emulator_manager.py +0 -501
  219. package/artemis-main/artemis/core/diagnostics/engine.py +0 -438
  220. package/artemis-main/artemis/core/diagnostics/hierarchy_parity.py +0 -216
  221. package/artemis-main/artemis/core/diagnostics/probes/adb_probe.py +0 -887
  222. package/artemis-main/artemis/core/diagnostics/probes/base.py +0 -45
  223. package/artemis-main/artemis/core/diagnostics/probes/credentials_probe.py +0 -296
  224. package/artemis-main/artemis/core/diagnostics/probes/host_probe.py +0 -427
  225. package/artemis-main/artemis/core/diagnostics/probes/runtime_probe.py +0 -169
  226. package/artemis-main/artemis/core/diagnostics/probes/toolchain_probe.py +0 -139
  227. package/artemis-main/artemis/core/diagnostics/readiness.py +0 -83
  228. package/artemis-main/artemis/core/diagnostics/schema.py +0 -118
  229. package/artemis-main/artemis/core/tool_declaration.py +0 -43
  230. package/artemis-main/artemis/core/tool_failure.py +0 -56
  231. package/artemis-main/artemis/data_engine/context_vars.py +0 -24
  232. package/artemis-main/artemis/data_engine/engine.py +0 -1615
  233. package/artemis-main/artemis/data_engine/history_reader.py +0 -142
  234. package/artemis-main/artemis/data_engine/models.py +0 -131
  235. package/artemis-main/artemis/data_engine/storage.py +0 -1245
  236. package/artemis-main/artemis/data_engine/trace.py +0 -727
  237. package/artemis-main/artemis/drivers/__init__.py +0 -48
  238. package/artemis-main/artemis/drivers/android/adb_driver.py +0 -507
  239. package/artemis-main/artemis/drivers/android/hierarchy.py +0 -64
  240. package/artemis-main/artemis/drivers/android/input_ime.py +0 -120
  241. package/artemis-main/artemis/drivers/android/recorder.py +0 -57
  242. package/artemis-main/artemis/drivers/base.py +0 -290
  243. package/artemis-main/artemis/drivers/cloud/cloud_driver.py +0 -117
  244. package/artemis-main/artemis/drivers/factory.py +0 -80
  245. package/artemis-main/artemis/drivers/mock/mock_driver.py +0 -198
  246. package/artemis-main/artemis/drivers/types.py +0 -67
  247. package/artemis-main/artemis/graph/checkpoints.py +0 -1243
  248. package/artemis-main/artemis/graph/graph.py +0 -1055
  249. package/artemis-main/artemis/graph/perception.py +0 -234
  250. package/artemis-main/artemis/graph/state.py +0 -151
  251. package/artemis-main/artemis/graph/visibility.py +0 -238
  252. package/artemis-main/artemis/interfaces/cli/__init__.py +0 -19
  253. package/artemis-main/artemis/interfaces/cli/commands/__init__.py +0 -15
  254. package/artemis-main/artemis/interfaces/cli/commands/batch.py +0 -278
  255. package/artemis-main/artemis/interfaces/cli/commands/doctor.py +0 -468
  256. package/artemis-main/artemis/interfaces/cli/commands/helper.py +0 -226
  257. package/artemis-main/artemis/interfaces/cli/commands/init.py +0 -193
  258. package/artemis-main/artemis/interfaces/cli/commands/mcp.py +0 -862
  259. package/artemis-main/artemis/interfaces/cli/commands/run.py +0 -463
  260. package/artemis-main/artemis/interfaces/cli/commands/server.py +0 -151
  261. package/artemis-main/artemis/interfaces/cli/commands/server_lifecycle.py +0 -328
  262. package/artemis-main/artemis/interfaces/cli/commands/trace.py +0 -111
  263. package/artemis-main/artemis/interfaces/cli/commands/ui.py +0 -404
  264. package/artemis-main/artemis/interfaces/cli/main.py +0 -109
  265. package/artemis-main/artemis/interfaces/sdk/__init__.py +0 -31
  266. package/artemis-main/artemis/interfaces/sdk/client.py +0 -19
  267. package/artemis-main/artemis/interfaces/sdk/task.py +0 -72
  268. package/artemis-main/artemis/llm/__init__.py +0 -25
  269. package/artemis-main/artemis/llm/fake_model.py +0 -179
  270. package/artemis-main/artemis/llm/google/__init__.py +0 -57
  271. package/artemis-main/artemis/llm/google/provider.py +0 -185
  272. package/artemis-main/artemis/llm/google/usage.py +0 -148
  273. package/artemis-main/artemis/llm/parser.py +0 -32
  274. package/artemis-main/artemis/llm/reliability.py +0 -267
  275. package/artemis-main/artemis/llm/router.py +0 -389
  276. package/artemis-main/artemis/llm/schemas.py +0 -36
  277. package/artemis-main/artemis/llm/structured.py +0 -196
  278. package/artemis-main/artemis/main.py +0 -58
  279. package/artemis-main/artemis/mcp/__init__.py +0 -20
  280. package/artemis-main/artemis/mcp/action_executor.py +0 -760
  281. package/artemis-main/artemis/mcp/action_manifest.py +0 -320
  282. package/artemis-main/artemis/mcp/action_names.py +0 -172
  283. package/artemis-main/artemis/mcp/action_server.py +0 -202
  284. package/artemis-main/artemis/mcp/action_session.py +0 -245
  285. package/artemis-main/artemis/mcp/action_specs.py +0 -868
  286. package/artemis-main/artemis/mcp/action_types.py +0 -86
  287. package/artemis-main/artemis/mcp/actuators/__init__.py +0 -21
  288. package/artemis-main/artemis/mcp/actuators/adb.py +0 -414
  289. package/artemis-main/artemis/mcp/actuators/base.py +0 -113
  290. package/artemis-main/artemis/mcp/actuators/mock.py +0 -70
  291. package/artemis-main/artemis/mcp/adb_server.py +0 -490
  292. package/artemis-main/artemis/mcp/observation.py +0 -133
  293. package/artemis-main/artemis/mcp/xml_search_server.py +0 -297
  294. package/artemis-main/artemis/memory/__init__.py +0 -90
  295. package/artemis-main/artemis/memory/chunking.py +0 -1843
  296. package/artemis-main/artemis/memory/context_policy.py +0 -226
  297. package/artemis-main/artemis/memory/step_capsule.md +0 -73
  298. package/artemis-main/artemis/memory/step_memory.py +0 -281
  299. package/artemis-main/artemis/memory/transcript.py +0 -798
  300. package/artemis-main/artemis/platform/__init__.py +0 -61
  301. package/artemis-main/artemis/platform/base.py +0 -104
  302. package/artemis-main/artemis/platform/darwin.py +0 -184
  303. package/artemis-main/artemis/platform/linux.py +0 -207
  304. package/artemis-main/artemis/platform/windows.py +0 -193
  305. package/artemis-main/artemis/resources/__init__.py +0 -46
  306. package/artemis-main/artemis/runtime/__init__.py +0 -108
  307. package/artemis-main/artemis/runtime/adb_endpoint.py +0 -173
  308. package/artemis-main/artemis/runtime/awake_lease.py +0 -283
  309. package/artemis-main/artemis/runtime/awake_service.py +0 -343
  310. package/artemis-main/artemis/runtime/cancel_requests.py +0 -254
  311. package/artemis-main/artemis/runtime/daemon_client.py +0 -422
  312. package/artemis-main/artemis/runtime/device_lock.py +0 -1013
  313. package/artemis-main/artemis/runtime/device_pool.py +0 -478
  314. package/artemis-main/artemis/runtime/helper_manager.py +0 -1030
  315. package/artemis-main/artemis/runtime/process_probe.py +0 -98
  316. package/artemis-main/artemis/runtime/server_lifecycle.py +0 -435
  317. package/artemis-main/artemis/runtime/supervisor.py +0 -121
  318. package/artemis-main/artemis/runtime/trace_store.py +0 -375
  319. package/artemis-main/artemis/sdk/__init__.py +0 -26
  320. package/artemis-main/artemis/sdk/agent.py +0 -485
  321. package/artemis-main/artemis/sdk/builders/__init__.py +0 -29
  322. package/artemis-main/artemis/sdk/builders/agent_config_builder.py +0 -474
  323. package/artemis-main/artemis/sdk/constants.py +0 -15
  324. package/artemis-main/artemis/sdk/run_outcome.py +0 -58
  325. package/artemis-main/artemis/sdk/types/__init__.py +0 -61
  326. package/artemis-main/artemis/sdk/types/agent.py +0 -89
  327. package/artemis-main/artemis/sdk/utils.py +0 -28
  328. package/artemis-main/artemis/services/llm.py +0 -1040
  329. package/artemis-main/artemis/services/token_meter.py +0 -267
  330. package/artemis-main/artemis/telemetry/__init__.py +0 -35
  331. package/artemis-main/artemis/telemetry/models.py +0 -64
  332. package/artemis-main/artemis/telemetry/replay.py +0 -34
  333. package/artemis-main/artemis/telemetry/storage/json_storage.py +0 -47
  334. package/artemis-main/artemis/telemetry/tracer.py +0 -85
  335. package/artemis-main/artemis/toolchain/__init__.py +0 -52
  336. package/artemis-main/artemis/toolchain/descriptors.py +0 -92
  337. package/artemis-main/artemis/toolchain/resolver.py +0 -185
  338. package/artemis-main/artemis/tools/base.py +0 -232
  339. package/artemis-main/artemis/tools/command_tool.py +0 -1240
  340. package/artemis-main/artemis/tools/committee_prompts.json +0 -5
  341. package/artemis-main/artemis/tools/committee_tool.py +0 -422
  342. package/artemis-main/artemis/tools/diagnoser_submit_answer_tool.py +0 -87
  343. package/artemis-main/artemis/tools/diagnostic_tool.py +0 -120
  344. package/artemis-main/artemis/tools/explorer_tool.py +0 -581
  345. package/artemis-main/artemis/tools/history/__init__.py +0 -398
  346. package/artemis-main/artemis/tools/history/replay.py +0 -120
  347. package/artemis-main/artemis/tools/history/screenshot.py +0 -139
  348. package/artemis-main/artemis/tools/history/search.py +0 -563
  349. package/artemis-main/artemis/tools/image_processor_tool.py +0 -124
  350. package/artemis-main/artemis/tools/index.py +0 -47
  351. package/artemis-main/artemis/tools/log_tool.py +0 -108
  352. package/artemis-main/artemis/tools/mobile/launch_app.py +0 -132
  353. package/artemis-main/artemis/tools/mobile/log_utils.py +0 -138
  354. package/artemis-main/artemis/tools/mobile/ocr.py +0 -202
  355. package/artemis-main/artemis/tools/mobile/read_hierarchy.py +0 -108
  356. package/artemis-main/artemis/tools/mobile/read_logs.py +0 -116
  357. package/artemis-main/artemis/tools/mobile/search_logs.py +0 -260
  358. package/artemis-main/artemis/tools/object_detection_tool.py +0 -244
  359. package/artemis-main/artemis/tools/scratchpad.py +0 -819
  360. package/artemis-main/artemis/tools/system/adb_shell.py +0 -31
  361. package/artemis-main/artemis/tools/tool_wrapper.py +0 -270
  362. package/artemis-main/artemis/tools/video_tool.py +0 -261
  363. package/artemis-main/artemis/tools/wait_tool.py +0 -97
  364. package/artemis-main/artemis/utils/app_launch_utils.py +0 -207
  365. package/artemis-main/artemis/utils/coordinates.py +0 -606
  366. package/artemis-main/artemis/utils/credentials_validator.py +0 -201
  367. package/artemis-main/artemis/utils/cv_canvas.py +0 -189
  368. package/artemis-main/artemis/utils/cython_compat.py +0 -45
  369. package/artemis-main/artemis/utils/element_hit_test.py +0 -80
  370. package/artemis-main/artemis/utils/image_diff.py +0 -335
  371. package/artemis-main/artemis/utils/image_hash.py +0 -80
  372. package/artemis-main/artemis/utils/notes.py +0 -470
  373. package/artemis-main/artemis/utils/ocr_api.py +0 -105
  374. package/artemis-main/artemis/utils/ocr_xml_fusion.py +0 -318
  375. package/artemis-main/artemis/utils/plan_grammar.py +0 -513
  376. package/artemis-main/artemis/utils/python_executor.py +0 -213
  377. package/artemis-main/artemis/utils/startup_progress.py +0 -60
  378. package/artemis-main/artemis/utils/task_tree.py +0 -1174
  379. package/artemis-main/artemis/utils/text.py +0 -37
  380. package/artemis-main/artemis/utils/ui_filter.py +0 -651
  381. package/artemis-main/artemis/utils/video.py +0 -685
  382. package/artemis-main/artemis/utils/visualization.py +0 -802
  383. package/artemis-main/config/artemis.example.jsonc +0 -12
  384. package/artemis-main/mcp_server/README.md +0 -111
  385. package/artemis-main/mcp_server/__init__.py +0 -21
  386. package/artemis-main/mcp_server/__main__.py +0 -20
  387. package/artemis-main/mcp_server/background/__init__.py +0 -15
  388. package/artemis-main/mcp_server/background/task_runner.py +0 -453
  389. package/artemis-main/mcp_server/base.py +0 -49
  390. package/artemis-main/mcp_server/notifiers/__init__.py +0 -74
  391. package/artemis-main/mcp_server/notifiers/agentapi.py +0 -289
  392. package/artemis-main/mcp_server/notifiers/base.py +0 -45
  393. package/artemis-main/mcp_server/notifiers/composite.py +0 -87
  394. package/artemis-main/mcp_server/notifiers/desktop.py +0 -108
  395. package/artemis-main/mcp_server/notifiers/file.py +0 -69
  396. package/artemis-main/mcp_server/notifiers/script.py +0 -90
  397. package/artemis-main/mcp_server/notifiers/webhook.py +0 -87
  398. package/artemis-main/mcp_server/rules.md +0 -68
  399. package/artemis-main/mcp_server/server.py +0 -106
  400. package/artemis-main/mcp_server/tools/__init__.py +0 -29
  401. package/artemis-main/mcp_server/tools/device_state.py +0 -107
  402. package/artemis-main/mcp_server/tools/diagnose.py +0 -1249
  403. package/artemis-main/mcp_server/tools/inspect_trace.py +0 -394
  404. package/artemis-main/mcp_server/tools/task_manager.py +0 -627
  405. package/artemis-main/mcp_server/tools/task_runner.py +0 -548
  406. package/artemis-main/mcp_server/utils/__init__.py +0 -15
  407. package/artemis-main/mcp_server/utils/device_utils.py +0 -180
  408. package/artemis-main/mcp_server/utils/env_utils.py +0 -65
  409. package/artemis-main/packages/artemis-accessibility-helper/ArtemisAccessibilityHelper.apk +0 -0
  410. package/artemis-main/packages/artemis-accessibility-helper/app/build.gradle.kts +0 -35
  411. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/AndroidManifest.xml +0 -49
  412. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/A11yNode.java +0 -274
  413. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/ArtemisAccessibilityService.java +0 -227
  414. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/CommandServer.java +0 -463
  415. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/DisplayUtils.java +0 -111
  416. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/GestureController.java +0 -232
  417. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/HierarchyDumper.java +0 -832
  418. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/TokenReceiver.java +0 -36
  419. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/TokenStore.java +0 -38
  420. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/java/com/artemis/helper/XmlUtils.java +0 -102
  421. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/res/values/strings.xml +0 -4
  422. package/artemis-main/packages/artemis-accessibility-helper/app/src/main/res/xml/accessibility_service_config.xml +0 -10
  423. package/artemis-main/packages/artemis-accessibility-helper/build.gradle.kts +0 -3
  424. package/artemis-main/packages/artemis-accessibility-helper/build_apk.sh +0 -215
  425. package/artemis-main/packages/artemis-accessibility-helper/debug.keystore +0 -0
  426. package/artemis-main/packages/artemis-accessibility-helper/gradle.properties +0 -2
  427. package/artemis-main/packages/artemis-accessibility-helper/helper_manifest.json +0 -7
  428. package/artemis-main/packages/artemis-accessibility-helper/settings.gradle.kts +0 -17
  429. package/artemis-main/packages/artemis-client/DESIGN.md +0 -89
  430. package/artemis-main/packages/artemis-client/README.md +0 -112
  431. package/artemis-main/packages/artemis-client/examples/basic.py +0 -30
  432. package/artemis-main/packages/artemis-client/pyproject.toml +0 -36
  433. package/artemis-main/packages/artemis-client/src/artemis_client/__init__.py +0 -45
  434. package/artemis-main/packages/artemis-client/src/artemis_client/client.py +0 -401
  435. package/artemis-main/packages/artemis-client/src/artemis_client/errors.py +0 -66
  436. package/artemis-main/packages/artemis-client/src/artemis_client/models.py +0 -212
  437. package/artemis-main/packages/artemis-client/src/artemis_client/py.typed +0 -1
  438. package/artemis-main/packages/artemis-client/src/artemis_client/transport.py +0 -134
  439. package/artemis-main/packages/artemis-client/tests/test_client.py +0 -289
  440. package/artemis-main/packages/artemis-client/tests/test_transport.py +0 -85
  441. package/artemis-main/pyproject.toml +0 -259
  442. package/artemis-main/pyright-core.json +0 -17
  443. package/artemis-main/scripts/check_dependency_sources.py +0 -68
  444. package/artemis-main/scripts/install_deps.ps1 +0 -520
  445. package/artemis-main/scripts/install_deps.sh +0 -533
  446. package/artemis-main/scripts/quality_ratchet.py +0 -97
  447. package/artemis-main/scripts/real_device_video_acceptance.py +0 -483
  448. package/artemis-main/scripts/run_edge_case_part.py +0 -327
  449. package/artemis-main/scripts/run_ui.py +0 -242
  450. package/artemis-main/scripts/start.ps1 +0 -500
  451. package/artemis-main/scripts/test_all_edge_cases.py +0 -269
  452. package/artemis-main/scripts/verify_concurrency_and_devices.py +0 -385
  453. package/artemis-main/setup.py +0 -164
  454. package/artemis-main/start.bat +0 -35
  455. package/artemis-main/start.sh +0 -423
  456. package/artemis-main/third_party/mobile_use/LICENSE +0 -190
  457. package/artemis-main/third_party/mobile_use/METADATA +0 -27
  458. package/artemis-main/third_party/mobile_use/NOTICE +0 -12
  459. package/artemis-main/third_party/mobile_use/__init__.py +0 -19
  460. package/artemis-main/third_party/mobile_use/agents/__init__.py +0 -13
  461. package/artemis-main/third_party/mobile_use/agents/hopper/__init__.py +0 -13
  462. package/artemis-main/third_party/mobile_use/agents/hopper/hopper.md +0 -22
  463. package/artemis-main/third_party/mobile_use/agents/hopper/hopper.py +0 -80
  464. package/artemis-main/third_party/mobile_use/clients/__init__.py +0 -13
  465. package/artemis-main/third_party/mobile_use/clients/ui_automator_client.py +0 -482
  466. package/artemis-main/third_party/mobile_use/config/__init__.py +0 -13
  467. package/artemis-main/third_party/mobile_use/config/llm.py +0 -183
  468. package/artemis-main/third_party/mobile_use/config/output.py +0 -184
  469. package/artemis-main/third_party/mobile_use/context.py +0 -119
  470. package/artemis-main/third_party/mobile_use/controllers/__init__.py +0 -13
  471. package/artemis-main/third_party/mobile_use/controllers/platform_specific_commands_controller.py +0 -151
  472. package/artemis-main/third_party/mobile_use/controllers/types.py +0 -92
  473. package/artemis-main/third_party/mobile_use/controllers/unified_controller.py +0 -183
  474. package/artemis-main/third_party/mobile_use/graph.py +0 -54
  475. package/artemis-main/third_party/mobile_use/llm_service.py +0 -193
  476. package/artemis-main/third_party/mobile_use/main.py +0 -130
  477. package/artemis-main/third_party/mobile_use/sdk/__init__.py +0 -13
  478. package/artemis-main/third_party/mobile_use/sdk/agent.py +0 -1060
  479. package/artemis-main/third_party/mobile_use/sdk/builders/__init__.py +0 -13
  480. package/artemis-main/third_party/mobile_use/sdk/builders/agent_config_builder.py +0 -225
  481. package/artemis-main/third_party/mobile_use/sdk/builders/index.py +0 -33
  482. package/artemis-main/third_party/mobile_use/sdk/builders/task_request_builder.py +0 -243
  483. package/artemis-main/third_party/mobile_use/sdk/types/__init__.py +0 -13
  484. package/artemis-main/third_party/mobile_use/sdk/types/agent.py +0 -98
  485. package/artemis-main/third_party/mobile_use/sdk/types/exceptions.py +0 -109
  486. package/artemis-main/third_party/mobile_use/sdk/types/task.py +0 -234
  487. package/artemis-main/third_party/mobile_use/testing.py +0 -59
  488. package/artemis-main/third_party/mobile_use/tools/__init__.py +0 -13
  489. package/artemis-main/third_party/mobile_use/tools/index.py +0 -44
  490. package/artemis-main/third_party/mobile_use/tools/mobile/__init__.py +0 -13
  491. package/artemis-main/third_party/mobile_use/tools/mobile/launch_app.py +0 -89
  492. package/artemis-main/third_party/mobile_use/tools/tool_wrapper.py +0 -52
  493. package/artemis-main/third_party/mobile_use/utils/__init__.py +0 -13
  494. package/artemis-main/third_party/mobile_use/utils/app_launch_utils.py +0 -217
  495. package/artemis-main/third_party/mobile_use/utils/cli_helpers.py +0 -60
  496. package/artemis-main/third_party/mobile_use/utils/decorators.py +0 -158
  497. package/artemis-main/third_party/mobile_use/utils/file.py +0 -31
  498. package/artemis-main/third_party/mobile_use/utils/logger.py +0 -216
  499. package/artemis-main/third_party/mobile_use/utils/media.py +0 -213
  500. package/artemis-main/third_party/mobile_use/utils/shell_utils.py +0 -39
  501. package/artemis-main/third_party/mobile_use/utils/video.py +0 -398
  502. package/artemis-main/uv.lock +0 -4908
  503. package/bin/artemis-config.mjs +0 -15
  504. package/bin/artemis-embedded.py +0 -56
  505. package/bin/start-artemis.mjs +0 -30
  506. package/bin/start-dev.mjs +0 -112
  507. package/bin/sync-readme-docs.mjs +0 -49
  508. package/bin/test_artemis_embedded.py +0 -44
  509. package/index.html +0 -12
  510. package/remote-agent/index.ts +0 -232
  511. package/server/analytics.test.ts +0 -46
  512. package/server/analytics.ts +0 -24
  513. package/server/android-device-info.ts +0 -28
  514. package/server/android-sdk.ts +0 -104
  515. package/server/api-safety-analytics.test.ts +0 -57
  516. package/server/appium-auto-save.test.ts +0 -79
  517. package/server/appium-config.test.ts +0 -182
  518. package/server/appium-recorder/ai-deduplication.test.ts +0 -80
  519. package/server/appium-recorder/ai-deduplication.ts +0 -74
  520. package/server/appium-recorder/ai-observation.test.ts +0 -125
  521. package/server/appium-recorder/ai-observation.ts +0 -125
  522. package/server/appium-recorder/ai-recognition.test.ts +0 -27
  523. package/server/appium-recorder/ai-recognition.ts +0 -186
  524. package/server/appium-recorder/appium-runner.ts +0 -1985
  525. package/server/appium-recorder/appium-version.test.ts +0 -55
  526. package/server/appium-recorder/bounded-loop.test.ts +0 -55
  527. package/server/appium-recorder/bounded-loop.ts +0 -129
  528. package/server/appium-recorder/condition-timeout.ts +0 -4
  529. package/server/appium-recorder/element-tap.test.ts +0 -312
  530. package/server/appium-recorder/flow-layout.test.ts +0 -52
  531. package/server/appium-recorder/history-capture.ts +0 -35
  532. package/server/appium-recorder/image-check.ts +0 -174
  533. package/server/appium-recorder/managed-appium.ts +0 -198
  534. package/server/appium-recorder/managed-cleanup.test.ts +0 -113
  535. package/server/appium-recorder/open-gallery.ts +0 -61
  536. package/server/appium-recorder/prompt-optimizer.ts +0 -57
  537. package/server/appium-recorder/random-value-replay.test.ts +0 -76
  538. package/server/appium-recorder/random-value.test.ts +0 -114
  539. package/server/appium-recorder/random-value.ts +0 -34
  540. package/server/appium-recorder/replay-lifecycle.test.ts +0 -123
  541. package/server/appium-recorder/replay-log.ts +0 -13
  542. package/server/appium-recorder/replay-mp4.ts +0 -72
  543. package/server/appium-recorder/replay-video-segments.ts +0 -77
  544. package/server/appium-recorder/replay-video.ts +0 -125
  545. package/server/appium-recorder/report-summary.test.ts +0 -78
  546. package/server/appium-recorder/report-summary.ts +0 -60
  547. package/server/appium-recorder/report.ts +0 -935
  548. package/server/appium-recorder/repository.ts +0 -561
  549. package/server/appium-recorder/request-timeout.test.ts +0 -34
  550. package/server/appium-recorder/request-timeout.ts +0 -34
  551. package/server/appium-recorder/routes.ts +0 -524
  552. package/server/appium-recorder/run-history.ts +0 -53
  553. package/server/appium-recorder/scrcpy-recording-source.ts +0 -85
  554. package/server/appium-recorder/screenshot.ts +0 -22
  555. package/server/appium-recorder/script-export.ts +0 -80
  556. package/server/appium-recorder/script-import.test.ts +0 -45
  557. package/server/appium-recorder/stop-app.ts +0 -18
  558. package/server/appium-recorder/tree-dump.ts +0 -66
  559. package/server/appium-recorder/variable-store.ts +0 -22
  560. package/server/appium-recorder/variables.ts +0 -89
  561. package/server/appium-recorder/video-response.ts +0 -36
  562. package/server/appium-recorder/visual-change.ts +0 -184
  563. package/server/artemis.ts +0 -34
  564. package/server/config-access.test.ts +0 -27
  565. package/server/config-access.ts +0 -27
  566. package/server/config-store.ts +0 -137
  567. package/server/config.ts +0 -272
  568. package/server/device-locks/repository.ts +0 -147
  569. package/server/device-locks/service.ts +0 -72
  570. package/server/device-locks/types.ts +0 -22
  571. package/server/device-sessions/repository.ts +0 -169
  572. package/server/device-sessions/service.ts +0 -59
  573. package/server/device-sessions/types.ts +0 -24
  574. package/server/http-api.ts +0 -1505
  575. package/server/model-tester.ts +0 -121
  576. package/server/operations/repository.ts +0 -226
  577. package/server/operations/service.ts +0 -84
  578. package/server/operations/types.ts +0 -27
  579. package/server/paths.ts +0 -36
  580. package/server/remote-agents/protocol.ts +0 -40
  581. package/server/remote-agents/registry.test.ts +0 -65
  582. package/server/remote-agents/registry.ts +0 -191
  583. package/server/remote-agents/replay-integration.test.ts +0 -79
  584. package/server/remote-agents/routes.ts +0 -86
  585. package/server/request-body.test.ts +0 -40
  586. package/server/request-body.ts +0 -48
  587. package/server/script-agent.ts +0 -289
  588. package/server/script-db.ts +0 -255
  589. package/server/script-runner.ts +0 -554
  590. package/server/storage/sqlite.ts +0 -112
  591. package/server/test-case-import/formatter.ts +0 -28
  592. package/server/test-case-import/parsers/excel.ts +0 -69
  593. package/server/test-case-import/parsers/txt.ts +0 -11
  594. package/server/test-case-import/parsers/word.ts +0 -9
  595. package/server/test-case-import/service.ts +0 -58
  596. package/server/test-case-import/text-normalizer.ts +0 -98
  597. package/server/test-case-import/types.ts +0 -24
  598. package/server/test-case-import/validator.ts +0 -34
  599. package/src/App.vue +0 -1022
  600. package/src/analytics/summary.ts +0 -75
  601. package/src/api.ts +0 -320
  602. package/src/appium-recorder/AppiumPage.vue +0 -2836
  603. package/src/appium-recorder/RunHistoryDialog.vue +0 -203
  604. package/src/appium-recorder/action-descriptions.ts +0 -49
  605. package/src/appium-recorder/ai-deduplication.ts +0 -34
  606. package/src/appium-recorder/ai-prompt-presets.ts +0 -34
  607. package/src/appium-recorder/ai-recognition.ts +0 -48
  608. package/src/appium-recorder/api.ts +0 -209
  609. package/src/appium-recorder/bounded-loop.ts +0 -74
  610. package/src/appium-recorder/components/AiRecognitionPromptInput.vue +0 -41
  611. package/src/appium-recorder/components/AiRecognitionSettings.vue +0 -251
  612. package/src/appium-recorder/components/AiRecognitionTestDialog.vue +0 -86
  613. package/src/appium-recorder/components/BranchTimeoutSettings.vue +0 -23
  614. package/src/appium-recorder/components/BreakLoopSettings.vue +0 -45
  615. package/src/appium-recorder/components/ComponentInspector.vue +0 -33
  616. package/src/appium-recorder/components/ComponentTree.vue +0 -139
  617. package/src/appium-recorder/components/CoordinatePointPicker.vue +0 -23
  618. package/src/appium-recorder/components/FlowActionMenu.vue +0 -257
  619. package/src/appium-recorder/components/FlowCanvas.vue +0 -391
  620. package/src/appium-recorder/components/FlowNodeCard.vue +0 -318
  621. package/src/appium-recorder/components/FlowNodeSearch.vue +0 -62
  622. package/src/appium-recorder/components/FlowRoundedEdge.vue +0 -58
  623. package/src/appium-recorder/components/FlowStepEditor.vue +0 -541
  624. package/src/appium-recorder/components/ImageCheckDialog.vue +0 -172
  625. package/src/appium-recorder/components/LongPressSettings.vue +0 -58
  626. package/src/appium-recorder/components/LoopSettings.vue +0 -39
  627. package/src/appium-recorder/components/MergeBranchesDialog.vue +0 -102
  628. package/src/appium-recorder/components/NestedConditionBranches.vue +0 -403
  629. package/src/appium-recorder/components/NewScriptDialog.vue +0 -27
  630. package/src/appium-recorder/components/NodeDetail.vue +0 -179
  631. package/src/appium-recorder/components/PresetVariables.vue +0 -110
  632. package/src/appium-recorder/components/RandomValueSettings.vue +0 -139
  633. package/src/appium-recorder/components/RecordedSteps.vue +0 -468
  634. package/src/appium-recorder/components/RecorderWorkspace.vue +0 -132
  635. package/src/appium-recorder/components/ScriptParameterSettings.vue +0 -65
  636. package/src/appium-recorder/components/StageLogSettings.vue +0 -17
  637. package/src/appium-recorder/components/TextClickSettings.vue +0 -19
  638. package/src/appium-recorder/components/VariableExtractionSettings.vue +0 -19
  639. package/src/appium-recorder/components/VariableTable.vue +0 -82
  640. package/src/appium-recorder/components/VisualChangeDialog.vue +0 -151
  641. package/src/appium-recorder/components/VisualChangeEndPicker.vue +0 -21
  642. package/src/appium-recorder/coordinate-preview.ts +0 -37
  643. package/src/appium-recorder/flow-appearance.ts +0 -70
  644. package/src/appium-recorder/flow-copy.ts +0 -278
  645. package/src/appium-recorder/flow-graph.ts +0 -868
  646. package/src/appium-recorder/flow-insert.ts +0 -27
  647. package/src/appium-recorder/flow-labels.ts +0 -138
  648. package/src/appium-recorder/flow-layout.ts +0 -88
  649. package/src/appium-recorder/flow-merge.ts +0 -123
  650. package/src/appium-recorder/flow-normalize.ts +0 -77
  651. package/src/appium-recorder/flow-remove.ts +0 -75
  652. package/src/appium-recorder/flow-search.ts +0 -29
  653. package/src/appium-recorder/flow-unmerge.ts +0 -145
  654. package/src/appium-recorder/image-check.ts +0 -121
  655. package/src/appium-recorder/long-press.ts +0 -27
  656. package/src/appium-recorder/native-control-state.ts +0 -33
  657. package/src/appium-recorder/node-locators.ts +0 -25
  658. package/src/appium-recorder/node-timeout.ts +0 -1
  659. package/src/appium-recorder/random-value.ts +0 -60
  660. package/src/appium-recorder/report-summary.ts +0 -60
  661. package/src/appium-recorder/run-history.ts +0 -53
  662. package/src/appium-recorder/stage-log.ts +0 -21
  663. package/src/appium-recorder/text-click.ts +0 -9
  664. package/src/appium-recorder/tree.ts +0 -176
  665. package/src/appium-recorder/types.ts +0 -198
  666. package/src/appium-recorder/variable-presets.ts +0 -24
  667. package/src/appium-recorder/variables.ts +0 -34
  668. package/src/appium-recorder/visual-change-pairs.ts +0 -155
  669. package/src/appium-recorder/visual-change.ts +0 -87
  670. package/src/assets/appium-actions/add.svg +0 -7
  671. package/src/assets/appium-actions/android.svg +0 -6
  672. package/src/assets/appium-actions/back.svg +0 -6
  673. package/src/assets/appium-actions/bidirection.svg +0 -6
  674. package/src/assets/appium-actions/browser.svg +0 -6
  675. package/src/assets/appium-actions/clear.svg +0 -3
  676. package/src/assets/appium-actions/crosshair.svg +0 -6
  677. package/src/assets/appium-actions/eye.svg +0 -3
  678. package/src/assets/appium-actions/pause.svg +0 -7
  679. package/src/assets/appium-actions/phone.svg +0 -9
  680. package/src/assets/appium-actions/pin.svg +0 -6
  681. package/src/assets/appium-actions/power.svg +0 -6
  682. package/src/assets/appium-actions/select.svg +0 -3
  683. package/src/assets/appium-actions/sidebar.svg +0 -6
  684. package/src/assets/appium-actions/text.svg +0 -6
  685. package/src/assets/appium-actions/zoom.svg +0 -6
  686. package/src/assets/device-actions/back.svg +0 -5
  687. package/src/assets/device-actions/home.svg +0 -3
  688. package/src/assets/device-actions/power.svg +0 -5
  689. package/src/assets/device-actions/tasks.svg +0 -3
  690. package/src/assets/device-actions/volume-down.svg +0 -3
  691. package/src/assets/device-actions/volume-up.svg +0 -3
  692. package/src/components/AppSidebar.vue +0 -32
  693. package/src/components/MidsceneMaintenanceNotice.vue +0 -17
  694. package/src/components/analytics/AnalysisCharts.vue +0 -189
  695. package/src/components/analytics/ReportAnalysis.vue +0 -78
  696. package/src/components/config/AiDeduplicationSettings.vue +0 -70
  697. package/src/components/config/AiPromptPresetsSettings.vue +0 -113
  698. package/src/components/config/AppiumConfigPanel.vue +0 -113
  699. package/src/components/config/AppiumModelSettings.vue +0 -45
  700. package/src/components/config/BaseConfigPanel.vue +0 -106
  701. package/src/components/config/FlowAppearanceSettings.vue +0 -150
  702. package/src/components/config/MidsceneConfigPanel.vue +0 -211
  703. package/src/components/config/ReplayReportSummarySettings.vue +0 -118
  704. package/src/components/device/DeviceInfoTooltip.vue +0 -55
  705. package/src/components/device/DevicePreviewPanel.vue +0 -482
  706. package/src/components/generator/GeneratedCodePanel.vue +0 -70
  707. package/src/components/generator/TestCaseFileUpload.vue +0 -97
  708. package/src/components/help/HelpCenter.vue +0 -204
  709. package/src/components/help/MarkdownDocument.vue +0 -139
  710. package/src/composables/use-device-preview.ts +0 -279
  711. package/src/composables/use-initial-resource.ts +0 -17
  712. package/src/composables/use-script-execution.ts +0 -277
  713. package/src/config/credentials.ts +0 -2
  714. package/src/config/midscene-model-presets.ts +0 -103
  715. package/src/config/prompt-example.ts +0 -10
  716. package/src/config/prompt-presets.ts +0 -172
  717. package/src/config/use-appium-auto-save.ts +0 -75
  718. package/src/config/use-model-config.ts +0 -161
  719. package/src/main.ts +0 -10
  720. package/src/pages/AiGeneratorPage.vue +0 -273
  721. package/src/pages/AnalysisPage.vue +0 -60
  722. package/src/pages/ArtemisPage.vue +0 -72
  723. package/src/pages/AutomationPage.vue +0 -161
  724. package/src/pages/ConfigPage.vue +0 -165
  725. package/src/pages/GeneratorPage.vue +0 -104
  726. package/src/pages/ManualStepsPage.vue +0 -179
  727. package/src/script-generator/codegen.ts +0 -126
  728. package/src/script-generator/index.ts +0 -4
  729. package/src/script-generator/presets.ts +0 -37
  730. package/src/script-generator/step-options.ts +0 -52
  731. package/src/script-generator/types.ts +0 -27
  732. package/src/style.css +0 -4183
  733. package/src/types.ts +0 -167
  734. package/src/vite-env.d.ts +0 -1
  735. package/tsconfig.app.json +0 -8
  736. package/tsconfig.json +0 -11
  737. package/tsconfig.node.json +0 -16
  738. package/vite.config.ts +0 -28
  739. package//346/265/201/347/250/213/350/212/202/347/202/271/346/223/215/344/275/234/350/257/264/346/230/216.md +0 -408
@@ -1,1419 +0,0 @@
1
- /**
2
- * Copyright 2026 Google LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { ActionParam } from '../core/models/stream.model';
18
- import { extractNumbersFromCoordinateValue, isPureDirectionString, parseSequenceCoordinates } from './image-overlay.util';
19
-
20
- // Tool objects are replaced (not mutated) when a trace is updated, so a
21
- // WeakMap keyed on the tool is a safe memo for the parsed-args lookup that
22
- // templates would otherwise re-run (including JSON.parse) on every render.
23
- const toolArgsCache = new WeakMap<object, any>();
24
-
25
- /**
26
- * Extract arguments from tool payload or direct args field
27
- */
28
- export function getToolArgs(tool: any): any {
29
- if (!tool) return {};
30
- if (typeof tool === 'object') {
31
- const cached = toolArgsCache.get(tool);
32
- if (cached !== undefined) return cached;
33
- const args = computeToolArgs(tool);
34
- toolArgsCache.set(tool, args);
35
- return args;
36
- }
37
- return computeToolArgs(tool);
38
- }
39
-
40
- function computeToolArgs(tool: any): any {
41
- if (tool.payload) {
42
- let payloadObj = tool.payload;
43
- if (typeof payloadObj === 'string') {
44
- try { payloadObj = JSON.parse(payloadObj); } catch {}
45
- }
46
- if (payloadObj && typeof payloadObj === 'object') {
47
- if (payloadObj.args && typeof payloadObj.args === 'object') {
48
- return payloadObj.args;
49
- }
50
- return payloadObj;
51
- }
52
- }
53
- if (tool.args) {
54
- let argsObj = tool.args;
55
- if (typeof argsObj === 'string') {
56
- try { argsObj = JSON.parse(argsObj); } catch {}
57
- }
58
- if (argsObj && typeof argsObj === 'object') {
59
- return argsObj;
60
- }
61
- }
62
- return {};
63
- }
64
-
65
- /**
66
- * Check if a tool is one of the five note-related tools
67
- */
68
- export function isNoteTool(tool: any): boolean {
69
- if (!tool || !tool.name) return false;
70
- const cleanName = tool.name.replace(/^(_)?(self\.)?exec_/, '');
71
- const nameLower = cleanName.toLowerCase();
72
- return ['save_note', 'read_note', 'list_notes', 'update_note', 'append_note'].includes(nameLower);
73
- }
74
-
75
- /**
76
- * Check if a tool is video analysis related
77
- */
78
- export function isVideoTool(tool: any): boolean {
79
- if (!tool || !tool.name) return false;
80
- const cleanName = tool.name.replace(/^(_)?(self\.)?exec_/, '');
81
- const nameLower = cleanName.toLowerCase();
82
- return [
83
- 'video_analysis',
84
- 'video_analyzer',
85
- 'video_analyzer_pure',
86
- 'spawn_sub_agent',
87
- 'analyze_audio_only'
88
- ].includes(nameLower);
89
- }
90
-
91
- export type VideoAnalysisOutcome = 'running' | 'recovering' | 'waiting' | 'complete' | 'partial' | 'failed';
92
-
93
- export interface VideoAnalysisRange {
94
- start: number;
95
- end: number;
96
- category?: string;
97
- retryable?: boolean;
98
- }
99
-
100
- export interface VideoAnalysisView {
101
- outcome: VideoAnalysisOutcome;
102
- title: string;
103
- query: string;
104
- summary: string;
105
- reuse: 'none' | 'partial' | 'full';
106
- requestedRange: VideoAnalysisRange | null;
107
- completedRanges: VideoAnalysisRange[];
108
- failedRanges: VideoAnalysisRange[];
109
- evidenceCount: number;
110
- completedCount: number;
111
- totalCount: number;
112
- fallbackUsed: boolean;
113
- }
114
-
115
- function numericRange(value: any): VideoAnalysisRange | null {
116
- if (!value || typeof value !== 'object') return null;
117
- const start = Number(value.start);
118
- const end = Number(value.end);
119
- if (!Number.isFinite(start) || !Number.isFinite(end) || end <= start) return null;
120
- return {
121
- start,
122
- end,
123
- category: value.category ? String(value.category) : undefined,
124
- retryable: value.retryable === true
125
- };
126
- }
127
-
128
- function parseVideoResultText(text: string): Partial<VideoAnalysisView> {
129
- const value = text.trim();
130
- if (!value) return {};
131
- if (value.startsWith('CACHED VIDEO ANALYSIS:')) {
132
- return { outcome: 'complete', reuse: 'full', summary: value.replace(/^CACHED VIDEO ANALYSIS:\s*/, '') };
133
- }
134
- if (value.startsWith('PARTIAL VIDEO ANALYSIS')) {
135
- return { outcome: 'partial', reuse: 'partial', summary: value };
136
- }
137
- if (value.startsWith('All sub-agent chunks failed') || value.startsWith('Error:')) {
138
- return { outcome: 'failed', summary: value };
139
- }
140
- if (value.includes('Analysis is already in progress in another video agent')) {
141
- return { outcome: 'waiting', summary: 'Another video agent is already analyzing this evidence.' };
142
- }
143
- return { outcome: 'complete', summary: value };
144
- }
145
-
146
- /** Build the user-facing, backward-compatible video analysis state. */
147
- export function getVideoAnalysisView(tool: any): VideoAnalysisView | null {
148
- if (!isVideoTool(tool)) return null;
149
- const args = getToolArgs(tool);
150
- const payload = tool?.payload && typeof tool.payload === 'object' ? tool.payload : {};
151
- const rawResult = payload.result ?? tool.result ?? null;
152
- const structured = rawResult && typeof rawResult === 'object' ? rawResult : {};
153
- const parsed = typeof rawResult === 'string' ? parseVideoResultText(rawResult) : {};
154
-
155
- let outcome = String(structured.outcome || payload.outcome || parsed.outcome || '').toLowerCase() as VideoAnalysisOutcome;
156
- if (!['running', 'recovering', 'waiting', 'complete', 'partial', 'failed'].includes(outcome)) {
157
- outcome = tool?.status === 'failed' || tool?.status === 'error'
158
- ? 'failed'
159
- : tool?.status === 'running' ? 'running' : 'complete';
160
- }
161
- const recovering = structured.recovering === true || structured.fallback_used === true;
162
- if (outcome === 'running' && recovering) outcome = 'recovering';
163
-
164
- const start = Number(args.start_time ?? structured.requested_range?.start);
165
- const end = Number(args.end_time ?? structured.requested_range?.end);
166
- const requestedRange = Number.isFinite(start) && Number.isFinite(end) && end > start
167
- ? { start, end }
168
- : numericRange(structured.requested_range);
169
- const completedRanges = Array.isArray(structured.completed_ranges)
170
- ? structured.completed_ranges.map(numericRange).filter((range: VideoAnalysisRange | null): range is VideoAnalysisRange => Boolean(range))
171
- : [];
172
- const failedRanges = Array.isArray(structured.failed_ranges)
173
- ? structured.failed_ranges.map(numericRange).filter((range: VideoAnalysisRange | null): range is VideoAnalysisRange => Boolean(range))
174
- : [];
175
- const completedCount = Number(structured.completed_count ?? completedRanges.length ?? 0);
176
- const totalCount = Number(structured.total_count ?? (completedRanges.length + failedRanges.length));
177
- const titleByOutcome: Record<VideoAnalysisOutcome, string> = {
178
- running: 'Analyzing screen recording',
179
- recovering: 'Analyzing unfinished recording segment',
180
- waiting: 'Waiting for existing video analysis',
181
- complete: structured.reuse === 'full' || parsed.reuse === 'full'
182
- ? 'Reused video analysis'
183
- : 'Analyzed screen recording',
184
- partial: 'Video analysis partially completed',
185
- failed: 'Video analysis returned no result'
186
- };
187
-
188
- return {
189
- outcome,
190
- title: titleByOutcome[outcome],
191
- query: String(args.specific_query || args.query || args.prompt || structured.query || ''),
192
- summary: String(structured.summary || parsed.summary || ''),
193
- reuse: (structured.reuse || parsed.reuse || 'none') as 'none' | 'partial' | 'full',
194
- requestedRange,
195
- completedRanges,
196
- failedRanges,
197
- evidenceCount: Number(structured.evidence_count || 0),
198
- completedCount: Number.isFinite(completedCount) ? completedCount : 0,
199
- totalCount: Number.isFinite(totalCount) ? totalCount : 0,
200
- fallbackUsed: structured.fallback_used === true
201
- };
202
- }
203
-
204
- export function formatVideoTime(seconds: number): string {
205
- const safe = Math.max(0, Number(seconds) || 0);
206
- const minutes = Math.floor(safe / 60);
207
- const secs = Math.floor(safe % 60);
208
- return `${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
209
- }
210
-
211
- /**
212
- * Extract target video filename or description for video analysis tools
213
- */
214
- export function getVideoToolTarget(tool: any): string | null {
215
- if (!tool) return null;
216
- const args = getToolArgs(tool);
217
- if (args.video_path || args.video_file || args.file_path || args.file) {
218
- const p = String(args.video_path || args.video_file || args.file_path || args.file);
219
- return p.split('/').pop() || p;
220
- }
221
- if (args.time_description) {
222
- return String(args.time_description);
223
- }
224
- if (args.start_time !== undefined || args.end_time !== undefined) {
225
- const start = args.start_time ?? 0;
226
- const end = args.end_time ? `${args.end_time}s` : 'end';
227
- return `${start}s - ${end}`;
228
- }
229
- if (args.purpose) {
230
- return String(args.purpose);
231
- }
232
- return 'screen_record.mp4';
233
- }
234
-
235
- /**
236
- * Canonical list of mobile device automation and ADB command tool names.
237
- */
238
- export const DEVICE_ACTION_TOOL_NAMES = new Set([
239
- 'click', 'click_sequence', 'long_press', 'long_press_on', 'input', 'input_text',
240
- 'swipe', 'scroll', 'press_key', 'press_home', 'press_back', 'launch_app', 'manage_app', 'open_app',
241
- 'focus_and_input_text', 'focus_and_clear_text', 'tap', 'wait_for_delay', 'wait',
242
- 'run_adb_command', 'run_short_adb_command'
243
- ]);
244
-
245
- /**
246
- * Check if a tool represents a real mobile device action or ADB command.
247
- */
248
- export function isDeviceActionTool(tool: any): boolean {
249
- if (!tool || !tool.name) return false;
250
- if (tool.type === 'llm_call') return false;
251
- const cleanName = tool.name.replace(/^(_)?(self\.)?exec_/, '').toLowerCase();
252
- return DEVICE_ACTION_TOOL_NAMES.has(cleanName);
253
- }
254
-
255
- /**
256
- * Backward-compatible alias for isDeviceActionTool.
257
- */
258
- export function isFailureAnalyzerActionTool(tool: any): boolean {
259
- return isDeviceActionTool(tool);
260
- }
261
-
262
- /**
263
- * Framework-internal infrastructure tools that are not intended for end-user timeline display.
264
- */
265
- export function isInternalPlumbingTool(tool: any): boolean {
266
- if (!tool || !tool.name) return true;
267
- const cleanName = tool.name.replace(/^(_)?(self\.)?exec_/, '').toLowerCase();
268
- if (cleanName.includes('safety_net')) return true;
269
- if (cleanName === 'report_task_status' || cleanName === 'report_status' || cleanName === 'submit_task_status') {
270
- return true;
271
- }
272
- return false;
273
- }
274
-
275
- /**
276
- * Determines whether a tool invocation should be displayed in the timeline.
277
- */
278
- export function shouldShowTool(tool: any, _stepData?: any): boolean {
279
- if (!tool || !tool.name) return false;
280
- if (tool.type === 'llm_call') return false;
281
- if (tool.type === 'agent') return false;
282
- if (tool.type === 'log') return false; // system notes render as quiet rows, not tool cards
283
- if (isInternalPlumbingTool(tool)) return false;
284
-
285
- return true;
286
- }
287
-
288
- /**
289
- * Extracts human-readable initiating agent name / role for a tool.
290
- */
291
- export function getToolAgentName(tool: any): string | null {
292
- if (!tool) return null;
293
- const name = (tool.agent_name || tool.agent || '').toLowerCase();
294
- if (name.includes('failure') || name.includes('analyzer')) {
295
- return null; // Omit self-healing label per user instruction
296
- }
297
- if (name.includes('outputter')) {
298
- return 'Outputter';
299
- }
300
- if (name.includes('validator')) {
301
- return 'Validator';
302
- }
303
- if (name.includes('diagnos')) {
304
- return 'Diagnoser';
305
- }
306
- if (name.includes('explorer')) {
307
- return 'Explorer';
308
- }
309
- return null;
310
- }
311
-
312
- /**
313
- * Filter out nested child wrapper duplicates while preserving independent executions at the same level
314
- */
315
- export function getUniqueGenericTools(tools: any[] | undefined): any[] {
316
- if (!tools) return [];
317
-
318
- // Only Google GenAI SDK retries are observable. Artemis wrapper retries and
319
- // opaque provider retries must never be presented as provider internals.
320
- const retryTools = tools.filter(tool =>
321
- tool?.type === 'llm_call'
322
- && tool?.status === 'retrying'
323
- && (tool?.name === 'llm_retry' || tool?.name === 'llm_retry_group')
324
- && tool?.payload?.source === 'provider_sdk'
325
- && ['google', 'gemini'].includes(String(tool?.payload?.provider || '').toLowerCase())
326
- );
327
- const retryKey = (tool: any) => String(
328
- tool?.payload?.request_id || `legacy-${tool?.step_id || 'unassigned'}`
329
- );
330
- const retryGroups = new Map<string, any[]>();
331
- for (const retry of retryTools) {
332
- const key = retryKey(retry);
333
- retryGroups.set(key, [...(retryGroups.get(key) || []), retry]);
334
- }
335
- const terminalRequestIds = new Set(
336
- tools
337
- .filter(tool => tool?.type === 'llm_call' && tool?.status === 'failed')
338
- .map(tool => tool?.payload?.request_id)
339
- .filter((requestId): requestId is string => typeof requestId === 'string' && !!requestId)
340
- );
341
-
342
- const buildRetryAggregate = (group: any[]) => {
343
- const firstRetry = group[0];
344
- const latestRetry = group[group.length - 1];
345
- return {
346
- ...firstRetry,
347
- trace_id: `llm-retry-group-${firstRetry?.payload?.request_id || firstRetry?.trace_id || firstRetry?.timestamp || 'unknown'}`,
348
- name: 'llm_retry_group',
349
- payload: {
350
- ...(latestRetry?.payload || {}),
351
- retry_count: group.length,
352
- total_delay: group.reduce(
353
- (total, retry) => total + (Number(retry?.payload?.delay) || 0),
354
- 0
355
- ),
356
- retries: group.map(retry => ({
357
- trace_id: retry.trace_id,
358
- timestamp: retry.timestamp,
359
- error: retry?.payload?.error || retry.error,
360
- delay: Number(retry?.payload?.delay) || 0,
361
- provider: retry?.payload?.provider,
362
- source: retry?.payload?.source,
363
- request_id: retry?.payload?.request_id,
364
- scheduled_at: retry?.payload?.scheduled_at
365
- }))
366
- }
367
- };
368
- };
369
-
370
- const toolMap = new Map<string, any>();
371
- for (const t of tools) {
372
- if (t && t.trace_id) {
373
- toolMap.set(t.trace_id, t);
374
- }
375
- }
376
-
377
- const cleanName = (nameStr: string) => (nameStr || '').replace(/^(_)?(self\.)?exec_/, '').toLowerCase().trim();
378
-
379
- const result: any[] = [];
380
- const seenTraces = new Set<string>();
381
- const addedRetryGroups = new Set<string>();
382
-
383
- for (const tool of tools) {
384
- if (!tool || !tool.name) continue;
385
- if (tool.type === 'agent') continue;
386
-
387
- if (tool.type === 'llm_call' && tool.status === 'retrying') {
388
- const groupKey = retryKey(tool);
389
- const group = retryGroups.get(groupKey);
390
- const requestId = tool?.payload?.request_id;
391
- if (
392
- group
393
- && !addedRetryGroups.has(groupKey)
394
- && !(requestId && terminalRequestIds.has(requestId))
395
- ) {
396
- result.push(buildRetryAggregate(group));
397
- addedRetryGroups.add(groupKey);
398
- }
399
- continue;
400
- }
401
-
402
- if (tool.type === 'llm_call' && tool.status === 'failed') {
403
- // Callback-level attempt errors are implementation details. The wrapper
404
- // emits one terminal llm_pause trace after retries are exhausted.
405
- if (tool.name === 'llm_pause' || tool?.payload?.pause === true) {
406
- result.push(tool);
407
- }
408
- continue;
409
- }
410
-
411
- const currClean = cleanName(tool.name);
412
-
413
- // Check if this tool is a nested child execution of a parent tool with the exact same tool name
414
- let isNestedChildDuplicate = false;
415
- if (tool.parent_trace_id) {
416
- const parentTool = toolMap.get(tool.parent_trace_id);
417
- if (parentTool && cleanName(parentTool.name) === currClean) {
418
- isNestedChildDuplicate = true;
419
- }
420
- }
421
-
422
- if (!isNestedChildDuplicate) {
423
- if (tool.trace_id) {
424
- if (!seenTraces.has(tool.trace_id)) {
425
- seenTraces.add(tool.trace_id);
426
- // Always use the latest state from toolMap for this trace_id
427
- result.push(toolMap.get(tool.trace_id) || tool);
428
- }
429
- } else {
430
- result.push(tool);
431
- }
432
- }
433
- }
434
- return collapseVideoAnalysisTools(result);
435
- }
436
-
437
- /**
438
- * Present one note-style timeline row for one video-analyzer execution. Child
439
- * chunk, audio, and wrapper traces stay available in the raw trace but do not
440
- * look like repeated user-visible analyses.
441
- */
442
- function collapseVideoAnalysisTools(tools: any[]): any[] {
443
- const groups = new Map<string, { firstIndex: number; tools: any[] }>();
444
- const passthrough: Array<{ index: number; tool: any }> = [];
445
-
446
- tools.forEach((tool, index) => {
447
- if (!isVideoTool(tool)) {
448
- passthrough.push({ index, tool });
449
- return;
450
- }
451
- const cleanName = String(tool.name || '').replace(/^(_)?(self\.)?exec_/, '').toLowerCase();
452
- const groupId = cleanName === 'video_analyzer' || cleanName === 'video_analyzer_pure'
453
- ? String(tool.trace_id || tool.parent_trace_id || `video-${index}`)
454
- : String(tool.parent_trace_id || tool.trace_id || `video-${index}`);
455
- const existing = groups.get(groupId);
456
- if (existing) {
457
- existing.tools.push(tool);
458
- } else {
459
- groups.set(groupId, { firstIndex: index, tools: [tool] });
460
- }
461
- });
462
-
463
- const collapsed = [...passthrough];
464
- for (const [groupId, group] of groups) {
465
- const views = group.tools
466
- .map(getVideoAnalysisView)
467
- .filter((view): view is VideoAnalysisView => Boolean(view));
468
- if (!views.length) continue;
469
-
470
- const hasActive = views.some(view => view.outcome === 'running' || view.outcome === 'recovering');
471
- const completed = views.filter(view => view.outcome === 'complete');
472
- const hasPartial = views.some(view => view.outcome === 'partial');
473
- const failed = views.filter(view => view.outcome === 'failed');
474
- const waiting = views.filter(view => view.outcome === 'waiting');
475
- let outcome: VideoAnalysisOutcome;
476
- if (hasActive) {
477
- outcome = views.some(view => view.outcome === 'recovering') ? 'recovering' : 'running';
478
- } else if (hasPartial || (completed.length > 0 && failed.length > 0)) {
479
- outcome = 'partial';
480
- } else if (completed.length > 0) {
481
- outcome = 'complete';
482
- } else if (waiting.length > 0) {
483
- outcome = 'waiting';
484
- } else {
485
- outcome = 'failed';
486
- }
487
-
488
- const ranges = views
489
- .map(view => view.requestedRange)
490
- .filter((range): range is VideoAnalysisRange => Boolean(range));
491
- const requestedRange = ranges.length
492
- ? {
493
- start: Math.min(...ranges.map(range => range.start)),
494
- end: Math.max(...ranges.map(range => range.end))
495
- }
496
- : null;
497
- const reuse = completed.length > 0 && completed.every(view => view.reuse === 'full')
498
- ? 'full'
499
- : views.some(view => view.reuse !== 'none') ? 'partial' : 'none';
500
- const base = group.tools[0];
501
- const structuredResult = {
502
- outcome,
503
- reuse,
504
- requested_range: requestedRange,
505
- completed_count: completed.length,
506
- total_count: views.length,
507
- evidence_count: views.reduce((sum, view) => sum + view.evidenceCount, 0),
508
- query: views.find(view => view.query)?.query || '',
509
- recovering: outcome === 'recovering',
510
- fallback_used: views.some(view => view.fallbackUsed)
511
- };
512
-
513
- collapsed.push({
514
- index: group.firstIndex,
515
- tool: {
516
- ...base,
517
- trace_id: `video-analysis-${groupId}`,
518
- name: 'video_analysis',
519
- status: outcome === 'running' || outcome === 'recovering' ? 'running' : 'success',
520
- payload: {
521
- ...(base.payload || {}),
522
- args: {
523
- ...(base.payload?.args || base.args || {}),
524
- start_time: requestedRange?.start,
525
- end_time: requestedRange?.end
526
- },
527
- result: structuredResult
528
- }
529
- }
530
- });
531
- }
532
-
533
- collapsed.sort((a, b) => a.index - b.index);
534
- return collapsed.map(item => item.tool);
535
- }
536
-
537
- /**
538
- * Get note key for the tool if it exists
539
- */
540
- export function getToolKey(tool: any): string | null {
541
- if (!tool || !tool.name) return null;
542
- const args = tool.payload?.args || tool.args;
543
- const key = args?.key;
544
- if (!key) return null;
545
- return key.toLowerCase().endsWith('.md') ? key : `${key}.md`;
546
- }
547
-
548
- /**
549
- * Get display label for tools (e.g. for pills or headers)
550
- */
551
- export function getToolDisplayLabel(tool: any, isFirstSaveNote: boolean = false): string {
552
- if (!tool || !tool.name) return '';
553
- const cleanName = tool.name.replace(/^(_)?exec_/, '');
554
- const nameLower = cleanName.toLowerCase();
555
- const args = getToolArgs(tool);
556
-
557
- switch (nameLower) {
558
- case 'manage_app':
559
- case 'launch_app': {
560
- const rawApp = args.app_name || args.package_name || args.app || '';
561
- const app = rawApp ? (rawApp.charAt(0).toUpperCase() + rawApp.slice(1)) : 'Application';
562
- const rawAction = args.action ? String(args.action).toLowerCase() : '';
563
- const verb = rawAction === 'launch' ? 'Launching' : (rawAction === 'stop' || rawAction === 'close' ? 'Stopping' : 'Managing');
564
- return `${verb} "${app}"`;
565
- }
566
-
567
- case 'wait_for_delay':
568
- case 'wait_delay':
569
- case 'wait': {
570
- const delay = args.delay_seconds || args.seconds || args.delay || args.duration;
571
- return delay ? `Waiting for ${delay} second${Number(delay) > 1 ? 's' : ''}...` : 'Waiting for delay...';
572
- }
573
- case 'wait_for_text': {
574
- const text = args.text || args.target_text || '';
575
- return text ? `Waiting for text "${text}" to appear on screen` : 'Waiting for text on screen';
576
- }
577
-
578
- case 'input_text':
579
- case 'input': {
580
- const text = args.text || args.input_text || '';
581
- return text ? `Entering text "${text}" into field` : 'Entering text into input field';
582
- }
583
- case 'focus_and_input_text': {
584
- const text = args.text || args.input_text || '';
585
- return text ? `Focusing field and typing "${text}"` : 'Focusing field and entering text';
586
- }
587
- case 'focus_and_clear_text':
588
- return 'Focusing and clearing field text';
589
-
590
- case 'click':
591
- case 'tap': {
592
- const target = args.target_text || args.text || args.query || '';
593
- return target ? `Tapping on "${target}"` : 'Tapping on screen element';
594
- }
595
- case 'click_sequence':
596
- return 'Executing click sequence';
597
- case 'long_press': {
598
- const target = args.target_text || args.text || '';
599
- return target ? `Long pressing on "${target}"` : 'Long pressing screen element';
600
- }
601
- case 'swipe': {
602
- const dir = args.action || args.direction || '';
603
- return dir ? `Swiping ${String(dir).toUpperCase()} on screen` : 'Swiping screen';
604
- }
605
- case 'press_key': {
606
- const key = args.key || args.keycode || '';
607
- return key ? `Pressing key ${String(key).toUpperCase()}` : 'Pressing hardware key';
608
- }
609
-
610
- case 'save_note':
611
- return isFirstSaveNote ? 'Creating note' : 'Saving note';
612
- case 'read_note':
613
- return 'Reading note';
614
- case 'list_notes':
615
- return 'Browsing all saved notes';
616
- case 'update_note':
617
- return 'Updating note';
618
- case 'append_note':
619
- return 'Updating note';
620
-
621
- case 'object_detection': {
622
- const q = Array.isArray(args.queries) ? args.queries.join(', ') : (args.queries || '');
623
- return q ? `Locating on screen: "${q}"` : 'Locating elements on screen';
624
- }
625
- case 'ask_explorer': {
626
- const query = args.query || args.prompt || '';
627
- return query ? `Searching on screen: "${query}"` : 'Searching on screen';
628
- }
629
- case 'report_failure_analysis': {
630
- const reason = args.reason || args.analysis || '';
631
- return reason ? `Investigating issue: ${reason}` : 'Investigating execution issue';
632
- }
633
- case 'run_adb_command':
634
- case 'run_short_adb_command': {
635
- const cmd = args.command || args.cmd || '';
636
- return cmd ? `Running command: ${cmd}` : 'Running system command';
637
- }
638
- case 'search_logs':
639
- case 'read_logs': {
640
- const q = args.query || args.filter || '';
641
- return q ? `Searching logs for "${q}"` : 'Analyzing system logs';
642
- }
643
- case 'log_analyzer':
644
- case 'output_analyzer':
645
- return 'Analyzing logs';
646
- case 'diagnoser':
647
- case 'diagnose':
648
- return 'Diagnosing issue';
649
- case 'video_analyzer':
650
- case 'video_analyzer_pure':
651
- return 'Analyzing screen recording';
652
- case 'extract_segment_metadata': {
653
- const start = args.start_time !== undefined ? `${args.start_time}s` : '';
654
- const end = args.end_time !== undefined ? `${args.end_time}s` : '';
655
- const range = (start && end) ? ` (${start} - ${end})` : (start ? ` (from ${start})` : '');
656
- return `Cropping screen recording segment${range}`;
657
- }
658
- case 'spawn_sub_agent': {
659
- const q = args.specific_query || args.query || args.prompt || '';
660
- return q ? `Analyzing recording with sub-agent: "${q}"` : 'Analyzing recording with sub-agent';
661
- }
662
- case 'analyze_audio_only': {
663
- const q = args.specific_query || args.query || '';
664
- return q ? `Analyzing audio track: "${q}"` : 'Analyzing recording audio track';
665
- }
666
- case 'search_history': {
667
- const q = args.query || '';
668
- const range = Array.isArray(args.step_range) && args.step_range.length
669
- ? ` in steps ${args.step_range[0]}–${args.step_range[args.step_range.length - 1]}`
670
- : '';
671
- return q ? `Searching execution history for "${q}"${range}` : `Searching execution history${range}`;
672
- }
673
- case 'replay_steps': {
674
- const n = args.start_step;
675
- const end = args.end_step;
676
- if (n !== undefined && n !== '' && end !== undefined && end !== null && end !== '' && String(end) !== String(n)) {
677
- return `Reviewing steps ${n}–${end}`;
678
- }
679
- return n !== undefined && n !== '' ? `Reviewing step ${n}` : 'Reviewing step details';
680
- }
681
- case 'get_step_screenshot': {
682
- const n = args.step_number;
683
- const variant = String(args.which || '').toLowerCase();
684
- if (variant === 'overlay') {
685
- return n !== undefined && n !== '' ? `Looking at where step ${n}'s action landed` : 'Looking at where an action landed';
686
- }
687
- const which = variant === 'post' ? 'after' : 'before';
688
- return n !== undefined && n !== '' ? `Looking at the screen ${which} step ${n}` : 'Looking at a step screenshot';
689
- }
690
- case 'probe_device': {
691
- const kind = args.kind ? String(args.kind).replace(/_/g, ' ') : '';
692
- return kind ? `Reading ${kind} from the device` : 'Reading device state';
693
- }
694
- case 'outputter':
695
- case 'output_synthesis':
696
- return 'Synthesizing output report';
697
- case 'web_search': {
698
- const q = args.query || '';
699
- return q ? `Searching web for "${q}"` : 'Searching the web';
700
- }
701
- case 'read_url':
702
- return 'Fetching web page';
703
- case 'compress_history':
704
- return getCompressionLabel(tool);
705
-
706
- default:
707
- return `Executing ${cleanName.split('_').map((w: string) => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')}`;
708
- }
709
- }
710
-
711
- function formatTokenFigure(value: any): string {
712
- const n = Number(value);
713
- if (!Number.isFinite(n) || n < 0) return '';
714
- if (n < 1000) return `${Math.round(n)}`;
715
- return `${(n / 1000).toFixed(1).replace(/\.0$/, '')}k`;
716
- }
717
-
718
- /** Format compression progress and token usage for the timeline. */
719
- export function getCompressionLabel(tool: any): string {
720
- const args = getToolArgs(tool) || {};
721
- const start = Number(args.start_step);
722
- const end = Number(args.end_step);
723
- const hasRange = Number.isFinite(start) && Number.isFinite(end) && start > 0 && end > 0;
724
- const range = hasRange
725
- ? (start === end ? `step ${start}` : `steps ${start}–${end}`)
726
- : 'earlier steps';
727
- const rangeCapitalized = range.charAt(0).toUpperCase() + range.slice(1);
728
- const status = String(tool?.status || '').toLowerCase();
729
- const phase = getCompressionPhase(tool);
730
-
731
- if (status === 'failed' || phase === 'failed') {
732
- return `Couldn't condense ${range} yet; keeping the full record and retrying later`;
733
- }
734
- if (status !== 'success') {
735
- const note = String(args.note || '').toLowerCase();
736
- if (note === 'retrying') return `Retrying the memory summary for ${range}…`;
737
- if (note === 'held' || phase === 'ready') {
738
- const swapAt = Number(args.swap_at_tokens);
739
- const heldContext = Number(args.context_tokens);
740
- const heldParts = [`Short memory for ${range} is ready; keeping the full record until working memory fills up`];
741
- if (heldContext > 0 && swapAt > 0) {
742
- heldParts.push(`≈ ${formatTokenFigure(heldContext)} of ${formatTokenFigure(swapAt)} tokens`);
743
- }
744
- return heldParts.join(' · ');
745
- }
746
- return `Condensing ${range} into a short memory to free up room…`;
747
- }
748
-
749
- const parts: string[] = [];
750
- const source = Number(args.source_tokens);
751
- const summary = Number(args.summary_tokens);
752
- if (args.forced) {
753
- parts.push(`${rangeCapitalized} condensed into a recap to free up memory`);
754
- } else {
755
- parts.push(`${rangeCapitalized} condensed into a short memory`);
756
- if (source > 0 && summary > 0) {
757
- const factor = source / summary;
758
- const factorText = factor >= 2 ? ` (${Math.round(factor)}× smaller)` : '';
759
- parts.push(`${formatTokenFigure(source)} → ${formatTokenFigure(summary)} tokens${factorText}`);
760
- }
761
- }
762
- const context = Number(args.context_tokens);
763
- const budget = Number(args.context_budget);
764
- if (context > 0) {
765
- parts.push(budget > 0
766
- ? `working memory ≈ ${formatTokenFigure(context)} of ${formatTokenFigure(budget)} tokens`
767
- : `working memory ≈ ${formatTokenFigure(context)} tokens`);
768
- }
769
- return parts.join(' · ');
770
- }
771
-
772
- /**
773
- * Plain-language phases of one compress_history line. Mirrors
774
- * COMPRESSION_PHASES in artemis/memory/chunking.py: the backend writes
775
- * `args.phase`; the trace `status` (running/success/failed) is left alone.
776
- */
777
- export type CompressionPhase = 'summarizing' | 'ready' | 'applied' | 'failed';
778
-
779
- const COMPRESSION_PHASES: readonly CompressionPhase[] = ['summarizing', 'ready', 'applied', 'failed'];
780
-
781
- export function isCompressionTool(tool: any): boolean {
782
- const name = String(tool?.name || '').toLowerCase().replace(/^(_)?exec_/, '');
783
- return name === 'compress_history';
784
- }
785
-
786
- /**
787
- * Phase of a compress_history line. Prefers the backend's `args.phase`;
788
- * older traces without it fall back to status + note (`held` ⇒ ready).
789
- */
790
- export function getCompressionPhase(tool: any): CompressionPhase {
791
- const args = getToolArgs(tool) || {};
792
- const declared = String(args.phase || '').toLowerCase() as CompressionPhase;
793
- if (COMPRESSION_PHASES.includes(declared)) return declared;
794
- const status = String(tool?.status || '').toLowerCase();
795
- if (status === 'failed') return 'failed';
796
- if (status === 'success') return 'applied';
797
- if (String(args.note || '').toLowerCase() === 'held') return 'ready';
798
- return 'summarizing';
799
- }
800
-
801
- /** One short, non-technical label per compression phase. */
802
- export function getCompressionPhaseLabel(tool: any): string {
803
- switch (getCompressionPhase(tool)) {
804
- case 'ready':
805
- return 'Summary ready; kept in reserve until the context fills up';
806
- case 'applied':
807
- return 'Replaced this stretch with its summary';
808
- case 'failed':
809
- return 'Summary failed; full record kept';
810
- default:
811
- return 'Summarizing this stretch';
812
- }
813
- }
814
-
815
- /**
816
- * A ready-but-held summary is waiting, not working: the card must not keep
817
- * its running pulse even though the trace status is still `running`.
818
- */
819
- export function isCompressionWaiting(tool: any): boolean {
820
- return isCompressionTool(tool) && getCompressionPhase(tool) === 'ready';
821
- }
822
-
823
- /**
824
- * Get Material Symbol icon for tools
825
- */
826
- export function getToolIcon(tool: any): string {
827
- if (!tool || !tool.name) return 'settings';
828
- const name = tool.name.toLowerCase().replace(/^(_)?exec_/, '');
829
- switch (name) {
830
- case 'click':
831
- case 'tap':
832
- return 'ads_click';
833
- case 'click_sequence':
834
- case 'long_press':
835
- return 'touch_app';
836
- case 'input_text':
837
- case 'input':
838
- return 'keyboard';
839
- case 'swipe':
840
- return 'swipe';
841
- case 'press_key':
842
- return 'keyboard_tab';
843
- case 'manage_app':
844
- return 'open_in_new';
845
- case 'wait_for_delay':
846
- return 'timer';
847
- case 'wait_for_text':
848
- return 'hourglass_empty';
849
- case 'object_detection':
850
- return 'search';
851
- case 'ask_explorer':
852
- return 'search';
853
- case 'report_failure_analysis':
854
- return 'assessment';
855
- case 'run_adb_command':
856
- case 'run_short_adb_command':
857
- return 'terminal';
858
- case 'web_search':
859
- return 'travel_explore';
860
- case 'read_url':
861
- return 'language';
862
- case 'search_logs':
863
- case 'read_logs':
864
- case 'log_analyzer':
865
- case 'output_analyzer':
866
- return 'receipt_long';
867
- case 'diagnoser':
868
- case 'diagnose':
869
- return 'medical_services';
870
- case 'video_analyzer':
871
- case 'video_analyzer_pure':
872
- return 'video_camera_back';
873
- case 'extract_segment_metadata':
874
- return 'crop';
875
- case 'spawn_sub_agent':
876
- return 'smart_toy';
877
- case 'analyze_audio_only':
878
- return 'graphic_eq';
879
- case 'search_history':
880
- return 'find_in_page';
881
- case 'replay_steps':
882
- return 'manage_search';
883
- case 'get_step_screenshot':
884
- return 'image_search';
885
- case 'probe_device':
886
- return 'sensors';
887
- case 'outputter':
888
- case 'output_synthesis':
889
- return 'assignment_turned_in';
890
- case 'compress_history':
891
- return 'compress';
892
- default:
893
- return 'build';
894
- }
895
- }
896
-
897
- /**
898
- * Get formatted title for a tool call card
899
- */
900
- export function getToolTitle(tool: any): string {
901
- if (!tool || !tool.name) return 'Tool Call';
902
- const cleanName = tool.name.replace(/^(_)?exec_/, '');
903
- const name = cleanName.toLowerCase();
904
- switch (name) {
905
- case 'click':
906
- case 'tap':
907
- return 'Tapping Element';
908
- case 'click_sequence':
909
- return 'Executing Click Sequence';
910
- case 'long_press':
911
- return 'Long Pressing Element';
912
- case 'input_text':
913
- case 'input':
914
- return 'Entering Text';
915
- case 'swipe':
916
- case 'scroll': {
917
- const args = getToolArgs(tool);
918
- const dir = args.direction || args.gesture || (typeof args.action === 'string' ? args.action : '');
919
- if (dir && isPureDirectionString(dir)) return `Swiping Screen (${String(dir).toUpperCase()})`;
920
- return 'Swiping Screen';
921
- }
922
- case 'drag':
923
- case 'drag_and_drop':
924
- return 'Dragging Screen';
925
- case 'press_key':
926
- return 'Pressing Hardware Key';
927
- case 'manage_app':
928
- case 'launch_app': {
929
- const args = getToolArgs(tool);
930
- const rawAction = args.action ? String(args.action).toLowerCase() : '';
931
- if (rawAction === 'launch') return 'Launching Application';
932
- if (rawAction === 'stop' || rawAction === 'close') return 'Stopping Application';
933
- return 'Managing Application';
934
- }
935
- case 'wait_for_delay':
936
- case 'wait_delay':
937
- return 'Waiting for Delay';
938
- case 'wait_for_text':
939
- return 'Waiting for Text';
940
- case 'object_detection':
941
- return 'Locating Elements';
942
- case 'ask_explorer':
943
- return 'Searching on Screen';
944
- case 'report_failure_analysis':
945
- return 'Investigating Issue';
946
- case 'run_adb_command':
947
- case 'run_short_adb_command':
948
- return 'Running System Command';
949
- case 'web_search':
950
- return 'Web Search';
951
- case 'read_url':
952
- return 'Fetching Web Page';
953
- case 'search_logs':
954
- case 'read_logs':
955
- return 'Searching Logs';
956
- case 'log_analyzer':
957
- case 'output_analyzer':
958
- return 'Analyzing Logs';
959
- case 'diagnoser':
960
- case 'diagnose':
961
- return 'Diagnosing Issue';
962
- case 'video_analyzer':
963
- case 'video_analyzer_pure':
964
- return 'Analyzing Screen Recording';
965
- case 'extract_segment_metadata':
966
- return 'Cropping Screen Recording';
967
- case 'spawn_sub_agent':
968
- return 'Delegating Video Analysis';
969
- case 'analyze_audio_only':
970
- return 'Analyzing Audio Track';
971
- default:
972
- return cleanName.replace(/_/g, ' ').replace(/\b\w/g, (c: string) => c.toUpperCase());
973
- }
974
- }
975
-
976
- /**
977
- * Join per-point self-described targets (click_sequence `target_descriptions`)
978
- * into one label, chained with ' → ' like the coordinate rendering.
979
- * Returns '' when the value is missing or holds no usable text.
980
- */
981
- export function joinTargetDescriptions(descriptions: any): string {
982
- if (!Array.isArray(descriptions)) return '';
983
- const parts = descriptions
984
- .map(d => (d === null || d === undefined) ? '' : String(d).trim())
985
- .filter(d => d.length > 0);
986
- return parts.join(' → ');
987
- }
988
-
989
- /**
990
- * Get target text description for tools
991
- */
992
- export function getToolTargetText(tool: any): string {
993
- if (!tool || !tool.name) return '';
994
- const args = getToolArgs(tool);
995
- const name = tool.name.toLowerCase().replace(/^(_)?exec_/, '');
996
- if (name === 'manage_app' || name === 'launch_app') {
997
- const rawApp = args.app_name || args.package_name || args.app || '';
998
- const app = rawApp ? (rawApp.charAt(0).toUpperCase() + rawApp.slice(1)) : '';
999
- const rawAct = args.action ? String(args.action).toLowerCase() : '';
1000
- const act = rawAct ? (rawAct.charAt(0).toUpperCase() + rawAct.slice(1)) : '';
1001
- if (act && app) {
1002
- return `${act} ${app}`;
1003
- }
1004
- return app || act || '';
1005
- }
1006
- if (name === 'swipe' && typeof args.action === 'string' && isPureDirectionString(args.action)) {
1007
- return args.action;
1008
- }
1009
- if (name === 'wait_for_text') {
1010
- return args.text || '';
1011
- }
1012
- if (name === 'object_detection') {
1013
- if (Array.isArray(args.queries)) return args.queries.join(', ');
1014
- return args.queries || '';
1015
- }
1016
- if (name === 'ask_explorer' || name === 'web_search') {
1017
- return args.query || args.prompt || '';
1018
- }
1019
- if (name === 'read_url') {
1020
- return args.url || '';
1021
- }
1022
- if (name === 'search_logs' || name === 'read_logs') {
1023
- return args.query || args.filter || '';
1024
- }
1025
- if (name === 'report_failure_analysis') {
1026
- return args.status || args.reason || args.analysis || '';
1027
- }
1028
- if (name === 'click_sequence' || name === 'tap_sequence') {
1029
- // One self-described target per point, chained like getToolCoords does.
1030
- const joined = joinTargetDescriptions(args.target_descriptions);
1031
- if (joined) return joined;
1032
- }
1033
- if (args.target && typeof args.target === 'string') {
1034
- return args.target;
1035
- }
1036
- if (args.target && typeof args.target === 'number') {
1037
- return `Element #${args.target}`;
1038
- }
1039
- if (args.index !== undefined) {
1040
- return `Element #${args.index}`;
1041
- }
1042
- return args.target_text || args.target_description || args.target_class || args.element || args.element_text || (name !== 'input_text' ? args.text : '') || '';
1043
- }
1044
-
1045
- /**
1046
- * Get input label for tools
1047
- */
1048
- export function getToolInputLabel(tool: any): string {
1049
- if (!tool || !tool.name) return 'Input';
1050
- const name = tool.name.toLowerCase().replace(/^(_)?exec_/, '');
1051
- if (name === 'wait_for_delay' || name === 'wait_delay' || name === 'delay' || name === 'wait') {
1052
- return 'Duration';
1053
- }
1054
- if (name === 'swipe' || name === 'scroll' || name === 'drag' || name === 'drag_and_drop') {
1055
- const args = getToolArgs(tool);
1056
- const dir = args.direction || args.gesture || (typeof args.action === 'string' ? args.action : '');
1057
- if (dir && isPureDirectionString(dir)) {
1058
- return 'Direction';
1059
- }
1060
- return 'Input';
1061
- }
1062
- if (name === 'press_key' || name === 'press_home' || name === 'press_back') {
1063
- return 'Key';
1064
- }
1065
- if (name === 'input_text' || name === 'input') {
1066
- return 'Input Text';
1067
- }
1068
- return 'Input';
1069
- }
1070
-
1071
- /**
1072
- * Get input value for tools
1073
- */
1074
- export function getToolInputText(tool: any): string {
1075
- if (!tool || !tool.name) return '';
1076
- const args = getToolArgs(tool);
1077
- const name = tool.name.toLowerCase().replace(/^(_)?exec_/, '');
1078
- if (name === 'press_key') {
1079
- return args.key || args.keycode || '';
1080
- }
1081
- if (name === 'swipe' || name === 'scroll' || name === 'drag' || name === 'drag_and_drop') {
1082
- const dir = args.direction || args.gesture || (typeof args.action === 'string' ? args.action : '');
1083
- if (dir && isPureDirectionString(dir)) {
1084
- return String(dir).toUpperCase();
1085
- }
1086
- return '';
1087
- }
1088
- if (name === 'wait_for_delay' || name === 'wait_delay') {
1089
- return args.time_in_ms ? `${args.time_in_ms}ms` : (args.delay_ms ? `${args.delay_ms}ms` : (args.time ? `${args.time}` : ''));
1090
- }
1091
- if (name === 'long_press' && args.duration) {
1092
- return `Duration: ${args.duration}ms`;
1093
- }
1094
- if (name === 'input_text' || name === 'input') {
1095
- return args.text || args.input_text || '';
1096
- }
1097
- return args.input_text || '';
1098
- }
1099
-
1100
- /**
1101
- * Get coordinates string representation for tools
1102
- */
1103
- export function getToolCoords(tool: any): string {
1104
- if (!tool || !tool.name) return '';
1105
- const args = getToolArgs(tool);
1106
- const cleanName = tool.name.replace(/^(_)?exec_/, '');
1107
- const name = cleanName.toLowerCase();
1108
-
1109
- // Check sequence first if action is sequence or sequence arg is present
1110
- const isSequenceAction = name === 'click_sequence' || name === 'tap_sequence' || Boolean(args.sequence || args.normalized_sequence);
1111
- const rawSeq = args.normalized_sequence || args.sequence || args.targets || (Array.isArray(args.coordinates) && Array.isArray(args.coordinates[0]) ? args.coordinates : null);
1112
- const seqPoints = parseSequenceCoordinates(rawSeq);
1113
- if (seqPoints && seqPoints.length > 0 && (isSequenceAction || seqPoints.length > 1)) {
1114
- return seqPoints.map(pt => `[${pt[0]}, ${pt[1]}]`).join(' → ');
1115
- }
1116
-
1117
- // Check normalized start and end first
1118
- const normStart = extractNumbersFromCoordinateValue(args.normalized_start_coordinates || args.start_coordinates || args.start);
1119
- const normEnd = extractNumbersFromCoordinateValue(args.normalized_end_coordinates || args.end_coordinates || args.end);
1120
- if (normStart && normEnd && normStart.length === 2 && normEnd.length === 2) {
1121
- return `[${normStart[0]}, ${normStart[1]}] → [${normEnd[0]}, ${normEnd[1]}]`;
1122
- }
1123
-
1124
- const coords = extractNumbersFromCoordinateValue(args.normalized_coordinates) ||
1125
- extractNumbersFromCoordinateValue(args.coordinates) ||
1126
- extractNumbersFromCoordinateValue(args.target) ||
1127
- extractNumbersFromCoordinateValue(args.action) ||
1128
- extractNumbersFromCoordinateValue(args.gesture) ||
1129
- extractNumbersFromCoordinateValue(args.point);
1130
-
1131
- if (coords && Array.isArray(coords)) {
1132
- if (coords.length === 4) {
1133
- return `[${coords[0]}, ${coords[1]}] → [${coords[2]}, ${coords[3]}]`;
1134
- }
1135
- if (coords.length === 2) {
1136
- return `[${coords[0]}, ${coords[1]}]`;
1137
- }
1138
- return coords.join(', ');
1139
- }
1140
-
1141
- if (args.x !== undefined && args.y !== undefined) {
1142
- return `[${args.x}, ${args.y}]`;
1143
- }
1144
- return '';
1145
- }
1146
-
1147
- /**
1148
- * Get analysis / reasoning text for tools
1149
- */
1150
- export function getToolAnalysisText(tool: any): string {
1151
- if (!tool || !tool.name) return '';
1152
- const args = getToolArgs(tool);
1153
- return args.analysis || args.reasoning || args.summary || '';
1154
- }
1155
-
1156
- /**
1157
- * Check if tool is ADB command
1158
- */
1159
- export function isAdbCommandTool(tool: any): boolean {
1160
- if (!tool || !tool.name) return false;
1161
- const name = tool.name.toLowerCase().replace(/^(_)?exec_/, '');
1162
- return name === 'run_adb_command' || name === 'run_short_adb_command';
1163
- }
1164
-
1165
- /**
1166
- * Get ADB command line string
1167
- */
1168
- export function getAdbCommandLine(tool: any): string {
1169
- const args = getToolArgs(tool);
1170
- return args.CommandLine || '';
1171
- }
1172
-
1173
- /**
1174
- * Get ADB working directory
1175
- */
1176
- export function getAdbCwd(tool: any): string {
1177
- const args = getToolArgs(tool);
1178
- return args.Cwd || '';
1179
- }
1180
-
1181
- /**
1182
- * Get ADB requested terminal id
1183
- */
1184
- export function getAdbTerminalId(tool: any): string {
1185
- const args = getToolArgs(tool);
1186
- return args.RequestedTerminalID || '';
1187
- }
1188
-
1189
- /**
1190
- * Get fallback generic details for unspecified tools
1191
- */
1192
- export function getToolGenericDetails(tool: any): string {
1193
- if (!tool) return '';
1194
- if (isAdbCommandTool(tool)) {
1195
- return '';
1196
- }
1197
- if (getToolTargetText(tool) || getToolInputText(tool) || getToolCoords(tool) || getToolAnalysisText(tool)) {
1198
- return '';
1199
- }
1200
- const args = getToolArgs(tool);
1201
- if (!args || typeof args !== 'object') return '';
1202
- const ignoredKeys = new Set(['state', 'controller', 'ctx', 'session_id', 'step_id', 'trace_id', 'parent_trace_id', 'times', 'delay_ms']);
1203
- const entries = Object.entries(args).filter(([k, v]) => !ignoredKeys.has(k) && v !== undefined && v !== null && v !== '');
1204
- if (entries.length === 0) return '';
1205
- return entries.map(([k, v]) => `${k}: ${typeof v === 'object' ? JSON.stringify(v) : v}`).join(', ');
1206
- }
1207
-
1208
- /**
1209
- * Check if tool execution failed
1210
- */
1211
- export function isToolFailed(tool: any): boolean {
1212
- if (!tool) return false;
1213
- if (tool.status === 'failed' || tool.status === 'error') return true;
1214
- const args = getToolArgs(tool);
1215
- if (args.status === 'failed' || args.status === 'error' || args.status === 'cannot_fix') return true;
1216
- return false;
1217
- }
1218
-
1219
- /**
1220
- * Get error message for a failed tool
1221
- */
1222
- export function getToolErrorMessage(tool: any): string {
1223
- if (!tool) return 'Tool Failed';
1224
- const args = getToolArgs(tool);
1225
- if (args.status === 'cannot_fix') return 'Status: cannot_fix';
1226
- if (args.error || args.message || args.failure_reason) {
1227
- return args.error || args.message || args.failure_reason;
1228
- }
1229
- if (tool.error || tool.message) return tool.error || tool.message;
1230
- return 'Action Failed';
1231
- }
1232
-
1233
- /**
1234
- * Extract extra parameters for generic tools
1235
- */
1236
- export function extractToolExtraParams(toolData: any, cache?: WeakMap<any, ActionParam[]>): ActionParam[] {
1237
- if (!toolData) return [];
1238
- const payload = toolData.payload || toolData.args || toolData;
1239
- if (!payload || typeof payload !== 'object') return [];
1240
- if (cache && cache.has(payload)) {
1241
- return cache.get(payload)!;
1242
- }
1243
-
1244
- const standardKeys = new Set([
1245
- 'action', 'name', 'type', 'target_text', 'target_description', 'target_descriptions',
1246
- 'text', 'input_text', 'target',
1247
- 'coordinates', 'coords', 'target_bounds', 'bounds', 'target_resource_id',
1248
- 'resource_id', 'target_class', 'class_name', 'normalized_coordinates',
1249
- 'pre_image_name', 'post_image_name', 'pre_screenshot', 'post_screenshot',
1250
- 'before_screenshot', 'after_screenshot', 'status', 'success', 'timestamp',
1251
- 'created_at', 'start_time', 'execution_id', 'controller', 'agent', 'session_id', 'step_id',
1252
- 'app_name', 'package_name', 'app', 'key', 'keycode', 'time_in_ms', 'delay_ms', 'delay_seconds', 'duration',
1253
- 'args', 'kwargs', 'parameters', 'extra_params', 'payload', 'trace_id', 'result', 'error', 'analysis', 'details', 'command', 'cwd', 'terminal_id'
1254
- ]);
1255
-
1256
- const result: ActionParam[] = [];
1257
-
1258
- const rawArgs = toolData.args || toolData.Args || toolData.kwargs || toolData.parameters || toolData.payload;
1259
- let parsedArgs: any = {};
1260
- if (rawArgs) {
1261
- if (typeof rawArgs === 'object') {
1262
- parsedArgs = rawArgs;
1263
- } else if (typeof rawArgs === 'string') {
1264
- try {
1265
- parsedArgs = JSON.parse(rawArgs);
1266
- } catch {
1267
- if (!rawArgs.includes('<') && !rawArgs.includes('object at')) {
1268
- parsedArgs = { details: rawArgs };
1269
- }
1270
- }
1271
- }
1272
- }
1273
-
1274
- const mergedObj = { ...toolData, ...(typeof payload === 'object' ? payload : {}), ...parsedArgs };
1275
-
1276
- for (const [k, v] of Object.entries(mergedObj)) {
1277
- const lowerK = k.toLowerCase();
1278
- if (standardKeys.has(lowerK)) continue;
1279
- if (v === null || v === undefined || v === '') continue;
1280
-
1281
- let valStr = String(v);
1282
- if (valStr.includes('object at 0x') || valStr.startsWith('<artemis.') || valStr.includes('<controller') || valStr.includes('<android_world')) continue;
1283
-
1284
- if (typeof v === 'object') {
1285
- try { valStr = JSON.stringify(v); } catch { valStr = String(v); }
1286
- }
1287
-
1288
- let prettyKey = k.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
1289
- if (lowerK === 'time_in_ms' || lowerK === 'delay_ms') prettyKey = 'Delay';
1290
-
1291
- result.push({ key: prettyKey, value: valStr });
1292
- }
1293
-
1294
- if (cache) {
1295
- cache.set(payload, result);
1296
- }
1297
- return result;
1298
- }
1299
-
1300
- /**
1301
- * Check if text is genuine human thinking rather than raw JSON payload output
1302
- */
1303
- export function isHumanThinking(text: string | null): boolean {
1304
- if (!text) return false;
1305
- let trimmed = text.trim();
1306
- if (!trimmed) return false;
1307
-
1308
- // Strip markdown code blocks if wrapped: ```json ... ``` or ``` ... ```
1309
- if (trimmed.startsWith('```')) {
1310
- const match = trimmed.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);
1311
- if (match) {
1312
- trimmed = match[1].trim();
1313
- }
1314
- }
1315
-
1316
- // Direct object or array start
1317
- if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
1318
- return false;
1319
- }
1320
-
1321
- // Try parsing as JSON if it looks like JSON structures
1322
- try {
1323
- const parsed = JSON.parse(trimmed);
1324
- if (typeof parsed === 'object' && parsed !== null) {
1325
- return false;
1326
- }
1327
- } catch {
1328
- // Not valid standalone JSON, continue checks
1329
- }
1330
-
1331
- // Check for common JSON object detection / grounding / action / tool patterns
1332
- if (/^\s*\{.*"label"\s*:.*"results"\s*:/s.test(trimmed) ||
1333
- /^\s*\{.*"point"\s*:.*"label"\s*:/s.test(trimmed) ||
1334
- /^\s*\{.*"action"\s*:/s.test(trimmed) ||
1335
- /^\s*\{.*"name"\s*:/s.test(trimmed) ||
1336
- /^\s*\{\s*"[^"]+"\s*:\s*/.test(trimmed) ||
1337
- /^\s*\[\s*\{\s*"[^"]+"\s*:\s*/.test(trimmed)) {
1338
- return false;
1339
- }
1340
-
1341
- return true;
1342
- }
1343
-
1344
- /**
1345
- * Clean up raw error messages for display in the UI
1346
- */
1347
- export function cleanErrorMessage(rawError: any): string {
1348
- if (typeof rawError === 'object' && rawError !== null) {
1349
- if (rawError.message && typeof rawError.message === 'string') {
1350
- return cleanErrorMessage(rawError.message);
1351
- }
1352
- if (rawError.error?.message && typeof rawError.error?.message === 'string') {
1353
- return cleanErrorMessage(rawError.error.message);
1354
- }
1355
- if (rawError.detail && typeof rawError.detail === 'string') {
1356
- return cleanErrorMessage(rawError.detail);
1357
- }
1358
- try {
1359
- return JSON.stringify(rawError);
1360
- } catch {
1361
- return String(rawError);
1362
- }
1363
- }
1364
-
1365
- const errorStr = String(rawError).trim();
1366
- if (!errorStr) return 'Unknown error';
1367
-
1368
- // 1. Try regex extraction for "message": "..."
1369
- const doubleQuoteMsgMatch = errorStr.match(/"message"\s*:\s*"((?:[^"\\]|\\.)*)"/i);
1370
- if (doubleQuoteMsgMatch && doubleQuoteMsgMatch[1]) {
1371
- const unescaped = doubleQuoteMsgMatch[1].replace(/\\"/g, '"').replace(/\\n/g, ' ').trim();
1372
- if (unescaped) return unescaped;
1373
- }
1374
-
1375
- // 2. Try regex extraction for 'message': '...'
1376
- const singleQuoteMsgMatch = errorStr.match(/'message'\s*:\s*['"]((?:[^'\\]|\\.)*)['"]/i);
1377
- if (singleQuoteMsgMatch && singleQuoteMsgMatch[1]) {
1378
- const unescaped = singleQuoteMsgMatch[1].replace(/\\'/g, "'").replace(/\\n/g, ' ').trim();
1379
- if (unescaped) return unescaped;
1380
- }
1381
-
1382
- // 3. Try parsing JSON substrings inside the error string
1383
- const jsonMatch = errorStr.match(/\{[\s\S]*\}/);
1384
- if (jsonMatch) {
1385
- try {
1386
- const normalizedJsonStr = jsonMatch[0]
1387
- .replace(/'/g, '"')
1388
- .replace(/True/g, 'true')
1389
- .replace(/False/g, 'false')
1390
- .replace(/None/g, 'null');
1391
- const parsed = JSON.parse(normalizedJsonStr);
1392
- if (parsed?.message) return String(parsed.message);
1393
- if (parsed?.error?.message) return String(parsed.error.message);
1394
- } catch {
1395
- // Ignore
1396
- }
1397
- }
1398
-
1399
- // 4. Fallback: truncate at trace dump headers or return clean message
1400
- let fallback = errorStr;
1401
- if (fallback.includes('=== Source Location Trace')) {
1402
- fallback = fallback.split('=== Source Location Trace')[0];
1403
- }
1404
- if (fallback.includes('[type.googleapis.com')) {
1405
- fallback = fallback.split('[type.googleapis.com')[0];
1406
- }
1407
- fallback = fallback
1408
- .replace(/^Pre-execution validation failed:\s*/i, '')
1409
- .replace(/^Pixel-level validation failed:\s*/i, '')
1410
- .replace(/^Execution error:\s*/i, '')
1411
- .replace(/^ServerError:\s*/i, '')
1412
- // LLM wrappers may add this prefix more than once. It is context, not the
1413
- // actual provider reason, and an empty prefix must not be shown as though
1414
- // it were a useful error message.
1415
- .replace(/^(?:LLM\s+(?:Request\s+)?Error\s*:\s*)+/i, '')
1416
- .trim();
1417
-
1418
- return fallback || 'Unknown error';
1419
- }