/**
 * Copyright 2025 The Artinet Project
 * SPDX-License-Identifier: Apache-2.0
 */
import { A2A } from "../types/index.js";
import * as describe from "../create/describe.js";
import { ClientFactoryOptions, ClientConfig, Client, Transport, RequestOptions } from '@a2a-js/sdk/client';
import { z } from 'zod/v4';
export declare const MessengerParamsSchema: z.ZodObject<{
    headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
    authToken: z.ZodOptional<z.ZodString>;
    baseUrl: z.ZodURL;
    fallbackPath: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
type BaseMessengerParams = z.infer<typeof MessengerParamsSchema>;
/**
 * Checks if the given parameters are a valid MessengerParams object.
 * @param params The parameters to check.
 * @returns True if the parameters are a valid MessengerParams object, false otherwise.
 */
export declare const isMessengerParams: (params: unknown) => params is MessengerParams;
export interface MessengerParams extends Omit<BaseMessengerParams, 'baseUrl'> {
    baseUrl: URL | string;
    factory?: Partial<ClientFactoryOptions>;
    config?: ClientConfig;
}
/**
 * Messenger is the main communication client for interacting with remote A2A-compatible services.
 * It provides methods for sending messages, retrieving tasks, canceling operations, and handling streaming responses.
 */
declare class Messenger implements Omit<Transport, 'getAuthenticatedExtendedAgentCard' | 'getExtendedAgentCard'> {
    private _headers;
    private _fallbackPath?;
    private _baseUrl;
    private _factory;
    private clientPromise;
    constructor(baseUrl: URL | string, _headers?: Record<string, string>, _fallbackPath?: string | undefined, factory?: ClientFactoryOptions, config?: ClientConfig);
    reset(baseUrl?: URL | string, fallbackPath?: string | undefined): Promise<Client>;
    get baseUrl(): string;
    get headers(): Record<string, string>;
    set headers(headers: Record<string, string>);
    protected get _client(): Promise<Client>;
    /**
     * Retrieves the AgentCard from the A2A server.
     * @returns A promise resolving to the AgentCard.
     */
    getAgentCard(requestOptions?: RequestOptions): Promise<A2A.AgentCard>;
    sendMessage(params: A2A.MessageSendParams, options?: RequestOptions): Promise<A2A.SendMessageSuccessResult>;
    sendMessage(params: describe.MessageParams, options?: RequestOptions): Promise<A2A.SendMessageSuccessResult>;
    sendMessage(params: describe.MessageSendParamsParams, options?: RequestOptions): Promise<A2A.SendMessageSuccessResult>;
    sendMessageStream(params: A2A.MessageSendParams, options?: RequestOptions): AsyncGenerator<A2A.Update, void, undefined>;
    sendMessageStream(params: describe.MessageSendParamsParams, options?: RequestOptions): AsyncGenerator<A2A.Update, void, undefined>;
    sendMessageStream(params: describe.MessageParams, options?: RequestOptions): AsyncGenerator<A2A.Update, void, undefined>;
    /**
     * Retrieves the current state of a task.
     * @param params The parameters for the tasks/get method.
     * @returns A promise resolving to the Task object or null.
     */
    getTask(params: A2A.TaskQueryParams, options?: RequestOptions): Promise<A2A.Task>;
    /**
     * Cancels a currently running task.
     * @param params The parameters for the tasks/cancel method.
     * @returns A promise resolving to the updated Task object (usually canceled state) or null.
     */
    cancelTask(params: A2A.TaskIdParams, options?: RequestOptions): Promise<A2A.Task>;
    /**
     * Sets or updates the push notification config for a task.
     * @param params The parameters for the tasks/pushNotificationConfig/set method (which is TaskPushNotificationConfig).
     * @returns A promise resolving to the confirmed TaskPushNotificationConfig or null.
     */
    setTaskPushNotificationConfig(params: A2A.TaskPushNotificationConfig, options?: RequestOptions): Promise<A2A.TaskPushNotificationConfig>;
    /**
     * Retrieves the currently configured push notification config for a task.
     * @param params The parameters for the tasks/pushNotificationConfig/get method.
     * @returns A promise resolving to the TaskPushNotificationConfig or null.
     */
    getTaskPushNotificationConfig(params: A2A.TaskIdParams, options?: RequestOptions): Promise<A2A.TaskPushNotificationConfig>;
    listTaskPushNotificationConfig(params: A2A.ListTaskPushNotificationConfigParams, options?: RequestOptions): Promise<A2A.ListTaskPushNotificationConfigResult>;
    deleteTaskPushNotificationConfig(params: A2A.DeleteTaskPushNotificationConfigParams, options?: RequestOptions): Promise<void>;
    /**
     * Resubscribes to an existing task's update stream.
     * @param params Parameters identifying the task to resubscribe to
     * @returns An AsyncIterable that yields TaskStatusUpdateEvent or TaskArtifactUpdateEvent payloads.
     */
    resubscribeTask(params: A2A.TaskQueryParams, options?: RequestOptions): AsyncGenerator<A2A.Update>;
    /**
     * Checks if the server supports a specific capability based on the agent card.
     * @param capability The capability to check (e.g., 'streaming', 'pushNotifications').
     * @returns A promise resolving to true if the capability is supported.
     */
    supports(capability: 'streaming' | 'pushNotifications' | 'stateTransitionHistory' | 'extensions'): Promise<boolean>;
    /**
     * Adds a single header to be included in all requests.
     * @param name The header name.
     * @param value The header value.
     */
    addHeader(name: string, value: string): void;
    /**
     * Removes a header.
     * @param name The header name to remove.
     */
    removeHeader(name: string): void;
    static create({ baseUrl, headers, fallbackPath, factory, config }: MessengerParams): Promise<Messenger>;
}
/**
 * Creates a new Messenger instance.
 * @param baseUrl The base URL for the A2A server.
 * @param headers Optional custom headers to include in all requests.
 * @param fallbackPath Optional fallback path to use if the agent card is not found at the base URL.
 * @example
 * const messenger = createMessenger({
 *   baseUrl: "http://localhost:4000/a2a",
 * });
 * const card = await messenger.getAgentCard();
 * console.log(card);
 * @example
 * const messenger = createMessenger({
 *   baseUrl: "http://localhost:4000/a2a",
 *   fallbackPath: "/agent-card",
 * });
 * const card = await messenger.getAgentCard();
 * console.log(card);
 */
export declare const createMessenger: typeof Messenger.create;
export declare const AgentMessenger: typeof Messenger;
export type AgentMessenger = Messenger;
/**
 * @deprecated Use {@link createMessenger} instead.
 */
export declare const A2AClient: typeof Messenger;
export {};
