import { URI as ResourceURI } from "../../../../base/common/uri.js";
import { IProductService } from "../../../product/common/productService.service.js";
import { TerminalState, ToolResultFileEditContent, type ActiveTurn, type ChangesetState, type URI as ProtocolURI, type RootState, type SessionState, type SessionSummary, type TextRange, type ToolCallCancelledState, type ToolCallCompletedState, type ToolCallResult, type ToolCallState, type ToolResultContent, type ToolResultSubagentContent, type Message } from "./protocol/state.js";
export { ChangesetOperationScope, ChangesetOperationStatus, ChangesetStatus, CustomizationLoadStatus, CustomizationType, MessageAttachmentKind, MessageKind, PendingMessageKind, PolicyState, ResponsePartKind, SessionInputAnswerState, SessionInputAnswerValueKind, SessionInputQuestionKind, SessionInputResponseKind, SessionLifecycle, SessionStatus, ToolCallCancellationReason, ToolCallConfirmationReason, ToolCallContributorKind, ToolCallStatus, ToolResultContentType, TurnState, type ActiveTurn, type AgentCustomization, type AgentInfo, type AgentSelection, type ChangesetFile, type ChangesetOperation, type ChangesetState, type ChangesetSummary, 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 ModelSelection, type PendingMessage, type PluginCustomization, type ProjectInfo, type PromptCustomization, type ReasoningResponsePart, type ResponsePart, type RootState, type RuleCustomization, type SessionActiveClient, type SessionConfigState, type SessionInputAnswer, type SessionInputOption, type SessionInputQuestion, type SessionInputRequest, type SessionModelInfo, type SessionState, type SessionSummary, type SkillCustomization, type Snapshot, type StringOrMarkdown, type TerminalState, type ToolAnnotations, type ToolCallCancelledState, type ToolCallCompletedState, type ToolCallPendingConfirmationState, type ToolCallPendingResultConfirmationState, type ToolCallResponsePart, type ToolCallResult, type ToolCallRunningState, type ToolCallState, type ToolCallStreamingState, type ToolCallContributor, type ToolDefinition, type ToolResultContent, type ToolResultFileEditContent, type ToolResultSubagentContent, type ToolResultTextContent, type Turn, type URI, type UsageInfo, type Message } from "./protocol/state.js";
export { ChangesetOperationTargetKind, type ChangesetOperationFollowUp, type ChangesetOperationTarget } from "./protocol/commands.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:/<encoded>`). */
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 a subagent session URI into its parent session URI and tool call ID.
 * Returns `undefined` if the URI does not follow the subagent convention.
 */
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;
export declare function createSessionState(summary: SessionSummary): SessionState;
export declare function createActiveTurn(id: string, message: Message): ActiveTurn;
export declare enum StateComponents {
    Root = 0,
    Session = 1,
    Terminal = 2,
    Changeset = 3
}
export type ComponentToState = {
    [StateComponents.Root]: RootState;
    [StateComponents.Session]: SessionState;
    [StateComponents.Terminal]: TerminalState;
    [StateComponents.Changeset]: ChangesetState;
};
/**
 * 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<string, unknown>;
/**
 * 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";
/**
 * 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 a `github.com` git remote. */
    readonly hasGitHubRemote?: boolean;
    /** Current branch name. */
    readonly branchName?: string;
    /** Base branch the work targets (e.g. `main`). */
    readonly baseBranchName?: string;
    /** Upstream tracking branch (e.g. `origin/feature`). */
    readonly upstreamBranchName?: 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;
    /** GitHub repository owner parsed from the working copy's GitHub remote (preferring `origin`, falling back to the first GitHub remote). */
    readonly githubOwner?: string;
    /** GitHub repository name parsed from the working copy's GitHub remote (preferring `origin`, falling back to the first GitHub remote). */
    readonly githubRepo?: string;
}
/**
 * Reads the well-known git-state payload from {@link SessionMeta}, if
 * present. Returns `undefined` when the meta bag is absent or the value at
 * the git key 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 readSessionGitState(meta: SessionMeta | undefined): ISessionGitState | undefined;
/**
 * 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;
/**
 * 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<string, unknown>;
/**
 * 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(meta: RootMeta | 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;
