import { Event } from "../../../base/common/event.js"; import { Disposable, IReference } from "../../../base/common/lifecycle.js"; import { IObservable } from "../../../base/common/observable.js"; import { ILogService } from "../../log/common/log.service.js"; import { ArtifactActor, ArtifactAuthenticationRequest, ArtifactDetails, ArtifactJsonValue, ArtifactRun, ArtifactSnapshot, IArtifactIntegrationAccess, IArtifactModel } from "./artifactIntegration.js"; import { ArtifactAutomationNotice } from "./artifactRuntime.js"; export type ArtifactIntegrationRequest = { readonly kind: "acquire"; readonly subscription: string; readonly session: string; readonly artifactId: string; } | { readonly kind: "release"; readonly subscription: string; } | { readonly kind: "authenticate"; readonly subscription: string; readonly integrationId: string; } | { readonly kind: "configure"; readonly subscription: string; readonly integrationId: string; readonly revision: number; readonly values: Readonly>; readonly actor?: ArtifactActor; } | { readonly kind: "notice"; readonly subscription: string; readonly notice: Pick; } | { readonly kind: "invoke"; readonly subscription: string; readonly integrationId: string; readonly actionId: string; readonly chat: string; readonly requestId: string; readonly actor?: ArtifactActor; readonly input?: ArtifactJsonValue; } | { readonly kind: "cancel" | "reconcile"; readonly subscription: string; readonly runId: string; } | { readonly kind: "history"; readonly subscription: string; readonly before?: string; readonly limit?: number; } | { readonly kind: "details"; readonly subscription: string; readonly parent: string; readonly integrationId: string; readonly detailsId: string; } | { readonly kind: "loadMore"; readonly subscription: string; } | { readonly kind: "runItemAction"; readonly subscription: string; readonly itemId: string; readonly actionId: string; }; export type ArtifactIntegrationUpdate = { readonly subscription: string; readonly revision: number; } & ({ readonly kind: "artifact"; readonly snapshot: ArtifactSnapshot; } | { readonly kind: "details"; readonly details: ArtifactDetails; readonly canLoadMore: boolean; }); export type ArtifactIntegrationResponse = ArtifactIntegrationUpdate | { readonly kind: "ok"; } | { readonly kind: "run"; readonly run: ArtifactRun; } | { readonly kind: "authentication"; readonly request: ArtifactAuthenticationRequest; } | { readonly kind: "history"; readonly runs: readonly ArtifactRun[]; readonly next?: string; }; export type ArtifactAuthenticationHandler = (request: ArtifactAuthenticationRequest, isCurrent: () => boolean) => Promise; export interface IArtifactIntegrationTransport { readonly onDidUpdate: Event; readonly onDidReset?: Event; readonly available?: IObservable; readonly authenticate?: ArtifactAuthenticationHandler; request(request: ArtifactIntegrationRequest): Promise; } export declare function isArtifactIntegrationRequest(value: unknown): value is ArtifactIntegrationRequest; export declare function isArtifactIntegrationUpdate(value: unknown): value is ArtifactIntegrationUpdate; export declare function isArtifactIntegrationResponse(value: unknown): value is ArtifactIntegrationResponse; /** One endpoint per connection; disposal releases that connection's subscriptions, not its automations. */ export declare class ArtifactIntegrationServer extends Disposable implements IArtifactIntegrationTransport { private readonly access; private readonly postNotice?; private readonly subscriptions; private readonly artifacts; private readonly details; private readonly updates; readonly onDidUpdate: Event; constructor(access: IArtifactIntegrationAccess, postNotice?: ((notice: ArtifactAutomationNotice) => Promise) | undefined); request(request: ArtifactIntegrationRequest): Promise; private requireArtifact; } export declare class ArtifactIntegrationClient extends Disposable implements IArtifactIntegrationAccess { private readonly transport; private readonly logService; private readonly leases; private readonly restorers; private readonly referenceCounts; private readonly restoring; private readonly disposed; private epoch; constructor(transport: IArtifactIntegrationTransport, logService: ILogService); acquireArtifact(session: string, artifactId: string): Promise>; private acquireDetails; private createLease; private releaseLease; private request; private requestAcknowledgement; dispose(): void; }