@didim365/agent-cli-core 0.1.1 → 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,1577 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect, vi, beforeEach, afterEach, } from 'vitest';
|
|
7
|
-
import { debugLogger } from '../utils/debugLogger.js';
|
|
8
|
-
import { LocalAgentExecutor } from './local-executor.js';
|
|
9
|
-
import { makeFakeConfig } from '../test-utils/config.js';
|
|
10
|
-
import { ToolRegistry } from '../tools/tool-registry.js';
|
|
11
|
-
import { DiscoveredMCPTool, MCP_QUALIFIED_NAME_SEPARATOR, } from '../tools/mcp-tool.js';
|
|
12
|
-
import { LSTool } from '../tools/ls.js';
|
|
13
|
-
import { LS_TOOL_NAME, READ_FILE_TOOL_NAME } from '../tools/tool-names.js';
|
|
14
|
-
import { GeminiChat, StreamEventType, } from '../core/geminiChat.js';
|
|
15
|
-
import {} from '@google/genai';
|
|
16
|
-
import { MockTool } from '../test-utils/mock-tool.js';
|
|
17
|
-
import { getDirectoryContextString } from '../utils/environmentContext.js';
|
|
18
|
-
import { z } from 'zod';
|
|
19
|
-
import { promptIdContext } from '../utils/promptIdContext.js';
|
|
20
|
-
import { logAgentStart, logAgentFinish, logRecoveryAttempt, } from '../telemetry/loggers.js';
|
|
21
|
-
import { AgentStartEvent, AgentFinishEvent, RecoveryAttemptEvent, } from '../telemetry/types.js';
|
|
22
|
-
import { AgentTerminateMode } from './types.js';
|
|
23
|
-
import { CompressionStatus } from '../core/turn.js';
|
|
24
|
-
import { ChatCompressionService } from '../services/chatCompressionService.js';
|
|
25
|
-
import { getModelConfigAlias } from './registry.js';
|
|
26
|
-
const { mockSendMessageStream, mockScheduleAgentTools, mockSetSystemInstruction, mockCompress, } = vi.hoisted(() => ({
|
|
27
|
-
mockSendMessageStream: vi.fn(),
|
|
28
|
-
mockScheduleAgentTools: vi.fn(),
|
|
29
|
-
mockSetSystemInstruction: vi.fn(),
|
|
30
|
-
mockCompress: vi.fn(),
|
|
31
|
-
}));
|
|
32
|
-
let mockChatHistory = [];
|
|
33
|
-
const mockSetHistory = vi.fn((newHistory) => {
|
|
34
|
-
mockChatHistory = newHistory;
|
|
35
|
-
});
|
|
36
|
-
vi.mock('../services/chatCompressionService.js', () => ({
|
|
37
|
-
ChatCompressionService: vi.fn().mockImplementation(() => ({
|
|
38
|
-
compress: mockCompress,
|
|
39
|
-
})),
|
|
40
|
-
}));
|
|
41
|
-
vi.mock('../core/geminiChat.js', async (importOriginal) => {
|
|
42
|
-
const actual = await importOriginal();
|
|
43
|
-
return {
|
|
44
|
-
...actual,
|
|
45
|
-
GeminiChat: vi.fn().mockImplementation(() => ({
|
|
46
|
-
sendMessageStream: mockSendMessageStream,
|
|
47
|
-
getHistory: vi.fn((_curated) => [...mockChatHistory]),
|
|
48
|
-
setHistory: mockSetHistory,
|
|
49
|
-
setSystemInstruction: mockSetSystemInstruction,
|
|
50
|
-
})),
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
|
-
vi.mock('./agent-scheduler.js', () => ({
|
|
54
|
-
scheduleAgentTools: mockScheduleAgentTools,
|
|
55
|
-
}));
|
|
56
|
-
vi.mock('../utils/version.js', () => ({
|
|
57
|
-
getVersion: vi.fn().mockResolvedValue('1.2.3'),
|
|
58
|
-
}));
|
|
59
|
-
vi.mock('../utils/environmentContext.js');
|
|
60
|
-
vi.mock('../telemetry/loggers.js', () => ({
|
|
61
|
-
logAgentStart: vi.fn(),
|
|
62
|
-
logAgentFinish: vi.fn(),
|
|
63
|
-
logRecoveryAttempt: vi.fn(),
|
|
64
|
-
}));
|
|
65
|
-
vi.mock('../utils/schemaValidator.js', () => ({
|
|
66
|
-
SchemaValidator: {
|
|
67
|
-
validate: vi.fn().mockReturnValue(null),
|
|
68
|
-
validateSchema: vi.fn().mockReturnValue(null),
|
|
69
|
-
},
|
|
70
|
-
}));
|
|
71
|
-
vi.mock('../utils/filesearch/crawler.js', () => ({
|
|
72
|
-
crawl: vi.fn().mockResolvedValue([]),
|
|
73
|
-
}));
|
|
74
|
-
vi.mock('../telemetry/clearcut-logger/clearcut-logger.js', () => ({
|
|
75
|
-
ClearcutLogger: class {
|
|
76
|
-
log() { }
|
|
77
|
-
},
|
|
78
|
-
}));
|
|
79
|
-
vi.mock('../utils/promptIdContext.js', async (importOriginal) => {
|
|
80
|
-
const actual = await importOriginal();
|
|
81
|
-
return {
|
|
82
|
-
...actual,
|
|
83
|
-
promptIdContext: {
|
|
84
|
-
...actual.promptIdContext,
|
|
85
|
-
getStore: vi.fn(),
|
|
86
|
-
run: vi.fn((_id, fn) => fn()),
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
const MockedGeminiChat = vi.mocked(GeminiChat);
|
|
91
|
-
const mockedGetDirectoryContextString = vi.mocked(getDirectoryContextString);
|
|
92
|
-
const mockedPromptIdContext = vi.mocked(promptIdContext);
|
|
93
|
-
const mockedLogAgentStart = vi.mocked(logAgentStart);
|
|
94
|
-
const mockedLogAgentFinish = vi.mocked(logAgentFinish);
|
|
95
|
-
const mockedLogRecoveryAttempt = vi.mocked(logRecoveryAttempt);
|
|
96
|
-
// Constants for testing
|
|
97
|
-
const TASK_COMPLETE_TOOL_NAME = 'complete_task';
|
|
98
|
-
const MOCK_TOOL_NOT_ALLOWED = new MockTool({ name: 'write_file_interactive' });
|
|
99
|
-
/**
|
|
100
|
-
* Helper to create a mock API response chunk.
|
|
101
|
-
* Uses conditional spread to handle readonly functionCalls property safely.
|
|
102
|
-
*/
|
|
103
|
-
const createMockResponseChunk = (parts, functionCalls) => ({
|
|
104
|
-
candidates: [{ index: 0, content: { role: 'model', parts } }],
|
|
105
|
-
...(functionCalls && functionCalls.length > 0 ? { functionCalls } : {}),
|
|
106
|
-
});
|
|
107
|
-
/**
|
|
108
|
-
* Helper to mock a single turn of model response in the stream.
|
|
109
|
-
*/
|
|
110
|
-
const mockModelResponse = (functionCalls, thought, text) => {
|
|
111
|
-
const parts = [];
|
|
112
|
-
if (thought) {
|
|
113
|
-
parts.push({
|
|
114
|
-
text: `**${thought}** This is the reasoning part.`,
|
|
115
|
-
thought: true,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
if (text)
|
|
119
|
-
parts.push({ text });
|
|
120
|
-
const responseChunk = createMockResponseChunk(parts, functionCalls);
|
|
121
|
-
mockSendMessageStream.mockImplementationOnce(async () => (async function* () {
|
|
122
|
-
yield {
|
|
123
|
-
type: StreamEventType.CHUNK,
|
|
124
|
-
value: responseChunk,
|
|
125
|
-
};
|
|
126
|
-
})());
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Helper to extract the message parameters sent to sendMessageStream.
|
|
130
|
-
* Provides type safety for inspecting mock calls.
|
|
131
|
-
*/
|
|
132
|
-
const getMockMessageParams = (callIndex) => {
|
|
133
|
-
const call = mockSendMessageStream.mock.calls[callIndex];
|
|
134
|
-
expect(call).toBeDefined();
|
|
135
|
-
return {
|
|
136
|
-
modelConfigKey: call[0],
|
|
137
|
-
message: call[1],
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
let mockConfig;
|
|
141
|
-
let parentToolRegistry;
|
|
142
|
-
/**
|
|
143
|
-
* Type-safe helper to create agent definitions for tests.
|
|
144
|
-
*/
|
|
145
|
-
const createTestDefinition = (tools = [LS_TOOL_NAME], runConfigOverrides = {}, outputConfigMode = 'default', schema = z.string()) => {
|
|
146
|
-
let outputConfig;
|
|
147
|
-
if (outputConfigMode === 'default') {
|
|
148
|
-
outputConfig = {
|
|
149
|
-
outputName: 'finalResult',
|
|
150
|
-
description: 'The final result.',
|
|
151
|
-
schema,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
return {
|
|
155
|
-
kind: 'local',
|
|
156
|
-
name: 'TestAgent',
|
|
157
|
-
description: 'An agent for testing.',
|
|
158
|
-
inputConfig: {
|
|
159
|
-
inputSchema: {
|
|
160
|
-
type: 'object',
|
|
161
|
-
properties: {
|
|
162
|
-
goal: { type: 'string', description: 'goal' },
|
|
163
|
-
},
|
|
164
|
-
required: ['goal'],
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
modelConfig: {
|
|
168
|
-
model: 'gemini-test-model',
|
|
169
|
-
generateContentConfig: {
|
|
170
|
-
temperature: 0,
|
|
171
|
-
topP: 1,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
runConfig: { maxTimeMinutes: 5, maxTurns: 5, ...runConfigOverrides },
|
|
175
|
-
promptConfig: { systemPrompt: 'Achieve the goal: ${goal}.' },
|
|
176
|
-
toolConfig: { tools },
|
|
177
|
-
outputConfig,
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
describe('LocalAgentExecutor', () => {
|
|
181
|
-
let activities;
|
|
182
|
-
let onActivity;
|
|
183
|
-
let abortController;
|
|
184
|
-
let signal;
|
|
185
|
-
beforeEach(async () => {
|
|
186
|
-
vi.resetAllMocks();
|
|
187
|
-
mockCompress.mockClear();
|
|
188
|
-
mockSetHistory.mockClear();
|
|
189
|
-
mockSendMessageStream.mockReset();
|
|
190
|
-
mockSetSystemInstruction.mockReset();
|
|
191
|
-
mockScheduleAgentTools.mockReset();
|
|
192
|
-
mockedLogAgentStart.mockReset();
|
|
193
|
-
mockedLogAgentFinish.mockReset();
|
|
194
|
-
mockedPromptIdContext.getStore.mockReset();
|
|
195
|
-
mockedPromptIdContext.run.mockImplementation((_id, fn) => fn());
|
|
196
|
-
ChatCompressionService.mockImplementation(() => ({
|
|
197
|
-
compress: mockCompress,
|
|
198
|
-
}));
|
|
199
|
-
mockCompress.mockResolvedValue({
|
|
200
|
-
newHistory: null,
|
|
201
|
-
info: { compressionStatus: CompressionStatus.NOOP },
|
|
202
|
-
});
|
|
203
|
-
MockedGeminiChat.mockImplementation(() => ({
|
|
204
|
-
sendMessageStream: mockSendMessageStream,
|
|
205
|
-
setSystemInstruction: mockSetSystemInstruction,
|
|
206
|
-
getHistory: vi.fn((_curated) => [...mockChatHistory]),
|
|
207
|
-
getLastPromptTokenCount: vi.fn(() => 100),
|
|
208
|
-
setHistory: mockSetHistory,
|
|
209
|
-
}));
|
|
210
|
-
vi.useFakeTimers();
|
|
211
|
-
mockConfig = makeFakeConfig();
|
|
212
|
-
parentToolRegistry = new ToolRegistry(mockConfig, mockConfig.getMessageBus());
|
|
213
|
-
parentToolRegistry.registerTool(new LSTool(mockConfig, mockConfig.getMessageBus()));
|
|
214
|
-
parentToolRegistry.registerTool(new MockTool({ name: READ_FILE_TOOL_NAME }));
|
|
215
|
-
parentToolRegistry.registerTool(MOCK_TOOL_NOT_ALLOWED);
|
|
216
|
-
vi.spyOn(mockConfig, 'getToolRegistry').mockReturnValue(parentToolRegistry);
|
|
217
|
-
vi.spyOn(mockConfig, 'getAgentRegistry').mockReturnValue({
|
|
218
|
-
getAllAgentNames: () => [],
|
|
219
|
-
});
|
|
220
|
-
mockedGetDirectoryContextString.mockResolvedValue('Mocked Environment Context');
|
|
221
|
-
activities = [];
|
|
222
|
-
onActivity = (activity) => activities.push(activity);
|
|
223
|
-
abortController = new AbortController();
|
|
224
|
-
signal = abortController.signal;
|
|
225
|
-
});
|
|
226
|
-
afterEach(() => {
|
|
227
|
-
vi.useRealTimers();
|
|
228
|
-
});
|
|
229
|
-
describe('create (Initialization and Validation)', () => {
|
|
230
|
-
it('should create successfully with allowed tools', async () => {
|
|
231
|
-
const definition = createTestDefinition([LS_TOOL_NAME]);
|
|
232
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
233
|
-
expect(executor).toBeInstanceOf(LocalAgentExecutor);
|
|
234
|
-
});
|
|
235
|
-
it('should allow any tool for experimentation (formerly SECURITY check)', async () => {
|
|
236
|
-
const definition = createTestDefinition([MOCK_TOOL_NOT_ALLOWED.name]);
|
|
237
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
238
|
-
expect(executor).toBeInstanceOf(LocalAgentExecutor);
|
|
239
|
-
});
|
|
240
|
-
it('should create an isolated ToolRegistry for the agent', async () => {
|
|
241
|
-
const definition = createTestDefinition([
|
|
242
|
-
LS_TOOL_NAME,
|
|
243
|
-
READ_FILE_TOOL_NAME,
|
|
244
|
-
]);
|
|
245
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
246
|
-
const agentRegistry = executor['toolRegistry'];
|
|
247
|
-
expect(agentRegistry).not.toBe(parentToolRegistry);
|
|
248
|
-
expect(agentRegistry.getAllToolNames()).toEqual(expect.arrayContaining([LS_TOOL_NAME, READ_FILE_TOOL_NAME]));
|
|
249
|
-
expect(agentRegistry.getAllToolNames()).toHaveLength(2);
|
|
250
|
-
expect(agentRegistry.getTool(MOCK_TOOL_NOT_ALLOWED.name)).toBeUndefined();
|
|
251
|
-
});
|
|
252
|
-
it('should use parentPromptId from context to create agentId', async () => {
|
|
253
|
-
const parentId = 'parent-id';
|
|
254
|
-
mockedPromptIdContext.getStore.mockReturnValue(parentId);
|
|
255
|
-
const definition = createTestDefinition();
|
|
256
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
257
|
-
expect(executor['agentId']).toMatch(new RegExp(`^${parentId}-${definition.name}-`));
|
|
258
|
-
});
|
|
259
|
-
it('should correctly apply templates to initialMessages', async () => {
|
|
260
|
-
const definition = createTestDefinition();
|
|
261
|
-
// Override promptConfig to use initialMessages instead of systemPrompt
|
|
262
|
-
definition.promptConfig = {
|
|
263
|
-
initialMessages: [
|
|
264
|
-
{ role: 'user', parts: [{ text: 'Goal: ${goal}' }] },
|
|
265
|
-
{ role: 'model', parts: [{ text: 'OK, starting on ${goal}.' }] },
|
|
266
|
-
],
|
|
267
|
-
};
|
|
268
|
-
const inputs = { goal: 'TestGoal' };
|
|
269
|
-
// Mock a response to prevent the loop from running forever
|
|
270
|
-
mockModelResponse([
|
|
271
|
-
{
|
|
272
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
273
|
-
args: { finalResult: 'done' },
|
|
274
|
-
id: 'call1',
|
|
275
|
-
},
|
|
276
|
-
]);
|
|
277
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
278
|
-
await executor.run(inputs, signal);
|
|
279
|
-
const chatConstructorArgs = MockedGeminiChat.mock.calls[0];
|
|
280
|
-
const startHistory = chatConstructorArgs[3]; // history is the 4th arg
|
|
281
|
-
expect(startHistory).toBeDefined();
|
|
282
|
-
expect(startHistory).toHaveLength(2);
|
|
283
|
-
// Perform checks on defined objects to satisfy TS
|
|
284
|
-
const firstPart = startHistory?.[0]?.parts?.[0];
|
|
285
|
-
expect(firstPart?.text).toBe('Goal: TestGoal');
|
|
286
|
-
const secondPart = startHistory?.[1]?.parts?.[0];
|
|
287
|
-
expect(secondPart?.text).toBe('OK, starting on TestGoal.');
|
|
288
|
-
});
|
|
289
|
-
it('should filter out subagent tools to prevent recursion', async () => {
|
|
290
|
-
const subAgentName = 'recursive-agent';
|
|
291
|
-
// Register a mock tool that simulates a subagent
|
|
292
|
-
parentToolRegistry.registerTool(new MockTool({ name: subAgentName }));
|
|
293
|
-
// Mock the agent registry to return the subagent name
|
|
294
|
-
vi.spyOn(mockConfig.getAgentRegistry(), 'getAllAgentNames').mockReturnValue([subAgentName]);
|
|
295
|
-
const definition = createTestDefinition([LS_TOOL_NAME, subAgentName]);
|
|
296
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
297
|
-
const agentRegistry = executor['toolRegistry'];
|
|
298
|
-
// LS should be present
|
|
299
|
-
expect(agentRegistry.getTool(LS_TOOL_NAME)).toBeDefined();
|
|
300
|
-
// Subagent should be filtered out
|
|
301
|
-
expect(agentRegistry.getTool(subAgentName)).toBeUndefined();
|
|
302
|
-
});
|
|
303
|
-
it('should default to ALL tools (except subagents) when toolConfig is undefined', async () => {
|
|
304
|
-
const subAgentName = 'recursive-agent';
|
|
305
|
-
// Register tools in parent registry
|
|
306
|
-
// LS_TOOL_NAME is already registered in beforeEach
|
|
307
|
-
const otherTool = new MockTool({ name: 'other-tool' });
|
|
308
|
-
parentToolRegistry.registerTool(otherTool);
|
|
309
|
-
parentToolRegistry.registerTool(new MockTool({ name: subAgentName }));
|
|
310
|
-
// Mock the agent registry to return the subagent name
|
|
311
|
-
vi.spyOn(mockConfig.getAgentRegistry(), 'getAllAgentNames').mockReturnValue([subAgentName]);
|
|
312
|
-
// Create definition and force toolConfig to be undefined
|
|
313
|
-
const definition = createTestDefinition();
|
|
314
|
-
definition.toolConfig = undefined;
|
|
315
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
316
|
-
const agentRegistry = executor['toolRegistry'];
|
|
317
|
-
// Should include standard tools
|
|
318
|
-
expect(agentRegistry.getTool(LS_TOOL_NAME)).toBeDefined();
|
|
319
|
-
expect(agentRegistry.getTool('other-tool')).toBeDefined();
|
|
320
|
-
// Should exclude subagent
|
|
321
|
-
expect(agentRegistry.getTool(subAgentName)).toBeUndefined();
|
|
322
|
-
});
|
|
323
|
-
it('should enforce qualified names for MCP tools in agent definitions', async () => {
|
|
324
|
-
const serverName = 'mcp-server';
|
|
325
|
-
const toolName = 'mcp-tool';
|
|
326
|
-
const qualifiedName = `${serverName}${MCP_QUALIFIED_NAME_SEPARATOR}${toolName}`;
|
|
327
|
-
const mockMcpTool = {
|
|
328
|
-
tool: vi.fn(),
|
|
329
|
-
callTool: vi.fn(),
|
|
330
|
-
};
|
|
331
|
-
const mcpTool = new DiscoveredMCPTool(mockMcpTool, serverName, toolName, 'description', {}, mockConfig.getMessageBus());
|
|
332
|
-
// Mock getTool to return our real DiscoveredMCPTool instance
|
|
333
|
-
const getToolSpy = vi
|
|
334
|
-
.spyOn(parentToolRegistry, 'getTool')
|
|
335
|
-
.mockImplementation((name) => {
|
|
336
|
-
if (name === toolName || name === qualifiedName) {
|
|
337
|
-
return mcpTool;
|
|
338
|
-
}
|
|
339
|
-
return undefined;
|
|
340
|
-
});
|
|
341
|
-
// 1. Qualified name works and registers the tool (using short name per status quo)
|
|
342
|
-
const definition = createTestDefinition([qualifiedName]);
|
|
343
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
344
|
-
const agentRegistry = executor['toolRegistry'];
|
|
345
|
-
// Registry shortening logic means it's registered as 'mcp-tool' internally
|
|
346
|
-
expect(agentRegistry.getTool(toolName)).toBeDefined();
|
|
347
|
-
// 2. Unqualified name for MCP tool THROWS
|
|
348
|
-
const badDefinition = createTestDefinition([toolName]);
|
|
349
|
-
await expect(LocalAgentExecutor.create(badDefinition, mockConfig, onActivity)).rejects.toThrow(/must be requested with its server prefix/);
|
|
350
|
-
getToolSpy.mockRestore();
|
|
351
|
-
});
|
|
352
|
-
it('should use custom chatFactory when provided', async () => {
|
|
353
|
-
const definition = createTestDefinition();
|
|
354
|
-
const mockCustomChat = {
|
|
355
|
-
sendMessageStream: mockSendMessageStream,
|
|
356
|
-
setHistory: mockSetHistory,
|
|
357
|
-
getHistory: vi.fn((_curated) => [...mockChatHistory]),
|
|
358
|
-
getLastPromptTokenCount: vi.fn(() => 100),
|
|
359
|
-
};
|
|
360
|
-
const customFactory = vi.fn(() => mockCustomChat);
|
|
361
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity, customFactory);
|
|
362
|
-
// Trigger a run to invoke createChatObject → chatFactory
|
|
363
|
-
mockModelResponse([
|
|
364
|
-
{
|
|
365
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
366
|
-
args: { finalResult: 'done' },
|
|
367
|
-
id: 'call1',
|
|
368
|
-
},
|
|
369
|
-
]);
|
|
370
|
-
await executor.run({ goal: 'test' }, signal);
|
|
371
|
-
// Custom factory should have been called instead of GeminiChat constructor
|
|
372
|
-
expect(customFactory).toHaveBeenCalledTimes(1);
|
|
373
|
-
expect(MockedGeminiChat).not.toHaveBeenCalled();
|
|
374
|
-
});
|
|
375
|
-
});
|
|
376
|
-
describe('run (Execution Loop and Logic)', () => {
|
|
377
|
-
it('should log AgentFinish with error if run throws', async () => {
|
|
378
|
-
const definition = createTestDefinition();
|
|
379
|
-
// Make the definition invalid to cause an error during run
|
|
380
|
-
definition.inputConfig.inputSchema = {
|
|
381
|
-
type: 'object',
|
|
382
|
-
properties: {
|
|
383
|
-
goal: { type: 'string', description: 'goal' },
|
|
384
|
-
},
|
|
385
|
-
required: ['goal'],
|
|
386
|
-
};
|
|
387
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
388
|
-
// Run without inputs to trigger validation error
|
|
389
|
-
await expect(executor.run({}, signal)).rejects.toThrow(/Missing required input parameters/);
|
|
390
|
-
expect(mockedLogAgentStart).toHaveBeenCalledTimes(1);
|
|
391
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledTimes(1);
|
|
392
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
393
|
-
terminate_reason: AgentTerminateMode.ERROR,
|
|
394
|
-
}));
|
|
395
|
-
});
|
|
396
|
-
it('should execute successfully when model calls complete_task with output (Happy Path with Output)', async () => {
|
|
397
|
-
const definition = createTestDefinition();
|
|
398
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
399
|
-
const inputs = { goal: 'Find files' };
|
|
400
|
-
// Turn 1: Model calls ls
|
|
401
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id: 'call1' }], 'T1: Listing');
|
|
402
|
-
mockScheduleAgentTools.mockResolvedValueOnce([
|
|
403
|
-
{
|
|
404
|
-
status: 'success',
|
|
405
|
-
request: {
|
|
406
|
-
callId: 'call1',
|
|
407
|
-
name: LS_TOOL_NAME,
|
|
408
|
-
args: { path: '.' },
|
|
409
|
-
isClientInitiated: false,
|
|
410
|
-
prompt_id: 'test-prompt',
|
|
411
|
-
},
|
|
412
|
-
tool: {},
|
|
413
|
-
invocation: {},
|
|
414
|
-
response: {
|
|
415
|
-
callId: 'call1',
|
|
416
|
-
resultDisplay: 'file1.txt',
|
|
417
|
-
responseParts: [
|
|
418
|
-
{
|
|
419
|
-
functionResponse: {
|
|
420
|
-
name: LS_TOOL_NAME,
|
|
421
|
-
response: { result: 'file1.txt' },
|
|
422
|
-
id: 'call1',
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
],
|
|
426
|
-
error: undefined,
|
|
427
|
-
errorType: undefined,
|
|
428
|
-
contentLength: undefined,
|
|
429
|
-
},
|
|
430
|
-
},
|
|
431
|
-
]);
|
|
432
|
-
// Turn 2: Model calls complete_task with required output
|
|
433
|
-
mockModelResponse([
|
|
434
|
-
{
|
|
435
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
436
|
-
args: { finalResult: 'Found file1.txt' },
|
|
437
|
-
id: 'call2',
|
|
438
|
-
},
|
|
439
|
-
], 'T2: Done');
|
|
440
|
-
const output = await executor.run(inputs, signal);
|
|
441
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
442
|
-
const systemInstruction = MockedGeminiChat.mock.calls[0][1];
|
|
443
|
-
expect(systemInstruction).toContain(`MUST call the \`${TASK_COMPLETE_TOOL_NAME}\` tool`);
|
|
444
|
-
expect(systemInstruction).toContain('Mocked Environment Context');
|
|
445
|
-
expect(systemInstruction).toContain('You are running in a non-interactive mode');
|
|
446
|
-
expect(systemInstruction).toContain('Always use absolute paths');
|
|
447
|
-
const { modelConfigKey } = getMockMessageParams(0);
|
|
448
|
-
expect(modelConfigKey.model).toBe(getModelConfigAlias(definition));
|
|
449
|
-
const chatConstructorArgs = MockedGeminiChat.mock.calls[0];
|
|
450
|
-
// tools are the 3rd argument (index 2), passed as [{ functionDeclarations: [...] }]
|
|
451
|
-
const passedToolsArg = chatConstructorArgs[2];
|
|
452
|
-
const sentTools = passedToolsArg[0].functionDeclarations;
|
|
453
|
-
expect(sentTools).toBeDefined();
|
|
454
|
-
expect(sentTools).toEqual(expect.arrayContaining([
|
|
455
|
-
expect.objectContaining({ name: LS_TOOL_NAME }),
|
|
456
|
-
expect.objectContaining({ name: TASK_COMPLETE_TOOL_NAME }),
|
|
457
|
-
]));
|
|
458
|
-
const completeToolDef = sentTools.find((t) => t.name === TASK_COMPLETE_TOOL_NAME);
|
|
459
|
-
expect(completeToolDef?.parameters?.required).toContain('finalResult');
|
|
460
|
-
expect(output.result).toBe('Found file1.txt');
|
|
461
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
462
|
-
// Telemetry checks
|
|
463
|
-
expect(mockedLogAgentStart).toHaveBeenCalledTimes(1);
|
|
464
|
-
expect(mockedLogAgentStart).toHaveBeenCalledWith(mockConfig, expect.any(AgentStartEvent));
|
|
465
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledTimes(1);
|
|
466
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.any(AgentFinishEvent));
|
|
467
|
-
const finishEvent = mockedLogAgentFinish.mock.calls[0][1];
|
|
468
|
-
expect(finishEvent.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
469
|
-
// Context checks
|
|
470
|
-
expect(mockedPromptIdContext.run).toHaveBeenCalledTimes(2); // Two turns
|
|
471
|
-
const agentId = executor['agentId'];
|
|
472
|
-
expect(mockedPromptIdContext.run).toHaveBeenNthCalledWith(1, `${agentId}#0`, expect.any(Function));
|
|
473
|
-
expect(mockedPromptIdContext.run).toHaveBeenNthCalledWith(2, `${agentId}#1`, expect.any(Function));
|
|
474
|
-
expect(activities).toEqual(expect.arrayContaining([
|
|
475
|
-
expect.objectContaining({
|
|
476
|
-
type: 'THOUGHT_CHUNK',
|
|
477
|
-
data: { text: 'T1: Listing' },
|
|
478
|
-
}),
|
|
479
|
-
expect.objectContaining({
|
|
480
|
-
type: 'TOOL_CALL_END',
|
|
481
|
-
data: { name: LS_TOOL_NAME, output: 'file1.txt' },
|
|
482
|
-
}),
|
|
483
|
-
expect.objectContaining({
|
|
484
|
-
type: 'TOOL_CALL_START',
|
|
485
|
-
data: {
|
|
486
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
487
|
-
args: { finalResult: 'Found file1.txt' },
|
|
488
|
-
},
|
|
489
|
-
}),
|
|
490
|
-
expect.objectContaining({
|
|
491
|
-
type: 'TOOL_CALL_END',
|
|
492
|
-
data: {
|
|
493
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
494
|
-
output: expect.stringContaining('Output submitted'),
|
|
495
|
-
},
|
|
496
|
-
}),
|
|
497
|
-
]));
|
|
498
|
-
});
|
|
499
|
-
it('should execute successfully when model calls complete_task without output (Happy Path No Output)', async () => {
|
|
500
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {}, 'none');
|
|
501
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
502
|
-
mockModelResponse([
|
|
503
|
-
{ name: LS_TOOL_NAME, args: { path: '.' }, id: 'call1' },
|
|
504
|
-
]);
|
|
505
|
-
mockScheduleAgentTools.mockResolvedValueOnce([
|
|
506
|
-
{
|
|
507
|
-
status: 'success',
|
|
508
|
-
request: {
|
|
509
|
-
callId: 'call1',
|
|
510
|
-
name: LS_TOOL_NAME,
|
|
511
|
-
args: { path: '.' },
|
|
512
|
-
isClientInitiated: false,
|
|
513
|
-
prompt_id: 'test-prompt',
|
|
514
|
-
},
|
|
515
|
-
tool: {},
|
|
516
|
-
invocation: {},
|
|
517
|
-
response: {
|
|
518
|
-
callId: 'call1',
|
|
519
|
-
resultDisplay: 'ok',
|
|
520
|
-
responseParts: [
|
|
521
|
-
{
|
|
522
|
-
functionResponse: {
|
|
523
|
-
name: LS_TOOL_NAME,
|
|
524
|
-
response: {},
|
|
525
|
-
id: 'call1',
|
|
526
|
-
},
|
|
527
|
-
},
|
|
528
|
-
],
|
|
529
|
-
error: undefined,
|
|
530
|
-
errorType: undefined,
|
|
531
|
-
contentLength: undefined,
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
]);
|
|
535
|
-
mockModelResponse([
|
|
536
|
-
{
|
|
537
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
538
|
-
args: { result: 'All work done' },
|
|
539
|
-
id: 'call2',
|
|
540
|
-
},
|
|
541
|
-
], 'Task finished.');
|
|
542
|
-
const output = await executor.run({ goal: 'Do work' }, signal);
|
|
543
|
-
const { modelConfigKey } = getMockMessageParams(0);
|
|
544
|
-
expect(modelConfigKey.model).toBe(getModelConfigAlias(definition));
|
|
545
|
-
const chatConstructorArgs = MockedGeminiChat.mock.calls[0];
|
|
546
|
-
const passedToolsArg = chatConstructorArgs[2];
|
|
547
|
-
const sentTools = passedToolsArg[0].functionDeclarations;
|
|
548
|
-
expect(sentTools).toBeDefined();
|
|
549
|
-
const completeToolDef = sentTools.find((t) => t.name === TASK_COMPLETE_TOOL_NAME);
|
|
550
|
-
expect(completeToolDef?.parameters?.required).toEqual(['result']);
|
|
551
|
-
expect(completeToolDef?.description).toContain('submit your final findings');
|
|
552
|
-
expect(output.result).toBe('All work done');
|
|
553
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
554
|
-
});
|
|
555
|
-
it('should error immediately if the model stops tools without calling complete_task (Protocol Violation)', async () => {
|
|
556
|
-
const definition = createTestDefinition();
|
|
557
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
558
|
-
mockModelResponse([
|
|
559
|
-
{ name: LS_TOOL_NAME, args: { path: '.' }, id: 'call1' },
|
|
560
|
-
]);
|
|
561
|
-
mockScheduleAgentTools.mockResolvedValueOnce([
|
|
562
|
-
{
|
|
563
|
-
status: 'success',
|
|
564
|
-
request: {
|
|
565
|
-
callId: 'call1',
|
|
566
|
-
name: LS_TOOL_NAME,
|
|
567
|
-
args: { path: '.' },
|
|
568
|
-
isClientInitiated: false,
|
|
569
|
-
prompt_id: 'test-prompt',
|
|
570
|
-
},
|
|
571
|
-
tool: {},
|
|
572
|
-
invocation: {},
|
|
573
|
-
response: {
|
|
574
|
-
callId: 'call1',
|
|
575
|
-
resultDisplay: 'ok',
|
|
576
|
-
responseParts: [
|
|
577
|
-
{
|
|
578
|
-
functionResponse: {
|
|
579
|
-
name: LS_TOOL_NAME,
|
|
580
|
-
response: {},
|
|
581
|
-
id: 'call1',
|
|
582
|
-
},
|
|
583
|
-
},
|
|
584
|
-
],
|
|
585
|
-
error: undefined,
|
|
586
|
-
errorType: undefined,
|
|
587
|
-
contentLength: undefined,
|
|
588
|
-
},
|
|
589
|
-
},
|
|
590
|
-
]);
|
|
591
|
-
// Turn 2 (protocol violation)
|
|
592
|
-
mockModelResponse([], 'I think I am done.');
|
|
593
|
-
// Turn 3 (recovery turn - also fails)
|
|
594
|
-
mockModelResponse([], 'I still give up.');
|
|
595
|
-
const output = await executor.run({ goal: 'Strict test' }, signal);
|
|
596
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(3);
|
|
597
|
-
const expectedError = `Agent stopped calling tools but did not call '${TASK_COMPLETE_TOOL_NAME}'.`;
|
|
598
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.ERROR_NO_COMPLETE_TASK_CALL);
|
|
599
|
-
expect(output.result).toBe(expectedError);
|
|
600
|
-
// Telemetry check for error
|
|
601
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
602
|
-
terminate_reason: AgentTerminateMode.ERROR_NO_COMPLETE_TASK_CALL,
|
|
603
|
-
}));
|
|
604
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
605
|
-
type: 'ERROR',
|
|
606
|
-
data: expect.objectContaining({
|
|
607
|
-
context: 'protocol_violation',
|
|
608
|
-
error: expectedError,
|
|
609
|
-
}),
|
|
610
|
-
}));
|
|
611
|
-
});
|
|
612
|
-
it('should report an error if complete_task is called with missing required arguments', async () => {
|
|
613
|
-
const definition = createTestDefinition();
|
|
614
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
615
|
-
// Turn 1: Missing arg
|
|
616
|
-
mockModelResponse([
|
|
617
|
-
{
|
|
618
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
619
|
-
args: { wrongArg: 'oops' },
|
|
620
|
-
id: 'call1',
|
|
621
|
-
},
|
|
622
|
-
]);
|
|
623
|
-
// Turn 2: Corrected
|
|
624
|
-
mockModelResponse([
|
|
625
|
-
{
|
|
626
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
627
|
-
args: { finalResult: 'Corrected result' },
|
|
628
|
-
id: 'call2',
|
|
629
|
-
},
|
|
630
|
-
]);
|
|
631
|
-
const output = await executor.run({ goal: 'Error test' }, signal);
|
|
632
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
633
|
-
const expectedError = "Missing required argument 'finalResult' for completion.";
|
|
634
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
635
|
-
type: 'ERROR',
|
|
636
|
-
data: {
|
|
637
|
-
context: 'tool_call',
|
|
638
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
639
|
-
error: expectedError,
|
|
640
|
-
},
|
|
641
|
-
}));
|
|
642
|
-
const turn2Params = getMockMessageParams(1);
|
|
643
|
-
const turn2Parts = turn2Params.message;
|
|
644
|
-
expect(turn2Parts).toBeDefined();
|
|
645
|
-
expect(turn2Parts).toHaveLength(1);
|
|
646
|
-
expect(turn2Parts[0]).toEqual(expect.objectContaining({
|
|
647
|
-
functionResponse: expect.objectContaining({
|
|
648
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
649
|
-
response: { error: expectedError },
|
|
650
|
-
id: 'call1',
|
|
651
|
-
}),
|
|
652
|
-
}));
|
|
653
|
-
expect(output.result).toBe('Corrected result');
|
|
654
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
655
|
-
});
|
|
656
|
-
it('should handle multiple calls to complete_task in the same turn (accept first, block rest)', async () => {
|
|
657
|
-
const definition = createTestDefinition([], {}, 'none');
|
|
658
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
659
|
-
// Turn 1: Duplicate calls
|
|
660
|
-
mockModelResponse([
|
|
661
|
-
{
|
|
662
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
663
|
-
args: { result: 'done' },
|
|
664
|
-
id: 'call1',
|
|
665
|
-
},
|
|
666
|
-
{
|
|
667
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
668
|
-
args: { result: 'ignored' },
|
|
669
|
-
id: 'call2',
|
|
670
|
-
},
|
|
671
|
-
]);
|
|
672
|
-
const output = await executor.run({ goal: 'Dup test' }, signal);
|
|
673
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(1);
|
|
674
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
675
|
-
const completions = activities.filter((a) => a.type === 'TOOL_CALL_END' &&
|
|
676
|
-
a.data['name'] === TASK_COMPLETE_TOOL_NAME);
|
|
677
|
-
const errors = activities.filter((a) => a.type === 'ERROR' && a.data['name'] === TASK_COMPLETE_TOOL_NAME);
|
|
678
|
-
expect(completions).toHaveLength(1);
|
|
679
|
-
expect(errors).toHaveLength(1);
|
|
680
|
-
expect(errors[0].data['error']).toContain('Task already marked complete in this turn');
|
|
681
|
-
});
|
|
682
|
-
it('should execute parallel tool calls and then complete', async () => {
|
|
683
|
-
const definition = createTestDefinition([LS_TOOL_NAME]);
|
|
684
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
685
|
-
const call1 = {
|
|
686
|
-
name: LS_TOOL_NAME,
|
|
687
|
-
args: { path: '/a' },
|
|
688
|
-
id: 'c1',
|
|
689
|
-
};
|
|
690
|
-
const call2 = {
|
|
691
|
-
name: LS_TOOL_NAME,
|
|
692
|
-
args: { path: '/b' },
|
|
693
|
-
id: 'c2',
|
|
694
|
-
};
|
|
695
|
-
// Turn 1: Parallel calls
|
|
696
|
-
mockModelResponse([call1, call2]);
|
|
697
|
-
// Concurrency mock
|
|
698
|
-
let callsStarted = 0;
|
|
699
|
-
let resolveCalls;
|
|
700
|
-
const bothStarted = new Promise((r) => {
|
|
701
|
-
resolveCalls = r;
|
|
702
|
-
});
|
|
703
|
-
mockScheduleAgentTools.mockImplementation(async (_ctx, requests) => {
|
|
704
|
-
const results = await Promise.all(requests.map(async (reqInfo) => {
|
|
705
|
-
callsStarted++;
|
|
706
|
-
if (callsStarted === 2)
|
|
707
|
-
resolveCalls();
|
|
708
|
-
await vi.advanceTimersByTimeAsync(100);
|
|
709
|
-
return {
|
|
710
|
-
status: 'success',
|
|
711
|
-
request: reqInfo,
|
|
712
|
-
tool: {},
|
|
713
|
-
invocation: {},
|
|
714
|
-
response: {
|
|
715
|
-
callId: reqInfo.callId,
|
|
716
|
-
resultDisplay: 'ok',
|
|
717
|
-
responseParts: [
|
|
718
|
-
{
|
|
719
|
-
functionResponse: {
|
|
720
|
-
name: reqInfo.name,
|
|
721
|
-
response: {},
|
|
722
|
-
id: reqInfo.callId,
|
|
723
|
-
},
|
|
724
|
-
},
|
|
725
|
-
],
|
|
726
|
-
error: undefined,
|
|
727
|
-
errorType: undefined,
|
|
728
|
-
contentLength: undefined,
|
|
729
|
-
},
|
|
730
|
-
};
|
|
731
|
-
}));
|
|
732
|
-
return results;
|
|
733
|
-
});
|
|
734
|
-
// Turn 2: Completion
|
|
735
|
-
mockModelResponse([
|
|
736
|
-
{
|
|
737
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
738
|
-
args: { finalResult: 'done' },
|
|
739
|
-
id: 'c3',
|
|
740
|
-
},
|
|
741
|
-
]);
|
|
742
|
-
const runPromise = executor.run({ goal: 'Parallel' }, signal);
|
|
743
|
-
await vi.advanceTimersByTimeAsync(1);
|
|
744
|
-
await bothStarted;
|
|
745
|
-
await vi.advanceTimersByTimeAsync(150);
|
|
746
|
-
await vi.advanceTimersByTimeAsync(1);
|
|
747
|
-
const output = await runPromise;
|
|
748
|
-
expect(mockScheduleAgentTools).toHaveBeenCalledTimes(1);
|
|
749
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
750
|
-
// Safe access to message parts
|
|
751
|
-
const turn2Params = getMockMessageParams(1);
|
|
752
|
-
const parts = turn2Params.message;
|
|
753
|
-
expect(parts).toBeDefined();
|
|
754
|
-
expect(parts).toHaveLength(2);
|
|
755
|
-
expect(parts).toEqual(expect.arrayContaining([
|
|
756
|
-
expect.objectContaining({
|
|
757
|
-
functionResponse: expect.objectContaining({ id: 'c1' }),
|
|
758
|
-
}),
|
|
759
|
-
expect.objectContaining({
|
|
760
|
-
functionResponse: expect.objectContaining({ id: 'c2' }),
|
|
761
|
-
}),
|
|
762
|
-
]));
|
|
763
|
-
});
|
|
764
|
-
it('SECURITY: should block unauthorized tools and provide explicit failure to model', async () => {
|
|
765
|
-
const definition = createTestDefinition([LS_TOOL_NAME]);
|
|
766
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
767
|
-
// Turn 1: Model tries to use a tool not in its config
|
|
768
|
-
const badCallId = 'bad_call_1';
|
|
769
|
-
mockModelResponse([
|
|
770
|
-
{
|
|
771
|
-
name: READ_FILE_TOOL_NAME,
|
|
772
|
-
args: { path: 'secret.txt' },
|
|
773
|
-
id: badCallId,
|
|
774
|
-
},
|
|
775
|
-
]);
|
|
776
|
-
// Turn 2: Model gives up and completes
|
|
777
|
-
mockModelResponse([
|
|
778
|
-
{
|
|
779
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
780
|
-
args: { finalResult: 'Could not read file.' },
|
|
781
|
-
id: 'c2',
|
|
782
|
-
},
|
|
783
|
-
]);
|
|
784
|
-
const consoleWarnSpy = vi
|
|
785
|
-
.spyOn(debugLogger, 'warn')
|
|
786
|
-
.mockImplementation(() => { });
|
|
787
|
-
await executor.run({ goal: 'Sec test' }, signal);
|
|
788
|
-
// Verify external executor was not called (Security held)
|
|
789
|
-
expect(mockScheduleAgentTools).not.toHaveBeenCalled();
|
|
790
|
-
// 2. Verify console warning
|
|
791
|
-
expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining(`[LocalAgentExecutor] Blocked call:`));
|
|
792
|
-
consoleWarnSpy.mockRestore();
|
|
793
|
-
// Verify specific error was sent back to model
|
|
794
|
-
const turn2Params = getMockMessageParams(1);
|
|
795
|
-
const parts = turn2Params.message;
|
|
796
|
-
expect(parts).toBeDefined();
|
|
797
|
-
expect(parts[0]).toEqual(expect.objectContaining({
|
|
798
|
-
functionResponse: expect.objectContaining({
|
|
799
|
-
id: badCallId,
|
|
800
|
-
name: READ_FILE_TOOL_NAME,
|
|
801
|
-
response: {
|
|
802
|
-
error: expect.stringContaining('Unauthorized tool call'),
|
|
803
|
-
},
|
|
804
|
-
}),
|
|
805
|
-
}));
|
|
806
|
-
// Verify Activity Stream reported the error
|
|
807
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
808
|
-
type: 'ERROR',
|
|
809
|
-
data: expect.objectContaining({
|
|
810
|
-
context: 'tool_call_unauthorized',
|
|
811
|
-
name: READ_FILE_TOOL_NAME,
|
|
812
|
-
}),
|
|
813
|
-
}));
|
|
814
|
-
});
|
|
815
|
-
});
|
|
816
|
-
describe('Edge Cases and Error Handling', () => {
|
|
817
|
-
it('should report an error if complete_task output fails schema validation', async () => {
|
|
818
|
-
const definition = createTestDefinition([], {}, 'default', z.string().min(10));
|
|
819
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
820
|
-
// Turn 1: Invalid arg (too short)
|
|
821
|
-
mockModelResponse([
|
|
822
|
-
{
|
|
823
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
824
|
-
args: { finalResult: 'short' },
|
|
825
|
-
id: 'call1',
|
|
826
|
-
},
|
|
827
|
-
]);
|
|
828
|
-
// Turn 2: Corrected
|
|
829
|
-
mockModelResponse([
|
|
830
|
-
{
|
|
831
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
832
|
-
args: { finalResult: 'This is a much longer and valid result' },
|
|
833
|
-
id: 'call2',
|
|
834
|
-
},
|
|
835
|
-
]);
|
|
836
|
-
const output = await executor.run({ goal: 'Validation test' }, signal);
|
|
837
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
838
|
-
const expectedError = 'Output validation failed: {"formErrors":["String must contain at least 10 character(s)"],"fieldErrors":{}}';
|
|
839
|
-
// Check that the error was reported in the activity stream
|
|
840
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
841
|
-
type: 'ERROR',
|
|
842
|
-
data: {
|
|
843
|
-
context: 'tool_call',
|
|
844
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
845
|
-
error: expect.stringContaining('Output validation failed'),
|
|
846
|
-
},
|
|
847
|
-
}));
|
|
848
|
-
// Check that the error was sent back to the model for the next turn
|
|
849
|
-
const turn2Params = getMockMessageParams(1);
|
|
850
|
-
const turn2Parts = turn2Params.message;
|
|
851
|
-
expect(turn2Parts).toEqual([
|
|
852
|
-
expect.objectContaining({
|
|
853
|
-
functionResponse: expect.objectContaining({
|
|
854
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
855
|
-
response: { error: expectedError },
|
|
856
|
-
id: 'call1',
|
|
857
|
-
}),
|
|
858
|
-
}),
|
|
859
|
-
]);
|
|
860
|
-
// Check that the agent eventually succeeded
|
|
861
|
-
expect(output.result).toContain('This is a much longer and valid result');
|
|
862
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
863
|
-
});
|
|
864
|
-
it('should throw and log if GeminiChat creation fails', async () => {
|
|
865
|
-
const definition = createTestDefinition();
|
|
866
|
-
const initError = new Error('Chat creation failed');
|
|
867
|
-
MockedGeminiChat.mockImplementationOnce(() => {
|
|
868
|
-
throw initError;
|
|
869
|
-
});
|
|
870
|
-
// We expect the error to be thrown during the run, not creation
|
|
871
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
872
|
-
await expect(executor.run({ goal: 'test' }, signal)).rejects.toThrow(`Failed to create chat object: ${initError}`);
|
|
873
|
-
// Ensure the error was reported via the activity callback
|
|
874
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
875
|
-
type: 'ERROR',
|
|
876
|
-
data: expect.objectContaining({
|
|
877
|
-
error: `Error: Failed to create chat object: ${initError}`,
|
|
878
|
-
}),
|
|
879
|
-
}));
|
|
880
|
-
// Ensure the agent run was logged as a failure
|
|
881
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
882
|
-
terminate_reason: AgentTerminateMode.ERROR,
|
|
883
|
-
}));
|
|
884
|
-
});
|
|
885
|
-
it('should handle a failed tool call and feed the error to the model', async () => {
|
|
886
|
-
const definition = createTestDefinition([LS_TOOL_NAME]);
|
|
887
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
888
|
-
const toolErrorMessage = 'Tool failed spectacularly';
|
|
889
|
-
// Turn 1: Model calls a tool that will fail
|
|
890
|
-
mockModelResponse([
|
|
891
|
-
{ name: LS_TOOL_NAME, args: { path: '/fake' }, id: 'call1' },
|
|
892
|
-
]);
|
|
893
|
-
mockScheduleAgentTools.mockResolvedValueOnce([
|
|
894
|
-
{
|
|
895
|
-
status: 'error',
|
|
896
|
-
request: {
|
|
897
|
-
callId: 'call1',
|
|
898
|
-
name: LS_TOOL_NAME,
|
|
899
|
-
args: { path: '/fake' },
|
|
900
|
-
isClientInitiated: false,
|
|
901
|
-
prompt_id: 'test-prompt',
|
|
902
|
-
},
|
|
903
|
-
tool: {},
|
|
904
|
-
invocation: {},
|
|
905
|
-
response: {
|
|
906
|
-
callId: 'call1',
|
|
907
|
-
resultDisplay: '',
|
|
908
|
-
responseParts: [
|
|
909
|
-
{
|
|
910
|
-
functionResponse: {
|
|
911
|
-
name: LS_TOOL_NAME,
|
|
912
|
-
response: { error: toolErrorMessage },
|
|
913
|
-
id: 'call1',
|
|
914
|
-
},
|
|
915
|
-
},
|
|
916
|
-
],
|
|
917
|
-
error: new Error(toolErrorMessage),
|
|
918
|
-
errorType: 'ToolError',
|
|
919
|
-
contentLength: 0,
|
|
920
|
-
},
|
|
921
|
-
},
|
|
922
|
-
]);
|
|
923
|
-
// Turn 2: Model sees the error and completes
|
|
924
|
-
mockModelResponse([
|
|
925
|
-
{
|
|
926
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
927
|
-
args: { finalResult: 'Aborted due to tool failure.' },
|
|
928
|
-
id: 'call2',
|
|
929
|
-
},
|
|
930
|
-
]);
|
|
931
|
-
const output = await executor.run({ goal: 'Tool failure test' }, signal);
|
|
932
|
-
expect(mockScheduleAgentTools).toHaveBeenCalledTimes(1);
|
|
933
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
934
|
-
// Verify the error was reported in the activity stream
|
|
935
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
936
|
-
type: 'ERROR',
|
|
937
|
-
data: {
|
|
938
|
-
context: 'tool_call',
|
|
939
|
-
name: LS_TOOL_NAME,
|
|
940
|
-
error: toolErrorMessage,
|
|
941
|
-
},
|
|
942
|
-
}));
|
|
943
|
-
// Verify the error was sent back to the model
|
|
944
|
-
const turn2Params = getMockMessageParams(1);
|
|
945
|
-
const parts = turn2Params.message;
|
|
946
|
-
expect(parts).toEqual([
|
|
947
|
-
expect.objectContaining({
|
|
948
|
-
functionResponse: expect.objectContaining({
|
|
949
|
-
name: LS_TOOL_NAME,
|
|
950
|
-
id: 'call1',
|
|
951
|
-
response: {
|
|
952
|
-
error: toolErrorMessage,
|
|
953
|
-
},
|
|
954
|
-
}),
|
|
955
|
-
}),
|
|
956
|
-
]);
|
|
957
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
958
|
-
expect(output.result).toBe('Aborted due to tool failure.');
|
|
959
|
-
});
|
|
960
|
-
});
|
|
961
|
-
describe('Model Routing', () => {
|
|
962
|
-
it('should use model routing when the agent model is "auto"', async () => {
|
|
963
|
-
const definition = createTestDefinition();
|
|
964
|
-
definition.modelConfig.model = 'auto';
|
|
965
|
-
const mockRouter = {
|
|
966
|
-
route: vi.fn().mockResolvedValue({
|
|
967
|
-
model: 'routed-model',
|
|
968
|
-
metadata: { source: 'test', reasoning: 'test' },
|
|
969
|
-
}),
|
|
970
|
-
};
|
|
971
|
-
vi.spyOn(mockConfig, 'getModelRouterService').mockReturnValue(mockRouter);
|
|
972
|
-
// Mock resolved config to return 'auto'
|
|
973
|
-
vi.spyOn(mockConfig.modelConfigService, 'getResolvedConfig').mockReturnValue({
|
|
974
|
-
model: 'auto',
|
|
975
|
-
generateContentConfig: {},
|
|
976
|
-
});
|
|
977
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
978
|
-
mockModelResponse([
|
|
979
|
-
{
|
|
980
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
981
|
-
args: { finalResult: 'done' },
|
|
982
|
-
id: 'call1',
|
|
983
|
-
},
|
|
984
|
-
]);
|
|
985
|
-
await executor.run({ goal: 'test' }, signal);
|
|
986
|
-
expect(mockRouter.route).toHaveBeenCalled();
|
|
987
|
-
expect(mockSendMessageStream).toHaveBeenCalledWith(expect.objectContaining({ model: 'routed-model' }), expect.any(Array), expect.any(String), expect.any(AbortSignal));
|
|
988
|
-
});
|
|
989
|
-
it('should NOT use model routing when the agent model is NOT "auto"', async () => {
|
|
990
|
-
const definition = createTestDefinition();
|
|
991
|
-
definition.modelConfig.model = 'concrete-model';
|
|
992
|
-
const mockRouter = {
|
|
993
|
-
route: vi.fn(),
|
|
994
|
-
};
|
|
995
|
-
vi.spyOn(mockConfig, 'getModelRouterService').mockReturnValue(mockRouter);
|
|
996
|
-
// Mock resolved config to return 'concrete-model'
|
|
997
|
-
vi.spyOn(mockConfig.modelConfigService, 'getResolvedConfig').mockReturnValue({
|
|
998
|
-
model: 'concrete-model',
|
|
999
|
-
generateContentConfig: {},
|
|
1000
|
-
});
|
|
1001
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1002
|
-
mockModelResponse([
|
|
1003
|
-
{
|
|
1004
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1005
|
-
args: { finalResult: 'done' },
|
|
1006
|
-
id: 'call1',
|
|
1007
|
-
},
|
|
1008
|
-
]);
|
|
1009
|
-
await executor.run({ goal: 'test' }, signal);
|
|
1010
|
-
expect(mockRouter.route).not.toHaveBeenCalled();
|
|
1011
|
-
expect(mockSendMessageStream).toHaveBeenCalledWith(expect.objectContaining({ model: 'concrete-model' }), expect.any(Array), expect.any(String), expect.any(AbortSignal));
|
|
1012
|
-
});
|
|
1013
|
-
});
|
|
1014
|
-
describe('run (Termination Conditions)', () => {
|
|
1015
|
-
const mockWorkResponse = (id) => {
|
|
1016
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id }]);
|
|
1017
|
-
mockScheduleAgentTools.mockResolvedValueOnce([
|
|
1018
|
-
{
|
|
1019
|
-
status: 'success',
|
|
1020
|
-
request: {
|
|
1021
|
-
callId: id,
|
|
1022
|
-
name: LS_TOOL_NAME,
|
|
1023
|
-
args: { path: '.' },
|
|
1024
|
-
isClientInitiated: false,
|
|
1025
|
-
prompt_id: 'test-prompt',
|
|
1026
|
-
},
|
|
1027
|
-
tool: {},
|
|
1028
|
-
invocation: {},
|
|
1029
|
-
response: {
|
|
1030
|
-
callId: id,
|
|
1031
|
-
resultDisplay: 'ok',
|
|
1032
|
-
responseParts: [
|
|
1033
|
-
{ functionResponse: { name: LS_TOOL_NAME, response: {}, id } },
|
|
1034
|
-
],
|
|
1035
|
-
error: undefined,
|
|
1036
|
-
errorType: undefined,
|
|
1037
|
-
contentLength: undefined,
|
|
1038
|
-
},
|
|
1039
|
-
},
|
|
1040
|
-
]);
|
|
1041
|
-
};
|
|
1042
|
-
it('should terminate when max_turns is reached', async () => {
|
|
1043
|
-
const MAX = 2;
|
|
1044
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1045
|
-
maxTurns: MAX,
|
|
1046
|
-
});
|
|
1047
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig);
|
|
1048
|
-
mockWorkResponse('t1');
|
|
1049
|
-
mockWorkResponse('t2');
|
|
1050
|
-
// Recovery turn
|
|
1051
|
-
mockModelResponse([], 'I give up');
|
|
1052
|
-
const output = await executor.run({ goal: 'Turns test' }, signal);
|
|
1053
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.MAX_TURNS);
|
|
1054
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(MAX + 1);
|
|
1055
|
-
});
|
|
1056
|
-
it('should terminate with TIMEOUT if a model call takes too long', async () => {
|
|
1057
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1058
|
-
maxTimeMinutes: 0.5, // 30 seconds
|
|
1059
|
-
});
|
|
1060
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1061
|
-
// Mock a model call that is interruptible by an abort signal.
|
|
1062
|
-
mockSendMessageStream.mockImplementationOnce(async (_key, _message, _promptId, signal) =>
|
|
1063
|
-
// eslint-disable-next-line require-yield
|
|
1064
|
-
(async function* () {
|
|
1065
|
-
await new Promise((resolve) => {
|
|
1066
|
-
// This promise resolves when aborted, ending the generator.
|
|
1067
|
-
signal?.addEventListener('abort', () => {
|
|
1068
|
-
resolve();
|
|
1069
|
-
}, { once: true });
|
|
1070
|
-
});
|
|
1071
|
-
})());
|
|
1072
|
-
// Recovery turn
|
|
1073
|
-
mockModelResponse([], 'I give up');
|
|
1074
|
-
const runPromise = executor.run({ goal: 'Timeout test' }, signal);
|
|
1075
|
-
// Advance time past the timeout to trigger the abort.
|
|
1076
|
-
await vi.advanceTimersByTimeAsync(31 * 1000);
|
|
1077
|
-
const output = await runPromise;
|
|
1078
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.TIMEOUT);
|
|
1079
|
-
expect(output.result).toContain('Agent timed out after 0.5 minutes.');
|
|
1080
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
1081
|
-
// Verify activity stream reported the timeout
|
|
1082
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1083
|
-
type: 'ERROR',
|
|
1084
|
-
data: expect.objectContaining({
|
|
1085
|
-
context: 'timeout',
|
|
1086
|
-
error: 'Agent timed out after 0.5 minutes.',
|
|
1087
|
-
}),
|
|
1088
|
-
}));
|
|
1089
|
-
// Verify telemetry
|
|
1090
|
-
expect(mockedLogAgentFinish).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
1091
|
-
terminate_reason: AgentTerminateMode.TIMEOUT,
|
|
1092
|
-
}));
|
|
1093
|
-
});
|
|
1094
|
-
it('should terminate with TIMEOUT if a tool call takes too long', async () => {
|
|
1095
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1096
|
-
maxTimeMinutes: 1,
|
|
1097
|
-
});
|
|
1098
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig);
|
|
1099
|
-
mockModelResponse([
|
|
1100
|
-
{ name: LS_TOOL_NAME, args: { path: '.' }, id: 't1' },
|
|
1101
|
-
]);
|
|
1102
|
-
// Long running tool
|
|
1103
|
-
mockScheduleAgentTools.mockImplementationOnce(async (_ctx, requests) => {
|
|
1104
|
-
await vi.advanceTimersByTimeAsync(61 * 1000);
|
|
1105
|
-
return [
|
|
1106
|
-
{
|
|
1107
|
-
status: 'success',
|
|
1108
|
-
request: requests[0],
|
|
1109
|
-
tool: {},
|
|
1110
|
-
invocation: {},
|
|
1111
|
-
response: {
|
|
1112
|
-
callId: 't1',
|
|
1113
|
-
resultDisplay: 'ok',
|
|
1114
|
-
responseParts: [],
|
|
1115
|
-
error: undefined,
|
|
1116
|
-
errorType: undefined,
|
|
1117
|
-
contentLength: undefined,
|
|
1118
|
-
},
|
|
1119
|
-
},
|
|
1120
|
-
];
|
|
1121
|
-
});
|
|
1122
|
-
// Recovery turn
|
|
1123
|
-
mockModelResponse([], 'I give up');
|
|
1124
|
-
const output = await executor.run({ goal: 'Timeout test' }, signal);
|
|
1125
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.TIMEOUT);
|
|
1126
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
1127
|
-
});
|
|
1128
|
-
it('should terminate when AbortSignal is triggered', async () => {
|
|
1129
|
-
const definition = createTestDefinition();
|
|
1130
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig);
|
|
1131
|
-
mockSendMessageStream.mockImplementationOnce(async () => (async function* () {
|
|
1132
|
-
yield {
|
|
1133
|
-
type: StreamEventType.CHUNK,
|
|
1134
|
-
value: createMockResponseChunk([
|
|
1135
|
-
{ text: 'Thinking...', thought: true },
|
|
1136
|
-
]),
|
|
1137
|
-
};
|
|
1138
|
-
abortController.abort();
|
|
1139
|
-
})());
|
|
1140
|
-
const output = await executor.run({ goal: 'Abort test' }, signal);
|
|
1141
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.ABORTED);
|
|
1142
|
-
});
|
|
1143
|
-
});
|
|
1144
|
-
describe('run (Recovery Turns)', () => {
|
|
1145
|
-
const mockWorkResponse = (id) => {
|
|
1146
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id }]);
|
|
1147
|
-
mockScheduleAgentTools.mockResolvedValueOnce([
|
|
1148
|
-
{
|
|
1149
|
-
status: 'success',
|
|
1150
|
-
request: {
|
|
1151
|
-
callId: id,
|
|
1152
|
-
name: LS_TOOL_NAME,
|
|
1153
|
-
args: { path: '.' },
|
|
1154
|
-
isClientInitiated: false,
|
|
1155
|
-
prompt_id: 'test-prompt',
|
|
1156
|
-
},
|
|
1157
|
-
tool: {},
|
|
1158
|
-
invocation: {},
|
|
1159
|
-
response: {
|
|
1160
|
-
callId: id,
|
|
1161
|
-
resultDisplay: 'ok',
|
|
1162
|
-
responseParts: [
|
|
1163
|
-
{ functionResponse: { name: LS_TOOL_NAME, response: {}, id } },
|
|
1164
|
-
],
|
|
1165
|
-
error: undefined,
|
|
1166
|
-
errorType: undefined,
|
|
1167
|
-
contentLength: undefined,
|
|
1168
|
-
},
|
|
1169
|
-
},
|
|
1170
|
-
]);
|
|
1171
|
-
};
|
|
1172
|
-
it('should recover successfully if complete_task is called during the grace turn after MAX_TURNS', async () => {
|
|
1173
|
-
const MAX = 1;
|
|
1174
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1175
|
-
maxTurns: MAX,
|
|
1176
|
-
});
|
|
1177
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1178
|
-
// Turn 1 (hits max_turns)
|
|
1179
|
-
mockWorkResponse('t1');
|
|
1180
|
-
// Recovery Turn (succeeds)
|
|
1181
|
-
mockModelResponse([
|
|
1182
|
-
{
|
|
1183
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1184
|
-
args: { finalResult: 'Recovered!' },
|
|
1185
|
-
id: 't2',
|
|
1186
|
-
},
|
|
1187
|
-
], 'Recovering from max turns');
|
|
1188
|
-
const output = await executor.run({ goal: 'Turns recovery' }, signal);
|
|
1189
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
1190
|
-
expect(output.result).toBe('Recovered!');
|
|
1191
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(MAX + 1); // 1 regular + 1 recovery
|
|
1192
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1193
|
-
type: 'THOUGHT_CHUNK',
|
|
1194
|
-
data: {
|
|
1195
|
-
text: 'Execution limit reached (MAX_TURNS). Attempting one final recovery turn with a grace period.',
|
|
1196
|
-
},
|
|
1197
|
-
}));
|
|
1198
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1199
|
-
type: 'THOUGHT_CHUNK',
|
|
1200
|
-
data: { text: 'Graceful recovery succeeded.' },
|
|
1201
|
-
}));
|
|
1202
|
-
});
|
|
1203
|
-
it('should fail if complete_task is NOT called during the grace turn after MAX_TURNS', async () => {
|
|
1204
|
-
const MAX = 1;
|
|
1205
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1206
|
-
maxTurns: MAX,
|
|
1207
|
-
});
|
|
1208
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1209
|
-
// Turn 1 (hits max_turns)
|
|
1210
|
-
mockWorkResponse('t1');
|
|
1211
|
-
// Recovery Turn (fails by calling no tools)
|
|
1212
|
-
mockModelResponse([], 'I give up again.');
|
|
1213
|
-
const output = await executor.run({ goal: 'Turns recovery fail' }, signal);
|
|
1214
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.MAX_TURNS);
|
|
1215
|
-
expect(output.result).toContain('Agent reached max turns limit');
|
|
1216
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(MAX + 1);
|
|
1217
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1218
|
-
type: 'ERROR',
|
|
1219
|
-
data: expect.objectContaining({
|
|
1220
|
-
context: 'recovery_turn',
|
|
1221
|
-
error: 'Graceful recovery attempt failed. Reason: stop',
|
|
1222
|
-
}),
|
|
1223
|
-
}));
|
|
1224
|
-
});
|
|
1225
|
-
it('should recover successfully from a protocol violation (no complete_task)', async () => {
|
|
1226
|
-
const definition = createTestDefinition();
|
|
1227
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1228
|
-
// Turn 1: Normal work
|
|
1229
|
-
mockWorkResponse('t1');
|
|
1230
|
-
// Turn 2: Protocol violation (no tool calls)
|
|
1231
|
-
mockModelResponse([], 'I think I am done, but I forgot the right tool.');
|
|
1232
|
-
// Turn 3: Recovery turn (succeeds)
|
|
1233
|
-
mockModelResponse([
|
|
1234
|
-
{
|
|
1235
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1236
|
-
args: { finalResult: 'Recovered from violation!' },
|
|
1237
|
-
id: 't3',
|
|
1238
|
-
},
|
|
1239
|
-
], 'My mistake, here is the completion.');
|
|
1240
|
-
const output = await executor.run({ goal: 'Violation recovery' }, signal);
|
|
1241
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(3);
|
|
1242
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
1243
|
-
expect(output.result).toBe('Recovered from violation!');
|
|
1244
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1245
|
-
type: 'THOUGHT_CHUNK',
|
|
1246
|
-
data: {
|
|
1247
|
-
text: 'Execution limit reached (ERROR_NO_COMPLETE_TASK_CALL). Attempting one final recovery turn with a grace period.',
|
|
1248
|
-
},
|
|
1249
|
-
}));
|
|
1250
|
-
});
|
|
1251
|
-
it('should fail recovery from a protocol violation if it violates again', async () => {
|
|
1252
|
-
const definition = createTestDefinition();
|
|
1253
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1254
|
-
// Turn 1: Normal work
|
|
1255
|
-
mockWorkResponse('t1');
|
|
1256
|
-
// Turn 2: Protocol violation (no tool calls)
|
|
1257
|
-
mockModelResponse([], 'I think I am done, but I forgot the right tool.');
|
|
1258
|
-
// Turn 3: Recovery turn (fails again)
|
|
1259
|
-
mockModelResponse([], 'I still dont know what to do.');
|
|
1260
|
-
const output = await executor.run({ goal: 'Violation recovery fail' }, signal);
|
|
1261
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(3);
|
|
1262
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.ERROR_NO_COMPLETE_TASK_CALL);
|
|
1263
|
-
expect(output.result).toContain(`Agent stopped calling tools but did not call '${TASK_COMPLETE_TOOL_NAME}'`);
|
|
1264
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1265
|
-
type: 'ERROR',
|
|
1266
|
-
data: expect.objectContaining({
|
|
1267
|
-
context: 'recovery_turn',
|
|
1268
|
-
error: 'Graceful recovery attempt failed. Reason: stop',
|
|
1269
|
-
}),
|
|
1270
|
-
}));
|
|
1271
|
-
});
|
|
1272
|
-
it('should recover successfully from a TIMEOUT', async () => {
|
|
1273
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1274
|
-
maxTimeMinutes: 0.5, // 30 seconds
|
|
1275
|
-
});
|
|
1276
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1277
|
-
// Mock a model call that gets interrupted by the timeout.
|
|
1278
|
-
mockSendMessageStream.mockImplementationOnce(async (_key, _message, _promptId, signal) =>
|
|
1279
|
-
// eslint-disable-next-line require-yield
|
|
1280
|
-
(async function* () {
|
|
1281
|
-
// This promise never resolves, it waits for abort.
|
|
1282
|
-
await new Promise((resolve) => {
|
|
1283
|
-
signal?.addEventListener('abort', () => resolve(), {
|
|
1284
|
-
once: true,
|
|
1285
|
-
});
|
|
1286
|
-
});
|
|
1287
|
-
})());
|
|
1288
|
-
// Recovery turn (succeeds)
|
|
1289
|
-
mockModelResponse([
|
|
1290
|
-
{
|
|
1291
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1292
|
-
args: { finalResult: 'Recovered from timeout!' },
|
|
1293
|
-
id: 't2',
|
|
1294
|
-
},
|
|
1295
|
-
], 'Apologies for the delay, finishing up.');
|
|
1296
|
-
const runPromise = executor.run({ goal: 'Timeout recovery' }, signal);
|
|
1297
|
-
// Advance time past the timeout to trigger the abort and recovery.
|
|
1298
|
-
await vi.advanceTimersByTimeAsync(31 * 1000);
|
|
1299
|
-
const output = await runPromise;
|
|
1300
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2); // 1 failed + 1 recovery
|
|
1301
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.GOAL);
|
|
1302
|
-
expect(output.result).toBe('Recovered from timeout!');
|
|
1303
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1304
|
-
type: 'THOUGHT_CHUNK',
|
|
1305
|
-
data: {
|
|
1306
|
-
text: 'Execution limit reached (TIMEOUT). Attempting one final recovery turn with a grace period.',
|
|
1307
|
-
},
|
|
1308
|
-
}));
|
|
1309
|
-
});
|
|
1310
|
-
it('should fail recovery from a TIMEOUT if the grace period also times out', async () => {
|
|
1311
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1312
|
-
maxTimeMinutes: 0.5, // 30 seconds
|
|
1313
|
-
});
|
|
1314
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1315
|
-
mockSendMessageStream.mockImplementationOnce(async (_key, _message, _promptId, signal) =>
|
|
1316
|
-
// eslint-disable-next-line require-yield
|
|
1317
|
-
(async function* () {
|
|
1318
|
-
await new Promise((resolve) => signal?.addEventListener('abort', () => resolve(), {
|
|
1319
|
-
once: true,
|
|
1320
|
-
}));
|
|
1321
|
-
})());
|
|
1322
|
-
// Mock the recovery call to also be long-running
|
|
1323
|
-
mockSendMessageStream.mockImplementationOnce(async (_key, _message, _promptId, signal) =>
|
|
1324
|
-
// eslint-disable-next-line require-yield
|
|
1325
|
-
(async function* () {
|
|
1326
|
-
await new Promise((resolve) => signal?.addEventListener('abort', () => resolve(), {
|
|
1327
|
-
once: true,
|
|
1328
|
-
}));
|
|
1329
|
-
})());
|
|
1330
|
-
const runPromise = executor.run({ goal: 'Timeout recovery fail' }, signal);
|
|
1331
|
-
// 1. Trigger the main timeout
|
|
1332
|
-
await vi.advanceTimersByTimeAsync(31 * 1000);
|
|
1333
|
-
// 2. Let microtasks run (start recovery turn)
|
|
1334
|
-
await vi.advanceTimersByTimeAsync(1);
|
|
1335
|
-
// 3. Trigger the grace period timeout (60s)
|
|
1336
|
-
await vi.advanceTimersByTimeAsync(61 * 1000);
|
|
1337
|
-
const output = await runPromise;
|
|
1338
|
-
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
1339
|
-
expect(output.terminate_reason).toBe(AgentTerminateMode.TIMEOUT);
|
|
1340
|
-
expect(output.result).toContain('Agent timed out after 0.5 minutes.');
|
|
1341
|
-
expect(activities).toContainEqual(expect.objectContaining({
|
|
1342
|
-
type: 'ERROR',
|
|
1343
|
-
data: expect.objectContaining({
|
|
1344
|
-
context: 'recovery_turn',
|
|
1345
|
-
error: 'Graceful recovery attempt failed. Reason: stop',
|
|
1346
|
-
}),
|
|
1347
|
-
}));
|
|
1348
|
-
});
|
|
1349
|
-
});
|
|
1350
|
-
describe('Telemetry and Logging', () => {
|
|
1351
|
-
const mockWorkResponse = (id) => {
|
|
1352
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id }]);
|
|
1353
|
-
mockScheduleAgentTools.mockResolvedValueOnce([
|
|
1354
|
-
{
|
|
1355
|
-
status: 'success',
|
|
1356
|
-
request: {
|
|
1357
|
-
callId: id,
|
|
1358
|
-
name: LS_TOOL_NAME,
|
|
1359
|
-
args: { path: '.' },
|
|
1360
|
-
isClientInitiated: false,
|
|
1361
|
-
prompt_id: 'test-prompt',
|
|
1362
|
-
},
|
|
1363
|
-
tool: {},
|
|
1364
|
-
invocation: {},
|
|
1365
|
-
response: {
|
|
1366
|
-
callId: id,
|
|
1367
|
-
resultDisplay: 'ok',
|
|
1368
|
-
responseParts: [
|
|
1369
|
-
{ functionResponse: { name: LS_TOOL_NAME, response: {}, id } },
|
|
1370
|
-
],
|
|
1371
|
-
error: undefined,
|
|
1372
|
-
errorType: undefined,
|
|
1373
|
-
contentLength: undefined,
|
|
1374
|
-
},
|
|
1375
|
-
},
|
|
1376
|
-
]);
|
|
1377
|
-
};
|
|
1378
|
-
beforeEach(() => {
|
|
1379
|
-
mockedLogRecoveryAttempt.mockClear();
|
|
1380
|
-
});
|
|
1381
|
-
it('should log a RecoveryAttemptEvent when a recoverable error occurs and recovery fails', async () => {
|
|
1382
|
-
const MAX = 1;
|
|
1383
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1384
|
-
maxTurns: MAX,
|
|
1385
|
-
});
|
|
1386
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig);
|
|
1387
|
-
// Turn 1 (hits max_turns)
|
|
1388
|
-
mockWorkResponse('t1');
|
|
1389
|
-
// Recovery Turn (fails by calling no tools)
|
|
1390
|
-
mockModelResponse([], 'I give up again.');
|
|
1391
|
-
await executor.run({ goal: 'Turns recovery fail' }, signal);
|
|
1392
|
-
expect(mockedLogRecoveryAttempt).toHaveBeenCalledTimes(1);
|
|
1393
|
-
const recoveryEvent = mockedLogRecoveryAttempt.mock.calls[0][1];
|
|
1394
|
-
expect(recoveryEvent).toBeInstanceOf(RecoveryAttemptEvent);
|
|
1395
|
-
expect(recoveryEvent.agent_name).toBe(definition.name);
|
|
1396
|
-
expect(recoveryEvent.reason).toBe(AgentTerminateMode.MAX_TURNS);
|
|
1397
|
-
expect(recoveryEvent.success).toBe(false);
|
|
1398
|
-
expect(recoveryEvent.turn_count).toBe(1);
|
|
1399
|
-
expect(recoveryEvent.duration_ms).toBeGreaterThanOrEqual(0);
|
|
1400
|
-
});
|
|
1401
|
-
it('should log a successful RecoveryAttemptEvent when recovery succeeds', async () => {
|
|
1402
|
-
const MAX = 1;
|
|
1403
|
-
const definition = createTestDefinition([LS_TOOL_NAME], {
|
|
1404
|
-
maxTurns: MAX,
|
|
1405
|
-
});
|
|
1406
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig);
|
|
1407
|
-
// Turn 1 (hits max_turns)
|
|
1408
|
-
mockWorkResponse('t1');
|
|
1409
|
-
// Recovery Turn (succeeds)
|
|
1410
|
-
mockModelResponse([
|
|
1411
|
-
{
|
|
1412
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1413
|
-
args: { finalResult: 'Recovered!' },
|
|
1414
|
-
id: 't2',
|
|
1415
|
-
},
|
|
1416
|
-
], 'Recovering from max turns');
|
|
1417
|
-
await executor.run({ goal: 'Turns recovery success' }, signal);
|
|
1418
|
-
expect(mockedLogRecoveryAttempt).toHaveBeenCalledTimes(1);
|
|
1419
|
-
const recoveryEvent = mockedLogRecoveryAttempt.mock.calls[0][1];
|
|
1420
|
-
expect(recoveryEvent).toBeInstanceOf(RecoveryAttemptEvent);
|
|
1421
|
-
expect(recoveryEvent.success).toBe(true);
|
|
1422
|
-
expect(recoveryEvent.reason).toBe(AgentTerminateMode.MAX_TURNS);
|
|
1423
|
-
});
|
|
1424
|
-
});
|
|
1425
|
-
describe('Chat Compression', () => {
|
|
1426
|
-
const mockWorkResponse = (id) => {
|
|
1427
|
-
mockModelResponse([{ name: LS_TOOL_NAME, args: { path: '.' }, id }]);
|
|
1428
|
-
mockScheduleAgentTools.mockResolvedValueOnce([
|
|
1429
|
-
{
|
|
1430
|
-
status: 'success',
|
|
1431
|
-
request: {
|
|
1432
|
-
callId: id,
|
|
1433
|
-
name: LS_TOOL_NAME,
|
|
1434
|
-
args: { path: '.' },
|
|
1435
|
-
isClientInitiated: false,
|
|
1436
|
-
prompt_id: 'test-prompt',
|
|
1437
|
-
},
|
|
1438
|
-
tool: {},
|
|
1439
|
-
invocation: {},
|
|
1440
|
-
response: {
|
|
1441
|
-
callId: id,
|
|
1442
|
-
resultDisplay: 'ok',
|
|
1443
|
-
responseParts: [
|
|
1444
|
-
{ functionResponse: { name: LS_TOOL_NAME, response: {}, id } },
|
|
1445
|
-
],
|
|
1446
|
-
error: undefined,
|
|
1447
|
-
errorType: undefined,
|
|
1448
|
-
contentLength: undefined,
|
|
1449
|
-
},
|
|
1450
|
-
},
|
|
1451
|
-
]);
|
|
1452
|
-
};
|
|
1453
|
-
it('should attempt to compress chat history on each turn', async () => {
|
|
1454
|
-
const definition = createTestDefinition();
|
|
1455
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1456
|
-
// Mock compression to do nothing
|
|
1457
|
-
mockCompress.mockResolvedValue({
|
|
1458
|
-
newHistory: null,
|
|
1459
|
-
info: { compressionStatus: CompressionStatus.NOOP },
|
|
1460
|
-
});
|
|
1461
|
-
// Turn 1
|
|
1462
|
-
mockWorkResponse('t1');
|
|
1463
|
-
// Turn 2: Complete
|
|
1464
|
-
mockModelResponse([
|
|
1465
|
-
{
|
|
1466
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1467
|
-
args: { finalResult: 'Done' },
|
|
1468
|
-
id: 'call2',
|
|
1469
|
-
},
|
|
1470
|
-
], 'T2');
|
|
1471
|
-
await executor.run({ goal: 'Compress test' }, signal);
|
|
1472
|
-
expect(mockCompress).toHaveBeenCalledTimes(2);
|
|
1473
|
-
});
|
|
1474
|
-
it('should update chat history when compression is successful', async () => {
|
|
1475
|
-
const definition = createTestDefinition();
|
|
1476
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1477
|
-
const compressedHistory = [
|
|
1478
|
-
{ role: 'user', parts: [{ text: 'compressed' }] },
|
|
1479
|
-
];
|
|
1480
|
-
mockCompress.mockResolvedValue({
|
|
1481
|
-
newHistory: compressedHistory,
|
|
1482
|
-
info: { compressionStatus: CompressionStatus.COMPRESSED },
|
|
1483
|
-
});
|
|
1484
|
-
// Turn 1: Complete
|
|
1485
|
-
mockModelResponse([
|
|
1486
|
-
{
|
|
1487
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1488
|
-
args: { finalResult: 'Done' },
|
|
1489
|
-
id: 'call1',
|
|
1490
|
-
},
|
|
1491
|
-
], 'T1');
|
|
1492
|
-
await executor.run({ goal: 'Compress success' }, signal);
|
|
1493
|
-
expect(mockCompress).toHaveBeenCalledTimes(1);
|
|
1494
|
-
expect(mockSetHistory).toHaveBeenCalledTimes(1);
|
|
1495
|
-
expect(mockSetHistory).toHaveBeenCalledWith(compressedHistory);
|
|
1496
|
-
});
|
|
1497
|
-
it('should pass hasFailedCompressionAttempt=true to compression after a failure', async () => {
|
|
1498
|
-
const definition = createTestDefinition();
|
|
1499
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1500
|
-
// First call fails
|
|
1501
|
-
mockCompress.mockResolvedValueOnce({
|
|
1502
|
-
newHistory: null,
|
|
1503
|
-
info: {
|
|
1504
|
-
compressionStatus: CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT,
|
|
1505
|
-
},
|
|
1506
|
-
});
|
|
1507
|
-
// Second call is neutral
|
|
1508
|
-
mockCompress.mockResolvedValueOnce({
|
|
1509
|
-
newHistory: null,
|
|
1510
|
-
info: { compressionStatus: CompressionStatus.NOOP },
|
|
1511
|
-
});
|
|
1512
|
-
// Turn 1
|
|
1513
|
-
mockWorkResponse('t1');
|
|
1514
|
-
// Turn 2: Complete
|
|
1515
|
-
mockModelResponse([
|
|
1516
|
-
{
|
|
1517
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1518
|
-
args: { finalResult: 'Done' },
|
|
1519
|
-
id: 't2',
|
|
1520
|
-
},
|
|
1521
|
-
], 'T2');
|
|
1522
|
-
await executor.run({ goal: 'Compress fail' }, signal);
|
|
1523
|
-
expect(mockCompress).toHaveBeenCalledTimes(2);
|
|
1524
|
-
// First call, hasFailedCompressionAttempt is false
|
|
1525
|
-
expect(mockCompress.mock.calls[0][5]).toBe(false);
|
|
1526
|
-
// Second call, hasFailedCompressionAttempt is true
|
|
1527
|
-
expect(mockCompress.mock.calls[1][5]).toBe(true);
|
|
1528
|
-
});
|
|
1529
|
-
it('should reset hasFailedCompressionAttempt flag after a successful compression', async () => {
|
|
1530
|
-
const definition = createTestDefinition();
|
|
1531
|
-
const executor = await LocalAgentExecutor.create(definition, mockConfig, onActivity);
|
|
1532
|
-
const compressedHistory = [
|
|
1533
|
-
{ role: 'user', parts: [{ text: 'compressed' }] },
|
|
1534
|
-
];
|
|
1535
|
-
// Turn 1: Fails
|
|
1536
|
-
mockCompress.mockResolvedValueOnce({
|
|
1537
|
-
newHistory: null,
|
|
1538
|
-
info: {
|
|
1539
|
-
compressionStatus: CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT,
|
|
1540
|
-
},
|
|
1541
|
-
});
|
|
1542
|
-
// Turn 2: Succeeds
|
|
1543
|
-
mockCompress.mockResolvedValueOnce({
|
|
1544
|
-
newHistory: compressedHistory,
|
|
1545
|
-
info: { compressionStatus: CompressionStatus.COMPRESSED },
|
|
1546
|
-
});
|
|
1547
|
-
// Turn 3: Neutral
|
|
1548
|
-
mockCompress.mockResolvedValueOnce({
|
|
1549
|
-
newHistory: null,
|
|
1550
|
-
info: { compressionStatus: CompressionStatus.NOOP },
|
|
1551
|
-
});
|
|
1552
|
-
// Turn 1
|
|
1553
|
-
mockWorkResponse('t1');
|
|
1554
|
-
// Turn 2
|
|
1555
|
-
mockWorkResponse('t2');
|
|
1556
|
-
// Turn 3: Complete
|
|
1557
|
-
mockModelResponse([
|
|
1558
|
-
{
|
|
1559
|
-
name: TASK_COMPLETE_TOOL_NAME,
|
|
1560
|
-
args: { finalResult: 'Done' },
|
|
1561
|
-
id: 't3',
|
|
1562
|
-
},
|
|
1563
|
-
], 'T3');
|
|
1564
|
-
await executor.run({ goal: 'Compress reset' }, signal);
|
|
1565
|
-
expect(mockCompress).toHaveBeenCalledTimes(3);
|
|
1566
|
-
// Call 1: hasFailed... is false
|
|
1567
|
-
expect(mockCompress.mock.calls[0][5]).toBe(false);
|
|
1568
|
-
// Call 2: hasFailed... is true
|
|
1569
|
-
expect(mockCompress.mock.calls[1][5]).toBe(true);
|
|
1570
|
-
// Call 3: hasFailed... is false again
|
|
1571
|
-
expect(mockCompress.mock.calls[2][5]).toBe(false);
|
|
1572
|
-
expect(mockSetHistory).toHaveBeenCalledTimes(1);
|
|
1573
|
-
expect(mockSetHistory).toHaveBeenCalledWith(compressedHistory);
|
|
1574
|
-
});
|
|
1575
|
-
});
|
|
1576
|
-
});
|
|
1577
|
-
//# sourceMappingURL=local-executor.test.js.map
|