@codingame/monaco-vscode-chat-service-override 38.0.7 → 38.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/common.js +0 -53
  2. package/index.js +0 -3
  3. package/package.json +5 -5
  4. package/session.js +0 -3
  5. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/missionControlAgentHostContribution.js +1 -1
  6. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostActions.js +1 -1
  7. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.js +1 -1
  8. package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +6 -6
  9. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.d.ts +1 -1
  10. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.js +1 -1
  11. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.d.ts +1 -1
  12. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.js +2 -2
  13. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentActions.js +1 -1
  14. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHost.contribution.js +7 -7
  15. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostChatContribution.js +4 -4
  16. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +1 -1
  17. package/vscode/src/vs/platform/agentHost/browser/webPubSubRelayTransport.d.ts +0 -135
  18. package/vscode/src/vs/platform/agentHost/browser/webPubSubRelayTransport.js +0 -510
  19. package/vscode/src/vs/platform/agentHost/common/agentModelNotices.d.ts +0 -22
  20. package/vscode/src/vs/platform/agentHost/common/agentModelNotices.js +0 -21
  21. package/vscode/src/vs/platform/agentHost/common/cloudSandboxAgentHost.d.ts +0 -273
  22. package/vscode/src/vs/platform/agentHost/common/cloudSandboxAgentHost.js +0 -61
  23. package/vscode/src/vs/platform/agentHost/common/meta/agentModelMeta.d.ts +0 -7
  24. package/vscode/src/vs/platform/agentHost/common/meta/agentModelMeta.js +0 -17
  25. package/vscode/src/vs/platform/agentHost/common/meta/copilotd/cloudSandboxProjectMeta.d.ts +0 -12
  26. package/vscode/src/vs/platform/agentHost/common/meta/copilotd/cloudSandboxProjectMeta.js +0 -48
  27. package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelEnsembleMeta.d.ts +0 -8
  28. package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelEnsembleMeta.js +0 -11
  29. package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelPricing.d.ts +0 -114
  30. package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentModelPricing.js +0 -141
  31. package/vscode/src/vs/platform/agentHost/common/taskEventReplay.d.ts +0 -48
  32. package/vscode/src/vs/platform/agentHost/common/taskEventReplay.js +0 -238
  33. package/vscode/src/vs/platform/agentHost/common/webPubSub/chunking.d.ts +0 -102
  34. package/vscode/src/vs/platform/agentHost/common/webPubSub/chunking.js +0 -260
  35. package/vscode/src/vs/platform/agentHost/common/webPubSub/framing.d.ts +0 -102
  36. package/vscode/src/vs/platform/agentHost/common/webPubSub/framing.js +0 -115
  37. package/vscode/src/vs/platform/agentHost/common/webPubSub/groups.d.ts +0 -46
  38. package/vscode/src/vs/platform/agentHost/common/webPubSub/groups.js +0 -92
  39. package/vscode/src/vs/sessions/contrib/chat/browser/newSession.d.ts +0 -9
  40. package/vscode/src/vs/sessions/contrib/chat/browser/voiceBridge.contribution.d.ts +0 -14
  41. package/vscode/src/vs/sessions/contrib/chat/browser/voiceBridge.contribution.js +0 -385
  42. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudAutomationStore.d.ts +0 -67
  43. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudAutomationStore.js +0 -695
  44. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudSandboxSessionConfig.d.ts +0 -4
  45. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/cloudSandboxSessionConfig.js +0 -39
  46. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.d.ts +0 -1
  47. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.js +0 -59
  48. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.d.ts +0 -1
  49. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.js +0 -83
  50. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsChangesets.d.ts +0 -87
  51. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsChangesets.js +0 -176
  52. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.d.ts +0 -422
  53. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.js +0 -2444
  54. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/githubCloudAutomationStore.d.ts +0 -91
  55. package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/githubCloudAutomationStore.js +0 -620
  56. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHost.contribution.d.ts +0 -1
  57. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHost.contribution.js +0 -5
  58. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHostContribution.d.ts +0 -46
  59. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHostContribution.js +0 -321
  60. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.d.ts +0 -104
  61. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.js +0 -345
  62. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.d.ts +0 -2
  63. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.js +0 -611
  64. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.d.ts +0 -20
  65. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.js +0 -85
  66. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.d.ts +0 -200
  67. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.js +0 -981
  68. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.d.ts +0 -24
  69. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +0 -206
  70. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.d.ts +0 -65
  71. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.js +0 -368
  72. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.d.ts +0 -10
  73. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.js +0 -57
  74. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.d.ts +0 -33
  75. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.js +0 -98
  76. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.d.ts +0 -32
  77. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.js +0 -186
  78. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.d.ts +0 -12
  79. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.js +0 -116
  80. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.d.ts +0 -32
  81. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.js +0 -226
  82. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.d.ts +0 -18
  83. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.js +0 -138
  84. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.d.ts +0 -32
  85. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.js +0 -29
  86. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.d.ts +0 -13
  87. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.js +0 -108
  88. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.d.ts +0 -13
  89. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.js +0 -63
  90. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/media/voiceModeOnboarding.css +0 -252
  91. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.d.ts +0 -1
  92. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.js +0 -178
  93. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.d.ts +0 -47
  94. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.js +0 -322
  95. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.d.ts +0 -146
  96. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.js +0 -890
  97. package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.d.ts +0 -132
  98. package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.js +0 -237
  99. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.d.ts +0 -120
  100. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.js +0 -234
  101. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +0 -36
  102. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +0 -164
  103. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/repositoryPicker.d.ts +0 -21
  104. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/repositoryPicker.js +0 -122
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupMicrosoftProbe.d.ts +0 -82
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupMicrosoftProbe.js +0 -213
  107. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxAgentHostService.d.ts +0 -40
  108. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxAgentHostService.js +0 -561
  109. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxApiService.d.ts +0 -133
  110. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxApiService.js +0 -1176
  111. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxConnectionCustomization.d.ts +0 -17
  112. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxConnectionCustomization.js +0 -76
  113. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxCredentialRefresh.d.ts +0 -54
  114. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxCredentialRefresh.js +0 -220
  115. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxHistoryCache.d.ts +0 -21
  116. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxHistoryCache.js +0 -184
  117. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxLegacySessionPreparation.d.ts +0 -8
  118. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxLegacySessionPreparation.js +0 -165
  119. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.d.ts +0 -43
  120. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxModels.js +0 -162
  121. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.d.ts +0 -40
  122. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxReadOnlySessionHandler.js +0 -129
  123. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.d.ts +0 -166
  124. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.js +0 -838
  125. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.d.ts +0 -40
  126. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionHandler.js +0 -604
  127. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxTelemetry.d.ts +0 -289
  128. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxTelemetry.js +0 -497
  129. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlCredentialSealing.d.ts +0 -6
  130. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlCredentialSealing.js +0 -41
  131. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentService.d.ts +0 -73
  132. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentService.js +0 -398
  133. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlSharingService.d.ts +0 -45
  134. package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlSharingService.js +0 -296
  135. package/vscode/src/vs/workbench/contrib/chat/browser/speechToText/voiceCodeTranscriptionClient.d.ts +0 -63
  136. package/vscode/src/vs/workbench/contrib/chat/browser/speechToText/voiceCodeTranscriptionClient.js +0 -361
  137. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.d.ts +0 -34
  138. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/ttsPlaybackService.js +0 -198
  139. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.d.ts +0 -131
  140. package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.js +0 -871
  141. package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.d.ts +0 -66
  142. package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.js +0 -297
  143. package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.d.ts +0 -31
  144. package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.js +0 -118
