import type { AgentSlotConfig, TemplateAgentRef, ThreadTemplate } from '../../core/types/thread-types.js'; /** Resolve the `__active__` agent ref placeholder to the currently active default agent * (set by `!agent`). Falls back to `'main'` when no default is configured. Other names * pass through unchanged. */ export declare function resolveActiveAgentName(name: string): string; /** Replace {{systemVar}} placeholders with system variable values. Unknown vars are left as-is. */ export declare function resolveSystemVars(text: string): string; /** Resolve a TemplateAgentRef to a full AgentSlotConfig by merging agent definition with optional overrides. */ export declare function resolveAgentSlotConfig(ref: TemplateAgentRef): AgentSlotConfig | null; /** Resolve a single agent name to AgentSlotConfig (for ad-hoc threads) */ export declare function resolveAgentSlotConfigByName(agentName: string): AgentSlotConfig | null; /** Resolve all agent refs in a template to AgentSlotConfigs */ export declare function resolveTemplateAgents(template: ThreadTemplate): AgentSlotConfig[]; /** Resolve the unique profile names a template's agents will actually run with. * Mirrors thread-runner profile resolution (runner.ts): hardcoded agent profiles win; * `__active__` slots resolve to `activeProfile` (the dispatch/scheduler profile that * would be injected via metadata.profileOverride). Null/empty entries are dropped. * Unknown template or no resolvable agents → [] (fail-open; callers decide fallback). */ export declare function resolveTemplateProfiles(templateName: string, activeProfile: string | null): string[]; /** Render an `(agent, stage)` pair as the canonical endpoint string used for iterationCounts keys * and transition-rule matching. Stages that are null render as bare agent names. */ export declare function formatEndpoint(agent: string, stage: string | null): string; /** Pick the prompt template for this step. For stage-aware agents, use `stages[stage]`; * otherwise fall back to the agent-level `promptTemplate` (single-stage legacy path). */ export declare function pickStepTemplate(agentConfig: AgentSlotConfig, stage: string | null): { template: string; continuesSession: boolean; }; /** System-level protocol preamble injected into every step prompt of threads that own a workspace artifact. */ export declare const THREAD_PROTOCOL_PREAMBLE: string; export declare function buildStepPrompt(threadId: string, agentConfig: AgentSlotConfig, stage?: string | null): string; /** * Assemble the prompt for a single plain user-conversation turn — the thread-independent * counterpart of buildStepPrompt. Plain user messages are NOT wrapped in a thread, so there * is no thread record, artifact, previous step, or transition to consider. * * Fidelity with the legacy default-thread path (templateName='default', isUserInitiated=true): * - applies the default agent's promptTemplate (typically `{{input}}`) with empty thread vars; * - prepends the agent directive (resolved for {{systemVar}}); * - prepends the user profile (loadUserContext) — plain conversation is the ONLY path that * injects USER.md; it is on by default unless CORTEX_DISABLE_USER_CONTEXT=1. Thread steps * (buildStepPrompt) never inject it. The caller gates it via opts.includeUserContext so the * profile is sent only on a session's FIRST turn (session resume keeps it in history thereafter); * - NEVER injects THREAD_PROTOCOL_PREAMBLE (no artifact, no [ABORT] protocol for conversations). */ export declare function buildConversationPrompt(agentConfig: AgentSlotConfig, input: string, opts?: { includeUserContext?: boolean; }): string;