@didim365/agent-cli-core 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -2
- package/dist/docs/00_project/ai_adapter/01-overview.md +0 -172
- package/dist/docs/00_project/ai_adapter/02-architecture.md +0 -448
- package/dist/docs/00_project/ai_adapter/03-technical-design.md +0 -1470
- package/dist/docs/00_project/ai_adapter/04-integration-design.md +0 -1934
- package/dist/docs/00_project/ai_adapter/05-implementation-plan.md +0 -336
- package/dist/docs/00_project/ai_adapter/06-didiaistudio-plan.md +0 -559
- package/dist/docs/00_project/ai_adapter/README.md +0 -145
- package/dist/docs/00_project/ai_adapter/agent_service_openapi.json +0 -1
- package/dist/docs/00_project/ai_adapter/didimStudi-AISTUDIO /341/204/213/341/205/254/341/204/207/341/205/256 /341/204/211/341/205/245/341/204/207/341/205/265/341/204/211/341/205/263 /341/204/221/341/205/263/341/206/257/341/204/205/341/205/251/341/204/213/341/205/256 /341/204/213/341/205/247/341/206/253/341/204/200/341/205/247/341/206/257 /341/204/207/341/205/241/341/206/274/341/204/211/341/205/265/341/206/250-100226-093925.pdf +0 -0
- package/dist/docs/00_project/ai_adapter/event-mapping-matrix.md +0 -148
- package/dist/docs/00_project/ai_adapter/migration-plan.md +0 -205
- package/dist/docs/00_project/ai_adapter/template/00_vibecoding_workflow.md +0 -627
- package/dist/docs/00_project/ai_adapter/template/01_todolist_performance_template.md +0 -436
- package/dist/docs/00_project/ai_adapter/template/02_code_review_template.md +0 -248
- package/dist/docs/00_project/ai_adapter/template/03_work_result_report_template.md +0 -133
- package/dist/docs/00_project/ai_adapter/template/100_Python_Performance_Guide.md +0 -472
- package/dist/docs/00_project/ai_adapter/template/99_TDD_plan.md +0 -123
- package/dist/docs/00_project/ai_adapter/todolist/00_master_implementation_plan.md +0 -433
- package/dist/docs/00_project/ai_adapter/todolist/phase1_foundation_todolist.md +0 -726
- package/dist/docs/00_project/ai_adapter/todolist/phase2_core_refactoring_todolist.md +0 -974
- package/dist/docs/00_project/ai_adapter/todolist/phase3_handoff.md +0 -203
- package/dist/docs/00_project/ai_adapter/todolist/phase3_provider_extension_todolist.md +0 -1382
- package/dist/docs/00_project/ai_adapter/utility-migration.md +0 -237
- package/dist/docs/00_project/ai_adapter/working_history/.gitkeep +0 -0
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.0_/354/275/224/353/223/234/354/235/270/353/262/244/355/206/240/353/246/254_20260201.md +0 -197
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.1_/355/203/200/354/236/205/354/204/244/352/263/204_20260201.md +0 -185
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.2_Adapter/354/235/270/355/224/204/353/235/274_20260203.md +0 -378
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.3_Provider/354/204/240/355/203/235_20260206.md +0 -269
- package/dist/docs/00_project/ai_adapter/working_history/Phase1_M1.4_/354/234/240/355/213/270/353/246/254/355/213/260/353/247/210/354/235/264/352/267/270/353/240/210/354/235/264/354/205/230_20260206.md +0 -86
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_ETC_/354/227/260/352/270/260/354/236/221/354/227/205/354/240/225/353/246/254_20260208.md +0 -157
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.0_/353/224/224/353/240/211/355/206/240/353/246/254/354/236/254/352/265/254/354/204/261_20260207.md +0 -107
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.1_ContentGenerator/354/235/270/355/204/260/355/216/230/354/235/264/354/212/244/354/236/254/354/240/225/354/235/230_20260207.md +0 -630
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.2_EventMapper/352/265/254/355/230/204_20260207.md +0 -372
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.3_GeminiAdapter/352/265/254/355/230/204_20260208.md +0 -205
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.4_ModelConfigService/355/230/270/355/231/230/353/240/210/354/235/264/354/226/264_20260208.md +0 -275
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.5_/354/234/240/355/213/270/353/246/254/355/213/260/353/240/210/354/235/264/354/226/264/353/246/254/355/214/251/355/206/240/353/247/201_20260208.md +0 -239
- package/dist/docs/00_project/ai_adapter/working_history/Phase2_M2.6_/353/235/274/354/232/260/355/214/205/353/240/210/354/235/264/354/226/264/355/203/200/354/236/205/353/217/205/353/246/275/355/231/224_20260208.md +0 -228
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_ETC_/352/270/260/353/263/270/354/273/250/355/205/215/354/212/244/355/212/270/355/214/214/354/235/274/353/252/205AGENTS/354/240/204/355/231/230_20260211.md +0 -470
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.1_Gemini/354/240/204/354/232/251/355/214/214/354/235/274/353/254/274/353/246/254/354/240/201/354/235/264/353/217/231_20260209.md +0 -271
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.2_messageInspectors/353/247/210/354/235/264/352/267/270/353/240/210/354/235/264/354/205/230_20260209.md +0 -330
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.3_/355/205/224/353/240/210/353/251/224/355/212/270/353/246/254Agent/353/217/205/353/246/275/355/231/224_20260209.md +0 -251
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.4_/353/263/200/355/231/230/353/270/214/353/246/277/354/247/200/354/240/225/353/246/254_20260209.md +0 -136
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.0.5_/353/237/260/355/203/200/354/236/204/354/213/244/355/226/211/352/262/275/353/241/234/354/227/260/352/262/260_20260209.md +0 -232
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.0_Claude/354/202/254/354/240/204/354/244/200/353/271/204_20260209.md +0 -191
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.1_ClaudeAdapter/352/265/254/355/230/204_20260209.md +0 -225
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.2_ClaudeConverter/352/263/240/353/217/204/355/231/224_20260209.md +0 -171
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.3_ClaudeStreamError/352/263/240/353/217/204/355/231/224_20260209.md +0 -198
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.1.4_ClaudeErrorMapping_20260209.md +0 -98
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.2.A_OpenAIAdapterCore_20260210.md +0 -264
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.2.B_OpenAIStreamConverter_20260210.md +0 -204
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.3.2_/353/252/250/353/215/270/355/205/234/355/224/214/353/246/277/355/233/205/353/263/264/354/231/204_20260211.md +0 -106
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.3_OpenAICompatibleAdapter_20260211.md +0 -251
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.2_E2E/355/205/214/354/212/244/355/212/270/354/213/234/353/202/230/353/246/254/354/230/244_20260210.md +0 -264
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.3_/354/204/261/353/212/245/355/232/214/352/267/200/355/205/214/354/212/244/355/212/270_20260211.md +0 -176
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.5_/354/225/210/354/240/225/355/231/224/354/236/221/354/227/205_20260211.md +0 -204
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.A_CLI/355/206/265/355/225/251_3Provider/355/206/265/355/225/251/355/205/214/354/212/244/355/212/270_20260210.md +0 -316
- package/dist/docs/00_project/ai_adapter/working_history/Phase3_M3.4.A_UI/354/203/201/355/203/234/353/260/224/354/210/230/354/240/225_20260210.md +0 -262
- package/dist/docs/00_project/ai_adapter/working_history/phase2_tradeoff_EventType/354/240/204/355/231/230_20260208.md +0 -286
- package/dist/docs/00_project/white_labeling/template/00_vibecoding_workflow.md +0 -627
- package/dist/docs/00_project/white_labeling/template/01_todolist_performance_template.md +0 -400
- package/dist/docs/00_project/white_labeling/template/02_code_review_template.md +0 -248
- package/dist/docs/00_project/white_labeling/template/03_work_result_report_template.md +0 -133
- package/dist/docs/00_project/white_labeling/template/100_Python_Performance_Guide.md +0 -472
- package/dist/docs/00_project/white_labeling/template/99_TDD_plan.md +0 -123
- package/dist/docs/00_project/white_labeling/todolist/Phase_CLI/355/214/250/355/202/244/354/247/200/353/252/205/353/263/200/352/262/275_todolist.md +0 -431
- package/dist/docs/00_project/white_labeling/working_history/Phase_CLI/355/214/250/355/202/244/354/247/200/353/252/205/353/263/200/352/262/275_20260214.md +0 -238
- package/dist/docs/00_project/white_labeling//354/225/261/352/265/254/354/241/260.md +0 -310
- package/dist/docs/CONTRIBUTING.md +0 -554
- package/dist/docs/ai_adapter/01-overview.md +0 -155
- package/dist/docs/ai_adapter/02-architecture.md +0 -452
- package/dist/docs/ai_adapter/03-technical-design.md +0 -1470
- package/dist/docs/ai_adapter/04-integration-design.md +0 -1904
- package/dist/docs/ai_adapter/05-implementation-plan.md +0 -312
- package/dist/docs/ai_adapter/06-didiaistudio-plan.md +0 -559
- package/dist/docs/ai_adapter/README.md +0 -118
- package/dist/docs/ai_adapter/agent_service_openapi.json +0 -1
- package/dist/docs/ai_adapter/didimStudi-AISTUDIO /341/204/213/341/205/254/341/204/207/341/205/256 /341/204/211/341/205/245/341/204/207/341/205/265/341/204/211/341/205/263 /341/204/221/341/205/263/341/206/257/341/204/205/341/205/251/341/204/213/341/205/256 /341/204/213/341/205/247/341/206/253/341/204/200/341/205/247/341/206/257 /341/204/207/341/205/241/341/206/274/341/204/211/341/205/265/341/206/250-100226-093925.pdf +0 -0
- package/dist/docs/ai_adapter/event-mapping-matrix.md +0 -140
- package/dist/docs/ai_adapter/migration-plan.md +0 -205
- package/dist/docs/ai_adapter/template/00_vibecoding_workflow.md +0 -636
- package/dist/docs/ai_adapter/template/01_todolist_performance_template.md +0 -372
- package/dist/docs/ai_adapter/template/02_code_review_template.md +0 -220
- package/dist/docs/ai_adapter/template/03_work_result_report_template.md +0 -120
- package/dist/docs/ai_adapter/template/100_Python_Performance_Guide.md +0 -453
- package/dist/docs/ai_adapter/template/99_TDD_plan.md +0 -111
- package/dist/docs/ai_adapter/todolist/00_master_implementation_plan.md +0 -433
- package/dist/docs/ai_adapter/todolist/phase1_foundation_todolist.md +0 -726
- package/dist/docs/ai_adapter/todolist/phase2_core_refactoring_todolist.md +0 -974
- package/dist/docs/ai_adapter/todolist/phase3_handoff.md +0 -203
- package/dist/docs/ai_adapter/todolist/phase3_provider_extension_todolist.md +0 -1382
- package/dist/docs/ai_adapter/utility-migration.md +0 -237
- package/dist/docs/ai_adapter/working_history/.gitkeep +0 -0
- package/dist/docs/ai_adapter/working_history/Phase1_M1.0_/354/275/224/353/223/234/354/235/270/353/262/244/355/206/240/353/246/254_20260201.md +0 -185
- package/dist/docs/ai_adapter/working_history/Phase1_M1.1_/355/203/200/354/236/205/354/204/244/352/263/204_20260201.md +0 -185
- package/dist/docs/ai_adapter/working_history/Phase1_M1.2_Adapter/354/235/270/355/224/204/353/235/274_20260203.md +0 -378
- package/dist/docs/ai_adapter/working_history/Phase1_M1.3_Provider/354/204/240/355/203/235_20260206.md +0 -269
- package/dist/docs/ai_adapter/working_history/Phase1_M1.4_/354/234/240/355/213/270/353/246/254/355/213/260/353/247/210/354/235/264/352/267/270/353/240/210/354/235/264/354/205/230_20260206.md +0 -86
- package/dist/docs/ai_adapter/working_history/Phase2_ETC_/354/227/260/352/270/260/354/236/221/354/227/205/354/240/225/353/246/254_20260208.md +0 -157
- package/dist/docs/ai_adapter/working_history/Phase2_M2.0_/353/224/224/353/240/211/355/206/240/353/246/254/354/236/254/352/265/254/354/204/261_20260207.md +0 -107
- package/dist/docs/ai_adapter/working_history/Phase2_M2.1_ContentGenerator/354/235/270/355/204/260/355/216/230/354/235/264/354/212/244/354/236/254/354/240/225/354/235/230_20260207.md +0 -630
- package/dist/docs/ai_adapter/working_history/Phase2_M2.2_EventMapper/352/265/254/355/230/204_20260207.md +0 -372
- package/dist/docs/ai_adapter/working_history/Phase2_M2.3_GeminiAdapter/352/265/254/355/230/204_20260208.md +0 -205
- package/dist/docs/ai_adapter/working_history/Phase2_M2.4_ModelConfigService/355/230/270/355/231/230/353/240/210/354/235/264/354/226/264_20260208.md +0 -275
- package/dist/docs/ai_adapter/working_history/Phase2_M2.5_/354/234/240/355/213/270/353/246/254/355/213/260/353/240/210/354/235/264/354/226/264/353/246/254/355/214/251/355/206/240/353/247/201_20260208.md +0 -239
- package/dist/docs/ai_adapter/working_history/Phase2_M2.6_/353/235/274/354/232/260/355/214/205/353/240/210/354/235/264/354/226/264/355/203/200/354/236/205/353/217/205/353/246/275/355/231/224_20260208.md +0 -228
- package/dist/docs/ai_adapter/working_history/Phase3_ETC_/352/270/260/353/263/270/354/273/250/355/205/215/354/212/244/355/212/270/355/214/214/354/235/274/353/252/205AGENTS/354/240/204/355/231/230_20260211.md +0 -367
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.1_Gemini/354/240/204/354/232/251/355/214/214/354/235/274/353/254/274/353/246/254/354/240/201/354/235/264/353/217/231_20260209.md +0 -271
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.2_messageInspectors/353/247/210/354/235/264/352/267/270/353/240/210/354/235/264/354/205/230_20260209.md +0 -330
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.3_/355/205/224/353/240/210/353/251/224/355/212/270/353/246/254Agent/353/217/205/353/246/275/355/231/224_20260209.md +0 -251
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.4_/353/263/200/355/231/230/353/270/214/353/246/277/354/247/200/354/240/225/353/246/254_20260209.md +0 -136
- package/dist/docs/ai_adapter/working_history/Phase3_M3.0.5_/353/237/260/355/203/200/354/236/204/354/213/244/355/226/211/352/262/275/353/241/234/354/227/260/352/262/260_20260209.md +0 -232
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.0_Claude/354/202/254/354/240/204/354/244/200/353/271/204_20260209.md +0 -191
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.1_ClaudeAdapter/352/265/254/355/230/204_20260209.md +0 -225
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.2_ClaudeConverter/352/263/240/353/217/204/355/231/224_20260209.md +0 -171
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.3_ClaudeStreamError/352/263/240/353/217/204/355/231/224_20260209.md +0 -198
- package/dist/docs/ai_adapter/working_history/Phase3_M3.1.4_ClaudeErrorMapping_20260209.md +0 -98
- package/dist/docs/ai_adapter/working_history/Phase3_M3.2.A_OpenAIAdapterCore_20260210.md +0 -264
- package/dist/docs/ai_adapter/working_history/Phase3_M3.2.B_OpenAIStreamConverter_20260210.md +0 -204
- package/dist/docs/ai_adapter/working_history/Phase3_M3.3.2_/353/252/250/353/215/270/355/205/234/355/224/214/353/246/277/355/233/205/353/263/264/354/231/204_20260211.md +0 -106
- package/dist/docs/ai_adapter/working_history/Phase3_M3.3_OpenAICompatibleAdapter_20260211.md +0 -251
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.2_E2E/355/205/214/354/212/244/355/212/270/354/213/234/353/202/230/353/246/254/354/230/244_20260210.md +0 -264
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.3_/354/204/261/353/212/245/355/232/214/352/267/200/355/205/214/354/212/244/355/212/270_20260211.md +0 -176
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.5_/354/225/210/354/240/225/355/231/224/354/236/221/354/227/205_20260211.md +0 -204
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.A_CLI/355/206/265/355/225/251_3Provider/355/206/265/355/225/251/355/205/214/354/212/244/355/212/270_20260210.md +0 -316
- package/dist/docs/ai_adapter/working_history/Phase3_M3.4.A_UI/354/203/201/355/203/234/353/260/224/354/210/230/354/240/225_20260210.md +0 -262
- package/dist/docs/ai_adapter/working_history/phase2_tradeoff_EventType/354/240/204/355/231/230_20260208.md +0 -286
- package/dist/docs/api/index.md +0 -5
- package/dist/docs/api/providers.md +0 -56
- package/dist/docs/architecture.md +0 -80
- package/dist/docs/assets/connected_devtools.png +0 -0
- package/dist/docs/assets/gemini-screenshot.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-logs.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-metrics.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-overview.png +0 -0
- package/dist/docs/assets/release_patch.png +0 -0
- package/dist/docs/assets/theme-ansi-light.png +0 -0
- package/dist/docs/assets/theme-ansi.png +0 -0
- package/dist/docs/assets/theme-atom-one.png +0 -0
- package/dist/docs/assets/theme-ayu-light.png +0 -0
- package/dist/docs/assets/theme-ayu.png +0 -0
- package/dist/docs/assets/theme-custom.png +0 -0
- package/dist/docs/assets/theme-default-light.png +0 -0
- package/dist/docs/assets/theme-default.png +0 -0
- package/dist/docs/assets/theme-dracula.png +0 -0
- package/dist/docs/assets/theme-github-light.png +0 -0
- package/dist/docs/assets/theme-github.png +0 -0
- package/dist/docs/assets/theme-google-light.png +0 -0
- package/dist/docs/assets/theme-xcode-light.png +0 -0
- package/dist/docs/change_model/model_command_multi_provider_plan.md +0 -221
- package/dist/docs/change_model/model_command_multi_provider_todolist.md +0 -206
- package/dist/docs/changelogs/index.md +0 -726
- package/dist/docs/changelogs/latest.md +0 -370
- package/dist/docs/changelogs/preview.md +0 -332
- package/dist/docs/cli/authentication.md +0 -3
- package/dist/docs/cli/checkpointing.md +0 -94
- package/dist/docs/cli/commands.md +0 -375
- package/dist/docs/cli/custom-commands.md +0 -315
- package/dist/docs/cli/enterprise.md +0 -565
- package/dist/docs/cli/gemini-ignore.md +0 -71
- package/dist/docs/cli/gemini-md.md +0 -108
- package/dist/docs/cli/generation-settings.md +0 -210
- package/dist/docs/cli/headless.md +0 -388
- package/dist/docs/cli/index.md +0 -65
- package/dist/docs/cli/keyboard-shortcuts.md +0 -129
- package/dist/docs/cli/model-routing.md +0 -42
- package/dist/docs/cli/model.md +0 -62
- package/dist/docs/cli/sandbox.md +0 -171
- package/dist/docs/cli/session-management.md +0 -158
- package/dist/docs/cli/settings.md +0 -130
- package/dist/docs/cli/skills.md +0 -188
- package/dist/docs/cli/system-prompt.md +0 -125
- package/dist/docs/cli/telemetry.md +0 -826
- package/dist/docs/cli/themes.md +0 -235
- package/dist/docs/cli/token-caching.md +0 -20
- package/dist/docs/cli/trusted-folders.md +0 -95
- package/dist/docs/cli/tutorials/skills-getting-started.md +0 -124
- package/dist/docs/cli/tutorials.md +0 -87
- package/dist/docs/cli/uninstall.md +0 -65
- package/dist/docs/configuration.md +0 -108
- package/dist/docs/core/index.md +0 -105
- package/dist/docs/core/long-term-memory-design.md +0 -254
- package/dist/docs/core/long-term-memory-proposal.md +0 -112
- package/dist/docs/core/memport.md +0 -246
- package/dist/docs/core/policy-engine.md +0 -300
- package/dist/docs/core/tools-api.md +0 -131
- package/dist/docs/examples/proxy-script.md +0 -83
- package/dist/docs/extensions/best-practices.md +0 -139
- package/dist/docs/extensions/index.md +0 -44
- package/dist/docs/extensions/reference.md +0 -312
- package/dist/docs/extensions/releasing.md +0 -183
- package/dist/docs/extensions/writing-extensions.md +0 -283
- package/dist/docs/faq.md +0 -154
- package/dist/docs/get-started/authentication.md +0 -321
- package/dist/docs/get-started/configuration-v1.md +0 -888
- package/dist/docs/get-started/configuration.md +0 -1567
- package/dist/docs/get-started/examples.md +0 -219
- package/dist/docs/get-started/gemini-3.md +0 -101
- package/dist/docs/get-started/index.md +0 -71
- package/dist/docs/get-started/installation.md +0 -141
- package/dist/docs/hooks/best-practices.md +0 -677
- package/dist/docs/hooks/index.md +0 -178
- package/dist/docs/hooks/reference.md +0 -322
- package/dist/docs/hooks/writing-hooks.md +0 -450
- package/dist/docs/ide-integration/ide-companion-spec.md +0 -267
- package/dist/docs/ide-integration/index.md +0 -202
- package/dist/docs/index.md +0 -153
- package/dist/docs/integration-tests.md +0 -211
- package/dist/docs/issue-and-pr-automation.md +0 -134
- package/dist/docs/local-development.md +0 -128
- package/dist/docs/mermaid/context.mmd +0 -103
- package/dist/docs/mermaid/render-path.mmd +0 -64
- package/dist/docs/migration.md +0 -78
- package/dist/docs/npm.md +0 -62
- package/dist/docs/providers.md +0 -136
- package/dist/docs/quota-and-pricing.md +0 -158
- package/dist/docs/release-confidence.md +0 -164
- package/dist/docs/releases.md +0 -539
- package/dist/docs/sidebar.json +0 -140
- package/dist/docs/tools/file-system.md +0 -217
- package/dist/docs/tools/index.md +0 -98
- package/dist/docs/tools/mcp-server.md +0 -1068
- package/dist/docs/tools/memory.md +0 -54
- package/dist/docs/tools/shell.md +0 -260
- package/dist/docs/tools/todos.md +0 -57
- package/dist/docs/tools/web-fetch.md +0 -59
- package/dist/docs/tools/web-search.md +0 -42
- package/dist/docs/tos-privacy.md +0 -96
- package/dist/docs/troubleshooting.md +0 -173
- package/dist/src/agents/a2a-client-manager.test.d.ts +0 -6
- package/dist/src/agents/a2a-client-manager.test.js +0 -220
- package/dist/src/agents/a2a-client-manager.test.js.map +0 -1
- package/dist/src/agents/a2aUtils.test.d.ts +0 -6
- package/dist/src/agents/a2aUtils.test.js +0 -147
- package/dist/src/agents/a2aUtils.test.js.map +0 -1
- package/dist/src/agents/acknowledgedAgents.test.d.ts +0 -6
- package/dist/src/agents/acknowledgedAgents.test.js +0 -70
- package/dist/src/agents/acknowledgedAgents.test.js.map +0 -1
- package/dist/src/agents/agent-scheduler.test.d.ts +0 -6
- package/dist/src/agents/agent-scheduler.test.js +0 -56
- package/dist/src/agents/agent-scheduler.test.js.map +0 -1
- package/dist/src/agents/agentLoader.test.d.ts +0 -6
- package/dist/src/agents/agentLoader.test.js +0 -304
- package/dist/src/agents/agentLoader.test.js.map +0 -1
- package/dist/src/agents/cli-help-agent.test.d.ts +0 -6
- package/dist/src/agents/cli-help-agent.test.js +0 -67
- package/dist/src/agents/cli-help-agent.test.js.map +0 -1
- package/dist/src/agents/codebase-investigator.test.d.ts +0 -6
- package/dist/src/agents/codebase-investigator.test.js +0 -42
- package/dist/src/agents/codebase-investigator.test.js.map +0 -1
- package/dist/src/agents/generalist-agent.test.d.ts +0 -6
- package/dist/src/agents/generalist-agent.test.js +0 -31
- package/dist/src/agents/generalist-agent.test.js.map +0 -1
- package/dist/src/agents/local-executor.test.d.ts +0 -6
- package/dist/src/agents/local-executor.test.js +0 -1577
- package/dist/src/agents/local-executor.test.js.map +0 -1
- package/dist/src/agents/local-invocation.test.d.ts +0 -6
- package/dist/src/agents/local-invocation.test.js +0 -228
- package/dist/src/agents/local-invocation.test.js.map +0 -1
- package/dist/src/agents/registry.test.d.ts +0 -6
- package/dist/src/agents/registry.test.js +0 -773
- package/dist/src/agents/registry.test.js.map +0 -1
- package/dist/src/agents/registry_acknowledgement.test.d.ts +0 -6
- package/dist/src/agents/registry_acknowledgement.test.js +0 -130
- package/dist/src/agents/registry_acknowledgement.test.js.map +0 -1
- package/dist/src/agents/remote-invocation.test.d.ts +0 -6
- package/dist/src/agents/remote-invocation.test.js +0 -213
- package/dist/src/agents/remote-invocation.test.js.map +0 -1
- package/dist/src/agents/subagent-tool-wrapper.test.d.ts +0 -6
- package/dist/src/agents/subagent-tool-wrapper.test.js +0 -109
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +0 -1
- package/dist/src/agents/utils.test.d.ts +0 -6
- package/dist/src/agents/utils.test.js +0 -87
- package/dist/src/agents/utils.test.js.map +0 -1
- package/dist/src/availability/fallbackIntegration.test.d.ts +0 -6
- package/dist/src/availability/fallbackIntegration.test.js +0 -58
- package/dist/src/availability/fallbackIntegration.test.js.map +0 -1
- package/dist/src/availability/modelAvailabilityService.test.d.ts +0 -6
- package/dist/src/availability/modelAvailabilityService.test.js +0 -140
- package/dist/src/availability/modelAvailabilityService.test.js.map +0 -1
- package/dist/src/availability/policyCatalog.test.d.ts +0 -6
- package/dist/src/availability/policyCatalog.test.js +0 -70
- package/dist/src/availability/policyCatalog.test.js.map +0 -1
- package/dist/src/availability/policyHelpers.test.d.ts +0 -6
- package/dist/src/availability/policyHelpers.test.js +0 -220
- package/dist/src/availability/policyHelpers.test.js.map +0 -1
- package/dist/src/code_assist/admin/admin_controls.test.d.ts +0 -6
- package/dist/src/code_assist/admin/admin_controls.test.js +0 -200
- package/dist/src/code_assist/admin/admin_controls.test.js.map +0 -1
- package/dist/src/code_assist/codeAssist.test.d.ts +0 -6
- package/dist/src/code_assist/codeAssist.test.js +0 -102
- package/dist/src/code_assist/codeAssist.test.js.map +0 -1
- package/dist/src/code_assist/converter.test.d.ts +0 -6
- package/dist/src/code_assist/converter.test.js +0 -391
- package/dist/src/code_assist/converter.test.js.map +0 -1
- package/dist/src/code_assist/experiments/client_metadata.test.d.ts +0 -6
- package/dist/src/code_assist/experiments/client_metadata.test.js +0 -96
- package/dist/src/code_assist/experiments/client_metadata.test.js.map +0 -1
- package/dist/src/code_assist/experiments/experiments.test.d.ts +0 -6
- package/dist/src/code_assist/experiments/experiments.test.js +0 -93
- package/dist/src/code_assist/experiments/experiments.test.js.map +0 -1
- package/dist/src/code_assist/experiments/experiments_local.test.d.ts +0 -6
- package/dist/src/code_assist/experiments/experiments_local.test.js +0 -115
- package/dist/src/code_assist/experiments/experiments_local.test.js.map +0 -1
- package/dist/src/code_assist/oauth-credential-storage.test.d.ts +0 -6
- package/dist/src/code_assist/oauth-credential-storage.test.js +0 -198
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +0 -1
- package/dist/src/code_assist/oauth2.test.d.ts +0 -6
- package/dist/src/code_assist/oauth2.test.js +0 -1065
- package/dist/src/code_assist/oauth2.test.js.map +0 -1
- package/dist/src/code_assist/server.test.d.ts +0 -6
- package/dist/src/code_assist/server.test.js +0 -453
- package/dist/src/code_assist/server.test.js.map +0 -1
- package/dist/src/code_assist/setup.test.d.ts +0 -6
- package/dist/src/code_assist/setup.test.js +0 -517
- package/dist/src/code_assist/setup.test.js.map +0 -1
- package/dist/src/code_assist/telemetry.test.d.ts +0 -6
- package/dist/src/code_assist/telemetry.test.js +0 -301
- package/dist/src/code_assist/telemetry.test.js.map +0 -1
- package/dist/src/commands/extensions.test.d.ts +0 -6
- package/dist/src/commands/extensions.test.js +0 -19
- package/dist/src/commands/extensions.test.js.map +0 -1
- package/dist/src/commands/init.test.d.ts +0 -6
- package/dist/src/commands/init.test.js +0 -25
- package/dist/src/commands/init.test.js.map +0 -1
- package/dist/src/commands/memory.test.d.ts +0 -6
- package/dist/src/commands/memory.test.js +0 -182
- package/dist/src/commands/memory.test.js.map +0 -1
- package/dist/src/commands/restore.test.d.ts +0 -6
- package/dist/src/commands/restore.test.js +0 -137
- package/dist/src/commands/restore.test.js.map +0 -1
- package/dist/src/config/config.test.d.ts +0 -6
- package/dist/src/config/config.test.js +0 -1811
- package/dist/src/config/config.test.js.map +0 -1
- package/dist/src/config/flashFallback.test.d.ts +0 -6
- package/dist/src/config/flashFallback.test.js +0 -63
- package/dist/src/config/flashFallback.test.js.map +0 -1
- package/dist/src/config/models.test.d.ts +0 -6
- package/dist/src/config/models.test.js +0 -146
- package/dist/src/config/models.test.js.map +0 -1
- package/dist/src/config/storage.test.d.ts +0 -6
- package/dist/src/config/storage.test.js +0 -115
- package/dist/src/config/storage.test.js.map +0 -1
- package/dist/src/confirmation-bus/message-bus.test.d.ts +0 -6
- package/dist/src/confirmation-bus/message-bus.test.js +0 -170
- package/dist/src/confirmation-bus/message-bus.test.js.map +0 -1
- package/dist/src/core/apiKeyCredentialStorage.test.d.ts +0 -6
- package/dist/src/core/apiKeyCredentialStorage.test.js +0 -71
- package/dist/src/core/apiKeyCredentialStorage.test.js.map +0 -1
- package/dist/src/core/baseLlmClient.test.d.ts +0 -6
- package/dist/src/core/baseLlmClient.test.js +0 -569
- package/dist/src/core/baseLlmClient.test.js.map +0 -1
- package/dist/src/core/baseLlmClient_new_types.test.d.ts +0 -1
- package/dist/src/core/baseLlmClient_new_types.test.js +0 -387
- package/dist/src/core/baseLlmClient_new_types.test.js.map +0 -1
- package/dist/src/core/client.test.d.ts +0 -6
- package/dist/src/core/client.test.js +0 -2654
- package/dist/src/core/client.test.js.map +0 -1
- package/dist/src/core/contentGenerator.multiProvider.test.d.ts +0 -6
- package/dist/src/core/contentGenerator.multiProvider.test.js +0 -314
- package/dist/src/core/contentGenerator.multiProvider.test.js.map +0 -1
- package/dist/src/core/contentGenerator.test.d.ts +0 -6
- package/dist/src/core/contentGenerator.test.js +0 -299
- package/dist/src/core/contentGenerator.test.js.map +0 -1
- package/dist/src/core/contentGenerator_new_types.test.d.ts +0 -6
- package/dist/src/core/contentGenerator_new_types.test.js +0 -292
- package/dist/src/core/contentGenerator_new_types.test.js.map +0 -1
- package/dist/src/core/coreToolHookTriggers.test.d.ts +0 -6
- package/dist/src/core/coreToolHookTriggers.test.js +0 -159
- package/dist/src/core/coreToolHookTriggers.test.js.map +0 -1
- package/dist/src/core/coreToolScheduler.test.d.ts +0 -6
- package/dist/src/core/coreToolScheduler.test.js +0 -1684
- package/dist/src/core/coreToolScheduler.test.js.map +0 -1
- package/dist/src/core/fakeContentGenerator.test.d.ts +0 -6
- package/dist/src/core/fakeContentGenerator.test.js +0 -127
- package/dist/src/core/fakeContentGenerator.test.js.map +0 -1
- package/dist/src/core/geminiChat.test.d.ts +0 -6
- package/dist/src/core/geminiChat.test.js +0 -1773
- package/dist/src/core/geminiChat.test.js.map +0 -1
- package/dist/src/core/geminiChat_network_retry.test.d.ts +0 -6
- package/dist/src/core/geminiChat_network_retry.test.js +0 -201
- package/dist/src/core/geminiChat_network_retry.test.js.map +0 -1
- package/dist/src/core/logger.test.d.ts +0 -6
- package/dist/src/core/logger.test.js +0 -550
- package/dist/src/core/logger.test.js.map +0 -1
- package/dist/src/core/loggingContentGenerator.test.d.ts +0 -6
- package/dist/src/core/loggingContentGenerator.test.js +0 -221
- package/dist/src/core/loggingContentGenerator.test.js.map +0 -1
- package/dist/src/core/prompts-substitution.test.d.ts +0 -6
- package/dist/src/core/prompts-substitution.test.js +0 -101
- package/dist/src/core/prompts-substitution.test.js.map +0 -1
- package/dist/src/core/prompts.test.d.ts +0 -6
- package/dist/src/core/prompts.test.js +0 -391
- package/dist/src/core/prompts.test.js.map +0 -1
- package/dist/src/core/recordingContentGenerator.test.d.ts +0 -6
- package/dist/src/core/recordingContentGenerator.test.js +0 -101
- package/dist/src/core/recordingContentGenerator.test.js.map +0 -1
- package/dist/src/core/tokenLimits.test.d.ts +0 -6
- package/dist/src/core/tokenLimits.test.js +0 -30
- package/dist/src/core/tokenLimits.test.js.map +0 -1
- package/dist/src/core/turn.test.d.ts +0 -6
- package/dist/src/core/turn.test.js +0 -739
- package/dist/src/core/turn.test.js.map +0 -1
- package/dist/src/fallback/handler.test.d.ts +0 -6
- package/dist/src/fallback/handler.test.js +0 -242
- package/dist/src/fallback/handler.test.js.map +0 -1
- package/dist/src/hooks/hookAggregator.test.d.ts +0 -6
- package/dist/src/hooks/hookAggregator.test.js +0 -387
- package/dist/src/hooks/hookAggregator.test.js.map +0 -1
- package/dist/src/hooks/hookEventHandler.test.d.ts +0 -6
- package/dist/src/hooks/hookEventHandler.test.js +0 -603
- package/dist/src/hooks/hookEventHandler.test.js.map +0 -1
- package/dist/src/hooks/hookPlanner.test.d.ts +0 -6
- package/dist/src/hooks/hookPlanner.test.js +0 -315
- package/dist/src/hooks/hookPlanner.test.js.map +0 -1
- package/dist/src/hooks/hookRegistry.test.d.ts +0 -6
- package/dist/src/hooks/hookRegistry.test.js +0 -529
- package/dist/src/hooks/hookRegistry.test.js.map +0 -1
- package/dist/src/hooks/hookRunner.test.d.ts +0 -6
- package/dist/src/hooks/hookRunner.test.js +0 -606
- package/dist/src/hooks/hookRunner.test.js.map +0 -1
- package/dist/src/hooks/hookSystem.test.d.ts +0 -6
- package/dist/src/hooks/hookSystem.test.js +0 -330
- package/dist/src/hooks/hookSystem.test.js.map +0 -1
- package/dist/src/hooks/hookSystem_new_types.test.d.ts +0 -6
- package/dist/src/hooks/hookSystem_new_types.test.js +0 -243
- package/dist/src/hooks/hookSystem_new_types.test.js.map +0 -1
- package/dist/src/hooks/hookTranslator.test.d.ts +0 -6
- package/dist/src/hooks/hookTranslator.test.js +0 -192
- package/dist/src/hooks/hookTranslator.test.js.map +0 -1
- package/dist/src/hooks/trustedHooks.test.d.ts +0 -6
- package/dist/src/hooks/trustedHooks.test.js +0 -154
- package/dist/src/hooks/trustedHooks.test.js.map +0 -1
- package/dist/src/hooks/types.test.d.ts +0 -6
- package/dist/src/hooks/types.test.js +0 -278
- package/dist/src/hooks/types.test.js.map +0 -1
- package/dist/src/ide/detect-ide.test.d.ts +0 -6
- package/dist/src/ide/detect-ide.test.js +0 -195
- package/dist/src/ide/detect-ide.test.js.map +0 -1
- package/dist/src/ide/ide-client.test.d.ts +0 -6
- package/dist/src/ide/ide-client.test.js +0 -753
- package/dist/src/ide/ide-client.test.js.map +0 -1
- package/dist/src/ide/ide-installer.test.d.ts +0 -6
- package/dist/src/ide/ide-installer.test.js +0 -193
- package/dist/src/ide/ide-installer.test.js.map +0 -1
- package/dist/src/ide/ideContext.test.d.ts +0 -6
- package/dist/src/ide/ideContext.test.js +0 -393
- package/dist/src/ide/ideContext.test.js.map +0 -1
- package/dist/src/ide/process-utils.test.d.ts +0 -6
- package/dist/src/ide/process-utils.test.js +0 -151
- package/dist/src/ide/process-utils.test.js.map +0 -1
- package/dist/src/index.test.d.ts +0 -6
- package/dist/src/index.test.js +0 -53
- package/dist/src/index.test.js.map +0 -1
- package/dist/src/mcp/google-auth-provider.test.d.ts +0 -6
- package/dist/src/mcp/google-auth-provider.test.js +0 -167
- package/dist/src/mcp/google-auth-provider.test.js.map +0 -1
- package/dist/src/mcp/oauth-provider.test.d.ts +0 -6
- package/dist/src/mcp/oauth-provider.test.js +0 -1355
- package/dist/src/mcp/oauth-provider.test.js.map +0 -1
- package/dist/src/mcp/oauth-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/oauth-token-storage.test.js +0 -305
- package/dist/src/mcp/oauth-token-storage.test.js.map +0 -1
- package/dist/src/mcp/oauth-utils.test.d.ts +0 -6
- package/dist/src/mcp/oauth-utils.test.js +0 -289
- package/dist/src/mcp/oauth-utils.test.js.map +0 -1
- package/dist/src/mcp/sa-impersonation-provider.test.d.ts +0 -6
- package/dist/src/mcp/sa-impersonation-provider.test.js +0 -117
- package/dist/src/mcp/sa-impersonation-provider.test.js.map +0 -1
- package/dist/src/mcp/token-storage/base-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/token-storage/base-token-storage.test.js +0 -151
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +0 -1
- package/dist/src/mcp/token-storage/file-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/token-storage/file-token-storage.test.js +0 -238
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +0 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +0 -193
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +0 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +0 -305
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +0 -1
- package/dist/src/output/json-formatter.test.d.ts +0 -6
- package/dist/src/output/json-formatter.test.js +0 -294
- package/dist/src/output/json-formatter.test.js.map +0 -1
- package/dist/src/output/stream-json-formatter.test.d.ts +0 -6
- package/dist/src/output/stream-json-formatter.test.js +0 -477
- package/dist/src/output/stream-json-formatter.test.js.map +0 -1
- package/dist/src/policy/config.test.d.ts +0 -6
- package/dist/src/policy/config.test.js +0 -598
- package/dist/src/policy/config.test.js.map +0 -1
- package/dist/src/policy/persistence.test.d.ts +0 -6
- package/dist/src/policy/persistence.test.js +0 -154
- package/dist/src/policy/persistence.test.js.map +0 -1
- package/dist/src/policy/policy-engine.test.d.ts +0 -6
- package/dist/src/policy/policy-engine.test.js +0 -1299
- package/dist/src/policy/policy-engine.test.js.map +0 -1
- package/dist/src/policy/policy-updater.test.d.ts +0 -6
- package/dist/src/policy/policy-updater.test.js +0 -116
- package/dist/src/policy/policy-updater.test.js.map +0 -1
- package/dist/src/policy/shell-safety.test.d.ts +0 -6
- package/dist/src/policy/shell-safety.test.js +0 -438
- package/dist/src/policy/shell-safety.test.js.map +0 -1
- package/dist/src/policy/toml-loader.test.d.ts +0 -6
- package/dist/src/policy/toml-loader.test.js +0 -409
- package/dist/src/policy/toml-loader.test.js.map +0 -1
- package/dist/src/policy/utils.test.d.ts +0 -6
- package/dist/src/policy/utils.test.js +0 -92
- package/dist/src/policy/utils.test.js.map +0 -1
- package/dist/src/prompts/mcp-prompts.test.d.ts +0 -6
- package/dist/src/prompts/mcp-prompts.test.js +0 -39
- package/dist/src/prompts/mcp-prompts.test.js.map +0 -1
- package/dist/src/prompts/prompt-registry.test.d.ts +0 -6
- package/dist/src/prompts/prompt-registry.test.js +0 -96
- package/dist/src/prompts/prompt-registry.test.js.map +0 -1
- package/dist/src/providers/__tests__/bundleSize.test.d.ts +0 -6
- package/dist/src/providers/__tests__/bundleSize.test.js +0 -75
- package/dist/src/providers/__tests__/bundleSize.test.js.map +0 -1
- package/dist/src/providers/__tests__/errorHandling.integration.test.d.ts +0 -6
- package/dist/src/providers/__tests__/errorHandling.integration.test.js +0 -339
- package/dist/src/providers/__tests__/errorHandling.integration.test.js.map +0 -1
- package/dist/src/providers/__tests__/multiProvider.integration.test.d.ts +0 -6
- package/dist/src/providers/__tests__/multiProvider.integration.test.js +0 -419
- package/dist/src/providers/__tests__/multiProvider.integration.test.js.map +0 -1
- package/dist/src/providers/__tests__/performance.test.d.ts +0 -6
- package/dist/src/providers/__tests__/performance.test.js +0 -270
- package/dist/src/providers/__tests__/performance.test.js.map +0 -1
- package/dist/src/providers/__tests__/providerConfigIntegration.test.d.ts +0 -6
- package/dist/src/providers/__tests__/providerConfigIntegration.test.js +0 -245
- package/dist/src/providers/__tests__/providerConfigIntegration.test.js.map +0 -1
- package/dist/src/providers/baseAdapter.test.d.ts +0 -1
- package/dist/src/providers/baseAdapter.test.js +0 -142
- package/dist/src/providers/baseAdapter.test.js.map +0 -1
- package/dist/src/providers/claude/adapter.test.d.ts +0 -6
- package/dist/src/providers/claude/adapter.test.js +0 -628
- package/dist/src/providers/claude/adapter.test.js.map +0 -1
- package/dist/src/providers/claude/bootstrap.test.d.ts +0 -6
- package/dist/src/providers/claude/bootstrap.test.js +0 -74
- package/dist/src/providers/claude/bootstrap.test.js.map +0 -1
- package/dist/src/providers/claude/converter.test.d.ts +0 -6
- package/dist/src/providers/claude/converter.test.js +0 -1002
- package/dist/src/providers/claude/converter.test.js.map +0 -1
- package/dist/src/providers/claude/exports.test.d.ts +0 -6
- package/dist/src/providers/claude/exports.test.js +0 -40
- package/dist/src/providers/claude/exports.test.js.map +0 -1
- package/dist/src/providers/configAdapter.test.d.ts +0 -1
- package/dist/src/providers/configAdapter.test.js +0 -150
- package/dist/src/providers/configAdapter.test.js.map +0 -1
- package/dist/src/providers/contentResolver.test.d.ts +0 -1
- package/dist/src/providers/contentResolver.test.js +0 -89
- package/dist/src/providers/contentResolver.test.js.map +0 -1
- package/dist/src/providers/factory.test.d.ts +0 -1
- package/dist/src/providers/factory.test.js +0 -151
- package/dist/src/providers/factory.test.js.map +0 -1
- package/dist/src/providers/gemini/adapterBridge.test.d.ts +0 -6
- package/dist/src/providers/gemini/adapterBridge.test.js +0 -164
- package/dist/src/providers/gemini/adapterBridge.test.js.map +0 -1
- package/dist/src/providers/gemini/bootstrap.test.d.ts +0 -6
- package/dist/src/providers/gemini/bootstrap.test.js +0 -72
- package/dist/src/providers/gemini/bootstrap.test.js.map +0 -1
- package/dist/src/providers/gemini/configConverter.test.d.ts +0 -6
- package/dist/src/providers/gemini/configConverter.test.js +0 -218
- package/dist/src/providers/gemini/configConverter.test.js.map +0 -1
- package/dist/src/providers/gemini/errorClassifier.test.d.ts +0 -6
- package/dist/src/providers/gemini/errorClassifier.test.js +0 -83
- package/dist/src/providers/gemini/errorClassifier.test.js.map +0 -1
- package/dist/src/providers/gemini/eventMapper.test.d.ts +0 -6
- package/dist/src/providers/gemini/eventMapper.test.js +0 -502
- package/dist/src/providers/gemini/eventMapper.test.js.map +0 -1
- package/dist/src/providers/gemini/exports.test.d.ts +0 -6
- package/dist/src/providers/gemini/exports.test.js +0 -90
- package/dist/src/providers/gemini/exports.test.js.map +0 -1
- package/dist/src/providers/gemini/featureFlag.test.d.ts +0 -6
- package/dist/src/providers/gemini/featureFlag.test.js +0 -139
- package/dist/src/providers/gemini/featureFlag.test.js.map +0 -1
- package/dist/src/providers/gemini/geminiAdapter.test.d.ts +0 -6
- package/dist/src/providers/gemini/geminiAdapter.test.js +0 -279
- package/dist/src/providers/gemini/geminiAdapter.test.js.map +0 -1
- package/dist/src/providers/gemini/geminiConverter.test.d.ts +0 -6
- package/dist/src/providers/gemini/geminiConverter.test.js +0 -474
- package/dist/src/providers/gemini/geminiConverter.test.js.map +0 -1
- package/dist/src/providers/gemini/geminiParity.test.d.ts +0 -6
- package/dist/src/providers/gemini/geminiParity.test.js +0 -754
- package/dist/src/providers/gemini/geminiParity.test.js.map +0 -1
- package/dist/src/providers/gemini/geminiStream.test.d.ts +0 -6
- package/dist/src/providers/gemini/geminiStream.test.js +0 -391
- package/dist/src/providers/gemini/geminiStream.test.js.map +0 -1
- package/dist/src/providers/gemini/historyBuilder.test.d.ts +0 -6
- package/dist/src/providers/gemini/historyBuilder.test.js +0 -207
- package/dist/src/providers/gemini/historyBuilder.test.js.map +0 -1
- package/dist/src/providers/gemini/requestBuilder.test.d.ts +0 -6
- package/dist/src/providers/gemini/requestBuilder.test.js +0 -358
- package/dist/src/providers/gemini/requestBuilder.test.js.map +0 -1
- package/dist/src/providers/gemini/streamConverter.test.d.ts +0 -6
- package/dist/src/providers/gemini/streamConverter.test.js +0 -131
- package/dist/src/providers/gemini/streamConverter.test.js.map +0 -1
- package/dist/src/providers/modelSpec.test.d.ts +0 -1
- package/dist/src/providers/modelSpec.test.js +0 -119
- package/dist/src/providers/modelSpec.test.js.map +0 -1
- package/dist/src/providers/openai/adapter.test.d.ts +0 -6
- package/dist/src/providers/openai/adapter.test.js +0 -274
- package/dist/src/providers/openai/adapter.test.js.map +0 -1
- package/dist/src/providers/openai/bootstrap.test.d.ts +0 -6
- package/dist/src/providers/openai/bootstrap.test.js +0 -76
- package/dist/src/providers/openai/bootstrap.test.js.map +0 -1
- package/dist/src/providers/openai/converter.test.d.ts +0 -6
- package/dist/src/providers/openai/converter.test.js +0 -1133
- package/dist/src/providers/openai/converter.test.js.map +0 -1
- package/dist/src/providers/openai-compatible/__tests__/compatibility.test.d.ts +0 -6
- package/dist/src/providers/openai-compatible/__tests__/compatibility.test.js +0 -356
- package/dist/src/providers/openai-compatible/__tests__/compatibility.test.js.map +0 -1
- package/dist/src/providers/openai-compatible/adapter.test.d.ts +0 -6
- package/dist/src/providers/openai-compatible/adapter.test.js +0 -240
- package/dist/src/providers/openai-compatible/adapter.test.js.map +0 -1
- package/dist/src/providers/openai-compatible/bootstrap.test.d.ts +0 -6
- package/dist/src/providers/openai-compatible/bootstrap.test.js +0 -145
- package/dist/src/providers/openai-compatible/bootstrap.test.js.map +0 -1
- package/dist/src/providers/openai-compatible/promptBuilder.test.d.ts +0 -6
- package/dist/src/providers/openai-compatible/promptBuilder.test.js +0 -154
- package/dist/src/providers/openai-compatible/promptBuilder.test.js.map +0 -1
- package/dist/src/providers/providerConfig.test.d.ts +0 -1
- package/dist/src/providers/providerConfig.test.js +0 -145
- package/dist/src/providers/providerConfig.test.js.map +0 -1
- package/dist/src/providers/providerConfigIntegration.test.d.ts +0 -6
- package/dist/src/providers/providerConfigIntegration.test.js +0 -187
- package/dist/src/providers/providerConfigIntegration.test.js.map +0 -1
- package/dist/src/providers/providerSelector.test.d.ts +0 -1
- package/dist/src/providers/providerSelector.test.js +0 -199
- package/dist/src/providers/providerSelector.test.js.map +0 -1
- package/dist/src/providers/providerTypes.test.d.ts +0 -1
- package/dist/src/providers/providerTypes.test.js +0 -95
- package/dist/src/providers/providerTypes.test.js.map +0 -1
- package/dist/src/providers/registry.test.d.ts +0 -1
- package/dist/src/providers/registry.test.js +0 -207
- package/dist/src/providers/registry.test.js.map +0 -1
- package/dist/src/providers/streamAssembler.test.d.ts +0 -1
- package/dist/src/providers/streamAssembler.test.js +0 -247
- package/dist/src/providers/streamAssembler.test.js.map +0 -1
- package/dist/src/providers/telemetryBridge.test.d.ts +0 -6
- package/dist/src/providers/telemetryBridge.test.js +0 -235
- package/dist/src/providers/telemetryBridge.test.js.map +0 -1
- package/dist/src/providers/types.test.d.ts +0 -6
- package/dist/src/providers/types.test.js +0 -253
- package/dist/src/providers/types.test.js.map +0 -1
- package/dist/src/resources/resource-registry.test.d.ts +0 -6
- package/dist/src/resources/resource-registry.test.js +0 -54
- package/dist/src/resources/resource-registry.test.js.map +0 -1
- package/dist/src/routing/modelRouterService.test.d.ts +0 -6
- package/dist/src/routing/modelRouterService.test.js +0 -106
- package/dist/src/routing/modelRouterService.test.js.map +0 -1
- package/dist/src/routing/strategies/classifierStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/classifierStrategy.test.js +0 -249
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/compositeStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/compositeStrategy.test.js +0 -124
- package/dist/src/routing/strategies/compositeStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/defaultStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/defaultStrategy.test.js +0 -102
- package/dist/src/routing/strategies/defaultStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/fallbackStrategy.test.js +0 -96
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.js +0 -367
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.js.map +0 -1
- package/dist/src/routing/strategies/overrideStrategy.test.d.ts +0 -6
- package/dist/src/routing/strategies/overrideStrategy.test.js +0 -59
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +0 -1
- package/dist/src/safety/built-in.test.d.ts +0 -6
- package/dist/src/safety/built-in.test.js +0 -199
- package/dist/src/safety/built-in.test.js.map +0 -1
- package/dist/src/safety/checker-runner.test.d.ts +0 -6
- package/dist/src/safety/checker-runner.test.js +0 -238
- package/dist/src/safety/checker-runner.test.js.map +0 -1
- package/dist/src/safety/context-builder.test.d.ts +0 -6
- package/dist/src/safety/context-builder.test.js +0 -49
- package/dist/src/safety/context-builder.test.js.map +0 -1
- package/dist/src/safety/registry.test.d.ts +0 -6
- package/dist/src/safety/registry.test.js +0 -31
- package/dist/src/safety/registry.test.js.map +0 -1
- package/dist/src/scheduler/confirmation.test.d.ts +0 -6
- package/dist/src/scheduler/confirmation.test.js +0 -325
- package/dist/src/scheduler/confirmation.test.js.map +0 -1
- package/dist/src/scheduler/policy.test.d.ts +0 -6
- package/dist/src/scheduler/policy.test.js +0 -299
- package/dist/src/scheduler/policy.test.js.map +0 -1
- package/dist/src/scheduler/scheduler.test.d.ts +0 -6
- package/dist/src/scheduler/scheduler.test.js +0 -822
- package/dist/src/scheduler/scheduler.test.js.map +0 -1
- package/dist/src/scheduler/state-manager.test.d.ts +0 -6
- package/dist/src/scheduler/state-manager.test.js +0 -429
- package/dist/src/scheduler/state-manager.test.js.map +0 -1
- package/dist/src/scheduler/tool-executor.test.d.ts +0 -6
- package/dist/src/scheduler/tool-executor.test.js +0 -232
- package/dist/src/scheduler/tool-executor.test.js.map +0 -1
- package/dist/src/scheduler/tool-modifier.test.d.ts +0 -6
- package/dist/src/scheduler/tool-modifier.test.js +0 -159
- package/dist/src/scheduler/tool-modifier.test.js.map +0 -1
- package/dist/src/services/chatCompressionService.test.d.ts +0 -6
- package/dist/src/services/chatCompressionService.test.js +0 -573
- package/dist/src/services/chatCompressionService.test.js.map +0 -1
- package/dist/src/services/chatRecordingService.test.d.ts +0 -6
- package/dist/src/services/chatRecordingService.test.js +0 -486
- package/dist/src/services/chatRecordingService.test.js.map +0 -1
- package/dist/src/services/contextManager.test.d.ts +0 -6
- package/dist/src/services/contextManager.test.js +0 -104
- package/dist/src/services/contextManager.test.js.map +0 -1
- package/dist/src/services/environmentSanitization.test.d.ts +0 -6
- package/dist/src/services/environmentSanitization.test.js +0 -284
- package/dist/src/services/environmentSanitization.test.js.map +0 -1
- package/dist/src/services/fileDiscoveryService.test.d.ts +0 -6
- package/dist/src/services/fileDiscoveryService.test.js +0 -223
- package/dist/src/services/fileDiscoveryService.test.js.map +0 -1
- package/dist/src/services/fileSystemService.test.d.ts +0 -6
- package/dist/src/services/fileSystemService.test.js +0 -41
- package/dist/src/services/fileSystemService.test.js.map +0 -1
- package/dist/src/services/gitService.test.d.ts +0 -6
- package/dist/src/services/gitService.test.js +0 -264
- package/dist/src/services/gitService.test.js.map +0 -1
- package/dist/src/services/loopDetectionService.test.d.ts +0 -6
- package/dist/src/services/loopDetectionService.test.js +0 -881
- package/dist/src/services/loopDetectionService.test.js.map +0 -1
- package/dist/src/services/modelConfig.golden.test.d.ts +0 -6
- package/dist/src/services/modelConfig.golden.test.js +0 -74
- package/dist/src/services/modelConfig.golden.test.js.map +0 -1
- package/dist/src/services/modelConfig.integration.test.d.ts +0 -6
- package/dist/src/services/modelConfig.integration.test.js +0 -247
- package/dist/src/services/modelConfig.integration.test.js.map +0 -1
- package/dist/src/services/modelConfigBridge.test.d.ts +0 -6
- package/dist/src/services/modelConfigBridge.test.js +0 -410
- package/dist/src/services/modelConfigBridge.test.js.map +0 -1
- package/dist/src/services/modelConfigService.test.d.ts +0 -6
- package/dist/src/services/modelConfigService.test.js +0 -868
- package/dist/src/services/modelConfigService.test.js.map +0 -1
- package/dist/src/services/sessionSummaryService.test.d.ts +0 -6
- package/dist/src/services/sessionSummaryService.test.js +0 -785
- package/dist/src/services/sessionSummaryService.test.js.map +0 -1
- package/dist/src/services/sessionSummaryUtils.test.d.ts +0 -6
- package/dist/src/services/sessionSummaryUtils.test.js +0 -160
- package/dist/src/services/sessionSummaryUtils.test.js.map +0 -1
- package/dist/src/services/shellExecutionService.test.d.ts +0 -6
- package/dist/src/services/shellExecutionService.test.js +0 -1080
- package/dist/src/services/shellExecutionService.test.js.map +0 -1
- package/dist/src/skills/skillLoader.test.d.ts +0 -6
- package/dist/src/skills/skillLoader.test.js +0 -185
- package/dist/src/skills/skillLoader.test.js.map +0 -1
- package/dist/src/skills/skillManager.test.d.ts +0 -6
- package/dist/src/skills/skillManager.test.js +0 -297
- package/dist/src/skills/skillManager.test.js.map +0 -1
- package/dist/src/telemetry/activity-detector.test.d.ts +0 -6
- package/dist/src/telemetry/activity-detector.test.js +0 -136
- package/dist/src/telemetry/activity-detector.test.js.map +0 -1
- package/dist/src/telemetry/activity-monitor.test.d.ts +0 -6
- package/dist/src/telemetry/activity-monitor.test.js +0 -251
- package/dist/src/telemetry/activity-monitor.test.js.map +0 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +0 -19
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +0 -964
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +0 -1
- package/dist/src/telemetry/config.test.d.ts +0 -6
- package/dist/src/telemetry/config.test.js +0 -149
- package/dist/src/telemetry/config.test.js.map +0 -1
- package/dist/src/telemetry/gcp-exporters.test.d.ts +0 -6
- package/dist/src/telemetry/gcp-exporters.test.js +0 -318
- package/dist/src/telemetry/gcp-exporters.test.js.map +0 -1
- package/dist/src/telemetry/high-water-mark-tracker.test.d.ts +0 -6
- package/dist/src/telemetry/high-water-mark-tracker.test.js +0 -152
- package/dist/src/telemetry/high-water-mark-tracker.test.js.map +0 -1
- package/dist/src/telemetry/integration.test.circular.d.ts +0 -6
- package/dist/src/telemetry/integration.test.circular.js +0 -54
- package/dist/src/telemetry/integration.test.circular.js.map +0 -1
- package/dist/src/telemetry/loggers.test.circular.d.ts +0 -6
- package/dist/src/telemetry/loggers.test.circular.js +0 -107
- package/dist/src/telemetry/loggers.test.circular.js.map +0 -1
- package/dist/src/telemetry/loggers.test.d.ts +0 -6
- package/dist/src/telemetry/loggers.test.js +0 -1618
- package/dist/src/telemetry/loggers.test.js.map +0 -1
- package/dist/src/telemetry/memory-monitor.test.d.ts +0 -6
- package/dist/src/telemetry/memory-monitor.test.js +0 -472
- package/dist/src/telemetry/memory-monitor.test.js.map +0 -1
- package/dist/src/telemetry/metrics.test.d.ts +0 -6
- package/dist/src/telemetry/metrics.test.js +0 -1176
- package/dist/src/telemetry/metrics.test.js.map +0 -1
- package/dist/src/telemetry/rate-limiter.test.d.ts +0 -6
- package/dist/src/telemetry/rate-limiter.test.js +0 -207
- package/dist/src/telemetry/rate-limiter.test.js.map +0 -1
- package/dist/src/telemetry/sanitize.test.d.ts +0 -6
- package/dist/src/telemetry/sanitize.test.js +0 -279
- package/dist/src/telemetry/sanitize.test.js.map +0 -1
- package/dist/src/telemetry/sdk.test.d.ts +0 -6
- package/dist/src/telemetry/sdk.test.js +0 -360
- package/dist/src/telemetry/sdk.test.js.map +0 -1
- package/dist/src/telemetry/semantic.test.d.ts +0 -6
- package/dist/src/telemetry/semantic.test.js +0 -387
- package/dist/src/telemetry/semantic.test.js.map +0 -1
- package/dist/src/telemetry/semantic.truncation.test.d.ts +0 -1
- package/dist/src/telemetry/semantic.truncation.test.js +0 -92
- package/dist/src/telemetry/semantic.truncation.test.js.map +0 -1
- package/dist/src/telemetry/startupProfiler.test.d.ts +0 -6
- package/dist/src/telemetry/startupProfiler.test.js +0 -285
- package/dist/src/telemetry/startupProfiler.test.js.map +0 -1
- package/dist/src/telemetry/telemetry-utils.test.d.ts +0 -6
- package/dist/src/telemetry/telemetry-utils.test.js +0 -41
- package/dist/src/telemetry/telemetry-utils.test.js.map +0 -1
- package/dist/src/telemetry/telemetry.test.d.ts +0 -6
- package/dist/src/telemetry/telemetry.test.js +0 -57
- package/dist/src/telemetry/telemetry.test.js.map +0 -1
- package/dist/src/telemetry/uiTelemetry.test.d.ts +0 -6
- package/dist/src/telemetry/uiTelemetry.test.js +0 -584
- package/dist/src/telemetry/uiTelemetry.test.js.map +0 -1
- package/dist/src/tools/activate-skill.test.d.ts +0 -6
- package/dist/src/tools/activate-skill.test.js +0 -113
- package/dist/src/tools/activate-skill.test.js.map +0 -1
- package/dist/src/tools/ask-user.test.d.ts +0 -6
- package/dist/src/tools/ask-user.test.js +0 -187
- package/dist/src/tools/ask-user.test.js.map +0 -1
- package/dist/src/tools/base-tool-invocation.test.d.ts +0 -6
- package/dist/src/tools/base-tool-invocation.test.js +0 -85
- package/dist/src/tools/base-tool-invocation.test.js.map +0 -1
- package/dist/src/tools/confirmation-policy.test.d.ts +0 -6
- package/dist/src/tools/confirmation-policy.test.js +0 -143
- package/dist/src/tools/confirmation-policy.test.js.map +0 -1
- package/dist/src/tools/diffOptions.test.d.ts +0 -6
- package/dist/src/tools/diffOptions.test.js +0 -172
- package/dist/src/tools/diffOptions.test.js.map +0 -1
- package/dist/src/tools/edit.test.d.ts +0 -6
- package/dist/src/tools/edit.test.js +0 -729
- package/dist/src/tools/edit.test.js.map +0 -1
- package/dist/src/tools/get-internal-docs.test.d.ts +0 -6
- package/dist/src/tools/get-internal-docs.test.js +0 -57
- package/dist/src/tools/get-internal-docs.test.js.map +0 -1
- package/dist/src/tools/glob.test.d.ts +0 -6
- package/dist/src/tools/glob.test.js +0 -433
- package/dist/src/tools/glob.test.js.map +0 -1
- package/dist/src/tools/grep.test.d.ts +0 -6
- package/dist/src/tools/grep.test.js +0 -328
- package/dist/src/tools/grep.test.js.map +0 -1
- package/dist/src/tools/ls.test.d.ts +0 -6
- package/dist/src/tools/ls.test.js +0 -242
- package/dist/src/tools/ls.test.js.map +0 -1
- package/dist/src/tools/mcp-client-manager.test.d.ts +0 -6
- package/dist/src/tools/mcp-client-manager.test.js +0 -251
- package/dist/src/tools/mcp-client-manager.test.js.map +0 -1
- package/dist/src/tools/mcp-client.test.d.ts +0 -6
- package/dist/src/tools/mcp-client.test.js +0 -1346
- package/dist/src/tools/mcp-client.test.js.map +0 -1
- package/dist/src/tools/mcp-tool.test.d.ts +0 -6
- package/dist/src/tools/mcp-tool.test.js +0 -657
- package/dist/src/tools/mcp-tool.test.js.map +0 -1
- package/dist/src/tools/memoryTool.test.d.ts +0 -6
- package/dist/src/tools/memoryTool.test.js +0 -302
- package/dist/src/tools/memoryTool.test.js.map +0 -1
- package/dist/src/tools/message-bus-integration.test.d.ts +0 -6
- package/dist/src/tools/message-bus-integration.test.js +0 -169
- package/dist/src/tools/message-bus-integration.test.js.map +0 -1
- package/dist/src/tools/modifiable-tool.test.d.ts +0 -6
- package/dist/src/tools/modifiable-tool.test.js +0 -237
- package/dist/src/tools/modifiable-tool.test.js.map +0 -1
- package/dist/src/tools/read-file.test.d.ts +0 -6
- package/dist/src/tools/read-file.test.js +0 -376
- package/dist/src/tools/read-file.test.js.map +0 -1
- package/dist/src/tools/read-many-files.test.d.ts +0 -6
- package/dist/src/tools/read-many-files.test.js +0 -567
- package/dist/src/tools/read-many-files.test.js.map +0 -1
- package/dist/src/tools/ripGrep.test.d.ts +0 -6
- package/dist/src/tools/ripGrep.test.js +0 -1139
- package/dist/src/tools/ripGrep.test.js.map +0 -1
- package/dist/src/tools/shell.test.d.ts +0 -6
- package/dist/src/tools/shell.test.js +0 -526
- package/dist/src/tools/shell.test.js.map +0 -1
- package/dist/src/tools/tool-names.test.d.ts +0 -6
- package/dist/src/tools/tool-names.test.js +0 -43
- package/dist/src/tools/tool-names.test.js.map +0 -1
- package/dist/src/tools/tool-registry.test.d.ts +0 -6
- package/dist/src/tools/tool-registry.test.js +0 -461
- package/dist/src/tools/tool-registry.test.js.map +0 -1
- package/dist/src/tools/tools.test.d.ts +0 -6
- package/dist/src/tools/tools.test.js +0 -207
- package/dist/src/tools/tools.test.js.map +0 -1
- package/dist/src/tools/web-fetch.test.d.ts +0 -6
- package/dist/src/tools/web-fetch.test.js +0 -442
- package/dist/src/tools/web-fetch.test.js.map +0 -1
- package/dist/src/tools/web-search.test.d.ts +0 -6
- package/dist/src/tools/web-search.test.js +0 -214
- package/dist/src/tools/web-search.test.js.map +0 -1
- package/dist/src/tools/write-file.test.d.ts +0 -6
- package/dist/src/tools/write-file.test.js +0 -681
- package/dist/src/tools/write-file.test.js.map +0 -1
- package/dist/src/tools/write-todos.test.d.ts +0 -6
- package/dist/src/tools/write-todos.test.js +0 -90
- package/dist/src/tools/write-todos.test.js.map +0 -1
- package/dist/src/utils/apiConversionUtils.test.d.ts +0 -6
- package/dist/src/utils/apiConversionUtils.test.js +0 -150
- package/dist/src/utils/apiConversionUtils.test.js.map +0 -1
- package/dist/src/utils/bfsFileSearch.test.d.ts +0 -6
- package/dist/src/utils/bfsFileSearch.test.js +0 -227
- package/dist/src/utils/bfsFileSearch.test.js.map +0 -1
- package/dist/src/utils/channel.test.d.ts +0 -6
- package/dist/src/utils/channel.test.js +0 -170
- package/dist/src/utils/channel.test.js.map +0 -1
- package/dist/src/utils/checkpointUtils.test.d.ts +0 -6
- package/dist/src/utils/checkpointUtils.test.js +0 -229
- package/dist/src/utils/checkpointUtils.test.js.map +0 -1
- package/dist/src/utils/customHeaderUtils.test.d.ts +0 -6
- package/dist/src/utils/customHeaderUtils.test.js +0 -77
- package/dist/src/utils/customHeaderUtils.test.js.map +0 -1
- package/dist/src/utils/debugLogger.test.d.ts +0 -6
- package/dist/src/utils/debugLogger.test.js +0 -69
- package/dist/src/utils/debugLogger.test.js.map +0 -1
- package/dist/src/utils/delay.test.d.ts +0 -6
- package/dist/src/utils/delay.test.js +0 -88
- package/dist/src/utils/delay.test.js.map +0 -1
- package/dist/src/utils/editCorrector.test.d.ts +0 -6
- package/dist/src/utils/editCorrector.test.js +0 -533
- package/dist/src/utils/editCorrector.test.js.map +0 -1
- package/dist/src/utils/editor.test.d.ts +0 -6
- package/dist/src/utils/editor.test.js +0 -429
- package/dist/src/utils/editor.test.js.map +0 -1
- package/dist/src/utils/environmentContext.test.d.ts +0 -6
- package/dist/src/utils/environmentContext.test.js +0 -114
- package/dist/src/utils/environmentContext.test.js.map +0 -1
- package/dist/src/utils/errorParsing.test.d.ts +0 -6
- package/dist/src/utils/errorParsing.test.js +0 -84
- package/dist/src/utils/errorParsing.test.js.map +0 -1
- package/dist/src/utils/errorReporting.test.d.ts +0 -6
- package/dist/src/utils/errorReporting.test.js +0 -133
- package/dist/src/utils/errorReporting.test.js.map +0 -1
- package/dist/src/utils/errors.test.d.ts +0 -6
- package/dist/src/utils/errors.test.js +0 -155
- package/dist/src/utils/errors.test.js.map +0 -1
- package/dist/src/utils/events.test.d.ts +0 -6
- package/dist/src/utils/events.test.js +0 -237
- package/dist/src/utils/events.test.js.map +0 -1
- package/dist/src/utils/extensionLoader.test.d.ts +0 -6
- package/dist/src/utils/extensionLoader.test.js +0 -176
- package/dist/src/utils/extensionLoader.test.js.map +0 -1
- package/dist/src/utils/fileDiffUtils.test.d.ts +0 -6
- package/dist/src/utils/fileDiffUtils.test.js +0 -84
- package/dist/src/utils/fileDiffUtils.test.js.map +0 -1
- package/dist/src/utils/fileUtils.test.d.ts +0 -6
- package/dist/src/utils/fileUtils.test.js +0 -780
- package/dist/src/utils/fileUtils.test.js.map +0 -1
- package/dist/src/utils/filesearch/crawlCache.test.d.ts +0 -6
- package/dist/src/utils/filesearch/crawlCache.test.js +0 -103
- package/dist/src/utils/filesearch/crawlCache.test.js.map +0 -1
- package/dist/src/utils/filesearch/crawler.test.d.ts +0 -6
- package/dist/src/utils/filesearch/crawler.test.js +0 -495
- package/dist/src/utils/filesearch/crawler.test.js.map +0 -1
- package/dist/src/utils/filesearch/fileSearch.test.d.ts +0 -6
- package/dist/src/utils/filesearch/fileSearch.test.js +0 -663
- package/dist/src/utils/filesearch/fileSearch.test.js.map +0 -1
- package/dist/src/utils/filesearch/ignore.test.d.ts +0 -6
- package/dist/src/utils/filesearch/ignore.test.js +0 -144
- package/dist/src/utils/filesearch/ignore.test.js.map +0 -1
- package/dist/src/utils/filesearch/result-cache.test.d.ts +0 -6
- package/dist/src/utils/filesearch/result-cache.test.js +0 -46
- package/dist/src/utils/filesearch/result-cache.test.js.map +0 -1
- package/dist/src/utils/flashFallback.test.d.ts +0 -6
- package/dist/src/utils/flashFallback.test.js +0 -103
- package/dist/src/utils/flashFallback.test.js.map +0 -1
- package/dist/src/utils/formatters.test.d.ts +0 -6
- package/dist/src/utils/formatters.test.js +0 -26
- package/dist/src/utils/formatters.test.js.map +0 -1
- package/dist/src/utils/geminiIgnoreParser.test.d.ts +0 -6
- package/dist/src/utils/geminiIgnoreParser.test.js +0 -98
- package/dist/src/utils/geminiIgnoreParser.test.js.map +0 -1
- package/dist/src/utils/geminiTypeConversion.test.d.ts +0 -6
- package/dist/src/utils/geminiTypeConversion.test.js +0 -310
- package/dist/src/utils/geminiTypeConversion.test.js.map +0 -1
- package/dist/src/utils/generateContentResponseUtilities.test.d.ts +0 -6
- package/dist/src/utils/generateContentResponseUtilities.test.js +0 -512
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +0 -1
- package/dist/src/utils/getFolderStructure.test.d.ts +0 -6
- package/dist/src/utils/getFolderStructure.test.js +0 -283
- package/dist/src/utils/getFolderStructure.test.js.map +0 -1
- package/dist/src/utils/gitIgnoreParser.test.d.ts +0 -6
- package/dist/src/utils/gitIgnoreParser.test.js +0 -243
- package/dist/src/utils/gitIgnoreParser.test.js.map +0 -1
- package/dist/src/utils/googleErrors.test.d.ts +0 -6
- package/dist/src/utils/googleErrors.test.js +0 -309
- package/dist/src/utils/googleErrors.test.js.map +0 -1
- package/dist/src/utils/googleQuotaErrors.test.d.ts +0 -6
- package/dist/src/utils/googleQuotaErrors.test.js +0 -548
- package/dist/src/utils/googleQuotaErrors.test.js.map +0 -1
- package/dist/src/utils/ignorePatterns.test.d.ts +0 -6
- package/dist/src/utils/ignorePatterns.test.js +0 -246
- package/dist/src/utils/ignorePatterns.test.js.map +0 -1
- package/dist/src/utils/installationManager.test.d.ts +0 -6
- package/dist/src/utils/installationManager.test.js +0 -93
- package/dist/src/utils/installationManager.test.js.map +0 -1
- package/dist/src/utils/llm-edit-fixer.test.d.ts +0 -6
- package/dist/src/utils/llm-edit-fixer.test.js +0 -223
- package/dist/src/utils/llm-edit-fixer.test.js.map +0 -1
- package/dist/src/utils/llmUtils.test.d.ts +0 -6
- package/dist/src/utils/llmUtils.test.js +0 -196
- package/dist/src/utils/llmUtils.test.js.map +0 -1
- package/dist/src/utils/memoryDiscovery.test.d.ts +0 -6
- package/dist/src/utils/memoryDiscovery.test.js +0 -542
- package/dist/src/utils/memoryDiscovery.test.js.map +0 -1
- package/dist/src/utils/memoryImportProcessor.test.d.ts +0 -6
- package/dist/src/utils/memoryImportProcessor.test.js +0 -581
- package/dist/src/utils/memoryImportProcessor.test.js.map +0 -1
- package/dist/src/utils/nextSpeakerChecker.test.d.ts +0 -6
- package/dist/src/utils/nextSpeakerChecker.test.js +0 -191
- package/dist/src/utils/nextSpeakerChecker.test.js.map +0 -1
- package/dist/src/utils/partUtils.test.d.ts +0 -6
- package/dist/src/utils/partUtils.test.js +0 -397
- package/dist/src/utils/partUtils.test.js.map +0 -1
- package/dist/src/utils/pathCorrector.test.d.ts +0 -6
- package/dist/src/utils/pathCorrector.test.js +0 -87
- package/dist/src/utils/pathCorrector.test.js.map +0 -1
- package/dist/src/utils/pathReader.test.d.ts +0 -6
- package/dist/src/utils/pathReader.test.js +0 -406
- package/dist/src/utils/pathReader.test.js.map +0 -1
- package/dist/src/utils/paths.test.d.ts +0 -6
- package/dist/src/utils/paths.test.js +0 -402
- package/dist/src/utils/paths.test.js.map +0 -1
- package/dist/src/utils/retry.test.d.ts +0 -6
- package/dist/src/utils/retry.test.js +0 -548
- package/dist/src/utils/retry.test.js.map +0 -1
- package/dist/src/utils/retry_llm_error.test.d.ts +0 -6
- package/dist/src/utils/retry_llm_error.test.js +0 -280
- package/dist/src/utils/retry_llm_error.test.js.map +0 -1
- package/dist/src/utils/safeJsonStringify.test.d.ts +0 -6
- package/dist/src/utils/safeJsonStringify.test.js +0 -61
- package/dist/src/utils/safeJsonStringify.test.js.map +0 -1
- package/dist/src/utils/schemaValidator.test.d.ts +0 -6
- package/dist/src/utils/schemaValidator.test.js +0 -113
- package/dist/src/utils/schemaValidator.test.js.map +0 -1
- package/dist/src/utils/secure-browser-launcher.test.d.ts +0 -6
- package/dist/src/utils/secure-browser-launcher.test.js +0 -149
- package/dist/src/utils/secure-browser-launcher.test.js.map +0 -1
- package/dist/src/utils/security.test.d.ts +0 -1
- package/dist/src/utils/security.test.js +0 -121
- package/dist/src/utils/security.test.js.map +0 -1
- package/dist/src/utils/shell-utils.integration.test.d.ts +0 -1
- package/dist/src/utils/shell-utils.integration.test.js +0 -58
- package/dist/src/utils/shell-utils.integration.test.js.map +0 -1
- package/dist/src/utils/shell-utils.test.d.ts +0 -6
- package/dist/src/utils/shell-utils.test.js +0 -437
- package/dist/src/utils/shell-utils.test.js.map +0 -1
- package/dist/src/utils/stdio.test.d.ts +0 -6
- package/dist/src/utils/stdio.test.js +0 -47
- package/dist/src/utils/stdio.test.js.map +0 -1
- package/dist/src/utils/summarizer.test.d.ts +0 -6
- package/dist/src/utils/summarizer.test.js +0 -152
- package/dist/src/utils/summarizer.test.js.map +0 -1
- package/dist/src/utils/systemEncoding.test.d.ts +0 -6
- package/dist/src/utils/systemEncoding.test.js +0 -369
- package/dist/src/utils/systemEncoding.test.js.map +0 -1
- package/dist/src/utils/terminalSerializer.test.d.ts +0 -6
- package/dist/src/utils/terminalSerializer.test.js +0 -193
- package/dist/src/utils/terminalSerializer.test.js.map +0 -1
- package/dist/src/utils/textUtils.test.d.ts +0 -6
- package/dist/src/utils/textUtils.test.js +0 -76
- package/dist/src/utils/textUtils.test.js.map +0 -1
- package/dist/src/utils/thoughtUtils.test.d.ts +0 -6
- package/dist/src/utils/thoughtUtils.test.js +0 -78
- package/dist/src/utils/thoughtUtils.test.js.map +0 -1
- package/dist/src/utils/tokenCalculation.test.d.ts +0 -6
- package/dist/src/utils/tokenCalculation.test.js +0 -184
- package/dist/src/utils/tokenCalculation.test.js.map +0 -1
- package/dist/src/utils/tool-utils.test.d.ts +0 -6
- package/dist/src/utils/tool-utils.test.js +0 -84
- package/dist/src/utils/tool-utils.test.js.map +0 -1
- package/dist/src/utils/toolCallContext.test.d.ts +0 -6
- package/dist/src/utils/toolCallContext.test.js +0 -68
- package/dist/src/utils/toolCallContext.test.js.map +0 -1
- package/dist/src/utils/userAccountManager.test.d.ts +0 -6
- package/dist/src/utils/userAccountManager.test.js +0 -225
- package/dist/src/utils/userAccountManager.test.js.map +0 -1
- package/dist/src/utils/version.test.d.ts +0 -6
- package/dist/src/utils/version.test.js +0 -39
- package/dist/src/utils/version.test.js.map +0 -1
- package/dist/src/utils/workspaceContext.test.d.ts +0 -6
- package/dist/src/utils/workspaceContext.test.js +0 -374
- package/dist/src/utils/workspaceContext.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,1618 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { AuthType, EditTool, GeminiClient, ToolConfirmationOutcome, ToolErrorType, ToolRegistry, } from '../index.js';
|
|
7
|
-
import { OutputFormat } from '../output/types.js';
|
|
8
|
-
import { logs } from '@opentelemetry/api-logs';
|
|
9
|
-
import { logApiError, logApiRequest, logApiResponse, logCliConfiguration, logUserPrompt, logToolCall, logFlashFallback, logChatCompression, logMalformedJsonResponse, logFileOperation, logRipgrepFallback, logToolOutputTruncated, logModelRouting, logExtensionEnable, logExtensionDisable, logExtensionInstallEvent, logExtensionUninstall, logAgentStart, logAgentFinish, logWebFetchFallbackAttempt, logExtensionUpdateEvent, logHookCall, } from './loggers.js';
|
|
10
|
-
import { ToolCallDecision } from './tool-call-decision.js';
|
|
11
|
-
import { EVENT_API_ERROR, EVENT_API_REQUEST, EVENT_API_RESPONSE, EVENT_CLI_CONFIG, EVENT_TOOL_CALL, EVENT_USER_PROMPT, EVENT_FLASH_FALLBACK, EVENT_MALFORMED_JSON_RESPONSE, EVENT_FILE_OPERATION, EVENT_RIPGREP_FALLBACK, EVENT_MODEL_ROUTING, EVENT_EXTENSION_ENABLE, EVENT_EXTENSION_DISABLE, EVENT_EXTENSION_INSTALL, EVENT_EXTENSION_UNINSTALL, EVENT_TOOL_OUTPUT_TRUNCATED, EVENT_AGENT_START, EVENT_AGENT_FINISH, EVENT_WEB_FETCH_FALLBACK_ATTEMPT, ApiErrorEvent, ApiRequestEvent, ApiResponseEvent, StartSessionEvent, ToolCallEvent, UserPromptEvent, FlashFallbackEvent, RipgrepFallbackEvent, MalformedJsonResponseEvent, makeChatCompressionEvent, FileOperationEvent, ToolOutputTruncatedEvent, ModelRoutingEvent, ExtensionEnableEvent, ExtensionDisableEvent, ExtensionInstallEvent, ExtensionUninstallEvent, AgentStartEvent, AgentFinishEvent, WebFetchFallbackAttemptEvent, ExtensionUpdateEvent, EVENT_EXTENSION_UPDATE, HookCallEvent, EVENT_HOOK_CALL, } from './types.js';
|
|
12
|
-
import * as metrics from './metrics.js';
|
|
13
|
-
import { FileOperation } from './metrics.js';
|
|
14
|
-
import * as sdk from './sdk.js';
|
|
15
|
-
import { createMockMessageBus } from '../test-utils/mock-message-bus.js';
|
|
16
|
-
import { vi, describe, beforeEach, it, expect, afterEach } from 'vitest';
|
|
17
|
-
import {} from '../config/config.js';
|
|
18
|
-
import { FinishReason, } from '@google/genai';
|
|
19
|
-
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
|
|
20
|
-
import * as uiTelemetry from './uiTelemetry.js';
|
|
21
|
-
import { makeFakeConfig } from '../test-utils/config.js';
|
|
22
|
-
import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js';
|
|
23
|
-
import { UserAccountManager } from '../utils/userAccountManager.js';
|
|
24
|
-
import { InstallationManager } from '../utils/installationManager.js';
|
|
25
|
-
import { AgentTerminateMode } from '../agents/types.js';
|
|
26
|
-
vi.mock('systeminformation', () => ({
|
|
27
|
-
default: {
|
|
28
|
-
graphics: vi.fn().mockResolvedValue({
|
|
29
|
-
controllers: [{ model: 'Mock GPU' }],
|
|
30
|
-
}),
|
|
31
|
-
},
|
|
32
|
-
}));
|
|
33
|
-
describe('loggers', () => {
|
|
34
|
-
const mockLogger = {
|
|
35
|
-
emit: vi.fn(),
|
|
36
|
-
};
|
|
37
|
-
const mockUiEvent = {
|
|
38
|
-
addEvent: vi.fn(),
|
|
39
|
-
};
|
|
40
|
-
beforeEach(() => {
|
|
41
|
-
vi.clearAllMocks();
|
|
42
|
-
vi.spyOn(sdk, 'isTelemetrySdkInitialized').mockReturnValue(true);
|
|
43
|
-
vi.spyOn(sdk, 'bufferTelemetryEvent').mockImplementation((cb) => cb());
|
|
44
|
-
vi.spyOn(logs, 'getLogger').mockReturnValue(mockLogger);
|
|
45
|
-
vi.spyOn(uiTelemetry.uiTelemetryService, 'addEvent').mockImplementation(mockUiEvent.addEvent);
|
|
46
|
-
vi.spyOn(UserAccountManager.prototype, 'getCachedGoogleAccount').mockReturnValue('test-user@example.com');
|
|
47
|
-
vi.spyOn(InstallationManager.prototype, 'getInstallationId').mockReturnValue('test-installation-id');
|
|
48
|
-
vi.useFakeTimers();
|
|
49
|
-
vi.setSystemTime(new Date('2025-01-01T00:00:00.000Z'));
|
|
50
|
-
});
|
|
51
|
-
describe('logChatCompression', () => {
|
|
52
|
-
beforeEach(() => {
|
|
53
|
-
vi.spyOn(metrics, 'recordChatCompressionMetrics');
|
|
54
|
-
vi.spyOn(ClearcutLogger.prototype, 'logChatCompressionEvent');
|
|
55
|
-
});
|
|
56
|
-
it('logs the chat compression event to Clearcut', () => {
|
|
57
|
-
const mockConfig = makeFakeConfig();
|
|
58
|
-
const event = makeChatCompressionEvent({
|
|
59
|
-
tokens_before: 9001,
|
|
60
|
-
tokens_after: 9000,
|
|
61
|
-
});
|
|
62
|
-
logChatCompression(mockConfig, event);
|
|
63
|
-
expect(ClearcutLogger.prototype.logChatCompressionEvent).toHaveBeenCalledWith(event);
|
|
64
|
-
});
|
|
65
|
-
it('records the chat compression event to OTEL', () => {
|
|
66
|
-
const mockConfig = makeFakeConfig();
|
|
67
|
-
logChatCompression(mockConfig, makeChatCompressionEvent({
|
|
68
|
-
tokens_before: 9001,
|
|
69
|
-
tokens_after: 9000,
|
|
70
|
-
}));
|
|
71
|
-
expect(metrics.recordChatCompressionMetrics).toHaveBeenCalledWith(mockConfig, { tokens_before: 9001, tokens_after: 9000 });
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe('logCliConfiguration', () => {
|
|
75
|
-
it('should log the cli configuration', () => {
|
|
76
|
-
const mockConfig = {
|
|
77
|
-
getSessionId: () => 'test-session-id',
|
|
78
|
-
getModel: () => 'test-model',
|
|
79
|
-
getEmbeddingModel: () => 'test-embedding-model',
|
|
80
|
-
getSandbox: () => true,
|
|
81
|
-
getCoreTools: () => ['ls', 'read-file'],
|
|
82
|
-
getApprovalMode: () => 'default',
|
|
83
|
-
getContentGeneratorConfig: () => ({
|
|
84
|
-
model: 'test-model',
|
|
85
|
-
apiKey: 'test-api-key',
|
|
86
|
-
authType: AuthType.USE_VERTEX_AI,
|
|
87
|
-
}),
|
|
88
|
-
getTelemetryEnabled: () => true,
|
|
89
|
-
getUsageStatisticsEnabled: () => true,
|
|
90
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
91
|
-
getFileFilteringRespectGitIgnore: () => true,
|
|
92
|
-
getFileFilteringAllowBuildArtifacts: () => false,
|
|
93
|
-
getDebugMode: () => true,
|
|
94
|
-
getMcpServers: () => {
|
|
95
|
-
throw new Error('Should not call');
|
|
96
|
-
},
|
|
97
|
-
getQuestion: () => 'test-question',
|
|
98
|
-
getTargetDir: () => 'target-dir',
|
|
99
|
-
getProxy: () => 'http://test.proxy.com:8080',
|
|
100
|
-
getOutputFormat: () => OutputFormat.JSON,
|
|
101
|
-
getExtensions: () => [
|
|
102
|
-
{ name: 'ext-one', id: 'id-one' },
|
|
103
|
-
{ name: 'ext-two', id: 'id-two' },
|
|
104
|
-
],
|
|
105
|
-
getMcpClientManager: () => ({
|
|
106
|
-
getMcpServers: () => ({
|
|
107
|
-
'test-server': {
|
|
108
|
-
command: 'test-command',
|
|
109
|
-
},
|
|
110
|
-
}),
|
|
111
|
-
}),
|
|
112
|
-
isInteractive: () => false,
|
|
113
|
-
};
|
|
114
|
-
const startSessionEvent = new StartSessionEvent(mockConfig);
|
|
115
|
-
logCliConfiguration(mockConfig, startSessionEvent);
|
|
116
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
117
|
-
body: 'CLI configuration loaded.',
|
|
118
|
-
attributes: {
|
|
119
|
-
'session.id': 'test-session-id',
|
|
120
|
-
'user.email': 'test-user@example.com',
|
|
121
|
-
'installation.id': 'test-installation-id',
|
|
122
|
-
'event.name': EVENT_CLI_CONFIG,
|
|
123
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
124
|
-
interactive: false,
|
|
125
|
-
model: 'test-model',
|
|
126
|
-
embedding_model: 'test-embedding-model',
|
|
127
|
-
sandbox_enabled: true,
|
|
128
|
-
core_tools_enabled: 'ls,read-file',
|
|
129
|
-
approval_mode: 'default',
|
|
130
|
-
api_key_enabled: true,
|
|
131
|
-
vertex_ai_enabled: true,
|
|
132
|
-
log_user_prompts_enabled: true,
|
|
133
|
-
file_filtering_respect_git_ignore: true,
|
|
134
|
-
debug_mode: true,
|
|
135
|
-
mcp_servers: 'test-server',
|
|
136
|
-
mcp_servers_count: 1,
|
|
137
|
-
mcp_tools: undefined,
|
|
138
|
-
mcp_tools_count: undefined,
|
|
139
|
-
output_format: 'json',
|
|
140
|
-
extension_ids: 'id-one,id-two',
|
|
141
|
-
extensions_count: 2,
|
|
142
|
-
extensions: 'ext-one,ext-two',
|
|
143
|
-
auth_type: 'vertex-ai',
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
describe('logUserPrompt', () => {
|
|
149
|
-
const mockConfig = {
|
|
150
|
-
getSessionId: () => 'test-session-id',
|
|
151
|
-
getTelemetryEnabled: () => true,
|
|
152
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
153
|
-
getUsageStatisticsEnabled: () => true,
|
|
154
|
-
isInteractive: () => false,
|
|
155
|
-
};
|
|
156
|
-
it('should log a user prompt', () => {
|
|
157
|
-
const event = new UserPromptEvent(11, 'prompt-id-8', AuthType.USE_VERTEX_AI, 'test-prompt');
|
|
158
|
-
logUserPrompt(mockConfig, event);
|
|
159
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
160
|
-
body: 'User prompt. Length: 11.',
|
|
161
|
-
attributes: {
|
|
162
|
-
'session.id': 'test-session-id',
|
|
163
|
-
'user.email': 'test-user@example.com',
|
|
164
|
-
'installation.id': 'test-installation-id',
|
|
165
|
-
'event.name': EVENT_USER_PROMPT,
|
|
166
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
167
|
-
interactive: false,
|
|
168
|
-
prompt_length: 11,
|
|
169
|
-
prompt: 'test-prompt',
|
|
170
|
-
prompt_id: 'prompt-id-8',
|
|
171
|
-
auth_type: 'vertex-ai',
|
|
172
|
-
},
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
it('should not log prompt if disabled', () => {
|
|
176
|
-
const mockConfig = {
|
|
177
|
-
getSessionId: () => 'test-session-id',
|
|
178
|
-
getTelemetryEnabled: () => true,
|
|
179
|
-
getTelemetryLogPromptsEnabled: () => false,
|
|
180
|
-
getTargetDir: () => 'target-dir',
|
|
181
|
-
getUsageStatisticsEnabled: () => true,
|
|
182
|
-
isInteractive: () => false,
|
|
183
|
-
};
|
|
184
|
-
const event = new UserPromptEvent(11, 'prompt-id-9', AuthType.COMPUTE_ADC, 'test-prompt');
|
|
185
|
-
logUserPrompt(mockConfig, event);
|
|
186
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
187
|
-
body: 'User prompt. Length: 11.',
|
|
188
|
-
attributes: {
|
|
189
|
-
'session.id': 'test-session-id',
|
|
190
|
-
'user.email': 'test-user@example.com',
|
|
191
|
-
'installation.id': 'test-installation-id',
|
|
192
|
-
'event.name': EVENT_USER_PROMPT,
|
|
193
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
194
|
-
interactive: false,
|
|
195
|
-
prompt_length: 11,
|
|
196
|
-
prompt_id: 'prompt-id-9',
|
|
197
|
-
auth_type: 'compute-default-credentials',
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
describe('logApiResponse', () => {
|
|
203
|
-
const mockConfig = {
|
|
204
|
-
getSessionId: () => 'test-session-id',
|
|
205
|
-
getTargetDir: () => 'target-dir',
|
|
206
|
-
getUsageStatisticsEnabled: () => true,
|
|
207
|
-
getTelemetryEnabled: () => true,
|
|
208
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
209
|
-
isInteractive: () => false,
|
|
210
|
-
};
|
|
211
|
-
const mockMetrics = {
|
|
212
|
-
recordApiResponseMetrics: vi.fn(),
|
|
213
|
-
recordTokenUsageMetrics: vi.fn(),
|
|
214
|
-
};
|
|
215
|
-
beforeEach(() => {
|
|
216
|
-
vi.spyOn(metrics, 'recordApiResponseMetrics').mockImplementation(mockMetrics.recordApiResponseMetrics);
|
|
217
|
-
vi.spyOn(metrics, 'recordTokenUsageMetrics').mockImplementation(mockMetrics.recordTokenUsageMetrics);
|
|
218
|
-
});
|
|
219
|
-
it('should log an API response with all fields', () => {
|
|
220
|
-
const usageData = {
|
|
221
|
-
promptTokenCount: 17,
|
|
222
|
-
candidatesTokenCount: 50,
|
|
223
|
-
cachedContentTokenCount: 10,
|
|
224
|
-
thoughtsTokenCount: 5,
|
|
225
|
-
toolUsePromptTokenCount: 2,
|
|
226
|
-
};
|
|
227
|
-
const event = new ApiResponseEvent('test-model', 100, {
|
|
228
|
-
prompt_id: 'prompt-id-1',
|
|
229
|
-
contents: [
|
|
230
|
-
{
|
|
231
|
-
role: 'user',
|
|
232
|
-
parts: [{ text: 'Hello' }],
|
|
233
|
-
},
|
|
234
|
-
],
|
|
235
|
-
generate_content_config: {
|
|
236
|
-
temperature: 1,
|
|
237
|
-
topP: 2,
|
|
238
|
-
topK: 3,
|
|
239
|
-
responseMimeType: 'text/plain',
|
|
240
|
-
candidateCount: 1,
|
|
241
|
-
seed: 678,
|
|
242
|
-
frequencyPenalty: 10,
|
|
243
|
-
maxOutputTokens: 8000,
|
|
244
|
-
presencePenalty: 6,
|
|
245
|
-
stopSequences: ['stop', 'please stop'],
|
|
246
|
-
systemInstruction: {
|
|
247
|
-
role: 'model',
|
|
248
|
-
parts: [{ text: 'be nice' }],
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
server: {
|
|
252
|
-
address: 'foo.com',
|
|
253
|
-
port: 8080,
|
|
254
|
-
},
|
|
255
|
-
}, {
|
|
256
|
-
response_id: '',
|
|
257
|
-
candidates: [
|
|
258
|
-
{
|
|
259
|
-
content: {
|
|
260
|
-
role: 'model',
|
|
261
|
-
parts: [{ text: 'candidate 1' }],
|
|
262
|
-
},
|
|
263
|
-
finishReason: FinishReason.STOP,
|
|
264
|
-
},
|
|
265
|
-
],
|
|
266
|
-
}, AuthType.LOGIN_WITH_GOOGLE, usageData, 'test-response');
|
|
267
|
-
logApiResponse(mockConfig, event);
|
|
268
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
269
|
-
body: 'API response from test-model. Status: 200. Duration: 100ms.',
|
|
270
|
-
attributes: expect.objectContaining({
|
|
271
|
-
'event.name': EVENT_API_RESPONSE,
|
|
272
|
-
prompt_id: 'prompt-id-1',
|
|
273
|
-
finish_reasons: ['stop'],
|
|
274
|
-
}),
|
|
275
|
-
});
|
|
276
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
277
|
-
body: 'GenAI operation details from test-model. Status: 200. Duration: 100ms.',
|
|
278
|
-
attributes: expect.objectContaining({
|
|
279
|
-
'event.name': 'gen_ai.client.inference.operation.details',
|
|
280
|
-
'gen_ai.request.model': 'test-model',
|
|
281
|
-
'gen_ai.request.temperature': 1,
|
|
282
|
-
'gen_ai.request.top_p': 2,
|
|
283
|
-
'gen_ai.request.top_k': 3,
|
|
284
|
-
'gen_ai.input.messages': '[{"role":"user","parts":[{"type":"text","content":"Hello"}]}]',
|
|
285
|
-
'gen_ai.output.messages': '[{"finish_reason":"stop","role":"system","parts":[{"type":"text","content":"candidate 1"}]}]',
|
|
286
|
-
'gen_ai.response.finish_reasons': ['stop'],
|
|
287
|
-
'gen_ai.response.model': 'test-model',
|
|
288
|
-
'gen_ai.usage.input_tokens': 17,
|
|
289
|
-
'gen_ai.usage.output_tokens': 50,
|
|
290
|
-
'gen_ai.operation.name': 'generate_content',
|
|
291
|
-
'gen_ai.output.type': 'text',
|
|
292
|
-
'gen_ai.request.choice.count': 1,
|
|
293
|
-
'gen_ai.request.seed': 678,
|
|
294
|
-
'gen_ai.request.frequency_penalty': 10,
|
|
295
|
-
'gen_ai.request.presence_penalty': 6,
|
|
296
|
-
'gen_ai.request.max_tokens': 8000,
|
|
297
|
-
'server.address': 'foo.com',
|
|
298
|
-
'server.port': 8080,
|
|
299
|
-
'gen_ai.request.stop_sequences': ['stop', 'please stop'],
|
|
300
|
-
'gen_ai.system_instructions': '[{"type":"text","content":"be nice"}]',
|
|
301
|
-
}),
|
|
302
|
-
});
|
|
303
|
-
expect(mockMetrics.recordApiResponseMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
304
|
-
model: 'test-model',
|
|
305
|
-
status_code: 200,
|
|
306
|
-
genAiAttributes: {
|
|
307
|
-
'gen_ai.operation.name': 'generate_content',
|
|
308
|
-
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
309
|
-
'gen_ai.request.model': 'test-model',
|
|
310
|
-
'gen_ai.response.model': 'test-model',
|
|
311
|
-
},
|
|
312
|
-
});
|
|
313
|
-
// Verify token usage calls for all token types
|
|
314
|
-
expect(mockMetrics.recordTokenUsageMetrics).toHaveBeenCalledWith(mockConfig, 17, {
|
|
315
|
-
model: 'test-model',
|
|
316
|
-
type: 'input',
|
|
317
|
-
genAiAttributes: {
|
|
318
|
-
'gen_ai.operation.name': 'generate_content',
|
|
319
|
-
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
320
|
-
'gen_ai.request.model': 'test-model',
|
|
321
|
-
'gen_ai.response.model': 'test-model',
|
|
322
|
-
},
|
|
323
|
-
});
|
|
324
|
-
expect(mockMetrics.recordTokenUsageMetrics).toHaveBeenCalledWith(mockConfig, 50, {
|
|
325
|
-
model: 'test-model',
|
|
326
|
-
type: 'output',
|
|
327
|
-
genAiAttributes: {
|
|
328
|
-
'gen_ai.operation.name': 'generate_content',
|
|
329
|
-
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
330
|
-
'gen_ai.request.model': 'test-model',
|
|
331
|
-
'gen_ai.response.model': 'test-model',
|
|
332
|
-
},
|
|
333
|
-
});
|
|
334
|
-
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
335
|
-
...event,
|
|
336
|
-
'event.name': EVENT_API_RESPONSE,
|
|
337
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
338
|
-
});
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
describe('logApiError', () => {
|
|
342
|
-
const mockConfig = {
|
|
343
|
-
getSessionId: () => 'test-session-id',
|
|
344
|
-
getTargetDir: () => 'target-dir',
|
|
345
|
-
getUsageStatisticsEnabled: () => true,
|
|
346
|
-
getTelemetryEnabled: () => true,
|
|
347
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
348
|
-
isInteractive: () => false,
|
|
349
|
-
};
|
|
350
|
-
const mockMetrics = {
|
|
351
|
-
recordApiResponseMetrics: vi.fn(),
|
|
352
|
-
recordApiErrorMetrics: vi.fn(),
|
|
353
|
-
recordTokenUsageMetrics: vi.fn(),
|
|
354
|
-
};
|
|
355
|
-
beforeEach(() => {
|
|
356
|
-
vi.spyOn(metrics, 'recordApiResponseMetrics').mockImplementation(mockMetrics.recordApiResponseMetrics);
|
|
357
|
-
vi.spyOn(metrics, 'recordApiErrorMetrics').mockImplementation(mockMetrics.recordApiErrorMetrics);
|
|
358
|
-
});
|
|
359
|
-
it('should log an API error with all fields', () => {
|
|
360
|
-
const event = new ApiErrorEvent('test-model', 'UNAVAILABLE. {"error":{"code":503,"message":"The model is overloaded. Please try again later.","status":"UNAVAILABLE"}}', 100, {
|
|
361
|
-
prompt_id: 'prompt-id-1',
|
|
362
|
-
contents: [
|
|
363
|
-
{
|
|
364
|
-
role: 'user',
|
|
365
|
-
parts: [{ text: 'Hello' }],
|
|
366
|
-
},
|
|
367
|
-
],
|
|
368
|
-
generate_content_config: {
|
|
369
|
-
temperature: 1,
|
|
370
|
-
topP: 2,
|
|
371
|
-
topK: 3,
|
|
372
|
-
responseMimeType: 'text/plain',
|
|
373
|
-
candidateCount: 1,
|
|
374
|
-
seed: 678,
|
|
375
|
-
frequencyPenalty: 10,
|
|
376
|
-
maxOutputTokens: 8000,
|
|
377
|
-
presencePenalty: 6,
|
|
378
|
-
stopSequences: ['stop', 'please stop'],
|
|
379
|
-
systemInstruction: {
|
|
380
|
-
role: 'model',
|
|
381
|
-
parts: [{ text: 'be nice' }],
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
server: {
|
|
385
|
-
address: 'foo.com',
|
|
386
|
-
port: 8080,
|
|
387
|
-
},
|
|
388
|
-
}, AuthType.LOGIN_WITH_GOOGLE, 'ApiError', 503);
|
|
389
|
-
logApiError(mockConfig, event);
|
|
390
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
391
|
-
body: 'API error for test-model. Error: UNAVAILABLE. {"error":{"code":503,"message":"The model is overloaded. Please try again later.","status":"UNAVAILABLE"}}. Duration: 100ms.',
|
|
392
|
-
attributes: expect.objectContaining({
|
|
393
|
-
'event.name': EVENT_API_ERROR,
|
|
394
|
-
prompt_id: 'prompt-id-1',
|
|
395
|
-
}),
|
|
396
|
-
});
|
|
397
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
398
|
-
body: 'GenAI operation error details from test-model. Error: UNAVAILABLE. {"error":{"code":503,"message":"The model is overloaded. Please try again later.","status":"UNAVAILABLE"}}. Duration: 100ms.',
|
|
399
|
-
attributes: expect.objectContaining({
|
|
400
|
-
'event.name': 'gen_ai.client.inference.operation.details',
|
|
401
|
-
'gen_ai.request.model': 'test-model',
|
|
402
|
-
'gen_ai.request.temperature': 1,
|
|
403
|
-
'gen_ai.request.top_p': 2,
|
|
404
|
-
'gen_ai.request.top_k': 3,
|
|
405
|
-
'gen_ai.input.messages': '[{"role":"user","parts":[{"type":"text","content":"Hello"}]}]',
|
|
406
|
-
'gen_ai.operation.name': 'generate_content',
|
|
407
|
-
'gen_ai.output.type': 'text',
|
|
408
|
-
'gen_ai.request.choice.count': 1,
|
|
409
|
-
'gen_ai.request.seed': 678,
|
|
410
|
-
'gen_ai.request.frequency_penalty': 10,
|
|
411
|
-
'gen_ai.request.presence_penalty': 6,
|
|
412
|
-
'gen_ai.request.max_tokens': 8000,
|
|
413
|
-
'server.address': 'foo.com',
|
|
414
|
-
'server.port': 8080,
|
|
415
|
-
'gen_ai.request.stop_sequences': ['stop', 'please stop'],
|
|
416
|
-
'gen_ai.system_instructions': '[{"type":"text","content":"be nice"}]',
|
|
417
|
-
}),
|
|
418
|
-
});
|
|
419
|
-
expect(mockMetrics.recordApiErrorMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
420
|
-
model: 'test-model',
|
|
421
|
-
status_code: 503,
|
|
422
|
-
error_type: 'ApiError',
|
|
423
|
-
});
|
|
424
|
-
expect(mockMetrics.recordApiResponseMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
425
|
-
model: 'test-model',
|
|
426
|
-
status_code: 503,
|
|
427
|
-
genAiAttributes: {
|
|
428
|
-
'gen_ai.operation.name': 'generate_content',
|
|
429
|
-
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
430
|
-
'gen_ai.request.model': 'test-model',
|
|
431
|
-
'gen_ai.response.model': 'test-model',
|
|
432
|
-
'error.type': 'ApiError',
|
|
433
|
-
},
|
|
434
|
-
});
|
|
435
|
-
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
436
|
-
...event,
|
|
437
|
-
'event.name': EVENT_API_ERROR,
|
|
438
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
439
|
-
});
|
|
440
|
-
});
|
|
441
|
-
});
|
|
442
|
-
describe('logApiRequest', () => {
|
|
443
|
-
const mockConfig = {
|
|
444
|
-
getSessionId: () => 'test-session-id',
|
|
445
|
-
getTargetDir: () => 'target-dir',
|
|
446
|
-
getUsageStatisticsEnabled: () => true,
|
|
447
|
-
getTelemetryEnabled: () => true,
|
|
448
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
449
|
-
isInteractive: () => false,
|
|
450
|
-
getContentGeneratorConfig: () => ({
|
|
451
|
-
authType: AuthType.LOGIN_WITH_GOOGLE,
|
|
452
|
-
}),
|
|
453
|
-
};
|
|
454
|
-
it('should log an API request with request_text', () => {
|
|
455
|
-
const event = new ApiRequestEvent('test-model', {
|
|
456
|
-
prompt_id: 'prompt-id-7',
|
|
457
|
-
contents: [],
|
|
458
|
-
}, 'This is a test request');
|
|
459
|
-
logApiRequest(mockConfig, event);
|
|
460
|
-
expect(mockLogger.emit).toHaveBeenNthCalledWith(1, {
|
|
461
|
-
body: 'API request to test-model.',
|
|
462
|
-
attributes: expect.objectContaining({
|
|
463
|
-
'event.name': EVENT_API_REQUEST,
|
|
464
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
465
|
-
interactive: false,
|
|
466
|
-
model: 'test-model',
|
|
467
|
-
request_text: 'This is a test request',
|
|
468
|
-
prompt_id: 'prompt-id-7',
|
|
469
|
-
}),
|
|
470
|
-
});
|
|
471
|
-
expect(mockLogger.emit).toHaveBeenNthCalledWith(2, {
|
|
472
|
-
body: 'GenAI operation request details from test-model.',
|
|
473
|
-
attributes: expect.objectContaining({
|
|
474
|
-
'event.name': 'gen_ai.client.inference.operation.details',
|
|
475
|
-
'gen_ai.request.model': 'test-model',
|
|
476
|
-
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
477
|
-
}),
|
|
478
|
-
});
|
|
479
|
-
});
|
|
480
|
-
it('should log an API request without request_text', () => {
|
|
481
|
-
const event = new ApiRequestEvent('test-model', {
|
|
482
|
-
prompt_id: 'prompt-id-6',
|
|
483
|
-
contents: [],
|
|
484
|
-
});
|
|
485
|
-
logApiRequest(mockConfig, event);
|
|
486
|
-
expect(mockLogger.emit).toHaveBeenNthCalledWith(1, {
|
|
487
|
-
body: 'API request to test-model.',
|
|
488
|
-
attributes: expect.objectContaining({
|
|
489
|
-
'event.name': EVENT_API_REQUEST,
|
|
490
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
491
|
-
interactive: false,
|
|
492
|
-
model: 'test-model',
|
|
493
|
-
prompt_id: 'prompt-id-6',
|
|
494
|
-
}),
|
|
495
|
-
});
|
|
496
|
-
expect(mockLogger.emit).toHaveBeenNthCalledWith(2, {
|
|
497
|
-
body: 'GenAI operation request details from test-model.',
|
|
498
|
-
attributes: expect.objectContaining({
|
|
499
|
-
'event.name': 'gen_ai.client.inference.operation.details',
|
|
500
|
-
'gen_ai.request.model': 'test-model',
|
|
501
|
-
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
502
|
-
}),
|
|
503
|
-
});
|
|
504
|
-
});
|
|
505
|
-
it('should log an API request with full semantic details when logPrompts is enabled', () => {
|
|
506
|
-
const mockConfigWithPrompts = {
|
|
507
|
-
getSessionId: () => 'test-session-id',
|
|
508
|
-
getTargetDir: () => 'target-dir',
|
|
509
|
-
getUsageStatisticsEnabled: () => true,
|
|
510
|
-
getTelemetryEnabled: () => true,
|
|
511
|
-
getTelemetryLogPromptsEnabled: () => true, // Enabled
|
|
512
|
-
isInteractive: () => false,
|
|
513
|
-
getContentGeneratorConfig: () => ({
|
|
514
|
-
authType: AuthType.USE_GEMINI,
|
|
515
|
-
}),
|
|
516
|
-
};
|
|
517
|
-
const promptDetails = {
|
|
518
|
-
prompt_id: 'prompt-id-semantic-1',
|
|
519
|
-
contents: [
|
|
520
|
-
{
|
|
521
|
-
role: 'user',
|
|
522
|
-
parts: [{ text: 'Semantic request test' }],
|
|
523
|
-
},
|
|
524
|
-
],
|
|
525
|
-
generate_content_config: {
|
|
526
|
-
temperature: 0.5,
|
|
527
|
-
topP: 0.8,
|
|
528
|
-
topK: 10,
|
|
529
|
-
responseMimeType: 'application/json',
|
|
530
|
-
candidateCount: 1,
|
|
531
|
-
stopSequences: ['end'],
|
|
532
|
-
systemInstruction: {
|
|
533
|
-
role: 'model',
|
|
534
|
-
parts: [{ text: 'be helpful' }],
|
|
535
|
-
},
|
|
536
|
-
},
|
|
537
|
-
server: {
|
|
538
|
-
address: 'semantic-api.example.com',
|
|
539
|
-
port: 8080,
|
|
540
|
-
},
|
|
541
|
-
};
|
|
542
|
-
const event = new ApiRequestEvent('test-model', promptDetails, 'Full semantic request');
|
|
543
|
-
logApiRequest(mockConfigWithPrompts, event);
|
|
544
|
-
// Expect two calls to emit: one for the regular log, one for the semantic log
|
|
545
|
-
expect(mockLogger.emit).toHaveBeenCalledTimes(2);
|
|
546
|
-
// Verify the first (original) log record
|
|
547
|
-
expect(mockLogger.emit).toHaveBeenNthCalledWith(1, {
|
|
548
|
-
body: 'API request to test-model.',
|
|
549
|
-
attributes: expect.objectContaining({
|
|
550
|
-
'event.name': EVENT_API_REQUEST,
|
|
551
|
-
prompt_id: 'prompt-id-semantic-1',
|
|
552
|
-
}),
|
|
553
|
-
});
|
|
554
|
-
// Verify the second (semantic) log record
|
|
555
|
-
expect(mockLogger.emit).toHaveBeenNthCalledWith(2, {
|
|
556
|
-
body: 'GenAI operation request details from test-model.',
|
|
557
|
-
attributes: expect.objectContaining({
|
|
558
|
-
'event.name': 'gen_ai.client.inference.operation.details',
|
|
559
|
-
'gen_ai.request.model': 'test-model',
|
|
560
|
-
'gen_ai.request.temperature': 0.5,
|
|
561
|
-
'gen_ai.request.top_p': 0.8,
|
|
562
|
-
'gen_ai.request.top_k': 10,
|
|
563
|
-
'gen_ai.input.messages': JSON.stringify([
|
|
564
|
-
{
|
|
565
|
-
role: 'user',
|
|
566
|
-
parts: [{ type: 'text', content: 'Semantic request test' }],
|
|
567
|
-
},
|
|
568
|
-
]),
|
|
569
|
-
'server.address': 'semantic-api.example.com',
|
|
570
|
-
'server.port': 8080,
|
|
571
|
-
'gen_ai.operation.name': 'generate_content',
|
|
572
|
-
'gen_ai.provider.name': 'gcp.gen_ai',
|
|
573
|
-
'gen_ai.output.type': 'json',
|
|
574
|
-
'gen_ai.request.stop_sequences': ['end'],
|
|
575
|
-
'gen_ai.system_instructions': JSON.stringify([
|
|
576
|
-
{ type: 'text', content: 'be helpful' },
|
|
577
|
-
]),
|
|
578
|
-
}),
|
|
579
|
-
});
|
|
580
|
-
});
|
|
581
|
-
it('should log an API request with semantic details, but without prompts when logPrompts is disabled', () => {
|
|
582
|
-
const mockConfigWithoutPrompts = {
|
|
583
|
-
getSessionId: () => 'test-session-id',
|
|
584
|
-
getTargetDir: () => 'target-dir',
|
|
585
|
-
getUsageStatisticsEnabled: () => true,
|
|
586
|
-
getTelemetryEnabled: () => true,
|
|
587
|
-
getTelemetryLogPromptsEnabled: () => false, // Disabled
|
|
588
|
-
isInteractive: () => false,
|
|
589
|
-
getContentGeneratorConfig: () => ({
|
|
590
|
-
authType: AuthType.USE_VERTEX_AI,
|
|
591
|
-
}),
|
|
592
|
-
};
|
|
593
|
-
const promptDetails = {
|
|
594
|
-
prompt_id: 'prompt-id-semantic-2',
|
|
595
|
-
contents: [
|
|
596
|
-
{
|
|
597
|
-
role: 'user',
|
|
598
|
-
parts: [{ text: 'This prompt should be hidden' }],
|
|
599
|
-
},
|
|
600
|
-
],
|
|
601
|
-
generate_content_config: {},
|
|
602
|
-
model: 'gemini-1.0-pro',
|
|
603
|
-
};
|
|
604
|
-
const event = new ApiRequestEvent('gemini-1.0-pro', promptDetails, 'Request with hidden prompt');
|
|
605
|
-
logApiRequest(mockConfigWithoutPrompts, event);
|
|
606
|
-
// Expect two calls to emit
|
|
607
|
-
expect(mockLogger.emit).toHaveBeenCalledTimes(2);
|
|
608
|
-
// Get the arguments of the second (semantic) log call
|
|
609
|
-
const semanticLogCall = mockLogger.emit.mock.calls[1][0];
|
|
610
|
-
// Assert on the body
|
|
611
|
-
expect(semanticLogCall.body).toBe('GenAI operation request details from gemini-1.0-pro.');
|
|
612
|
-
// Assert on specific attributes
|
|
613
|
-
const attributes = semanticLogCall.attributes;
|
|
614
|
-
expect(attributes['event.name']).toBe('gen_ai.client.inference.operation.details');
|
|
615
|
-
expect(attributes['gen_ai.request.model']).toBe('gemini-1.0-pro');
|
|
616
|
-
expect(attributes['gen_ai.provider.name']).toBe('gcp.vertex_ai');
|
|
617
|
-
// Ensure prompt messages are NOT included
|
|
618
|
-
expect(attributes['gen_ai.input.messages']).toBeUndefined();
|
|
619
|
-
});
|
|
620
|
-
it('should correctly derive model from prompt details if available in semantic log', () => {
|
|
621
|
-
const mockConfig = {
|
|
622
|
-
getSessionId: () => 'test-session-id',
|
|
623
|
-
getTelemetryEnabled: () => true,
|
|
624
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
625
|
-
isInteractive: () => false,
|
|
626
|
-
getUsageStatisticsEnabled: () => true,
|
|
627
|
-
getContentGeneratorConfig: () => ({
|
|
628
|
-
authType: AuthType.USE_GEMINI,
|
|
629
|
-
}),
|
|
630
|
-
};
|
|
631
|
-
const promptDetails = {
|
|
632
|
-
prompt_id: 'prompt-id-semantic-3',
|
|
633
|
-
contents: [],
|
|
634
|
-
model: 'my-custom-model',
|
|
635
|
-
};
|
|
636
|
-
const event = new ApiRequestEvent('my-custom-model', promptDetails, 'Request with custom model');
|
|
637
|
-
logApiRequest(mockConfig, event);
|
|
638
|
-
// Verify the second (semantic) log record
|
|
639
|
-
expect(mockLogger.emit).toHaveBeenNthCalledWith(2, {
|
|
640
|
-
body: 'GenAI operation request details from my-custom-model.',
|
|
641
|
-
attributes: expect.objectContaining({
|
|
642
|
-
'event.name': 'gen_ai.client.inference.operation.details',
|
|
643
|
-
'gen_ai.request.model': 'my-custom-model',
|
|
644
|
-
}),
|
|
645
|
-
});
|
|
646
|
-
});
|
|
647
|
-
});
|
|
648
|
-
describe('logFlashFallback', () => {
|
|
649
|
-
const mockConfig = {
|
|
650
|
-
getSessionId: () => 'test-session-id',
|
|
651
|
-
getUsageStatisticsEnabled: () => true,
|
|
652
|
-
isInteractive: () => false,
|
|
653
|
-
};
|
|
654
|
-
it('should log flash fallback event', () => {
|
|
655
|
-
const event = new FlashFallbackEvent(AuthType.USE_VERTEX_AI);
|
|
656
|
-
logFlashFallback(mockConfig, event);
|
|
657
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
658
|
-
body: 'Switching to flash as Fallback.',
|
|
659
|
-
attributes: {
|
|
660
|
-
'session.id': 'test-session-id',
|
|
661
|
-
'user.email': 'test-user@example.com',
|
|
662
|
-
'installation.id': 'test-installation-id',
|
|
663
|
-
'event.name': EVENT_FLASH_FALLBACK,
|
|
664
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
665
|
-
interactive: false,
|
|
666
|
-
auth_type: 'vertex-ai',
|
|
667
|
-
},
|
|
668
|
-
});
|
|
669
|
-
});
|
|
670
|
-
});
|
|
671
|
-
describe('logRipgrepFallback', () => {
|
|
672
|
-
const mockConfig = {
|
|
673
|
-
getSessionId: () => 'test-session-id',
|
|
674
|
-
getUsageStatisticsEnabled: () => true,
|
|
675
|
-
isInteractive: () => false,
|
|
676
|
-
};
|
|
677
|
-
beforeEach(() => {
|
|
678
|
-
vi.spyOn(ClearcutLogger.prototype, 'logRipgrepFallbackEvent');
|
|
679
|
-
});
|
|
680
|
-
it('should log ripgrep fallback event', () => {
|
|
681
|
-
const event = new RipgrepFallbackEvent();
|
|
682
|
-
logRipgrepFallback(mockConfig, event);
|
|
683
|
-
expect(ClearcutLogger.prototype.logRipgrepFallbackEvent).toHaveBeenCalled();
|
|
684
|
-
const emittedEvent = mockLogger.emit.mock.calls[0][0];
|
|
685
|
-
expect(emittedEvent.body).toBe('Switching to grep as fallback.');
|
|
686
|
-
expect(emittedEvent.attributes).toEqual(expect.objectContaining({
|
|
687
|
-
'session.id': 'test-session-id',
|
|
688
|
-
'user.email': 'test-user@example.com',
|
|
689
|
-
'installation.id': 'test-installation-id',
|
|
690
|
-
'event.name': EVENT_RIPGREP_FALLBACK,
|
|
691
|
-
error: undefined,
|
|
692
|
-
}));
|
|
693
|
-
});
|
|
694
|
-
it('should log ripgrep fallback event with an error', () => {
|
|
695
|
-
const event = new RipgrepFallbackEvent('rg not found');
|
|
696
|
-
logRipgrepFallback(mockConfig, event);
|
|
697
|
-
expect(ClearcutLogger.prototype.logRipgrepFallbackEvent).toHaveBeenCalled();
|
|
698
|
-
const emittedEvent = mockLogger.emit.mock.calls[0][0];
|
|
699
|
-
expect(emittedEvent.body).toBe('Switching to grep as fallback.');
|
|
700
|
-
expect(emittedEvent.attributes).toEqual(expect.objectContaining({
|
|
701
|
-
'session.id': 'test-session-id',
|
|
702
|
-
'user.email': 'test-user@example.com',
|
|
703
|
-
'installation.id': 'test-installation-id',
|
|
704
|
-
'event.name': EVENT_RIPGREP_FALLBACK,
|
|
705
|
-
error: 'rg not found',
|
|
706
|
-
}));
|
|
707
|
-
});
|
|
708
|
-
});
|
|
709
|
-
describe('logToolCall', () => {
|
|
710
|
-
const cfg1 = {
|
|
711
|
-
getSessionId: () => 'test-session-id',
|
|
712
|
-
getTargetDir: () => 'target-dir',
|
|
713
|
-
getGeminiClient: () => mockGeminiClient,
|
|
714
|
-
};
|
|
715
|
-
const cfg2 = {
|
|
716
|
-
getSessionId: () => 'test-session-id',
|
|
717
|
-
getTargetDir: () => 'target-dir',
|
|
718
|
-
getProxy: () => 'http://test.proxy.com:8080',
|
|
719
|
-
getContentGeneratorConfig: () => ({ model: 'test-model' }),
|
|
720
|
-
getModel: () => 'test-model',
|
|
721
|
-
getEmbeddingModel: () => 'test-embedding-model',
|
|
722
|
-
getWorkingDir: () => 'test-working-dir',
|
|
723
|
-
getSandbox: () => true,
|
|
724
|
-
getCoreTools: () => ['ls', 'read-file'],
|
|
725
|
-
getApprovalMode: () => 'default',
|
|
726
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
727
|
-
getFileFilteringRespectGitIgnore: () => true,
|
|
728
|
-
getFileFilteringAllowBuildArtifacts: () => false,
|
|
729
|
-
getDebugMode: () => true,
|
|
730
|
-
getMcpServers: () => ({
|
|
731
|
-
'test-server': {
|
|
732
|
-
command: 'test-command',
|
|
733
|
-
},
|
|
734
|
-
}),
|
|
735
|
-
getQuestion: () => 'test-question',
|
|
736
|
-
getToolRegistry: () => new ToolRegistry(cfg1, {}),
|
|
737
|
-
getUserMemory: () => 'user-memory',
|
|
738
|
-
};
|
|
739
|
-
const mockGeminiClient = new GeminiClient(cfg2);
|
|
740
|
-
const mockConfig = {
|
|
741
|
-
getSessionId: () => 'test-session-id',
|
|
742
|
-
getTargetDir: () => 'target-dir',
|
|
743
|
-
getGeminiClient: () => mockGeminiClient,
|
|
744
|
-
getUsageStatisticsEnabled: () => true,
|
|
745
|
-
getTelemetryEnabled: () => true,
|
|
746
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
747
|
-
isInteractive: () => false,
|
|
748
|
-
};
|
|
749
|
-
const mockMetrics = {
|
|
750
|
-
recordToolCallMetrics: vi.fn(),
|
|
751
|
-
recordLinesChanged: vi.fn(),
|
|
752
|
-
};
|
|
753
|
-
beforeEach(() => {
|
|
754
|
-
vi.spyOn(metrics, 'recordToolCallMetrics').mockImplementation(mockMetrics.recordToolCallMetrics);
|
|
755
|
-
vi.spyOn(metrics, 'recordLinesChanged').mockImplementation(mockMetrics.recordLinesChanged);
|
|
756
|
-
mockLogger.emit.mockReset();
|
|
757
|
-
});
|
|
758
|
-
it('should log a tool call with all fields', () => {
|
|
759
|
-
const tool = new EditTool(mockConfig, createMockMessageBus());
|
|
760
|
-
const call = {
|
|
761
|
-
status: 'success',
|
|
762
|
-
request: {
|
|
763
|
-
name: 'test-function',
|
|
764
|
-
args: {
|
|
765
|
-
arg1: 'value1',
|
|
766
|
-
arg2: 2,
|
|
767
|
-
},
|
|
768
|
-
callId: 'test-call-id',
|
|
769
|
-
isClientInitiated: true,
|
|
770
|
-
prompt_id: 'prompt-id-1',
|
|
771
|
-
},
|
|
772
|
-
response: {
|
|
773
|
-
callId: 'test-call-id',
|
|
774
|
-
responseParts: [{ text: 'test-response' }],
|
|
775
|
-
resultDisplay: {
|
|
776
|
-
fileDiff: 'diff',
|
|
777
|
-
fileName: 'file.txt',
|
|
778
|
-
filePath: 'file.txt',
|
|
779
|
-
originalContent: 'old content',
|
|
780
|
-
newContent: 'new content',
|
|
781
|
-
diffStat: {
|
|
782
|
-
model_added_lines: 1,
|
|
783
|
-
model_removed_lines: 2,
|
|
784
|
-
model_added_chars: 3,
|
|
785
|
-
model_removed_chars: 4,
|
|
786
|
-
user_added_lines: 5,
|
|
787
|
-
user_removed_lines: 6,
|
|
788
|
-
user_added_chars: 7,
|
|
789
|
-
user_removed_chars: 8,
|
|
790
|
-
},
|
|
791
|
-
},
|
|
792
|
-
error: undefined,
|
|
793
|
-
errorType: undefined,
|
|
794
|
-
contentLength: 13,
|
|
795
|
-
},
|
|
796
|
-
tool,
|
|
797
|
-
invocation: {},
|
|
798
|
-
durationMs: 100,
|
|
799
|
-
outcome: ToolConfirmationOutcome.ProceedOnce,
|
|
800
|
-
};
|
|
801
|
-
const event = new ToolCallEvent(call);
|
|
802
|
-
logToolCall(mockConfig, event);
|
|
803
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
804
|
-
body: 'Tool call: test-function. Decision: accept. Success: true. Duration: 100ms.',
|
|
805
|
-
attributes: {
|
|
806
|
-
'session.id': 'test-session-id',
|
|
807
|
-
'user.email': 'test-user@example.com',
|
|
808
|
-
'installation.id': 'test-installation-id',
|
|
809
|
-
'event.name': EVENT_TOOL_CALL,
|
|
810
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
811
|
-
interactive: false,
|
|
812
|
-
function_name: 'test-function',
|
|
813
|
-
function_args: JSON.stringify({
|
|
814
|
-
arg1: 'value1',
|
|
815
|
-
arg2: 2,
|
|
816
|
-
}, null, 2),
|
|
817
|
-
duration_ms: 100,
|
|
818
|
-
success: true,
|
|
819
|
-
decision: ToolCallDecision.ACCEPT,
|
|
820
|
-
prompt_id: 'prompt-id-1',
|
|
821
|
-
tool_type: 'native',
|
|
822
|
-
error: undefined,
|
|
823
|
-
error_type: undefined,
|
|
824
|
-
mcp_server_name: undefined,
|
|
825
|
-
extension_id: undefined,
|
|
826
|
-
metadata: {
|
|
827
|
-
model_added_lines: 1,
|
|
828
|
-
model_removed_lines: 2,
|
|
829
|
-
model_added_chars: 3,
|
|
830
|
-
model_removed_chars: 4,
|
|
831
|
-
user_added_lines: 5,
|
|
832
|
-
user_removed_lines: 6,
|
|
833
|
-
user_added_chars: 7,
|
|
834
|
-
user_removed_chars: 8,
|
|
835
|
-
},
|
|
836
|
-
content_length: 13,
|
|
837
|
-
},
|
|
838
|
-
});
|
|
839
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
840
|
-
function_name: 'test-function',
|
|
841
|
-
success: true,
|
|
842
|
-
decision: ToolCallDecision.ACCEPT,
|
|
843
|
-
tool_type: 'native',
|
|
844
|
-
});
|
|
845
|
-
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
846
|
-
...event,
|
|
847
|
-
'event.name': EVENT_TOOL_CALL,
|
|
848
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
849
|
-
});
|
|
850
|
-
expect(mockMetrics.recordLinesChanged).toHaveBeenCalledWith(mockConfig, 1, 'added', { function_name: 'test-function' });
|
|
851
|
-
expect(mockMetrics.recordLinesChanged).toHaveBeenCalledWith(mockConfig, 2, 'removed', { function_name: 'test-function' });
|
|
852
|
-
});
|
|
853
|
-
it('should log a tool call with a reject decision', () => {
|
|
854
|
-
const call = {
|
|
855
|
-
status: 'error',
|
|
856
|
-
request: {
|
|
857
|
-
name: 'test-function',
|
|
858
|
-
args: {
|
|
859
|
-
arg1: 'value1',
|
|
860
|
-
arg2: 2,
|
|
861
|
-
},
|
|
862
|
-
callId: 'test-call-id',
|
|
863
|
-
isClientInitiated: true,
|
|
864
|
-
prompt_id: 'prompt-id-2',
|
|
865
|
-
},
|
|
866
|
-
response: {
|
|
867
|
-
callId: 'test-call-id',
|
|
868
|
-
responseParts: [{ text: 'test-response' }],
|
|
869
|
-
resultDisplay: undefined,
|
|
870
|
-
error: undefined,
|
|
871
|
-
errorType: undefined,
|
|
872
|
-
contentLength: undefined,
|
|
873
|
-
},
|
|
874
|
-
durationMs: 100,
|
|
875
|
-
outcome: ToolConfirmationOutcome.Cancel,
|
|
876
|
-
};
|
|
877
|
-
const event = new ToolCallEvent(call);
|
|
878
|
-
logToolCall(mockConfig, event);
|
|
879
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
880
|
-
body: 'Tool call: test-function. Decision: reject. Success: false. Duration: 100ms.',
|
|
881
|
-
attributes: {
|
|
882
|
-
'session.id': 'test-session-id',
|
|
883
|
-
'user.email': 'test-user@example.com',
|
|
884
|
-
'installation.id': 'test-installation-id',
|
|
885
|
-
'event.name': EVENT_TOOL_CALL,
|
|
886
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
887
|
-
interactive: false,
|
|
888
|
-
function_name: 'test-function',
|
|
889
|
-
function_args: JSON.stringify({
|
|
890
|
-
arg1: 'value1',
|
|
891
|
-
arg2: 2,
|
|
892
|
-
}, null, 2),
|
|
893
|
-
duration_ms: 100,
|
|
894
|
-
success: false,
|
|
895
|
-
decision: ToolCallDecision.REJECT,
|
|
896
|
-
prompt_id: 'prompt-id-2',
|
|
897
|
-
tool_type: 'native',
|
|
898
|
-
error: undefined,
|
|
899
|
-
error_type: undefined,
|
|
900
|
-
mcp_server_name: undefined,
|
|
901
|
-
extension_id: undefined,
|
|
902
|
-
metadata: undefined,
|
|
903
|
-
content_length: undefined,
|
|
904
|
-
},
|
|
905
|
-
});
|
|
906
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
907
|
-
function_name: 'test-function',
|
|
908
|
-
success: false,
|
|
909
|
-
decision: ToolCallDecision.REJECT,
|
|
910
|
-
tool_type: 'native',
|
|
911
|
-
});
|
|
912
|
-
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
913
|
-
...event,
|
|
914
|
-
'event.name': EVENT_TOOL_CALL,
|
|
915
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
916
|
-
});
|
|
917
|
-
});
|
|
918
|
-
it('should log a tool call with a modify decision', () => {
|
|
919
|
-
const call = {
|
|
920
|
-
status: 'success',
|
|
921
|
-
request: {
|
|
922
|
-
name: 'test-function',
|
|
923
|
-
args: {
|
|
924
|
-
arg1: 'value1',
|
|
925
|
-
arg2: 2,
|
|
926
|
-
},
|
|
927
|
-
callId: 'test-call-id',
|
|
928
|
-
isClientInitiated: true,
|
|
929
|
-
prompt_id: 'prompt-id-3',
|
|
930
|
-
},
|
|
931
|
-
response: {
|
|
932
|
-
callId: 'test-call-id',
|
|
933
|
-
responseParts: [{ text: 'test-response' }],
|
|
934
|
-
resultDisplay: undefined,
|
|
935
|
-
error: undefined,
|
|
936
|
-
errorType: undefined,
|
|
937
|
-
contentLength: 13,
|
|
938
|
-
},
|
|
939
|
-
outcome: ToolConfirmationOutcome.ModifyWithEditor,
|
|
940
|
-
tool: new EditTool(mockConfig, createMockMessageBus()),
|
|
941
|
-
invocation: {},
|
|
942
|
-
durationMs: 100,
|
|
943
|
-
};
|
|
944
|
-
const event = new ToolCallEvent(call);
|
|
945
|
-
logToolCall(mockConfig, event);
|
|
946
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
947
|
-
body: 'Tool call: test-function. Decision: modify. Success: true. Duration: 100ms.',
|
|
948
|
-
attributes: {
|
|
949
|
-
'session.id': 'test-session-id',
|
|
950
|
-
'user.email': 'test-user@example.com',
|
|
951
|
-
'installation.id': 'test-installation-id',
|
|
952
|
-
'event.name': EVENT_TOOL_CALL,
|
|
953
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
954
|
-
interactive: false,
|
|
955
|
-
function_name: 'test-function',
|
|
956
|
-
function_args: JSON.stringify({
|
|
957
|
-
arg1: 'value1',
|
|
958
|
-
arg2: 2,
|
|
959
|
-
}, null, 2),
|
|
960
|
-
duration_ms: 100,
|
|
961
|
-
success: true,
|
|
962
|
-
decision: ToolCallDecision.MODIFY,
|
|
963
|
-
prompt_id: 'prompt-id-3',
|
|
964
|
-
tool_type: 'native',
|
|
965
|
-
error: undefined,
|
|
966
|
-
error_type: undefined,
|
|
967
|
-
mcp_server_name: undefined,
|
|
968
|
-
extension_id: undefined,
|
|
969
|
-
metadata: undefined,
|
|
970
|
-
content_length: 13,
|
|
971
|
-
},
|
|
972
|
-
});
|
|
973
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
974
|
-
function_name: 'test-function',
|
|
975
|
-
success: true,
|
|
976
|
-
decision: ToolCallDecision.MODIFY,
|
|
977
|
-
tool_type: 'native',
|
|
978
|
-
});
|
|
979
|
-
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
980
|
-
...event,
|
|
981
|
-
'event.name': EVENT_TOOL_CALL,
|
|
982
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
983
|
-
});
|
|
984
|
-
});
|
|
985
|
-
it('should log a tool call without a decision', () => {
|
|
986
|
-
const call = {
|
|
987
|
-
status: 'success',
|
|
988
|
-
request: {
|
|
989
|
-
name: 'test-function',
|
|
990
|
-
args: {
|
|
991
|
-
arg1: 'value1',
|
|
992
|
-
arg2: 2,
|
|
993
|
-
},
|
|
994
|
-
callId: 'test-call-id',
|
|
995
|
-
isClientInitiated: true,
|
|
996
|
-
prompt_id: 'prompt-id-4',
|
|
997
|
-
},
|
|
998
|
-
response: {
|
|
999
|
-
callId: 'test-call-id',
|
|
1000
|
-
responseParts: [{ text: 'test-response' }],
|
|
1001
|
-
resultDisplay: undefined,
|
|
1002
|
-
error: undefined,
|
|
1003
|
-
errorType: undefined,
|
|
1004
|
-
contentLength: 13,
|
|
1005
|
-
},
|
|
1006
|
-
tool: new EditTool(mockConfig, createMockMessageBus()),
|
|
1007
|
-
invocation: {},
|
|
1008
|
-
durationMs: 100,
|
|
1009
|
-
};
|
|
1010
|
-
const event = new ToolCallEvent(call);
|
|
1011
|
-
logToolCall(mockConfig, event);
|
|
1012
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1013
|
-
body: 'Tool call: test-function. Success: true. Duration: 100ms.',
|
|
1014
|
-
attributes: {
|
|
1015
|
-
'session.id': 'test-session-id',
|
|
1016
|
-
'user.email': 'test-user@example.com',
|
|
1017
|
-
'installation.id': 'test-installation-id',
|
|
1018
|
-
'event.name': EVENT_TOOL_CALL,
|
|
1019
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1020
|
-
interactive: false,
|
|
1021
|
-
function_name: 'test-function',
|
|
1022
|
-
function_args: JSON.stringify({
|
|
1023
|
-
arg1: 'value1',
|
|
1024
|
-
arg2: 2,
|
|
1025
|
-
}, null, 2),
|
|
1026
|
-
duration_ms: 100,
|
|
1027
|
-
success: true,
|
|
1028
|
-
prompt_id: 'prompt-id-4',
|
|
1029
|
-
tool_type: 'native',
|
|
1030
|
-
decision: undefined,
|
|
1031
|
-
error: undefined,
|
|
1032
|
-
error_type: undefined,
|
|
1033
|
-
mcp_server_name: undefined,
|
|
1034
|
-
extension_id: undefined,
|
|
1035
|
-
metadata: undefined,
|
|
1036
|
-
content_length: 13,
|
|
1037
|
-
},
|
|
1038
|
-
});
|
|
1039
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
1040
|
-
function_name: 'test-function',
|
|
1041
|
-
success: true,
|
|
1042
|
-
decision: undefined,
|
|
1043
|
-
tool_type: 'native',
|
|
1044
|
-
});
|
|
1045
|
-
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
1046
|
-
...event,
|
|
1047
|
-
'event.name': EVENT_TOOL_CALL,
|
|
1048
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1049
|
-
});
|
|
1050
|
-
});
|
|
1051
|
-
it('should log a failed tool call with an error', () => {
|
|
1052
|
-
const errorMessage = 'test-error';
|
|
1053
|
-
const call = {
|
|
1054
|
-
status: 'error',
|
|
1055
|
-
request: {
|
|
1056
|
-
name: 'test-function',
|
|
1057
|
-
args: {
|
|
1058
|
-
arg1: 'value1',
|
|
1059
|
-
arg2: 2,
|
|
1060
|
-
},
|
|
1061
|
-
callId: 'test-call-id',
|
|
1062
|
-
isClientInitiated: true,
|
|
1063
|
-
prompt_id: 'prompt-id-5',
|
|
1064
|
-
},
|
|
1065
|
-
response: {
|
|
1066
|
-
callId: 'test-call-id',
|
|
1067
|
-
responseParts: [{ text: 'test-response' }],
|
|
1068
|
-
resultDisplay: undefined,
|
|
1069
|
-
error: new Error(errorMessage),
|
|
1070
|
-
errorType: ToolErrorType.UNKNOWN,
|
|
1071
|
-
contentLength: errorMessage.length,
|
|
1072
|
-
},
|
|
1073
|
-
durationMs: 100,
|
|
1074
|
-
};
|
|
1075
|
-
const event = new ToolCallEvent(call);
|
|
1076
|
-
logToolCall(mockConfig, event);
|
|
1077
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1078
|
-
body: 'Tool call: test-function. Success: false. Duration: 100ms.',
|
|
1079
|
-
attributes: {
|
|
1080
|
-
'session.id': 'test-session-id',
|
|
1081
|
-
'user.email': 'test-user@example.com',
|
|
1082
|
-
'installation.id': 'test-installation-id',
|
|
1083
|
-
'event.name': EVENT_TOOL_CALL,
|
|
1084
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1085
|
-
interactive: false,
|
|
1086
|
-
function_name: 'test-function',
|
|
1087
|
-
function_args: JSON.stringify({
|
|
1088
|
-
arg1: 'value1',
|
|
1089
|
-
arg2: 2,
|
|
1090
|
-
}, null, 2),
|
|
1091
|
-
duration_ms: 100,
|
|
1092
|
-
success: false,
|
|
1093
|
-
error: 'test-error',
|
|
1094
|
-
'error.message': 'test-error',
|
|
1095
|
-
error_type: ToolErrorType.UNKNOWN,
|
|
1096
|
-
'error.type': ToolErrorType.UNKNOWN,
|
|
1097
|
-
prompt_id: 'prompt-id-5',
|
|
1098
|
-
tool_type: 'native',
|
|
1099
|
-
decision: undefined,
|
|
1100
|
-
mcp_server_name: undefined,
|
|
1101
|
-
extension_id: undefined,
|
|
1102
|
-
metadata: undefined,
|
|
1103
|
-
content_length: errorMessage.length,
|
|
1104
|
-
},
|
|
1105
|
-
});
|
|
1106
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
1107
|
-
function_name: 'test-function',
|
|
1108
|
-
success: false,
|
|
1109
|
-
decision: undefined,
|
|
1110
|
-
tool_type: 'native',
|
|
1111
|
-
});
|
|
1112
|
-
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
1113
|
-
...event,
|
|
1114
|
-
'event.name': EVENT_TOOL_CALL,
|
|
1115
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1116
|
-
});
|
|
1117
|
-
});
|
|
1118
|
-
it('should log a tool call with mcp_server_name for MCP tools', () => {
|
|
1119
|
-
const mockMcpTool = new DiscoveredMCPTool({}, 'mock_mcp_server', 'mock_mcp_tool', 'tool description', {
|
|
1120
|
-
type: 'object',
|
|
1121
|
-
properties: {
|
|
1122
|
-
arg1: { type: 'string' },
|
|
1123
|
-
arg2: { type: 'number' },
|
|
1124
|
-
},
|
|
1125
|
-
required: ['arg1', 'arg2'],
|
|
1126
|
-
}, createMockMessageBus(), false, undefined, undefined, 'test-extension', 'test-extension-id');
|
|
1127
|
-
const call = {
|
|
1128
|
-
status: 'success',
|
|
1129
|
-
request: {
|
|
1130
|
-
name: 'mock_mcp_tool',
|
|
1131
|
-
args: { arg1: 'value1', arg2: 2 },
|
|
1132
|
-
callId: 'test-call-id',
|
|
1133
|
-
isClientInitiated: true,
|
|
1134
|
-
prompt_id: 'prompt-id',
|
|
1135
|
-
},
|
|
1136
|
-
response: {
|
|
1137
|
-
callId: 'test-call-id',
|
|
1138
|
-
responseParts: [{ text: 'test-response' }],
|
|
1139
|
-
resultDisplay: undefined,
|
|
1140
|
-
error: undefined,
|
|
1141
|
-
errorType: undefined,
|
|
1142
|
-
},
|
|
1143
|
-
tool: mockMcpTool,
|
|
1144
|
-
invocation: {},
|
|
1145
|
-
durationMs: 100,
|
|
1146
|
-
};
|
|
1147
|
-
const event = new ToolCallEvent(call);
|
|
1148
|
-
logToolCall(mockConfig, event);
|
|
1149
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1150
|
-
body: 'Tool call: mock_mcp_tool. Success: true. Duration: 100ms.',
|
|
1151
|
-
attributes: {
|
|
1152
|
-
'session.id': 'test-session-id',
|
|
1153
|
-
'user.email': 'test-user@example.com',
|
|
1154
|
-
'installation.id': 'test-installation-id',
|
|
1155
|
-
'event.name': EVENT_TOOL_CALL,
|
|
1156
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1157
|
-
extension_name: 'test-extension',
|
|
1158
|
-
extension_id: 'test-extension-id',
|
|
1159
|
-
interactive: false,
|
|
1160
|
-
function_name: 'mock_mcp_tool',
|
|
1161
|
-
function_args: JSON.stringify({
|
|
1162
|
-
arg1: 'value1',
|
|
1163
|
-
arg2: 2,
|
|
1164
|
-
}, null, 2),
|
|
1165
|
-
duration_ms: 100,
|
|
1166
|
-
success: true,
|
|
1167
|
-
prompt_id: 'prompt-id',
|
|
1168
|
-
tool_type: 'mcp',
|
|
1169
|
-
mcp_server_name: 'mock_mcp_server',
|
|
1170
|
-
decision: undefined,
|
|
1171
|
-
error: undefined,
|
|
1172
|
-
error_type: undefined,
|
|
1173
|
-
metadata: undefined,
|
|
1174
|
-
content_length: undefined,
|
|
1175
|
-
},
|
|
1176
|
-
});
|
|
1177
|
-
});
|
|
1178
|
-
});
|
|
1179
|
-
describe('logMalformedJsonResponse', () => {
|
|
1180
|
-
beforeEach(() => {
|
|
1181
|
-
vi.spyOn(ClearcutLogger.prototype, 'logMalformedJsonResponseEvent');
|
|
1182
|
-
});
|
|
1183
|
-
it('logs the event to Clearcut and OTEL', () => {
|
|
1184
|
-
const mockConfig = makeFakeConfig();
|
|
1185
|
-
const event = new MalformedJsonResponseEvent('test-model');
|
|
1186
|
-
logMalformedJsonResponse(mockConfig, event);
|
|
1187
|
-
expect(ClearcutLogger.prototype.logMalformedJsonResponseEvent).toHaveBeenCalledWith(event);
|
|
1188
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1189
|
-
body: 'Malformed JSON response from test-model.',
|
|
1190
|
-
attributes: {
|
|
1191
|
-
'session.id': 'test-session-id',
|
|
1192
|
-
'user.email': 'test-user@example.com',
|
|
1193
|
-
'installation.id': 'test-installation-id',
|
|
1194
|
-
'event.name': EVENT_MALFORMED_JSON_RESPONSE,
|
|
1195
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1196
|
-
interactive: false,
|
|
1197
|
-
model: 'test-model',
|
|
1198
|
-
},
|
|
1199
|
-
});
|
|
1200
|
-
});
|
|
1201
|
-
});
|
|
1202
|
-
describe('logFileOperation', () => {
|
|
1203
|
-
const mockConfig = {
|
|
1204
|
-
getSessionId: () => 'test-session-id',
|
|
1205
|
-
getTargetDir: () => 'target-dir',
|
|
1206
|
-
getUsageStatisticsEnabled: () => true,
|
|
1207
|
-
getTelemetryEnabled: () => true,
|
|
1208
|
-
getTelemetryLogPromptsEnabled: () => true,
|
|
1209
|
-
isInteractive: () => false,
|
|
1210
|
-
};
|
|
1211
|
-
const mockMetrics = {
|
|
1212
|
-
recordFileOperationMetric: vi.fn(),
|
|
1213
|
-
};
|
|
1214
|
-
beforeEach(() => {
|
|
1215
|
-
vi.spyOn(metrics, 'recordFileOperationMetric').mockImplementation(mockMetrics.recordFileOperationMetric);
|
|
1216
|
-
});
|
|
1217
|
-
it('should log a file operation event', () => {
|
|
1218
|
-
const event = new FileOperationEvent('test-tool', FileOperation.READ, 10, 'text/plain', '.txt', 'typescript');
|
|
1219
|
-
logFileOperation(mockConfig, event);
|
|
1220
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1221
|
-
body: 'File operation: read. Lines: 10.',
|
|
1222
|
-
attributes: {
|
|
1223
|
-
'session.id': 'test-session-id',
|
|
1224
|
-
'user.email': 'test-user@example.com',
|
|
1225
|
-
'installation.id': 'test-installation-id',
|
|
1226
|
-
'event.name': EVENT_FILE_OPERATION,
|
|
1227
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1228
|
-
interactive: false,
|
|
1229
|
-
tool_name: 'test-tool',
|
|
1230
|
-
operation: 'read',
|
|
1231
|
-
lines: 10,
|
|
1232
|
-
mimetype: 'text/plain',
|
|
1233
|
-
extension: '.txt',
|
|
1234
|
-
programming_language: 'typescript',
|
|
1235
|
-
},
|
|
1236
|
-
});
|
|
1237
|
-
expect(mockMetrics.recordFileOperationMetric).toHaveBeenCalledWith(mockConfig, {
|
|
1238
|
-
operation: 'read',
|
|
1239
|
-
lines: 10,
|
|
1240
|
-
mimetype: 'text/plain',
|
|
1241
|
-
extension: '.txt',
|
|
1242
|
-
programming_language: 'typescript',
|
|
1243
|
-
});
|
|
1244
|
-
});
|
|
1245
|
-
});
|
|
1246
|
-
describe('logToolOutputTruncated', () => {
|
|
1247
|
-
const mockConfig = {
|
|
1248
|
-
getSessionId: () => 'test-session-id',
|
|
1249
|
-
getUsageStatisticsEnabled: () => true,
|
|
1250
|
-
isInteractive: () => false,
|
|
1251
|
-
};
|
|
1252
|
-
it('should log a tool output truncated event', () => {
|
|
1253
|
-
const event = new ToolOutputTruncatedEvent('prompt-id-1', {
|
|
1254
|
-
toolName: 'test-tool',
|
|
1255
|
-
originalContentLength: 1000,
|
|
1256
|
-
truncatedContentLength: 100,
|
|
1257
|
-
threshold: 500,
|
|
1258
|
-
lines: 10,
|
|
1259
|
-
});
|
|
1260
|
-
logToolOutputTruncated(mockConfig, event);
|
|
1261
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1262
|
-
body: 'Tool output truncated for test-tool.',
|
|
1263
|
-
attributes: {
|
|
1264
|
-
'session.id': 'test-session-id',
|
|
1265
|
-
'user.email': 'test-user@example.com',
|
|
1266
|
-
'installation.id': 'test-installation-id',
|
|
1267
|
-
'event.name': EVENT_TOOL_OUTPUT_TRUNCATED,
|
|
1268
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1269
|
-
eventName: 'tool_output_truncated',
|
|
1270
|
-
interactive: false,
|
|
1271
|
-
prompt_id: 'prompt-id-1',
|
|
1272
|
-
tool_name: 'test-tool',
|
|
1273
|
-
original_content_length: 1000,
|
|
1274
|
-
truncated_content_length: 100,
|
|
1275
|
-
threshold: 500,
|
|
1276
|
-
lines: 10,
|
|
1277
|
-
},
|
|
1278
|
-
});
|
|
1279
|
-
});
|
|
1280
|
-
});
|
|
1281
|
-
describe('logModelRouting', () => {
|
|
1282
|
-
const mockConfig = {
|
|
1283
|
-
getSessionId: () => 'test-session-id',
|
|
1284
|
-
getUsageStatisticsEnabled: () => true,
|
|
1285
|
-
isInteractive: () => false,
|
|
1286
|
-
};
|
|
1287
|
-
beforeEach(() => {
|
|
1288
|
-
vi.spyOn(ClearcutLogger.prototype, 'logModelRoutingEvent');
|
|
1289
|
-
vi.spyOn(metrics, 'recordModelRoutingMetrics');
|
|
1290
|
-
});
|
|
1291
|
-
it('should log the event to Clearcut and OTEL, and record metrics', () => {
|
|
1292
|
-
const event = new ModelRoutingEvent('gemini-pro', 'default', 100, 'test-reason', false, undefined);
|
|
1293
|
-
logModelRouting(mockConfig, event);
|
|
1294
|
-
expect(ClearcutLogger.prototype.logModelRoutingEvent).toHaveBeenCalledWith(event);
|
|
1295
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1296
|
-
body: 'Model routing decision. Model: gemini-pro, Source: default',
|
|
1297
|
-
attributes: {
|
|
1298
|
-
'session.id': 'test-session-id',
|
|
1299
|
-
'user.email': 'test-user@example.com',
|
|
1300
|
-
'installation.id': 'test-installation-id',
|
|
1301
|
-
...event,
|
|
1302
|
-
'event.name': EVENT_MODEL_ROUTING,
|
|
1303
|
-
interactive: false,
|
|
1304
|
-
},
|
|
1305
|
-
});
|
|
1306
|
-
expect(metrics.recordModelRoutingMetrics).toHaveBeenCalledWith(mockConfig, event);
|
|
1307
|
-
});
|
|
1308
|
-
it('should only log to Clearcut if OTEL SDK is not initialized', () => {
|
|
1309
|
-
vi.spyOn(sdk, 'isTelemetrySdkInitialized').mockReturnValue(false);
|
|
1310
|
-
vi.spyOn(sdk, 'bufferTelemetryEvent').mockImplementation(() => { });
|
|
1311
|
-
const event = new ModelRoutingEvent('gemini-pro', 'default', 100, 'test-reason', false, undefined);
|
|
1312
|
-
logModelRouting(mockConfig, event);
|
|
1313
|
-
expect(ClearcutLogger.prototype.logModelRoutingEvent).toHaveBeenCalledWith(event);
|
|
1314
|
-
expect(mockLogger.emit).not.toHaveBeenCalled();
|
|
1315
|
-
expect(metrics.recordModelRoutingMetrics).not.toHaveBeenCalled();
|
|
1316
|
-
});
|
|
1317
|
-
});
|
|
1318
|
-
describe('logExtensionInstall', () => {
|
|
1319
|
-
const mockConfig = {
|
|
1320
|
-
getSessionId: () => 'test-session-id',
|
|
1321
|
-
getUsageStatisticsEnabled: () => true,
|
|
1322
|
-
getContentGeneratorConfig: () => null,
|
|
1323
|
-
isInteractive: () => false,
|
|
1324
|
-
};
|
|
1325
|
-
beforeEach(() => {
|
|
1326
|
-
vi.spyOn(ClearcutLogger.prototype, 'logExtensionInstallEvent');
|
|
1327
|
-
});
|
|
1328
|
-
afterEach(() => {
|
|
1329
|
-
vi.clearAllMocks();
|
|
1330
|
-
});
|
|
1331
|
-
it('should log extension install event', async () => {
|
|
1332
|
-
const event = new ExtensionInstallEvent('testing', 'testing-hash', 'testing-id', '0.1.0', 'git', 'success');
|
|
1333
|
-
await logExtensionInstallEvent(mockConfig, event);
|
|
1334
|
-
expect(ClearcutLogger.prototype.logExtensionInstallEvent).toHaveBeenCalledWith(event);
|
|
1335
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1336
|
-
body: 'Installed extension testing',
|
|
1337
|
-
attributes: {
|
|
1338
|
-
'session.id': 'test-session-id',
|
|
1339
|
-
'user.email': 'test-user@example.com',
|
|
1340
|
-
'installation.id': 'test-installation-id',
|
|
1341
|
-
'event.name': EVENT_EXTENSION_INSTALL,
|
|
1342
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1343
|
-
interactive: false,
|
|
1344
|
-
extension_name: 'testing',
|
|
1345
|
-
extension_version: '0.1.0',
|
|
1346
|
-
extension_source: 'git',
|
|
1347
|
-
status: 'success',
|
|
1348
|
-
},
|
|
1349
|
-
});
|
|
1350
|
-
});
|
|
1351
|
-
});
|
|
1352
|
-
describe('logExtensionUpdate', async () => {
|
|
1353
|
-
const mockConfig = {
|
|
1354
|
-
getSessionId: () => 'test-session-id',
|
|
1355
|
-
getUsageStatisticsEnabled: () => true,
|
|
1356
|
-
getContentGeneratorConfig: () => null,
|
|
1357
|
-
isInteractive: () => false,
|
|
1358
|
-
};
|
|
1359
|
-
beforeEach(() => {
|
|
1360
|
-
vi.spyOn(ClearcutLogger.prototype, 'logExtensionUpdateEvent');
|
|
1361
|
-
});
|
|
1362
|
-
afterEach(() => {
|
|
1363
|
-
vi.clearAllMocks();
|
|
1364
|
-
});
|
|
1365
|
-
it('should log extension update event', async () => {
|
|
1366
|
-
const event = new ExtensionUpdateEvent('testing', 'testing-hash', 'testing-id', '0.1.0', '0.1.1', 'git', 'success');
|
|
1367
|
-
await logExtensionUpdateEvent(mockConfig, event);
|
|
1368
|
-
expect(ClearcutLogger.prototype.logExtensionUpdateEvent).toHaveBeenCalledWith(event);
|
|
1369
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1370
|
-
body: 'Updated extension testing',
|
|
1371
|
-
attributes: {
|
|
1372
|
-
'session.id': 'test-session-id',
|
|
1373
|
-
'user.email': 'test-user@example.com',
|
|
1374
|
-
'installation.id': 'test-installation-id',
|
|
1375
|
-
'event.name': EVENT_EXTENSION_UPDATE,
|
|
1376
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1377
|
-
interactive: false,
|
|
1378
|
-
extension_name: 'testing',
|
|
1379
|
-
extension_version: '0.1.0',
|
|
1380
|
-
extension_previous_version: '0.1.1',
|
|
1381
|
-
extension_source: 'git',
|
|
1382
|
-
status: 'success',
|
|
1383
|
-
},
|
|
1384
|
-
});
|
|
1385
|
-
});
|
|
1386
|
-
});
|
|
1387
|
-
describe('logExtensionUninstall', async () => {
|
|
1388
|
-
const mockConfig = {
|
|
1389
|
-
getSessionId: () => 'test-session-id',
|
|
1390
|
-
getUsageStatisticsEnabled: () => true,
|
|
1391
|
-
getContentGeneratorConfig: () => null,
|
|
1392
|
-
isInteractive: () => false,
|
|
1393
|
-
};
|
|
1394
|
-
beforeEach(() => {
|
|
1395
|
-
vi.spyOn(ClearcutLogger.prototype, 'logExtensionUninstallEvent');
|
|
1396
|
-
});
|
|
1397
|
-
afterEach(() => {
|
|
1398
|
-
vi.clearAllMocks();
|
|
1399
|
-
});
|
|
1400
|
-
it('should log extension uninstall event', async () => {
|
|
1401
|
-
const event = new ExtensionUninstallEvent('testing', 'testing-hash', 'testing-id', 'success');
|
|
1402
|
-
await logExtensionUninstall(mockConfig, event);
|
|
1403
|
-
expect(ClearcutLogger.prototype.logExtensionUninstallEvent).toHaveBeenCalledWith(event);
|
|
1404
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1405
|
-
body: 'Uninstalled extension testing',
|
|
1406
|
-
attributes: {
|
|
1407
|
-
'session.id': 'test-session-id',
|
|
1408
|
-
'user.email': 'test-user@example.com',
|
|
1409
|
-
'installation.id': 'test-installation-id',
|
|
1410
|
-
'event.name': EVENT_EXTENSION_UNINSTALL,
|
|
1411
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1412
|
-
interactive: false,
|
|
1413
|
-
extension_name: 'testing',
|
|
1414
|
-
status: 'success',
|
|
1415
|
-
},
|
|
1416
|
-
});
|
|
1417
|
-
});
|
|
1418
|
-
});
|
|
1419
|
-
describe('logExtensionEnable', async () => {
|
|
1420
|
-
const mockConfig = {
|
|
1421
|
-
getSessionId: () => 'test-session-id',
|
|
1422
|
-
getUsageStatisticsEnabled: () => true,
|
|
1423
|
-
isInteractive: () => false,
|
|
1424
|
-
};
|
|
1425
|
-
beforeEach(() => {
|
|
1426
|
-
vi.spyOn(ClearcutLogger.prototype, 'logExtensionEnableEvent');
|
|
1427
|
-
});
|
|
1428
|
-
afterEach(() => {
|
|
1429
|
-
vi.clearAllMocks();
|
|
1430
|
-
});
|
|
1431
|
-
it('should log extension enable event', async () => {
|
|
1432
|
-
const event = new ExtensionEnableEvent('testing', 'testing-hash', 'testing-id', 'user');
|
|
1433
|
-
await logExtensionEnable(mockConfig, event);
|
|
1434
|
-
expect(ClearcutLogger.prototype.logExtensionEnableEvent).toHaveBeenCalledWith(event);
|
|
1435
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1436
|
-
body: 'Enabled extension testing',
|
|
1437
|
-
attributes: {
|
|
1438
|
-
'session.id': 'test-session-id',
|
|
1439
|
-
'user.email': 'test-user@example.com',
|
|
1440
|
-
'installation.id': 'test-installation-id',
|
|
1441
|
-
'event.name': EVENT_EXTENSION_ENABLE,
|
|
1442
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1443
|
-
interactive: false,
|
|
1444
|
-
extension_name: 'testing',
|
|
1445
|
-
setting_scope: 'user',
|
|
1446
|
-
},
|
|
1447
|
-
});
|
|
1448
|
-
});
|
|
1449
|
-
});
|
|
1450
|
-
describe('logExtensionDisable', () => {
|
|
1451
|
-
const mockConfig = {
|
|
1452
|
-
getSessionId: () => 'test-session-id',
|
|
1453
|
-
getUsageStatisticsEnabled: () => true,
|
|
1454
|
-
isInteractive: () => false,
|
|
1455
|
-
};
|
|
1456
|
-
beforeEach(() => {
|
|
1457
|
-
vi.spyOn(ClearcutLogger.prototype, 'logExtensionDisableEvent');
|
|
1458
|
-
});
|
|
1459
|
-
afterEach(() => {
|
|
1460
|
-
vi.clearAllMocks();
|
|
1461
|
-
});
|
|
1462
|
-
it('should log extension disable event', async () => {
|
|
1463
|
-
const event = new ExtensionDisableEvent('testing', 'testing-hash', 'testing-id', 'user');
|
|
1464
|
-
await logExtensionDisable(mockConfig, event);
|
|
1465
|
-
expect(ClearcutLogger.prototype.logExtensionDisableEvent).toHaveBeenCalledWith(event);
|
|
1466
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1467
|
-
body: 'Disabled extension testing',
|
|
1468
|
-
attributes: {
|
|
1469
|
-
'session.id': 'test-session-id',
|
|
1470
|
-
'user.email': 'test-user@example.com',
|
|
1471
|
-
'installation.id': 'test-installation-id',
|
|
1472
|
-
'event.name': EVENT_EXTENSION_DISABLE,
|
|
1473
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1474
|
-
interactive: false,
|
|
1475
|
-
extension_name: 'testing',
|
|
1476
|
-
setting_scope: 'user',
|
|
1477
|
-
},
|
|
1478
|
-
});
|
|
1479
|
-
});
|
|
1480
|
-
});
|
|
1481
|
-
describe('logAgentStart', () => {
|
|
1482
|
-
const mockConfig = {
|
|
1483
|
-
getSessionId: () => 'test-session-id',
|
|
1484
|
-
getUsageStatisticsEnabled: () => true,
|
|
1485
|
-
isInteractive: () => false,
|
|
1486
|
-
};
|
|
1487
|
-
beforeEach(() => {
|
|
1488
|
-
vi.spyOn(ClearcutLogger.prototype, 'logAgentStartEvent');
|
|
1489
|
-
});
|
|
1490
|
-
it('should log agent start event', () => {
|
|
1491
|
-
const event = new AgentStartEvent('agent-123', 'TestAgent');
|
|
1492
|
-
logAgentStart(mockConfig, event);
|
|
1493
|
-
expect(ClearcutLogger.prototype.logAgentStartEvent).toHaveBeenCalledWith(event);
|
|
1494
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1495
|
-
body: 'Agent TestAgent started. ID: agent-123',
|
|
1496
|
-
attributes: {
|
|
1497
|
-
'session.id': 'test-session-id',
|
|
1498
|
-
'user.email': 'test-user@example.com',
|
|
1499
|
-
'installation.id': 'test-installation-id',
|
|
1500
|
-
'event.name': EVENT_AGENT_START,
|
|
1501
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1502
|
-
interactive: false,
|
|
1503
|
-
agent_id: 'agent-123',
|
|
1504
|
-
agent_name: 'TestAgent',
|
|
1505
|
-
},
|
|
1506
|
-
});
|
|
1507
|
-
});
|
|
1508
|
-
});
|
|
1509
|
-
describe('logAgentFinish', () => {
|
|
1510
|
-
const mockConfig = {
|
|
1511
|
-
getSessionId: () => 'test-session-id',
|
|
1512
|
-
getUsageStatisticsEnabled: () => true,
|
|
1513
|
-
isInteractive: () => false,
|
|
1514
|
-
};
|
|
1515
|
-
beforeEach(() => {
|
|
1516
|
-
vi.spyOn(ClearcutLogger.prototype, 'logAgentFinishEvent');
|
|
1517
|
-
vi.spyOn(metrics, 'recordAgentRunMetrics');
|
|
1518
|
-
});
|
|
1519
|
-
it('should log agent finish event and record metrics', () => {
|
|
1520
|
-
const event = new AgentFinishEvent('agent-123', 'TestAgent', 1000, 5, AgentTerminateMode.GOAL);
|
|
1521
|
-
logAgentFinish(mockConfig, event);
|
|
1522
|
-
expect(ClearcutLogger.prototype.logAgentFinishEvent).toHaveBeenCalledWith(event);
|
|
1523
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1524
|
-
body: 'Agent TestAgent finished. Reason: GOAL. Duration: 1000ms. Turns: 5.',
|
|
1525
|
-
attributes: {
|
|
1526
|
-
'session.id': 'test-session-id',
|
|
1527
|
-
'user.email': 'test-user@example.com',
|
|
1528
|
-
'installation.id': 'test-installation-id',
|
|
1529
|
-
'event.name': EVENT_AGENT_FINISH,
|
|
1530
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1531
|
-
interactive: false,
|
|
1532
|
-
agent_id: 'agent-123',
|
|
1533
|
-
agent_name: 'TestAgent',
|
|
1534
|
-
duration_ms: 1000,
|
|
1535
|
-
turn_count: 5,
|
|
1536
|
-
terminate_reason: 'GOAL',
|
|
1537
|
-
},
|
|
1538
|
-
});
|
|
1539
|
-
expect(metrics.recordAgentRunMetrics).toHaveBeenCalledWith(mockConfig, event);
|
|
1540
|
-
});
|
|
1541
|
-
});
|
|
1542
|
-
describe('logWebFetchFallbackAttempt', () => {
|
|
1543
|
-
const mockConfig = {
|
|
1544
|
-
getSessionId: () => 'test-session-id',
|
|
1545
|
-
getUsageStatisticsEnabled: () => true,
|
|
1546
|
-
isInteractive: () => false,
|
|
1547
|
-
};
|
|
1548
|
-
beforeEach(() => {
|
|
1549
|
-
vi.spyOn(ClearcutLogger.prototype, 'logWebFetchFallbackAttemptEvent');
|
|
1550
|
-
});
|
|
1551
|
-
it('should log web fetch fallback attempt event', () => {
|
|
1552
|
-
const event = new WebFetchFallbackAttemptEvent('private_ip');
|
|
1553
|
-
logWebFetchFallbackAttempt(mockConfig, event);
|
|
1554
|
-
expect(ClearcutLogger.prototype.logWebFetchFallbackAttemptEvent).toHaveBeenCalledWith(event);
|
|
1555
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1556
|
-
body: 'Web fetch fallback attempt. Reason: private_ip',
|
|
1557
|
-
attributes: {
|
|
1558
|
-
'session.id': 'test-session-id',
|
|
1559
|
-
'user.email': 'test-user@example.com',
|
|
1560
|
-
'installation.id': 'test-installation-id',
|
|
1561
|
-
'event.name': EVENT_WEB_FETCH_FALLBACK_ATTEMPT,
|
|
1562
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1563
|
-
interactive: false,
|
|
1564
|
-
reason: 'private_ip',
|
|
1565
|
-
},
|
|
1566
|
-
});
|
|
1567
|
-
});
|
|
1568
|
-
});
|
|
1569
|
-
describe('logHookCall', () => {
|
|
1570
|
-
const mockConfig = {
|
|
1571
|
-
getSessionId: () => 'test-session-id',
|
|
1572
|
-
getUsageStatisticsEnabled: () => true,
|
|
1573
|
-
isInteractive: () => false,
|
|
1574
|
-
getTelemetryLogPromptsEnabled: () => false,
|
|
1575
|
-
};
|
|
1576
|
-
beforeEach(() => {
|
|
1577
|
-
vi.spyOn(ClearcutLogger.prototype, 'logHookCallEvent');
|
|
1578
|
-
vi.spyOn(metrics, 'recordHookCallMetrics');
|
|
1579
|
-
});
|
|
1580
|
-
it('should log hook call event to Clearcut and OTEL', () => {
|
|
1581
|
-
const event = new HookCallEvent('before-tool', 'command', '/path/to/script.sh', { arg: 'val' }, 150, true, { out: 'res' }, 0);
|
|
1582
|
-
logHookCall(mockConfig, event);
|
|
1583
|
-
expect(ClearcutLogger.prototype.logHookCallEvent).toHaveBeenCalledWith(event);
|
|
1584
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1585
|
-
body: 'Hook call before-tool./path/to/script.sh succeeded in 150ms',
|
|
1586
|
-
attributes: {
|
|
1587
|
-
'session.id': 'test-session-id',
|
|
1588
|
-
'user.email': 'test-user@example.com',
|
|
1589
|
-
'installation.id': 'test-installation-id',
|
|
1590
|
-
'event.name': EVENT_HOOK_CALL,
|
|
1591
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1592
|
-
interactive: false,
|
|
1593
|
-
hook_event_name: 'before-tool',
|
|
1594
|
-
hook_type: 'command',
|
|
1595
|
-
hook_name: 'script.sh', // Sanitized because logPrompts is false
|
|
1596
|
-
duration_ms: 150,
|
|
1597
|
-
success: true,
|
|
1598
|
-
exit_code: 0,
|
|
1599
|
-
},
|
|
1600
|
-
});
|
|
1601
|
-
expect(metrics.recordHookCallMetrics).toHaveBeenCalledWith(mockConfig, 'before-tool', '/path/to/script.sh', 150, true);
|
|
1602
|
-
});
|
|
1603
|
-
});
|
|
1604
|
-
describe('Telemetry Buffering', () => {
|
|
1605
|
-
it('should buffer events when SDK is not initialized', () => {
|
|
1606
|
-
vi.spyOn(sdk, 'isTelemetrySdkInitialized').mockReturnValue(false);
|
|
1607
|
-
const bufferSpy = vi
|
|
1608
|
-
.spyOn(sdk, 'bufferTelemetryEvent')
|
|
1609
|
-
.mockImplementation(() => { });
|
|
1610
|
-
const mockConfig = makeFakeConfig();
|
|
1611
|
-
const event = new StartSessionEvent(mockConfig);
|
|
1612
|
-
logCliConfiguration(mockConfig, event);
|
|
1613
|
-
expect(bufferSpy).toHaveBeenCalled();
|
|
1614
|
-
expect(mockLogger.emit).not.toHaveBeenCalled();
|
|
1615
|
-
});
|
|
1616
|
-
});
|
|
1617
|
-
});
|
|
1618
|
-
//# sourceMappingURL=loggers.test.js.map
|