@runtypelabs/a2a-aisdk-example 0.0.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts","../src/time-executor.ts","../src/executor.ts","../src/default-skills.ts","../src/server.ts","../src/client.ts"],"sourcesContent":["/**\n * A2A Protocol Types\n *\n * Based on A2A Protocol v0.3\n * https://a2aproject.github.io/A2A/specification/\n */\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Agent Card\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport interface AgentCard {\n name: string\n description: string\n url: string\n version: string\n protocolVersion: string\n defaultInputModes: Array<'text' | 'file' | 'data'>\n defaultOutputModes: Array<'text' | 'file' | 'data'>\n iconUrl?: string\n provider?: {\n organization: string\n url?: string\n }\n capabilities: {\n streaming: boolean\n pushNotifications: boolean\n statefulness: 'none' | 'session' | 'task'\n }\n skills: Skill[]\n authentication?: {\n type: 'none' | 'bearer' | 'api_key'\n bearerAuth?: {\n scopes: string[]\n }\n apiKeyAuth?: {\n headerName: string\n }\n }\n}\n\nexport interface Skill {\n id: string\n name: string\n description: string\n inputModes: Array<'text' | 'file' | 'data'>\n outputModes: Array<'text' | 'file' | 'data'>\n tags: string[]\n inputSchema?: Record<string, unknown>\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// JSON-RPC\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport interface JsonRpcRequest {\n jsonrpc: '2.0'\n id?: string | number\n method: string\n params?: unknown\n}\n\nexport interface JsonRpcResponse {\n jsonrpc: '2.0'\n id?: string | number\n result?: unknown\n error?: JsonRpcError\n}\n\nexport interface JsonRpcError {\n code: number\n message: string\n data?: unknown\n}\n\n// Standard JSON-RPC error codes\nexport const JSON_RPC_ERRORS = {\n PARSE_ERROR: -32700,\n INVALID_REQUEST: -32600,\n METHOD_NOT_FOUND: -32601,\n INVALID_PARAMS: -32602,\n INTERNAL_ERROR: -32603,\n // Custom A2A errors\n TASK_NOT_FOUND: -32001,\n SKILL_NOT_FOUND: -32002,\n UNAUTHORIZED: -32003,\n RATE_LIMITED: -32004,\n TASK_CANCELED: -32005,\n} as const\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Messages\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport interface MessagePart {\n type: 'text' | 'file' | 'data'\n text?: string\n data?: unknown\n mimeType?: string\n uri?: string\n}\n\nexport interface A2AMessage {\n role: 'user' | 'agent'\n parts: MessagePart[]\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Tasks\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport type TaskStatus = 'submitted' | 'working' | 'completed' | 'failed' | 'canceled'\n\nexport interface Task {\n id: string\n contextId?: string\n status: TaskStatus\n artifacts?: Artifact[]\n error?: { message: string }\n metadata?: Record<string, unknown>\n}\n\nexport interface Artifact {\n name: string\n parts: MessagePart[]\n index?: number\n append?: boolean\n lastChunk?: boolean\n}\n\nexport interface TaskHistoryEntry {\n status: TaskStatus\n message: string\n timestamp: string\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Method Parameters\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport interface TasksSendParams {\n skill: string\n message: A2AMessage\n contextId?: string\n pushNotification?: {\n url: string\n authentication?: {\n type: 'bearer' | 'api_key'\n token?: string\n headerName?: string\n }\n }\n metadata?: Record<string, unknown>\n}\n\nexport interface TasksGetParams {\n taskId: string\n includeHistory?: boolean\n}\n\nexport interface TasksCancelParams {\n taskId: string\n reason?: string\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// SSE Events\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport interface TaskStatusEvent {\n taskId: string\n contextId?: string\n status: TaskStatus\n message?: string\n final?: boolean\n}\n\nexport interface TaskArtifactEvent {\n taskId: string\n artifact: Artifact\n}\n\nexport interface TaskErrorEvent {\n taskId: string\n error: {\n code: number\n message: string\n }\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Agent Configuration\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport interface AgentConfig {\n name: string\n description?: string\n version?: string\n port?: number\n host?: string\n provider?: {\n organization: string\n url?: string\n }\n skills?: SkillConfig[]\n defaultInputModes?: Array<'text' | 'file' | 'data'>\n defaultOutputModes?: Array<'text' | 'file' | 'data'>\n llm?: LLMConfig\n}\n\nexport interface SkillConfig {\n id: string\n name: string\n description: string\n systemPrompt?: string\n inputSchema?: Record<string, unknown>\n tags?: string[]\n}\n\nexport interface LLMConfig {\n provider: 'openai' | 'anthropic'\n model: string\n /** Gateway model string (e.g. openai/gpt-5-nano) when using Vercel AI Gateway */\n gatewayModel?: string\n apiKey?: string\n temperature?: number\n maxOutputTokens?: number\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Executor Interface\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport interface ExecutorContext {\n taskId: string\n contextId?: string\n skill: SkillConfig\n message: A2AMessage\n metadata?: Record<string, unknown>\n}\n\nexport interface ExecutorResult {\n text: string\n artifacts?: Artifact[]\n}\n\nexport interface StreamCallbacks {\n onChunk: (text: string) => Promise<void>\n onComplete: () => Promise<void>\n onError: (error: Error) => Promise<void>\n}\n","/**\n * Deterministic Time Executor\n *\n * Computes temporal data using date-fns and the system clock.\n * No LLM generation — all results are deterministic.\n */\n\nimport {\n format,\n addDays,\n addWeeks,\n addMonths,\n addBusinessDays,\n differenceInDays,\n differenceInHours,\n differenceInMinutes,\n isWeekend,\n isBefore,\n parseISO,\n} from 'date-fns'\nimport { formatInTimeZone } from 'date-fns-tz'\nimport type { ExecutorContext, ExecutorResult, A2AMessage } from './types.js'\n\ninterface TimeToolResponse {\n result: Record<string, unknown>\n computed: {\n method: 'deterministic'\n source: 'system_clock' | 'date_arithmetic'\n }\n usage: string\n}\n\nfunction createResponse(\n result: Record<string, unknown>,\n source: 'system_clock' | 'date_arithmetic'\n): TimeToolResponse {\n return {\n result,\n computed: { method: 'deterministic', source },\n usage: 'Use this value directly. Do not recalculate.',\n }\n}\n\nfunction extractInput(message: A2AMessage): Record<string, unknown> {\n for (const part of message.parts) {\n if (part.type === 'data' && part.data) {\n return part.data as Record<string, unknown>\n }\n if (part.type === 'text' && part.text) {\n try {\n return JSON.parse(part.text)\n } catch {\n return { expression: part.text }\n }\n }\n }\n return {}\n}\n\nexport async function executeTimeSkill(context: ExecutorContext): Promise<ExecutorResult> {\n const input = extractInput(context.message)\n let response: TimeToolResponse\n\n switch (context.skill.id) {\n case 'time/now': {\n const tz = (input.timezone as string) || 'UTC'\n const now = new Date()\n response = createResponse(\n {\n timestamp: now.toISOString(),\n timezone: tz,\n formatted: formatInTimeZone(now, tz, \"yyyy-MM-dd'T'HH:mm:ssXXX\"),\n human: formatInTimeZone(now, tz, 'EEEE, MMMM d, yyyy h:mm a zzz'),\n day: formatInTimeZone(now, tz, 'EEEE'),\n offset: formatInTimeZone(now, tz, 'xxx'),\n },\n 'system_clock'\n )\n break\n }\n\n case 'time/day_of_week': {\n const dateStr = input.date as string\n if (!dateStr) throw new Error('Missing required field: date')\n const date = parseISO(dateStr)\n if (isNaN(date.getTime())) throw new Error(`Invalid date: ${dateStr}`)\n\n response = createResponse(\n {\n date: dateStr,\n day: format(date, 'EEEE'),\n // @snake-case-ok: A2A protocol response field\n day_index: date.getDay(),\n // @snake-case-ok: A2A protocol response field\n is_weekend: isWeekend(date),\n },\n 'date_arithmetic'\n )\n break\n }\n\n case 'time/add': {\n const baseStr = (input.date as string) || new Date().toISOString().split('T')[0]\n const base = parseISO(baseStr)\n if (isNaN(base.getTime())) throw new Error(`Invalid date: ${baseStr}`)\n\n let result = base\n if (input.days) result = addDays(result, input.days as number)\n if (input.weeks) result = addWeeks(result, input.weeks as number)\n if (input.months) result = addMonths(result, input.months as number)\n\n response = createResponse(\n {\n original: baseStr,\n computed: format(result, 'yyyy-MM-dd'),\n day: format(result, 'EEEE'),\n operation: { days: input.days, weeks: input.weeks, months: input.months },\n },\n 'date_arithmetic'\n )\n break\n }\n\n case 'time/business_days': {\n const baseStr = (input.date as string) || new Date().toISOString().split('T')[0]\n const days = input.days as number\n if (typeof days !== 'number') throw new Error('Missing required field: days')\n\n const base = parseISO(baseStr)\n if (isNaN(base.getTime())) throw new Error(`Invalid date: ${baseStr}`)\n\n const result = addBusinessDays(base, days)\n\n response = createResponse(\n {\n original: baseStr,\n computed: format(result, 'yyyy-MM-dd'),\n day: format(result, 'EEEE'),\n // @snake-case-ok: A2A protocol response field\n business_days_added: days,\n },\n 'date_arithmetic'\n )\n break\n }\n\n case 'time/diff': {\n const from = parseISO(input.from as string)\n const to = parseISO(input.to as string)\n if (isNaN(from.getTime())) throw new Error(`Invalid from date: ${input.from}`)\n if (isNaN(to.getTime())) throw new Error(`Invalid to date: ${input.to}`)\n\n const days = differenceInDays(to, from)\n const hours = differenceInHours(to, from)\n const minutes = differenceInMinutes(to, from)\n\n response = createResponse(\n {\n from: input.from,\n to: input.to,\n difference: { days, hours, minutes },\n human: `${Math.abs(days)} days`,\n },\n 'date_arithmetic'\n )\n break\n }\n\n case 'time/is_past': {\n const ts = input.timestamp as string\n if (!ts) throw new Error('Missing required field: timestamp')\n\n const check = parseISO(ts)\n if (isNaN(check.getTime())) throw new Error(`Invalid timestamp: ${ts}`)\n\n const now = new Date()\n\n response = createResponse(\n {\n timestamp: ts,\n // @snake-case-ok: A2A protocol response field\n is_past: isBefore(check, now),\n // @snake-case-ok: A2A protocol response field\n is_future: isBefore(now, check),\n // @snake-case-ok: A2A protocol response field\n checked_at: now.toISOString(),\n },\n 'system_clock'\n )\n break\n }\n\n case 'time/convert': {\n const ts = input.timestamp as string\n const toTz = input.to as string\n if (!ts) throw new Error('Missing required field: timestamp')\n if (!toTz) throw new Error('Missing required field: to (timezone)')\n\n const date = parseISO(ts)\n if (isNaN(date.getTime())) throw new Error(`Invalid timestamp: ${ts}`)\n\n response = createResponse(\n {\n original: ts,\n converted: formatInTimeZone(date, toTz, \"yyyy-MM-dd'T'HH:mm:ssXXX\"),\n timezone: toTz,\n human: formatInTimeZone(date, toTz, 'EEEE, MMMM d, yyyy h:mm a zzz'),\n },\n 'date_arithmetic'\n )\n break\n }\n\n case 'time/parse': {\n const expr = (input.expression as string)?.toLowerCase()\n const tz = (input.timezone as string) || 'UTC'\n const ref = input.reference ? parseISO(input.reference as string) : new Date()\n\n if (!expr) throw new Error('Missing required field: expression')\n\n let result: Date | null = null\n\n if (expr === 'today') {\n result = ref\n } else if (expr === 'tomorrow') {\n result = addDays(ref, 1)\n } else if (expr === 'yesterday') {\n result = addDays(ref, -1)\n } else if (expr.startsWith('next ')) {\n const dayName = expr.replace('next ', '').split(' ')[0]\n const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']\n const targetDay = days.indexOf(dayName)\n if (targetDay >= 0) {\n let daysToAdd = targetDay - ref.getDay()\n if (daysToAdd <= 0) daysToAdd += 7\n result = addDays(ref, daysToAdd)\n }\n } else if (expr.includes('in ') && expr.includes(' day')) {\n const match = expr.match(/in (\\d+) days?/)\n if (match) result = addDays(ref, parseInt(match[1]))\n } else if (expr.includes('in ') && expr.includes(' week')) {\n const match = expr.match(/in (\\d+) weeks?/)\n if (match) result = addWeeks(ref, parseInt(match[1]))\n }\n\n if (!result) {\n throw new Error(\n `Could not parse expression: \"${expr}\". Supported: today, tomorrow, yesterday, next [day], in N days/weeks`\n )\n }\n\n response = createResponse(\n {\n expression: input.expression,\n resolved: format(result, 'yyyy-MM-dd'),\n day: format(result, 'EEEE'),\n timezone: tz,\n // @snake-case-ok: A2A protocol response field\n reference_used: ref.toISOString(),\n },\n 'date_arithmetic'\n )\n break\n }\n\n default:\n throw new Error(`Unknown time skill: ${context.skill.id}`)\n }\n\n const text = JSON.stringify(response, null, 2)\n return {\n text,\n artifacts: [\n {\n name: 'response',\n parts: [{ type: 'text', text }],\n },\n ],\n }\n}\n","/**\n * Agent Executor\n *\n * Executes tasks using the Vercel AI SDK for LLM integration.\n * Supports both streaming and non-streaming responses.\n */\n\nimport { streamText, generateText, tool, jsonSchema, stepCountIs, type Tool } from 'ai'\nimport { createGateway } from '@ai-sdk/gateway'\nimport { createOpenAI } from '@ai-sdk/openai'\nimport { createAnthropic } from '@ai-sdk/anthropic'\nimport { executeTimeSkill } from './time-executor.js'\nimport type {\n ExecutorContext,\n ExecutorResult,\n StreamCallbacks,\n LLMConfig,\n SkillConfig,\n} from './types.js'\n\n/**\n * Default system prompts for built-in skills\n */\nconst DEFAULT_SYSTEM_PROMPTS: Record<string, string> = {\n chat: `You are a helpful AI assistant. Respond concisely and accurately to the user's questions.`,\n analyze: `You are an analytical AI assistant. Analyze the provided input and give detailed insights.`,\n summarize: `You are a summarization assistant. Provide clear, concise summaries of the provided content.`,\n code: `You are a coding assistant. Help with code-related questions, provide examples, and explain concepts clearly.`,\n}\n\nconst CHAT_SKILL_ID = 'chat'\nconst TOOL_STOP_CONDITION = stepCountIs(5)\nconst TOOL_TAG = 'tool'\nconst LLM_TAG = 'llm'\n\n/**\n * Extract text content from A2A message parts\n */\nfunction extractTextFromMessage(message: ExecutorContext['message']): string {\n return message.parts\n .filter((p) => p.type === 'text' && p.text)\n .map((p) => p.text)\n .join('\\n')\n}\n\n/**\n * Create LLM provider based on configuration.\n * Uses Vercel AI Gateway when AI_GATEWAY_API_KEY is set, with fallback to direct providers.\n */\nfunction createLLMProvider(config: LLMConfig) {\n const gatewayKey = process.env.AI_GATEWAY_API_KEY\n\n if (gatewayKey) {\n const gateway = createGateway({ apiKey: gatewayKey })\n const modelId = config.gatewayModel || `${config.provider}/${config.model}`\n return gateway(modelId)\n }\n\n const apiKey = config.apiKey || process.env[`${config.provider.toUpperCase()}_API_KEY`]\n\n if (!apiKey) {\n throw new Error(\n `API key not provided. Set AI_GATEWAY_API_KEY for Vercel AI Gateway, or ${config.provider.toUpperCase()}_API_KEY for direct provider access.`\n )\n }\n\n switch (config.provider) {\n case 'openai':\n return createOpenAI({ apiKey })(config.model)\n case 'anthropic':\n return createAnthropic({ apiKey })(config.model)\n default:\n throw new Error(`Unsupported LLM provider: ${config.provider}`)\n }\n}\n\n/**\n * Get system prompt for a skill\n */\nfunction getSystemPrompt(skill: SkillConfig): string {\n if (skill.systemPrompt) {\n return skill.systemPrompt\n }\n return DEFAULT_SYSTEM_PROMPTS[skill.id] || DEFAULT_SYSTEM_PROMPTS.chat\n}\n\nfunction sanitizeToolName(skillId: string): string {\n let name = skillId.replace(/[^a-zA-Z0-9_]/g, '_').toLowerCase()\n if (!name) {\n name = 'tool'\n }\n if (/^[0-9]/.test(name)) {\n name = `tool_${name}`\n }\n return name\n}\n\nfunction makeUniqueToolName(skillId: string, usedNames: Set<string>): string {\n const baseName = sanitizeToolName(skillId)\n if (!usedNames.has(baseName)) {\n usedNames.add(baseName)\n return baseName\n }\n\n let counter = 1\n let candidate = `${baseName}_${counter}`\n while (usedNames.has(candidate)) {\n counter += 1\n candidate = `${baseName}_${counter}`\n }\n usedNames.add(candidate)\n return candidate\n}\n\nfunction toToolInput(params: unknown): Record<string, unknown> {\n if (params && typeof params === 'object' && !Array.isArray(params)) {\n return params as Record<string, unknown>\n }\n return { input: params }\n}\n\nfunction parseToolResult(text: string): unknown {\n try {\n return JSON.parse(text)\n } catch {\n return { text }\n }\n}\n\nasync function executeCatalogToolSkill(\n parentContext: ExecutorContext,\n skill: SkillConfig,\n params: unknown\n): Promise<unknown> {\n if (skill.id.startsWith('time/')) {\n const toolContext: ExecutorContext = {\n taskId: `${parentContext.taskId}_tool_${skill.id}`,\n contextId: parentContext.contextId,\n skill,\n message: {\n role: 'user',\n parts: [{ type: 'data', data: toToolInput(params) }],\n },\n metadata: parentContext.metadata,\n }\n const result = await executeTimeSkill(toolContext)\n return parseToolResult(result.text)\n }\n\n throw new Error(`Unsupported tool skill: ${skill.id}`)\n}\n\nfunction buildChatTools(\n context: ExecutorContext,\n skillsCatalog?: SkillConfig[]\n): Record<string, Tool> {\n if (context.skill.id !== CHAT_SKILL_ID || !skillsCatalog || skillsCatalog.length === 0) {\n return {}\n }\n\n const tools: Record<string, Tool> = {}\n const usedNames = new Set<string>()\n\n for (const skill of skillsCatalog) {\n if (skill.id === context.skill.id) {\n continue\n }\n\n const tags = skill.tags ?? []\n if (!tags.includes(TOOL_TAG) || tags.includes(LLM_TAG)) {\n continue\n }\n if (!skill.id.startsWith('time/')) {\n continue\n }\n\n const toolName = makeUniqueToolName(skill.id, usedNames)\n const schema = skill.inputSchema ?? {\n type: 'object',\n properties: {},\n additionalProperties: true,\n }\n\n tools[toolName] = tool({\n description: skill.description || `Execute ${skill.name}`,\n inputSchema: jsonSchema(schema),\n execute: async (params) => executeCatalogToolSkill(context, skill, params),\n })\n }\n\n return tools\n}\n\n/**\n * Execute a task without streaming\n */\nexport async function executeTask(\n context: ExecutorContext,\n llmConfig: LLMConfig,\n skillsCatalog?: SkillConfig[]\n): Promise<ExecutorResult> {\n const model = createLLMProvider(llmConfig)\n const userMessage = extractTextFromMessage(context.message)\n const systemPrompt = getSystemPrompt(context.skill)\n const chatTools = buildChatTools(context, skillsCatalog)\n const hasChatTools = Object.keys(chatTools).length > 0\n\n const result = await generateText({\n model,\n system: systemPrompt,\n prompt: userMessage,\n temperature: llmConfig.temperature ?? 0.7,\n maxOutputTokens: llmConfig.maxOutputTokens ?? 4096,\n ...(hasChatTools ? { tools: chatTools, stopWhen: TOOL_STOP_CONDITION } : {}),\n })\n\n return {\n text: result.text,\n artifacts: [\n {\n name: 'response',\n parts: [{ type: 'text', text: result.text }],\n },\n ],\n }\n}\n\n/**\n * Execute a task with streaming\n */\nexport async function executeTaskStreaming(\n context: ExecutorContext,\n llmConfig: LLMConfig,\n callbacks: StreamCallbacks,\n skillsCatalog?: SkillConfig[]\n): Promise<void> {\n const model = createLLMProvider(llmConfig)\n const userMessage = extractTextFromMessage(context.message)\n const systemPrompt = getSystemPrompt(context.skill)\n const chatTools = buildChatTools(context, skillsCatalog)\n const hasChatTools = Object.keys(chatTools).length > 0\n\n const result = streamText({\n model,\n system: systemPrompt,\n prompt: userMessage,\n temperature: llmConfig.temperature ?? 0.7,\n maxOutputTokens: llmConfig.maxOutputTokens ?? 4096,\n ...(hasChatTools ? { tools: chatTools, stopWhen: TOOL_STOP_CONDITION } : {}),\n onError: async ({ error }) => {\n await callbacks.onError(error instanceof Error ? error : new Error(String(error)))\n },\n })\n\n for await (const chunk of result.textStream) {\n await callbacks.onChunk(chunk)\n }\n\n await callbacks.onComplete()\n}\n\n/**\n * Simple executor for testing (no LLM, just echoes)\n */\nexport async function executeEcho(context: ExecutorContext): Promise<ExecutorResult> {\n const userMessage = extractTextFromMessage(context.message)\n\n return {\n text: `Echo from ${context.skill.name}: ${userMessage}`,\n artifacts: [\n {\n name: 'response',\n parts: [{ type: 'text', text: `Echo from ${context.skill.name}: ${userMessage}` }],\n },\n ],\n }\n}\n\n/**\n * Simple streaming executor for testing\n */\nexport async function executeEchoStreaming(\n context: ExecutorContext,\n callbacks: StreamCallbacks\n): Promise<void> {\n const userMessage = extractTextFromMessage(context.message)\n const response = `Echo from ${context.skill.name}: ${userMessage}`\n\n try {\n // Simulate streaming by sending word by word\n const words = response.split(' ')\n for (let i = 0; i < words.length; i++) {\n const chunk = (i === 0 ? '' : ' ') + words[i]\n await callbacks.onChunk(chunk)\n // Small delay to simulate streaming\n await new Promise((resolve) => setTimeout(resolve, 50))\n }\n await callbacks.onComplete()\n } catch (error) {\n await callbacks.onError(error instanceof Error ? error : new Error(String(error)))\n }\n}\n","/**\n * Default Skills Configuration\n *\n * Shared skill definitions for A2A agents. Import these in your agent\n * configuration to avoid duplication across different deployment targets.\n */\n\nimport type { SkillConfig, LLMConfig } from './types.js'\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Default Skills\n// ═══════════════════════════════════════════════════════════════════════════════\n\n/**\n * Default skills available to A2A agents.\n * Includes deterministic time tools and LLM-powered skills.\n */\nexport const DEFAULT_SKILLS: SkillConfig[] = [\n // Time tools (deterministic — no LLM)\n {\n id: 'time/now',\n name: 'Current Time',\n description: 'Returns current UTC time with optional timezone conversion',\n inputSchema: {\n type: 'object',\n properties: {\n timezone: { type: 'string', description: 'IANA timezone name (e.g. America/New_York)' },\n },\n additionalProperties: false,\n },\n tags: ['deterministic', 'time', 'tool'],\n },\n {\n id: 'time/parse',\n name: 'Parse Date Expression',\n description: 'Converts \"next Tuesday at 3pm\" to ISO timestamp',\n inputSchema: {\n type: 'object',\n properties: {\n expression: { type: 'string', description: 'Natural language date expression' },\n timezone: { type: 'string', description: 'IANA timezone name (default: UTC)' },\n reference: { type: 'string', description: 'Reference ISO timestamp', format: 'date-time' },\n },\n required: ['expression'],\n additionalProperties: false,\n },\n tags: ['deterministic', 'time', 'tool'],\n },\n {\n id: 'time/convert',\n name: 'Convert Timezone',\n description: 'Converts a timestamp between timezones',\n inputSchema: {\n type: 'object',\n properties: {\n timestamp: { type: 'string', description: 'ISO timestamp to convert', format: 'date-time' },\n to: { type: 'string', description: 'Target IANA timezone name' },\n },\n required: ['timestamp', 'to'],\n additionalProperties: false,\n },\n tags: ['deterministic', 'time', 'tool'],\n },\n {\n id: 'time/add',\n name: 'Date Arithmetic',\n description: 'Add days, weeks, or months to a date',\n inputSchema: {\n type: 'object',\n properties: {\n date: { type: 'string', description: 'Base ISO date (defaults to today)' },\n days: { type: 'number', description: 'Days to add (can be negative)' },\n weeks: { type: 'number', description: 'Weeks to add (can be negative)' },\n months: { type: 'number', description: 'Months to add (can be negative)' },\n },\n additionalProperties: false,\n },\n tags: ['deterministic', 'time', 'tool'],\n },\n {\n id: 'time/diff',\n name: 'Date Difference',\n description: 'Calculate duration between two dates',\n inputSchema: {\n type: 'object',\n properties: {\n from: { type: 'string', description: 'Start ISO timestamp', format: 'date-time' },\n to: { type: 'string', description: 'End ISO timestamp', format: 'date-time' },\n },\n required: ['from', 'to'],\n additionalProperties: false,\n },\n tags: ['deterministic', 'time', 'tool'],\n },\n {\n id: 'time/day_of_week',\n name: 'Day of Week',\n description: 'Returns the day of the week for a given date',\n inputSchema: {\n type: 'object',\n properties: {\n date: { type: 'string', description: 'ISO date string' },\n },\n required: ['date'],\n additionalProperties: false,\n },\n tags: ['deterministic', 'time', 'tool'],\n },\n {\n id: 'time/is_past',\n name: 'Is Past',\n description: 'Checks whether a timestamp is in the past',\n inputSchema: {\n type: 'object',\n properties: {\n timestamp: { type: 'string', description: 'ISO timestamp to check', format: 'date-time' },\n },\n required: ['timestamp'],\n additionalProperties: false,\n },\n tags: ['deterministic', 'time', 'tool'],\n },\n {\n id: 'time/business_days',\n name: 'Business Days',\n description: 'Add or subtract business days from a date',\n inputSchema: {\n type: 'object',\n properties: {\n date: { type: 'string', description: 'Base ISO date (defaults to today)' },\n days: { type: 'number', description: 'Business days to add/subtract' },\n },\n required: ['days'],\n additionalProperties: false,\n },\n tags: ['deterministic', 'time', 'tool'],\n },\n // LLM-powered skills\n {\n id: 'chat',\n name: 'Chat',\n description: 'General conversational AI assistant',\n systemPrompt: 'You are a helpful AI assistant. Respond concisely and accurately.',\n tags: ['llm'],\n },\n {\n id: 'echo',\n name: 'Echo',\n description: 'Echoes back the input (for testing)',\n tags: ['testing'],\n },\n {\n id: 'analyze',\n name: 'Analyze',\n description: 'Analyzes provided content and gives insights',\n systemPrompt: 'You are an analytical AI. Analyze the input and provide detailed insights.',\n tags: ['llm'],\n },\n]\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Default LLM Configuration\n// ═══════════════════════════════════════════════════════════════════════════════\n\n/**\n * Default LLM configuration for A2A agents.\n */\nexport const DEFAULT_LLM_CONFIG: LLMConfig = {\n provider: 'openai',\n model: 'gpt-5-nano',\n gatewayModel: 'openai/gpt-5-nano',\n temperature: 0.7,\n maxOutputTokens: 4096,\n}\n","/**\n * A2A Protocol Server\n *\n * Express server implementing the A2A (Agent-to-Agent) protocol.\n * Provides agent card discovery and JSON-RPC task execution endpoints.\n */\n\nimport express, { type Request, type Response, type Application } from 'express'\nimport { v4 as uuidv4 } from 'uuid'\nimport type {\n AgentCard,\n AgentConfig,\n SkillConfig,\n LLMConfig,\n JsonRpcRequest,\n Task,\n TasksSendParams,\n TasksGetParams,\n TasksCancelParams,\n TaskHistoryEntry,\n ExecutorContext,\n A2AMessage,\n} from './types.js'\nimport { JSON_RPC_ERRORS } from './types.js'\nimport {\n executeTask,\n executeTaskStreaming,\n executeEcho,\n executeEchoStreaming,\n} from './executor.js'\nimport { executeTimeSkill } from './time-executor.js'\nimport { DEFAULT_SKILLS, DEFAULT_LLM_CONFIG } from './default-skills.js'\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Constants\n// ═══════════════════════════════════════════════════════════════════════════════\n\nconst A2A_PROTOCOL_VERSION = '0.3'\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// In-Memory Storage\n// ═══════════════════════════════════════════════════════════════════════════════\n\ninterface StoredTask extends Task {\n skillId: string\n requestMessage: A2AMessage\n history: TaskHistoryEntry[]\n}\n\nconst tasks = new Map<string, StoredTask>()\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Helper Functions\n// ═══════════════════════════════════════════════════════════════════════════════\n\nfunction generateTaskId(): string {\n return `task_${Date.now()}_${uuidv4().substring(0, 8)}`\n}\n\nfunction jsonRpcSuccess(id: string | number | undefined, result: unknown) {\n return { jsonrpc: '2.0' as const, id, result }\n}\n\nfunction jsonRpcError(id: string | number | undefined, code: number, message: string, data?: unknown) {\n return { jsonrpc: '2.0' as const, id, error: { code, message, data } }\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Server Creation\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport interface A2AServerOptions {\n config: AgentConfig\n llmConfig?: LLMConfig\n echoMode?: boolean // Use echo executor instead of LLM (for testing)\n}\n\nexport interface A2AServer {\n app: Application\n start: () => Promise<void>\n stop: () => Promise<void>\n}\n\nexport function createA2AServer(options: A2AServerOptions): A2AServer {\n const { config, llmConfig = DEFAULT_LLM_CONFIG, echoMode = false } = options\n\n const app = express()\n app.use(express.json())\n\n // CORS headers\n app.use((_req, res, next) => {\n res.header('Access-Control-Allow-Origin', '*')\n res.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')\n res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-API-Key')\n next()\n })\n\n app.options('*', (_req, res) => {\n res.sendStatus(204)\n })\n\n const port = config.port || 9999\n const host = config.host || 'localhost'\n const skills = config.skills || DEFAULT_SKILLS\n\n // Build agent card\n const agentCard: AgentCard = {\n name: config.name,\n description: config.description || `A2A Agent: ${config.name}`,\n url: `http://${host}:${port}/a2a`,\n version: config.version || '1.0.0',\n protocolVersion: A2A_PROTOCOL_VERSION,\n defaultInputModes: config.defaultInputModes || ['text', 'data'],\n defaultOutputModes: config.defaultOutputModes || ['text', 'data'],\n provider: config.provider || {\n organization: 'Runtype',\n url: 'https://runtype.com',\n },\n capabilities: {\n streaming: true,\n pushNotifications: false,\n statefulness: 'task',\n },\n skills: skills.map((s) => ({\n id: s.id,\n name: s.name,\n description: s.description,\n inputModes: ['text', 'data'],\n outputModes: ['text', 'data'],\n tags: s.tags ?? [],\n inputSchema: s.inputSchema,\n })),\n authentication: {\n type: 'none',\n },\n }\n\n // ═══════════════════════════════════════════════════════════════════════════════\n // Routes\n // ═══════════════════════════════════════════════════════════════════════════════\n\n // Agent Card discovery\n app.get('/.well-known/agent.json', (_req: Request, res: Response) => {\n res.setHeader('Cache-Control', 'public, max-age=3600')\n res.json(agentCard)\n })\n\n // Health check\n app.get('/health', (_req: Request, res: Response) => {\n res.json({ status: 'healthy', timestamp: new Date().toISOString() })\n })\n\n // A2A JSON-RPC endpoint\n app.post('/a2a', async (req: Request, res: Response) => {\n const body = req.body as JsonRpcRequest\n\n // Validate JSON-RPC structure\n if (body.jsonrpc !== '2.0' || !body.method) {\n res.json(jsonRpcError(body?.id, JSON_RPC_ERRORS.INVALID_REQUEST, 'Invalid JSON-RPC request'))\n return\n }\n\n const { id, method, params } = body\n\n console.log(`[A2A] ${method}`, params ? JSON.stringify(params).substring(0, 100) : '')\n\n try {\n switch (method) {\n case 'tasks/send':\n await handleTasksSend(req, res, id, params as TasksSendParams, skills, llmConfig, echoMode)\n break\n\n case 'tasks/sendSubscribe':\n await handleTasksSendSubscribe(req, res, id, params as TasksSendParams, skills, llmConfig, echoMode)\n break\n\n case 'tasks/get':\n handleTasksGet(res, id, params as TasksGetParams)\n break\n\n case 'tasks/cancel':\n handleTasksCancel(res, id, params as TasksCancelParams)\n break\n\n case 'ping':\n res.json(jsonRpcSuccess(id, { pong: true }))\n break\n\n default:\n res.json(jsonRpcError(id, JSON_RPC_ERRORS.METHOD_NOT_FOUND, `Method not found: ${method}`))\n }\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n console.error(`[A2A] Error in ${method}:`, errorMessage)\n res.json(jsonRpcError(id, JSON_RPC_ERRORS.INTERNAL_ERROR, errorMessage))\n }\n })\n\n // ═══════════════════════════════════════════════════════════════════════════════\n // Server Lifecycle\n // ═══════════════════════════════════════════════════════════════════════════════\n\n let server: ReturnType<Application['listen']> | null = null\n\n return {\n app,\n start: () =>\n new Promise((resolve) => {\n server = app.listen(port, () => {\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log(`A2A Agent Server: ${config.name}`)\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log('')\n console.log(` Agent Card: http://${host}:${port}/.well-known/agent.json`)\n console.log(` A2A Endpoint: http://${host}:${port}/a2a`)\n console.log(` Health Check: http://${host}:${port}/health`)\n console.log('')\n console.log(' Skills:')\n for (const skill of skills) {\n console.log(` - ${skill.id}: ${skill.description}`)\n }\n console.log('')\n console.log(` Mode: ${echoMode ? 'Echo (testing)' : `LLM (${llmConfig.provider}/${llmConfig.model})`}`)\n console.log('')\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log('')\n resolve()\n })\n }),\n stop: () =>\n new Promise((resolve, reject) => {\n if (server) {\n server.close((err) => {\n if (err) reject(err)\n else resolve()\n })\n } else {\n resolve()\n }\n }),\n }\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// Method Handlers\n// ═══════════════════════════════════════════════════════════════════════════════\n\nasync function handleTasksSend(\n _req: Request,\n res: Response,\n id: string | number | undefined,\n params: TasksSendParams,\n skills: SkillConfig[],\n llmConfig: LLMConfig,\n echoMode: boolean\n) {\n const { skill: skillId, message, contextId, metadata } = params\n\n // Find skill\n const skill = skills.find((s) => s.id === skillId)\n if (!skill) {\n res.json(\n jsonRpcError(id, JSON_RPC_ERRORS.SKILL_NOT_FOUND, `Skill not found: ${skillId}`, {\n availableSkills: skills.map((s) => s.id),\n })\n )\n return\n }\n\n // Create task\n const taskId = generateTaskId()\n const task: StoredTask = {\n id: taskId,\n contextId,\n status: 'submitted',\n skillId,\n requestMessage: message,\n artifacts: [],\n metadata,\n history: [{ status: 'submitted', message: 'Task created', timestamp: new Date().toISOString() }],\n }\n tasks.set(taskId, task)\n\n // Update to working\n task.status = 'working'\n task.history.push({ status: 'working', message: 'Execution started', timestamp: new Date().toISOString() })\n\n try {\n const context: ExecutorContext = {\n taskId,\n contextId,\n skill,\n message,\n metadata,\n }\n\n // Execute task — route by skill type\n let result\n if (skillId.startsWith('time/')) {\n result = await executeTimeSkill(context)\n } else if (echoMode || skillId === 'echo') {\n result = await executeEcho(context)\n } else {\n result = await executeTask(context, llmConfig, skills)\n }\n\n // Update task\n task.status = 'completed'\n task.artifacts = result.artifacts\n task.history.push({ status: 'completed', message: 'Task completed', timestamp: new Date().toISOString() })\n\n res.json(\n jsonRpcSuccess(id, {\n task: {\n id: taskId,\n contextId,\n status: 'completed',\n artifacts: task.artifacts,\n metadata,\n },\n })\n )\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n task.status = 'failed'\n task.error = { message: errorMessage }\n task.history.push({ status: 'failed', message: errorMessage, timestamp: new Date().toISOString() })\n\n res.json(jsonRpcError(id, JSON_RPC_ERRORS.INTERNAL_ERROR, `Task execution failed: ${errorMessage}`))\n }\n}\n\nasync function handleTasksSendSubscribe(\n _req: Request,\n res: Response,\n id: string | number | undefined,\n params: TasksSendParams,\n skills: SkillConfig[],\n llmConfig: LLMConfig,\n echoMode: boolean\n) {\n const { skill: skillId, message, contextId, metadata } = params\n\n // Find skill\n const skill = skills.find((s) => s.id === skillId)\n if (!skill) {\n res.json(\n jsonRpcError(id, JSON_RPC_ERRORS.SKILL_NOT_FOUND, `Skill not found: ${skillId}`, {\n availableSkills: skills.map((s) => s.id),\n })\n )\n return\n }\n\n // Create task\n const taskId = generateTaskId()\n const task: StoredTask = {\n id: taskId,\n contextId,\n status: 'submitted',\n skillId,\n requestMessage: message,\n artifacts: [],\n metadata,\n history: [{ status: 'submitted', message: 'Task created', timestamp: new Date().toISOString() }],\n }\n tasks.set(taskId, task)\n\n // Set SSE headers\n res.setHeader('Content-Type', 'text/event-stream')\n res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate')\n res.setHeader('Connection', 'keep-alive')\n res.setHeader('X-Accel-Buffering', 'no')\n\n const sendEvent = (event: string, data: unknown) => {\n res.write(`event: ${event}\\ndata: ${JSON.stringify(data)}\\n\\n`)\n }\n\n // Send initial status\n sendEvent('task/status', { taskId, contextId, status: 'submitted' })\n\n // Update to working\n task.status = 'working'\n task.history.push({ status: 'working', message: 'Execution started', timestamp: new Date().toISOString() })\n sendEvent('task/status', { taskId, contextId, status: 'working' })\n\n try {\n const context: ExecutorContext = {\n taskId,\n contextId,\n skill,\n message,\n metadata,\n }\n\n let artifactIndex = 0\n let fullText = ''\n\n const callbacks = {\n onChunk: async (text: string) => {\n fullText += text\n sendEvent('task/artifact', {\n taskId,\n artifact: {\n name: 'response',\n parts: [{ type: 'text', text }],\n index: artifactIndex,\n append: artifactIndex > 0,\n lastChunk: false,\n },\n })\n artifactIndex++\n },\n onComplete: async () => {\n // Send final artifact marker\n sendEvent('task/artifact', {\n taskId,\n artifact: {\n name: 'response',\n parts: [{ type: 'text', text: '' }],\n index: artifactIndex,\n append: true,\n lastChunk: true,\n },\n })\n\n // Update task\n task.status = 'completed'\n task.artifacts = [{ name: 'response', parts: [{ type: 'text', text: fullText }] }]\n task.history.push({ status: 'completed', message: 'Task completed', timestamp: new Date().toISOString() })\n\n sendEvent('task/status', { taskId, contextId, status: 'completed', final: true })\n res.end()\n },\n onError: async (error: Error) => {\n task.status = 'failed'\n task.error = { message: error.message }\n task.history.push({ status: 'failed', message: error.message, timestamp: new Date().toISOString() })\n\n sendEvent('task/error', { taskId, error: { code: -32603, message: error.message } })\n sendEvent('task/status', { taskId, contextId, status: 'failed', message: error.message, final: true })\n res.end()\n },\n }\n\n // Execute — time skills return immediately, others stream\n if (skillId.startsWith('time/')) {\n const timeResult = await executeTimeSkill(context)\n await callbacks.onChunk(timeResult.text)\n await callbacks.onComplete()\n } else if (echoMode || skillId === 'echo') {\n await executeEchoStreaming(context, callbacks)\n } else {\n await executeTaskStreaming(context, llmConfig, callbacks, skills)\n }\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n task.status = 'failed'\n task.error = { message: errorMessage }\n task.history.push({ status: 'failed', message: errorMessage, timestamp: new Date().toISOString() })\n\n sendEvent('task/error', { taskId, error: { code: -32603, message: errorMessage } })\n sendEvent('task/status', { taskId, contextId, status: 'failed', message: errorMessage, final: true })\n res.end()\n }\n}\n\nfunction handleTasksGet(res: Response, id: string | number | undefined, params: TasksGetParams) {\n const { taskId, includeHistory } = params\n\n const task = tasks.get(taskId)\n if (!task) {\n res.json(jsonRpcError(id, JSON_RPC_ERRORS.TASK_NOT_FOUND, `Task not found: ${taskId}`))\n return\n }\n\n const result: {\n task: {\n id: string\n contextId?: string\n status: string\n artifacts?: Array<{ name: string; parts: Array<{ type: string; text?: string }> }>\n metadata?: Record<string, unknown>\n error?: { message: string }\n history?: TaskHistoryEntry[]\n }\n } = {\n task: {\n id: task.id,\n contextId: task.contextId,\n status: task.status,\n artifacts: task.artifacts,\n metadata: task.metadata,\n },\n }\n\n if (task.error) {\n result.task.error = task.error\n }\n\n if (includeHistory) {\n result.task.history = task.history\n }\n\n res.json(jsonRpcSuccess(id, result))\n}\n\nfunction handleTasksCancel(res: Response, id: string | number | undefined, params: TasksCancelParams) {\n const { taskId, reason } = params\n\n const task = tasks.get(taskId)\n if (!task) {\n res.json(jsonRpcError(id, JSON_RPC_ERRORS.TASK_NOT_FOUND, `Task not found: ${taskId}`))\n return\n }\n\n if (['completed', 'failed', 'canceled'].includes(task.status)) {\n res.json(jsonRpcError(id, JSON_RPC_ERRORS.TASK_CANCELED, `Task cannot be canceled: already ${task.status}`))\n return\n }\n\n task.status = 'canceled'\n task.history.push({\n status: 'canceled',\n message: reason || 'Canceled by request',\n timestamp: new Date().toISOString(),\n })\n\n res.json(jsonRpcSuccess(id, { task: { id: taskId, status: 'canceled' } }))\n}\n","/**\n * A2A Client\n *\n * Client for testing A2A protocol endpoints, including Runtype's A2A surfaces.\n */\n\nimport type {\n AgentCard,\n JsonRpcRequest,\n JsonRpcResponse,\n TasksSendParams,\n Task,\n Artifact,\n TaskStatusEvent,\n JsonRpcError,\n} from './types.js'\n\nexport interface A2AClientOptions {\n /** Base URL of the A2A endpoint (with or without /a2a suffix) */\n baseUrl: string\n /** API key for authentication (optional) */\n apiKey?: string\n /** Custom headers to include in requests */\n headers?: Record<string, string>\n}\n\nexport interface StreamEvent {\n type: 'status' | 'artifact' | 'error'\n data: unknown\n}\n\nexport class A2AClient {\n private baseUrl: string\n private rpcUrl: string\n private agentCardUrl: string\n private apiKey?: string\n private headers: Record<string, string>\n\n constructor(options: A2AClientOptions) {\n this.baseUrl = options.baseUrl.replace(/\\/$/, '')\n const isA2aBase = this.baseUrl.endsWith('/a2a')\n this.rpcUrl = isA2aBase ? this.baseUrl : `${this.baseUrl}/a2a`\n this.agentCardUrl = `${this.baseUrl}/.well-known/agent.json`\n this.apiKey = options.apiKey\n this.headers = options.headers || {}\n }\n\n /**\n * Get the agent card for discovery\n */\n async getAgentCard(): Promise<AgentCard> {\n const response = await fetch(this.agentCardUrl, {\n headers: this.getHeaders(),\n })\n\n if (!response.ok) {\n throw new Error(`Failed to fetch agent card: ${response.status} ${response.statusText}`)\n }\n\n return response.json() as Promise<AgentCard>\n }\n\n /**\n * Send a task and wait for completion (synchronous)\n */\n async sendTask(params: TasksSendParams): Promise<Task> {\n const request: JsonRpcRequest = {\n jsonrpc: '2.0',\n id: `req_${Date.now()}`,\n method: 'tasks/send',\n params,\n }\n\n const response = await this.sendJsonRpc(request)\n\n if (response.error) {\n throw new Error(`A2A error: ${response.error.message} (code: ${response.error.code})`)\n }\n\n return (response.result as { task: Task }).task\n }\n\n /**\n * Send a task with streaming (SSE)\n */\n async sendTaskStreaming(\n params: TasksSendParams,\n callbacks: {\n onStatus?: (status: string, data: TaskStatusEvent) => void\n onArtifact?: (artifact: Artifact) => void\n onError?: (error: JsonRpcError) => void\n onChunk?: (text: string) => void\n }\n ): Promise<void> {\n const request: JsonRpcRequest = {\n jsonrpc: '2.0',\n id: `req_${Date.now()}`,\n method: 'tasks/sendSubscribe',\n params,\n }\n\n const response = await fetch(`${this.baseUrl}/a2a`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...this.getHeaders(),\n },\n body: JSON.stringify(request),\n })\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n }\n\n const reader = response.body?.getReader()\n if (!reader) {\n throw new Error('No response body')\n }\n\n const decoder = new TextDecoder()\n let buffer = ''\n\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n\n buffer += decoder.decode(value, { stream: true })\n\n // Parse SSE events\n const lines = buffer.split('\\n')\n buffer = lines.pop() || ''\n\n let currentEvent = ''\n for (const line of lines) {\n if (line.startsWith('event: ')) {\n currentEvent = line.substring(7)\n } else if (line.startsWith('data: ')) {\n const data = JSON.parse(line.substring(6))\n\n switch (currentEvent) {\n case 'task/status':\n callbacks.onStatus?.(data.status, data)\n break\n case 'task/artifact':\n callbacks.onArtifact?.(data.artifact)\n // Extract text for convenience\n if (data.artifact?.parts) {\n for (const part of data.artifact.parts) {\n if (part.type === 'text' && part.text) {\n callbacks.onChunk?.(part.text)\n }\n }\n }\n break\n case 'task/error':\n callbacks.onError?.(data.error)\n break\n }\n }\n }\n }\n }\n\n /**\n * Get task status\n */\n async getTask(taskId: string, includeHistory = false): Promise<Task> {\n const request: JsonRpcRequest = {\n jsonrpc: '2.0',\n id: `req_${Date.now()}`,\n method: 'tasks/get',\n params: { taskId, includeHistory },\n }\n\n const response = await this.sendJsonRpc(request)\n\n if (response.error) {\n throw new Error(`A2A error: ${response.error.message} (code: ${response.error.code})`)\n }\n\n return (response.result as { task: Task }).task\n }\n\n /**\n * Cancel a task\n */\n async cancelTask(taskId: string, reason?: string): Promise<Task> {\n const request: JsonRpcRequest = {\n jsonrpc: '2.0',\n id: `req_${Date.now()}`,\n method: 'tasks/cancel',\n params: { taskId, reason },\n }\n\n const response = await this.sendJsonRpc(request)\n\n if (response.error) {\n throw new Error(`A2A error: ${response.error.message} (code: ${response.error.code})`)\n }\n\n return (response.result as { task: Task }).task\n }\n\n /**\n * Send a JSON-RPC request\n */\n private async sendJsonRpc(request: JsonRpcRequest): Promise<JsonRpcResponse> {\n const response = await fetch(this.rpcUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...this.getHeaders(),\n },\n body: JSON.stringify(request),\n })\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n }\n\n return response.json() as Promise<JsonRpcResponse>\n }\n\n /**\n * Get headers for requests\n */\n private getHeaders(): Record<string, string> {\n const headers: Record<string, string> = { ...this.headers }\n\n if (this.apiKey) {\n if (this.apiKey.startsWith('a2a_')) {\n headers['Authorization'] = `Bearer ${this.apiKey}`\n } else {\n headers['X-API-Key'] = this.apiKey\n }\n }\n\n return headers\n }\n}\n\n/**\n * Create a client for testing a Runtype A2A surface\n */\nexport function createRuntypeA2AClient(options: {\n productId: string\n surfaceId: string\n apiKey: string\n environment?: 'production' | 'staging' | 'local'\n}): A2AClient {\n const { productId, surfaceId, apiKey, environment = 'production' } = options\n\n const baseUrls = {\n production: 'https://api.runtype.com',\n staging: 'https://api.runtype-staging.com',\n local: 'http://localhost:8787',\n }\n\n const baseUrl = `${baseUrls[environment]}/v1/products/${productId}/surfaces/${surfaceId}/a2a`\n\n return new A2AClient({\n baseUrl,\n apiKey,\n })\n}\n"],"mappings":";;;AA4EO,IAAM,kBAAkB;AAAA,EAC7B,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA;AAAA,EAEhB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,eAAe;AACjB;;;ACjFA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AAYjC,SAAS,eACP,QACA,QACkB;AAClB,SAAO;AAAA,IACL;AAAA,IACA,UAAU,EAAE,QAAQ,iBAAiB,OAAO;AAAA,IAC5C,OAAO;AAAA,EACT;AACF;AAEA,SAAS,aAAa,SAA8C;AAClE,aAAW,QAAQ,QAAQ,OAAO;AAChC,QAAI,KAAK,SAAS,UAAU,KAAK,MAAM;AACrC,aAAO,KAAK;AAAA,IACd;AACA,QAAI,KAAK,SAAS,UAAU,KAAK,MAAM;AACrC,UAAI;AACF,eAAO,KAAK,MAAM,KAAK,IAAI;AAAA,MAC7B,QAAQ;AACN,eAAO,EAAE,YAAY,KAAK,KAAK;AAAA,MACjC;AAAA,IACF;AAAA,EACF;AACA,SAAO,CAAC;AACV;AAEA,eAAsB,iBAAiB,SAAmD;AACxF,QAAM,QAAQ,aAAa,QAAQ,OAAO;AAC1C,MAAI;AAEJ,UAAQ,QAAQ,MAAM,IAAI;AAAA,IACxB,KAAK,YAAY;AACf,YAAM,KAAM,MAAM,YAAuB;AACzC,YAAM,MAAM,o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MAAM,GAAG;AAClC,gBAAQ,eAAe,IAAI,UAAU,KAAK,MAAM;AAAA,MAClD,OAAO;AACL,gBAAQ,WAAW,IAAI,KAAK;AAAA,MAC9B;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAKO,SAAS,uBAAuB,SAKzB;AACZ,QAAM,EAAE,WAAW,WAAW,QAAQ,cAAc,aAAa,IAAI;AAErE,QAAM,WAAW;AAAA,IACf,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAEA,QAAM,UAAU,GAAG,SAAS,WAAW,CAAC,gBAAgB,SAAS,aAAa,SAAS;AAEvF,SAAO,IAAI,UAAU;AAAA,IACnB;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/cli.js ADDED
@@ -0,0 +1,215 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ A2AClient,
4
+ createA2AServer,
5
+ createRuntypeA2AClient
6
+ } from "./chunk-OLB7ZZNY.js";
7
+
8
+ // src/cli.ts
9
+ import { Command } from "commander";
10
+ var program = new Command();
11
+ program.name("a2a-agent-example").description("A2A Agent Example - Run an A2A server or test A2A endpoints").version("0.1.0");
12
+ program.command("serve").description("Start an A2A-compatible agent server").option("-p, --port <port>", "Port to listen on", "9999").option("-h, --host <host>", "Host to bind to", "localhost").option("-n, --name <name>", "Agent name", "Example A2A Agent").option("--echo", "Run in echo mode (no LLM, for testing)", false).option("--provider <provider>", "LLM provider (openai, anthropic)", "openai").option("--model <model>", "LLM model", "gpt-4o-mini").option("--temperature <temp>", "LLM temperature", "0.7").action(async (options) => {
13
+ const config = {
14
+ name: options.name,
15
+ description: "Example A2A agent for testing and reference",
16
+ port: parseInt(options.port, 10),
17
+ host: options.host,
18
+ provider: {
19
+ organization: "Runtype",
20
+ url: "https://runtype.com"
21
+ }
22
+ };
23
+ const llmConfig = {
24
+ provider: options.provider,
25
+ model: options.model,
26
+ temperature: parseFloat(options.temperature)
27
+ };
28
+ const server = createA2AServer({
29
+ config,
30
+ llmConfig,
31
+ echoMode: options.echo
32
+ });
33
+ process.on("SIGINT", async () => {
34
+ console.log("\nShutting down...");
35
+ await server.stop();
36
+ process.exit(0);
37
+ });
38
+ process.on("SIGTERM", async () => {
39
+ console.log("\nShutting down...");
40
+ await server.stop();
41
+ process.exit(0);
42
+ });
43
+ await server.start();
44
+ });
45
+ program.command("test").description("Test an A2A endpoint").argument("<url>", "Base URL of the A2A endpoint (e.g., http://localhost:9999)").option("-s, --skill <skill>", "Skill to test", "echo").option("-m, --message <message>", "Message to send", "Hello from A2A client!").option("--stream", "Use streaming mode", false).option("-k, --api-key <key>", "API key for authentication").action(async (url, options) => {
46
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
47
+ console.log("A2A Protocol Test");
48
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
49
+ console.log("");
50
+ console.log(` Target: ${url}`);
51
+ console.log("");
52
+ const client = new A2AClient({
53
+ baseUrl: url,
54
+ apiKey: options.apiKey
55
+ });
56
+ try {
57
+ console.log("1. Fetching Agent Card...");
58
+ const agentCard = await client.getAgentCard();
59
+ console.log(` Name: ${agentCard.name}`);
60
+ console.log(` Version: ${agentCard.version}`);
61
+ console.log(` Protocol: ${agentCard.protocolVersion}`);
62
+ console.log(` Skills: ${agentCard.skills.map((s) => s.id).join(", ")}`);
63
+ console.log(` Streaming: ${agentCard.capabilities.streaming}`);
64
+ console.log("");
65
+ if (options.stream) {
66
+ console.log("2. Sending streaming task...");
67
+ console.log(` Skill: ${options.skill}`);
68
+ console.log(` Message: "${options.message}"`);
69
+ console.log("");
70
+ console.log(" Response:");
71
+ process.stdout.write(" ");
72
+ await client.sendTaskStreaming(
73
+ {
74
+ skill: options.skill,
75
+ message: {
76
+ role: "user",
77
+ parts: [{ type: "text", text: options.message }]
78
+ }
79
+ },
80
+ {
81
+ onChunk: (text) => {
82
+ process.stdout.write(text);
83
+ },
84
+ onStatus: (status) => {
85
+ if (status === "completed" || status === "failed") {
86
+ console.log("");
87
+ console.log("");
88
+ console.log(` Status: ${status}`);
89
+ }
90
+ },
91
+ onError: (error) => {
92
+ console.log("");
93
+ console.log(` Error: ${error.message}`);
94
+ }
95
+ }
96
+ );
97
+ } else {
98
+ console.log("2. Sending synchronous task...");
99
+ console.log(` Skill: ${options.skill}`);
100
+ console.log(` Message: "${options.message}"`);
101
+ const task = await client.sendTask({
102
+ skill: options.skill,
103
+ message: {
104
+ role: "user",
105
+ parts: [{ type: "text", text: options.message }]
106
+ }
107
+ });
108
+ console.log(` Task ID: ${task.id}`);
109
+ console.log(` Status: ${task.status}`);
110
+ if (task.artifacts && task.artifacts.length > 0) {
111
+ const text = task.artifacts[0].parts?.filter((p) => p.type === "text").map((p) => p.text).join("");
112
+ console.log(` Response: "${text}"`);
113
+ }
114
+ }
115
+ console.log("");
116
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
117
+ console.log("Test completed successfully!");
118
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
119
+ } catch (error) {
120
+ console.error(`
121
+ Error: ${error instanceof Error ? error.message : String(error)}`);
122
+ process.exit(1);
123
+ }
124
+ });
125
+ program.command("test-runtype").description("Test a Runtype A2A surface").requiredOption("--product-id <id>", "Runtype product ID").requiredOption("--surface-id <id>", "Runtype surface ID").requiredOption("--api-key <key>", "A2A API key (a2a_xxx)").option("-e, --environment <env>", "Environment (production, staging, local)", "local").option("-s, --skill <skill>", "Skill/capability to test").option("-m, --message <message>", "Message to send", "Hello from A2A client!").option("--stream", "Use streaming mode", false).action(async (options) => {
126
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
127
+ console.log("Runtype A2A Surface Test");
128
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
129
+ console.log("");
130
+ console.log(` Product: ${options.productId}`);
131
+ console.log(` Surface: ${options.surfaceId}`);
132
+ console.log(` Environment: ${options.environment}`);
133
+ console.log("");
134
+ const client = createRuntypeA2AClient({
135
+ productId: options.productId,
136
+ surfaceId: options.surfaceId,
137
+ apiKey: options.apiKey,
138
+ environment: options.environment
139
+ });
140
+ try {
141
+ console.log("1. Fetching Agent Card...");
142
+ const agentCard = await client.getAgentCard();
143
+ console.log(` Name: ${agentCard.name}`);
144
+ console.log(` Version: ${agentCard.version}`);
145
+ console.log(` Skills: ${agentCard.skills.map((s) => s.id).join(", ")}`);
146
+ console.log("");
147
+ const skill = options.skill || (agentCard.skills.length > 0 ? agentCard.skills[0].id : null);
148
+ if (!skill) {
149
+ console.log(" No skills available on this surface.");
150
+ return;
151
+ }
152
+ if (options.stream) {
153
+ console.log("2. Sending streaming task...");
154
+ console.log(` Skill: ${skill}`);
155
+ console.log(` Message: "${options.message}"`);
156
+ console.log("");
157
+ console.log(" Response:");
158
+ process.stdout.write(" ");
159
+ await client.sendTaskStreaming(
160
+ {
161
+ skill,
162
+ message: {
163
+ role: "user",
164
+ parts: [{ type: "text", text: options.message }]
165
+ }
166
+ },
167
+ {
168
+ onChunk: (text) => {
169
+ process.stdout.write(text);
170
+ },
171
+ onStatus: (status) => {
172
+ if (status === "completed" || status === "failed") {
173
+ console.log("");
174
+ console.log("");
175
+ console.log(` Status: ${status}`);
176
+ }
177
+ },
178
+ onError: (error) => {
179
+ console.log("");
180
+ console.log(` Error: ${error.message}`);
181
+ }
182
+ }
183
+ );
184
+ } else {
185
+ console.log("2. Sending synchronous task...");
186
+ console.log(` Skill: ${skill}`);
187
+ console.log(` Message: "${options.message}"`);
188
+ const task = await client.sendTask({
189
+ skill,
190
+ message: {
191
+ role: "user",
192
+ parts: [{ type: "text", text: options.message }]
193
+ }
194
+ });
195
+ console.log(` Task ID: ${task.id}`);
196
+ console.log(` Status: ${task.status}`);
197
+ if (task.artifacts && task.artifacts.length > 0) {
198
+ const text = task.artifacts[0].parts?.filter((p) => p.type === "text").map((p) => p.text).join("");
199
+ console.log("");
200
+ console.log(" Response:");
201
+ console.log(` ${text}`);
202
+ }
203
+ }
204
+ console.log("");
205
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
206
+ console.log("Test completed successfully!");
207
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
208
+ } catch (error) {
209
+ console.error(`
210
+ Error: ${error instanceof Error ? error.message : String(error)}`);
211
+ process.exit(1);
212
+ }
213
+ });
214
+ program.parse();
215
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["/**\n * A2A Agent Example CLI\n *\n * Run an A2A-compatible agent server or test A2A endpoints.\n *\n * Usage:\n * # Start a server in echo mode (for testing)\n * a2a-agent-example serve --echo\n *\n * # Start a server with LLM\n * OPENAI_API_KEY=xxx a2a-agent-example serve\n *\n * # Test an A2A endpoint\n * a2a-agent-example test http://localhost:9999\n *\n * # Test a Runtype A2A surface\n * a2a-agent-example test-runtype --product-id prod_xxx --surface-id surf_xxx --api-key a2a_xxx\n */\n\nimport { Command } from 'commander'\nimport { createA2AServer } from './server.js'\nimport { A2AClient, createRuntypeA2AClient } from './client.js'\nimport type { AgentConfig, LLMConfig } from './types.js'\n\nconst program = new Command()\n\nprogram\n .name('a2a-agent-example')\n .description('A2A Agent Example - Run an A2A server or test A2A endpoints')\n .version('0.1.0')\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// serve command\n// ═══════════════════════════════════════════════════════════════════════════════\n\nprogram\n .command('serve')\n .description('Start an A2A-compatible agent server')\n .option('-p, --port <port>', 'Port to listen on', '9999')\n .option('-h, --host <host>', 'Host to bind to', 'localhost')\n .option('-n, --name <name>', 'Agent name', 'Example A2A Agent')\n .option('--echo', 'Run in echo mode (no LLM, for testing)', false)\n .option('--provider <provider>', 'LLM provider (openai, anthropic)', 'openai')\n .option('--model <model>', 'LLM model', 'gpt-4o-mini')\n .option('--temperature <temp>', 'LLM temperature', '0.7')\n .action(async (options) => {\n const config: AgentConfig = {\n name: options.name,\n description: 'Example A2A agent for testing and reference',\n port: parseInt(options.port, 10),\n host: options.host,\n provider: {\n organization: 'Runtype',\n url: 'https://runtype.com',\n },\n }\n\n const llmConfig: LLMConfig = {\n provider: options.provider as 'openai' | 'anthropic',\n model: options.model,\n temperature: parseFloat(options.temperature),\n }\n\n const server = createA2AServer({\n config,\n llmConfig,\n echoMode: options.echo,\n })\n\n // Handle graceful shutdown\n process.on('SIGINT', async () => {\n console.log('\\nShutting down...')\n await server.stop()\n process.exit(0)\n })\n\n process.on('SIGTERM', async () => {\n console.log('\\nShutting down...')\n await server.stop()\n process.exit(0)\n })\n\n await server.start()\n })\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// test command\n// ═══════════════════════════════════════════════════════════════════════════════\n\nprogram\n .command('test')\n .description('Test an A2A endpoint')\n .argument('<url>', 'Base URL of the A2A endpoint (e.g., http://localhost:9999)')\n .option('-s, --skill <skill>', 'Skill to test', 'echo')\n .option('-m, --message <message>', 'Message to send', 'Hello from A2A client!')\n .option('--stream', 'Use streaming mode', false)\n .option('-k, --api-key <key>', 'API key for authentication')\n .action(async (url, options) => {\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log('A2A Protocol Test')\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log('')\n console.log(` Target: ${url}`)\n console.log('')\n\n const client = new A2AClient({\n baseUrl: url,\n apiKey: options.apiKey,\n })\n\n try {\n // 1. Fetch agent card\n console.log('1. Fetching Agent Card...')\n const agentCard = await client.getAgentCard()\n console.log(` Name: ${agentCard.name}`)\n console.log(` Version: ${agentCard.version}`)\n console.log(` Protocol: ${agentCard.protocolVersion}`)\n console.log(` Skills: ${agentCard.skills.map((s) => s.id).join(', ')}`)\n console.log(` Streaming: ${agentCard.capabilities.streaming}`)\n console.log('')\n\n // 2. Send task\n if (options.stream) {\n console.log('2. Sending streaming task...')\n console.log(` Skill: ${options.skill}`)\n console.log(` Message: \"${options.message}\"`)\n console.log('')\n console.log(' Response:')\n process.stdout.write(' ')\n\n await client.sendTaskStreaming(\n {\n skill: options.skill,\n message: {\n role: 'user',\n parts: [{ type: 'text', text: options.message }],\n },\n },\n {\n onChunk: (text) => {\n process.stdout.write(text)\n },\n onStatus: (status) => {\n if (status === 'completed' || status === 'failed') {\n console.log('')\n console.log('')\n console.log(` Status: ${status}`)\n }\n },\n onError: (error) => {\n console.log('')\n console.log(` Error: ${error.message}`)\n },\n }\n )\n } else {\n console.log('2. Sending synchronous task...')\n console.log(` Skill: ${options.skill}`)\n console.log(` Message: \"${options.message}\"`)\n\n const task = await client.sendTask({\n skill: options.skill,\n message: {\n role: 'user',\n parts: [{ type: 'text', text: options.message }],\n },\n })\n\n console.log(` Task ID: ${task.id}`)\n console.log(` Status: ${task.status}`)\n\n if (task.artifacts && task.artifacts.length > 0) {\n const text = task.artifacts[0].parts\n ?.filter((p) => p.type === 'text')\n .map((p) => p.text)\n .join('')\n console.log(` Response: \"${text}\"`)\n }\n }\n\n console.log('')\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log('Test completed successfully!')\n console.log('═══════════════════════════════════════════════════════════════════')\n } catch (error: unknown) {\n console.error(`\\nError: ${error instanceof Error ? error.message : String(error)}`)\n process.exit(1)\n }\n })\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// test-runtype command\n// ═══════════════════════════════════════════════════════════════════════════════\n\nprogram\n .command('test-runtype')\n .description('Test a Runtype A2A surface')\n .requiredOption('--product-id <id>', 'Runtype product ID')\n .requiredOption('--surface-id <id>', 'Runtype surface ID')\n .requiredOption('--api-key <key>', 'A2A API key (a2a_xxx)')\n .option('-e, --environment <env>', 'Environment (production, staging, local)', 'local')\n .option('-s, --skill <skill>', 'Skill/capability to test')\n .option('-m, --message <message>', 'Message to send', 'Hello from A2A client!')\n .option('--stream', 'Use streaming mode', false)\n .action(async (options) => {\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log('Runtype A2A Surface Test')\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log('')\n console.log(` Product: ${options.productId}`)\n console.log(` Surface: ${options.surfaceId}`)\n console.log(` Environment: ${options.environment}`)\n console.log('')\n\n const client = createRuntypeA2AClient({\n productId: options.productId,\n surfaceId: options.surfaceId,\n apiKey: options.apiKey,\n environment: options.environment as 'production' | 'staging' | 'local',\n })\n\n try {\n // 1. Fetch agent card\n console.log('1. Fetching Agent Card...')\n const agentCard = await client.getAgentCard()\n console.log(` Name: ${agentCard.name}`)\n console.log(` Version: ${agentCard.version}`)\n console.log(` Skills: ${agentCard.skills.map((s) => s.id).join(', ')}`)\n console.log('')\n\n // Determine skill to use\n const skill = options.skill || (agentCard.skills.length > 0 ? agentCard.skills[0].id : null)\n if (!skill) {\n console.log(' No skills available on this surface.')\n return\n }\n\n // 2. Send task\n if (options.stream) {\n console.log('2. Sending streaming task...')\n console.log(` Skill: ${skill}`)\n console.log(` Message: \"${options.message}\"`)\n console.log('')\n console.log(' Response:')\n process.stdout.write(' ')\n\n await client.sendTaskStreaming(\n {\n skill,\n message: {\n role: 'user',\n parts: [{ type: 'text', text: options.message }],\n },\n },\n {\n onChunk: (text) => {\n process.stdout.write(text)\n },\n onStatus: (status) => {\n if (status === 'completed' || status === 'failed') {\n console.log('')\n console.log('')\n console.log(` Status: ${status}`)\n }\n },\n onError: (error) => {\n console.log('')\n console.log(` Error: ${error.message}`)\n },\n }\n )\n } else {\n console.log('2. Sending synchronous task...')\n console.log(` Skill: ${skill}`)\n console.log(` Message: \"${options.message}\"`)\n\n const task = await client.sendTask({\n skill,\n message: {\n role: 'user',\n parts: [{ type: 'text', text: options.message }],\n },\n })\n\n console.log(` Task ID: ${task.id}`)\n console.log(` Status: ${task.status}`)\n\n if (task.artifacts && task.artifacts.length > 0) {\n const text = task.artifacts[0].parts\n ?.filter((p) => p.type === 'text')\n .map((p) => p.text)\n .join('')\n console.log('')\n console.log(' Response:')\n console.log(` ${text}`)\n }\n }\n\n console.log('')\n console.log('═══════════════════════════════════════════════════════════════════')\n console.log('Test completed successfully!')\n console.log('═══════════════════════════════════════════════════════════════════')\n } catch (error: unknown) {\n console.error(`\\nError: ${error instanceof Error ? error.message : String(error)}`)\n process.exit(1)\n }\n })\n\nprogram.parse()\n"],"mappings":";;;;;;;;AAmBA,SAAS,eAAe;AAKx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