import type { CodaliRuntimeAppToolContract, CodaliRuntimeAppToolGatewayContract } from "../runtime/CodaliRuntime.js"; export declare const CODALI_APP_TOOL_GATEWAY_VERSION = "codali.app_tool_gateway.v1"; export type AppToolGatewayDispatchErrorCode = "GATEWAY_TOOL_NOT_ALLOWED" | "GATEWAY_TOOL_DENIED" | "GATEWAY_CONTRACT_NOT_READ_ONLY" | "GATEWAY_ENDPOINT_REQUIRED" | "GATEWAY_SIGNATURE_REQUIRED" | "GATEWAY_INVALID_ARGS" | "GATEWAY_SCOPE_OVERRIDE_BLOCKED" | "GATEWAY_HTTP_FAILED" | "GATEWAY_RESPONSE_MALFORMED"; export declare class AppToolGatewayDispatchError extends Error { readonly code: AppToolGatewayDispatchErrorCode; readonly retryable: boolean; readonly details?: Record; constructor(code: AppToolGatewayDispatchErrorCode, message: string, options?: { retryable?: boolean; details?: Record; }); } export interface CodaliAppToolGatewayScope extends Record { tenant_id?: string; tenant_slug?: string; docdex_repo_id?: string; } export interface CodaliAppToolGatewayRequesterScope extends Record { request_id?: string; owner_user_id?: string; api_key_id?: string; agent_slug?: string; } export interface CodaliAppToolGatewayUnsignedRequest { version: typeof CODALI_APP_TOOL_GATEWAY_VERSION; run_id: string; session_id?: string; request_id?: string; tenant_scope?: CodaliAppToolGatewayScope; requester_scope?: CodaliAppToolGatewayRequesterScope; tool_name: string; validated_args: unknown; timestamp: string; nonce: string; read_only: true; call_schema?: Record; result_contract?: string; result_sources?: string[]; source_paths?: string[]; source_types?: string[]; } export interface CodaliAppToolGatewaySignedRequest extends CodaliAppToolGatewayUnsignedRequest { signature: string; } export interface AppToolGatewayDispatchInput { runId: string; sessionId?: string; requestId?: string; tenantScope?: CodaliAppToolGatewayScope; requesterScope?: CodaliAppToolGatewayRequesterScope; toolName: string; args: unknown; contract: CodaliRuntimeAppToolContract; gateway: CodaliRuntimeAppToolGatewayContract; allowedTools?: string[]; deniedTools?: string[]; now?: () => Date; nonce?: () => string; fetchImpl?: typeof fetch; } export interface AppToolGatewayDispatchResult { request: CodaliAppToolGatewaySignedRequest; redactedRequest: unknown; responseStatus: number; responseText: string; responsePayload: unknown; evidencePayload: Record; redactedResponse: unknown; } export declare const canonicalizeAppToolGatewayPayload: (value: unknown) => string; export declare const signAppToolGatewayRequest: (request: CodaliAppToolGatewayUnsignedRequest, secret: string) => string; export declare const verifyAppToolGatewayRequestSignature: (request: CodaliAppToolGatewaySignedRequest, secret: string) => boolean; export declare const redactAppToolGatewayPayload: (value: unknown) => unknown; export declare const buildAppToolGatewaySignedRequest: (input: { runId: string; sessionId?: string; requestId?: string; tenantScope?: CodaliAppToolGatewayScope; requesterScope?: CodaliAppToolGatewayRequesterScope; toolName: string; args: unknown; contract: CodaliRuntimeAppToolContract; timestamp: string; nonce: string; secret: string; }) => CodaliAppToolGatewaySignedRequest; export declare const dispatchAppToolGateway: (input: AppToolGatewayDispatchInput) => Promise; //# sourceMappingURL=AppToolGatewayDispatcher.d.ts.map