/**
 * Team management commands for organizing multi-agent collaboration.
 *
 * Implements `agents teams` -- create named teams, add teammates (background
 * agent processes), check status with session-aware previews, manage DAG
 * dependencies between teammates, and clean up when work is done.
 */
import type { Command } from 'commander';
import { AgentManager, AgentStatus, type TaskType } from '../lib/teams/agents.js';
import type { DispatchOptions } from '../lib/cloud/types.js';
import { type TaskInfo } from '../lib/teams/api.js';
import { type TeamRow } from './teams-picker.js';
import { type TeamSpawner } from '../lib/session/db.js';
import type { AgentProcess } from '../lib/teams/agents.js';
type TeamRegistry = Record<string, {
    created_at: string;
    description?: string;
}>;
export interface TeamListAgentSnapshot {
    agent_id: string;
    task_name: string;
    agent_type: string;
    status: string;
    prompt: string;
    started_at: string;
    completed_at: string | null;
    workspace_dir: string | null;
    version: string | null;
    remote_session_id: string | null;
    name: string | null;
    after: string[];
    task_type: TaskType | null;
    host: string | null;
    mode: string | null;
    cloud_session_id: string | null;
    cloud_provider: string | null;
    pr_url: string | null;
}
/**
 * One-line operator nudge after `teams start`: teammates are briefed to post
 * IMPORTANT milestones to the feed (RUSH-2250), and this is how to watch them.
 * Print-only — no engine behavior.
 */
export declare function printFeedHint(team: string): void;
/** Where `teams message`/`teams resume` routes a follow-up, by teammate status. */
export type TeamMessageRoute = {
    kind: 'steer';
} | {
    kind: 'resume';
} | {
    kind: 'need-message';
} | {
    kind: 'not-started';
};
/**
 * Decide how a follow-up to a teammate is delivered from its reconciled status.
 * Pure — the source of truth for the routing table, unit-tested without I/O.
 *   - pending                       -> not-started (tell them to `teams start`)
 *   - running     + message         -> steer (mailbox)
 *   - stopped/etc + message         -> resume (re-enter session)
 *   - any actionable + no message   -> need-message
 */
export declare function decideTeamMessageRoute(status: AgentStatus, hasMessage: boolean): TeamMessageRoute;
/**
 * Tell the user a worktree from a failed `teams add` is still on disk, and give
 * them the exact commands to remove it. Reached only when we could not remove it
 * ourselves — a leftover `agents/<name>` branch is what makes the retry fail with
 * `fatal: a branch ... already exists`, so it must never be silent (RUSH-2356).
 */
/**
 * Tear down a worktree a failed operation left behind — but ONLY if it is a
 * genuine orphan.
 *
 * Extracted because this guard was hand-duplicated at two call sites (`teams
 * add` and the pr-watch fixer) and the copy at the fixer path was written
 * WITHOUT it, which is RUSH-2356 reoccurring at the one site that skipped the
 * check. One implementation, one place to get it right.
 *
 * The two errors here are not symmetric, so the guard deliberately fails
 * CLOSED: a spurious "claimed" strands a branch a human can delete, while a
 * spurious "unclaimed" runs `git worktree remove --force` over a live
 * teammate's checkout and destroys uncommitted work. So an unreadable record
 * means "leave it alone and tell the user", never "assume it is free".
 *
 * A staged teammate is exactly the case that makes this necessary: `spawn()`
 * persists its meta.json and only THEN runs the retention pass, which refreshes
 * every sibling and can throw on a distributed one — so a failure can land here
 * with a live, durably-recorded, merely-pending `--after` teammate already
 * owning this worktree.
 */
export declare function tearDownOrphanWorktree(mgr: AgentManager, baseCwd: string, name: string): Promise<void>;
/**
 * The blocking message when `teams add` is pointed at a stale checkout. Pure so
 * the guidance is pinned by tests (mirrors `remoteCwdOnAddError`): it MUST name
 * how far behind, tell the caller to sync with remote main, and mention `--confirm`
 * as the override.
 */
export declare function staleRepoError(params: {
    team: string;
    where: string;
    behind: number;
    base: string;
    sync: string;
}): string;
/**
 * Register the generic cloud dispatcher — staged cloud teammates get
 * dispatched when their --after deps resolve, using repo/branch stored on
 * the teammate itself so we don't need the original --cloud CLI args.
 */
export declare function wireCloudDispatcher(mgr: AgentManager): void;
export declare function cloudDispatchOptions(agent: Pick<AgentProcess, 'prompt' | 'agentType' | 'cloudRepo' | 'cloudBranch' | 'model' | 'mode'>): DispatchOptions;
/**
 * Single-wave start used by `teams start` without --watch. startReady()
 * terminalizes a placement/spawn/cloud/dependency failure to FAILED with
 * evidence rather than leaving it PENDING, so a teammate that failed this wave
 * appears in neither `launched` nor `still_pending` — it must be diffed against
 * the pre-wave roster and reported explicitly, or the wave reads as a success.
 * A wave that only produced failures sets a non-zero exit code.
 */
export declare function runOneWave(mgr: AgentManager, team: string, json: boolean): Promise<void>;
export declare function buildTeamRowsFromSnapshots(registry: TeamRegistry, agents: TeamListAgentSnapshot[], 
/** team name -> the session that spawned it (see teamSpawners). */
spawners?: Map<string, TeamSpawner>): Promise<{
    rows: TeamRow[];
    teams: TaskInfo[];
    names: string[];
}>;
/**
 * `teams add --remote-cwd` is a no-op trap. `--remote-cwd` comes from the shared
 * `--device` option family (option.ts) and is meaningful for commands that *route*
 * to a host, but `teams add` special-cases `--device`/`--device` as PLACEMENT, so
 * the flag is never read — a teammate's directory is the team's repo plus its
 * `--worktree`, not a path passed here. Silently ignoring it misleads you into
 * thinking it set the teammate's repo path (the exact wrong model that turns one
 * team into a teardown-and-rebuild). Reject with guidance instead. Exported for
 * the unit test that pins the message.
 */
export declare function remoteCwdOnAddError(team: string): string;
/** Register the `agents teams` command tree (list, create, add, status, start, remove, disband, logs, doctor). */
export declare function registerTeamsCommands(program: Command): void;
export {};
