mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
This commit is contained in:
1291
.vscode/searches/no-any-casts.code-search
vendored
1291
.vscode/searches/no-any-casts.code-search
vendored
File diff suppressed because it is too large
Load Diff
@@ -603,27 +603,6 @@ export default tseslint.config(
|
|||||||
'src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts',
|
'src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts',
|
||||||
'src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.ts',
|
'src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.ts',
|
||||||
'src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview.ts',
|
'src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPreview.ts',
|
||||||
'src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/browser/chatSessions/common.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsTreeRenderer.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/chatModel.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/chatService.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/chatServiceImpl.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/chatSessionsService.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/languageModelToolsService.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/languageModels.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/common/tools/manageTodoListTool.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/test/common/languageModels.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/test/common/mockLanguageModelToolsService.ts',
|
|
||||||
'src/vs/workbench/contrib/chat/test/common/mockPromptsService.ts',
|
|
||||||
'src/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens.ts',
|
'src/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens.ts',
|
||||||
'src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.ts',
|
'src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.ts',
|
||||||
'src/vs/workbench/contrib/codeEditor/electron-browser/selectionClipboard.ts',
|
'src/vs/workbench/contrib/codeEditor/electron-browser/selectionClipboard.ts',
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ abstract class ChatCodeBlockAction extends Action2 {
|
|||||||
return this.runWithContext(accessor, context);
|
return this.runWithContext(accessor, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
abstract runWithContext(accessor: ServicesAccessor, context: ICodeBlockActionContext): any;
|
abstract runWithContext(accessor: ServicesAccessor, context: ICodeBlockActionContext): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,6 +622,7 @@ export function registerChatCodeCompareBlockActions() {
|
|||||||
return this.runWithContext(accessor, context);
|
return this.runWithContext(accessor, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
abstract runWithContext(accessor: ServicesAccessor, context: ICodeCompareBlockActionContext): any;
|
abstract runWithContext(accessor: ServicesAccessor, context: ICodeCompareBlockActionContext): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,6 +643,7 @@ export function registerChatCodeCompareBlockActions() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
async runWithContext(accessor: ServicesAccessor, context: ICodeCompareBlockActionContext): Promise<any> {
|
async runWithContext(accessor: ServicesAccessor, context: ICodeCompareBlockActionContext): Promise<any> {
|
||||||
|
|
||||||
const instaService = accessor.get(IInstantiationService);
|
const instaService = accessor.get(IInstantiationService);
|
||||||
@@ -693,6 +696,7 @@ export function registerChatCodeCompareBlockActions() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
async runWithContext(accessor: ServicesAccessor, context: ICodeCompareBlockActionContext): Promise<any> {
|
async runWithContext(accessor: ServicesAccessor, context: ICodeCompareBlockActionContext): Promise<any> {
|
||||||
const instaService = accessor.get(IInstantiationService);
|
const instaService = accessor.get(IInstantiationService);
|
||||||
const editor = instaService.createInstance(DefaultChatTextEditor);
|
const editor = instaService.createInstance(DefaultChatTextEditor);
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ class AttachSelectionToChatAction extends Action2 {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
override async run(accessor: ServicesAccessor, ...args: any[]): Promise<void> {
|
override async run(accessor: ServicesAccessor, ...args: any[]): Promise<void> {
|
||||||
const editorService = accessor.get(IEditorService);
|
const editorService = accessor.get(IEditorService);
|
||||||
|
|
||||||
|
|||||||
@@ -53,12 +53,14 @@ export abstract class EditingSessionAction extends Action2 {
|
|||||||
return this.runEditingSessionAction(accessor, context.editingSession, context.chatWidget, ...args);
|
return this.runEditingSessionAction(accessor, context.editingSession, context.chatWidget, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
abstract runEditingSessionAction(accessor: ServicesAccessor, editingSession: IChatEditingSession, chatWidget: IChatWidget, ...args: unknown[]): any;
|
abstract runEditingSessionAction(accessor: ServicesAccessor, editingSession: IChatEditingSession, chatWidget: IChatWidget, ...args: unknown[]): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve view title toolbar context. If none, return context from the lastFocusedWidget.
|
* Resolve view title toolbar context. If none, return context from the lastFocusedWidget.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export function getEditingSessionContext(accessor: ServicesAccessor, args: any[]): { editingSession?: IChatEditingSession; chatWidget: IChatWidget } | undefined {
|
export function getEditingSessionContext(accessor: ServicesAccessor, args: any[]): { editingSession?: IChatEditingSession; chatWidget: IChatWidget } | undefined {
|
||||||
const arg0 = args.at(0);
|
const arg0 = args.at(0);
|
||||||
const context = isChatViewTitleActionContext(arg0) ? arg0 : undefined;
|
const context = isChatViewTitleActionContext(arg0) ? arg0 : undefined;
|
||||||
@@ -96,6 +98,7 @@ abstract class WorkingSetAction extends EditingSessionAction {
|
|||||||
return this.runWorkingSetAction(accessor, editingSession, chatWidget, ...uris);
|
return this.runWorkingSetAction(accessor, editingSession, chatWidget, ...uris);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
abstract runWorkingSetAction(accessor: ServicesAccessor, editingSession: IChatEditingSession, chatWidget: IChatWidget | undefined, ...uris: URI[]): any;
|
abstract runWorkingSetAction(accessor: ServicesAccessor, editingSession: IChatEditingSession, chatWidget: IChatWidget | undefined, ...uris: URI[]): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ export class ChatEditingService extends Disposable implements IChatEditingServic
|
|||||||
|
|
||||||
// TODO@jrieken
|
// TODO@jrieken
|
||||||
// some ugly casting so that this service can pass itself as argument instad as service dependeny
|
// some ugly casting so that this service can pass itself as argument instad as service dependeny
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
|
||||||
this._register(textModelService.registerTextModelContentProvider(ChatEditingTextModelContentProvider.scheme, _instantiationService.createInstance(ChatEditingTextModelContentProvider as any, this)));
|
this._register(textModelService.registerTextModelContentProvider(ChatEditingTextModelContentProvider.scheme, _instantiationService.createInstance(ChatEditingTextModelContentProvider as any, this)));
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
|
||||||
this._register(textModelService.registerTextModelContentProvider(Schemas.chatEditingSnapshotScheme, _instantiationService.createInstance(ChatEditingSnapshotTextModelContentProvider as any, this)));
|
this._register(textModelService.registerTextModelContentProvider(Schemas.chatEditingSnapshotScheme, _instantiationService.createInstance(ChatEditingSnapshotTextModelContentProvider as any, this)));
|
||||||
|
|
||||||
this._register(this._chatService.onDidDisposeSession((e) => {
|
this._register(this._chatService.onDidDisposeSession((e) => {
|
||||||
@@ -104,9 +104,11 @@ export class ChatEditingService extends Disposable implements IChatEditingServic
|
|||||||
this._register(extensionService.onDidChangeExtensions(setReadonlyFilesEnabled));
|
this._register(extensionService.onDidChangeExtensions(setReadonlyFilesEnabled));
|
||||||
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let storageTask: Promise<any> | undefined;
|
let storageTask: Promise<any> | undefined;
|
||||||
|
|
||||||
this._register(storageService.onWillSaveState(() => {
|
this._register(storageService.onWillSaveState(() => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const tasks: Promise<any>[] = [];
|
const tasks: Promise<any>[] = [];
|
||||||
|
|
||||||
for (const session of this.editingSessionsObs.get()) {
|
for (const session of this.editingSessionsObs.get()) {
|
||||||
|
|||||||
@@ -920,6 +920,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
|
|||||||
*/
|
*/
|
||||||
public async getNewChatSessionItem(chatSessionType: string, options: {
|
public async getNewChatSessionItem(chatSessionType: string, options: {
|
||||||
request: IChatAgentRequest;
|
request: IChatAgentRequest;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
metadata?: any;
|
metadata?: any;
|
||||||
}, token: CancellationToken): Promise<IChatSessionItem> {
|
}, token: CancellationToken): Promise<IChatSessionItem> {
|
||||||
if (!(await this.activateChatSessionItemProvider(chatSessionType))) {
|
if (!(await this.activateChatSessionItemProvider(chatSessionType))) {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export function extractTimestamp(item: IChatSessionItem): number | undefined {
|
|||||||
|
|
||||||
// For other items, timestamp might already be set
|
// For other items, timestamp might already be set
|
||||||
if ('timestamp' in item) {
|
if ('timestamp' in item) {
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
|
||||||
return (item as any).timestamp;
|
return (item as any).timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,9 @@ export function getSessionItemContextOverlay(
|
|||||||
provider?: IChatSessionItemProvider,
|
provider?: IChatSessionItemProvider,
|
||||||
chatService?: IChatService,
|
chatService?: IChatService,
|
||||||
editorGroupsService?: IEditorGroupsService
|
editorGroupsService?: IEditorGroupsService
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
): [string, any][] {
|
): [string, any][] {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const overlay: [string, any][] = [];
|
const overlay: [string, any][] = [];
|
||||||
if (provider) {
|
if (provider) {
|
||||||
overlay.push([ChatContextKeys.sessionType.key, provider.chatSessionType]);
|
overlay.push([ChatContextKeys.sessionType.key, provider.chatSessionType]);
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ export interface IGettingStartedItem {
|
|||||||
label: string;
|
label: string;
|
||||||
commandId: string;
|
commandId: string;
|
||||||
icon?: ThemeIcon;
|
icon?: ThemeIcon;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
args?: any[];
|
args?: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ export class ChatDynamicVariableModel extends Disposable implements IChatWidgetC
|
|||||||
/**
|
/**
|
||||||
* Loose check to filter objects that are obviously missing data
|
* Loose check to filter objects that are obviously missing data
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function isDynamicVariable(obj: any): obj is IDynamicVariable {
|
function isDynamicVariable(obj: any): obj is IDynamicVariable {
|
||||||
return obj &&
|
return obj &&
|
||||||
typeof obj.id === 'string' &&
|
typeof obj.id === 'string' &&
|
||||||
@@ -194,6 +195,7 @@ export interface IAddDynamicVariableContext {
|
|||||||
command?: Command;
|
command?: Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function isAddDynamicVariableContext(context: any): context is IAddDynamicVariableContext {
|
function isAddDynamicVariableContext(context: any): context is IAddDynamicVariableContext {
|
||||||
return 'widget' in context &&
|
return 'widget' in context &&
|
||||||
'range' in context &&
|
'range' in context &&
|
||||||
|
|||||||
@@ -669,6 +669,7 @@ export class Response extends AbstractResponse implements IDisposable {
|
|||||||
const uri = notebookUri ?? progress.uri;
|
const uri = notebookUri ?? progress.uri;
|
||||||
let found = false;
|
let found = false;
|
||||||
const groupKind = progress.kind === 'textEdit' && !notebookUri ? 'textEditGroup' : 'notebookEditGroup';
|
const groupKind = progress.kind === 'textEdit' && !notebookUri ? 'textEditGroup' : 'notebookEditGroup';
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const edits: any = groupKind === 'textEditGroup' ? progress.edits : progress.edits.map(edit => TextEdit.isTextEdit(edit) ? { uri: progress.uri, edit } : edit);
|
const edits: any = groupKind === 'textEditGroup' ? progress.edits : progress.edits.map(edit => TextEdit.isTextEdit(edit) ? { uri: progress.uri, edit } : edit);
|
||||||
const isExternalEdit = progress.isExternalEdit;
|
const isExternalEdit = progress.isExternalEdit;
|
||||||
for (let i = 0; !found && i < this._responseParts.length; i++) {
|
for (let i = 0; !found && i < this._responseParts.length; i++) {
|
||||||
@@ -1392,7 +1393,7 @@ function normalizeOldFields(raw: ISerializableChatDataIn): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, local/code-no-any-casts
|
||||||
if ((raw.initialLocation as any) === 'editing-session') {
|
if ((raw.initialLocation as any) === 'editing-session') {
|
||||||
raw.initialLocation = ChatAgentLocation.Chat;
|
raw.initialLocation = ChatAgentLocation.Chat;
|
||||||
}
|
}
|
||||||
@@ -1811,7 +1812,7 @@ export class ChatModel extends Disposable implements IChatModel {
|
|||||||
modelId: raw.modelId,
|
modelId: raw.modelId,
|
||||||
});
|
});
|
||||||
request.shouldBeRemovedOnSend = raw.isHidden ? { requestId: raw.requestId } : raw.shouldBeRemovedOnSend;
|
request.shouldBeRemovedOnSend = raw.isHidden ? { requestId: raw.requestId } : raw.shouldBeRemovedOnSend;
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, local/code-no-any-casts
|
||||||
if (raw.response || raw.result || (raw as any).responseErrorDetails) {
|
if (raw.response || raw.result || (raw as any).responseErrorDetails) {
|
||||||
const agent = (raw.agent && 'metadata' in raw.agent) ? // Check for the new format, ignore entries in the old format
|
const agent = (raw.agent && 'metadata' in raw.agent) ? // Check for the new format, ignore entries in the old format
|
||||||
reviveSerializedAgent(raw.agent) : undefined;
|
reviveSerializedAgent(raw.agent) : undefined;
|
||||||
@@ -2104,6 +2105,7 @@ export class ChatModel extends Disposable implements IChatModel {
|
|||||||
requests: this._requests.map((r): ISerializableChatRequestData => {
|
requests: this._requests.map((r): ISerializableChatRequestData => {
|
||||||
const message = {
|
const message = {
|
||||||
...r.message,
|
...r.message,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
parts: r.message.parts.map((p: any) => p && 'toJSON' in p ? (p.toJSON as Function)() : p)
|
parts: r.message.parts.map((p: any) => p && 'toJSON' in p ? (p.toJSON as Function)() : p)
|
||||||
};
|
};
|
||||||
const agent = r.response?.agent;
|
const agent = r.response?.agent;
|
||||||
@@ -2123,7 +2125,7 @@ export class ChatModel extends Disposable implements IChatModel {
|
|||||||
} else if (item.kind === 'confirmation') {
|
} else if (item.kind === 'confirmation') {
|
||||||
return { ...item, isLive: false };
|
return { ...item, isLive: false };
|
||||||
} else {
|
} else {
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
|
||||||
return item as any; // TODO
|
return item as any; // TODO
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export enum ChatErrorLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IChatResponseErrorDetailsConfirmationButton {
|
export interface IChatResponseErrorDetailsConfirmationButton {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
data: any;
|
data: any;
|
||||||
label: string;
|
label: string;
|
||||||
isSecondary?: boolean;
|
isSecondary?: boolean;
|
||||||
@@ -273,6 +274,7 @@ export interface IChatNotebookEdit {
|
|||||||
export interface IChatConfirmation {
|
export interface IChatConfirmation {
|
||||||
title: string;
|
title: string;
|
||||||
message: string | IMarkdownString;
|
message: string | IMarkdownString;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
data: any;
|
data: any;
|
||||||
/** Indicates whether this came from a current chat session (true/undefined) or a restored historic session (false) */
|
/** Indicates whether this came from a current chat session (true/undefined) or a restored historic session (false) */
|
||||||
isLive?: boolean;
|
isLive?: boolean;
|
||||||
@@ -319,6 +321,7 @@ export interface IChatThinkingPart {
|
|||||||
kind: 'thinking';
|
kind: 'thinking';
|
||||||
value?: string | string[];
|
value?: string | string[];
|
||||||
id?: string;
|
id?: string;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
metadata?: { readonly [key: string]: any };
|
metadata?: { readonly [key: string]: any };
|
||||||
generatedTitle?: string;
|
generatedTitle?: string;
|
||||||
}
|
}
|
||||||
@@ -369,6 +372,7 @@ export interface ILegacyChatTerminalToolInvocationData {
|
|||||||
|
|
||||||
export interface IChatToolInputInvocationData {
|
export interface IChatToolInputInvocationData {
|
||||||
kind: 'input';
|
kind: 'input';
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
rawInput: any;
|
rawInput: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -853,6 +857,7 @@ export interface IChatDynamicRequest {
|
|||||||
/**
|
/**
|
||||||
* Any extra metadata/context that will go to the provider.
|
* Any extra metadata/context that will go to the provider.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
metadata?: any;
|
metadata?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,7 +925,9 @@ export interface IChatSendRequestOptions {
|
|||||||
parserContext?: IChatParserContext;
|
parserContext?: IChatParserContext;
|
||||||
attempt?: number;
|
attempt?: number;
|
||||||
noCommandDetection?: boolean;
|
noCommandDetection?: boolean;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
acceptedConfirmationData?: any[];
|
acceptedConfirmationData?: any[];
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
rejectedConfirmationData?: any[];
|
rejectedConfirmationData?: any[];
|
||||||
attachedContext?: IChatRequestVariableEntry[];
|
attachedContext?: IChatRequestVariableEntry[];
|
||||||
|
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ export class ChatService extends Disposable implements IChatService {
|
|||||||
// This handles the case where getName() is called before initialization completes
|
// This handles the case where getName() is called before initialization completes
|
||||||
// Access the internal synchronous index method via reflection
|
// Access the internal synchronous index method via reflection
|
||||||
// This is a workaround for the timing issue where initialization hasn't completed
|
// This is a workaround for the timing issue where initialization hasn't completed
|
||||||
// eslint-disable-next-line local/code-no-any-casts
|
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
|
||||||
const internalGetIndex = (this._chatSessionStore as any).internalGetIndex;
|
const internalGetIndex = (this._chatSessionStore as any).internalGetIndex;
|
||||||
if (typeof internalGetIndex === 'function') {
|
if (typeof internalGetIndex === 'function') {
|
||||||
const indexData = internalGetIndex.call(this._chatSessionStore);
|
const indexData = internalGetIndex.call(this._chatSessionStore);
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ export interface IChatSession extends IDisposable {
|
|||||||
requestHandler?: (
|
requestHandler?: (
|
||||||
request: IChatAgentRequest,
|
request: IChatAgentRequest,
|
||||||
progress: (progress: IChatProgress[]) => void,
|
progress: (progress: IChatProgress[]) => void,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
history: any[], // TODO: Nail down types
|
history: any[], // TODO: Nail down types
|
||||||
token: CancellationToken
|
token: CancellationToken
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
@@ -137,6 +138,7 @@ export interface IChatSessionItemProvider {
|
|||||||
provideChatSessionItems(token: CancellationToken): Promise<IChatSessionItem[]>;
|
provideChatSessionItems(token: CancellationToken): Promise<IChatSessionItem[]>;
|
||||||
provideNewChatSessionItem?(options: {
|
provideNewChatSessionItem?(options: {
|
||||||
request: IChatAgentRequest;
|
request: IChatAgentRequest;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
metadata?: any;
|
metadata?: any;
|
||||||
}, token: CancellationToken): Promise<IChatSessionItem>;
|
}, token: CancellationToken): Promise<IChatSessionItem>;
|
||||||
}
|
}
|
||||||
@@ -177,6 +179,7 @@ export interface IChatSessionsService {
|
|||||||
|
|
||||||
getNewChatSessionItem(chatSessionType: string, options: {
|
getNewChatSessionItem(chatSessionType: string, options: {
|
||||||
request: IChatAgentRequest;
|
request: IChatAgentRequest;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
metadata?: any;
|
metadata?: any;
|
||||||
}, token: CancellationToken): Promise<IChatSessionItem>;
|
}, token: CancellationToken): Promise<IChatSessionItem>;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ interface IChatHistoryEntry {
|
|||||||
|
|
||||||
/** The collected input state for chat history entries */
|
/** The collected input state for chat history entries */
|
||||||
interface IChatInputState {
|
interface IChatInputState {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
chatContextAttachments?: ReadonlyArray<IChatRequestVariableEntry>;
|
chatContextAttachments?: ReadonlyArray<IChatRequestVariableEntry>;
|
||||||
|
|
||||||
@@ -83,6 +84,7 @@ export class ChatWidgetHistoryService extends Disposable implements IChatWidgetH
|
|||||||
return history.map(entry => this.migrateHistoryEntry(entry));
|
return history.map(entry => this.migrateHistoryEntry(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
private migrateHistoryEntry(entry: any): IChatModelInputState {
|
private migrateHistoryEntry(entry: any): IChatModelInputState {
|
||||||
// If it's already in the new format (has 'inputText' property), return as-is
|
// If it's already in the new format (has 'inputText' property), return as-is
|
||||||
if (entry.inputText !== undefined) {
|
if (entry.inputText !== undefined) {
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ export namespace ToolDataSource {
|
|||||||
export interface IToolInvocation {
|
export interface IToolInvocation {
|
||||||
callId: string;
|
callId: string;
|
||||||
toolId: string;
|
toolId: string;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
parameters: Record<string, any>;
|
parameters: Record<string, any>;
|
||||||
tokenBudget?: number;
|
tokenBudget?: number;
|
||||||
context: IToolInvocationContext | undefined;
|
context: IToolInvocationContext | undefined;
|
||||||
@@ -146,11 +147,13 @@ export interface IToolInvocationContext {
|
|||||||
readonly sessionResource: URI;
|
readonly sessionResource: URI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export function isToolInvocationContext(obj: any): obj is IToolInvocationContext {
|
export function isToolInvocationContext(obj: any): obj is IToolInvocationContext {
|
||||||
return typeof obj === 'object' && typeof obj.sessionId === 'string' && URI.isUri(obj.sessionResource);
|
return typeof obj === 'object' && typeof obj.sessionId === 'string' && URI.isUri(obj.sessionResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IToolInvocationPreparationContext {
|
export interface IToolInvocationPreparationContext {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
parameters: any;
|
parameters: any;
|
||||||
chatRequestId?: string;
|
chatRequestId?: string;
|
||||||
chatSessionId?: string;
|
chatSessionId?: string;
|
||||||
@@ -187,10 +190,12 @@ export interface IToolResultOutputDetails {
|
|||||||
readonly output: { type: 'data'; mimeType: string; value: VSBuffer };
|
readonly output: { type: 'data'; mimeType: string; value: VSBuffer };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export function isToolResultInputOutputDetails(obj: any): obj is IToolResultInputOutputDetails {
|
export function isToolResultInputOutputDetails(obj: any): obj is IToolResultInputOutputDetails {
|
||||||
return typeof obj === 'object' && typeof obj?.input === 'string' && (typeof obj?.output === 'string' || Array.isArray(obj?.output));
|
return typeof obj === 'object' && typeof obj?.input === 'string' && (typeof obj?.output === 'string' || Array.isArray(obj?.output));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export function isToolResultOutputDetails(obj: any): obj is IToolResultOutputDetails {
|
export function isToolResultOutputDetails(obj: any): obj is IToolResultOutputDetails {
|
||||||
return typeof obj === 'object' && typeof obj?.output === 'object' && typeof obj?.output?.mimeType === 'string' && obj?.output?.type === 'data';
|
return typeof obj === 'object' && typeof obj?.output === 'object' && typeof obj?.output?.mimeType === 'string' && obj?.output?.type === 'data';
|
||||||
}
|
}
|
||||||
@@ -262,6 +267,7 @@ export interface IToolConfirmationAction {
|
|||||||
label: string;
|
label: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
data: any;
|
data: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export interface IChatMessageThinkingPart {
|
|||||||
type: 'thinking';
|
type: 'thinking';
|
||||||
value: string | string[];
|
value: string | string[];
|
||||||
id?: string;
|
id?: string;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
metadata?: { readonly [key: string]: any };
|
metadata?: { readonly [key: string]: any };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +132,7 @@ export interface IChatResponseToolUsePart {
|
|||||||
type: 'tool_use';
|
type: 'tool_use';
|
||||||
name: string;
|
name: string;
|
||||||
toolCallId: string;
|
toolCallId: string;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
parameters: any;
|
parameters: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,6 +140,7 @@ export interface IChatResponseThinkingPart {
|
|||||||
type: 'thinking';
|
type: 'thinking';
|
||||||
value: string | string[];
|
value: string | string[];
|
||||||
id?: string;
|
id?: string;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
metadata?: { readonly [key: string]: any };
|
metadata?: { readonly [key: string]: any };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,18 +206,21 @@ export namespace ILanguageModelChatMetadata {
|
|||||||
|
|
||||||
export interface ILanguageModelChatResponse {
|
export interface ILanguageModelChatResponse {
|
||||||
stream: AsyncIterable<IChatResponsePart | IChatResponsePart[]>;
|
stream: AsyncIterable<IChatResponsePart | IChatResponsePart[]>;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
result: Promise<any>;
|
result: Promise<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILanguageModelChatProvider {
|
export interface ILanguageModelChatProvider {
|
||||||
readonly onDidChange: Event<void>;
|
readonly onDidChange: Event<void>;
|
||||||
provideLanguageModelChatInfo(options: { silent: boolean }, token: CancellationToken): Promise<ILanguageModelChatMetadataAndIdentifier[]>;
|
provideLanguageModelChatInfo(options: { silent: boolean }, token: CancellationToken): Promise<ILanguageModelChatMetadataAndIdentifier[]>;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
sendChatRequest(modelId: string, messages: IChatMessage[], from: ExtensionIdentifier, options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
|
sendChatRequest(modelId: string, messages: IChatMessage[], from: ExtensionIdentifier, options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
|
||||||
provideTokenCount(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise<number>;
|
provideTokenCount(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise<number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILanguageModelChat {
|
export interface ILanguageModelChat {
|
||||||
metadata: ILanguageModelChatMetadata;
|
metadata: ILanguageModelChatMetadata;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
sendChatRequest(messages: IChatMessage[], from: ExtensionIdentifier, options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
|
sendChatRequest(messages: IChatMessage[], from: ExtensionIdentifier, options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
|
||||||
provideTokenCount(message: string | IChatMessage, token: CancellationToken): Promise<number>;
|
provideTokenCount(message: string | IChatMessage, token: CancellationToken): Promise<number>;
|
||||||
}
|
}
|
||||||
@@ -277,6 +283,7 @@ export interface ILanguageModelsService {
|
|||||||
|
|
||||||
registerLanguageModelProvider(vendor: string, provider: ILanguageModelChatProvider): IDisposable;
|
registerLanguageModelProvider(vendor: string, provider: ILanguageModelChatProvider): IDisposable;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
sendChatRequest(modelId: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
|
sendChatRequest(modelId: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
|
||||||
|
|
||||||
computeTokenLength(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise<number>;
|
computeTokenLength(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise<number>;
|
||||||
@@ -547,6 +554,7 @@ export class LanguageModelsService implements ILanguageModelsService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
async sendChatRequest(modelId: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse> {
|
async sendChatRequest(modelId: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse> {
|
||||||
const provider = this._providers.get(this._modelCache.get(modelId)?.vendor || '');
|
const provider = this._providers.get(this._modelCache.get(modelId)?.vendor || '');
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
|
|||||||
@@ -387,6 +387,7 @@ export class PromptsService extends Disposable implements IPromptsService {
|
|||||||
const uri = promptPath.uri;
|
const uri = promptPath.uri;
|
||||||
const ast = await this.parseNew(uri, token);
|
const ast = await this.parseNew(uri, token);
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let metadata: any | undefined;
|
let metadata: any | undefined;
|
||||||
if (ast.header) {
|
if (ast.header) {
|
||||||
const advanced = ast.header.getAttribute(PromptHeaderAttributes.advancedOptions);
|
const advanced = ast.header.getAttribute(PromptHeaderAttributes.advancedOptions);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export const TodoListToolDescriptionFieldSettingId = 'chat.todoListTool.descript
|
|||||||
export const ManageTodoListToolToolId = 'manage_todo_list';
|
export const ManageTodoListToolToolId = 'manage_todo_list';
|
||||||
|
|
||||||
export function createManageTodoListToolData(writeOnly: boolean, includeDescription: boolean = true): IToolData {
|
export function createManageTodoListToolData(writeOnly: boolean, includeDescription: boolean = true): IToolData {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const baseProperties: any = {
|
const baseProperties: any = {
|
||||||
todoList: {
|
todoList: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
@@ -120,6 +121,7 @@ export class ManageTodoListTool extends Disposable implements IToolImpl {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
async invoke(invocation: IToolInvocation, _countTokens: any, _progress: any, _token: CancellationToken): Promise<IToolResult> {
|
async invoke(invocation: IToolInvocation, _countTokens: any, _progress: any, _token: CancellationToken): Promise<IToolResult> {
|
||||||
const args = invocation.parameters as IManageTodoListToolInputParams;
|
const args = invocation.parameters as IManageTodoListToolInputParams;
|
||||||
// For: #263001 Use default sessionId
|
// For: #263001 Use default sessionId
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export class NullLanguageModelsService implements ILanguageModelsService {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
sendChatRequest(identifier: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse> {
|
sendChatRequest(identifier: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse> {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export class MockLanguageModelToolsService implements ILanguageModelToolsService
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
setToolAutoConfirmation(toolId: string, scope: any): void {
|
setToolAutoConfirmation(toolId: string, scope: any): void {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,16 +33,23 @@ export class MockPromptsService implements IPromptsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stub implementations for required interface methods
|
// Stub implementations for required interface methods
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
getSyntaxParserFor(_model: any): any { throw new Error('Not implemented'); }
|
getSyntaxParserFor(_model: any): any { throw new Error('Not implemented'); }
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
listPromptFiles(_type: any): Promise<readonly any[]> { throw new Error('Not implemented'); }
|
listPromptFiles(_type: any): Promise<readonly any[]> { throw new Error('Not implemented'); }
|
||||||
listPromptFilesForStorage(type: PromptsType, storage: PromptsStorage, token: CancellationToken): Promise<readonly IPromptPath[]> { throw new Error('Not implemented'); }
|
listPromptFilesForStorage(type: PromptsType, storage: PromptsStorage, token: CancellationToken): Promise<readonly IPromptPath[]> { throw new Error('Not implemented'); }
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
getSourceFolders(_type: any): readonly any[] { throw new Error('Not implemented'); }
|
getSourceFolders(_type: any): readonly any[] { throw new Error('Not implemented'); }
|
||||||
isValidSlashCommandName(_command: string): boolean { return false; }
|
isValidSlashCommandName(_command: string): boolean { return false; }
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
resolvePromptSlashCommand(command: string, _token: CancellationToken): Promise<any> { throw new Error('Not implemented'); }
|
resolvePromptSlashCommand(command: string, _token: CancellationToken): Promise<any> { throw new Error('Not implemented'); }
|
||||||
get onDidChangeSlashCommands(): Event<void> { throw new Error('Not implemented'); }
|
get onDidChangeSlashCommands(): Event<void> { throw new Error('Not implemented'); }
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
getPromptSlashCommands(_token: CancellationToken): Promise<any[]> { throw new Error('Not implemented'); }
|
getPromptSlashCommands(_token: CancellationToken): Promise<any[]> { throw new Error('Not implemented'); }
|
||||||
getPromptSlashCommandName(uri: URI, _token: CancellationToken): Promise<string> { throw new Error('Not implemented'); }
|
getPromptSlashCommandName(uri: URI, _token: CancellationToken): Promise<string> { throw new Error('Not implemented'); }
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
parse(_uri: URI, _type: any, _token: CancellationToken): Promise<any> { throw new Error('Not implemented'); }
|
parse(_uri: URI, _type: any, _token: CancellationToken): Promise<any> { throw new Error('Not implemented'); }
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
parseNew(_uri: URI, _token: CancellationToken): Promise<any> { throw new Error('Not implemented'); }
|
parseNew(_uri: URI, _token: CancellationToken): Promise<any> { throw new Error('Not implemented'); }
|
||||||
getParsedPromptFile(textModel: ITextModel): ParsedPromptFile { throw new Error('Not implemented'); }
|
getParsedPromptFile(textModel: ITextModel): ParsedPromptFile { throw new Error('Not implemented'); }
|
||||||
registerContributedFile(type: PromptsType, name: string, description: string, uri: URI, extension: IExtensionDescription): IDisposable { throw new Error('Not implemented'); }
|
registerContributedFile(type: PromptsType, name: string, description: string, uri: URI, extension: IExtensionDescription): IDisposable { throw new Error('Not implemented'); }
|
||||||
|
|||||||
Reference in New Issue
Block a user