{"_id":"@a2akit/fastify","_rev":"2-c60109f2b64423c5f754b22fbb70f851","name":"@a2akit/fastify","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@a2akit/fastify","version":"0.1.0","keywords":["a2a","fastify","agent","ai","plugin","protocol","json-rpc"],"author":"","license":"MIT","_id":"@a2akit/fastify@0.1.0","maintainers":[{"name":"mcpkit-dev","email":"chechavalera@gmail.com"}],"homepage":"https://github.com/a2akit/a2akit/tree/main/packages/fastify#readme","bugs":{"url":"https://github.com/a2akit/a2akit/issues"},"dist":{"shasum":"f1e68fa99a11a8f08f1b1a7c860309e0bcbb0dbd","tarball":"https://registry.npmjs.org/@a2akit/fastify/-/fastify-0.1.0.tgz","fileCount":8,"integrity":"sha512-xPGXGKqZU3zISwslYj49pjIDSYr5Twysp/8T0raPQQzWD6oAzT2OgPvzJs0DuuUDFOXRi69ntywiyE0CIQWcuA==","signatures":[{"sig":"MEUCIAnuruE6CtJjpXhrKHEHrXs5OJaYXXix1ttumfzhW4+qAiEA2NrRpBoJpUVVWDJ/y7Tew7Ae1RI1OYf2w3jZ89HwLk8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22638},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"bb05509f7e0cb8cf48989ed9e79c7f27e56e331f","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"mcpkit-dev","email":"chechavalera@gmail.com"},"repository":{"url":"git+https://github.com/a2akit/a2akit.git","type":"git","directory":"packages/fastify"},"_npmVersion":"10.9.0","description":"Fastify adapter for @a2akit/core A2A protocol servers","directories":{},"sideEffects":false,"_nodeVersion":"22.11.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^1.0.0","fastify":"^4.28.0","typescript":"^5.3.0","@types/node":"^20.10.0","@a2akit/core":"workspace:*","@vitest/coverage-v8":"^1.0.0"},"peerDependencies":{"fastify":"^4.0.0 || ^5.0.0","@a2akit/core":"^0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/fastify_0.1.0_1768232549932_0.6723172482352682","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@a2akit/fastify","version":"0.2.0","description":"Fastify adapter for @a2akit/core A2A protocol servers","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage"},"repository":{"type":"git","url":"git+https://github.com/a2akit/a2akit.git","directory":"packages/fastify"},"bugs":{"url":"https://github.com/a2akit/a2akit/issues"},"homepage":"https://github.com/a2akit/a2akit/tree/main/packages/fastify#readme","keywords":["a2a","fastify","agent","ai","plugin","protocol","json-rpc"],"author":"","license":"MIT","peerDependencies":{"@a2akit/core":"^0.2.0","fastify":"^4.0.0 || ^5.0.0"},"devDependencies":{"@a2akit/core":"workspace:*","@types/node":"^20.10.0","fastify":"^4.28.0","tsup":"^8.0.0","typescript":"^5.3.0","vitest":"^1.0.0","@vitest/coverage-v8":"^1.0.0"},"engines":{"node":">=18.0.0"},"_id":"@a2akit/fastify@0.2.0","gitHead":"32d26bcd61c687b9836790fd5f413c781c5a25d5","_nodeVersion":"22.11.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-rpEAAujMScwTfR7lk0MnP+zhFh8+9vyaJPuYnyyM2Ro5oc4eGSohUwV9MhW3PK0CZtjrYYa6ortiR/A2DrEBlg==","shasum":"5614aa272c333f950e49d83f7743288d6a7b6057","tarball":"https://registry.npmjs.org/@a2akit/fastify/-/fastify-0.2.0.tgz","fileCount":8,"unpackedSize":22638,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGpLkO+5eIuy8mpprlFAs19+rHy4LWE+OwSPZMnPDszLAiALqRRF4D9zUqh2DoeWMzo5KSRnl/ZF2wPSciWowUQo5A=="}]},"_npmUser":{"name":"mcpkit-dev","email":"chechavalera@gmail.com"},"directories":{},"maintainers":[{"name":"mcpkit-dev","email":"chechavalera@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fastify_0.2.0_1768292383093_0.2052936161303376"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-12T15:42:29.819Z","modified":"2026-01-13T08:19:43.451Z","0.1.0":"2026-01-12T15:42:30.069Z","0.2.0":"2026-01-13T08:19:43.232Z"},"bugs":{"url":"https://github.com/a2akit/a2akit/issues"},"license":"MIT","homepage":"https://github.com/a2akit/a2akit/tree/main/packages/fastify#readme","keywords":["a2a","fastify","agent","ai","plugin","protocol","json-rpc"],"repository":{"type":"git","url":"git+https://github.com/a2akit/a2akit.git","directory":"packages/fastify"},"description":"Fastify adapter for @a2akit/core A2A protocol servers","maintainers":[{"name":"mcpkit-dev","email":"chechavalera@gmail.com"}],"readme":"# @a2akit/fastify\n\nFastify adapter for [@a2akit/core](https://www.npmjs.com/package/@a2akit/core) A2A protocol servers.\n\n## Installation\n\n```bash\nnpm install @a2akit/fastify @a2akit/core fastify reflect-metadata\n```\n\n## Quick Start\n\n```typescript\nimport 'reflect-metadata';\nimport Fastify from 'fastify';\nimport { createA2APlugin } from '@a2akit/fastify';\nimport { A2AAgent, Skill, TextPart } from '@a2akit/core';\n\n@A2AAgent({\n  name: 'Fastify Agent',\n  description: 'An agent running on Fastify',\n  version: '1.0.0',\n})\nclass MyAgent {\n  @Skill({\n    name: 'Hello',\n    description: 'Say hello',\n  })\n  hello(@TextPart() name: string): string {\n    return `Hello, ${name}!`;\n  }\n}\n\nconst fastify = Fastify({ logger: true });\n\nfastify.register(createA2APlugin(MyAgent), { prefix: '/a2a' });\n\nfastify.listen({ port: 3000 }, (err, address) => {\n  if (err) throw err;\n  console.log(`A2A server running at ${address}`);\n});\n```\n\n## API Reference\n\n### createA2APlugin(agentClass)\n\nCreates a Fastify plugin with A2A protocol endpoints.\n\n```typescript\nimport { createA2APlugin } from '@a2akit/fastify';\n\nfastify.register(createA2APlugin(MyAgent), {\n  prefix: '/a2a',  // Optional: route prefix\n});\n```\n\n#### Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `prefix` | `string` | `''` | Route prefix for all endpoints |\n\n#### Endpoints\n\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | `/.well-known/agent.json` | Agent Card |\n| POST | `/` | JSON-RPC endpoint |\n\n### Fastify Decoration\n\nThe plugin decorates the Fastify instance with access to the task manager:\n\n```typescript\nfastify.register(createA2APlugin(MyAgent));\n\n// Access task manager\nconst taskManager = fastify.a2aTaskManager;\nconst task = taskManager?.get('task-id');\n```\n\n## Examples\n\n### Basic Setup\n\n```typescript\nimport 'reflect-metadata';\nimport Fastify from 'fastify';\nimport { createA2APlugin } from '@a2akit/fastify';\nimport { A2AAgent, Skill, TextPart } from '@a2akit/core';\n\n@A2AAgent({\n  name: 'Greeting Agent',\n  description: 'Greets users',\n  version: '1.0.0',\n})\nclass GreetingAgent {\n  @Skill({ name: 'Greet', description: 'Greet by name' })\n  greet(@TextPart() name: string): string {\n    return `Hello, ${name}!`;\n  }\n}\n\nconst fastify = Fastify();\nfastify.register(createA2APlugin(GreetingAgent));\nfastify.listen({ port: 3000 });\n```\n\n### Multiple Agents\n\n```typescript\nimport Fastify from 'fastify';\nimport { createA2APlugin } from '@a2akit/fastify';\n\nconst fastify = Fastify();\n\n// Mount different agents on different paths\nfastify.register(createA2APlugin(GreetingAgent), { prefix: '/agents/greeting' });\nfastify.register(createA2APlugin(CalculatorAgent), { prefix: '/agents/calculator' });\n\nfastify.listen({ port: 3000 });\n```\n\n### With Logging\n\n```typescript\nimport Fastify from 'fastify';\nimport { createA2APlugin } from '@a2akit/fastify';\n\nconst fastify = Fastify({\n  logger: {\n    level: 'info',\n    transport: {\n      target: 'pino-pretty',\n    },\n  },\n});\n\nfastify.register(createA2APlugin(MyAgent), { prefix: '/a2a' });\nfastify.listen({ port: 3000 });\n```\n\n### With Other Plugins\n\n```typescript\nimport Fastify from 'fastify';\nimport cors from '@fastify/cors';\nimport { createA2APlugin } from '@a2akit/fastify';\n\nconst fastify = Fastify();\n\nawait fastify.register(cors, {\n  origin: true,\n});\n\nawait fastify.register(createA2APlugin(MyAgent), { prefix: '/a2a' });\n\nfastify.listen({ port: 3000 });\n```\n\n## Testing Your Agent\n\n```bash\n# Get Agent Card\ncurl http://localhost:3000/a2a/.well-known/agent.json | jq\n\n# Call a skill\ncurl -X POST http://localhost:3000/a2a \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": \"1\",\n    \"method\": \"tasks/send\",\n    \"params\": {\n      \"id\": \"task-1\",\n      \"message\": {\n        \"role\": \"user\",\n        \"parts\": [{\"type\": \"text\", \"text\": \"World\"}]\n      },\n      \"metadata\": {\"skillId\": \"hello\"}\n    }\n  }'\n```\n\n## TypeScript Support\n\nThe plugin includes TypeScript declaration merging for the Fastify instance:\n\n```typescript\ndeclare module 'fastify' {\n  interface FastifyInstance {\n    a2aTaskManager?: TaskManager;\n  }\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}