import { CancellationToken } from "../../../../base/common/cancellation.js"; import { IDisposable } from "../../../../base/common/lifecycle.js"; import { Event, URI } from "../../../../sessions/sessions.web.main.internal.js"; import { IChatDebugEvent, ChatDebugLogLevel, IChatDebugLogProvider, IChatDebugResolvedEventContent } from "@codingame/monaco-vscode-chat-service-override/vscode/vs/workbench/contrib/chat/common/chatDebugService"; export declare const IChatDebugService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; /** * Service for collecting and exposing chat debug events. * Internal components can log events, * and the debug editor pane can display them. */ export interface IChatDebugService extends IDisposable { readonly _serviceBrand: undefined; /** * Fired when a new event is added. */ readonly onDidAddEvent: Event; /** * Fired when provider events are cleared for a session (before re-invoking providers). */ readonly onDidClearProviderEvents: Event; /** * Fired when a debug session ends (see {@link endSession}), so providers * can release any per-session resources (e.g. live file watchers). */ readonly onDidEndSession: Event; /** * Log a generic event to the debug service. */ log(sessionResource: URI, name: string, details?: string, level?: ChatDebugLogLevel, options?: { id?: string; category?: string; parentEventId?: string; }): void; /** * Add a typed event to the debug service. */ addEvent(event: IChatDebugEvent): void; /** * Add an event sourced from an external provider. * These events are cleared before re-invoking providers to avoid duplicates. */ addProviderEvent(event: IChatDebugEvent): void; /** * Get all events for a specific session. */ getEvents(sessionResource?: URI): readonly IChatDebugEvent[]; /** * Get all session resources that have logged events. */ getSessionResources(): readonly URI[]; /** * The currently active session resource for debugging. */ activeSessionResource: URI | undefined; /** * Clear all logged events. */ clear(): void; /** * Register an external provider that can supply additional debug events. * This is used by the extension API (ChatDebugLogProvider). */ registerProvider(provider: IChatDebugLogProvider): IDisposable; /** * Check whether providers have already been invoked for a given session. */ hasInvokedProviders(sessionResource: URI): boolean; /** * Invoke all registered providers for a given session resource. * Called when the Debug View is opened to fetch events from extensions. */ invokeProviders(sessionResource: URI): Promise; /** * End a debug session: cancels any in-flight provider invocation, * disposes the associated CancellationTokenSource, and removes it. * Called when the chat session is disposed/archived. */ endSession(sessionResource: URI): void; /** * Resolve the full details of an event by its id. * Delegates to the registered provider's resolveChatDebugLogEvent. */ resolveEvent(eventId: string): Promise; /** /** * Export the debug log for a session via the registered provider. */ exportLog(sessionResource: URI): Promise; /** * Import a previously exported debug log via the registered provider. * Returns the session URI for the imported data. */ importLog(data: Uint8Array): Promise; /** * Returns true if the event was logged by VS Code core * (not sourced from an external provider). */ isCoreEvent(event: IChatDebugEvent): boolean; /** * Store a human-readable title for an imported session. */ setImportedSessionTitle(sessionResource: URI, title: string): void; /** * Get the stored title for an imported session, if available. */ getImportedSessionTitle(sessionResource: URI): string | undefined; /** * Fired when available session resources change (e.g. historical sessions discovered from disk). */ readonly onDidChangeAvailableSessionResources: Event; /** * Store session resources that have debug log data available on disk. * Called by the main thread after the extension reports historical sessions. */ addAvailableSessionResources(resources: readonly { uri: URI; title?: string; }[]): void; /** * Get all session resources that have debug log data available, * including historical sessions persisted on disk by the provider. * Triggers a lazy fetch from the registered fetcher on first call. */ getAvailableSessionResources(): readonly URI[]; /** * Register a callback that fetches available session resources from a provider. * Called lazily when `getAvailableSessionResources()` is first invoked. Multiple * fetchers may be registered (e.g. the extension host and local agent-host * discovery); each is invoked at most once. Dispose to unregister. */ registerAvailableSessionsFetcher(fetcher: (token: CancellationToken) => Promise<{ uri: URI; title?: string; }[]>): IDisposable; /** * Get the stored title for a historical session discovered from disk. */ getHistoricalSessionTitle(sessionResource: URI): string | undefined; }