{"_id":"@aegis-sdk/mistral","_rev":"2-f67a6353d43fe6ee189764b1573bbf2e","name":"@aegis-sdk/mistral","dist-tags":{"latest":"0.5.0"},"versions":{"0.3.0":{"name":"@aegis-sdk/mistral","version":"0.3.0","license":"MIT","_id":"@aegis-sdk/mistral@0.3.0","maintainers":[{"name":"msjoshlopez","email":"josh@memberstack.com"}],"dist":{"shasum":"9fefded94ad2fdd4e53529c40ed0417af599c3c4","tarball":"https://registry.npmjs.org/@aegis-sdk/mistral/-/mistral-0.3.0.tgz","fileCount":8,"integrity":"sha512-zidBOCxjphaQ7JpS6/EGvW0eyuaYPZB63kRy15bISFr7GLBXNb5PmY2fLhRKOsIg290MOLfofI7koBYAIQDSnQ==","signatures":[{"sig":"MEUCIQC5DU0dHVhy9HfcvQNeFVm/fMReJz1qnVkBoaE96k7MdwIgZdzuZ4//kojHIQNLboNTJuUJUl/Hn6AovFkayppFc+I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65333},"main":"./dist/index.cjs","type":"module","_from":"file:aegis-sdk-mistral-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/6d2a5a82d4f0468deb40a9b03044e140/aegis-sdk-mistral-0.3.0.tgz","_integrity":"sha512-zidBOCxjphaQ7JpS6/EGvW0eyuaYPZB63kRy15bISFr7GLBXNb5PmY2fLhRKOsIg290MOLfofI7koBYAIQDSnQ==","_npmVersion":"10.9.4","description":"Mistral AI SDK adapter for Aegis prompt injection defense","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@aegis-sdk/core":"0.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@aegis-sdk/core":"0.3.0","@mistralai/mistralai":">=1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mistral_0.3.0_1771394272980_0.08756812440734207","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@aegis-sdk/mistral","version":"0.5.0","description":"Mistral AI SDK 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":{"@mistralai/mistralai":">=1.0.0","@aegis-sdk/core":"0.5.0"},"dependencies":{"@aegis-sdk/core":"0.5.0"},"engines":{"node":">=18.0.0"},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"_id":"@aegis-sdk/mistral@0.5.0","_integrity":"sha512-IkNrxCOismFCgfCwcQDLu7T6p44PNFPUAIMCjE/u7A/NRn0qOkcRqz14F4iQVY77GWy2MIL25BMz+Gc1sA+reg==","_resolved":"/tmp/8d89aa71a067f35ca3317c41e333abd0/aegis-sdk-mistral-0.5.0.tgz","_from":"file:aegis-sdk-mistral-0.5.0.tgz","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-IkNrxCOismFCgfCwcQDLu7T6p44PNFPUAIMCjE/u7A/NRn0qOkcRqz14F4iQVY77GWy2MIL25BMz+Gc1sA+reg==","shasum":"139139b96739e06df6013db5648dcd6833fecfff","tarball":"https://registry.npmjs.org/@aegis-sdk/mistral/-/mistral-0.5.0.tgz","fileCount":9,"unpackedSize":67799,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIELgsZo/V/tc9BharM+ohqE2EwJY3svodZXe6cs443RXAiAZvdOJRS4Cdnr2pNRGPuLbvwGV2wXBTHHRmHtdmiZBVw=="}]},"_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/mistral_0.5.0_1771972392843_0.5624473091614235"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-18T05:57:52.880Z","modified":"2026-02-24T22:33:13.092Z","0.3.0":"2026-02-18T05:57:53.130Z","0.5.0":"2026-02-24T22:33:12.989Z"},"license":"MIT","description":"Mistral AI SDK adapter for Aegis prompt injection defense","maintainers":[{"name":"msjoshlopez","email":"josh@memberstack.com"}],"readme":"# @aegis-sdk/mistral\n\nMistral AI SDK adapter for Aegis prompt injection defense. Scans messages and monitors streaming responses in Mistral's chat completion format.\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/mistral @aegis-sdk/core @mistralai/mistralai\n```\n\n## Quick Start\n\nWrap the Mistral client for automatic protection:\n\n```typescript\nimport { Mistral } from '@mistralai/mistralai';\nimport { Aegis } from '@aegis-sdk/core';\nimport { wrapMistralClient } from '@aegis-sdk/mistral';\n\nconst aegis = new Aegis({ policy: 'strict' });\nconst client = wrapMistralClient(new Mistral({ apiKey: process.env.MISTRAL_API_KEY! }), aegis);\n\n// Messages are scanned before sending.\n// Streaming responses are monitored in real-time.\nconst response = await client.chat.complete({\n  model: 'mistral-large-latest',\n  messages: [{ role: 'user', content: 'Hello!' }],\n});\n```\n\nOr scan messages manually:\n\n```typescript\nimport { Aegis } from '@aegis-sdk/core';\nimport { guardMessages } from '@aegis-sdk/mistral';\n\nconst aegis = new Aegis({ policy: 'strict' });\n\nconst messages = [\n  { role: 'system' as const, content: 'You are a helpful assistant.' },\n  { role: 'user' as const, content: userInput },\n];\n\n// Throws AegisInputBlocked if injection is detected\nconst safe = await guardMessages(aegis, messages);\n```\n\n## API\n\n### `wrapMistralClient(client, aegis, options?)`\n\nProxy the Mistral client to automatically guard `chat.complete()` and `chat.stream()` calls. Input messages are scanned before sending and streaming responses are monitored. All other client methods pass through unchanged.\n\n### `guardMessages(aegis, messages, options?)`\n\nScan an array of `MistralMessage[]` for prompt injection. Extracts text content from Mistral's message format (system, user, assistant, tool roles) and runs them through `aegis.guardInput()`. Tool messages are treated as user-provided content for scanning purposes since they can carry injection payloads. Returns the original messages if safe, throws `AegisInputBlocked` if blocked.\n\n### `createStreamTransform(aegis)`\n\nCreate a `TransformStream<string, string>` for monitoring extracted text deltas from Mistral streaming chunks.\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"}