{"_id":"@ainative/ai-kit-svelte","_rev":"8-a0642c8f7db62b0983da4abdb9790ef3","name":"@ainative/ai-kit-svelte","dist-tags":{"alpha":"0.1.0-alpha.1","latest":"0.2.1"},"versions":{"0.1.0-alpha.0":{"name":"@ainative/ai-kit-svelte","version":"0.1.0-alpha.0","keywords":["ainative","ai","llm","typescript","ai-agents","ai-primitives","ainative-developer","claude","claude-code","openai","anthropic","svelte","sveltekit","framework","reactive","ui","components"],"author":{"name":"AINative Studio"},"license":"MIT","_id":"@ainative/ai-kit-svelte@0.1.0-alpha.0","maintainers":[{"name":"ainative-studio","email":"toby@rely.ventures"}],"homepage":"https://github.com/AINative-Studio/ai-kit#readme","bugs":{"url":"https://github.com/AINative-Studio/ai-kit/issues"},"dist":{"shasum":"1638dbe6eeab002099a52c7bbc50a6ba579fd7e3","tarball":"https://registry.npmjs.org/@ainative/ai-kit-svelte/-/ai-kit-svelte-0.1.0-alpha.0.tgz","fileCount":9,"integrity":"sha512-wu7qvifgln0MOOS/UI3K9O/Tu0wDys2ALdcE12YjStuWLzSnoQ14rNey05H3EdiNVGbpwhQu3p1+9d0xzW1SWg==","signatures":[{"sig":"MEYCIQCyrG2EtNdhwO/A81UmELSl3WiqSElBUcw75P/BMPUDrgIhANjYMV6LuXu4zQTGJQQDmRdh8zAyMDpfOhuJ0BFf6145","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26101},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"fc76d30b210657f175234126d6c0edbaa71d4140","scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest","build":"tsup","clean":"rm -rf dist","type-check":"tsc --noEmit","test:coverage":"vitest --coverage"},"_npmUser":{"name":"ainative-studio","email":"toby@rely.ventures"},"repository":{"url":"git+https://github.com/AINative-Studio/ai-kit.git","type":"git","directory":"packages/svelte"},"_npmVersion":"10.9.4","description":"AI Kit - Svelte stores and actions for building AI-powered applications","directories":{},"_nodeVersion":"22.21.0","dependencies":{"@ainative/ai-kit-core":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","jsdom":"^23.0.1","svelte":"^4.2.8","vitest":"^1.6.0","typescript":"^5.3.0","@types/node":"^20.10.0","@vitest/coverage-v8":"^1.6.0","@testing-library/svelte":"^4.0.5"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-kit-svelte_0.1.0-alpha.0_1763692569174_0.5768057501913528","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-alpha.1":{"name":"@ainative/ai-kit-svelte","version":"0.1.0-alpha.1","keywords":["ainative","ai","llm","typescript","ai-agents","ai-primitives","ainative-developer","claude","claude-code","openai","anthropic","svelte","sveltekit","framework","reactive","ui","components"],"author":{"name":"AINative Studio"},"license":"MIT","_id":"@ainative/ai-kit-svelte@0.1.0-alpha.1","maintainers":[{"name":"ainative-studio","email":"toby@rely.ventures"}],"homepage":"https://github.com/AINative-Studio/ai-kit#readme","bugs":{"url":"https://github.com/AINative-Studio/ai-kit/issues"},"dist":{"shasum":"597317df2b67a4ed502af095394ea2cc183d49bb","tarball":"https://registry.npmjs.org/@ainative/ai-kit-svelte/-/ai-kit-svelte-0.1.0-alpha.1.tgz","fileCount":9,"integrity":"sha512-VbnGKbBFsxYlltzuTrbBPaE40gPCh95MtI2Aj7VQFiH5oZjXmQFH2VH/Tg1VPtmg8j1QZDsS1WmUNWDfJ9imfg==","signatures":[{"sig":"MEUCIQCck9MRsXZmMuwZilL/uWWWuFjJzo5Fngu/Yz8MY+Dd/wIgYQ7XGg7Le2Zq1HpltTmVP1bSQCdOTP5AsqS0NJl5xGc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26101},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"fc76d30b210657f175234126d6c0edbaa71d4140","scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest","build":"tsup","clean":"rm -rf dist","type-check":"tsc --noEmit","test:coverage":"vitest --coverage"},"_npmUser":{"name":"ainative-studio","email":"toby@rely.ventures"},"repository":{"url":"git+https://github.com/AINative-Studio/ai-kit.git","type":"git","directory":"packages/svelte"},"_npmVersion":"10.9.4","description":"AI Kit - Svelte stores and actions for building AI-powered applications","directories":{},"_nodeVersion":"22.21.0","dependencies":{"@ainative/ai-kit-core":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^8.0.1","jsdom":"^23.0.1","svelte":"^4.2.8","vitest":"^1.6.0","typescript":"^5.3.0","@types/node":"^20.10.0","@vitest/coverage-v8":"^1.6.0","@testing-library/svelte":"^4.0.5"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-kit-svelte_0.1.0-alpha.1_1763693097496_0.4691747076906896","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-alpha.2":{"name":"@ainative/ai-kit-svelte","version":"0.1.0-alpha.2","keywords":["ainative","ai","llm","typescript","ai-agents","ai-primitives","ainative-developer","claude","claude-code","openai","anthropic","svelte","sveltekit","framework","reactive","ui","components"],"author":{"name":"AINative Studio"},"license":"MIT","_id":"@ainative/ai-kit-svelte@0.1.0-alpha.2","maintainers":[{"name":"ainative-studio","email":"toby@rely.ventures"}],"homepage":"https://github.com/AINative-Studio/ai-kit#readme","bugs":{"url":"https://github.com/AINative-Studio/ai-kit/issues"},"dist":{"shasum":"f1decfa4f5ea0210d1cd6e2b2f20bf91a7ae4c6f","tarball":"https://registry.npmjs.org/@ainative/ai-kit-svelte/-/ai-kit-svelte-0.1.0-alpha.2.tgz","fileCount":9,"integrity":"sha512-jn+Ff53SD4OCOjzCPpBNL5wycSFmFjIaHLZF/ynqOXZ03OMOh59PVQsOFqYH3EE/YG40UWKE4z2vN5Jaba/4eA==","signatures":[{"sig":"MEQCIHwRsS2qC4Vp8ci4FesTG4xPrMW1im2Rk4dnxoGTKjg2AiBC6AZdOEeEXfVTZ2FzjWPUm7dYjWEB6GKVcsMxb59l1w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26096},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"dc8dc4a4951e8951a407b2c28d26fcda12bf373d","scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest","build":"tsup","clean":"rm -rf dist","type-check":"tsc --noEmit","test:coverage":"vitest --coverage"},"_npmUser":{"name":"ainative-studio","email":"toby@rely.ventures"},"repository":{"url":"git+https://github.com/AINative-Studio/ai-kit.git","type":"git","directory":"packages/svelte"},"_npmVersion":"10.9.4","description":"AI Kit - Svelte stores and actions for building AI-powered applications","directories":{},"_nodeVersion":"22.21.0","dependencies":{"@ainative/ai-kit-core":"^0.1.2"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","jsdom":"^23.0.1","svelte":"^4.2.8","vitest":"^1.6.0","typescript":"^5.3.0","@types/node":"^20.10.0","@vitest/coverage-v8":"^1.6.0","@testing-library/svelte":"^4.0.5"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-kit-svelte_0.1.0-alpha.2_1763767337362_0.5632064625653981","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-alpha.3":{"name":"@ainative/ai-kit-svelte","version":"0.1.0-alpha.3","keywords":["ainative","ai","llm","typescript","ai-agents","ai-primitives","ainative-developer","claude","claude-code","openai","anthropic","svelte","sveltekit","framework","reactive","ui","components"],"author":{"name":"AINative Studio"},"license":"MIT","_id":"@ainative/ai-kit-svelte@0.1.0-alpha.3","maintainers":[{"name":"ainative-studio","email":"toby@rely.ventures"}],"homepage":"https://github.com/AINative-Studio/ai-kit#readme","bugs":{"url":"https://github.com/AINative-Studio/ai-kit/issues"},"dist":{"shasum":"14deed681ed6f0f3e5bf63672daf2ce1bb3be0be","tarball":"https://registry.npmjs.org/@ainative/ai-kit-svelte/-/ai-kit-svelte-0.1.0-alpha.3.tgz","fileCount":9,"integrity":"sha512-3ZHNIK3n6tc5RmkhZ0FclGAVs+qfVRt1yuhhX67lpNHe43pMbDJB2quxtHfnJ9TbO2AXMbkoZfxauYfqqTyCEg==","signatures":[{"sig":"MEYCIQDl8eNoMsOcQsCA1wV2lRfYhnH0HxDz395+XKYSMkiUFgIhAJ2If10FBHEicHG8iBIn+0fCedhre8Pl5o0fG1aVCrWv","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2133599},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"dc8dc4a4951e8951a407b2c28d26fcda12bf373d","scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest","build":"tsup","clean":"rm -rf dist","type-check":"tsc --noEmit","test:coverage":"vitest --coverage"},"_npmUser":{"name":"ainative-studio","email":"toby@rely.ventures"},"repository":{"url":"git+https://github.com/AINative-Studio/ai-kit.git","type":"git","directory":"packages/svelte"},"_npmVersion":"10.9.4","description":"AI Kit - Svelte stores and actions for building AI-powered applications","directories":{},"_nodeVersion":"22.21.0","dependencies":{"@ainative-studio/aikit-core":"^0.1.3"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","jsdom":"^23.0.1","svelte":"^4.2.8","vitest":"^1.6.0","typescript":"^5.3.0","@types/node":"^20.10.0","@vitest/coverage-v8":"^1.6.0","@testing-library/svelte":"^4.0.5"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-kit-svelte_0.1.0-alpha.3_1763779286357_0.6739781356257641","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-alpha.4":{"name":"@ainative/ai-kit-svelte","version":"0.1.0-alpha.4","keywords":["ainative","ai","llm","typescript","ai-agents","ai-primitives","ainative-developer","claude","claude-code","openai","anthropic","svelte","sveltekit","framework","reactive","ui","components"],"author":{"name":"AINative Studio"},"license":"MIT","_id":"@ainative/ai-kit-svelte@0.1.0-alpha.4","maintainers":[{"name":"ainative-studio","email":"toby@rely.ventures"}],"homepage":"https://ainative.studio/ai-kit","bugs":{"url":"https://github.com/AINative-Studio/ai-kit/issues"},"dist":{"shasum":"623b91f0edd62dc6a56c55da21fa98fed5ccb6f1","tarball":"https://registry.npmjs.org/@ainative/ai-kit-svelte/-/ai-kit-svelte-0.1.0-alpha.4.tgz","fileCount":9,"integrity":"sha512-A9tuDKfGgqtatAUtgfAqCLWMIx04n/uu8ycaiux1g9XueHph4iG7dhmd6iWWF2k9+rjI/4e5U5Gm4pwePEcq2Q==","signatures":[{"sig":"MEYCIQDzUnTsNMwnLxNFA0SYCxfL/PNeNoTyIrrbFpHHS1XU7AIhANjCvOBLO6lXiwfS0JNqqbkbfa+MZLq7hAiWRhxyFjLt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26091},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"d6b72c3dc5155c1f9ed5cf03652ec41ab173eeda","scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup","clean":"rm -rf dist","type-check":"tsc --noEmit","test:coverage":"vitest --coverage"},"_npmUser":{"name":"ainative-studio","email":"toby@rely.ventures"},"repository":{"url":"git+https://github.com/AINative-Studio/ai-kit.git","type":"git","directory":"packages/svelte"},"_npmVersion":"10.9.4","description":"AI Kit - Svelte stores and actions for building AI-powered applications","directories":{},"_nodeVersion":"22.21.0","dependencies":{"@ainative/ai-kit-core":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","jsdom":"^23.0.1","svelte":"^4.2.8","vitest":"^1.6.0","typescript":"^5.3.0","@types/node":"^20.10.0","@vitest/coverage-v8":"^1.6.0","@testing-library/svelte":"^4.0.5"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-kit-svelte_0.1.0-alpha.4_1765567546866_0.5716264228974122","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@ainative/ai-kit-svelte","version":"0.2.0","keywords":["ainative","ai","llm","typescript","ai-agents","ai-primitives","ainative-developer","claude","claude-code","openai","anthropic","svelte","sveltekit","framework","reactive","ui","components"],"author":{"name":"AINative Studio"},"license":"MIT","_id":"@ainative/ai-kit-svelte@0.2.0","maintainers":[{"name":"ainative-studio","email":"toby@rely.ventures"}],"homepage":"https://ainative.studio/ai-kit","bugs":{"url":"https://github.com/AINative-Studio/ai-kit/issues"},"dist":{"shasum":"274496244be91d1fbc120f8ffc156a17625dd621","tarball":"https://registry.npmjs.org/@ainative/ai-kit-svelte/-/ai-kit-svelte-0.2.0.tgz","fileCount":9,"integrity":"sha512-JDVQN/RRC036/EziTMpyiHrAyYPN5tXu/S0DFNKDOOueVWmJs8sRUYb3DP0em0UD9sgVgq7fPT2RRIODT3OyYQ==","signatures":[{"sig":"MEUCIQCK1E6n12HnywII8ievhvzE6yJdpuWE9s53QeJIz83UzgIgc5inJRx7rleTzCK40As+JCRRBE+FBfRtYBwR9kQnk2E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25111},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"20c46435e47c7b04321440147c853677f79c7982","scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup","clean":"rm -rf dist","type-check":"tsc --noEmit","test:coverage":"vitest --coverage"},"_npmUser":{"name":"ainative-studio","email":"toby@rely.ventures"},"repository":{"url":"git+https://github.com/AINative-Studio/ai-kit.git","type":"git","directory":"packages/svelte"},"_npmVersion":"10.9.4","description":"AI Kit - Svelte stores and actions for building AI-powered applications","directories":{},"_nodeVersion":"22.21.0","dependencies":{"@ainative/ai-kit-core":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","jsdom":"^23.0.1","svelte":"^4.2.8","vitest":"^4.0.18","typescript":"^5.3.0","@types/node":"^20.10.0","@vitest/coverage-v8":"^4.0.18","@testing-library/svelte":"^4.0.5"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-kit-svelte_0.2.0_1770580041988_0.6709110096567934","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"_id":"@ainative/ai-kit-svelte@0.2.1","bugs":{"url":"https://github.com/AINative-Studio/ai-kit/issues"},"dist":{"shasum":"5a7b10a089b34aafb765700277e2cd8fa24f8978","tarball":"https://registry.npmjs.org/@ainative/ai-kit-svelte/-/ai-kit-svelte-0.2.1.tgz","fileCount":9,"integrity":"sha512-+nFIrl1uANrbEbcb7p3vV94tRXzyNqQXuUhJNcbD0io84i9UswbCyeziLHqeS20Ww5/hWN86rALgt6WuW/YwJQ==","signatures":[{"sig":"MEUCIQC1yIB/dCo4GS4lc7eJAcP3WNRbDHH2AxPdY3VivkSxVAIgHH4hTG8qtXgS23bDMWmkTB5CrEfZ1zz5QNA5uEIku0E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD46HXQ1cHto1ZUegbMgACvH51xWgxZpXXCMpLzMU2/GQIgbaEcu02IEsoH5xr3ExlnrBqcJZKzRe7bWChqZ5AxZZI="}],"unpackedSize":25179},"main":"./dist/index.js","name":"@ainative/ai-kit-svelte","types":"./dist/index.d.ts","author":{"name":"AINative Studio"},"module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"669962f093747eaa3f6013c614fdba2f0e5be431","license":"MIT","scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup","clean":"rm -rf dist","type-check":"tsc --noEmit","test:coverage":"vitest --coverage","prepublishOnly":"tsx ../../scripts/check-no-workspace-protocol.ts"},"version":"0.2.1","_npmUser":{"name":"ainative-studio","email":"toby@rely.ventures"},"homepage":"https://ainative.studio/ai-kit","keywords":["ainative","ai","llm","typescript","ai-agents","ai-primitives","ainative-developer","claude","claude-code","openai","anthropic","svelte","sveltekit","framework","reactive","ui","components"],"repository":{"url":"git+https://github.com/AINative-Studio/ai-kit.git","type":"git","directory":"packages/svelte"},"_npmVersion":"10.9.4","description":"AI Kit - Svelte stores and actions for building AI-powered applications","directories":{},"maintainers":[{"name":"ainative-studio","email":"toby@rely.ventures"}],"_nodeVersion":"22.21.0","dependencies":{"@ainative/ai-kit-core":"0.2.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","jsdom":"^23.0.1","svelte":"^4.2.8","vitest":"^4.0.18","typescript":"^5.3.0","@types/node":"^20.10.0","@vitest/coverage-v8":"^4.0.18","@testing-library/svelte":"^4.0.5"},"peerDependencies":{"svelte":"^4.0.0 || ^5.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-kit-svelte_0.2.1_1789350242926_0.23177489966812304"}}},"time":{"created":"2025-11-21T02:36:09.093Z","modified":"2026-09-14T01:44:03.157Z","0.1.0-alpha.0":"2025-11-21T02:36:09.381Z","0.1.0-alpha.1":"2025-11-21T02:44:57.678Z","0.1.0-alpha.2":"2025-11-21T23:22:17.576Z","0.1.0-alpha.3":"2025-11-22T02:41:26.574Z","0.1.0-alpha.4":"2025-12-12T19:25:47.001Z","0.2.0":"2026-02-08T19:47:22.138Z","0.2.1":"2026-09-14T01:44:03.010Z"},"bugs":{"url":"https://github.com/AINative-Studio/ai-kit/issues"},"author":{"name":"AINative Studio"},"license":"MIT","homepage":"https://ainative.studio/ai-kit","keywords":["ainative","ai","llm","typescript","ai-agents","ai-primitives","ainative-developer","claude","claude-code","openai","anthropic","svelte","sveltekit","framework","reactive","ui","components"],"repository":{"url":"git+https://github.com/AINative-Studio/ai-kit.git","type":"git","directory":"packages/svelte"},"description":"AI Kit - Svelte stores and actions for building AI-powered applications","maintainers":[{"name":"ainative-studio","email":"toby@rely.ventures"}],"readme":"# @ainative/ai-kit-svelte\n\nSvelte adapter for AI Kit with reactive stores for AI streaming.\n\n## Installation\n\n```bash\npnpm add @ainative/ai-kit-svelte\n```\n\n## Usage\n\n### Basic Example\n\n```svelte\n<script lang=\"ts\">\n  import { createAIStream } from '@ainative/ai-kit-svelte'\n\n  const aiStream = createAIStream({\n    endpoint: '/api/chat',\n    model: 'gpt-4',\n    systemPrompt: 'You are a helpful assistant.'\n  })\n\n  // Subscribe to reactive stores\n  $: messages = $aiStream.messages\n  $: isStreaming = $aiStream.isStreaming\n  $: error = $aiStream.error\n\n  let userInput = ''\n\n  async function handleSend() {\n    if (!userInput.trim()) return\n    await aiStream.send(userInput)\n    userInput = ''\n  }\n\n  // Clean up when component is destroyed\n  import { onDestroy } from 'svelte'\n  onDestroy(() => {\n    aiStream.destroy()\n  })\n</script>\n\n<div class=\"chat-container\">\n  {#each $messages as message (message.id)}\n    <div class=\"message {message.role}\">\n      <strong>{message.role}:</strong>\n      <p>{message.content}</p>\n    </div>\n  {/each}\n</div>\n\n<form on:submit|preventDefault={handleSend}>\n  <input\n    type=\"text\"\n    bind:value={userInput}\n    disabled={$isStreaming}\n    placeholder=\"Type your message...\"\n  />\n  <button type=\"submit\" disabled={$isStreaming}>\n    {$isStreaming ? 'Sending...' : 'Send'}\n  </button>\n</form>\n\n{#if $error}\n  <div class=\"error\">Error: {$error.message}</div>\n{/if}\n```\n\n### Advanced Example with Callbacks\n\n```svelte\n<script lang=\"ts\">\n  import { createAIStream } from '@ainative/ai-kit-svelte'\n\n  const aiStream = createAIStream({\n    endpoint: '/api/chat',\n    model: 'gpt-4',\n    onToken: (token) => {\n      console.log('Received token:', token)\n    },\n    onCost: (usage) => {\n      console.log('Token usage:', usage)\n    },\n    onError: (error) => {\n      console.error('Stream error:', error)\n    },\n    retry: {\n      maxRetries: 3,\n      backoff: 'exponential',\n      initialDelay: 1000,\n      maxDelay: 10000\n    }\n  })\n\n  // Usage statistics\n  $: usage = $aiStream.usage\n  $: console.log('Total tokens:', $usage.totalTokens)\n\n  function handleRetry() {\n    aiStream.retry()\n  }\n\n  function handleReset() {\n    aiStream.reset()\n  }\n\n  function handleStop() {\n    aiStream.stop()\n  }\n</script>\n\n<!-- UI implementation -->\n```\n\n## API Reference\n\n### `createAIStream(config: StreamConfig): AIStreamStore`\n\nCreates a new AI streaming store.\n\n#### Parameters\n\n- `config.endpoint` (string, required): The API endpoint for streaming\n- `config.model` (string, optional): The AI model to use\n- `config.systemPrompt` (string, optional): System prompt for the AI\n- `config.onToken` (function, optional): Callback fired for each token\n- `config.onCost` (function, optional): Callback fired when usage stats update\n- `config.onError` (function, optional): Callback fired on errors\n- `config.retry` (object, optional): Retry configuration\n  - `maxRetries` (number): Maximum number of retries\n  - `backoff` ('linear' | 'exponential'): Backoff strategy\n  - `initialDelay` (number): Initial retry delay in ms\n  - `maxDelay` (number): Maximum retry delay in ms\n- `config.headers` (object, optional): Additional HTTP headers\n\n#### Returns\n\nAn `AIStreamStore` object with the following properties:\n\n##### Stores (Readable)\n\n- `messages`: Readable store containing the message history\n- `isStreaming`: Readable store indicating if currently streaming\n- `error`: Readable store containing any errors\n- `usage`: Readable store with token usage statistics\n\n##### Methods\n\n- `send(content: string): Promise<void>`: Send a user message\n- `reset(): void`: Clear all messages and reset state\n- `retry(): Promise<void>`: Retry the last message\n- `stop(): void`: Stop the current stream\n- `destroy(): void`: Clean up resources and event listeners\n\n### Types\n\n```typescript\ninterface Message {\n  id: string\n  role: 'user' | 'assistant' | 'system'\n  content: string\n  timestamp: number\n}\n\ninterface Usage {\n  promptTokens: number\n  completionTokens: number\n  totalTokens: number\n  estimatedCost?: number\n  latency?: number\n  model?: string\n  cacheHit?: boolean\n}\n```\n\n## Features\n\n- ✅ Reactive Svelte stores for all state\n- ✅ Automatic message history management\n- ✅ Server-sent events (SSE) streaming\n- ✅ Automatic retry with exponential backoff\n- ✅ Token usage tracking\n- ✅ Error handling\n- ✅ TypeScript support\n- ✅ Framework-agnostic core\n\n## Testing\n\n```bash\n# Run tests\npnpm test\n\n# Run tests with coverage\npnpm test:coverage\n\n# Type check\npnpm type-check\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}