@xynehq/jaf
Version:
Juspay Agent Framework - A purely functional agent framework with immutable state and composable tools
378 lines • 21.4 kB
TypeScript
/**
* A2A Integration for JAF - Main Export
* Pure functional A2A protocol support for Functional Agent Framework
*/
export type { A2AAgent, A2AAgentTool, A2AMessage, A2APart, A2ATask, A2AArtifact, A2AError, A2AStreamEvent, AgentCard, AgentSkill, AgentState, StreamEvent, ToolContext, A2AToolResult, JSONRPCRequest, JSONRPCResponse, JSONRPCError, SendMessageRequest, SendStreamingMessageRequest, GetTaskRequest, MessageSendConfiguration, A2AServerConfig, A2AClientConfig, A2AClientState } from './types.js';
export type { A2AExecutionContext, A2AExecutionEvent, A2AExecutionResult } from './executor.js';
export { createA2AAgent, createA2ATool, getProcessingMessage, createInitialAgentState, addMessageToState, updateStateFromRunResult, createUserMessage, transformA2AAgentToJAF, transformA2AToolToJAF, createRunConfigForA2AAgent, transformToRunState, processAgentQuery, extractTextFromA2AMessage, createA2ATextMessage, createA2ADataMessage, createA2ATask, updateA2ATaskStatus, addArtifactToA2ATask, completeA2ATask } from './agent.js';
export { executeA2AAgent, convertToA2AStreamEvents, executeA2AAgentWithStreaming } from './executor.js';
export { validateJSONRPCRequest, createJSONRPCSuccessResponse, createJSONRPCErrorResponse, createA2AError, mapErrorToA2AError, validateSendMessageRequest, handleMessageSend, handleMessageStream, handleTasksGet, handleTasksCancel, handleGetAuthenticatedExtendedCard, routeA2ARequest, createProtocolHandlerConfig } from './protocol.js';
export { generateAgentCard, generateSkillsFromAgents, generateExamplesForAgent, generateExamplesForTool, generateSecuritySchemes, generateSecurityRequirements, generateAgentCardForAgent, validateAgentCard, createMinimalAgentCard, mergeAgentCards, createAgentCardFromConfig } from './agent-card.js';
export { createA2AServer, startA2AServer } from './server.js';
import { createSimpleA2ATaskProvider } from './memory/factory.js';
export { createA2AClient, createMessageRequest, createStreamingMessageRequest, sendA2ARequest, sendMessage, streamMessage, getAgentCard, discoverAgents, sendMessageToAgent, streamMessageToAgent, extractTextResponse, checkA2AHealth, getA2ACapabilities, connectToA2AAgent } from './client.js';
export { A2AErrorCodes } from './types.js';
export { a2aMessageSchema, sendMessageRequestSchema } from './types.js';
export * from './memory/index.js';
export { createWeatherAgent, getWeatherAgentProcessingMessage, weatherAgentExamples } from './examples/weather-agent.js';
export { createCalculatorAgent, createGreetingAgent, startExampleServer } from './examples/server-example.js';
export declare const A2A: {
readonly agent: (config: {
readonly name: string;
readonly description: string;
readonly instruction: string;
readonly tools: readonly import("./types.js").A2AAgentTool[];
readonly supportedContentTypes?: readonly string[];
}) => import("./types.js").A2AAgent;
readonly tool: <T>(config: {
readonly name: string;
readonly description: string;
readonly parameters: import("zod").ZodType<T>;
readonly execute: (args: T, context?: import("./types.js").ToolContext) => Promise<any | import("./types.js").A2AToolResult>;
}) => import("./types.js").A2AAgentTool;
readonly server: {
readonly create: (config: import("./types.js").A2AServerConfig) => Promise<{
app: import("fastify").FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>;
config: {
host: string;
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
agentCard: {
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
protocolVersion: string;
name: string;
description: string;
url: string;
preferredTransport?: string;
version: string;
provider?: {
readonly organization: string;
readonly url: string;
};
defaultInputModes: readonly string[];
defaultOutputModes: readonly string[];
skills: readonly import("./types.js").AgentSkill[];
securitySchemes?: Readonly<Record<string, any>>;
security?: readonly Record<string, readonly string[]>[];
};
taskProvider: import("./memory/types.js").A2ATaskProvider;
protocolHandler: {
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
modelProvider: any;
agentCard: any;
taskProvider: import("./memory/types.js").A2ATaskProvider | undefined;
handleRequest: (request: import("./types.js").JSONRPCRequest, agentName?: string) => Promise<import("./types.js").JSONRPCResponse> | AsyncGenerator<import("./types.js").JSONRPCResponse, void, unknown>;
};
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
port: number;
};
start: () => Promise<void>;
stop: () => Promise<void>;
addAgent: (name: string, agent: import("./types.js").A2AAgent) => {
host: string;
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
agentCard: {
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
protocolVersion: string;
name: string;
description: string;
url: string;
preferredTransport?: string;
version: string;
provider?: {
readonly organization: string;
readonly url: string;
};
defaultInputModes: readonly string[];
defaultOutputModes: readonly string[];
skills: readonly import("./types.js").AgentSkill[];
securitySchemes?: Readonly<Record<string, any>>;
security?: readonly Record<string, readonly string[]>[];
};
taskProvider: import("./memory/types.js").A2ATaskProvider;
protocolHandler: {
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
modelProvider: any;
agentCard: any;
taskProvider: import("./memory/types.js").A2ATaskProvider | undefined;
handleRequest: (request: import("./types.js").JSONRPCRequest, agentName?: string) => Promise<import("./types.js").JSONRPCResponse> | AsyncGenerator<import("./types.js").JSONRPCResponse, void, unknown>;
};
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
port: number;
};
removeAgent: (name: string) => {
host: string;
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
agentCard: {
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
protocolVersion: string;
name: string;
description: string;
url: string;
preferredTransport?: string;
version: string;
provider?: {
readonly organization: string;
readonly url: string;
};
defaultInputModes: readonly string[];
defaultOutputModes: readonly string[];
skills: readonly import("./types.js").AgentSkill[];
securitySchemes?: Readonly<Record<string, any>>;
security?: readonly Record<string, readonly string[]>[];
};
taskProvider: import("./memory/types.js").A2ATaskProvider;
protocolHandler: {
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
modelProvider: any;
agentCard: any;
taskProvider: import("./memory/types.js").A2ATaskProvider | undefined;
handleRequest: (request: import("./types.js").JSONRPCRequest, agentName?: string) => Promise<import("./types.js").JSONRPCResponse> | AsyncGenerator<import("./types.js").JSONRPCResponse, void, unknown>;
};
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
port: number;
};
getAgentCard: () => {
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
protocolVersion: string;
name: string;
description: string;
url: string;
preferredTransport?: string;
version: string;
provider?: {
readonly organization: string;
readonly url: string;
};
defaultInputModes: readonly string[];
defaultOutputModes: readonly string[];
skills: readonly import("./types.js").AgentSkill[];
securitySchemes?: Readonly<Record<string, any>>;
security?: readonly Record<string, readonly string[]>[];
};
handleRequest: (request: import("./types.js").JSONRPCRequest) => Promise<import("./types.js").JSONRPCResponse | AsyncIterable<import("./types.js").JSONRPCResponse>>;
}>;
readonly start: (config: import("./types.js").A2AServerConfig) => Promise<{
app: import("fastify").FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>;
config: {
host: string;
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
agentCard: {
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
protocolVersion: string;
name: string;
description: string;
url: string;
preferredTransport?: string;
version: string;
provider?: {
readonly organization: string;
readonly url: string;
};
defaultInputModes: readonly string[];
defaultOutputModes: readonly string[];
skills: readonly import("./types.js").AgentSkill[];
securitySchemes?: Readonly<Record<string, any>>;
security?: readonly Record<string, readonly string[]>[];
};
taskProvider: import("./memory/types.js").A2ATaskProvider;
protocolHandler: {
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
modelProvider: any;
agentCard: any;
taskProvider: import("./memory/types.js").A2ATaskProvider | undefined;
handleRequest: (request: import("./types.js").JSONRPCRequest, agentName?: string) => Promise<import("./types.js").JSONRPCResponse> | AsyncGenerator<import("./types.js").JSONRPCResponse, void, unknown>;
};
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
port: number;
};
start: () => Promise<void>;
stop: () => Promise<void>;
addAgent: (name: string, agent: import("./types.js").A2AAgent) => {
host: string;
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
agentCard: {
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
protocolVersion: string;
name: string;
description: string;
url: string;
preferredTransport?: string;
version: string;
provider?: {
readonly organization: string;
readonly url: string;
};
defaultInputModes: readonly string[];
defaultOutputModes: readonly string[];
skills: readonly import("./types.js").AgentSkill[];
securitySchemes?: Readonly<Record<string, any>>;
security?: readonly Record<string, readonly string[]>[];
};
taskProvider: import("./memory/types.js").A2ATaskProvider;
protocolHandler: {
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
modelProvider: any;
agentCard: any;
taskProvider: import("./memory/types.js").A2ATaskProvider | undefined;
handleRequest: (request: import("./types.js").JSONRPCRequest, agentName?: string) => Promise<import("./types.js").JSONRPCResponse> | AsyncGenerator<import("./types.js").JSONRPCResponse, void, unknown>;
};
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
port: number;
};
removeAgent: (name: string) => {
host: string;
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
agentCard: {
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
protocolVersion: string;
name: string;
description: string;
url: string;
preferredTransport?: string;
version: string;
provider?: {
readonly organization: string;
readonly url: string;
};
defaultInputModes: readonly string[];
defaultOutputModes: readonly string[];
skills: readonly import("./types.js").AgentSkill[];
securitySchemes?: Readonly<Record<string, any>>;
security?: readonly Record<string, readonly string[]>[];
};
taskProvider: import("./memory/types.js").A2ATaskProvider;
protocolHandler: {
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
modelProvider: any;
agentCard: any;
taskProvider: import("./memory/types.js").A2ATaskProvider | undefined;
handleRequest: (request: import("./types.js").JSONRPCRequest, agentName?: string) => Promise<import("./types.js").JSONRPCResponse> | AsyncGenerator<import("./types.js").JSONRPCResponse, void, unknown>;
};
agents: ReadonlyMap<string, import("./types.js").A2AAgent>;
port: number;
};
getAgentCard: () => {
capabilities: Partial<{
readonly streaming?: boolean;
readonly pushNotifications?: boolean;
readonly stateTransitionHistory?: boolean;
}>;
protocolVersion: string;
name: string;
description: string;
url: string;
preferredTransport?: string;
version: string;
provider?: {
readonly organization: string;
readonly url: string;
};
defaultInputModes: readonly string[];
defaultOutputModes: readonly string[];
skills: readonly import("./types.js").AgentSkill[];
securitySchemes?: Readonly<Record<string, any>>;
security?: readonly Record<string, readonly string[]>[];
};
handleRequest: (request: import("./types.js").JSONRPCRequest) => Promise<import("./types.js").JSONRPCResponse | AsyncIterable<import("./types.js").JSONRPCResponse>>;
}>;
};
readonly client: {
readonly create: (baseUrl: string, config?: Partial<import("./types.js").A2AClientConfig>) => import("./types.js").A2AClientState;
readonly connect: (baseUrl: string) => Promise<{
client: import("./types.js").A2AClientState;
agentCard: import("./types.js").AgentCard;
ask: (message: string, config?: any) => Promise<string>;
stream: (message: string, config?: any) => AsyncGenerator<import("./types.js").A2AStreamEvent, void, unknown>;
health: () => Promise<{
status: string;
agents: string[];
timestamp: string;
}>;
capabilities: () => Promise<any>;
}>;
readonly discover: (baseUrl: string) => Promise<import("./types.js").AgentCard>;
};
readonly protocol: {
readonly validate: (request: any) => request is import("./types.js").JSONRPCRequest;
readonly createSuccess: (id: string | number, result: any) => import("./types.js").JSONRPCResponse;
readonly createError: (id: string | number | null, error: import("./types.js").JSONRPCError) => import("./types.js").JSONRPCResponse;
};
readonly card: {
readonly generate: (config: import("./types.js").A2AServerConfig["agentCard"], agents: ReadonlyMap<string, import("./types.js").A2AAgent>, baseUrl?: string) => import("./types.js").AgentCard;
readonly validate: (card: import("./types.js").AgentCard) => {
isValid: boolean;
errors: readonly string[];
};
readonly minimal: (name: string, description: string, url?: string) => import("./types.js").AgentCard;
};
readonly memory: {
readonly createTaskProvider: (config: import("./memory/types.js").A2ATaskProviderConfig, externalClients?: {
redis?: any;
postgres?: any;
}) => Promise<import("./memory/types.js").A2ATaskProvider>;
readonly createSimpleTaskProvider: typeof createSimpleA2ATaskProvider;
readonly createCompositeTaskProvider: (primary: import("./memory/types.js").A2ATaskProvider, fallback?: import("./memory/types.js").A2ATaskProvider) => import("./memory/types.js").A2ATaskProvider;
readonly createTaskProviderFromEnv: (externalClients?: {
redis?: any;
postgres?: any;
}) => Promise<import("./memory/types.js").A2ATaskProvider>;
readonly validateTaskProviderConfig: (config: any) => {
valid: boolean;
errors: string[];
};
};
};
export default A2A;
//# sourceMappingURL=index.d.ts.map