import { URI as ResourceURI } from "../../../../base/common/uri.js"; import { IProductService } from "../../../product/common/productService.service.js"; export { readUsageInfoMeta, type UsageInfoMeta } from "../meta/agentUsageMeta.js"; export { getInlineToolInput } from "../partialToolInput.js"; export { isMessageHiddenFromTranscript, isMessageRequestHiddenFromTranscript, readMessageSystemInitiatedLabel, withMessageHiddenFromTranscript, withMessageRequestHiddenFromTranscript, withMessageSystemInitiatedLabel } from "../meta/agentMessageMeta.js"; import { SessionStatus, TerminalState, ToolResultFileEditContent, ChatInteractivity, type ActiveTurn, type ChangesetState, type ChatState, type ChatSummary, type ChatOrigin, type CanvasState, type ErrorInfo, type ErrorResponsePart, type PendingMessage, type Turn, type AnnotationsState, type AutomationState, type AutomationRunState, type URI as ProtocolURI, type RootState, type SessionState, type SessionChatSummary, type SessionSummary, type TextRange, type ToolCallCancelledState, type ToolCallCompletedState, type ToolCallResult, type ToolCallState, type ToolResultContent, type ToolResultSubagentContent, type UsageInfo, type Message } from "./protocol/state.js"; export { ChangesetOperationScope, ChangesetOperationStatus, ChangesetStatus, CustomizationLoadStatus, CustomizationType, MessageAttachmentKind, MessageKind, PendingMessageKind, PolicyState, ResponsePartKind, ChatInteractivity, ChatOriginKind, SessionLifecycle, SessionStatus, ToolCallCancellationReason, ToolCallConfirmationReason, ToolCallContributorKind, ToolCallRiskAssessmentKind, ToolCallRiskAssessmentStatus, ToolCallStatus, ToolResultContentType, TurnState, type ActiveTurn, type AgentCustomization, type AgentCapabilities, type AgentInfo, type AgentSelection, type Annotation, type AnnotationEntry, type AnnotationOrigin, type AnnotationsState, type AnnotationsSummary, type Changeset, type ChangesetFile, type ChangesetOperation, type ChangesetState, type ChatState, type ChatSummary, type ChatOrigin, type CanvasReference, type CanvasState, type ChildCustomization, type ClientPluginCustomization, type ConfigPropertySchema, type ConfigSchema, type ContentRef, type Customization, type CustomizationDegradedState, type CustomizationErrorState, type CustomizationLoadedState, type CustomizationLoadingState, type CustomizationLoadState, type DirectoryCustomization, type ErrorInfo, type HookCustomization, type FileEdit as ISessionFileDiff, type ToolResultEmbeddedResourceContent as IToolResultBinaryContent, type MarkdownResponsePart, type McpServerCustomization, type MessageAttachment, type MessageResourceAttachment, type MessageEmbeddedResourceAttachment, type MessageAnnotationsAttachment, type MessageChatAttachment, type ModelSelection, type PendingMessage, type PluginCustomization, type ProjectInfo, type PromptCustomization, type ReasoningResponsePart, type ErrorResponsePart, type ResponsePart, type RootState, type RuleCustomization, type SessionActiveClient, type AutomationState, type AutomationRunState, type SessionConfigState, type ChatConfigState, type SessionModelInfo, type SessionState, type SessionSummary, type SkillCustomization, type Snapshot, type StringOrMarkdown, type TerminalState, type TextRange, type ToolAnnotations, type ToolCallCancelledState, type ToolCallCompletedState, type ToolCallPendingConfirmationState, type ToolCallPendingResultConfirmationState, type ToolCallResponsePart, type ToolCallResult, type ToolCallRiskAssessment, type ToolCallRiskAssessmentCompleteState, type ToolCallRiskAssessmentLoadingState, type ToolCallRunningState, type ToolCallState, type ToolCallStreamingState, type ToolCallContributor, type ToolDefinition, type ToolInput, type ToolResultContent, type ToolResultFileEditContent, type TerminalCommandResult, type ToolResultSubagentContent, type ToolResultTerminalContent, type ToolResultTextContent, type Turn, type URI, type UsageInfo, type Message } from "./protocol/state.js"; export declare function getErrorResponsePart(turn: Turn | ActiveTurn | undefined): ErrorResponsePart | undefined; export declare function createErrorResponsePart(error: ErrorInfo, resumable?: boolean): ErrorResponsePart; export declare function mergeLogicalTurnUsage(previous: UsageInfo | undefined, current: UsageInfo | undefined): UsageInfo | undefined; /** * Singleton channel containing the host-owned automation catalogue. */ export declare const AHP_AUTOMATIONS_SCHEME = "ahp-automations"; export declare const AUTOMATION_CATALOG_URI = "ahp-automations://"; /** * Returns whether `uri` identifies the singleton automation catalogue channel, * including forms normalized by the workbench {@link ResourceURI} class. */ export declare function isAhpAutomationCatalogChannel(uri: string): boolean; /** Returns whether `uri` identifies one automation-run channel. */ export declare function isAhpAutomationRunChannel(uri: string): boolean; /** * Whether `turn` is a hidden system notification the host appended purely to * carry a message (e.g. an Agent Merge status change). It never reaches the * provider and never captures a checkpoint, so it can never own file changes * and must be skipped when resolving a "last turn" for per-turn changes. * * A *visible* system notification (a background-agent completion, an Agent * Merge repair prompt) is a real turn and is deliberately not matched. * A hidden workspace-continuation request is also a real provider turn. */ export declare function isHostNoticeTurn(turn: { readonly message: Message; }): boolean; /** Returns the last turn id that can own file changes, or `undefined` if there is none. */ export declare function lastAttributableTurnId(turns: readonly { readonly id: string; readonly message: Message; }[] | undefined): string | undefined; /** Whole-turn token consumption attributed to a single model. */ export interface ITurnTokenTotal { readonly model: string; readonly inputTokens: number; readonly cachedTokens: number; readonly outputTokens: number; } export interface IAutoModeResolvedInfo { readonly chosenModel: string; readonly reasoningBucket?: "low" | "medium" | "high"; readonly categoryScores?: Readonly>; readonly predictedLabel?: string; readonly confidence?: number; readonly candidateModels?: readonly string[]; /** * Display-only sentence from the routing service explaining why * {@link chosenModel} was picked; it already names the model. Absent for * on-device selections and when the service supplied no explanation. */ readonly selectionReason?: string; } /** * Mirrors the SDK's `SessionContextAttribution` shape — a flat list of * per-source entries describing what occupies the session's context window. */ export interface IContextAttributionData { readonly totalTokens: number; readonly entries: readonly IContextAttributionEntry[]; readonly compactions: { readonly count: number; }; } export interface IContextAttributionEntry { readonly kind: string; readonly id: string; readonly label: string; readonly tokens: number; readonly parentId?: string; readonly attributes?: Readonly>; } /** * Whether a usage report actually records consumption, as opposed to merely * existing. * * A turn can carry a token-less {@link UsageInfo} that exists only to hold * routing metadata — notably a Copilot Auto turn restored from the event log, * which keeps `_meta.autoModeResolved` even though the usage event itself is * ephemeral and was never persisted. Callers that ask "does this turn have * usage?" almost always mean "does it have numbers to show", so route that * question through here rather than testing the object for truthiness. */ export declare function hasReportedUsage(usage: UsageInfo | undefined): boolean; export { ChangesetOperationTargetKind, type ChangesetOperationFollowUp, type ChangesetOperationTarget } from "./protocol/commands.js"; export { ChatInputAnswerState, ChatInputAnswerValueKind, ChatInputQuestionKind, ChatInputResponseKind, type ChatInputAnswer, type ChatInputOption, type ChatInputQuestion, type ChatInputRequest, type InputRequestResponsePart, } from "./protocol/state.js"; /** * The kind of file edit operation. Derived from the presence/absence of * `before`/`after` in {@link ToolResultFileEditContent}. */ export declare enum FileEditKind { /** Content edit (same file URI, different content). */ Edit = "edit", /** File creation (no before state). */ Create = "create", /** File deletion (no after state). */ Delete = "delete", /** File rename/move (different before and after URIs). */ Rename = "rename" } /** URI for the root state subscription. */ export declare const ROOT_STATE_URI = "ahp-root://"; /** Scheme used by {@link ROOT_STATE_URI}. */ export declare const AHP_ROOT_SCHEME = "ahp-root"; /** Scheme used by resource-watch channel URIs (`ahp-resource-watch:/`). */ export declare const AHP_RESOURCE_WATCH_SCHEME = "ahp-resource-watch"; /** * Encode a resource-watch descriptor into its canonical channel URI. The * descriptor is serialised into the URI path so the receiver can recover * the watch parameters without any server-side bookkeeping — subscribe is * the only point where state is materialised (an `IFileService` watcher * is attached on the first subscriber and held through a grace window * after the last drops). */ export declare function buildResourceWatchChannelUri(descriptor: { readonly root: string; readonly recursive?: boolean; readonly excludes?: { items: readonly string[]; }; readonly includes?: { items: readonly string[]; }; }): string; /** * Inverse of {@link buildResourceWatchChannelUri}. Returns `undefined` if * `uri` is not a well-formed `ahp-resource-watch:` URI — callers should * surface that as a not-found error to the client. */ export declare function parseResourceWatchChannelUri(uri: string): { root: string; recursive: boolean; excludes?: { items: string[]; }; includes?: { items: string[]; }; } | undefined; /** Returns `true` when `uri` identifies a resource-watch channel. */ export declare function isAhpResourceWatchChannel(uri: string): boolean; /** * Returns `true` when `uri` identifies the root channel, regardless of * whether the caller passes the canonical wire form (`'ahp-root://'`) or a * variant that has been round-tripped through the workbench {@link URI} class * (which normalizes the authority-less form to `'ahp-root:'`). Always prefer * this helper over a direct `=== ROOT_STATE_URI` comparison so the two * spellings stay interchangeable. */ export declare function isAhpRootChannel(uri: string): boolean; /** * Mints a session-unique opaque id for a customization, derived from its * source URI and (when present) its `range` within the source. Plugins MAY * declare multiple children (e.g. MCP servers, hooks) inside the same * manifest file; including the range disambiguates them without an extra * mapping table. * * The range is appended as a reserved `#range=` query-style suffix; any * existing `#` in the URI is percent-encoded first so a source URI that * already contains a fragment cannot collide with a ranged id. */ export declare function customizationId(uri: string, range?: TextRange): string; /** * A tool call in a terminal state, stored in completed turns. */ export type ICompletedToolCall = ToolCallCompletedState | ToolCallCancelledState; /** * Derived status type for the tool call lifecycle. */ export type ToolCallStatusString = ToolCallState["status"]; /** * Extracts a plain-text tool output string from a tool call result's `content` * array. Joins all text-type content parts into a single string. * * Returns `undefined` if there are no text content parts. */ export declare function getToolOutputText(result: ToolCallResult): string | undefined; /** * Extracts file edit content entries from a tool call result's `content` array. * Returns an empty array if there are no file edit content parts. */ export declare function getToolFileEdits(result: ToolCallResult): ToolResultFileEditContent[]; /** * Extracts the first subagent content entry from a tool call's `content` array. * Works with both completed tool call results and running tool call states. * Returns `undefined` if there are no subagent content parts. */ export declare function getToolSubagentContent(result: { content?: readonly ToolResultContent[]; }): ToolResultSubagentContent | undefined; /** * Builds a subagent session URI from a parent session URI and tool call ID. * Convention: `{parentSessionUri}/subagent/{toolCallId}` */ export declare function buildSubagentSessionUri(parentSession: ProtocolURI | ResourceURI, toolCallId: string): string; /** Parses path-based subagent URIs and legacy Copilot fragment selections into their parent and tool call ID. */ export declare function parseSubagentSessionUri(uri: ProtocolURI | ResourceURI): { parentSession: ResourceURI; toolCallId: string; } | undefined; /** * Returns whether a session URI represents a subagent session. */ export declare function isSubagentSession(uri: ProtocolURI | ResourceURI): boolean; /** * Builds the string prefix used by the state manager for cached subagent sessions. */ export declare function buildSubagentSessionUriPrefix(parentSession: ProtocolURI | ResourceURI): string; export declare function createRootState(): RootState; /** * Creates the initial flat {@link SessionState} for a session from its * root-channel {@link SessionSummary} catalog entry. Session metadata * ({@link SessionMetadata}) — and the shared `_meta` bag — are inlined directly * onto the state. */ export declare function createSessionState(summary: SessionSummary): SessionState; /** * Creates an empty {@link ChatState} for a chat. The summary fields are * denormalized onto the chat state per the protocol contract; callers pass * the chat's catalog summary and this seeds an empty conversation. */ export declare function createChatState(summary: ChatSummary): ChatState; /** * Derives the default-chat {@link ChatSummary} for a session from its * {@link SessionSummary}. The default chat inherits the session's title, * activity status and activity, and is marked as a * {@link ChatOriginKind.User | user-originated} chat. Both the session and * chat `modifiedAt` are ISO-8601 strings, so it is carried over directly. */ export declare function createDefaultChatSummary(session: SessionSummary, chatUri: ProtocolURI): ChatSummary; /** * Derives a {@link ChatSummary} from a fully-populated {@link ChatState} by * projecting out the denormalized summary fields. Used to keep the parent * session's `chats` catalog in sync with a chat's denormalized state. */ export declare function chatSummaryFromState(state: ChatState): ChatSummary; /** * The effective interactivity of a chat given its session's archived state. * * `interactivity` is the general read-only mechanism (e.g. subagent worker * chats are `ReadOnly`). An archived session is read-only too, so its * interactive chats are downgraded to `ReadOnly`. `Hidden` chats stay hidden — * archiving only downgrades `Full` chats. Absent interactivity defaults to * `Full` for backward compatibility. * * The host uses this to enforce read-only turns off a single signal * ({@link isChatReadOnly}) rather than special-casing archived; the same rule * is mirrored client-side to hide the composer. */ export declare function effectiveChatInteractivity(interactivity: ChatInteractivity | undefined, sessionArchived: boolean): ChatInteractivity; /** * Whether a chat rejects user-dispatched turns, given its own interactivity and * its session's archived state. `true` for `ReadOnly` chats (including archived * sessions' interactive chats). See {@link effectiveChatInteractivity}. */ export declare function isChatReadOnly(interactivity: ChatInteractivity | undefined, sessionArchived: boolean): boolean; export declare function createActiveTurn(id: string, message: Message, startedAt: string): ActiveTurn; export declare function getTurnError(turn: Turn | undefined): ErrorInfo | undefined; export declare enum StateComponents { Root = 0, Session = 1, Chat = 2, Terminal = 3, Changeset = 4, Annotations = 5, AutomationCatalog = 6, AutomationRun = 7, Canvas = 8 } export type ComponentToState = { [StateComponents.Root]: RootState; [StateComponents.Session]: SessionState; [StateComponents.Chat]: ChatState; [StateComponents.Terminal]: TerminalState; [StateComponents.Changeset]: ChangesetState; [StateComponents.Annotations]: AnnotationsState; [StateComponents.AutomationCatalog]: AutomationState; [StateComponents.AutomationRun]: AutomationRunState; [StateComponents.Canvas]: CanvasState; }; /** Scheme used by chat channel URIs (`ahp-chat://...`). */ export declare const AHP_CHAT_SCHEME = "ahp-chat"; /** Chat id of the default chat that every session owns. */ export declare const DEFAULT_CHAT_ID = "default"; /** * Derives the deterministic channel URI for a chat within a session. Every chat * — the default chat and any additional peer chats — encodes its owning session * URI into the path so producers and consumers can recover the session without a * lookup table (see {@link parseChatUri}). The chat id is carried in the URI * authority. * * `ahp-chat:///` */ export declare function buildChatUri(sessionUri: ProtocolURI | ResourceURI, chatId: string): string; /** * Mints the URI of a new session's default chat. This is the minting scheme * for new default chats and may change (for example, to opaque URIs); it does * not find an existing session's default chat. Hosts read the recorded default * chat and clients read the advertised `SessionState.defaultChat`. */ export declare function buildDefaultChatUri(sessionUri: ProtocolURI | ResourceURI): string; export declare function buildSubagentChatUri(sessionUri: ProtocolURI | ResourceURI, toolCallId: string): string; /** * Recovers the chat id of a chat channel URI. Returns `undefined` when `uri` * is not a well-formed chat URI. The session a chat URI was minted for is not * exposed: a chat's owner and storage come from the records that contain it. */ export declare function parseChatUri(uri: ProtocolURI | ResourceURI): { chatId: string; } | undefined; /** * The uuid of a canonical opaque chat URI (`ahp-chat:/` with nothing * else), or `undefined` for any other resource. */ export declare function getCanonicalOpaqueChatUuid(resource: ResourceURI | string): string | undefined; /** * The client chat id (a chat resource fragment) of a chat. Deterministic per * URI so persisted fragments never change: the short uuid of a canonical * opaque chat, the parsed id of a shaped chat other than `default`, and the * full URI for everything else. The recorded default chat is addressed by an * empty fragment or {@link DEFAULT_CHAT_ID}, never by this id. */ export declare function getAgentHostChatId(resource: ResourceURI | string): string; /** Resolves a client chat id against the immutable catalog, preferring exact resources over short ids. */ export declare function getSessionChatResource(state: { readonly chats: readonly Pick[]; }, chatId: string, defaultChat: ProtocolURI | undefined): ProtocolURI | undefined; /** Returns `true` when `chatId` addresses the session's advertised `defaultChat` (rule 7 matching, exact URI first). */ export declare function isSessionDefaultChatId(state: { readonly chats: readonly Pick[]; }, chatId: string, defaultChat: ProtocolURI | undefined): boolean; /** Returns `true` when `uri` identifies a chat channel. */ export declare function isAhpChatChannel(uri: string): boolean; /** * A single chat's effective session context: the shared {@link SessionState} * (working directories, active clients, config, customizations/MCP scope, …) * resolved for one chat and merged with that chat's conversation contents. * * The protocol moved turns and pending state off the session and onto a * per-chat channel, and lets a chat override the session's working directories * with a subset (e.g. {@link ChatState.workingDirectories}). This composite * recombines the session with one of its chats — default or peer — so consumers * read the chat's effective context and conversation through one object without * walking back to the session to re-derive shared state. The * {@link ISessionWithDefaultChat.workingDirectories} carry the chat's *effective* * working directories (its own subset override when present, else the session's * full set). */ export interface ISessionWithDefaultChat extends SessionState { /** Completed turns of this chat. */ turns: Turn[]; /** Currently in-progress turn of this chat. */ activeTurn?: ActiveTurn; /** Steering message pending on this chat. */ steeringMessage?: PendingMessage; /** Steering and queued messages pending on this chat. */ queuedMessages?: PendingMessage[]; /** Draft input of this chat. */ draft?: Message; } /** * Projects a {@link SessionState} and one of its {@link ChatState | chats} * (default or peer) into that chat's {@link ISessionWithDefaultChat | effective * session context}. Per-chat overrides (the working-directories subset) are * layered over the session defaults, and the conversation fields are taken from * the chat. When the chat state is absent (e.g. not yet hydrated) the * conversation fields default to empty and the session defaults apply. */ export declare function mergeSessionWithDefaultChat(session: SessionState, chat: ChatState | undefined): ISessionWithDefaultChat; /** * Resolves the active turn of a session's default chat, if any. */ export declare function getActiveTurn(chat: ChatState | undefined): ActiveTurn | undefined; /** * VS Code-side alias for the protocol's open `_meta` property bag on * {@link SessionState}. Keys SHOULD be namespaced (e.g. `git`, `vscode.foo`) * to avoid collisions; values MUST be JSON-serializable. */ export type SessionMeta = Record; /** * VS Code-side alias for the protocol's open `_meta` property bag on * {@link SessionSummary}. Keys SHOULD be namespaced (e.g. `git`, `vscode.foo`) * to avoid collisions; values MUST be JSON-serializable. */ export type SessionSummaryMeta = Record; /** * Reserved key under {@link SessionMeta} for the well-known git-state * payload. Value at this key, when present, MUST be shaped like * {@link ISessionGitState}. This is a VS Code-specific convention layered * on top of the protocol's generic `_meta` bag — the protocol itself does * not know about git state. */ export declare const SESSION_META_GIT_KEY = "git"; /** Reserved key for Git state keyed by normalized working-directory scope. */ export declare const SESSION_META_GIT_DATA_KEY = "gitData"; /** Host-authored scope ids keyed by their exact backend working-directory list. */ export declare const SESSION_META_WORKING_DIRECTORY_SCOPE_IDS_KEY = "workingDirectoryScopeIds"; /** * Reserved key under {@link SessionMeta} for a single {@link ISessionGitHubState} * describing the session folder. It is never written to session state: clients * pass it in a new session's configuration to seed the session folder's state * (see {@link readSessionGitHubStateInput}), and sessions recorded before each * folder had its own state are migrated from it into * {@link SESSION_META_GITHUB_DATA_KEY} (see {@link withMigratedSessionGitHubState}). * This is a VS Code-specific convention layered on top of the protocol's generic * `_meta` bag — the protocol itself does not know about GitHub state. */ export declare const SESSION_META_GITHUB_KEY = "github"; /** Reserved key for durable source-control workflow provenance. */ export declare const SESSION_META_SOURCE_CONTROL_KEY = "vscode.sourceControl"; export declare const SESSION_META_PROMPT_CACHE_KEY = "vscode.promptCache"; export declare const SESSION_META_MULTI_ROOT_KEY = "multiRoot"; /** Reserved key for whether a provider-native session has not yet been adopted. */ export declare const SESSION_META_EXTERNAL_KEY = "vscode.external"; /** Multi-root workspace provenance attached by the creating client. */ export interface ISessionMultiRootMetadata { readonly workspaceFile: string; } /** Reads validated multi-root workspace provenance from session metadata. */ export declare function readSessionMultiRootMetadata(meta: SessionMeta | undefined): ISessionMultiRootMetadata | undefined; /** Parses validated multi-root workspace provenance from its persisted JSON representation. */ export declare function parseSessionMultiRootMetadata(value: string | undefined): ISessionMultiRootMetadata | undefined; /** Returns session metadata with the multi-root workspace provenance updated or removed. */ export declare function withSessionMultiRootMetadata(meta: SessionMeta | undefined, multiRoot: ISessionMultiRootMetadata | undefined): SessionMeta | undefined; /** Latest known prompt-cache state for the model active in an agent session. */ export interface ISessionPromptCacheState { readonly modelId: string; readonly cacheExpiresAt: string; } /** Reads the latest known prompt-cache state from session metadata. */ export declare function readSessionPromptCacheState(meta: SessionMeta | undefined): ISessionPromptCacheState | undefined; /** Returns session metadata with the prompt-cache slot updated or removed. */ export declare function withSessionPromptCacheState(meta: SessionMeta | undefined, promptCache: ISessionPromptCacheState | undefined): SessionMeta | undefined; /** Reserved key for the harness-owned new-session folder-picker decision. */ export declare const SESSION_META_FOLDER_PICKER_KEY = "vscode.folderPicker"; /** * Harness-owned decision about the multi-root new-session Folder picker for an * agent-host session, carried under {@link SessionMeta} at * {@link SESSION_META_FOLDER_PICKER_KEY}. * * The provider (harness) owns this because the signal differs per backend — for * example Copilot hides the picker when at most one workspace folder carries * hooks under `.github/hooks/` (pinning that folder as {@link primary} when * exactly one does), since the Copilot agent only applies hooks from the primary * working directory, and shows the picker when several folders carry hooks so * the user resolves the ambiguity. When {@link primary} is set, it names the * working directory the client should auto-select before the session starts. */ export interface ISessionFolderPickerDecision { /** Whether the client should hide the multi-root Folder picker. */ readonly hidden: boolean; /** * The working directory the client should auto-select as the primary, as a * URI string. Present only when the harness pins a specific folder (it * always accompanies `hidden: true`, but a `hidden` decision need not pin * one — e.g. when no folder carries hooks the current selection is kept). */ readonly primary?: string; } /** Reads the validated folder-picker decision from session metadata. */ export declare function readSessionFolderPickerDecision(meta: SessionMeta | undefined): ISessionFolderPickerDecision | undefined; /** Parses the validated folder-picker decision from its persisted JSON representation. */ export declare function parseSessionFolderPickerDecision(value: string | undefined): ISessionFolderPickerDecision | undefined; /** Returns session metadata with the folder-picker decision updated or removed. */ export declare function withSessionFolderPickerDecision(meta: SessionMeta | undefined, decision: ISessionFolderPickerDecision | undefined): SessionMeta | undefined; /** * Git state of a session's working directory, carried under * {@link SessionMeta} at {@link SESSION_META_GIT_KEY}. Used by clients to * drive source-control affordances (e.g. PR/merge buttons in the Agents * app). * * All fields are optional — agents that do not track a particular field * should omit it rather than send a placeholder, so clients can distinguish * "unknown" from "known to be zero". */ export interface ISessionGitState { /** Whether the working directory has any Git remote. */ readonly hasGitRemote?: boolean; /** Whether the working directory has a `github.com` git remote. */ readonly hasGitHubRemote?: boolean; /** Current branch name. */ readonly branchName?: string; /** * Whether `HEAD` is detached, which is why {@link branchName} is absent. * Distinguishes a legitimately branch-less checkout from git state left * behind by a probe that failed before it could resolve the branch. */ readonly isDetachedHead?: boolean; /** Base branch the work targets (e.g. `main`). */ readonly baseBranchName?: string; /** Upstream tracking branch (e.g. `origin/feature`). */ readonly upstreamBranchName?: string; /** * Default branch of the `origin` remote (e.g. `main`), read from * `refs/remotes/origin/HEAD`. Unlike {@link baseBranchName}, it is never * replaced by a configured base branch. */ readonly defaultBranchName?: string; /** Remote-tracking branch of {@link defaultBranchName} (e.g. `origin/main`), present only when that ref exists. */ readonly defaultRemoteBranchName?: string; /** Number of commits the upstream branch has ahead of the local branch. */ readonly incomingChanges?: number; /** Number of commits the local branch has ahead of the upstream branch. */ readonly outgoingChanges?: number; /** Number of files with uncommitted changes. */ readonly uncommittedChanges?: number; /** Whether the current branch has commits not contained in its local base branch. */ readonly hasBaseBranchChanges?: boolean; /** GitHub repository owner parsed from the working copy's GitHub remote (preferring `origin`, falling back to the first GitHub remote). */ readonly githubOwner?: string; /** GitHub owner parsed from the current branch's upstream or push remote. */ readonly githubHeadOwner?: string; /** GitHub repository name parsed from the working copy's GitHub remote (preferring `origin`, falling back to the first GitHub remote). */ readonly githubRepo?: string; } export declare enum SessionSourceControlOutcome { Merge = "merge", PullRequest = "pullRequest" } /** Durable source-control workflow provenance for a session. */ export interface ISessionSourceControlState { readonly merge?: { /** Resulting target-branch HEAD after the most recent successful merge. */ readonly commit: string; }; readonly latestOutcome?: SessionSourceControlOutcome; } /** Reads validated source-control workflow provenance from session metadata. */ export declare function readSessionSourceControlState(meta: SessionMeta | undefined): ISessionSourceControlState | undefined; /** Returns session metadata with source-control workflow provenance updated. */ export declare function withSessionSourceControlState(meta: SessionMeta | undefined, state: ISessionSourceControlState | undefined): SessionMeta | undefined; /** * GitHub state of a session, carried under {@link SessionMeta} at * {@link SESSION_META_GITHUB_KEY}. Used by clients to drive GitHub-specific * affordances (e.g. PR/merge buttons in the Agents app). * * All fields are optional — agents that do not track a particular field * should omit it rather than send a placeholder, so clients can distinguish * "unknown" from "known to be zero". */ export interface ISessionGitHubState { /** The owner of the GitHub repository. */ readonly owner?: string; /** The name of the GitHub repository. */ readonly repo?: string; /** GitHub pull request URLs found for the session's checkouts, most recent first. */ readonly pullRequestUrls?: readonly string[]; /** Pull requests that predate a folder-isolated session. An empty array is a captured baseline. */ readonly initialPullRequestUrls?: readonly string[]; /** Pull requests explicitly associated through user intent, most recent first. */ readonly associatedPullRequestUrls?: readonly string[]; /** Last host-observed state of {@link pullRequestStateUrl}. */ readonly pullRequestState?: "open" | "closed" | "merged"; /** Pull request URL to which {@link pullRequestState} applies. */ readonly pullRequestStateUrl?: string; /** * The name of the branch the most recent {@link pullRequestUrls} entry was found (or created) for. * A pull request always relates to a branch: when the working copy switches * to a different branch the host keeps reporting the known pull request but * resumes looking for one that belongs to the newly checked out branch. */ readonly pullRequestBranchName?: string; } /** * Whether the known pull request of `gitHubState` belongs to `branchName`. * * State persisted before pull requests were tracked per branch has no * {@link ISessionGitHubState.pullRequestBranchName}; such a pull request is * optimistically treated as belonging to the given branch so existing sessions * keep their pull request affordances until the host has verified which branch * it actually belongs to. */ export declare function hasSessionPullRequestForBranch(gitHubState: ISessionGitHubState | undefined, branchName: string | undefined): boolean; /** Returns pull requests related to the session rather than inherited from its folder checkout. */ export declare function getSessionRelatedPullRequestUrls(gitHubState: ISessionGitHubState | undefined): readonly string[]; /** Maximum pull requests retained for a session. */ export declare const MAX_SESSION_PULL_REQUEST_REFERENCES = 10; /** Returns GitHub state with `pullRequestUrl` moved to the front of its bounded history. */ export declare function withMostRecentSessionPullRequest(gitHubState: ISessionGitHubState | undefined, pullRequestUrl: string, branchName: string): ISessionGitHubState; /** Returns state that promotes a pull request from the folder baseline into the session. */ export declare function withMostRecentRelatedSessionPullRequest(gitHubState: ISessionGitHubState | undefined, pullRequestUrl: string, branchName: string): ISessionGitHubState; /** Returns state that records a pull request in the folder-session baseline. */ export declare function withInitialSessionPullRequest(gitHubState: ISessionGitHubState | undefined, pullRequestUrl?: string): ISessionGitHubState; /** Parses a Git state payload, dropping fields with invalid types. */ export declare function parseSessionGitState(value: unknown): ISessionGitState | undefined; /** Reads the well-known Git state payload from {@link SessionMeta}. */ export declare function readSessionGitState(meta: SessionMeta | undefined): ISessionGitState | undefined; /** * Whether a session's git state should be recomputed because it does not * describe a usable checkout. * * A state that was never computed obviously qualifies. So does one that is * missing its branch without a detached `HEAD` to explain it: `git status` is * the only probe that reports the branch, so such a state is the residue of a * probe that failed, and consumers that key off the branch (Agent Merge binds * its pull request that way) stay stranded until it is recomputed. A detached * `HEAD` is a legitimate branch-less checkout and must not be mistaken for it, * or every caller would refresh in a loop against a repository that will never * report a branch. */ export declare function needsSessionGitStateRefresh(gitState: ISessionGitState | undefined): boolean; /** * Returns a new {@link SessionMeta} with the git-state payload set to * `gitState`, or with the git slot removed if `gitState` is `undefined`. * Returns `undefined` if the result would be empty. */ export declare function withSessionGitState(meta: SessionMeta | undefined, gitState: ISessionGitState | undefined): SessionMeta | undefined; /** Parses Git state keyed by normalized working-directory scope. */ export declare function parseSessionGitData(value: unknown): ReadonlyMap; /** Reads Git state keyed by normalized working-directory scope. */ export declare function readSessionGitData(meta: SessionSummaryMeta | undefined): ReadonlyMap; export declare function readWorkingDirectoryScopeIds(meta: SessionSummaryMeta | undefined): ReadonlyMap; export declare function readWorkingDirectoryScopeId(meta: SessionSummaryMeta | undefined, workingDirectories: readonly string[]): string; export declare function withWorkingDirectoryScopeId(meta: SessionSummaryMeta | undefined, workingDirectories: readonly string[], scopeId?: string): SessionSummaryMeta | undefined; /** Reads the Git state recorded for one normalized working-directory scope. */ export declare function readFolderScopeGitState(meta: SessionSummaryMeta | undefined, scopeId: string): ISessionGitState | undefined; /** Returns `meta` with the Git state for one normalized working-directory scope replaced. */ export declare function withFolderScopeGitState(meta: SessionSummaryMeta | undefined, scopeId: string, gitState: ISessionGitState | undefined, workingDirectories?: readonly string[]): SessionSummaryMeta | undefined; /** Returns `meta` with all normalized working-directory Git states replaced. */ export declare function withSessionGitData(meta: SessionSummaryMeta | undefined, scopes: ReadonlyMap): SessionSummaryMeta | undefined; /** * Reserved key under {@link SessionSummaryMeta} holding the GitHub and pull * request state of each session folder, keyed by working-directory key (see * `getWorkingDirectoryKey`). The session folder is the session's first working * directory. A session without working directories has no GitHub state. VS * Code-specific convention layered on top of the protocol's generic `_meta` bag. */ export declare const SESSION_META_GITHUB_DATA_KEY = "githubData"; /** Host-authored folder keys keyed by their exact backend working directory. */ export declare const SESSION_META_WORKING_DIRECTORY_KEYS_KEY = "workingDirectoryKeys"; /** * Parses a GitHub state payload. Returns `undefined` when the value is not a * plain object (e.g. an array or a primitive). Individual fields with wrong * types are silently dropped so partial state still propagates. */ export declare function parseSessionGitHubState(value: unknown): ISessionGitHubState | undefined; /** Parses a {@link SESSION_META_GITHUB_DATA_KEY} payload into the GitHub state of each folder, keyed by working-directory key. */ export declare function parseSessionGitHubData(value: unknown): ReadonlyMap; /** * Reads the GitHub state recorded for each folder, keyed by working-directory key. * * Unlike the other typed readers, this takes the raw {@link SessionSummaryMeta} * value rather than its parent {@link SessionState}: the sessions provider stores and * reads a detached meta snapshot without retaining the owning state. */ export declare function readSessionGitHubData(meta: SessionSummaryMeta | undefined): ReadonlyMap; export declare function readWorkingDirectoryKeys(meta: SessionSummaryMeta | undefined): ReadonlyMap; export declare function readWorkingDirectoryKey(meta: SessionSummaryMeta | undefined, workingDirectory: string): string; export declare function withWorkingDirectoryKey(meta: SessionSummaryMeta | undefined, workingDirectory: string, folderKey?: string): SessionSummaryMeta | undefined; /** Reads the GitHub state of the folder with working-directory key `folderKey`. */ export declare function readFolderGitHubState(meta: SessionSummaryMeta | undefined, folderKey: string | undefined): ISessionGitHubState | undefined; /** Reads the GitHub state of the session folder, the session's first working directory. */ export declare function readSessionGitHubState(meta: SessionSummaryMeta | undefined, sessionWorkingDirectory: string | undefined): ISessionGitHubState | undefined; /** * Returns `meta` with the GitHub state of the folder with working-directory key * `folderKey` replaced, removing the entry when `gitHubState` is `undefined`. * Returns `meta` unchanged when `folderKey` is `undefined`, and `undefined` if * the result would be empty. */ export declare function withFolderGitHubState(meta: SessionSummaryMeta | undefined, folderKey: string | undefined, gitHubState: ISessionGitHubState | undefined, workingDirectory?: string): SessionSummaryMeta | undefined; /** * Reads the GitHub state of the session folder of a session state or summary: * its first working directory. Agent Merge and the pull request lifecycle * follow this folder's pull request. */ export declare function readSessionFolderGitHubState(session: { readonly _meta?: SessionSummaryMeta; readonly workingDirectories?: readonly string[]; } | undefined): ISessionGitHubState | undefined; /** Returns `meta` with the GitHub state of the session folder, the session's first working directory, replaced. */ export declare function withSessionGitHubState(meta: SessionSummaryMeta | undefined, sessionWorkingDirectory: string | undefined, gitHubState: ISessionGitHubState | undefined): SessionSummaryMeta | undefined; /** * Returns `meta` with the GitHub state of every folder replaced by `folders`, * keyed by working-directory key. Returns `undefined` if the result would be empty. */ export declare function withSessionGitHubData(meta: SessionSummaryMeta | undefined, folders: ReadonlyMap): SessionSummaryMeta | undefined; /** * Reads the GitHub state a client supplies under {@link SESSION_META_GITHUB_KEY} * in a new session's configuration for the session folder. */ export declare function readSessionGitHubStateInput(meta: SessionSummaryMeta | undefined): ISessionGitHubState | undefined; /** * Returns `meta` with the GitHub state a new session's folder starts with (see * {@link readSessionGitHubStateInput}), or with it removed if `gitHubState` is * `undefined`. Returns `undefined` if the result would be empty. */ export declare function withSessionGitHubStateInput(meta: SessionSummaryMeta | undefined, gitHubState: ISessionGitHubState | undefined): SessionSummaryMeta | undefined; /** * Migrates the single GitHub state of a session recorded before each folder had * its own state: records `legacyState` (by default the one under * {@link SESSION_META_GITHUB_KEY} in `meta`) as the state of the session folder * unless that folder already has one, and removes the original entry. The state * is dropped for a session without working directories. */ export declare function withMigratedSessionGitHubState(meta: SessionSummaryMeta | undefined, sessionWorkingDirectory: string | undefined, legacyState?: ISessionGitHubState | undefined): SessionSummaryMeta | undefined; /** * Moves the GitHub state recorded for working directory `directory` to * `replacement`, for a folder whose checkout moved (for example into a * worktree). An existing entry for `replacement` is kept. */ export declare function withReplacedFolderGitHubState(meta: SessionSummaryMeta | undefined, directory: string, replacement: string): SessionSummaryMeta | undefined; /** * Every pull request URL related to the session across all of its folders, * deduplicated, including those of an original single-folder entry that was not * migrated yet (see {@link withMigratedSessionGitHubState}). */ export declare function getAllSessionRelatedPullRequestUrls(meta: SessionSummaryMeta | undefined): readonly string[]; /** * Reserved key under {@link SessionSummaryMeta} recording how deeply a session * was spawned via the `create_session` host tool (0 for a top-level, user-created * session). Used to bound recursive session creation. VS Code-specific convention * layered on top of the protocol's generic `_meta` bag. */ export declare const SESSION_META_SPAWN_DEPTH_KEY = "agentHost/sessionSpawnDepth"; /** * Reads the `create_session` spawn depth from a {@link SessionSummaryMeta} bag, * returning `0` when the key is absent or not a finite number. */ export declare function readSessionSpawnDepth(meta: SessionSummaryMeta | undefined): number; /** * Returns a new {@link SessionSummaryMeta} with the `create_session` spawn depth * set to `depth`, preserving any other keys in the bag. */ export declare function withSessionSpawnDepth(meta: SessionSummaryMeta | undefined, depth: number): SessionSummaryMeta; export declare const SESSION_META_CREATED_BY_SESSION_KEY = "agentHost/createdBySession"; export declare const AH_META_CREATED_BY_SESSION_DB_KEY = "agentHost.createdBySession"; export interface ISessionCreationReference { readonly session: string; readonly chat?: string; readonly turnId?: string; } export declare function readSessionCreationReference(meta: SessionSummaryMeta | undefined): ISessionCreationReference | undefined; export declare function parseSessionCreationReference(value: string | undefined): ISessionCreationReference | undefined; export declare function withSessionCreationReference(meta: SessionSummaryMeta | undefined, creationReference: ISessionCreationReference): SessionSummaryMeta; export declare const SESSION_META_COMPARISON_KEY = "agentHost/sessionComparison"; export type AgentSessionComparisonRole = "attempt" | "judge" | "synthesis"; export interface IAgentSessionComparisonMetadata { readonly id: string; readonly role: AgentSessionComparisonRole; readonly attemptIndex?: number; readonly attemptCount: number; } export declare function readSessionComparisonMetadata(meta: SessionSummaryMeta | undefined): IAgentSessionComparisonMetadata | undefined; export declare function withSessionComparisonMetadata(meta: SessionSummaryMeta | undefined, comparison: IAgentSessionComparisonMetadata): SessionSummaryMeta; /** * Reserved key under {@link SessionSummaryMeta} marking a session as * workspace-less: a session with no workspace/folder binding (surfaced in the * UI as a "Quick Chat"). Carried on the summary bag (not the full state) so * clients can group/style such sessions in session lists without subscribing to * full session state. VS Code-specific convention layered on the protocol's * generic `_meta` bag. */ export declare const SESSION_META_WORKSPACELESS_KEY = "workspaceless"; /** * Session-database metadata key recording whether a session is workspace-less (a * workspace-less chat). Owned by the AH service: `AgentService` writes it centrally at * create/materialize and overlays it onto every agent's summary `_meta` in * `listSessions`; agents only read it (e.g. to pick the workspace-less system prompt * on resume) and never persist it themselves. */ export declare const AH_META_WORKSPACELESS_DB_KEY = "agentHost.workspaceless"; /** Session-database marker indicating that retained turns include workspace-transition boundaries. */ export declare const AH_META_HAS_WORKSPACE_TRANSITIONS_DB_KEY = "agentHost.hasWorkspaceTransitions"; /** Summary metadata mirror of {@link AH_META_HAS_WORKSPACE_TRANSITIONS_DB_KEY}. */ export declare const SESSION_META_HAS_WORKSPACE_TRANSITIONS_KEY = "hasWorkspaceTransitions"; /** Blocks turns for a session whose provider could not be detached from an untrusted working directory. */ export declare const AH_META_WORKSPACE_CONVERSION_QUARANTINED_DB_KEY = "agentHost.workspaceConversionQuarantined"; /** * Session-database metadata key recording whether a session is archived. Written by * the AH orchestrator (`AgentSideEffects` on `SessionIsArchivedChanged`) and read by * both the orchestrator (`AgentService` restore/list) and agents (e.g. `CopilotAgent` * decides whether to recreate a missing worktree vs. resume read-only for history). * {@link AH_META_IS_DONE_DB_KEY} is the legacy name kept for sessions persisted before * the rename; readers fall back to it when {@link AH_META_IS_ARCHIVED_DB_KEY} is absent. */ export declare const AH_META_IS_ARCHIVED_DB_KEY = "isArchived"; /** Timestamp written only when merged-session cleanup automatically archives a session. */ export declare const AH_META_AUTO_ARCHIVED_AT_DB_KEY = "agentHost.autoArchivedAt"; /** Legacy metadata key for the archived flag; see {@link AH_META_IS_ARCHIVED_DB_KEY}. */ export declare const AH_META_IS_DONE_DB_KEY = "isDone"; /** * Session-database metadata key recording the session aggregate read state. The * in-memory truth is {@link SessionStatus.IsRead}; chat state is stored separately. */ export declare const AH_META_IS_READ_DB_KEY = "isRead"; /** Session-database metadata key recording the default chat's independent read state. */ export declare const AH_META_DEFAULT_CHAT_IS_READ_DB_KEY = "defaultChatIsRead"; /** Returns `status` with `flag` set or cleared. */ export declare function withSessionStatusFlag(status: SessionStatus, flag: SessionStatus, set: boolean): SessionStatus; /** Whether the {@link SessionStatus.IsRead} flag bit is set. */ export declare function isSessionStatusRead(status: SessionStatus | undefined): boolean; /** * Whether a chat participates in the containing session's aggregate read state. * Tool/subagent/hidden chats retain exact per-chat state without making the session unread. */ export declare function isChatInSessionReadAggregate(resource: ProtocolURI, origin?: ChatOrigin, interactivity?: ChatInteractivity): boolean; /** Whether the {@link SessionStatus.IsArchived} flag bit is set. */ export declare function isSessionStatusArchived(status: SessionStatus | undefined): boolean; /** Reads the archive flag from current chat status or a legacy AHP 0.9 summary. */ export declare function isSessionChatArchived(chat: SessionChatSummary & { readonly archived?: boolean; }): boolean; /** * Reads the workspace-less marker from {@link SessionSummaryMeta}. Returns * `true` only when the well-known key is present and set to boolean `true`. */ export declare function readSessionWorkspaceless(meta: SessionSummaryMeta | undefined): boolean; /** * Returns a new {@link SessionSummaryMeta} with the workspace-less marker set, * or with the slot removed when `workspaceless` is `false`. Returns `undefined` * if the result would be empty. */ export declare function withSessionWorkspaceless(meta: SessionSummaryMeta | undefined, workspaceless: boolean): SessionSummaryMeta | undefined; /** * Summary `_meta` key listing the scratch folders (host-allocated per-chat folders of workspace-less * sessions) a session uses, as an array of folder URI strings. */ export declare const SessionScratchFoldersMetaKey = "vscode.scratchFolders"; /** Reads the scratch folders of a session summary; `[]` when absent or not an array of non-empty strings. */ export declare function readSessionScratchFolders(meta: SessionSummaryMeta | undefined): readonly string[]; /** Returns a new {@link SessionSummaryMeta} listing `folders`, or without the slot when `folders` is empty; `undefined` if the result would be empty. */ export declare function withSessionScratchFolders(meta: SessionSummaryMeta | undefined, folders: readonly string[]): SessionSummaryMeta | undefined; /** Whether retained turns in this session include host-owned workspace transitions. */ export declare function readSessionHasWorkspaceTransitions(meta: SessionSummaryMeta | undefined): boolean; /** Returns summary metadata with the workspace-transition history marker updated. */ export declare function withSessionHasWorkspaceTransitions(meta: SessionSummaryMeta | undefined, hasTransitions: boolean): SessionSummaryMeta | undefined; /** Whether a provider-native session has not yet been adopted by the host. */ export declare function readSessionExternal(meta: SessionSummaryMeta | undefined): boolean; /** Writes an explicit external flag so clearing it survives serialization and metadata-only refreshes. */ export declare function withSessionExternal(meta: SessionSummaryMeta | undefined, external: boolean): SessionSummaryMeta; /** * `_meta` key marking a session as an un-adopted legacy Copilot CLI session * surfaced (only under the migrate setting) as adoptable. Clients read it to * avoid passively subscribing to — and thereby migrating — the session before * the user opens it. Cleared implicitly once the session is adopted (it no * longer surfaces as adoptable). */ export declare const SESSION_META_EHCLI_ADOPTABLE_KEY = "ehcliAdoptable"; /** Whether the session is an un-adopted legacy Copilot CLI session surfaced as adoptable. */ export declare function readSessionEhcliAdoptable(meta: SessionSummaryMeta | undefined): boolean; /** Returns a new {@link SessionSummaryMeta} with the adoptable-legacy marker set. */ export declare function withSessionEhcliAdoptable(meta: SessionSummaryMeta | undefined): SessionSummaryMeta; /** * Session-DB key recording that a session was adopted from a legacy Copilot CLI * (extension-host) chat. Unlike {@link SESSION_META_EHCLI_ADOPTABLE_KEY} this * survives adoption, so consumers can keep treating the session as legacy for * the rest of its life — a migrated session must not change how it is listed. */ export declare const AH_META_EHCLI_ADOPTED_DB_KEY = "agentHost.ehcliAdopted"; /** `_meta` key mirroring {@link AH_META_EHCLI_ADOPTED_DB_KEY} on a summary. */ export declare const SESSION_META_EHCLI_ADOPTED_KEY = "ehcliAdopted"; /** Whether the session was adopted from a legacy Copilot CLI chat. */ export declare function readSessionEhcliAdopted(meta: SessionSummaryMeta | undefined): boolean; /** Returns a copy of `meta` with the adopted-legacy provenance marker updated. */ export declare function withSessionEhcliAdopted(meta: SessionSummaryMeta | undefined, adopted: boolean): SessionSummaryMeta | undefined; /** * Session-DB key recording the id of the final turn that existed when a legacy * Copilot CLI session was adopted. It marks the boundary between the migrated * (checkpoint-less) history and any turns added after adoption, so a consumer * that substitutes the session-wide changeset for a migrated turn's absent * per-turn changeset (see the chat editor fallback) can target exactly that * turn and never a post-adoption one. */ export declare const AH_META_EHCLI_LAST_TURN_DB_KEY = "agentHost.ehcliLastMigratedTurn"; /** `_meta` key mirroring {@link AH_META_EHCLI_LAST_TURN_DB_KEY} on a summary. */ export declare const SESSION_META_EHCLI_LAST_TURN_KEY = "ehcliLastMigratedTurn"; /** The id of the last turn migrated when the legacy Copilot CLI session was adopted, if recorded. */ export declare function readSessionEhcliLastMigratedTurn(meta: SessionSummaryMeta | undefined): string | undefined; /** Returns a copy of `meta` with the last-migrated-turn marker set, or unchanged when `turnId` is empty. */ export declare function withSessionEhcliLastMigratedTurn(meta: SessionSummaryMeta | undefined, turnId: string | undefined): SessionSummaryMeta | undefined; /** * Whether a session should be matched against a workspace folder by its project * (repository) root in addition to its working directories. True only for * legacy Copilot CLI sessions, which run out of a worktree outside the * repository; agent-host-native worktree sessions are deliberately not surfaced * in a window opened on their source repository. */ export declare function readSessionMatchesByProjectRoot(meta: SessionSummaryMeta | undefined): boolean; /** * VS Code-side alias for the protocol's open `_meta` property bag on * {@link RootState}. Keys SHOULD be namespaced to avoid collisions; values MUST * be JSON-serializable. */ export type RootMeta = Record; /** * Reserved key under {@link RootMeta} for the well-known host-build payload. * Value at this key, when present, MUST be shaped like {@link IHostBuildInfo}. * This is a VS Code-specific convention layered on top of the protocol's * generic `_meta` bag — the protocol itself does not know about build info. */ export declare const ROOT_META_HOST_BUILD_KEY = "hostBuild"; /** * Build information about the program hosting the agent host (the VS Code CLI), * carried under {@link RootMeta} at {@link ROOT_META_HOST_BUILD_KEY}. Lets a * client see which build is hosting it — useful when inspecting the output of a * remote agent host. * * All fields except {@link version} are optional — a build that does not track * a particular field should omit it. */ export interface IHostBuildInfo { /** Product version (e.g. `1.96.0`). */ readonly version: string; /** Commit SHA of the build, if known. */ readonly commit?: string; /** Build date (ISO 8601), if known. */ readonly date?: string; /** Release quality (e.g. `stable`, `insider`), if known. */ readonly quality?: string; } /** * Derives {@link IHostBuildInfo} from the host's {@link IProductService}. */ export declare function hostBuildInfoFromProduct(productService: IProductService): IHostBuildInfo; /** * Reads the well-known host-build payload from {@link RootMeta}, if present. * Returns `undefined` when the meta bag is absent or the value at the host-build * key is not a plain object with a string `version`. Optional fields with wrong * types are silently dropped. */ export declare function readHostBuildInfo(state: RootState | undefined): IHostBuildInfo | undefined; /** * Returns a new {@link RootMeta} with the host-build payload set to * `buildInfo`, or with the slot removed if `buildInfo` is `undefined`. Returns * `undefined` if the result would be empty. */ export declare function withHostBuildInfo(meta: RootMeta | undefined, buildInfo: IHostBuildInfo | undefined): RootMeta | undefined; /** * Formats {@link IHostBuildInfo} as a short single-line human-readable string, * e.g. `1.96.0 (commit abc1234, 2024-01-02T03:04:05Z, insider)`. */ export declare function formatHostBuildInfo(info: IHostBuildInfo): string;