Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
// Gate on `ChatContextKeys.enabled` so the dictation UI and its commands are
// hidden (not just disabled) when the user has turned AI features off; without
// it the F1 "Select Microphone" command stays discoverable.
export
const
=
.
and
(
.
,
.
has
(
.
.
)
)
;
/** True while the selected dictation backend is preparing. */
export
const
=
.
has
(
.
.
)
;
const
=
.
equals
(
'config.dictation.model'
,
'mai'
)
;
/**
* True unless the user has hidden the chat-input dictation microphone button via
* {@link DictationSettingId.ShowButton}. Gates only the toolbar button; the
* Cmd/Ctrl+I dictation shortcut stays available so dictation can still be
* launched when the button is hidden.
*/
const
=
.
notEquals
(
`config.${DictationSettingId.ShowButton}`
,
false
)
;
/** Releases shorter than this are treated as an accidental tap and discarded. */
const
HOLD_TO_TALK_THRESHOLD_MS
=
500
;
/** Services required to run the dictation shortcut, see {@link runDictationShortcut}. */
export
interface
IDictationShortcutContext
{
readonly
:
;
readonly
:
;
readonly
:
;
/**
* Supplied by chat inputs only. The first dictation started from one shows
* its introduction alongside recording; editor and terminal dictation have
* nowhere to dock the card.
*/
readonly
?
:
;
}
/** Resolves a toggle invocation against the current dictation lifecycle. */
export
function
getDictationShortcutOperation
(
:
boolean
,
:
,
:
boolean
)
:
'start'
|
'stop'
|
'cancel'
|
undefined
{
if
(
)
{
return
?
'cancel'
:
'stop'
;
}
return
===
.
?
'start'
:
undefined
;
}
/**
* Run the dictation shortcut for `editor`. Shared by the main chat input toggle
* action and the Agents composer's Cmd/Ctrl+I command so both behave
* identically: tapping toggles, holding is push-to-talk (release stops).
*
* `commandId` is the keybinding command being run; it is used to detect a held
* shortcut via {@link IKeybindingService.enableKeybindingHoldMode}, which
* returns `undefined` when not invoked through a held key (e.g. the toolbar mic
* or the command palette), collapsing the behavior to a plain toggle.
*/
export
async
function
runDictationShortcut
(
:
,
:
string
,
:
,
:
typeof
=
,
)
:
Promise
<
void
>
{
const
{
,
,
}
=
;
switch
(
getDictationShortcutOperation
(
isDictating
(
)
,
.
,
.
)
)
{
case
'cancel'
:
cancelDictation
(
)
;
return
;
case
'stop'
:
await
stopDictation
(
)
;
return
;
case
undefined
:
return
;
}
const
=
getWindow
(
.
getDomNode
(
)
)
??
getActiveWindow
(
)
;
// The first-run card is informational and must not delay recording.
.
?.
showIfNeeded
(
)
;
// Attempt to detect a held keybinding. Returns `undefined` when not invoked
// through a held key (e.g. the toolbar mic or the command palette), which
// collapses the behavior to a plain toggle.
const
=
.
enableKeybindingHoldMode
(
)
;
await
startDictationFn
(
,
,
,
)
;
if
(
.
===
.
)
{
.
?.
refreshMicrophones
(
.
,
=>
.
switchMicrophone
(
,
)
,
)
;
}
if
(
!
)
{
return
;
}
// The shortcut is being held: wait for release and decide between the tap
// (toggle) and hold (push-to-talk) intents based on how long it was held.
const
=
.
now
(
)
;
await
;
const
=
.
now
(
)
-
;
if
(
heldMs<HOLD_TO_TALK_THRESHOLD_MS){// A quick tap means "toggle on": leave dictation running so the user can// tap again to stop.return;}awaitstopDictation();}exportclass ToggleChatSpeechToTextAction extends Action2 {staticreadonlyID='workbench.action.chat.toggleSpeechToText';constructor(){super({
id: ToggleChatSpeechToTextAction.ID,
title:localize2('chat.speechToText.start',"Dictate (Speech to Text)"),
category:CHAT_CATEGORY,
icon: Codicon.micCompact,
f1:false,
toggled:{
condition: ChatContextKeys.speechToTextRecording,
icon: Codicon.micFilled,
title:localize2('chat.speechToText.stop',"Stop Dictation").value,},
menu:[{
id: MenuId.ChatExecute,
order:-11,
when: ContextKeyExpr.and(ChatSpeechToTextConfigured, ChatSpeechToTextButtonShown, ChatSpeechToTextPreparing.negate(),AGENTS_VOICE_CONNECTED.negate(), SegmentedVoiceInputModePillInactive),
group:'navigation',}],
keybinding:{// Outrank the legacy "Start Voice Chat" action, which binds the// same Cmd+I in the chat input at WorkbenchContrib weight. When// dictation is configured it should win the chord.
weight: KeybindingWeight.WorkbenchContrib +1,// Dedicated chord scoped to the chat input. Kept distinct from// Voice Mode's Cmd+Shift+Space so the two never contend.
when: ContextKeyExpr.and(
ChatSpeechToTextConfigured,
ChatContextKeys.inChatInput,
EditorContextKeys.focus.negate(),NOTEBOOK_EDITOR_FOCUSED.negate(),),
primary: KeyMod.CtrlCmd | KeyCode.KeyI,},});}asyncrun(accessor: ServicesAccessor,...args:unknown[]):Promise<void>{const context = args[0]as IChatExecuteActionContext |undefined;const widgetService = accessor.get(IChatWidgetService);const widget = context?.widget ?? widgetService.lastFocusedWidget;if(!widget){return;}awaitrunDictationShortcut({
speechService: accessor.get(IChatSpeechToTextService),
keybindingService: accessor.get(IKeybindingService),
logService: accessor.get(ILogService),
onboardingService: accessor.get(IDictationOnboardingService),}, ToggleChatSpeechToTextAction.ID, widget.inputEditor);}}/**
* Shown in place of the mic button while the on-device model downloads or loads.
*/exportclass ChatSpeechToTextPreparingAction extends Action2 {staticreadonlyID='workbench.action.chat.speechToTextPreparing';constructor(){super({
id: ChatSpeechToTextPreparingAction.ID,
title:localize2('chat.speechToText.preparing',"Preparing Speech to Text Model…"),
category:CHAT_CATEGORY,
f1:false,
icon: Codicon.micDownloadCompact,
precondition: ChatSpeechToTextPreparing,
menu:[{
id: MenuId.ChatExecute,
order:-11,
when: ContextKeyExpr.and(ChatSpeechToTextConfigured, ChatSpeechToTextButtonShown, ChatSpeechToTextPreparing, ChatSpeechToTextMaiBackend.negate(),AGENTS_VOICE_CONNECTED.negate(), SegmentedVoiceInputModePillInactive),
group:'navigation',}],});}asyncrun():Promise<void>{if(isDictating()){cancelDictation();}}}/** Shown in place of the mic button while cloud dictation connects. */exportclass ChatSpeechToTextConnectingAction extends Action2 {staticreadonlyID='workbench.action.chat.speechToTextConnecting';constructor(){super({
id: ChatSpeechToTextConnectingAction.ID,
title:localize2('chat.speechToText.connecting',"Connecting to Speech to Text…"),
category:CHAT_CATEGORY,
f1:false,
icon: Codicon.loadingCompact,
precondition: ChatSpeechToTextPreparing,
menu:[{
id: MenuId.ChatExecute,
order:-11,
when: ContextKeyExpr.and(ChatSpeechToTextConfigured, ChatSpeechToTextButtonShown, ChatSpeechToTextPreparing, ChatSpeechToTextMaiBackend,AGENTS_VOICE_CONNECTED.negate(), SegmentedVoiceInputModePillInactive),
group:'navigation',}],});}asyncrun():Promise<void>{if(isDictating()){cancelDictation();}}}class HoldToSpeechToTextAction extends Action2 {staticreadonlyID='workbench.action.chat.holdToSpeechToText';constructor(){super({
id: HoldToSpeechToTextAction.ID,
title:localize2('chat.speechToText.hold',"Hold to Dictate (Speech to Text)"),
category:CHAT_CATEGORY,
f1:false,});}asyncrun(accessor: ServicesAccessor,...args:unknown[]):Promise<void>{const context = args[0]as IChatExecuteActionContext |undefined;const widgetService = accessor.get(IChatWidgetService);const speechService = accessor.get(IChatSpeechToTextService);const keybindingService = accessor.get(IKeybindingService);const widget = context?.widget ?? widgetService.lastFocusedWidget;if(!widget || speechService.state !== ChatSpeechToTextState.Idle){return;}// Resolves when the triggering key is released.const holdMode = keybindingService.enableKeybindingHoldMode(HoldToSpeechToTextAction.ID);if(!holdMode){return;}const window =getWindow(widget.domNode)??getActiveWindow();const heldFrom = Date.now();awaitstartDictation(speechService, widget.inputEditor, window, accessor.get(ILogService));await holdMode;// Treat a quick tap as accidental: discard instead of transcribing.if(Date.now()- heldFrom <HOLD_TO_TALK_THRESHOLD_MS){cancelDictation();return;}awaitstopDictation();}}class SelectSpeechToTextMicrophoneAction extends Action2 {staticreadonlyID='workbench.action.chat.selectSpeechToTextMicrophone';constructor(){super({
id: SelectSpeechToTextMicrophoneAction.ID,
title:localize2('chat.speechToText.selectMicrophone',"Select Microphone"),
category:CHAT_CATEGORY,
f1:true,// Shared by dictation and Voice Mode (both persist to the same// device), so stay available whenever either feature is enabled.
precondition: ContextKeyExpr.or(ChatSpeechToTextConfigured,AGENTS_VOICE_ENABLED),});}asyncrun(accessor: ServicesAccessor):Promise<void>{const quickInputService = accessor.get(IQuickInputService);const storageService = accessor.get(IStorageService);const devices =await navigator.mediaDevices.enumerateDevices();if(!devices.some(device => device.kind ==='audioinput')){
quickInputService.pick([{ label:localize('chatStt.noMicrophones',"No microphones found")}]);return;}// Shares the Voice Mode microphone selection so both features use the same device.const currentDeviceId = storageService.get(AgentsVoiceStorageKeys.MicrophoneDevice, StorageScope.APPLICATION,'');type DevicePickItem ={ label:string; description?:string; deviceId:string};const items: DevicePickItem[]=buildMicrophoneOptions(devices).map(device =>
(
{
:
.
,
:
.
===
?
localize
(
'chatStt.current'
,
"(current)"
)
:
undefined
,
:
.
,
}
)
)
;
const
=
await
.
pick
(
,
{
:
localize
(
'chatStt.selectMic'
,
"Select a microphone for dictation"
)
,
}
)
;
if
(
)
{
const
=
as
;
if
(
.
)
{
.
store
(
.
,
.
,
.
APPLICATION
,
.
MACHINE
)
;
}
else
{
.
remove
(
.
,
.
APPLICATION
)
;
}
}
}
}
class
ShowChatSpeechToTextIntroductionAction
extends
Action2
{
static
readonly
ID
=
SHOW_DICTATION_ONBOARDING_COMMAND
;
constructor
(
)
{
super
(
{
:
.
ID
,
:
localize2
(
'chat.speechToText.showIntroduction'
,
"Dictate: Show Introduction"
)
,
:
CHAT_CATEGORY
,
:
true
,
:
,
}
)
;
}
async
run
(
:
)
:
Promise
<
void
>
{
const
=
.
get
(
)
;
if
(
.
show
(
)
)
{
return
;
}
// The card docks to a chat input, so there is nothing to show it in when
// no chat is open. Say so rather than appearing to do nothing.
.
get
(
)
.
info
(
localize
(
'chatStt.introductionNeedsChat'
,
"Open a chat to see the dictation introduction."
)
)
;
}
}
class
ResetChatSpeechToTextIntroductionAction
extends
Action2
{
constructor
(
)
{
super
(
{
:
RESET_DICTATION_ONBOARDING_COMMAND
,
:
localize2
(
'chat.speechToText.resetIntroduction'
,
"Dictate: Reset Onboarding"
)
,
:
CHAT_CATEGORY
,
:
true
,
:
,
}
)
;
}
run
(
:
)
:
void
{
.
get
(
)
.
reset
(
)
;
}
}
class
CancelChatSpeechToTextAction
extends
Action2
{
static
readonly
ID
=
'workbench.action.chat.cancelSpeechToText'
;
constructor
(
)
{
super
(
{
:
.
ID
,
:
localize2
(
'chat.speechToText.cancel'
,
"Cancel Dictation (Speech to Text)"
)
,
:
CHAT_CATEGORY
,
:
false
,
:
{
// Escape aborts an in-progress dictation, discarding what was
// recorded. Scoped to the chat input while recording and ranked
// above the input's other Escape handlers so it wins the chord.