export type { Logger, LogLevel } from './logger.ts';
export { isStructuredError, RichError, StructuredError } from './error.ts';
export { safeStringify } from './json.ts';
export type { Body, FetchAdapter, FetchErrorResponse, FetchRequest, FetchResponse, FetchSuccessResponse, HttpMethod, } from './fetch.ts';
export { BodySchema, FetchErrorResponseSchema, FetchRequestSchema, FetchResponseSchema, FetchSuccessResponseSchema, HttpMethodSchema, } from './fetch.ts';
export { ServiceException, ServiceExceptionPayloadSchema, type ServiceExceptionPayload, } from './exception.ts';
export { buildUrl, fromResponse, toPayload, toServiceException } from './http-util.ts';
/**
 * HTTP client adapter for Agentuity service clients.
 *
 * This package provides a minimal HTTP adapter that service clients (keyvalue, queue, etc.)
 * use to communicate with Agentuity cloud services. It handles authentication headers,
 * request/response processing, and debug logging.
 *
 * @module @agentuity/adapter
 */
import type { FetchRequest, FetchResponse, FetchAdapter } from './fetch.ts';
import type { Logger } from './logger.ts';
import { ServiceException } from './exception.ts';
/**
 * Configuration for the service fetch adapter.
 */
export interface ServiceAdapterConfig {
    /** Headers to include in all requests */
    headers: Record<string, string>;
    /** Query parameters to append to all requests */
    queryParams?: Record<string, string>;
    /** Hook called before each request */
    onBefore?: (url: string, options: FetchRequest, invoke: () => Promise<void>) => Promise<void>;
    /** Hook called after each request */
    onAfter?: <T>(url: string, options: FetchRequest, response: FetchResponse<T>, err?: InstanceType<typeof ServiceException>) => Promise<void>;
}
/**
 * Options for building client request headers.
 */
export interface BuildClientHeadersOptions {
    /** API key for authentication (Bearer token) */
    apiKey?: string;
    /** Organization ID for multi-tenant requests */
    orgId?: string;
}
/**
 * Builds standard headers for Agentuity service clients.
 *
 * This helper creates the header object needed by `createServerFetchAdapter`,
 * handling authentication and multi-tenant scoping consistently across all clients.
 *
 * @param options - Options containing apiKey and/or orgId
 * @returns Headers object ready to pass to createServerFetchAdapter
 *
 * @example
 * ```typescript
 * import { buildClientHeaders, createServerFetchAdapter } from '@agentuity/adapter';
 *
 * const headers = buildClientHeaders({ apiKey: 'sk_xxx', orgId: 'org_xxx' });
 * const adapter = createServerFetchAdapter({ headers }, logger);
 * ```
 */
export declare function buildClientHeaders(options: BuildClientHeadersOptions): Record<string, string>;
/**
 * Redacts the middle of a string while keeping a prefix and suffix visible.
 * Ensures that if the string is too short, everything is redacted.
 *
 * @param input The string to redact
 * @param prefix Number of chars to keep at the start
 * @param suffix Number of chars to keep at the end
 * @param mask Character used for redaction
 */
export declare function redact(input: string, prefix?: number, suffix?: number, mask?: string): string;
declare class ServerFetchAdapter implements FetchAdapter {
    #private;
    constructor(config: ServiceAdapterConfig, logger: Logger);
    private _invoke;
    invoke<T>(url: string, options?: FetchRequest): Promise<FetchResponse<T>>;
}
/**
 * Create a Server Side Fetch Adapter to allow the server to add headers and track outgoing requests.
 *
 * This adapter is used by all Agentuity service clients (KeyValueClient, QueueClient, etc.)
 * to communicate with Agentuity cloud services.
 *
 * @param config - Configuration containing headers and optional hooks
 * @param logger - Logger instance for debug output
 * @returns A FetchAdapter instance
 *
 * @example
 * ```typescript
 * import { createServerFetchAdapter, buildClientHeaders } from '@agentuity/adapter';
 * import { createMinimalLogger } from '@agentuity/core';
 *
 * const headers = buildClientHeaders({ apiKey: 'sk_xxx' });
 * const adapter = createServerFetchAdapter({ headers }, createMinimalLogger());
 *
 * // Use with a service
 * const service = new KeyValueStorageService('https://api.agentuity.sh', adapter);
 * ```
 */
export declare function createServerFetchAdapter(config: ServiceAdapterConfig, logger: Logger): ServerFetchAdapter;
//# sourceMappingURL=index.d.ts.map