@codingame/monaco-vscode-chat-service-override 34.1.3 → 35.0.0

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.
Files changed (427) hide show
  1. package/index.js +38 -0
  2. package/package.json +5 -5
  3. package/vscode/src/vs/platform/agentHost/browser/agentHost.config.contribution.d.ts +1 -0
  4. package/vscode/src/vs/platform/agentHost/browser/agentHost.config.contribution.js +40 -0
  5. package/vscode/src/vs/platform/agentHost/browser/agentHostConnectionsService.d.ts +27 -0
  6. package/vscode/src/vs/platform/agentHost/browser/agentHostConnectionsService.js +91 -0
  7. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.d.ts +20 -4
  8. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.js +148 -15
  9. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.d.ts +1 -0
  10. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +9 -1
  11. package/vscode/src/vs/platform/agentHost/common/agentHost.config.contribution.js +57 -3
  12. package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.d.ts +10 -14
  13. package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.js +29 -8
  14. package/vscode/src/vs/platform/agentHost/common/agentHostSchema.d.ts +109 -2
  15. package/vscode/src/vs/platform/agentHost/common/agentHostSchema.js +207 -21
  16. package/vscode/src/vs/platform/agentHost/common/agentHostStarter.config.contribution.js +362 -37
  17. package/vscode/src/vs/platform/agentHost/common/agentService.d.ts +698 -91
  18. package/vscode/src/vs/platform/agentHost/common/agentService.js +46 -3
  19. package/vscode/src/vs/platform/agentHost/common/customAgents.js +1 -0
  20. package/vscode/src/vs/platform/agentHost/common/resourceReadLogging.d.ts +1 -0
  21. package/vscode/src/vs/platform/agentHost/common/resourceReadLogging.js +26 -0
  22. package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.d.ts +5 -5
  23. package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.js +17 -17
  24. package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.d.ts +96 -12
  25. package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.js +226 -19
  26. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-annotations/reducer.d.ts +18 -0
  27. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-annotations/reducer.js +89 -0
  28. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-changeset/reducer.js +10 -0
  29. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-chat/reducer.d.ts +6 -0
  30. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-chat/reducer.js +400 -0
  31. package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-session/reducer.js +129 -446
  32. package/vscode/src/vs/platform/agentHost/common/state/protocol/common/reducer-helpers.d.ts +2 -2
  33. package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.d.ts +1 -1
  34. package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.js +1 -1
  35. package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +35 -25
  36. package/vscode/src/vs/platform/agentHost/common/state/sessionActions.js +7 -1
  37. package/vscode/src/vs/{workbench/contrib → platform}/browserView/common/browserChatToolReferenceNames.d.ts +4 -0
  38. package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +1 -1
  39. package/vscode/src/vs/platform/sandbox/browser/sandboxHelperService.js +1 -0
  40. package/vscode/src/vs/platform/sandbox/common/terminalSandboxCommandRules.d.ts +0 -6
  41. package/vscode/src/vs/platform/sandbox/common/terminalSandboxCommandRules.js +5 -18
  42. package/vscode/src/vs/platform/sandbox/common/terminalSandboxEngine.d.ts +52 -3
  43. package/vscode/src/vs/platform/sandbox/common/terminalSandboxEngine.js +212 -34
  44. package/vscode/src/vs/platform/sandbox/common/terminalSandboxReadAllowList.js +3 -4
  45. package/vscode/src/vs/platform/sandbox/common/terminalSandboxRuntimeConfigurationPerOperation.js +11 -10
  46. package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.d.ts +13 -6
  47. package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.js +6 -1
  48. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.d.ts +2 -0
  49. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.js +399 -0
  50. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.d.ts +20 -0
  51. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.js +85 -0
  52. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.d.ts +177 -0
  53. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.js +898 -0
  54. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.d.ts +24 -0
  55. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +204 -0
  56. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.d.ts +61 -0
  57. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.js +338 -0
  58. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.d.ts +10 -0
  59. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.js +57 -0
  60. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.d.ts +33 -0
  61. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.js +98 -0
  62. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.d.ts +30 -0
  63. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.js +149 -0
  64. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.d.ts +12 -0
  65. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.js +116 -0
  66. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.d.ts +32 -0
  67. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.js +226 -0
  68. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.d.ts +18 -0
  69. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.js +138 -0
  70. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.d.ts +26 -0
  71. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.js +25 -0
  72. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.d.ts +13 -0
  73. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.js +108 -0
  74. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.d.ts +13 -0
  75. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.js +63 -0
  76. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.d.ts +1 -0
  77. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.js +178 -0
  78. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.d.ts +47 -0
  79. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.js +322 -0
  80. package/vscode/src/vs/workbench/contrib/agentsVoice/common/agentsVoice.d.ts +15 -0
  81. package/vscode/src/vs/workbench/contrib/agentsVoice/common/agentsVoice.js +15 -0
  82. package/vscode/src/vs/workbench/contrib/agentsVoice/common/agentsVoiceColors.d.ts +2 -0
  83. package/vscode/src/vs/workbench/contrib/agentsVoice/common/agentsVoiceColors.js +26 -0
  84. package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.d.ts +132 -0
  85. package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.js +237 -0
  86. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +2 -2
  87. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.d.ts +2 -2
  88. package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +32 -16
  89. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +8 -8
  90. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +1 -1
  91. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +71 -60
  92. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
  93. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +6 -1
  94. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +15 -15
  95. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +8 -8
  96. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +7 -7
  97. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +19 -24
  98. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
  99. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.d.ts +9 -0
  100. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.js +14 -5
  101. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
  102. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
  103. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
  104. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +14 -14
  105. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +13 -13
  106. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +66 -52
  107. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
  108. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +15 -36
  109. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
  110. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +19 -19
  111. package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +20 -20
  112. package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.d.ts +1 -1
  113. package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.js +128 -13
  114. package/vscode/src/vs/workbench/contrib/chat/browser/actions/openCopilotCliStateFileAction.js +6 -6
  115. package/vscode/src/vs/workbench/contrib/chat/browser/actions/reviewEdits.js +1 -1
  116. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.js +10 -10
  117. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +2 -2
  118. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +2 -2
  119. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +1 -0
  120. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +58 -9
  121. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +13 -13
  122. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.d.ts +15 -3
  123. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.js +64 -17
  124. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.d.ts +45 -1
  125. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.js +15 -0
  126. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.d.ts +25 -5
  127. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.js +143 -20
  128. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModeSynchronizer.js +7 -31
  129. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostNewSessionFolderService.d.ts +23 -0
  130. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostNewSessionFolderService.js +52 -0
  131. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +5 -5
  132. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolSetEnablementService.d.ts +47 -0
  133. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolSetEnablementService.js +163 -0
  134. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.d.ts +26 -3
  135. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.js +106 -8
  136. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.d.ts +16 -3
  137. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.js +44 -14
  138. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +3 -3
  139. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +70 -59
  140. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +5 -5
  141. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +1 -1
  142. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +1 -1
  143. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +4 -4
  144. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
  145. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +4 -4
  146. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +22 -22
  147. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +17 -17
  148. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
  149. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentDisabledInputTipContribution.d.ts +27 -0
  150. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentDisabledInputTipContribution.js +152 -0
  151. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.js +11 -5
  152. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +1 -1
  153. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +9 -36
  154. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +8 -0
  155. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +17 -15
  156. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +143 -0
  157. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +30 -0
  158. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.d.ts +6 -3
  159. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +3 -1
  160. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +1 -3
  161. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +107 -126
  162. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +46 -46
  163. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +19 -22
  164. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +244 -190
  165. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.d.ts +2 -0
  166. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +13 -1
  167. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.d.ts +3 -1
  168. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.js +7 -2
  169. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.d.ts +5 -1
  170. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.js +47 -28
  171. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.d.ts +2 -5
  172. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.js +4 -8
  173. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/automationsListWidget.d.ts +87 -0
  174. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/automationsListWidget.js +772 -0
  175. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.d.ts +24 -8
  176. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.js +3 -8
  177. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +1 -7
  178. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.js +2 -2
  179. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedExtensionToolsDetail.d.ts +42 -0
  180. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedExtensionToolsDetail.js +130 -0
  181. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.js +3 -3
  182. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/galleryItemRenderer.d.ts +46 -0
  183. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/galleryItemRenderer.js +94 -0
  184. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +9 -1
  185. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +421 -201
  186. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +1426 -97
  187. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationWelcomePromptLaunchers.css +1 -1
  188. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +1 -0
  189. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +107 -127
  190. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +29 -0
  191. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.js +331 -0
  192. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/toolsListWidget.d.ts +120 -0
  193. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/toolsListWidget.js +898 -0
  194. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +1 -1
  195. package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +581 -336
  196. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.d.ts +123 -0
  197. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.js +567 -0
  198. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +32 -32
  199. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheDiff.js +168 -84
  200. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.d.ts +183 -2
  201. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.js +897 -251
  202. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheInsights.d.ts +213 -0
  203. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheInsights.js +720 -0
  204. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +6 -6
  205. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
  206. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +20 -20
  207. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +7 -7
  208. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +4 -4
  209. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +7 -7
  210. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +22 -22
  211. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +13 -13
  212. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
  213. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +24 -24
  214. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +8 -8
  215. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +23 -23
  216. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +33 -33
  217. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
  218. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/media/chatDebug.css +354 -1
  219. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.js +9 -2
  220. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +1 -1
  221. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingDeletedFileEntry.js +1 -1
  222. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
  223. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
  224. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +3 -3
  225. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
  226. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +11 -4
  227. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +1 -1
  228. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +1 -1
  229. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +4 -4
  230. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +3 -3
  231. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +1 -1
  232. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
  233. package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.d.ts +9 -3
  234. package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +55 -8
  235. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +8 -8
  236. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +2 -2
  237. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +18 -1
  238. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +192 -87
  239. package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +37 -3
  240. package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +4 -4
  241. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +30 -30
  242. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.d.ts +40 -1
  243. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.js +230 -41
  244. package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
  245. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseFileChangesService.d.ts +30 -0
  246. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseFileChangesService.js +29 -0
  247. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +23 -25
  248. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +10 -10
  249. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +6 -6
  250. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +35 -32
  251. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +26 -2
  252. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +56 -32
  253. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +19 -19
  254. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +0 -1
  255. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +109 -68
  256. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.d.ts +38 -5
  257. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +175 -50
  258. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +4 -0
  259. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +19 -19
  260. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +2 -2
  261. package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +4 -4
  262. package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
  263. package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContext.contribution.js +5 -5
  264. package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +5 -5
  265. package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.js +4 -4
  266. package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
  267. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +1 -1
  268. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorActions.js +4 -4
  269. package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorContribution.js +5 -5
  270. package/vscode/src/vs/workbench/contrib/chat/browser/pluginAutoUpdate.d.ts +4 -5
  271. package/vscode/src/vs/workbench/contrib/chat/browser/pluginAutoUpdate.js +1 -1
  272. package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +3 -3
  273. package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +32 -3
  274. package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +183 -84
  275. package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +15 -15
  276. package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.d.ts +3 -1
  277. package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +20 -9
  278. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +6 -6
  279. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +27 -27
  280. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +3 -3
  281. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
  282. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolSetsCodeLensProvider.d.ts +1 -0
  283. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolSetsCodeLensProvider.js +109 -0
  284. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +2 -2
  285. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
  286. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +7 -7
  287. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
  288. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +3 -3
  289. package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +20 -20
  290. package/vscode/src/vs/workbench/contrib/chat/browser/tools/clientToolSetsContribution.d.ts +17 -0
  291. package/vscode/src/vs/workbench/contrib/chat/browser/tools/clientToolSetsContribution.js +117 -0
  292. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +39 -39
  293. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.d.ts +40 -4
  294. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +169 -34
  295. package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +7 -7
  296. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.d.ts +5 -1
  297. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +2 -2
  298. package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +8 -8
  299. package/vscode/src/vs/workbench/contrib/chat/browser/utilityModelContribution.js +2 -2
  300. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
  301. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/micCaptureService.d.ts +125 -0
  302. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/micCaptureService.js +399 -0
  303. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.d.ts +34 -0
  304. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.js +198 -0
  305. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.d.ts +85 -0
  306. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.js +504 -0
  307. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceSessionController.d.ts +321 -0
  308. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceSessionController.js +2117 -0
  309. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceToolDispatchService.d.ts +57 -0
  310. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceToolDispatchService.js +367 -0
  311. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +16 -12
  312. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.d.ts +2 -0
  313. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +68 -18
  314. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +11 -10
  315. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +2 -2
  316. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +1 -1
  317. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +1 -1
  318. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.d.ts +7 -0
  319. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +13 -2
  320. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +23 -5
  321. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +320 -40
  322. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +2 -2
  323. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatViewPane.css +80 -4
  324. package/vscode/src/vs/workbench/contrib/chat/common/automations/automation.d.ts +78 -0
  325. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationDialogService.d.ts +13 -0
  326. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationDialogService.service.d.ts +11 -0
  327. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationDialogService.service.js +6 -0
  328. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationRunner.service.d.ts +16 -0
  329. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationRunner.service.js +6 -0
  330. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationService.d.ts +46 -0
  331. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationService.service.d.ts +36 -0
  332. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationService.service.js +6 -0
  333. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationsEnabled.d.ts +12 -0
  334. package/vscode/src/vs/workbench/contrib/chat/common/automations/automationsEnabled.js +6 -0
  335. package/vscode/src/vs/workbench/contrib/chat/common/automations/schedule.d.ts +9 -0
  336. package/vscode/src/vs/workbench/contrib/chat/common/automations/schedule.js +6 -0
  337. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +2 -0
  338. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +7 -1
  339. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +28 -0
  340. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +226 -88
  341. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.d.ts +6 -0
  342. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.js +8 -3
  343. package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +13 -2
  344. package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +12 -8
  345. package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.d.ts +5 -0
  346. package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.js +5 -2
  347. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +15 -0
  348. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +177 -0
  349. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +2 -18
  350. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +78 -136
  351. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +1 -16
  352. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +1 -17
  353. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +2 -0
  354. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +16 -5
  355. package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.d.ts +31 -0
  356. package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.js +122 -0
  357. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +24 -18
  358. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.d.ts +3 -0
  359. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +113 -10
  360. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +5 -5
  361. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +12 -12
  362. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +10 -0
  363. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +227 -152
  364. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
  365. package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.d.ts +26 -0
  366. package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.js +98 -0
  367. package/vscode/src/vs/workbench/contrib/chat/common/workingDirectory.d.ts +5 -0
  368. package/vscode/src/vs/workbench/contrib/chat/common/workingDirectory.js +7 -6
  369. package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarousel.contribution.js +11 -12
  370. package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditor.js +10 -10
  371. package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditorInput.d.ts +2 -0
  372. package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditorInput.js +7 -0
  373. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +15 -15
  374. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +2 -2
  375. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +4 -4
  376. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +14 -14
  377. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +1 -1
  378. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +10 -10
  379. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +5 -5
  380. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
  381. package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
  382. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
  383. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +32 -20
  384. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +1 -1
  385. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/agentHostSandboxForwarder.d.ts +23 -5
  386. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/agentHostSandboxForwarder.js +37 -30
  387. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +7 -0
  388. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +7 -0
  389. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +7 -0
  390. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/largeOutputFileWriter.d.ts +33 -0
  391. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/largeOutputFileWriter.js +71 -0
  392. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.d.ts +19 -0
  393. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +29 -9
  394. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +7 -20
  395. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +4 -4
  396. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +2 -1
  397. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +1 -1
  398. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +12 -12
  399. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +10 -8
  400. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
  401. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +4 -4
  402. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
  403. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +3 -3
  404. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +3 -3
  405. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +26 -2
  406. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +32 -3
  407. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +416 -252
  408. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.d.ts +1 -1
  409. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +3 -2
  410. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +10 -10
  411. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +14 -14
  412. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +7 -7
  413. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +14 -14
  414. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
  415. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/sandboxSettingsReader.d.ts +2 -3
  416. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/sandboxSettingsReader.js +5 -5
  417. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +6 -2
  418. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +25 -8
  419. package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.d.ts +8 -3
  420. package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.js +15 -0
  421. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +0 -20
  422. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +0 -77
  423. package/vscode/src/vs/workbench/contrib/chat/browser/copilotCliEventsUri.d.ts +0 -52
  424. package/vscode/src/vs/workbench/contrib/chat/browser/copilotCliEventsUri.js +0 -82
  425. package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.d.ts +0 -38
  426. package/vscode/src/vs/workbench/contrib/chat/common/chatSelectedModel.js +0 -47
  427. /package/vscode/src/vs/{workbench/contrib → platform}/browserView/common/browserChatToolReferenceNames.js +0 -0
