import { sessionManager } from './session.js';
export interface CallHelperOpts {
    /** IM thread coordinates — used to pick the same agent the user is
     *  currently chatting with. */
    platform: string;
    channelId: string;
    threadId: string;
    /** Behavioral guidance ("you are X, do Y, do not Z"). Most agents don't
     *  expose a native system role, so we prepend it to the user prompt. */
    systemPrompt: string;
    /** The actual instruction / payload. */
    userPrompt: string;
    /** Hard wall-clock cap. Default 15s. */
    timeoutMs?: number;
    /** Stop accumulating output once this many characters arrive. Defends
     *  against a runaway agent and bounds memory. Default 4 000. */
    maxOutputChars?: number;
    /** Override agent selection. When omitted, resolveActiveAgent() picks. */
    agentName?: string;
}
/**
 * Resolve which agent to use for this thread. Exposed so callers can probe
 * "is an agent available at all?" before composing a heavy prompt.
 *
 * Visible-for-test: takes optional injectable resolvers so unit tests don't
 * need to spin up a real session manager.
 */
export declare function resolveActiveAgent(platform: string, channelId: string, threadId: string, deps?: {
    getExistingSession?: typeof sessionManager.getExistingSession;
    listAgents?: () => string[];
}): Promise<string | null>;
/**
 * Pick the fastest registered agent for a short helper task (noun
 * extraction, intent classification, etc.). Spawn-cost order, lowest first:
 *
 *   1. opencode — HTTP daemon already running; per-call latency ~1–3 s
 *   2. claude-code — fresh subprocess each call; ~5–10 s spawn cost
 *   3. codex — `codex exec` cold start is ~15–30 s; way too slow for
 *      a micro-task that has a 6 s timeout budget
 *   4. any other — fallback to first registered
 *
 * Used for inline LLM helpers that block the IM pipeline (memo-extract's
 * `what` extraction, intent detector). Picking the sticky agent would
 * make a feishu-+-codex user pay 15 s per memo save — unacceptable.
 *
 * Falls through to `resolveActiveAgent` semantics if none of the preferred
 * agents are registered.
 */
export declare function pickFastHelperAgent(deps?: {
    listAgents?: () => string[];
}): string | null;
/**
 * Call a helper agent with composed prompts. Returns trimmed output text or
 * null on any failure / timeout / no-agent.
 *
 * The result is *raw* — JSON parsing, truncation, etc. are caller's job.
 */
export declare function callHelperAgent(opts: CallHelperOpts): Promise<string | null>;
/**
 * Shorthand for "ask the helper agent and parse the first JSON block out
 * of the response". Returns null on parse failure or LLM failure. Callers
 * should validate the shape with their own type guard.
 */
export declare function callHelperForJson<T = unknown>(opts: CallHelperOpts): Promise<T | null>;
//# sourceMappingURL=agent-helper.d.ts.map