@autotest/agent 0.0.1 → 0.0.2
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.
- package/dist/api/agent_api.d.ts.map +1 -0
- package/dist/api/agent_api.js +550 -0
- package/dist/api/agent_api.js.map +1 -0
- package/dist/api/autotest_agent.d.ts.map +1 -0
- package/dist/api/autotest_agent.js +206 -0
- package/dist/api/autotest_agent.js.map +1 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +12 -0
- package/dist/api/types.js.map +1 -0
- package/dist/autotest-cli.d.ts +1 -0
- package/dist/autotest-cli.d.ts.map +1 -0
- package/dist/autotest-cli.js +392 -0
- package/dist/autotest-cli.js.map +1 -0
- package/dist/common/case_manager.d.ts.map +1 -0
- package/dist/common/case_manager.js +92 -0
- package/dist/common/case_manager.js.map +1 -0
- package/dist/common/collect_case.d.ts.map +1 -0
- package/dist/common/collect_case.js +129 -0
- package/dist/common/collect_case.js.map +1 -0
- package/dist/common/common_errors.d.ts.map +1 -0
- package/dist/common/common_errors.js +67 -0
- package/dist/common/common_errors.js.map +1 -0
- package/dist/common/config/config_validator.d.ts.map +1 -0
- package/dist/common/config/config_validator.js +29 -0
- package/dist/common/config/config_validator.js.map +1 -0
- package/dist/common/config/manager.d.ts.map +1 -0
- package/dist/common/config/manager.js +258 -0
- package/dist/common/config/manager.js.map +1 -0
- package/dist/common/config/output.d.ts.map +1 -0
- package/dist/common/config/output.js +60 -0
- package/dist/common/config/output.js.map +1 -0
- package/dist/common/config/types.d.ts.map +1 -0
- package/dist/common/config/types.js +185 -0
- package/dist/common/config/types.js.map +1 -0
- package/dist/common/dfx/client_factory.d.ts.map +1 -0
- package/dist/common/dfx/client_factory.js +63 -0
- package/dist/common/dfx/client_factory.js.map +1 -0
- package/dist/common/dfx/context.d.ts.map +1 -0
- package/dist/common/dfx/context.js +24 -0
- package/dist/common/dfx/context.js.map +1 -0
- package/dist/common/dfx/index.d.ts.map +1 -0
- package/dist/common/dfx/index.js +16 -0
- package/dist/common/dfx/index.js.map +1 -0
- package/dist/common/dfx/recorder.d.ts.map +1 -0
- package/dist/common/dfx/recorder.js +192 -0
- package/dist/common/dfx/recorder.js.map +1 -0
- package/dist/common/dfx/recording_fetch.d.ts.map +1 -0
- package/dist/common/dfx/recording_fetch.js +229 -0
- package/dist/common/dfx/recording_fetch.js.map +1 -0
- package/dist/common/dfx/source.d.ts.map +1 -0
- package/dist/common/dfx/source.js +14 -0
- package/dist/common/dfx/source.js.map +1 -0
- package/dist/common/image_cacher.d.ts.map +1 -0
- package/dist/common/image_cacher.js +37 -0
- package/dist/common/image_cacher.js.map +1 -0
- package/dist/common/image_helper.d.ts.map +1 -0
- package/dist/common/image_helper.js +129 -0
- package/dist/common/image_helper.js.map +1 -0
- package/dist/common/image_similarity.d.ts.map +1 -0
- package/dist/common/image_similarity.js +172 -0
- package/dist/common/image_similarity.js.map +1 -0
- package/dist/common/llm_cache/cache_transport.d.ts.map +1 -0
- package/dist/common/llm_cache/cache_transport.js +99 -0
- package/dist/common/llm_cache/cache_transport.js.map +1 -0
- package/dist/common/logger.d.ts.map +1 -0
- package/dist/common/logger.js +159 -0
- package/dist/common/logger.js.map +1 -0
- package/dist/common/model/custom_model.d.ts.map +1 -0
- package/dist/common/model/custom_model.js +435 -0
- package/dist/common/model/custom_model.js.map +1 -0
- package/dist/common/model/index.d.ts.map +1 -0
- package/dist/common/model/index.js +6 -0
- package/dist/common/model/index.js.map +1 -0
- package/dist/common/path_utils.d.ts.map +1 -0
- package/dist/common/path_utils.js +82 -0
- package/dist/common/path_utils.js.map +1 -0
- package/dist/common/result_parser.d.ts.map +1 -0
- package/dist/common/result_parser.js +50 -0
- package/dist/common/result_parser.js.map +1 -0
- package/dist/common/usage/token_usage.d.ts.map +1 -0
- package/dist/common/usage/token_usage.js +118 -0
- package/dist/common/usage/token_usage.js.map +1 -0
- package/dist/common/utils.d.ts.map +1 -0
- package/dist/common/utils.js +126 -0
- package/dist/common/utils.js.map +1 -0
- package/dist/core/agent/layered_agent/ability_helper.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/ability_helper.js +126 -0
- package/dist/core/agent/layered_agent/ability_helper.js.map +1 -0
- package/dist/core/agent/layered_agent/agent.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/agent.js +38 -0
- package/dist/core/agent/layered_agent/agent.js.map +1 -0
- package/dist/core/agent/layered_agent/agent_registry.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/agent_registry.js +76 -0
- package/dist/core/agent/layered_agent/agent_registry.js.map +1 -0
- package/dist/core/agent/layered_agent/decision.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/decision.js +479 -0
- package/dist/core/agent/layered_agent/decision.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/action_handler.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/action_handler.js +156 -0
- package/dist/core/agent/layered_agent/execute_agent/action_handler.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.js +42 -0
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/base_agent.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/base_agent.js +113 -0
- package/dist/core/agent/layered_agent/execute_agent/base_agent.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/general_agent.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/general_agent.js +208 -0
- package/dist/core/agent/layered_agent/execute_agent/general_agent.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.js +242 -0
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/i18n.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/i18n.js +35 -0
- package/dist/core/agent/layered_agent/execute_agent/i18n.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/index.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/index.js +68 -0
- package/dist/core/agent/layered_agent/execute_agent/index.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js +317 -0
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +155 -0
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js +244 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js +140 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/index.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/index.js +10 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/index.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js +95 -0
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/prompts.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/prompts.js +110 -0
- package/dist/core/agent/layered_agent/execute_agent/prompts.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js +34 -0
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/utils.d.ts.map +1 -0
- package/dist/core/agent/layered_agent/execute_agent/utils.js +53 -0
- package/dist/core/agent/layered_agent/execute_agent/utils.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/agent.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/agent.js +566 -0
- package/dist/core/agent/report_analyzer_agent/agent.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/config.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/config.js +23 -0
- package/dist/core/agent/report_analyzer_agent/config.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/data_loader.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/data_loader.js +256 -0
- package/dist/core/agent/report_analyzer_agent/data_loader.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/guardrails.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/guardrails.js +100 -0
- package/dist/core/agent/report_analyzer_agent/guardrails.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/hooks.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/hooks.js +32 -0
- package/dist/core/agent/report_analyzer_agent/hooks.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/index.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/index.js +53 -0
- package/dist/core/agent/report_analyzer_agent/index.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.js +43 -0
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/mapping.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/mapping.js +134 -0
- package/dist/core/agent/report_analyzer_agent/mapping.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/parse.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/parse.js +376 -0
- package/dist/core/agent/report_analyzer_agent/parse.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/prompt.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/prompt.js +301 -0
- package/dist/core/agent/report_analyzer_agent/prompt.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/report_writer.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/report_writer.js +559 -0
- package/dist/core/agent/report_analyzer_agent/report_writer.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/tools.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/tools.js +151 -0
- package/dist/core/agent/report_analyzer_agent/tools.js.map +1 -0
- package/dist/core/agent/report_analyzer_agent/types.d.ts.map +1 -0
- package/dist/core/agent/report_analyzer_agent/types.js +275 -0
- package/dist/core/agent/report_analyzer_agent/types.js.map +1 -0
- package/dist/core/agent/rewrite_agent/agent.d.ts.map +1 -0
- package/dist/core/agent/rewrite_agent/agent.js +210 -0
- package/dist/core/agent/rewrite_agent/agent.js.map +1 -0
- package/dist/core/agent/rewrite_agent/guardrails.d.ts.map +1 -0
- package/dist/core/agent/rewrite_agent/guardrails.js +96 -0
- package/dist/core/agent/rewrite_agent/guardrails.js.map +1 -0
- package/dist/core/agent/rewrite_agent/mapping.d.ts.map +1 -0
- package/dist/core/agent/rewrite_agent/mapping.js +57 -0
- package/dist/core/agent/rewrite_agent/mapping.js.map +1 -0
- package/dist/core/agent/rewrite_agent/parse.d.ts.map +1 -0
- package/dist/core/agent/rewrite_agent/parse.js +122 -0
- package/dist/core/agent/rewrite_agent/parse.js.map +1 -0
- package/dist/core/agent/rewrite_agent/types.d.ts.map +1 -0
- package/dist/core/agent/rewrite_agent/types.js +38 -0
- package/dist/core/agent/rewrite_agent/types.js.map +1 -0
- package/dist/core/agent/single_agent/agent.d.ts.map +1 -0
- package/dist/core/agent/single_agent/agent.js +799 -0
- package/dist/core/agent/single_agent/agent.js.map +1 -0
- package/dist/core/agent/single_agent/hook_manager.d.ts.map +1 -0
- package/dist/core/agent/single_agent/hook_manager.js +61 -0
- package/dist/core/agent/single_agent/hook_manager.js.map +1 -0
- package/dist/core/agent/single_agent/hooks.d.ts.map +1 -0
- package/dist/core/agent/single_agent/hooks.js +289 -0
- package/dist/core/agent/single_agent/hooks.js.map +1 -0
- package/dist/core/agent/single_agent/image_utils.d.ts.map +1 -0
- package/dist/core/agent/single_agent/image_utils.js +160 -0
- package/dist/core/agent/single_agent/image_utils.js.map +1 -0
- package/dist/core/agent/single_agent/scroll_search_agent.d.ts.map +1 -0
- package/dist/core/agent/single_agent/scroll_search_agent.js +377 -0
- package/dist/core/agent/single_agent/scroll_search_agent.js.map +1 -0
- package/dist/core/agent/single_agent/subagent_manager.d.ts.map +1 -0
- package/dist/core/agent/single_agent/subagent_manager.js +74 -0
- package/dist/core/agent/single_agent/subagent_manager.js.map +1 -0
- package/dist/core/agent/single_agent/tool_recorder_hook.d.ts.map +1 -0
- package/dist/core/agent/single_agent/tool_recorder_hook.js +43 -0
- package/dist/core/agent/single_agent/tool_recorder_hook.js.map +1 -0
- package/dist/core/agent/types.d.ts.map +1 -0
- package/dist/core/agent/types.js +3 -0
- package/dist/core/agent/types.js.map +1 -0
- package/dist/core/agent/utils/message_builder.d.ts.map +1 -0
- package/dist/core/agent/utils/message_builder.js +139 -0
- package/dist/core/agent/utils/message_builder.js.map +1 -0
- package/dist/core/device/device_protocol.d.ts.map +1 -0
- package/dist/core/device/device_protocol.js +3 -0
- package/dist/core/device/device_protocol.js.map +1 -0
- package/dist/core/device/hdc/apps.d.ts.map +1 -0
- package/dist/core/device/hdc/apps.js +438 -0
- package/dist/core/device/hdc/apps.js.map +1 -0
- package/dist/core/device/hdc/device.d.ts.map +1 -0
- package/dist/core/device/hdc/device.js +220 -0
- package/dist/core/device/hdc/device.js.map +1 -0
- package/dist/core/device/hdc/index.d.ts.map +1 -0
- package/dist/core/device/hdc/index.js +32 -0
- package/dist/core/device/hdc/index.js.map +1 -0
- package/dist/core/device/hdc/input.d.ts.map +1 -0
- package/dist/core/device/hdc/input.js +75 -0
- package/dist/core/device/hdc/input.js.map +1 -0
- package/dist/core/device/hdc/screenshot.d.ts.map +1 -0
- package/dist/core/device/hdc/screenshot.js +172 -0
- package/dist/core/device/hdc/screenshot.js.map +1 -0
- package/dist/core/device/index.d.ts.map +1 -0
- package/dist/core/device/index.js +71 -0
- package/dist/core/device/index.js.map +1 -0
- package/dist/core/device/types.d.ts.map +1 -0
- package/dist/core/device/types.js +3 -0
- package/dist/core/device/types.js.map +1 -0
- package/dist/core/knowledge/knowledge_manager.d.ts.map +1 -0
- package/dist/core/knowledge/knowledge_manager.js +71 -0
- package/dist/core/knowledge/knowledge_manager.js.map +1 -0
- package/dist/core/knowledge/vectordb.d.ts.map +1 -0
- package/dist/core/knowledge/vectordb.js +284 -0
- package/dist/core/knowledge/vectordb.js.map +1 -0
- package/dist/core/mcp/adapter_factory.d.ts.map +1 -0
- package/dist/core/mcp/adapter_factory.js +100 -0
- package/dist/core/mcp/adapter_factory.js.map +1 -0
- package/dist/core/mcp/android_adapter.d.ts.map +1 -0
- package/dist/core/mcp/android_adapter.js +287 -0
- package/dist/core/mcp/android_adapter.js.map +1 -0
- package/dist/core/mcp/base_adapter.d.ts.map +1 -0
- package/dist/core/mcp/base_adapter.js +87 -0
- package/dist/core/mcp/base_adapter.js.map +1 -0
- package/dist/core/mcp/harmony_hdc_adapter.d.ts.map +1 -0
- package/dist/core/mcp/harmony_hdc_adapter.js +589 -0
- package/dist/core/mcp/harmony_hdc_adapter.js.map +1 -0
- package/dist/core/mcp/ios_adapter.d.ts.map +1 -0
- package/dist/core/mcp/ios_adapter.js +287 -0
- package/dist/core/mcp/ios_adapter.js.map +1 -0
- package/dist/core/mcp/local_tools.d.ts.map +1 -0
- package/dist/core/mcp/local_tools.js +42 -0
- package/dist/core/mcp/local_tools.js.map +1 -0
- package/dist/core/mcp/mcp_tools.d.ts.map +1 -0
- package/dist/core/mcp/mcp_tools.js +383 -0
- package/dist/core/mcp/mcp_tools.js.map +1 -0
- package/dist/core/mcp/types.d.ts.map +1 -0
- package/dist/core/mcp/types.js +7 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/memory/compressed_session.d.ts.map +1 -0
- package/dist/core/memory/compressed_session.js +183 -0
- package/dist/core/memory/compressed_session.js.map +1 -0
- package/dist/core/memory/context_compressor.d.ts.map +1 -0
- package/dist/core/memory/context_compressor.js +177 -0
- package/dist/core/memory/context_compressor.js.map +1 -0
- package/dist/core/memory/index.d.ts.map +1 -0
- package/dist/core/memory/index.js +23 -0
- package/dist/core/memory/index.js.map +1 -0
- package/dist/core/memory/memory_manager.d.ts.map +1 -0
- package/dist/core/memory/memory_manager.js +29 -0
- package/dist/core/memory/memory_manager.js.map +1 -0
- package/dist/core/memory/reflector.d.ts.map +1 -0
- package/dist/core/memory/reflector.js +96 -0
- package/dist/core/memory/reflector.js.map +1 -0
- package/dist/core/memory/session_factory.d.ts.map +1 -0
- package/dist/core/memory/session_factory.js +30 -0
- package/dist/core/memory/session_factory.js.map +1 -0
- package/dist/core/memory/tool_player.d.ts.map +1 -0
- package/dist/core/memory/tool_player.js +226 -0
- package/dist/core/memory/tool_player.js.map +1 -0
- package/dist/core/memory/tool_recorder.d.ts.map +1 -0
- package/dist/core/memory/tool_recorder.js +127 -0
- package/dist/core/memory/tool_recorder.js.map +1 -0
- package/dist/core/preprocessor/task_splitter.d.ts.map +1 -0
- package/dist/core/preprocessor/task_splitter.js +113 -0
- package/dist/core/preprocessor/task_splitter.js.map +1 -0
- package/dist/core/prompt/prompt_loader.d.ts.map +1 -0
- package/dist/core/prompt/prompt_loader.js +314 -0
- package/dist/core/prompt/prompt_loader.js.map +1 -0
- package/dist/core/skill/skill_manager.d.ts.map +1 -0
- package/dist/core/skill/skill_manager.js +300 -0
- package/dist/core/skill/skill_manager.js.map +1 -0
- package/dist/data_types/action.d.ts.map +1 -0
- package/dist/data_types/action.js +3 -0
- package/dist/data_types/action.js.map +1 -0
- package/dist/data_types/agent.d.ts.map +1 -0
- package/dist/data_types/agent.js +3 -0
- package/dist/data_types/agent.js.map +1 -0
- package/dist/data_types/device.d.ts.map +1 -0
- package/dist/data_types/device.js +3 -0
- package/dist/data_types/device.js.map +1 -0
- package/dist/data_types/index.d.ts.map +1 -0
- package/dist/data_types/index.js +7 -0
- package/dist/data_types/index.js.map +1 -0
- package/dist/data_types/report.d.ts.map +1 -0
- package/dist/data_types/report.js +7 -0
- package/dist/data_types/report.js.map +1 -0
- package/dist/data_types/task.d.ts.map +1 -0
- package/dist/data_types/task.js +3 -0
- package/dist/data_types/task.js.map +1 -0
- package/dist/hypium_generator/generator.d.ts.map +1 -0
- package/dist/hypium_generator/generator.js +847 -0
- package/dist/hypium_generator/generator.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +136 -1
- package/dist/index.js.map +1 -0
- package/dist/loop/cli.d.ts.map +1 -0
- package/dist/loop/cli.js +128 -0
- package/dist/loop/cli.js.map +1 -0
- package/dist/loop/orchestrator.d.ts.map +1 -0
- package/dist/loop/orchestrator.js +315 -0
- package/dist/loop/orchestrator.js.map +1 -0
- package/dist/loop/result_writer.d.ts.map +1 -0
- package/dist/loop/result_writer.js +261 -0
- package/dist/loop/result_writer.js.map +1 -0
- package/dist/loop/types.d.ts.map +1 -0
- package/dist/loop/types.js +83 -0
- package/dist/loop/types.js.map +1 -0
- package/dist/mcp-server/server.d.ts.map +1 -0
- package/dist/mcp-server/server.js +277 -0
- package/dist/mcp-server/server.js.map +1 -0
- package/dist/mcp-server/types.d.ts.map +1 -0
- package/dist/mcp-server/types.js +82 -0
- package/dist/mcp-server/types.js.map +1 -0
- package/dist/reporter/batch_summary.d.ts.map +1 -0
- package/dist/reporter/batch_summary.js +198 -0
- package/dist/reporter/batch_summary.js.map +1 -0
- package/dist/reporter/generator.d.ts.map +1 -0
- package/dist/reporter/generator.js +773 -0
- package/dist/reporter/generator.js.map +1 -0
- package/dist/reporter/types.d.ts.map +1 -0
- package/dist/reporter/types.js +45 -0
- package/dist/reporter/types.js.map +1 -0
- package/dist/tools/batch_runner.d.ts +1 -0
- package/dist/tools/batch_runner.d.ts.map +1 -0
- package/dist/tools/batch_runner.js +722 -0
- package/dist/tools/batch_runner.js.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,773 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ReportGeneratorImpl = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const types_1 = require("./types");
|
|
40
|
+
const image_helper_1 = require("../common/image_helper");
|
|
41
|
+
const TOOL_NAME_MAP = {
|
|
42
|
+
click: '点击', long_click: '长按', double_click: '双击',
|
|
43
|
+
swipe: '滑动', drag: '拖拽', input_text: '输入文本',
|
|
44
|
+
go_back: '返回', go_home: '回到桌面', start_app: '启动应用',
|
|
45
|
+
stop_app: '停止应用', wait: '等待', press_key: '按键',
|
|
46
|
+
screen_on: '点亮屏幕', unlock_screen: '解锁屏幕', clear_recent_task: '清空最近任务',
|
|
47
|
+
};
|
|
48
|
+
class ReportGeneratorImpl {
|
|
49
|
+
events = [];
|
|
50
|
+
totalTokens = {
|
|
51
|
+
total: 0, inputTokens: 0, outputTokens: 0, reasoningTokens: 0, cachedTokens: 0, sources: {},
|
|
52
|
+
};
|
|
53
|
+
stepTokens = [];
|
|
54
|
+
taskDesc = '';
|
|
55
|
+
testCase = '';
|
|
56
|
+
startTime = null;
|
|
57
|
+
endTime = null;
|
|
58
|
+
status = null;
|
|
59
|
+
reportDir;
|
|
60
|
+
embedImages;
|
|
61
|
+
embedMaxPixels;
|
|
62
|
+
constructor(reportDir, embedImages = false, embedMaxPixels = 800) {
|
|
63
|
+
this.reportDir = reportDir;
|
|
64
|
+
this.embedImages = embedImages;
|
|
65
|
+
this.embedMaxPixels = embedMaxPixels;
|
|
66
|
+
if (!fs.existsSync(reportDir)) {
|
|
67
|
+
fs.mkdirSync(reportDir, { recursive: true });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
addEvent(event) {
|
|
71
|
+
const parsed = types_1.ReportEventSchema.safeParse(event);
|
|
72
|
+
if (parsed.success) {
|
|
73
|
+
this.events.push(parsed.data);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.events.push({
|
|
77
|
+
eventType: event.eventType,
|
|
78
|
+
timestamp: event.timestamp ?? new Date().toISOString(),
|
|
79
|
+
content: event.content ?? '',
|
|
80
|
+
data: event.data ?? {},
|
|
81
|
+
screenshotPath: event.screenshotPath,
|
|
82
|
+
stepNumber: event.stepNumber,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
this.flushJson();
|
|
86
|
+
}
|
|
87
|
+
getCurrentStepNumber() {
|
|
88
|
+
for (let i = this.events.length - 1; i >= 0; i--) {
|
|
89
|
+
const sn = this.events[i].stepNumber;
|
|
90
|
+
if (sn != null) {
|
|
91
|
+
return sn;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
flushJson() {
|
|
97
|
+
if (!this.reportDir)
|
|
98
|
+
return;
|
|
99
|
+
try {
|
|
100
|
+
const data = this.serializeForJson();
|
|
101
|
+
fs.writeFileSync(path.join(this.reportDir, 'report.json'), JSON.stringify(data, null, 2), 'utf-8');
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// flush failure is non-blocking
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
addTokenUsage(usage, source, stepNumber) {
|
|
108
|
+
const u = usage;
|
|
109
|
+
if (!u)
|
|
110
|
+
return;
|
|
111
|
+
const input = u.inputTokens ?? u.input_tokens ?? 0;
|
|
112
|
+
const output = u.outputTokens ?? u.output_tokens ?? 0;
|
|
113
|
+
const reasoning = u.reasoningTokens ?? u.reasoning_tokens ?? 0;
|
|
114
|
+
const cached = u.cachedTokens ?? u.cached_tokens ?? 0;
|
|
115
|
+
const total = input + output + reasoning + cached;
|
|
116
|
+
const uncached = input - cached;
|
|
117
|
+
const normalized = Math.round((uncached * 1.0 + cached * 0.2 + output * 1.0) * 10) / 10;
|
|
118
|
+
this.totalTokens.total += total;
|
|
119
|
+
this.totalTokens.inputTokens += input;
|
|
120
|
+
this.totalTokens.outputTokens += output;
|
|
121
|
+
this.totalTokens.reasoningTokens += reasoning;
|
|
122
|
+
this.totalTokens.cachedTokens += cached;
|
|
123
|
+
if (source) {
|
|
124
|
+
if (!this.totalTokens.sources[source]) {
|
|
125
|
+
this.totalTokens.sources[source] = { total: 0, inputTokens: 0, outputTokens: 0, reasoningTokens: 0, cachedTokens: 0, sources: {} };
|
|
126
|
+
}
|
|
127
|
+
const src = this.totalTokens.sources[source];
|
|
128
|
+
src.total += total;
|
|
129
|
+
src.inputTokens += input;
|
|
130
|
+
src.outputTokens += output;
|
|
131
|
+
src.reasoningTokens += reasoning;
|
|
132
|
+
src.cachedTokens += cached;
|
|
133
|
+
}
|
|
134
|
+
if (stepNumber !== undefined) {
|
|
135
|
+
this.stepTokens.push({
|
|
136
|
+
step_number: stepNumber, timestamp: new Date().toISOString(),
|
|
137
|
+
input_tokens: input, output_tokens: output, reasoning_tokens: reasoning,
|
|
138
|
+
cached_tokens: cached, total_tokens: total, normalized_tokens: normalized,
|
|
139
|
+
...(source ? { source } : {}),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
setTask(task) { this.taskDesc = task; }
|
|
144
|
+
setTestCase(testCase) { this.testCase = testCase; }
|
|
145
|
+
startTask() {
|
|
146
|
+
this.startTime = new Date().toISOString();
|
|
147
|
+
this.addEvent({
|
|
148
|
+
eventType: types_1.EventType.TASK_START, timestamp: this.startTime,
|
|
149
|
+
content: `Task started: ${this.taskDesc}`,
|
|
150
|
+
data: { testCase: this.testCase, task: this.taskDesc }, stepNumber: null,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
endTask(result, status) {
|
|
154
|
+
this.endTime = new Date().toISOString();
|
|
155
|
+
if (!status) {
|
|
156
|
+
if (result.startsWith('Error:') || result.startsWith('错误') || result.startsWith('任务执行失败')) {
|
|
157
|
+
this.status = 'FAIL';
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
const m = result.match(/结果\s*[::]\s*(不?通过)/);
|
|
161
|
+
if (m) {
|
|
162
|
+
this.status = m[1] === '通过' ? 'PASS' : 'FAIL';
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
this.status = this.status ?? 'UNKNOWN';
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.status = status.toUpperCase();
|
|
171
|
+
}
|
|
172
|
+
this.addEvent({
|
|
173
|
+
eventType: types_1.EventType.TASK_END, timestamp: this.endTime,
|
|
174
|
+
content: `Task completed: ${result}`,
|
|
175
|
+
data: { result, status: this.status.toLowerCase() }, stepNumber: null,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
saveScreenshot(base64Data, layoutData, prefix) {
|
|
179
|
+
const screenshotsDir = path.join(this.reportDir, 'screenPath');
|
|
180
|
+
if (!fs.existsSync(screenshotsDir)) {
|
|
181
|
+
fs.mkdirSync(screenshotsDir, { recursive: true });
|
|
182
|
+
}
|
|
183
|
+
const p = prefix ?? 'screenshot';
|
|
184
|
+
const now = new Date();
|
|
185
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
186
|
+
const timestamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}_${String(now.getMilliseconds()).padStart(3, '0')}`;
|
|
187
|
+
const filename = `${p}_${timestamp}.jpeg`;
|
|
188
|
+
const filepath = path.join(screenshotsDir, filename);
|
|
189
|
+
fs.writeFileSync(filepath, Buffer.from(base64Data, 'base64'));
|
|
190
|
+
const layoutDir = path.join(this.reportDir, 'layout');
|
|
191
|
+
if (!fs.existsSync(layoutDir)) {
|
|
192
|
+
fs.mkdirSync(layoutDir, { recursive: true });
|
|
193
|
+
}
|
|
194
|
+
const layoutFilename = `${p}_${timestamp}.json`;
|
|
195
|
+
fs.writeFileSync(path.join(layoutDir, layoutFilename), layoutData ?? '');
|
|
196
|
+
return filepath;
|
|
197
|
+
}
|
|
198
|
+
saveJson() { this.flushJson(); }
|
|
199
|
+
async saveAll(baseFilename) {
|
|
200
|
+
const name = baseFilename ?? 'report';
|
|
201
|
+
const reportData = this.buildReportData();
|
|
202
|
+
const jsonPath = path.join(this.reportDir, `${name}.json`);
|
|
203
|
+
fs.writeFileSync(jsonPath, JSON.stringify(this.serializeForJson(), null, 2), 'utf-8');
|
|
204
|
+
const mdPath = path.join(this.reportDir, `${name}.md`);
|
|
205
|
+
fs.writeFileSync(mdPath, this.generateMarkdown(reportData), 'utf-8');
|
|
206
|
+
const htmlPath = path.join(this.reportDir, `${name}.html`);
|
|
207
|
+
fs.writeFileSync(htmlPath, await this.generateHtml(reportData), 'utf-8');
|
|
208
|
+
return { json: jsonPath, markdown: mdPath, html: htmlPath };
|
|
209
|
+
}
|
|
210
|
+
getReportDir() { return this.reportDir; }
|
|
211
|
+
buildReportData() {
|
|
212
|
+
return {
|
|
213
|
+
test_case: this.testCase, task: this.taskDesc,
|
|
214
|
+
start_time: this.startTime, end_time: this.endTime,
|
|
215
|
+
total_tokens: this.totalTokens, step_tokens: this.stepTokens, events: this.events,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
serializeForJson() {
|
|
219
|
+
return {
|
|
220
|
+
test_case: this.testCase,
|
|
221
|
+
task: this.taskDesc,
|
|
222
|
+
start_time: this.startTime,
|
|
223
|
+
end_time: this.endTime,
|
|
224
|
+
total_tokens: this.totalTokens,
|
|
225
|
+
step_tokens: this.stepTokens,
|
|
226
|
+
events: this.events.map(e => this.eventToDict(e)),
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
eventToDict(ev) {
|
|
230
|
+
const d = {
|
|
231
|
+
event_type: ev.eventType,
|
|
232
|
+
timestamp: ev.timestamp,
|
|
233
|
+
content: ev.content,
|
|
234
|
+
data: ev.data,
|
|
235
|
+
screenshot_path: ev.screenshotPath ?? null,
|
|
236
|
+
step_number: ev.stepNumber ?? null,
|
|
237
|
+
};
|
|
238
|
+
if (ev.subEvents && ev.subEvents.length > 0) {
|
|
239
|
+
d['sub_events'] = ev.subEvents;
|
|
240
|
+
}
|
|
241
|
+
return d;
|
|
242
|
+
}
|
|
243
|
+
toRelativePath(absPath) {
|
|
244
|
+
if (!absPath)
|
|
245
|
+
return '';
|
|
246
|
+
try {
|
|
247
|
+
return path.relative(this.reportDir, absPath).replace(/\\/g, '/');
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
return absPath;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async resolveImgSrc(relPath) {
|
|
254
|
+
if (!relPath || !this.embedImages)
|
|
255
|
+
return relPath;
|
|
256
|
+
const abs = path.resolve(this.reportDir, relPath);
|
|
257
|
+
const base64 = await (0, image_helper_1.compressImageToBase64)(abs, this.embedMaxPixels);
|
|
258
|
+
return base64 || relPath;
|
|
259
|
+
}
|
|
260
|
+
escapeHtml(text) {
|
|
261
|
+
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
|
262
|
+
.replace(/"/g, '"').replace(/'/g, ''');
|
|
263
|
+
}
|
|
264
|
+
formatDuration(s, e) {
|
|
265
|
+
if (!s || !e)
|
|
266
|
+
return 'N/A';
|
|
267
|
+
const d = new Date(e).getTime() - new Date(s).getTime();
|
|
268
|
+
return `${Math.floor(d / 60000)}:${Math.floor((d % 60000) / 1000).toString().padStart(2, '0')}`;
|
|
269
|
+
}
|
|
270
|
+
formatTime(iso) {
|
|
271
|
+
try {
|
|
272
|
+
const d = new Date(iso);
|
|
273
|
+
return `${d.getHours().toString().padStart(2, '0')}:${d.getMinutes().toString().padStart(2, '0')}:${d.getSeconds().toString().padStart(2, '0')}.${d.getMilliseconds().toString().padStart(3, '0').slice(0, 2)}`;
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return iso;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
formatTokenCount(n) {
|
|
280
|
+
if (n >= 1000000)
|
|
281
|
+
return `${(n / 1000000).toFixed(1)}M`;
|
|
282
|
+
if (n >= 1000)
|
|
283
|
+
return `${(n / 1000).toFixed(1)}K`;
|
|
284
|
+
return String(n);
|
|
285
|
+
}
|
|
286
|
+
extractStepTitle(g) {
|
|
287
|
+
if (!g.toolCall)
|
|
288
|
+
return g.thinking ? g.thinking.split('\n')[0].slice(0, 50) : `步骤 ${g.step}`;
|
|
289
|
+
const name = g.toolCall.name;
|
|
290
|
+
const args = g.toolCallArgs ?? {};
|
|
291
|
+
if (args.log && typeof args.log === 'string')
|
|
292
|
+
return args.log;
|
|
293
|
+
if (name === 'start_app' && args.app_name)
|
|
294
|
+
return `启动${args.app_name}`;
|
|
295
|
+
if (name === 'stop_app' && args.app_name)
|
|
296
|
+
return `停止${args.app_name}`;
|
|
297
|
+
if (name === 'wait' && args.duration)
|
|
298
|
+
return `等待${args.duration}秒`;
|
|
299
|
+
if (name === 'input_text' && args.text)
|
|
300
|
+
return `输入"${args.text}"`;
|
|
301
|
+
if (name === 'press_key' && args.key_name)
|
|
302
|
+
return `按下${args.key_name}键`;
|
|
303
|
+
return TOOL_NAME_MAP[name] ?? name;
|
|
304
|
+
}
|
|
305
|
+
asPoint2(v) {
|
|
306
|
+
if (Array.isArray(v) && v.length === 2 && typeof v[0] === 'number' && typeof v[1] === 'number') {
|
|
307
|
+
return [v[0], v[1]];
|
|
308
|
+
}
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
asPointFromXY(x, y) {
|
|
312
|
+
if (typeof x === 'number' && typeof y === 'number')
|
|
313
|
+
return [x, y];
|
|
314
|
+
if (typeof x === 'number')
|
|
315
|
+
return [x, 0];
|
|
316
|
+
if (typeof y === 'number')
|
|
317
|
+
return [0, y];
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
stripTagMarkers(text) {
|
|
321
|
+
return text.replace(/<\/?(?:thinking|judgment|judgement)\b[^>]*>/gi, '').trim();
|
|
322
|
+
}
|
|
323
|
+
groupSteps(data) {
|
|
324
|
+
const groups = new Map();
|
|
325
|
+
for (const ev of data.events) {
|
|
326
|
+
const s = ev.stepNumber;
|
|
327
|
+
if (s == null || s <= 0)
|
|
328
|
+
continue;
|
|
329
|
+
if (!groups.has(s)) {
|
|
330
|
+
groups.set(s, {
|
|
331
|
+
step: s, thinking: '', reasoning: '', toolCall: null, toolCallArgs: null,
|
|
332
|
+
observationScreenshot: null, beforeScreenshot: null, afterScreenshot: null,
|
|
333
|
+
toolResult: '', toolStartTime: '', toolEndTime: '',
|
|
334
|
+
stepStartTime: '', stepEndTime: '', clickPoint: null, swipeStart: null, swipeEnd: null,
|
|
335
|
+
action: null, subSteps: [], hasSubAgent: false,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
const g = groups.get(s);
|
|
339
|
+
const d = ev.data;
|
|
340
|
+
const sr = this.toRelativePath(ev.screenshotPath);
|
|
341
|
+
if (ev.eventType === 'llm_response' || ev.eventType === 'planner_thinking' || ev.eventType === 'planner_output') {
|
|
342
|
+
const reasoning = d?.reasoning ?? '';
|
|
343
|
+
if (reasoning)
|
|
344
|
+
g.reasoning = reasoning;
|
|
345
|
+
const thinking = d?.thinking ?? '';
|
|
346
|
+
const judgment = d?.judgment ?? '';
|
|
347
|
+
const raw = d?.text ?? ev.content ?? '';
|
|
348
|
+
const chosen = thinking || judgment || raw;
|
|
349
|
+
if (chosen)
|
|
350
|
+
g.thinking = this.stripTagMarkers(chosen);
|
|
351
|
+
}
|
|
352
|
+
else if (ev.eventType === 'screenshot' || ev.eventType === 'planner_observation') {
|
|
353
|
+
const phase = d?.phase ?? 'observation';
|
|
354
|
+
if (phase === 'after' && sr)
|
|
355
|
+
g.afterScreenshot = sr;
|
|
356
|
+
else if (phase === 'before' && sr)
|
|
357
|
+
g.beforeScreenshot = sr;
|
|
358
|
+
else if (!g.observationScreenshot && sr)
|
|
359
|
+
g.observationScreenshot = sr;
|
|
360
|
+
}
|
|
361
|
+
else if (ev.eventType === 'planner_tool_call') {
|
|
362
|
+
const tn = d?.tool_name ?? d?.toolName ?? '';
|
|
363
|
+
const rawArgs = d?.arguments ?? d?.args;
|
|
364
|
+
g.toolCall = { name: tn, args: rawArgs ? JSON.stringify(rawArgs, null, 2) : (ev.content ?? '') };
|
|
365
|
+
g.toolCallArgs = (rawArgs && typeof rawArgs === 'object') ? rawArgs : null;
|
|
366
|
+
}
|
|
367
|
+
else if (ev.eventType === 'mcp_tool_start') {
|
|
368
|
+
g.toolStartTime = ev.timestamp;
|
|
369
|
+
if (sr)
|
|
370
|
+
g.beforeScreenshot = sr;
|
|
371
|
+
const dd = d;
|
|
372
|
+
if (dd) {
|
|
373
|
+
const args = (dd.args ?? dd.arguments ?? {});
|
|
374
|
+
const toolName = dd.action ?? dd.tool_name ?? '';
|
|
375
|
+
if (toolName)
|
|
376
|
+
g.action = toolName;
|
|
377
|
+
if (toolName === 'run_subagent' || toolName === 'run_subagent_tool') {
|
|
378
|
+
g.hasSubAgent = true;
|
|
379
|
+
}
|
|
380
|
+
const point = this.asPoint2(dd.point) ?? this.asPoint2(args.pos) ?? this.asPointFromXY(args.x, args.y);
|
|
381
|
+
const start = this.asPoint2(dd.start) ?? this.asPoint2(args.start) ?? this.asPointFromXY(args.start_x, args.start_y);
|
|
382
|
+
const end = this.asPoint2(dd.end) ?? this.asPoint2(args.end) ?? this.asPointFromXY(args.end_x, args.end_y);
|
|
383
|
+
if (point)
|
|
384
|
+
g.clickPoint = point;
|
|
385
|
+
if (start)
|
|
386
|
+
g.swipeStart = start;
|
|
387
|
+
if (end)
|
|
388
|
+
g.swipeEnd = end;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
else if (ev.eventType === 'mcp_tool_end') {
|
|
392
|
+
g.toolEndTime = ev.timestamp;
|
|
393
|
+
if (sr)
|
|
394
|
+
g.afterScreenshot = sr;
|
|
395
|
+
g.toolResult = d?.result ?? ev.content ?? '';
|
|
396
|
+
}
|
|
397
|
+
else if (ev.eventType === 'step_start') {
|
|
398
|
+
g.stepStartTime = ev.timestamp;
|
|
399
|
+
}
|
|
400
|
+
else if (ev.eventType === 'step_end') {
|
|
401
|
+
g.stepEndTime = ev.timestamp;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return Array.from(groups.values()).sort((a, b) => a.step - b.step);
|
|
405
|
+
}
|
|
406
|
+
getStepTokens(data, step) {
|
|
407
|
+
let input = 0, output = 0, cached = 0, reasoning = 0, total = 0, normalized = 0;
|
|
408
|
+
for (const st of data.step_tokens) {
|
|
409
|
+
if (st.stepNumber === step || st.step === step) {
|
|
410
|
+
input += (st.inputTokens ?? st.input_tokens ?? 0);
|
|
411
|
+
output += (st.outputTokens ?? st.output_tokens ?? 0);
|
|
412
|
+
cached += (st.cachedTokens ?? st.cached_tokens ?? 0);
|
|
413
|
+
reasoning += (st.reasoningTokens ?? st.reasoning_tokens ?? 0);
|
|
414
|
+
total += (st.totalTokens ?? st.total_tokens ?? 0);
|
|
415
|
+
normalized += (st.normalizedTokens ?? st.normalized_tokens ?? 0);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return { input, output, cached, reasoning, total, normalized };
|
|
419
|
+
}
|
|
420
|
+
getFinalStatus(data) {
|
|
421
|
+
const r = { status: 'UNKNOWN', result: '', judgment: '', screenshot: '' };
|
|
422
|
+
for (const ev of data.events) {
|
|
423
|
+
if (ev.eventType === 'task_end') {
|
|
424
|
+
const d = ev.data;
|
|
425
|
+
const rawStatus = d?.status ?? '';
|
|
426
|
+
const rawResult = d?.result ?? ev.content ?? '';
|
|
427
|
+
// Strategy A: explicit status
|
|
428
|
+
if (['pass', 'completed', 'success'].includes(rawStatus.toLowerCase()))
|
|
429
|
+
r.status = 'PASS';
|
|
430
|
+
else if (['fail', 'failed', 'error', 'stopped'].includes(rawStatus.toLowerCase()))
|
|
431
|
+
r.status = 'FAIL';
|
|
432
|
+
else if (rawStatus)
|
|
433
|
+
r.status = rawStatus.toUpperCase();
|
|
434
|
+
r.result = rawResult;
|
|
435
|
+
// Strategy B: Chinese keyword matching
|
|
436
|
+
const m = rawResult.match(/结果\s*[::]\s*(不?通过)/);
|
|
437
|
+
if (m)
|
|
438
|
+
r.status = m[1] === '通过' ? 'PASS' : 'FAIL';
|
|
439
|
+
// Strategy C: error pattern
|
|
440
|
+
if (rawResult.startsWith('Error:') || rawResult.startsWith('任务执行失败') || rawResult.includes('超过最大步数'))
|
|
441
|
+
r.status = 'FAIL';
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
const steps = this.groupSteps(data);
|
|
445
|
+
const last = steps[steps.length - 1];
|
|
446
|
+
if (last) {
|
|
447
|
+
r.judgment = last.thinking || last.reasoning;
|
|
448
|
+
r.screenshot = last.afterScreenshot || last.observationScreenshot || '';
|
|
449
|
+
}
|
|
450
|
+
return r;
|
|
451
|
+
}
|
|
452
|
+
generateMarkdown(data) {
|
|
453
|
+
const lines = [];
|
|
454
|
+
lines.push('# 执行报告', '');
|
|
455
|
+
lines.push('## 任务信息', '');
|
|
456
|
+
lines.push(`- **测试用例**: ${data.test_case || 'N/A'}`);
|
|
457
|
+
lines.push(`- **任务描述**: ${data.task || 'N/A'}`);
|
|
458
|
+
lines.push(`- **开始时间**: ${data.start_time ?? 'N/A'}`);
|
|
459
|
+
lines.push(`- **结束时间**: ${data.end_time ?? 'N/A'}`);
|
|
460
|
+
lines.push(`- **耗时**: ${this.formatDuration(data.start_time, data.end_time)}`, '');
|
|
461
|
+
lines.push('### Token 消耗', '');
|
|
462
|
+
lines.push(`- **总 Token**: ${this.formatTokenCount(data.total_tokens.total)}`);
|
|
463
|
+
lines.push(`- **输入**: ${data.total_tokens.inputTokens}`);
|
|
464
|
+
lines.push(`- **输出**: ${data.total_tokens.outputTokens}`);
|
|
465
|
+
lines.push(`- **推理**: ${data.total_tokens.reasoningTokens}`);
|
|
466
|
+
lines.push(`- **缓存**: ${data.total_tokens.cachedTokens}`);
|
|
467
|
+
const sk = Object.keys(data.total_tokens.sources);
|
|
468
|
+
if (sk.length > 0)
|
|
469
|
+
lines.push(`- **来源**: ${sk.map(s => `${s}: ${data.total_tokens.sources[s].total}`).join(' | ')}`);
|
|
470
|
+
lines.push(`- **总事件数**: ${data.events.length}`, '');
|
|
471
|
+
const steps = this.groupSteps(data);
|
|
472
|
+
if (steps.length > 0) {
|
|
473
|
+
lines.push('## 执行时间线', '');
|
|
474
|
+
const fr = this.getFinalStatus(data);
|
|
475
|
+
lines.push(`**最终结果**: ${fr.status} ${fr.result ? '— ' + fr.result : ''}`, '');
|
|
476
|
+
for (const g of steps) {
|
|
477
|
+
const t = this.getStepTokens(data, g.step);
|
|
478
|
+
const title = this.extractStepTitle(g);
|
|
479
|
+
lines.push(`### Step ${g.step}: ${title}`, '');
|
|
480
|
+
lines.push(`- **时间**: ${g.stepStartTime ? this.formatTime(g.stepStartTime) : 'N/A'} ~ ${g.stepEndTime ? this.formatTime(g.stepEndTime) : 'N/A'}`);
|
|
481
|
+
lines.push(`- **Token**: 输入 ${t.input} | 输出 ${t.output} | 缓存 ${t.cached} | 推理 ${t.reasoning} | 归一化 ${t.normalized}`, '');
|
|
482
|
+
if (g.reasoning) {
|
|
483
|
+
lines.push('#### 💭 思考过程', '', g.reasoning, '');
|
|
484
|
+
}
|
|
485
|
+
if (g.thinking && g.thinking !== g.reasoning) {
|
|
486
|
+
lines.push('#### 📌 模型输出', '', g.thinking, '');
|
|
487
|
+
}
|
|
488
|
+
if (g.toolCall) {
|
|
489
|
+
lines.push('#### 🔧 工具调用', '', `**工具**: ${g.toolCall.name}`, '', '```json', g.toolCall.args, '```', '');
|
|
490
|
+
}
|
|
491
|
+
const ss = [{ l: '观察', p: g.observationScreenshot }, { l: '操作前', p: g.beforeScreenshot }, { l: '操作后', p: g.afterScreenshot }].filter(s => s.p);
|
|
492
|
+
if (ss.length > 0) {
|
|
493
|
+
lines.push('#### 📸 截图', '');
|
|
494
|
+
for (const s of ss) {
|
|
495
|
+
lines.push(`**${s.l}**:`, '', `<img src="${s.p}" width="300" />`, '');
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (g.toolResult) {
|
|
499
|
+
lines.push('#### ⚙️ 执行结果', '', '```json', g.toolResult, '```', '');
|
|
500
|
+
}
|
|
501
|
+
lines.push('---', '');
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return lines.join('\n');
|
|
505
|
+
}
|
|
506
|
+
async generateHtml(data) {
|
|
507
|
+
const steps = this.groupSteps(data);
|
|
508
|
+
const fr = this.getFinalStatus(data);
|
|
509
|
+
const sc = fr.status === 'PASS' ? 'pass' : fr.status === 'FAIL' ? 'fail' : '';
|
|
510
|
+
const dur = this.formatDuration(data.start_time, data.end_time);
|
|
511
|
+
const tn = this.formatTokenCount(data.total_tokens.total);
|
|
512
|
+
// Pre-resolve screenshot paths to base64 if embedImages is enabled
|
|
513
|
+
const allPaths = new Set();
|
|
514
|
+
for (const g of steps) {
|
|
515
|
+
if (g.observationScreenshot)
|
|
516
|
+
allPaths.add(g.observationScreenshot);
|
|
517
|
+
if (g.beforeScreenshot)
|
|
518
|
+
allPaths.add(g.beforeScreenshot);
|
|
519
|
+
if (g.afterScreenshot)
|
|
520
|
+
allPaths.add(g.afterScreenshot);
|
|
521
|
+
}
|
|
522
|
+
if (fr.screenshot)
|
|
523
|
+
allPaths.add(fr.screenshot);
|
|
524
|
+
const imgSrcMap = new Map();
|
|
525
|
+
if (this.embedImages) {
|
|
526
|
+
await Promise.all(Array.from(allPaths).map(async (p) => {
|
|
527
|
+
const embedded = await this.resolveImgSrc(p);
|
|
528
|
+
imgSrcMap.set(p, embedded);
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
const resolveSrc = (p) => {
|
|
532
|
+
if (!p)
|
|
533
|
+
return '';
|
|
534
|
+
return imgSrcMap.get(p) ?? p;
|
|
535
|
+
};
|
|
536
|
+
const navItems = steps.map((g, i) => {
|
|
537
|
+
const title = this.extractStepTitle(g);
|
|
538
|
+
return `<div class="nav-item" title="${this.escapeHtml(title)}" onclick="scrollToStep(${i})">${i + 1}. ${this.escapeHtml(title)}</div>`;
|
|
539
|
+
}).join('\n');
|
|
540
|
+
const stepCards = steps.map((g, idx) => {
|
|
541
|
+
const t = this.getStepTokens(data, g.step);
|
|
542
|
+
const tb = t.total > 0 ? `<span class="step-token-badge" title="输入: ${t.input} | 输出: ${t.output} | 缓存: ${t.cached} | 推理: ${t.reasoning}">${this.formatTokenCount(t.total)}</span>` : '';
|
|
543
|
+
const tr = g.stepStartTime ? `${this.formatTime(g.stepStartTime)} ~ ${g.stepEndTime ? this.formatTime(g.stepEndTime) : 'N/A'}` : '';
|
|
544
|
+
const tb2 = (g.reasoning || g.thinking) ? `<div class="thinking"><div class="thinking-label">思考过程</div><div class="thinking-text">${this.escapeHtml(g.reasoning || g.thinking)}</div></div>` : '';
|
|
545
|
+
const tcb = g.toolCall ? `<div class="event planner"><div class="event-head"><span class="event-type">TOOL: ${this.escapeHtml(g.toolCall.name)}</span><span class="event-time">${this.formatTime(g.stepStartTime)}</span></div><div class="event-content">${this.escapeHtml(g.toolCall.args)}</div></div>` : '';
|
|
546
|
+
const ss = [
|
|
547
|
+
{ label: '操作前', path: g.beforeScreenshot ? resolveSrc(g.beforeScreenshot) : '' }, { label: '操作', path: g.observationScreenshot ? resolveSrc(g.observationScreenshot) : '' }, { label: '操作后', path: g.afterScreenshot ? resolveSrc(g.afterScreenshot) : '' },
|
|
548
|
+
].filter((s) => !!s.path);
|
|
549
|
+
const mk = (s) => {
|
|
550
|
+
if (s.label !== '操作')
|
|
551
|
+
return '';
|
|
552
|
+
const isDoubleTap = g.action && ['double_click', 'double_tap', 'doubleclick'].includes(g.action);
|
|
553
|
+
const isLongPress = g.action && ['long_press', 'long_click', 'longpress'].includes(g.action);
|
|
554
|
+
if (g.clickPoint) {
|
|
555
|
+
const [cx, cy] = g.clickPoint;
|
|
556
|
+
if (isDoubleTap) {
|
|
557
|
+
return `<div class="double-tap-marker" style="left:${cx / 10}%;top:${cy / 10}%" title="双击: ${cx},${cy}"></div>`;
|
|
558
|
+
}
|
|
559
|
+
if (isLongPress) {
|
|
560
|
+
return `<div class="long-press-marker" style="left:${cx / 10}%;top:${cy / 10}%" title="长按: ${cx},${cy}"></div>`;
|
|
561
|
+
}
|
|
562
|
+
return `<div class="marker marker-click" style="left:${cx / 10}%;top:${cy / 10}%" title="点击: ${cx},${cy}"><span class="marker-ring"></span><span class="marker-dot"></span></div>`;
|
|
563
|
+
}
|
|
564
|
+
if (g.swipeStart && g.swipeEnd) {
|
|
565
|
+
const [sx, sy] = g.swipeStart;
|
|
566
|
+
const [ex, ey] = g.swipeEnd;
|
|
567
|
+
const aid = `arrow-${g.step}`;
|
|
568
|
+
return `<div class="marker marker-swipe-start" style="left:${sx / 10}%;top:${sy / 10}%" title="起点 ${sx},${sy}"><span class="swipe-label swipe-label-start">起</span></div><div class="marker marker-swipe-end" style="left:${ex / 10}%;top:${ey / 10}%" title="终点 ${ex},${ey}"><span class="swipe-label swipe-label-end">终</span></div><svg class="swipe-line-svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><marker id="${aid}" markerWidth="4" markerHeight="4" refX="3" refY="2" orient="auto"><path d="M0,0 L4,2 L0,4 Z" fill="#10b981"></path></marker></defs><line x1="${sx / 10}" y1="${sy / 10}" x2="${ex / 10}" y2="${ey / 10}" stroke="#10b981" stroke-width="0.8" marker-end="url(#${aid})"></line></svg>`;
|
|
569
|
+
}
|
|
570
|
+
return '';
|
|
571
|
+
};
|
|
572
|
+
const ssHtml = ss.length > 0 ? `<div class="screenshots">${ss.map(s => `<div class="screenshot"><div class="screenshot-label">${s.label}</div><div style="position:relative"><img class="screenshot-img" src="${s.path}" alt="Screenshot" loading="lazy" onclick="openFullscreen('${s.path}')">${mk(s)}</div></div>`).join('')}</div>` : '';
|
|
573
|
+
const rb = g.toolResult ? `<div class="section"><div class="section-title result">执行结果</div><div class="event mcp"><div class="event-head"><span class="event-type">状态: 完成</span><span class="event-time">${this.formatTime(g.toolEndTime)}</span></div><div class="event-data">${this.escapeHtml(g.toolResult)}</div></div></div>` : '';
|
|
574
|
+
const subAgentHtml = g.hasSubAgent && g.subSteps.length > 0
|
|
575
|
+
? `<div class="subagent-section"><div class="subagent-toggle" onclick="this.parentElement.classList.toggle('subagent-expanded')"><span class="subagent-icon">▼</span> 子 Agent 执行 (${g.subSteps.length} 步)</div><div class="subagent-body">${g.subSteps.map((ssg) => {
|
|
576
|
+
const ssTitle = this.escapeHtml(this.extractStepTitle(ssg));
|
|
577
|
+
const ssTime = ssg.stepStartTime ? this.formatTime(ssg.stepStartTime) : '';
|
|
578
|
+
const ssScreenshots = [{ l: '操作前', p: ssg.beforeScreenshot }, { l: '观察', p: ssg.observationScreenshot }, { l: '操作后', p: ssg.afterScreenshot }].filter(s => s.p);
|
|
579
|
+
const ssHtml2 = ssScreenshots.length > 0 ? `<div class="screenshots">${ssScreenshots.map(s => `<div class="screenshot"><div class="screenshot-label">${s.l}</div><img class="screenshot-img" src="${resolveSrc(s.p)}" loading="lazy" style="max-width:200px"></div>`).join('')}</div>` : '';
|
|
580
|
+
const ssResult = ssg.toolResult ? `<div class="event-data" style="font-size:12px">${this.escapeHtml(ssg.toolResult.slice(0, 200))}</div>` : '';
|
|
581
|
+
return `<div class="substep-card"><div class="substep-header"><span class="substep-num">子步 ${ssg.step}</span><span class="substep-name">${ssTitle}</span><span class="substep-time">${ssTime}</span></div>${ssHtml2}${ssResult}</div>`;
|
|
582
|
+
}).join('')}</div></div>`
|
|
583
|
+
: '';
|
|
584
|
+
const isLast = idx === steps.length - 1;
|
|
585
|
+
const hc = isLast && (fr.status === 'PASS' || fr.status === 'FAIL') ? (fr.status === 'PASS' ? 'end' : 'fail') : '';
|
|
586
|
+
const title = this.extractStepTitle(g);
|
|
587
|
+
return `<div class="step-card" id="step-${idx + 1}">
|
|
588
|
+
<div class="step-header ${hc}"><span class="step-num">${g.step}</span><span class="step-name">${this.escapeHtml(title)}</span>${tb}<span class="step-time">${tr}</span></div>
|
|
589
|
+
<div class="step-body"><div class="step-grid"><div class="section"><div class="section-title">Planner 规划</div>${tb2}</div><div class="section"><div class="section-title model">模型执行</div>${tcb}</div></div>${ssHtml || rb || subAgentHtml ? `<div class="step-bottom">${ssHtml}${rb}${subAgentHtml}</div>` : ''}</div>
|
|
590
|
+
</div>`;
|
|
591
|
+
}).join('\n');
|
|
592
|
+
const frScr = fr.screenshot ? resolveSrc(fr.screenshot) : '';
|
|
593
|
+
const jsc = frScr ? `<div class="judgment-card-right"><div class="judgment-screenshot"><div class="judgment-screenshot-label">判定观察</div><img class="judgment-screenshot-img" src="${frScr}" alt="Screenshot" loading="lazy" onclick="openFullscreen('${frScr}')"></div></div>` : '';
|
|
594
|
+
return `<!DOCTYPE html>
|
|
595
|
+
<html lang="zh-CN">
|
|
596
|
+
<head>
|
|
597
|
+
<meta charset="UTF-8">
|
|
598
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
599
|
+
<title>测试报告 - ${this.escapeHtml(data.test_case)}</title>
|
|
600
|
+
<style>
|
|
601
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
602
|
+
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;background:#f8fafc;color:#1e293b;line-height:1.6}
|
|
603
|
+
.sidebar{width:260px;background:#fff;height:100vh;position:fixed;left:0;top:0;overflow-y:auto;border-right:1px solid #e2e8f0;padding:20px}
|
|
604
|
+
.sidebar-title{font-size:16px;font-weight:700;color:#0f172a;padding-bottom:16px;border-bottom:2px solid #3b82f6;margin-bottom:20px}
|
|
605
|
+
.metrics{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:20px}
|
|
606
|
+
.metric{padding:16px;border-radius:12px;background:linear-gradient(135deg,#3b82f6,#2563eb);color:#fff;overflow:hidden}
|
|
607
|
+
.metric.pass{background:linear-gradient(135deg,#22c55e,#16a34a)}
|
|
608
|
+
.metric.fail{background:linear-gradient(135deg,#ef4444,#dc2626)}
|
|
609
|
+
.metric-label{font-size:12px;opacity:.9}
|
|
610
|
+
.metric-value{font-size:18px;font-weight:700;margin-top:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
611
|
+
.nav-title{font-size:12px;color:#64748b;margin-bottom:12px;font-weight:600}
|
|
612
|
+
.nav-item{padding:10px 12px;margin-bottom:4px;border-radius:8px;cursor:pointer;font-size:14px;color:#475569;background:#f1f5f9;transition:background .15s;overflow:hidden;text-overflow:ellipsis;position:relative}
|
|
613
|
+
.nav-item:hover{background:#e2e8f0}
|
|
614
|
+
.nav-item.active{background:#3b82f6;color:#fff}
|
|
615
|
+
.main{margin-left:260px;padding:30px;min-height:100vh}
|
|
616
|
+
.header{margin-bottom:30px}
|
|
617
|
+
.title{font-size:24px;font-weight:700;color:#0f172a;margin-bottom:8px}
|
|
618
|
+
.subtitle{font-size:14px;color:#64748b}
|
|
619
|
+
.step-card{background:#fff;border-radius:16px;margin-bottom:20px;border:1px solid #e2e8f0;overflow:hidden}
|
|
620
|
+
.step-header{padding:16px 24px;background:linear-gradient(135deg,#3b82f6,#2563eb);color:#fff;display:flex;align-items:center}
|
|
621
|
+
.step-header.end{background:linear-gradient(135deg,#22c55e,#16a34a)}
|
|
622
|
+
.step-header.fail{background:linear-gradient(135deg,#ef4444,#dc2626)}
|
|
623
|
+
.step-num{width:32px;height:32px;line-height:32px;text-align:center;background:rgba(255,255,255,.2);border-radius:8px;font-weight:700;margin-right:12px}
|
|
624
|
+
.step-name{font-size:16px;font-weight:600;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
625
|
+
.step-time{font-size:12px;opacity:.8;margin-left:12px}
|
|
626
|
+
.step-body{padding:20px 24px}
|
|
627
|
+
.step-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}
|
|
628
|
+
.step-bottom{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:16px;padding-top:16px;border-top:1px solid #e2e8f0}
|
|
629
|
+
.section-title{font-size:13px;font-weight:700;color:#0f172a;margin-bottom:12px;padding-left:12px;border-left:3px solid #3b82f6}
|
|
630
|
+
.section-title.model{border-left-color:#f59e0b}
|
|
631
|
+
.section-title.result{border-left-color:#22c55e}
|
|
632
|
+
.event{padding:14px 18px;margin-bottom:12px;background:#f8fafc;border-radius:10px;border-left:3px solid #cbd5e1}
|
|
633
|
+
.event.planner{border-left-color:#3b82f6;background:#eff6ff}
|
|
634
|
+
.event.mcp{border-left-color:#f59e0b;background:#fffbeb}
|
|
635
|
+
.event-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
|
|
636
|
+
.event-type{font-size:11px;font-weight:600;color:#64748b;background:#e2e8f0;padding:2px 8px;border-radius:4px}
|
|
637
|
+
.event-time{font-size:11px;color:#94a3b8}
|
|
638
|
+
.event-content{font-size:14px;color:#334155;white-space:pre-wrap;word-break:break-word}
|
|
639
|
+
.event-data{margin-top:12px;padding:12px;background:#1e293b;color:#e2e8f0;border-radius:8px;font-size:12px;font-family:Consolas,Monaco,monospace;overflow-x:auto;white-space:pre-wrap;word-break:break-word}
|
|
640
|
+
.thinking{padding:16px;background:#eff6ff;border-radius:10px;border:1px solid #bfdbfe;margin-bottom:12px}
|
|
641
|
+
.thinking-label{font-size:12px;font-weight:700;color:#3b82f6;margin-bottom:8px}
|
|
642
|
+
.thinking-text{font-size:14px;color:#334155;white-space:pre-wrap;word-break:break-word;overflow-y:auto;max-height:50vh}
|
|
643
|
+
.screenshots{display:flex;gap:12px;flex-wrap:nowrap}
|
|
644
|
+
.screenshot{border:1px solid #e2e8f0;border-radius:8px;overflow:hidden;background:#fff;flex:1 1 0%;min-width:0;max-width:260px}
|
|
645
|
+
.screenshot-label{padding:6px 10px;background:#f1f5f9;font-size:11px;font-weight:600;color:#475569}
|
|
646
|
+
.screenshot-img{width:100%;max-width:260px;display:block;cursor:pointer}
|
|
647
|
+
.marker{position:absolute;transform:translate(-50%,-50%);pointer-events:none;z-index:2}
|
|
648
|
+
.marker-click{width:24px;height:24px}
|
|
649
|
+
.marker-ring{position:absolute;inset:0;border-radius:50%;border:3px solid #ef4444;animation:marker-pulse 1.8s ease-in-out infinite}
|
|
650
|
+
.marker-dot{position:absolute;top:50%;left:50%;width:10px;height:10px;border-radius:50%;background:#ef4444;transform:translate(-50%,-50%);box-shadow:0 0 8px rgba(239,68,68,.6)}
|
|
651
|
+
@keyframes marker-pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.6);opacity:.4}}
|
|
652
|
+
.marker-swipe-start,.marker-swipe-end{width:24px;height:24px}
|
|
653
|
+
.swipe-label{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;font-size:12px;font-weight:700;color:#fff;box-shadow:0 2px 8px rgba(0,0,0,.35)}
|
|
654
|
+
.swipe-label-start{background:#10b981}
|
|
655
|
+
.swipe-label-end{background:#f59e0b}
|
|
656
|
+
.swipe-line-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1}
|
|
657
|
+
.double-tap-marker{position:absolute;width:24px;height:24px;background:rgba(33,150,243,.6);border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;box-shadow:0 0 0 4px rgba(33,150,243,.3)}
|
|
658
|
+
.long-press-marker{position:absolute;width:30px;height:30px;background:rgba(156,39,176,.6);border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;box-shadow:0 0 10px rgba(156,39,176,.5)}
|
|
659
|
+
.subagent-section{margin-top:12px;border:1px solid #a855f7;border-radius:8px;overflow:hidden}
|
|
660
|
+
.subagent-toggle{padding:8px 12px;background:#faf5ff;color:#7c3aed;font-size:13px;font-weight:600;cursor:pointer;user-select:none;display:flex;align-items:center;gap:6px}
|
|
661
|
+
.subagent-icon{font-size:10px;transition:transform .2s}
|
|
662
|
+
.subagent-section.subagent-expanded .subagent-icon{transform:rotate(180deg)}
|
|
663
|
+
.subagent-body{display:none;padding:12px;background:#faf5ff}
|
|
664
|
+
.subagent-section.subagent-expanded .subagent-body{display:block}
|
|
665
|
+
.substep-card{background:#fff;border:1px solid #e9d5ff;border-radius:6px;padding:10px;margin-bottom:8px}
|
|
666
|
+
.substep-header{display:flex;align-items:center;gap:8px;margin-bottom:8px}
|
|
667
|
+
.substep-num{font-size:11px;font-weight:700;color:#7c3aed;background:#f3e8ff;padding:2px 8px;border-radius:4px}
|
|
668
|
+
.substep-name{font-size:13px;color:#475569;flex:1}
|
|
669
|
+
.substep-time{font-size:11px;color:#94a3b8}
|
|
670
|
+
.status-badge{display:inline-block;padding:10px 24px;border-radius:12px;font-size:16px;font-weight:700;color:#fff}
|
|
671
|
+
.status-pass{background:#22c55e}.status-fail{background:#ef4444}.status-unknown{background:#64748b}
|
|
672
|
+
.step-token-badge{display:inline-block;padding:2px 10px;background:rgba(255,255,255,.2);border-radius:10px;font-size:12px;font-weight:600;margin-left:8px}
|
|
673
|
+
.top-cards-row{display:grid;grid-template-columns:4fr 6fr;gap:20px;margin-bottom:20px}
|
|
674
|
+
.detail-card{background:#fff;border-radius:16px;padding:24px;border:1px solid #e2e8f0;max-height:50vh;display:flex;flex-direction:column}
|
|
675
|
+
.detail-card-title{font-size:16px;font-weight:700;color:#0f172a;margin-bottom:16px;padding-bottom:12px;border-bottom:2px solid #3b82f6;flex-shrink:0}
|
|
676
|
+
.detail-card-body{overflow:auto;flex:1;min-height:0}
|
|
677
|
+
.detail-card-task-content{font-size:14px;color:#334155;white-space:pre-wrap;word-break:break-word;background:#f8fafc;padding:16px;border-radius:8px}
|
|
678
|
+
.judgment-card{background:#fff;border-radius:16px;padding:24px;border:1px solid #e2e8f0;max-height:50vh;display:flex;flex-direction:column}
|
|
679
|
+
.judgment-card-title{font-size:16px;font-weight:700;color:#0f172a;margin-bottom:16px;padding-bottom:12px;border-bottom:2px solid #22c55e;flex-shrink:0}
|
|
680
|
+
.judgment-card-body{overflow-y:auto;flex:1;min-height:0;display:flex;gap:16px}
|
|
681
|
+
.judgment-content{font-size:14px;color:#334155;white-space:pre-wrap;word-break:break-word;background:#f8fafc;padding:16px;border-radius:8px}
|
|
682
|
+
.judgment-card-left{flex:1;min-width:0}
|
|
683
|
+
.judgment-card-right{flex-shrink:0;display:flex;flex-direction:column;gap:8px;align-items:center}
|
|
684
|
+
.judgment-screenshot{border-radius:8px;overflow:hidden;border:1px solid #e2e8f0;cursor:pointer;position:relative}
|
|
685
|
+
.judgment-screenshot-img{width:100%;max-width:180px;display:block;cursor:pointer}
|
|
686
|
+
.judgment-screenshot-label{padding:4px 8px;background:#f1f5f9;font-size:10px;font-weight:600;color:#475569;text-align:center}
|
|
687
|
+
.end-box{padding:40px;background:#f0fdf4;border-radius:16px;border:2px solid #22c55e;text-align:center;margin-bottom:20px}
|
|
688
|
+
.end-box.fail{background:#fef2f2;border-color:#ef4444}
|
|
689
|
+
.floating-detail{position:fixed;top:16px;right:16px;z-index:100;background:#fff;border-radius:12px;border:2px solid #3b82f6;padding:16px;display:none;flex-direction:column;gap:12px;max-width:25vw;max-height:35vh;overflow-y:auto;box-shadow:0 4px 16px rgba(0,0,0,.15);transition:opacity .2s}
|
|
690
|
+
.floating-detail-header{display:flex;align-items:center;gap:10px;cursor:pointer}
|
|
691
|
+
.floating-detail-title{font-size:14px;font-weight:700;color:#0f172a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
692
|
+
.floating-detail-desc{font-size:13px;color:#64748b;overflow-y:auto;word-break:break-word;cursor:pointer;max-height:calc(35vh - 52px)}
|
|
693
|
+
.floating-detail-close{width:24px;height:24px;line-height:24px;text-align:center;background:#e2e8f0;border-radius:6px;cursor:pointer;font-size:14px;color:#475569;flex-shrink:0;margin-left:auto}
|
|
694
|
+
.floating-detail-close:hover{background:#cbd5e1;color:#0f172a}
|
|
695
|
+
</style>
|
|
696
|
+
</head>
|
|
697
|
+
<body>
|
|
698
|
+
<div class="sidebar">
|
|
699
|
+
<div class="sidebar-title">测试报告</div>
|
|
700
|
+
<div class="metrics">
|
|
701
|
+
<div class="metric ${sc}"><div class="metric-label">状态</div><div class="metric-value">${fr.status}</div></div>
|
|
702
|
+
<div class="metric"><div class="metric-label">耗时</div><div class="metric-value">${dur}</div></div>
|
|
703
|
+
<div class="metric"><div class="metric-label">步骤</div><div class="metric-value">${steps.length}</div></div>
|
|
704
|
+
<div class="metric"><div class="metric-label">Token</div><div class="metric-value" title="输入: ${data.total_tokens.inputTokens} | 输出: ${data.total_tokens.outputTokens} | 推理: ${data.total_tokens.reasoningTokens} | 缓存: ${data.total_tokens.cachedTokens}">${tn}</div></div>
|
|
705
|
+
</div>
|
|
706
|
+
<div class="nav-title">导航</div>
|
|
707
|
+
<div class="nav-item" onclick="scrollToDetail()" id="nav-detail">任务描述</div>
|
|
708
|
+
${navItems}
|
|
709
|
+
</div>
|
|
710
|
+
<div class="main">
|
|
711
|
+
<div class="header">
|
|
712
|
+
<div class="title">${this.escapeHtml(data.test_case)}</div>
|
|
713
|
+
<div class="subtitle">自动化测试执行报告</div>
|
|
714
|
+
</div>
|
|
715
|
+
<div id="floating-detail" class="floating-detail">
|
|
716
|
+
<div class="floating-detail-header" onclick="scrollToDetail()">
|
|
717
|
+
<span class="floating-detail-title">任务描述</span>
|
|
718
|
+
<div class="floating-detail-close" onclick="closeFloatingDetail(event)" title="关闭">✕</div>
|
|
719
|
+
</div>
|
|
720
|
+
<div class="floating-detail-desc" onclick="scrollToDetail()">${this.escapeHtml(data.task)}</div>
|
|
721
|
+
</div>
|
|
722
|
+
<div class="top-cards-row">
|
|
723
|
+
<div class="detail-card" id="task-detail">
|
|
724
|
+
<div class="detail-card-title">任务描述</div>
|
|
725
|
+
<div class="detail-card-body"><div class="detail-card-task-content">${this.escapeHtml(data.task)}</div></div>
|
|
726
|
+
</div>
|
|
727
|
+
<div class="judgment-card">
|
|
728
|
+
<div class="judgment-card-title">结果判定详情 <span class="status-badge status-${sc || 'unknown'}" style="font-size:12px;padding:3px 10px;margin-left:8px">${fr.status}</span></div>
|
|
729
|
+
<div class="judgment-card-body">
|
|
730
|
+
<div class="judgment-card-left"><div class="judgment-content">${this.escapeHtml(fr.judgment || fr.result || '暂无判定内容')}</div></div>
|
|
731
|
+
${jsc}
|
|
732
|
+
</div>
|
|
733
|
+
</div>
|
|
734
|
+
</div>
|
|
735
|
+
${stepCards}
|
|
736
|
+
<div class="end-box ${fr.status === 'FAIL' ? 'fail' : ''}">
|
|
737
|
+
<div style="font-size:20px;font-weight:700;color:${fr.status === 'PASS' ? '#22c55e' : fr.status === 'FAIL' ? '#ef4444' : '#64748b'}">${fr.status} ${fr.result ? '— ' + this.escapeHtml(fr.result) : ''}</div>
|
|
738
|
+
</div>
|
|
739
|
+
</div>
|
|
740
|
+
<script>
|
|
741
|
+
var cards=document.querySelectorAll('.step-card');
|
|
742
|
+
var navs=document.querySelectorAll('.nav-item');
|
|
743
|
+
var navDetail=document.getElementById('nav-detail');
|
|
744
|
+
var taskDetail=document.getElementById('task-detail');
|
|
745
|
+
var floatingDetail=document.getElementById('floating-detail');
|
|
746
|
+
var floatingClosed=false;
|
|
747
|
+
function closeFloatingDetail(e){if(e)e.stopPropagation();floatingClosed=true;if(floatingDetail)floatingDetail.style.display='none'}
|
|
748
|
+
function scrollToDetail(){if(taskDetail){taskDetail.scrollIntoView({behavior:'smooth',block:'start'});clearNavActive();if(navDetail)navDetail.classList.add('active')}}
|
|
749
|
+
function scrollToStep(n){if(cards[n]){cards[n].scrollIntoView({behavior:'smooth',block:'start'});cards[n].style.boxShadow='0 0 0 2px #3b82f6';setTimeout(function(){cards[n].style.boxShadow=''},1500)}clearNavActive();var ni=n+1;if(navs[ni])navs[ni].classList.add('active')}
|
|
750
|
+
function clearNavActive(){navs.forEach(function(e){e.classList.remove('active')})}
|
|
751
|
+
function onScroll(){
|
|
752
|
+
clearNavActive();
|
|
753
|
+
if(taskDetail){var r=taskDetail.getBoundingClientRect();if(r.top>0&&r.bottom>0&&r.top<=200){if(navDetail)navDetail.classList.add('active');if(floatingDetail)floatingDetail.style.display='none';floatingClosed=false;return}if(floatingDetail&&!floatingClosed){floatingDetail.style.display=r.bottom<0?'flex':'none'}}
|
|
754
|
+
var a=-1;for(var i=0;i<cards.length;i++){var r=cards[i].getBoundingClientRect();if(r.top<=150)a=i}
|
|
755
|
+
if(a>=0){var ni=a+1;if(navs[ni])navs[ni].classList.add('active')}else if(navDetail)navDetail.classList.add('active')
|
|
756
|
+
}
|
|
757
|
+
window.addEventListener('scroll',onScroll);onScroll();
|
|
758
|
+
function openFullscreen(src){
|
|
759
|
+
var o=document.createElement('div');
|
|
760
|
+
o.style.cssText='position:fixed;top:0;left:0;width:100vw;height:100vh;background:rgba(0,0,0,.9);display:flex;align-items:center;justify-content:center;z-index:9999;cursor:pointer';
|
|
761
|
+
var img=document.createElement('img');
|
|
762
|
+
img.src=src;img.style.cssText='display:block;max-width:95vw;max-height:95vh;border-radius:8px';
|
|
763
|
+
o.appendChild(img);
|
|
764
|
+
o.onclick=function(e){if(e.target===o||e.target===img)o.remove()};
|
|
765
|
+
document.body.appendChild(o)
|
|
766
|
+
}
|
|
767
|
+
</script>
|
|
768
|
+
</body>
|
|
769
|
+
</html>`;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
exports.ReportGeneratorImpl = ReportGeneratorImpl;
|
|
773
|
+
//# sourceMappingURL=generator.js.map
|