{"_id":"@aegis-kernel/openai","_rev":"3-ec2d5a2e5eedf8bc70a23bf732180114","name":"@aegis-kernel/openai","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@aegis-kernel/openai","version":"1.0.0","keywords":["openai","function-calling","ai-safety","guardrails","llm-tools"],"author":{"name":"Sneh Gabani","email":"sneh@aegis-kernel.dev"},"license":"MIT","_id":"@aegis-kernel/openai@1.0.0","maintainers":[{"name":"aegis-kernel","email":"sneh.gabani1999@gmail.com"}],"homepage":"https://aegis-kernel.dev","bugs":{"url":"https://github.com/Snehgabani/aegis-kernel/issues"},"dist":{"shasum":"c336af13e8c7143644da764c1c3befd7c5219f05","tarball":"https://registry.npmjs.org/@aegis-kernel/openai/-/openai-1.0.0.tgz","fileCount":8,"integrity":"sha512-HfBTKu2P+hvUVOU5IXGU8OtYDZdSZZu+66Ze5/wuj69dW+ucAXEuvdcEQVXtpkrq0fs5/0gqJi/t9+yu/rN2DQ==","signatures":[{"sig":"MEQCIBVGmjRuFIemzCjtqLzEZk0ewPEun23mN09Pukycr94lAiAWbnf1YSVv8U2/OZR5cuJDhfiCPSOX2823qOHIK60qxA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18447},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":{"import":"./dist/index.d.ts","require":"./dist/index.d.cts"},"import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"a5d907eb2f205ff5d5a96abcf5da33d1b900eaff","scripts":{"lint":"tsc --noEmit","test":"vitest run","build":"tsup"},"_npmUser":{"name":"aegis-kernel","email":"sneh.gabani1999@gmail.com"},"repository":{"url":"git+https://github.com/Snehgabani/aegis-kernel.git","type":"git","directory":"packages/openai"},"_npmVersion":"10.9.8","description":"OpenAI Function Calling and Assistant Tools safety guard","directories":{},"_nodeVersion":"22.23.2","dependencies":{"@aegis-kernel/core":"*"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.6","vitest":"^4.1.10","typescript":"^5.7.3","@types/node":"^26.2.0"},"_npmOperationalInternal":{"tmp":"tmp/openai_1.0.0_1787148128827_0.357207885368761","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.1.0":{"name":"@aegis-kernel/openai","version":"1.1.0","keywords":["openai","function-calling","ai-safety","guardrails","llm-tools"],"author":{"name":"Sneh Gabani","email":"sneh@aegis-kernel.dev"},"license":"MIT","_id":"@aegis-kernel/openai@1.1.0","maintainers":[{"name":"aegis-kernel","email":"sneh.gabani1999@gmail.com"}],"homepage":"https://snehgabani.github.io/aegis-kernel/","bugs":{"url":"https://github.com/Snehgabani/aegis-kernel/issues"},"dist":{"shasum":"7e7c31ba4acfead5dd073aa190ebf65055eafa99","tarball":"https://registry.npmjs.org/@aegis-kernel/openai/-/openai-1.1.0.tgz","fileCount":8,"integrity":"sha512-lhXsjHxtbScVc5rSI/QSG2C1IkhBVV8JKJggEDOjkTGKP7j0Pd+jXGGbR6pi9vCKZwLPqKz8KxSktjUfDIgeGw==","signatures":[{"sig":"MEQCIFMF2zMa7ipqi67B8GZcBV7K8ct3GIPyCuR9HqUisBvxAiBmPAaKfq5UvRfROoaZu7aL1yJvMj3dnKmpHnLzjUksWg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aegis-kernel%2fopenai@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":18473},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":{"import":"./dist/index.d.ts","require":"./dist/index.d.cts"},"import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"6d41f24ec5a43c311fef98c4d2bb6f4962974295","scripts":{"lint":"tsc --noEmit","test":"vitest run","build":"tsup"},"_npmUser":{"name":"aegis-kernel","email":"sneh.gabani1999@gmail.com"},"repository":{"url":"git+https://github.com/Snehgabani/aegis-kernel.git","type":"git","directory":"packages/openai"},"_npmVersion":"10.8.2","description":"OpenAI Function Calling and Assistant Tools safety guard","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@aegis-kernel/core":"*"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.6","vitest":"^4.1.10","typescript":"^5.7.3","@types/node":"^26.2.0"},"_npmOperationalInternal":{"tmp":"tmp/openai_1.1.0_1787306491322_0.3147082448611329","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2026-08-19T14:02:08.592Z","modified":"2026-08-30T02:36:00.094Z","1.0.0":"2026-08-19T14:02:08.958Z","1.1.0":"2026-08-21T10:01:31.453Z"},"bugs":{"url":"https://github.com/Snehgabani/aegis-kernel/issues"},"author":{"name":"Sneh Gabani","email":"sneh@aegis-kernel.dev"},"license":"MIT","homepage":"https://snehgabani.github.io/aegis-kernel/","keywords":["openai","function-calling","ai-safety","guardrails","llm-tools"],"repository":{"url":"git+https://github.com/Snehgabani/aegis-kernel.git","type":"git","directory":"packages/openai"},"description":"OpenAI Function Calling and Assistant Tools safety guard","maintainers":[{"name":"aegis-kernel","email":"sneh.gabani1999@gmail.com"}],"readme":"# 🛡️ @aegis-kernel/openai\n\n> **OpenAI Function Calling & Assistant Tools Deterministic Safety Guard**  \n> *Pre-Execution Clearance • Structured Self-Healing Error Feedback • Tool Message Interception*\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue.svg)](https://www.typescriptlang.org/)\n[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0-green.svg)](https://nodejs.org/)\n\n---\n\n## 🚀 Overview\n\n`@aegis-kernel/openai` intercepts OpenAI chat completion tool calls (`message.tool_calls`) and enforces deterministic policy invariants before dispatching tool execution. If a tool call violates an invariant, the guard automatically synthesizes a self-healing tool error message that guides the LLM to auto-correct its arguments.\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install @aegis-kernel/openai @aegis-kernel/core\n```\n\n---\n\n## ⚡ Quickstart\n\n```typescript\nimport OpenAI from 'openai';\nimport { AegisOpenAIGuard } from '@aegis-kernel/openai';\n\nconst openai = new OpenAI();\nconst guard = new AegisOpenAIGuard({\n  mode: 'enforce',\n  packs: ['@aegis/sql-guard', '@aegis/finance-guard'],\n});\n\nconst completion = await openai.chat.completions.create({\n  model: 'gpt-4o',\n  messages: [{ role: 'user', content: 'Clean up inactive users table' }],\n  tools: myToolDefinitions,\n});\n\nconst message = completion.choices[0].message;\n\nif (message.tool_calls) {\n  for (const toolCall of message.tool_calls) {\n    // Automatically intercepts, validates invariants, and executes safely\n    const toolMessage = await guard.handleToolCall(toolCall, async (args) => {\n      return await myLocalToolExecutor(args);\n    });\n\n    // toolMessage contains either the execution output or structured self-healing feedback\n    messages.push(toolMessage);\n  }\n}\n```\n\n---\n\n## 📄 License\n\nDistributed under the [MIT License](https://opensource.org/licenses/MIT). Copyright (c) 2026 Sneh Gabani.\n","readmeFilename":"README.md"}