@@ -1,890 +0,0 @@
1
-
2
- import { registerCss } from '@codingame/monaco-vscode-api/css';
3
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
- import { getWindow, scheduleAtNextAnimationFrame, addDisposableListener, append, $, clearNode, EventType, isAncestorOfActiveElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
5
- import { renderFormattedText } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/formattedTextRenderer';
6
- import { status } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
7
- import { SelectBox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/selectBox/selectBox';
8
- import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
9
- import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
10
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
11
- import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
12
- import { Disposable, MutableDisposable, toDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
13
- import { FileAccess } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
14
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
15
- import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
16
- import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
17
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
18
- import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
19
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
20
- import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
21
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
22
- import { IContextViewService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
23
- import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
24
- import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
25
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
26
- import { CONFIGURE_VOICE_INSTRUCTIONS_ACTION_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/configureVoiceInstructionsAction';
27
- import { ChatInputOnboarding } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/input/chatInputOnboarding';
28
- import { ChatInputNoticeWidget, ChatInputNoticeVariant } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/input/chatInputNoticeWidget';
29
- import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
30
- import { defaultSelectBoxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
31
- import { asCssVariableWithDefault, asCssVariable } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
32
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
33
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
34
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
35
- import { selectListBackground, selectBackground } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
36
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
37
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
38
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
39
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
40
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
41
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
42
- import { AgentsVoiceStorageKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/agentsVoice/common/agentsVoice';
43
- import { buildMicrophoneOptions, indexOfMicrophone } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/speechToText/dictationOnboarding';
44
- import * as voiceModeOnboarding from './media/voiceModeOnboarding.css';
45
-
46
- registerCss(voiceModeOnboarding, 1);
47
- const VOICE_SETTING = "agents.voice.voice";
48
- const VOICE_LANGUAGE_SETTING = "agents.voice.language";
49
- const VOICE_SETTINGS_COMMAND = "agentsVoice.openSettings";
50
- const VOICES = [{
51
- id: "birch_neutral",
52
- sampleId: "maya_neutral",
53
- label: ( localize(8770, "Birch (Default)")),
54
- signature: [{
55
- frequency: 1.0,
56
- amplitude: 0.42,
57
- speed: 0.42,
58
- phase: 0.0
59
- }, {
60
- frequency: 1.7,
61
- amplitude: 0.26,
62
- speed: -0.31,
63
- phase: 1.1
64
- }, {
65
- frequency: 2.6,
66
- amplitude: 0.19,
67
- speed: 0.24,
68
- phase: 2.4
69
- }, {
70
- frequency: 4.1,
71
- amplitude: 0.13,
72
- speed: -0.18,
73
- phase: 0.7
74
- }]
75
- }, {
76
- id: "harper_neutral",
77
- sampleId: "victoria_neutral",
78
- label: ( localize(8771, "Harper")),
79
- signature: [{
80
- frequency: 1.4,
81
- amplitude: 0.38,
82
- speed: 0.52,
83
- phase: 0.0
84
- }, {
85
- frequency: 2.3,
86
- amplitude: 0.27,
87
- speed: -0.38,
88
- phase: 1.1
89
- }, {
90
- frequency: 3.6,
91
- amplitude: 0.21,
92
- speed: 0.30,
93
- phase: 2.4
94
- }, {
95
- frequency: 5.2,
96
- amplitude: 0.14,
97
- speed: -0.22,
98
- phase: 0.7
99
- }]
100
- }, {
101
- id: "oak_neutral",
102
- sampleId: "kevin_neutral",
103
- label: ( localize(8772, "Oak")),
104
- signature: [{
105
- frequency: 0.7,
106
- amplitude: 0.48,
107
- speed: 0.30,
108
- phase: 0.4
109
- }, {
110
- frequency: 1.2,
111
- amplitude: 0.28,
112
- speed: -0.22,
113
- phase: 1.7
114
- }, {
115
- frequency: 2.0,
116
- amplitude: 0.16,
117
- speed: 0.18,
118
- phase: 0.9
119
- }, {
120
- frequency: 3.1,
121
- amplitude: 0.09,
122
- speed: -0.14,
123
- phase: 2.2
124
- }]
125
- }, {
126
- id: "junho_neutral",
127
- sampleId: "daniel_neutral",
128
- label: ( localize(8773, "Junho")),
129
- signature: [{
130
- frequency: 0.9,
131
- amplitude: 0.44,
132
- speed: 0.24,
133
- phase: 1.3
134
- }, {
135
- frequency: 1.5,
136
- amplitude: 0.30,
137
- speed: -0.18,
138
- phase: 0.2
139
- }, {
140
- frequency: 2.4,
141
- amplitude: 0.14,
142
- speed: 0.15,
143
- phase: 2.0
144
- }, {
145
- frequency: 3.4,
146
- amplitude: 0.10,
147
- speed: -0.12,
148
- phase: 1.5
149
- }]
150
- }];
151
- const LOCALIZED_VOICES = {
152
- de: {
153
- id: "de_marc_neutral",
154
- label: ( localize(8774, "Marc"))
155
- },
156
- es: {
157
- id: "es-ES_maria_neutral",
158
- label: ( localize(8775, "Maria"))
159
- },
160
- fr: {
161
- id: "fr_david_neutral",
162
- label: ( localize(8776, "David"))
163
- },
164
- it: {
165
- id: "it_eva_neutral",
166
- label: ( localize(8777, "Eva"))
167
- },
168
- ja: {
169
- id: "ja_aruha_neutral",
170
- label: ( localize(8778, "Aruha"))
171
- },
172
- ko: {
173
- id: "ko_jiyon_neutral",
174
- label: ( localize(8779, "Jiyon"))
175
- },
176
- pt: {
177
- id: "pt-BR_gil_neutral",
178
- label: ( localize(8780, "Gil"))
179
- },
180
- zh: {
181
- id: "zh_wuzhi_neutral",
182
- label: ( localize(8781, "Wuzhi"))
183
- }
184
- };
185
- function localizedVoiceForLanguage(language) {
186
- try {
187
- const canonical = Intl.getCanonicalLocales(language.trim())[0];
188
- const base = canonical?.split("-")[0].toLowerCase();
189
- return base ? LOCALIZED_VOICES[base] : undefined;
190
- } catch {
191
- return undefined;
192
- }
193
- }
194
- const RESTING_SIGNATURE = VOICES[0].signature.map((_, index) => {
195
- const components = VOICES.map(voice => voice.signature[index]);
196
- const mean = pick => components.reduce((sum, wave) => sum + pick(wave), 0) / components.length;
197
- return {
198
- frequency: mean(wave => wave.frequency),
199
- amplitude: mean(wave => wave.amplitude),
200
- speed: mean(wave => wave.speed),
201
- phase: mean(wave => wave.phase)
202
- };
203
- });
204
- const IDLE_CYCLE_SECONDS = 2.6;
205
- const WAVE_TEMPO = (2 * Math.PI) / IDLE_CYCLE_SECONDS / Math.abs(RESTING_SIGNATURE[0].speed);
206
- const IDLE_GAIN = 0.5;
207
- const SPEAKING_GAIN = 0.45;
208
- const IDLE_MOTION = 0.2;
209
- const SPEAKING_MOTION = 0.8;
210
- const LEVEL_EASING = 0.08;
211
- const SIGNATURE_EASING = 0.06;
212
- const REFERENCE_FRAME_SECONDS = 1 / 60;
213
- const BAR_WIDTH = 1;
214
- const BAR_GAP = 2;
215
- const BAR_MIN = 1;
216
- function cloneSignature(signature) {
217
- return signature.map(wave => ({
218
- ...wave,
219
- oscillation: 0
220
- }));
221
- }
222
- function easingFactor(perFrameEasing, dt) {
223
- return 1 - Math.pow(1 - perFrameEasing, dt / REFERENCE_FRAME_SECONDS);
224
- }
225
- function easeSignature(current, target, factor) {
226
- for (let i = 0; i < current.length && i < target.length; i++) {
227
- current[i].frequency += (target[i].frequency - current[i].frequency) * factor;
228
- current[i].amplitude += (target[i].amplitude - current[i].amplitude) * factor;
229
- current[i].speed += (target[i].speed - current[i].speed) * factor;
230
- current[i].phase += (target[i].phase - current[i].phase) * factor;
231
- }
232
- }
233
- function advanceOscillation(waves, dt) {
234
- const tau = 2 * Math.PI;
235
- for (const wave of waves) {
236
- wave.oscillation = (wave.oscillation + wave.speed * WAVE_TEMPO * dt) % tau;
237
- }
238
- }
239
- function drawBars(context, width, height, waves, gain) {
240
- const pitch = BAR_WIDTH + BAR_GAP;
241
- const count = Math.max(1, Math.floor(width / pitch));
242
- const inset = (width - (count * pitch - BAR_GAP)) / 2;
243
- const centerY = height / 2;
244
- const maxHalf = height / 2;
245
- for (let index = 0; index < count; index++) {
246
- const position = count > 1 ? index / (count - 1) : 0;
247
- const amount = bandFraction(position, waves) * gain;
248
- const half = Math.max(BAR_MIN / 2, Math.min(maxHalf, amount * maxHalf));
249
- context.beginPath();
250
- context.roundRect(inset + index * pitch, centerY - half, BAR_WIDTH, half * 2, BAR_WIDTH / 2);
251
- context.fill();
252
- }
253
- }
254
- function bandFraction(position, waves) {
255
- let amplitude = 0;
256
- let total = 0;
257
- for (const wave of waves) {
258
- const phase = position * wave.frequency * Math.PI * 2 + wave.oscillation + wave.phase;
259
- amplitude += (0.5 + 0.5 * Math.sin(phase)) * wave.amplitude;
260
- total += wave.amplitude;
261
- }
262
- if (total === 0) {
263
- return 0;
264
- }
265
- const taper = Math.sin(Math.PI * Math.min(1, Math.max(0, position)));
266
- return (amplitude / total) * (0.35 + 0.65 * taper);
267
- }
268
- let VoiceModeOnboardingAnimator = class VoiceModeOnboardingAnimator extends Disposable {
269
- constructor(canvas, container, source, themeService, accessibilityService) {
270
- super();
271
- this.canvas = canvas;
272
- this.container = container;
273
- this.source = source;
274
- this.themeService = themeService;
275
- this.accessibilityService = accessibilityService;
276
- this.animationFrame = this._register(( new MutableDisposable()));
277
- this.width = 0;
278
- this.height = 0;
279
- this.running = false;
280
- this.suspended = false;
281
- this.level = 0;
282
- this.stroke = "";
283
- const context = canvas.getContext("2d");
284
- if (!context) {
285
- throw ( new Error("Failed to create the Voice Mode onboarding canvas context"));
286
- }
287
- this.context = context;
288
- this.waves = cloneSignature(this.source.getSignature());
289
- const targetWindow = getWindow(container);
290
- const observer = new targetWindow.ResizeObserver(() => this.resize());
291
- observer.observe(container);
292
- this._register(toDisposable(() => observer.disconnect()));
293
- this._register(this.themeService.onDidColorThemeChange(() => {
294
- this.readStroke();
295
- this.draw(targetWindow.performance.now());
296
- }));
297
- this._register(
298
- this.accessibilityService.onDidChangeReducedMotion(() => this.updateMotion())
299
- );
300
- this._register(toDisposable(() => this.stop()));
301
- this.readStroke();
302
- this.resize();
303
- this.updateMotion();
304
- }
305
- readStroke() {
306
- this.stroke = getWindow(this.canvas).getComputedStyle(this.canvas).color;
307
- }
308
- updateMotion() {
309
- if (this.suspended || this.accessibilityService.isMotionReduced()) {
310
- this.stop();
311
- this.draw(getWindow(this.container).performance.now());
312
- } else {
313
- this.start();
314
- }
315
- }
316
- setSuspended(suspended) {
317
- if (this.suspended === suspended) {
318
- return;
319
- }
320
- this.suspended = suspended;
321
- this.updateMotion();
322
- }
323
- start() {
324
- if (this.running) {
325
- return;
326
- }
327
- this.running = true;
328
- this.lastTimestamp = undefined;
329
- const targetWindow = getWindow(this.container);
330
- const tick = time => {
331
- if (!this.running) {
332
- return;
333
- }
334
- this.draw(time);
335
- this.animationFrame.value = scheduleAtNextAnimationFrame(targetWindow, () => tick(targetWindow.performance.now()));
336
- };
337
- this.animationFrame.value = scheduleAtNextAnimationFrame(targetWindow, () => tick(targetWindow.performance.now()));
338
- }
339
- stop() {
340
- this.running = false;
341
- this.animationFrame.clear();
342
- }
343
- resize() {
344
- const targetWindow = getWindow(this.container);
345
- const devicePixelRatio = targetWindow.devicePixelRatio || 1;
346
- this.width = this.container.offsetWidth;
347
- this.height = this.container.offsetHeight;
348
- if (!this.width || !this.height) {
349
- return;
350
- }
351
- this.canvas.width = this.width * devicePixelRatio;
352
- this.canvas.height = this.height * devicePixelRatio;
353
- this.context.setTransform(devicePixelRatio, 0, 0, devicePixelRatio, 0, 0);
354
- this.draw(targetWindow.performance.now());
355
- }
356
- draw(timestamp) {
357
- if (!this.width || !this.height) {
358
- return;
359
- }
360
- const dt = !this.running || this.lastTimestamp === undefined ? 0 : Math.max(0, (timestamp - this.lastTimestamp) * 0.001);
361
- this.lastTimestamp = timestamp;
362
- this.level += (this.source.getLevel() - this.level) * easingFactor(LEVEL_EASING, dt);
363
- easeSignature(this.waves, this.source.getSignature(), easingFactor(SIGNATURE_EASING, dt));
364
- advanceOscillation(this.waves, dt * (IDLE_MOTION + this.level * SPEAKING_MOTION));
365
- const gain = IDLE_GAIN + this.level * SPEAKING_GAIN;
366
- this.context.clearRect(0, 0, this.width, this.height);
367
- this.context.fillStyle = this.stroke;
368
- drawBars(this.context, this.width, this.height, this.waves, gain);
369
- }
370
- };
371
- VoiceModeOnboardingAnimator = ( __decorate([( __param(3, IThemeService)), ( __param(4, IAccessibilityService))], VoiceModeOnboardingAnimator));
372
- let VoiceSamplePlayer = class VoiceSamplePlayer extends Disposable {
373
- get playingVoice() {
374
- return this._playingVoice;
375
- }
376
- constructor(element, audioFactory, logService) {
377
- super();
378
- this.element = element;
379
- this.audioFactory = audioFactory;
380
- this.logService = logService;
381
- this.playback = this._register(( new MutableDisposable()));
382
- this._onDidChangePlayingVoice = this._register(( new Emitter()));
383
- this.onDidChangePlayingVoice = this._onDidChangePlayingVoice.event;
384
- this._register(toDisposable(() => this.stop()));
385
- }
386
- getLevel() {
387
- if (!this.analyser || !this.levels || !this._playingVoice) {
388
- return 0;
389
- }
390
- this.analyser.getByteTimeDomainData(this.levels);
391
- let sum = 0;
392
- for (const sample of this.levels) {
393
- const centered = (sample - 128) / 128;
394
- sum += centered * centered;
395
- }
396
- return Math.min(1, Math.sqrt(sum / this.levels.length) * 3.2);
397
- }
398
- play(sampleId, playingVoice = sampleId) {
399
- this.stop();
400
- try {
401
- const audio = this.ensureAudio();
402
- audio.src = ( ( FileAccess.asBrowserUri(`vs/workbench/contrib/agentsVoice/browser/media/${sampleId}.mp3`)).toString(true));
403
- const store = ( new DisposableStore());
404
- store.add(addDisposableListener(audio, "ended", () => this.stop()));
405
- store.add(addDisposableListener(audio, "error", () => this.stop()));
406
- store.add(toDisposable(() => audio.pause()));
407
- this.playback.value = store;
408
- this.setPlayingVoice(playingVoice);
409
- audio.play().catch(error => {
410
- this.logService.trace(`[voice] Voice Mode onboarding preview failed: ${error}`);
411
- this.stop();
412
- });
413
- } catch (error) {
414
- this.logService.trace(`[voice] Voice Mode onboarding preview unavailable: ${error}`);
415
- this.stop();
416
- }
417
- }
418
- ensureAudio() {
419
- if (this.audio) {
420
- return this.audio;
421
- }
422
- const targetWindow = getWindow(this.element);
423
- const audio = this.audioFactory?.() ?? new targetWindow.Audio();
424
- this.audio = audio;
425
- this._register(toDisposable(() => {
426
- audio.pause();
427
- audio.src = "";
428
- }));
429
- if (this.audioFactory) {
430
- return audio;
431
- }
432
- try {
433
- const context = new targetWindow.AudioContext();
434
- this._register(toDisposable(() => void context.close().catch(() => {})));
435
- const analyser = context.createAnalyser();
436
- analyser.fftSize = 256;
437
- context.createMediaElementSource(audio).connect(analyser);
438
- analyser.connect(context.destination);
439
- this.analyser = analyser;
440
- this.levels = ( new Uint8Array(analyser.fftSize));
441
- } catch (error) {
442
- this.logService.trace(`[voice] Voice Mode onboarding analyser unavailable: ${error}`);
443
- }
444
- return audio;
445
- }
446
- stop() {
447
- this.playback.clear();
448
- this.setPlayingVoice(undefined);
449
- }
450
- setPlayingVoice(voiceId) {
451
- if (this._playingVoice === voiceId) {
452
- return;
453
- }
454
- this._playingVoice = voiceId;
455
- this._onDidChangePlayingVoice.fire(voiceId);
456
- }
457
- };
458
- VoiceSamplePlayer = ( __decorate([( __param(2, ILogService))], VoiceSamplePlayer));
459
- let VoiceModeOnboardingBanner = class VoiceModeOnboardingBanner extends ChatInputNoticeWidget {
460
- constructor(
461
- options,
462
- commandService,
463
- configurationService,
464
- contextViewService,
465
- instantiationService,
466
- logService,
467
- storageService,
468
- telemetryService
469
- ) {
470
- super({
471
- container: options.container,
472
- variant: ChatInputNoticeVariant.Onboarding,
473
- className: "voice-mode-onboarding-banner",
474
- ariaLabel: ( localize(8782, "Voice Mode introduction")),
475
- ariaDescription: ( localize(8783, "Choose how your agent speaks to you. Adjust settings anytime.")),
476
- onEscape: () => {
477
- this.logAction("escape");
478
- this.options.onDismiss();
479
- }
480
- });
481
- this.commandService = commandService;
482
- this.configurationService = configurationService;
483
- this.contextViewService = contextViewService;
484
- this.logService = logService;
485
- this.storageService = storageService;
486
- this.telemetryService = telemetryService;
487
- this.microphonePicker = this._register(( new MutableDisposable()));
488
- this.microphoneOptions = [];
489
- this.voiceElements = ( new Map());
490
- this.voicesDisposables = this._register(( new DisposableStore()));
491
- this.options = options;
492
- this.localizedVoice = localizedVoiceForLanguage(this.resolveSpokenLanguage());
493
- this.player = this._register(
494
- instantiationService.createInstance(VoiceSamplePlayer, this.domNode, options.audioFactory)
495
- );
496
- this._register(
497
- this.player.onDidChangePlayingVoice(voiceId => this.updatePlaying(voiceId))
498
- );
499
- const copy = append(this.domNode, $(".voice-mode-onboarding-copy"));
500
- const title = append(copy, $(".chat-input-notice-title.voice-mode-onboarding-title"));
501
- title.textContent = ( localize(8784, "Welcome to Voice Mode"));
502
- this.renderDescription(copy);
503
- this.renderSharedWaveform(instantiationService);
504
- this.renderMicrophonePicker();
505
- const actions = append(this.domNode, $(".voice-mode-onboarding-actions"));
506
- this.voicesContainer = actions;
507
- this.renderVoices();
508
- this.renderClose();
509
- this.logAction("shown");
510
- this._register(this.configurationService.onDidChangeConfiguration(event => {
511
- if (event.affectsConfiguration(VOICE_LANGUAGE_SETTING)) {
512
- this.updateForLanguage();
513
- }
514
- }));
515
- }
516
- currentSignature() {
517
- return this.selectedVoice?.signature ?? RESTING_SIGNATURE;
518
- }
519
- renderSharedWaveform(instantiationService) {
520
- const wave = append(this.domNode, $(".voice-mode-onboarding-wave"));
521
- const canvas = append(wave, $("canvas.voice-mode-onboarding-canvas"));
522
- canvas.setAttribute("aria-hidden", "true");
523
- this.animator = this._register(
524
- instantiationService.createInstance(VoiceModeOnboardingAnimator, canvas, wave, {
525
- getLevel: () => this.player.getLevel(),
526
- getSignature: () => this.currentSignature()
527
- })
528
- );
529
- }
530
- renderMicrophonePicker() {
531
- this.microphonePickerContainer = append(
532
- this.domNode,
533
- $(".chat-input-notice-picker.voice-mode-onboarding-microphone-picker")
534
- );
535
- this.microphoneOptions = [{
536
- deviceId: "",
537
- label: ( localize(8785, "System default"))
538
- }];
539
- this.updateMicrophonePicker();
540
- const mediaDevices = getWindow(this.domNode).navigator.mediaDevices;
541
- if (mediaDevices) {
542
- this._register(
543
- addDisposableListener(mediaDevices, "devicechange", () => void this.refreshMicrophones())
544
- );
545
- void this.refreshMicrophones();
546
- }
547
- }
548
- async refreshMicrophones() {
549
- const mediaDevices = getWindow(this.domNode).navigator.mediaDevices;
550
- if (!mediaDevices?.enumerateDevices) {
551
- return;
552
- }
553
- let devices;
554
- try {
555
- devices = await mediaDevices.enumerateDevices();
556
- } catch (error) {
557
- this.logService.trace(`[voice] could not enumerate microphones: ${error}`);
558
- return;
559
- }
560
- if (this._store.isDisposed) {
561
- return;
562
- }
563
- const options = buildMicrophoneOptions(devices);
564
- if (options.length > 1 && !( devices.some(device => device.kind === "audioinput" && device.label))) {
565
- return;
566
- }
567
- this.microphoneOptions = options;
568
- this.updateMicrophonePicker();
569
- }
570
- updateMicrophonePicker() {
571
- if (!this.microphonePickerContainer) {
572
- return;
573
- }
574
- this.microphonePicker.clear();
575
- clearNode(this.microphonePickerContainer);
576
- this.microphonePickerContainer.hidden = this.microphoneOptions.length <= 1;
577
- if (this.microphonePickerContainer.hidden) {
578
- return;
579
- }
580
- append(this.microphonePickerContainer, $(
581
- `span.codicon.codicon-${Codicon.mic.id}.voice-mode-onboarding-microphone-icon`
582
- )).setAttribute("aria-hidden", "true");
583
- const selected = indexOfMicrophone(this.microphoneOptions, this.currentMicrophoneId());
584
- const store = ( new DisposableStore());
585
- const selectBox = store.add(( new SelectBox(this.microphoneOptions.map(option => ({
586
- text: option.label
587
- })), selected, this.contextViewService, {
588
- ...defaultSelectBoxStyles,
589
- selectBackground: undefined,
590
- selectBorder: undefined,
591
- selectForeground: undefined,
592
- selectListBackground: asCssVariableWithDefault(selectListBackground, asCssVariable(selectBackground))
593
- }, {
594
- ariaLabel: ( localize(8786, "Microphone")),
595
- useCustomDrawn: true
596
- })));
597
- selectBox.render(this.microphonePickerContainer);
598
- store.add(selectBox.onDidSelect(event => this.selectMicrophone(event.index)));
599
- this.microphonePicker.value = store;
600
- }
601
- currentMicrophoneId() {
602
- return this.storageService.get(AgentsVoiceStorageKeys.MicrophoneDevice, StorageScope.APPLICATION, "");
603
- }
604
- selectMicrophone(index) {
605
- const option = this.microphoneOptions[index];
606
- if (!option) {
607
- return;
608
- }
609
- this.logAction("selectMicrophone");
610
- if (option.deviceId) {
611
- this.storageService.store(
612
- AgentsVoiceStorageKeys.MicrophoneDevice,
613
- option.deviceId,
614
- StorageScope.APPLICATION,
615
- StorageTarget.MACHINE
616
- );
617
- } else {
618
- this.storageService.remove(AgentsVoiceStorageKeys.MicrophoneDevice, StorageScope.APPLICATION);
619
- }
620
- status(( localize(8787, "{0} selected.", option.label)));
621
- }
622
- renderVoices() {
623
- const container = this.voicesContainer;
624
- if (!container) {
625
- return;
626
- }
627
- this.voicesDisposables.clear();
628
- this.voiceElements.clear();
629
- clearNode(container);
630
- const labelText = ( localize(8788, "Agent Voice:"));
631
- const label = append(container, $(".voice-mode-onboarding-voices-label"));
632
- label.textContent = labelText;
633
- if (this.localizedVoice) {
634
- this.renderLocalizedVoice(container, labelText, this.localizedVoice);
635
- return;
636
- }
637
- const group = append(container, $(".voice-mode-onboarding-voices"));
638
- group.setAttribute("role", "radiogroup");
639
- group.setAttribute("aria-label", labelText);
640
- for (const voice of VOICES) {
641
- const option = append(group, $(".voice-mode-onboarding-voice"));
642
- option.setAttribute("role", "radio");
643
- const restingAria = ( localize(
644
- 8789,
645
- "{0}. Hear this voice and use it for every conversation.",
646
- voice.label
647
- ));
648
- option.setAttribute("aria-label", restingAria);
649
- this.appendVoiceIcon(option);
650
- const label = append(option, $("span.voice-mode-onboarding-voice-label"));
651
- label.textContent = voice.label;
652
- this.voiceElements.set(voice.id, {
653
- element: option,
654
- label: voice.label,
655
- restingAria
656
- });
657
- this.voicesDisposables.add(
658
- addDisposableListener(option, EventType.CLICK, () => this.selectVoice(voice))
659
- );
660
- this.voicesDisposables.add(addDisposableListener(
661
- option,
662
- EventType.KEY_DOWN,
663
- event => this.handleOptionKey(event, voice)
664
- ));
665
- }
666
- this.updateSelection();
667
- }
668
- updateForLanguage() {
669
- const localizedVoice = localizedVoiceForLanguage(this.resolveSpokenLanguage());
670
- if (localizedVoice?.id === this.localizedVoice?.id) {
671
- return;
672
- }
673
- const hadVoiceFocus = this.voicesContainer ? isAncestorOfActiveElement(this.voicesContainer) : false;
674
- this.player.stop();
675
- this.localizedVoice = localizedVoice;
676
- this.selectedVoice = undefined;
677
- this.renderVoices();
678
- if (hadVoiceFocus) {
679
- ( this.voiceElements.values()).next().value?.element.focus();
680
- }
681
- }
682
- renderLocalizedVoice(container, ariaLabel, voice) {
683
- const group = append(container, $(".voice-mode-onboarding-voices"));
684
- group.setAttribute("aria-label", ariaLabel);
685
- const option = append(group, $(".voice-mode-onboarding-voice"));
686
- option.setAttribute("role", "button");
687
- option.tabIndex = 0;
688
- const restingAria = ( localize(8790, "{0}. Hear how your agent will sound.", voice.label));
689
- option.setAttribute("aria-label", restingAria);
690
- this.appendVoiceIcon(option);
691
- const label = append(option, $("span.voice-mode-onboarding-voice-label"));
692
- label.textContent = voice.label;
693
- this.voiceElements.set(voice.id, {
694
- element: option,
695
- label: voice.label,
696
- restingAria
697
- });
698
- this.voicesDisposables.add(
699
- addDisposableListener(option, EventType.CLICK, () => this.previewLocalizedVoice(voice))
700
- );
701
- this.voicesDisposables.add(addDisposableListener(option, EventType.KEY_DOWN, event => {
702
- const keyboardEvent = ( new StandardKeyboardEvent(event));
703
- if (keyboardEvent.equals(KeyCode.Enter) || keyboardEvent.equals(KeyCode.Space)) {
704
- keyboardEvent.preventDefault();
705
- this.previewLocalizedVoice(voice);
706
- }
707
- }));
708
- }
709
- appendVoiceIcon(option) {
710
- const icon = append(option, $("span.voice-mode-onboarding-voice-icon"));
711
- append(
712
- icon,
713
- $(`span.codicon.codicon-${Codicon.play.id}.voice-mode-onboarding-voice-idle`)
714
- ).setAttribute("aria-hidden", "true");
715
- append(icon, $(
716
- `span.codicon.codicon-${Codicon.checkCompact.id}.voice-mode-onboarding-voice-chosen`
717
- )).setAttribute("aria-hidden", "true");
718
- const bars = append(icon, $("span.voice-mode-onboarding-voice-bars"));
719
- bars.setAttribute("aria-hidden", "true");
720
- for (let bar = 0; bar < 3; bar++) {
721
- append(bars, $("span.voice-mode-onboarding-voice-bar"));
722
- }
723
- }
724
- handleOptionKey(event, voice) {
725
- const keyboardEvent = ( new StandardKeyboardEvent(event));
726
- if (keyboardEvent.equals(KeyCode.Enter) || keyboardEvent.equals(KeyCode.Space)) {
727
- keyboardEvent.preventDefault();
728
- this.selectVoice(voice);
729
- return;
730
- }
731
- const forward = keyboardEvent.equals(KeyCode.RightArrow) || keyboardEvent.equals(KeyCode.DownArrow);
732
- const backward = keyboardEvent.equals(KeyCode.LeftArrow) || keyboardEvent.equals(KeyCode.UpArrow);
733
- if (forward || backward) {
734
- keyboardEvent.preventDefault();
735
- const index = ( VOICES.indexOf(voice));
736
- const next = VOICES[(index + (forward ? 1 : VOICES.length - 1)) % VOICES.length];
737
- this.selectVoice(next);
738
- this.voiceElements.get(next.id)?.element.focus();
739
- }
740
- }
741
- renderDescription(container) {
742
- const description = append(
743
- container,
744
- $(".chat-input-notice-description.voice-mode-onboarding-description")
745
- );
746
- const text = ( localize(
747
- 8791,
748
- "Choose how your agent speaks to you. Adjust [[settings]] or [[how it's written]] anytime."
749
- ));
750
- append(description, renderFormattedText(text, {
751
- actionHandler: {
752
- callback: index => {
753
- const commandId = index === "0" ? VOICE_SETTINGS_COMMAND : CONFIGURE_VOICE_INSTRUCTIONS_ACTION_ID;
754
- this.logAction(index === "0" ? "openSettings" : "openInstructions");
755
- this.commandService.executeCommand(commandId).catch(
756
- error => this.logService.error(`[voice] Failed to run ${commandId}: ${error}`)
757
- );
758
- },
759
- disposables: this._store
760
- }
761
- }, $("span")));
762
- for (const link of description.querySelectorAll("a")) {
763
- link.tabIndex = 0;
764
- link.setAttribute("role", "button");
765
- this._register(addDisposableListener(link, EventType.KEY_DOWN, event => {
766
- const keyboardEvent = ( new StandardKeyboardEvent(event));
767
- if (keyboardEvent.equals(KeyCode.Enter) || keyboardEvent.equals(KeyCode.Space)) {
768
- keyboardEvent.preventDefault();
769
- link.click();
770
- }
771
- }));
772
- }
773
- }
774
- renderClose() {
775
- this.addDismissAction({
776
- className: "voice-mode-onboarding-close",
777
- ariaLabel: ( localize(8792, "Close the introduction")),
778
- onActivate: () => this.finish()
779
- });
780
- }
781
- setVisible(visible) {
782
- super.setVisible(visible);
783
- this.animator?.setSuspended(!visible);
784
- if (!visible) {
785
- this.player.stop();
786
- }
787
- }
788
- selectVoice(voice) {
789
- if (this.player.playingVoice === voice.id) {
790
- this.player.stop();
791
- status(( localize(8793, "{0} preview stopped.", voice.label)));
792
- return;
793
- }
794
- this.logAction("selectVoice");
795
- this.selectedVoice = voice;
796
- this.updateSelection();
797
- this.player.play(voice.sampleId, voice.id);
798
- status(( localize(8794, "{0} selected.", voice.label)));
799
- this.configurationService.updateValue(VOICE_SETTING, voice.id, ConfigurationTarget.USER).catch(
800
- error => this.logService.error(`[voice] Failed to persist the Voice Mode voice: ${error}`)
801
- );
802
- }
803
- previewLocalizedVoice(voice) {
804
- if (this.player.playingVoice === voice.id) {
805
- this.player.stop();
806
- status(( localize(8795, "{0} preview stopped.", voice.label)));
807
- return;
808
- }
809
- this.logAction("previewVoice");
810
- this.player.play(voice.id);
811
- status(( localize(8796, "Playing {0} preview.", voice.label)));
812
- }
813
- resolveSpokenLanguage() {
814
- if (this.options.voiceLanguage) {
815
- return this.options.voiceLanguage;
816
- }
817
- const configuredLanguage = this.configurationService.getValue(VOICE_LANGUAGE_SETTING)?.trim();
818
- if (configuredLanguage && configuredLanguage.toLowerCase() !== "auto") {
819
- return configuredLanguage;
820
- }
821
- return getWindow(this.domNode).navigator.language;
822
- }
823
- updateSelection() {
824
- for (const [id, entry] of this.voiceElements) {
825
- const selected = id === this.selectedVoice?.id;
826
- entry.element.classList.toggle("selected", selected);
827
- entry.element.setAttribute("aria-checked", String(selected));
828
- }
829
- this.updateTabStop();
830
- }
831
- updateTabStop() {
832
- let first = true;
833
- for (const [id, entry] of this.voiceElements) {
834
- const isTabStop = this.selectedVoice === undefined ? first : id === this.selectedVoice.id;
835
- entry.element.tabIndex = isTabStop ? 0 : -1;
836
- first = false;
837
- }
838
- }
839
- updatePlaying(playingVoice) {
840
- for (const [id, entry] of this.voiceElements) {
841
- const playing = id === playingVoice;
842
- entry.element.classList.toggle("playing", playing);
843
- entry.element.setAttribute("aria-label", playing ? ( localize(8797, "Stop {0} preview.", entry.label)) : entry.restingAria);
844
- }
845
- this.domNode.classList.toggle("playing", playingVoice !== undefined);
846
- }
847
- finish() {
848
- this.player.stop();
849
- this.logAction("close");
850
- this.options.onDismiss();
851
- }
852
- logAction(action) {
853
- this.telemetryService.publicLog2("voiceModeOnboarding.action", {
854
- action,
855
- source: this.options.source
856
- });
857
- }
858
- };
859
- VoiceModeOnboardingBanner = ( __decorate([( __param(1, ICommandService)), ( __param(2, IConfigurationService)), ( __param(3, IContextViewService)), ( __param(4, IInstantiationService)), ( __param(5, ILogService)), ( __param(6, IStorageService)), ( __param(7, ITelemetryService))], VoiceModeOnboardingBanner));
860
- let VoiceModeOnboardingService = class VoiceModeOnboardingService extends Disposable {
861
- get isVisible() {
862
- return this.onboarding.isVisible;
863
- }
864
- constructor(instantiationService) {
865
- super();
866
- this.instantiationService = instantiationService;
867
- this.onboarding = this._register(this.instantiationService.createInstance(ChatInputOnboarding, {
868
- storageKey: AgentsVoiceStorageKeys.IntroBannerShown
869
- }));
870
- }
871
- registerHost(options) {
872
- return this.onboarding.registerHost(options);
873
- }
874
- showIfNeeded() {
875
- this.onboarding.showIfNeeded(context => this.createBanner(context, "automatic"));
876
- }
877
- show() {
878
- return this.onboarding.show(context => this.createBanner(context, "manual"));
879
- }
880
- createBanner(context, source) {
881
- return this.instantiationService.createInstance(VoiceModeOnboardingBanner, {
882
- container: context.container,
883
- onDismiss: () => context.dismiss(isAncestorOfActiveElement(context.container)),
884
- source
885
- });
886
- }
887
- };
888
- VoiceModeOnboardingService = ( __decorate([( __param(0, IInstantiationService))], VoiceModeOnboardingService));
889
-
890
- export { VoiceModeOnboardingBanner, VoiceModeOnboardingService };