@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
|
@@ -155,8 +155,8 @@ const CompressionConfigSchema = zod_1.z.object({
|
|
|
155
155
|
});
|
|
156
156
|
const ReflectionConfigSchema = zod_1.z.object({
|
|
157
157
|
enabled: zod_1.z.boolean().default(true),
|
|
158
|
-
initialStep: zod_1.z.number().int().default(
|
|
159
|
-
interval: zod_1.z.number().int().default(
|
|
158
|
+
initialStep: zod_1.z.number().int().default(25),
|
|
159
|
+
interval: zod_1.z.number().int().default(15),
|
|
160
160
|
recentMessages: zod_1.z.number().int().default(10),
|
|
161
161
|
});
|
|
162
162
|
const DetectionConfigSchema = zod_1.z.object({
|
|
@@ -182,4 +182,3 @@ exports.AppConfigSchema = zod_1.z.object({
|
|
|
182
182
|
agentRoles: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
183
183
|
extensions: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
184
184
|
});
|
|
185
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -3,4 +3,3 @@ export { createRecordingFetch, type FetchLike } from './recording_fetch';
|
|
|
3
3
|
export { setStepNumber, getStepNumber, clearStepNumber } from './context';
|
|
4
4
|
export { RecordingSource } from './source';
|
|
5
5
|
export { createLLMClient, type ModelSettings, type CreateLLMClientOptions, type LLMClientBundle, } from './client_factory';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/common/dfx/index.js
CHANGED
|
@@ -13,4 +13,3 @@ var source_1 = require("./source");
|
|
|
13
13
|
Object.defineProperty(exports, "RecordingSource", { enumerable: true, get: function () { return source_1.RecordingSource; } });
|
|
14
14
|
var client_factory_1 = require("./client_factory");
|
|
15
15
|
Object.defineProperty(exports, "createLLMClient", { enumerable: true, get: function () { return client_factory_1.createLLMClient; } });
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { LLMTrafficRecorder } from './recorder';
|
|
2
2
|
export type FetchLike = typeof globalThis.fetch;
|
|
3
3
|
export declare function createRecordingFetch(originalFetch: FetchLike, recorder: LLMTrafficRecorder, source: string, runId?: string | null): FetchLike;
|
|
4
|
-
//# sourceMappingURL=recording_fetch.d.ts.map
|
|
@@ -16,4 +16,3 @@ export declare function decodeBase64Image(base64Data: string): Promise<Buffer>;
|
|
|
16
16
|
* only apply when re-encoding via sharp, which callers can do via compressBase64Image).
|
|
17
17
|
*/
|
|
18
18
|
export declare function encodeImageToBase64(buf: Buffer): string;
|
|
19
|
-
//# sourceMappingURL=image_helper.d.ts.map
|
|
@@ -4,4 +4,3 @@ export declare function hammingDistance(hash1: string, hash2: string): number;
|
|
|
4
4
|
export declare function computeImageSimilarity(image1Base64: string, image2Base64: string, side?: number): Promise<number | null>;
|
|
5
5
|
export declare function areImagesSimilar(hash1: string, hash2: string, threshold?: number): boolean;
|
|
6
6
|
export declare function expectedHashLength(): number;
|
|
7
|
-
//# sourceMappingURL=image_similarity.d.ts.map
|
|
@@ -3,8 +3,9 @@ export declare class CacheTransport {
|
|
|
3
3
|
private cacheDir;
|
|
4
4
|
private cache;
|
|
5
5
|
constructor(enabled?: boolean, cacheDir?: string);
|
|
6
|
+
/** Exposed for prompt-cache injection gating (aligned with python `enable_cache`). */
|
|
7
|
+
isEnabled(): boolean;
|
|
6
8
|
getCachedResponse(requestKey: string): Promise<string | null>;
|
|
7
9
|
setCachedResponse(requestKey: string, response: string): Promise<void>;
|
|
8
10
|
clearCache(): void;
|
|
9
11
|
}
|
|
10
|
-
//# sourceMappingURL=cache_transport.d.ts.map
|
|
@@ -45,6 +45,10 @@ class CacheTransport {
|
|
|
45
45
|
this.enabled = enabled ?? true;
|
|
46
46
|
this.cacheDir = cacheDir ?? path.join(process.cwd(), '.llm_cache');
|
|
47
47
|
}
|
|
48
|
+
/** Exposed for prompt-cache injection gating (aligned with python `enable_cache`). */
|
|
49
|
+
isEnabled() {
|
|
50
|
+
return this.enabled;
|
|
51
|
+
}
|
|
48
52
|
async getCachedResponse(requestKey) {
|
|
49
53
|
if (!this.enabled)
|
|
50
54
|
return null;
|
|
@@ -96,4 +100,3 @@ class CacheTransport {
|
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
102
|
exports.CacheTransport = CacheTransport;
|
|
99
|
-
//# sourceMappingURL=cache_transport.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DashScope 上下文缓存注入器(移植自 python/AutoTest/core/openai/transports/cache_transport.py)
|
|
3
|
+
*
|
|
4
|
+
* 在 HTTP 请求发出前,在 system message 上添加 `cache_control: {"type": "ephemeral"}` 标记,
|
|
5
|
+
* 使 DashScope 复用前缀 token(节省 system prompt 重复计费)。
|
|
6
|
+
*
|
|
7
|
+
* **重要**:这是 DashScope 服务端上下文缓存(prefix token reuse),与 `cache_transport.ts`
|
|
8
|
+
* 中的本地响应缓存(memoization)是两套机制。本模块只注入请求体标记,不缓存响应。
|
|
9
|
+
*
|
|
10
|
+
* DashScope 官方文档:https://help.aliyun.com/zh/model-studio/context-cache
|
|
11
|
+
*/
|
|
12
|
+
export declare const DASHSCOPE_CACHE_SUPPORTED_PREFIXES: readonly string[];
|
|
13
|
+
interface MessageLike {
|
|
14
|
+
role?: string;
|
|
15
|
+
content?: unknown;
|
|
16
|
+
}
|
|
17
|
+
interface RequestBodyLike {
|
|
18
|
+
model?: string;
|
|
19
|
+
messages?: MessageLike[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 在 system message 上添加 cache_control 标记(原地修改 messages)。
|
|
23
|
+
*
|
|
24
|
+
* 只在 system message 上添加 cache_control,因为 system prompt 在多步骤间完全相同,
|
|
25
|
+
* 确保每步都能命中缓存(节省 system prompt 的 token 费用)。
|
|
26
|
+
*
|
|
27
|
+
* 不在最后一个 content item 上添加 cache_control,因为每步都有新截图(image_url)
|
|
28
|
+
* 和新工具结果,前缀必然变化,无法命中缓存。
|
|
29
|
+
*
|
|
30
|
+
* 对于字符串 content 的 system message,会先转为 content 数组格式再添加标记。
|
|
31
|
+
* 对于已经是数组格式的 system message,直接在最后一个 item 上添加标记。
|
|
32
|
+
*
|
|
33
|
+
* @returns True 表示修改了 messages,False 表示无 system message 或已有 cache_control
|
|
34
|
+
*/
|
|
35
|
+
export declare function addCacheControlToSystemMessage(messages: MessageLike[]): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 根据请求上下文(base_url + model 名)判断是否注入 cache_control。
|
|
38
|
+
*
|
|
39
|
+
* 目前仅支持 DashScope(阿里云),通过 base_url 包含 "dashscope" 判定。
|
|
40
|
+
* 模型名按前缀匹配,避免误注入到不支持缓存的模型导致 400 错误。
|
|
41
|
+
*/
|
|
42
|
+
export declare function supportsCacheControl(baseUrl: string, modelName: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 在请求体上注入 cache_control(原地修改 body.messages)。
|
|
45
|
+
*
|
|
46
|
+
* @param body 请求体(包含 messages 数组)
|
|
47
|
+
* @param baseUrl LLM API 基础 URL
|
|
48
|
+
* @param modelName 模型名
|
|
49
|
+
* @param enabled 是否启用(受 agent.unified.enableCache 控制,对齐 python)
|
|
50
|
+
* @returns True 表示修改了 body(调用方需要重新序列化),False 表示不需要缓存
|
|
51
|
+
*/
|
|
52
|
+
export declare function injectPromptCache(body: RequestBodyLike, baseUrl: string, modelName: string, enabled: boolean): boolean;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DashScope 上下文缓存注入器(移植自 python/AutoTest/core/openai/transports/cache_transport.py)
|
|
4
|
+
*
|
|
5
|
+
* 在 HTTP 请求发出前,在 system message 上添加 `cache_control: {"type": "ephemeral"}` 标记,
|
|
6
|
+
* 使 DashScope 复用前缀 token(节省 system prompt 重复计费)。
|
|
7
|
+
*
|
|
8
|
+
* **重要**:这是 DashScope 服务端上下文缓存(prefix token reuse),与 `cache_transport.ts`
|
|
9
|
+
* 中的本地响应缓存(memoization)是两套机制。本模块只注入请求体标记,不缓存响应。
|
|
10
|
+
*
|
|
11
|
+
* DashScope 官方文档:https://help.aliyun.com/zh/model-studio/context-cache
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.DASHSCOPE_CACHE_SUPPORTED_PREFIXES = void 0;
|
|
15
|
+
exports.addCacheControlToSystemMessage = addCacheControlToSystemMessage;
|
|
16
|
+
exports.supportsCacheControl = supportsCacheControl;
|
|
17
|
+
exports.injectPromptCache = injectPromptCache;
|
|
18
|
+
// DashScope(阿里云)支持显式缓存(cache_control)的模型前缀列表
|
|
19
|
+
// 来源:https://help.aliyun.com/zh/model-studio/context-cache
|
|
20
|
+
// 前缀匹配,带日期后缀的模型名(如 qwen3.7-plus-2026-05-26)也支持缓存
|
|
21
|
+
exports.DASHSCOPE_CACHE_SUPPORTED_PREFIXES = [
|
|
22
|
+
'qwen3.7-max',
|
|
23
|
+
'qwen3.6-max-preview',
|
|
24
|
+
'qwen3-max',
|
|
25
|
+
'qwen3.7-plus',
|
|
26
|
+
'qwen3.6-plus',
|
|
27
|
+
'qwen3.5-plus',
|
|
28
|
+
'qwen-plus',
|
|
29
|
+
'qwen3.6-flash',
|
|
30
|
+
'qwen3.5-flash',
|
|
31
|
+
'qwen-flash',
|
|
32
|
+
'qwen3-coder-plus',
|
|
33
|
+
'qwen3-coder-flash',
|
|
34
|
+
'qwen3-vl-plus',
|
|
35
|
+
'qwen3-vl-flash',
|
|
36
|
+
'deepseek-v3.2',
|
|
37
|
+
'kimi-k2.6',
|
|
38
|
+
'kimi-k2.5',
|
|
39
|
+
'glm-5.1',
|
|
40
|
+
];
|
|
41
|
+
/**
|
|
42
|
+
* 在 system message 上添加 cache_control 标记(原地修改 messages)。
|
|
43
|
+
*
|
|
44
|
+
* 只在 system message 上添加 cache_control,因为 system prompt 在多步骤间完全相同,
|
|
45
|
+
* 确保每步都能命中缓存(节省 system prompt 的 token 费用)。
|
|
46
|
+
*
|
|
47
|
+
* 不在最后一个 content item 上添加 cache_control,因为每步都有新截图(image_url)
|
|
48
|
+
* 和新工具结果,前缀必然变化,无法命中缓存。
|
|
49
|
+
*
|
|
50
|
+
* 对于字符串 content 的 system message,会先转为 content 数组格式再添加标记。
|
|
51
|
+
* 对于已经是数组格式的 system message,直接在最后一个 item 上添加标记。
|
|
52
|
+
*
|
|
53
|
+
* @returns True 表示修改了 messages,False 表示无 system message 或已有 cache_control
|
|
54
|
+
*/
|
|
55
|
+
function addCacheControlToSystemMessage(messages) {
|
|
56
|
+
let modified = false;
|
|
57
|
+
for (const msg of messages) {
|
|
58
|
+
if (msg.role !== 'system')
|
|
59
|
+
continue;
|
|
60
|
+
const content = msg.content;
|
|
61
|
+
if (typeof content === 'string') {
|
|
62
|
+
// 字符串 content 转数组格式并添加 cache_control
|
|
63
|
+
const newItem = {
|
|
64
|
+
type: 'text',
|
|
65
|
+
text: content,
|
|
66
|
+
cache_control: { type: 'ephemeral' },
|
|
67
|
+
};
|
|
68
|
+
msg.content = [newItem];
|
|
69
|
+
modified = true;
|
|
70
|
+
}
|
|
71
|
+
else if (Array.isArray(content) && content.length > 0) {
|
|
72
|
+
// 数组 content 在最后一个 item 上添加 cache_control
|
|
73
|
+
const lastItem = content[content.length - 1];
|
|
74
|
+
if (typeof lastItem === 'object' && lastItem !== null && !('cache_control' in lastItem)) {
|
|
75
|
+
lastItem.cache_control = { type: 'ephemeral' };
|
|
76
|
+
modified = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
break; // 只处理第一个 system message
|
|
80
|
+
}
|
|
81
|
+
return modified;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 根据请求上下文(base_url + model 名)判断是否注入 cache_control。
|
|
85
|
+
*
|
|
86
|
+
* 目前仅支持 DashScope(阿里云),通过 base_url 包含 "dashscope" 判定。
|
|
87
|
+
* 模型名按前缀匹配,避免误注入到不支持缓存的模型导致 400 错误。
|
|
88
|
+
*/
|
|
89
|
+
function supportsCacheControl(baseUrl, modelName) {
|
|
90
|
+
if (!baseUrl || !baseUrl.toLowerCase().includes('dashscope'))
|
|
91
|
+
return false;
|
|
92
|
+
const modelLower = (modelName || '').toLowerCase();
|
|
93
|
+
return exports.DASHSCOPE_CACHE_SUPPORTED_PREFIXES.some((prefix) => modelLower.startsWith(prefix));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 在请求体上注入 cache_control(原地修改 body.messages)。
|
|
97
|
+
*
|
|
98
|
+
* @param body 请求体(包含 messages 数组)
|
|
99
|
+
* @param baseUrl LLM API 基础 URL
|
|
100
|
+
* @param modelName 模型名
|
|
101
|
+
* @param enabled 是否启用(受 agent.unified.enableCache 控制,对齐 python)
|
|
102
|
+
* @returns True 表示修改了 body(调用方需要重新序列化),False 表示不需要缓存
|
|
103
|
+
*/
|
|
104
|
+
function injectPromptCache(body, baseUrl, modelName, enabled) {
|
|
105
|
+
if (!enabled)
|
|
106
|
+
return false;
|
|
107
|
+
if (!supportsCacheControl(baseUrl, modelName))
|
|
108
|
+
return false;
|
|
109
|
+
const messages = body.messages;
|
|
110
|
+
if (!Array.isArray(messages) || messages.length === 0)
|
|
111
|
+
return false;
|
|
112
|
+
return addCacheControlToSystemMessage(messages);
|
|
113
|
+
}
|
package/dist/common/logger.d.ts
CHANGED
package/dist/common/logger.js
CHANGED
|
@@ -39,6 +39,7 @@ const ai_1 = require("ai");
|
|
|
39
39
|
const openai_1 = require("@ai-sdk/openai");
|
|
40
40
|
const token_usage_1 = require("../../common/usage/token_usage");
|
|
41
41
|
const cache_transport_1 = require("../llm_cache/cache_transport");
|
|
42
|
+
const prompt_cache_1 = require("../llm_cache/prompt_cache");
|
|
42
43
|
const logger_1 = require("../../common/logger");
|
|
43
44
|
const common_errors_1 = require("../../common/common_errors");
|
|
44
45
|
const MAX_SUMMARY_LEN = 300;
|
|
@@ -118,6 +119,16 @@ class LLMCaller {
|
|
|
118
119
|
try {
|
|
119
120
|
const body = JSON.parse(init.body);
|
|
120
121
|
Object.assign(body, extraBody);
|
|
122
|
+
// DashScope 服务端 prompt cache:在 system message 上注入 cache_control,
|
|
123
|
+
// 跨步骤复用稳定前缀(移植自 python cache_transport.py)。
|
|
124
|
+
try {
|
|
125
|
+
if ((0, prompt_cache_1.injectPromptCache)(body, modelConfig.baseUrl, modelConfig.name, this.cacheTransport.isEnabled())) {
|
|
126
|
+
logger_1.logger.debug(`LLMCaller: injected cache_control (model=${modelConfig.name})`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
logger_1.logger.warn(`LLMCaller: inject cache_control failed, pass-through: ${e instanceof Error ? e.message : String(e)}`);
|
|
131
|
+
}
|
|
121
132
|
init = { ...init, body: JSON.stringify(body) };
|
|
122
133
|
}
|
|
123
134
|
catch {
|
|
@@ -207,6 +218,7 @@ class LLMCaller {
|
|
|
207
218
|
}
|
|
208
219
|
}
|
|
209
220
|
let capturedReasoning;
|
|
221
|
+
let capturedCacheDetails;
|
|
210
222
|
const provider = this.createProvider(opts.modelConfig, async (response) => {
|
|
211
223
|
const cloned = response.clone();
|
|
212
224
|
try {
|
|
@@ -214,6 +226,13 @@ class LLMCaller {
|
|
|
214
226
|
const rc = json?.choices?.[0]?.message?.reasoning_content;
|
|
215
227
|
if (rc)
|
|
216
228
|
capturedReasoning = rc;
|
|
229
|
+
const ptd = json?.usage?.prompt_tokens_details;
|
|
230
|
+
if (ptd && (ptd.cached_tokens || ptd.cache_creation_input_tokens)) {
|
|
231
|
+
capturedCacheDetails = {
|
|
232
|
+
cached_tokens: ptd.cached_tokens ?? 0,
|
|
233
|
+
cache_creation_input_tokens: ptd.cache_creation_input_tokens ?? 0,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
217
236
|
}
|
|
218
237
|
catch {
|
|
219
238
|
// response not JSON or already consumed
|
|
@@ -226,8 +245,17 @@ class LLMCaller {
|
|
|
226
245
|
if (opts.systemPrompt)
|
|
227
246
|
logger_1.logger.debug(`LLM call() system prompt: ${opts.systemPrompt}`);
|
|
228
247
|
for (const m of messages) {
|
|
229
|
-
const content = typeof m.content === 'string'
|
|
230
|
-
|
|
248
|
+
const content = typeof m.content === 'string'
|
|
249
|
+
? m.content
|
|
250
|
+
: Array.isArray(m.content)
|
|
251
|
+
? m.content.filter((p) => p.type === 'text').map((p) => p.text ?? '').join('\n') || '[multimodal]'
|
|
252
|
+
: '[multimodal]';
|
|
253
|
+
if (m.role === 'user') {
|
|
254
|
+
logger_1.logger.info(`LLM call() message [user]: ${content}`);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
logger_1.logger.debug(`LLM call() message [${m.role}]: ${content}`);
|
|
258
|
+
}
|
|
231
259
|
}
|
|
232
260
|
if (opts.tools)
|
|
233
261
|
logger_1.logger.debug(`LLM call() tools: ${Object.keys(opts.tools).join(', ')}`);
|
|
@@ -245,7 +273,7 @@ class LLMCaller {
|
|
|
245
273
|
generateOpts.tools = opts.tools;
|
|
246
274
|
}
|
|
247
275
|
const result = await (0, ai_1.generateText)(generateOpts);
|
|
248
|
-
logger_1.logger.
|
|
276
|
+
logger_1.logger.info(`LLM call() output → finishReason=${result.finishReason} text=${result.text}`);
|
|
249
277
|
if (result.toolCalls && result.toolCalls.length > 0) {
|
|
250
278
|
logger_1.logger.debug(`LLM call() toolCalls: ${result.toolCalls.map(tc => tc.toolName).join(', ')}`);
|
|
251
279
|
}
|
|
@@ -278,6 +306,9 @@ class LLMCaller {
|
|
|
278
306
|
output_tokens: usage.outputTokens ?? 0,
|
|
279
307
|
total_tokens: usage.totalTokens ?? 0,
|
|
280
308
|
};
|
|
309
|
+
if (capturedCacheDetails) {
|
|
310
|
+
usageObj.input_tokens_details = capturedCacheDetails;
|
|
311
|
+
}
|
|
281
312
|
const tokenUsage = tokenType.fromUsageObj(usageObj);
|
|
282
313
|
const llmResult = {
|
|
283
314
|
text: result.text,
|
|
@@ -320,6 +351,7 @@ class LLMCaller {
|
|
|
320
351
|
}
|
|
321
352
|
}
|
|
322
353
|
let capturedReasoning;
|
|
354
|
+
let capturedCacheDetails;
|
|
323
355
|
const provider = this.createProvider(opts.modelConfig, async (response) => {
|
|
324
356
|
const cloned = response.clone();
|
|
325
357
|
try {
|
|
@@ -327,6 +359,13 @@ class LLMCaller {
|
|
|
327
359
|
const rc = json?.choices?.[0]?.message?.reasoning_content;
|
|
328
360
|
if (rc)
|
|
329
361
|
capturedReasoning = rc;
|
|
362
|
+
const ptd = json?.usage?.prompt_tokens_details;
|
|
363
|
+
if (ptd && (ptd.cached_tokens || ptd.cache_creation_input_tokens)) {
|
|
364
|
+
capturedCacheDetails = {
|
|
365
|
+
cached_tokens: ptd.cached_tokens ?? 0,
|
|
366
|
+
cache_creation_input_tokens: ptd.cache_creation_input_tokens ?? 0,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
330
369
|
}
|
|
331
370
|
catch {
|
|
332
371
|
// response not JSON or already consumed
|
|
@@ -336,7 +375,17 @@ class LLMCaller {
|
|
|
336
375
|
const tokenType = (0, token_usage_1.resolveTokenType)(opts.modelConfig.baseUrl);
|
|
337
376
|
logger_1.logger.debug(`LLM callWithMessages() input → model=${opts.modelConfig.name} messages=${opts.messages.length}`);
|
|
338
377
|
for (const m of opts.messages) {
|
|
339
|
-
|
|
378
|
+
const content = typeof m.content === 'string'
|
|
379
|
+
? m.content
|
|
380
|
+
: Array.isArray(m.content)
|
|
381
|
+
? m.content.filter((p) => p.type === 'text').map((p) => p.text ?? '').join('\n') || '[multimodal]'
|
|
382
|
+
: summarizeMessageContent(m.content);
|
|
383
|
+
if (m.role === 'user') {
|
|
384
|
+
logger_1.logger.info(`LLM callWithMessages() message [user]: ${content}`);
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
logger_1.logger.debug(`LLM callWithMessages() message [${m.role}]: ${summarizeMessageContent(m.content)}`);
|
|
388
|
+
}
|
|
340
389
|
}
|
|
341
390
|
if (opts.tools)
|
|
342
391
|
logger_1.logger.debug(`LLM callWithMessages() tools: ${Object.keys(opts.tools).join(', ')}`);
|
|
@@ -357,7 +406,7 @@ class LLMCaller {
|
|
|
357
406
|
generateOpts.tools = opts.tools;
|
|
358
407
|
}
|
|
359
408
|
const result = await (0, ai_1.generateText)(generateOpts);
|
|
360
|
-
logger_1.logger.
|
|
409
|
+
logger_1.logger.info(`LLM callWithMessages() output → finishReason=${result.finishReason} text=${result.text}`);
|
|
361
410
|
if (result.reasoningText)
|
|
362
411
|
logger_1.logger.debug(`LLM callWithMessages() reasoningText: ${result.reasoningText}`);
|
|
363
412
|
if (result.toolCalls && result.toolCalls.length > 0) {
|
|
@@ -393,6 +442,9 @@ class LLMCaller {
|
|
|
393
442
|
output_tokens: usage.outputTokens ?? 0,
|
|
394
443
|
total_tokens: usage.totalTokens ?? 0,
|
|
395
444
|
};
|
|
445
|
+
if (capturedCacheDetails) {
|
|
446
|
+
usageObj.input_tokens_details = capturedCacheDetails;
|
|
447
|
+
}
|
|
396
448
|
const tokenUsage = tokenType.fromUsageObj(usageObj);
|
|
397
449
|
const llmResult = {
|
|
398
450
|
text: result.text,
|
|
@@ -432,4 +484,3 @@ class LLMCaller {
|
|
|
432
484
|
}
|
|
433
485
|
}
|
|
434
486
|
exports.LLMCaller = LLMCaller;
|
|
435
|
-
//# sourceMappingURL=custom_model.js.map
|
|
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LLMCaller = void 0;
|
|
4
4
|
var custom_model_1 = require("./custom_model");
|
|
5
5
|
Object.defineProperty(exports, "LLMCaller", { enumerable: true, get: function () { return custom_model_1.LLMCaller; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 定位打包后 dist
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* 定位打包后 dist 根目录。
|
|
3
|
+
*
|
|
4
|
+
* 查找策略(从 __dirname 向上遍历):
|
|
5
|
+
* 1. 优先检查目录同时包含 common/ 和 core/ 子目录(最可靠,不依赖具体文件)
|
|
6
|
+
* 2. 回退检查 common/config/config.yaml 存在(兼容旧逻辑)
|
|
7
|
+
*
|
|
8
|
+
* 兼容普通构建(模块在 dist/core/... 子目录)与单文件 bundle(模块在 dist/index.js)。
|
|
5
9
|
*/
|
|
6
10
|
export declare function findDistRoot(): string;
|
|
7
11
|
export declare function findProjectRoot(): string;
|
|
8
12
|
export declare function getReportBaseDir(config?: {
|
|
9
13
|
rootDir?: string;
|
|
10
14
|
}): string;
|
|
11
|
-
//# sourceMappingURL=path_utils.d.ts.map
|
|
@@ -40,14 +40,18 @@ const fs = __importStar(require("fs"));
|
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const PROJECT_ROOT_MARKERS = ['package.json', 'pyproject.toml'];
|
|
42
42
|
/**
|
|
43
|
-
* 定位打包后 dist
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* 定位打包后 dist 根目录。
|
|
44
|
+
*
|
|
45
|
+
* 查找策略(从 __dirname 向上遍历):
|
|
46
|
+
* 1. 优先检查目录同时包含 common/ 和 core/ 子目录(最可靠,不依赖具体文件)
|
|
47
|
+
* 2. 回退检查 common/config/config.yaml 存在(兼容旧逻辑)
|
|
48
|
+
*
|
|
49
|
+
* 兼容普通构建(模块在 dist/core/... 子目录)与单文件 bundle(模块在 dist/index.js)。
|
|
46
50
|
*/
|
|
47
51
|
function findDistRoot() {
|
|
48
52
|
let current = __dirname;
|
|
49
53
|
for (let i = 0; i < 10; i++) {
|
|
50
|
-
if (
|
|
54
|
+
if (_isDistRoot(current)) {
|
|
51
55
|
return current;
|
|
52
56
|
}
|
|
53
57
|
const parent = path.dirname(current);
|
|
@@ -57,6 +61,10 @@ function findDistRoot() {
|
|
|
57
61
|
}
|
|
58
62
|
return __dirname;
|
|
59
63
|
}
|
|
64
|
+
function _isDistRoot(dir) {
|
|
65
|
+
return fs.existsSync(path.join(dir, 'common'))
|
|
66
|
+
&& fs.existsSync(path.join(dir, 'core'));
|
|
67
|
+
}
|
|
60
68
|
function findProjectRoot() {
|
|
61
69
|
let current = path.resolve(process.cwd());
|
|
62
70
|
for (let i = 0; i < 10; i++) {
|
|
@@ -70,7 +78,6 @@ function findProjectRoot() {
|
|
|
70
78
|
break;
|
|
71
79
|
current = parent;
|
|
72
80
|
}
|
|
73
|
-
// 与 Python 对齐:找不到 marker 时回退到 cwd(安装/打包运行场景),而非抛错
|
|
74
81
|
return path.resolve(process.cwd());
|
|
75
82
|
}
|
|
76
83
|
function getReportBaseDir(config) {
|
|
@@ -79,4 +86,3 @@ function getReportBaseDir(config) {
|
|
|
79
86
|
return path.resolve(rootDir);
|
|
80
87
|
return path.join(findProjectRoot(), 'reports');
|
|
81
88
|
}
|
|
82
|
-
//# sourceMappingURL=path_utils.js.map
|
|
@@ -4,7 +4,7 @@ exports.LONG_PRESS_ACTIONS = exports.DOUBLE_CLICK_ACTIONS = exports.SWIPE_LIKE_T
|
|
|
4
4
|
exports.parseTaskResult = parseTaskResult;
|
|
5
5
|
exports.hasVerdict = hasVerdict;
|
|
6
6
|
const PASS_KEYWORDS = ['pass', 'passed', 'success', 'successful', 'complete', 'completed', '通过', '成功', '完成'];
|
|
7
|
-
const FAIL_KEYWORDS = ['fail', 'failed', 'failure', 'incomplete', 'unsuccessful', '不通过', '失败', '未完成', '未成功'];
|
|
7
|
+
const FAIL_KEYWORDS = ['fail', 'failed', 'failure', 'incomplete', 'unsuccessful', '不通过', '失败', '未完成', '未成功', 'max steps', '最大步数', '步数超过'];
|
|
8
8
|
function parseTaskResult(agentStatus, resultText) {
|
|
9
9
|
if (agentStatus) {
|
|
10
10
|
const lower = agentStatus.toLowerCase();
|
|
@@ -47,4 +47,3 @@ exports.CLICK_LIKE_TOOLS = ['click', 'tap', 'double_click', 'double_tap', 'long_
|
|
|
47
47
|
exports.SWIPE_LIKE_TOOLS = ['swipe', 'drag', 'slide'];
|
|
48
48
|
exports.DOUBLE_CLICK_ACTIONS = ['double_click', 'double_tap', 'doubleclick'];
|
|
49
49
|
exports.LONG_PRESS_ACTIONS = ['long_press', 'long_click', 'longpress'];
|
|
50
|
-
//# sourceMappingURL=result_parser.js.map
|
|
@@ -20,4 +20,3 @@ export declare class DashScopeTokenUsage extends TokenUsage {
|
|
|
20
20
|
static fromUsageObj(usageObj: Record<string, unknown> | null | undefined): DashScopeTokenUsage | null;
|
|
21
21
|
}
|
|
22
22
|
export declare function resolveTokenType(baseUrl: string): typeof TokenUsage;
|
|
23
|
-
//# sourceMappingURL=token_usage.d.ts.map
|
package/dist/common/utils.d.ts
CHANGED
|
@@ -41,4 +41,3 @@ export declare function normalizeToolCoordinates(toolName: string, args: Record<
|
|
|
41
41
|
* Values >= 1000 are shown as `X.XK`, otherwise the raw number is returned.
|
|
42
42
|
*/
|
|
43
43
|
export declare function formatTokenDisplay(total: number): string;
|
|
44
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/common/utils.js
CHANGED
|
@@ -33,4 +33,3 @@ export declare function getBundleInfo(driver: AbilityDriver, bundleName: string)
|
|
|
33
33
|
export declare function getIconAbilities(driver: AbilityDriver, bundleName: string): IconAbilityInfo[];
|
|
34
34
|
export declare function getMainAbility(driver: AbilityDriver, bundleName: string): IconAbilityInfo | null;
|
|
35
35
|
export {};
|
|
36
|
-
//# sourceMappingURL=ability_helper.d.ts.map
|
|
@@ -12,4 +12,3 @@ export declare class LayeredAgent {
|
|
|
12
12
|
constructor(adapter: MCPDeviceAdapter, config: AppConfig, reportGenerator: ReportGenerator, hooks?: AgentHooks, llmCaller?: LLMCaller);
|
|
13
13
|
run(args: SingleAgentArgs): Promise<AgentResult>;
|
|
14
14
|
}
|
|
15
|
-
//# sourceMappingURL=agent.d.ts.map
|