import { IDisposable } from "../../../../../base/common/lifecycle.js"; import { URI } from "../../../../../base/common/uri.js"; import { Action2 } from "../../../../../platform/actions/common/actions.js"; import { IInstantiationService, ServicesAccessor } from "../../../../../platform/instantiation/common/instantiation.js"; import { IChatService } from "../../common/chatService/chatService.service.js"; import { IChatSessionForkOptions, IChatSessionRequestHistoryItem } from "../../common/chatSessionsService.js"; import { IChatWidget } from "../chat.js"; export declare const ForkConversationActionId = "workbench.action.chat.forkConversation"; export interface IForkConversationOptions extends IChatSessionForkOptions { readonly toSide?: boolean; } /** * Parses the argument after `/fork` for the `prompt` keyword that agent-host * chats reserve: `/fork prompt ` forks and sends ``. * * @returns `undefined` without the keyword; otherwise the prompt and its offset * within the argument. The prompt is empty for a bare `/fork prompt`. */ export declare function parseForkPromptArgument(argument: string): { readonly text: string; readonly offset: number; } | undefined; /** * Owns the source chat's draft of a submitted `/fork prompt ` until the * fork's outcome is known. Disposing releases the source chat without clearing * the draft, so a fork that was not created leaves the prompt to retry. */ export interface IForkPromptSourceInput extends IDisposable { /** Clears the source draft if it is unchanged since submission, then releases the source chat. */ readonly clear: () => void; } /** * Captures the draft of a widget submitting `/fork prompt ` in an * agent-host chat, or returns `undefined` for any other submission. * * The fork opens before the `/fork` command settles, which releases the source * chat. Releasing it persists its draft, including to the agent host's chat * draft, so the source chat is kept alive until its draft is cleared or retained. */ export declare function captureForkPromptSourceInput(widget: IChatWidget, chatService: IChatService): IForkPromptSourceInput | undefined; export declare class ForkConversationAction extends Action2 { constructor(); run(accessor: ServicesAccessor, ...args: unknown[]): Promise; protected _openForkedSession(instantiationService: IInstantiationService, parentSessionResource: URI, forkedSessionResource: URI, _options?: IForkConversationOptions): Promise; /** * Hook for surfaces (the Agents window) that prefer to fork a multi-chat * session into a new peer chat in the same session rather than a brand-new * session. Returns `true` when it fully handled the fork; the default * implementation does nothing and returns `false`, so the standard * session-creating fork path runs. */ protected _tryForkAsChat(_instantiationService: IInstantiationService, _sourceSessionResource: URI, _request: IChatSessionRequestHistoryItem | undefined, _options?: IForkConversationOptions): Promise; private readonly pendingForks; private forkContributedChatSession; private _handleForkPromptError; }