{"_id":"@cogitator-ai/koa","_rev":"7-fb8df9d1d6f4ff940c7292a91ef5b6b4","name":"@cogitator-ai/koa","dist-tags":{"latest":"0.1.14"},"versions":{"0.1.0":{"name":"@cogitator-ai/koa","version":"0.1.0","keywords":["cogitator","ai","agents","koa","server","api","streaming","sse","websocket","llm","middleware"],"license":"MIT","_id":"@cogitator-ai/koa@0.1.0","maintainers":[{"name":"el1fe","email":"piuro.pavel@gmail.com"}],"homepage":"https://github.com/cogitator-ai/Cogitator-AI#readme","bugs":{"url":"https://github.com/cogitator-ai/Cogitator-AI/issues"},"dist":{"shasum":"0105f75d0de8c873efb76dc5969576bd42b06167","tarball":"https://registry.npmjs.org/@cogitator-ai/koa/-/koa-0.1.0.tgz","fileCount":79,"integrity":"sha512-emi1b4H6ArEWj75k1gqJCf9JCUDKy83OtuHgCjgyzHkhQYZKqspgqQmH33wKJUcAa2oRzi6KRgxH1ESxT8wqiw==","signatures":[{"sig":"MEUCIBx4Oo82c/eaOouTRgP5OI175bQF3sNUI4F31TrUHRCoAiEA67GpeQvXvDYARQSDXCl6uINpM+xJIrb8tzWbffuGe6Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96463},"main":"./dist/index.js","type":"module","_from":"file:cogitator-ai-koa-0.1.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"el1fe","email":"piuro.pavel@gmail.com"},"_resolved":"/private/var/folders/20/4d95hdvj45j337gtqpbx3v1m0000gn/T/7f26a03f5b42be3c3f8464451b0f9cce/cogitator-ai-koa-0.1.0.tgz","_integrity":"sha512-emi1b4H6ArEWj75k1gqJCf9JCUDKy83OtuHgCjgyzHkhQYZKqspgqQmH33wKJUcAa2oRzi6KRgxH1ESxT8wqiw==","repository":{"url":"git+https://github.com/cogitator-ai/Cogitator-AI.git","type":"git","directory":"packages/koa"},"_npmVersion":"10.9.0","description":"Koa server adapter for Cogitator AI runtime","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@cogitator-ai/core":"0.17.5","@cogitator-ai/types":"0.19.3","@cogitator-ai/server-shared":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"ws":"^8.18.0","koa":"^2.15.0","@types/ws":"^8.5.0","@types/koa":"^2.15.0","typescript":"^5.6.0","@koa/router":"^13.1.0","@types/koa__router":"^12.0.0","@cogitator-ai/swarms":"0.4.7","@cogitator-ai/workflows":"0.5.4"},"peerDependencies":{"koa":">=2.15.0","@koa/router":">=12.0.0"},"optionalDependencies":{"ws":"^8.0.0","@cogitator-ai/swarms":"0.4.7","@cogitator-ai/workflows":"0.5.4"},"_npmOperationalInternal":{"tmp":"tmp/koa_0.1.0_1769512834226_0.5895935859021781","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@cogitator-ai/koa","version":"0.1.1","keywords":["cogitator","ai","agents","koa","server","api","streaming","sse","websocket","llm","middleware"],"license":"MIT","_id":"@cogitator-ai/koa@0.1.1","maintainers":[{"name":"el1fe","email":"piuro.pavel@gmail.com"}],"homepage":"https://github.com/cogitator-ai/Cogitator-AI#readme","bugs":{"url":"https://github.com/cogitator-ai/Cogitator-AI/issues"},"dist":{"shasum":"a5a71a013326281da724e4349543040f91a0c782","tarball":"https://registry.npmjs.org/@cogitator-ai/koa/-/koa-0.1.1.tgz","fileCount":82,"integrity":"sha512-uJulb7uwtbFJ3KabtbtW9xJAUmr1kv2COvAg/Aaj62rPhx99zX1l6A/vdHw6/lv58Z4PGEN5d45fwfGsm0OCrw==","signatures":[{"sig":"MEYCIQCZ7ynjZIrERJsT9KKRizEpCq/34kryrGdDGwsVszwntQIhAMvNDvOGcaclFxPGPcA+1G7kTz1m971NY6r1ffeasHPh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":99107},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"a6b9adee17ab69490d006ebca129a24d50e90b0f","scripts":{"dev":"tsc --watch","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"el1fe","email":"piuro.pavel@gmail.com"},"repository":{"url":"git+https://github.com/cogitator-ai/Cogitator-AI.git","type":"git","directory":"packages/koa"},"_npmVersion":"10.9.0","description":"Koa server adapter for Cogitator AI runtime","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@cogitator-ai/core":"workspace:*","@cogitator-ai/types":"workspace:*","@cogitator-ai/server-shared":"workspace:*"},"_hasShrinkwrap":false,"devDependencies":{"ws":"^8.18.0","koa":"^2.15.0","@types/ws":"^8.5.0","@types/koa":"^2.15.0","typescript":"^5.6.0","@koa/router":"^13.1.0","@types/koa__router":"^12.0.0","@cogitator-ai/swarms":"workspace:*","@cogitator-ai/workflows":"workspace:*"},"peerDependencies":{"koa":">=2.15.0","@koa/router":">=12.0.0"},"optionalDependencies":{"ws":"^8.0.0","@cogitator-ai/swarms":"workspace:*","@cogitator-ai/workflows":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/koa_0.1.1_1771596833894_0.8343991338205285","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@cogitator-ai/koa","version":"0.1.3","keywords":["cogitator","ai","agents","koa","server","api","streaming","sse","websocket","llm","middleware"],"license":"MIT","_id":"@cogitator-ai/koa@0.1.3","maintainers":[{"name":"el1fe","email":"piuro.pavel@gmail.com"}],"homepage":"https://github.com/cogitator-ai/Cogitator-AI#readme","bugs":{"url":"https://github.com/cogitator-ai/Cogitator-AI/issues"},"dist":{"shasum":"612e10483dad80d1534153b9d00c82b47c74be8b","tarball":"https://registry.npmjs.org/@cogitator-ai/koa/-/koa-0.1.3.tgz","fileCount":82,"integrity":"sha512-ZPCtcLv+kuIXlwEZAfC6HFTUhZBSC/ra+eARsxG063ssGFXJaS6A1FUDWAMvsLBXXW4aDf4yfkYgm1bu9XSCxg==","signatures":[{"sig":"MEQCIHqCZ7LJPWTXiT/vp0bhGITxfGJ+7HqnxeZlW79tMSQlAiBRRZJw8OxOv8iRAMev9ZLbJ5zLSjNl5VegxzH6vBywWA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108114},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"ccb9c1f52f0b4b82d2b20ce6da27bfa36b2afcb0","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"el1fe","email":"piuro.pavel@gmail.com"},"repository":{"url":"git+https://github.com/cogitator-ai/Cogitator-AI.git","type":"git","directory":"packages/koa"},"_npmVersion":"10.9.0","description":"Koa server adapter for Cogitator AI runtime","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@cogitator-ai/core":"workspace:*","@cogitator-ai/types":"workspace:*","@cogitator-ai/server-shared":"workspace:*"},"_hasShrinkwrap":false,"devDependencies":{"ws":"^8.18.0","koa":"^2.15.0","vitest":"^3.0.0","@types/ws":"^8.5.0","supertest":"^7.0.0","@types/koa":"^2.15.0","typescript":"^5.6.0","@koa/router":"^13.1.0","@types/supertest":"^6.0.0","@types/koa__router":"^12.0.0","@cogitator-ai/swarms":"workspace:*","@cogitator-ai/workflows":"workspace:*"},"peerDependencies":{"koa":">=2.15.0","@koa/router":">=12.0.0"},"optionalDependencies":{"ws":"^8.0.0","@cogitator-ai/swarms":"workspace:*","@cogitator-ai/workflows":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/koa_0.1.3_1772016523220_0.7641235146679342","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@cogitator-ai/koa","version":"0.1.5","keywords":["cogitator","ai","agents","koa","server","api","streaming","sse","websocket","llm","middleware"],"license":"MIT","_id":"@cogitator-ai/koa@0.1.5","maintainers":[{"name":"el1fe","email":"piuro.pavel@gmail.com"}],"homepage":"https://github.com/cogitator-ai/Cogitator-AI#readme","bugs":{"url":"https://github.com/cogitator-ai/Cogitator-AI/issues"},"dist":{"shasum":"34a80a5aa6b173aea18e51f418de90f254ae9bcc","tarball":"https://registry.npmjs.org/@cogitator-ai/koa/-/koa-0.1.5.tgz","fileCount":82,"integrity":"sha512-+PNIg/zl9PlLdqx8DXS+A0PV7rmut+Q1e5IT5NZE3rXvv5ChH8iryP0kpEiNV8BdOFNHmMgkaEAbKW8PJE5cag==","signatures":[{"sig":"MEYCIQCf5xKKfPYW+lhOsThfCyi9gq+HLapURwSAGwx9FDMyfQIhAP/2qMjYErYDm9n6ZKTmw/AjnQrfTnQbFStT1mUDS3gk","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108280},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f508be4a1a30c7bd136f0fa8b2e6cee5521416ab","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"el1fe","email":"piuro.pavel@gmail.com"},"repository":{"url":"git+https://github.com/cogitator-ai/Cogitator-AI.git","type":"git","directory":"packages/koa"},"_npmVersion":"10.9.0","description":"Koa server adapter for Cogitator AI runtime","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@cogitator-ai/core":"workspace:*","@cogitator-ai/types":"workspace:*","@cogitator-ai/server-shared":"workspace:*"},"_hasShrinkwrap":false,"devDependencies":{"ws":"^8.18.0","koa":"^2.15.0","vitest":"^3.0.0","@types/ws":"^8.5.0","supertest":"^7.0.0","@types/koa":"^2.15.0","typescript":"^5.6.0","@koa/router":"^13.1.0","@types/supertest":"^6.0.0","@types/koa__router":"^12.0.0","@cogitator-ai/swarms":"workspace:*","@cogitator-ai/workflows":"workspace:*"},"peerDependencies":{"koa":">=2.15.0","@koa/router":">=12.0.0"},"optionalDependencies":{"ws":"^8.0.0","@cogitator-ai/swarms":"workspace:*","@cogitator-ai/workflows":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/koa_0.1.5_1772035608589_0.8942917004139936","host":"s3://npm-registry-packages-npm-production"}},"0.1.12":{"name":"@cogitator-ai/koa","version":"0.1.12","keywords":["cogitator","ai","agents","koa","server","api","streaming","sse","websocket","llm","middleware"],"license":"MIT","_id":"@cogitator-ai/koa@0.1.12","maintainers":[{"name":"el1fe","email":"piuro.pavel@gmail.com"}],"homepage":"https://github.com/cogitator-ai/Cogitator-AI#readme","bugs":{"url":"https://github.com/cogitator-ai/Cogitator-AI/issues"},"dist":{"shasum":"38938dd3296e575cc9385a7e490b9bc7628bc60a","tarball":"https://registry.npmjs.org/@cogitator-ai/koa/-/koa-0.1.12.tgz","fileCount":82,"integrity":"sha512-W0txo7tQTcfEgrh1aJMd+OlB1UmwfXD5cfm8IYEqROQPYiw3Uoi2Vye+mEjfK3dgLUdKFm9J8vnpzcskK4d23A==","signatures":[{"sig":"MEUCIQDmzgBOJxHNrDpAaxwDLTbCgnG6a0UQ2FnNsLw7L9nR8AIgUPddxWBEMcp2n+eTjW55FOqQrzlQUYTMOPuBKKVJ8tg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108280},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"33b6a8cb29bfdd7d2255acfa240b2df5d558354e","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"el1fe","email":"piuro.pavel@gmail.com"},"repository":{"url":"git+https://github.com/cogitator-ai/Cogitator-AI.git","type":"git","directory":"packages/koa"},"_npmVersion":"10.9.0","description":"Koa server adapter for Cogitator AI runtime","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@cogitator-ai/core":"workspace:*","@cogitator-ai/types":"workspace:*","@cogitator-ai/server-shared":"workspace:*"},"_hasShrinkwrap":false,"devDependencies":{"ws":"^8.18.0","koa":"^2.15.0","vitest":"^3.0.0","@types/ws":"^8.5.0","supertest":"^7.0.0","@types/koa":"^2.15.0","typescript":"^5.6.0","@koa/router":"^13.1.0","@types/supertest":"^6.0.0","@types/koa__router":"^12.0.0","@cogitator-ai/swarms":"workspace:*","@cogitator-ai/workflows":"workspace:*"},"peerDependencies":{"koa":">=2.15.0","@koa/router":">=12.0.0"},"optionalDependencies":{"ws":"^8.0.0","@cogitator-ai/swarms":"workspace:*","@cogitator-ai/workflows":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/koa_0.1.12_1778881355621_0.7455616800184666","host":"s3://npm-registry-packages-npm-production"}},"0.1.13":{"name":"@cogitator-ai/koa","version":"0.1.13","keywords":["cogitator","ai","agents","koa","server","api","streaming","sse","websocket","llm","middleware"],"license":"MIT","_id":"@cogitator-ai/koa@0.1.13","maintainers":[{"name":"el1fe","email":"piuro.pavel@gmail.com"}],"homepage":"https://github.com/cogitator-ai/Cogitator-AI#readme","bugs":{"url":"https://github.com/cogitator-ai/Cogitator-AI/issues"},"dist":{"shasum":"4017434cb3dec5dcfd3d233f9a22d6a1839b532f","tarball":"https://registry.npmjs.org/@cogitator-ai/koa/-/koa-0.1.13.tgz","fileCount":83,"integrity":"sha512-h/e4MUr5yO/6dbLJl7xpuj2VeWwBZKs3CSsHqKBo1u3UKT9rUrh3rOn5FnIOxJa+3CcmFIDa4mTvcX360qAKFw==","signatures":[{"sig":"MEUCIQCb0cXsim9tspW6XzpZrCUF9JhJVkB5l9njHKFXOUcZ8AIgMkH3ScxkeqQNLTrqNZj89BcMuCsfA1RbVO1cOynOhjc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":109322},"main":"./dist/index.js","type":"module","_from":"file:cogitator-ai-koa-0.1.13.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"el1fe","email":"piuro.pavel@gmail.com"},"_resolved":"/private/var/folders/20/4d95hdvj45j337gtqpbx3v1m0000gn/T/cf492a47192911bcaa8ae590cc22d635/cogitator-ai-koa-0.1.13.tgz","_integrity":"sha512-h/e4MUr5yO/6dbLJl7xpuj2VeWwBZKs3CSsHqKBo1u3UKT9rUrh3rOn5FnIOxJa+3CcmFIDa4mTvcX360qAKFw==","repository":{"url":"git+https://github.com/cogitator-ai/Cogitator-AI.git","type":"git","directory":"packages/koa"},"_npmVersion":"10.9.0","description":"Koa server adapter for Cogitator AI runtime","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@cogitator-ai/core":"0.19.3","@cogitator-ai/types":"0.22.2","@cogitator-ai/server-shared":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"ws":"^8.18.0","koa":"^2.15.0","vitest":"^3.0.0","@types/ws":"^8.5.0","supertest":"^7.0.0","@types/koa":"^2.15.0","typescript":"^5.6.0","@koa/router":"^13.1.0","@types/supertest":"^6.0.0","@types/koa__router":"^12.0.0","@cogitator-ai/swarms":"0.4.19","@cogitator-ai/workflows":"0.5.16"},"peerDependencies":{"koa":">=2.15.0","@koa/router":">=12.0.0"},"optionalDependencies":{"ws":"^8.0.0","@cogitator-ai/swarms":"0.4.19","@cogitator-ai/workflows":"0.5.16"},"_npmOperationalInternal":{"tmp":"tmp/koa_0.1.13_1778882270933_0.15475924334179791","host":"s3://npm-registry-packages-npm-production"}},"0.1.14":{"name":"@cogitator-ai/koa","version":"0.1.14","description":"Koa server adapter for Cogitator AI runtime","type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"main":"./dist/index.js","types":"./dist/index.d.ts","dependencies":{"@cogitator-ai/core":"0.19.4","@cogitator-ai/server-shared":"0.1.0","@cogitator-ai/types":"0.22.3"},"peerDependencies":{"koa":">=2.15.0","@koa/router":">=12.0.0"},"optionalDependencies":{"ws":"^8.0.0","@cogitator-ai/workflows":"0.5.17","@cogitator-ai/swarms":"0.4.20"},"devDependencies":{"supertest":"^7.0.0","@types/supertest":"^6.0.0","vitest":"^3.0.0","@types/koa":"^2.15.0","@types/koa__router":"^12.0.0","@types/ws":"^8.5.0","koa":"^2.15.0","@koa/router":"^13.1.0","typescript":"^5.6.0","ws":"^8.18.0","@cogitator-ai/workflows":"0.5.17","@cogitator-ai/swarms":"0.4.20"},"repository":{"type":"git","url":"git+https://github.com/cogitator-ai/Cogitator-AI.git","directory":"packages/koa"},"license":"MIT","keywords":["cogitator","ai","agents","koa","server","api","streaming","sse","websocket","llm","middleware"],"scripts":{"build":"tsc","dev":"tsc --watch","test":"vitest run","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"_id":"@cogitator-ai/koa@0.1.14","bugs":{"url":"https://github.com/cogitator-ai/Cogitator-AI/issues"},"homepage":"https://github.com/cogitator-ai/Cogitator-AI#readme","_integrity":"sha512-RkHgvdk8LHyrvlhegF5q/1IT4oX8OxeAT1ddCEY7PtaH9sP3WoL7/YbmNlnMdJBLhJ2sN9oSnViKWXpl5eQk8A==","_resolved":"/private/var/folders/20/4d95hdvj45j337gtqpbx3v1m0000gn/T/415b36cf396bd29520d5320159cd4c8a/cogitator-ai-koa-0.1.14.tgz","_from":"file:cogitator-ai-koa-0.1.14.tgz","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-RkHgvdk8LHyrvlhegF5q/1IT4oX8OxeAT1ddCEY7PtaH9sP3WoL7/YbmNlnMdJBLhJ2sN9oSnViKWXpl5eQk8A==","shasum":"63bfb2cd945b3e1bb682ce99540e0bb117a3f99a","tarball":"https://registry.npmjs.org/@cogitator-ai/koa/-/koa-0.1.14.tgz","fileCount":83,"unpackedSize":111696,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDgWii5gcU4G7btheBfVJqKkOTM+E7wPWw9dbJ5Kj1o8wIhAI6szag2RhQhG7l0w3oD/eEl3a40fhkMzhHAo6GT7g+Y"}]},"_npmUser":{"name":"el1fe","email":"piuro.pavel@gmail.com"},"directories":{},"maintainers":[{"name":"el1fe","email":"piuro.pavel@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/koa_0.1.14_1785059678629_0.5442184372112457"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-27T11:20:34.102Z","modified":"2026-07-26T09:54:38.901Z","0.1.0":"2026-01-27T11:20:34.373Z","0.1.1":"2026-02-20T14:13:54.055Z","0.1.3":"2026-02-25T10:48:43.404Z","0.1.5":"2026-02-25T16:06:48.747Z","0.1.12":"2026-05-15T21:42:35.761Z","0.1.13":"2026-05-15T21:57:51.111Z","0.1.14":"2026-07-26T09:54:38.761Z"},"bugs":{"url":"https://github.com/cogitator-ai/Cogitator-AI/issues"},"license":"MIT","homepage":"https://github.com/cogitator-ai/Cogitator-AI#readme","keywords":["cogitator","ai","agents","koa","server","api","streaming","sse","websocket","llm","middleware"],"repository":{"type":"git","url":"git+https://github.com/cogitator-ai/Cogitator-AI.git","directory":"packages/koa"},"description":"Koa server adapter for Cogitator AI runtime","maintainers":[{"name":"el1fe","email":"piuro.pavel@gmail.com"}],"readme":"# @cogitator-ai/koa\n\nKoa server adapter for Cogitator AI runtime. Exposes agents, workflows, swarms, and threads as a REST API with SSE streaming and WebSocket support.\n\n## Installation\n\n```bash\npnpm add @cogitator-ai/koa @cogitator-ai/core koa @koa/router\n```\n\n## Quick Start\n\n```typescript\nimport Koa from 'koa';\nimport { Cogitator, Agent } from '@cogitator-ai/core';\nimport { cogitatorApp } from '@cogitator-ai/koa';\n\nconst cogitator = new Cogitator({\n  /* ... */\n});\nconst chatAgent = new Agent({ name: 'chat', instructions: 'You are a helpful assistant.' });\n\nconst app = new Koa();\n\nconst router = cogitatorApp({\n  cogitator,\n  agents: { chat: chatAgent },\n});\n\napp.use(router.routes());\napp.use(router.allowedMethods());\n\napp.listen(3000);\n```\n\n## API\n\n### `cogitatorApp(options)`\n\nCreates a Koa Router with all Cogitator endpoints.\n\n**Options:**\n\n| Option            | Type                            | Description                                    |\n| ----------------- | ------------------------------- | ---------------------------------------------- |\n| `cogitator`       | `Cogitator`                     | **Required.** Cogitator runtime instance       |\n| `agents`          | `Record<string, Agent>`         | Named agents to expose                         |\n| `workflows`       | `Record<string, Workflow>`      | Named workflows                                |\n| `swarms`          | `Record<string, SwarmConfig>`   | Named swarms                                   |\n| `auth`            | `(ctx: Context) => AuthContext` | Authentication function (receives Koa Context) |\n| `enableSwagger`   | `boolean`                       | Enable Swagger/OpenAPI docs                    |\n| `swagger`         | `SwaggerConfig`                 | Swagger configuration                          |\n| `enableWebSocket` | `boolean`                       | Enable WebSocket support                       |\n| `websocket`       | `WebSocketConfig`               | WebSocket configuration                        |\n\n## Endpoints\n\n### Agents\n\n| Method | Path                   | Description               |\n| ------ | ---------------------- | ------------------------- |\n| `GET`  | `/agents`              | List all agents           |\n| `POST` | `/agents/:name/run`    | Run agent (JSON response) |\n| `POST` | `/agents/:name/stream` | Run agent (SSE stream)    |\n\n### Threads (Memory)\n\n| Method   | Path                    | Description           |\n| -------- | ----------------------- | --------------------- |\n| `GET`    | `/threads/:id`          | Get thread messages   |\n| `POST`   | `/threads/:id/messages` | Add message to thread |\n| `DELETE` | `/threads/:id`          | Delete thread         |\n\n### Workflows\n\n| Method | Path                      | Description            |\n| ------ | ------------------------- | ---------------------- |\n| `GET`  | `/workflows`              | List workflows         |\n| `POST` | `/workflows/:name/run`    | Execute workflow       |\n| `POST` | `/workflows/:name/stream` | Stream workflow events |\n\n### Swarms\n\n| Method | Path                       | Description           |\n| ------ | -------------------------- | --------------------- |\n| `GET`  | `/swarms`                  | List swarms           |\n| `POST` | `/swarms/:name/run`        | Run swarm             |\n| `POST` | `/swarms/:name/stream`     | Stream swarm progress |\n| `GET`  | `/swarms/:name/blackboard` | Get shared state      |\n\n### Tools & Health\n\n| Method | Path      | Description     |\n| ------ | --------- | --------------- |\n| `GET`  | `/tools`  | List all tools  |\n| `GET`  | `/health` | Health check    |\n| `GET`  | `/ready`  | Readiness check |\n\n## Authentication\n\n```typescript\nconst router = cogitatorApp({\n  cogitator,\n  agents: { chat: chatAgent },\n  auth: async (ctx) => {\n    const token = ctx.get('authorization')?.replace('Bearer ', '');\n    if (!token) throw new Error('No token');\n    return { userId: 'user-123', roles: ['admin'] };\n  },\n});\n```\n\n## Route Prefix\n\n```typescript\nimport Koa from 'koa';\nimport Router from '@koa/router';\nimport { cogitatorApp } from '@cogitator-ai/koa';\n\nconst app = new Koa();\nconst main = new Router();\nconst api = cogitatorApp({ cogitator, agents });\n\nmain.use('/api/v1', api.routes(), api.allowedMethods());\napp.use(main.routes());\n```\n\n## WebSocket\n\nRequires the optional `ws` peer dependency. Supports agent, workflow, and swarm runs over a persistent connection.\n\n```typescript\nimport { createServer } from 'http';\nimport { cogitatorApp, setupWebSocket } from '@cogitator-ai/koa';\n\nconst app = new Koa();\nconst router = cogitatorApp({ cogitator, agents, enableWebSocket: true });\napp.use(router.routes());\napp.use(router.allowedMethods());\n\nconst server = createServer(app.callback());\nawait setupWebSocket(\n  server,\n  { runtime: cogitator, agents, workflows: {}, swarms: {} },\n  {\n    path: '/ws',\n    pingInterval: 30000,\n  }\n);\n\nserver.listen(3000);\n```\n\n**Message types:**\n\n| Client sends | Description                       |\n| ------------ | --------------------------------- |\n| `run`        | Start an agent/workflow/swarm run |\n| `stop`       | Cancel the current run            |\n| `ping`       | Heartbeat ping                    |\n\n| Server sends | Description                                     |\n| ------------ | ----------------------------------------------- |\n| `event`      | Stream event (token, tool-call, complete, etc.) |\n| `error`      | Error response                                  |\n| `pong`       | Heartbeat pong                                  |\n\n## SSE Streaming\n\nThe adapter includes `KoaStreamWriter` for Server-Sent Events with structured event types (text deltas, tool calls, workflow/swarm events).\n\n## Event Factories\n\nRe-exported from `@cogitator-ai/server-shared` for custom stream handling:\n\n```typescript\nimport {\n  createStartEvent,\n  createTextDeltaEvent,\n  createToolCallStartEvent,\n  createFinishEvent,\n  createWorkflowEvent,\n  createSwarmEvent,\n} from '@cogitator-ai/koa';\n```\n\n## Individual Route Builders\n\nEach route group is available as a standalone factory for custom composition:\n\n```typescript\nimport {\n  createAgentRoutes,\n  createThreadRoutes,\n  createToolRoutes,\n  createWorkflowRoutes,\n  createSwarmRoutes,\n  createHealthRoutes,\n  createSwaggerRoutes,\n} from '@cogitator-ai/koa';\n```\n\n## Middleware\n\nBuilt-in middleware stack (applied automatically by `cogitatorApp`):\n\n- **Error handler** — catches errors and returns structured `ErrorResponse`\n- **Body parser** — parses JSON for POST, PUT, PATCH requests (1 MB limit)\n- **Context** — injects `RouteContext` with `runtime`, `agents`, `workflows`, `swarms` into Koa state\n- **Auth** — optional authentication via the `auth` callback\n\n## Key Types\n\n```typescript\nimport type {\n  RouteContext, // { runtime, agents, workflows, swarms }\n  CogitatorAppOptions,\n  AuthContext,\n  AuthFunction,\n  WebSocketConfig,\n  WorkflowStatusResponse,\n  AgentRunRequest,\n  AgentRunResponse,\n  SwarmRunResponse,\n  ErrorResponse,\n} from '@cogitator-ai/koa';\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}