@didim365/agent-cli-core 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -2
- package/dist/docs/00_project/ai_adapter/01-overview.md +0 -172
- package/dist/docs/00_project/ai_adapter/02-architecture.md +0 -448
- package/dist/docs/00_project/ai_adapter/03-technical-design.md +0 -1470
- package/dist/docs/00_project/ai_adapter/04-integration-design.md +0 -1934
- package/dist/docs/00_project/ai_adapter/05-implementation-plan.md +0 -336
- package/dist/docs/00_project/ai_adapter/06-didiaistudio-plan.md +0 -559
- package/dist/docs/00_project/ai_adapter/README.md +0 -145
- package/dist/docs/00_project/ai_adapter/agent_service_openapi.json +0 -1
- package/dist/docs/00_project/ai_adapter/didimStudi-AISTUDIO /341/204/213/341/205/254/341/204/207/341/205/256 /341/204/211/341/205/245/341/204/207/341/205/265/341/204/211/341/205/263 /341/204/221/341/205/263/341/206/257/341/204/205/341/205/251/341/204/213/341/205/256 /341/204/213/341/205/247/341/206/253/341/204/200/341/205/247/341/206/257 /341/204/207/341/205/241/341/206/274/341/204/211/341/205/265/341/206/250-100226-093925.pdf +0 -0
- package/dist/docs/00_project/ai_adapter/event-mapping-matrix.md +0 -148
- package/dist/docs/00_project/ai_adapter/migration-plan.md +0 -205
- package/dist/docs/00_project/ai_adapter/template/00_vibecoding_workflow.md +0 -627
- package/dist/docs/00_project/ai_adapter/template/01_todolist_performance_template.md +0 -436
- package/dist/docs/00_project/ai_adapter/template/02_code_review_template.md +0 -248
- package/dist/docs/00_project/ai_adapter/template/03_work_result_report_template.md +0 -133
- package/dist/docs/00_project/ai_adapter/template/100_Python_Performance_Guide.md +0 -472
- package/dist/docs/00_project/ai_adapter/template/99_TDD_plan.md +0 -123
- package/dist/docs/00_project/ai_adapter/todolist/00_master_implementation_plan.md +0 -433
- package/dist/docs/00_project/ai_adapter/todolist/phase1_foundation_todolist.md +0 -726
- package/dist/docs/00_project/ai_adapter/todolist/phase2_core_refactoring_todolist.md +0 -974
- package/dist/docs/00_project/ai_adapter/todolist/phase3_handoff.md +0 -203
- package/dist/docs/00_project/ai_adapter/todolist/phase3_provider_extension_todolist.md +0 -1382
- package/dist/docs/00_project/ai_adapter/utility-migration.md +0 -237
- package/dist/docs/00_project/ai_adapter/working_history/.gitkeep +0 -0
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.0_/354/275/224/353/223/234/354/235/270/353/262/244/355/206/240/353/246/254_20260201.md +0 -197
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.1_/355/203/200/354/236/205/354/204/244/352/263/204_20260201.md +0 -185
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.2_Adapter/354/235/270/355/224/204/353/235/274_20260203.md +0 -378
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.3_Provider/354/204/240/355/203/235_20260206.md +0 -269
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.4_/354/234/240/355/213/270/353/246/254/355/213/260/353/247/210/354/235/264/352/267/270/353/240/210/354/235/264/354/205/230_20260206.md +0 -86
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_ETC_/354/227/260/352/270/260/354/236/221/354/227/205/354/240/225/353/246/254_20260208.md +0 -157
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.0_/353/224/224/353/240/211/355/206/240/353/246/254/354/236/254/352/265/254/354/204/261_20260207.md +0 -107
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.1_ContentGenerator/354/235/270/355/204/260/355/216/230/354/235/264/354/212/244/354/236/254/354/240/225/354/235/230_20260207.md +0 -630
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.2_EventMapper/352/265/254/355/230/204_20260207.md +0 -372
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.3_GeminiAdapter/352/265/254/355/230/204_20260208.md +0 -205
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.4_ModelConfigService/355/230/270/355/231/230/353/240/210/354/235/264/354/226/264_20260208.md +0 -275
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.5_/354/234/240/355/213/270/353/246/254/355/213/260/353/240/210/354/235/264/354/226/264/353/246/254/355/214/251/355/206/240/353/247/201_20260208.md +0 -239
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.6_/353/235/274/354/232/260/355/214/205/353/240/210/354/235/264/354/226/264/355/203/200/354/236/205/353/217/205/353/246/275/355/231/224_20260208.md +0 -228
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_ETC_/352/270/260/353/263/270/354/273/250/355/205/215/354/212/244/355/212/270/355/214/214/354/235/274/353/252/205AGENTS/354/240/204/355/231/230_20260211.md +0 -470
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.1_Gemini/354/240/204/354/232/251/355/214/214/354/235/274/353/254/274/353/246/254/354/240/201/354/235/264/353/217/231_20260209.md +0 -271
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.2_messageInspectors/353/247/210/354/235/264/352/267/270/353/240/210/354/235/264/354/205/230_20260209.md +0 -330
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.3_/355/205/224/353/240/210/353/251/224/355/212/270/353/246/254Agent/353/217/205/353/246/275/355/231/224_20260209.md +0 -251
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.4_/353/263/200/355/231/230/353/270/214/353/246/277/354/247/200/354/240/225/353/246/254_20260209.md +0 -136
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.5_/353/237/260/355/203/200/354/236/204/354/213/244/355/226/211/352/262/275/353/241/234/354/227/260/352/262/260_20260209.md +0 -232
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.0_Claude/354/202/254/354/240/204/354/244/200/353/271/204_20260209.md +0 -191
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.1_ClaudeAdapter/352/265/254/355/230/204_20260209.md +0 -225
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.2_ClaudeConverter/352/263/240/353/217/204/355/231/224_20260209.md +0 -171
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.3_ClaudeStreamError/352/263/240/353/217/204/355/231/224_20260209.md +0 -198
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.4_ClaudeErrorMapping_20260209.md +0 -98
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.2.A_OpenAIAdapterCore_20260210.md +0 -264
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.2.B_OpenAIStreamConverter_20260210.md +0 -204
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.3.2_/353/252/250/353/215/270/355/205/234/355/224/214/353/246/277/355/233/205/353/263/264/354/231/204_20260211.md +0 -106
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.3_OpenAICompatibleAdapter_20260211.md +0 -251
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.2_E2E/355/205/214/354/212/244/355/212/270/354/213/234/353/202/230/353/246/254/354/230/244_20260210.md +0 -264
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.3_/354/204/261/353/212/245/355/232/214/352/267/200/355/205/214/354/212/244/355/212/270_20260211.md +0 -176
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.5_/354/225/210/354/240/225/355/231/224/354/236/221/354/227/205_20260211.md +0 -204
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.A_CLI/355/206/265/355/225/251_3Provider/355/206/265/355/225/251/355/205/214/354/212/244/355/212/270_20260210.md +0 -316
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.A_UI/354/203/201/355/203/234/353/260/224/354/210/230/354/240/225_20260210.md +0 -262
- package/dist/docs/00_project/ai_adapter/working_history/phase2_tradeoff_EventType/354/240/204/355/231/230_20260208.md +0 -286
- package/dist/docs/00_project/white_labeling/template/00_vibecoding_workflow.md +0 -627
- package/dist/docs/00_project/white_labeling/template/01_todolist_performance_template.md +0 -400
- package/dist/docs/00_project/white_labeling/template/02_code_review_template.md +0 -248
- package/dist/docs/00_project/white_labeling/template/03_work_result_report_template.md +0 -133
- package/dist/docs/00_project/white_labeling/template/100_Python_Performance_Guide.md +0 -472
- package/dist/docs/00_project/white_labeling/template/99_TDD_plan.md +0 -123
- package/dist/docs/00_project/white_labeling/todolist/Phase_CLI/355/214/250/355/202/244/354/247/200/353/252/205/353/263/200/352/262/275_todolist.md +0 -431
- package/dist/docs/00_project/white_labeling/working_history/Phase_CLI/355/214/250/355/202/244/354/247/200/353/252/205/353/263/200/352/262/275_20260214.md +0 -238
- package/dist/docs/00_project/white_labeling//354/225/261/352/265/254/354/241/260.md +0 -310
- package/dist/docs/CONTRIBUTING.md +0 -554
- package/dist/docs/ai_adapter/01-overview.md +0 -155
- package/dist/docs/ai_adapter/02-architecture.md +0 -452
- package/dist/docs/ai_adapter/03-technical-design.md +0 -1470
- package/dist/docs/ai_adapter/04-integration-design.md +0 -1904
- package/dist/docs/ai_adapter/05-implementation-plan.md +0 -312
- package/dist/docs/ai_adapter/06-didiaistudio-plan.md +0 -559
- package/dist/docs/ai_adapter/README.md +0 -118
- package/dist/docs/ai_adapter/agent_service_openapi.json +0 -1
- package/dist/docs/ai_adapter/didimStudi-AISTUDIO /341/204/213/341/205/254/341/204/207/341/205/256 /341/204/211/341/205/245/341/204/207/341/205/265/341/204/211/341/205/263 /341/204/221/341/205/263/341/206/257/341/204/205/341/205/251/341/204/213/341/205/256 /341/204/213/341/205/247/341/206/253/341/204/200/341/205/247/341/206/257 /341/204/207/341/205/241/341/206/274/341/204/211/341/205/265/341/206/250-100226-093925.pdf +0 -0
- package/dist/docs/ai_adapter/event-mapping-matrix.md +0 -140
- package/dist/docs/ai_adapter/migration-plan.md +0 -205
- package/dist/docs/ai_adapter/template/00_vibecoding_workflow.md +0 -636
- package/dist/docs/ai_adapter/template/01_todolist_performance_template.md +0 -372
- package/dist/docs/ai_adapter/template/02_code_review_template.md +0 -220
- package/dist/docs/ai_adapter/template/03_work_result_report_template.md +0 -120
- package/dist/docs/ai_adapter/template/100_Python_Performance_Guide.md +0 -453
- package/dist/docs/ai_adapter/template/99_TDD_plan.md +0 -111
- package/dist/docs/ai_adapter/todolist/00_master_implementation_plan.md +0 -433
- package/dist/docs/ai_adapter/todolist/phase1_foundation_todolist.md +0 -726
- package/dist/docs/ai_adapter/todolist/phase2_core_refactoring_todolist.md +0 -974
- package/dist/docs/ai_adapter/todolist/phase3_handoff.md +0 -203
- package/dist/docs/ai_adapter/todolist/phase3_provider_extension_todolist.md +0 -1382
- package/dist/docs/ai_adapter/utility-migration.md +0 -237
- package/dist/docs/ai_adapter/working_history/.gitkeep +0 -0
- package/dist/docs/ai_adapter/working_history/Phase1_M1.0_/354/275/224/353/223/234/354/235/270/353/262/244/355/206/240/353/246/254_20260201.md +0 -185
- package/dist/docs/ai_adapter/working_history/Phase1_M1.1_/355/203/200/354/236/205/354/204/244/352/263/204_20260201.md +0 -185
- package/dist/docs/ai_adapter/working_history/Phase1_M1.2_Adapter/354/235/270/355/224/204/353/235/274_20260203.md +0 -378
- package/dist/docs/ai_adapter/working_history/Phase1_M1.3_Provider/354/204/240/355/203/235_20260206.md +0 -269
- package/dist/docs/ai_adapter/working_history/Phase1_M1.4_/354/234/240/355/213/270/353/246/254/355/213/260/353/247/210/354/235/264/352/267/270/353/240/210/354/235/264/354/205/230_20260206.md +0 -86
- package/dist/docs/ai_adapter/working_history/Phase2_ETC_/354/227/260/352/270/260/354/236/221/354/227/205/354/240/225/353/246/254_20260208.md +0 -157
- package/dist/docs/ai_adapter/working_history/Phase2_M2.0_/353/224/224/353/240/211/355/206/240/353/246/254/354/236/254/352/265/254/354/204/261_20260207.md +0 -107
- package/dist/docs/ai_adapter/working_history/Phase2_M2.1_ContentGenerator/354/235/270/355/204/260/355/216/230/354/235/264/354/212/244/354/236/254/354/240/225/354/235/230_20260207.md +0 -630
- package/dist/docs/ai_adapter/working_history/Phase2_M2.2_EventMapper/352/265/254/355/230/204_20260207.md +0 -372
- package/dist/docs/ai_adapter/working_history/Phase2_M2.3_GeminiAdapter/352/265/254/355/230/204_20260208.md +0 -205
- package/dist/docs/ai_adapter/working_history/Phase2_M2.4_ModelConfigService/355/230/270/355/231/230/353/240/210/354/235/264/354/226/264_20260208.md +0 -275
- package/dist/docs/ai_adapter/working_history/Phase2_M2.5_/354/234/240/355/213/270/353/246/254/355/213/260/353/240/210/354/235/264/354/226/264/353/246/254/355/214/251/355/206/240/353/247/201_20260208.md +0 -239
- package/dist/docs/ai_adapter/working_history/Phase2_M2.6_/353/235/274/354/232/260/355/214/205/353/240/210/354/235/264/354/226/264/355/203/200/354/236/205/353/217/205/353/246/275/355/231/224_20260208.md +0 -228
- package/dist/docs/ai_adapter/working_history/Phase3_ETC_/352/270/260/353/263/270/354/273/250/355/205/215/354/212/244/355/212/270/355/214/214/354/235/274/353/252/205AGENTS/354/240/204/355/231/230_20260211.md +0 -367
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.1_Gemini/354/240/204/354/232/251/355/214/214/354/235/274/353/254/274/353/246/254/354/240/201/354/235/264/353/217/231_20260209.md +0 -271
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.2_messageInspectors/353/247/210/354/235/264/352/267/270/353/240/210/354/235/264/354/205/230_20260209.md +0 -330
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.3_/355/205/224/353/240/210/353/251/224/355/212/270/353/246/254Agent/353/217/205/353/246/275/355/231/224_20260209.md +0 -251
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.4_/353/263/200/355/231/230/353/270/214/353/246/277/354/247/200/354/240/225/353/246/254_20260209.md +0 -136
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.5_/353/237/260/355/203/200/354/236/204/354/213/244/355/226/211/352/262/275/353/241/234/354/227/260/352/262/260_20260209.md +0 -232
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.0_Claude/354/202/254/354/240/204/354/244/200/353/271/204_20260209.md +0 -191
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.1_ClaudeAdapter/352/265/254/355/230/204_20260209.md +0 -225
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.2_ClaudeConverter/352/263/240/353/217/204/355/231/224_20260209.md +0 -171
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.3_ClaudeStreamError/352/263/240/353/217/204/355/231/224_20260209.md +0 -198
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.4_ClaudeErrorMapping_20260209.md +0 -98
- package/dist/docs/ai_adapter/working_history/Phase3_M3.2.A_OpenAIAdapterCore_20260210.md +0 -264
- package/dist/docs/ai_adapter/working_history/Phase3_M3.2.B_OpenAIStreamConverter_20260210.md +0 -204
- package/dist/docs/ai_adapter/working_history/Phase3_M3.3.2_/353/252/250/353/215/270/355/205/234/355/224/214/353/246/277/355/233/205/353/263/264/354/231/204_20260211.md +0 -106
- package/dist/docs/ai_adapter/working_history/Phase3_M3.3_OpenAICompatibleAdapter_20260211.md +0 -251
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.2_E2E/355/205/214/354/212/244/355/212/270/354/213/234/353/202/230/353/246/254/354/230/244_20260210.md +0 -264
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.3_/354/204/261/353/212/245/355/232/214/352/267/200/355/205/214/354/212/244/355/212/270_20260211.md +0 -176
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.5_/354/225/210/354/240/225/355/231/224/354/236/221/354/227/205_20260211.md +0 -204
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.A_CLI/355/206/265/355/225/251_3Provider/355/206/265/355/225/251/355/205/214/354/212/244/355/212/270_20260210.md +0 -316
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.A_UI/354/203/201/355/203/234/353/260/224/354/210/230/354/240/225_20260210.md +0 -262
- package/dist/docs/ai_adapter/working_history/phase2_tradeoff_EventType/354/240/204/355/231/230_20260208.md +0 -286
- package/dist/docs/api/index.md +0 -5
- package/dist/docs/api/providers.md +0 -56
- package/dist/docs/architecture.md +0 -80
- package/dist/docs/assets/connected_devtools.png +0 -0
- package/dist/docs/assets/gemini-screenshot.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-logs.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-metrics.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-overview.png +0 -0
- package/dist/docs/assets/release_patch.png +0 -0
- package/dist/docs/assets/theme-ansi-light.png +0 -0
- package/dist/docs/assets/theme-ansi.png +0 -0
- package/dist/docs/assets/theme-atom-one.png +0 -0
- package/dist/docs/assets/theme-ayu-light.png +0 -0
- package/dist/docs/assets/theme-ayu.png +0 -0
- package/dist/docs/assets/theme-custom.png +0 -0
- package/dist/docs/assets/theme-default-light.png +0 -0
- package/dist/docs/assets/theme-default.png +0 -0
- package/dist/docs/assets/theme-dracula.png +0 -0
- package/dist/docs/assets/theme-github-light.png +0 -0
- package/dist/docs/assets/theme-github.png +0 -0
- package/dist/docs/assets/theme-google-light.png +0 -0
- package/dist/docs/assets/theme-xcode-light.png +0 -0
- package/dist/docs/change_model/model_command_multi_provider_plan.md +0 -221
- package/dist/docs/change_model/model_command_multi_provider_todolist.md +0 -206
- package/dist/docs/changelogs/index.md +0 -726
- package/dist/docs/changelogs/latest.md +0 -370
- package/dist/docs/changelogs/preview.md +0 -332
- package/dist/docs/cli/authentication.md +0 -3
- package/dist/docs/cli/checkpointing.md +0 -94
- package/dist/docs/cli/commands.md +0 -375
- package/dist/docs/cli/custom-commands.md +0 -315
- package/dist/docs/cli/enterprise.md +0 -565
- package/dist/docs/cli/gemini-ignore.md +0 -71
- package/dist/docs/cli/gemini-md.md +0 -108
- package/dist/docs/cli/generation-settings.md +0 -210
- package/dist/docs/cli/headless.md +0 -388
- package/dist/docs/cli/index.md +0 -65
- package/dist/docs/cli/keyboard-shortcuts.md +0 -129
- package/dist/docs/cli/model-routing.md +0 -42
- package/dist/docs/cli/model.md +0 -62
- package/dist/docs/cli/sandbox.md +0 -171
- package/dist/docs/cli/session-management.md +0 -158
- package/dist/docs/cli/settings.md +0 -130
- package/dist/docs/cli/skills.md +0 -188
- package/dist/docs/cli/system-prompt.md +0 -125
- package/dist/docs/cli/telemetry.md +0 -826
- package/dist/docs/cli/themes.md +0 -235
- package/dist/docs/cli/token-caching.md +0 -20
- package/dist/docs/cli/trusted-folders.md +0 -95
- package/dist/docs/cli/tutorials/skills-getting-started.md +0 -124
- package/dist/docs/cli/tutorials.md +0 -87
- package/dist/docs/cli/uninstall.md +0 -65
- package/dist/docs/configuration.md +0 -108
- package/dist/docs/core/index.md +0 -105
- package/dist/docs/core/long-term-memory-design.md +0 -254
- package/dist/docs/core/long-term-memory-proposal.md +0 -112
- package/dist/docs/core/memport.md +0 -246
- package/dist/docs/core/policy-engine.md +0 -300
- package/dist/docs/core/tools-api.md +0 -131
- package/dist/docs/examples/proxy-script.md +0 -83
- package/dist/docs/extensions/best-practices.md +0 -139
- package/dist/docs/extensions/index.md +0 -44
- package/dist/docs/extensions/reference.md +0 -312
- package/dist/docs/extensions/releasing.md +0 -183
- package/dist/docs/extensions/writing-extensions.md +0 -283
- package/dist/docs/faq.md +0 -154
- package/dist/docs/get-started/authentication.md +0 -321
- package/dist/docs/get-started/configuration-v1.md +0 -888
- package/dist/docs/get-started/configuration.md +0 -1567
- package/dist/docs/get-started/examples.md +0 -219
- package/dist/docs/get-started/gemini-3.md +0 -101
- package/dist/docs/get-started/index.md +0 -71
- package/dist/docs/get-started/installation.md +0 -141
- package/dist/docs/hooks/best-practices.md +0 -677
- package/dist/docs/hooks/index.md +0 -178
- package/dist/docs/hooks/reference.md +0 -322
- package/dist/docs/hooks/writing-hooks.md +0 -450
- package/dist/docs/ide-integration/ide-companion-spec.md +0 -267
- package/dist/docs/ide-integration/index.md +0 -202
- package/dist/docs/index.md +0 -153
- package/dist/docs/integration-tests.md +0 -211
- package/dist/docs/issue-and-pr-automation.md +0 -134
- package/dist/docs/local-development.md +0 -128
- package/dist/docs/mermaid/context.mmd +0 -103
- package/dist/docs/mermaid/render-path.mmd +0 -64
- package/dist/docs/migration.md +0 -78
- package/dist/docs/npm.md +0 -62
- package/dist/docs/providers.md +0 -136
- package/dist/docs/quota-and-pricing.md +0 -158
- package/dist/docs/release-confidence.md +0 -164
- package/dist/docs/releases.md +0 -539
- package/dist/docs/sidebar.json +0 -140
- package/dist/docs/tools/file-system.md +0 -217
- package/dist/docs/tools/index.md +0 -98
- package/dist/docs/tools/mcp-server.md +0 -1068
- package/dist/docs/tools/memory.md +0 -54
- package/dist/docs/tools/shell.md +0 -260
- package/dist/docs/tools/todos.md +0 -57
- package/dist/docs/tools/web-fetch.md +0 -59
- package/dist/docs/tools/web-search.md +0 -42
- package/dist/docs/tos-privacy.md +0 -96
- package/dist/docs/troubleshooting.md +0 -173
- package/dist/src/agents/a2a-client-manager.test.d.ts +0 -6
- package/dist/src/agents/a2a-client-manager.test.js +0 -220
- package/dist/src/agents/a2a-client-manager.test.js.map +0 -1
- package/dist/src/agents/a2aUtils.test.d.ts +0 -6
- package/dist/src/agents/a2aUtils.test.js +0 -147
- package/dist/src/agents/a2aUtils.test.js.map +0 -1
- package/dist/src/agents/acknowledgedAgents.test.d.ts +0 -6
- package/dist/src/agents/acknowledgedAgents.test.js +0 -70
- package/dist/src/agents/acknowledgedAgents.test.js.map +0 -1
- package/dist/src/agents/agent-scheduler.test.d.ts +0 -6
- package/dist/src/agents/agent-scheduler.test.js +0 -56
- package/dist/src/agents/agent-scheduler.test.js.map +0 -1
- package/dist/src/agents/agentLoader.test.d.ts +0 -6
- package/dist/src/agents/agentLoader.test.js +0 -304
- package/dist/src/agents/agentLoader.test.js.map +0 -1
- package/dist/src/agents/cli-help-agent.test.d.ts +0 -6
- package/dist/src/agents/cli-help-agent.test.js +0 -67
- package/dist/src/agents/cli-help-agent.test.js.map +0 -1
- package/dist/src/agents/codebase-investigator.test.d.ts +0 -6
- package/dist/src/agents/codebase-investigator.test.js +0 -42
- package/dist/src/agents/codebase-investigator.test.js.map +0 -1
- package/dist/src/agents/generalist-agent.test.d.ts +0 -6
- package/dist/src/agents/generalist-agent.test.js +0 -31
- package/dist/src/agents/generalist-agent.test.js.map +0 -1
- package/dist/src/agents/local-executor.test.d.ts +0 -6
- package/dist/src/agents/local-executor.test.js +0 -1577
- package/dist/src/agents/local-executor.test.js.map +0 -1
- package/dist/src/agents/local-invocation.test.d.ts +0 -6
- package/dist/src/agents/local-invocation.test.js +0 -228
- package/dist/src/agents/local-invocation.test.js.map +0 -1
- package/dist/src/agents/registry.test.d.ts +0 -6
- package/dist/src/agents/registry.test.js +0 -773
- package/dist/src/agents/registry.test.js.map +0 -1
- package/dist/src/agents/registry_acknowledgement.test.d.ts +0 -6
- package/dist/src/agents/registry_acknowledgement.test.js +0 -130
- package/dist/src/agents/registry_acknowledgement.test.js.map +0 -1
- package/dist/src/agents/remote-invocation.test.d.ts +0 -6
- package/dist/src/agents/remote-invocation.test.js +0 -213
- package/dist/src/agents/remote-invocation.test.js.map +0 -1
- package/dist/src/agents/subagent-tool-wrapper.test.d.ts +0 -6
- package/dist/src/agents/subagent-tool-wrapper.test.js +0 -109
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +0 -1
- package/dist/src/agents/utils.test.d.ts +0 -6
- package/dist/src/agents/utils.test.js +0 -87
- package/dist/src/agents/utils.test.js.map +0 -1
- package/dist/src/availability/fallbackIntegration.test.d.ts +0 -6
- package/dist/src/availability/fallbackIntegration.test.js +0 -58
- package/dist/src/availability/fallbackIntegration.test.js.map +0 -1
- package/dist/src/availability/modelAvailabilityService.test.d.ts +0 -6
- package/dist/src/availability/modelAvailabilityService.test.js +0 -140
- package/dist/src/availability/modelAvailabilityService.test.js.map +0 -1
- package/dist/src/availability/policyCatalog.test.d.ts +0 -6
- package/dist/src/availability/policyCatalog.test.js +0 -70
- package/dist/src/availability/policyCatalog.test.js.map +0 -1
- package/dist/src/availability/policyHelpers.test.d.ts +0 -6
- package/dist/src/availability/policyHelpers.test.js +0 -220
- package/dist/src/availability/policyHelpers.test.js.map +0 -1
- package/dist/src/code_assist/admin/admin_controls.test.d.ts +0 -6
- package/dist/src/code_assist/admin/admin_controls.test.js +0 -200
- package/dist/src/code_assist/admin/admin_controls.test.js.map +0 -1
- package/dist/src/code_assist/codeAssist.test.d.ts +0 -6
- package/dist/src/code_assist/codeAssist.test.js +0 -102
- package/dist/src/code_assist/codeAssist.test.js.map +0 -1
- package/dist/src/code_assist/converter.test.d.ts +0 -6
- package/dist/src/code_assist/converter.test.js +0 -391
- package/dist/src/code_assist/converter.test.js.map +0 -1
- package/dist/src/code_assist/experiments/client_metadata.test.d.ts +0 -6
- package/dist/src/code_assist/experiments/client_metadata.test.js +0 -96
- package/dist/src/code_assist/experiments/client_metadata.test.js.map +0 -1
- package/dist/src/code_assist/experiments/experiments.test.d.ts +0 -6
- package/dist/src/code_assist/experiments/experiments.test.js +0 -93
- package/dist/src/code_assist/experiments/experiments.test.js.map +0 -1
- package/dist/src/code_assist/experiments/experiments_local.test.d.ts +0 -6
- package/dist/src/code_assist/experiments/experiments_local.test.js +0 -115
- package/dist/src/code_assist/experiments/experiments_local.test.js.map +0 -1
- package/dist/src/code_assist/oauth-credential-storage.test.d.ts +0 -6
- package/dist/src/code_assist/oauth-credential-storage.test.js +0 -198
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +0 -1
- package/dist/src/code_assist/oauth2.test.d.ts +0 -6
- package/dist/src/code_assist/oauth2.test.js +0 -1065
- package/dist/src/code_assist/oauth2.test.js.map +0 -1
- package/dist/src/code_assist/server.test.d.ts +0 -6
- package/dist/src/code_assist/server.test.js +0 -453
- package/dist/src/code_assist/server.test.js.map +0 -1
- package/dist/src/code_assist/setup.test.d.ts +0 -6
- package/dist/src/code_assist/setup.test.js +0 -517
- package/dist/src/code_assist/setup.test.js.map +0 -1
- package/dist/src/code_assist/telemetry.test.d.ts +0 -6
- package/dist/src/code_assist/telemetry.test.js +0 -301
- package/dist/src/code_assist/telemetry.test.js.map +0 -1
- package/dist/src/commands/extensions.test.d.ts +0 -6
- package/dist/src/commands/extensions.test.js +0 -19
- package/dist/src/commands/extensions.test.js.map +0 -1
- package/dist/src/commands/init.test.d.ts +0 -6
- package/dist/src/commands/init.test.js +0 -25
- package/dist/src/commands/init.test.js.map +0 -1
- package/dist/src/commands/memory.test.d.ts +0 -6
- package/dist/src/commands/memory.test.js +0 -182
- package/dist/src/commands/memory.test.js.map +0 -1
- package/dist/src/commands/restore.test.d.ts +0 -6
- package/dist/src/commands/restore.test.js +0 -137
- package/dist/src/commands/restore.test.js.map +0 -1
- package/dist/src/config/config.test.d.ts +0 -6
- package/dist/src/config/config.test.js +0 -1811
- package/dist/src/config/config.test.js.map +0 -1
- package/dist/src/config/flashFallback.test.d.ts +0 -6
- package/dist/src/config/flashFallback.test.js +0 -63
- package/dist/src/config/flashFallback.test.js.map +0 -1
- package/dist/src/config/models.test.d.ts +0 -6
- package/dist/src/config/models.test.js +0 -146
- package/dist/src/config/models.test.js.map +0 -1
- package/dist/src/config/storage.test.d.ts +0 -6
- package/dist/src/config/storage.test.js +0 -115
- package/dist/src/config/storage.test.js.map +0 -1
- package/dist/src/confirmation-bus/message-bus.test.d.ts +0 -6
- package/dist/src/confirmation-bus/message-bus.test.js +0 -170
- package/dist/src/confirmation-bus/message-bus.test.js.map +0 -1
- package/dist/src/core/apiKeyCredentialStorage.test.d.ts +0 -6
- package/dist/src/core/apiKeyCredentialStorage.test.js +0 -71
- package/dist/src/core/apiKeyCredentialStorage.test.js.map +0 -1
- package/dist/src/core/baseLlmClient.test.d.ts +0 -6
- package/dist/src/core/baseLlmClient.test.js +0 -569
- package/dist/src/core/baseLlmClient.test.js.map +0 -1
- package/dist/src/core/baseLlmClient_new_types.test.d.ts +0 -1
- package/dist/src/core/baseLlmClient_new_types.test.js +0 -387
- package/dist/src/core/baseLlmClient_new_types.test.js.map +0 -1
- package/dist/src/core/client.test.d.ts +0 -6
- package/dist/src/core/client.test.js +0 -2654
- package/dist/src/core/client.test.js.map +0 -1
- package/dist/src/core/contentGenerator.multiProvider.test.d.ts +0 -6
- package/dist/src/core/contentGenerator.multiProvider.test.js +0 -314
- package/dist/src/core/contentGenerator.multiProvider.test.js.map +0 -1
- package/dist/src/core/contentGenerator.test.d.ts +0 -6
- package/dist/src/core/contentGenerator.test.js +0 -299
- package/dist/src/core/contentGenerator.test.js.map +0 -1
- package/dist/src/core/contentGenerator_new_types.test.d.ts +0 -6
- package/dist/src/core/contentGenerator_new_types.test.js +0 -292
- package/dist/src/core/contentGenerator_new_types.test.js.map +0 -1
- package/dist/src/core/coreToolHookTriggers.test.d.ts +0 -6
- package/dist/src/core/coreToolHookTriggers.test.js +0 -159
- package/dist/src/core/coreToolHookTriggers.test.js.map +0 -1
- package/dist/src/core/coreToolScheduler.test.d.ts +0 -6
- package/dist/src/core/coreToolScheduler.test.js +0 -1684
- package/dist/src/core/coreToolScheduler.test.js.map +0 -1
- package/dist/src/core/fakeContentGenerator.test.d.ts +0 -6
- package/dist/src/core/fakeContentGenerator.test.js +0 -127
- package/dist/src/core/fakeContentGenerator.test.js.map +0 -1
- package/dist/src/core/geminiChat.test.d.ts +0 -6
- package/dist/src/core/geminiChat.test.js +0 -1773
- package/dist/src/core/geminiChat.test.js.map +0 -1
- package/dist/src/core/geminiChat_network_retry.test.d.ts +0 -6
- package/dist/src/core/geminiChat_network_retry.test.js +0 -201
- package/dist/src/core/geminiChat_network_retry.test.js.map +0 -1
- package/dist/src/core/logger.test.d.ts +0 -6
- package/dist/src/core/logger.test.js +0 -550
- package/dist/src/core/logger.test.js.map +0 -1
- package/dist/src/core/loggingContentGenerator.test.d.ts +0 -6
- package/dist/src/core/loggingContentGenerator.test.js +0 -221
- package/dist/src/core/loggingContentGenerator.test.js.map +0 -1
- package/dist/src/core/prompts-substitution.test.d.ts +0 -6
- package/dist/src/core/prompts-substitution.test.js +0 -101
- package/dist/src/core/prompts-substitution.test.js.map +0 -1
- package/dist/src/core/prompts.test.d.ts +0 -6
- package/dist/src/core/prompts.test.js +0 -391
- package/dist/src/core/prompts.test.js.map +0 -1
- package/dist/src/core/recordingContentGenerator.test.d.ts +0 -6
- package/dist/src/core/recordingContentGenerator.test.js +0 -101
- package/dist/src/core/recordingContentGenerator.test.js.map +0 -1
- package/dist/src/core/tokenLimits.test.d.ts +0 -6
- package/dist/src/core/tokenLimits.test.js +0 -30
- package/dist/src/core/tokenLimits.test.js.map +0 -1
- package/dist/src/core/turn.test.d.ts +0 -6
- package/dist/src/core/turn.test.js +0 -739
- package/dist/src/core/turn.test.js.map +0 -1
- package/dist/src/fallback/handler.test.d.ts +0 -6
- package/dist/src/fallback/handler.test.js +0 -242
- package/dist/src/fallback/handler.test.js.map +0 -1
- package/dist/src/hooks/hookAggregator.test.d.ts +0 -6
- package/dist/src/hooks/hookAggregator.test.js +0 -387
- package/dist/src/hooks/hookAggregator.test.js.map +0 -1
- package/dist/src/hooks/hookEventHandler.test.d.ts +0 -6
- package/dist/src/hooks/hookEventHandler.test.js +0 -603
- package/dist/src/hooks/hookEventHandler.test.js.map +0 -1
- package/dist/src/hooks/hookPlanner.test.d.ts +0 -6
- package/dist/src/hooks/hookPlanner.test.js +0 -315
- package/dist/src/hooks/hookPlanner.test.js.map +0 -1
- package/dist/src/hooks/hookRegistry.test.d.ts +0 -6
- package/dist/src/hooks/hookRegistry.test.js +0 -529
- package/dist/src/hooks/hookRegistry.test.js.map +0 -1
- package/dist/src/hooks/hookRunner.test.d.ts +0 -6
- package/dist/src/hooks/hookRunner.test.js +0 -606
- package/dist/src/hooks/hookRunner.test.js.map +0 -1
- package/dist/src/hooks/hookSystem.test.d.ts +0 -6
- package/dist/src/hooks/hookSystem.test.js +0 -330
- package/dist/src/hooks/hookSystem.test.js.map +0 -1
- package/dist/src/hooks/hookSystem_new_types.test.d.ts +0 -6
- package/dist/src/hooks/hookSystem_new_types.test.js +0 -243
- package/dist/src/hooks/hookSystem_new_types.test.js.map +0 -1
- package/dist/src/hooks/hookTranslator.test.d.ts +0 -6
- package/dist/src/hooks/hookTranslator.test.js +0 -192
- package/dist/src/hooks/hookTranslator.test.js.map +0 -1
- package/dist/src/hooks/trustedHooks.test.d.ts +0 -6
- package/dist/src/hooks/trustedHooks.test.js +0 -154
- package/dist/src/hooks/trustedHooks.test.js.map +0 -1
- package/dist/src/hooks/types.test.d.ts +0 -6
- package/dist/src/hooks/types.test.js +0 -278
- package/dist/src/hooks/types.test.js.map +0 -1
- package/dist/src/ide/detect-ide.test.d.ts +0 -6
- package/dist/src/ide/detect-ide.test.js +0 -195
- package/dist/src/ide/detect-ide.test.js.map +0 -1
- package/dist/src/ide/ide-client.test.d.ts +0 -6
- package/dist/src/ide/ide-client.test.js +0 -753
- package/dist/src/ide/ide-client.test.js.map +0 -1
- package/dist/src/ide/ide-installer.test.d.ts +0 -6
- package/dist/src/ide/ide-installer.test.js +0 -193
- package/dist/src/ide/ide-installer.test.js.map +0 -1
- package/dist/src/ide/ideContext.test.d.ts +0 -6
- package/dist/src/ide/ideContext.test.js +0 -393
- package/dist/src/ide/ideContext.test.js.map +0 -1
- package/dist/src/ide/process-utils.test.d.ts +0 -6
- package/dist/src/ide/process-utils.test.js +0 -151
- package/dist/src/ide/process-utils.test.js.map +0 -1
- package/dist/src/index.test.d.ts +0 -6
- package/dist/src/index.test.js +0 -53
- package/dist/src/index.test.js.map +0 -1
- package/dist/src/mcp/google-auth-provider.test.d.ts +0 -6
- package/dist/src/mcp/google-auth-provider.test.js +0 -167
- package/dist/src/mcp/google-auth-provider.test.js.map +0 -1
- package/dist/src/mcp/oauth-provider.test.d.ts +0 -6
- package/dist/src/mcp/oauth-provider.test.js +0 -1355
- package/dist/src/mcp/oauth-provider.test.js.map +0 -1
- package/dist/src/mcp/oauth-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/oauth-token-storage.test.js +0 -305
- package/dist/src/mcp/oauth-token-storage.test.js.map +0 -1
- package/dist/src/mcp/oauth-utils.test.d.ts +0 -6
- package/dist/src/mcp/oauth-utils.test.js +0 -289
- package/dist/src/mcp/oauth-utils.test.js.map +0 -1
- package/dist/src/mcp/sa-impersonation-provider.test.d.ts +0 -6
- package/dist/src/mcp/sa-impersonation-provider.test.js +0 -117
- package/dist/src/mcp/sa-impersonation-provider.test.js.map +0 -1
- package/dist/src/mcp/token-storage/base-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/token-storage/base-token-storage.test.js +0 -151
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +0 -1
- package/dist/src/mcp/token-storage/file-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/token-storage/file-token-storage.test.js +0 -238
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +0 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +0 -193
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +0 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +0 -305
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +0 -1
- package/dist/src/output/json-formatter.test.d.ts +0 -6
- package/dist/src/output/json-formatter.test.js +0 -294
- package/dist/src/output/json-formatter.test.js.map +0 -1
- package/dist/src/output/stream-json-formatter.test.d.ts +0 -6
- package/dist/src/output/stream-json-formatter.test.js +0 -477
- package/dist/src/output/stream-json-formatter.test.js.map +0 -1
- package/dist/src/policy/config.test.d.ts +0 -6
- package/dist/src/policy/config.test.js +0 -598
- package/dist/src/policy/config.test.js.map +0 -1
- package/dist/src/policy/persistence.test.d.ts +0 -6
- package/dist/src/policy/persistence.test.js +0 -154
- package/dist/src/policy/persistence.test.js.map +0 -1
- package/dist/src/policy/policy-engine.test.d.ts +0 -6
- package/dist/src/policy/policy-engine.test.js +0 -1299
- package/dist/src/policy/policy-engine.test.js.map +0 -1
- package/dist/src/policy/policy-updater.test.d.ts +0 -6
- package/dist/src/policy/policy-updater.test.js +0 -116
- package/dist/src/policy/policy-updater.test.js.map +0 -1
- package/dist/src/policy/shell-safety.test.d.ts +0 -6
- package/dist/src/policy/shell-safety.test.js +0 -438
- package/dist/src/policy/shell-safety.test.js.map +0 -1
- package/dist/src/policy/toml-loader.test.d.ts +0 -6
- package/dist/src/policy/toml-loader.test.js +0 -409
- package/dist/src/policy/toml-loader.test.js.map +0 -1
- package/dist/src/policy/utils.test.d.ts +0 -6
- package/dist/src/policy/utils.test.js +0 -92
- package/dist/src/policy/utils.test.js.map +0 -1
- package/dist/src/prompts/mcp-prompts.test.d.ts +0 -6
- package/dist/src/prompts/mcp-prompts.test.js +0 -39
- package/dist/src/prompts/mcp-prompts.test.js.map +0 -1
- package/dist/src/prompts/prompt-registry.test.d.ts +0 -6
- package/dist/src/prompts/prompt-registry.test.js +0 -96
- package/dist/src/prompts/prompt-registry.test.js.map +0 -1
- package/dist/src/providers/__tests__/bundleSize.test.d.ts +0 -6
- package/dist/src/providers/__tests__/bundleSize.test.js +0 -75
- package/dist/src/providers/__tests__/bundleSize.test.js.map +0 -1
- package/dist/src/providers/__tests__/errorHandling.integration.test.d.ts +0 -6
- package/dist/src/providers/__tests__/errorHandling.integration.test.js +0 -339
- package/dist/src/providers/__tests__/errorHandling.integration.test.js.map +0 -1
- package/dist/src/providers/__tests__/multiProvider.integration.test.d.ts +0 -6
- package/dist/src/providers/__tests__/multiProvider.integration.test.js +0 -419
- package/dist/src/providers/__tests__/multiProvider.integration.test.js.map +0 -1
- package/dist/src/providers/__tests__/performance.test.d.ts +0 -6
- package/dist/src/providers/__tests__/performance.test.js +0 -270
- package/dist/src/providers/__tests__/performance.test.js.map +0 -1
- package/dist/src/providers/__tests__/providerConfigIntegration.test.d.ts +0 -6
- package/dist/src/providers/__tests__/providerConfigIntegration.test.js +0 -245
- package/dist/src/providers/__tests__/providerConfigIntegration.test.js.map +0 -1
- package/dist/src/providers/baseAdapter.test.d.ts +0 -1
- package/dist/src/providers/baseAdapter.test.js +0 -142
- package/dist/src/providers/baseAdapter.test.js.map +0 -1
- package/dist/src/providers/claude/adapter.test.d.ts +0 -6
- package/dist/src/providers/claude/adapter.test.js +0 -628
- package/dist/src/providers/claude/adapter.test.js.map +0 -1
- package/dist/src/providers/claude/bootstrap.test.d.ts +0 -6
- package/dist/src/providers/claude/bootstrap.test.js +0 -74
- package/dist/src/providers/claude/bootstrap.test.js.map +0 -1
- package/dist/src/providers/claude/converter.test.d.ts +0 -6
- package/dist/src/providers/claude/converter.test.js +0 -1002
- package/dist/src/providers/claude/converter.test.js.map +0 -1
- package/dist/src/providers/claude/exports.test.d.ts +0 -6
- package/dist/src/providers/claude/exports.test.js +0 -40
- package/dist/src/providers/claude/exports.test.js.map +0 -1
- package/dist/src/providers/configAdapter.test.d.ts +0 -1
- package/dist/src/providers/configAdapter.test.js +0 -150
- package/dist/src/providers/configAdapter.test.js.map +0 -1
- package/dist/src/providers/contentResolver.test.d.ts +0 -1
- package/dist/src/providers/contentResolver.test.js +0 -89
- package/dist/src/providers/contentResolver.test.js.map +0 -1
- package/dist/src/providers/factory.test.d.ts +0 -1
- package/dist/src/providers/factory.test.js +0 -151
- package/dist/src/providers/factory.test.js.map +0 -1
- package/dist/src/providers/gemini/adapterBridge.test.d.ts +0 -6
- package/dist/src/providers/gemini/adapterBridge.test.js +0 -164
- package/dist/src/providers/gemini/adapterBridge.test.js.map +0 -1
- package/dist/src/providers/gemini/bootstrap.test.d.ts +0 -6
- package/dist/src/providers/gemini/bootstrap.test.js +0 -72
- package/dist/src/providers/gemini/bootstrap.test.js.map +0 -1
- package/dist/src/providers/gemini/configConverter.test.d.ts +0 -6
- package/dist/src/providers/gemini/configConverter.test.js +0 -218
- package/dist/src/providers/gemini/configConverter.test.js.map +0 -1
- package/dist/src/providers/gemini/errorClassifier.test.d.ts +0 -6
- package/dist/src/providers/gemini/errorClassifier.test.js +0 -83
- package/dist/src/providers/gemini/errorClassifier.test.js.map +0 -1
- package/dist/src/providers/gemini/eventMapper.test.d.ts +0 -6
- package/dist/src/providers/gemini/eventMapper.test.js +0 -502
- package/dist/src/providers/gemini/eventMapper.test.js.map +0 -1
- package/dist/src/providers/gemini/exports.test.d.ts +0 -6
- package/dist/src/providers/gemini/exports.test.js +0 -90
- package/dist/src/providers/gemini/exports.test.js.map +0 -1
- package/dist/src/providers/gemini/featureFlag.test.d.ts +0 -6
- package/dist/src/providers/gemini/featureFlag.test.js +0 -139
- package/dist/src/providers/gemini/featureFlag.test.js.map +0 -1
- package/dist/src/providers/gemini/geminiAdapter.test.d.ts +0 -6
- package/dist/src/providers/gemini/geminiAdapter.test.js +0 -279
- package/dist/src/providers/gemini/geminiAdapter.test.js.map +0 -1
- package/dist/src/providers/gemini/geminiConverter.test.d.ts +0 -6
- package/dist/src/providers/gemini/geminiConverter.test.js +0 -474
- package/dist/src/providers/gemini/geminiConverter.test.js.map +0 -1
- package/dist/src/providers/gemini/geminiParity.test.d.ts +0 -6
- package/dist/src/providers/gemini/geminiParity.test.js +0 -754
- package/dist/src/providers/gemini/geminiParity.test.js.map +0 -1
- package/dist/src/providers/gemini/geminiStream.test.d.ts +0 -6
- package/dist/src/providers/gemini/geminiStream.test.js +0 -391
- package/dist/src/providers/gemini/geminiStream.test.js.map +0 -1
- package/dist/src/providers/gemini/historyBuilder.test.d.ts +0 -6
- package/dist/src/providers/gemini/historyBuilder.test.js +0 -207
- package/dist/src/providers/gemini/historyBuilder.test.js.map +0 -1
- package/dist/src/providers/gemini/requestBuilder.test.d.ts +0 -6
- package/dist/src/providers/gemini/requestBuilder.test.js +0 -358
- package/dist/src/providers/gemini/requestBuilder.test.js.map +0 -1
- package/dist/src/providers/gemini/streamConverter.test.d.ts +0 -6
- package/dist/src/providers/gemini/streamConverter.test.js +0 -131
- package/dist/src/providers/gemini/streamConverter.test.js.map +0 -1
- package/dist/src/providers/modelSpec.test.d.ts +0 -1
- package/dist/src/providers/modelSpec.test.js +0 -119
- package/dist/src/providers/modelSpec.test.js.map +0 -1
- package/dist/src/providers/openai/adapter.test.d.ts +0 -6
- package/dist/src/providers/openai/adapter.test.js +0 -274
- package/dist/src/providers/openai/adapter.test.js.map +0 -1
- package/dist/src/providers/openai/bootstrap.test.d.ts +0 -6
- package/dist/src/providers/openai/bootstrap.test.js +0 -76
- package/dist/src/providers/openai/bootstrap.test.js.map +0 -1
- package/dist/src/providers/openai/converter.test.d.ts +0 -6
- package/dist/src/providers/openai/converter.test.js +0 -1133
- package/dist/src/providers/openai/converter.test.js.map +0 -1
- package/dist/src/providers/openai-compatible/__tests__/compatibility.test.d.ts +0 -6
- package/dist/src/providers/openai-compatible/__tests__/compatibility.test.js +0 -356
- package/dist/src/providers/openai-compatible/__tests__/compatibility.test.js.map +0 -1
- package/dist/src/providers/openai-compatible/adapter.test.d.ts +0 -6
- package/dist/src/providers/openai-compatible/adapter.test.js +0 -240
- package/dist/src/providers/openai-compatible/adapter.test.js.map +0 -1
- package/dist/src/providers/openai-compatible/bootstrap.test.d.ts +0 -6
- package/dist/src/providers/openai-compatible/bootstrap.test.js +0 -145
- package/dist/src/providers/openai-compatible/bootstrap.test.js.map +0 -1
- package/dist/src/providers/openai-compatible/promptBuilder.test.d.ts +0 -6
- package/dist/src/providers/openai-compatible/promptBuilder.test.js +0 -154
- package/dist/src/providers/openai-compatible/promptBuilder.test.js.map +0 -1
- package/dist/src/providers/providerConfig.test.d.ts +0 -1
- package/dist/src/providers/providerConfig.test.js +0 -145
- package/dist/src/providers/providerConfig.test.js.map +0 -1
- package/dist/src/providers/providerConfigIntegration.test.d.ts +0 -6
- package/dist/src/providers/providerConfigIntegration.test.js +0 -187
- package/dist/src/providers/providerConfigIntegration.test.js.map +0 -1
- package/dist/src/providers/providerSelector.test.d.ts +0 -1
- package/dist/src/providers/providerSelector.test.js +0 -199
- package/dist/src/providers/providerSelector.test.js.map +0 -1
- package/dist/src/providers/providerTypes.test.d.ts +0 -1
- package/dist/src/providers/providerTypes.test.js +0 -95
- package/dist/src/providers/providerTypes.test.js.map +0 -1
- package/dist/src/providers/registry.test.d.ts +0 -1
- package/dist/src/providers/registry.test.js +0 -207
- package/dist/src/providers/registry.test.js.map +0 -1
- package/dist/src/providers/streamAssembler.test.d.ts +0 -1
- package/dist/src/providers/streamAssembler.test.js +0 -247
- package/dist/src/providers/streamAssembler.test.js.map +0 -1
- package/dist/src/providers/telemetryBridge.test.d.ts +0 -6
- package/dist/src/providers/telemetryBridge.test.js +0 -235
- package/dist/src/providers/telemetryBridge.test.js.map +0 -1
- package/dist/src/providers/types.test.d.ts +0 -6
- package/dist/src/providers/types.test.js +0 -253
- package/dist/src/providers/types.test.js.map +0 -1
- package/dist/src/resources/resource-registry.test.d.ts +0 -6
- package/dist/src/resources/resource-registry.test.js +0 -54
- package/dist/src/resources/resource-registry.test.js.map +0 -1
- package/dist/src/routing/modelRouterService.test.d.ts +0 -6
- package/dist/src/routing/modelRouterService.test.js +0 -106
- package/dist/src/routing/modelRouterService.test.js.map +0 -1
- package/dist/src/routing/strategies/classifierStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/classifierStrategy.test.js +0 -249
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/compositeStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/compositeStrategy.test.js +0 -124
- package/dist/src/routing/strategies/compositeStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/defaultStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/defaultStrategy.test.js +0 -102
- package/dist/src/routing/strategies/defaultStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/fallbackStrategy.test.js +0 -96
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.js +0 -367
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/overrideStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/overrideStrategy.test.js +0 -59
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +0 -1
- package/dist/src/safety/built-in.test.d.ts +0 -6
- package/dist/src/safety/built-in.test.js +0 -199
- package/dist/src/safety/built-in.test.js.map +0 -1
- package/dist/src/safety/checker-runner.test.d.ts +0 -6
- package/dist/src/safety/checker-runner.test.js +0 -238
- package/dist/src/safety/checker-runner.test.js.map +0 -1
- package/dist/src/safety/context-builder.test.d.ts +0 -6
- package/dist/src/safety/context-builder.test.js +0 -49
- package/dist/src/safety/context-builder.test.js.map +0 -1
- package/dist/src/safety/registry.test.d.ts +0 -6
- package/dist/src/safety/registry.test.js +0 -31
- package/dist/src/safety/registry.test.js.map +0 -1
- package/dist/src/scheduler/confirmation.test.d.ts +0 -6
- package/dist/src/scheduler/confirmation.test.js +0 -325
- package/dist/src/scheduler/confirmation.test.js.map +0 -1
- package/dist/src/scheduler/policy.test.d.ts +0 -6
- package/dist/src/scheduler/policy.test.js +0 -299
- package/dist/src/scheduler/policy.test.js.map +0 -1
- package/dist/src/scheduler/scheduler.test.d.ts +0 -6
- package/dist/src/scheduler/scheduler.test.js +0 -822
- package/dist/src/scheduler/scheduler.test.js.map +0 -1
- package/dist/src/scheduler/state-manager.test.d.ts +0 -6
- package/dist/src/scheduler/state-manager.test.js +0 -429
- package/dist/src/scheduler/state-manager.test.js.map +0 -1
- package/dist/src/scheduler/tool-executor.test.d.ts +0 -6
- package/dist/src/scheduler/tool-executor.test.js +0 -232
- package/dist/src/scheduler/tool-executor.test.js.map +0 -1
- package/dist/src/scheduler/tool-modifier.test.d.ts +0 -6
- package/dist/src/scheduler/tool-modifier.test.js +0 -159
- package/dist/src/scheduler/tool-modifier.test.js.map +0 -1
- package/dist/src/services/chatCompressionService.test.d.ts +0 -6
- package/dist/src/services/chatCompressionService.test.js +0 -573
- package/dist/src/services/chatCompressionService.test.js.map +0 -1
- package/dist/src/services/chatRecordingService.test.d.ts +0 -6
- package/dist/src/services/chatRecordingService.test.js +0 -486
- package/dist/src/services/chatRecordingService.test.js.map +0 -1
- package/dist/src/services/contextManager.test.d.ts +0 -6
- package/dist/src/services/contextManager.test.js +0 -104
- package/dist/src/services/contextManager.test.js.map +0 -1
- package/dist/src/services/environmentSanitization.test.d.ts +0 -6
- package/dist/src/services/environmentSanitization.test.js +0 -284
- package/dist/src/services/environmentSanitization.test.js.map +0 -1
- package/dist/src/services/fileDiscoveryService.test.d.ts +0 -6
- package/dist/src/services/fileDiscoveryService.test.js +0 -223
- package/dist/src/services/fileDiscoveryService.test.js.map +0 -1
- package/dist/src/services/fileSystemService.test.d.ts +0 -6
- package/dist/src/services/fileSystemService.test.js +0 -41
- package/dist/src/services/fileSystemService.test.js.map +0 -1
- package/dist/src/services/gitService.test.d.ts +0 -6
- package/dist/src/services/gitService.test.js +0 -264
- package/dist/src/services/gitService.test.js.map +0 -1
- package/dist/src/services/loopDetectionService.test.d.ts +0 -6
- package/dist/src/services/loopDetectionService.test.js +0 -881
- package/dist/src/services/loopDetectionService.test.js.map +0 -1
- package/dist/src/services/modelConfig.golden.test.d.ts +0 -6
- package/dist/src/services/modelConfig.golden.test.js +0 -74
- package/dist/src/services/modelConfig.golden.test.js.map +0 -1
- package/dist/src/services/modelConfig.integration.test.d.ts +0 -6
- package/dist/src/services/modelConfig.integration.test.js +0 -247
- package/dist/src/services/modelConfig.integration.test.js.map +0 -1
- package/dist/src/services/modelConfigBridge.test.d.ts +0 -6
- package/dist/src/services/modelConfigBridge.test.js +0 -410
- package/dist/src/services/modelConfigBridge.test.js.map +0 -1
- package/dist/src/services/modelConfigService.test.d.ts +0 -6
- package/dist/src/services/modelConfigService.test.js +0 -868
- package/dist/src/services/modelConfigService.test.js.map +0 -1
- package/dist/src/services/sessionSummaryService.test.d.ts +0 -6
- package/dist/src/services/sessionSummaryService.test.js +0 -785
- package/dist/src/services/sessionSummaryService.test.js.map +0 -1
- package/dist/src/services/sessionSummaryUtils.test.d.ts +0 -6
- package/dist/src/services/sessionSummaryUtils.test.js +0 -160
- package/dist/src/services/sessionSummaryUtils.test.js.map +0 -1
- package/dist/src/services/shellExecutionService.test.d.ts +0 -6
- package/dist/src/services/shellExecutionService.test.js +0 -1080
- package/dist/src/services/shellExecutionService.test.js.map +0 -1
- package/dist/src/skills/skillLoader.test.d.ts +0 -6
- package/dist/src/skills/skillLoader.test.js +0 -185
- package/dist/src/skills/skillLoader.test.js.map +0 -1
- package/dist/src/skills/skillManager.test.d.ts +0 -6
- package/dist/src/skills/skillManager.test.js +0 -297
- package/dist/src/skills/skillManager.test.js.map +0 -1
- package/dist/src/telemetry/activity-detector.test.d.ts +0 -6
- package/dist/src/telemetry/activity-detector.test.js +0 -136
- package/dist/src/telemetry/activity-detector.test.js.map +0 -1
- package/dist/src/telemetry/activity-monitor.test.d.ts +0 -6
- package/dist/src/telemetry/activity-monitor.test.js +0 -251
- package/dist/src/telemetry/activity-monitor.test.js.map +0 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +0 -19
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +0 -964
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +0 -1
- package/dist/src/telemetry/config.test.d.ts +0 -6
- package/dist/src/telemetry/config.test.js +0 -149
- package/dist/src/telemetry/config.test.js.map +0 -1
- package/dist/src/telemetry/gcp-exporters.test.d.ts +0 -6
- package/dist/src/telemetry/gcp-exporters.test.js +0 -318
- package/dist/src/telemetry/gcp-exporters.test.js.map +0 -1
- package/dist/src/telemetry/high-water-mark-tracker.test.d.ts +0 -6
- package/dist/src/telemetry/high-water-mark-tracker.test.js +0 -152
- package/dist/src/telemetry/high-water-mark-tracker.test.js.map +0 -1
- package/dist/src/telemetry/integration.test.circular.d.ts +0 -6
- package/dist/src/telemetry/integration.test.circular.js +0 -54
- package/dist/src/telemetry/integration.test.circular.js.map +0 -1
- package/dist/src/telemetry/loggers.test.circular.d.ts +0 -6
- package/dist/src/telemetry/loggers.test.circular.js +0 -107
- package/dist/src/telemetry/loggers.test.circular.js.map +0 -1
- package/dist/src/telemetry/loggers.test.d.ts +0 -6
- package/dist/src/telemetry/loggers.test.js +0 -1618
- package/dist/src/telemetry/loggers.test.js.map +0 -1
- package/dist/src/telemetry/memory-monitor.test.d.ts +0 -6
- package/dist/src/telemetry/memory-monitor.test.js +0 -472
- package/dist/src/telemetry/memory-monitor.test.js.map +0 -1
- package/dist/src/telemetry/metrics.test.d.ts +0 -6
- package/dist/src/telemetry/metrics.test.js +0 -1176
- package/dist/src/telemetry/metrics.test.js.map +0 -1
- package/dist/src/telemetry/rate-limiter.test.d.ts +0 -6
- package/dist/src/telemetry/rate-limiter.test.js +0 -207
- package/dist/src/telemetry/rate-limiter.test.js.map +0 -1
- package/dist/src/telemetry/sanitize.test.d.ts +0 -6
- package/dist/src/telemetry/sanitize.test.js +0 -279
- package/dist/src/telemetry/sanitize.test.js.map +0 -1
- package/dist/src/telemetry/sdk.test.d.ts +0 -6
- package/dist/src/telemetry/sdk.test.js +0 -360
- package/dist/src/telemetry/sdk.test.js.map +0 -1
- package/dist/src/telemetry/semantic.test.d.ts +0 -6
- package/dist/src/telemetry/semantic.test.js +0 -387
- package/dist/src/telemetry/semantic.test.js.map +0 -1
- package/dist/src/telemetry/semantic.truncation.test.d.ts +0 -1
- package/dist/src/telemetry/semantic.truncation.test.js +0 -92
- package/dist/src/telemetry/semantic.truncation.test.js.map +0 -1
- package/dist/src/telemetry/startupProfiler.test.d.ts +0 -6
- package/dist/src/telemetry/startupProfiler.test.js +0 -285
- package/dist/src/telemetry/startupProfiler.test.js.map +0 -1
- package/dist/src/telemetry/telemetry-utils.test.d.ts +0 -6
- package/dist/src/telemetry/telemetry-utils.test.js +0 -41
- package/dist/src/telemetry/telemetry-utils.test.js.map +0 -1
- package/dist/src/telemetry/telemetry.test.d.ts +0 -6
- package/dist/src/telemetry/telemetry.test.js +0 -57
- package/dist/src/telemetry/telemetry.test.js.map +0 -1
- package/dist/src/telemetry/uiTelemetry.test.d.ts +0 -6
- package/dist/src/telemetry/uiTelemetry.test.js +0 -584
- package/dist/src/telemetry/uiTelemetry.test.js.map +0 -1
- package/dist/src/tools/activate-skill.test.d.ts +0 -6
- package/dist/src/tools/activate-skill.test.js +0 -113
- package/dist/src/tools/activate-skill.test.js.map +0 -1
- package/dist/src/tools/ask-user.test.d.ts +0 -6
- package/dist/src/tools/ask-user.test.js +0 -187
- package/dist/src/tools/ask-user.test.js.map +0 -1
- package/dist/src/tools/base-tool-invocation.test.d.ts +0 -6
- package/dist/src/tools/base-tool-invocation.test.js +0 -85
- package/dist/src/tools/base-tool-invocation.test.js.map +0 -1
- package/dist/src/tools/confirmation-policy.test.d.ts +0 -6
- package/dist/src/tools/confirmation-policy.test.js +0 -143
- package/dist/src/tools/confirmation-policy.test.js.map +0 -1
- package/dist/src/tools/diffOptions.test.d.ts +0 -6
- package/dist/src/tools/diffOptions.test.js +0 -172
- package/dist/src/tools/diffOptions.test.js.map +0 -1
- package/dist/src/tools/edit.test.d.ts +0 -6
- package/dist/src/tools/edit.test.js +0 -729
- package/dist/src/tools/edit.test.js.map +0 -1
- package/dist/src/tools/get-internal-docs.test.d.ts +0 -6
- package/dist/src/tools/get-internal-docs.test.js +0 -57
- package/dist/src/tools/get-internal-docs.test.js.map +0 -1
- package/dist/src/tools/glob.test.d.ts +0 -6
- package/dist/src/tools/glob.test.js +0 -433
- package/dist/src/tools/glob.test.js.map +0 -1
- package/dist/src/tools/grep.test.d.ts +0 -6
- package/dist/src/tools/grep.test.js +0 -328
- package/dist/src/tools/grep.test.js.map +0 -1
- package/dist/src/tools/ls.test.d.ts +0 -6
- package/dist/src/tools/ls.test.js +0 -242
- package/dist/src/tools/ls.test.js.map +0 -1
- package/dist/src/tools/mcp-client-manager.test.d.ts +0 -6
- package/dist/src/tools/mcp-client-manager.test.js +0 -251
- package/dist/src/tools/mcp-client-manager.test.js.map +0 -1
- package/dist/src/tools/mcp-client.test.d.ts +0 -6
- package/dist/src/tools/mcp-client.test.js +0 -1346
- package/dist/src/tools/mcp-client.test.js.map +0 -1
- package/dist/src/tools/mcp-tool.test.d.ts +0 -6
- package/dist/src/tools/mcp-tool.test.js +0 -657
- package/dist/src/tools/mcp-tool.test.js.map +0 -1
- package/dist/src/tools/memoryTool.test.d.ts +0 -6
- package/dist/src/tools/memoryTool.test.js +0 -302
- package/dist/src/tools/memoryTool.test.js.map +0 -1
- package/dist/src/tools/message-bus-integration.test.d.ts +0 -6
- package/dist/src/tools/message-bus-integration.test.js +0 -169
- package/dist/src/tools/message-bus-integration.test.js.map +0 -1
- package/dist/src/tools/modifiable-tool.test.d.ts +0 -6
- package/dist/src/tools/modifiable-tool.test.js +0 -237
- package/dist/src/tools/modifiable-tool.test.js.map +0 -1
- package/dist/src/tools/read-file.test.d.ts +0 -6
- package/dist/src/tools/read-file.test.js +0 -376
- package/dist/src/tools/read-file.test.js.map +0 -1
- package/dist/src/tools/read-many-files.test.d.ts +0 -6
- package/dist/src/tools/read-many-files.test.js +0 -567
- package/dist/src/tools/read-many-files.test.js.map +0 -1
- package/dist/src/tools/ripGrep.test.d.ts +0 -6
- package/dist/src/tools/ripGrep.test.js +0 -1139
- package/dist/src/tools/ripGrep.test.js.map +0 -1
- package/dist/src/tools/shell.test.d.ts +0 -6
- package/dist/src/tools/shell.test.js +0 -526
- package/dist/src/tools/shell.test.js.map +0 -1
- package/dist/src/tools/tool-names.test.d.ts +0 -6
- package/dist/src/tools/tool-names.test.js +0 -43
- package/dist/src/tools/tool-names.test.js.map +0 -1
- package/dist/src/tools/tool-registry.test.d.ts +0 -6
- package/dist/src/tools/tool-registry.test.js +0 -461
- package/dist/src/tools/tool-registry.test.js.map +0 -1
- package/dist/src/tools/tools.test.d.ts +0 -6
- package/dist/src/tools/tools.test.js +0 -207
- package/dist/src/tools/tools.test.js.map +0 -1
- package/dist/src/tools/web-fetch.test.d.ts +0 -6
- package/dist/src/tools/web-fetch.test.js +0 -442
- package/dist/src/tools/web-fetch.test.js.map +0 -1
- package/dist/src/tools/web-search.test.d.ts +0 -6
- package/dist/src/tools/web-search.test.js +0 -214
- package/dist/src/tools/web-search.test.js.map +0 -1
- package/dist/src/tools/write-file.test.d.ts +0 -6
- package/dist/src/tools/write-file.test.js +0 -681
- package/dist/src/tools/write-file.test.js.map +0 -1
- package/dist/src/tools/write-todos.test.d.ts +0 -6
- package/dist/src/tools/write-todos.test.js +0 -90
- package/dist/src/tools/write-todos.test.js.map +0 -1
- package/dist/src/utils/apiConversionUtils.test.d.ts +0 -6
- package/dist/src/utils/apiConversionUtils.test.js +0 -150
- package/dist/src/utils/apiConversionUtils.test.js.map +0 -1
- package/dist/src/utils/bfsFileSearch.test.d.ts +0 -6
- package/dist/src/utils/bfsFileSearch.test.js +0 -227
- package/dist/src/utils/bfsFileSearch.test.js.map +0 -1
- package/dist/src/utils/channel.test.d.ts +0 -6
- package/dist/src/utils/channel.test.js +0 -170
- package/dist/src/utils/channel.test.js.map +0 -1
- package/dist/src/utils/checkpointUtils.test.d.ts +0 -6
- package/dist/src/utils/checkpointUtils.test.js +0 -229
- package/dist/src/utils/checkpointUtils.test.js.map +0 -1
- package/dist/src/utils/customHeaderUtils.test.d.ts +0 -6
- package/dist/src/utils/customHeaderUtils.test.js +0 -77
- package/dist/src/utils/customHeaderUtils.test.js.map +0 -1
- package/dist/src/utils/debugLogger.test.d.ts +0 -6
- package/dist/src/utils/debugLogger.test.js +0 -69
- package/dist/src/utils/debugLogger.test.js.map +0 -1
- package/dist/src/utils/delay.test.d.ts +0 -6
- package/dist/src/utils/delay.test.js +0 -88
- package/dist/src/utils/delay.test.js.map +0 -1
- package/dist/src/utils/editCorrector.test.d.ts +0 -6
- package/dist/src/utils/editCorrector.test.js +0 -533
- package/dist/src/utils/editCorrector.test.js.map +0 -1
- package/dist/src/utils/editor.test.d.ts +0 -6
- package/dist/src/utils/editor.test.js +0 -429
- package/dist/src/utils/editor.test.js.map +0 -1
- package/dist/src/utils/environmentContext.test.d.ts +0 -6
- package/dist/src/utils/environmentContext.test.js +0 -114
- package/dist/src/utils/environmentContext.test.js.map +0 -1
- package/dist/src/utils/errorParsing.test.d.ts +0 -6
- package/dist/src/utils/errorParsing.test.js +0 -84
- package/dist/src/utils/errorParsing.test.js.map +0 -1
- package/dist/src/utils/errorReporting.test.d.ts +0 -6
- package/dist/src/utils/errorReporting.test.js +0 -133
- package/dist/src/utils/errorReporting.test.js.map +0 -1
- package/dist/src/utils/errors.test.d.ts +0 -6
- package/dist/src/utils/errors.test.js +0 -155
- package/dist/src/utils/errors.test.js.map +0 -1
- package/dist/src/utils/events.test.d.ts +0 -6
- package/dist/src/utils/events.test.js +0 -237
- package/dist/src/utils/events.test.js.map +0 -1
- package/dist/src/utils/extensionLoader.test.d.ts +0 -6
- package/dist/src/utils/extensionLoader.test.js +0 -176
- package/dist/src/utils/extensionLoader.test.js.map +0 -1
- package/dist/src/utils/fileDiffUtils.test.d.ts +0 -6
- package/dist/src/utils/fileDiffUtils.test.js +0 -84
- package/dist/src/utils/fileDiffUtils.test.js.map +0 -1
- package/dist/src/utils/fileUtils.test.d.ts +0 -6
- package/dist/src/utils/fileUtils.test.js +0 -780
- package/dist/src/utils/fileUtils.test.js.map +0 -1
- package/dist/src/utils/filesearch/crawlCache.test.d.ts +0 -6
- package/dist/src/utils/filesearch/crawlCache.test.js +0 -103
- package/dist/src/utils/filesearch/crawlCache.test.js.map +0 -1
- package/dist/src/utils/filesearch/crawler.test.d.ts +0 -6
- package/dist/src/utils/filesearch/crawler.test.js +0 -495
- package/dist/src/utils/filesearch/crawler.test.js.map +0 -1
- package/dist/src/utils/filesearch/fileSearch.test.d.ts +0 -6
- package/dist/src/utils/filesearch/fileSearch.test.js +0 -663
- package/dist/src/utils/filesearch/fileSearch.test.js.map +0 -1
- package/dist/src/utils/filesearch/ignore.test.d.ts +0 -6
- package/dist/src/utils/filesearch/ignore.test.js +0 -144
- package/dist/src/utils/filesearch/ignore.test.js.map +0 -1
- package/dist/src/utils/filesearch/result-cache.test.d.ts +0 -6
- package/dist/src/utils/filesearch/result-cache.test.js +0 -46
- package/dist/src/utils/filesearch/result-cache.test.js.map +0 -1
- package/dist/src/utils/flashFallback.test.d.ts +0 -6
- package/dist/src/utils/flashFallback.test.js +0 -103
- package/dist/src/utils/flashFallback.test.js.map +0 -1
- package/dist/src/utils/formatters.test.d.ts +0 -6
- package/dist/src/utils/formatters.test.js +0 -26
- package/dist/src/utils/formatters.test.js.map +0 -1
- package/dist/src/utils/geminiIgnoreParser.test.d.ts +0 -6
- package/dist/src/utils/geminiIgnoreParser.test.js +0 -98
- package/dist/src/utils/geminiIgnoreParser.test.js.map +0 -1
- package/dist/src/utils/geminiTypeConversion.test.d.ts +0 -6
- package/dist/src/utils/geminiTypeConversion.test.js +0 -310
- package/dist/src/utils/geminiTypeConversion.test.js.map +0 -1
- package/dist/src/utils/generateContentResponseUtilities.test.d.ts +0 -6
- package/dist/src/utils/generateContentResponseUtilities.test.js +0 -512
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +0 -1
- package/dist/src/utils/getFolderStructure.test.d.ts +0 -6
- package/dist/src/utils/getFolderStructure.test.js +0 -283
- package/dist/src/utils/getFolderStructure.test.js.map +0 -1
- package/dist/src/utils/gitIgnoreParser.test.d.ts +0 -6
- package/dist/src/utils/gitIgnoreParser.test.js +0 -243
- package/dist/src/utils/gitIgnoreParser.test.js.map +0 -1
- package/dist/src/utils/googleErrors.test.d.ts +0 -6
- package/dist/src/utils/googleErrors.test.js +0 -309
- package/dist/src/utils/googleErrors.test.js.map +0 -1
- package/dist/src/utils/googleQuotaErrors.test.d.ts +0 -6
- package/dist/src/utils/googleQuotaErrors.test.js +0 -548
- package/dist/src/utils/googleQuotaErrors.test.js.map +0 -1
- package/dist/src/utils/ignorePatterns.test.d.ts +0 -6
- package/dist/src/utils/ignorePatterns.test.js +0 -246
- package/dist/src/utils/ignorePatterns.test.js.map +0 -1
- package/dist/src/utils/installationManager.test.d.ts +0 -6
- package/dist/src/utils/installationManager.test.js +0 -93
- package/dist/src/utils/installationManager.test.js.map +0 -1
- package/dist/src/utils/llm-edit-fixer.test.d.ts +0 -6
- package/dist/src/utils/llm-edit-fixer.test.js +0 -223
- package/dist/src/utils/llm-edit-fixer.test.js.map +0 -1
- package/dist/src/utils/llmUtils.test.d.ts +0 -6
- package/dist/src/utils/llmUtils.test.js +0 -196
- package/dist/src/utils/llmUtils.test.js.map +0 -1
- package/dist/src/utils/memoryDiscovery.test.d.ts +0 -6
- package/dist/src/utils/memoryDiscovery.test.js +0 -542
- package/dist/src/utils/memoryDiscovery.test.js.map +0 -1
- package/dist/src/utils/memoryImportProcessor.test.d.ts +0 -6
- package/dist/src/utils/memoryImportProcessor.test.js +0 -581
- package/dist/src/utils/memoryImportProcessor.test.js.map +0 -1
- package/dist/src/utils/nextSpeakerChecker.test.d.ts +0 -6
- package/dist/src/utils/nextSpeakerChecker.test.js +0 -191
- package/dist/src/utils/nextSpeakerChecker.test.js.map +0 -1
- package/dist/src/utils/partUtils.test.d.ts +0 -6
- package/dist/src/utils/partUtils.test.js +0 -397
- package/dist/src/utils/partUtils.test.js.map +0 -1
- package/dist/src/utils/pathCorrector.test.d.ts +0 -6
- package/dist/src/utils/pathCorrector.test.js +0 -87
- package/dist/src/utils/pathCorrector.test.js.map +0 -1
- package/dist/src/utils/pathReader.test.d.ts +0 -6
- package/dist/src/utils/pathReader.test.js +0 -406
- package/dist/src/utils/pathReader.test.js.map +0 -1
- package/dist/src/utils/paths.test.d.ts +0 -6
- package/dist/src/utils/paths.test.js +0 -402
- package/dist/src/utils/paths.test.js.map +0 -1
- package/dist/src/utils/retry.test.d.ts +0 -6
- package/dist/src/utils/retry.test.js +0 -548
- package/dist/src/utils/retry.test.js.map +0 -1
- package/dist/src/utils/retry_llm_error.test.d.ts +0 -6
- package/dist/src/utils/retry_llm_error.test.js +0 -280
- package/dist/src/utils/retry_llm_error.test.js.map +0 -1
- package/dist/src/utils/safeJsonStringify.test.d.ts +0 -6
- package/dist/src/utils/safeJsonStringify.test.js +0 -61
- package/dist/src/utils/safeJsonStringify.test.js.map +0 -1
- package/dist/src/utils/schemaValidator.test.d.ts +0 -6
- package/dist/src/utils/schemaValidator.test.js +0 -113
- package/dist/src/utils/schemaValidator.test.js.map +0 -1
- package/dist/src/utils/secure-browser-launcher.test.d.ts +0 -6
- package/dist/src/utils/secure-browser-launcher.test.js +0 -149
- package/dist/src/utils/secure-browser-launcher.test.js.map +0 -1
- package/dist/src/utils/security.test.d.ts +0 -1
- package/dist/src/utils/security.test.js +0 -121
- package/dist/src/utils/security.test.js.map +0 -1
- package/dist/src/utils/shell-utils.integration.test.d.ts +0 -1
- package/dist/src/utils/shell-utils.integration.test.js +0 -58
- package/dist/src/utils/shell-utils.integration.test.js.map +0 -1
- package/dist/src/utils/shell-utils.test.d.ts +0 -6
- package/dist/src/utils/shell-utils.test.js +0 -437
- package/dist/src/utils/shell-utils.test.js.map +0 -1
- package/dist/src/utils/stdio.test.d.ts +0 -6
- package/dist/src/utils/stdio.test.js +0 -47
- package/dist/src/utils/stdio.test.js.map +0 -1
- package/dist/src/utils/summarizer.test.d.ts +0 -6
- package/dist/src/utils/summarizer.test.js +0 -152
- package/dist/src/utils/summarizer.test.js.map +0 -1
- package/dist/src/utils/systemEncoding.test.d.ts +0 -6
- package/dist/src/utils/systemEncoding.test.js +0 -369
- package/dist/src/utils/systemEncoding.test.js.map +0 -1
- package/dist/src/utils/terminalSerializer.test.d.ts +0 -6
- package/dist/src/utils/terminalSerializer.test.js +0 -193
- package/dist/src/utils/terminalSerializer.test.js.map +0 -1
- package/dist/src/utils/textUtils.test.d.ts +0 -6
- package/dist/src/utils/textUtils.test.js +0 -76
- package/dist/src/utils/textUtils.test.js.map +0 -1
- package/dist/src/utils/thoughtUtils.test.d.ts +0 -6
- package/dist/src/utils/thoughtUtils.test.js +0 -78
- package/dist/src/utils/thoughtUtils.test.js.map +0 -1
- package/dist/src/utils/tokenCalculation.test.d.ts +0 -6
- package/dist/src/utils/tokenCalculation.test.js +0 -184
- package/dist/src/utils/tokenCalculation.test.js.map +0 -1
- package/dist/src/utils/tool-utils.test.d.ts +0 -6
- package/dist/src/utils/tool-utils.test.js +0 -84
- package/dist/src/utils/tool-utils.test.js.map +0 -1
- package/dist/src/utils/toolCallContext.test.d.ts +0 -6
- package/dist/src/utils/toolCallContext.test.js +0 -68
- package/dist/src/utils/toolCallContext.test.js.map +0 -1
- package/dist/src/utils/userAccountManager.test.d.ts +0 -6
- package/dist/src/utils/userAccountManager.test.js +0 -225
- package/dist/src/utils/userAccountManager.test.js.map +0 -1
- package/dist/src/utils/version.test.d.ts +0 -6
- package/dist/src/utils/version.test.js +0 -39
- package/dist/src/utils/version.test.js.map +0 -1
- package/dist/src/utils/workspaceContext.test.d.ts +0 -6
- package/dist/src/utils/workspaceContext.test.js +0 -374
- package/dist/src/utils/workspaceContext.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,1684 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
7
|
-
import { CoreToolScheduler, PLAN_MODE_DENIAL_MESSAGE, } from './coreToolScheduler.js';
|
|
8
|
-
import { DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES, DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD, BaseDeclarativeTool, BaseToolInvocation, ToolConfirmationOutcome, Kind, ApprovalMode, HookSystem, PolicyDecision, ToolErrorType, } from '../index.js';
|
|
9
|
-
import { createMockMessageBus } from '../test-utils/mock-message-bus.js';
|
|
10
|
-
import { MockModifiableTool, MockTool, MOCK_TOOL_SHOULD_CONFIRM_EXECUTE, } from '../test-utils/mock-tool.js';
|
|
11
|
-
import * as modifiableToolModule from '../tools/modifiable-tool.js';
|
|
12
|
-
import { DEFAULT_GEMINI_MODEL } from '../config/models.js';
|
|
13
|
-
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
|
|
14
|
-
vi.mock('fs/promises', () => ({
|
|
15
|
-
writeFile: vi.fn(),
|
|
16
|
-
}));
|
|
17
|
-
class TestApprovalTool extends BaseDeclarativeTool {
|
|
18
|
-
config;
|
|
19
|
-
static Name = 'testApprovalTool';
|
|
20
|
-
constructor(config, messageBus) {
|
|
21
|
-
super(TestApprovalTool.Name, 'TestApprovalTool', 'A tool for testing approval logic', Kind.Edit, {
|
|
22
|
-
properties: { id: { type: 'string' } },
|
|
23
|
-
required: ['id'],
|
|
24
|
-
type: 'object',
|
|
25
|
-
}, messageBus);
|
|
26
|
-
this.config = config;
|
|
27
|
-
}
|
|
28
|
-
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
29
|
-
return new TestApprovalInvocation(this.config, params, messageBus);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
class TestApprovalInvocation extends BaseToolInvocation {
|
|
33
|
-
config;
|
|
34
|
-
constructor(config, params, messageBus) {
|
|
35
|
-
super(params, messageBus);
|
|
36
|
-
this.config = config;
|
|
37
|
-
}
|
|
38
|
-
getDescription() {
|
|
39
|
-
return `Test tool ${this.params.id}`;
|
|
40
|
-
}
|
|
41
|
-
async shouldConfirmExecute() {
|
|
42
|
-
// Need confirmation unless approval mode is AUTO_EDIT
|
|
43
|
-
if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
type: 'edit',
|
|
48
|
-
title: `Confirm Test Tool ${this.params.id}`,
|
|
49
|
-
fileName: `test-${this.params.id}.txt`,
|
|
50
|
-
filePath: `/test-${this.params.id}.txt`,
|
|
51
|
-
fileDiff: 'Test diff content',
|
|
52
|
-
originalContent: '',
|
|
53
|
-
newContent: 'Test content',
|
|
54
|
-
onConfirm: async (outcome) => {
|
|
55
|
-
if (outcome === ToolConfirmationOutcome.ProceedAlways) {
|
|
56
|
-
this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
async execute() {
|
|
62
|
-
return {
|
|
63
|
-
llmContent: `Executed test tool ${this.params.id}`,
|
|
64
|
-
returnDisplay: `Executed test tool ${this.params.id}`,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
class AbortDuringConfirmationInvocation extends BaseToolInvocation {
|
|
69
|
-
abortController;
|
|
70
|
-
abortError;
|
|
71
|
-
constructor(abortController, abortError, params, messageBus) {
|
|
72
|
-
super(params, messageBus);
|
|
73
|
-
this.abortController = abortController;
|
|
74
|
-
this.abortError = abortError;
|
|
75
|
-
}
|
|
76
|
-
async shouldConfirmExecute(_signal) {
|
|
77
|
-
this.abortController.abort();
|
|
78
|
-
throw this.abortError;
|
|
79
|
-
}
|
|
80
|
-
async execute(_abortSignal) {
|
|
81
|
-
throw new Error('execute should not be called when confirmation fails');
|
|
82
|
-
}
|
|
83
|
-
getDescription() {
|
|
84
|
-
return 'Abort during confirmation invocation';
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
class AbortDuringConfirmationTool extends BaseDeclarativeTool {
|
|
88
|
-
abortController;
|
|
89
|
-
abortError;
|
|
90
|
-
constructor(abortController, abortError, messageBus) {
|
|
91
|
-
super('abortDuringConfirmationTool', 'Abort During Confirmation Tool', 'A tool that aborts while confirming execution.', Kind.Other, {
|
|
92
|
-
type: 'object',
|
|
93
|
-
properties: {},
|
|
94
|
-
}, messageBus);
|
|
95
|
-
this.abortController = abortController;
|
|
96
|
-
this.abortError = abortError;
|
|
97
|
-
}
|
|
98
|
-
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
99
|
-
return new AbortDuringConfirmationInvocation(this.abortController, this.abortError, params, messageBus);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
async function waitForStatus(onToolCallsUpdate, status, timeout = 5000) {
|
|
103
|
-
return new Promise((resolve, reject) => {
|
|
104
|
-
const startTime = Date.now();
|
|
105
|
-
const check = () => {
|
|
106
|
-
if (Date.now() - startTime > timeout) {
|
|
107
|
-
const seenStatuses = onToolCallsUpdate.mock.calls
|
|
108
|
-
.flatMap((call) => call[0])
|
|
109
|
-
.map((toolCall) => toolCall.status);
|
|
110
|
-
reject(new Error(`Timed out waiting for status "${status}". Seen statuses: ${seenStatuses.join(', ')}`));
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const foundCall = onToolCallsUpdate.mock.calls
|
|
114
|
-
.flatMap((call) => call[0])
|
|
115
|
-
.find((toolCall) => toolCall.status === status);
|
|
116
|
-
if (foundCall) {
|
|
117
|
-
resolve(foundCall);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
setTimeout(check, 10); // Check again in 10ms
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
check();
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function createMockConfig(overrides = {}) {
|
|
127
|
-
const defaultToolRegistry = {
|
|
128
|
-
getTool: () => undefined,
|
|
129
|
-
getToolByName: () => undefined,
|
|
130
|
-
getFunctionDeclarations: () => [],
|
|
131
|
-
tools: new Map(),
|
|
132
|
-
discovery: {},
|
|
133
|
-
registerTool: () => { },
|
|
134
|
-
getToolByDisplayName: () => undefined,
|
|
135
|
-
getTools: () => [],
|
|
136
|
-
discoverTools: async () => { },
|
|
137
|
-
getAllTools: () => [],
|
|
138
|
-
getToolsByServer: () => [],
|
|
139
|
-
getExperiments: () => { },
|
|
140
|
-
};
|
|
141
|
-
const baseConfig = {
|
|
142
|
-
getSessionId: () => 'test-session-id',
|
|
143
|
-
getUsageStatisticsEnabled: () => true,
|
|
144
|
-
getDebugMode: () => false,
|
|
145
|
-
isInteractive: () => true,
|
|
146
|
-
getApprovalMode: () => ApprovalMode.DEFAULT,
|
|
147
|
-
setApprovalMode: () => { },
|
|
148
|
-
getAllowedTools: () => [],
|
|
149
|
-
getContentGeneratorConfig: () => ({
|
|
150
|
-
model: 'test-model',
|
|
151
|
-
authType: 'oauth-personal',
|
|
152
|
-
}),
|
|
153
|
-
getShellExecutionConfig: () => ({
|
|
154
|
-
terminalWidth: 90,
|
|
155
|
-
terminalHeight: 30,
|
|
156
|
-
sanitizationConfig: {
|
|
157
|
-
enableEnvironmentVariableRedaction: true,
|
|
158
|
-
allowedEnvironmentVariables: [],
|
|
159
|
-
blockedEnvironmentVariables: [],
|
|
160
|
-
},
|
|
161
|
-
}),
|
|
162
|
-
storage: {
|
|
163
|
-
getProjectTempDir: () => '/tmp',
|
|
164
|
-
},
|
|
165
|
-
getTruncateToolOutputThreshold: () => DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
|
166
|
-
getTruncateToolOutputLines: () => DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
|
|
167
|
-
getToolRegistry: () => defaultToolRegistry,
|
|
168
|
-
getActiveModel: () => DEFAULT_GEMINI_MODEL,
|
|
169
|
-
getGeminiClient: () => null,
|
|
170
|
-
getMessageBus: () => createMockMessageBus(),
|
|
171
|
-
getEnableHooks: () => false,
|
|
172
|
-
getExperiments: () => { },
|
|
173
|
-
};
|
|
174
|
-
const finalConfig = { ...baseConfig, ...overrides };
|
|
175
|
-
// Patch the policy engine to use the final config if not overridden
|
|
176
|
-
if (!overrides.getPolicyEngine) {
|
|
177
|
-
finalConfig.getPolicyEngine = () => ({
|
|
178
|
-
check: async (toolCall, _serverName) => {
|
|
179
|
-
// Mock simple policy logic for tests
|
|
180
|
-
const mode = finalConfig.getApprovalMode();
|
|
181
|
-
if (mode === ApprovalMode.YOLO) {
|
|
182
|
-
return { decision: PolicyDecision.ALLOW };
|
|
183
|
-
}
|
|
184
|
-
const allowed = finalConfig.getAllowedTools();
|
|
185
|
-
if (allowed &&
|
|
186
|
-
(allowed.includes(toolCall.name) ||
|
|
187
|
-
allowed.some((p) => toolCall.name.startsWith(p)))) {
|
|
188
|
-
return { decision: PolicyDecision.ALLOW };
|
|
189
|
-
}
|
|
190
|
-
return { decision: PolicyDecision.ASK_USER };
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
return finalConfig;
|
|
195
|
-
}
|
|
196
|
-
describe('CoreToolScheduler', () => {
|
|
197
|
-
it('should cancel a tool call if the signal is aborted before confirmation', async () => {
|
|
198
|
-
const mockTool = new MockTool({
|
|
199
|
-
name: 'mockTool',
|
|
200
|
-
shouldConfirmExecute: MOCK_TOOL_SHOULD_CONFIRM_EXECUTE,
|
|
201
|
-
});
|
|
202
|
-
const declarativeTool = mockTool;
|
|
203
|
-
const mockToolRegistry = {
|
|
204
|
-
getTool: () => declarativeTool,
|
|
205
|
-
getFunctionDeclarations: () => [],
|
|
206
|
-
tools: new Map(),
|
|
207
|
-
discovery: {},
|
|
208
|
-
registerTool: () => { },
|
|
209
|
-
getToolByName: () => declarativeTool,
|
|
210
|
-
getToolByDisplayName: () => declarativeTool,
|
|
211
|
-
getTools: () => [],
|
|
212
|
-
discoverTools: async () => { },
|
|
213
|
-
getAllTools: () => [],
|
|
214
|
-
getToolsByServer: () => [],
|
|
215
|
-
};
|
|
216
|
-
const onAllToolCallsComplete = vi.fn();
|
|
217
|
-
const onToolCallsUpdate = vi.fn();
|
|
218
|
-
const mockConfig = createMockConfig({
|
|
219
|
-
getToolRegistry: () => mockToolRegistry,
|
|
220
|
-
isInteractive: () => false,
|
|
221
|
-
});
|
|
222
|
-
const scheduler = new CoreToolScheduler({
|
|
223
|
-
config: mockConfig,
|
|
224
|
-
onAllToolCallsComplete,
|
|
225
|
-
onToolCallsUpdate,
|
|
226
|
-
getPreferredEditor: () => 'vscode',
|
|
227
|
-
});
|
|
228
|
-
const abortController = new AbortController();
|
|
229
|
-
const request = {
|
|
230
|
-
callId: '1',
|
|
231
|
-
name: 'mockTool',
|
|
232
|
-
args: {},
|
|
233
|
-
isClientInitiated: false,
|
|
234
|
-
prompt_id: 'prompt-id-1',
|
|
235
|
-
};
|
|
236
|
-
abortController.abort();
|
|
237
|
-
await scheduler.schedule([request], abortController.signal);
|
|
238
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
239
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
240
|
-
.calls[0][0];
|
|
241
|
-
expect(completedCalls[0].status).toBe('cancelled');
|
|
242
|
-
});
|
|
243
|
-
it('should cancel all tools when cancelAll is called', async () => {
|
|
244
|
-
const mockTool1 = new MockTool({
|
|
245
|
-
name: 'mockTool1',
|
|
246
|
-
shouldConfirmExecute: MOCK_TOOL_SHOULD_CONFIRM_EXECUTE,
|
|
247
|
-
});
|
|
248
|
-
const mockTool2 = new MockTool({ name: 'mockTool2' });
|
|
249
|
-
const mockTool3 = new MockTool({ name: 'mockTool3' });
|
|
250
|
-
const mockToolRegistry = {
|
|
251
|
-
getTool: (name) => {
|
|
252
|
-
if (name === 'mockTool1')
|
|
253
|
-
return mockTool1;
|
|
254
|
-
if (name === 'mockTool2')
|
|
255
|
-
return mockTool2;
|
|
256
|
-
if (name === 'mockTool3')
|
|
257
|
-
return mockTool3;
|
|
258
|
-
return undefined;
|
|
259
|
-
},
|
|
260
|
-
getFunctionDeclarations: () => [],
|
|
261
|
-
tools: new Map(),
|
|
262
|
-
discovery: {},
|
|
263
|
-
registerTool: () => { },
|
|
264
|
-
getToolByName: (name) => {
|
|
265
|
-
if (name === 'mockTool1')
|
|
266
|
-
return mockTool1;
|
|
267
|
-
if (name === 'mockTool2')
|
|
268
|
-
return mockTool2;
|
|
269
|
-
if (name === 'mockTool3')
|
|
270
|
-
return mockTool3;
|
|
271
|
-
return undefined;
|
|
272
|
-
},
|
|
273
|
-
getToolByDisplayName: () => undefined,
|
|
274
|
-
getTools: () => [],
|
|
275
|
-
discoverTools: async () => { },
|
|
276
|
-
getAllTools: () => [],
|
|
277
|
-
getToolsByServer: () => [],
|
|
278
|
-
};
|
|
279
|
-
const onAllToolCallsComplete = vi.fn();
|
|
280
|
-
const onToolCallsUpdate = vi.fn();
|
|
281
|
-
const mockConfig = createMockConfig({
|
|
282
|
-
getToolRegistry: () => mockToolRegistry,
|
|
283
|
-
getHookSystem: () => undefined,
|
|
284
|
-
});
|
|
285
|
-
const scheduler = new CoreToolScheduler({
|
|
286
|
-
config: mockConfig,
|
|
287
|
-
onAllToolCallsComplete,
|
|
288
|
-
onToolCallsUpdate,
|
|
289
|
-
getPreferredEditor: () => 'vscode',
|
|
290
|
-
});
|
|
291
|
-
const abortController = new AbortController();
|
|
292
|
-
const requests = [
|
|
293
|
-
{
|
|
294
|
-
callId: '1',
|
|
295
|
-
name: 'mockTool1',
|
|
296
|
-
args: {},
|
|
297
|
-
isClientInitiated: false,
|
|
298
|
-
prompt_id: 'prompt-id-1',
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
callId: '2',
|
|
302
|
-
name: 'mockTool2',
|
|
303
|
-
args: {},
|
|
304
|
-
isClientInitiated: false,
|
|
305
|
-
prompt_id: 'prompt-id-1',
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
callId: '3',
|
|
309
|
-
name: 'mockTool3',
|
|
310
|
-
args: {},
|
|
311
|
-
isClientInitiated: false,
|
|
312
|
-
prompt_id: 'prompt-id-1',
|
|
313
|
-
},
|
|
314
|
-
];
|
|
315
|
-
// Don't await, let it run in the background
|
|
316
|
-
void scheduler.schedule(requests, abortController.signal);
|
|
317
|
-
// Wait for the first tool to be awaiting approval
|
|
318
|
-
await waitForStatus(onToolCallsUpdate, 'awaiting_approval');
|
|
319
|
-
// Cancel all operations
|
|
320
|
-
scheduler.cancelAll(abortController.signal);
|
|
321
|
-
abortController.abort(); // Also fire the signal
|
|
322
|
-
await vi.waitFor(() => {
|
|
323
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
324
|
-
});
|
|
325
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
326
|
-
.calls[0][0];
|
|
327
|
-
expect(completedCalls).toHaveLength(3);
|
|
328
|
-
expect(completedCalls.find((c) => c.request.callId === '1')?.status).toBe('cancelled');
|
|
329
|
-
expect(completedCalls.find((c) => c.request.callId === '2')?.status).toBe('cancelled');
|
|
330
|
-
expect(completedCalls.find((c) => c.request.callId === '3')?.status).toBe('cancelled');
|
|
331
|
-
});
|
|
332
|
-
it('should cancel all tools in a batch when one is cancelled via confirmation', async () => {
|
|
333
|
-
const mockTool1 = new MockTool({
|
|
334
|
-
name: 'mockTool1',
|
|
335
|
-
shouldConfirmExecute: MOCK_TOOL_SHOULD_CONFIRM_EXECUTE,
|
|
336
|
-
});
|
|
337
|
-
const mockTool2 = new MockTool({ name: 'mockTool2' });
|
|
338
|
-
const mockTool3 = new MockTool({ name: 'mockTool3' });
|
|
339
|
-
const mockToolRegistry = {
|
|
340
|
-
getTool: (name) => {
|
|
341
|
-
if (name === 'mockTool1')
|
|
342
|
-
return mockTool1;
|
|
343
|
-
if (name === 'mockTool2')
|
|
344
|
-
return mockTool2;
|
|
345
|
-
if (name === 'mockTool3')
|
|
346
|
-
return mockTool3;
|
|
347
|
-
return undefined;
|
|
348
|
-
},
|
|
349
|
-
getFunctionDeclarations: () => [],
|
|
350
|
-
tools: new Map(),
|
|
351
|
-
discovery: {},
|
|
352
|
-
registerTool: () => { },
|
|
353
|
-
getToolByName: (name) => {
|
|
354
|
-
if (name === 'mockTool1')
|
|
355
|
-
return mockTool1;
|
|
356
|
-
if (name === 'mockTool2')
|
|
357
|
-
return mockTool2;
|
|
358
|
-
if (name === 'mockTool3')
|
|
359
|
-
return mockTool3;
|
|
360
|
-
return undefined;
|
|
361
|
-
},
|
|
362
|
-
getToolByDisplayName: () => undefined,
|
|
363
|
-
getTools: () => [],
|
|
364
|
-
discoverTools: async () => { },
|
|
365
|
-
getAllTools: () => [],
|
|
366
|
-
getToolsByServer: () => [],
|
|
367
|
-
};
|
|
368
|
-
const onAllToolCallsComplete = vi.fn();
|
|
369
|
-
const onToolCallsUpdate = vi.fn();
|
|
370
|
-
const mockConfig = createMockConfig({
|
|
371
|
-
getToolRegistry: () => mockToolRegistry,
|
|
372
|
-
getHookSystem: () => undefined,
|
|
373
|
-
});
|
|
374
|
-
const scheduler = new CoreToolScheduler({
|
|
375
|
-
config: mockConfig,
|
|
376
|
-
onAllToolCallsComplete,
|
|
377
|
-
onToolCallsUpdate,
|
|
378
|
-
getPreferredEditor: () => 'vscode',
|
|
379
|
-
});
|
|
380
|
-
const abortController = new AbortController();
|
|
381
|
-
const requests = [
|
|
382
|
-
{
|
|
383
|
-
callId: '1',
|
|
384
|
-
name: 'mockTool1',
|
|
385
|
-
args: {},
|
|
386
|
-
isClientInitiated: false,
|
|
387
|
-
prompt_id: 'prompt-id-1',
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
callId: '2',
|
|
391
|
-
name: 'mockTool2',
|
|
392
|
-
args: {},
|
|
393
|
-
isClientInitiated: false,
|
|
394
|
-
prompt_id: 'prompt-id-1',
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
callId: '3',
|
|
398
|
-
name: 'mockTool3',
|
|
399
|
-
args: {},
|
|
400
|
-
isClientInitiated: false,
|
|
401
|
-
prompt_id: 'prompt-id-1',
|
|
402
|
-
},
|
|
403
|
-
];
|
|
404
|
-
// Don't await, let it run in the background
|
|
405
|
-
void scheduler.schedule(requests, abortController.signal);
|
|
406
|
-
// Wait for the first tool to be awaiting approval
|
|
407
|
-
const awaitingCall = (await waitForStatus(onToolCallsUpdate, 'awaiting_approval'));
|
|
408
|
-
// Cancel the first tool via its confirmation handler
|
|
409
|
-
const confirmationDetails = awaitingCall.confirmationDetails;
|
|
410
|
-
await confirmationDetails.onConfirm(ToolConfirmationOutcome.Cancel);
|
|
411
|
-
abortController.abort(); // User cancelling often involves an abort signal
|
|
412
|
-
await vi.waitFor(() => {
|
|
413
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
414
|
-
});
|
|
415
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
416
|
-
.calls[0][0];
|
|
417
|
-
expect(completedCalls).toHaveLength(3);
|
|
418
|
-
expect(completedCalls.find((c) => c.request.callId === '1')?.status).toBe('cancelled');
|
|
419
|
-
expect(completedCalls.find((c) => c.request.callId === '2')?.status).toBe('cancelled');
|
|
420
|
-
expect(completedCalls.find((c) => c.request.callId === '3')?.status).toBe('cancelled');
|
|
421
|
-
});
|
|
422
|
-
it('should mark tool call as cancelled when abort happens during confirmation error', async () => {
|
|
423
|
-
const abortController = new AbortController();
|
|
424
|
-
const abortError = new Error('Abort requested during confirmation');
|
|
425
|
-
const declarativeTool = new AbortDuringConfirmationTool(abortController, abortError, createMockMessageBus());
|
|
426
|
-
const mockToolRegistry = {
|
|
427
|
-
getTool: () => declarativeTool,
|
|
428
|
-
getFunctionDeclarations: () => [],
|
|
429
|
-
tools: new Map(),
|
|
430
|
-
discovery: {},
|
|
431
|
-
registerTool: () => { },
|
|
432
|
-
getToolByName: () => declarativeTool,
|
|
433
|
-
getToolByDisplayName: () => declarativeTool,
|
|
434
|
-
getTools: () => [],
|
|
435
|
-
discoverTools: async () => { },
|
|
436
|
-
getAllTools: () => [],
|
|
437
|
-
getToolsByServer: () => [],
|
|
438
|
-
};
|
|
439
|
-
const onAllToolCallsComplete = vi.fn();
|
|
440
|
-
const onToolCallsUpdate = vi.fn();
|
|
441
|
-
const mockConfig = createMockConfig({
|
|
442
|
-
getToolRegistry: () => mockToolRegistry,
|
|
443
|
-
isInteractive: () => true,
|
|
444
|
-
});
|
|
445
|
-
const scheduler = new CoreToolScheduler({
|
|
446
|
-
config: mockConfig,
|
|
447
|
-
onAllToolCallsComplete,
|
|
448
|
-
onToolCallsUpdate,
|
|
449
|
-
getPreferredEditor: () => 'vscode',
|
|
450
|
-
});
|
|
451
|
-
const request = {
|
|
452
|
-
callId: 'abort-1',
|
|
453
|
-
name: 'abortDuringConfirmationTool',
|
|
454
|
-
args: {},
|
|
455
|
-
isClientInitiated: false,
|
|
456
|
-
prompt_id: 'prompt-id-abort',
|
|
457
|
-
};
|
|
458
|
-
await scheduler.schedule([request], abortController.signal);
|
|
459
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
460
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
461
|
-
.calls[0][0];
|
|
462
|
-
expect(completedCalls[0].status).toBe('cancelled');
|
|
463
|
-
const statuses = onToolCallsUpdate.mock.calls.flatMap((call) => call[0].map((toolCall) => toolCall.status));
|
|
464
|
-
expect(statuses).not.toContain('error');
|
|
465
|
-
});
|
|
466
|
-
it('should error when tool requires confirmation in non-interactive mode', async () => {
|
|
467
|
-
const mockTool = new MockTool({
|
|
468
|
-
name: 'mockTool',
|
|
469
|
-
shouldConfirmExecute: MOCK_TOOL_SHOULD_CONFIRM_EXECUTE,
|
|
470
|
-
});
|
|
471
|
-
const declarativeTool = mockTool;
|
|
472
|
-
const mockToolRegistry = {
|
|
473
|
-
getTool: () => declarativeTool,
|
|
474
|
-
getFunctionDeclarations: () => [],
|
|
475
|
-
tools: new Map(),
|
|
476
|
-
discovery: {},
|
|
477
|
-
registerTool: () => { },
|
|
478
|
-
getToolByName: () => declarativeTool,
|
|
479
|
-
getToolByDisplayName: () => declarativeTool,
|
|
480
|
-
getTools: () => [],
|
|
481
|
-
discoverTools: async () => { },
|
|
482
|
-
getAllTools: () => [],
|
|
483
|
-
getToolsByServer: () => [],
|
|
484
|
-
};
|
|
485
|
-
const onAllToolCallsComplete = vi.fn();
|
|
486
|
-
const onToolCallsUpdate = vi.fn();
|
|
487
|
-
const mockConfig = createMockConfig({
|
|
488
|
-
getToolRegistry: () => mockToolRegistry,
|
|
489
|
-
isInteractive: () => false,
|
|
490
|
-
});
|
|
491
|
-
const scheduler = new CoreToolScheduler({
|
|
492
|
-
config: mockConfig,
|
|
493
|
-
onAllToolCallsComplete,
|
|
494
|
-
onToolCallsUpdate,
|
|
495
|
-
getPreferredEditor: () => 'vscode',
|
|
496
|
-
});
|
|
497
|
-
const abortController = new AbortController();
|
|
498
|
-
const request = {
|
|
499
|
-
callId: '1',
|
|
500
|
-
name: 'mockTool',
|
|
501
|
-
args: {},
|
|
502
|
-
isClientInitiated: false,
|
|
503
|
-
prompt_id: 'prompt-id-1',
|
|
504
|
-
};
|
|
505
|
-
await scheduler.schedule([request], abortController.signal);
|
|
506
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
507
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
508
|
-
.calls[0][0];
|
|
509
|
-
expect(completedCalls[0].status).toBe('error');
|
|
510
|
-
const erroredCall = completedCalls[0];
|
|
511
|
-
const errorResponse = erroredCall.response;
|
|
512
|
-
const errorParts = errorResponse.responseParts;
|
|
513
|
-
// @ts-expect-error - accessing internal structure of FunctionResponsePart
|
|
514
|
-
const errorMessage = errorParts[0].functionResponse.response.error;
|
|
515
|
-
expect(errorMessage).toContain('Tool execution for "mockTool" requires user confirmation, which is not supported in non-interactive mode.');
|
|
516
|
-
});
|
|
517
|
-
});
|
|
518
|
-
describe('CoreToolScheduler with payload', () => {
|
|
519
|
-
it('should update args and diff and execute tool when payload is provided', async () => {
|
|
520
|
-
const mockTool = new MockModifiableTool();
|
|
521
|
-
mockTool.executeFn = vi.fn();
|
|
522
|
-
const declarativeTool = mockTool;
|
|
523
|
-
const mockToolRegistry = {
|
|
524
|
-
getTool: () => declarativeTool,
|
|
525
|
-
getFunctionDeclarations: () => [],
|
|
526
|
-
tools: new Map(),
|
|
527
|
-
discovery: {},
|
|
528
|
-
registerTool: () => { },
|
|
529
|
-
getToolByName: () => declarativeTool,
|
|
530
|
-
getToolByDisplayName: () => declarativeTool,
|
|
531
|
-
getTools: () => [],
|
|
532
|
-
discoverTools: async () => { },
|
|
533
|
-
getAllTools: () => [],
|
|
534
|
-
getToolsByServer: () => [],
|
|
535
|
-
};
|
|
536
|
-
const onAllToolCallsComplete = vi.fn();
|
|
537
|
-
const onToolCallsUpdate = vi.fn();
|
|
538
|
-
const mockConfig = createMockConfig({
|
|
539
|
-
getToolRegistry: () => mockToolRegistry,
|
|
540
|
-
});
|
|
541
|
-
const mockMessageBus = createMockMessageBus();
|
|
542
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
543
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
544
|
-
mockConfig.getHookSystem = vi
|
|
545
|
-
.fn()
|
|
546
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
547
|
-
const scheduler = new CoreToolScheduler({
|
|
548
|
-
config: mockConfig,
|
|
549
|
-
onAllToolCallsComplete,
|
|
550
|
-
onToolCallsUpdate,
|
|
551
|
-
getPreferredEditor: () => 'vscode',
|
|
552
|
-
});
|
|
553
|
-
const abortController = new AbortController();
|
|
554
|
-
const request = {
|
|
555
|
-
callId: '1',
|
|
556
|
-
name: 'mockModifiableTool',
|
|
557
|
-
args: {},
|
|
558
|
-
isClientInitiated: false,
|
|
559
|
-
prompt_id: 'prompt-id-2',
|
|
560
|
-
};
|
|
561
|
-
await scheduler.schedule([request], abortController.signal);
|
|
562
|
-
const awaitingCall = (await waitForStatus(onToolCallsUpdate, 'awaiting_approval'));
|
|
563
|
-
const confirmationDetails = awaitingCall.confirmationDetails;
|
|
564
|
-
if (confirmationDetails) {
|
|
565
|
-
const payload = { newContent: 'final version' };
|
|
566
|
-
await confirmationDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce, payload);
|
|
567
|
-
}
|
|
568
|
-
// After internal update, the tool should be awaiting approval again with the NEW content.
|
|
569
|
-
const updatedAwaitingCall = (await waitForStatus(onToolCallsUpdate, 'awaiting_approval'));
|
|
570
|
-
// Now confirm for real to execute.
|
|
571
|
-
await updatedAwaitingCall.confirmationDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
572
|
-
// Wait for the tool execution to complete
|
|
573
|
-
await vi.waitFor(() => {
|
|
574
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
575
|
-
});
|
|
576
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
577
|
-
.calls[0][0];
|
|
578
|
-
expect(completedCalls[0].status).toBe('success');
|
|
579
|
-
expect(mockTool.executeFn).toHaveBeenCalledWith({
|
|
580
|
-
newContent: 'final version',
|
|
581
|
-
});
|
|
582
|
-
});
|
|
583
|
-
});
|
|
584
|
-
class MockEditToolInvocation extends BaseToolInvocation {
|
|
585
|
-
constructor(params, messageBus) {
|
|
586
|
-
super(params, messageBus);
|
|
587
|
-
}
|
|
588
|
-
getDescription() {
|
|
589
|
-
return 'A mock edit tool invocation';
|
|
590
|
-
}
|
|
591
|
-
async shouldConfirmExecute(_abortSignal) {
|
|
592
|
-
return {
|
|
593
|
-
type: 'edit',
|
|
594
|
-
title: 'Confirm Edit',
|
|
595
|
-
fileName: 'test.txt',
|
|
596
|
-
filePath: 'test.txt',
|
|
597
|
-
fileDiff: '--- test.txt\n+++ test.txt\n@@ -1,1 +1,1 @@\n-old content\n+new content',
|
|
598
|
-
originalContent: 'old content',
|
|
599
|
-
newContent: 'new content',
|
|
600
|
-
onConfirm: async () => { },
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
async execute(_abortSignal) {
|
|
604
|
-
return {
|
|
605
|
-
llmContent: 'Edited successfully',
|
|
606
|
-
returnDisplay: 'Edited successfully',
|
|
607
|
-
};
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
class MockEditTool extends BaseDeclarativeTool {
|
|
611
|
-
constructor(messageBus) {
|
|
612
|
-
super('mockEditTool', 'mockEditTool', 'A mock edit tool', Kind.Edit, {}, messageBus);
|
|
613
|
-
}
|
|
614
|
-
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
615
|
-
return new MockEditToolInvocation(params, messageBus);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
describe('CoreToolScheduler edit cancellation', () => {
|
|
619
|
-
it('should preserve diff when an edit is cancelled', async () => {
|
|
620
|
-
const mockEditTool = new MockEditTool(createMockMessageBus());
|
|
621
|
-
const mockToolRegistry = {
|
|
622
|
-
getTool: () => mockEditTool,
|
|
623
|
-
getFunctionDeclarations: () => [],
|
|
624
|
-
tools: new Map(),
|
|
625
|
-
discovery: {},
|
|
626
|
-
registerTool: () => { },
|
|
627
|
-
getToolByName: () => mockEditTool,
|
|
628
|
-
getToolByDisplayName: () => mockEditTool,
|
|
629
|
-
getTools: () => [],
|
|
630
|
-
discoverTools: async () => { },
|
|
631
|
-
getAllTools: () => [],
|
|
632
|
-
getToolsByServer: () => [],
|
|
633
|
-
};
|
|
634
|
-
const onAllToolCallsComplete = vi.fn();
|
|
635
|
-
const onToolCallsUpdate = vi.fn();
|
|
636
|
-
const mockConfig = createMockConfig({
|
|
637
|
-
getToolRegistry: () => mockToolRegistry,
|
|
638
|
-
});
|
|
639
|
-
const mockMessageBus = createMockMessageBus();
|
|
640
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
641
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
642
|
-
mockConfig.getHookSystem = vi
|
|
643
|
-
.fn()
|
|
644
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
645
|
-
const scheduler = new CoreToolScheduler({
|
|
646
|
-
config: mockConfig,
|
|
647
|
-
onAllToolCallsComplete,
|
|
648
|
-
onToolCallsUpdate,
|
|
649
|
-
getPreferredEditor: () => 'vscode',
|
|
650
|
-
});
|
|
651
|
-
const abortController = new AbortController();
|
|
652
|
-
const request = {
|
|
653
|
-
callId: '1',
|
|
654
|
-
name: 'mockEditTool',
|
|
655
|
-
args: {},
|
|
656
|
-
isClientInitiated: false,
|
|
657
|
-
prompt_id: 'prompt-id-1',
|
|
658
|
-
};
|
|
659
|
-
await scheduler.schedule([request], abortController.signal);
|
|
660
|
-
const awaitingCall = (await waitForStatus(onToolCallsUpdate, 'awaiting_approval'));
|
|
661
|
-
// Cancel the edit
|
|
662
|
-
const confirmationDetails = awaitingCall.confirmationDetails;
|
|
663
|
-
if (confirmationDetails) {
|
|
664
|
-
await confirmationDetails.onConfirm(ToolConfirmationOutcome.Cancel);
|
|
665
|
-
}
|
|
666
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
667
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
668
|
-
.calls[0][0];
|
|
669
|
-
expect(completedCalls[0].status).toBe('cancelled');
|
|
670
|
-
// Check that the diff is preserved
|
|
671
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
672
|
-
const cancelledCall = completedCalls[0];
|
|
673
|
-
expect(cancelledCall.response.resultDisplay).toBeDefined();
|
|
674
|
-
expect(cancelledCall.response.resultDisplay.fileDiff).toBe('--- test.txt\n+++ test.txt\n@@ -1,1 +1,1 @@\n-old content\n+new content');
|
|
675
|
-
expect(cancelledCall.response.resultDisplay.fileName).toBe('test.txt');
|
|
676
|
-
});
|
|
677
|
-
});
|
|
678
|
-
describe('CoreToolScheduler YOLO mode', () => {
|
|
679
|
-
it('should execute tool requiring confirmation directly without waiting', async () => {
|
|
680
|
-
// Arrange
|
|
681
|
-
const executeFn = vi.fn().mockResolvedValue({
|
|
682
|
-
llmContent: 'Tool executed',
|
|
683
|
-
returnDisplay: 'Tool executed',
|
|
684
|
-
});
|
|
685
|
-
const mockTool = new MockTool({
|
|
686
|
-
name: 'mockTool',
|
|
687
|
-
execute: executeFn,
|
|
688
|
-
shouldConfirmExecute: MOCK_TOOL_SHOULD_CONFIRM_EXECUTE,
|
|
689
|
-
});
|
|
690
|
-
const declarativeTool = mockTool;
|
|
691
|
-
const mockToolRegistry = {
|
|
692
|
-
getTool: () => declarativeTool,
|
|
693
|
-
getToolByName: () => declarativeTool,
|
|
694
|
-
// Other properties are not needed for this test but are included for type consistency.
|
|
695
|
-
getFunctionDeclarations: () => [],
|
|
696
|
-
tools: new Map(),
|
|
697
|
-
discovery: {},
|
|
698
|
-
registerTool: () => { },
|
|
699
|
-
getToolByDisplayName: () => declarativeTool,
|
|
700
|
-
getTools: () => [],
|
|
701
|
-
discoverTools: async () => { },
|
|
702
|
-
getAllTools: () => [],
|
|
703
|
-
getToolsByServer: () => [],
|
|
704
|
-
};
|
|
705
|
-
const onAllToolCallsComplete = vi.fn();
|
|
706
|
-
const onToolCallsUpdate = vi.fn();
|
|
707
|
-
// Configure the scheduler for YOLO mode.
|
|
708
|
-
const mockConfig = createMockConfig({
|
|
709
|
-
getToolRegistry: () => mockToolRegistry,
|
|
710
|
-
getApprovalMode: () => ApprovalMode.YOLO,
|
|
711
|
-
isInteractive: () => false,
|
|
712
|
-
});
|
|
713
|
-
const mockMessageBus = createMockMessageBus();
|
|
714
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
715
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
716
|
-
mockConfig.getHookSystem = vi
|
|
717
|
-
.fn()
|
|
718
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
719
|
-
const scheduler = new CoreToolScheduler({
|
|
720
|
-
config: mockConfig,
|
|
721
|
-
onAllToolCallsComplete,
|
|
722
|
-
onToolCallsUpdate,
|
|
723
|
-
getPreferredEditor: () => 'vscode',
|
|
724
|
-
});
|
|
725
|
-
const abortController = new AbortController();
|
|
726
|
-
const request = {
|
|
727
|
-
callId: '1',
|
|
728
|
-
name: 'mockTool',
|
|
729
|
-
args: { param: 'value' },
|
|
730
|
-
isClientInitiated: false,
|
|
731
|
-
prompt_id: 'prompt-id-yolo',
|
|
732
|
-
};
|
|
733
|
-
// Act
|
|
734
|
-
await scheduler.schedule([request], abortController.signal);
|
|
735
|
-
// Wait for the tool execution to complete
|
|
736
|
-
await vi.waitFor(() => {
|
|
737
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
738
|
-
});
|
|
739
|
-
// Assert
|
|
740
|
-
// 1. The tool's execute method was called directly.
|
|
741
|
-
expect(executeFn).toHaveBeenCalledWith({ param: 'value' });
|
|
742
|
-
// 2. The tool call status never entered 'awaiting_approval'.
|
|
743
|
-
const statusUpdates = onToolCallsUpdate.mock.calls
|
|
744
|
-
.map((call) => call[0][0]?.status)
|
|
745
|
-
.filter(Boolean);
|
|
746
|
-
expect(statusUpdates).not.toContain('awaiting_approval');
|
|
747
|
-
expect(statusUpdates).toEqual([
|
|
748
|
-
'validating',
|
|
749
|
-
'scheduled',
|
|
750
|
-
'executing',
|
|
751
|
-
'success',
|
|
752
|
-
]);
|
|
753
|
-
// 3. The final callback indicates the tool call was successful.
|
|
754
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
755
|
-
.calls[0][0];
|
|
756
|
-
expect(completedCalls).toHaveLength(1);
|
|
757
|
-
const completedCall = completedCalls[0];
|
|
758
|
-
expect(completedCall.status).toBe('success');
|
|
759
|
-
if (completedCall.status === 'success') {
|
|
760
|
-
expect(completedCall.response.resultDisplay).toBe('Tool executed');
|
|
761
|
-
}
|
|
762
|
-
});
|
|
763
|
-
});
|
|
764
|
-
describe('CoreToolScheduler request queueing', () => {
|
|
765
|
-
it('should queue a request if another is running', async () => {
|
|
766
|
-
let resolveFirstCall;
|
|
767
|
-
const firstCallPromise = new Promise((resolve) => {
|
|
768
|
-
resolveFirstCall = resolve;
|
|
769
|
-
});
|
|
770
|
-
const executeFn = vi.fn().mockImplementation(() => firstCallPromise);
|
|
771
|
-
const mockTool = new MockTool({ name: 'mockTool', execute: executeFn });
|
|
772
|
-
const declarativeTool = mockTool;
|
|
773
|
-
const mockToolRegistry = {
|
|
774
|
-
getTool: () => declarativeTool,
|
|
775
|
-
getToolByName: () => declarativeTool,
|
|
776
|
-
getFunctionDeclarations: () => [],
|
|
777
|
-
tools: new Map(),
|
|
778
|
-
discovery: {},
|
|
779
|
-
registerTool: () => { },
|
|
780
|
-
getToolByDisplayName: () => declarativeTool,
|
|
781
|
-
getTools: () => [],
|
|
782
|
-
discoverTools: async () => { },
|
|
783
|
-
getAllTools: () => [],
|
|
784
|
-
getToolsByServer: () => [],
|
|
785
|
-
};
|
|
786
|
-
const onAllToolCallsComplete = vi.fn();
|
|
787
|
-
const onToolCallsUpdate = vi.fn();
|
|
788
|
-
const mockConfig = createMockConfig({
|
|
789
|
-
getToolRegistry: () => mockToolRegistry,
|
|
790
|
-
getApprovalMode: () => ApprovalMode.YOLO, // Use YOLO to avoid confirmation prompts
|
|
791
|
-
isInteractive: () => false,
|
|
792
|
-
});
|
|
793
|
-
const mockMessageBus = createMockMessageBus();
|
|
794
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
795
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
796
|
-
mockConfig.getHookSystem = vi
|
|
797
|
-
.fn()
|
|
798
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
799
|
-
const scheduler = new CoreToolScheduler({
|
|
800
|
-
config: mockConfig,
|
|
801
|
-
onAllToolCallsComplete,
|
|
802
|
-
onToolCallsUpdate,
|
|
803
|
-
getPreferredEditor: () => 'vscode',
|
|
804
|
-
});
|
|
805
|
-
const abortController = new AbortController();
|
|
806
|
-
const request1 = {
|
|
807
|
-
callId: '1',
|
|
808
|
-
name: 'mockTool',
|
|
809
|
-
args: { a: 1 },
|
|
810
|
-
isClientInitiated: false,
|
|
811
|
-
prompt_id: 'prompt-1',
|
|
812
|
-
};
|
|
813
|
-
const request2 = {
|
|
814
|
-
callId: '2',
|
|
815
|
-
name: 'mockTool',
|
|
816
|
-
args: { b: 2 },
|
|
817
|
-
isClientInitiated: false,
|
|
818
|
-
prompt_id: 'prompt-2',
|
|
819
|
-
};
|
|
820
|
-
// Schedule the first call, which will pause execution.
|
|
821
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
822
|
-
scheduler.schedule([request1], abortController.signal);
|
|
823
|
-
// Wait for the first call to be in the 'executing' state.
|
|
824
|
-
await waitForStatus(onToolCallsUpdate, 'executing');
|
|
825
|
-
// Schedule the second call while the first is "running".
|
|
826
|
-
const schedulePromise2 = scheduler.schedule([request2], abortController.signal);
|
|
827
|
-
// Ensure the second tool call hasn't been executed yet.
|
|
828
|
-
expect(executeFn).toHaveBeenCalledWith({ a: 1 });
|
|
829
|
-
// Complete the first tool call.
|
|
830
|
-
resolveFirstCall({
|
|
831
|
-
llmContent: 'First call complete',
|
|
832
|
-
returnDisplay: 'First call complete',
|
|
833
|
-
});
|
|
834
|
-
// Wait for the second schedule promise to resolve.
|
|
835
|
-
await schedulePromise2;
|
|
836
|
-
// Let the second call finish.
|
|
837
|
-
const secondCallResult = {
|
|
838
|
-
llmContent: 'Second call complete',
|
|
839
|
-
returnDisplay: 'Second call complete',
|
|
840
|
-
};
|
|
841
|
-
// Since the mock is shared, we need to resolve the current promise.
|
|
842
|
-
// In a real scenario, a new promise would be created for the second call.
|
|
843
|
-
resolveFirstCall(secondCallResult);
|
|
844
|
-
await vi.waitFor(() => {
|
|
845
|
-
// Now the second tool call should have been executed.
|
|
846
|
-
expect(executeFn).toHaveBeenCalledTimes(2);
|
|
847
|
-
});
|
|
848
|
-
expect(executeFn).toHaveBeenCalledWith({ b: 2 });
|
|
849
|
-
// Wait for the second completion.
|
|
850
|
-
await vi.waitFor(() => {
|
|
851
|
-
expect(onAllToolCallsComplete).toHaveBeenCalledTimes(2);
|
|
852
|
-
});
|
|
853
|
-
// Verify the completion callbacks were called correctly.
|
|
854
|
-
expect(onAllToolCallsComplete.mock.calls[0][0][0].status).toBe('success');
|
|
855
|
-
expect(onAllToolCallsComplete.mock.calls[1][0][0].status).toBe('success');
|
|
856
|
-
});
|
|
857
|
-
it('should auto-approve a tool call if it is on the allowedTools list', async () => {
|
|
858
|
-
// Arrange
|
|
859
|
-
const executeFn = vi.fn().mockResolvedValue({
|
|
860
|
-
llmContent: 'Tool executed',
|
|
861
|
-
returnDisplay: 'Tool executed',
|
|
862
|
-
});
|
|
863
|
-
const mockTool = new MockTool({
|
|
864
|
-
name: 'mockTool',
|
|
865
|
-
execute: executeFn,
|
|
866
|
-
shouldConfirmExecute: MOCK_TOOL_SHOULD_CONFIRM_EXECUTE,
|
|
867
|
-
});
|
|
868
|
-
const declarativeTool = mockTool;
|
|
869
|
-
const toolRegistry = {
|
|
870
|
-
getTool: () => declarativeTool,
|
|
871
|
-
getToolByName: () => declarativeTool,
|
|
872
|
-
getFunctionDeclarations: () => [],
|
|
873
|
-
tools: new Map(),
|
|
874
|
-
discovery: {},
|
|
875
|
-
registerTool: () => { },
|
|
876
|
-
getToolByDisplayName: () => declarativeTool,
|
|
877
|
-
getTools: () => [],
|
|
878
|
-
discoverTools: async () => { },
|
|
879
|
-
getAllTools: () => [],
|
|
880
|
-
getToolsByServer: () => [],
|
|
881
|
-
};
|
|
882
|
-
const onAllToolCallsComplete = vi.fn();
|
|
883
|
-
const onToolCallsUpdate = vi.fn();
|
|
884
|
-
// Configure the scheduler to auto-approve the specific tool call.
|
|
885
|
-
const mockConfig = createMockConfig({
|
|
886
|
-
getAllowedTools: () => ['mockTool'], // Auto-approve this tool
|
|
887
|
-
getToolRegistry: () => toolRegistry,
|
|
888
|
-
getShellExecutionConfig: () => ({
|
|
889
|
-
terminalWidth: 80,
|
|
890
|
-
terminalHeight: 24,
|
|
891
|
-
sanitizationConfig: {
|
|
892
|
-
enableEnvironmentVariableRedaction: true,
|
|
893
|
-
allowedEnvironmentVariables: [],
|
|
894
|
-
blockedEnvironmentVariables: [],
|
|
895
|
-
},
|
|
896
|
-
}),
|
|
897
|
-
isInteractive: () => false,
|
|
898
|
-
});
|
|
899
|
-
const mockMessageBus = createMockMessageBus();
|
|
900
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
901
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
902
|
-
mockConfig.getHookSystem = vi
|
|
903
|
-
.fn()
|
|
904
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
905
|
-
const scheduler = new CoreToolScheduler({
|
|
906
|
-
config: mockConfig,
|
|
907
|
-
onAllToolCallsComplete,
|
|
908
|
-
onToolCallsUpdate,
|
|
909
|
-
getPreferredEditor: () => 'vscode',
|
|
910
|
-
});
|
|
911
|
-
const abortController = new AbortController();
|
|
912
|
-
const request = {
|
|
913
|
-
callId: '1',
|
|
914
|
-
name: 'mockTool',
|
|
915
|
-
args: { param: 'value' },
|
|
916
|
-
isClientInitiated: false,
|
|
917
|
-
prompt_id: 'prompt-auto-approved',
|
|
918
|
-
};
|
|
919
|
-
// Act
|
|
920
|
-
await scheduler.schedule([request], abortController.signal);
|
|
921
|
-
// Wait for the tool execution to complete
|
|
922
|
-
await vi.waitFor(() => {
|
|
923
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
924
|
-
});
|
|
925
|
-
// Assert
|
|
926
|
-
// 1. The tool's execute method was called directly.
|
|
927
|
-
expect(executeFn).toHaveBeenCalledWith({ param: 'value' });
|
|
928
|
-
// 2. The tool call status never entered 'awaiting_approval'.
|
|
929
|
-
const statusUpdates = onToolCallsUpdate.mock.calls
|
|
930
|
-
.map((call) => call[0][0]?.status)
|
|
931
|
-
.filter(Boolean);
|
|
932
|
-
expect(statusUpdates).not.toContain('awaiting_approval');
|
|
933
|
-
expect(statusUpdates).toEqual([
|
|
934
|
-
'validating',
|
|
935
|
-
'scheduled',
|
|
936
|
-
'executing',
|
|
937
|
-
'success',
|
|
938
|
-
]);
|
|
939
|
-
// 3. The final callback indicates the tool call was successful.
|
|
940
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
941
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
942
|
-
.calls[0][0];
|
|
943
|
-
expect(completedCalls).toHaveLength(1);
|
|
944
|
-
const completedCall = completedCalls[0];
|
|
945
|
-
expect(completedCall.status).toBe('success');
|
|
946
|
-
if (completedCall.status === 'success') {
|
|
947
|
-
expect(completedCall.response.resultDisplay).toBe('Tool executed');
|
|
948
|
-
}
|
|
949
|
-
});
|
|
950
|
-
it('should require approval for a chained shell command even when prefix is allowlisted', async () => {
|
|
951
|
-
const executeFn = vi.fn().mockResolvedValue({
|
|
952
|
-
llmContent: 'Shell command executed',
|
|
953
|
-
returnDisplay: 'Shell command executed',
|
|
954
|
-
});
|
|
955
|
-
const mockShellTool = new MockTool({
|
|
956
|
-
name: 'run_shell_command',
|
|
957
|
-
shouldConfirmExecute: (params) => Promise.resolve({
|
|
958
|
-
type: 'exec',
|
|
959
|
-
title: 'Confirm Shell Command',
|
|
960
|
-
command: String(params['command'] ?? ''),
|
|
961
|
-
rootCommand: 'git',
|
|
962
|
-
rootCommands: ['git'],
|
|
963
|
-
onConfirm: async () => { },
|
|
964
|
-
}),
|
|
965
|
-
execute: () => executeFn({}),
|
|
966
|
-
});
|
|
967
|
-
const toolRegistry = {
|
|
968
|
-
getTool: () => mockShellTool,
|
|
969
|
-
getToolByName: () => mockShellTool,
|
|
970
|
-
getFunctionDeclarations: () => [],
|
|
971
|
-
tools: new Map(),
|
|
972
|
-
discovery: {},
|
|
973
|
-
registerTool: () => { },
|
|
974
|
-
getToolByDisplayName: () => mockShellTool,
|
|
975
|
-
getTools: () => [],
|
|
976
|
-
discoverTools: async () => { },
|
|
977
|
-
getAllTools: () => [],
|
|
978
|
-
getToolsByServer: () => [],
|
|
979
|
-
};
|
|
980
|
-
const onAllToolCallsComplete = vi.fn();
|
|
981
|
-
const onToolCallsUpdate = vi.fn();
|
|
982
|
-
const mockConfig = createMockConfig({
|
|
983
|
-
getAllowedTools: () => ['run_shell_command(git)'],
|
|
984
|
-
getShellExecutionConfig: () => ({
|
|
985
|
-
terminalWidth: 80,
|
|
986
|
-
terminalHeight: 24,
|
|
987
|
-
sanitizationConfig: {
|
|
988
|
-
enableEnvironmentVariableRedaction: true,
|
|
989
|
-
allowedEnvironmentVariables: [],
|
|
990
|
-
blockedEnvironmentVariables: [],
|
|
991
|
-
},
|
|
992
|
-
}),
|
|
993
|
-
getToolRegistry: () => toolRegistry,
|
|
994
|
-
getHookSystem: () => undefined,
|
|
995
|
-
getPolicyEngine: () => ({
|
|
996
|
-
check: async () => ({ decision: PolicyDecision.ASK_USER }),
|
|
997
|
-
}),
|
|
998
|
-
});
|
|
999
|
-
const scheduler = new CoreToolScheduler({
|
|
1000
|
-
config: mockConfig,
|
|
1001
|
-
onAllToolCallsComplete,
|
|
1002
|
-
onToolCallsUpdate,
|
|
1003
|
-
getPreferredEditor: () => 'vscode',
|
|
1004
|
-
});
|
|
1005
|
-
const abortController = new AbortController();
|
|
1006
|
-
const request = {
|
|
1007
|
-
callId: 'shell-1',
|
|
1008
|
-
name: 'run_shell_command',
|
|
1009
|
-
args: { command: 'git status && rm -rf /tmp/should-not-run' },
|
|
1010
|
-
isClientInitiated: false,
|
|
1011
|
-
prompt_id: 'prompt-shell-auto-approved',
|
|
1012
|
-
};
|
|
1013
|
-
await scheduler.schedule([request], abortController.signal);
|
|
1014
|
-
const statusUpdates = onToolCallsUpdate.mock.calls
|
|
1015
|
-
.map((call) => call[0][0]?.status)
|
|
1016
|
-
.filter(Boolean);
|
|
1017
|
-
expect(statusUpdates).toContain('awaiting_approval');
|
|
1018
|
-
expect(executeFn).not.toHaveBeenCalled();
|
|
1019
|
-
expect(onAllToolCallsComplete).not.toHaveBeenCalled();
|
|
1020
|
-
}, 20000);
|
|
1021
|
-
it('should handle two synchronous calls to schedule', async () => {
|
|
1022
|
-
const executeFn = vi.fn().mockResolvedValue({
|
|
1023
|
-
llmContent: 'Tool executed',
|
|
1024
|
-
returnDisplay: 'Tool executed',
|
|
1025
|
-
});
|
|
1026
|
-
const mockTool = new MockTool({ name: 'mockTool', execute: executeFn });
|
|
1027
|
-
const declarativeTool = mockTool;
|
|
1028
|
-
const mockToolRegistry = {
|
|
1029
|
-
getTool: () => declarativeTool,
|
|
1030
|
-
getToolByName: () => declarativeTool,
|
|
1031
|
-
getFunctionDeclarations: () => [],
|
|
1032
|
-
tools: new Map(),
|
|
1033
|
-
discovery: {},
|
|
1034
|
-
registerTool: () => { },
|
|
1035
|
-
getToolByDisplayName: () => declarativeTool,
|
|
1036
|
-
getTools: () => [],
|
|
1037
|
-
discoverTools: async () => { },
|
|
1038
|
-
getAllTools: () => [],
|
|
1039
|
-
getToolsByServer: () => [],
|
|
1040
|
-
};
|
|
1041
|
-
const onAllToolCallsComplete = vi.fn();
|
|
1042
|
-
const onToolCallsUpdate = vi.fn();
|
|
1043
|
-
const mockConfig = createMockConfig({
|
|
1044
|
-
getToolRegistry: () => mockToolRegistry,
|
|
1045
|
-
getApprovalMode: () => ApprovalMode.YOLO,
|
|
1046
|
-
});
|
|
1047
|
-
const mockMessageBus = createMockMessageBus();
|
|
1048
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
1049
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
1050
|
-
mockConfig.getHookSystem = vi
|
|
1051
|
-
.fn()
|
|
1052
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
1053
|
-
const scheduler = new CoreToolScheduler({
|
|
1054
|
-
config: mockConfig,
|
|
1055
|
-
onAllToolCallsComplete,
|
|
1056
|
-
onToolCallsUpdate,
|
|
1057
|
-
getPreferredEditor: () => 'vscode',
|
|
1058
|
-
});
|
|
1059
|
-
const abortController = new AbortController();
|
|
1060
|
-
const request1 = {
|
|
1061
|
-
callId: '1',
|
|
1062
|
-
name: 'mockTool',
|
|
1063
|
-
args: { a: 1 },
|
|
1064
|
-
isClientInitiated: false,
|
|
1065
|
-
prompt_id: 'prompt-1',
|
|
1066
|
-
};
|
|
1067
|
-
const request2 = {
|
|
1068
|
-
callId: '2',
|
|
1069
|
-
name: 'mockTool',
|
|
1070
|
-
args: { b: 2 },
|
|
1071
|
-
isClientInitiated: false,
|
|
1072
|
-
prompt_id: 'prompt-2',
|
|
1073
|
-
};
|
|
1074
|
-
// Schedule two calls synchronously.
|
|
1075
|
-
const schedulePromise1 = scheduler.schedule([request1], abortController.signal);
|
|
1076
|
-
const schedulePromise2 = scheduler.schedule([request2], abortController.signal);
|
|
1077
|
-
// Wait for both promises to resolve.
|
|
1078
|
-
await Promise.all([schedulePromise1, schedulePromise2]);
|
|
1079
|
-
// Ensure the tool was called twice with the correct arguments.
|
|
1080
|
-
expect(executeFn).toHaveBeenCalledTimes(2);
|
|
1081
|
-
expect(executeFn).toHaveBeenCalledWith({ a: 1 });
|
|
1082
|
-
expect(executeFn).toHaveBeenCalledWith({ b: 2 });
|
|
1083
|
-
// Ensure completion callbacks were called twice.
|
|
1084
|
-
expect(onAllToolCallsComplete).toHaveBeenCalledTimes(2);
|
|
1085
|
-
});
|
|
1086
|
-
it('should auto-approve remaining tool calls when first tool call is approved with ProceedAlways', async () => {
|
|
1087
|
-
let approvalMode = ApprovalMode.DEFAULT;
|
|
1088
|
-
const mockConfig = createMockConfig({
|
|
1089
|
-
getApprovalMode: () => approvalMode,
|
|
1090
|
-
setApprovalMode: (mode) => {
|
|
1091
|
-
approvalMode = mode;
|
|
1092
|
-
},
|
|
1093
|
-
});
|
|
1094
|
-
const mockMessageBus = createMockMessageBus();
|
|
1095
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
1096
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
1097
|
-
mockConfig.getHookSystem = vi
|
|
1098
|
-
.fn()
|
|
1099
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
1100
|
-
const testTool = new TestApprovalTool(mockConfig, mockMessageBus);
|
|
1101
|
-
const toolRegistry = {
|
|
1102
|
-
getTool: () => testTool,
|
|
1103
|
-
getFunctionDeclarations: () => [],
|
|
1104
|
-
getFunctionDeclarationsFiltered: () => [],
|
|
1105
|
-
registerTool: () => { },
|
|
1106
|
-
discoverAllTools: async () => { },
|
|
1107
|
-
discoverMcpTools: async () => { },
|
|
1108
|
-
discoverToolsForServer: async () => { },
|
|
1109
|
-
removeMcpToolsByServer: () => { },
|
|
1110
|
-
getAllTools: () => [],
|
|
1111
|
-
getToolsByServer: () => [],
|
|
1112
|
-
tools: new Map(),
|
|
1113
|
-
config: mockConfig,
|
|
1114
|
-
mcpClientManager: undefined,
|
|
1115
|
-
getToolByName: () => testTool,
|
|
1116
|
-
getToolByDisplayName: () => testTool,
|
|
1117
|
-
getTools: () => [],
|
|
1118
|
-
discoverTools: async () => { },
|
|
1119
|
-
discovery: {},
|
|
1120
|
-
};
|
|
1121
|
-
mockConfig.getToolRegistry = () => toolRegistry;
|
|
1122
|
-
const onAllToolCallsComplete = vi.fn();
|
|
1123
|
-
const onToolCallsUpdate = vi.fn();
|
|
1124
|
-
const pendingConfirmations = [];
|
|
1125
|
-
const scheduler = new CoreToolScheduler({
|
|
1126
|
-
config: mockConfig,
|
|
1127
|
-
onAllToolCallsComplete,
|
|
1128
|
-
onToolCallsUpdate: (toolCalls) => {
|
|
1129
|
-
onToolCallsUpdate(toolCalls);
|
|
1130
|
-
// Capture confirmation handlers for awaiting_approval tools
|
|
1131
|
-
toolCalls.forEach((call) => {
|
|
1132
|
-
if (call.status === 'awaiting_approval') {
|
|
1133
|
-
const waitingCall = call;
|
|
1134
|
-
const details = waitingCall.confirmationDetails;
|
|
1135
|
-
if (details?.onConfirm) {
|
|
1136
|
-
const originalHandler = pendingConfirmations.find((h) => h === details.onConfirm);
|
|
1137
|
-
if (!originalHandler) {
|
|
1138
|
-
pendingConfirmations.push(details.onConfirm);
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1143
|
-
},
|
|
1144
|
-
getPreferredEditor: () => 'vscode',
|
|
1145
|
-
});
|
|
1146
|
-
const abortController = new AbortController();
|
|
1147
|
-
// Schedule multiple tools that need confirmation
|
|
1148
|
-
const requests = [
|
|
1149
|
-
{
|
|
1150
|
-
callId: '1',
|
|
1151
|
-
name: 'testApprovalTool',
|
|
1152
|
-
args: { id: 'first' },
|
|
1153
|
-
isClientInitiated: false,
|
|
1154
|
-
prompt_id: 'prompt-1',
|
|
1155
|
-
},
|
|
1156
|
-
{
|
|
1157
|
-
callId: '2',
|
|
1158
|
-
name: 'testApprovalTool',
|
|
1159
|
-
args: { id: 'second' },
|
|
1160
|
-
isClientInitiated: false,
|
|
1161
|
-
prompt_id: 'prompt-2',
|
|
1162
|
-
},
|
|
1163
|
-
{
|
|
1164
|
-
callId: '3',
|
|
1165
|
-
name: 'testApprovalTool',
|
|
1166
|
-
args: { id: 'third' },
|
|
1167
|
-
isClientInitiated: false,
|
|
1168
|
-
prompt_id: 'prompt-3',
|
|
1169
|
-
},
|
|
1170
|
-
];
|
|
1171
|
-
await scheduler.schedule(requests, abortController.signal);
|
|
1172
|
-
// Wait for the FIRST tool to be awaiting approval
|
|
1173
|
-
await vi.waitFor(() => {
|
|
1174
|
-
const calls = onToolCallsUpdate.mock.calls.at(-1)?.[0];
|
|
1175
|
-
// With the sequential scheduler, the update includes the active call and the queue.
|
|
1176
|
-
expect(calls?.length).toBe(3);
|
|
1177
|
-
expect(calls?.[0].status).toBe('awaiting_approval');
|
|
1178
|
-
expect(calls?.[0].request.callId).toBe('1');
|
|
1179
|
-
// Check that the other two are in the queue (still in 'validating' state)
|
|
1180
|
-
expect(calls?.[1].status).toBe('validating');
|
|
1181
|
-
expect(calls?.[2].status).toBe('validating');
|
|
1182
|
-
});
|
|
1183
|
-
expect(pendingConfirmations.length).toBe(1);
|
|
1184
|
-
// Approve the first tool with ProceedAlways
|
|
1185
|
-
const firstConfirmation = pendingConfirmations[0];
|
|
1186
|
-
firstConfirmation(ToolConfirmationOutcome.ProceedAlways);
|
|
1187
|
-
// Wait for all tools to be completed
|
|
1188
|
-
await vi.waitFor(() => {
|
|
1189
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
1190
|
-
});
|
|
1191
|
-
const completedCalls = onAllToolCallsComplete.mock.calls.at(-1)?.[0];
|
|
1192
|
-
expect(completedCalls?.length).toBe(3);
|
|
1193
|
-
expect(completedCalls?.every((call) => call.status === 'success')).toBe(true);
|
|
1194
|
-
// Verify approval mode was changed
|
|
1195
|
-
expect(approvalMode).toBe(ApprovalMode.AUTO_EDIT);
|
|
1196
|
-
});
|
|
1197
|
-
});
|
|
1198
|
-
describe('CoreToolScheduler Sequential Execution', () => {
|
|
1199
|
-
it('should execute tool calls in a batch sequentially', async () => {
|
|
1200
|
-
// Arrange
|
|
1201
|
-
let firstCallFinished = false;
|
|
1202
|
-
const executeFn = vi
|
|
1203
|
-
.fn()
|
|
1204
|
-
.mockImplementation(async (args) => {
|
|
1205
|
-
if (args.call === 1) {
|
|
1206
|
-
// First call, wait for a bit to simulate work
|
|
1207
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
1208
|
-
firstCallFinished = true;
|
|
1209
|
-
return { llmContent: 'First call done' };
|
|
1210
|
-
}
|
|
1211
|
-
if (args.call === 2) {
|
|
1212
|
-
// Second call, should only happen after the first is finished
|
|
1213
|
-
if (!firstCallFinished) {
|
|
1214
|
-
throw new Error('Second tool call started before the first one finished!');
|
|
1215
|
-
}
|
|
1216
|
-
return { llmContent: 'Second call done' };
|
|
1217
|
-
}
|
|
1218
|
-
return { llmContent: 'default' };
|
|
1219
|
-
});
|
|
1220
|
-
const mockTool = new MockTool({ name: 'mockTool', execute: executeFn });
|
|
1221
|
-
const declarativeTool = mockTool;
|
|
1222
|
-
const mockToolRegistry = {
|
|
1223
|
-
getTool: () => declarativeTool,
|
|
1224
|
-
getToolByName: () => declarativeTool,
|
|
1225
|
-
getFunctionDeclarations: () => [],
|
|
1226
|
-
tools: new Map(),
|
|
1227
|
-
discovery: {},
|
|
1228
|
-
registerTool: () => { },
|
|
1229
|
-
getToolByDisplayName: () => declarativeTool,
|
|
1230
|
-
getTools: () => [],
|
|
1231
|
-
discoverTools: async () => { },
|
|
1232
|
-
getAllTools: () => [],
|
|
1233
|
-
getToolsByServer: () => [],
|
|
1234
|
-
};
|
|
1235
|
-
const onAllToolCallsComplete = vi.fn();
|
|
1236
|
-
const onToolCallsUpdate = vi.fn();
|
|
1237
|
-
const mockConfig = createMockConfig({
|
|
1238
|
-
getToolRegistry: () => mockToolRegistry,
|
|
1239
|
-
getApprovalMode: () => ApprovalMode.YOLO, // Use YOLO to avoid confirmation prompts
|
|
1240
|
-
isInteractive: () => false,
|
|
1241
|
-
});
|
|
1242
|
-
const mockMessageBus = createMockMessageBus();
|
|
1243
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
1244
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
1245
|
-
mockConfig.getHookSystem = vi
|
|
1246
|
-
.fn()
|
|
1247
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
1248
|
-
const scheduler = new CoreToolScheduler({
|
|
1249
|
-
config: mockConfig,
|
|
1250
|
-
onAllToolCallsComplete,
|
|
1251
|
-
onToolCallsUpdate,
|
|
1252
|
-
getPreferredEditor: () => 'vscode',
|
|
1253
|
-
});
|
|
1254
|
-
const abortController = new AbortController();
|
|
1255
|
-
const requests = [
|
|
1256
|
-
{
|
|
1257
|
-
callId: '1',
|
|
1258
|
-
name: 'mockTool',
|
|
1259
|
-
args: { call: 1 },
|
|
1260
|
-
isClientInitiated: false,
|
|
1261
|
-
prompt_id: 'prompt-1',
|
|
1262
|
-
},
|
|
1263
|
-
{
|
|
1264
|
-
callId: '2',
|
|
1265
|
-
name: 'mockTool',
|
|
1266
|
-
args: { call: 2 },
|
|
1267
|
-
isClientInitiated: false,
|
|
1268
|
-
prompt_id: 'prompt-1',
|
|
1269
|
-
},
|
|
1270
|
-
];
|
|
1271
|
-
// Act
|
|
1272
|
-
await scheduler.schedule(requests, abortController.signal);
|
|
1273
|
-
// Assert
|
|
1274
|
-
await vi.waitFor(() => {
|
|
1275
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
1276
|
-
});
|
|
1277
|
-
// Check that execute was called twice
|
|
1278
|
-
expect(executeFn).toHaveBeenCalledTimes(2);
|
|
1279
|
-
// Check the order of calls
|
|
1280
|
-
const calls = executeFn.mock.calls;
|
|
1281
|
-
expect(calls[0][0]).toEqual({ call: 1 });
|
|
1282
|
-
expect(calls[1][0]).toEqual({ call: 2 });
|
|
1283
|
-
// The onAllToolCallsComplete should be called once with both results
|
|
1284
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
1285
|
-
.calls[0][0];
|
|
1286
|
-
expect(completedCalls).toHaveLength(2);
|
|
1287
|
-
expect(completedCalls[0].status).toBe('success');
|
|
1288
|
-
expect(completedCalls[1].status).toBe('success');
|
|
1289
|
-
});
|
|
1290
|
-
it('should cancel subsequent tools when the signal is aborted.', async () => {
|
|
1291
|
-
// Arrange
|
|
1292
|
-
const abortController = new AbortController();
|
|
1293
|
-
let secondCallStarted = false;
|
|
1294
|
-
const executeFn = vi
|
|
1295
|
-
.fn()
|
|
1296
|
-
.mockImplementation(async (args) => {
|
|
1297
|
-
if (args.call === 1) {
|
|
1298
|
-
return { llmContent: 'First call done' };
|
|
1299
|
-
}
|
|
1300
|
-
if (args.call === 2) {
|
|
1301
|
-
secondCallStarted = true;
|
|
1302
|
-
// This call will be cancelled while it's "running".
|
|
1303
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
1304
|
-
// It should not return a value because it will be cancelled.
|
|
1305
|
-
return { llmContent: 'Second call should not complete' };
|
|
1306
|
-
}
|
|
1307
|
-
if (args.call === 3) {
|
|
1308
|
-
return { llmContent: 'Third call done' };
|
|
1309
|
-
}
|
|
1310
|
-
return { llmContent: 'default' };
|
|
1311
|
-
});
|
|
1312
|
-
const mockTool = new MockTool({ name: 'mockTool', execute: executeFn });
|
|
1313
|
-
const declarativeTool = mockTool;
|
|
1314
|
-
const mockToolRegistry = {
|
|
1315
|
-
getTool: () => declarativeTool,
|
|
1316
|
-
getToolByName: () => declarativeTool,
|
|
1317
|
-
getFunctionDeclarations: () => [],
|
|
1318
|
-
tools: new Map(),
|
|
1319
|
-
discovery: {},
|
|
1320
|
-
registerTool: () => { },
|
|
1321
|
-
getToolByDisplayName: () => declarativeTool,
|
|
1322
|
-
getTools: () => [],
|
|
1323
|
-
discoverTools: async () => { },
|
|
1324
|
-
getAllTools: () => [],
|
|
1325
|
-
getToolsByServer: () => [],
|
|
1326
|
-
};
|
|
1327
|
-
const onAllToolCallsComplete = vi.fn();
|
|
1328
|
-
const onToolCallsUpdate = vi.fn();
|
|
1329
|
-
const mockConfig = createMockConfig({
|
|
1330
|
-
getToolRegistry: () => mockToolRegistry,
|
|
1331
|
-
getApprovalMode: () => ApprovalMode.YOLO,
|
|
1332
|
-
isInteractive: () => false,
|
|
1333
|
-
});
|
|
1334
|
-
const mockMessageBus = createMockMessageBus();
|
|
1335
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
1336
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
1337
|
-
mockConfig.getHookSystem = vi
|
|
1338
|
-
.fn()
|
|
1339
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
1340
|
-
const scheduler = new CoreToolScheduler({
|
|
1341
|
-
config: mockConfig,
|
|
1342
|
-
onAllToolCallsComplete,
|
|
1343
|
-
onToolCallsUpdate,
|
|
1344
|
-
getPreferredEditor: () => 'vscode',
|
|
1345
|
-
});
|
|
1346
|
-
const requests = [
|
|
1347
|
-
{
|
|
1348
|
-
callId: '1',
|
|
1349
|
-
name: 'mockTool',
|
|
1350
|
-
args: { call: 1 },
|
|
1351
|
-
isClientInitiated: false,
|
|
1352
|
-
prompt_id: 'prompt-1',
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
callId: '2',
|
|
1356
|
-
name: 'mockTool',
|
|
1357
|
-
args: { call: 2 },
|
|
1358
|
-
isClientInitiated: false,
|
|
1359
|
-
prompt_id: 'prompt-1',
|
|
1360
|
-
},
|
|
1361
|
-
{
|
|
1362
|
-
callId: '3',
|
|
1363
|
-
name: 'mockTool',
|
|
1364
|
-
args: { call: 3 },
|
|
1365
|
-
isClientInitiated: false,
|
|
1366
|
-
prompt_id: 'prompt-1',
|
|
1367
|
-
},
|
|
1368
|
-
];
|
|
1369
|
-
// Act
|
|
1370
|
-
const schedulePromise = scheduler.schedule(requests, abortController.signal);
|
|
1371
|
-
// Wait for the second call to start, then abort.
|
|
1372
|
-
await vi.waitFor(() => {
|
|
1373
|
-
expect(secondCallStarted).toBe(true);
|
|
1374
|
-
});
|
|
1375
|
-
abortController.abort();
|
|
1376
|
-
await schedulePromise;
|
|
1377
|
-
// Assert
|
|
1378
|
-
await vi.waitFor(() => {
|
|
1379
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
1380
|
-
});
|
|
1381
|
-
// Check that execute was called for the first two tools only
|
|
1382
|
-
expect(executeFn).toHaveBeenCalledTimes(2);
|
|
1383
|
-
expect(executeFn).toHaveBeenCalledWith({ call: 1 });
|
|
1384
|
-
expect(executeFn).toHaveBeenCalledWith({ call: 2 });
|
|
1385
|
-
const completedCalls = onAllToolCallsComplete.mock
|
|
1386
|
-
.calls[0][0];
|
|
1387
|
-
expect(completedCalls).toHaveLength(3);
|
|
1388
|
-
const call1 = completedCalls.find((c) => c.request.callId === '1');
|
|
1389
|
-
const call2 = completedCalls.find((c) => c.request.callId === '2');
|
|
1390
|
-
const call3 = completedCalls.find((c) => c.request.callId === '3');
|
|
1391
|
-
expect(call1?.status).toBe('success');
|
|
1392
|
-
expect(call2?.status).toBe('cancelled');
|
|
1393
|
-
expect(call3?.status).toBe('cancelled');
|
|
1394
|
-
});
|
|
1395
|
-
it('should pass confirmation diff data into modifyWithEditor overrides', async () => {
|
|
1396
|
-
const modifyWithEditorSpy = vi
|
|
1397
|
-
.spyOn(modifiableToolModule, 'modifyWithEditor')
|
|
1398
|
-
.mockResolvedValue({
|
|
1399
|
-
updatedParams: { param: 'updated' },
|
|
1400
|
-
updatedDiff: 'updated diff',
|
|
1401
|
-
});
|
|
1402
|
-
const mockModifiableTool = new MockModifiableTool('mockModifiableTool');
|
|
1403
|
-
const mockToolRegistry = {
|
|
1404
|
-
getTool: () => mockModifiableTool,
|
|
1405
|
-
getToolByName: () => mockModifiableTool,
|
|
1406
|
-
getFunctionDeclarations: () => [],
|
|
1407
|
-
tools: new Map(),
|
|
1408
|
-
discovery: {},
|
|
1409
|
-
registerTool: () => { },
|
|
1410
|
-
getToolByDisplayName: () => mockModifiableTool,
|
|
1411
|
-
getTools: () => [],
|
|
1412
|
-
discoverTools: async () => { },
|
|
1413
|
-
getAllTools: () => [],
|
|
1414
|
-
getToolsByServer: () => [],
|
|
1415
|
-
};
|
|
1416
|
-
const onAllToolCallsComplete = vi.fn();
|
|
1417
|
-
const onToolCallsUpdate = vi.fn();
|
|
1418
|
-
const mockConfig = createMockConfig({
|
|
1419
|
-
getToolRegistry: () => mockToolRegistry,
|
|
1420
|
-
});
|
|
1421
|
-
const mockMessageBus = createMockMessageBus();
|
|
1422
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
1423
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
1424
|
-
mockConfig.getHookSystem = vi
|
|
1425
|
-
.fn()
|
|
1426
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
1427
|
-
const scheduler = new CoreToolScheduler({
|
|
1428
|
-
config: mockConfig,
|
|
1429
|
-
onAllToolCallsComplete,
|
|
1430
|
-
onToolCallsUpdate,
|
|
1431
|
-
getPreferredEditor: () => 'vscode',
|
|
1432
|
-
});
|
|
1433
|
-
const abortController = new AbortController();
|
|
1434
|
-
await scheduler.schedule([
|
|
1435
|
-
{
|
|
1436
|
-
callId: '1',
|
|
1437
|
-
name: 'mockModifiableTool',
|
|
1438
|
-
args: {},
|
|
1439
|
-
isClientInitiated: false,
|
|
1440
|
-
prompt_id: 'prompt-1',
|
|
1441
|
-
},
|
|
1442
|
-
], abortController.signal);
|
|
1443
|
-
const toolCall = scheduler
|
|
1444
|
-
.toolCalls[0];
|
|
1445
|
-
expect(toolCall.status).toBe('awaiting_approval');
|
|
1446
|
-
const confirmationSignal = new AbortController().signal;
|
|
1447
|
-
await scheduler.handleConfirmationResponse(toolCall.request.callId, async () => { }, ToolConfirmationOutcome.ModifyWithEditor, confirmationSignal);
|
|
1448
|
-
expect(modifyWithEditorSpy).toHaveBeenCalled();
|
|
1449
|
-
const overrides = modifyWithEditorSpy.mock.calls[modifyWithEditorSpy.mock.calls.length - 1][4];
|
|
1450
|
-
expect(overrides).toEqual({
|
|
1451
|
-
currentContent: 'originalContent',
|
|
1452
|
-
proposedContent: 'newContent',
|
|
1453
|
-
});
|
|
1454
|
-
modifyWithEditorSpy.mockRestore();
|
|
1455
|
-
});
|
|
1456
|
-
it('should pass serverName to policy engine for DiscoveredMCPTool', async () => {
|
|
1457
|
-
const mockMcpTool = {
|
|
1458
|
-
tool: async () => ({ functionDeclarations: [] }),
|
|
1459
|
-
callTool: async () => [],
|
|
1460
|
-
};
|
|
1461
|
-
const serverName = 'test-server';
|
|
1462
|
-
const toolName = 'test-tool';
|
|
1463
|
-
const mcpTool = new DiscoveredMCPTool(mockMcpTool, serverName, toolName, 'description', { type: 'object', properties: {} }, createMockMessageBus());
|
|
1464
|
-
const mockToolRegistry = {
|
|
1465
|
-
getTool: () => mcpTool,
|
|
1466
|
-
getFunctionDeclarations: () => [],
|
|
1467
|
-
tools: new Map(),
|
|
1468
|
-
discovery: {},
|
|
1469
|
-
registerTool: () => { },
|
|
1470
|
-
getToolByName: () => mcpTool,
|
|
1471
|
-
getToolByDisplayName: () => mcpTool,
|
|
1472
|
-
getTools: () => [],
|
|
1473
|
-
discoverTools: async () => { },
|
|
1474
|
-
getAllTools: () => [],
|
|
1475
|
-
getToolsByServer: () => [],
|
|
1476
|
-
};
|
|
1477
|
-
const mockPolicyEngineCheck = vi.fn().mockResolvedValue({
|
|
1478
|
-
decision: PolicyDecision.ALLOW,
|
|
1479
|
-
});
|
|
1480
|
-
const mockConfig = createMockConfig({
|
|
1481
|
-
getToolRegistry: () => mockToolRegistry,
|
|
1482
|
-
getPolicyEngine: () => ({
|
|
1483
|
-
check: mockPolicyEngineCheck,
|
|
1484
|
-
}),
|
|
1485
|
-
isInteractive: () => false,
|
|
1486
|
-
});
|
|
1487
|
-
mockConfig.getHookSystem = vi.fn().mockReturnValue(undefined);
|
|
1488
|
-
const scheduler = new CoreToolScheduler({
|
|
1489
|
-
config: mockConfig,
|
|
1490
|
-
getPreferredEditor: () => 'vscode',
|
|
1491
|
-
});
|
|
1492
|
-
const abortController = new AbortController();
|
|
1493
|
-
const request = {
|
|
1494
|
-
callId: '1',
|
|
1495
|
-
name: toolName,
|
|
1496
|
-
args: {},
|
|
1497
|
-
isClientInitiated: false,
|
|
1498
|
-
prompt_id: 'prompt-id-1',
|
|
1499
|
-
};
|
|
1500
|
-
await scheduler.schedule(request, abortController.signal);
|
|
1501
|
-
expect(mockPolicyEngineCheck).toHaveBeenCalledWith(expect.objectContaining({ name: toolName }), serverName);
|
|
1502
|
-
});
|
|
1503
|
-
it('should not double-report completed tools when concurrent completions occur', async () => {
|
|
1504
|
-
// Arrange
|
|
1505
|
-
const executeFn = vi.fn().mockResolvedValue({ llmContent: 'success' });
|
|
1506
|
-
const mockTool = new MockTool({ name: 'mockTool', execute: executeFn });
|
|
1507
|
-
const declarativeTool = mockTool;
|
|
1508
|
-
const mockToolRegistry = {
|
|
1509
|
-
getTool: () => declarativeTool,
|
|
1510
|
-
getToolByName: () => declarativeTool,
|
|
1511
|
-
getFunctionDeclarations: () => [],
|
|
1512
|
-
tools: new Map(),
|
|
1513
|
-
discovery: {},
|
|
1514
|
-
registerTool: () => { },
|
|
1515
|
-
getToolByDisplayName: () => declarativeTool,
|
|
1516
|
-
getTools: () => [],
|
|
1517
|
-
discoverTools: async () => { },
|
|
1518
|
-
getAllTools: () => [],
|
|
1519
|
-
getToolsByServer: () => [],
|
|
1520
|
-
};
|
|
1521
|
-
let completionCallCount = 0;
|
|
1522
|
-
const onAllToolCallsComplete = vi.fn().mockImplementation(async () => {
|
|
1523
|
-
completionCallCount++;
|
|
1524
|
-
// Simulate slow reporting (e.g. Gemini API call)
|
|
1525
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
1526
|
-
});
|
|
1527
|
-
const mockConfig = createMockConfig({
|
|
1528
|
-
getToolRegistry: () => mockToolRegistry,
|
|
1529
|
-
getApprovalMode: () => ApprovalMode.YOLO,
|
|
1530
|
-
isInteractive: () => false,
|
|
1531
|
-
});
|
|
1532
|
-
const mockMessageBus = createMockMessageBus();
|
|
1533
|
-
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
1534
|
-
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
1535
|
-
mockConfig.getHookSystem = vi
|
|
1536
|
-
.fn()
|
|
1537
|
-
.mockReturnValue(new HookSystem(mockConfig));
|
|
1538
|
-
const scheduler = new CoreToolScheduler({
|
|
1539
|
-
config: mockConfig,
|
|
1540
|
-
onAllToolCallsComplete,
|
|
1541
|
-
getPreferredEditor: () => 'vscode',
|
|
1542
|
-
});
|
|
1543
|
-
const abortController = new AbortController();
|
|
1544
|
-
const request = {
|
|
1545
|
-
callId: '1',
|
|
1546
|
-
name: 'mockTool',
|
|
1547
|
-
args: {},
|
|
1548
|
-
isClientInitiated: false,
|
|
1549
|
-
prompt_id: 'prompt-1',
|
|
1550
|
-
};
|
|
1551
|
-
// Act
|
|
1552
|
-
// 1. Start execution
|
|
1553
|
-
const schedulePromise = scheduler.schedule([request], abortController.signal);
|
|
1554
|
-
// 2. Wait just enough for it to finish and enter checkAndNotifyCompletion
|
|
1555
|
-
// (awaiting our slow mock)
|
|
1556
|
-
await vi.waitFor(() => {
|
|
1557
|
-
expect(completionCallCount).toBe(1);
|
|
1558
|
-
});
|
|
1559
|
-
// 3. Trigger a concurrent completion event (e.g. via cancelAll)
|
|
1560
|
-
scheduler.cancelAll(abortController.signal);
|
|
1561
|
-
await schedulePromise;
|
|
1562
|
-
// Assert
|
|
1563
|
-
// Even though cancelAll was called while the first completion was in progress,
|
|
1564
|
-
// it should not have triggered a SECOND completion call because the first one
|
|
1565
|
-
// was still 'finalizing' and will drain any new tools.
|
|
1566
|
-
expect(onAllToolCallsComplete).toHaveBeenCalledTimes(1);
|
|
1567
|
-
});
|
|
1568
|
-
it('should complete reporting all tools even mid-callback during abort', async () => {
|
|
1569
|
-
// Arrange
|
|
1570
|
-
const onAllToolCallsComplete = vi.fn().mockImplementation(async () => {
|
|
1571
|
-
// Simulate slow reporting
|
|
1572
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
1573
|
-
});
|
|
1574
|
-
const mockTool = new MockTool({ name: 'mockTool' });
|
|
1575
|
-
const mockToolRegistry = {
|
|
1576
|
-
getTool: () => mockTool,
|
|
1577
|
-
getToolByName: () => mockTool,
|
|
1578
|
-
getFunctionDeclarations: () => [],
|
|
1579
|
-
tools: new Map(),
|
|
1580
|
-
discovery: {},
|
|
1581
|
-
registerTool: () => { },
|
|
1582
|
-
getToolByDisplayName: () => mockTool,
|
|
1583
|
-
getTools: () => [],
|
|
1584
|
-
discoverTools: async () => { },
|
|
1585
|
-
getAllTools: () => [],
|
|
1586
|
-
getToolsByServer: () => [],
|
|
1587
|
-
};
|
|
1588
|
-
const mockConfig = createMockConfig({
|
|
1589
|
-
getToolRegistry: () => mockToolRegistry,
|
|
1590
|
-
getApprovalMode: () => ApprovalMode.YOLO,
|
|
1591
|
-
isInteractive: () => false,
|
|
1592
|
-
});
|
|
1593
|
-
mockConfig.getHookSystem = vi.fn().mockReturnValue(undefined);
|
|
1594
|
-
const scheduler = new CoreToolScheduler({
|
|
1595
|
-
config: mockConfig,
|
|
1596
|
-
onAllToolCallsComplete,
|
|
1597
|
-
getPreferredEditor: () => 'vscode',
|
|
1598
|
-
});
|
|
1599
|
-
const abortController = new AbortController();
|
|
1600
|
-
const signal = abortController.signal;
|
|
1601
|
-
// Act
|
|
1602
|
-
// 1. Start execution of two tools
|
|
1603
|
-
const schedulePromise = scheduler.schedule([
|
|
1604
|
-
{
|
|
1605
|
-
callId: '1',
|
|
1606
|
-
name: 'mockTool',
|
|
1607
|
-
args: {},
|
|
1608
|
-
isClientInitiated: false,
|
|
1609
|
-
prompt_id: 'prompt-1',
|
|
1610
|
-
},
|
|
1611
|
-
{
|
|
1612
|
-
callId: '2',
|
|
1613
|
-
name: 'mockTool',
|
|
1614
|
-
args: {},
|
|
1615
|
-
isClientInitiated: false,
|
|
1616
|
-
prompt_id: 'prompt-1',
|
|
1617
|
-
},
|
|
1618
|
-
], signal);
|
|
1619
|
-
// 2. Wait for reporting to start
|
|
1620
|
-
await vi.waitFor(() => {
|
|
1621
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
1622
|
-
});
|
|
1623
|
-
// 3. Abort the signal while reporting is in progress
|
|
1624
|
-
abortController.abort();
|
|
1625
|
-
await schedulePromise;
|
|
1626
|
-
// Assert
|
|
1627
|
-
// Verify that onAllToolCallsComplete was called and processed the tools,
|
|
1628
|
-
// and that the scheduler didn't just drop them because of the abort.
|
|
1629
|
-
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
1630
|
-
const reportedTools = onAllToolCallsComplete.mock.calls.flatMap((call) =>
|
|
1631
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1632
|
-
call[0].map((t) => t.request.callId));
|
|
1633
|
-
// Both tools should have been reported exactly once with success status
|
|
1634
|
-
expect(reportedTools).toContain('1');
|
|
1635
|
-
expect(reportedTools).toContain('2');
|
|
1636
|
-
const allStatuses = onAllToolCallsComplete.mock.calls.flatMap((call) =>
|
|
1637
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1638
|
-
call[0].map((t) => t.status));
|
|
1639
|
-
expect(allStatuses).toEqual(['success', 'success']);
|
|
1640
|
-
expect(onAllToolCallsComplete).toHaveBeenCalledTimes(1);
|
|
1641
|
-
});
|
|
1642
|
-
describe('Policy Decisions in Plan Mode', () => {
|
|
1643
|
-
it('should return STOP_EXECUTION error type and informative message when denied in Plan Mode', async () => {
|
|
1644
|
-
const mockTool = new MockTool({
|
|
1645
|
-
name: 'dangerous_tool',
|
|
1646
|
-
displayName: 'Dangerous Tool',
|
|
1647
|
-
description: 'Does risky stuff',
|
|
1648
|
-
});
|
|
1649
|
-
const mockToolRegistry = {
|
|
1650
|
-
getTool: () => mockTool,
|
|
1651
|
-
getAllToolNames: () => ['dangerous_tool'],
|
|
1652
|
-
};
|
|
1653
|
-
const onAllToolCallsComplete = vi.fn();
|
|
1654
|
-
const mockConfig = createMockConfig({
|
|
1655
|
-
getToolRegistry: () => mockToolRegistry,
|
|
1656
|
-
getApprovalMode: () => ApprovalMode.PLAN,
|
|
1657
|
-
getPolicyEngine: () => ({
|
|
1658
|
-
check: async () => ({ decision: PolicyDecision.DENY }),
|
|
1659
|
-
}),
|
|
1660
|
-
});
|
|
1661
|
-
mockConfig.getHookSystem = vi.fn().mockReturnValue(undefined);
|
|
1662
|
-
const scheduler = new CoreToolScheduler({
|
|
1663
|
-
config: mockConfig,
|
|
1664
|
-
onAllToolCallsComplete,
|
|
1665
|
-
getPreferredEditor: () => 'vscode',
|
|
1666
|
-
});
|
|
1667
|
-
const request = {
|
|
1668
|
-
callId: 'call-1',
|
|
1669
|
-
name: 'dangerous_tool',
|
|
1670
|
-
args: {},
|
|
1671
|
-
isClientInitiated: false,
|
|
1672
|
-
prompt_id: 'prompt-1',
|
|
1673
|
-
};
|
|
1674
|
-
await scheduler.schedule(request, new AbortController().signal);
|
|
1675
|
-
expect(onAllToolCallsComplete).toHaveBeenCalledTimes(1);
|
|
1676
|
-
const reportedTools = onAllToolCallsComplete.mock.calls[0][0];
|
|
1677
|
-
const result = reportedTools[0];
|
|
1678
|
-
expect(result.status).toBe('error');
|
|
1679
|
-
expect(result.response.errorType).toBe(ToolErrorType.STOP_EXECUTION);
|
|
1680
|
-
expect(result.response.error.message).toBe(PLAN_MODE_DENIAL_MESSAGE);
|
|
1681
|
-
});
|
|
1682
|
-
});
|
|
1683
|
-
});
|
|
1684
|
-
//# sourceMappingURL=coreToolScheduler.test.js.map
|