/**
 * agent_bridge — shared types (WAB.2, 0.5.94).
 *
 * Authoritative source: `docs/tasks/WAB.1-architecture.md` decisions (b) +
 * (c), and `docs/tasks/T-warm-agent-chat-bridge.md` WAB.2 spec.
 *
 * Why one types module: all six WAB sub-modules (event_bus, transport_bridge,
 * session_manager, agent_loop, batch, dispatcher) share the SessionKey +
 * InboundChatEvent + OutboundChatReply contracts. Inlining them per-module
 * would either duplicate the zod schemas (drift risk) or chain imports
 * deeply (re-export thrash). One types module + barrel re-export keeps
 * the public surface flat for consumers.
 *
 * Schema validation discipline: every type that crosses an external
 * boundary (chokidar-watched JSONL file, MCP tool args, future RPC) has a
 * zod schema declared next to its TS interface; the schema is the runtime
 * gate and the TS type is `z.infer<typeof schema>`. This matches the
 * pattern in `src/runtime/types.ts`.
 *
 * Imports from: zod.
 * Imported by: event_bus.ts, transport_bridge.ts, (future) session_manager,
 *   agent_loop, batch, dispatcher.
 */
import { z } from 'zod';
export declare const SessionPlatform: z.ZodEnum<["telegram", "discord", "slack"]>;
export type SessionPlatform = z.infer<typeof SessionPlatform>;
export declare const sessionKeySchema: z.ZodObject<{
    platform: z.ZodEnum<["telegram", "discord", "slack"]>;
    chatId: z.ZodString;
    threadId: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
    chatId: string;
    platform: "telegram" | "discord" | "slack";
    threadId?: string | undefined;
}, {
    chatId: string;
    platform: "telegram" | "discord" | "slack";
    threadId?: string | undefined;
}>;
export type SessionKey = z.infer<typeof sessionKeySchema>;
/**
 * Canonical slug form. `<platform>:<chatId>[:<threadId>]`.
 *
 * Used as the LRU cache key (WAB.3) and as the on-disk filename base for
 * persisted session history. Hex-encoded by the persistence layer before
 * touching the filesystem; this function is the pre-encoding form.
 */
