{"_id":"@ailog/client","_rev":"8-c518b4d88ab795d76a8d6aa0b3d6018d","name":"@ailog/client","dist-tags":{"latest":"0.2.3"},"versions":{"0.1.0":{"name":"@ailog/client","version":"0.1.0","keywords":["llm","logging","ai","sdk","client"],"license":"MIT","_id":"@ailog/client@0.1.0","maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"dist":{"shasum":"be235d89be54c9219d949352c435b4dc4d3b618c","tarball":"https://registry.npmjs.org/@ailog/client/-/client-0.1.0.tgz","fileCount":4,"integrity":"sha512-r9kFmggE2/47+xcHahMn6OnGP0h/cOOKTb35+mJgltAMXeHc6oBKJ5HrPhbpNVVrbWJdOnejMM31QzIOzzAwTQ==","signatures":[{"sig":"MEUCIQCr5eec+Lw0dMqyQtACAiSsqKKFKKL/5DGh37AEFM8+WAIgS1cPP06f4mjI0t3qEpflC4JEU30ZcyK36mTRwJxCxF4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50989},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"a65e2995773ad73af35e905792abe8bdc92df934","private":false,"scripts":{"dev":"tsup --watch","lint":"eslint --max-warnings=0 .","build":"bun run prebuild && tsup","lint:fix":"eslint --fix .","prebuild":"bun scripts/copy-types.ts","check-types":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"rororo","email":"ro.syoyu@gmail.com"},"_npmVersion":"10.9.3","description":"Minimal Node.js client SDK for the LLM Logging System","directories":{},"_nodeVersion":"22.20.0","dependencies":{"zod":"^3.25.49","p-queue":"^8.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","eslint":"^9.39.2","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.0_1766295338409_0.49199404779109956","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@ailog/client","version":"0.1.1","keywords":["llm","logging","ai","sdk","client"],"license":"MIT","_id":"@ailog/client@0.1.1","maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"dist":{"shasum":"d7407860bf7e4cd1c8331eac119340840b7e97f8","tarball":"https://registry.npmjs.org/@ailog/client/-/client-0.1.1.tgz","fileCount":4,"integrity":"sha512-IpvKrjZ21xo0A8Y5/3iXEV9GA0FpNjVi9kp/2XF8cmT2s7NG+cO51Qsq0Wxce7i7wrEdIC2U88bYGKndnV0B1A==","signatures":[{"sig":"MEUCIQCPg7uki9N6umdB0a3shWrYj7s6Sqo2YdD33TYgrUV7sgIgX24Mb8GBsCdGRz5G0Ejjiw/j9XWAz9FP97HcJeVB9EU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50072},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"d99d67f26fd98da5ce3851f08090c3a8f1ec02c4","private":false,"scripts":{"dev":"tsup --watch","lint":"eslint --max-warnings=0 .","build":"bun run prebuild && tsup","lint:fix":"eslint --fix .","prebuild":"bun scripts/copy-types.ts","check-types":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"rororo","email":"ro.syoyu@gmail.com"},"_npmVersion":"10.9.3","description":"Minimal Node.js client SDK for the LLM Logging System","directories":{},"_nodeVersion":"22.20.0","dependencies":{"zod":"^3.25.49","p-queue":"^8.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","eslint":"^9.39.2","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.1_1766297952298_0.9342493875207158","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@ailog/client","version":"0.1.2","keywords":["llm","logging","ai","sdk","client"],"license":"MIT","_id":"@ailog/client@0.1.2","maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"dist":{"shasum":"7e2831c0a593c5efb533b4ae73a022b514956b88","tarball":"https://registry.npmjs.org/@ailog/client/-/client-0.1.2.tgz","fileCount":4,"integrity":"sha512-PoDIjpyFXIW2Wv7hKk9b+QouTllDuntKO/nJUeRwL1lAk92OKmsPGNRZFOPN7TrClHPuECCCxpPC0ZNqpPg8XA==","signatures":[{"sig":"MEYCIQCShBxQ7GvHJgUVKYXfNum3aC925M/jMEeIhZ4OSp6+XwIhANrO45g0kRdXHZsSEI0MTtIVxvwFJX/Z9Wj0M/dudRum","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50089},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"d40e1555fc79529475bc707e9d50f89586d0a2f2","private":false,"scripts":{"dev":"tsup --watch","lint":"eslint --max-warnings=0 .","build":"bun run prebuild && tsup","lint:fix":"eslint --fix .","prebuild":"bun scripts/copy-types.ts","check-types":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"rororo","email":"ro.syoyu@gmail.com"},"_npmVersion":"10.9.3","description":"Minimal Node.js client SDK for the LLM Logging System","directories":{},"_nodeVersion":"22.20.0","dependencies":{"zod":"^3.25.49","p-queue":"^8.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","eslint":"^9.39.2","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.2_1766299770353_0.8131945026433041","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@ailog/client","version":"0.1.3","keywords":["llm","logging","ai","sdk","client"],"license":"MIT","_id":"@ailog/client@0.1.3","maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"dist":{"shasum":"ed7f2806a22eb11db9c17c8e2a7c4588131e4c17","tarball":"https://registry.npmjs.org/@ailog/client/-/client-0.1.3.tgz","fileCount":4,"integrity":"sha512-PpINViVtYtaUnPS/92N4VPkElFIyQxxiS7/CMJX7jOZS+9XPDRSrMoYoVpgNGNolHyWBvMCsi+9+sOj9dh5P6A==","signatures":[{"sig":"MEUCICpCjOYoMq5ISZXA4nya8tA3qfLzA0XAGDPua5H/z5SjAiEAy56vzUSwblqSD9IbmGPSD/5zuEV1Ty5nADtD2jNMsDI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51623},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"1cbd419673b571c2e2dd97f7a930a092a8f4c0ed","private":false,"scripts":{"dev":"tsup --watch","lint":"eslint --max-warnings=0 .","build":"bun run prebuild && tsup","lint:fix":"eslint --fix .","prebuild":"bun scripts/copy-types.ts","check-types":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"rororo","email":"ro.syoyu@gmail.com"},"_npmVersion":"10.9.3","description":"Minimal Node.js client SDK for the LLM Logging System","directories":{},"_nodeVersion":"22.20.0","dependencies":{"zod":"^3.25.49","p-queue":"^8.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","eslint":"^9.39.2","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.3_1766308350455_0.26699967601768493","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@ailog/client","version":"0.1.4","keywords":["llm","logging","ai","sdk","client"],"license":"MIT","_id":"@ailog/client@0.1.4","maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"dist":{"shasum":"4cada98f5ad3aa50ffcf54eb8dab4fcd2b0afcbe","tarball":"https://registry.npmjs.org/@ailog/client/-/client-0.1.4.tgz","fileCount":4,"integrity":"sha512-t9i+T1fXx8j1L59lCpB7YUqNPsocWi+2Zx3JBrSRfM4pyg6dAXQvJguL2zyVN+cP0DsK95Jp3wfCvNivx20O7A==","signatures":[{"sig":"MEUCIHHBFY9o3Dvl6uDHWM+bRh/bJbohDmVZ9eR4WyeHkIsbAiEAiNk8YRBE424uH0lm8EEidAYuclxofmBnylwGxytxhjU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51766},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"671c2437d7cf71433faa7e2937bd637aa50b5dd0","private":false,"scripts":{"dev":"tsup --watch","lint":"eslint --max-warnings=0 .","build":"bun run prebuild && tsup","lint:fix":"eslint --fix .","prebuild":"bun scripts/copy-types.ts","check-types":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"rororo","email":"ro.syoyu@gmail.com"},"_npmVersion":"10.9.3","description":"Minimal Node.js client SDK for the LLM Logging System","directories":{},"_nodeVersion":"22.20.0","dependencies":{"zod":"^3.25.49","p-queue":"^8.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","eslint":"^9.39.2","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.4_1766322275379_0.3231270050653645","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@ailog/client","version":"0.2.0","keywords":["llm","logging","ai","sdk","client"],"license":"MIT","_id":"@ailog/client@0.2.0","maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"dist":{"shasum":"20975407aad876fbc11618464ab8bdf5b59e54ea","tarball":"https://registry.npmjs.org/@ailog/client/-/client-0.2.0.tgz","fileCount":4,"integrity":"sha512-lhLOSpVJQj3z/eLwNptDcM/oVRHgm/lCxfcb5jSr7gl0643Ov7rt25AWrqEbbgohBrhq2VVXtPNetiKIleTlrg==","signatures":[{"sig":"MEUCIQDyZnsgmTHGMoyWGT9slBcKVQwJ+sO9v6BbZMVR5L1MMAIgEWE6773dp7Lex1jVZhV9INmUOc15yyVC19z47Gz0UpU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51766},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"097b9c95fa2dc0ca9d795fac446a3f42c71c2002","private":false,"scripts":{"dev":"tsup --watch","lint":"eslint --max-warnings=0 .","build":"bun run prebuild && tsup","lint:fix":"eslint --fix .","prebuild":"bun scripts/copy-types.ts","check-types":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"rororo","email":"ro.syoyu@gmail.com"},"_npmVersion":"10.9.3","description":"Minimal Node.js client SDK for the LLM Logging System","directories":{},"_nodeVersion":"22.20.0","dependencies":{"zod":"^3.25.49","p-queue":"^8.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","eslint":"^9.39.2","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/client_0.2.0_1768982592180_0.27622936883772975","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@ailog/client","version":"0.2.2","keywords":["llm","logging","ai","sdk","client"],"license":"MIT","_id":"@ailog/client@0.2.2","maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"dist":{"shasum":"ca0954a43783454c938969e3b3280f64e7ec4740","tarball":"https://registry.npmjs.org/@ailog/client/-/client-0.2.2.tgz","fileCount":4,"integrity":"sha512-pgHZMtQMbDRSS1fPfCeXQXy2xFmYwsiE6EYUAw33XicthcECsnFcSyTJaMdJRsoBCwJvdmZzpXWjOKn+a0j8Xw==","signatures":[{"sig":"MEYCIQCEr9JQThWXYQAs0iLAxUfaaPM/dTMq6hk6HV8B4tqjIwIhAOkZbPfTtCXs1AOLE9BkWsBNTOG1XtrE6UWhNchBep+A","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52142},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"4bf5b9739296044c4068baba620f9326f137c0b8","private":false,"scripts":{"dev":"tsup --watch","lint":"eslint --max-warnings=0 .","build":"bun run prebuild && tsup","lint:fix":"eslint --fix .","prebuild":"bun scripts/copy-types.ts","check-types":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"rororo","email":"ro.syoyu@gmail.com"},"_npmVersion":"10.9.3","description":"Minimal Node.js client SDK for the LLM Logging System","directories":{},"_nodeVersion":"22.20.0","dependencies":{"zod":"^3.25.49","p-queue":"^8.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","eslint":"^9.39.2","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/client_0.2.2_1769946648935_0.05752017353109529","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@ailog/client","version":"0.2.3","description":"Minimal Node.js client SDK for the LLM Logging System","private":false,"type":"module","license":"MIT","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"keywords":["llm","logging","ai","sdk","client"],"scripts":{"prebuild":"bun scripts/copy-types.ts","build":"bun run prebuild && tsup","dev":"tsup --watch","prepublishOnly":"bun run build","lint":"eslint --max-warnings=0 .","lint:fix":"eslint --fix .","check-types":"tsc --noEmit"},"dependencies":{"p-queue":"^8.1.0","zod":"^3.25.49"},"devDependencies":{"eslint":"^9.39.2","tsup":"^8.5.1","typescript":"^5.9.2"},"_id":"@ailog/client@0.2.3","gitHead":"f7d4ffd8adcab55ceddb4f58aaa04531fd8af1e5","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-33vbcSsGK7Y7MbhnhEIAGsS06MVmq007jjg3PcRcVaz8FnkL+5W/jTildn3by2BO2cy2t//3vAQmSUtLWG+HKg==","shasum":"a3431aa49dad9c8e9078537d10d63a5e7a647e22","tarball":"https://registry.npmjs.org/@ailog/client/-/client-0.2.3.tgz","fileCount":4,"unpackedSize":52217,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBSzLtQX+VCbnGRjlcsJ9SXzFIgSqkm0VHYv3jijQ1T3AiEA7wJPB2lgU+6TrIJoLrFwhUnV0AHNr0Lpp9bQNuUJ5+U="}]},"_npmUser":{"name":"rororo","email":"ro.syoyu@gmail.com"},"directories":{},"maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/client_0.2.3_1769951693744_0.2100652502257767"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-21T05:35:38.302Z","modified":"2026-02-01T13:14:54.304Z","0.1.0":"2025-12-21T05:35:38.543Z","0.1.1":"2025-12-21T06:19:12.436Z","0.1.2":"2025-12-21T06:49:30.493Z","0.1.3":"2025-12-21T09:12:30.609Z","0.1.4":"2025-12-21T13:04:35.513Z","0.2.0":"2026-01-21T08:03:12.310Z","0.2.2":"2026-02-01T11:50:49.085Z","0.2.3":"2026-02-01T13:14:53.891Z"},"license":"MIT","keywords":["llm","logging","ai","sdk","client"],"description":"Minimal Node.js client SDK for the LLM Logging System","maintainers":[{"name":"rororo","email":"ro.syoyu@gmail.com"}],"readme":"# @ailog/client\n\nMinimal Node.js client SDK for the LLM Logging System.\n\n## Features\n\n- **Non-blocking**: Log sending doesn't block your main process\n- **Batch sending**: Multiple operations sent together for efficiency\n- **Graceful shutdown**: Ensures all logs are sent before process exit\n- **TypeScript support**: Full type definitions included\n- **Minimal dependencies**: Works in Node 18+ and Bun\n\n## Installation\n\n```bash\nnpm install @ailog/client\n# or\nyarn add @ailog/client\n# or\nbun add @ailog/client\n```\n\n## Usage\n\n```typescript\nimport { LogClient } from '@ailog/client'\n\nconst logClient = new LogClient({\n  baseUrl: 'http://localhost:9001',\n  apiKey: 'sk_your_api_key_here',\n  onError: ({ error }) => {\n    console.error('Log send failed:', error.message)\n  },\n})\n\n// Start a generation (non-blocking - returns immediately)\n// generationId and requestId are auto-generated\nconst gen = logClient.generationStart({\n  // Required\n  threadId: 'thread-456',\n  userId: 'user-789',\n  model: 'gpt-4',\n  messages: [{ role: 'user', content: 'What is the capital of France?' }],\n  // Optional\n  tenantId: 'tenant-123', // Tenant ID (auto-created if not exists)\n  requestId: 'req-001', // Request ID (defaults to generationId)\n  threadTitle: 'Chat about Paris', // Thread title (auto-upserts thread)\n  name: 'chat', // Generation name\n})\n\nconsole.log(gen.generationId) // Auto-generated ID\n\ntry {\n  const result = await streamText({\n    // ... your LLM call\n    onFinish: ({ usage, response }) => {\n      // End generation (non-blocking)\n      // latencyMs is auto-calculated\n      gen.end({\n        responseMessages: response.messages,\n        usage,\n      })\n    },\n  })\n} catch (error) {\n  // Record error (non-blocking)\n  gen.error({\n    kind: 'error',\n    message: error.message,\n    stack: error.stack,\n  })\n}\n\n// Upload a file (sent immediately)\nawait gen.uploadFile({\n  file: fileBuffer,\n  filename: 'diagram.png',\n  contentType: 'image/png',\n})\n```\n\n## Graceful Shutdown\n\nEnsure all pending logs are sent before your process exits:\n\n```typescript\nprocess.on('SIGTERM', async () => {\n  await logClient.shutdown()\n  process.exit(0)\n})\n\n// Or manually flush\nawait logClient.flush()\n```\n\n## API Reference\n\n### LogClient\n\n```typescript\nnew LogClient({\n  baseUrl: string,           // Server URL\n  apiKey: string,            // API key\n  concurrency?: number,      // Max concurrent requests (default: 5)\n  onError?: (params) => void // Error callback\n  headers?: Record<string, string> | (() => Record<string,string> | Promise<Record<string,string>>) // additional headers\n})\n```\n\n| Method                    | Returns                 | Description                                |\n| ------------------------- | ----------------------- | ------------------------------------------ |\n| `generationStart(params)` | `Generation`            | Start a new generation. Non-blocking.      |\n| `flush()`                 | `Promise<void>`         | Force send all pending logs                |\n| `shutdown()`              | `Promise<void>`         | Graceful shutdown (flush + stop accepting) |\n| `getQueueStatus()`        | `{ pending, inFlight }` | Get queue status                           |\n\n### Generation\n\n| Property       | Type     | Description              |\n| -------------- | -------- | ------------------------ |\n| `generationId` | `string` | Auto-generated unique ID |\n\n| Method               | Returns               | Description                        |\n| -------------------- | --------------------- | ---------------------------------- |\n| `end(params)`        | `void`                | Complete generation. Non-blocking. |\n| `error(params)`      | `void`                | Record an error. Non-blocking.     |\n| `uploadFile(params)` | `Promise<{ fileId }>` | Upload a file (sent immediately)   |\n","readmeFilename":"README.md"}