@codingame/monaco-vscode-extensions-service-override
Version:
VSCode public API plugged on the monaco editor - extensions service-override
119 lines (118 loc) • 8.64 kB
TypeScript
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
import { URI, UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
import { IAgentSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service";
import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
import { IChatDebugService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service";
import { IChatContentInlineReference, IChatProgress } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService";
import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
import { IChatSession, IChatSessionHistoryItem, IChatSessionItem, IChatSessionProviderOptionGroup, IChatSessionProviderOptionItem, IChatSessionRequestHistoryItem, ReadonlyChatSessionOptionsMap } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService";
import { IChatSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service";
import { IChatAgentRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents";
import { IChatArtifactsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/chatArtifactsService.service";
import { IChatTodoListService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/chatTodoListService.service";
import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js";
import { Dto } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/proxyIdentifier";
import { ChatSessionContentContextDto, ExtHostChatSessionsShape, IChatProgressDto, IChatSessionItemsChange, MainThreadChatSessionsShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
export declare class ObservableChatSession extends Disposable implements IChatSession {
readonly sessionResource: URI;
readonly providerHandle: number;
readonly history: Array<IChatSessionHistoryItem>;
title?: string;
private _options?;
get options(): ReadonlyChatSessionOptionsMap | undefined;
private readonly _progressObservable;
private readonly _isCompleteObservable;
private readonly _onWillDispose;
readonly onWillDispose: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
private readonly _pendingProgressChunks;
private _isInitialized;
private _interruptionWasCanceled;
private _disposalPending;
private _initializationPromise?;
interruptActiveResponseCallback?: () => Promise<boolean>;
requestHandler?: (request: IChatAgentRequest, progress: (progress: IChatProgress[]) => void, history: any[], token: CancellationToken) => Promise<void>;
forkSession?: (request: IChatSessionRequestHistoryItem | undefined, token: CancellationToken) => Promise<IChatSessionItem>;
private readonly _proxy;
private readonly _providerHandle;
private readonly _logService;
private readonly _dialogService;
get progressObs(): IObservable<IChatProgress[]>;
get isCompleteObs(): IObservable<boolean>;
constructor(resource: URI, providerHandle: number, proxy: ExtHostChatSessionsShape, logService: ILogService, dialogService: IDialogService);
initialize(token: CancellationToken, context: ChatSessionContentContextDto): Promise<void>;
private _doInitializeContent;
/**
* Handle progress chunks coming from the extension host.
* If the session is not initialized yet, the chunks will be queued.
*/
handleProgressChunk(requestId: string, progress: IChatProgress[]): void;
/**
* Handle progress completion from the extension host.
*/
handleProgressComplete(requestId: string): void;
private _addProgress;
private _markComplete;
private toRequestDto;
dispose(): void;
}
export declare class MainThreadChatSessions extends Disposable implements MainThreadChatSessionsShape {
private readonly _extHostContext;
private readonly _agentSessionsService;
private readonly _chatSessionsService;
private readonly _chatService;
private readonly _chatWidgetService;
private readonly _chatTodoListService;
private readonly _chatArtifactsService;
private readonly _chatDebugService;
private readonly _dialogService;
private readonly _editorService;
private readonly editorGroupService;
private readonly _logService;
private readonly _instantiationService;
private readonly _itemControllerRegistrations;
private readonly _contentProvidersRegistrations;
private readonly _sessionTypeToHandle;
private readonly _activeSessions;
private readonly _sessionDisposables;
private readonly _proxy;
constructor(_extHostContext: IExtHostContext, _agentSessionsService: IAgentSessionsService, _chatSessionsService: IChatSessionsService, _chatService: IChatService, _chatWidgetService: IChatWidgetService, _chatTodoListService: IChatTodoListService, _chatArtifactsService: IChatArtifactsService, _chatDebugService: IChatDebugService, _dialogService: IDialogService, _editorService: IEditorService, editorGroupService: IEditorGroupsService, _logService: ILogService, _instantiationService: IInstantiationService);
private _getHandleForSessionType;
$registerChatSessionItemController(handle: number, chatSessionType: string, supportsResolve: boolean): void;
$updateChatSessionItemControllerCapabilities(handle: number, supportsResolve: boolean): void;
private _refreshControllerInputState;
private _applyOptionGroups;
private getController;
$updateChatSessionItems(controllerHandle: number, change: IChatSessionItemsChange): Promise<void>;
$addOrUpdateChatSessionItem(controllerHandle: number, item: Dto<IChatSessionItem>): Promise<void>;
$onDidChangeChatSessionOptions(handle: number, sessionResourceComponents: UriComponents, updates: Record<string, string | IChatSessionProviderOptionItem>): void;
$onDidCommitChatSessionItem(handle: number, originalComponents: UriComponents, modifiedCompoennts: UriComponents): Promise<void>;
/**
* Re-sends pending and in-flight requests from the original session on the committed session.
*/
private _resendPendingRequests;
private _provideChatSessionContent;
$unregisterChatSessionItemController(handle: number): void;
$registerChatSessionContentProvider(handle: number, chatSessionScheme: string): void;
$unregisterChatSessionContentProvider(handle: number): void;
$handleProgressChunk(handle: number, sessionResource: UriComponents, requestId: string, chunks: (IChatProgressDto | [
IChatProgressDto,
number
])[]): Promise<void>;
$handleProgressComplete(handle: number, sessionResource: UriComponents, requestId: string): void;
$handleAnchorResolve(handle: number, sesssionResource: UriComponents, requestId: string, requestHandle: string, anchor: Dto<IChatContentInlineReference>): void;
$onDidChangeChatSessionProviderOptions(handle: number): void;
$updateChatSessionInputState(controllerHandle: number, sessionResource: UriComponents, optionGroups: readonly IChatSessionProviderOptionGroup[]): void;
private _refreshProviderOptions;
dispose(): void;
/**
* Notify the extension about option changes for a session
*/
notifyOptionsChange(handle: number, sessionResource: URI, updates: ReadonlyMap<string, string | IChatSessionProviderOptionItem | undefined>): Promise<void>;
}