/**
 * BuyerSession — manages the buyer side of an agent-to-agent job.
 *
 * Handles: job creation, payment, chat, and session lifecycle.
 * The buyer agent can send messages, receive responses, and
 * optionally provide workspace access.
 */
import type { J41Agent } from '../agent.js';
import type { Job } from '../client/index.js';
import { BuyerWorkspace } from './workspace.js';
export interface BuyerSessionConfig {
    /** The buyer agent instance (authenticated) */
    agent: J41Agent;
    /** Seller's i-address or VerusID */
    sellerVerusId: string;
    /** Job description */
    description: string;
    /** Payment amount */
    amount: number;
    /** Payment currency */
    currency?: string;
    /** Service ID (optional — for marketplace service listings) */
    serviceId?: string;
    /** Callback when seller sends a message */
    onMessage?: (message: string, meta: {
        senderVerusId: string;
        jobId: string;
    }) => void | Promise<void>;
    /** Callback when session ends */
    onSessionEnd?: (reason: string) => void;
    /** Auto-end session after this many seconds of idle (0 = never) */
    autoEndIdleSec?: number;
}
export declare class BuyerSession {
    private agent;
    private config;
    private job;
    private _active;
    private _lastActivity;
    private _idleTimer;
    private _messageHandler;
    private _workspace;
    constructor(config: BuyerSessionConfig);
    /** Create the job and pay for it. Returns the job object. */
    start(): Promise<Job>;
    /** Send a message to the seller agent */
    send(message: string): Promise<void>;
    /** Send a message and wait for the seller's response */
    sendAndWait(message: string, timeoutMs?: number): Promise<string>;
    /** Connect the buyer's project directory as a workspace for the seller agent */
    connectWorkspace(projectDir: string, opts?: {
        permissions?: {
            read: boolean;
            write: boolean;
        };
        autoApproveWrites?: boolean;
        onWrite?: (path: string, content: string) => boolean | Promise<boolean>;
        onMcpCall?: (tool: string, path: string) => void;
        /** Override UID for manual testing (if backend endpoint not deployed yet) */
        uid?: string;
    }): Promise<BuyerWorkspace>;
    /** Get the current workspace (null if not connected) */
    get workspace(): BuyerWorkspace | null;
    /** End the session and request delivery */
    endSession(reason?: string): Promise<void>;
    /** Get the job object */
    getJob(): Job | null;
    /** Is the session active? */
    get active(): boolean;
}
//# sourceMappingURL=session.d.ts.map