import { EventLike } from "../../../../../../base/browser/dom.js"; import { BaseActionViewItem, IActionViewItemOptions } from "../../../../../../base/browser/ui/actionbar/actionViewItems.js"; import { IAction } from "../../../../../../base/common/actions.js"; import { IDisposable } from "../../../../../../base/common/lifecycle.js"; import { ThemeIcon } from "../../../../../../base/common/themables.js"; import { URI } from "../../../../../../base/common/uri.js"; import { IAgentRuntimeModelConfiguration } from "../../../../../../platform/agentHost/common/meta/agentModelConfigurationMeta.js"; import { IConfigurationService } from "../../../../../../platform/configuration/common/configuration.service.js"; import { IHoverService } from "../../../../../../platform/hover/browser/hover.service.js"; import { IInstantiationService } from "../../../../../../platform/instantiation/common/instantiation.js"; import { IMarkdownRendererService } from "../../../../../../platform/markdown/browser/markdownRenderer.service.js"; import { INotificationService } from "../../../../../../platform/notification/common/notification.service.js"; import { ILanguageModelsService } from "../../../common/languageModels.service.js"; import { IChatWidgetService } from "../../chat.service.js"; import { IChatMarkdownAnchorService } from "./chatMarkdownAnchorService.service.js"; export interface IOpenSubagentChatContext { readonly chatResource: string; readonly isChatAvailable?: boolean; readonly parentSessionResource?: string; readonly title?: string; readonly agentType?: string; /** Open the subagent chat to the side (in a new group) rather than in place. */ readonly toSide?: boolean; readonly confirmationCount?: number; readonly confirmationActive?: boolean; readonly startedAt?: number; readonly duration?: number; readonly modelId?: string; readonly modelName?: string; readonly modelConfiguration?: Record; readonly runtimeModelConfiguration?: IAgentRuntimeModelConfiguration; /** Copilot credits (AIC) this subagent has consumed so far. */ readonly credits?: number; readonly parentModelId?: string; readonly parentModelName?: string; readonly parentResolvedModelId?: string; readonly isActive?: boolean; readonly activeToolCallId?: string; readonly activeToolLabel?: string; readonly activeToolIcon?: ThemeIcon; readonly activeToolSubagent?: ISubagentActivity; } export interface ISubagentActivity { readonly title: string; readonly chatResource?: string; readonly isChatAvailable?: boolean; } export type SubagentPillContext = Omit; export interface IInlineSubagentDetailsContext extends SubagentPillContext { readonly presentation: "inline"; readonly expanded: boolean; readonly contentId: string; readonly toggleDetails: () => void; } export type SubagentChatStatus = "running" | "waiting" | "completed" | "failed" | "cancelled"; export interface ISubagentChatOpener { open(context: IOpenSubagentChatContext): Promise; } declare class SubagentChatOpenerRegistry { private readonly openers; register(opener: ISubagentChatOpener): IDisposable; open(context: IOpenSubagentChatContext): Promise; } export declare const subagentChatOpenerRegistry: SubagentChatOpenerRegistry; export declare function getSubagentEditorResource(context: IOpenSubagentChatContext): URI | undefined; /** Compares known model identities, falling back to labels for legacy invocations. A concrete model always shows under an Auto parent. */ export declare function shouldShowSubagentModel(subagentModelName: string | undefined, parentModelId: string | undefined, parentModelName: string | undefined, parentModelMetadataId: string | undefined, subagentModelId?: string): boolean; export declare function formatCompactSubagentDuration(startedAt: number, duration: number | undefined, now?: number): string; export declare function shouldAnimateSubagentToolTransition(displayedToolCallId: string | undefined, displayedIsTool: boolean, targetToolCallId: string | undefined, targetIsTool: boolean): boolean; export declare class OpenSubagentChatActionViewItem extends BaseActionViewItem { private readonly markdownRendererService; private readonly instantiationService; private readonly chatMarkdownAnchorService; protected readonly languageModelsService: ILanguageModelsService; private readonly hoverService; private readonly configurationService; private static readonly creditUsageSettings; private static readonly modelChanges; private readonly _sourceAction; private readonly _showElapsedOnly; private _resolvedTitle; private _trackedEnabled; private _reportedAgentType; private _reportedModelName; private _modelConfigurationDescription; private _reportedCredits; private _renderedStatus; private _confirmationCount; private readonly _spinner; private readonly _durationTimer; private readonly _toolTransition; private readonly _activeToolRendered; private readonly _activeToolDisposables; private readonly _pillHover; private readonly _enabledTracker; private _enabledTrackerFactory; private _dragDataProvider; private _labelElement; private _container; private _agentTypeElement; private _pillContentElement; private _modelElement; private _creditsElement; private _durationElement; private _activeToolElement; private _activeToolIconElement; private _activeToolLabelElement; private _confirmationCountElement; private _iconElement; private _statusIconElement; private _displayedToolLabel; private _displayedToolIcon; private _displayedToolCallId; private _displayedToolSubagent; private _displayedToolAccessibleLabel; private _targetToolLabel; private _targetToolIcon; private _targetToolCallId; private _targetToolSubagent; private _targetActivityIsTool; private _displayedActivityIsTool; constructor(context: unknown, action: IAction, options: IActionViewItemOptions & { readonly showElapsedOnly?: boolean; }, openInEditor: boolean | undefined, markdownRendererService: IMarkdownRendererService, instantiationService: IInstantiationService, chatMarkdownAnchorService: IChatMarkdownAnchorService, chatWidgetService: IChatWidgetService, notificationService: INotificationService, languageModelsService: ILanguageModelsService, hoverService: IHoverService, configurationService: IConfigurationService); render(container: HTMLElement): void; onClick(event: EventLike, preserveFocus?: boolean): void; private _openToSide; setActionContext(newContext: unknown): void; protected get navigationContext(): IOpenSubagentChatContext | undefined; protected get pillContext(): SubagentPillContext | undefined; protected get modelName(): string | undefined; protected get showModel(): boolean; protected get isActive(): boolean; protected get activityLabel(): string; protected get activityAriaLabel(): string | undefined; protected _update(): void; trackEnabled(tracker: (context: IOpenSubagentChatContext, update: (enabled: boolean) => void) => IDisposable): void; setDragDataProvider(provider: (context: IOpenSubagentChatContext, event: DragEvent) => boolean): void; private _restartEnabledTracker; private _setEnabled; private _setModelName; private _updateModelConfiguration; private _setCredits; private _updateCredits; private get _showCreditUsage(); private _setAgentType; protected get status(): SubagentChatStatus | undefined; protected get statusIcon(): ThemeIcon; private _updateStatus; private _updateConfirmationCount; protected get duration(): number | undefined; protected get showDuration(): boolean; protected get durationLabel(): string | undefined; private _updateDuration; private _setActiveTool; private _setDisplayedTool; private _renderActiveToolIcon; private _setResolvedTitle; protected getTooltip(): string | undefined; protected updateTooltip(): void; protected updateEnabled(): void; private getActionLabel; protected updateAriaLabel(): void; } export {};