{"_id":"@aegis-sdk/hono","_rev":"3-1a1c4262ade4cba1a5e3fa3a41d60a8c","name":"@aegis-sdk/hono","dist-tags":{"latest":"0.5.0"},"versions":{"0.2.0":{"name":"@aegis-sdk/hono","version":"0.2.0","license":"MIT","_id":"@aegis-sdk/hono@0.2.0","maintainers":[{"name":"msjoshlopez","email":"josh@memberstack.com"}],"homepage":"https://github.com/aegis-sdk/aegis#readme","bugs":{"url":"https://github.com/aegis-sdk/aegis/issues"},"dist":{"shasum":"882acc1c9991479693eea10b52a5e425e45aa580","tarball":"https://registry.npmjs.org/@aegis-sdk/hono/-/hono-0.2.0.tgz","fileCount":8,"integrity":"sha512-MnEyDtzUDOMdFvhcFK8O5EQPEU2z04diWv4mBjmia2JlPO2ORFMfueV0WOeZZ5cH4Iit4MfW3jJ6dqYcBuC9yw==","signatures":[{"sig":"MEYCIQDcPOi7oRYjBOXT5K//+2h0iCMyoOd8K+23JL54bUamgQIhAMNMsdr6/tu6b3pabUE+/gadgIr0ZFMA+z+i2NueB5qU","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54621},"main":"./dist/index.cjs","type":"module","_from":"file:aegis-sdk-hono-0.2.0.tgz","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"}}},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"msjoshlopez","email":"josh@memberstack.com"},"_resolved":"/tmp/818be440e41a25cc93e2886453885657/aegis-sdk-hono-0.2.0.tgz","_integrity":"sha512-MnEyDtzUDOMdFvhcFK8O5EQPEU2z04diWv4mBjmia2JlPO2ORFMfueV0WOeZZ5cH4Iit4MfW3jJ6dqYcBuC9yw==","repository":{"url":"git+https://github.com/aegis-sdk/aegis.git","type":"git","directory":"packages/hono"},"_npmVersion":"10.9.4","description":"Hono middleware adapter for Aegis prompt injection defense","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@aegis-sdk/core":"0.2.0"},"_hasShrinkwrap":false,"peerDependencies":{"hono":">=4.0.0","@aegis-sdk/core":"0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/hono_0.2.0_1771372100724_0.7450129168470365","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@aegis-sdk/hono","version":"0.3.0","license":"MIT","_id":"@aegis-sdk/hono@0.3.0","maintainers":[{"name":"msjoshlopez","email":"josh@memberstack.com"}],"homepage":"https://github.com/aegis-sdk/aegis#readme","bugs":{"url":"https://github.com/aegis-sdk/aegis/issues"},"dist":{"shasum":"332201b44e57801d65d2f213bc433c244a6387ff","tarball":"https://registry.npmjs.org/@aegis-sdk/hono/-/hono-0.3.0.tgz","fileCount":8,"integrity":"sha512-QD2incVEFhkE1NDeGgPB0XQ8sWjp5s5PMCVccUxhLEf3o8JsV+dPt7WzftC/V4SdMb4bFqc4rTr1f007ZQ0NiA==","signatures":[{"sig":"MEUCIQDLJZ3s8F6VGNqUMnAPyIGZFG4t5AqMipPTM3zVuoejXgIgFIScu76z4PEASw+QbdIUFwrsicR9pOirzfpXrRwQaf4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54621},"main":"./dist/index.cjs","type":"module","_from":"file:aegis-sdk-hono-0.3.0.tgz","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"}}},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"msjoshlopez","email":"josh@memberstack.com"},"_resolved":"/tmp/f8d030cfa137563721ebffa76a693506/aegis-sdk-hono-0.3.0.tgz","_integrity":"sha512-QD2incVEFhkE1NDeGgPB0XQ8sWjp5s5PMCVccUxhLEf3o8JsV+dPt7WzftC/V4SdMb4bFqc4rTr1f007ZQ0NiA==","repository":{"url":"git+https://github.com/aegis-sdk/aegis.git","type":"git","directory":"packages/hono"},"_npmVersion":"10.9.4","description":"Hono middleware adapter for Aegis prompt injection defense","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@aegis-sdk/core":"0.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"hono":">=4.0.0","@aegis-sdk/core":"0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/hono_0.3.0_1771394272862_0.7013781151359901","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@aegis-sdk/hono","version":"0.5.0","description":"Hono middleware adapter for Aegis prompt injection defense","license":"MIT","type":"module","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","peerDependencies":{"hono":">=4.0.0","@aegis-sdk/core":"0.5.0"},"dependencies":{"@aegis-sdk/core":"0.5.0"},"repository":{"type":"git","url":"git+https://github.com/aegis-sdk/aegis.git","directory":"packages/hono"},"engines":{"node":">=18.0.0"},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"_id":"@aegis-sdk/hono@0.5.0","bugs":{"url":"https://github.com/aegis-sdk/aegis/issues"},"homepage":"https://github.com/aegis-sdk/aegis#readme","_integrity":"sha512-mxTVtvLTWkC4F0TAPiXGBmofp4JP28h2HDIVlN6TCcF3wfgyTGmbSc3uAIkfNVbnGa2XzHOI6ukqB3pyjw/K3g==","_resolved":"/tmp/6fc46fac6be63f0f99088cf91a7bb3bc/aegis-sdk-hono-0.5.0.tgz","_from":"file:aegis-sdk-hono-0.5.0.tgz","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-mxTVtvLTWkC4F0TAPiXGBmofp4JP28h2HDIVlN6TCcF3wfgyTGmbSc3uAIkfNVbnGa2XzHOI6ukqB3pyjw/K3g==","shasum":"a11824c46cd777b18b6f80da1f2b04ef70457290","tarball":"https://registry.npmjs.org/@aegis-sdk/hono/-/hono-0.5.0.tgz","fileCount":9,"unpackedSize":57144,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDAe0pqXu03chyTLZMzgL412ksnh9Jx2VHUvchg0nLMUgIgV95+Je+xtvTtbwyHRgahDvk88aZzvdfY9N2uqEbMcDU="}]},"_npmUser":{"name":"msjoshlopez","email":"josh@memberstack.com"},"directories":{},"maintainers":[{"name":"msjoshlopez","email":"josh@memberstack.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hono_0.5.0_1771972389810_0.5926242277087321"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-17T23:48:20.647Z","modified":"2026-02-24T22:33:10.111Z","0.2.0":"2026-02-17T23:48:20.872Z","0.3.0":"2026-02-18T05:57:53.023Z","0.5.0":"2026-02-24T22:33:09.974Z"},"bugs":{"url":"https://github.com/aegis-sdk/aegis/issues"},"license":"MIT","homepage":"https://github.com/aegis-sdk/aegis#readme","repository":{"type":"git","url":"git+https://github.com/aegis-sdk/aegis.git","directory":"packages/hono"},"description":"Hono middleware adapter for Aegis prompt injection defense","maintainers":[{"name":"msjoshlopez","email":"josh@memberstack.com"}],"readme":"# @aegis-sdk/hono\n\nHono middleware for scanning LLM chat messages against prompt injection attacks.\n\nPart of the [Aegis.js](https://github.com/aegis-sdk/Aegis) prompt injection defense toolkit.\n\n## Installation\n\n```bash\nnpm install @aegis-sdk/hono @aegis-sdk/core\n```\n\n## Quick Start\n\n```ts\nimport { Hono } from 'hono';\nimport { Aegis } from '@aegis-sdk/core';\nimport { aegisMiddleware } from '@aegis-sdk/hono';\n\nconst app = new Hono();\nconst aegis = new Aegis({ policy: 'strict' });\n\napp.post('/api/chat', aegisMiddleware({ aegis }), async (c) => {\n  const { messages, instance } = c.get('aegis');\n  // messages are scanned and safe to forward to your LLM\n  return c.json({ reply: '...' });\n});\n\nexport default app;\n```\n\n## API\n\n### `aegisMiddleware(options?)`\n\nCreates Hono middleware that reads messages from the request body, runs them through `aegis.guardInput()`, and sets the result on the context via `c.set('aegis', ...)`. Returns 403 with violation details if input is blocked.\n\nAccepts either an `AegisConfig` directly or an `AegisMiddlewareOptions` object:\n\n| Option | Type | Default | Description |\n|---|---|---|---|\n| `aegis` | `AegisConfig \\| Aegis` | `{}` | Aegis configuration or pre-constructed instance |\n| `messagesProperty` | `string` | `\"messages\"` | Property on the request body to read messages from |\n| `scanStrategy` | `ScanStrategy` | `\"last-user\"` | Which messages to scan |\n| `onBlocked` | `(c, error) => Response` | -- | Custom error handler. Return a `Response` to take over |\n\nAccess scan results in your handler via `c.get('aegis')`, which returns `{ messages, instance, auditLog }`.\n\n### `aegisStreamTransform(configOrInstance?)`\n\nReturns a `TransformStream<string, string>` that monitors LLM output tokens for injection payloads, PII leaks, and canary token leaks.\n\n```ts\napp.post('/chat', aegisMiddleware({ aegis }), async (c) => {\n  const transform = aegisStreamTransform(aegis);\n  const monitoredStream = llmStream.pipeThrough(transform);\n  return new Response(monitoredStream, {\n    headers: { 'Content-Type': 'text/event-stream' },\n  });\n});\n```\n\n### `guardMessages(aegis, messages, options?)`\n\nScans messages directly without using the middleware. Throws `AegisInputBlocked` if input is blocked.\n\n### Re-exports\n\n`Aegis`, `AegisInputBlocked`, `AegisSessionQuarantined`, `AegisSessionTerminated`, and all core types are re-exported for convenience.\n\n## Learn More\n\n- [Documentation](https://aegis-sdk.github.io/Aegis/)\n- [GitHub](https://github.com/aegis-sdk/Aegis)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}