export declare function sessionKeyString(k: SessionKey): string;
export declare const inboundChatEventSchema: z.ZodObject<{
    kind: z.ZodLiteral<"inbound_message">;
    sessionKey: z.ZodObject<{
        platform: z.ZodEnum<["telegram", "discord", "slack"]>;
        chatId: z.ZodString;
        threadId: z.ZodOptional<z.ZodString>;
    }, "strip", z.ZodTypeAny, {
        chatId: string;
        platform: "telegram" | "discord" | "slack";
        threadId?: string | undefined;
    }, {
        chatId: string;
        platform: "telegram" | "discord" | "slack";
        threadId?: string | undefined;
    }>;
    messageId: z.ZodString;
    sender: z.ZodObject<{
        id: z.ZodString;
        name: z.ZodOptional<z.ZodString>;
    }, "strip", z.ZodTypeAny, {
        id: string;
        name?: string | undefined;
    }, {
        id: string;
        name?: string | undefined;
    }>;
    text: z.ZodString;
    receivedAt: z.ZodString;
    enqueuedAt: z.ZodString;
    projectUuid: z.ZodString;
    /**
     * Owning umbrella id (T-CHAT-AS-TERMINAL CAT.5). Stamped by a
     * umbrella-keyed transport bridge (one umbrella ↔ one chat session,
     * invariants #2/#4). The dispatcher's T-DEL arbitration reads
     * `umbrellaLiveSessionLease(umbrellaId)` to decide whether to answer. A
     * project-keyed transport (legacy / general session) omits it, in which case
     * the dispatcher falls back to the project lease (`liveSessionLease`).
     */
    umbrellaId: z.ZodOptional<z.ZodString>;
    raw: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strip", z.ZodTypeAny, {
    kind: "inbound_message";
    receivedAt: string;
    sender: {
        id: string;
        name?: string | undefined;
    };
    text: string;
    messageId: string;
    sessionKey: {
        chatId: string;
        platform: "telegram" | "discord" | "slack";
        threadId?: string | undefined;
    };
    enqueuedAt: string;
    projectUuid: string;
    umbrellaId?: string | undefined;
    raw?: Record<string, unknown> | undefined;
}, {
    kind: "inbound_message";
    receivedAt: string;
    sender: {
        id: string;
        name?: string | undefined;
    };
    text: string;
    messageId: string;
    sessionKey: {
        chatId: string;
        platform: "telegram" | "discord" | "slack";
        threadId?: string | undefined;
    };
    enqueuedAt: string;
    projectUuid: string;
    umbrellaId?: string | undefined;
    raw?: Record<string, unknown> | undefined;
}>;
export type InboundChatEvent = z.infer<typeof inboundChatEventSchema>;
export declare const outboundChatReplySchema: z.ZodObject<{
    sessionKey: z.ZodObject<{
        platform: z.ZodEnum<["telegram", "discord", "slack"]>;
        chatId: z.ZodString;
        threadId: z.ZodOptional<z.ZodString>;
    }, "strip", z.ZodTypeAny, {
        chatId: string;
        platform: "telegram" | "discord" | "slack";
        threadId?: string | undefined;
    }, {
        chatId: string;
        platform: "telegram" | "discord" | "slack";
        threadId?: string | undefined;
    }>;
    text: z.ZodString;
    /** Optional source message id to thread under (Telegram reply_to_message_id). */
    replyTo: z.ZodOptional<z.ZodString>;
    projectUuid: z.ZodString;
}, "strip", z.ZodTypeAny, {
    text: string;
    sessionKey: {
        chatId: string;
        platform: "telegram" | "discord" | "slack";
        threadId?: string | undefined;
    };
    projectUuid: string;
    replyTo?: string | undefined;
}, {
    text: string;
    sessionKey: {
        chatId: string;
        platform: "telegram" | "discord" | "slack";
        threadId?: string | undefined;
    };
    projectUuid: string;
    replyTo?: string | undefined;
}>;
export type OutboundChatReply = z.infer<typeof outboundChatReplySchema>;
export declare const chatHistoryContentBlockSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
    type: z.ZodLiteral<"text">;
    text: z.ZodString;
}, "strip", z.ZodTypeAny, {
    type: "text";
    text: string;
}, {
    type: "text";
    text: string;
}>, z.ZodObject<{
    type: z.ZodLiteral<"tool_use">;
    id: z.ZodString;
    name: z.ZodString;
    input: z.ZodUnknown;
}, "strip", z.ZodTypeAny, {
    type: "tool_use";
    id: string;
    name: string;
    input?: unknown;
}, {
    type: "tool_use";
    id: string;
    name: string;
    input?: unknown;
}>, z.ZodObject<{
    type: z.ZodLiteral<"tool_result">;
    tool_use_id: z.ZodString;
    content: z.ZodString;
}, "strip", z.ZodTypeAny, {
    type: "tool_result";
    content: string;
    tool_use_id: string;
}, {
    type: "tool_result";
    content: string;
    tool_use_id: string;
}>]>;
export type ChatHistoryContentBlock = z.infer<typeof chatHistoryContentBlockSchema>;
export declare const chatHistoryEntrySchema: z.ZodObject<{
    role: z.ZodEnum<["user", "assistant"]>;
    content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
        type: z.ZodLiteral<"text">;
        text: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        type: "text";
        text: string;
    }, {
        type: "text";
        text: string;
    }>, z.ZodObject<{
        type: z.ZodLiteral<"tool_use">;
        id: z.ZodString;
        name: z.ZodString;
        input: z.ZodUnknown;
    }, "strip", z.ZodTypeAny, {
        type: "tool_use";
        id: string;
        name: string;
        input?: unknown;
    }, {
        type: "tool_use";
        id: string;
        name: string;
        input?: unknown;
    }>, z.ZodObject<{
        type: z.ZodLiteral<"tool_result">;
        tool_use_id: z.ZodString;
        content: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        type: "tool_result";
        content: string;
        tool_use_id: string;
    }, {
        type: "tool_result";
        content: string;
        tool_use_id: string;
    }>]>, "many">;
    timestamp: z.ZodString;
    cacheMark: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
    content: ({
        type: "text";
        text: string;
    } | {
        type: "tool_use";
        id: string;
        name: string;
        input?: unknown;
    } | {
        type: "tool_result";
        content: string;
        tool_use_id: string;
    })[];
    role: "user" | "assistant";
    timestamp: string;
    cacheMark?: boolean | undefined;
}, {
    content: ({
        type: "text";
        text: string;
    } | {
        type: "tool_use";
        id: string;
        name: string;
        input?: unknown;
    } | {
        type: "tool_result";
        content: string;
        tool_use_id: string;
    })[];
    role: "user" | "assistant";
    timestamp: string;
    cacheMark?: boolean | undefined;
}>;
export type ChatHistoryEntry = z.infer<typeof chatHistoryEntrySchema>;
export interface SessionState {
    key: SessionKey;
    history: ChatHistoryEntry[];
    lastActivityMs: number;
    projectUuid: string;
    packId: string;
    modelAlias: string;
    /** Set true while an agent turn is mid-flight; batches buffer until cleared. */
    turnInFlight: boolean;
}
export interface ToolSpec {
    name: string;
    description: string;
    /** JSON Schema for tool input. Serialized to Anthropic as-is. */
    input_schema: Record<string, unknown>;
    /**
     * Optional runtime input guard. Called by the dispatcher BEFORE the
     * handler. Implementations: `(input) => schema.parse(input)` for zod,
     * or any function that throws on invalid input. Return value is
     * forwarded to the handler (so tools can both validate AND narrow types
     * in one step).
     */
    validate?: (input: unknown) => unknown;
}
export interface ToolContext {
    sessionKey: SessionKey;
    projectUuid: string;
}
export type ToolHandler = (input: unknown, ctx: ToolContext) => Promise<string>;
export interface ToolDispatcher {
    /** Snapshot of registered tool specs — passed to Anthropic.messages.create. */
    list(): ToolSpec[];
    /**
     * Dispatch a single tool_use block from the model. Throws on unknown
     * name (caller should treat as a hard error — the model invoked
     * something not in `list()`) or on validation failure. The returned
     * string is fed back to the model as `tool_result.content`.
     */
    call(name: string, input: unknown, ctx: ToolContext): Promise<string>;
}
//# sourceMappingURL=types.d.ts.map