@@ -0,0 +1,2117 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Disposable, DisposableStore, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
5
+ import { disposableWindowInterval } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
6
+ import { disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
7
+ import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
8
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
9
+ import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
10
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
11
+ import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
12
+ import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
13
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
14
+ import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
15
+ import { IVoiceTranscriptStore } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.service';
16
+ import { IVoiceClientService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/voiceClient/voiceClientService.service';
17
+ import { IMicCaptureService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/voiceClient/micCaptureService.service';
18
+ import { ITtsPlaybackService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.service';
19
+ import { VoiceToolDispatchService } from './voiceToolDispatchService.js';
20
+ import { IVoiceToolDispatchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/voiceClient/voiceToolDispatchService.service';
21
+ import { IVoicePlaybackService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/voicePlaybackService.service';
22
+ import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
23
+ import '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel';
24
+ import { IChatToolInvocation, ToolConfirmKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService';
25
+ import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
26
+ import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
27
+ import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
28
+ import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
29
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
30
+ import { AccessibilitySignal } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
31
+ import { IAccessibilitySignalService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
32
+ import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
33
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
34
+ import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
35
+ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
36
+ import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
37
+ import { ChatSessionStatus } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
38
+ import { observableSignalFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignalFromEvent';
39
+
40
+ var VoiceSessionController_1;
41
+ let VoiceSessionController = class VoiceSessionController extends Disposable {
42
+ static {
43
+ VoiceSessionController_1 = this;
44
+ }
45
+ static {
46
+ this._MAX_TURNS = 2;
47
+ }
48
+ static {
49
+ this._PTT_MAX_DURATION_MS = 5 * 60 * 1000;
50
+ }
51
+ static {
52
+ this._PTT_TOGGLE_THRESHOLD_MS = 300;
53
+ }
54
+ static {
55
+ this._AUTO_LISTEN_QUIET_MS = 1200;
56
+ }
57
+ static {
58
+ this._USER_CANCEL_SUPPRESS_MS = 10_000;
59
+ }
60
+ static {
61
+ this._CONFIRMATION_FLUSH_DELAY_MS = 1500;
62
+ }
63
+ static {
64
+ this.PRIOR_TIMELINE_ENTRY_LIMIT = 30;
65
+ }
66
+ static {
67
+ this.CODING_AGENT_REPLY_SENTENCE_LIMIT = 2;
68
+ }
69
+ constructor(
70
+ voiceClientService,
71
+ micCaptureService,
72
+ ttsPlaybackService,
73
+ voiceToolDispatchService,
74
+ voicePlaybackService,
75
+ agentSessionsService,
76
+ chatService,
77
+ commandService,
78
+ authenticationService,
79
+ voiceTranscriptStore,
80
+ logService,
81
+ environmentService,
82
+ telemetryService,
83
+ configurationService,
84
+ accessibilitySignalService,
85
+ accessibilityService
86
+ ) {
87
+ super();
88
+ this.voiceClientService = voiceClientService;
89
+ this.micCaptureService = micCaptureService;
90
+ this.ttsPlaybackService = ttsPlaybackService;
91
+ this.voiceToolDispatchService = voiceToolDispatchService;
92
+ this.voicePlaybackService = voicePlaybackService;
93
+ this.agentSessionsService = agentSessionsService;
94
+ this.chatService = chatService;
95
+ this.commandService = commandService;
96
+ this.authenticationService = authenticationService;
97
+ this.voiceTranscriptStore = voiceTranscriptStore;
98
+ this.logService = logService;
99
+ this.environmentService = environmentService;
100
+ this.telemetryService = telemetryService;
101
+ this.configurationService = configurationService;
102
+ this.accessibilitySignalService = accessibilitySignalService;
103
+ this.accessibilityService = accessibilityService;
104
+ this._voiceState = observableValue(this, "idle");
105
+ this.voiceState = this._voiceState;
106
+ this._statusText = observableValue(this, "Tap to start");
107
+ this.statusText = this._statusText;
108
+ this._transcriptTurns = observableValue(this, []);
109
+ this.transcriptTurns = this._transcriptTurns;
110
+ this._isConnected = observableValue(this, false);
111
+ this.isConnected = this._isConnected;
112
+ this._isConnecting = observableValue(this, false);
113
+ this.isConnecting = this._isConnecting;
114
+ this._isReconnecting = observableValue(this, false);
115
+ this.isReconnecting = this._isReconnecting;
116
+ this._pendingToolConfirmations = observableValue(this, []);
117
+ this.pendingToolConfirmations = this._pendingToolConfirmations;
118
+ this._targetSession = observableValue(this, undefined);
119
+ this.targetSession = this._targetSession;
120
+ this._pttHeld = false;
121
+ this._pttToggleMode = false;
122
+ this._pttCurrentTurnId = "";
123
+ this._voiceEventDisposables = this._register(( new DisposableStore()));
124
+ this._voiceAutorunDisposable = this._register(( new MutableDisposable()));
125
+ this._autoApprovedSessions = ( new Set());
126
+ this._pttWaitingForPlayback = false;
127
+ this._replyPlayedSinceSend = false;
128
+ this._awaitingReplyAudio = false;
129
+ this._autoListenAfterGreeting = false;
130
+ this._hasPlayedInitialListenCue = false;
131
+ this._audioQueue = [];
132
+ this._currentPlaybackSessionId = null;
133
+ this._isProcessingQueue = false;
134
+ this._suppressIncomingAudio = false;
135
+ this._sessionAudioCache = ( new Map());
136
+ this._prevSessionStates = ( new Map());
137
+ this._userCancelledSessions = ( new Map());
138
+ this._confirmationFlushWatchdogs = ( new Map());
139
+ this._eagerModelRefs = ( new Map());
140
+ this._eagerModelLoading = ( new Set());
141
+ this._pendingIdleNarration = ( new Set());
142
+ this._telemetrySessionIndex = 0;
143
+ this._telemetryTurnCount = 0;
144
+ this._telemetryReconnectCount = 0;
145
+ this._telemetryFirstConnect = true;
146
+ this._telemetryTtsInterrupted = false;
147
+ this._pendingPriorTimeline = [];
148
+ this.voiceToolDispatchService.setDelegate({
149
+ acceptInput: text => {
150
+ this.commandService.executeCommand("_chat.voice.acceptInput", text).catch(err => {
151
+ this.logService.warn("[voice] acceptInput delegate failed:", err);
152
+ });
153
+ return true;
154
+ },
155
+ getCurrentSessionResource: async () => {
156
+ const resourceStr = await this.commandService.executeCommand("_chat.voice.getCurrentSession").catch(() => undefined);
157
+ return resourceStr ? ( URI.parse(resourceStr)) : undefined;
158
+ },
159
+ switchToSession: resource => {
160
+ this.commandService.executeCommand("_chat.voice.switchToSession", ( resource.toString()));
161
+ },
162
+ getAutoApprovedSessions: () => {
163
+ return this._autoApprovedSessions;
164
+ },
165
+ addAllAutoApprovedSessions: () => {
166
+ const sessions = this.agentSessionsService.model.sessions.filter(s => !s.isArchived());
167
+ for (const s of sessions) {
168
+ this._autoApprovedSessions.add(( s.resource.toString()));
169
+ const model = this.chatService.getSession(s.resource);
170
+ if (model) {
171
+ for (const req of model.getRequests()) {
172
+ const pending = req.response?.isPendingConfirmation.get();
173
+ if (pending && req.response) {
174
+ for (const part of req.response.response.value) {
175
+ if (part.kind === "toolInvocation") {
176
+ IChatToolInvocation.confirmWith(part, {
177
+ type: ToolConfirmKind.UserAction
178
+ });
179
+ }
180
+ }
181
+ }
182
+ }
183
+ }
184
+ }
185
+ },
186
+ removeAutoApprovedSession: resource => {
187
+ this._autoApprovedSessions.delete(resource);
188
+ },
189
+ triggerAutoApproveCheck: () => {
190
+ this._autoApproveCheck();
191
+ }
192
+ });
193
+ this._register(autorun(reader => {
194
+ const agentSessions = this.agentSessionsService.model.sessions.filter(s => !s.isArchived());
195
+ const toolConfirmations = [];
196
+ const processedResources = ( new Set());
197
+ const modelsToCheck = [];
198
+ for (const s of agentSessions) {
199
+ processedResources.add(( s.resource.toString()));
200
+ const model = this.chatService.getSession(s.resource);
201
+ if (model) {
202
+ modelsToCheck.push({
203
+ model,
204
+ resource: s.resource,
205
+ label: s.label || "Untitled session"
206
+ });
207
+ }
208
+ }
209
+ for (const chatModel of this.chatService.chatModels.read(reader)) {
210
+ const key = ( chatModel.sessionResource.toString());
211
+ if (( processedResources.has(key))) {
212
+ continue;
213
+ }
214
+ if (chatModel.getRequests().length === 0) {
215
+ continue;
216
+ }
217
+ processedResources.add(key);
218
+ modelsToCheck.push({
219
+ model: chatModel,
220
+ resource: chatModel.sessionResource,
221
+ label: chatModel.title || "Chat"
222
+ });
223
+ }
224
+ for (const {
225
+ model,
226
+ resource,
227
+ label
228
+ } of modelsToCheck) {
229
+ const lastReq = model.lastRequestObs.read(reader);
230
+ if (lastReq?.response) {
231
+ const pending = lastReq.response.isPendingConfirmation.read(reader);
232
+ if (pending && !( this._autoApprovedSessions.has(( resource.toString())))) {
233
+ const confirmType = this._classifyPendingType(lastReq.response);
234
+ const desc = this._getConfirmationDescription(lastReq.response);
235
+ toolConfirmations.push({
236
+ type: confirmType,
237
+ sessionLabel: label,
238
+ sessionResource: resource,
239
+ description: desc || pending.detail || (confirmType === "input" ? "Needs your input" : "Needs approval"),
240
+ approve: () => {
241
+ if (lastReq.response) {
242
+ for (const part of lastReq.response.response.value) {
243
+ if (part.kind === "toolInvocation") {
244
+ IChatToolInvocation.confirmWith(part, {
245
+ type: ToolConfirmKind.UserAction
246
+ });
247
+ }
248
+ }
249
+ }
250
+ },
251
+ deny: () => {
252
+ if (lastReq.response) {
253
+ for (const part of lastReq.response.response.value) {
254
+ if (part.kind === "toolInvocation") {
255
+ IChatToolInvocation.confirmWith(part, {
256
+ type: ToolConfirmKind.Denied
257
+ });
258
+ }
259
+ }
260
+ }
261
+ }
262
+ });
263
+ }
264
+ if (!pending && !( this._autoApprovedSessions.has(( resource.toString())))) {
265
+ for (const part of lastReq.response.response.value) {
266
+ if (part.kind === "toolInvocation") {
267
+ const toolState = part.state.read(reader);
268
+ if (toolState.type === IChatToolInvocation.StateKind.WaitingForConfirmation) {
269
+ const params = toolState.parameters;
270
+ const questions = params?.["questions"];
271
+ let desc = "";
272
+ if (Array.isArray(questions) && questions.length > 0) {
273
+ desc = ( questions.map(q => {
274
+ const title = q["header"] || q["question"];
275
+ if (!title) {
276
+ return "";
277
+ }
278
+ const options = q["options"];
279
+ if (Array.isArray(options) && options.length > 0) {
280
+ const labels = ( options.map(o => o["label"])).filter(Boolean);
281
+ if (labels.length > 0) {
282
+ return `${title}: ${labels.join(", ")}`;
283
+ }
284
+ }
285
+ return title;
286
+ })).filter(Boolean).join("; ");
287
+ }
288
+ toolConfirmations.push({
289
+ type: "input",
290
+ sessionLabel: label,
291
+ sessionResource: resource,
292
+ description: desc || "Needs your input",
293
+ approve: () => {
294
+ IChatToolInvocation.confirmWith(part, {
295
+ type: ToolConfirmKind.UserAction
296
+ });
297
+ },
298
+ deny: () => {
299
+ IChatToolInvocation.confirmWith(part, {
300
+ type: ToolConfirmKind.Denied
301
+ });
302
+ }
303
+ });
304
+ break;
305
+ }
306
+ }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ this._pendingToolConfirmations.set(toolConfirmations, undefined);
312
+ }));
313
+ this._register(
314
+ CommandsRegistry.registerCommand("_chat.voicePlayback.replay", (_accessor, payload) => {
315
+ const sessionId = payload?.sessionId;
316
+ if (!sessionId) {
317
+ return;
318
+ }
319
+ this._replaySessionAudio(sessionId);
320
+ })
321
+ );
322
+ this._register(
323
+ CommandsRegistry.registerCommand("_chat.voicePlayback.stop", (_accessor, payload) => {
324
+ this._stopReplay();
325
+ if (payload?.sessionId) {
326
+ this.voicePlaybackService.notifyPlaybackEnd(( URI.parse(payload.sessionId)));
327
+ }
328
+ })
329
+ );
330
+ this._register({
331
+ dispose: () => this.disconnect()
332
+ });
333
+ }
334
+ async connect(window) {
335
+ if (this._isConnecting.get() || this._isConnected.get()) {
336
+ return;
337
+ }
338
+ this._window = window;
339
+ this._isConnecting.set(true, undefined);
340
+ this._statusText.set("Connecting...", undefined);
341
+ this._voiceState.set("idle", undefined);
342
+ this._telemetryConnectStartMs = Date.now();
343
+ let authToken;
344
+ try {
345
+ const sessions = await this.authenticationService.getSessions("github");
346
+ this._userLogin = sessions[0]?.account.label;
347
+ authToken = sessions[0]?.accessToken;
348
+ if (!this._userLogin) {
349
+ this.logService.warn("[voice] no GitHub session found; transcripts will not be persisted");
350
+ } else {
351
+ const lastTurn = (await this.voiceTranscriptStore.loadTurns(this._userLogin, {
352
+ limit: 1
353
+ }))[0];
354
+ this._lastPersistedTurnId = lastTurn?.turnId;
355
+ try {
356
+ const recent = await this.voiceTranscriptStore.loadTurns(this._userLogin, {
357
+ limit: VoiceSessionController_1.PRIOR_TIMELINE_ENTRY_LIMIT
358
+ });
359
+ this._pendingPriorTimeline = this._buildPriorTimeline(recent);
360
+ } catch (err) {
361
+ this.logService.warn("[voice] failed to load prior timeline entries for context", err);
362
+ this._pendingPriorTimeline = [];
363
+ }
364
+ }
365
+ } catch (err) {
366
+ this.logService.warn("[voice] failed to resolve GitHub session", err);
367
+ }
368
+ this._voiceEventDisposables.clear();
369
+ this._voiceEventDisposables.add(this.micCaptureService.onPttStart(() => {
370
+ this.voiceClientService.sendPttStart(this._pttCurrentTurnId);
371
+ }));
372
+ this._voiceEventDisposables.add(this.micCaptureService.onPttAudioChunk(b64 => {
373
+ this.voiceClientService.sendPttAudioChunk(b64);
374
+ }));
375
+ this._voiceEventDisposables.add(this.micCaptureService.onPttEnd(() => {
376
+ this.voiceClientService.sendPttEnd();
377
+ }));
378
+ this._voiceEventDisposables.add(this.micCaptureService.onPttDiagnostic(diag => {
379
+ this.logService.info(
380
+ `[voice] ptt.diagnostic turn_id=${diag.turnId} ` + `msHeld=${diag.msHeld} chunksSent=${diag.chunksSent} samplesSent=${diag.samplesSent} ` + `drainFired=${diag.drainFired} drainChunks=${diag.drainChunks} drainSamples=${diag.drainSamples} drainWindowMs=${diag.drainWindowMs} ` + `drainSkippedByMute=${diag.drainSkippedByMute} drainSkippedBySuppression=${diag.drainSkippedBySuppression} ` + `postReleaseCallbacks=${diag.postReleaseCallbacks} postReleaseSamples=${diag.postReleaseSamples} ` + `postReleaseSkippedByMute=${diag.postReleaseSkippedByMute} postReleaseSkippedBySuppression=${diag.postReleaseSkippedBySuppression} ` + `postReleaseWindowMs=${diag.postReleaseWindowMs} ` + `releasedDuringAcquire=${diag.releasedDuringAcquire} pttUpWithoutCapture=${diag.pttUpWithoutCapture}`
381
+ );
382
+ this.voiceClientService.sendPttDiagnostic(diag.turnId, {
383
+ ms_held: diag.msHeld,
384
+ chunks_sent: diag.chunksSent,
385
+ samples_sent: diag.samplesSent,
386
+ drain_fired: diag.drainFired,
387
+ drain_chunks: diag.drainChunks,
388
+ drain_samples: diag.drainSamples,
389
+ drain_window_ms: diag.drainWindowMs,
390
+ drain_skipped_by_mute: diag.drainSkippedByMute,
391
+ drain_skipped_by_suppression: diag.drainSkippedBySuppression,
392
+ post_release_callbacks: diag.postReleaseCallbacks,
393
+ post_release_samples: diag.postReleaseSamples,
394
+ post_release_skipped_by_mute: diag.postReleaseSkippedByMute,
395
+ post_release_skipped_by_suppression: diag.postReleaseSkippedBySuppression,
396
+ post_release_window_ms: diag.postReleaseWindowMs,
397
+ released_during_acquire: diag.releasedDuringAcquire,
398
+ ptt_up_without_capture: diag.pttUpWithoutCapture
399
+ });
400
+ }));
401
+ this._voiceEventDisposables.add(this.ttsPlaybackService.onPlaybackStopped(() => {
402
+ const listenedToEnd = !this._telemetryTtsInterrupted;
403
+ this.telemetryService.publicLog2("voiceTtsListenThrough", {
404
+ listenedToEnd,
405
+ listenedPct: listenedToEnd ? 100 : 50
406
+ });
407
+ this._telemetryTtsInterrupted = false;
408
+ const finishedSessionId = this._currentPlaybackSessionId;
409
+ const samples = this.ttsPlaybackService.getLastPlayedSamples();
410
+ if (samples && finishedSessionId !== null) {
411
+ const cacheKey = finishedSessionId ?? "__generic__";
412
+ this._sessionAudioCache.set(cacheKey, samples);
413
+ }
414
+ this.voicePlaybackService.notifyPlaybackEnd(undefined);
415
+ this._currentPlaybackSessionId = null;
416
+ if (this._audioQueue.length > 0) {
417
+ setTimeout(() => this._processQueue(), 500);
418
+ } else {
419
+ if (this._pttHeld) {
420
+ this._voiceState.set("listening", undefined);
421
+ this._statusText.set("Listening...", undefined);
422
+ } else {
423
+ this._voiceState.set("idle", undefined);
424
+ this._statusText.set("Hold to speak...", undefined);
425
+ if (this._pttWaitingForPlayback) {
426
+ this._scheduleDelayedMicStop();
427
+ }
428
+ if (this._isAutoSendEnabled() && !this._awaitingReplyAudio) {
429
+ if (this._autoListenAfterGreeting) {
430
+ this._autoListenAfterGreeting = false;
431
+ this._enterAutoListen();
432
+ } else if (this._replyPlayedSinceSend) {
433
+ this._scheduleAutoListen();
434
+ }
435
+ }
436
+ }
437
+ }
438
+ }));
439
+ this._voiceEventDisposables.add(this.voiceClientService.onDidChangeConnectionState(async connected => {
440
+ if (connected) {
441
+ const pbCtx = this.ttsPlaybackService.ensureContext(window);
442
+ pbCtx.resume();
443
+ const isResuming = this.voiceClientService.isResuming;
444
+ const now = Date.now();
445
+ const connectMs = this._telemetryConnectStartMs ? now - this._telemetryConnectStartMs : 0;
446
+ if (this._telemetryFirstConnect) {
447
+ this._telemetryFirstConnect = false;
448
+ this.telemetryService.publicLog2("voiceFirstConnect", {
449
+ timeToConnectMs: connectMs
450
+ });
451
+ }
452
+ if (isResuming) {
453
+ this._telemetryReconnectCount++;
454
+ const secSinceLast = this._telemetryLastConnectMs ? Math.round((now - this._telemetryLastConnectMs) / 1000) : 0;
455
+ this.telemetryService.publicLog2("voiceReconnect", {
456
+ timeSinceLastConnectSec: secSinceLast
457
+ });
458
+ } else {
459
+ this._telemetrySessionIndex++;
460
+ this._telemetrySessionStart = now;
461
+ this._telemetryTurnCount = 0;
462
+ this._telemetryReconnectCount = 0;
463
+ this.telemetryService.publicLog2("voiceSessionStarted", {
464
+ sessionIndex: this._telemetrySessionIndex
465
+ });
466
+ }
467
+ this._telemetryLastConnectMs = now;
468
+ if (isResuming) {
469
+ this.voiceClientService.sendResumeSession(this._buildSessionContext(), this._getMachineId());
470
+ } else {
471
+ const priorTimeline = this._pendingPriorTimeline;
472
+ this._pendingPriorTimeline = [];
473
+ this.voiceClientService.sendStartSession(this._buildSessionContext(), this._getMachineId(), priorTimeline);
474
+ }
475
+ if (isResuming) {
476
+ this.micCaptureService.stopCapture();
477
+ }
478
+ this.micCaptureService.prepare(window);
479
+ transaction(tx => {
480
+ this._isConnecting.set(false, tx);
481
+ this._isReconnecting.set(false, tx);
482
+ this._isConnected.set(true, tx);
483
+ });
484
+ const seededResources = ( new Set());
485
+ for (const s of this.agentSessionsService.model.sessions.filter(ss => !ss.isArchived())) {
486
+ seededResources.add(( s.resource.toString()));
487
+ const model = this.chatService.getSession(s.resource);
488
+ const info = model ? this._getAgentStateInfo(model) : undefined;
489
+ const currentState = info?.state ?? (s.status === ChatSessionStatus.InProgress ? "thinking" : s.status === ChatSessionStatus.NeedsInput ? "waiting_for_confirmation" : s.status === ChatSessionStatus.Completed ? "idle" : "unknown");
490
+ if (currentState !== "unknown") {
491
+ this._prevSessionStates.set(( s.resource.toString()), {
492
+ state: currentState,
493
+ detail: info?.detail ?? ""
494
+ });
495
+ }
496
+ }
497
+ for (const chatModel of this.chatService.chatModels.get()) {
498
+ const key = ( chatModel.sessionResource.toString());
499
+ if (( seededResources.has(key))) {
500
+ continue;
501
+ }
502
+ if (chatModel.getRequests().length === 0) {
503
+ continue;
504
+ }
505
+ const info = this._getAgentStateInfo(chatModel);
506
+ if (info.state !== "unknown") {
507
+ this._prevSessionStates.set(key, {
508
+ state: info.state,
509
+ detail: info.detail ?? ""
510
+ });
511
+ }
512
+ }
513
+ const sessionChangeListener = this.agentSessionsService.model.onDidChangeSessions(() => {
514
+ this._checkSessionStateChanges();
515
+ this._sendContext();
516
+ });
517
+ const autorunDisposable = autorun(reader => {
518
+ const agentSessions = this.agentSessionsService.model.sessions.filter(s => !s.isArchived());
519
+ let needsRecheck = false;
520
+ const stateChanges = [];
521
+ const waitingForConfirmationSessions = [];
522
+ const processedResources = ( new Set());
523
+ const processModel = (model, resource, label) => {
524
+ const sessionId = ( resource.toString());
525
+ this._pendingIdleNarration.delete(sessionId);
526
+ const lastReq = model.lastRequestObs.read(reader);
527
+ if (lastReq?.response) {
528
+ lastReq.response.isIncomplete.read(reader);
529
+ const pending = lastReq.response.isPendingConfirmation.read(reader);
530
+ if (pending && ( this._autoApprovedSessions.has(sessionId))) {
531
+ for (const part of lastReq.response.response.value) {
532
+ if (part.kind === "toolInvocation") {
533
+ if (IChatToolInvocation.confirmWith(part, {
534
+ type: ToolConfirmKind.UserAction
535
+ })) {
536
+ needsRecheck = true;
537
+ }
538
+ }
539
+ }
540
+ }
541
+ const responseSignal = observableSignalFromEvent(lastReq.response, lastReq.response.onDidChange);
542
+ responseSignal.read(reader);
543
+ }
544
+ const info = this._getAgentStateInfo(model);
545
+ const currentState = info.state;
546
+ const detail = info.detail;
547
+ const lastResponseSummary = info.last_response_summary;
548
+ const prev = this._prevSessionStates.get(sessionId);
549
+ const isStateTransition = prev !== undefined && prev.state !== currentState && currentState !== "unknown";
550
+ const isDetailTransition = !isStateTransition && prev !== undefined && currentState === "waiting_for_confirmation" && (detail ?? "") !== prev.detail;
551
+ const isTransition = isStateTransition || isDetailTransition;
552
+ if (isTransition) {
553
+ this.logService.info(
554
+ `[voice] autorun transition id=${sessionId.slice(-32)} ${prev?.state}→${currentState} detailChanged=${isDetailTransition} hasDetail=${!!detail}`
555
+ );
556
+ const cancelExpiry = this._userCancelledSessions.get(sessionId);
557
+ if (cancelExpiry) {
558
+ this.logService.info(
559
+ `[voice] autorun swallowing transition (user-cancelled) id=${sessionId.slice(-32)}`
560
+ );
561
+ clearTimeout(cancelExpiry);
562
+ this._userCancelledSessions.delete(sessionId);
563
+ } else {
564
+ stateChanges.push({
565
+ sessionId,
566
+ currentState,
567
+ label,
568
+ detail,
569
+ lastResponseSummary,
570
+ detailOnly: isDetailTransition
571
+ });
572
+ }
573
+ }
574
+ if (currentState !== "unknown") {
575
+ this._prevSessionStates.set(sessionId, {
576
+ state: currentState,
577
+ detail: detail ?? ""
578
+ });
579
+ }
580
+ if (currentState === "waiting_for_confirmation") {
581
+ waitingForConfirmationSessions.push({
582
+ sessionId,
583
+ label,
584
+ detail,
585
+ transition: isTransition
586
+ });
587
+ }
588
+ };
589
+ for (const s of agentSessions) {
590
+ processedResources.add(( s.resource.toString()));
591
+ const model = this.chatService.getSession(s.resource);
592
+ if (model) {
593
+ processModel(model, s.resource, s.label || "Untitled session");
594
+ } else {
595
+ const sessionId = ( s.resource.toString());
596
+ const currentState = s.status === ChatSessionStatus.InProgress ? "thinking" : s.status === ChatSessionStatus.NeedsInput ? "waiting_for_confirmation" : s.status === ChatSessionStatus.Completed ? "idle" : "unknown";
597
+ if (s.status === ChatSessionStatus.NeedsInput) {
598
+ this._ensureModelLoaded(s.resource);
599
+ }
600
+ const prev = this._prevSessionStates.get(sessionId);
601
+ const isStateTransition = prev !== undefined && prev.state !== currentState && currentState !== "unknown";
602
+ if (isStateTransition && currentState === "idle") {
603
+ this._deferIdleNarrationUntilModelLoaded(s.resource);
604
+ continue;
605
+ }
606
+ if (isStateTransition) {
607
+ const cancelExpiry = this._userCancelledSessions.get(sessionId);
608
+ if (cancelExpiry) {
609
+ clearTimeout(cancelExpiry);
610
+ this._userCancelledSessions.delete(sessionId);
611
+ } else {
612
+ stateChanges.push({
613
+ sessionId,
614
+ currentState,
615
+ label: s.label || "Untitled session"
616
+ });
617
+ }
618
+ }
619
+ if (currentState !== "unknown") {
620
+ this._prevSessionStates.set(sessionId, {
621
+ state: currentState,
622
+ detail: ""
623
+ });
624
+ }
625
+ if (currentState === "waiting_for_confirmation") {
626
+ waitingForConfirmationSessions.push({
627
+ sessionId,
628
+ label: s.label || "Untitled session",
629
+ detail: undefined,
630
+ transition: isStateTransition
631
+ });
632
+ }
633
+ }
634
+ }
635
+ for (const chatModel of this.chatService.chatModels.read(reader)) {
636
+ const key = ( chatModel.sessionResource.toString());
637
+ if (( processedResources.has(key))) {
638
+ continue;
639
+ }
640
+ if (chatModel.getRequests().length === 0) {
641
+ continue;
642
+ }
643
+ processedResources.add(key);
644
+ processModel(chatModel, chatModel.sessionResource, chatModel.title || "Chat");
645
+ }
646
+ if (needsRecheck) {
647
+ setTimeout(() => this._autoApproveCheck(), 500);
648
+ }
649
+ this._sendContext();
650
+ if (stateChanges.length > 0) {
651
+ for (const change of stateChanges) {
652
+ if (change.detailOnly) {
653
+ this.voiceClientService.invalidateSessionCache(change.sessionId);
654
+ }
655
+ }
656
+ if (( stateChanges.some(c => c.detailOnly))) {
657
+ this._sendContext();
658
+ }
659
+ this.logService.info(
660
+ `[voice] autorun stateChanges=${stateChanges.length} flushing immediately: ${( stateChanges.map(c => `${c.label}:${c.currentState}${c.detailOnly ? " (detail-only)" : ""}`)).join(", ")}`
661
+ );
662
+ this.voiceClientService.flushSessionContext();
663
+ }
664
+ for (const change of stateChanges) {
665
+ this._persistEntry("coding_event", `session "${change.label}" → ${change.currentState}`, {
666
+ codingSessionId: change.sessionId,
667
+ codingStatus: change.currentState,
668
+ codingSessionLabel: change.label
669
+ });
670
+ }
671
+ for (const w of waitingForConfirmationSessions) {
672
+ this._armConfirmationFlushWatchdog(w.sessionId, w.label, w.transition);
673
+ }
674
+ const stillWaiting = ( new Set(( waitingForConfirmationSessions.map(w => w.sessionId))));
675
+ for (const id of [...( this._confirmationFlushWatchdogs.keys())]) {
676
+ if (!( stillWaiting.has(id))) {
677
+ const t = this._confirmationFlushWatchdogs.get(id);
678
+ if (t) {
679
+ clearTimeout(t);
680
+ }
681
+ this._confirmationFlushWatchdogs.delete(id);
682
+ }
683
+ }
684
+ for (const id of [...( this._eagerModelRefs.keys())]) {
685
+ if (!( stillWaiting.has(id))) {
686
+ this._eagerModelRefs.get(id).dispose();
687
+ this._eagerModelRefs.delete(id);
688
+ }
689
+ }
690
+ });
691
+ const connectionDisposables = ( new DisposableStore());
692
+ connectionDisposables.add(sessionChangeListener);
693
+ connectionDisposables.add(autorunDisposable);
694
+ connectionDisposables.add(
695
+ disposableWindowInterval(this._window, () => this._checkSessionStateChanges(), 5000)
696
+ );
697
+ this._voiceAutorunDisposable.value = connectionDisposables;
698
+ this.micCaptureService.isMuted = false;
699
+ this._statusText.set("Hold to speak...", undefined);
700
+ this._voiceState.set("idle", undefined);
701
+ if (!isResuming && this._isAutoSendEnabled()) {
702
+ this._autoListenAfterGreeting = true;
703
+ }
704
+ } else if (this._isConnected.get()) {
705
+ this._onConnectionLost();
706
+ } else if (this._isReconnecting.get()) {
707
+ this._isReconnecting.set(false, undefined);
708
+ this._voiceState.set("idle", undefined);
709
+ this._statusText.set("Tap to start", undefined);
710
+ } else if (this._isConnecting.get()) {
711
+ this._isConnecting.set(false, undefined);
712
+ this._voiceState.set("idle", undefined);
713
+ this._statusText.set("Tap to start", undefined);
714
+ } else {
715
+ this._voiceState.set("idle", undefined);
716
+ }
717
+ }));
718
+ this._voiceEventDisposables.add(this.voiceClientService.onSpeechStarted(() => {
719
+ this._clearAutoSendSilenceTimer();
720
+ this._clearAutoListenTimer();
721
+ this.ttsPlaybackService.stopPlayback();
722
+ this._audioQueue.length = 0;
723
+ this._currentPlaybackSessionId = null;
724
+ this._isProcessingQueue = false;
725
+ this._suppressIncomingAudio = true;
726
+ this._startUserTurn();
727
+ }));
728
+ this._voiceEventDisposables.add(this.voiceClientService.onTranscription(e => {
729
+ if (!this._telemetryFirstTranscriptionMs && this._telemetryPttDownMs) {
730
+ this._telemetryFirstTranscriptionMs = Date.now();
731
+ }
732
+ let text = e.text;
733
+ if (this._pttToggleMode && this._pttHeld) {
734
+ const strippedText = this._checkSendKeyword(text);
735
+ if (strippedText !== undefined) {
736
+ text = strippedText;
737
+ this._updateUserTurn(text, e.committed ?? "", false);
738
+ this._persistTurn("user", text);
739
+ this._pttToggleMode = false;
740
+ this._finishPtt();
741
+ return;
742
+ }
743
+ }
744
+ this._updateUserTurn(text, e.committed ?? "", e.status === "partial");
745
+ if (e.status !== "partial") {
746
+ if (!this._pttHeld) {
747
+ this._voiceState.set("processing", undefined);
748
+ this._statusText.set("Processing...", undefined);
749
+ }
750
+ this._persistTurn("user", text);
751
+ }
752
+ if (this._pttToggleMode && this._pttHeld) {
753
+ this._scheduleAutoSendOnSilence();
754
+ }
755
+ }));
756
+ this._voiceEventDisposables.add(this.voiceClientService.onAudioResponse(e => {
757
+ if (e.isFirstChunk && this._telemetryPttUpMs) {
758
+ const ttft = this._telemetryFirstTranscriptionMs && this._telemetryPttDownMs ? this._telemetryFirstTranscriptionMs - this._telemetryPttDownMs : 0;
759
+ const e2e = Date.now() - this._telemetryPttUpMs;
760
+ this.telemetryService.publicLog2("voiceLatency", {
761
+ timeToFirstTranscriptionMs: ttft,
762
+ endToEndTurnMs: e2e
763
+ });
764
+ this._telemetryPttUpMs = undefined;
765
+ }
766
+ this._enqueueAudio(e.codingSessionId, e.audio, e.isFirstChunk, e.isFinal, e.transcript);
767
+ if (e.isFinal && e.transcript) {
768
+ this._persistTurn("assistant", e.transcript);
769
+ }
770
+ }));
771
+ this._voiceEventDisposables.add(this.voiceClientService.onToolCall(e => {
772
+ const allowedTools = [
773
+ "send_to_chat",
774
+ "get_session_info",
775
+ "get_session_changes",
776
+ "get_session_thread",
777
+ "approve_confirmation",
778
+ "reject_confirmation",
779
+ "auto_approve_session",
780
+ "revoke_auto_approve",
781
+ "focus_session"
782
+ ];
783
+ if (e.name === "send_to_chat") {
784
+ let text = typeof e.args?.["text"] === "string" ? e.args["text"] : "";
785
+ const stripped = this._checkSendKeyword(text);
786
+ if (stripped !== undefined) {
787
+ text = stripped;
788
+ }
789
+ this._statusText.set(VoiceToolDispatchService.getActionLabel(e.name), undefined);
790
+ this._persistEntry("agent_tool_call", this._renderToolCallSummary(e.name, e.args), {
791
+ toolName: e.name,
792
+ toolArgs: e.args
793
+ });
794
+ this._setAwaitingReply();
795
+ const sendPromise = text.trim() ? this._sendTranscriptionToChat(text) : Promise.resolve();
796
+ sendPromise.finally(() => {
797
+ this.voiceClientService.sendToolResult(e.callId, "ok");
798
+ this._voiceState.set("idle", undefined);
799
+ this._statusText.set("Hold to speak...", undefined);
800
+ this._sendContext();
801
+ });
802
+ return;
803
+ }
804
+ if (allowedTools.includes(e.name)) {
805
+ this._statusText.set(VoiceToolDispatchService.getActionLabel(e.name), undefined);
806
+ this._persistEntry("agent_tool_call", this._renderToolCallSummary(e.name, e.args), {
807
+ toolName: e.name,
808
+ toolArgs: e.args
809
+ });
810
+ if (e.name === "approve_confirmation" || e.name === "reject_confirmation") {
811
+ this.telemetryService.publicLog2("voiceToolApproval", {
812
+ toolName: e.name,
813
+ approved: e.name === "approve_confirmation"
814
+ });
815
+ }
816
+ if (this._pttHeld) {
817
+ this._finishPtt();
818
+ }
819
+ this._suppressIncomingAudio = false;
820
+ this._setAwaitingReply();
821
+ this.voiceToolDispatchService.dispatchToolCall(e).then(result => {
822
+ this.voiceClientService.sendToolResult(e.callId, result);
823
+ this._voiceState.set("idle", undefined);
824
+ this._statusText.set("Hold to speak...", undefined);
825
+ this._sendContext();
826
+ });
827
+ } else {
828
+ this.voiceClientService.sendToolResult(e.callId, "ok");
829
+ }
830
+ }));
831
+ this._voiceEventDisposables.add(this.voiceClientService.onError(detail => {
832
+ if (!this._isConnecting.get()) {
833
+ this._voiceState.set("error", undefined);
834
+ this._statusText.set(`Error: ${detail}`, undefined);
835
+ }
836
+ }));
837
+ await this.voiceClientService.connect(window, authToken);
838
+ const connectTimeout = setTimeout(() => {
839
+ if (this._isConnecting.get() && !this._isConnected.get()) {
840
+ this.disconnect();
841
+ }
842
+ }, 10000);
843
+ this._voiceEventDisposables.add({
844
+ dispose: () => clearTimeout(connectTimeout)
845
+ });
846
+ }
847
+ disconnect() {
848
+ if (this._telemetrySessionStart) {
849
+ const durationSec = Math.round((Date.now() - this._telemetrySessionStart) / 1000);
850
+ this.telemetryService.publicLog2("voiceSessionEnded", {
851
+ turnCount: this._telemetryTurnCount,
852
+ durationSec,
853
+ reconnectCount: this._telemetryReconnectCount
854
+ });
855
+ this._telemetrySessionStart = undefined;
856
+ }
857
+ this._isConnecting.set(false, undefined);
858
+ this._isReconnecting.set(false, undefined);
859
+ this._voiceAutorunDisposable.clear();
860
+ this._voiceEventDisposables.clear();
861
+ this.ttsPlaybackService.closeContext();
862
+ this.micCaptureService.stopCapture();
863
+ this.voiceClientService.disconnect();
864
+ this._pttHeld = false;
865
+ this._pttToggleMode = false;
866
+ this._isConnected.set(false, undefined);
867
+ this._voiceState.set("idle", undefined);
868
+ this._statusText.set("Tap to start", undefined);
869
+ this._transcriptTurns.set([], undefined);
870
+ this._clearAutoSendSilenceTimer();
871
+ this._clearAutoListenTimer();
872
+ this._clearAwaitingReply();
873
+ this._autoListenAfterGreeting = false;
874
+ this._hasPlayedInitialListenCue = false;
875
+ this._replyPlayedSinceSend = false;
876
+ this._audioQueue.length = 0;
877
+ this._currentPlaybackSessionId = null;
878
+ this._isProcessingQueue = false;
879
+ this._suppressIncomingAudio = false;
880
+ this._prevSessionStates.clear();
881
+ for (const t of ( this._userCancelledSessions.values())) {
882
+ clearTimeout(t);
883
+ }
884
+ this._userCancelledSessions.clear();
885
+ for (const t of ( this._confirmationFlushWatchdogs.values())) {
886
+ clearTimeout(t);
887
+ }
888
+ this._confirmationFlushWatchdogs.clear();
889
+ for (const ref of ( this._eagerModelRefs.values())) {
890
+ ref.dispose();
891
+ }
892
+ this._eagerModelRefs.clear();
893
+ this._eagerModelLoading.clear();
894
+ this._pendingIdleNarration.clear();
895
+ this._userLogin = undefined;
896
+ this._lastPersistedTurnId = undefined;
897
+ this._pendingPriorTimeline = [];
898
+ this._stopReplay();
899
+ this._sessionAudioCache.clear();
900
+ }
901
+ simulateConnection() {
902
+ this._isConnected.set(true, undefined);
903
+ this._isConnecting.set(false, undefined);
904
+ this._voiceState.set("idle", undefined);
905
+ this._statusText.set("Hold to speak...", undefined);
906
+ this._voiceEventDisposables.add(disposableTimeout(() => {
907
+ if (!this._isConnected.get()) {
908
+ return;
909
+ }
910
+ this._voiceState.set("listening", undefined);
911
+ this._transcriptTurns.set([{
912
+ speaker: "user",
913
+ text: "Create a",
914
+ committed: "",
915
+ isPartial: true
916
+ }], undefined);
917
+ }, 1000));
918
+ this._voiceEventDisposables.add(disposableTimeout(() => {
919
+ if (!this._isConnected.get()) {
920
+ return;
921
+ }
922
+ this._transcriptTurns.set([{
923
+ speaker: "user",
924
+ text: "Create a new React component",
925
+ committed: "Create a ",
926
+ isPartial: true
927
+ }], undefined);
928
+ }, 2000));
929
+ this._voiceEventDisposables.add(disposableTimeout(() => {
930
+ if (!this._isConnected.get()) {
931
+ return;
932
+ }
933
+ this._transcriptTurns.set([{
934
+ speaker: "user",
935
+ text: "Create a new React component for the dashboard",
936
+ committed: "Create a new React component for the dashboard",
937
+ isPartial: false
938
+ }], undefined);
939
+ this._voiceState.set("idle", undefined);
940
+ }, 3000));
941
+ this._voiceEventDisposables.add(disposableTimeout(() => {
942
+ if (!this._isConnected.get()) {
943
+ return;
944
+ }
945
+ this._transcriptTurns.set([{
946
+ speaker: "user",
947
+ text: "Create a new React component for the dashboard",
948
+ committed: "Create a new React component for the dashboard",
949
+ isPartial: false
950
+ }, {
951
+ speaker: "assistant",
952
+ text: "I'll create a Dashboard component with some widgets...",
953
+ committed: "",
954
+ isPartial: false
955
+ }], undefined);
956
+ }, 4500));
957
+ }
958
+ _onConnectionLost() {
959
+ this.logService.warn("[voice] connection lost, preserving state for reconnect");
960
+ this.ttsPlaybackService.closeContext();
961
+ this._pttHeld = false;
962
+ this._pttToggleMode = false;
963
+ this._isConnected.set(false, undefined);
964
+ this._isReconnecting.set(true, undefined);
965
+ this._voiceState.set("idle", undefined);
966
+ this._statusText.set("Reconnecting...", undefined);
967
+ }
968
+ pttDown() {
969
+ if (!this._isConnected.get()) {
970
+ return;
971
+ }
972
+ this._clearAutoSendSilenceTimer();
973
+ if (this._pttToggleMode) {
974
+ this._pttToggleMode = false;
975
+ this._finishPtt();
976
+ return;
977
+ }
978
+ if (this._pttHeld) {
979
+ return;
980
+ }
981
+ this._pttHeld = true;
982
+ this._autoListenAfterGreeting = false;
983
+ this._clearAutoListenTimer();
984
+ this._pttCurrentTurnId = generateUuid();
985
+ this._pttWaitingForPlayback = false;
986
+ this._telemetryPttDownMs = Date.now();
987
+ this._telemetryFirstTranscriptionMs = undefined;
988
+ this._telemetryTurnCount++;
989
+ this._telemetryTtsInterrupted = this.ttsPlaybackService.isPlaying;
990
+ if (this._delayedMicStopTimer) {
991
+ clearTimeout(this._delayedMicStopTimer);
992
+ this._delayedMicStopTimer = undefined;
993
+ }
994
+ this._cancelTranscriptFade();
995
+ this._startUserTurn();
996
+ this._audioQueue.length = 0;
997
+ this._currentPlaybackSessionId = null;
998
+ this._isProcessingQueue = false;
999
+ this._suppressIncomingAudio = true;
1000
+ this.micCaptureService.isMuted = false;
1001
+ this.micCaptureService.pttDown(this._pttCurrentTurnId).catch(() => {
1002
+ this._pttHeld = false;
1003
+ this._statusText.set("Microphone denied", undefined);
1004
+ this._voiceState.set("error", undefined);
1005
+ if (this._pttMaxDurationTimer) {
1006
+ clearTimeout(this._pttMaxDurationTimer);
1007
+ this._pttMaxDurationTimer = undefined;
1008
+ }
1009
+ this.disconnect();
1010
+ });
1011
+ this.ttsPlaybackService.stopPlayback();
1012
+ this._voiceState.set("listening", undefined);
1013
+ this._statusText.set("Listening...", undefined);
1014
+ if (this._isAutoSendEnabled()) {
1015
+ if (!this._hasPlayedInitialListenCue) {
1016
+ this._hasPlayedInitialListenCue = true;
1017
+ this.accessibilitySignalService.playSignal(AccessibilitySignal.voiceRecordingStarted);
1018
+ } else if (this.accessibilityService.isScreenReaderOptimized()) {
1019
+ this.accessibilitySignalService.playSignal(AccessibilitySignal.voiceRecordingStarted);
1020
+ }
1021
+ }
1022
+ this._pttMaxDurationTimer = setTimeout(() => {
1023
+ if (this._pttHeld) {
1024
+ this._statusText.set("Max duration reached", undefined);
1025
+ this.pttUp();
1026
+ }
1027
+ }, VoiceSessionController_1._PTT_MAX_DURATION_MS);
1028
+ }
1029
+ pttUp() {
1030
+ if (!this._pttHeld) {
1031
+ return;
1032
+ }
1033
+ const holdMs = this._telemetryPttDownMs ? Date.now() - this._telemetryPttDownMs : Infinity;
1034
+ if (holdMs < VoiceSessionController_1._PTT_TOGGLE_THRESHOLD_MS) {
1035
+ this._pttToggleMode = true;
1036
+ return;
1037
+ }
1038
+ this._finishPtt();
1039
+ }
1040
+ _finishPtt() {
1041
+ if (!this._pttHeld) {
1042
+ return;
1043
+ }
1044
+ this._clearAutoSendSilenceTimer();
1045
+ this._clearAutoListenTimer();
1046
+ this._pttHeld = false;
1047
+ this._telemetryPttUpMs = Date.now();
1048
+ const holdMs = this._telemetryPttDownMs ? Date.now() - this._telemetryPttDownMs : 0;
1049
+ this.telemetryService.publicLog2("voicePtt", {
1050
+ holdDurationMs: holdMs
1051
+ });
1052
+ if (this._pttMaxDurationTimer) {
1053
+ clearTimeout(this._pttMaxDurationTimer);
1054
+ this._pttMaxDurationTimer = undefined;
1055
+ }
1056
+ this._voiceState.set("processing", undefined);
1057
+ this._statusText.set("Processing...", undefined);
1058
+ this._replyPlayedSinceSend = false;
1059
+ this._clearAwaitingReply();
1060
+ this._suppressIncomingAudio = false;
1061
+ this.micCaptureService.pttUp();
1062
+ if (this.accessibilityService.isScreenReaderOptimized()) {
1063
+ this.accessibilitySignalService.playSignal(AccessibilitySignal.voiceRecordingStopped);
1064
+ }
1065
+ }
1066
+ markUserCancelled(sessionId) {
1067
+ const existing = this._userCancelledSessions.get(sessionId);
1068
+ if (existing) {
1069
+ clearTimeout(existing);
1070
+ }
1071
+ const expiry = setTimeout(() => {
1072
+ this._userCancelledSessions.delete(sessionId);
1073
+ }, VoiceSessionController_1._USER_CANCEL_SUPPRESS_MS);
1074
+ this._userCancelledSessions.set(sessionId, expiry);
1075
+ }
1076
+ setTargetSession(resource) {
1077
+ this._targetSession.set(resource, undefined);
1078
+ }
1079
+ newSessionAsTarget() {
1080
+ const ref = this.chatService.startNewLocalSession(ChatAgentLocation.Chat);
1081
+ const resource = ref.object.sessionResource;
1082
+ ref.dispose();
1083
+ this._targetSession.set(resource, undefined);
1084
+ this.commandService.executeCommand("_chat.voice.switchToSession", ( resource.toString())).catch(() => {});
1085
+ }
1086
+ _scheduleDelayedMicStop() {
1087
+ if (this._delayedMicStopTimer) {
1088
+ clearTimeout(this._delayedMicStopTimer);
1089
+ }
1090
+ this._delayedMicStopTimer = setTimeout(() => {
1091
+ this._delayedMicStopTimer = undefined;
1092
+ this._pttWaitingForPlayback = false;
1093
+ }, 1000);
1094
+ }
1095
+ _isAutoSendEnabled() {
1096
+ const delayMs = this.configurationService.getValue("agents.voice.autoSendDelay");
1097
+ return typeof delayMs === "number" && delayMs >= 0;
1098
+ }
1099
+ _checkSendKeyword(text) {
1100
+ const keyword = this.configurationService.getValue("agents.voice.sendKeyword")?.trim();
1101
+ if (!keyword) {
1102
+ return undefined;
1103
+ }
1104
+ const trimmed = text.trimEnd().replace(/[.,!?;:]+$/, "").trimEnd();
1105
+ const keywordLower = keyword.toLowerCase();
1106
+ if (trimmed.toLowerCase().endsWith(keywordLower)) {
1107
+ const stripped = trimmed.slice(0, trimmed.length - keyword.length).trimEnd();
1108
+ return stripped || undefined;
1109
+ }
1110
+ return undefined;
1111
+ }
1112
+ _enterAutoListen() {
1113
+ this._clearAutoListenTimer();
1114
+ if (!this._isConnected.get() || this._pttHeld) {
1115
+ return;
1116
+ }
1117
+ if (this.ttsPlaybackService.isPlaying || this._audioQueue.length > 0 || this._currentPlaybackSessionId !== null) {
1118
+ return;
1119
+ }
1120
+ this.pttDown();
1121
+ this.pttUp();
1122
+ }
1123
+ _scheduleAutoListen() {
1124
+ this._clearAutoListenTimer();
1125
+ this._autoListenTimer = setTimeout(() => {
1126
+ this._autoListenTimer = undefined;
1127
+ if (this._awaitingReplyAudio) {
1128
+ return;
1129
+ }
1130
+ this._enterAutoListen();
1131
+ }, VoiceSessionController_1._AUTO_LISTEN_QUIET_MS);
1132
+ }
1133
+ _clearAutoListenTimer() {
1134
+ if (this._autoListenTimer) {
1135
+ clearTimeout(this._autoListenTimer);
1136
+ this._autoListenTimer = undefined;
1137
+ }
1138
+ }
1139
+ _scheduleAutoSendOnSilence() {
1140
+ this._clearAutoSendSilenceTimer();
1141
+ const delayMs = this.configurationService.getValue("agents.voice.autoSendDelay");
1142
+ if (typeof delayMs !== "number" || delayMs < 0) {
1143
+ return;
1144
+ }
1145
+ this._autoSendSilenceTimer = setTimeout(() => {
1146
+ this._autoSendSilenceTimer = undefined;
1147
+ if (this._pttToggleMode && this._pttHeld) {
1148
+ this._pttToggleMode = false;
1149
+ this._finishPtt();
1150
+ }
1151
+ }, delayMs);
1152
+ }
1153
+ _clearAutoSendSilenceTimer() {
1154
+ if (this._autoSendSilenceTimer) {
1155
+ clearTimeout(this._autoSendSilenceTimer);
1156
+ this._autoSendSilenceTimer = undefined;
1157
+ }
1158
+ }
1159
+ _setAwaitingReply() {
1160
+ this._awaitingReplyAudio = true;
1161
+ this._clearAutoListenTimer();
1162
+ if (this._awaitingReplyWatchdog) {
1163
+ clearTimeout(this._awaitingReplyWatchdog);
1164
+ }
1165
+ this._awaitingReplyWatchdog = setTimeout(() => {
1166
+ this._awaitingReplyWatchdog = undefined;
1167
+ this._awaitingReplyAudio = false;
1168
+ if (this._isAutoSendEnabled() && !this._pttHeld) {
1169
+ this._enterAutoListen();
1170
+ }
1171
+ }, 30_000);
1172
+ }
1173
+ _clearAwaitingReply() {
1174
+ this._awaitingReplyAudio = false;
1175
+ if (this._awaitingReplyWatchdog) {
1176
+ clearTimeout(this._awaitingReplyWatchdog);
1177
+ this._awaitingReplyWatchdog = undefined;
1178
+ }
1179
+ }
1180
+ async _sendTranscriptionToChat(text) {
1181
+ const target = this._targetSession.get();
1182
+ if (target) {
1183
+ const currentSession = await this.commandService.executeCommand("_chat.voice.getCurrentSession").catch(() => undefined);
1184
+ const isTargetVisible = currentSession === ( target.toString());
1185
+ if (isTargetVisible) {
1186
+ await this.commandService.executeCommand("_chat.voice.acceptInput", text).catch(err => {
1187
+ this.logService.warn("[voice] acceptInput failed for visible target:", err);
1188
+ });
1189
+ } else {
1190
+ const cts = ( new CancellationTokenSource());
1191
+ const ref = await this.chatService.acquireOrLoadSession(target, ChatAgentLocation.Chat, cts.token, "voice-send").catch(err => {
1192
+ this.logService.warn("[voice] Failed to load target session:", err);
1193
+ return undefined;
1194
+ });
1195
+ cts.dispose();
1196
+ if (!ref) {
1197
+ this.logService.warn("[voice] Could not load target session, falling back to switch");
1198
+ const switched = await this.commandService.executeCommand("_chat.voice.switchToSession", ( target.toString())).catch(() => false);
1199
+ if (switched) {
1200
+ await ( new Promise(resolve => setTimeout(resolve, 200)));
1201
+ await this.commandService.executeCommand("_chat.voice.acceptInput", text).catch(() => {});
1202
+ }
1203
+ return;
1204
+ }
1205
+ const result = await this.chatService.sendRequest(target, text).catch(err => {
1206
+ this.logService.warn("[voice] Error sending transcription to target session:", err);
1207
+ return undefined;
1208
+ });
1209
+ if (result && result.kind !== "rejected") {
1210
+ this._watchResponseForFloatingWindow(target);
1211
+ this.commandService.executeCommand("_agentsVoice.openWindow").catch(() => {});
1212
+ const model = this.chatService.getSession(target);
1213
+ if (model) {
1214
+ const lastReq = model.getRequests().at(-1);
1215
+ if (lastReq?.response && !lastReq.response.isComplete && !lastReq.response.isCanceled) {
1216
+ const responseDisposable = lastReq.response.onDidChange(() => {
1217
+ if (lastReq.response.isComplete || lastReq.response.isCanceled) {
1218
+ responseDisposable.dispose();
1219
+ ref.dispose();
1220
+ }
1221
+ });
1222
+ } else {
1223
+ ref.dispose();
1224
+ }
1225
+ } else {
1226
+ ref.dispose();
1227
+ }
1228
+ } else {
1229
+ ref.dispose();
1230
+ }
1231
+ }
1232
+ } else {
1233
+ const currentSession = await this.commandService.executeCommand("_chat.voice.getCurrentSession").catch(() => undefined);
1234
+ if (currentSession) {
1235
+ this.commandService.executeCommand("_chat.voice.acceptInput", text).catch(err => {
1236
+ this.logService.warn("[voice] acceptInput failed for current session:", err);
1237
+ });
1238
+ } else {
1239
+ const models = [...this.chatService.chatModels.get()];
1240
+ const existingSession = models.length > 0 ? models[models.length - 1] : undefined;
1241
+ const sessionResource = existingSession?.sessionResource;
1242
+ if (sessionResource) {
1243
+ const switched = await this.commandService.executeCommand("_chat.voice.switchToSession", ( sessionResource.toString())).catch(() => false);
1244
+ if (switched) {
1245
+ await ( new Promise(resolve => setTimeout(resolve, 200)));
1246
+ await this.commandService.executeCommand("_chat.voice.acceptInput", text).catch(err => {
1247
+ this.logService.warn("[voice] acceptInput failed after switch to existing:", err);
1248
+ });
1249
+ } else {
1250
+ this.chatService.sendRequest(sessionResource, text).catch(err => {
1251
+ this.logService.warn("[voice] Error sending transcription to existing session:", err);
1252
+ });
1253
+ }
1254
+ } else {
1255
+ const ref = this.chatService.startNewLocalSession(ChatAgentLocation.Chat);
1256
+ const resource = ref.object.sessionResource;
1257
+ ref.dispose();
1258
+ this.commandService.executeCommand("_chat.voice.switchToSession", ( resource.toString())).catch(() => {});
1259
+ this.chatService.sendRequest(resource, text).catch(err => {
1260
+ this.logService.warn("[voice] Error sending transcription to new session:", err);
1261
+ });
1262
+ }
1263
+ }
1264
+ this.commandService.executeCommand("workbench.panel.chat.view.copilot.focus").catch(() => {});
1265
+ }
1266
+ }
1267
+ _watchResponseForFloatingWindow(sessionResource) {
1268
+ const model = this.chatService.getSession(sessionResource);
1269
+ if (!model) {
1270
+ return;
1271
+ }
1272
+ this._prevSessionStates.set(( sessionResource.toString()), {
1273
+ state: "thinking",
1274
+ detail: ""
1275
+ });
1276
+ this._sendContext();
1277
+ const disposables = ( new DisposableStore());
1278
+ let lastText = "";
1279
+ const updateFromResponse = () => {
1280
+ const lastReq = model.lastRequest;
1281
+ const response = lastReq?.response;
1282
+ if (!response) {
1283
+ return;
1284
+ }
1285
+ const markdown = response.response.getMarkdown();
1286
+ const previewText = markdown.length > 200 ? markdown.slice(0, 200) + "…" : markdown;
1287
+ if (previewText && previewText !== lastText) {
1288
+ const isFirst = lastText === "";
1289
+ lastText = previewText;
1290
+ this._setAssistantTurn(previewText, {
1291
+ startNewTurn: isFirst
1292
+ });
1293
+ }
1294
+ if (response.isComplete || response.isCanceled) {
1295
+ this._prevSessionStates.set(( sessionResource.toString()), {
1296
+ state: "idle",
1297
+ detail: ""
1298
+ });
1299
+ this._sendContext();
1300
+ this.voiceClientService.flushSessionContext();
1301
+ disposables.dispose();
1302
+ }
1303
+ };
1304
+ const checkResponse = () => {
1305
+ const lastReq = model.lastRequest;
1306
+ if (lastReq?.response) {
1307
+ disposables.add(lastReq.response.onDidChange(() => updateFromResponse()));
1308
+ updateFromResponse();
1309
+ }
1310
+ };
1311
+ disposables.add(model.onDidChange(e => {
1312
+ if (e.kind === "addResponse") {
1313
+ checkResponse();
1314
+ }
1315
+ }));
1316
+ checkResponse();
1317
+ const timeout = setTimeout(() => disposables.dispose(), 5 * 60 * 1000);
1318
+ disposables.add({
1319
+ dispose: () => clearTimeout(timeout)
1320
+ });
1321
+ }
1322
+ _pushTurn(turn) {
1323
+ const cur = this._transcriptTurns.get();
1324
+ const next = [...cur, turn].slice(-VoiceSessionController_1._MAX_TURNS);
1325
+ this._transcriptTurns.set(next, undefined);
1326
+ }
1327
+ _startUserTurn() {
1328
+ const cur = this._transcriptTurns.get();
1329
+ const last = cur[cur.length - 1];
1330
+ if (last && last.speaker === "user" && !last.text) {
1331
+ return;
1332
+ }
1333
+ this._pushTurn({
1334
+ speaker: "user",
1335
+ text: "",
1336
+ committed: "",
1337
+ isPartial: true
1338
+ });
1339
+ }
1340
+ _updateUserTurn(text, committed, isPartial) {
1341
+ const cur = this._transcriptTurns.get();
1342
+ const last = cur[cur.length - 1];
1343
+ if (!last || last.speaker !== "user") {
1344
+ this._pushTurn({
1345
+ speaker: "user",
1346
+ text,
1347
+ committed,
1348
+ isPartial
1349
+ });
1350
+ return;
1351
+ }
1352
+ const updated = {
1353
+ speaker: "user",
1354
+ text,
1355
+ committed,
1356
+ isPartial
1357
+ };
1358
+ this._transcriptTurns.set([...cur.slice(0, -1), updated], undefined);
1359
+ }
1360
+ _setAssistantTurn(
1361
+ text,
1362
+ opts = {
1363
+ startNewTurn: true
1364
+ }
1365
+ ) {
1366
+ const cur = this._transcriptTurns.get();
1367
+ const last = cur[cur.length - 1];
1368
+ if (!opts.startNewTurn && last && last.speaker === "assistant") {
1369
+ const updated = {
1370
+ speaker: "assistant",
1371
+ text,
1372
+ committed: "",
1373
+ isPartial: false
1374
+ };
1375
+ this._transcriptTurns.set([...cur.slice(0, -1), updated], undefined);
1376
+ return;
1377
+ }
1378
+ this._pushTurn({
1379
+ speaker: "assistant",
1380
+ text,
1381
+ committed: "",
1382
+ isPartial: false
1383
+ });
1384
+ }
1385
+ _cancelTranscriptFade() {
1386
+ if (this._transcriptFadeTimer) {
1387
+ clearTimeout(this._transcriptFadeTimer);
1388
+ this._transcriptFadeTimer = undefined;
1389
+ }
1390
+ }
1391
+ _persistEntry(kind, text, metadata) {
1392
+ const userId = this._userLogin;
1393
+ if (!userId || !text) {
1394
+ return;
1395
+ }
1396
+ const entry = {
1397
+ turnId: generateUuid(),
1398
+ ancestorIds: this._lastPersistedTurnId ? [this._lastPersistedTurnId] : [],
1399
+ kind,
1400
+ role: kind === "user_voice" ? "user" : "assistant",
1401
+ text,
1402
+ timestamp: ( new Date()).toISOString(),
1403
+ ...(metadata ? {
1404
+ metadata
1405
+ } : {})
1406
+ };
1407
+ this._lastPersistedTurnId = entry.turnId;
1408
+ this.voiceTranscriptStore.appendTurn(userId, entry).catch(err => {
1409
+ this.logService.warn("[voice] failed to persist transcript entry", err);
1410
+ });
1411
+ }
1412
+ _persistTurn(role, text) {
1413
+ this._persistEntry(role === "user" ? "user_voice" : "agent_voice", text);
1414
+ }
1415
+ _renderToolCallSummary(name, args) {
1416
+ if (!args || ( Object.keys(args)).length === 0) {
1417
+ return `${name}()`;
1418
+ }
1419
+ const pairs = [];
1420
+ for (const [k, v] of Object.entries(args)) {
1421
+ let rendered;
1422
+ if (typeof v === "string") {
1423
+ rendered = v.length > 200 ? `${v.slice(0, 197)}...` : v;
1424
+ rendered = JSON.stringify(rendered);
1425
+ } else {
1426
+ try {
1427
+ const json = JSON.stringify(v);
1428
+ rendered = json.length > 200 ? `${json.slice(0, 197)}...` : json;
1429
+ } catch {
1430
+ rendered = String(v);
1431
+ }
1432
+ }
1433
+ pairs.push(`${k}=${rendered}`);
1434
+ }
1435
+ return `${name}(${pairs.join(", ")})`;
1436
+ }
1437
+ _buildPriorTimeline(turns) {
1438
+ const out = [];
1439
+ for (const t of turns) {
1440
+ const kind = t.kind;
1441
+ if (!kind) {
1442
+ continue;
1443
+ }
1444
+ const entry = {
1445
+ kind,
1446
+ text: t.text,
1447
+ timestamp: ( new Date(t.timestamp)).toISOString(),
1448
+ ...(t.metadata?.toolName ? {
1449
+ toolName: t.metadata.toolName
1450
+ } : {}),
1451
+ ...(t.metadata?.codingSessionId ? {
1452
+ codingSessionId: t.metadata.codingSessionId
1453
+ } : {}),
1454
+ ...(t.metadata?.codingStatus ? {
1455
+ codingStatus: t.metadata.codingStatus
1456
+ } : {})
1457
+ };
1458
+ out.push(entry);
1459
+ }
1460
+ try {
1461
+ const sessions = this.agentSessionsService.model.sessions.filter(s => !s.isArchived());
1462
+ for (const session of sessions) {
1463
+ const model = this.chatService.getSession(session.resource);
1464
+ const lastReq = model?.getRequests().at(-1);
1465
+ const value = lastReq?.response?.response.value;
1466
+ if (!value) {
1467
+ continue;
1468
+ }
1469
+ const full = ( value.filter(p => p.kind === "markdownContent").map(p => p.content.value)).join(" ").trim();
1470
+ if (!full) {
1471
+ continue;
1472
+ }
1473
+ const summary = this._firstSentences(full, VoiceSessionController_1.CODING_AGENT_REPLY_SENTENCE_LIMIT);
1474
+ if (!summary) {
1475
+ continue;
1476
+ }
1477
+ out.push({
1478
+ kind: "coding_agent_reply",
1479
+ text: summary,
1480
+ timestamp: ( new Date()).toISOString(),
1481
+ codingSessionId: ( session.resource.toString())
1482
+ });
1483
+ }
1484
+ } catch (err) {
1485
+ this.logService.warn("[voice] failed to synthesize coding_agent_reply timeline entries", err);
1486
+ }
1487
+ return out;
1488
+ }
1489
+ _firstSentences(text, n) {
1490
+ const collapsed = text.replace(/\s+/g, " ").trim();
1491
+ if (!collapsed) {
1492
+ return "";
1493
+ }
1494
+ const sentences = [];
1495
+ const re = /[^.!?]+[.!?]+(\s|$)/g;
1496
+ let m;
1497
+ while ((m = re.exec(collapsed)) !== null && sentences.length < n) {
1498
+ sentences.push(m[0].trim());
1499
+ }
1500
+ if (sentences.length === 0) {
1501
+ return collapsed.length > 600 ? `${collapsed.slice(0, 597)}...` : collapsed;
1502
+ }
1503
+ return sentences.join(" ");
1504
+ }
1505
+ _enqueueAudio(sessionId, audio, isFirstChunk, isFinal, transcript) {
1506
+ if (this._suppressIncomingAudio) {
1507
+ if (isFirstChunk) {
1508
+ this._suppressIncomingAudio = false;
1509
+ } else {
1510
+ return;
1511
+ }
1512
+ }
1513
+ if (isFirstChunk) {
1514
+ this._clearAwaitingReply();
1515
+ }
1516
+ const nothingPlaying = this._currentPlaybackSessionId === null;
1517
+ const sameSession = !nothingPlaying && this._currentPlaybackSessionId === sessionId;
1518
+ if ((nothingPlaying && this._audioQueue.length === 0) || sameSession) {
1519
+ this._playChunk(sessionId, audio, isFirstChunk, isFinal, transcript);
1520
+ return;
1521
+ }
1522
+ let entry = this._audioQueue.find(
1523
+ e => e.sessionId === sessionId || (e.sessionId === undefined && sessionId === undefined)
1524
+ );
1525
+ if (!entry) {
1526
+ entry = {
1527
+ sessionId,
1528
+ chunks: []
1529
+ };
1530
+ this._audioQueue.push(entry);
1531
+ }
1532
+ entry.chunks.push({
1533
+ audio,
1534
+ isFirstChunk,
1535
+ isFinal,
1536
+ transcript
1537
+ });
1538
+ if (this._currentPlaybackSessionId === null && !this._isProcessingQueue) {
1539
+ this._processQueue();
1540
+ }
1541
+ }
1542
+ _playChunk(sessionId, audio, isFirstChunk, isFinal, transcript) {
1543
+ this._currentPlaybackSessionId = sessionId;
1544
+ if (transcript) {
1545
+ this._setAssistantTurn(transcript, {
1546
+ startNewTurn: isFirstChunk
1547
+ });
1548
+ }
1549
+ const sessionResource = sessionId ? ( URI.parse(sessionId)) : undefined;
1550
+ if (sessionResource) {
1551
+ this.voicePlaybackService.notifyPlaybackStart(sessionResource, transcript);
1552
+ }
1553
+ const ttsEnabled = this.configurationService.getValue("agents.voice.textToSpeech") !== false;
1554
+ if (ttsEnabled && audio) {
1555
+ this._clearAutoListenTimer();
1556
+ this._replyPlayedSinceSend = true;
1557
+ this.micCaptureService.suppressUntil(Date.now() + 800);
1558
+ this._voiceState.set("speaking", undefined);
1559
+ this._statusText.set("Speaking...", undefined);
1560
+ this.ttsPlaybackService.playAudioChunk(audio, isFinal, this._window);
1561
+ } else if (!ttsEnabled) {
1562
+ this._replyPlayedSinceSend = true;
1563
+ if (isFinal) {
1564
+ this._currentPlaybackSessionId = null;
1565
+ this._processQueue();
1566
+ if (this._isAutoSendEnabled()) {
1567
+ this._scheduleAutoListen();
1568
+ }
1569
+ }
1570
+ } else {
1571
+ this.ttsPlaybackService.playAudioChunk(audio, isFinal, this._window);
1572
+ }
1573
+ }
1574
+ _processQueue() {
1575
+ if (this._audioQueue.length === 0 || this._currentPlaybackSessionId !== null) {
1576
+ this._isProcessingQueue = false;
1577
+ return;
1578
+ }
1579
+ this._isProcessingQueue = true;
1580
+ const next = this._audioQueue.shift();
1581
+ for (const chunk of next.chunks) {
1582
+ this._playChunk(
1583
+ next.sessionId,
1584
+ chunk.audio,
1585
+ chunk.isFirstChunk,
1586
+ chunk.isFinal,
1587
+ chunk.transcript
1588
+ );
1589
+ }
1590
+ this._isProcessingQueue = false;
1591
+ }
1592
+ _replaySessionAudio(sessionId) {
1593
+ this._stopReplay();
1594
+ const samples = this._sessionAudioCache.get(sessionId);
1595
+ if (!samples || !this._window) {
1596
+ return;
1597
+ }
1598
+ const ctx = this.ttsPlaybackService.ensureContext(this._window);
1599
+ const buffer = ctx.createBuffer(1, samples.length, 24000);
1600
+ buffer.getChannelData(0).set(samples);
1601
+ const source = ctx.createBufferSource();
1602
+ source.buffer = buffer;
1603
+ source.connect(ctx.destination);
1604
+ this._replaySourceNode = source;
1605
+ const sessionResource = ( URI.parse(sessionId));
1606
+ this.voicePlaybackService.notifyPlaybackStart(sessionResource, undefined);
1607
+ this._voiceState.set("speaking", undefined);
1608
+ this._statusText.set("Replaying...", undefined);
1609
+ source.onended = () => {
1610
+ if (this._replaySourceNode === source) {
1611
+ this._replaySourceNode = undefined;
1612
+ this.voicePlaybackService.notifyPlaybackEnd(sessionResource);
1613
+ this._voiceState.set("idle", undefined);
1614
+ this._statusText.set("Hold to speak...", undefined);
1615
+ }
1616
+ };
1617
+ source.start(0);
1618
+ }
1619
+ _stopReplay() {
1620
+ if (this._replaySourceNode) {
1621
+ try {
1622
+ this._replaySourceNode.stop();
1623
+ } catch {}
1624
+ this._replaySourceNode = undefined;
1625
+ }
1626
+ }
1627
+ _sendContext() {
1628
+ this.voiceClientService.sendSessionContext(this._buildSessionContext());
1629
+ }
1630
+ _armConfirmationFlushWatchdog(sessionId, label, isTransition) {
1631
+ if (( this._confirmationFlushWatchdogs.has(sessionId))) {
1632
+ return;
1633
+ }
1634
+ if (isTransition) {
1635
+ this.logService.info(
1636
+ `[voice] arming confirmation flush watchdog id=${sessionId.slice(-32)} label="${label}"`
1637
+ );
1638
+ }
1639
+ const timer = setTimeout(() => {
1640
+ this._confirmationFlushWatchdogs.delete(sessionId);
1641
+ this.logService.info(
1642
+ `[voice] confirmation flush watchdog firing id=${sessionId.slice(-32)} label="${label}"`
1643
+ );
1644
+ this._sendContext();
1645
+ this.voiceClientService.flushSessionContext();
1646
+ }, VoiceSessionController_1._CONFIRMATION_FLUSH_DELAY_MS);
1647
+ this._confirmationFlushWatchdogs.set(sessionId, timer);
1648
+ }
1649
+ _checkSessionStateChanges() {
1650
+ const sessions = this.agentSessionsService.model.sessions.filter(s => !s.isArchived());
1651
+ const stateChanges = [];
1652
+ const processedResources = ( new Set());
1653
+ for (const s of sessions) {
1654
+ processedResources.add(( s.resource.toString()));
1655
+ const sessionId = ( s.resource.toString());
1656
+ const model = this.chatService.getSession(s.resource);
1657
+ let currentState;
1658
+ let detail;
1659
+ let lastResponseSummary;
1660
+ if (model) {
1661
+ const info = this._getAgentStateInfo(model);
1662
+ currentState = info.state;
1663
+ detail = info.detail;
1664
+ lastResponseSummary = info.last_response_summary;
1665
+ this._pendingIdleNarration.delete(sessionId);
1666
+ } else {
1667
+ currentState = s.status === ChatSessionStatus.InProgress ? "thinking" : s.status === ChatSessionStatus.NeedsInput ? "waiting_for_confirmation" : s.status === ChatSessionStatus.Completed ? "idle" : "unknown";
1668
+ if (s.status === ChatSessionStatus.NeedsInput) {
1669
+ this._ensureModelLoaded(s.resource);
1670
+ }
1671
+ }
1672
+ const prev = this._prevSessionStates.get(sessionId);
1673
+ const isStateChange = prev !== undefined && prev.state !== currentState && currentState !== "unknown";
1674
+ const isDetailChange = !isStateChange && prev !== undefined && currentState === "waiting_for_confirmation" && (detail ?? "") !== prev.detail;
1675
+ if (!model && currentState === "idle" && isStateChange) {
1676
+ this._deferIdleNarrationUntilModelLoaded(s.resource);
1677
+ continue;
1678
+ }
1679
+ if (isStateChange || isDetailChange) {
1680
+ const cancelExpiry = this._userCancelledSessions.get(sessionId);
1681
+ if (cancelExpiry) {
1682
+ clearTimeout(cancelExpiry);
1683
+ this._userCancelledSessions.delete(sessionId);
1684
+ } else {
1685
+ if (isDetailChange) {
1686
+ this.voiceClientService.invalidateSessionCache(sessionId);
1687
+ }
1688
+ stateChanges.push({
1689
+ sessionId,
1690
+ currentState,
1691
+ label: s.label || "Untitled session",
1692
+ detail,
1693
+ lastResponseSummary
1694
+ });
1695
+ }
1696
+ }
1697
+ if (currentState !== "unknown") {
1698
+ this._prevSessionStates.set(sessionId, {
1699
+ state: currentState,
1700
+ detail: detail ?? ""
1701
+ });
1702
+ }
1703
+ }
1704
+ for (const chatModel of this.chatService.chatModels.get()) {
1705
+ const key = ( chatModel.sessionResource.toString());
1706
+ if (( processedResources.has(key))) {
1707
+ continue;
1708
+ }
1709
+ if (chatModel.getRequests().length === 0) {
1710
+ continue;
1711
+ }
1712
+ const info = this._getAgentStateInfo(chatModel);
1713
+ const currentState = info.state;
1714
+ const detail = info.detail;
1715
+ const lastResponseSummary = info.last_response_summary;
1716
+ const prev = this._prevSessionStates.get(key);
1717
+ const isStateChange = prev !== undefined && prev.state !== currentState && currentState !== "unknown";
1718
+ const isDetailChange = !isStateChange && prev !== undefined && currentState === "waiting_for_confirmation" && (detail ?? "") !== prev.detail;
1719
+ if (isStateChange || isDetailChange) {
1720
+ if (isDetailChange) {
1721
+ this.voiceClientService.invalidateSessionCache(key);
1722
+ }
1723
+ stateChanges.push({
1724
+ sessionId: key,
1725
+ currentState,
1726
+ label: chatModel.title || "Chat",
1727
+ detail,
1728
+ lastResponseSummary
1729
+ });
1730
+ }
1731
+ if (currentState !== "unknown") {
1732
+ this._prevSessionStates.set(key, {
1733
+ state: currentState,
1734
+ detail: detail ?? ""
1735
+ });
1736
+ }
1737
+ }
1738
+ if (stateChanges.length > 0) {
1739
+ this.logService.info(
1740
+ `[voice] onDidChangeSessions detected ${stateChanges.length} state change(s): ${( stateChanges.map(c => `${c.label}: ${c.currentState}`)).join(", ")}`
1741
+ );
1742
+ this._sendContext();
1743
+ this.voiceClientService.flushSessionContext();
1744
+ for (const change of stateChanges) {
1745
+ this._persistEntry("coding_event", `session "${change.label}" → ${change.currentState}`, {
1746
+ codingSessionId: change.sessionId,
1747
+ codingStatus: change.currentState,
1748
+ codingSessionLabel: change.label
1749
+ });
1750
+ }
1751
+ }
1752
+ }
1753
+ _buildSessionContext() {
1754
+ const oneHourAgo = Date.now() - 60 * 60 * 1000;
1755
+ const sessions = this.agentSessionsService.model.sessions.filter(s => {
1756
+ if (s.isArchived()) {
1757
+ return false;
1758
+ }
1759
+ if (s.status === ChatSessionStatus.InProgress || s.status === ChatSessionStatus.NeedsInput) {
1760
+ return true;
1761
+ }
1762
+ if (s.status === ChatSessionStatus.Completed) {
1763
+ const endedAt = s.timing.lastRequestEnded ?? s.timing.created;
1764
+ return endedAt !== undefined && endedAt > oneHourAgo;
1765
+ }
1766
+ return false;
1767
+ });
1768
+ const targetSessionId = this._targetSession.get()?.toString();
1769
+ const sessionList = ( sessions.map(s => {
1770
+ const model = this.chatService.getSession(s.resource);
1771
+ const isActive = ( s.resource.toString()) === targetSessionId;
1772
+ if (!model) {
1773
+ const sessionIdStr = ( s.resource.toString());
1774
+ let fallbackState = s.status === ChatSessionStatus.InProgress ? "thinking" : s.status === ChatSessionStatus.NeedsInput ? "waiting_for_confirmation" : s.status === ChatSessionStatus.Completed ? "idle" : "unknown";
1775
+ if (fallbackState === "idle" && ( this._pendingIdleNarration.has(sessionIdStr))) {
1776
+ const prev = this._prevSessionStates.get(sessionIdStr);
1777
+ if (prev?.state) {
1778
+ fallbackState = prev.state;
1779
+ }
1780
+ }
1781
+ return {
1782
+ id: sessionIdStr,
1783
+ is_active: isActive,
1784
+ agent_state: fallbackState
1785
+ };
1786
+ }
1787
+ const stateInfo = this._getAgentStateInfo(model);
1788
+ return {
1789
+ id: ( s.resource.toString()),
1790
+ is_active: isActive,
1791
+ agent_state: stateInfo.state,
1792
+ ...(stateInfo.detail ? {
1793
+ agent_state_detail: stateInfo.detail
1794
+ } : {}),
1795
+ ...(stateInfo.last_response_summary ? {
1796
+ last_response_summary: stateInfo.last_response_summary
1797
+ } : {})
1798
+ };
1799
+ }));
1800
+ const agentResources = ( new Set(( this.agentSessionsService.model.sessions.map(s => ( s.resource.toString())))));
1801
+ for (const chatModel of this.chatService.chatModels.get()) {
1802
+ const key = ( chatModel.sessionResource.toString());
1803
+ if (( agentResources.has(key))) {
1804
+ continue;
1805
+ }
1806
+ if (chatModel.getRequests().length === 0) {
1807
+ continue;
1808
+ }
1809
+ const stateInfo = this._getAgentStateInfo(chatModel);
1810
+ if (stateInfo.state === "idle") {
1811
+ const lastActive = chatModel.lastMessageDate;
1812
+ if (lastActive < oneHourAgo) {
1813
+ continue;
1814
+ }
1815
+ }
1816
+ sessionList.push({
1817
+ id: key,
1818
+ is_active: key === targetSessionId,
1819
+ agent_state: stateInfo.state,
1820
+ ...(stateInfo.detail ? {
1821
+ agent_state_detail: stateInfo.detail
1822
+ } : {}),
1823
+ ...(stateInfo.last_response_summary ? {
1824
+ last_response_summary: stateInfo.last_response_summary
1825
+ } : {})
1826
+ });
1827
+ }
1828
+ const context = {
1829
+ sessions: sessionList,
1830
+ display_locale: this._window?.navigator.language
1831
+ };
1832
+ return context;
1833
+ }
1834
+ _ensureModelLoaded(resource) {
1835
+ const key = ( resource.toString());
1836
+ if (( this._eagerModelRefs.has(key)) || ( this._eagerModelLoading.has(key)) || this.chatService.getSession(resource)) {
1837
+ return;
1838
+ }
1839
+ this.logService.info(`[voice] eagerly loading model for session ${key.slice(-32)}`);
1840
+ this._eagerModelLoading.add(key);
1841
+ const cts = ( new CancellationTokenSource());
1842
+ this.chatService.acquireOrLoadSession(
1843
+ resource,
1844
+ ChatAgentLocation.Chat,
1845
+ cts.token,
1846
+ "VoiceSessionController#eagerLoad"
1847
+ ).then(ref => {
1848
+ this._eagerModelLoading.delete(key);
1849
+ if (ref) {
1850
+ const existing = this._eagerModelRefs.get(key);
1851
+ if (!this._isConnected.get() || existing) {
1852
+ ref.dispose();
1853
+ if (!this._isConnected.get()) {
1854
+ this._pendingIdleNarration.delete(key);
1855
+ }
1856
+ } else {
1857
+ this._eagerModelRefs.set(key, ref);
1858
+ }
1859
+ } else {
1860
+ this._pendingIdleNarration.delete(key);
1861
+ }
1862
+ cts.dispose();
1863
+ }, () => {
1864
+ this._eagerModelLoading.delete(key);
1865
+ this._pendingIdleNarration.delete(key);
1866
+ cts.dispose();
1867
+ });
1868
+ }
1869
+ _deferIdleNarrationUntilModelLoaded(resource) {
1870
+ this._pendingIdleNarration.add(( resource.toString()));
1871
+ this._ensureModelLoaded(resource);
1872
+ }
1873
+ _getAgentStateInfo(model) {
1874
+ if (!model) {
1875
+ return {
1876
+ state: "unknown"
1877
+ };
1878
+ }
1879
+ const lastRequest = model.getRequests().at(-1);
1880
+ const pendingConfirmation = lastRequest?.response?.isPendingConfirmation.get();
1881
+ if (pendingConfirmation) {
1882
+ let confirmDetail = "";
1883
+ for (const part of lastRequest?.response?.response.value ?? []) {
1884
+ if (part.kind === "questionCarousel" && !part.isUsed) {
1885
+ const carousel = part;
1886
+ const titles = ( (carousel.questions ?? []).map(q => q.title)).filter(Boolean);
1887
+ if (titles.length > 0) {
1888
+ confirmDetail = `questions: ${titles.join(", ")}`;
1889
+ } else {
1890
+ const msg = carousel.message;
1891
+ confirmDetail = msg ? (typeof msg === "string" ? msg : msg.value) : "asking clarifying questions";
1892
+ }
1893
+ } else if (part.kind === "planReview" && !part.isUsed) {
1894
+ confirmDetail = "review the plan to continue";
1895
+ } else if (part.kind === "elicitation2") {
1896
+ const elicitation = part;
1897
+ if (elicitation.state.get() === "pending") {
1898
+ const title = elicitation.title;
1899
+ confirmDetail = title ? (typeof title === "string" ? title : title.value) : "needs input";
1900
+ }
1901
+ } else if (part.kind === "confirmation" && !part.isUsed) {
1902
+ const conf = part;
1903
+ confirmDetail = conf.title ?? "needs approval";
1904
+ } else if (part.kind === "toolInvocation") {
1905
+ const state = part.state.get();
1906
+ if (state.type === IChatToolInvocation.StateKind.WaitingForConfirmation) {
1907
+ const params = state.parameters;
1908
+ const command = params?.["command"] ?? params?.["input"];
1909
+ const explanation = params?.["explanation"] ?? params?.["goal"];
1910
+ if (typeof command === "string" && command) {
1911
+ confirmDetail = `command: ${command}`;
1912
+ if (typeof explanation === "string" && explanation) {
1913
+ confirmDetail += `\nreason: ${explanation}`;
1914
+ }
1915
+ } else {
1916
+ confirmDetail = pendingConfirmation.detail ?? "";
1917
+ }
1918
+ }
1919
+ }
1920
+ }
1921
+ return {
1922
+ state: "waiting_for_confirmation",
1923
+ detail: confirmDetail || pendingConfirmation.detail || ""
1924
+ };
1925
+ }
1926
+ if (lastRequest?.response) {
1927
+ let fallbackDetail;
1928
+ for (const part of lastRequest.response.response.value) {
1929
+ if (part.kind === "toolInvocation") {
1930
+ const state = part.state.get();
1931
+ if (state.type === IChatToolInvocation.StateKind.WaitingForConfirmation) {
1932
+ const params = state.parameters;
1933
+ const questions = params?.["questions"];
1934
+ let detail = "";
1935
+ if (Array.isArray(questions) && questions.length > 0) {
1936
+ const headers = ( questions.map(q => q["header"] || q["question"])).filter(Boolean).join(", ");
1937
+ detail = headers ? `questions: ${headers}` : "asking clarifying questions";
1938
+ }
1939
+ if (!detail) {
1940
+ const invMsg = part.invocationMessage;
1941
+ detail = invMsg ? (typeof invMsg === "string" ? invMsg : invMsg.value) : "needs input";
1942
+ }
1943
+ fallbackDetail = detail;
1944
+ }
1945
+ }
1946
+ }
1947
+ if (fallbackDetail !== undefined) {
1948
+ return {
1949
+ state: "waiting_for_confirmation",
1950
+ detail: fallbackDetail
1951
+ };
1952
+ }
1953
+ }
1954
+ const incomplete = lastRequest?.response?.isIncomplete.get() ?? false;
1955
+ if (incomplete) {
1956
+ return {
1957
+ state: "thinking"
1958
+ };
1959
+ }
1960
+ const responseText = lastRequest?.response?.response.getMarkdown().trim() ?? "";
1961
+ return {
1962
+ state: "idle",
1963
+ ...(responseText ? {
1964
+ last_response_summary: responseText
1965
+ } : {})
1966
+ };
1967
+ }
1968
+ _classifyPendingType(response) {
1969
+ let result = "input";
1970
+ for (const part of response.response.value) {
1971
+ if (part.kind === "toolInvocation") {
1972
+ const invocation = part;
1973
+ const state = invocation.state.get();
1974
+ if (state.type === IChatToolInvocation.StateKind.WaitingForConfirmation || state.type === IChatToolInvocation.StateKind.WaitingForPostApproval) {
1975
+ result = "approval";
1976
+ }
1977
+ }
1978
+ if (part.kind === "confirmation" && !part.isUsed) {
1979
+ result = "approval";
1980
+ }
1981
+ if (part.kind === "questionCarousel" && !part.isUsed) {
1982
+ result = "input";
1983
+ }
1984
+ if (part.kind === "planReview" && !part.isUsed) {
1985
+ result = "input";
1986
+ }
1987
+ if (part.kind === "elicitation2") {
1988
+ result = "input";
1989
+ }
1990
+ }
1991
+ return result;
1992
+ }
1993
+ _getConfirmationDescription(response) {
1994
+ let desc = "";
1995
+ for (const part of response.response.value) {
1996
+ if (part.kind === "toolInvocation") {
1997
+ const invocation = part;
1998
+ const state = invocation.state.get();
1999
+ if (state.type === IChatToolInvocation.StateKind.WaitingForConfirmation) {
2000
+ const params = state.parameters;
2001
+ const command = params?.["command"] ?? params?.["input"];
2002
+ const explanation = params?.["explanation"] ?? params?.["goal"];
2003
+ if (typeof command === "string" && command) {
2004
+ desc = typeof explanation === "string" ? `${command} — ${explanation}` : command;
2005
+ }
2006
+ }
2007
+ } else if (part.kind === "questionCarousel" && !part.isUsed) {
2008
+ const carousel = part;
2009
+ const titles = ( (carousel.questions ?? []).map(q => q.title)).filter(Boolean);
2010
+ if (titles.length > 0) {
2011
+ desc = titles.join(", ");
2012
+ } else {
2013
+ const msg = carousel.message;
2014
+ desc = msg ? (typeof msg === "string" ? msg : msg.value) : "asking clarifying questions";
2015
+ }
2016
+ } else if (part.kind === "elicitation2") {
2017
+ const elicitation = part;
2018
+ if (elicitation.state.get() === "pending") {
2019
+ const title = elicitation.title;
2020
+ desc = title ? (typeof title === "string" ? title : title.value) : "needs input";
2021
+ }
2022
+ } else if (part.kind === "planReview" && !part.isUsed) {
2023
+ desc = "review the plan to continue";
2024
+ } else if (part.kind === "confirmation" && !part.isUsed) {
2025
+ desc = part.title ?? "needs approval";
2026
+ }
2027
+ }
2028
+ return desc;
2029
+ }
2030
+ _autoApproveCheck() {
2031
+ if (this._autoApprovedSessions.size === 0) {
2032
+ return;
2033
+ }
2034
+ const sessions = this.agentSessionsService.model.sessions.filter(s => !s.isArchived());
2035
+ for (const s of sessions) {
2036
+ if (!( this._autoApprovedSessions.has(( s.resource.toString())))) {
2037
+ continue;
2038
+ }
2039
+ const model = this.chatService.getSession(s.resource);
2040
+ if (!model) {
2041
+ continue;
2042
+ }
2043
+ for (const req of model.getRequests()) {
2044
+ const pending = req.response?.isPendingConfirmation.get();
2045
+ if (pending && req.response) {
2046
+ for (const part of req.response.response.value) {
2047
+ if (part.kind === "toolInvocation") {
2048
+ IChatToolInvocation.confirmWith(part, {
2049
+ type: ToolConfirmKind.UserAction
2050
+ });
2051
+ }
2052
+ }
2053
+ }
2054
+ }
2055
+ }
2056
+ }
2057
+ _getMachineId() {
2058
+ return this.environmentService.machineId ?? "unknown";
2059
+ }
2060
+ async submitFeedback(feedbackText) {
2061
+ let userId = this._userLogin;
2062
+ if (!userId) {
2063
+ try {
2064
+ const sessions = await this.authenticationService.getSessions("github");
2065
+ userId = sessions[0]?.account.label ?? "unknown";
2066
+ } catch {
2067
+ userId = "unknown";
2068
+ }
2069
+ }
2070
+ let transcriptHistory = [];
2071
+ try {
2072
+ const turns = await this.voiceTranscriptStore.loadTurns(userId);
2073
+ transcriptHistory = ( turns.map(t => ({
2074
+ role: t.role,
2075
+ text: t.text,
2076
+ timestamp: t.timestamp
2077
+ })));
2078
+ } catch (err) {
2079
+ this.logService.warn("[voice] failed to load transcript history for feedback", err);
2080
+ }
2081
+ const sessions = this.agentSessionsService.model.sessions.filter(s => !s.isArchived());
2082
+ const clientSessionState = {
2083
+ voiceState: this._voiceState.get(),
2084
+ isConnected: this._isConnected.get(),
2085
+ isConnecting: this._isConnecting.get(),
2086
+ isReconnecting: this._isReconnecting.get(),
2087
+ pendingToolConfirmations: ( this._pendingToolConfirmations.get().map(tc => ({
2088
+ type: tc.type,
2089
+ sessionLabel: tc.sessionLabel,
2090
+ description: tc.description
2091
+ }))),
2092
+ activeSessions: ( sessions.map(s => ({
2093
+ id: ( s.resource.toString()),
2094
+ label: s.label,
2095
+ status: s.status
2096
+ })))
2097
+ };
2098
+ const clientEnvironment = {
2099
+ machineId: this._getMachineId()
2100
+ };
2101
+ const payload = {
2102
+ feedbackText,
2103
+ machineId: this._getMachineId(),
2104
+ userId,
2105
+ sessionId: this.voiceClientService.currentSessionId ?? "",
2106
+ submissionId: generateUuid(),
2107
+ transcriptHistory,
2108
+ clientSessionState,
2109
+ clientEnvironment,
2110
+ timestamp: ( new Date()).toISOString()
2111
+ };
2112
+ return this.voiceClientService.submitFeedback(payload);
2113
+ }
2114
+ };
2115
+ VoiceSessionController = VoiceSessionController_1 = ( __decorate([( __param(0, IVoiceClientService)), ( __param(1, IMicCaptureService)), ( __param(2, ITtsPlaybackService)), ( __param(3, IVoiceToolDispatchService)), ( __param(4, IVoicePlaybackService)), ( __param(5, IAgentSessionsService)), ( __param(6, IChatService)), ( __param(7, ICommandService)), ( __param(8, IAuthenticationService)), ( __param(9, IVoiceTranscriptStore)), ( __param(10, ILogService)), ( __param(11, IWorkbenchEnvironmentService)), ( __param(12, ITelemetryService)), ( __param(13, IConfigurationService)), ( __param(14, IAccessibilitySignalService)), ( __param(15, IAccessibilityService))], VoiceSessionController));
2116
+
2117
+ export { VoiceSessionController };