import { A as A2ARequestHandler } from '../../a2a_request_handler-BuP9LgXH.js'; import { U as UserBuilder } from '../../handlers-Bje5MAUM.js'; export { v as AgentCardHandlerOptions, A as AgentCardProvider, J as JsonRpcHandlerOptions, x as RestHandlerOptions, q as agentCardHandler, s as jsonRpcHandler, t as restHandler } from '../../handlers-Bje5MAUM.js'; import { L as Logger } from '../../logger-DM9C11Ou.js'; export { C as ConsoleLogger, J as JsonLogger, b as LogContext, a as LogLevel, N as NoopLogger } from '../../logger-DM9C11Ou.js'; import '../../extensions-DvruCIzw.js'; /** * Fresh integration for the A2A Server library. * * Provides A2AFreshApp for Deno's Fresh web framework. * Fresh uses file-based routing, so this adapter provides handlers * that can be used in route files. */ /** * Fresh handler context type. */ interface FreshContext { params: Record; state: Record; render: (data?: unknown) => Response | Promise; renderNotFound: () => Response | Promise; } /** * Fresh handler function type. */ type FreshHandler = (request: Request, ctx: FreshContext) => Response | Promise; /** * Fresh Handlers object type. */ interface FreshHandlers { GET?: FreshHandler; POST?: FreshHandler; PUT?: FreshHandler; DELETE?: FreshHandler; PATCH?: FreshHandler; } /** * Configuration options for A2AFreshApp. * Follows the unified A2AServerOptions pattern for consistency across all server implementations. */ interface A2AFreshOptions { /** Logger instance for request/error logging */ logger?: Logger; /** Function to build user from web-standard Request */ userBuilder?: UserBuilder; /** Path for agent card endpoint (default: '/.well-known/agent-card.json') */ agentCardPath?: string; /** Enable REST API endpoints (default: false) */ enableRest?: boolean; /** Base path for REST endpoints (default: '/rest') */ restBasePath?: string; } /** * A2AFreshApp provides A2A protocol support for Fresh applications. * * @example * ```ts * const a2aApp = new A2AFreshApp(requestHandler, { * enableRest: true, * logger: JsonLogger.create(), * }); * * // In your route file: * export const handler = a2aApp.createHandlers('/a2a'); * ``` */ declare class A2AFreshApp { private requestHandler; private options; constructor(requestHandler: A2ARequestHandler, options?: A2AFreshOptions); /** * Creates a Fresh-compatible handler for A2A endpoints. * * @param basePath - Base path for A2A routes (default: '/a2a') * @returns Fresh handler function */ createHandler(basePath?: string): FreshHandler; /** * Creates Fresh Handlers object for A2A endpoints. * This is the recommended way to use A2A with Fresh. * * @example * ```ts * // routes/a2a/[...path].ts * export const handler = a2aApp.createHandlers('/a2a'); * ``` * * @param basePath - Base path for A2A routes (default: '/a2a') * @returns Fresh Handlers object */ createHandlers(basePath?: string): FreshHandlers; /** * Creates individual route handlers for Fresh's file-based routing. * Use this when you want separate route files for each endpoint. * * @example * ```ts * const { agentCard, jsonRpc, rest } = a2aApp.createRouteHandlers(); * * // routes/.well-known/agent-card.json.ts * export const handler: Handlers = { GET: agentCard }; * * // routes/a2a/index.ts * export const handler: Handlers = { POST: jsonRpc }; * ``` */ createRouteHandlers(): { agentCard: FreshHandler; jsonRpc: FreshHandler; rest: FreshHandler; }; } export { A2AFreshApp, type A2AFreshOptions, type FreshContext, type FreshHandler, type FreshHandlers, Logger, UserBuilder };