import { Disposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import { ArtifactSnapshot } from "../../../../platform/artifactIntegrations/common/artifactIntegration.js"; import { IInstantiationService } from "../../../../platform/instantiation/common/instantiation.js"; import { IChatPillEntry } from "../../../../workbench/browser/chatPills.js"; import { IChatInputPillSource } from "../../../../workbench/contrib/chat/browser/chatInputPills.js"; import { SessionChatPillKind } from "../../../../workbench/contrib/chat/common/sessionChatPills.js"; import { ArtifactIntegrationPresentation, IArtifactDetailsHost } from "./artifactIntegrationPresentation.js"; /** An integrated artifact or reference, with what the pill row needs to place it. */ export interface IArtifactIntegrationPillItem { /** The entry the artifact's pill shows, supplying its title, open target and entry actions. */ readonly entry: IChatPillEntry; readonly presentation: ArtifactIntegrationPresentation; readonly kind: SessionChatPillKind; /** Whether the record is an artifact rather than a reference. */ readonly isArtifact: boolean; /** Whether the pill kind's own filter, such as showing only open pull requests, keeps the artifact. */ readonly visible: boolean; } /** * The group ID the main integration assigns an integrated record, which gives the record a pill of its own instead of * listing it in the pill for its kind. Records without a main integration have none. */ export declare function getArtifactIntegrationGroupId(snapshot: ArtifactSnapshot): string | undefined; /** * The group an integrated record can join: artifacts of the same pill kind whose main integration assigns them the same * group ID share one, even across integrations. References never join a group, nor do records without a group ID. */ export declare function getArtifactIntegrationGroupKey(kind: SessionChatPillKind, isArtifact: boolean, groupId: string | undefined): string | undefined; /** * Identifies the resource an integrated record presents: records the main integration bound to the same canonical * resource, such as several links to one experiment step, are aliases of each other. Records not yet bound have none. */ export declare function getArtifactIntegrationAliasKey(snapshot: ArtifactSnapshot): string | undefined; /** An integrated record that may be an alias of another record of the same resource. */ export interface IArtifactIntegrationAliasCandidate { readonly isArtifact: boolean; /** Identifies the resource the record presents; records without a key are never aliases. */ readonly aliasKey?: string; /** * Whether the record has state only its own pill reaches, such as enabled Autopilot rules or activity. Bindings, * consent and runs stay per record, so such a record is never hidden behind another. */ readonly hasOwnState?: boolean; } /** Describes an integrated record's snapshot for {@link collapseArtifactIntegrationAliases}. */ export declare function getArtifactIntegrationAliasCandidate(snapshot: ArtifactSnapshot): Pick; /** * Keeps one record per resource, so aliases recorded several times, such as scorecards of one experiment step, show * one pill. The first artifact among the aliases represents them, else the first reference, in its recorded position; * `merge` folds the aliases it hides, such as their pins, into it. Aliases with state of their own stay visible. */ export declare function collapseArtifactIntegrationAliases(items: readonly T[], merge?: (representative: T, hidden: readonly T[]) => T): readonly T[]; /** An artifact that can be listed in a group of artifacts sharing its group ID. */ export interface IArtifactIntegrationPillCandidate { /** Identifies the group the artifact can join; artifacts without a key never join a group. */ readonly groupKey?: string; } export type ArtifactIntegrationPillLayout = { readonly kind: "single"; readonly item: T; readonly pinned: boolean; } | { readonly kind: "group"; readonly key: string; readonly items: readonly T[]; }; /** * Arranges integrated artifacts into pills: two or more unpinned artifacts sharing a group key collapse into one * group, shown where the first of them would be. Pinned artifacts and artifacts without company keep pills of * their own, in their recorded order. */ export declare function layoutArtifactIntegrationPills(items: readonly T[], isPinned: (item: T) => boolean): readonly ArtifactIntegrationPillLayout[]; /** * Places integrated artifacts that have a group ID in the chat input pill row: artifacts sharing a group ID collapse * into a group pill with a dropdown, while artifacts the user pinned out of their group, and those without company, * keep pills of their own. Pinning uses the same storage as other pill dropdowns. */ export declare class ArtifactIntegrationPillSources extends Disposable { readonly sources: IObservable; constructor(items: IObservable, pinScope: IObservable, detailsHost: IArtifactDetailsHost, instantiationService: IInstantiationService); }