import { type Changeset, type ISessionWithDefaultChat, type URI } from "./state/sessionState.js"; /** Stable id and change kind of the Agent Merge changeset. */ export declare const AGENT_MERGE_CHANGESET_ID = "agent-merge"; /** Localized human-readable label for the branch changeset entry. */ export declare const branchChangesetLabel: () => string; /** Localized human-readable label for the session-wide changeset entry. */ export declare const sessionChangesetLabel: () => string; /** Localized human-readable description for the session-wide changeset entry. */ export declare const sessionChangesetDescription: () => string; /** Localized human-readable label for the uncommitted-changes changeset entry. */ export declare const uncommittedChangesetLabel: () => string; /** Localized human-readable description for the uncommitted-changes changeset entry. */ export declare const uncommittedChangesetDescription: () => string; /** Localized human-readable label for the per-turn changeset template entry. */ export declare const thisTurnChangesetLabel: () => string; /** Localized human-readable description for the per-turn changeset template entry. */ export declare const thisTurnChangesetDescription: () => string; /** Localized human-readable label for the compare-turns changeset template entry. */ export declare const compareTurnsChangesetLabel: () => string; /** Localized human-readable description for the compare-turns changeset template entry. */ export declare const compareTurnsChangesetDescription: () => string; /** * Describes Branch Changes using the explicitly resolved base rather than inferring it from Git state. */ export declare function formatBranchChangesetDescription(branchName: string | undefined, baseBranchName: string | undefined): string | undefined; /** Discriminates the well-known changeset URI shapes. */ export declare enum ChangesetKind { Branch = "branch", Uncommitted = "uncommitted", Session = "session", Turn = "turn", Compare = "compare-turns", WorkingSet = "working-set", /** Producer-defined id we don't recognise (single-segment only). */ Unknown = "unknown" } /** * Resolves the selectable catalogue for a chat and the owner of each entry. * * A chat that advertises its own Session Changes entry keeps it, scoping * Session Changes to that chat. Otherwise the session's cumulative Session * Changes entry is projected into the chat catalogue. The session's Working Set * entry is not projected. `defaultChatUri` is the session's advertised default * chat (`SessionState.defaultChat`). */ export declare function resolveChatChangesetCatalogue(chatUri: URI, chatChangesets: readonly Changeset[] | undefined, allSessionChangesets: readonly Changeset[] | undefined, defaultChatUri: URI | undefined): readonly { readonly changeset: Changeset; readonly owner: "chat" | "session"; }[] | undefined; /** Changeset kinds that can represent a session's default changes view. */ export type DefaultChangesetKind = ChangesetKind.Branch | ChangesetKind.Uncommitted | ChangesetKind.Session; /** Selects the configured default changeset, falling back to the first catalogue entry. */ export declare function selectDefaultChangeset>(changesets: readonly T[] | undefined, defaultKind?: DefaultChangesetKind): T | undefined; /** * Resolve a {@link Changeset.uriTemplate} from a session's catalogue into a * subscribable URI template. * * A host may publish the template relative to the session channel * (`changeset/branch`); used verbatim that addresses the client's own * filesystem. Templates that already carry a scheme are returned unchanged. */ export declare function resolveChangesetUriTemplate(sessionUri: URI, uriTemplate: string): string; export declare function buildBranchChangesetUri(sessionUri: URI): URI; /** Builds the session-scoped owner URI for one effective folder/worktree scope. */ export declare function buildFolderChangesetOwnerUri(sessionUri: URI, scopeId: string): URI; /** Parses a folder changeset owner URI into its containing session and opaque scope id. */ export declare function parseFolderChangesetOwnerUri(ownerUri: URI): { sessionUri: URI; scopeId: string; } | undefined; /** Returns the subscribable URI for the session-wide changeset. */ export declare function buildSessionChangesetUri(sessionUri: URI): URI; /** Returns the subscribable URI for the working-set changeset of a session or chat. */ export declare function buildWorkingSetChangesetUri(ownerUri: URI): URI; /** Returns the subscribable URI for the uncommitted-changes changeset. */ export declare function buildUncommittedChangesetUri(sessionUri: URI): URI; /** * Returns the URI _template_ that catalogue entries advertise for the * per-turn changeset; clients expand `{turnId}` to build the * subscribable URI via {@link buildTurnChangesetUri}. */ export declare function buildTurnChangesetUriTemplate(sessionUri: URI): URI; /** Returns the subscribable URI for the per-turn changeset of `turnId`. */ export declare function buildTurnChangesetUri(sessionUri: URI, turnId: string): URI; /** * Returns the URI _template_ that catalogue entries advertise for the * compare-turns changeset; clients expand both `{originalTurnId}` and * `{modifiedTurnId}` to build the subscribable URI via * {@link buildCompareTurnsChangesetUri}. */ export declare function buildCompareTurnsChangesetUriTemplate(sessionUri: URI): URI; /** * Returns the subscribable URI for the compare-turns changeset between * `originalTurnId` (the "from" endpoint) and `modifiedTurnId` (the "to" * endpoint). Diff direction is `originalTurnId → modifiedTurnId`. */ export declare function buildCompareTurnsChangesetUri(sessionUri: URI, originalTurnId: string, modifiedTurnId: string): URI; /** * Returns the subscribable URI for an opaque, producer-defined * `changesetId`. The id must not contain `/` — well-known multi-segment * shapes have dedicated builders (e.g. {@link buildTurnChangesetUri}). */ export declare function buildChangesetUri(sessionUri: URI, changesetId: string): URI; /** * Parses a changeset URI back into its owner, id, and kind, or returns * `undefined` if `uri` is not a changeset URI we recognise. `sessionUri` is * set for session- and folder-owned changesets; the session of a chat-owned * changeset is that chat's recorded owner (see {@link changesetSession}). */ export declare function parseChangesetUri(uri: URI): { ownerUri: URI; sessionUri: URI | undefined; changesetId: string; kind: ChangesetKind; turnId?: string; originalTurnId?: string; modifiedTurnId?: string; } | undefined; /** The session containing a parsed changeset's owner, resolving a chat owner through its recorded owner. */ export declare function changesetSession(parsed: { readonly ownerUri: URI; readonly sessionUri: URI | undefined; }, getChatOwner: (chat: URI) => URI | undefined): URI | undefined; /** Returns `true` iff `uri` looks like a changeset URI we recognise. */ export declare function isChangesetUri(uri: URI): boolean; /** Returns `true` iff `uri` is the session-wide changeset URI. */ export declare function isSessionChangesetUri(uri: URI): boolean; /** Returns `true` iff `uri` is the uncommitted-changes changeset URI. */ export declare function isUncommittedChangesetUri(uri: URI): boolean; /** Returns the parsed turn id when `uri` is a per-turn changeset URI. */ export declare function parseTurnChangesetUri(uri: URI): { ownerUri: URI; turnId: string; } | undefined; /** Returns the parsed turn ids when `uri` is a compare-turns changeset URI. */ export declare function parseCompareTurnsChangesetUri(uri: URI): { ownerUri: URI; originalTurnId: string; modifiedTurnId: string; } | undefined; /** * Builds the ordered changeset catalogue for a session or chat channel. * Aggregate counts are filled in later by the diff producer as compute passes * complete. * * Ready session channels advertise the cumulative Session Changes entry, and * the Working Set entry with the session's changes that the user hasn't * accepted. The default chat is created together with the session and owns the temporary * uncommitted entry while the session is being created, as well as its * repository and turn catalogue after materialization. Peer chats additionally * advertise their own Session Changes entry, scoped to the edits made in that * chat, in place of the session's cumulative entry. * * The first two chat entries (`Branch`, `Uncommitted`) are * included only when Git state is available. The backing per-changeset states * are still registered for every owner; only the catalogue advertisement is * conditional. * * The Agent Merge entry is advertised by the chat that owns the enabled folder. * It uses the chat-owned compare-turns URI template because the repair range * belongs to that chat, and remains available after Agent Merge is disabled. * When chats share the folder, `resolveAgentMergeOwner` picks the one chat * whose transcript the repairs run in. * `branchChangesetOwnerUri` lets matching chat catalogues share one repository-level Branch Changes resource. * `isDefaultChat` is whether `ownerUri` is its session's recorded default chat. * `workspaceless` is the owner's own decision: the per-chat decision for a chat channel, the session marker for the session channel. * `branchChangesetBaseBranch` is resolved by the host using the same precedence as the branch diff. */ export declare function buildDefaultChangesetCatalog(ownerUri: URI, isDefaultChat: boolean, workspaceless: boolean, state?: ISessionWithDefaultChat, branchChangesetOwnerUri?: URI, resolveAgentMergeOwner?: (folderKey: string, recordedChat: URI | undefined) => URI | undefined, branchChangesetBaseBranch?: string): Changeset[];