{"_id":"@dexwox-labs/a2a-server","name":"@dexwox-labs/a2a-server","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@dexwox-labs/a2a-server","version":"0.1.0","description":"TypeScript server implementation for Google's Agent-to-Agent (A2A) protocol - includes Express/WebSocket handlers, request validation and queue management","homepage":"https://dexwox-innovations-org.github.io/a2a-node-sdk/","repository":{"type":"git","url":"git+https://github.com/Dexwox-Innovations-Org/a2a-node-sdk.git"},"bugs":{"url":"https://github.com/Dexwox-Innovations-Org/a2a-node-sdk/issues"},"keywords":["a2a","agent-to-agent","google","protocol","typescript","server","express","websocket","api","rpc"],"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"clean":"rm -rf dist tsconfig.tsbuildinfo","build":"tsc -p tsconfig.json","test":"vitest run","test:watch":"vitest watch","test:coverage":"vitest run --coverage","lint":"eslint . --ext .ts","format":"prettier --write ."},"dependencies":{"@dexwox-labs/a2a-core":"0.1.0","@types/ws":"^8.18.1","body-parser":"^2.2.0","cors":"^2.8.5","express":"^4.18.2","winston":"^3.17.0","ws":"^8.18.2","zod":"^3.22.4"},"devDependencies":{"@types/body-parser":"^1.19.5","@types/cors":"^2.8.18","@types/express":"^5.0.1","@types/express-serve-static-core":"^5.0.6","@types/node":"^22.15.17","@types/supertest":"^6.0.3","@vitest/coverage-v8":"^3.1.3","supertest":"^7.1.1","typescript":"^5.3.0","vite-tsconfig-paths":"^5.1.4","vitest":"^3.1.3"},"license":"Apache-2.0","_id":"@dexwox-labs/a2a-server@0.1.0","gitHead":"2963afc9b336bedb260a2b8f2822d3202c7d6381","_nodeVersion":"22.3.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-s+XBljmGEmsP8LZ74n1qpIbRWunpWs7y0K2DW78NBaboqrVO+F3nX6/oGIXMq8u3HGiJjVAFUfcs0b6Ad2uqmw==","shasum":"99b650d9e3096b7a247cd710110c9470a18c4313","tarball":"https://registry.npmjs.org/@dexwox-labs/a2a-server/-/a2a-server-0.1.0.tgz","fileCount":117,"unpackedSize":453983,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFepvuBSHYUUzwI20tIOz33EFR6nhdsliG56su+N4vEaAiEA49JcDbHSlsWgX4AVi+Jt8fN4ebL6Jaoz4w85H1XNegY="}]},"_npmUser":{"name":"dexwoxinnovations","email":"developer@dexwox.com"},"directories":{},"maintainers":[{"name":"dexwoxinnovations","email":"developer@dexwox.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/a2a-server_0.1.0_1748460292570_0.35008474321155725"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-28T19:24:52.494Z","0.1.0":"2025-05-28T19:24:52.786Z","modified":"2025-05-28T19:24:53.037Z"},"maintainers":[{"name":"dexwoxinnovations","email":"developer@dexwox.com"}],"description":"TypeScript server implementation for Google's Agent-to-Agent (A2A) protocol - includes Express/WebSocket handlers, request validation and queue management","homepage":"https://dexwox-innovations-org.github.io/a2a-node-sdk/","keywords":["a2a","agent-to-agent","google","protocol","typescript","server","express","websocket","api","rpc"],"repository":{"type":"git","url":"git+https://github.com/Dexwox-Innovations-Org/a2a-node-sdk.git"},"bugs":{"url":"https://github.com/Dexwox-Innovations-Org/a2a-node-sdk/issues"},"license":"Apache-2.0","readme":"# @dexwox-labs/a2a-server\n\nA TypeScript server implementation for the Agent-to-Agent (A2A) protocol, enabling agent execution and task management.\n\nThis package provides a robust server implementation of the A2A protocol specification. Developed by [Dexwox Innovations Pvt Ltd](https://dexwox.com) to deliver a production-ready TypeScript solution for hosting and managing A2A-compatible agents.\n\n## Features\n\n- Express-based HTTP server\n- WebSocket support for streaming\n- Request context management\n- Task lifecycle management\n- Error handling middleware\n- Configurable CORS and security\n\n## Installation\n\n```bash\nnpm install @dexwox-labs/a2a-server\n# or\npnpm add @dexwox-labs/a2a-server\n# or use the unified package\nnpm install @dexwox-labs/a2a-node\n```\n\n## Quick Start\n\n```typescript\n// Import from the server package\nimport { A2AServer } from '@dexwox-labs/a2a-server';\nimport { AgentCard } from '@dexwox-labs/a2a-core';\nimport { RequestHandler } from './request-handler';\n\n// Or import everything from the unified package\n// import { A2AServer, AgentCard } from '@dexwox-labs/a2a-node';\n\nconst agentCard: AgentCard = {\n  id: 'my-agent',\n  name: 'My Agent',\n  capabilities: ['task-processing'],\n  endpoint: 'http://localhost:3000'\n};\n\nconst requestHandler = new RequestHandler();\nconst server = new A2AServer(agentCard, requestHandler);\n\nserver.start(3000);\n```\n\n## Configuration\n\n### A2AServer Options\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| agentCard | `AgentCard` | Required agent metadata |\n| requestHandler | `RequestHandler` | Handles incoming requests |\n| contextMiddleware | `Function` | Optional custom middleware |\n\n### Environment Variables\n\n- `NODE_ENV`: 'production' or 'development'\n- `CORS_ORIGIN`: Allowed origins (default: '*')\n- `PORT`: Server port (default: 3000)\n\n## API Reference\n\n### A2AServer Class\n\n#### Methods\n\n- `start(port: number)`: Starts the HTTP/WebSocket server\n- `configureMiddleware()`: Sets up Express middleware\n- `configureRoutes()`: Defines API routes\n- `configureErrorHandling()`: Error handler setup\n\n### RequestHandler\n\nHandles all incoming requests with these key methods:\n\n- `handleStreamMessage()`: WebSocket message processing\n- `normalizeError()`: Standard error formatting\n- `handleCreateTask()`: Task creation endpoint\n- `handleUpdateTask()`: Task status updates\n\n## Examples\n\n### Custom Middleware\n\n```typescript\nconst customMiddleware = (req, res, next) => {\n  // Add custom request processing\n  next();\n};\n\nnew A2AServer(agentCard, requestHandler, customMiddleware);\n```\n\n### WebSocket Handling\n\n```typescript\nserver.start(3000); // Automatically starts WebSocket server\n\n// Client connection example:\nconst ws = new WebSocket('ws://localhost:3000');\nws.onmessage = (event) => {\n  console.log('Received:', JSON.parse(event.data));\n};\n```\n\n## Error Handling\n\nThe server provides standardized error responses:\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"error\": {\n    \"code\": -32603,\n    \"message\": \"Internal server error\"\n  }\n}\n```\n\n## Testing\n\nRun tests with:\n```bash\ncd packages/server\npnpm test\n```\n\nGenerate coverage report:\n```bash\npnpm test -- --coverage\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](../CONTRIBUTING.md) for development guidelines.\n","readmeFilename":"README.md","_rev":"1-8dabb786b0c2776036e1546980f1bcd6"}