export type SubagentStatus = "spawning" | "running" | "ended";
export type SubagentOutcome = "ok" | "error" | "timeout" | "killed" | "reset" | "deleted";
export type SubagentEntry = {
    childSessionKey: string;
    runId?: string;
    parentRunId?: string;
    deviceId: string;
    label?: string;
    depth: number;
    status: SubagentStatus;
    outcome?: SubagentOutcome;
    error?: string;
};
export type SubagentMeta = {
    label?: string;
    parentRunId?: string;
    depth: number;
};
type SpawnIntent = {
    label?: string;
    parentRunId: string;
    deviceId: string;
    depth: number;
    requesterSessionKey?: string;
};
/** Called by forwardAgentEventRaw on lifecycle start so we can resolve parentRunId. */
export declare function registerSessionKeyForRun(sessionKey: string, runId: string): void;
/** Look up subagent entry by any runId form (announce compound or bare). */
export declare function lookupByRunId(runId: string): SubagentEntry | undefined;
/** Look up subagent entry by childSessionKey. */
export declare function lookupByChildSessionKey(key: string): SubagentEntry | undefined;
/**
 * Called on sessions_spawn item.start (before tool execution).
 * Stores the spawn intent so spawning SSE can be emitted immediately.
 */
export declare function registerSpawnIntent(params: {
    toolCallId: string;
    label?: string;
    deviceId: string;
    parentRunId: string;
    requesterSessionKey?: string;
}): SpawnIntent;
/** Consume a previously registered spawn intent. Returns undefined if none. */
export declare function consumeSpawnIntent(toolCallId: string): SpawnIntent | undefined;
/**
 * Called when forwardAgentEventRaw sees a sessions_spawn tool result.
 * Extracts childSessionKey, runId, taskName and registers the subagent.
 */
export declare function ensureSubagentFromSpawnTool(params: {
    childSessionKey: string;
    bareRunId?: string;
    label?: string;
    deviceId: string;
    parentRunId: string;
    requesterSessionKey?: string;
    depth?: number;
}): SubagentEntry;
/** Mark subagent as ended. Resolves by bare/compound runId or childSessionKey. */
export declare function registerEnded(params: {
    runId?: string;
    childSessionKey?: string;
    outcome?: SubagentOutcome;
    error?: string;
}): SubagentEntry | undefined;
/** Extract subagent metadata for SSE annotation. */
export declare function subagentMeta(entry: SubagentEntry): SubagentMeta;
export declare function resetForTest(): void;
export {};
