import { CancellationToken } from "../../../base/common/cancellation.js"; import { Event } from "../../../base/common/event.js"; import { Disposable, IReference } from "../../../base/common/lifecycle.js"; import { IObservable } from "../../../base/common/observable.js"; import { ArtifactPromptReceipt } from "../../artifactIntegrations/common/artifactIntegration.js"; import { ArtifactPromptRecovery, ArtifactPromptRequest, ArtifactPromptSubmission, IArtifactChatAccess, IArtifactChatObservation } from "../../artifactIntegrations/common/artifactRuntime.js"; import { ActionEnvelope, ActionType, ChatAction } from "./state/sessionActions.js"; import { ChatState } from "./state/sessionState.js"; export type ArtifactChatAction = Extract; export type ArtifactChatEvent = Pick; export interface IArtifactChatBackend { readonly admission: "atomic" | "bestEffort"; readonly available: IObservable; readonly onDidAction: Event; /** Keeps the advertised ownership validated for the lifetime of the observation. */ acquireChat(session: string, chat: string): Promise>>; /** Sends once, awaits confirmation, and never replays the action after an ambiguous disconnect. */ dispatch(chat: string, action: ArtifactChatAction): Promise; } export declare class ArtifactProtocolChatAccess extends Disposable implements IArtifactChatAccess { private readonly backend; readonly admission: "atomic" | "bestEffort"; private readonly turns; private readonly cancelled; private readonly requests; private readonly queued; private readonly handles; private readonly recoveries; constructor(backend: IArtifactChatBackend); observeChat(session: string, chat: string): IArtifactChatObservation; submit(request: ArtifactPromptRequest, token: CancellationToken, isCurrent?: () => boolean): Promise; recover(request: ArtifactPromptRequest, receipt: ArtifactPromptReceipt | undefined, token: CancellationToken): Promise; private createHandle; private cancelSubmission; private findReceipt; private retainRequest; private observe; private readChat; }