/**
 * OwlCoda Native Agent Tool
 *
 * Spawns a sub-conversation (sub-agent) with its own tool dispatcher.
 * The sub-agent runs the prompt to completion and returns the result.
 *
 * Supports agent types:
 *   - "general-purpose" (default): all tools available
 *   - "Explore": read-only subset (bash, read, glob, grep)
 */
import type { Conversation } from '../protocol/types.js';
import type { NativeToolDef } from './types.js';
import { type ConversationCallbacks } from '../conversation.js';
import type { TaskPathScope } from '../protocol/types.js';
export interface AgentInput {
    /** Short 3-5 word description of the task */
    description: string;
    /** The full task prompt for the sub-agent */
    prompt: string;
    /** Agent type: "general-purpose" or "Explore" */
    subagent_type?: string;
    /** Optional iteration budget for long-running sub-agent work. */
    max_iterations?: number;
    /**
     * Slice 5: agent artifact contract. When non-empty, the sub-agent MUST
     * touch at least one path matching each expected artifact before the
     * parent considers the run successful. Unmatched artifacts cause the tool
     * to return isError=true even if the sub-agent itself exited cleanly.
     *
     * Text-deliverable / research agents that don't write files should omit
     * this field entirely — absence means "no artifact enforcement".
     */
    expectedArtifacts?: TaskPathScope[];
    /** Parent task ID for traceability (optional). */
    parentTaskId?: string;
    /** Parent step ID for traceability (optional). */
    parentStepId?: string;
}
export declare function getRunningAgents(): Map<string, {
    description: string;
    startTime: number;
}>;
/** Test-only inspection of the module-level semaphore. */
export declare function __getAgentSemaphoreStateForTesting(key?: string): {
    inFlight: number;
    waiting: number;
    max: number;
};
type IsolatedFailureReason = 'max_iterations' | 'no_deliverable' | 'artifact_contract' | 'watchdog_timeout' | 'provider_error' | 'unknown';
interface IsolatedFailureOutputOptions {
    reason: IsolatedFailureReason;
    /**
     * 'failed'  = clean failure, parent can routinely retry/skip/abort.
     * 'partial' = some artifacts produced but not all expected ones,
     *             AND the model did NOT claim completion. Skip+flag is
     *             a safe option.
     * 'inferred' = HIGH RISK: expected artifacts not produced AND the model
     *             claimed completion anyway. Parent must NOT silently skip —
     *             that would propagate a false completion claim into the
     *             final summary. Must verify directly or abort.
     */
    status: 'failed' | 'partial' | 'inferred';
    detail: string;
    /**
     * When true, the upstream provider call was classified as retryable
     * (e.g. rate-limit shape) and owlcoda already retried once before
     * surfacing it. In that case "retry the same prompt" is NOT a useful
     * suggestion — the runtime already tried.
     */
    alreadyAutoRetried?: boolean;
}
export declare function formatIsolatedFailureOutput(opts: IsolatedFailureOutputOptions): string;
export interface AgentToolDeps {
    /** API base URL for sub-agent requests */
    apiBaseUrl: string;
    /** API key */
    apiKey: string;
    /** Model to use for sub-agent */
    model: string;
    /** Resolve the latest active model at execution time. */
    getModel?: () => string;
    /** Resolve the latest context window at execution time. */
    getContextWindow?: () => number;
    /** Max tokens per response */
    maxTokens: number;
    /** Optional callbacks for sub-agent output */
    callbacks?: ConversationCallbacks;
    /** Context window size */
    contextWindow?: number;
}
export declare function createAgentTool(deps: AgentToolDeps): NativeToolDef<AgentInput>;
/**
 * Build a meaningful summary when a sub-agent returned without a final text
 * message. Walks the sub-conversation to surface tools used, the last
 * non-empty assistant text (often the agent describing what it did before
 * running out of iterations), and key metrics. Never returns an empty string.
 */
export declare function summarizeSilentAgent(subConv: Conversation, iterations: number, stopReason: string | null, elapsedSeconds: number): string;
export {};
