import { IObservable } from "../../base/common/observable.js"; import { ThemeIcon } from "../../base/common/themables.js"; import { URI } from "../../base/common/uri.js"; import type { ISessionGitState } from "../../platform/agentHost/common/state/sessionState.js"; import { IConfigurationService } from "../../platform/configuration/common/configuration.service.js"; import { IGitHubInfo, ISessionWorkspace } from "../services/sessions/common/session.js"; export interface IAgentHostSessionProjectSummary { readonly uri: URI; readonly displayName: string; } export interface IAgentHostSessionWorkspaceOptions { readonly providerLabel?: string; readonly fallbackIcon: ThemeIcon; readonly requiresWorkspaceTrust: boolean; readonly description?: string; /** * Group label used by the workspace picker to bucket the produced * workspace into a top-level tab (e.g. `"Local"`, `"Remote"`). */ readonly group?: string; /** * Configured `git.branchProtection` glob patterns. Used to compute * `baseBranchProtected` on the resulting repository. */ readonly branchProtectionPatterns?: readonly string[]; /** Overrides the inferred folder/worktree type icon. See {@link ISessionWorkspace.typeIcon}. */ readonly typeIcon?: ThemeIcon; } /** * Returns true when `branchName` matches any of the configured * `git.branchProtection` glob patterns. */ export declare function matchesAnyBranchProtectionPattern(branchName: string, patterns: readonly string[] | undefined): boolean; /** * Reads `git.branchProtection` from configuration and normalizes the result * into an array of trimmed, non-empty pattern strings. * * The `git.branchProtection` setting is `resource`-scoped, so the value can * differ between workspace folders. Pass the session's working directory (or * project URI as a fallback) as `resource` so we read the setting in the * scope of the folder VS Code actually has loaded rather than the host * window's active workspace. */ export declare function readBranchProtectionPatterns(configurationService: IConfigurationService, resource?: URI): readonly string[]; export declare function agentHostSessionWorkspaceKey(workspace: ISessionWorkspace | undefined): string | undefined; /** Resolves the GitHub info a session folder reports, by working directory. */ export type IFolderGitHubInfoResolver = (workingDirectory: URI) => IObservable | undefined; /** * Projects a chat's working-directory scope onto its owning session workspace. * Returns no workspace rather than exposing a partial scope when a required folder is unavailable. * Pass `resolveDetachedFolders` for a chat whose folders are intentionally detached from the * session workspace, such as an archived chat, so those folders are resolved on their own. * * Pass `getFolderGitHubInfo` to have each folder report its own repository and * pull request information instead of what the session workspace carries. * Pass `gitState` to project the chat scope's branch state onto its primary folder. */ export declare function buildAgentHostChatWorkspace(sessionWorkspace: ISessionWorkspace | undefined, workingDirectories: readonly URI[] | undefined, getFolderGitHubInfo?: IFolderGitHubInfoResolver, gitState?: ISessionGitState, resolveDetachedFolders?: boolean): ISessionWorkspace | undefined; /** Membership test over a session's host scratch folders (`vscode.scratchFolders`). */ export interface IAgentHostScratchFolders { has(folder: URI): boolean; } /** Removes host scratch folders from `workingDirectories`; they are internal and never shown or used as roots. */ export declare function withoutScratchFolders(workingDirectories: readonly URI[], scratchFolders: IAgentHostScratchFolders | undefined): readonly URI[]; /** * Like {@link buildAgentHostChatWorkspace}, for a session that reports host scratch folders. * Scratch folders are never shown: a chat working only in scratch folders has no workspace, and a * chat with folders of its own in a session without a workspace (a quick chat) gets a workspace of * those folders from `buildOwnWorkspace`, each reporting its own GitHub info. Without `scratchFolders` (an older host) this is * {@link buildAgentHostChatWorkspace}. */ export declare function buildAgentHostChatWorkspaceWithScratchFolders(sessionWorkspace: ISessionWorkspace | undefined, workingDirectories: readonly URI[] | undefined, scratchFolders: IAgentHostScratchFolders | undefined, buildOwnWorkspace: (workingDirectories: readonly URI[]) => ISessionWorkspace | undefined, getFolderGitHubInfo: IFolderGitHubInfoResolver | undefined, gitState: ISessionGitState | undefined, resolveDetachedFolders: boolean): ISessionWorkspace | undefined; export declare function buildAgentHostSessionWorkspace(project: IAgentHostSessionProjectSummary | undefined, workingDirectories: readonly URI[] | undefined, options: IAgentHostSessionWorkspaceOptions, gitHubInfo: IObservable, gitState?: ISessionGitState): ISessionWorkspace | undefined;