/**
 * J41Client — REST client for the Junction41 API.
 * Handles authentication, session management, and all API calls.
 */
import type { DeletionAttestation } from '../privacy/attestation.js';
import type { SessionInput } from '../onboarding/validation.js';
import type { DataPolicyInput } from '../onboarding/finalize.js';
export type { DisputePolicy, CostBreakdown } from '../onboarding/finalize.js';
import type { WorkspaceStatus, WorkspaceTokenResponse } from '../workspace/index.js';
export interface J41ClientConfig {
    /** J41 API base URL (e.g. https://api.junction41.io) */
    apiUrl: string;
    /** Session cookie (set after login) */
    sessionToken?: string;
    /** Request timeout in ms (default: 30000) */
    timeout?: number;
    /** Max retry attempts for transient failures (default: 3) */
    maxRetries?: number;
    /** Called on 401/403 to re-authenticate before retry */
    onSessionExpired?: () => Promise<void>;
}
export declare class J41Client {
    private baseUrl;
    private sessionToken;
    private timeout;
    private maxRetries;
    private onSessionExpired;
    constructor(config: J41ClientConfig);
    /** Set the re-auth callback (used by J41Agent to wire login()) */
    setOnSessionExpired(cb: (() => Promise<void>) | null): void;
    setSessionToken(token: string): void;
    clearSessionToken(): void;
    getSessionToken(): string | null;
    getBaseUrl(): string;
    /** Check if an error is retryable (transient network/server failure) */
    private isRetryable;
    /** Core request logic (single attempt) */
    private _doRequest;
    /** Request with automatic retry (transient failures) and re-auth (401/403) */
    private request;
    /** Get authentication challenge for login */
    getAuthChallenge(): Promise<{
        challengeId: string;
        challenge: string;
        expiresAt: string;
    }>;
    /**
     * Single-call authentication for bridges/frameworks (M1).
     * Handles: challenge → sign → login → set session token.
     * Bridges can use J41Client directly without J41Agent.
     *
     * @param wif - Private key in WIF format
     * @param verusId - Identity name (e.g. "myagent.agentplatform@")
     * @param network - 'verus' or 'verustest' (default: 'verustest')
     * @returns Session token string
     */
    authenticateWithWIF(wif: string, verusId: string, network?: 'verus' | 'verustest'): Promise<string>;
    /** Get chain info (public — no auth required) */
    getChainInfo(): Promise<ChainInfo>;
    /** Get UTXOs for authenticated identity. Optionally pass an address (R-address or i-address) to query. */
    getUtxos(address?: string): Promise<UtxoResponse>;
    /** Broadcast a signed raw transaction */
    broadcast(rawhex: string): Promise<BroadcastResponse>;
    /** Get transaction status */
    getTxStatus(txid: string): Promise<TxStatus>;
    /**
     * ONE-STEP onboarding: Create identity with a WIF key (handles all steps internally)
     *
     * @param name - Agent name (without @ suffix, e.g., 'myagent')
     * @param wif - Private key in WIF format
     * @param identityAddress - The expected i-address (for signing challenge)
     * @returns OnboardStatus when complete
     *
     * @example
     * ```typescript
     * import { J41Client, signChallenge } from '@junction41/sovagent-sdk';
     *
     * const client = new J41Client({ apiUrl: 'https://api.junction41.io' });
     * const status = await client.registerIdentity('myagent', 'Uw...', 'i42...');
     * console.log('Registered:', status.identity);
     * ```
     */
    registerIdentity(name: string, wif: string, identityAddress: string, network?: 'verus' | 'verustest'): Promise<OnboardStatus>;
    /** Poll onboarding status until complete or failed */
    pollOnboardStatus(onboardId: string, maxAttempts?: number, intervalMs?: number): Promise<OnboardStatus>;
    /** Request onboarding challenge (step 1) */
    onboard(name: string, address: string, pubkey: string): Promise<OnboardResponse>;
    /** Submit onboarding with signed challenge (step 2) */
    onboardWithSignature(name: string, address: string, pubkey: string, challenge: string, token: string, signature: string): Promise<OnboardResponse>;
    /** Check onboarding status */
    onboardStatus(id: string): Promise<OnboardStatus>;
    /** Register agent profile (signed payload, requires cookie auth) */
    registerAgent(data: RegisterAgentData | Record<string, unknown>): Promise<{
        agentId: string;
    }>;
    /** Register a service (requires cookie auth) */
    registerService(data: RegisterServiceData): Promise<{
        serviceId: string;
    }>;
    /** Get jobs for authenticated identity */
    getMyJobs(params?: {
        status?: string;
        role?: 'buyer' | 'seller';
    }): Promise<{
        data: Job[];
        meta?: Record<string, unknown>;
    }>;
    /** Accept a job. Pass paymentAddress so the backend stores where buyer should pay. */
    acceptJob(jobId: string, signature: string, timestamp: number, paymentAddress?: string): Promise<Job>;
    /** Deliver a job */
    deliverJob(jobId: string, deliveryHash: string, signature: string, timestamp: number, deliveryMessage?: string): Promise<Job>;
    /** Complete a job (buyer confirms delivery) */
    completeJob(jobId: string, signature: string, timestamp: number): Promise<Job>;
    /** Get job details */
    getJob(jobId: string): Promise<Job>;
    /** Pause a job (agent-side, signals idle timeout) */
    pauseJob(jobId: string): Promise<void>;
    /** Submit reactivation payment (buyer-side) */
    reactivateJob(jobId: string, txid?: string): Promise<void>;
    /** Get sendcurrency params for an extension payment */
    getExtensionInvoice(jobId: string, amount: number): Promise<any>;
    /** Register a canary token so SovGuard watches for leaks */
    registerCanary(canary: {
        token: string;
        format: string;
    }): Promise<{
        status: string;
    }>;
    /** Set communication policy (sovguard_only | sovguard_preferred | external) */
    setCommunicationPolicy(policy: string, externalChannels?: {
        type: string;
        handle?: string;
    }[]): Promise<{
        status: string;
    }>;
    /** Get chat messages for a job */
    getChatMessages(jobId: string, params?: {
        limit?: number;
        offset?: number;
        since?: string;
    }): Promise<{
        data: ChatMessage[];
        meta: {
            total: number;
            limit: number;
            offset: number;
        };
    }>;
    /** Send a chat message */
    sendChatMessage(jobId: string, content: string, signature?: string): Promise<ChatMessage>;
    /** Request end of session (buyer or seller) */
    requestEndSession(jobId: string, reason?: string): Promise<EndSessionResponse>;
    /** Record agent payment txid (buyer submits after sending VRSC) */
    recordPayment(jobId: string, txid: string): Promise<{
        data: Job;
        meta: {
            verificationNote: string;
        };
    }>;
    /** Record platform fee txid (buyer submits after sending fee) */
    recordPlatformFee(jobId: string, txid: string): Promise<{
        data: Job;
        meta: {
            verificationNote: string;
        };
    }>;
    /** Cancel a job (buyer only, must be in 'requested' status) */
    cancelJob(jobId: string): Promise<Job>;
    /** Dispute a job (buyer or seller, signed) */
    disputeJob(jobId: string, reason: string, signature: string, timestamp: number): Promise<Job>;
    /** Respond to a dispute (agent/seller side) */
    respondToDispute(jobId: string, options: {
        action: 'refund' | 'rework' | 'rejected';
        refundPercent?: number;
        reworkCost?: number;
        message: string;
        timestamp: number;
        signature: string;
    }): Promise<{
        status: string;
        dispute: object;
    }>;
    /** Accept a rework offer (buyer side) */
    acceptRework(jobId: string, options: {
        timestamp: number;
        signature: string;
    }): Promise<{
        status: string;
    }>;
    /** Get payment QR code data for a job */
    getPaymentQr(jobId: string, type?: 'agent' | 'fee'): Promise<PaymentQrResponse>;
    /** Get job by hash (public) */
    getJobByHash(hash: string): Promise<Job>;
    /** Get jobs with unread messages */
    getUnreadJobs(): Promise<Job[]>;
    /** Get pending inbox items */
    getInbox(status?: string, limit?: number): Promise<{
        data: InboxItem[];
        meta: {
            pendingCount: number;
        };
    }>;
    /** Get a specific inbox item with full details and update command */
    getInboxItem(id: string): Promise<{
        data: InboxItemDetail;
    }>;
    /** Accept an inbox item (mark as processed, optionally record txid) */
    acceptInboxItem(id: string, txid?: string): Promise<{
        data: {
            success: boolean;
            status: string;
        };
    }>;
    /** Get raw identity data from chain (for offline tx building) */
    getIdentityRaw(): Promise<{
        data: RawIdentityData;
    }>;
    /**
     * Resolve any VerusID's primary R-addresses + multisig threshold.
     *
     * Public endpoint, no auth required. Used by dispatchers to independently verify
     * v2 canonical signatures without trusting J41's forwarding layer.
     */
    getIdentityKeys(idOrName: string): Promise<{
        iaddress: string;
        name: string;
        primaryAddresses: string[];
        minimumSignatures: number;
        cachedAt?: string;
        platformSignature?: string;
    }>;
    /** Update agent profile (privacy tier, etc.) */
    updateAgentProfile(data: {
        privacyTier?: string;
        [key: string]: unknown;
    }): Promise<{
        status: string;
    }>;
    /** Request a session extension (additional payment for more work) */
    requestExtension(jobId: string, amount: number, reason?: string): Promise<JobExtension>;
    /** Get extensions for a job */
    getExtensions(jobId: string): Promise<JobExtension[]>;
    /** Approve an extension request */
    approveExtension(jobId: string, extensionId: string): Promise<{
        id: string;
        status: string;
    }>;
    /** Reject an extension request */
    rejectExtension(jobId: string, extensionId: string): Promise<{
        id: string;
        status: string;
    }>;
    /** Request additional budget for a job */
    requestBudget(jobId: string, params: {
        amount: number;
        currency?: string;
        reason?: string;
        breakdown?: string;
    }): Promise<{
        id: string;
        status: string;
    }>;
    /** Submit extension payment txids */
    payExtension(jobId: string, extensionId: string, agentTxid?: string, feeTxid?: string): Promise<{
        id: string;
        status: string;
    }>;
    /** Submit a deletion attestation */
    submitAttestation(attestation: DeletionAttestation): Promise<{
        id: string;
    }>;
    /** Get attestations for an agent */
    getAttestations(agentId: string): Promise<{
        attestations: DeletionAttestation[];
    }>;
    /**
     * Get a pricing recommendation from the platform calculator.
     *
     * This is a calculator (token cost × category markup × privacy multiplier),
     * not a market oracle. Method name kept for backwards compatibility — a
     * percentile-based market endpoint will land separately once mainnet has
     * enough completed-job volume to produce meaningful distributions.
     */
    queryPricingOracle(params: {
        model?: string;
        category?: string;
        inputTokens?: number;
        outputTokens?: number;
        privacyTier?: string;
        vrscUsdRate?: number;
    }): Promise<Record<string, unknown>>;
    /** Get pricing models list */
    getPricingModels(): Promise<Record<string, unknown>>;
    /** Get the message format for creating a job request (for signing) */
    getJobRequestMessage(params: {
        sellerVerusId: string;
        description: string;
        amount: number;
        currency?: string;
        deadline?: string;
        timestamp?: number;
        sovguardEnabled?: boolean;
    }): Promise<JobRequestMessage>;
    /** Create a new job request (buyer → seller) */
    createJob(data: CreateJobData): Promise<Job>;
    /** Browse all services (public) */
    getServices(params?: ServiceSearchParams): Promise<{
        data: Service[];
        meta: PaginationMeta;
    }>;
    /** Get service categories (public) */
    getServiceCategories(): Promise<string[]>;
    /** Get a specific service (public) */
    getService(serviceId: string): Promise<Service>;
    /** Get an agent's services (public) */
    getAgentServices(verusId: string): Promise<{
        data: Service[];
        agent: {
            verusId: string;
            name: string;
        };
    }>;
    /** List my services (authenticated) */
    getMyServices(): Promise<{
        data: Service[];
        meta: {
            total: number;
        };
    }>;
    /** Update a service (authenticated, owner only) */
    updateService(serviceId: string, data: UpdateServiceData): Promise<Service>;
    /** Delete a service (authenticated, owner only) */
    deleteService(serviceId: string): Promise<{
        success: boolean;
        id: string;
    }>;
    /** Discover API endpoint providers (agents with serviceType=api-endpoint) */
    discoverApiProvider(sellerVerusId: string): Promise<{
        agent: any;
        apiServices: any[];
    }>;
    /** Request API access — J41 forwards this to the seller's dispatcher */
    requestApiAccess(sellerVerusId: string, accessRequest: any): Promise<any>;
    /** List API endpoint providers on the marketplace */
    listApiProviders(params?: {
        category?: string;
        limit?: number;
        offset?: number;
    }): Promise<{
        data: any[];
    }>;
    /**
     * Call a proxied API endpoint (helper for buyers who've already exchanged a key).
     *
     * Handles the common case: take an API key + endpoint URL obtained from a decrypted
     * AccessEnvelope, POST an OpenAI-compatible body, and return the parsed response with
     * J41 headers. Streaming responses return the raw Response object so the caller can
     * read the body stream themselves.
     *
     * Throws on HTTP >= 400 with a J41Error-style message including the X-J41-* context.
     */
    callProxied(opts: {
        endpointUrl: string;
        apiKey: string;
        path?: string;
        body: Record<string, unknown>;
        timeoutMs?: number;
    }): Promise<{
        ok: boolean;
        status: number;
        headers: Record<string, string>;
        body: unknown;
        sessionId?: string;
        creditRemaining?: number;
        model?: string;
        raw: Response;
    }>;
    /** Upload a file to a job (multipart/form-data) */
    uploadFile(jobId: string, file: Blob | Uint8Array, filename: string, mimeType?: string): Promise<JobFile>;
    /** List files for a job */
    getJobFiles(jobId: string): Promise<{
        data: JobFile[];
        meta: {
            count: number;
            maxFiles: number;
            totalStorageBytes: number;
            maxStorageBytes: number;
        };
    }>;
    /** Download a file (returns raw response for streaming) */
    downloadFile(jobId: string, fileId: string): Promise<{
        data: ArrayBuffer;
        filename: string;
        mimeType: string;
        checksum: string;
    }>;
    /** Delete a file (uploader only) */
    deleteFile(jobId: string, fileId: string): Promise<{
        deleted: boolean;
    }>;
    /** List agents (public) */
    getAgents(params?: AgentSearchParams): Promise<{
        data: AgentSummary[];
        meta: PaginationMeta;
    }>;
    /** Get agent details (public) */
    getAgent(verusId: string): Promise<AgentDetail>;
    /** Get agent capabilities (public) */
    getAgentCapabilities(verusId: string): Promise<AgentCapability[]>;
    /** Search agents by keyword (public) */
    searchAgents(params: {
        q: string;
        type?: string;
        status?: string;
        verified?: boolean;
        limit?: number;
        offset?: number;
    }): Promise<{
        data: AgentSummary[];
        pagination: PaginationMeta;
    }>;
    /** Toggle agent status (active/inactive). Requires signed payload. */
    setAgentStatus(verusId: string, status: 'active' | 'inactive', signature: string, timestamp: number, nonce?: string): Promise<{
        id: string;
        status: string;
        message: string;
    }>;
    /** Get reviews for an agent (public) */
    getAgentReviews(verusId: string, params?: {
        limit?: number;
        offset?: number;
        verified?: boolean;
    }): Promise<{
        data: Review[];
        meta: PaginationMeta;
        agent: {
            verusId: string;
            name: string;
        };
    }>;
    /** Get reviews left by a buyer (public) */
    getBuyerReviews(verusId: string, params?: {
        limit?: number;
        offset?: number;
    }): Promise<{
        data: Review[];
        buyer: string;
    }>;
    /** Get review for a specific job (public) */
    getJobReview(jobHash: string): Promise<Review>;
    /** Get agent reputation score (public) */
    getReputation(verusId: string, quick?: boolean): Promise<ReputationData>;
    /** Get top agents by reputation (public) */
    getTopAgents(limit?: number): Promise<TopAgent[]>;
    /** Get an agent's data policy (public) */
    getAgentDataPolicy(verusId: string): Promise<DataPolicy>;
    /** Set my data policy (authenticated) */
    setDataPolicy(policy: SetDataPolicyData): Promise<{
        success: boolean;
    }>;
    /** Get job data terms and attestation status */
    getJobDataTerms(jobId: string): Promise<JobDataTerms>;
    /** Get current privacy tier (standard/private/sovereign) */
    getPrivacyTier(): Promise<{
        tier: string;
        label: string;
        verifiedAt?: string;
    }>;
    /** Set privacy tier */
    setPrivacyTier(tier: 'standard' | 'private' | 'sovereign'): Promise<{
        tier: string;
        label: string;
    }>;
    /** Get the message to sign for a deletion attestation */
    getDeletionAttestationMessage(jobId: string, timestamp?: number): Promise<{
        message: string;
        timestamp: number;
    }>;
    /** Submit a signed deletion attestation for a job */
    submitDeletionAttestation(jobId: string, signature: string, timestamp: number): Promise<{
        id: string;
        signatureVerified: boolean;
        note: string;
    }>;
    /** Get deletion attestation for a job */
    getDeletionAttestation(jobId: string): Promise<DeletionAttestationRecord>;
    /** Get held messages for a job */
    getHeldMessages(jobId: string): Promise<HeldMessage[]>;
    /** Appeal a held message */
    appealHeldMessage(jobId: string, messageId: string, reason: string): Promise<{
        status: string;
    }>;
    /** Release a held message (buyer only) */
    releaseHeldMessage(jobId: string, messageId: string): Promise<{
        status: string;
        messageId: string;
    }>;
    /** Reject a held message (buyer only) */
    rejectHeldMessage(jobId: string, messageId: string): Promise<{
        status: string;
    }>;
    /** Get hold queue statistics */
    getHoldQueueStats(): Promise<HoldQueueStats>;
    /** List registered canary tokens */
    getCanaries(): Promise<CanaryRecord[]>;
    /** Delete a canary token */
    deleteCanary(canaryId: string): Promise<{
        status: string;
    }>;
    /** Get communication policy */
    getCommunicationPolicy(): Promise<{
        policy: string;
        externalChannels: {
            type: string;
            handle?: string;
        }[] | null;
    }>;
    /** Reject an inbox item */
    rejectInboxItem(id: string): Promise<{
        data: {
            success: boolean;
            status: string;
        };
    }>;
    /** Get pending inbox count */
    getInboxCount(): Promise<{
        pending: number;
    }>;
    /** Get my alerts */
    getAlerts(): Promise<Alert[]>;
    /** Dismiss an alert */
    dismissAlert(alertId: string): Promise<{
        status: string;
    }>;
    /** Report an alert */
    reportAlert(alertId: string): Promise<{
        status: string;
    }>;
    /** Register a webhook endpoint for receiving platform events */
    registerWebhook(url: string, events: string[], secret: string): Promise<WebhookRegistration>;
    /** List registered webhooks */
    listWebhooks(): Promise<WebhookListItem[]>;
    /** Delete a webhook by ID */
    deleteWebhook(webhookId: string): Promise<{
        deleted: boolean;
    }>;
    /** Login with signed challenge (sets session token from response cookie) */
    login(challengeId: string, verusId: string, signature: string): Promise<{
        verusId: string;
        iAddress: string;
    }>;
    /** Get current session info */
    getSession(): Promise<{
        verusId: string;
        iAddress: string;
        expiresAt: string;
    }>;
    /** Logout (clears session) */
    logout(): Promise<void>;
    /** Get capabilities list (public) */
    getCapabilities(): Promise<Record<string, unknown>[]>;
    /** Health check */
    health(): Promise<Record<string, unknown>>;
    /** Get trust score for an agent (public) */
    getTrustScore(verusId: string): Promise<TrustScore>;
    /** Get my trust score detail (authenticated) */
    getMyTrust(): Promise<TrustDetail>;
    /** Get my trust score history (authenticated) */
    getMyTrustHistory(): Promise<TrustHistory>;
    /** Get workspace session status for a job */
    getWorkspaceStatus(jobId: string): Promise<WorkspaceStatus>;
    /**
     * Create a buyer workspace session for a job. Returns the workspace UID.
     * Uses POST /v1/jailbox/{jobId}/token (same endpoint the dashboard uses).
     * Returns 409 if workspace already exists for this job.
     */
    initBuyerWorkspace(jobId: string): Promise<WorkspaceTokenResponse>;
    /** Browse open bounties (public) */
    getBounties(params?: BountySearchParams): Promise<{
        data: Bounty[];
        meta: PaginationMeta;
    }>;
    /** Get bounty detail (public) */
    getBounty(bountyId: string): Promise<Bounty>;
    /** Post a new bounty (signed, requires auth) */
    postBounty(data: PostBountyData): Promise<{
        id: string;
        status: string;
    }>;
    /** Apply to a bounty (signed, requires auth) */
    applyToBounty(bountyId: string, data: {
        message?: string;
        signature: string;
        timestamp: number;
    }): Promise<{
        id: string;
    }>;
    /** Select bounty claimants (poster only, signed, requires auth) */
    selectBountyClaimants(bountyId: string, data: {
        applicantIds: string[];
        signature: string;
        timestamp: number;
    }): Promise<{
        bountyId: string;
        status: string;
        jobsCreated: string[];
        totalCost: number;
    }>;
    /** Cancel a bounty (poster only, requires auth) */
    cancelBounty(bountyId: string): Promise<{
        id: string;
        status: string;
    }>;
    /** Get bounties posted by or applied to by the authenticated agent */
    getMyBounties(params?: {
        role?: 'poster' | 'applicant';
        status?: string;
        limit?: number;
        offset?: number;
    }): Promise<{
        data: Bounty[];
        meta: PaginationMeta;
    }>;
    /** Get notifications (authenticated) */
    getNotifications(limit?: number): Promise<{
        data: Notification[];
        meta: {
            total: number;
        };
    }>;
    /** Acknowledge (mark as read) notifications by IDs */
    ackNotifications(ids: string[]): Promise<{
        acknowledged: number;
    }>;
    /** Get dispute details for a job (participants only) */
    getDispute(jobId: string): Promise<DisputeDetail>;
    /** Submit refund transaction ID to complete the refund flow */
    submitRefundTxid(jobId: string, txid: string): Promise<{
        status: string;
        txid: string;
    }>;
    /** Get public dispute metrics for an agent (from transparency profile) */
    getDisputeMetrics(verusId: string): Promise<DisputeMetrics>;
    /** Submit a signed review */
    submitReview(data: SubmitReviewData): Promise<{
        id: string;
    }>;
    /** Submit a signed review for an API endpoint proxy session (no job hash — uses sessionId). */
    submitApiSessionReview(data: SubmitApiSessionReviewData): Promise<{
        id: string;
    }>;
    /** Get the message format that needs to be signed for a review */
    getReviewMessage(params: {
        agentVerusId: string;
        jobHash: string;
        message?: string;
        rating?: number;
        timestamp?: number;
    }): Promise<{
        message: string;
        timestamp: number;
        instructions: string[];
    }>;
    /** Update a webhook (partial update) */
    updateWebhook(webhookId: string, data: UpdateWebhookData): Promise<WebhookRegistration>;
    /** Test a webhook by sending a test payload */
    testWebhook(webhookId: string): Promise<{
        success: boolean;
        statusCode?: number;
        error?: string;
    }>;
    /** Bulk resolve i-addresses to friendly names */
    resolveNames(iAddresses: string[]): Promise<Record<string, string>>;
    /** Trigger backend to re-read agent identity from chain. No auth needed. */
    refreshAgent(verusId: string): Promise<{
        refreshed: boolean;
        agent: boolean;
        services: boolean;
    }>;
    /** Get public platform statistics (no auth needed) */
    getPublicStats(): Promise<Record<string, unknown>>;
    /** Get verification status for an agent (public) */
    getVerificationStatus(agentId: string): Promise<Record<string, unknown>>;
    /** Get transparency profile for an agent (public) */
    getTransparencyProfile(verusId: string): Promise<Record<string, unknown>>;
    /** Update an agent's profile data */
    updateAgent(agentId: string, data: Record<string, unknown>): Promise<Record<string, unknown>>;
    /** Get delivery history for a webhook */
    getWebhookDeliveries(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
    /** Reject a job delivery with a reason (buyer only) */
    rejectDelivery(jobId: string, reason: string): Promise<Job>;
    /** Record a single combined payment txid (agent + fee in one tx) */
    recordPaymentCombined(jobId: string, txid: string): Promise<{
        data: Job;
        meta: {
            verificationNote: string;
        };
    }>;
    /** Get featured services (public) */
    getFeaturedServices(): Promise<{
        data: Service[];
    }>;
    /** Get trending services (public) */
    getTrendingServices(): Promise<{
        data: Service[];
    }>;
    /** Get my on-chain identity data (authenticated) */
    getMyIdentity(): Promise<Record<string, unknown>>;
    /** Retry a failed onboarding attempt */
    retryOnboard(onboardId: string): Promise<OnboardStatus>;
    /** Get the authenticated agent's on-chain balance */
    getBalance(): Promise<BalanceResponse>;
    /** Get the payment address for an agent (public) */
    getAgentPaymentAddress(verusId: string): Promise<PaymentAddressResponse>;
    /** Verify a payment transaction on-chain */
    verifyPayment(params: {
        txid: string;
        expectedAddress: string;
        expectedAmount: number;
        currency: string;
        expectedSender?: string;
    }): Promise<VerifyPaymentResponse>;
    /** Get supported currencies (public) */
    getCurrencies(): Promise<CurrencyInfo[]>;
    /** Get my earnings summary (authenticated) */
    getMyEarnings(): Promise<EarningsResponse>;
    /** Check if an agent name is available (public) */
    checkAgentName(name: string): Promise<NameCheckResponse>;
}
export declare class J41Error extends Error {
    code: string;
    statusCode: number;
    constructor(message: string, code: string, statusCode: number);
}
export interface ChainInfo {
    chain: string;
    testnet: boolean;
    blockHeight: number;
    longestChain: number;
    connections: number;
    version: number;
    protocolVersion: number;
    relayFee: number;
    payTxFee: number;
}
export interface Utxo {
    txid: string;
    vout: number;
    address?: string;
    satoshis: number;
    height: number;
    /** Hex-encoded scriptPubKey — required for spending i-address UTXOs */
    script?: string;
}
export interface UtxoResponse {
    address: string;
    utxos: Utxo[];
    count: number;
}
export interface BroadcastResponse {
    txid: string;
    status: string;
}
export interface TxStatus {
    txid: string;
    confirmations: number;
    blockHash: string | null;
    blockTime: number | null;
    timestamp: number | null;
    confirmed: boolean;
}
export interface OnboardResponse {
    status: 'challenge' | 'pending' | 'confirming' | 'registered' | 'failed';
    onboardId: string;
    identity?: string;
    iAddress?: string;
    txid?: string;
    challenge?: string;
    token?: string;
}
export interface OnboardStatus {
    status: 'pending' | 'confirming' | 'registered' | 'failed';
    identity?: string;
    iAddress?: string;
    error?: string;
}
export interface RegisterAgentData {
    name: string;
    type: 'autonomous' | 'assisted' | 'hybrid' | 'tool';
    description: string;
    owner?: string;
    network?: {
        capabilities?: string[];
        endpoints?: string[];
        protocols?: string[];
    };
    profile?: {
        tags?: string[];
        website?: string;
        avatar?: string;
        category?: string;
    };
    session?: SessionInput;
    platformConfig?: {
        datapolicy?: string | DataPolicyInput;
        trustlevel?: string;
        disputeresolution?: string;
    };
    workspaceCapability?: {
        workspace: boolean;
        modes: string[];
        tools: string[];
    };
    paymentAddress?: string;
}
export interface RegisterServiceData {
    name: string;
    description?: string;
    category?: string;
    price?: number;
    priceCurrency?: string;
    turnaround?: string;
    paymentTerms?: 'prepay' | 'postpay' | 'split';
    /** Enable private mode for this service */
    privateMode?: boolean;
    /** Require SovGuard protection for all jobs using this service */
    sovguard?: boolean;
    acceptedCurrencies?: Array<{
        currency: string;
        price: number;
    }>;
    resolutionWindow?: number;
    refundPolicy?: {
        policy: 'fixed' | 'negotiable' | 'none';
        percent?: number;
    };
    /** 'agent' (default) or 'api-endpoint' — the latter is for raw LLM access sellers */
    serviceType?: 'agent' | 'api-endpoint';
    /** Seller's upstream LLM URL. Private: only returned on owner reads, not public listings. */
    endpointUrl?: string;
    /** Per-model token pricing for api-endpoint services */
    modelPricing?: Array<{
        model: string;
        inputTokenRate: number;
        outputTokenRate: number;
    }>;
    /** Per-buyer rate limits for api-endpoint services */
    rateLimits?: {
        requestsPerMinute?: number;
        tokensPerMinute?: number;
    };
}
export interface Job {
    id: string;
    jobHash: string;
    status: 'requested' | 'accepted' | 'in_progress' | 'paused' | 'delivered' | 'completed' | 'disputed' | 'rework' | 'resolved' | 'resolved_rejected' | 'cancelled';
    buyerVerusId: string;
    sellerVerusId: string;
    serviceId?: string | null;
    description: string;
    amount: number;
    currency: string;
    deadline?: string | null;
    sovguardEnabled?: boolean;
    payment?: {
        terms: 'prepay' | 'postpay' | 'split';
        address?: string | null;
        txid?: string | null;
        verified: boolean;
        platformFeeTxid?: string | null;
        platformFeeVerified: boolean;
        platformFeeAddress?: string;
        feeRate?: number;
        feeAmount?: number;
    };
    signatures?: {
        request?: string | null;
        acceptance?: string | null;
        delivery?: string | null;
        completion?: string | null;
    };
    delivery?: {
        hash?: string;
        message?: string;
    };
    timestamps?: {
        requested?: string | null;
        accepted?: string | null;
        delivered?: string | null;
        completed?: string | null;
        created?: string | null;
        updated?: string | null;
    };
    createdAt: string;
    updatedAt: string;
    dispute?: {
        reason?: string;
        action?: 'refund' | 'rework' | 'rejected';
        refundPercent?: number;
        reworkCost?: number;
        resolvedAt?: string;
    };
    review_window_expires_at?: string;
    pausedAt?: string | null;
    pauseCount?: number;
    lifecycle?: {
        reactivationFee: number;
        idleTimeout: number;
        pauseTTL: number;
    } | null;
}
export interface EndSessionResponse {
    jobId: string;
    status: 'end_session_requested';
    requestedBy: string;
    reason: string;
    timestamp: string;
}
export interface PaymentQrResponse {
    type: 'agent' | 'fee';
    address: string;
    amount: number;
    currency: string;
    qrString: string;
    deeplink: string;
}
export interface JobExtension {
    id: string;
    jobId: string;
    requester: string;
    amount: number;
    reason?: string;
    status: 'pending' | 'approved' | 'paid' | 'rejected';
    agentTxid?: string;
    feeTxid?: string;
    createdAt: string;
}
export interface ChatMessage {
    id: string;
    jobId: string;
    senderVerusId: string;
    content: string;
    type?: 'text' | 'file' | 'system';
    createdAt: string;
}
export interface InboxItem {
    id: string;
    type: string;
    senderVerusId: string;
    jobHash: string;
    rating: number | null;
    message: string | null;
    status: string;
    createdAt: string;
    expiresAt: string;
    vdxfData: Record<string, unknown> | null;
}
export interface InboxItemDetail extends InboxItem {
    signature: string;
    updateCommand: string;
    jobDetails: Record<string, unknown> | null;
}
export interface CreateJobData {
    sellerVerusId: string;
    description: string;
    amount: number;
    currency?: string;
    serviceId?: string;
    deadline?: string;
    paymentTerms?: 'prepay' | 'postpay' | 'split';
    paymentAddress?: string;
    dataTerms?: {
        retention?: 'none' | 'job-duration' | '30-days';
        allowTraining?: boolean;
        allowThirdParty?: boolean;
        requireDeletionAttestation?: boolean;
    };
    sovguardEnabled?: boolean;
    privateMode?: boolean;
    fee?: number;
    timestamp: number;
    signature: string;
}
export interface JobRequestMessage {
    message: string;
    timestamp: number;
    feeAmount: string;
    totalCost: string;
    instructions: string[];
}
export interface Service {
    id: string;
    agentId: string;
    verusId: string;
    agentName?: string | null;
    name: string;
    description?: string | null;
    price: number;
    currency: string;
    category?: string | null;
    turnaround?: string | null;
    status: string;
    createdAt: string;
    updatedAt: string;
    indexedAt?: string;
    blockHeight?: number;
    sessionParams?: Record<string, unknown> | null;
    acceptedCurrencies?: Array<{
        currency: string;
        price: number;
    }>;
    reactivationFee?: number;
    idleTimeout?: number;
    pauseTTL?: number;
}
export interface ServiceSearchParams {
    agentId?: string;
    verusId?: string;
    category?: string;
    status?: string;
    minPrice?: number;
    maxPrice?: number;
    q?: string;
    limit?: number;
    offset?: number;
    sort?: string;
    order?: 'asc' | 'desc';
}
export interface UpdateServiceData {
    name?: string;
    description?: string | null;
    price?: number;
    currency?: string;
    category?: string | null;
    turnaround?: string | null;
    status?: 'active' | 'inactive' | 'deprecated';
    sovguard?: boolean;
}
export interface JobFile {
    id: string;
    jobId: string;
    messageId: string;
    uploaderVerusId: string;
    filename: string;
    mimeType: string;
    sizeBytes: number;
    checksum: string;
    createdAt: string;
    downloadUrl: string;
}
export interface AgentSummary {
    id: string;
    internalId?: string;
    name: string;
    type: string;
    description?: string | null;
    owner?: string | null;
    status: string;
    revoked?: boolean;
    privacyTier?: string;
    createdAt: string;
    updatedAt: string;
    indexedAt?: string;
    blockHeight?: number;
    protocols?: string[];
    trustInfo?: Record<string, unknown>;
}
export interface AgentCapability {
    id: string;
    name: string;
    description?: string | null;
    protocol: string;
    endpoint: string;
    public: boolean;
    pricing?: {
        model: string;
        amount: string;
        currency: string;
    } | null;
}
export interface AgentDetail extends AgentSummary {
    capabilities: AgentCapability[];
    endpoints: {
        url: string;
        protocol: string;
        public: boolean;
    }[];
}
export interface AgentSearchParams {
    status?: 'active' | 'inactive' | 'deprecated';
    type?: 'autonomous' | 'assisted' | 'hybrid' | 'tool';
    capability?: string;
    owner?: string;
    limit?: number;
    offset?: number;
    sort?: 'created_at' | 'updated_at' | 'name' | 'block_height';
    order?: 'asc' | 'desc';
}
export interface PaginationMeta {
    total: number;
    limit: number;
    offset: number;
    hasMore: boolean;
}
export interface Review {
    id: string;
    agentVerusId: string;
    buyerVerusId: string;
    jobHash: string;
    message: string;
    rating: number;
    signature: string;
    timestamp: number;
    verified: boolean;
    indexedAt?: string;
    blockHeight?: number;
}
export interface ReputationData {
    verusId: string;
    name: string;
    score: number;
    rawAverage?: number;
    totalReviews: number;
    verifiedReviews?: number;
    uniqueReviewers?: number;
    reviewerDiversity?: number;
    confidence: number;
    trending?: number;
    recentReviews?: number;
    transparency?: number;
    sybilFlags?: string[];
    timestamps?: {
        oldest: string;
        newest: string;
        calculated: string;
    };
}
export interface TopAgent {
    verusId: string;
    name: string;
    totalReviews: number;
    verifiedReviews: number;
    averageRating: number;
    totalJobsCompleted: number;
}
export interface DataPolicy {
    agentVerusId: string;
    retention: 'none' | 'job-duration' | '30-days' | 'permanent';
    allowTraining: boolean;
    allowThirdParty: boolean;
    deletionAttestationSupported: boolean;
    modelInfo?: {
        provider?: string;
        model?: string;
        hosting?: 'self-hosted' | 'cloud' | 'undisclosed';
    };
    updatedAt: string;
}
export interface SetDataPolicyData {
    retention: 'none' | 'job-duration' | '30-days' | 'permanent';
    allowTraining: boolean;
    allowThirdParty: boolean;
    deletionAttestationSupported: boolean;
    modelInfo?: {
        provider?: string;
        model?: string;
        hosting?: 'self-hosted' | 'cloud' | 'undisclosed';
    };
}
export interface JobDataTerms {
    terms: {
        retention: string;
        allowTraining: boolean;
        allowThirdParty: boolean;
        requireDeletionAttestation: boolean;
        acceptedBySeller: boolean;
        acceptedAt: string;
    } | null;
    attestation: {
        signed: boolean;
        scope: string;
        signedAt: string;
        verified: boolean;
    } | null;
    jobStatus: string;
}
export interface DeletionAttestationRecord {
    id: string;
    jobId: string;
    agentVerusId: string;
    scope: string;
    signatureVerified: boolean;
    createdAt: string;
    note: string;
}
export interface HeldMessage {
    id: string;
    senderVerusId: string;
    content: string;
    safetyScore: number;
    holdReason: string;
    heldAt: string;
    appealCount: number;
    lastAppealAt: string | null;
}
export interface HoldQueueStats {
    totalHeld: number;
    byReason: Record<string, number>;
    averageHoldTime: number;
    appealRate: number;
}
export interface CanaryRecord {
    id: string;
    token: string;
    format: string;
    created_at: string;
}
export interface Alert {
    id: string;
    type: string;
    title: string;
    body: string;
    jobId?: string | null;
    read: boolean;
    createdAt: string;
}
export interface RawIdentityData {
    identity: {
        name: string;
        identityaddress: string;
        parent: string;
        contentmap?: Record<string, string>;
        contentmultimap?: Record<string, unknown[]>;
        primaryaddresses: string[];
        minimumsignatures: number;
        revocationauthority: string;
        recoveryauthority: string;
        systemid?: string;
        version?: number;
        flags?: number;
    };
    txid: string | null;
    blockHeight: number;
    prevOutput: {
        txid: string;
        vout: number;
        scriptHex: string;
        value: number;
    } | null;
}
export interface WebhookRegistration {
    id: string;
    url: string;
    events: string[];
    secret: string;
    status: 'active' | 'inactive' | 'failed';
    createdAt: string;
    updatedAt: string;
}
export interface WebhookListItem {
    id: string;
    url: string;
    events: string[];
    status: 'active' | 'inactive' | 'failed';
    createdAt: string;
    updatedAt: string;
}
export interface WebhookPayload {
    event: string;
    timestamp: string;
    jobId?: string;
    data: Record<string, unknown>;
}
export interface TrustScore {
    score: number;
    tier: string;
    isNew: boolean;
    firstSeenAt: string;
    scoredAt: string;
}
export interface TrustDetail {
    score: number;
    tier: string;
    subScores: {
        uptime: number;
        completion: number;
        responsiveness: number;
        transparency: number;
        safety: number;
    };
    weights: Record<string, number>;
    isNew: boolean;
    penalties: string[];
    firstSeenAt: string;
}
export interface TrustHistory {
    snapshots: Array<{
        score: number;
        tier: string;
        scoredAt: string;
    }>;
}
export interface Bounty {
    id: string;
    poster_verus_id: string;
    title: string;
    description: string;
    amount: number;
    currency: string;
    category: string | null;
    max_claimants: number;
    application_deadline: string | null;
    min_reviews: number | null;
    min_trust_tier: string | null;
    required_category: string | null;
    status: 'open' | 'reviewing' | 'awarded' | 'cancelled' | 'expired';
    signature: string;
    created_at: string;
    updated_at: string;
    applications?: BountyApplication[];
}
export interface BountyApplication {
    id: string;
    bounty_id: string;
    applicant_verus_id: string;
    message: string | null;
    selected: boolean;
    created_at: string;
}
export interface PostBountyData {
    title: string;
    description: string;
    amount: number;
    currency?: string;
    category?: string;
    maxClaimants?: number;
    applicationDeadline?: string;
    minReviews?: number;
    minTrustTier?: string;
    requiredCategory?: string;
    signature: string;
    timestamp: number;
}
export interface BountySearchParams {
    category?: string;
    minAmount?: number;
    maxAmount?: number;
    limit?: number;
    offset?: number;
}
export interface Notification {
    id: string;
    type: string;
    title: string;
    body: string;
    jobId?: string | null;
    read: boolean;
    createdAt: string;
}
export interface DisputeDetail {
    jobId: string;
    status: string;
    reason: string;
    filedBy: string;
    filedAt: string;
    response?: {
        action: 'refund' | 'rework' | 'rejected';
        refundPercent?: number;
        reworkCost?: number;
        message: string;
        respondedAt: string;
    };
    refundTxid?: string | null;
    resolvedAt?: string | null;
}
export interface DisputeMetrics {
    verusId: string;
    totalJobs: number;
    totalDisputes: number;
    disputeRate: number;
    asAgent: {
        total: number;
        refunded: number;
        reworked: number;
        rejected: number;
    };
    asBuyer: {
        total: number;
        resolved: number;
    };
}
export interface SubmitReviewData {
    agentVerusId: string;
    buyerVerusId: string;
    jobHash: string;
    message?: string;
    rating?: number;
    timestamp: number;
    signature: string;
}
export interface SubmitApiSessionReviewData {
    agentVerusId: string;
    buyerVerusId: string;
    sessionId: string;
    model?: string;
    requestCount?: number;
    totalSpent?: number;
    message?: string;
    rating?: number;
    timestamp: number;
    signature: string;
}
export interface UpdateWebhookData {
    url?: string;
    events?: string[];
    secret?: string;
    status?: 'active' | 'inactive';
}
export interface WebhookDelivery {
    id: string;
    eventType: string;
    status: string;
    attempts: number;
    lastError: string | null;
    createdAt: string;
    deliveredAt: string | null;
}
export interface BalanceResponse {
    address: string;
    balance: number;
    currency: string;
}
export interface PaymentAddressResponse {
    verusId: string;
    address: string;
}
export interface VerifyPaymentResponse {
    txid: string;
    verified: boolean;
    /**
     * Why verification failed, or null when verified. One of:
     * 'address_not_paid' | 'amount_too_low' | 'insufficient_confirmations' |
     * 'sender_mismatch'. On a provable sender mismatch the platform forces
     * `verified=false` with reason 'sender_mismatch'.
     */
    reason: string | null;
    /** Amount actually paid to the expected address. */
    actualAmount: number;
    /** Amount the caller asserted. */
    expectedAmount: number;
    confirmations: number;
    /** The expected recipient address that was checked. */
    toAddress: string;
    currency: string;
    /**
     * Sender verification (populated only when `expectedSender` was passed AND
     * the platform supports it — advertised via the `tx.sender-verification`
     * feature flag on /health). `senderVerified === true` means the funding tx
     * provably originated from the expected sender; `senderVerusId`/`senderAddress`
     * echo the resolved source. Fields are OMITTED (not false) when sender
     * resolution is genuinely unavailable (coinbase input, unfetchable prevout,
     * >50 inputs, unresolvable identity).
     */
    senderVerified?: boolean;
    senderVerusId?: string;
    senderAddress?: string;
}
export interface CurrencyInfo {
    id: string;
    name: string;
    symbol: string;
    currencyId?: string;
    isToken?: boolean;
}
export interface EarningsResponse {
    total: number;
    currency: string;
    completedJobs: number;
    pendingEarnings: number;
}
export interface NameCheckResponse {
    name: string;
    available: boolean;
    reason?: string;
}
//# sourceMappingURL=index.d.ts.map