import { type InvocationRateLimit } from './invocation-rate-limit.js'; import { type AgentFailureContext, type AgentFailureFeedback } from './agent-feedback.js'; import type { BailingHubRuntimeConfig } from './runtime-config.js'; export declare const TERMINAL_STATUSES: readonly ["done", "error", "rejected"]; export declare const KNOWN_STATUSES: readonly ["queued", "running", "dispatched", "done", "error", "rejected"]; export declare const CLIENT_API_LIMITS: { readonly requestId: 128; readonly input: 100000; readonly toolDescription: 1200; readonly toolResultText: 8192; readonly toolCatalogEntries: 512; readonly responseBytes: number; readonly toolArgumentsBytes: number; }; export declare const AGENT_TOOL_INVOCATION_STATES: readonly ["executed", "business_rejected", "awaiting_approval", "denied", "rejected_before_dispatch", "reconciliation_required", "in_progress"]; export type AgentToolInvocationState = (typeof AGENT_TOOL_INVOCATION_STATES)[number]; export type AgentToolCatalogEntry = { name: string; description: string; description_truncated?: boolean; usage_guidance_available?: boolean; input_schema: Record; scope: string; risk: 'low' | 'medium' | 'high'; approval_required: boolean; readonly: boolean; idempotent: boolean; }; export type AgentToolCatalog = { schema_version: 'bailing.agent-tool-catalog.v1'; route: string; capability_revision: string; tools: AgentToolCatalogEntry[]; }; export type AgentToolInvocation = { schema_version: 'bailing.agent-tool-invocation.v1'; invocation_id: string; route: string; tool: string; state: AgentToolInvocationState; ok: boolean; auto_retry_allowed: boolean; retry_after_ms?: number; rate_limit?: InvocationRateLimit; text: string; business_status?: number; approval_id?: number; feedback?: AgentFailureFeedback; }; export type InvokeAgentToolInput = { invocationId: string; capabilityRevision: string; agentRunId: string; tool: string; arguments: Record; }; export type BailingHubClientErrorDisposition = 'accepted_unknown' | 'definitive_rejection' | 'refresh_required'; export type BailingHubClientErrorDetails = { origin?: 'core' | 'client'; dispatch?: 'not_dispatched'; limitScope?: 'arguments' | 'request_body'; actualBytes?: number; maxBytes?: number; observedBytes?: number; }; export type BailingHubJob = Record & { job_id: string; request_id: string; status: string; terminal: boolean; }; export declare class BailingHubClientError extends Error { readonly statusCode?: number | undefined; readonly retryable: boolean; readonly publicCode?: string | undefined; readonly disposition: BailingHubClientErrorDisposition; readonly invocationId?: string | undefined; readonly details: BailingHubClientErrorDetails; feedback?: AgentFailureFeedback; constructor(message: string, statusCode?: number | undefined, retryable?: boolean, publicCode?: string | undefined, disposition?: BailingHubClientErrorDisposition, invocationId?: string | undefined, failureContext?: AgentFailureContext, details?: BailingHubClientErrorDetails); get origin(): "core" | "client" | undefined; get dispatch(): "not_dispatched" | undefined; get limitScope(): "arguments" | "request_body" | undefined; get actualBytes(): number | undefined; get maxBytes(): number | undefined; get observedBytes(): number | undefined; } export declare class BailingHubToolArgumentsError extends BailingHubClientError { constructor(actualBytes: number, maxBytes: number, invocationId?: string); } /** Only documented scalar overflow evidence may cross the public error boundary. */ export declare function publicToolArgumentsErrorDetails(body: Record, code?: string): BailingHubClientErrorDetails; /** Snapshot the exact JSON object that will be sent, including UTF-8 and JSON escaping. */ export declare function normalizeAgentToolArguments(value: unknown, invocationId?: string): Record; export declare class BailingHubClient { private readonly config; private readonly fetchImpl; constructor(config: BailingHubRuntimeConfig, fetchImpl?: typeof fetch); submitJob(requestIdValue: unknown, inputValue: unknown): Promise; getAgentToolCatalog(): Promise; invokeAgentTool(input: InvokeAgentToolInput): Promise; resumeAgentToolInvocation(invocationIdValue: unknown): Promise; getJob(jobIdValue: unknown): Promise; waitForJob(jobIdValue: unknown, maxWaitSecondsValue?: unknown, options?: { pollIntervalMilliseconds?: number; now?: () => number; sleep?: (milliseconds: number) => Promise; }): Promise; private request; private send; } //# sourceMappingURL=client.d.ts.map