{"_id":"@azimuthpro/guardian-ai","_rev":"5-c6aa4a9b30db1922b291a2be6e56e69c","name":"@azimuthpro/guardian-ai","dist-tags":{"latest":"0.5.0"},"versions":{"0.2.0":{"name":"@azimuthpro/guardian-ai","version":"0.2.0","keywords":["ai","agent","security","monitoring","llm"],"author":{"name":"AZIMUTH PRO","email":"dev@azimuthpro.com"},"license":"MIT","_id":"@azimuthpro/guardian-ai@0.2.0","maintainers":[{"name":"pk_azimuthpro","email":"pk@azimuthpro.com"},{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"}],"homepage":"https://github.com/azimuthpro/guardian-ai#readme","bugs":{"url":"https://github.com/azimuthpro/guardian-ai/issues"},"dist":{"shasum":"8488810797cffe4e91ad7ef2db4443af76b5c8fa","tarball":"https://registry.npmjs.org/@azimuthpro/guardian-ai/-/guardian-ai-0.2.0.tgz","fileCount":47,"integrity":"sha512-fyUIgudKqUtoL3Lqh8xL53UiykxMk+VurOFmW/ksjn6TfalBKRVQSbm5rELs+OVAXb89GJGKZljrAqz6kYDnwQ==","signatures":[{"sig":"MEUCIQCjh2n4xQOMLOn5qsB+yxXUXXZ7mfe5ymVtX0jsH0X8WQIgRiew4qqE3dTqsiz2oIB2ceucDdTO10qKf0TIumQ4VaQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33994},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"7d55af63293c0eb23bbd9e8c61b02532d06c73af","scripts":{"lint":"eslint .","test":"jest","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"},"repository":{"url":"git+https://github.com/azimuthpro/guardian-ai.git","type":"git"},"_npmVersion":"10.8.2","description":"An AI agent that provides real-time monitoring, behavioral analysis, and security for your AI agent workforce.","directories":{},"_nodeVersion":"20.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","eslint":"^9.37.0","globals":"^16.4.0","@eslint/js":"^9.37.0","babel-jest":"^30.2.0","typescript":"^5.9.3","@babel/core":"^7.28.4","@types/jest":"^30.0.0","@babel/preset-env":"^7.28.3","@babel/preset-typescript":"^7.27.1","@typescript-eslint/parser":"^8.46.0","@typescript-eslint/eslint-plugin":"^8.46.0"},"_npmOperationalInternal":{"tmp":"tmp/guardian-ai_0.2.0_1763588547858_0.2814193727762069","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@azimuthpro/guardian-ai","version":"0.3.0","keywords":["ai","agent","security","monitoring","llm"],"author":{"name":"AZIMUTH PRO","email":"dev@azimuthpro.com"},"license":"MIT","_id":"@azimuthpro/guardian-ai@0.3.0","maintainers":[{"name":"pk_azimuthpro","email":"pk@azimuthpro.com"},{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"}],"homepage":"https://github.com/azimuthpro/guardian-ai#readme","bugs":{"url":"https://github.com/azimuthpro/guardian-ai/issues"},"dist":{"shasum":"fb559cb5980d00194d48b8ccfe649947ef7fd07c","tarball":"https://registry.npmjs.org/@azimuthpro/guardian-ai/-/guardian-ai-0.3.0.tgz","fileCount":51,"integrity":"sha512-7Ix6IVhpZ3NCctjlXphvGPKi8q2M2bBoN61U3SQESQFq9F1YtLUtPl3pwuvtRvIQpEojhs4GEAKRwKv82bsFrg==","signatures":[{"sig":"MEUCIDR9rL9eNlmq+005yr4wYN9qW3t8QzKyab7ey7wP8M40AiEA2FtoHtf3joVAFSYGfrquXVsR7+OocvE/K4QG5prQk9w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44815},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"98de1744ccaaf0044ee547ea586757c45a26bcae","scripts":{"lint":"eslint .","test":"jest","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"},"repository":{"url":"git+https://github.com/azimuthpro/guardian-ai.git","type":"git"},"_npmVersion":"10.8.2","description":"An AI agent that provides real-time monitoring, behavioral analysis, and security for your AI agent workforce.","directories":{},"_nodeVersion":"20.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","eslint":"^9.37.0","globals":"^16.4.0","@eslint/js":"^9.37.0","babel-jest":"^30.2.0","typescript":"^5.9.3","@babel/core":"^7.28.4","@types/jest":"^30.0.0","@babel/preset-env":"^7.28.3","@babel/preset-typescript":"^7.27.1","@typescript-eslint/parser":"^8.46.0","@typescript-eslint/eslint-plugin":"^8.46.0"},"_npmOperationalInternal":{"tmp":"tmp/guardian-ai_0.3.0_1763667819392_0.4657845757825396","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@azimuthpro/guardian-ai","version":"0.3.1","keywords":["ai","agent","security","monitoring","llm"],"author":{"name":"AZIMUTH PRO","email":"dev@azimuthpro.com"},"license":"MIT","_id":"@azimuthpro/guardian-ai@0.3.1","maintainers":[{"name":"pk_azimuthpro","email":"pk@azimuthpro.com"},{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"}],"homepage":"https://github.com/azimuthpro/guardian-ai#readme","bugs":{"url":"https://github.com/azimuthpro/guardian-ai/issues"},"dist":{"shasum":"3da34aa9c2a19c690166ba2a54aacc4477fff7be","tarball":"https://registry.npmjs.org/@azimuthpro/guardian-ai/-/guardian-ai-0.3.1.tgz","fileCount":51,"integrity":"sha512-hRNq0yTpbFjMIGTs+pCoEn7lx8guuYOoRNT6XkY2i4/Uula/fW+VrsKXLWODPv8W54uburAI72sPecVtMSMQyw==","signatures":[{"sig":"MEUCICeeA0mC2VdgOAJQl4ANjfvrwxinp6wS4AWpd/fqP/GWAiEAiv94DWwAtgRcxlepnaFAYwjUSj6yDrwYeUpjBh2SyZQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44907},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"1e20f0a45e0ff5a0c3539965890aa60fb63a9baa","scripts":{"lint":"eslint .","test":"jest","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"},"repository":{"url":"git+https://github.com/azimuthpro/guardian-ai.git","type":"git"},"_npmVersion":"10.8.2","description":"An AI agent that provides real-time monitoring, behavioral analysis, and security for your AI agent workforce.","directories":{},"_nodeVersion":"20.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","eslint":"^9.37.0","globals":"^16.4.0","@eslint/js":"^9.37.0","babel-jest":"^30.2.0","typescript":"^5.9.3","@babel/core":"^7.28.4","@types/jest":"^30.0.0","@babel/preset-env":"^7.28.3","@babel/preset-typescript":"^7.27.1","@typescript-eslint/parser":"^8.46.0","@typescript-eslint/eslint-plugin":"^8.46.0"},"_npmOperationalInternal":{"tmp":"tmp/guardian-ai_0.3.1_1763669206937_0.03567155628861385","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@azimuthpro/guardian-ai","version":"0.4.0","keywords":["ai","agent","security","monitoring","llm"],"author":{"name":"AZIMUTH PRO","email":"dev@azimuthpro.com"},"license":"MIT","_id":"@azimuthpro/guardian-ai@0.4.0","maintainers":[{"name":"pk_azimuthpro","email":"pk@azimuthpro.com"},{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"}],"homepage":"https://github.com/azimuthpro/guardian-ai#readme","bugs":{"url":"https://github.com/azimuthpro/guardian-ai/issues"},"dist":{"shasum":"75cce5319235f2b94db28ef78d53b49506488f3d","tarball":"https://registry.npmjs.org/@azimuthpro/guardian-ai/-/guardian-ai-0.4.0.tgz","fileCount":51,"integrity":"sha512-KOUrhTz/UC+bqRpaDY+nU2EtdcXbwGeUzrxUIwFGZkwm1y9lgL0iO9XlYjSVh6x/KqK65nlAk33WnTPA7sgTFA==","signatures":[{"sig":"MEUCIACf5UeSBsQmSxH18j8YuG61LD5NRjk0hWzOi4EXeSZoAiEAmCFMi7mHPTo2jzFX9G4BAzah37h2Hhsv+AWJrtk5tz4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44196},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"c5443746e735a47338b992742400ee5a6aaadcc9","scripts":{"lint":"eslint .","test":"jest","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"},"repository":{"url":"git+https://github.com/azimuthpro/guardian-ai.git","type":"git"},"_npmVersion":"10.8.2","description":"An AI agent that provides real-time monitoring, behavioral analysis, and security for your AI agent workforce.","directories":{},"_nodeVersion":"20.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","eslint":"^9.37.0","globals":"^16.4.0","@eslint/js":"^9.37.0","babel-jest":"^30.2.0","typescript":"^5.9.3","@babel/core":"^7.28.4","@types/jest":"^30.0.0","@babel/preset-env":"^7.28.3","@babel/preset-typescript":"^7.27.1","@typescript-eslint/parser":"^8.46.0","@typescript-eslint/eslint-plugin":"^8.46.0"},"_npmOperationalInternal":{"tmp":"tmp/guardian-ai_0.4.0_1763670233133_0.7314943239698206","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@azimuthpro/guardian-ai","version":"0.5.0","description":"Zero-Latency Stream Monitoring & Telemetry for AI Agents.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"jest","lint":"eslint .","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/azimuthpro/guardian-ai.git"},"keywords":["ai","agent","security","monitoring","llm"],"author":{"name":"AZIMUTH PRO","email":"dev@azimuthpro.com"},"license":"MIT","publishConfig":{"access":"public"},"devDependencies":{"@babel/core":"^7.28.4","@babel/preset-env":"^7.28.3","@babel/preset-typescript":"^7.27.1","@eslint/js":"^9.37.0","@types/jest":"^30.0.0","@typescript-eslint/eslint-plugin":"^8.46.0","@typescript-eslint/parser":"^8.46.0","babel-jest":"^30.2.0","eslint":"^9.37.0","globals":"^16.4.0","jest":"^30.2.0","typescript":"^5.9.3"},"_id":"@azimuthpro/guardian-ai@0.5.0","gitHead":"6d19ef94e9d291a3ac20e53b8d3f29eb3b11a223","bugs":{"url":"https://github.com/azimuthpro/guardian-ai/issues"},"homepage":"https://github.com/azimuthpro/guardian-ai#readme","_nodeVersion":"20.19.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-sZA/EHLyRdGtKu6suuF0oISIpycy8qjBBMmYOh0PiwoI4n5HSSDdTLDytaX3OnCx+5OXdY39bP24P7hiRNwBNg==","shasum":"d768e7b9217b076e170cd477c1bdcc32175eb2b6","tarball":"https://registry.npmjs.org/@azimuthpro/guardian-ai/-/guardian-ai-0.5.0.tgz","fileCount":51,"unpackedSize":45496,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHRE1/JFUlP+m/DVBkCTLjw7wIHvSU5DnhSot5mqAhG6AiEAwgAfkDHekgLirKSi7HmvTwnUayVmCdfzORC8JObctkU="}]},"_npmUser":{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"},"directories":{},"maintainers":[{"name":"pk_azimuthpro","email":"pk@azimuthpro.com"},{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/guardian-ai_0.5.0_1763912246527_0.033471349644883075"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-19T21:42:27.739Z","modified":"2025-11-23T15:37:27.121Z","0.2.0":"2025-11-19T21:42:28.045Z","0.3.0":"2025-11-20T19:43:39.563Z","0.3.1":"2025-11-20T20:06:47.184Z","0.4.0":"2025-11-20T20:23:53.336Z","0.5.0":"2025-11-23T15:37:26.879Z"},"bugs":{"url":"https://github.com/azimuthpro/guardian-ai/issues"},"author":{"name":"AZIMUTH PRO","email":"dev@azimuthpro.com"},"license":"MIT","homepage":"https://github.com/azimuthpro/guardian-ai#readme","keywords":["ai","agent","security","monitoring","llm"],"repository":{"type":"git","url":"git+https://github.com/azimuthpro/guardian-ai.git"},"description":"Zero-Latency Stream Monitoring & Telemetry for AI Agents.","maintainers":[{"name":"pk_azimuthpro","email":"pk@azimuthpro.com"},{"name":"ms_azimuthpro","email":"dev@azimuthpro.com"}],"readme":"# @azimuthpro/guardian-ai\n\n[![npm version](https://img.shields.io/npm/v/@azimuthpro/guardian-ai.svg)](https://www.npmjs.com/package/@azimuthpro/guardian-ai)\n\n**@azimuthpro/guardian-ai** is a composable telemetry SDK that mirrors Node.js and Web streams to the Guardian ingest service. Designed specifically for LLM workflows and AI agents, it allows developers to \"tap\" into response streams (like OpenAI, Anthropic, or Vercel AI SDK) to capture full interaction logs in real-time.\n\nUnlike traditional logging, Guardian is **streaming-first** and **non-blocking**. It handles data compression (gzip) and async uploading in the background, ensuring your application remains performant and your users experience zero added latency.\n\n## Key Features\n\n- **Universal Stream Support**: Auto-detects and wraps `Response`, `ReadableStream`, Node.js `Readable`, and `AsyncIterator`\n- **Zero-Latency Overhead**: Mirrors traffic asynchronously; the user stream continues instantly while logs upload in the background\n- **Bandwidth Optimized**: Automatic client-side gzip compression for all telemetry data\n- **Framework Agnostic**: Drop-in support for Next.js (App Router), Express, and the Vercel AI SDK\n\n## Installation\n\n```bash\nnpm install @azimuthpro/guardian-ai\n```\n\nView on npm: [@azimuthpro/guardian-ai](https://www.npmjs.com/package/@azimuthpro/guardian-ai)\n\n## Quick Start\n\n```ts\nimport { tap } from '@azimuthpro/guardian-ai';\n\n// Auto-detects stream type, uses env GUARDIAN_API_KEY\nconst { client, upload } = tap(response);\n\n// Forward the tapped stream to your downstream consumer\nclient.pipeTo(new WritableStream({ /* ... */ }));\n\n// Monitor background upload\nupload.catch((error) => {\n  console.error('Guardian upload failed', error);\n});\n```\n\n### Classic API (tapStream)\n\nFor more control, use the full `tapStream` API:\n\n```ts\nimport { tapStream, adapters } from '@azimuthpro/guardian-ai';\nimport fs from 'node:fs';\n\nconst source = adapters.fromNodeStream(fs.createReadStream('./agent-trace.log'));\n\nconst { client, upload } = tapStream(source, {\n  apiKey: process.env.GUARDIAN_API_KEY\n});\n\nclient.pipeTo(new WritableStream({ /* ... */ }));\nupload.catch((error) => console.error('Guardian upload failed', error));\n```\n\n> **Note:** Data is automatically compressed with gzip before upload to the Guardian ingest service.\n\n## Implementation Examples\n\n### Next.js API Route (App Router)\n\nMonitor AI agent streaming responses in a Next.js application:\n\n```ts\n// app/api/chat/route.ts\nimport { tap } from '@azimuthpro/guardian-ai';\n\nexport async function POST(request: Request) {\n  // Call your AI provider\n  const upstream = await fetch('https://api.openai.com/v1/chat/completions', {\n    method: 'POST',\n    headers: {\n      'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,\n      'Content-Type': 'application/json',\n    },\n    body: JSON.stringify({\n      model: 'gpt-4',\n      messages: [{ role: 'user', content: 'Hello!' }],\n      stream: true,\n    }),\n  });\n\n  // Tap the stream - auto-detects Response type\n  const { client, upload } = tap(upstream, {\n    headers: {\n      'X-Session-Id': crypto.randomUUID(),\n      'X-User-Id': 'user-123',\n      'X-Model': 'gpt-4',\n    },\n    onUploadError: (error) => {\n      console.error('Guardian monitoring failed', error);\n    },\n  });\n\n  // Monitor background upload\n  upload.catch((err) => console.error('Upload error:', err));\n\n  // Return the tapped stream to the client\n  return new Response(client, {\n    headers: {\n      'Content-Type': 'text/event-stream',\n      'Cache-Control': 'no-cache',\n      'Connection': 'keep-alive',\n    },\n  });\n}\n```\n\n### Vercel AI SDK Integration\n\nIntegrate Guardian monitoring with the Vercel AI SDK:\n\n```ts\n// app/api/chat/route.ts\nimport { google } from '@ai-sdk/google';\nimport { streamText, convertToModelMessages } from 'ai';\nimport { tap, createLogger } from '@azimuthpro/guardian-ai';\n\nconst logger = createLogger({ namespace: 'guardian:chat', level: 'info' });\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json();\n\n  // Generate streaming response with Vercel AI SDK\n  const result = streamText({\n    model: google('gemini-2.0-flash'),\n    messages: convertToModelMessages(messages),\n    temperature: 0.7,\n  });\n\n  const response = result.toUIMessageStreamResponse();\n\n  // Monitor with Guardian AI\n  const sessionId = crypto.randomUUID();\n  const { client, upload } = tap(response, {\n    headers: {\n      'X-Session-Id': sessionId,\n      'X-Model-Name': 'gemini-2.0-flash',\n      'X-Timestamp': new Date().toISOString(),\n    },\n    onUploadError: (error) => {\n      logger.error('Guardian upload failed', { sessionId, error });\n    },\n  });\n\n  // Handle background monitoring\n  upload.catch((error) => {\n    logger.error('Guardian background error', { sessionId, error });\n  });\n\n  // Return monitored stream\n  return new Response(client, {\n    status: response.status,\n    statusText: response.statusText,\n    headers: response.headers,\n  });\n}\n```\n\n### Express Middleware\n\nAdd Guardian monitoring to traditional Express.js applications:\n\n```ts\nimport express from 'express';\nimport { tap } from '@azimuthpro/guardian-ai';\n\nconst app = express();\n\napp.post('/api/stream', async (req, res) => {\n  // Call upstream AI service\n  const upstream = await fetch('https://api.anthropic.com/v1/messages', {\n    method: 'POST',\n    headers: {\n      'x-api-key': process.env.ANTHROPIC_API_KEY,\n      'anthropic-version': '2023-06-01',\n      'content-type': 'application/json',\n    },\n    body: JSON.stringify({\n      model: 'claude-3-5-sonnet-20241022',\n      messages: req.body.messages,\n      stream: true,\n      max_tokens: 1024,\n    }),\n  });\n\n  if (!upstream.ok) {\n    return res.status(upstream.status).json({ error: 'AI provider error' });\n  }\n\n  // Tap the upstream response\n  const { client, upload } = tap(upstream, {\n    apiKey: process.env.GUARDIAN_API_KEY,\n    headers: {\n      'X-User-Id': req.headers['x-user-id'] as string,\n      'X-Session-Id': crypto.randomUUID(),\n    },\n  });\n\n  // Set response headers\n  res.setHeader('Content-Type', 'text/event-stream');\n  res.setHeader('Cache-Control', 'no-cache');\n  res.setHeader('Connection', 'keep-alive');\n\n  // Pipe the monitored stream to the response\n  const reader = client.getReader();\n\n  try {\n    while (true) {\n      const { done, value } = await reader.read();\n      if (done) break;\n      res.write(value);\n    }\n    res.end();\n  } catch (error) {\n    console.error('Stream error:', error);\n    res.end();\n  }\n\n  // Monitor upload status\n  upload.catch((err) => console.error('Guardian upload failed:', err));\n});\n\napp.listen(3000, () => console.log('Server running on port 3000'));\n```\n\n## tap(stream, apiKeyOrOptions)\n\nSimplified API with automatic stream type detection.\n\n| Parameter | Type | Description |\n| --- | --- | --- |\n| `stream` | `ReadableStream \\| Readable \\| Response` | Any stream type - automatically detected and converted |\n| `apiKeyOrOptions` | `string \\| TapOptions` | API key string or full options object |\n\n**Returns:** `{ client: ReadableStream<Uint8Array>, upload: Promise<void> }`\n\n### Examples\n\n```ts\n// Simplest - auto-detects Response, uses env GUARDIAN_API_KEY\nconst { client, upload } = tap(response);\n\n// With explicit API key\nconst { client, upload } = tap(nodeStream, 'gdn_abc123...');\n\n// With session tracking\nconst { client, upload } = tap(response, {\n  headers: { 'X-Session-Id': crypto.randomUUID() },\n});\n\n// With full options\nconst { client, upload } = tap(webStream, {\n  apiKey: process.env.GUARDIAN_API_KEY,\n  headers: { 'X-Session-Id': crypto.randomUUID() },\n  onUploadError: console.error,\n  author: 'ai' // Optional: 'human' | 'ai'\n});\n```\n\n> **Note:** All uploads are automatically compressed with gzip before being sent to the Guardian ingest service.\n\n## tapStream(stream, options)\n\n| Option | Type | Description |\n| --- | --- | --- |\n| `apiKey` | `string` | Guardian API key. Falls back to `process.env.GUARDIAN_API_KEY`. |\n| `endpoint` | `string` | Custom ingest endpoint. Defaults to `https://guardian.azimuthpro.com/ingest`. |\n| `headers` | `Record<string, string>` | Additional headers merged into the upload request. |\n| `mapChunk` | `(chunk) => Uint8Array \\| Promise<Uint8Array>` | Transform or redact each chunk before upload. Return `undefined` to drop a chunk. |\n| `onUploadStart` | `() => void` | Invoked just before the background upload begins. |\n| `onUploadComplete` | `() => void` | Called after a successful upload. |\n| `onUploadError` | `(error) => void` | Called when the upload fails. |\n| `logger` | `Logger` | Inject a custom logger implementation. Defaults to a console-backed logger. |\n| `fetchImpl` | `typeof fetch` | Provide an alternative fetch implementation (e.g. for testing). |\n| `author` | `'human' \\| 'ai'` | Optional tag to distinguish between human and AI-authored messages. |\n\n> **Note:** All data is automatically compressed with gzip before upload. This cannot be disabled as the Guardian ingest service expects compressed data.\n\nReturns an object `{ client, upload }` where:\n\n- `client` is a `ReadableStream<Uint8Array>` that continues downstream.\n- `upload` is a `Promise<void>` tracking the background ingestion. Await or `catch` it for error handling.\n\n## Adapters\n\n- `fromNodeStream(stream)` – Wrap a Node.js readable stream as a Web `ReadableStream`.\n- `fromResponse(response)` – Extract the body stream from a `fetch` `Response`.\n- `fromAsyncIterator(iterator)` – Expose any `AsyncIterable<Uint8Array>` as a `ReadableStream`.\n\n```ts\nimport { adapters } from '@azimuthpro/guardian-ai';\n\nconst stream = adapters.fromAsyncIterator(myGenerator());\n```\n\n## Logging\n\nCreate structured loggers with namespace and level filtering:\n\n```ts\nimport { createLogger } from '@azimuthpro/guardian-ai';\n\nconst logger = createLogger({ namespace: 'guardian-agent', level: 'debug' });\nlogger.info('Starting monitoring session');\n```\n\n## Development\n\n```bash\nnpm install\nnpm run lint\nnpm test\nnpm run build\n```\n\n## License\n\nMIT © Azimuth Pro\n","readmeFilename":"README.md"}