{"_id":"@aulinq/assistant-widget","_rev":"3-dd8ceaedd872a3e22486940c5e55120f","name":"@aulinq/assistant-widget","dist-tags":{"latest":"1.0.25"},"versions":{"1.0.23":{"name":"@aulinq/assistant-widget","version":"1.0.23","keywords":["chat","widget","headless","websocket","react"],"author":{"name":"Aulinq"},"license":"MIT","_id":"@aulinq/assistant-widget@1.0.23","maintainers":[{"name":"amadmike","email":"xbiznet@gmail.com"}],"homepage":"https://github.com/aulinq/assistant-widget#readme","bugs":{"url":"https://github.com/aulinq/assistant-widget/issues"},"dist":{"shasum":"35c2e787dc2f3c8721723451caf4957fc59f9912","tarball":"https://registry.npmjs.org/@aulinq/assistant-widget/-/assistant-widget-1.0.23.tgz","fileCount":41,"integrity":"sha512-VvdD7sH0r7ABNGu0tzGQs9CqDjC6fSLlXKEkhvTnSa/WcS/3cmM2qCwq1rYsUIqJ/7v8q/vPC6NTjXZsechmxw==","signatures":[{"sig":"MEUCIGYCEhA9PXAKvC+KWgfDUNDCzkCqa6dJ0gJLBQuIleunAiEAi4ufs1Tb07kS03wV/KKolI9Aw0tdy/v5qDw8BA2nEuw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":460995},"main":"./dist/index.js","type":"module","style":"./dist/styles.css","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react/index.d.ts","import":"./dist/react/index.js","default":"./dist/react/index.js"},"./generator":{"types":"./dist/generator.d.ts","import":"./dist/generator.js","default":"./dist/generator.js"},"./styles.css":{"style":"./dist/styles.css","import":"./dist/styles.css","default":"./dist/styles.css","require":"./dist/styles.css"}},"gitHead":"9e1437150b8430edd73863af476ec1635146cf3d","scripts":{"dev":"vite build --watch","lint":"eslint .","test":"vitest run","build":"vite build && tsc --emitDeclarationOnly","preview":"vite preview","release":"npm publish --access public","dev:demo":"vite","build:lib":"vite build","type-check":"tsc --noEmit","build:types":"tsc --emitDeclarationOnly","prepublishOnly":"npm run type-check && npm run lint && npm run build"},"_npmUser":{"name":"amadmike","email":"xbiznet@gmail.com"},"repository":{"url":"git+https://github.com/aulinq/assistant-widget.git","type":"git"},"_npmVersion":"11.14.1","description":"Headless chat widget library with vanilla JS core and React components","directories":{},"_nodeVersion":"24.8.0","dependencies":{"marked":"^17.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.0","jsdom":"^29.1.1","react":"^19.2.3","eslint":"^9.39.2","vitest":"^3.2.4","globals":"^16.5.0","react-dom":"^19.2.3","typescript":"^5.9.3","@types/node":"^25.0.3","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","@tailwindcss/postcss":"^4.1.18","@vitejs/plugin-react":"^5.1.2","@typescript-eslint/parser":"^8.51.0","@typescript-eslint/eslint-plugin":"^8.51.0"},"peerDependencies":{"react":">=19.0.0","react-dom":">=19.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/assistant-widget_1.0.23_1783559041679_0.8263118505367246","host":"s3://npm-registry-packages-npm-production"}},"1.0.24":{"name":"@aulinq/assistant-widget","version":"1.0.24","keywords":["chat","widget","headless","websocket","react"],"author":{"name":"Aulinq"},"license":"MIT","_id":"@aulinq/assistant-widget@1.0.24","maintainers":[{"name":"amadmike","email":"xbiznet@gmail.com"}],"homepage":"https://github.com/aulinq/assistant-widget#readme","bugs":{"url":"https://github.com/aulinq/assistant-widget/issues"},"dist":{"shasum":"82a0f3be7d299bf075b54cc786b89e42882eb596","tarball":"https://registry.npmjs.org/@aulinq/assistant-widget/-/assistant-widget-1.0.24.tgz","fileCount":41,"integrity":"sha512-VdggV3QXYOPSClO34QE4KzX0wJ5Dt1hYBXrX4X/7dmZeZyK3EkEdyMc6iHNGJs5tH36px3Pox/Ti+v9epYm/tw==","signatures":[{"sig":"MEUCIQC6BPjRq0ZIkSEOOTMVXdkTp4vVD74kfSaGajIguETExAIgOydo3MMPcRKR9JcOLMBTLuqkUS2JxUj9QD8wCY0lBIU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":460995},"main":"./dist/index.js","type":"module","style":"./dist/styles.css","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react/index.d.ts","import":"./dist/react/index.js","default":"./dist/react/index.js"},"./generator":{"types":"./dist/generator.d.ts","import":"./dist/generator.js","default":"./dist/generator.js"},"./styles.css":{"style":"./dist/styles.css","import":"./dist/styles.css","default":"./dist/styles.css","require":"./dist/styles.css"}},"gitHead":"9e1437150b8430edd73863af476ec1635146cf3d","scripts":{"dev":"vite build --watch","lint":"eslint .","test":"vitest run","build":"vite build && tsc --emitDeclarationOnly","preview":"vite preview","release":"npm publish --access public","dev:demo":"vite","build:lib":"vite build","type-check":"tsc --noEmit","build:types":"tsc --emitDeclarationOnly","prepublishOnly":"npm run type-check && npm run lint && npm run build"},"_npmUser":{"name":"amadmike","email":"xbiznet@gmail.com"},"repository":{"url":"git+https://github.com/aulinq/assistant-widget.git","type":"git"},"_npmVersion":"11.14.1","description":"Headless chat widget library with vanilla JS core and React components","directories":{},"_nodeVersion":"24.8.0","dependencies":{"marked":"^17.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.0","jsdom":"^29.1.1","react":"^19.2.3","eslint":"^9.39.2","vitest":"^3.2.4","globals":"^16.5.0","react-dom":"^19.2.3","typescript":"^5.9.3","@types/node":"^25.0.3","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","@tailwindcss/postcss":"^4.1.18","@vitejs/plugin-react":"^5.1.2","@typescript-eslint/parser":"^8.51.0","@typescript-eslint/eslint-plugin":"^8.51.0"},"peerDependencies":{"react":">=19.0.0","react-dom":">=19.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/assistant-widget_1.0.24_1783559108378_0.37905330342135346","host":"s3://npm-registry-packages-npm-production"}},"1.0.25":{"name":"@aulinq/assistant-widget","version":"1.0.25","description":"Headless chat widget library with vanilla JS core and React components","keywords":["chat","widget","headless","websocket","react"],"homepage":"https://github.com/aulinq/assistant-widget#readme","bugs":{"url":"https://github.com/aulinq/assistant-widget/issues"},"repository":{"type":"git","url":"git+https://github.com/aulinq/assistant-widget.git"},"license":"MIT","author":{"name":"Aulinq"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react/index.d.ts","import":"./dist/react/index.js","default":"./dist/react/index.js"},"./generator":{"types":"./dist/generator.d.ts","import":"./dist/generator.js","default":"./dist/generator.js"},"./styles.css":{"style":"./dist/styles.css","import":"./dist/styles.css","require":"./dist/styles.css","default":"./dist/styles.css"}},"main":"./dist/index.js","types":"./dist/index.d.ts","style":"./dist/styles.css","scripts":{"dev":"vite build --watch","build":"vite build && tsc --emitDeclarationOnly","build:lib":"vite build","build:types":"tsc --emitDeclarationOnly","type-check":"tsc --noEmit","lint":"eslint .","preview":"vite preview","dev:demo":"vite","test":"vitest run","prepublishOnly":"npm run type-check && npm run lint && npm run build","release":"npm publish --access public"},"dependencies":{"marked":"^17.0.1"},"devDependencies":{"@tailwindcss/postcss":"^4.1.18","@types/node":"^25.0.3","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","@typescript-eslint/eslint-plugin":"^8.51.0","@typescript-eslint/parser":"^8.51.0","@vitejs/plugin-react":"^5.1.2","eslint":"^9.39.2","globals":"^16.5.0","jsdom":"^29.1.1","react":"^19.2.3","react-dom":"^19.2.3","typescript":"^5.9.3","vite":"^7.3.0","vitest":"^3.2.4"},"peerDependencies":{"react":">=19.0.0","react-dom":">=19.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"publishConfig":{"access":"public"},"module":"./dist/index.js","gitHead":"9e1437150b8430edd73863af476ec1635146cf3d","_id":"@aulinq/assistant-widget@1.0.25","_nodeVersion":"24.8.0","_npmVersion":"11.14.1","dist":{"integrity":"sha512-RdtmhEjb1N3UOpah3nHlDBDI7BvrwxHD5jYBGHVoZ0qTzVE6PF/Gg/391H0m4iip4E57RuqO4IK+s4G7AYXrVg==","shasum":"7b13fd9640c519ac3ac56c628317f309a0e1313a","tarball":"https://registry.npmjs.org/@aulinq/assistant-widget/-/assistant-widget-1.0.25.tgz","fileCount":41,"unpackedSize":460995,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE6Sr3IlZpwKIPONoRPsm8E1co02zd/OrYvnBBmaXr+gAiAEMZqnbeFwy1AR+aWv5sCThQNUyk2ViM0onxKSnNOBaw=="}]},"_npmUser":{"name":"amadmike","email":"xbiznet@gmail.com"},"directories":{},"maintainers":[{"name":"amadmike","email":"xbiznet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/assistant-widget_1.0.25_1783559184233_0.7210318104822959"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-09T01:04:01.516Z","modified":"2026-07-09T01:06:24.498Z","1.0.23":"2026-07-09T01:04:01.864Z","1.0.24":"2026-07-09T01:05:08.546Z","1.0.25":"2026-07-09T01:06:24.392Z"},"bugs":{"url":"https://github.com/aulinq/assistant-widget/issues"},"author":{"name":"Aulinq"},"license":"MIT","homepage":"https://github.com/aulinq/assistant-widget#readme","keywords":["chat","widget","headless","websocket","react"],"repository":{"type":"git","url":"git+https://github.com/aulinq/assistant-widget.git"},"description":"Headless chat widget library with vanilla JS core and React components","maintainers":[{"name":"amadmike","email":"xbiznet@gmail.com"}],"readme":"# Chat Widget\n\nA production-ready, headless chat widget library built with vanilla TypeScript core and React components.\n\n## Features\n\n- 🎯 **Headless Architecture** - Fully customizable, framework-agnostic core\n- 🔌 **WebSocket Real-time** - Bi-directional streaming communication\n- ⚛️ **React Components** - Ready-to-use React wrapper components\n- 🎨 **Themed UI** - Beautiful default theme included\n- 📝 **Markdown Support** - Rich text rendering with marked.js\n- 🔄 **Auto-reconnect** - Smart reconnection handling\n- 📦 **TypeScript** - Full type safety\n- 🎯 **Modern Stack** - React 19, Tailwind CSS v4, Vite\n\n## Installation\n\n```bash\nnpm install @aulinq/assistant-widget\n# or\nbun add @aulinq/assistant-widget\n```\n\n## Quick Start\n\n### React Component\n\n```tsx\nimport { ChatWidget } from '@aulinq/assistant-widget/react';\n\nfunction App() {\n  return (\n    <ChatWidget\n      identityUrl=\"http://localhost:8100\"\n      runtimeUrl=\"http://localhost:8890/v1/chat/stream\"\n      siteToken=\"your-site-token\"\n      title=\"IO Assistant\"\n      placeholder=\"Type a message...\"\n      theme=\"default\"\n      debug={true}\n      onClose={() => console.log('Widget closed')}\n    />\n  );\n}\n```\n\n\n### Vanilla JavaScript\n\n```ts\nimport { ChatService } from '@aulinq/assistant-widget';\n\nconst chat = new ChatService(\n  {\n    identityUrl: 'http://localhost:8100',\n    runtimeUrl: 'http://localhost:8890/v1/chat/stream',\n    siteToken: 'your-site-token',\n    debug: true,\n  },\n  (event) => {\n    console.log('Chat event:', event);\n  }\n);\n\n// Connect\nawait chat.connect();\n\n// Send message\nawait chat.sendMessage('Hello, AI!');\n\n// Disconnect\nchat.disconnect();\n```\n\n## API Reference\n\n### ChatWidget Props\n\n| Prop | Type | Default | Description |\n|------|------|---------|-------------|\n| `config` | `ChatConfig` | required | WebSocket configuration |\n| `autoConnect` | `boolean` | `true` | Auto-connect on mount |\n| `title` | `string` | `'Chat'` | Widget title |\n| `placeholder` | `string` | `'Type a message...'` | Input placeholder |\n| `theme` | `string` | `'default'` | UI theme |\n| `className` | `string` | `''` | Additional CSS classes |\n| `onClose` | `() => void` | - | Close handler |\n\n### ChatConfig\n\n```ts\ninterface ChatConfig {\n  siteToken: string;              // Website token from dashboard\n  identityUrl?: string;           // identity-service base URL\n  runtimeUrl?: string;            // agent-runtime stream or ws URL\n  transport?: 'sse' | 'ws';       // default: 'sse'\n  serverUrl?: string;             // deprecated runtime fallback\n  sessionId?: string;             // Optional session ID\n  reconnect?: boolean;            // Enable auto-reconnect (default: true)\n  reconnectInterval?: number;     // Reconnect delay in ms (default: 3000)\n  maxReconnectAttempts?: number;  // Max reconnect attempts (default: 5)\n  debug?: boolean;                // Enable debug logs (default: false)\n}\n```\n\n\n### Message Interface\n\n```ts\ninterface Message {\n  id: string;\n  role: 'user' | 'assistant' | 'system';\n  content: string;\n  timestamp: number;\n  type?: 'text' | 'audio' | 'control' | 'break' | 'error' | 'status';\n  metadata?: Record<string, unknown>;\n}\n```\n\n## Theming\n\nThe widget includes a beautiful default theme. It features:\n\n- Brown gradient background (`#7d5c59` to `#6d5654`)\n- Glass-morphism effects\n- Smooth animations\n- Responsive design\n- Dark theme optimized\n\n### Custom Theme\n\nYou can create your own theme by extending the CSS:\n\n```css\n@theme {\n  --color-primary: #your-color;\n  --radius-widget: 1rem;\n  /* ... other variables */\n}\n\n.theme-custom {\n  .chat-header {\n    background: linear-gradient(135deg, #your-colors);\n  }\n  /* ... other styles */\n}\n```\n\n## WebSocket Protocol\n\nThe widget authenticates with `POST /v1/chat/handshake`, then sends each text message to agent-runtime. The default transport is SSE via `POST /v1/chat/stream`; WebSocket is available with `transport: 'ws'` and uses `/v1/chat/ws`.\n\n### Runtime events\n- `delta`: Partial assistant text.\n- `thought`, `tool_call`, `tool_res`, `typing`: Status updates.\n- `done`: End of response.\n- `error`: Error message.\n\nRealtime voice is handled by the separate `voice-widget` package.\n\n## Development\n\n```bash\n# Install dependencies\nbun install\n\n# Build library\nbun run build\n\n# Watch mode\nbun run dev\n\n# Type check\nbun run type-check\n\n# Run demo\nbun run dev:demo\n```\n\n## Demo Pages\n\nThe widget includes three demo pages to help you get started:\n\n1. **React Demo** (`/`) - Full-featured React demo with component examples\n   - Shows React wrapper usage with `ChatWidget` component\n   - Interactive controls and live widget\n   - Access: Run `bun run dev:demo` and visit `http://localhost:5173`\n\n2. **Vanilla JS Demo** (`/demo/vanilla.html`) - Pure vanilla JavaScript implementation\n   - Shows core `ChatWidget` class usage\n   - Headless `ChatService` examples\n   - Interactive initialization and controls\n   - Access: `http://localhost:5173/demo/vanilla.html`\n\n3. **CDN Embed Example** (`/demo/embed.html`) - Simplest integration method\n   - Shows CDN/script tag usage with `embed.js`\n   - Interactive script generator with compression\n   - Copy-paste ready code\n   - Access: `http://localhost:5173/demo/embed.html`\n\n## Project Structure\n\n```\nassistant-widget/\n├── src/\n│   ├── core/              # Headless Core (Vanilla TS)\n│   │   ├── services/      # Business logic & API\n│   │   ├── store/         # State management\n│   │   ├── types/         # Type definitions\n│   │   ├── ui/            # UI Controller logic\n│   │   └── utils/         # Helpers & Audio logic\n│   ├── react/             # React Wrapper\n│   │   └── components/    # React-specific components\n│   ├── themes/            # UI Themes & Templates\n│   │   └── default/       # Default Theme\n│   ├── generator.ts       # Dashboard script generator\n│   ├── embed.ts           # CDN/Embed entry point\n│   └── index.ts           # Main library entry\n├── demo/                  # Demo applications\n├── dist/                  # Compiled assets\n├── package.json\n├── tsconfig.json\n├── vite.config.ts\n└── README.md\n```\n\n## Browser Support\n\n- Chrome/Edge (latest)\n- Firefox (latest)\n- Safari 14+\n\n## License\n\nMIT\n\n## Contributing\n\nContributions are welcome! Please read our contributing guidelines first.\n\n## Credits\n\nBuilt by Aulinq team with ❤️\n","readmeFilename":"README.md"}