import type { RudderSkillEntry } from "@rudderhq/agent-runtime-utils/server-utils";
import type { Db } from "@rudderhq/db";
import type { ProjectResourceAttachment } from "@rudderhq/shared";
export type AgentRunScene = "chat" | "heartbeat";
export type AgentRunContextAgent = {
    id: string;
    orgId: string;
    name: string;
    workspaceKey?: string | null;
    status?: string | null;
    agentRuntimeType: string;
    agentRuntimeConfig: unknown;
    metadata?: Record<string, unknown> | null;
};
export type ResolvedWorkspaceForRun = {
    cwd: string;
    source: "project_primary" | "task_session" | "agent_home";
    projectId: string | null;
    workspaceId: string | null;
    repoUrl: string | null;
    repoRef: string | null;
    workspaceHints: Array<{
        workspaceId: string;
        cwd: string | null;
        repoUrl: string | null;
        repoRef: string | null;
    }>;
    warnings: string[];
};
type ProjectWorkspaceCandidate = {
    id: string;
};
type BuildSceneContextInput = {
    scene: AgentRunScene;
    agent: AgentRunContextAgent;
    resolvedWorkspace: ResolvedWorkspaceForRun;
    runtimeConfig: Record<string, unknown>;
    executionWorkspace?: {
        cwd: string;
        source: string | null;
        strategy: string | null;
        projectId: string | null;
        workspaceId: string | null;
        repoUrl: string | null;
        repoRef: string | null;
        branchName: string | null;
        worktreePath: string | null;
    } | null;
    executionWorkspaceMode?: string | null;
};
type PreparedAgentRunConfig = {
    resolvedConfig: Record<string, unknown>;
    runtimeConfig: Record<string, unknown>;
    runtimeSkillEntries: RudderSkillEntry[];
    secretKeys: Set<string>;
};
export declare function prioritizeProjectWorkspaceCandidatesForRun<T extends ProjectWorkspaceCandidate>(rows: T[], preferredWorkspaceId: string | null | undefined): T[];
export declare function isHiddenSystemAgentMetadata(metadata: unknown): boolean;
export declare function agentRunContextService(db: Db): {
    buildSceneContext: (input: BuildSceneContextInput) => Promise<{
        rudderScene: AgentRunScene;
        rudderWorkspace: {
            cwd: string;
            source: string;
            mode: string;
            strategy: string | null;
            projectId: string | null;
            workspaceId: string | null;
            repoUrl: string | null;
            repoRef: string | null;
            branchName: string | null;
            worktreePath: string | null;
            executionWorkspaceCwd: string;
            executionWorkspaceSource: string;
            agentHome: string;
            agentRoot: string;
            instructionsDir: string;
            memoryDir: string;
            lifeDir: string;
            agentSkillsDir: string;
            orgWorkspaceRoot: string;
            orgAgentsDir: string;
            orgSkillsDir: string;
            orgPlansDir: string;
            orgArtifactsDir: string;
            resourcesPrompt: string;
            orgResourcesPrompt: string;
        };
        rudderResourcesPrompt: string;
        rudderResources: ProjectResourceAttachment[];
        rudderOrganizationResources: never[];
        rudderProjectResources: ProjectResourceAttachment[];
        rudderOrgNotes: string;
        rudderWorkspaces: {
            workspaceId: string;
            cwd: string | null;
            repoUrl: string | null;
            repoRef: string | null;
        }[];
        rudderRuntimeServiceIntents: Record<string, unknown>[] | undefined;
    }>;
    isHiddenSystemAgentMetadata: typeof isHiddenSystemAgentMetadata;
    prepareRuntimeConfig: (input: {
        scene: AgentRunScene;
        agent: AgentRunContextAgent;
        baseConfig?: Record<string, unknown> | null;
    }) => Promise<PreparedAgentRunConfig>;
    resolveWorkspaceForRun: (agent: AgentRunContextAgent, context: Record<string, unknown>, previousSessionParams: Record<string, unknown> | null, opts?: {
        useProjectWorkspace?: boolean | null;
    }) => Promise<ResolvedWorkspaceForRun>;
};
export {};
//# sourceMappingURL=agent-run-context.d.ts.map