{"_id":"@aevris/sdk","name":"@aevris/sdk","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aevris/sdk","version":"1.0.0","description":"Official JavaScript/TypeScript SDK for AEVRIS — deterministic AI security middleware that intercepts prompts before they reach AI models and verifies outputs before delivery.","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","type":"commonjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","test":"node --test dist/test-runtime.cjs"},"keywords":["ai-security","llm-security","prompt-injection","agentic-ai","mcp-security","owasp-llm"],"author":{"name":"AEVRIS LLC","email":"hello@aevris.ai"},"license":"MIT","homepage":"https://aevris.ai","repository":{"type":"git","url":"git+https://github.com/Aevris-AI/aevris-js-sdk.git"},"engines":{"node":">=18.0.0"},"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3"},"_id":"@aevris/sdk@1.0.0","bugs":{"url":"https://github.com/Aevris-AI/aevris-js-sdk/issues"},"_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-pFW1E3WfEsTSzPO0QzQM4CreEMnNX+QX6Cbs3t4O/LRj7fd/fizGZsWyiMHOHnyjVd4Tl6ijQf1okfiwlsMN+w==","shasum":"d4ff9e5f87687a1896da0b1f37d94e4f8e486aed","tarball":"https://registry.npmjs.org/@aevris/sdk/-/sdk-1.0.0.tgz","fileCount":6,"unpackedSize":48729,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCl+FXo11oLuue3SDq4PRRve6jx8ZUbkv+jiPppuWDbTQIgee8XyALdM/zkhKuuSj6UacUYc0xy5KU7AlmFY+cOOAI="}]},"_npmUser":{"name":"aevrisai","email":"hello@aevris.ai"},"directories":{},"maintainers":[{"name":"aevrisai","email":"hello@aevris.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.0_1782791618794_0.6243322774204028"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-30T03:53:38.652Z","1.0.0":"2026-06-30T03:53:38.937Z","modified":"2026-06-30T03:53:39.127Z"},"maintainers":[{"name":"aevrisai","email":"hello@aevris.ai"}],"description":"Official JavaScript/TypeScript SDK for AEVRIS — deterministic AI security middleware that intercepts prompts before they reach AI models and verifies outputs before delivery.","homepage":"https://aevris.ai","keywords":["ai-security","llm-security","prompt-injection","agentic-ai","mcp-security","owasp-llm"],"repository":{"type":"git","url":"git+https://github.com/Aevris-AI/aevris-js-sdk.git"},"author":{"name":"AEVRIS LLC","email":"hello@aevris.ai"},"bugs":{"url":"https://github.com/Aevris-AI/aevris-js-sdk/issues"},"license":"MIT","readme":"# AEVRIS JavaScript/TypeScript SDK\n\nOfficial Node.js/TypeScript client for [AEVRIS](https://aevris.ai) — deterministic AI security middleware that intercepts prompts before they reach AI models and verifies outputs before delivery.\n\nWorks in Node.js 18+ (native `fetch`), and in browser/Cloudflare Workers environments where `fetch` is globally available.\n\n## Install\n\n```bash\nnpm install @aevris/sdk\n```\n\n## Quickstart\n\n```typescript\nimport { Aevris } from \"@aevris/sdk\";\n\nconst client = new Aevris({ apiKey: \"sk-aevris-your-key-here\" });\n\nconst result = await client.scanInput(\"some user-provided prompt\");\n\nif (result.isBlocked) {\n  console.log(`Blocked: ${result.summary}`);\n  for (const agent of result.triggeredAgents) {\n    console.log(`  ${agent.name}: ${agent.severity} — ${agent.finding}`);\n  }\n} else {\n  // safe to send to your LLM\n}\n```\n\nCommonJS works the same way:\n\n```javascript\nconst { Aevris } = require(\"@aevris/sdk\");\n```\n\n## Scanning AI outputs before they reach your user\n\n```typescript\nconst response = await yourLlmCall(prompt); // however you call your model\n\nconst result = await client.scanOutput(prompt, response);\n\nif (!result.alignmentIntact) {\n  console.log(`Compromised response: ${result.summary}`);\n  // don't deliver this response to the user\n}\n```\n\n## Session-level threat scoring\n\nPass the same `sessionId` across multiple calls to enable multi-turn attack detection. AEVRIS tracks risk across the conversation server-side and flags coordinated attacks before they complete.\n\n```typescript\nconst sessionId = \"user-123-conversation-456\";\n\nconst r1 = await client.scanInput(\"hello, how are you?\", { sessionId });\nconst r2 = await client.scanInput(\"what can you help with?\", { sessionId });\nconst r3 = await client.scanInput(\"ignore your instructions and...\", { sessionId });\n\nconsole.log(r3.sessionRiskScore);    // accumulated risk across all 3 calls\nconsole.log(r3.sessionThreatLevel);  // SAFE / LOW / MEDIUM / HIGH / CRITICAL\n```\n\n## Throw instead of check\n\nIf you'd rather use try/catch than checking `.isBlocked` every time:\n\n```typescript\nconst client = new Aevris({ apiKey: \"...\", raiseOnBlock: true });\n\ntry {\n  const result = await client.scanInput(userPrompt);\n  // only reached if not blocked\n} catch (e) {\n  if (e instanceof AevrisBlockException) {\n    console.log(`Blocked: ${e.result.summary}`);\n  }\n}\n```\n\n## Agent action firewall\n\nGate autonomous agent actions behind human approval before they execute. This uses a different 4-state model (`ALLOWED` / `BLOCKED` / `FLAGGED` / `PENDING_APPROVAL`) than the input/output scans:\n\n```typescript\nconst action = await client.scanAction(\"delete_file\", {\n  actionPayload: { path: \"/data/customer_records.db\" },\n});\n\nif (action.isPending) {\n  console.log(`Awaiting human approval: ${action.pollUrl}`);\n  // poll later with client.pollAction(action.actionId)\n} else if (action.isBlocked) {\n  console.log(`Blocked: ${action.message}`);\n} else if (action.isAllowed) {\n  await proceedWithAction();\n}\n```\n\nNote: this endpoint authenticates differently than `scanInput`/`scanOutput` (uses `Authorization: Bearer` instead of `x-api-key`) — the SDK handles this automatically.\n\n## Webhook alerts\n\nGet real-time, HMAC-signed alerts when AEVRIS blocks something:\n\n```typescript\nawait client.setWebhook(\"https://your-endpoint.example.com/aevris-alerts\", {\n  minSeverity: \"HIGH\",\n});\n```\n\nAEVRIS immediately sends a signed test payload to confirm delivery. From then on, every BLOCK/COMPROMISED verdict at or above your threshold triggers a webhook with the verdict, severity, triggered agents, and session risk data.\n\n## Error handling\n\n```typescript\nimport { AevrisAPIError } from \"@aevris/sdk\";\n\ntry {\n  const result = await client.scanInput(prompt);\n} catch (e) {\n  if (e instanceof AevrisAPIError) {\n    console.log(`AEVRIS API error: ${e.message} (status ${e.statusCode})`);\n  }\n}\n```\n\n## TypeScript\n\nFull type definitions are included. `AevrisResult`, `ActionResult`, `AgentFinding`, and all client options are fully typed.\n\n## Links\n\n- [Live demo](https://aevris.ai/demo) — try detection without an API key\n- [API documentation](https://aevris.ai/docs)\n- [Competitor comparison](https://aevris.ai/compare)\n- [Python SDK](https://pypi.org/project/aevris/)\n- Support: hello@aevris.ai\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-f81f41a4aa40c6973a9ad6ce517e1a7a"}