import { AgentManager, type TaskType, type TeammateFailure } from './agents.js';
import { AgentType } from './parsers.js';
export interface ToolCallDetail {
    tool: string;
    summary: string;
    timestamp: string | null;
}
/** Result returned after spawning a new teammate. */
export interface SpawnResult {
    task_name: string;
    agent_id: string;
    agent_type: string;
    status: string;
    started_at: string;
    version?: string | null;
    profile_name?: string | null;
    remote_session_id?: string | null;
    name?: string | null;
    after?: string[];
    task_type?: TaskType | null;
    cloud_provider?: string | null;
    cloud_session_id?: string | null;
    /** Device name the teammate runs on for a distributed (--on) teammate; null for local. */
    host?: string | null;
    /** Sanitized evidence observed at the lifecycle boundary that failed. */
    failure?: TeammateFailure | null;
}
/** Detailed status of a single teammate, including file ops, commands, and a cursor for delta polling. */
export interface AgentStatusDetail {
    agent_id: string;
    agent_type: string;
    status: string;
    prompt: string;
    started_at: string;
    completed_at: string | null;
    duration: string | null;
    files_created: string[];
    files_modified: string[];
    files_read: string[];
    files_deleted: string[];
    bash_commands: string[];
    recent_tool_calls: ToolCallDetail[];
    last_messages: string[];
    tool_count: number;
    has_errors: boolean;
    cursor: string;
    mode?: string;
    cloud_session_id?: string | null;
    cloud_provider?: string | null;
    pr_url?: string | null;
    /**
     * Delivery postcondition (RUSH-2380), distinct from process `status`.
     * `pr_open` when the process completed but left an unmerged PR — orchestrators
     * must not treat that as "work landed on main".
     */
    delivery?: string;
    version?: string | null;
    remote_session_id?: string | null;
    session_label?: string | null;
    name?: string | null;
    after?: string[];
    task_type?: TaskType | null;
    /** Device name the teammate runs on for a distributed (--on) teammate; null for local. */
    host?: string | null;
    /** Absolute path to the teammate's worktree, when known. */
    workspace_dir?: string | null;
    /** Sanitized evidence observed at the lifecycle boundary that failed. */
    failure?: TeammateFailure | null;
}
/** Aggregated status of all teammates in a task, with per-status counts and a global cursor. */
export interface TaskStatusResult {
    task_name: string;
    agents: AgentStatusDetail[];
    summary: {
        pending: number;
        running: number;
        completed: number;
        stranded: number;
        failed: number;
        stopped: number;
    };
    cursor: string;
}
/**
 * Compact per-teammate snapshot for the default `teams status` view.
 *
 * The detail shape (`AgentStatusDetail`) carries the full prompt (often many
 * KB), every absolute path the agent has touched, and uncapped message
 * bodies. That's the right shape for programmatic consumers, but it makes
 * `teams status` unreadable for orchestrators who only need: what state are
 * you in, what did you just do, what files have you touched.
 *
 * Use {@link toAgentStatusSummary} to derive this from a detail record.
 */
export interface AgentStatusSummary {
    agent_id: string;
    name: string | null;
    agent_type: string;
    status: string;
    /** Delivery postcondition — see {@link AgentStatusDetail.delivery}. */
    delivery?: string;
    duration: string | null;
    tool_count: number;
    has_errors: boolean;
    pr_url: string | null;
    files: {
        /** Count of files modified since the cursor (delta), plus basenames. */
        modified: {
            count: number;
            names: string[];
        };
        created: {
            count: number;
            names: string[];
        };
        deleted: {
            count: number;
            names: string[];
        };
        /** Read is noisy (per-Read events fire constantly); only emit a count. */
        read: {
            count: number;
        };
    };
    /** Already capped at 15 × 120 chars by the detail builder. */
    bash_commands: string[];
    /** Last 3 messages, each body trimmed to ~400 chars. */
    last_messages: string[];
    /** Device name for a distributed (--on) teammate; null for local. */
    host: string | null;
    failure: TeammateFailure | null;
    /** Absolute path to the teammate's worktree, when known. */
    workspace_dir?: string | null;
    /** ISO timestamp — feed back via --since for delta polling. */
    cursor: string;
}
/** Compact aggregated result; mirrors {@link TaskStatusResult} but agents[] is the summary shape. */
export interface TaskStatusSummaryResult {
    task_name: string;
    agents: AgentStatusSummary[];
    summary: {
        pending: number;
        running: number;
        completed: number;
        stranded: number;
        failed: number;
        stopped: number;
    };
    cursor: string;
}
/**
 * Project a full AgentStatusDetail down to a compact AgentStatusSummary.
 * Drops `prompt` entirely (caller knows what they queued), folds file lists
 * to basenames + counts, caps `last_messages` to 3 × {@link SUMMARY_MESSAGE_MAX_CHARS}.
 */
export declare function toAgentStatusSummary(detail: AgentStatusDetail): AgentStatusSummary;
/** Project a full TaskStatusResult down to the compact summary shape. */
export declare function toTaskStatusSummary(result: TaskStatusResult): TaskStatusSummaryResult;
/** Result of stopping one or more teammates. */
export interface StopResult {
    task_name: string;
    stopped: string[];
    already_stopped: string[];
    not_found: string[];
}
/** Summary metadata for a single task (team), including agent counts by status and timestamps. */
export interface TaskInfo {
    task_name: string;
    agent_count: number;
    pending: number;
    running: number;
    completed: number;
    /** Completed teammates with uncommitted work and no PR (PHNX-2951). */
    stranded: number;
    failed: number;
    stopped: number;
    workspace_dir: string | null;
    created_at: string;
    modified_at: string;
}
/** Paginated list of tasks sorted by most recent activity. */
export interface TasksResult {
    tasks: TaskInfo[];
}
/** Spawn a new teammate in a task and return its initial metadata. */
export declare function handleSpawn(manager: AgentManager, taskName: string, agentType: AgentType, prompt: string, cwd: string | null, mode: string | null, effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto' | null, parentSessionId?: string | null, workspaceDir?: string | null, version?: string | null, name?: string | null, after?: string[], model?: string | null, envOverrides?: Record<string, string> | null, taskType?: TaskType | null, cloudProvider?: string | null, cloudSessionId?: string | null, cloudRepo?: string | null, cloudBranch?: string | null, worktreeName?: string | null, worktreePath?: string | null, profileName?: string | null, hostName?: string | null, hostTarget?: string | null, repoPath?: string | null, 
/** The team's `--project`; grants resolve from it at launch. */
project?: string | null): Promise<SpawnResult>;
/** Retrieve the current status of all teammates in a task, with optional timestamp-based delta filtering. */
export declare function handleStatus(manager: AgentManager, taskName: string | null | undefined, filter?: string, since?: string, // Optional ISO timestamp - return only events after this time
parentSessionId?: string | null): Promise<TaskStatusResult>;
/** List all known tasks grouped by task name, sorted by most recent activity. */
export declare function handleTasks(manager: AgentManager, limit?: number): Promise<TasksResult>;
/** Stop a specific teammate or all teammates in a task. */
export declare function handleStop(manager: AgentManager, taskName: string, agentId?: string): Promise<StopResult | {
    error: string;
}>;
