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