import { type AgentRelayActions, type ActionHandle } from './actions/index.js';
import { type RelaycastTelemetryOptions } from './relaycast-telemetry.js';
import { type RelayMessaging, type RelaycastMessagingOptions } from './messaging/index.js';
import { type EnrichedMessages, type RegisterActionInput, type RelayAgentClient, type RelayWorkspace } from './facade.js';
import { type AgentHandleInput, type ActionPredicate, type EnrichedEvents, type ListenerHandler, type ListenerPredicate, type RelayAgentHandle, type RelayEvent } from './listeners.js';
import type { AgentSessionEvent } from './session/index.js';
export interface AgentRelayOptions extends RelaycastMessagingOptions {
    messaging?: RelayMessaging;
    actions?: AgentRelayActions;
    /** Factory for agent-token-scoped messaging clients. Defaults to a Relaycast client. */
    createAgentMessaging?: (token: string) => RelayMessaging;
}
export interface AgentRelayCreateWorkspaceInput extends RelaycastTelemetryOptions {
    name: string;
    baseUrl?: string;
    retryPolicy?: RelaycastMessagingOptions['retryPolicy'];
    actions?: AgentRelayActions;
}
export interface AgentRelayAgent {
    readonly messaging: RelayMessaging;
    readonly agents: RelayMessaging['agents'];
    readonly channels: RelayMessaging['channels'];
    readonly messages: EnrichedMessages;
    readonly threads: RelayMessaging['threads'];
    readonly inbox: RelayMessaging['inbox'];
    readonly events: RelayMessaging['events'];
    readonly deliveries: RelayMessaging['deliveries'];
    readonly integrations: RelayMessaging['integrations'];
    readonly webhooks: RelayMessaging['webhooks'];
    readonly capabilities: RelayMessaging['commands'];
    readonly workspace: RelayWorkspace;
    registerAction<TInput, TOutput>(def: RegisterActionInput<TInput, TOutput>): ActionHandle;
    addListener(selector: string | ListenerPredicate, handler: ListenerHandler<RelayEvent>): () => void;
    action(name: string): ActionPredicate;
    agent(input: AgentHandleInput): RelayAgentHandle;
    emitSessionEvent(agentId: string, event: AgentSessionEvent): void;
}
export declare class AgentRelay implements AgentRelayAgent {
    readonly messaging: RelayMessaging;
    private readonly actions;
    readonly workspaceKey?: string;
    private readonly messagingOptions;
    private readonly clientsByToken;
    private readonly createAgentMessaging;
    private enrichedMessages?;
    private workspaceFacade?;
    private hub?;
    constructor(options?: AgentRelayOptions);
    static createWorkspace(input: string | AgentRelayCreateWorkspaceInput): Promise<AgentRelay>;
    get agents(): RelayMessaging['agents'];
    get channels(): RelayMessaging['channels'];
    get messages(): EnrichedMessages;
    get threads(): RelayMessaging['threads'];
    get inbox(): RelayMessaging['inbox'];
    get events(): EnrichedEvents;
    private get listenerHub();
    get deliveries(): RelayMessaging['deliveries'];
    get integrations(): RelayMessaging['integrations'];
    get webhooks(): RelayMessaging['webhooks'];
    get capabilities(): RelayMessaging['commands'];
    get workspace(): RelayWorkspace;
    /** Build a live client bound to a freshly-registered agent. */
    private buildAgentClient;
    /** Rehydrate a live client from a persisted agent token, resolving identity from the relay. */
    private reconnectAgent;
    registerAction<TInput, TOutput>(def: RegisterActionInput<TInput, TOutput>): ActionHandle;
    /** Subscribe by dotted event name, `'*'`/prefix wildcard, or a predicate. */
    addListener(selector: string | ListenerPredicate, handler: ListenerHandler<RelayEvent>): () => void;
    action(name: string): ActionPredicate;
    agent(input: AgentHandleInput): RelayAgentHandle;
    emitSessionEvent(agentId: string, event: AgentSessionEvent): void;
    private messagingForToken;
    private createMessagingResolver;
}
export declare function agentRelayAgent(messaging: RelayMessaging, actions: AgentRelayActions, handlerAgent?: string): AgentRelayAgent;
/**
 * Assemble a live agent client: an agent-scoped messaging surface plus the
 * agent's identity and status/tool predicate builders, with `reply`/`react`
 * convenience keyed on `messageId`.
 */
export declare function assembleAgentClient(messaging: RelayMessaging, actions: AgentRelayActions, identity: {
    id: string;
    name: string;
    handle?: string;
    token: string;
}): RelayAgentClient;
//# sourceMappingURL=agent-relay.d.ts.map