glirastes 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +146 -9
  3. package/codegen/package.json +5 -0
  4. package/dist/cjs/codegen/asset-sync.d.ts +20 -0
  5. package/dist/cjs/codegen/asset-sync.js +28 -0
  6. package/dist/cjs/codegen/coverage.d.ts +66 -0
  7. package/dist/cjs/codegen/coverage.js +408 -0
  8. package/dist/cjs/codegen/endpoint-scanner.d.ts +16 -0
  9. package/dist/cjs/codegen/endpoint-scanner.js +197 -0
  10. package/dist/cjs/codegen/format.d.ts +17 -0
  11. package/dist/cjs/codegen/format.js +34 -0
  12. package/dist/cjs/codegen/fs-utils.d.ts +45 -0
  13. package/dist/cjs/codegen/fs-utils.js +165 -0
  14. package/dist/cjs/codegen/index.d.ts +13 -0
  15. package/dist/cjs/codegen/index.js +33 -0
  16. package/dist/cjs/codegen/mcp-generator.d.ts +50 -0
  17. package/dist/cjs/codegen/mcp-generator.js +803 -0
  18. package/dist/cjs/codegen/module-generator.d.ts +11 -0
  19. package/dist/cjs/codegen/module-generator.js +353 -0
  20. package/dist/cjs/codegen/nestjs-scanner.d.ts +43 -0
  21. package/dist/cjs/codegen/nestjs-scanner.js +241 -0
  22. package/dist/cjs/codegen/output-recommender.d.ts +23 -0
  23. package/dist/cjs/codegen/output-recommender.js +33 -0
  24. package/dist/cjs/codegen/scaffolder.d.ts +36 -0
  25. package/dist/cjs/codegen/scaffolder.js +262 -0
  26. package/dist/cjs/codegen/skill-generator.d.ts +49 -0
  27. package/dist/cjs/codegen/skill-generator.js +967 -0
  28. package/dist/cjs/codegen/types.d.ts +52 -0
  29. package/dist/cjs/codegen/types.js +16 -0
  30. package/dist/cjs/codegen/ui-scanner.d.ts +24 -0
  31. package/dist/cjs/codegen/ui-scanner.js +202 -0
  32. package/dist/cjs/codegen/validator.d.ts +35 -0
  33. package/dist/cjs/codegen/validator.js +292 -0
  34. package/dist/cjs/index.d.ts +1 -0
  35. package/dist/cjs/index.js +23 -0
  36. package/dist/cjs/openapi/index.d.ts +78 -0
  37. package/dist/cjs/openapi/index.js +347 -0
  38. package/dist/cjs/package.json +1 -0
  39. package/dist/cjs/react/audio-worklet-processor.d.ts +16 -0
  40. package/dist/cjs/react/audio-worklet-processor.js +27 -0
  41. package/dist/cjs/react/bridges/rest-session-bridge.d.ts +113 -0
  42. package/dist/cjs/react/bridges/rest-session-bridge.js +209 -0
  43. package/dist/cjs/react/components/ai-chat-panel.d.ts +12 -0
  44. package/dist/cjs/react/components/ai-chat-panel.js +67 -0
  45. package/dist/cjs/react/components/ai-trigger-button.d.ts +2 -0
  46. package/dist/cjs/react/components/ai-trigger-button.js +239 -0
  47. package/dist/cjs/react/components/approval-card.d.ts +9 -0
  48. package/dist/cjs/react/components/approval-card.js +24 -0
  49. package/dist/cjs/react/components/bulk-approval-card.d.ts +9 -0
  50. package/dist/cjs/react/components/bulk-approval-card.js +36 -0
  51. package/dist/cjs/react/components/chat-input.d.ts +10 -0
  52. package/dist/cjs/react/components/chat-input.js +60 -0
  53. package/dist/cjs/react/components/chat-window.d.ts +2 -0
  54. package/dist/cjs/react/components/chat-window.js +134 -0
  55. package/dist/cjs/react/components/confirm-dialog.d.ts +32 -0
  56. package/dist/cjs/react/components/confirm-dialog.js +48 -0
  57. package/dist/cjs/react/components/floating-chat-ui.d.ts +90 -0
  58. package/dist/cjs/react/components/floating-chat-ui.js +163 -0
  59. package/dist/cjs/react/components/mention-chip.d.ts +16 -0
  60. package/dist/cjs/react/components/mention-chip.js +42 -0
  61. package/dist/cjs/react/components/mention-input.d.ts +8 -0
  62. package/dist/cjs/react/components/mention-input.js +117 -0
  63. package/dist/cjs/react/components/message-bubble.d.ts +11 -0
  64. package/dist/cjs/react/components/message-bubble.js +171 -0
  65. package/dist/cjs/react/components/message-list.d.ts +8 -0
  66. package/dist/cjs/react/components/message-list.js +52 -0
  67. package/dist/cjs/react/components/pipeline-timeline.d.ts +7 -0
  68. package/dist/cjs/react/components/pipeline-timeline.js +72 -0
  69. package/dist/cjs/react/components/recording-bar.d.ts +2 -0
  70. package/dist/cjs/react/components/recording-bar.js +81 -0
  71. package/dist/cjs/react/components/recording-controls.d.ts +18 -0
  72. package/dist/cjs/react/components/recording-controls.js +38 -0
  73. package/dist/cjs/react/components/rich-mention-input.d.ts +2 -0
  74. package/dist/cjs/react/components/rich-mention-input.js +571 -0
  75. package/dist/cjs/react/components/session-switcher.d.ts +14 -0
  76. package/dist/cjs/react/components/session-switcher.js +133 -0
  77. package/dist/cjs/react/components/suggestion-bar.d.ts +9 -0
  78. package/dist/cjs/react/components/suggestion-bar.js +47 -0
  79. package/dist/cjs/react/components/suggestion-chip.d.ts +9 -0
  80. package/dist/cjs/react/components/suggestion-chip.js +14 -0
  81. package/dist/cjs/react/components/voice-input-addon.d.ts +13 -0
  82. package/dist/cjs/react/components/voice-input-addon.js +31 -0
  83. package/dist/cjs/react/components/voice-input-button.d.ts +2 -0
  84. package/dist/cjs/react/components/voice-input-button.js +55 -0
  85. package/dist/cjs/react/components/wavesurfer-loader.d.ts +5 -0
  86. package/dist/cjs/react/components/wavesurfer-loader.js +36 -0
  87. package/dist/cjs/react/hooks/use-ai-chat.d.ts +22 -0
  88. package/dist/cjs/react/hooks/use-ai-chat.js +51 -0
  89. package/dist/cjs/react/hooks/use-approvals.d.ts +23 -0
  90. package/dist/cjs/react/hooks/use-approvals.js +63 -0
  91. package/dist/cjs/react/hooks/use-deepgram-transcription.d.ts +2 -0
  92. package/dist/cjs/react/hooks/use-deepgram-transcription.js +329 -0
  93. package/dist/cjs/react/hooks/use-drag-resize-panel.d.ts +48 -0
  94. package/dist/cjs/react/hooks/use-drag-resize-panel.js +308 -0
  95. package/dist/cjs/react/hooks/use-draggable-position.d.ts +25 -0
  96. package/dist/cjs/react/hooks/use-draggable-position.js +134 -0
  97. package/dist/cjs/react/hooks/use-keyboard-shortcut.d.ts +20 -0
  98. package/dist/cjs/react/hooks/use-keyboard-shortcut.js +93 -0
  99. package/dist/cjs/react/hooks/use-mentions.d.ts +23 -0
  100. package/dist/cjs/react/hooks/use-mentions.js +42 -0
  101. package/dist/cjs/react/hooks/use-suggestions.d.ts +22 -0
  102. package/dist/cjs/react/hooks/use-suggestions.js +39 -0
  103. package/dist/cjs/react/index.d.ts +43 -0
  104. package/dist/cjs/react/index.js +111 -0
  105. package/dist/cjs/react/provider/ai-chat-provider.d.ts +45 -0
  106. package/dist/cjs/react/provider/ai-chat-provider.js +1024 -0
  107. package/dist/cjs/react/provider/chat-context.d.ts +84 -0
  108. package/dist/cjs/react/provider/chat-context.js +13 -0
  109. package/dist/cjs/react/template.d.ts +84 -0
  110. package/dist/cjs/react/template.js +90 -0
  111. package/dist/cjs/react/themes.d.ts +24 -0
  112. package/dist/cjs/react/themes.js +273 -0
  113. package/dist/cjs/react/transports/langgraph/index.d.ts +2 -0
  114. package/dist/cjs/react/transports/langgraph/index.js +8 -0
  115. package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.d.ts +62 -0
  116. package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.js +94 -0
  117. package/dist/cjs/react/transports/langgraph.d.ts +71 -0
  118. package/dist/cjs/react/transports/langgraph.js +369 -0
  119. package/dist/cjs/react/transports/vercel/index.d.ts +2 -0
  120. package/dist/cjs/react/transports/vercel/index.js +8 -0
  121. package/dist/cjs/react/transports/vercel/vercel-ai-chat.d.ts +49 -0
  122. package/dist/cjs/react/transports/vercel/vercel-ai-chat.js +81 -0
  123. package/dist/cjs/react/transports/vercel.d.ts +30 -0
  124. package/dist/cjs/react/transports/vercel.js +69 -0
  125. package/dist/cjs/react/types.d.ts +760 -0
  126. package/dist/cjs/react/types.js +2 -0
  127. package/dist/cjs/react/ui.d.ts +73 -0
  128. package/dist/cjs/react/ui.js +183 -0
  129. package/dist/cjs/react/utils/create-approval-description.d.ts +53 -0
  130. package/dist/cjs/react/utils/create-approval-description.js +122 -0
  131. package/dist/cjs/react/utils/create-tool-result-handler.d.ts +90 -0
  132. package/dist/cjs/react/utils/create-tool-result-handler.js +168 -0
  133. package/dist/cjs/react/utils/mention-markup.d.ts +13 -0
  134. package/dist/cjs/react/utils/mention-markup.js +117 -0
  135. package/dist/cjs/react/utils/merge-pipeline-steps.d.ts +19 -0
  136. package/dist/cjs/react/utils/merge-pipeline-steps.js +81 -0
  137. package/dist/cjs/react/utils/sanitize-stored-messages.d.ts +23 -0
  138. package/dist/cjs/react/utils/sanitize-stored-messages.js +52 -0
  139. package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.d.ts +10 -0
  140. package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.js +42 -0
  141. package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.d.ts +32 -0
  142. package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.js +4 -0
  143. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.d.ts +11 -0
  144. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.js +80 -0
  145. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.d.ts +9 -0
  146. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.js +119 -0
  147. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.d.ts +13 -0
  148. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.js +131 -0
  149. package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.d.ts +7 -0
  150. package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js +52 -0
  151. package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.d.ts +19 -0
  152. package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.js +108 -0
  153. package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.d.ts +8 -0
  154. package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.js +59 -0
  155. package/dist/cjs/server/adapters/nestjs/chat/dto/index.d.ts +3 -0
  156. package/dist/cjs/server/adapters/nestjs/chat/dto/index.js +9 -0
  157. package/dist/cjs/server/adapters/nestjs/chat/index.d.ts +3 -0
  158. package/dist/cjs/server/adapters/nestjs/chat/index.js +9 -0
  159. package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +4 -0
  160. package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.js +73 -0
  161. package/dist/cjs/server/adapters/nestjs/chat/ws-loader.d.ts +5 -0
  162. package/dist/cjs/server/adapters/nestjs/chat/ws-loader.js +72 -0
  163. package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.d.ts +6 -0
  164. package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.js +13 -0
  165. package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.d.ts +5 -0
  166. package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.js +15 -0
  167. package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.d.ts +6 -0
  168. package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.js +22 -0
  169. package/dist/cjs/server/adapters/nestjs/decorators/constants.d.ts +4 -0
  170. package/dist/cjs/server/adapters/nestjs/decorators/constants.js +7 -0
  171. package/dist/cjs/server/adapters/nestjs/index.d.ts +14 -0
  172. package/dist/cjs/server/adapters/nestjs/index.js +42 -0
  173. package/dist/cjs/server/adapters/nestjs/metadata.d.ts +39 -0
  174. package/dist/cjs/server/adapters/nestjs/metadata.js +36 -0
  175. package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.d.ts +36 -0
  176. package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.js +159 -0
  177. package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.d.ts +37 -0
  178. package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.js +44 -0
  179. package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.d.ts +28 -0
  180. package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.js +41 -0
  181. package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.d.ts +16 -0
  182. package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.js +117 -0
  183. package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.d.ts +26 -0
  184. package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.js +259 -0
  185. package/dist/cjs/server/adapters/nestjs/swagger.d.ts +7 -0
  186. package/dist/cjs/server/adapters/nestjs/swagger.js +39 -0
  187. package/dist/cjs/server/adapters/nextjs/context-helpers.d.ts +22 -0
  188. package/dist/cjs/server/adapters/nextjs/context-helpers.js +60 -0
  189. package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.d.ts +94 -0
  190. package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.js +965 -0
  191. package/dist/cjs/server/adapters/nextjs/filter-fallback-error.d.ts +11 -0
  192. package/dist/cjs/server/adapters/nextjs/filter-fallback-error.js +41 -0
  193. package/dist/cjs/server/adapters/nextjs/index.d.ts +8 -0
  194. package/dist/cjs/server/adapters/nextjs/index.js +22 -0
  195. package/dist/cjs/server/adapters/nextjs/prepare-model-messages.d.ts +58 -0
  196. package/dist/cjs/server/adapters/nextjs/prepare-model-messages.js +114 -0
  197. package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.d.ts +64 -0
  198. package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.js +489 -0
  199. package/dist/cjs/server/adapters/nextjs/server-action-helper.d.ts +7 -0
  200. package/dist/cjs/server/adapters/nextjs/server-action-helper.js +40 -0
  201. package/dist/cjs/server/adapters/nextjs/types.d.ts +246 -0
  202. package/dist/cjs/server/adapters/nextjs/types.js +2 -0
  203. package/dist/cjs/server/adapters/nextjs/with-ai-tool.d.ts +9 -0
  204. package/dist/cjs/server/adapters/nextjs/with-ai-tool.js +12 -0
  205. package/dist/cjs/server/core/followup-tool.d.ts +9 -0
  206. package/dist/cjs/server/core/followup-tool.js +82 -0
  207. package/dist/cjs/server/core/index.d.ts +139 -0
  208. package/dist/cjs/server/core/index.js +818 -0
  209. package/dist/cjs/server/core/intent-classifier.d.ts +94 -0
  210. package/dist/cjs/server/core/intent-classifier.js +324 -0
  211. package/dist/cjs/server/core/model-selector.d.ts +12 -0
  212. package/dist/cjs/server/core/model-selector.js +48 -0
  213. package/dist/cjs/server/core/module-router.d.ts +14 -0
  214. package/dist/cjs/server/core/module-router.js +110 -0
  215. package/dist/cjs/server/core/zod-compact.d.ts +18 -0
  216. package/dist/cjs/server/core/zod-compact.js +129 -0
  217. package/dist/cjs/server/index.d.ts +6 -0
  218. package/dist/cjs/server/index.js +28 -0
  219. package/dist/cjs/server/lancer/cache.d.ts +9 -0
  220. package/dist/cjs/server/lancer/cache.js +33 -0
  221. package/dist/cjs/server/lancer/client.d.ts +2 -0
  222. package/dist/cjs/server/lancer/client.js +279 -0
  223. package/dist/cjs/server/lancer/errors.d.ts +13 -0
  224. package/dist/cjs/server/lancer/errors.js +21 -0
  225. package/dist/cjs/server/lancer/index.d.ts +3 -0
  226. package/dist/cjs/server/lancer/index.js +7 -0
  227. package/dist/cjs/server/lancer/telemetry-buffer.d.ts +15 -0
  228. package/dist/cjs/server/lancer/telemetry-buffer.js +64 -0
  229. package/dist/cjs/server/lancer/types.d.ts +201 -0
  230. package/dist/cjs/server/lancer/types.js +5 -0
  231. package/dist/cjs/server/pii-shield/aegis-detector.d.ts +26 -0
  232. package/dist/cjs/server/pii-shield/aegis-detector.js +26 -0
  233. package/dist/cjs/server/pii-shield/create-pii-shield.d.ts +2 -0
  234. package/dist/cjs/server/pii-shield/create-pii-shield.js +191 -0
  235. package/dist/cjs/server/pii-shield/deep-walk.d.ts +1 -0
  236. package/dist/cjs/server/pii-shield/deep-walk.js +19 -0
  237. package/dist/cjs/server/pii-shield/fake-data.d.ts +5 -0
  238. package/dist/cjs/server/pii-shield/fake-data.js +170 -0
  239. package/dist/cjs/server/pii-shield/index.d.ts +4 -0
  240. package/dist/cjs/server/pii-shield/index.js +9 -0
  241. package/dist/cjs/server/pii-shield/leakage.d.ts +1 -0
  242. package/dist/cjs/server/pii-shield/leakage.js +15 -0
  243. package/dist/cjs/server/pii-shield/session-mapping.d.ts +12 -0
  244. package/dist/cjs/server/pii-shield/session-mapping.js +70 -0
  245. package/dist/cjs/server/pipeline.d.ts +26 -0
  246. package/dist/cjs/server/pipeline.js +127 -0
  247. package/dist/cjs/server/testing/approvals.d.ts +11 -0
  248. package/dist/cjs/server/testing/approvals.js +41 -0
  249. package/dist/cjs/server/testing/combination.d.ts +3 -0
  250. package/dist/cjs/server/testing/combination.js +83 -0
  251. package/dist/cjs/server/testing/create-test-suite.d.ts +29 -0
  252. package/dist/cjs/server/testing/create-test-suite.js +81 -0
  253. package/dist/cjs/server/testing/edge-cases.d.ts +8 -0
  254. package/dist/cjs/server/testing/edge-cases.js +277 -0
  255. package/dist/cjs/server/testing/guardrails.d.ts +14 -0
  256. package/dist/cjs/server/testing/guardrails.js +152 -0
  257. package/dist/cjs/server/testing/helpers.d.ts +14 -0
  258. package/dist/cjs/server/testing/helpers.js +119 -0
  259. package/dist/cjs/server/testing/index.d.ts +12 -0
  260. package/dist/cjs/server/testing/index.js +37 -0
  261. package/dist/cjs/server/testing/mock-executor.d.ts +8 -0
  262. package/dist/cjs/server/testing/mock-executor.js +40 -0
  263. package/dist/cjs/server/testing/regression.d.ts +7 -0
  264. package/dist/cjs/server/testing/regression.js +27 -0
  265. package/dist/cjs/server/testing/routing.d.ts +12 -0
  266. package/dist/cjs/server/testing/routing.js +63 -0
  267. package/dist/cjs/server/testing/schema-consistency.d.ts +6 -0
  268. package/dist/cjs/server/testing/schema-consistency.js +56 -0
  269. package/dist/cjs/server/testing/smoke.d.ts +11 -0
  270. package/dist/cjs/server/testing/smoke.js +64 -0
  271. package/dist/cjs/server/testing/types.d.ts +156 -0
  272. package/dist/cjs/server/testing/types.js +2 -0
  273. package/dist/cjs/types.d.ts +696 -0
  274. package/dist/cjs/types.js +91 -0
  275. package/dist/cli/commands/install-skills.d.ts +17 -0
  276. package/dist/cli/commands/install-skills.js +185 -0
  277. package/dist/cli/commands/install-skills.js.map +1 -0
  278. package/dist/cli/index.js +25 -0
  279. package/dist/cli/index.js.map +1 -1
  280. package/dist/react/components/ai-trigger-button.js +4 -6
  281. package/dist/react/components/ai-trigger-button.js.map +1 -1
  282. package/dist/react/components/recording-bar.js +4 -6
  283. package/dist/react/components/recording-bar.js.map +1 -1
  284. package/dist/react/components/wavesurfer-loader.d.ts +5 -0
  285. package/dist/react/components/wavesurfer-loader.js +34 -0
  286. package/dist/react/components/wavesurfer-loader.js.map +1 -0
  287. package/dist/server/adapters/nestjs/chat/ai-chat.module.d.ts +1 -1
  288. package/dist/server/adapters/nestjs/chat/ai-chat.module.js +3 -2
  289. package/dist/server/adapters/nestjs/chat/ai-chat.module.js.map +1 -1
  290. package/dist/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +1 -1
  291. package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js +10 -8
  292. package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js.map +1 -1
  293. package/dist/server/adapters/nestjs/chat/ws-loader.d.ts +5 -0
  294. package/dist/server/adapters/nestjs/chat/ws-loader.js +37 -0
  295. package/dist/server/adapters/nestjs/chat/ws-loader.js.map +1 -0
  296. package/openapi/package.json +5 -0
  297. package/package.json +59 -16
  298. package/react/langgraph/package.json +5 -0
  299. package/react/package.json +5 -0
  300. package/react/vercel/package.json +5 -0
  301. package/server/nestjs/package.json +5 -0
  302. package/server/nextjs/package.json +5 -0
  303. package/server/package.json +5 -0
  304. package/server/testing/package.json +5 -0
  305. package/skills/README.md +107 -0
  306. package/skills/building-glirastes-chat-ui/SKILL.md +378 -0
  307. package/skills/integrating-glirastes-nestjs/SKILL.md +346 -0
  308. package/skills/integrating-glirastes-nextjs/SKILL.md +306 -0
  309. package/skills/integrating-glirastes-nextjs-with-nestjs-backend/SKILL.md +359 -0
  310. package/skills/maintaining-glirastes-tools/SKILL.md +463 -0
