{"_id":"@aegis-sdk/vercel","_rev":"5-75e311593f1454713225697e1d707b23","name":"@aegis-sdk/vercel","dist-tags":{"latest":"0.5.0"},"versions":{"0.0.0":{"name":"@aegis-sdk/vercel","version":"0.0.0","license":"MIT","_id":"@aegis-sdk/vercel@0.0.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":"b8c9a682f5b3792186d98b92907c445e50725afb","tarball":"https://registry.npmjs.org/@aegis-sdk/vercel/-/vercel-0.0.0.tgz","fileCount":8,"integrity":"sha512-XLqFJ/Pt1Dt1Y7byiPCSzDVzIl4kellYfCVYvWsgrZjT1TahErTEBhLzdmKM7XEDVPODEbtu1tYHC6W+SwIjlA==","signatures":[{"sig":"MEUCIQDEQyi+SdzhHMS3rNgYbAxQ7X8uVTywhc/2Wm1mHPqs4wIgGufYwFweeMSzIb0EA/F68y5rArY3Nf2ToqQEPKsH2es=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17270},"main":"./dist/index.cjs","type":"module","_from":"file:aegis-sdk-vercel-0.0.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/a411e0b9e4cf9d4087d1200ccccabfae/aegis-sdk-vercel-0.0.0.tgz","_integrity":"sha512-XLqFJ/Pt1Dt1Y7byiPCSzDVzIl4kellYfCVYvWsgrZjT1TahErTEBhLzdmKM7XEDVPODEbtu1tYHC6W+SwIjlA==","repository":{"url":"git+https://github.com/aegis-sdk/aegis.git","type":"git","directory":"packages/vercel"},"_npmVersion":"10.9.4","description":"Aegis integration for the Vercel AI SDK","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@aegis-sdk/core":"0.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"ai":">=4.0.0","@aegis-sdk/core":"0.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vercel_0.0.0_1771367880547_0.8436578082397443","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@aegis-sdk/vercel","version":"0.1.0","license":"MIT","_id":"@aegis-sdk/vercel@0.1.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":"b9468bc07602d41c5318e300e55f8b8df8c38d1e","tarball":"https://registry.npmjs.org/@aegis-sdk/vercel/-/vercel-0.1.0.tgz","fileCount":8,"integrity":"sha512-CkTQr8uFbsSAmZHDzjvTg8oZX2d4G4wB2Gxk0e+VS4Bv1GofaiZUnEqPmtuddhkh6HW5VEThWnOXleWoVI7E9A==","signatures":[{"sig":"MEUCIQD3mH9dsmt3riA+shGLWjP+wYak+3zhtIBot5LHDBLDlAIgP16VgrqaXdOpQvEkD/NG67H5ow31ENCbkScMzx/HXd4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17270},"main":"./dist/index.cjs","type":"module","_from":"file:aegis-sdk-vercel-0.1.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/2c5a530b8055863422f37d4a6a451dba/aegis-sdk-vercel-0.1.0.tgz","_integrity":"sha512-CkTQr8uFbsSAmZHDzjvTg8oZX2d4G4wB2Gxk0e+VS4Bv1GofaiZUnEqPmtuddhkh6HW5VEThWnOXleWoVI7E9A==","repository":{"url":"git+https://github.com/aegis-sdk/aegis.git","type":"git","directory":"packages/vercel"},"_npmVersion":"10.9.4","description":"Aegis integration for the Vercel AI SDK","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@aegis-sdk/core":"0.1.0"},"_hasShrinkwrap":false,"peerDependencies":{"ai":">=4.0.0","@aegis-sdk/core":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/vercel_0.1.0_1771370516403_0.5259604320228857","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@aegis-sdk/vercel","version":"0.2.0","license":"MIT","_id":"@aegis-sdk/vercel@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":"2f88d4f8c5dc688a47974b1facb30bb748cbbb77","tarball":"https://registry.npmjs.org/@aegis-sdk/vercel/-/vercel-0.2.0.tgz","fileCount":8,"integrity":"sha512-3u1TnWD164OUm660al0p0HGkMoEd5rw/86Zu99LbMpGQ8ewQ0rC9EFSPBTZIYsUFDiINlDS7kRfvj3Tj9umwOA==","signatures":[{"sig":"MEUCIDhTiOq1zkDVUcSQ8yiDLtJrYZN+NuAvD4ba0vrmeYhyAiEAlfjkZvwgn4LrpS0RdnyJPSkZtTrgxXEtRgIknickDOY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40140},"main":"./dist/index.cjs","type":"module","_from":"file:aegis-sdk-vercel-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/5fc0722921d6426152fc4a3927fa08be/aegis-sdk-vercel-0.2.0.tgz","_integrity":"sha512-3u1TnWD164OUm660al0p0HGkMoEd5rw/86Zu99LbMpGQ8ewQ0rC9EFSPBTZIYsUFDiINlDS7kRfvj3Tj9umwOA==","repository":{"url":"git+https://github.com/aegis-sdk/aegis.git","type":"git","directory":"packages/vercel"},"_npmVersion":"10.9.4","description":"Aegis integration for the Vercel AI SDK","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@aegis-sdk/core":"0.2.0"},"_hasShrinkwrap":false,"peerDependencies":{"ai":">=4.0.0","@aegis-sdk/core":"0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/vercel_0.2.0_1771372100121_0.935294112037288","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@aegis-sdk/vercel","version":"0.3.0","license":"MIT","_id":"@aegis-sdk/vercel@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":"1f27a3bfece2e0d3bc2e91661a21769975c631ea","tarball":"https://registry.npmjs.org/@aegis-sdk/vercel/-/vercel-0.3.0.tgz","fileCount":8,"integrity":"sha512-+bFQqXaLXBwNFInowh4hKsaIAWA8ObdXwywJg6tva1AL1PAtDLaUOSTucnpy+c2M4T30M6s7QWgygNKaHW46+A==","signatures":[{"sig":"MEUCIGFPbDAxVkheuqtL8q92gpoOWafRofM9b8u7f3MrUFNRAiEAn2pvRJKn3isMwz9YoOCljBzI3VlGaQaN1LOcG6vd1jY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40140},"main":"./dist/index.cjs","type":"module","_from":"file:aegis-sdk-vercel-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/a7c714208702cf382c2cab8af24a58be/aegis-sdk-vercel-0.3.0.tgz","_integrity":"sha512-+bFQqXaLXBwNFInowh4hKsaIAWA8ObdXwywJg6tva1AL1PAtDLaUOSTucnpy+c2M4T30M6s7QWgygNKaHW46+A==","repository":{"url":"git+https://github.com/aegis-sdk/aegis.git","type":"git","directory":"packages/vercel"},"_npmVersion":"10.9.4","description":"Aegis integration for the Vercel AI SDK","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@aegis-sdk/core":"0.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"ai":">=4.0.0","@aegis-sdk/core":"0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/vercel_0.3.0_1771394277887_0.3058370095976639","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@aegis-sdk/vercel","version":"0.5.0","description":"Aegis integration for the Vercel AI SDK","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":{"ai":">=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/vercel"},"engines":{"node":">=18.0.0"},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"_id":"@aegis-sdk/vercel@0.5.0","bugs":{"url":"https://github.com/aegis-sdk/aegis/issues"},"homepage":"https://github.com/aegis-sdk/aegis#readme","_integrity":"sha512-qFYB/ajF8O/L1v6E2o3Zy5z7+xI62PQ8GeKS2W84SQrH68om6vfUIrPKrL+XDYoIPh5PQtU5jQ1TfGiTTkky2Q==","_resolved":"/tmp/f47ed74d221812a057d8ecdad72b1848/aegis-sdk-vercel-0.5.0.tgz","_from":"file:aegis-sdk-vercel-0.5.0.tgz","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-qFYB/ajF8O/L1v6E2o3Zy5z7+xI62PQ8GeKS2W84SQrH68om6vfUIrPKrL+XDYoIPh5PQtU5jQ1TfGiTTkky2Q==","shasum":"e5e7461a1b8ddb5d9ae98b420c18c5b9f9166450","tarball":"https://registry.npmjs.org/@aegis-sdk/vercel/-/vercel-0.5.0.tgz","fileCount":9,"unpackedSize":42883,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAjqr7Hoc4RZs1A8Gq5LCNcgG5JNpo6U8ZirEOKIvV/VAiEAp6fbJ5v6nfVWjIW2plXz8akf2r/XXyD5ftG1q6GtPbM="}]},"_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/vercel_0.5.0_1771972393455_0.014530536494404389"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-17T22:38:00.458Z","modified":"2026-02-24T22:33:13.717Z","0.0.0":"2026-02-17T22:38:00.741Z","0.1.0":"2026-02-17T23:21:56.543Z","0.2.0":"2026-02-17T23:48:20.277Z","0.3.0":"2026-02-18T05:57:58.042Z","0.5.0":"2026-02-24T22:33:13.598Z"},"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/vercel"},"description":"Aegis integration for the Vercel AI SDK","maintainers":[{"name":"msjoshlopez","email":"josh@memberstack.com"}],"readme":"# @aegis-sdk/vercel\n\nVercel AI SDK adapter for Aegis prompt injection defense. Integrates directly with `streamText()` via `experimental_transform` for real-time output monitoring.\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/vercel @aegis-sdk/core ai\n```\n\n## Quick Start\n\n```typescript\nimport { streamText } from 'ai';\nimport { openai } from '@ai-sdk/openai';\nimport { Aegis } from '@aegis-sdk/core';\nimport { createAegisTransform, guardMessages } from '@aegis-sdk/vercel';\n\nconst aegis = new Aegis({ policy: 'strict' });\n\nexport async function POST(req: Request) {\n  const { messages } = await req.json();\n\n  // Scan input messages\n  const safeMessages = await guardMessages(aegis, messages);\n\n  // Stream with real-time output monitoring\n  const result = streamText({\n    model: openai('gpt-4o'),\n    messages: safeMessages,\n    experimental_transform: createAegisTransform(aegis),\n  });\n\n  return result.toDataStreamResponse();\n}\n```\n\n## API\n\n### `createAegisTransform(aegis, options?)`\n\nCreate a stream transform compatible with the Vercel AI SDK's `experimental_transform` option on `streamText()`. Returns a function (not a TransformStream directly) that accepts `{ tools, stopStream }` from the SDK.\n\nThe transform processes `TextStreamPart` objects:\n- `text-delta` parts have their `textDelta` scanned by the Aegis StreamMonitor. On violation, the stream is terminated via `stopStream()`.\n- All other part types pass through unchanged.\n\n```typescript\nconst result = streamText({\n  model: openai('gpt-4o'),\n  messages: safeMessages,\n  experimental_transform: createAegisTransform(aegis),\n});\n```\n\n### `createAegisMiddleware(aegis)`\n\nCreate model middleware for use with `wrapLanguageModel()`. An alternative to `experimental_transform` that wraps the model itself -- all streams through the wrapped model are monitored.\n\n```typescript\nimport { wrapLanguageModel } from 'ai';\nimport { createAegisMiddleware } from '@aegis-sdk/vercel';\n\nconst protectedModel = wrapLanguageModel({\n  model: openai('gpt-4o'),\n  middleware: createAegisMiddleware(aegis),\n});\n```\n\n### `guardMessages(aegis, messages, options?)`\n\nScan Vercel AI SDK format messages (`{ role: string, content: string }[]`) for prompt injection. Converts to Aegis format and runs `aegis.guardInput()`. Returns the original messages if safe, throws `AegisInputBlocked` if blocked.\n\nOptions:\n- **`scanStrategy`** -- `'last-user'` (default), `'all-user'`, or `'full-history'`\n\n### `getAuditLog(aegis)`\n\nConvenience accessor for the Aegis audit log.\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"}