/**
 * OpenClaw SDK type re-exports with inline fallback declarations.
 *
 * If `openclaw` is installed, we re-export the actual SDK types for full
 * type-safety. Otherwise, we declare compatible fallback types so the
 * plugin compiles standalone (e.g., during npm publish or in older envs).
 *
 * IMPORTANT: All runtime usage of OpenClaw APIs must still use feature
 * detection (typeof checks, try/catch dynamic imports) — these types
 * are purely for compile-time correctness.
 */
/** OpenClaw plugin API passed to register(). */
export interface OpenClawPluginApi {
    runtime: PluginRuntime;
    registerChannel(opts: {
        plugin: unknown;
    }): void;
    registerTool?(opts: unknown, flags?: {
        optional?: boolean;
    }): void;
    registerCommand?(opts: unknown): void;
    registerHttpRoute?(opts: HttpRouteRegistration): void;
    on?(event: string, handler: (...args: any[]) => void | Promise<void>): void;
}
/** OpenClaw runtime object — exposes channel, error, and other subsystems. */
export interface PluginRuntime {
    channel: {
        routing: {
            resolveAgentRoute(opts: unknown): {
                agentId: string;
                sessionKey: string;
            };
        };
        session: {
            resolveStorePath(store: unknown, opts: {
                agentId: string;
            }): string;
            readSessionUpdatedAt(opts: {
                storePath: string;
                sessionKey: string;
            }): number | undefined;
            recordInboundSession(opts: unknown): Promise<void>;
        };
        reply: {
            resolveEnvelopeFormatOptions(cfg: unknown): unknown;
            formatAgentEnvelope(opts: unknown): string;
            finalizeInboundContext(payload: Record<string, unknown>): Record<string, unknown>;
            dispatchReplyWithBufferedBlockDispatcher(opts: unknown): Promise<void>;
        };
    };
    error?(...args: unknown[]): void;
}
/** Context passed to gateway.startAccount(). */
export interface ChannelGatewayContext<TAccount = ResolvedAccountBase> {
    account: TAccount;
    cfg: unknown;
    log?: {
        info(msg: string): void;
        warn?(msg: string): void;
        error?(msg: string): void;
    } | ((msg: string) => void);
    abortSignal?: AbortSignal;
}
/** Minimal resolved account shape from OpenClaw config resolution. */
export interface ResolvedAccountBase {
    accountId: string;
    configured: boolean;
    dataDir: string;
    apiUrl: string;
    agentName: string;
    httpPort: number;
}
/** Context passed to outbound.sendPayload(). */
export interface ChannelOutboundPayloadContext {
    payload: ReplyPayload;
    sessionKey: string;
    accountId?: string;
    targetId?: string;
}
/** Structured reply payload from OpenClaw v2026.3.2+. */
export interface ReplyPayload {
    text?: string;
    mediaUrls?: string[];
    isReasoning?: boolean;
    suggestedActions?: SuggestedAction[];
    metadata?: Record<string, unknown>;
}
/** Suggested action attached to a reply payload. */
export interface SuggestedAction {
    label: string;
    action: string;
    payload?: Record<string, unknown>;
}
/** Registration options for registerHttpRoute(). */
export interface HttpRouteRegistration {
    path: string;
    method?: "GET" | "POST" | "PUT" | "DELETE";
    handler: (req: HttpRouteRequest) => Promise<HttpRouteResponse> | HttpRouteResponse;
}
/** Simplified request object from OpenClaw managed HTTP routes. */
export interface HttpRouteRequest {
    method: string;
    path: string;
    headers: Record<string, string>;
    body?: unknown;
    remoteAddress?: string;
}
/** Response object for OpenClaw managed HTTP routes. */
export interface HttpRouteResponse {
    status: number;
    headers?: Record<string, string>;
    body: unknown;
}
/** Hook event for message_sent. */
export interface MessageSentEvent {
    messageId: string;
    channelId: string;
    sessionKey: string;
    timestamp: number;
    deliveryStatus: "delivered" | "failed" | "pending";
}
/** Hook event for session_start. */
export interface SessionStartEvent {
    sessionKey: string;
    agentId: string;
    timestamp: number;
}
/** Hook event for session_end. */
export interface SessionEndEvent {
    sessionKey: string;
    agentId: string;
    timestamp: number;
    reason?: string;
}
/** Agent event payload from openclaw/dist/plugin-sdk/infra/agent-events.js. */
export interface AgentEventPayload {
    type: string;
    agentId: string;
    timestamp: number;
    data?: Record<string, unknown>;
}
/** Transcript update payload from openclaw/dist/plugin-sdk/sessions/transcript-events.js. */
export interface TranscriptUpdatePayload {
    sessionKey: string;
    delta: string;
    timestamp: number;
    role?: "assistant" | "user" | "system";
}
/** Hook event for before_tool_call (OpenClaw v2026.3.28+). */
export interface BeforeToolCallEvent {
    toolName: string;
    args: Record<string, unknown>;
    agentId: string;
    sessionKey: string;
}
/** Result returned from before_tool_call hook. */
export interface BeforeToolCallResult {
    /** If true, pause execution and ask owner for approval */
    requireApproval?: boolean;
    /** Reason shown in the approval overlay */
    approvalReason?: string;
    /** If true, block the tool call entirely */
    blocked?: boolean;
    /** Reason for blocking */
    blockedReason?: string;
}
/** Hook event for before_dispatch (OpenClaw v2026.3.28+). */
export interface BeforeDispatchEvent {
    channelId: string;
    agentId: string;
    sessionKey: string;
    inbound: {
        text: string;
        sender?: string;
        metadata?: Record<string, unknown>;
    };
}
/** Hook handler map type. */
export type PluginHookHandlerMap = {
    message_sent?: (event: MessageSentEvent) => void | Promise<void>;
    session_start?: (event: SessionStartEvent) => void | Promise<void>;
    session_end?: (event: SessionEndEvent) => void | Promise<void>;
    before_tool_call?: (event: BeforeToolCallEvent) => BeforeToolCallResult | Promise<BeforeToolCallResult>;
    before_dispatch?: (event: BeforeDispatchEvent) => void | Promise<void>;
};
//# sourceMappingURL=openclaw-types.d.ts.map