@@ -0,0 +1,378 @@
1
+ ---
2
+ name: building-glirastes-chat-ui
3
+ description: Customizing the Glirastes chat UI — VercelAiChat / LangGraphAiChat, AiChatProvider + AiChatPanel composition, theming, mentions, voice input, approval cards, ChatWindow portal, useAiClientAction. Use when going beyond the zero-config chat widget.
4
+ version: 1.0.0
5
+ tags:
6
+ - glirastes
7
+ - react
8
+ - chat-ui
9
+ - components
10
+ triggers:
11
+ - chat panel
12
+ - chat window
13
+ - VercelAiChat
14
+ - LangGraphAiChat
15
+ - AiChatProvider
16
+ - AiChatPanel
17
+ - useAiChat
18
+ - useAiClientAction
19
+ - chat theming
20
+ - chat mentions
21
+ - voice input
22
+ - approval card
23
+ - suggestion chips
24
+ - pipeline timeline
25
+ ---
26
+
27
+ # Building the Glirastes Chat UI
28
+
29
+ > **Scope:** customizing the chat UI beyond `<VercelAiChat endpoint="/api/chat" />`. For the initial integration (install, wire the route, drop the widget), see [integrating-glirastes-nextjs](../integrating-glirastes-nextjs/SKILL.md) or [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md).
30
+
31
+ ## Component map
32
+
33
+ ```
34
+ AiChatProvider (state + transport + config)
35
+ └─ AiChatPanel (the panel layout — header, body, input)
36
+ ├─ MessageList → MessageBubble (text, mentions, tool results, approvals, pipeline timeline)
37
+ ├─ SuggestionBar (Pro: contextual followup chips)
38
+ └─ ChatInput / RichMentionInput (input box)
39
+ └─ VoiceInputAddon (optional: live waveform + STT)
40
+
41
+ VercelAiChat = AiChatProvider + ChatWindow (floating, draggable, resizable) + AiTriggerButton (the floating launcher)
42
+ LangGraphAiChat = same shape but talks LangGraph instead of Vercel AI SDK
43
+ ```
44
+
45
+ `<VercelAiChat />` is the zero-config wrapper. For full control, drop down to `AiChatProvider` + `AiChatPanel`.
46
+
47
+ ## Three integration levels
48
+
49
+ ### Level 1 — VercelAiChat (zero config)
50
+
51
+ ```tsx
52
+ 'use client';
53
+ import { VercelAiChat } from 'glirastes/react/vercel';
54
+ import 'glirastes/react/styles.css';
55
+
56
+ export function ChatWidget() {
57
+ return <VercelAiChat endpoint="/api/chat" />;
58
+ }
59
+ ```
60
+
61
+ This gives you the floating trigger button (bottom-right), draggable+resizable chat window, message rendering, mentions, voice input, approval cards. Everything wired up. ~80% of apps stop here.
62
+
63
+ ### Level 2 — VercelAiChat with props
64
+
65
+ `VercelAiChat` (and `LangGraphAiChat`) accept layout + behaviour props:
66
+
67
+ ```tsx
68
+ <VercelAiChat
69
+ endpoint="/api/chat"
70
+ headers={() => ({ Authorization: `Bearer ${getToken()}` })}
71
+ bodyExtras={() => ({ tenantId: getTenantId() })}
72
+ title="Assistant"
73
+ defaultOpen={false}
74
+ draggable
75
+ resizable
76
+ size={{ width: 400, height: 640 }}
77
+ hideTriggerWhenOpen
78
+ shortcut={{ key: 'k', meta: true }}
79
+ showMic={true}
80
+ showClearButton
81
+ confirmClear
82
+ showSessionSwitcher
83
+ welcomeMessage="Hi! Ask me about your tasks."
84
+ triggerIcon={<MyCustomIcon />}
85
+ headerActions={<MySettingsButton />}
86
+ sessions={{ storage: 'localStorage', maxHistory: 30 }}
87
+ autoResumeOnApproval
88
+ />
89
+ ```
90
+
91
+ Highlights:
92
+
93
+ | Prop | What it does |
94
+ |---|---|
95
+ | `headers` | Function returning request headers — refreshed on every request, ideal for JWT |
96
+ | `bodyExtras` | Extra fields merged into the chat request body — tenant ID, locale, etc. |
97
+ | `shortcut` | Keyboard shortcut to toggle the chat (e.g. `⌘K`) |
98
+ | `showMic` | Voice input toggle. Set `false` to drop `wavesurfer.js` from the bundle entirely |
99
+ | `sessions` | Multi-session history — switches between conversations, persists across reloads |
100
+ | `autoResumeOnApproval` | After an approval card is approved, the LLM continues without manual nudge |
101
+
102
+ ### Level 3 — AiChatProvider + AiChatPanel (full control)
103
+
104
+ When you need a non-floating layout (sidebar, full-page, embedded), compose manually:
105
+
106
+ ```tsx
107
+ 'use client';
108
+ import { AiChatProvider, AiChatPanel, useAiChat } from 'glirastes/react';
109
+ import { useVercelAiChatTransport } from 'glirastes/react/vercel';
110
+
111
+ export function FullPageChat() {
112
+ const transport = useVercelAiChatTransport({
113
+ endpoint: '/api/chat',
114
+ headers: () => ({ Authorization: `Bearer ${getToken()}` }),
115
+ });
116
+
117
+ return (
118
+ <AiChatProvider transport={transport}>
119
+ <div className="h-full flex">
120
+ <Sidebar />
121
+ <AiChatPanel className="flex-1" />
122
+ </div>
123
+ </AiChatProvider>
124
+ );
125
+ }
126
+ ```
127
+
128
+ Inside any descendant of `AiChatProvider`, `useAiChat()` exposes the full state — messages, sending, current pipeline state, etc. Useful when you want to render messages elsewhere or add custom controls.
129
+
130
+ ## UI Action Bus — frontend reactions to tool results
131
+
132
+ Tool results that carry a `uiAction` payload (from `uiPattern` or `uiActionOnSuccess`) are dispatched through `UiActionBus`. Register handlers anywhere in the component tree:
133
+
134
+ ```tsx
135
+ 'use client';
136
+ import { useAiClientAction } from 'glirastes/react';
137
+ import { useRouter } from 'next/navigation';
138
+ import { toast } from 'sonner';
139
+
140
+ export function TaskList() {
141
+ const router = useRouter();
142
+
143
+ // Open the detail view when the LLM picks a task
144
+ useAiClientAction('task-details.open', (payload) => {
145
+ router.push(`/tasks/${payload?.taskId}`);
146
+ });
147
+
148
+ // Refresh the list after a mutation
149
+ useAiClientAction('tasks.refresh', () => {
150
+ queryClient.invalidateQueries({ queryKey: ['tasks'] });
151
+ });
152
+
153
+ // Open a custom dialog
154
+ useAiClientAction('task-create-dialog.open', () => {
155
+ setCreateDialogOpen(true);
156
+ });
157
+
158
+ return /* ... */;
159
+ }
160
+ ```
161
+
162
+ Action IDs follow conventions derived from `uiPattern`:
163
+
164
+ | `uiPattern.type` | Derived action ID |
165
+ |---|---|
166
+ | `open-detail`, `entity: 'task'` | `task-details.open` |
167
+ | `open-dialog`, `dialog: 'create-task'` | `task-create-dialog.open` |
168
+ | `refresh`, `target: 'tasks'` | `tasks.refresh` |
169
+ | `toast` | dispatched directly to your toast lib via the SDK's toast handler config |
170
+
171
+ For raw `uiActionOnSuccess: { type: 'run-client-action', actionId: 'X' }` you choose any string for `actionId`.
172
+
173
+ `glirastes coverage` reports any action ID declared in tools but not handled (or vice versa).
174
+
175
+ ## Approval cards
176
+
177
+ Mutations with `needsApproval: true` (default for POST/PATCH/PUT/DELETE) render an approval card before executing. The default card shows:
178
+
179
+ - Tool name and description
180
+ - Input parameters
181
+ - Approve / Cancel buttons
182
+
183
+ Customize per-tool with optional `approvalCard` config:
184
+
185
+ ```ts
186
+ defineEndpointTool({
187
+ // ...
188
+ approvalCard: {
189
+ title: 'Create task',
190
+ description: (input) => `Create task "${input.title}"?`,
191
+ severity: 'info', // or 'warning' | 'danger' for destructive ops
192
+ },
193
+ })
194
+ ```
195
+
196
+ For full UI control, pass a custom component to `AiChatProvider`:
197
+
198
+ ```tsx
199
+ <AiChatProvider
200
+ components={{ ApprovalCard: MyCustomApprovalCard }}
201
+ >
202
+ ...
203
+ </AiChatProvider>
204
+ ```
205
+
206
+ ## Mentions (`@user`, `#tag`)
207
+
208
+ Mentions let users reference entities the LLM can resolve to IDs. Configure on the provider or on `VercelAiChat`:
209
+
210
+ ```tsx
211
+ <VercelAiChat
212
+ endpoint="/api/chat"
213
+ mentions={{
214
+ triggers: {
215
+ '@': {
216
+ label: 'User',
217
+ search: async (query) => {
218
+ const users = await fetch(`/api/users/search?q=${query}`).then(r => r.json());
219
+ return users.map(u => ({ id: u.id, label: u.name, hint: u.email }));
220
+ },
221
+ },
222
+ '#': {
223
+ label: 'Tag',
224
+ search: async (query) => fetch(`/api/tags?q=${query}`).then(r => r.json()),
225
+ },
226
+ },
227
+ }}
228
+ />
229
+ ```
230
+
231
+ Mentions in the input get serialized into the user message — your tools see structured references the LLM can pass back as IDs:
232
+
233
+ ```
234
+ Input: "assign @Alice the task #urgent"
235
+ Wire: "assign user_123 the task with tag tag_456"
236
+ ```
237
+
238
+ ## Theming
239
+
240
+ The chat UI is styled with a small token system. Override at the provider level:
241
+
242
+ ```tsx
243
+ <VercelAiChat
244
+ endpoint="/api/chat"
245
+ theme={{
246
+ colors: {
247
+ primary: '#6366f1',
248
+ background: '#0a0a0a',
249
+ foreground: '#ffffff',
250
+ muted: '#262626',
251
+ border: '#404040',
252
+ },
253
+ radius: '12px',
254
+ fontFamily: 'Inter, sans-serif',
255
+ }}
256
+ />
257
+ ```
258
+
259
+ For deeper customization, swap the default `glirastes/react/styles.css` for your own:
260
+
261
+ 1. Don't import `glirastes/react/styles.css`
262
+ 2. Inspect the DOM (every component has stable `data-*` attributes) — e.g. `[data-glirastes='chat-panel']`, `[data-part='message-bubble']`
263
+ 3. Write your own CSS targeting those selectors
264
+
265
+ ## Voice input (Deepgram speech-to-text)
266
+
267
+ The trigger button has a built-in mic mode. When the user holds the mic:
268
+
269
+ 1. Browser captures audio
270
+ 2. `wavesurfer.js` renders a live waveform
271
+ 3. Audio frames stream to your backend's `/api/ai/speech-stream` WebSocket
272
+ 4. Backend proxies to Deepgram, streams transcriptions back
273
+ 5. On release, the final transcript becomes the chat input
274
+
275
+ **Frontend setup:**
276
+
277
+ ```bash
278
+ npm install wavesurfer.js
279
+ ```
280
+
281
+ ```tsx
282
+ <VercelAiChat
283
+ endpoint="/api/chat"
284
+ showMic={true}
285
+ voiceInput={{
286
+ websocketUrl: '/api/ai/speech-stream',
287
+ language: 'en', // or 'de', etc.
288
+ }}
289
+ />
290
+ ```
291
+
292
+ **Backend setup:** see [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md) → "Speech-to-text WebSocket". For Next.js standalone, you need a separate WebSocket server — Next.js Route Handlers don't support WS natively.
293
+
294
+ If you don't want voice input at all, set `showMic={false}` and skip installing `wavesurfer.js`. The components are tree-shaken.
295
+
296
+ ### Content Security Policy and `wavesurfer.js`
297
+
298
+ The optional-peer loader for `wavesurfer.js` uses `new Function('s', 'return import(s)')` to hide the specifier from bundlers (so apps that don't install the peer don't fail to build). This requires `script-src 'unsafe-eval'` in your CSP.
299
+
300
+ If your deployment forbids `unsafe-eval` **and** you want voice input, install `wavesurfer.js` unconditionally:
301
+
302
+ ```bash
303
+ npm install wavesurfer.js
304
+ ```
305
+
306
+ With the peer present at install time, the bundler resolves the static path successfully and the runtime trick is bypassed entirely. Strict-CSP environments without voice can stay on `showMic={false}` and never need `wavesurfer.js`.
307
+
308
+ ## ChatWindow — portal, draggable, resizable
309
+
310
+ `VercelAiChat` already wraps the panel in a `ChatWindow`. If you compose manually, you can use the window separately:
311
+
312
+ ```tsx
313
+ import { ChatWindow, AiChatPanel } from 'glirastes/react';
314
+
315
+ <ChatWindow
316
+ open={open}
317
+ onOpenChange={setOpen}
318
+ draggable
319
+ resizable
320
+ size={{ width: 400, height: 640 }}
321
+ defaultPosition={{ x: 'right', y: 'bottom', offset: 24 }}
322
+ >
323
+ <AiChatPanel />
324
+ </ChatWindow>
325
+ ```
326
+
327
+ The window portals to `document.body` by default — no z-index fights with your app shell.
328
+
329
+ ## Sessions (multi-conversation)
330
+
331
+ Enable conversation history with the `sessions` prop:
332
+
333
+ ```tsx
334
+ <VercelAiChat
335
+ endpoint="/api/chat"
336
+ sessions={{
337
+ storage: 'localStorage', // or a custom adapter implementing { load, save, clear }
338
+ maxHistory: 30,
339
+ onCreate: (session) => trackEvent('chat:new-session'),
340
+ }}
341
+ showSessionSwitcher
342
+ />
343
+ ```
344
+
345
+ A session switcher renders in the header (with `showSessionSwitcher`); users can name, switch, or delete sessions. Custom adapters let you persist server-side instead of localStorage.
346
+
347
+ ## Pipeline timeline (Pro)
348
+
349
+ When `GLIRASTES_API_KEY` is set, the chat shows per-request pipeline steps inline (intent classification, guardrails, tool calls, model selection):
350
+
351
+ ```
352
+ ↳ Intent: task_query (0.94)
353
+ ↳ Tools available: 3
354
+ ↳ Model: gpt-4o-mini
355
+ ↳ Tool call: list_tasks (124ms)
356
+ ```
357
+
358
+ No setup beyond having the key — the timeline auto-renders inside the message bubble of the corresponding assistant turn.
359
+
360
+ ## Common pitfalls
361
+
362
+ | Symptom | Cause | Fix |
363
+ |---|---|---|
364
+ | Widget unstyled | `styles.css` not imported | Add `import 'glirastes/react/styles.css'` near the root |
365
+ | Floating button overlaps a sticky footer | Default position bottom-right | Pass `defaultPosition={{ x: 'right', y: 'bottom', offset: 80 }}` |
366
+ | `useAiClientAction` doesn't fire | Component not mounted when the action arrives | Mount the handler in a layout that's always rendered |
367
+ | Mentions search runs on every keystroke | No debounce | Wrap your `search` fn with `lodash.debounce` (300ms typical) |
368
+ | Voice input fails silently | WebSocket URL wrong / `DEEPGRAM_API_KEY` missing | Check browser DevTools → WS frame; check backend logs |
369
+ | Approval card not shown for a mutation | Tool sets `needsApproval: false` explicitly | Either remove the override or set `autoApproveTools` per-user |
370
+ | Approval card shown for a benign GET | Tool overrides `needsApproval: true` | GETs default to `false` — drop the override |
371
+ | Multiple chat instances on the page | Mounted `<VercelAiChat />` more than once | Render exactly one in your root layout |
372
+ | Bundle includes `wavesurfer.js` despite `showMic={false}` | Direct import of voice components elsewhere | Remove any `import` from `glirastes/react/components/recording-bar` etc. |
373
+
374
+ ## What this skill does NOT cover
375
+
376
+ - **Initial integration** (install, route handler, widget mount) — see [integrating-glirastes-nextjs](../integrating-glirastes-nextjs/SKILL.md) or [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md)
377
+ - **Tool authoring** (`uiPattern` / `uiActionOnSuccess` semantics, `actionId` derivation, approval flag) — see [maintaining-glirastes-tools](../maintaining-glirastes-tools/SKILL.md)
378
+ - **LangGraph transport differences** — replace `useVercelAiChatTransport` / `VercelAiChat` with `useLangGraphAiChatTransport` / `LangGraphAiChat`; everything else in this skill applies unchanged