import type { Logger } from "pino";
import type { AgentSessionConfig } from "./agent/agent-sdk-types.js";
import type { AgentManager } from "./agent/agent-manager.js";
import type { AgentStorage } from "./agent/agent-storage.js";
import { type GitSetupOptions, type ProjectPlacementPayload, type SessionInboundMessage, type SessionOutboundMessage, type WorkspaceDescriptorPayload } from "./messages.js";
import type { PersistedProjectRecord, PersistedWorkspaceRecord, ProjectRegistry, WorkspaceRegistry } from "./workspace-registry.js";
import type { TerminalManager } from "../terminal/terminal-manager.js";
import { type WorktreeConfig } from "../utils/worktree.js";
export type NormalizedGitOptions = {
    baseBranch?: string;
    createNewBranch: boolean;
    newBranchName?: string;
    createWorktree: boolean;
    worktreeSlug?: string;
};
type EmitSessionMessage = (message: SessionOutboundMessage) => void;
type BuildAgentSessionConfigDependencies = {
    paseoHome?: string;
    sessionLogger: Logger;
    checkoutExistingBranch: (cwd: string, branch: string) => Promise<void>;
    createBranchFromBase: (params: {
        cwd: string;
        baseBranch: string;
        newBranchName: string;
    }) => Promise<void>;
};
type ArchivePaseoWorktreeDependencies = {
    paseoHome?: string;
    agentManager: Pick<AgentManager, "listAgents" | "closeAgent">;
    agentStorage: Pick<AgentStorage, "list" | "remove">;
    archiveWorkspaceRecord: (workspaceId: string) => Promise<void>;
    emit: EmitSessionMessage;
    emitWorkspaceUpdatesForCwds: (cwds: Iterable<string>) => Promise<void>;
    isPathWithinRoot: (rootPath: string, candidatePath: string) => boolean;
    killTerminalsUnderPath: (rootPath: string) => Promise<void>;
};
type RegisterPendingWorktreeWorkspaceDependencies = {
    buildPersistedProjectRecord: (input: {
        workspaceId: string;
        placement: ProjectPlacementPayload;
        createdAt: string;
        updatedAt: string;
    }) => PersistedProjectRecord;
    buildPersistedWorkspaceRecord: (input: {
        workspaceId: string;
        placement: ProjectPlacementPayload;
        createdAt: string;
        updatedAt: string;
    }) => PersistedWorkspaceRecord;
    buildProjectPlacement: (cwd: string) => Promise<ProjectPlacementPayload>;
    projectRegistry: Pick<ProjectRegistry, "get" | "upsert">;
    syncWorkspaceGitWatchTarget: (cwd: string, options: {
        isGit: boolean;
    }) => Promise<void>;
    workspaceRegistry: Pick<WorkspaceRegistry, "get" | "upsert">;
    archiveProjectRecordIfEmpty: (projectId: string, archivedAt: string) => Promise<void>;
};
type CreatePaseoWorktreeInBackgroundDependencies = {
    paseoHome?: string;
    emitWorkspaceUpdateForCwd: (cwd: string, options?: {
        dedupeGitState?: boolean;
    }) => Promise<void>;
    sessionLogger: Logger;
    terminalManager: TerminalManager | null;
};
type HandleCreatePaseoWorktreeRequestDependencies = {
    paseoHome?: string;
    describeWorkspaceRecord: (workspace: PersistedWorkspaceRecord) => Promise<WorkspaceDescriptorPayload>;
    emit: EmitSessionMessage;
    registerPendingWorktreeWorkspace: (options: {
        repoRoot: string;
        worktreePath: string;
        branchName: string;
    }) => Promise<PersistedWorkspaceRecord>;
    sessionLogger: Logger;
    createPaseoWorktreeInBackground: (options: {
        requestCwd: string;
        repoRoot: string;
        baseBranch: string;
        slug: string;
        worktreePath: string;
    }) => Promise<void>;
};
type KillTerminalsUnderPathDependencies = {
    isPathWithinRoot: (rootPath: string, candidatePath: string) => boolean;
    killTrackedTerminal: (terminalId: string, options?: {
        emitExit: boolean;
    }) => void;
    sessionLogger: Logger;
    terminalManager: TerminalManager | null;
};
export declare function buildAgentSessionConfig(dependencies: BuildAgentSessionConfigDependencies, config: AgentSessionConfig, gitOptions?: GitSetupOptions, legacyWorktreeName?: string, _labels?: Record<string, string>): Promise<{
    sessionConfig: AgentSessionConfig;
    worktreeConfig?: WorktreeConfig;
}>;
export declare function normalizeGitOptions(gitOptions?: GitSetupOptions, legacyWorktreeName?: string): NormalizedGitOptions | null;
export declare function assertSafeGitRef(ref: string, label: string): void;
export declare function resolveGitCreateBaseBranch(cwd: string, paseoHome?: string): Promise<string>;
export declare function handlePaseoWorktreeListRequest(dependencies: {
    emit: EmitSessionMessage;
    paseoHome?: string;
}, msg: Extract<SessionInboundMessage, {
    type: "paseo_worktree_list_request";
}>): Promise<void>;
export declare function archivePaseoWorktree(dependencies: ArchivePaseoWorktreeDependencies, options: {
    targetPath: string;
    repoRoot: string;
    requestId: string;
}): Promise<string[]>;
export declare function handlePaseoWorktreeArchiveRequest(dependencies: Omit<ArchivePaseoWorktreeDependencies, "emitWorkspaceUpdatesForCwds"> & {
    emit: EmitSessionMessage;
    emitWorkspaceUpdatesForCwds: (cwds: Iterable<string>) => Promise<void>;
}, msg: Extract<SessionInboundMessage, {
    type: "paseo_worktree_archive_request";
}>): Promise<void>;
export declare function registerPendingWorktreeWorkspace(dependencies: RegisterPendingWorktreeWorkspaceDependencies, options: {
    repoRoot: string;
    worktreePath: string;
    branchName: string;
}): Promise<PersistedWorkspaceRecord>;
export declare function handleCreatePaseoWorktreeRequest(dependencies: HandleCreatePaseoWorktreeRequestDependencies, request: Extract<SessionInboundMessage, {
    type: "create_paseo_worktree_request";
}>): Promise<void>;
export declare function createPaseoWorktreeInBackground(dependencies: CreatePaseoWorktreeInBackgroundDependencies, options: {
    requestCwd: string;
    repoRoot: string;
    baseBranch: string;
    slug: string;
    worktreePath: string;
}): Promise<void>;
export declare function killTerminalsUnderPath(dependencies: KillTerminalsUnderPathDependencies, rootPath: string): Promise<void>;
export {};
//# sourceMappingURL=worktree-session.d.ts.map