@codingame/monaco-vscode-katex-common 29.1.0 → 30.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.
- package/package.json +2 -2
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +14 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +34 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +12 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +208 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +637 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +202 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +17 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +53 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +296 -63
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +59 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +55 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +110 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +384 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.d.ts +12 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.js +220 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +1 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +14 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +40 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +97 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +8 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +15 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +155 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +36 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMissingSandboxDepsConfirmationSubPart.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMissingSandboxDepsConfirmationSubPart.js +68 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatModifiedFilesConfirmationSubPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +33 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +12 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +4 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +37 -113
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +66 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +13 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +103 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +35 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +39 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +44 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +60 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.js +4 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +5 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +6 -11
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +39 -39
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +746 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +300 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +55 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +273 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1963 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +314 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +258 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +886 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +118 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +71 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +40 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +313 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +265 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +185 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +104 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +43 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +69 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +469 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +149 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +933 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +180 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +32 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +102 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +643 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +197 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +539 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +90 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +92 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +0 -152
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +0 -1317
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalPromptFileSystem.d.ts +0 -47
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalPromptFileSystem.js +0 -95
package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js
DELETED
|
@@ -1,1317 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { sep } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
4
|
-
import { AsyncIterableProducer, raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
5
|
-
import { CancellationToken, CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
6
|
-
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
7
|
-
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
8
|
-
import { Disposable, DisposableMap, DisposableStore, combinedDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
9
|
-
import { ResourceMap, ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
10
|
-
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
11
|
-
import { joinPath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
12
|
-
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
13
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
14
|
-
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
15
|
-
import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
16
|
-
import { MenuId, MenuItemAction, MenuRegistry, registerAction2, Action2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
17
|
-
import { IMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service';
|
|
18
|
-
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
19
|
-
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
20
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
21
|
-
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
22
|
-
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
23
|
-
import { isDark } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/theme';
|
|
24
|
-
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
25
|
-
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
26
|
-
import { isProposedApiEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions';
|
|
27
|
-
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
28
|
-
import { ExtensionsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
29
|
-
import { ChatEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput';
|
|
30
|
-
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents.service';
|
|
31
|
-
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
32
|
-
import { isSessionInProgressStatus } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
|
|
33
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
34
|
-
import { ChatAgentLocation, ChatModeKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
35
|
-
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
36
|
-
import { IChatToolInvocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService';
|
|
37
|
-
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
38
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
39
|
-
import { renderAsPlaintext } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/markdownRenderer';
|
|
40
|
-
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
41
|
-
import { ChatViewId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
42
|
-
import { AgentSessionProviders, getAgentSessionProviderName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
|
|
43
|
-
import { isCancellationError, BugIndicatingError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
44
|
-
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
45
|
-
import { isUntitledChatSession, LocalChatSessionUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
|
|
46
|
-
import { assertNever } from '@codingame/monaco-vscode-api/vscode/vs/base/common/assert';
|
|
47
|
-
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
48
|
-
import { Target } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
49
|
-
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
50
|
-
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
51
|
-
|
|
52
|
-
const extensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
53
|
-
extensionPoint: "chatSessions",
|
|
54
|
-
jsonSchema: {
|
|
55
|
-
description: ( localize(6143, "Contributes chat session integrations to the chat widget.")),
|
|
56
|
-
type: "array",
|
|
57
|
-
items: {
|
|
58
|
-
type: "object",
|
|
59
|
-
additionalProperties: false,
|
|
60
|
-
properties: {
|
|
61
|
-
type: {
|
|
62
|
-
description: ( localize(6144, "Unique identifier for the type of chat session.")),
|
|
63
|
-
type: "string"
|
|
64
|
-
},
|
|
65
|
-
name: {
|
|
66
|
-
description: ( localize(
|
|
67
|
-
6145,
|
|
68
|
-
"Name of the dynamically registered chat participant (eg: @agent). Must not contain whitespace."
|
|
69
|
-
)),
|
|
70
|
-
type: "string",
|
|
71
|
-
pattern: "^[\\w-]+$"
|
|
72
|
-
},
|
|
73
|
-
displayName: {
|
|
74
|
-
description: ( localize(6146, "A longer name for this item which is used for display in menus.")),
|
|
75
|
-
type: "string"
|
|
76
|
-
},
|
|
77
|
-
description: {
|
|
78
|
-
description: ( localize(6147, "Description of the chat session for use in menus and tooltips.")),
|
|
79
|
-
type: "string"
|
|
80
|
-
},
|
|
81
|
-
when: {
|
|
82
|
-
description: ( localize(6148, "Condition which must be true to show this item.")),
|
|
83
|
-
type: "string"
|
|
84
|
-
},
|
|
85
|
-
icon: {
|
|
86
|
-
description: ( localize(
|
|
87
|
-
6149,
|
|
88
|
-
"Icon identifier (codicon ID) for the chat session editor tab. For example, \"{0}\" or \"{1}\".",
|
|
89
|
-
"$(github)",
|
|
90
|
-
"$(cloud)"
|
|
91
|
-
)),
|
|
92
|
-
anyOf: [{
|
|
93
|
-
type: "string"
|
|
94
|
-
}, {
|
|
95
|
-
type: "object",
|
|
96
|
-
properties: {
|
|
97
|
-
light: {
|
|
98
|
-
description: ( localize(6150, "Icon path when a light theme is used")),
|
|
99
|
-
type: "string"
|
|
100
|
-
},
|
|
101
|
-
dark: {
|
|
102
|
-
description: ( localize(6151, "Icon path when a dark theme is used")),
|
|
103
|
-
type: "string"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}]
|
|
107
|
-
},
|
|
108
|
-
order: {
|
|
109
|
-
description: ( localize(6152, "Order in which this item should be displayed.")),
|
|
110
|
-
type: "integer"
|
|
111
|
-
},
|
|
112
|
-
alternativeIds: {
|
|
113
|
-
description: ( localize(6153, "Alternative identifiers for backward compatibility.")),
|
|
114
|
-
type: "array",
|
|
115
|
-
items: {
|
|
116
|
-
type: "string"
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
welcomeTitle: {
|
|
120
|
-
description: ( localize(
|
|
121
|
-
6154,
|
|
122
|
-
"Title text to display in the chat welcome view for this session type."
|
|
123
|
-
)),
|
|
124
|
-
type: "string"
|
|
125
|
-
},
|
|
126
|
-
welcomeMessage: {
|
|
127
|
-
description: ( localize(
|
|
128
|
-
6155,
|
|
129
|
-
"Message text (supports markdown) to display in the chat welcome view for this session type."
|
|
130
|
-
)),
|
|
131
|
-
type: "string"
|
|
132
|
-
},
|
|
133
|
-
welcomeTips: {
|
|
134
|
-
description: ( localize(
|
|
135
|
-
6156,
|
|
136
|
-
"Tips text (supports markdown and theme icons) to display in the chat welcome view for this session type."
|
|
137
|
-
)),
|
|
138
|
-
type: "string"
|
|
139
|
-
},
|
|
140
|
-
inputPlaceholder: {
|
|
141
|
-
description: ( localize(
|
|
142
|
-
6157,
|
|
143
|
-
"Placeholder text to display in the chat input box for this session type."
|
|
144
|
-
)),
|
|
145
|
-
type: "string"
|
|
146
|
-
},
|
|
147
|
-
capabilities: {
|
|
148
|
-
description: ( localize(6158, "Optional capabilities for this chat session.")),
|
|
149
|
-
type: "object",
|
|
150
|
-
additionalProperties: false,
|
|
151
|
-
properties: {
|
|
152
|
-
supportsFileAttachments: {
|
|
153
|
-
description: ( localize(
|
|
154
|
-
6159,
|
|
155
|
-
"Whether this chat session supports attaching files or file references."
|
|
156
|
-
)),
|
|
157
|
-
type: "boolean"
|
|
158
|
-
},
|
|
159
|
-
supportsToolAttachments: {
|
|
160
|
-
description: ( localize(
|
|
161
|
-
6160,
|
|
162
|
-
"Whether this chat session supports attaching tools or tool references."
|
|
163
|
-
)),
|
|
164
|
-
type: "boolean"
|
|
165
|
-
},
|
|
166
|
-
supportsMCPAttachments: {
|
|
167
|
-
description: ( localize(6161, "Whether this chat session supports attaching MCP resources.")),
|
|
168
|
-
type: "boolean"
|
|
169
|
-
},
|
|
170
|
-
supportsImageAttachments: {
|
|
171
|
-
description: ( localize(6162, "Whether this chat session supports attaching images.")),
|
|
172
|
-
type: "boolean"
|
|
173
|
-
},
|
|
174
|
-
supportsSearchResultAttachments: {
|
|
175
|
-
description: ( localize(6163, "Whether this chat session supports attaching search results.")),
|
|
176
|
-
type: "boolean"
|
|
177
|
-
},
|
|
178
|
-
supportsInstructionAttachments: {
|
|
179
|
-
description: ( localize(6164, "Whether this chat session supports attaching instructions.")),
|
|
180
|
-
type: "boolean"
|
|
181
|
-
},
|
|
182
|
-
supportsSourceControlAttachments: {
|
|
183
|
-
description: ( localize(
|
|
184
|
-
6165,
|
|
185
|
-
"Whether this chat session supports attaching source control changes."
|
|
186
|
-
)),
|
|
187
|
-
type: "boolean"
|
|
188
|
-
},
|
|
189
|
-
supportsProblemAttachments: {
|
|
190
|
-
description: ( localize(6166, "Whether this chat session supports attaching problems.")),
|
|
191
|
-
type: "boolean"
|
|
192
|
-
},
|
|
193
|
-
supportsSymbolAttachments: {
|
|
194
|
-
description: ( localize(6167, "Whether this chat session supports attaching symbols.")),
|
|
195
|
-
type: "boolean"
|
|
196
|
-
},
|
|
197
|
-
supportsPromptAttachments: {
|
|
198
|
-
description: ( localize(6168, "Whether this chat session supports attaching prompts.")),
|
|
199
|
-
type: "boolean"
|
|
200
|
-
},
|
|
201
|
-
supportsHandOffs: {
|
|
202
|
-
description: ( localize(6169, "Whether this chat session supports hand-off prompts.")),
|
|
203
|
-
type: "boolean"
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
commands: {
|
|
208
|
-
markdownDescription: ( localize(
|
|
209
|
-
6170,
|
|
210
|
-
"Commands available for this chat session, which the user can invoke with a `/`."
|
|
211
|
-
)),
|
|
212
|
-
type: "array",
|
|
213
|
-
items: {
|
|
214
|
-
additionalProperties: false,
|
|
215
|
-
type: "object",
|
|
216
|
-
defaultSnippets: [{
|
|
217
|
-
body: {
|
|
218
|
-
name: "",
|
|
219
|
-
description: ""
|
|
220
|
-
}
|
|
221
|
-
}],
|
|
222
|
-
required: ["name"],
|
|
223
|
-
properties: {
|
|
224
|
-
name: {
|
|
225
|
-
description: ( localize(
|
|
226
|
-
6171,
|
|
227
|
-
"A short name by which this command is referred to in the UI, e.g. `fix` or `explain` for commands that fix an issue or explain code. The name should be unique among the commands provided by this participant."
|
|
228
|
-
)),
|
|
229
|
-
type: "string"
|
|
230
|
-
},
|
|
231
|
-
description: {
|
|
232
|
-
description: ( localize(6172, "A description of this command.")),
|
|
233
|
-
type: "string"
|
|
234
|
-
},
|
|
235
|
-
when: {
|
|
236
|
-
description: ( localize(6173, "A condition which must be true to enable this command.")),
|
|
237
|
-
type: "string"
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
canDelegate: {
|
|
243
|
-
description: ( localize(
|
|
244
|
-
6174,
|
|
245
|
-
"Whether delegation is supported. Default is false. Note that enabling this is experimental and may not be respected at all times."
|
|
246
|
-
)),
|
|
247
|
-
type: "boolean",
|
|
248
|
-
default: false
|
|
249
|
-
},
|
|
250
|
-
customAgentTarget: {
|
|
251
|
-
description: ( localize(
|
|
252
|
-
6175,
|
|
253
|
-
"When set, the chat session will show a filtered mode picker that prefers custom agents whose target property matches this value. Custom agents without a target property are still shown in all session types. This enables the use of standard agent/mode with contributed sessions."
|
|
254
|
-
)),
|
|
255
|
-
type: "string"
|
|
256
|
-
},
|
|
257
|
-
requiresCustomModels: {
|
|
258
|
-
description: ( localize(
|
|
259
|
-
6176,
|
|
260
|
-
"When set, the chat session will show a filtered model picker that prefers custom models. This enables the use of standard model picker with contributed sessions."
|
|
261
|
-
)),
|
|
262
|
-
type: "boolean",
|
|
263
|
-
default: false
|
|
264
|
-
},
|
|
265
|
-
autoAttachReferences: {
|
|
266
|
-
description: ( localize(
|
|
267
|
-
6177,
|
|
268
|
-
"Whether to automatically attach instruction files to chat requests for this session type."
|
|
269
|
-
)),
|
|
270
|
-
type: "boolean",
|
|
271
|
-
default: false
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
required: ["type", "name", "displayName", "description"]
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
activationEventsGenerator: function*(contribs) {
|
|
278
|
-
for (const contrib of contribs) {
|
|
279
|
-
yield `onChatSession:${contrib.type}`;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
class ContributedChatSessionData extends Disposable {
|
|
284
|
-
getOption(optionId) {
|
|
285
|
-
return this._optionsCache.get(optionId);
|
|
286
|
-
}
|
|
287
|
-
getAllOptions() {
|
|
288
|
-
return this._optionsCache.entries();
|
|
289
|
-
}
|
|
290
|
-
setOption(optionId, value) {
|
|
291
|
-
this._optionsCache.set(optionId, value);
|
|
292
|
-
}
|
|
293
|
-
constructor(session, chatSessionType, resource, options, onWillDispose) {
|
|
294
|
-
super();
|
|
295
|
-
this.session = session;
|
|
296
|
-
this.chatSessionType = chatSessionType;
|
|
297
|
-
this.resource = resource;
|
|
298
|
-
this.options = options;
|
|
299
|
-
this.onWillDispose = onWillDispose;
|
|
300
|
-
this._optionsCache = ( new Map(options));
|
|
301
|
-
this._register(this.session.onWillDispose(() => {
|
|
302
|
-
this.onWillDispose(this.resource);
|
|
303
|
-
}));
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
let ChatSessionsService = class ChatSessionsService extends Disposable {
|
|
307
|
-
get onDidChangeInProgress() {
|
|
308
|
-
return this._onDidChangeInProgress.event;
|
|
309
|
-
}
|
|
310
|
-
get onDidChangeContentProviderSchemes() {
|
|
311
|
-
return this._onDidChangeContentProviderSchemes.event;
|
|
312
|
-
}
|
|
313
|
-
get onDidChangeSessionOptions() {
|
|
314
|
-
return this._onDidChangeSessionOptions.event;
|
|
315
|
-
}
|
|
316
|
-
get onDidChangeOptionGroups() {
|
|
317
|
-
return this._onDidChangeOptionGroups.event;
|
|
318
|
-
}
|
|
319
|
-
constructor(
|
|
320
|
-
_logService,
|
|
321
|
-
_chatAgentService,
|
|
322
|
-
_extensionService,
|
|
323
|
-
_contextKeyService,
|
|
324
|
-
_menuService,
|
|
325
|
-
_themeService,
|
|
326
|
-
_labelService
|
|
327
|
-
) {
|
|
328
|
-
super();
|
|
329
|
-
this._logService = _logService;
|
|
330
|
-
this._chatAgentService = _chatAgentService;
|
|
331
|
-
this._extensionService = _extensionService;
|
|
332
|
-
this._contextKeyService = _contextKeyService;
|
|
333
|
-
this._menuService = _menuService;
|
|
334
|
-
this._themeService = _themeService;
|
|
335
|
-
this._labelService = _labelService;
|
|
336
|
-
this._itemControllers = ( new Map());
|
|
337
|
-
this._contributions = ( new Map());
|
|
338
|
-
this._contributionDisposables = this._register(( new DisposableMap()));
|
|
339
|
-
this._contentProviders = ( new Map());
|
|
340
|
-
this._alternativeIdMap = ( new Map());
|
|
341
|
-
this._contextKeys = ( new Set());
|
|
342
|
-
this._onDidChangeItemsProviders = this._register(( new Emitter()));
|
|
343
|
-
this.onDidChangeItemsProviders = this._onDidChangeItemsProviders.event;
|
|
344
|
-
this._onDidChangeSessionItems = this._register(( new Emitter()));
|
|
345
|
-
this.onDidChangeSessionItems = this._onDidChangeSessionItems.event;
|
|
346
|
-
this._onDidChangeAvailability = this._register(( new Emitter()));
|
|
347
|
-
this.onDidChangeAvailability = this._onDidChangeAvailability.event;
|
|
348
|
-
this._onDidChangeInProgress = this._register(( new Emitter()));
|
|
349
|
-
this._onDidChangeContentProviderSchemes = this._register(( new Emitter()));
|
|
350
|
-
this._onDidChangeSessionOptions = this._register(( new Emitter()));
|
|
351
|
-
this._onDidChangeOptionGroups = this._register(( new Emitter()));
|
|
352
|
-
this.inProgressMap = ( new Map());
|
|
353
|
-
this._sessionTypeOptions = ( new Map());
|
|
354
|
-
this._sessionTypeNewSessionOptions = ( new Map());
|
|
355
|
-
this._sessions = ( new ResourceMap());
|
|
356
|
-
this._resourceAliases = ( new ResourceMap());
|
|
357
|
-
this._hasCanDelegateProvidersKey = ChatContextKeys.hasCanDelegateProviders.bindTo(this._contextKeyService);
|
|
358
|
-
this._register(extensionPoint.setHandler(extensions => {
|
|
359
|
-
for (const ext of extensions) {
|
|
360
|
-
if (!isProposedApiEnabled(ext.description)) {
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
if (!Array.isArray(ext.value)) {
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
for (const contribution of ext.value) {
|
|
367
|
-
this._register(this.registerContribution(contribution, ext.description));
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}));
|
|
371
|
-
this._register(Event.filter(
|
|
372
|
-
this._contextKeyService.onDidChangeContext,
|
|
373
|
-
e => e.affectsSome(this._contextKeys)
|
|
374
|
-
)(() => {
|
|
375
|
-
this._evaluateAvailability();
|
|
376
|
-
}));
|
|
377
|
-
const builtinSessionProviders = [AgentSessionProviders.Local];
|
|
378
|
-
const contributedSessionProviders = observableFromEvent(this.onDidChangeAvailability, () => Array.from(( this._contributions.keys())).filter(key => ( this._contributionDisposables.has(key)) && isAgentSessionProviderType(key))).recomputeInitiallyAndOnChange(this._store);
|
|
379
|
-
this._register(autorun(reader => {
|
|
380
|
-
const activatedProviders = [...builtinSessionProviders, ...contributedSessionProviders.read(reader)];
|
|
381
|
-
for (const provider of ( Object.values(AgentSessionProviders))) {
|
|
382
|
-
if (activatedProviders.includes(provider)) {
|
|
383
|
-
reader.store.add(
|
|
384
|
-
registerNewSessionInPlaceAction(provider, getAgentSessionProviderName(provider))
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}));
|
|
389
|
-
this._register(this._labelService.registerFormatter({
|
|
390
|
-
scheme: Schemas.copilotPr,
|
|
391
|
-
formatting: {
|
|
392
|
-
label: "${authority}${path}",
|
|
393
|
-
separator: sep,
|
|
394
|
-
stripPathStartingSeparator: true
|
|
395
|
-
}
|
|
396
|
-
}));
|
|
397
|
-
}
|
|
398
|
-
reportInProgress(chatSessionType, count) {
|
|
399
|
-
if (!( this._itemControllers.has(chatSessionType))) {
|
|
400
|
-
this._logService.warn(
|
|
401
|
-
`Attempted to report in-progress status for unknown chat session type '${chatSessionType}'`
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
this.inProgressMap.set(chatSessionType, count);
|
|
405
|
-
this._onDidChangeInProgress.fire();
|
|
406
|
-
}
|
|
407
|
-
getInProgress() {
|
|
408
|
-
return ( Array.from(this.inProgressMap.entries()).map(([chatSessionType, count]) => ({
|
|
409
|
-
chatSessionType,
|
|
410
|
-
count
|
|
411
|
-
})));
|
|
412
|
-
}
|
|
413
|
-
async updateInProgressStatus(chatSessionType) {
|
|
414
|
-
try {
|
|
415
|
-
const items = [];
|
|
416
|
-
for await (const result of this.getChatSessionItems([chatSessionType], CancellationToken.None)) {
|
|
417
|
-
items.push(...result.items);
|
|
418
|
-
}
|
|
419
|
-
const inProgress = items.filter(item => item.status && isSessionInProgressStatus(item.status));
|
|
420
|
-
this.reportInProgress(chatSessionType, inProgress.length);
|
|
421
|
-
} catch (error) {
|
|
422
|
-
this._logService.warn(
|
|
423
|
-
`Failed to update in-progress status for chat session type '${chatSessionType}':`,
|
|
424
|
-
error
|
|
425
|
-
);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
registerContribution(contribution, ext) {
|
|
429
|
-
this._logService.trace(
|
|
430
|
-
`[ChatSessionsService] registerContribution called for type='${contribution.type}', canDelegate=${contribution.canDelegate}, when='${contribution.when}', extension='${ext.identifier.value}'`
|
|
431
|
-
);
|
|
432
|
-
if (( this._contributions.has(contribution.type))) {
|
|
433
|
-
this._logService.trace(
|
|
434
|
-
`[ChatSessionsService] registerContribution: type='${contribution.type}' already registered, skipping`
|
|
435
|
-
);
|
|
436
|
-
return Disposable.None;
|
|
437
|
-
}
|
|
438
|
-
if (contribution.when) {
|
|
439
|
-
const whenExpr = ContextKeyExpr.deserialize(contribution.when);
|
|
440
|
-
if (whenExpr) {
|
|
441
|
-
for (const key of ( whenExpr.keys())) {
|
|
442
|
-
this._contextKeys.add(key);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
this._contributions.set(contribution.type, {
|
|
447
|
-
contribution,
|
|
448
|
-
extension: ext
|
|
449
|
-
});
|
|
450
|
-
if (contribution.alternativeIds) {
|
|
451
|
-
for (const altId of contribution.alternativeIds) {
|
|
452
|
-
if (( this._alternativeIdMap.has(altId))) {
|
|
453
|
-
this._logService.warn(
|
|
454
|
-
`Alternative ID '${altId}' is already mapped to '${this._alternativeIdMap.get(altId)}'. Remapping to '${contribution.type}'.`
|
|
455
|
-
);
|
|
456
|
-
}
|
|
457
|
-
this._alternativeIdMap.set(altId, contribution.type);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
this._evaluateAvailability();
|
|
461
|
-
return {
|
|
462
|
-
dispose: () => {
|
|
463
|
-
this._contributions.delete(contribution.type);
|
|
464
|
-
if (contribution.alternativeIds) {
|
|
465
|
-
for (const altId of contribution.alternativeIds) {
|
|
466
|
-
if (this._alternativeIdMap.get(altId) === contribution.type) {
|
|
467
|
-
this._alternativeIdMap.delete(altId);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
472
|
-
this._updateHasCanDelegateProvidersContextKey();
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
_isContributionAvailable(contribution) {
|
|
477
|
-
if (!contribution.when) {
|
|
478
|
-
return true;
|
|
479
|
-
}
|
|
480
|
-
const whenExpr = ContextKeyExpr.deserialize(contribution.when);
|
|
481
|
-
return !whenExpr || this._contextKeyService.contextMatchesRules(whenExpr);
|
|
482
|
-
}
|
|
483
|
-
_resolveToPrimaryType(sessionType) {
|
|
484
|
-
const contribution = this._contributions.get(sessionType)?.contribution;
|
|
485
|
-
if (contribution) {
|
|
486
|
-
if (this._isContributionAvailable(contribution)) {
|
|
487
|
-
return sessionType;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
const primaryType = this._alternativeIdMap.get(sessionType);
|
|
491
|
-
if (primaryType) {
|
|
492
|
-
const altContribution = this._contributions.get(primaryType)?.contribution;
|
|
493
|
-
if (altContribution && this._isContributionAvailable(altContribution)) {
|
|
494
|
-
return primaryType;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
return undefined;
|
|
498
|
-
}
|
|
499
|
-
_registerMenuItems(contribution, extensionDescription) {
|
|
500
|
-
const contextKeyService = this._contextKeyService.createOverlay([["chatSessionType", contribution.type]]);
|
|
501
|
-
const rawMenuActions = this._menuService.getMenuActions(MenuId.AgentSessionsCreateSubMenu, contextKeyService);
|
|
502
|
-
const menuActions = ( rawMenuActions.map(value => value[1])).flat();
|
|
503
|
-
const disposables = ( new DisposableStore());
|
|
504
|
-
for (let i = 0; i < menuActions.length; i++) {
|
|
505
|
-
const action = menuActions[i];
|
|
506
|
-
if (action instanceof MenuItemAction) {
|
|
507
|
-
if (i === 0 && !contribution.canDelegate) {
|
|
508
|
-
disposables.add(
|
|
509
|
-
registerNewSessionExternalAction(contribution.type, contribution.displayName, action.item.id)
|
|
510
|
-
);
|
|
511
|
-
} else {
|
|
512
|
-
disposables.add(MenuRegistry.appendMenuItem(MenuId.ChatNewMenu, {
|
|
513
|
-
command: action.item,
|
|
514
|
-
group: "4_externally_contributed"
|
|
515
|
-
}));
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
return {
|
|
520
|
-
dispose: () => disposables.dispose()
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
_registerCommands(contribution) {
|
|
524
|
-
const isAvailableInSessionTypePicker = isAgentSessionProviderType(contribution.type);
|
|
525
|
-
return combinedDisposable(registerAction2(class OpenChatSessionAction extends Action2 {
|
|
526
|
-
constructor() {
|
|
527
|
-
super({
|
|
528
|
-
id: `workbench.action.chat.openSessionWithPrompt.${contribution.type}`,
|
|
529
|
-
title: ( localize2(6178, "New {0} with Prompt", contribution.displayName)),
|
|
530
|
-
category: CHAT_CATEGORY,
|
|
531
|
-
icon: Codicon.plus,
|
|
532
|
-
f1: false,
|
|
533
|
-
precondition: ChatContextKeys.enabled
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
async run(accessor, chatOptions) {
|
|
537
|
-
const chatService = accessor.get(IChatService);
|
|
538
|
-
const {
|
|
539
|
-
type
|
|
540
|
-
} = contribution;
|
|
541
|
-
if (chatOptions) {
|
|
542
|
-
const resource = URI.revive(chatOptions.resource);
|
|
543
|
-
const ref = await chatService.acquireOrLoadSession(resource, ChatAgentLocation.Chat, CancellationToken.None);
|
|
544
|
-
try {
|
|
545
|
-
const result = await chatService.sendRequest(resource, chatOptions.prompt, {
|
|
546
|
-
agentIdSilent: type,
|
|
547
|
-
attachedContext: chatOptions.attachedContext
|
|
548
|
-
});
|
|
549
|
-
if (result.kind === "queued") {
|
|
550
|
-
await result.deferred;
|
|
551
|
-
} else if (result.kind === "sent") {
|
|
552
|
-
await result.data.responseCompletePromise;
|
|
553
|
-
}
|
|
554
|
-
} finally {
|
|
555
|
-
ref?.dispose();
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}),
|
|
560
|
-
registerAction2(class OpenNewChatSessionEditorAction extends Action2 {
|
|
561
|
-
constructor() {
|
|
562
|
-
super({
|
|
563
|
-
id: `workbench.action.chat.openNewSessionEditor.${contribution.type}`,
|
|
564
|
-
title: ( localize2(6179, "New {0}", contribution.displayName)),
|
|
565
|
-
category: CHAT_CATEGORY,
|
|
566
|
-
icon: Codicon.plus,
|
|
567
|
-
f1: true,
|
|
568
|
-
precondition: ChatContextKeys.enabled
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
async run(accessor, chatOptions) {
|
|
572
|
-
const {
|
|
573
|
-
type,
|
|
574
|
-
displayName
|
|
575
|
-
} = contribution;
|
|
576
|
-
await openChatSession(accessor, {
|
|
577
|
-
type,
|
|
578
|
-
displayName,
|
|
579
|
-
position: ChatSessionPosition.Editor
|
|
580
|
-
}, chatOptions);
|
|
581
|
-
}
|
|
582
|
-
}),
|
|
583
|
-
registerAction2(class OpenNewChatSessionSidebarAction extends Action2 {
|
|
584
|
-
constructor() {
|
|
585
|
-
super({
|
|
586
|
-
id: `workbench.action.chat.openNewSessionSidebar.${contribution.type}`,
|
|
587
|
-
title: ( localize2(6180, "New {0}", contribution.displayName)),
|
|
588
|
-
category: CHAT_CATEGORY,
|
|
589
|
-
icon: Codicon.plus,
|
|
590
|
-
f1: false,
|
|
591
|
-
precondition: ChatContextKeys.enabled,
|
|
592
|
-
menu: !isAvailableInSessionTypePicker ? {
|
|
593
|
-
id: MenuId.ChatNewMenu,
|
|
594
|
-
group: "3_new_special"
|
|
595
|
-
} : undefined
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
async run(accessor, chatOptions) {
|
|
599
|
-
const {
|
|
600
|
-
type,
|
|
601
|
-
displayName
|
|
602
|
-
} = contribution;
|
|
603
|
-
await openChatSession(accessor, {
|
|
604
|
-
type,
|
|
605
|
-
displayName,
|
|
606
|
-
position: ChatSessionPosition.Sidebar
|
|
607
|
-
}, chatOptions);
|
|
608
|
-
}
|
|
609
|
-
}));
|
|
610
|
-
}
|
|
611
|
-
_evaluateAvailability() {
|
|
612
|
-
const newlyEnabledChatSessionTypes = ( new Set());
|
|
613
|
-
const newlyDisabledChatSessionTypes = ( new Set());
|
|
614
|
-
const disposedChatSessions = ( new ResourceSet());
|
|
615
|
-
for (const {
|
|
616
|
-
contribution,
|
|
617
|
-
extension
|
|
618
|
-
} of ( this._contributions.values())) {
|
|
619
|
-
const isCurrentlyRegistered = ( this._contributionDisposables.has(contribution.type));
|
|
620
|
-
const shouldBeRegistered = this._isContributionAvailable(contribution);
|
|
621
|
-
this._logService.trace(
|
|
622
|
-
`[ChatSessionsService] _evaluateAvailability: type='${contribution.type}', isCurrentlyRegistered=${isCurrentlyRegistered}, shouldBeRegistered=${shouldBeRegistered}, when='${contribution.when}'`
|
|
623
|
-
);
|
|
624
|
-
if (isCurrentlyRegistered && !shouldBeRegistered) {
|
|
625
|
-
this._contributionDisposables.deleteAndDispose(contribution.type);
|
|
626
|
-
for (const sessionResource of this._disposeSessionsForContribution(contribution.type)) {
|
|
627
|
-
disposedChatSessions.add(sessionResource);
|
|
628
|
-
}
|
|
629
|
-
newlyDisabledChatSessionTypes.add(contribution.type);
|
|
630
|
-
} else if (!isCurrentlyRegistered && shouldBeRegistered) {
|
|
631
|
-
if (extension) {
|
|
632
|
-
this._enableContribution(contribution, extension);
|
|
633
|
-
}
|
|
634
|
-
newlyEnabledChatSessionTypes.add(contribution.type);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
if (newlyEnabledChatSessionTypes.size > 0 || newlyDisabledChatSessionTypes.size > 0) {
|
|
638
|
-
this._onDidChangeAvailability.fire();
|
|
639
|
-
for (const chatSessionType of [...newlyEnabledChatSessionTypes, ...newlyDisabledChatSessionTypes]) {
|
|
640
|
-
this._onDidChangeItemsProviders.fire({
|
|
641
|
-
chatSessionType
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
if (disposedChatSessions.size > 0) {
|
|
645
|
-
this._onDidChangeSessionItems.fire({
|
|
646
|
-
removed: Array.from(disposedChatSessions)
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
this._updateHasCanDelegateProvidersContextKey();
|
|
651
|
-
}
|
|
652
|
-
_enableContribution(contribution, ext) {
|
|
653
|
-
this._logService.trace(
|
|
654
|
-
`[ChatSessionsService] _enableContribution: type='${contribution.type}', canDelegate=${contribution.canDelegate}`
|
|
655
|
-
);
|
|
656
|
-
const disposableStore = ( new DisposableStore());
|
|
657
|
-
this._contributionDisposables.set(contribution.type, disposableStore);
|
|
658
|
-
if (contribution.canDelegate) {
|
|
659
|
-
disposableStore.add(this._registerAgent(contribution, ext));
|
|
660
|
-
disposableStore.add(this._registerCommands(contribution));
|
|
661
|
-
}
|
|
662
|
-
disposableStore.add(this._registerMenuItems(contribution, ext));
|
|
663
|
-
}
|
|
664
|
-
_disposeSessionsForContribution(contributionId) {
|
|
665
|
-
const sessionsToDispose = [];
|
|
666
|
-
for (const [sessionResource, sessionData] of this._sessions) {
|
|
667
|
-
if (sessionData.chatSessionType === contributionId) {
|
|
668
|
-
sessionsToDispose.push(sessionResource);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
if (sessionsToDispose.length > 0) {
|
|
672
|
-
this._logService.info(
|
|
673
|
-
`Disposing ${sessionsToDispose.length} cached sessions for contribution '${contributionId}' due to when clause change`
|
|
674
|
-
);
|
|
675
|
-
}
|
|
676
|
-
for (const sessionKey of sessionsToDispose) {
|
|
677
|
-
const sessionData = this._sessions.get(sessionKey);
|
|
678
|
-
if (sessionData) {
|
|
679
|
-
sessionData.dispose();
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
return sessionsToDispose;
|
|
683
|
-
}
|
|
684
|
-
_registerAgent(contribution, ext) {
|
|
685
|
-
const storedIcon = this.getContributionIcon(ext, contribution);
|
|
686
|
-
const icons = ThemeIcon.isThemeIcon(storedIcon) ? {
|
|
687
|
-
themeIcon: storedIcon,
|
|
688
|
-
icon: undefined,
|
|
689
|
-
iconDark: undefined
|
|
690
|
-
} : storedIcon ? {
|
|
691
|
-
icon: storedIcon.light,
|
|
692
|
-
iconDark: storedIcon.dark
|
|
693
|
-
} : {
|
|
694
|
-
themeIcon: Codicon.sendToRemoteAgent
|
|
695
|
-
};
|
|
696
|
-
const id = contribution.type;
|
|
697
|
-
const agentData = {
|
|
698
|
-
id,
|
|
699
|
-
name: contribution.name,
|
|
700
|
-
fullName: contribution.displayName,
|
|
701
|
-
description: contribution.description,
|
|
702
|
-
isDefault: false,
|
|
703
|
-
isCore: false,
|
|
704
|
-
isDynamic: true,
|
|
705
|
-
slashCommands: contribution.commands ?? [],
|
|
706
|
-
locations: [ChatAgentLocation.Chat],
|
|
707
|
-
modes: [ChatModeKind.Agent, ChatModeKind.Ask],
|
|
708
|
-
disambiguation: [],
|
|
709
|
-
metadata: {
|
|
710
|
-
...icons
|
|
711
|
-
},
|
|
712
|
-
capabilities: contribution.capabilities,
|
|
713
|
-
canAccessPreviousChatHistory: true,
|
|
714
|
-
extensionId: ext.identifier,
|
|
715
|
-
extensionVersion: ext.version,
|
|
716
|
-
extensionDisplayName: ext.displayName || ext.name,
|
|
717
|
-
extensionPublisherId: ext.publisher
|
|
718
|
-
};
|
|
719
|
-
return this._chatAgentService.registerAgent(id, agentData);
|
|
720
|
-
}
|
|
721
|
-
getAllChatSessionContributions() {
|
|
722
|
-
return ( Array.from(( this._contributions.values())).filter(entry => this._isContributionAvailable(entry.contribution)).map(
|
|
723
|
-
entry => this.resolveChatSessionContribution(entry.extension, entry.contribution)
|
|
724
|
-
));
|
|
725
|
-
}
|
|
726
|
-
_updateHasCanDelegateProvidersContextKey() {
|
|
727
|
-
const hasCanDelegate = this.getAllChatSessionContributions().filter(c => c.canDelegate);
|
|
728
|
-
const canDelegateEnabled = hasCanDelegate.length > 0;
|
|
729
|
-
this._logService.trace(
|
|
730
|
-
`[ChatSessionsService] hasCanDelegateProvidersAvailable=${canDelegateEnabled} (${( hasCanDelegate.map(c => c.type)).join(", ")})`
|
|
731
|
-
);
|
|
732
|
-
this._hasCanDelegateProvidersKey.set(canDelegateEnabled);
|
|
733
|
-
}
|
|
734
|
-
getChatSessionContribution(chatSessionType) {
|
|
735
|
-
const entry = this._contributions.get(chatSessionType);
|
|
736
|
-
if (!entry) {
|
|
737
|
-
return undefined;
|
|
738
|
-
}
|
|
739
|
-
if (!this._isContributionAvailable(entry.contribution)) {
|
|
740
|
-
return undefined;
|
|
741
|
-
}
|
|
742
|
-
return this.resolveChatSessionContribution(entry.extension, entry.contribution);
|
|
743
|
-
}
|
|
744
|
-
resolveChatSessionContribution(ext, contribution) {
|
|
745
|
-
return {
|
|
746
|
-
...contribution,
|
|
747
|
-
icon: this.resolveIconForCurrentColorTheme(this.getContributionIcon(ext, contribution))
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
getContributionIcon(ext, contribution) {
|
|
751
|
-
if (!contribution.icon) {
|
|
752
|
-
return undefined;
|
|
753
|
-
}
|
|
754
|
-
if (typeof contribution.icon === "string") {
|
|
755
|
-
return contribution.icon.startsWith("$(") && contribution.icon.endsWith(")") ? ThemeIcon.fromString(contribution.icon) : ThemeIcon.fromId(contribution.icon);
|
|
756
|
-
}
|
|
757
|
-
return {
|
|
758
|
-
dark: ext ? joinPath(ext.extensionLocation, contribution.icon.dark) : ( URI.parse(contribution.icon.dark)),
|
|
759
|
-
light: ext ? joinPath(ext.extensionLocation, contribution.icon.light) : ( URI.parse(contribution.icon.light))
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
resolveIconForCurrentColorTheme(rawIcon) {
|
|
763
|
-
if (!rawIcon) {
|
|
764
|
-
return undefined;
|
|
765
|
-
}
|
|
766
|
-
if (ThemeIcon.isThemeIcon(rawIcon)) {
|
|
767
|
-
return rawIcon;
|
|
768
|
-
} else if (isDark(this._themeService.getColorTheme().type)) {
|
|
769
|
-
return rawIcon.dark;
|
|
770
|
-
} else {
|
|
771
|
-
return rawIcon.light;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
registerChatSessionContribution(contribution) {
|
|
775
|
-
if (( this._contributions.has(contribution.type))) {
|
|
776
|
-
return {
|
|
777
|
-
dispose: () => {}
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
this._contributions.set(contribution.type, {
|
|
781
|
-
contribution,
|
|
782
|
-
extension: undefined
|
|
783
|
-
});
|
|
784
|
-
this._onDidChangeAvailability.fire();
|
|
785
|
-
return toDisposable(() => {
|
|
786
|
-
this._contributions.delete(contribution.type);
|
|
787
|
-
this._onDidChangeAvailability.fire();
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
async activateChatSessionItemProvider(chatViewType) {
|
|
791
|
-
await this.doActivateChatSessionItemController(chatViewType);
|
|
792
|
-
}
|
|
793
|
-
async doActivateChatSessionItemController(chatViewType) {
|
|
794
|
-
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
795
|
-
const resolvedType = this._resolveToPrimaryType(chatViewType);
|
|
796
|
-
if (resolvedType) {
|
|
797
|
-
chatViewType = resolvedType;
|
|
798
|
-
}
|
|
799
|
-
const contribution = this._contributions.get(chatViewType)?.contribution;
|
|
800
|
-
if (contribution && !this._isContributionAvailable(contribution)) {
|
|
801
|
-
return false;
|
|
802
|
-
}
|
|
803
|
-
if (( this._itemControllers.has(chatViewType))) {
|
|
804
|
-
return true;
|
|
805
|
-
}
|
|
806
|
-
await this._extensionService.activateByEvent(`onChatSession:${chatViewType}`);
|
|
807
|
-
const controller = this._itemControllers.get(chatViewType);
|
|
808
|
-
return !!controller;
|
|
809
|
-
}
|
|
810
|
-
async canResolveChatSession(sessionType) {
|
|
811
|
-
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
812
|
-
const resolvedType = this._resolveToPrimaryType(sessionType) || sessionType;
|
|
813
|
-
const contribution = this._contributions.get(resolvedType)?.contribution;
|
|
814
|
-
if (contribution && !this._isContributionAvailable(contribution)) {
|
|
815
|
-
return false;
|
|
816
|
-
}
|
|
817
|
-
if (( this._contentProviders.has(sessionType))) {
|
|
818
|
-
return true;
|
|
819
|
-
}
|
|
820
|
-
await this._extensionService.activateByEvent(`onChatSession:${sessionType}`);
|
|
821
|
-
return ( this._contentProviders.has(sessionType));
|
|
822
|
-
}
|
|
823
|
-
async tryActivateControllers(providersToResolve) {
|
|
824
|
-
await Promise.all(( this.getAllChatSessionContributions().map(async contrib => {
|
|
825
|
-
if (providersToResolve && !providersToResolve.includes(contrib.type)) {
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
if (!(await this.doActivateChatSessionItemController(contrib.type))) {
|
|
829
|
-
if (providersToResolve?.includes(contrib.type)) {
|
|
830
|
-
this._logService.trace(
|
|
831
|
-
`[ChatSessionsService] No enabled provider found for chat session type ${contrib.type}`
|
|
832
|
-
);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
})));
|
|
836
|
-
}
|
|
837
|
-
getChatSessionItems(providersToResolve, token) {
|
|
838
|
-
return new AsyncIterableProducer(async writer => {
|
|
839
|
-
await raceCancellationError(this.tryActivateControllers(providersToResolve), token);
|
|
840
|
-
await Promise.all(
|
|
841
|
-
Array.from(this._itemControllers, async ([chatSessionType, controllerEntry]) => {
|
|
842
|
-
const resolvedType = this._resolveToPrimaryType(chatSessionType) ?? chatSessionType;
|
|
843
|
-
if (providersToResolve && !providersToResolve.includes(resolvedType)) {
|
|
844
|
-
return;
|
|
845
|
-
}
|
|
846
|
-
try {
|
|
847
|
-
await raceCancellationError(controllerEntry.initialRefresh, token);
|
|
848
|
-
const providerSessions = controllerEntry.controller.items;
|
|
849
|
-
this._logService.trace(
|
|
850
|
-
`[ChatSessionsService] Resolved ${providerSessions.length} sessions for provider ${resolvedType}`
|
|
851
|
-
);
|
|
852
|
-
writer.emitOne({
|
|
853
|
-
chatSessionType: resolvedType,
|
|
854
|
-
items: providerSessions
|
|
855
|
-
});
|
|
856
|
-
} catch (err) {
|
|
857
|
-
if (!isCancellationError(err)) {
|
|
858
|
-
this._logService.error(
|
|
859
|
-
`[ChatSessionsService] Failed to resolve sessions for provider ${resolvedType}`,
|
|
860
|
-
err
|
|
861
|
-
);
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
})
|
|
865
|
-
);
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
async refreshChatSessionItems(providersToResolve, token) {
|
|
869
|
-
await this.tryActivateControllers(providersToResolve);
|
|
870
|
-
await Promise.all(( Array.from(this._itemControllers).map(async ([chatSessionType, controllerEntry]) => {
|
|
871
|
-
const resolvedType = this._resolveToPrimaryType(chatSessionType) ?? chatSessionType;
|
|
872
|
-
if (providersToResolve && !providersToResolve.includes(resolvedType)) {
|
|
873
|
-
return;
|
|
874
|
-
}
|
|
875
|
-
try {
|
|
876
|
-
await controllerEntry.controller.refresh(token);
|
|
877
|
-
} catch (err) {
|
|
878
|
-
if (!isCancellationError(err)) {
|
|
879
|
-
this._logService.error(
|
|
880
|
-
`[ChatSessionsService] Failed to resolve sessions for provider ${resolvedType}`,
|
|
881
|
-
err
|
|
882
|
-
);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
})));
|
|
886
|
-
}
|
|
887
|
-
getRegisteredChatSessionItemProviders() {
|
|
888
|
-
return [...( new Set(( Array.from(( this._itemControllers.keys())).map(key => this._resolveToPrimaryType(key) ?? key))))];
|
|
889
|
-
}
|
|
890
|
-
registerChatSessionItemController(chatSessionType, controller) {
|
|
891
|
-
const disposables = ( new DisposableStore());
|
|
892
|
-
const initialRefreshCts = disposables.add(( new CancellationTokenSource()));
|
|
893
|
-
this._itemControllers.set(chatSessionType, {
|
|
894
|
-
controller,
|
|
895
|
-
initialRefresh: controller.refresh(initialRefreshCts.token)
|
|
896
|
-
});
|
|
897
|
-
this._onDidChangeItemsProviders.fire({
|
|
898
|
-
chatSessionType
|
|
899
|
-
});
|
|
900
|
-
disposables.add(controller.onDidChangeChatSessionItems(e => {
|
|
901
|
-
this._onDidChangeSessionItems.fire(e);
|
|
902
|
-
this.updateInProgressStatus(chatSessionType);
|
|
903
|
-
}));
|
|
904
|
-
return {
|
|
905
|
-
dispose: () => {
|
|
906
|
-
initialRefreshCts.cancel();
|
|
907
|
-
disposables.dispose();
|
|
908
|
-
const controller = this._itemControllers.get(chatSessionType);
|
|
909
|
-
if (controller) {
|
|
910
|
-
this._itemControllers.delete(chatSessionType);
|
|
911
|
-
this._onDidChangeItemsProviders.fire({
|
|
912
|
-
chatSessionType
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
this.updateInProgressStatus(chatSessionType);
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
registerChatSessionContentProvider(chatSessionType, provider) {
|
|
920
|
-
if (( this._contentProviders.has(chatSessionType))) {
|
|
921
|
-
throw ( new Error(`Content provider for ${chatSessionType} is already registered.`));
|
|
922
|
-
}
|
|
923
|
-
this._contentProviders.set(chatSessionType, provider);
|
|
924
|
-
this._onDidChangeContentProviderSchemes.fire({
|
|
925
|
-
added: [chatSessionType],
|
|
926
|
-
removed: []
|
|
927
|
-
});
|
|
928
|
-
return {
|
|
929
|
-
dispose: () => {
|
|
930
|
-
this._contentProviders.delete(chatSessionType);
|
|
931
|
-
this._onDidChangeContentProviderSchemes.fire({
|
|
932
|
-
added: [],
|
|
933
|
-
removed: [chatSessionType]
|
|
934
|
-
});
|
|
935
|
-
for (const [key, session] of this._sessions) {
|
|
936
|
-
if (session.chatSessionType === chatSessionType) {
|
|
937
|
-
session.dispose();
|
|
938
|
-
this._sessions.delete(key);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
};
|
|
943
|
-
}
|
|
944
|
-
getInProgressSessionDescription(chatModel) {
|
|
945
|
-
const requests = chatModel.getRequests();
|
|
946
|
-
if (requests.length === 0) {
|
|
947
|
-
return undefined;
|
|
948
|
-
}
|
|
949
|
-
const lastRequest = requests.at(-1);
|
|
950
|
-
const response = lastRequest?.response;
|
|
951
|
-
if (!response) {
|
|
952
|
-
return undefined;
|
|
953
|
-
}
|
|
954
|
-
if (response.isComplete) {
|
|
955
|
-
return undefined;
|
|
956
|
-
}
|
|
957
|
-
const responseParts = response.response.value;
|
|
958
|
-
let description = "";
|
|
959
|
-
for (let i = responseParts.length - 1; i >= 0; i--) {
|
|
960
|
-
const part = responseParts[i];
|
|
961
|
-
if (description) {
|
|
962
|
-
break;
|
|
963
|
-
}
|
|
964
|
-
if (part.kind === "confirmation" && typeof part.message === "string") {
|
|
965
|
-
description = part.message;
|
|
966
|
-
} else if (part.kind === "toolInvocation") {
|
|
967
|
-
const toolInvocation = part;
|
|
968
|
-
const state = toolInvocation.state.get();
|
|
969
|
-
description = toolInvocation.generatedTitle || toolInvocation.pastTenseMessage || toolInvocation.invocationMessage;
|
|
970
|
-
if (state.type === IChatToolInvocation.StateKind.WaitingForConfirmation) {
|
|
971
|
-
const confirmationTitle = state.confirmationMessages?.title;
|
|
972
|
-
const titleMessage = confirmationTitle && (typeof confirmationTitle === "string" ? confirmationTitle : confirmationTitle.value);
|
|
973
|
-
const descriptionValue = typeof description === "string" ? description : description.value;
|
|
974
|
-
description = titleMessage ?? ( localize(6181, "Waiting for confirmation: {0}", descriptionValue));
|
|
975
|
-
}
|
|
976
|
-
} else if (part.kind === "toolInvocationSerialized") {
|
|
977
|
-
description = part.invocationMessage;
|
|
978
|
-
} else if (part.kind === "progressMessage") {
|
|
979
|
-
description = part.content;
|
|
980
|
-
} else if (part.kind === "thinking") {
|
|
981
|
-
description = ( localize(6182, "Thinking..."));
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
return description ? renderAsPlaintext(description, {
|
|
985
|
-
useLinkFormatter: true
|
|
986
|
-
}) : "";
|
|
987
|
-
}
|
|
988
|
-
async createNewChatSessionItem(chatSessionType, request, token) {
|
|
989
|
-
const controllerData = this._itemControllers.get(chatSessionType);
|
|
990
|
-
if (!controllerData) {
|
|
991
|
-
return undefined;
|
|
992
|
-
}
|
|
993
|
-
await controllerData.initialRefresh;
|
|
994
|
-
return controllerData.controller.newChatSessionItem?.(request, token);
|
|
995
|
-
}
|
|
996
|
-
async getOrCreateChatSession(sessionResource, token) {
|
|
997
|
-
{
|
|
998
|
-
const existingSessionData = this._sessions.get(sessionResource);
|
|
999
|
-
if (existingSessionData) {
|
|
1000
|
-
return existingSessionData.session;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
if (!(await raceCancellationError(this.canResolveChatSession(sessionResource.scheme), token))) {
|
|
1004
|
-
throw Error(`Can not find provider for ${sessionResource}`);
|
|
1005
|
-
}
|
|
1006
|
-
{
|
|
1007
|
-
const existingSessionData = this._sessions.get(sessionResource);
|
|
1008
|
-
if (existingSessionData) {
|
|
1009
|
-
return existingSessionData.session;
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
const resolvedType = this._resolveToPrimaryType(sessionResource.scheme) || sessionResource.scheme;
|
|
1013
|
-
const provider = this._contentProviders.get(resolvedType);
|
|
1014
|
-
if (!provider) {
|
|
1015
|
-
throw Error(`Can not find provider for ${sessionResource}`);
|
|
1016
|
-
}
|
|
1017
|
-
let session;
|
|
1018
|
-
const newSessionOptions = this.getNewSessionOptionsForSessionType(resolvedType);
|
|
1019
|
-
if (isUntitledChatSession(sessionResource) && newSessionOptions) {
|
|
1020
|
-
session = {
|
|
1021
|
-
sessionResource: sessionResource,
|
|
1022
|
-
onWillDispose: Event.None,
|
|
1023
|
-
history: [],
|
|
1024
|
-
options: newSessionOptions ?? {},
|
|
1025
|
-
dispose: () => {}
|
|
1026
|
-
};
|
|
1027
|
-
} else {
|
|
1028
|
-
session = await raceCancellationError(provider.provideChatSessionContent(sessionResource, token), token);
|
|
1029
|
-
}
|
|
1030
|
-
if (session.options) {
|
|
1031
|
-
for (const [optionId, value] of session.options) {
|
|
1032
|
-
this.setSessionOption(sessionResource, optionId, value);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
{
|
|
1036
|
-
const existingSessionData = this._sessions.get(sessionResource);
|
|
1037
|
-
if (existingSessionData) {
|
|
1038
|
-
session.dispose();
|
|
1039
|
-
return existingSessionData.session;
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
const sessionData = ( new ContributedChatSessionData(
|
|
1043
|
-
session,
|
|
1044
|
-
sessionResource.scheme,
|
|
1045
|
-
sessionResource,
|
|
1046
|
-
session.options,
|
|
1047
|
-
resource => {
|
|
1048
|
-
sessionData.dispose();
|
|
1049
|
-
this._sessions.delete(resource);
|
|
1050
|
-
}
|
|
1051
|
-
));
|
|
1052
|
-
this._sessions.set(sessionResource, sessionData);
|
|
1053
|
-
if (session.options) {
|
|
1054
|
-
this._onDidChangeSessionOptions.fire({
|
|
1055
|
-
sessionResource,
|
|
1056
|
-
updates: session.options
|
|
1057
|
-
});
|
|
1058
|
-
}
|
|
1059
|
-
return session;
|
|
1060
|
-
}
|
|
1061
|
-
hasAnySessionOptions(sessionResource) {
|
|
1062
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1063
|
-
return !!session && !!session.options && session.options.size > 0;
|
|
1064
|
-
}
|
|
1065
|
-
getSessionOptions(sessionResource) {
|
|
1066
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1067
|
-
if (!session) {
|
|
1068
|
-
return undefined;
|
|
1069
|
-
}
|
|
1070
|
-
const result = ( new Map());
|
|
1071
|
-
for (const [key, value] of session.getAllOptions()) {
|
|
1072
|
-
result.set(key, typeof value === "string" ? value : value.id);
|
|
1073
|
-
}
|
|
1074
|
-
return result.size > 0 ? result : undefined;
|
|
1075
|
-
}
|
|
1076
|
-
getSessionOption(sessionResource, optionId) {
|
|
1077
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1078
|
-
return session?.getOption(optionId);
|
|
1079
|
-
}
|
|
1080
|
-
setSessionOption(sessionResource, optionId, value) {
|
|
1081
|
-
return this.updateSessionOptions(sessionResource, ( new Map([[optionId, value]])));
|
|
1082
|
-
}
|
|
1083
|
-
updateSessionOptions(sessionResource, updates) {
|
|
1084
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1085
|
-
if (!session) {
|
|
1086
|
-
return false;
|
|
1087
|
-
}
|
|
1088
|
-
let didChange = false;
|
|
1089
|
-
for (const [optionId, value] of updates) {
|
|
1090
|
-
const existingValue = session.getOption(optionId);
|
|
1091
|
-
if (existingValue !== value) {
|
|
1092
|
-
session.setOption(optionId, value);
|
|
1093
|
-
didChange = true;
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
if (didChange) {
|
|
1097
|
-
this._onDidChangeSessionOptions.fire({
|
|
1098
|
-
sessionResource,
|
|
1099
|
-
updates: updates
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
return didChange;
|
|
1103
|
-
}
|
|
1104
|
-
_resolveResource(resource) {
|
|
1105
|
-
return this._resourceAliases.get(resource) ?? resource;
|
|
1106
|
-
}
|
|
1107
|
-
registerSessionResourceAlias(untitledResource, realResource) {
|
|
1108
|
-
this._resourceAliases.set(realResource, untitledResource);
|
|
1109
|
-
}
|
|
1110
|
-
setOptionGroupsForSessionType(chatSessionType, handle, optionGroups) {
|
|
1111
|
-
if (optionGroups) {
|
|
1112
|
-
this._sessionTypeOptions.set(chatSessionType, optionGroups);
|
|
1113
|
-
} else {
|
|
1114
|
-
this._sessionTypeOptions.delete(chatSessionType);
|
|
1115
|
-
}
|
|
1116
|
-
this._onDidChangeOptionGroups.fire(chatSessionType);
|
|
1117
|
-
}
|
|
1118
|
-
getOptionGroupsForSessionType(chatSessionType) {
|
|
1119
|
-
return this._sessionTypeOptions.get(chatSessionType);
|
|
1120
|
-
}
|
|
1121
|
-
getNewSessionOptionsForSessionType(chatSessionType) {
|
|
1122
|
-
const options = this._sessionTypeNewSessionOptions.get(chatSessionType);
|
|
1123
|
-
if (!options || options.size === 0) {
|
|
1124
|
-
return undefined;
|
|
1125
|
-
}
|
|
1126
|
-
return ( new Map(options));
|
|
1127
|
-
}
|
|
1128
|
-
setNewSessionOptionsForSessionType(chatSessionType, options) {
|
|
1129
|
-
this._sessionTypeNewSessionOptions.set(chatSessionType, ( new Map(options)));
|
|
1130
|
-
}
|
|
1131
|
-
getCapabilitiesForSessionType(chatSessionType) {
|
|
1132
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1133
|
-
return contribution?.capabilities;
|
|
1134
|
-
}
|
|
1135
|
-
getCustomAgentTargetForSessionType(chatSessionType) {
|
|
1136
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1137
|
-
return contribution?.customAgentTarget ?? Target.Undefined;
|
|
1138
|
-
}
|
|
1139
|
-
requiresCustomModelsForSessionType(chatSessionType) {
|
|
1140
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1141
|
-
return !!contribution?.requiresCustomModels;
|
|
1142
|
-
}
|
|
1143
|
-
supportsDelegationForSessionType(chatSessionType) {
|
|
1144
|
-
const contribution = this._contributions.get(chatSessionType)?.contribution;
|
|
1145
|
-
return contribution?.supportsDelegation !== false;
|
|
1146
|
-
}
|
|
1147
|
-
sessionSupportsFork(sessionResource) {
|
|
1148
|
-
const session =
|
|
1149
|
-
this._sessions.get(sessionResource) ?? this._sessions.get(this._resolveResource(sessionResource));
|
|
1150
|
-
return !!session?.session.forkSession;
|
|
1151
|
-
}
|
|
1152
|
-
async forkChatSession(sessionResource, request, token) {
|
|
1153
|
-
const session = this._sessions.get(this._resolveResource(sessionResource));
|
|
1154
|
-
if (!session?.session.forkSession) {
|
|
1155
|
-
throw ( new Error(`Session ${( sessionResource.toString())} does not support forking`));
|
|
1156
|
-
}
|
|
1157
|
-
return session.session.forkSession(request, token);
|
|
1158
|
-
}
|
|
1159
|
-
getContentProviderSchemes() {
|
|
1160
|
-
return Array.from(( this._contentProviders.keys()));
|
|
1161
|
-
}
|
|
1162
|
-
};
|
|
1163
|
-
ChatSessionsService = ( __decorate([( __param(0, ILogService)), ( __param(1, IChatAgentService)), ( __param(2, IExtensionService)), ( __param(3, IContextKeyService)), ( __param(4, IMenuService)), ( __param(5, IThemeService)), ( __param(6, ILabelService))], ChatSessionsService));
|
|
1164
|
-
function registerNewSessionInPlaceAction(type, displayName) {
|
|
1165
|
-
return registerAction2(class NewChatSessionInPlaceAction extends Action2 {
|
|
1166
|
-
constructor() {
|
|
1167
|
-
super({
|
|
1168
|
-
id: `workbench.action.chat.openNewChatSessionInPlace.${type}`,
|
|
1169
|
-
title: ( localize2(6183, "New {0}", displayName)),
|
|
1170
|
-
category: CHAT_CATEGORY,
|
|
1171
|
-
f1: false,
|
|
1172
|
-
precondition: ChatContextKeys.enabled
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
async run(accessor, ...args) {
|
|
1176
|
-
if (args.length === 0) {
|
|
1177
|
-
throw ( new BugIndicatingError("Expected chat session position argument"));
|
|
1178
|
-
}
|
|
1179
|
-
const chatSessionPosition = args[0];
|
|
1180
|
-
if (chatSessionPosition !== ChatSessionPosition.Sidebar && chatSessionPosition !== ChatSessionPosition.Editor) {
|
|
1181
|
-
throw ( new BugIndicatingError(`Invalid chat session position argument: ${chatSessionPosition}`));
|
|
1182
|
-
}
|
|
1183
|
-
await openChatSession(accessor, {
|
|
1184
|
-
type: type,
|
|
1185
|
-
displayName: ( localize(6184, "Chat")),
|
|
1186
|
-
position: chatSessionPosition,
|
|
1187
|
-
replaceEditor: true
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
function registerNewSessionExternalAction(type, displayName, commandId) {
|
|
1193
|
-
return registerAction2(class NewChatSessionExternalAction extends Action2 {
|
|
1194
|
-
constructor() {
|
|
1195
|
-
super({
|
|
1196
|
-
id: `workbench.action.chat.openNewChatSessionExternal.${type}`,
|
|
1197
|
-
title: ( localize2(6185, "New {0}", displayName)),
|
|
1198
|
-
category: CHAT_CATEGORY,
|
|
1199
|
-
f1: false,
|
|
1200
|
-
precondition: ChatContextKeys.enabled
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
async run(accessor) {
|
|
1204
|
-
const commandService = accessor.get(ICommandService);
|
|
1205
|
-
await commandService.executeCommand(commandId);
|
|
1206
|
-
}
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
var ChatSessionPosition;
|
|
1210
|
-
(function(ChatSessionPosition) {
|
|
1211
|
-
ChatSessionPosition["Editor"] = "editor";
|
|
1212
|
-
ChatSessionPosition["Sidebar"] = "sidebar";
|
|
1213
|
-
})(ChatSessionPosition || (ChatSessionPosition = {}));
|
|
1214
|
-
async function openChatSession(accessor, openOptions, chatSendOptions) {
|
|
1215
|
-
const viewsService = accessor.get(IViewsService);
|
|
1216
|
-
const chatService = accessor.get(IChatService);
|
|
1217
|
-
const logService = accessor.get(ILogService);
|
|
1218
|
-
const editorGroupService = accessor.get(IEditorGroupsService);
|
|
1219
|
-
const editorService = accessor.get(IEditorService);
|
|
1220
|
-
const resource = getResourceForNewChatSession(openOptions);
|
|
1221
|
-
try {
|
|
1222
|
-
switch (openOptions.position) {
|
|
1223
|
-
case ChatSessionPosition.Sidebar:
|
|
1224
|
-
{
|
|
1225
|
-
const view = await viewsService.openView(ChatViewId);
|
|
1226
|
-
if (openOptions.type === AgentSessionProviders.Local) {
|
|
1227
|
-
await view.widget.clear();
|
|
1228
|
-
} else {
|
|
1229
|
-
await view.loadSession(resource);
|
|
1230
|
-
}
|
|
1231
|
-
view.focus();
|
|
1232
|
-
break;
|
|
1233
|
-
}
|
|
1234
|
-
case ChatSessionPosition.Editor:
|
|
1235
|
-
{
|
|
1236
|
-
const options = {
|
|
1237
|
-
override: ChatEditorInput.EditorID,
|
|
1238
|
-
pinned: true,
|
|
1239
|
-
title: {
|
|
1240
|
-
fallback: ( localize(6186, "{0}", openOptions.displayName))
|
|
1241
|
-
}
|
|
1242
|
-
};
|
|
1243
|
-
if (openOptions.replaceEditor) {
|
|
1244
|
-
const activeEditor = editorGroupService.activeGroup.activeEditor;
|
|
1245
|
-
if (!activeEditor || !(activeEditor instanceof ChatEditorInput)) {
|
|
1246
|
-
throw ( new Error("No active chat editor to replace"));
|
|
1247
|
-
}
|
|
1248
|
-
await editorService.replaceEditors([{
|
|
1249
|
-
editor: activeEditor,
|
|
1250
|
-
replacement: {
|
|
1251
|
-
resource,
|
|
1252
|
-
options
|
|
1253
|
-
}
|
|
1254
|
-
}], editorGroupService.activeGroup);
|
|
1255
|
-
} else {
|
|
1256
|
-
await editorService.openEditor({
|
|
1257
|
-
resource,
|
|
1258
|
-
options
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
break;
|
|
1262
|
-
}
|
|
1263
|
-
default:
|
|
1264
|
-
assertNever(
|
|
1265
|
-
openOptions.position,
|
|
1266
|
-
`Unknown chat session position: ${openOptions.position}`
|
|
1267
|
-
);
|
|
1268
|
-
}
|
|
1269
|
-
} catch (e) {
|
|
1270
|
-
logService.error(
|
|
1271
|
-
`Failed to open '${openOptions.type}' chat session with openOptions: ${JSON.stringify(openOptions)}`,
|
|
1272
|
-
e
|
|
1273
|
-
);
|
|
1274
|
-
return;
|
|
1275
|
-
}
|
|
1276
|
-
if (chatSendOptions) {
|
|
1277
|
-
try {
|
|
1278
|
-
if (chatSendOptions.initialSessionOptions) {
|
|
1279
|
-
const model = chatService.getSession(resource);
|
|
1280
|
-
if (model?.contributedChatSession) {
|
|
1281
|
-
model.setContributedChatSession({
|
|
1282
|
-
...model.contributedChatSession,
|
|
1283
|
-
initialSessionOptions: chatSendOptions.initialSessionOptions
|
|
1284
|
-
});
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
await chatService.sendRequest(resource, chatSendOptions.prompt, {
|
|
1288
|
-
agentIdSilent: openOptions.type,
|
|
1289
|
-
attachedContext: chatSendOptions.attachedContext
|
|
1290
|
-
});
|
|
1291
|
-
} catch (e) {
|
|
1292
|
-
logService.error(
|
|
1293
|
-
`Failed to send initial request to '${openOptions.type}' chat session with contextOptions: ${JSON.stringify(chatSendOptions)}`,
|
|
1294
|
-
e
|
|
1295
|
-
);
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
function getResourceForNewChatSession(options) {
|
|
1300
|
-
const isRemoteSession = options.type !== AgentSessionProviders.Local;
|
|
1301
|
-
if (isRemoteSession) {
|
|
1302
|
-
return ( URI.from({
|
|
1303
|
-
scheme: options.type,
|
|
1304
|
-
path: `/untitled-${generateUuid()}`
|
|
1305
|
-
}));
|
|
1306
|
-
}
|
|
1307
|
-
const isEditorPosition = options.position === ChatSessionPosition.Editor;
|
|
1308
|
-
if (isEditorPosition) {
|
|
1309
|
-
return ChatEditorInput.getNewEditorUri();
|
|
1310
|
-
}
|
|
1311
|
-
return LocalChatSessionUri.getNewSessionUri();
|
|
1312
|
-
}
|
|
1313
|
-
function isAgentSessionProviderType(type) {
|
|
1314
|
-
return ( Object.values(AgentSessionProviders)).includes(type);
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
export { ChatSessionPosition, ChatSessionsService, getResourceForNewChatSession };
|