glirastes 0.2.1 → 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 (319) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/CODE_OF_CONDUCT.md +85 -0
  3. package/CONTRIBUTING.md +87 -0
  4. package/README.md +268 -23
  5. package/SECURITY.md +46 -0
  6. package/codegen/package.json +5 -0
  7. package/dist/cjs/codegen/asset-sync.d.ts +20 -0
  8. package/dist/cjs/codegen/asset-sync.js +28 -0
  9. package/dist/cjs/codegen/coverage.d.ts +66 -0
  10. package/dist/cjs/codegen/coverage.js +408 -0
  11. package/dist/cjs/codegen/endpoint-scanner.d.ts +16 -0
  12. package/dist/cjs/codegen/endpoint-scanner.js +197 -0
  13. package/dist/cjs/codegen/format.d.ts +17 -0
  14. package/dist/cjs/codegen/format.js +34 -0
  15. package/dist/cjs/codegen/fs-utils.d.ts +45 -0
  16. package/dist/cjs/codegen/fs-utils.js +165 -0
  17. package/dist/cjs/codegen/index.d.ts +13 -0
  18. package/dist/cjs/codegen/index.js +33 -0
  19. package/dist/cjs/codegen/mcp-generator.d.ts +50 -0
  20. package/dist/cjs/codegen/mcp-generator.js +803 -0
  21. package/dist/cjs/codegen/module-generator.d.ts +11 -0
  22. package/dist/cjs/codegen/module-generator.js +353 -0
  23. package/dist/cjs/codegen/nestjs-scanner.d.ts +43 -0
  24. package/dist/cjs/codegen/nestjs-scanner.js +241 -0
  25. package/dist/cjs/codegen/output-recommender.d.ts +23 -0
  26. package/dist/cjs/codegen/output-recommender.js +33 -0
  27. package/dist/cjs/codegen/scaffolder.d.ts +36 -0
  28. package/dist/cjs/codegen/scaffolder.js +262 -0
  29. package/dist/cjs/codegen/skill-generator.d.ts +49 -0
  30. package/dist/cjs/codegen/skill-generator.js +967 -0
  31. package/dist/cjs/codegen/types.d.ts +52 -0
  32. package/dist/cjs/codegen/types.js +16 -0
  33. package/dist/cjs/codegen/ui-scanner.d.ts +24 -0
  34. package/dist/cjs/codegen/ui-scanner.js +202 -0
  35. package/dist/cjs/codegen/validator.d.ts +35 -0
  36. package/dist/cjs/codegen/validator.js +292 -0
  37. package/dist/cjs/index.d.ts +1 -0
  38. package/dist/cjs/index.js +23 -0
  39. package/dist/cjs/openapi/index.d.ts +78 -0
  40. package/dist/cjs/openapi/index.js +347 -0
  41. package/dist/cjs/package.json +1 -0
  42. package/dist/cjs/react/audio-worklet-processor.d.ts +16 -0
  43. package/dist/cjs/react/audio-worklet-processor.js +27 -0
  44. package/dist/cjs/react/bridges/rest-session-bridge.d.ts +113 -0
  45. package/dist/cjs/react/bridges/rest-session-bridge.js +209 -0
  46. package/dist/cjs/react/components/ai-chat-panel.d.ts +12 -0
  47. package/dist/cjs/react/components/ai-chat-panel.js +67 -0
  48. package/dist/cjs/react/components/ai-trigger-button.d.ts +2 -0
  49. package/dist/cjs/react/components/ai-trigger-button.js +239 -0
  50. package/dist/cjs/react/components/approval-card.d.ts +9 -0
  51. package/dist/cjs/react/components/approval-card.js +24 -0
  52. package/dist/cjs/react/components/bulk-approval-card.d.ts +9 -0
  53. package/dist/cjs/react/components/bulk-approval-card.js +36 -0
  54. package/dist/cjs/react/components/chat-input.d.ts +10 -0
  55. package/dist/cjs/react/components/chat-input.js +60 -0
  56. package/dist/cjs/react/components/chat-window.d.ts +2 -0
  57. package/dist/cjs/react/components/chat-window.js +134 -0
  58. package/dist/cjs/react/components/confirm-dialog.d.ts +32 -0
  59. package/dist/cjs/react/components/confirm-dialog.js +48 -0
  60. package/dist/cjs/react/components/floating-chat-ui.d.ts +90 -0
  61. package/dist/cjs/react/components/floating-chat-ui.js +163 -0
  62. package/dist/cjs/react/components/mention-chip.d.ts +16 -0
  63. package/dist/cjs/react/components/mention-chip.js +42 -0
  64. package/dist/cjs/react/components/mention-input.d.ts +8 -0
  65. package/dist/cjs/react/components/mention-input.js +117 -0
  66. package/dist/cjs/react/components/message-bubble.d.ts +11 -0
  67. package/dist/cjs/react/components/message-bubble.js +171 -0
  68. package/dist/cjs/react/components/message-list.d.ts +8 -0
  69. package/dist/cjs/react/components/message-list.js +52 -0
  70. package/dist/cjs/react/components/pipeline-timeline.d.ts +7 -0
  71. package/dist/cjs/react/components/pipeline-timeline.js +72 -0
  72. package/dist/cjs/react/components/recording-bar.d.ts +2 -0
  73. package/dist/cjs/react/components/recording-bar.js +81 -0
  74. package/dist/cjs/react/components/recording-controls.d.ts +18 -0
  75. package/dist/cjs/react/components/recording-controls.js +38 -0
  76. package/dist/cjs/react/components/rich-mention-input.d.ts +2 -0
  77. package/dist/cjs/react/components/rich-mention-input.js +571 -0
  78. package/dist/cjs/react/components/session-switcher.d.ts +14 -0
  79. package/dist/cjs/react/components/session-switcher.js +133 -0
  80. package/dist/cjs/react/components/suggestion-bar.d.ts +9 -0
  81. package/dist/cjs/react/components/suggestion-bar.js +47 -0
  82. package/dist/cjs/react/components/suggestion-chip.d.ts +9 -0
  83. package/dist/cjs/react/components/suggestion-chip.js +14 -0
  84. package/dist/cjs/react/components/voice-input-addon.d.ts +13 -0
  85. package/dist/cjs/react/components/voice-input-addon.js +31 -0
  86. package/dist/cjs/react/components/voice-input-button.d.ts +2 -0
  87. package/dist/cjs/react/components/voice-input-button.js +55 -0
  88. package/dist/cjs/react/components/wavesurfer-loader.d.ts +5 -0
  89. package/dist/cjs/react/components/wavesurfer-loader.js +36 -0
  90. package/dist/cjs/react/hooks/use-ai-chat.d.ts +22 -0
  91. package/dist/cjs/react/hooks/use-ai-chat.js +51 -0
  92. package/dist/cjs/react/hooks/use-approvals.d.ts +23 -0
  93. package/dist/cjs/react/hooks/use-approvals.js +63 -0
  94. package/dist/cjs/react/hooks/use-deepgram-transcription.d.ts +2 -0
  95. package/dist/cjs/react/hooks/use-deepgram-transcription.js +329 -0
  96. package/dist/cjs/react/hooks/use-drag-resize-panel.d.ts +48 -0
  97. package/dist/cjs/react/hooks/use-drag-resize-panel.js +308 -0
  98. package/dist/cjs/react/hooks/use-draggable-position.d.ts +25 -0
  99. package/dist/cjs/react/hooks/use-draggable-position.js +134 -0
  100. package/dist/cjs/react/hooks/use-keyboard-shortcut.d.ts +20 -0
  101. package/dist/cjs/react/hooks/use-keyboard-shortcut.js +93 -0
  102. package/dist/cjs/react/hooks/use-mentions.d.ts +23 -0
  103. package/dist/cjs/react/hooks/use-mentions.js +42 -0
  104. package/dist/cjs/react/hooks/use-suggestions.d.ts +22 -0
  105. package/dist/cjs/react/hooks/use-suggestions.js +39 -0
  106. package/dist/cjs/react/index.d.ts +43 -0
  107. package/dist/cjs/react/index.js +111 -0
  108. package/dist/cjs/react/provider/ai-chat-provider.d.ts +45 -0
  109. package/dist/cjs/react/provider/ai-chat-provider.js +1024 -0
  110. package/dist/cjs/react/provider/chat-context.d.ts +84 -0
  111. package/dist/cjs/react/provider/chat-context.js +13 -0
  112. package/dist/cjs/react/template.d.ts +84 -0
  113. package/dist/cjs/react/template.js +90 -0
  114. package/dist/cjs/react/themes.d.ts +24 -0
  115. package/dist/cjs/react/themes.js +273 -0
  116. package/dist/cjs/react/transports/langgraph/index.d.ts +2 -0
  117. package/dist/cjs/react/transports/langgraph/index.js +8 -0
  118. package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.d.ts +62 -0
  119. package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.js +94 -0
  120. package/dist/cjs/react/transports/langgraph.d.ts +71 -0
  121. package/dist/cjs/react/transports/langgraph.js +369 -0
  122. package/dist/cjs/react/transports/vercel/index.d.ts +2 -0
  123. package/dist/cjs/react/transports/vercel/index.js +8 -0
  124. package/dist/cjs/react/transports/vercel/vercel-ai-chat.d.ts +49 -0
  125. package/dist/cjs/react/transports/vercel/vercel-ai-chat.js +81 -0
  126. package/dist/cjs/react/transports/vercel.d.ts +30 -0
  127. package/dist/cjs/react/transports/vercel.js +69 -0
  128. package/dist/cjs/react/types.d.ts +760 -0
  129. package/dist/cjs/react/types.js +2 -0
  130. package/dist/cjs/react/ui.d.ts +73 -0
  131. package/dist/cjs/react/ui.js +183 -0
  132. package/dist/cjs/react/utils/create-approval-description.d.ts +53 -0
  133. package/dist/cjs/react/utils/create-approval-description.js +122 -0
  134. package/dist/cjs/react/utils/create-tool-result-handler.d.ts +90 -0
  135. package/dist/cjs/react/utils/create-tool-result-handler.js +168 -0
  136. package/dist/cjs/react/utils/mention-markup.d.ts +13 -0
  137. package/dist/cjs/react/utils/mention-markup.js +117 -0
  138. package/dist/cjs/react/utils/merge-pipeline-steps.d.ts +19 -0
  139. package/dist/cjs/react/utils/merge-pipeline-steps.js +81 -0
  140. package/dist/cjs/react/utils/sanitize-stored-messages.d.ts +23 -0
  141. package/dist/cjs/react/utils/sanitize-stored-messages.js +52 -0
  142. package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.d.ts +10 -0
  143. package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.js +42 -0
  144. package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.d.ts +32 -0
  145. package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.js +4 -0
  146. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.d.ts +11 -0
  147. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.js +80 -0
  148. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.d.ts +9 -0
  149. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.js +119 -0
  150. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.d.ts +13 -0
  151. package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.js +131 -0
  152. package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.d.ts +7 -0
  153. package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js +52 -0
  154. package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.d.ts +19 -0
  155. package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.js +108 -0
  156. package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.d.ts +8 -0
  157. package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.js +59 -0
  158. package/dist/cjs/server/adapters/nestjs/chat/dto/index.d.ts +3 -0
  159. package/dist/cjs/server/adapters/nestjs/chat/dto/index.js +9 -0
  160. package/dist/cjs/server/adapters/nestjs/chat/index.d.ts +3 -0
  161. package/dist/cjs/server/adapters/nestjs/chat/index.js +9 -0
  162. package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +4 -0
  163. package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.js +73 -0
  164. package/dist/cjs/server/adapters/nestjs/chat/ws-loader.d.ts +5 -0
  165. package/dist/cjs/server/adapters/nestjs/chat/ws-loader.js +72 -0
  166. package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.d.ts +6 -0
  167. package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.js +13 -0
  168. package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.d.ts +5 -0
  169. package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.js +15 -0
  170. package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.d.ts +6 -0
  171. package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.js +22 -0
  172. package/dist/cjs/server/adapters/nestjs/decorators/constants.d.ts +4 -0
  173. package/dist/cjs/server/adapters/nestjs/decorators/constants.js +7 -0
  174. package/dist/cjs/server/adapters/nestjs/index.d.ts +14 -0
  175. package/dist/cjs/server/adapters/nestjs/index.js +42 -0
  176. package/dist/cjs/server/adapters/nestjs/metadata.d.ts +39 -0
  177. package/dist/cjs/server/adapters/nestjs/metadata.js +36 -0
  178. package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.d.ts +36 -0
  179. package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.js +159 -0
  180. package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.d.ts +37 -0
  181. package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.js +44 -0
  182. package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.d.ts +28 -0
  183. package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.js +41 -0
  184. package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.d.ts +16 -0
  185. package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.js +117 -0
  186. package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.d.ts +26 -0
  187. package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.js +259 -0
  188. package/dist/cjs/server/adapters/nestjs/swagger.d.ts +7 -0
  189. package/dist/cjs/server/adapters/nestjs/swagger.js +39 -0
  190. package/dist/cjs/server/adapters/nextjs/context-helpers.d.ts +22 -0
  191. package/dist/cjs/server/adapters/nextjs/context-helpers.js +60 -0
  192. package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.d.ts +94 -0
  193. package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.js +965 -0
  194. package/dist/cjs/server/adapters/nextjs/filter-fallback-error.d.ts +11 -0
  195. package/dist/cjs/server/adapters/nextjs/filter-fallback-error.js +41 -0
  196. package/dist/cjs/server/adapters/nextjs/index.d.ts +8 -0
  197. package/dist/cjs/server/adapters/nextjs/index.js +22 -0
  198. package/dist/cjs/server/adapters/nextjs/prepare-model-messages.d.ts +58 -0
  199. package/dist/cjs/server/adapters/nextjs/prepare-model-messages.js +114 -0
  200. package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.d.ts +64 -0
  201. package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.js +489 -0
  202. package/dist/cjs/server/adapters/nextjs/server-action-helper.d.ts +7 -0
  203. package/dist/cjs/server/adapters/nextjs/server-action-helper.js +40 -0
  204. package/dist/cjs/server/adapters/nextjs/types.d.ts +246 -0
  205. package/dist/cjs/server/adapters/nextjs/types.js +2 -0
  206. package/dist/cjs/server/adapters/nextjs/with-ai-tool.d.ts +9 -0
  207. package/dist/cjs/server/adapters/nextjs/with-ai-tool.js +12 -0
  208. package/dist/cjs/server/core/followup-tool.d.ts +9 -0
  209. package/dist/cjs/server/core/followup-tool.js +82 -0
  210. package/dist/cjs/server/core/index.d.ts +139 -0
  211. package/dist/cjs/server/core/index.js +818 -0
  212. package/dist/cjs/server/core/intent-classifier.d.ts +94 -0
  213. package/dist/cjs/server/core/intent-classifier.js +324 -0
  214. package/dist/cjs/server/core/model-selector.d.ts +12 -0
  215. package/dist/cjs/server/core/model-selector.js +48 -0
  216. package/dist/cjs/server/core/module-router.d.ts +14 -0
  217. package/dist/cjs/server/core/module-router.js +110 -0
  218. package/dist/cjs/server/core/zod-compact.d.ts +18 -0
  219. package/dist/cjs/server/core/zod-compact.js +129 -0
  220. package/dist/cjs/server/index.d.ts +6 -0
  221. package/dist/cjs/server/index.js +28 -0
  222. package/dist/cjs/server/lancer/cache.d.ts +9 -0
  223. package/dist/cjs/server/lancer/cache.js +33 -0
  224. package/dist/cjs/server/lancer/client.d.ts +2 -0
  225. package/dist/cjs/server/lancer/client.js +279 -0
  226. package/dist/cjs/server/lancer/errors.d.ts +13 -0
  227. package/dist/cjs/server/lancer/errors.js +21 -0
  228. package/dist/cjs/server/lancer/index.d.ts +3 -0
  229. package/dist/cjs/server/lancer/index.js +7 -0
  230. package/dist/cjs/server/lancer/telemetry-buffer.d.ts +15 -0
  231. package/dist/cjs/server/lancer/telemetry-buffer.js +64 -0
  232. package/dist/cjs/server/lancer/types.d.ts +201 -0
  233. package/dist/cjs/server/lancer/types.js +5 -0
  234. package/dist/cjs/server/pii-shield/aegis-detector.d.ts +26 -0
  235. package/dist/cjs/server/pii-shield/aegis-detector.js +26 -0
  236. package/dist/cjs/server/pii-shield/create-pii-shield.d.ts +2 -0
  237. package/dist/cjs/server/pii-shield/create-pii-shield.js +191 -0
  238. package/dist/cjs/server/pii-shield/deep-walk.d.ts +1 -0
  239. package/dist/cjs/server/pii-shield/deep-walk.js +19 -0
  240. package/dist/cjs/server/pii-shield/fake-data.d.ts +5 -0
  241. package/dist/cjs/server/pii-shield/fake-data.js +170 -0
  242. package/dist/cjs/server/pii-shield/index.d.ts +4 -0
  243. package/dist/cjs/server/pii-shield/index.js +9 -0
  244. package/dist/cjs/server/pii-shield/leakage.d.ts +1 -0
  245. package/dist/cjs/server/pii-shield/leakage.js +15 -0
  246. package/dist/cjs/server/pii-shield/session-mapping.d.ts +12 -0
  247. package/dist/cjs/server/pii-shield/session-mapping.js +70 -0
  248. package/dist/cjs/server/pipeline.d.ts +26 -0
  249. package/dist/cjs/server/pipeline.js +127 -0
  250. package/dist/cjs/server/testing/approvals.d.ts +11 -0
  251. package/dist/cjs/server/testing/approvals.js +41 -0
  252. package/dist/cjs/server/testing/combination.d.ts +3 -0
  253. package/dist/cjs/server/testing/combination.js +83 -0
  254. package/dist/cjs/server/testing/create-test-suite.d.ts +29 -0
  255. package/dist/cjs/server/testing/create-test-suite.js +81 -0
  256. package/dist/cjs/server/testing/edge-cases.d.ts +8 -0
  257. package/dist/cjs/server/testing/edge-cases.js +277 -0
  258. package/dist/cjs/server/testing/guardrails.d.ts +14 -0
  259. package/dist/cjs/server/testing/guardrails.js +152 -0
  260. package/dist/cjs/server/testing/helpers.d.ts +14 -0
  261. package/dist/cjs/server/testing/helpers.js +119 -0
  262. package/dist/cjs/server/testing/index.d.ts +12 -0
  263. package/dist/cjs/server/testing/index.js +37 -0
  264. package/dist/cjs/server/testing/mock-executor.d.ts +8 -0
  265. package/dist/cjs/server/testing/mock-executor.js +40 -0
  266. package/dist/cjs/server/testing/regression.d.ts +7 -0
  267. package/dist/cjs/server/testing/regression.js +27 -0
  268. package/dist/cjs/server/testing/routing.d.ts +12 -0
  269. package/dist/cjs/server/testing/routing.js +63 -0
  270. package/dist/cjs/server/testing/schema-consistency.d.ts +6 -0
  271. package/dist/cjs/server/testing/schema-consistency.js +56 -0
  272. package/dist/cjs/server/testing/smoke.d.ts +11 -0
  273. package/dist/cjs/server/testing/smoke.js +64 -0
  274. package/dist/cjs/server/testing/types.d.ts +156 -0
  275. package/dist/cjs/server/testing/types.js +2 -0
  276. package/dist/cjs/types.d.ts +696 -0
  277. package/dist/cjs/types.js +91 -0
  278. package/dist/cli/commands/install-skills.d.ts +17 -0
  279. package/dist/cli/commands/install-skills.js +185 -0
  280. package/dist/cli/commands/install-skills.js.map +1 -0
  281. package/dist/cli/index.js +25 -0
  282. package/dist/cli/index.js.map +1 -1
  283. package/dist/react/components/ai-trigger-button.js +4 -6
  284. package/dist/react/components/ai-trigger-button.js.map +1 -1
  285. package/dist/react/components/recording-bar.js +4 -6
  286. package/dist/react/components/recording-bar.js.map +1 -1
  287. package/dist/react/components/wavesurfer-loader.d.ts +5 -0
  288. package/dist/react/components/wavesurfer-loader.js +34 -0
  289. package/dist/react/components/wavesurfer-loader.js.map +1 -0
  290. package/dist/server/adapters/nestjs/chat/ai-chat.module.d.ts +1 -1
  291. package/dist/server/adapters/nestjs/chat/ai-chat.module.js +3 -2
  292. package/dist/server/adapters/nestjs/chat/ai-chat.module.js.map +1 -1
  293. package/dist/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +1 -1
  294. package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js +10 -8
  295. package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js.map +1 -1
  296. package/dist/server/adapters/nestjs/chat/ws-loader.d.ts +5 -0
  297. package/dist/server/adapters/nestjs/chat/ws-loader.js +37 -0
  298. package/dist/server/adapters/nestjs/chat/ws-loader.js.map +1 -0
  299. package/dist/server/adapters/nextjs/create-ai-chat-handler.d.ts +16 -0
  300. package/dist/server/adapters/nextjs/create-ai-chat-handler.js +14 -3
  301. package/dist/server/adapters/nextjs/create-ai-chat-handler.js.map +1 -1
  302. package/dist/server/adapters/nextjs/filter-fallback-error.d.ts +11 -0
  303. package/dist/server/adapters/nextjs/filter-fallback-error.js +38 -0
  304. package/dist/server/adapters/nextjs/filter-fallback-error.js.map +1 -0
  305. package/openapi/package.json +5 -0
  306. package/package.json +66 -21
  307. package/react/langgraph/package.json +5 -0
  308. package/react/package.json +5 -0
  309. package/react/vercel/package.json +5 -0
  310. package/server/nestjs/package.json +5 -0
  311. package/server/nextjs/package.json +5 -0
  312. package/server/package.json +5 -0
  313. package/server/testing/package.json +5 -0
  314. package/skills/README.md +107 -0
  315. package/skills/building-glirastes-chat-ui/SKILL.md +378 -0
  316. package/skills/integrating-glirastes-nestjs/SKILL.md +346 -0
  317. package/skills/integrating-glirastes-nextjs/SKILL.md +306 -0
  318. package/skills/integrating-glirastes-nextjs-with-nestjs-backend/SKILL.md +359 -0
  319. package/skills/maintaining-glirastes-tools/SKILL.md +463 -0
@@ -0,0 +1,463 @@
1
+ ---
2
+ name: maintaining-glirastes-tools
3
+ description: Authoring and maintaining Glirastes AI tool definitions, modules, and the codegen pipeline. Use when defining ai-tool.ts files, refining tool descriptions, configuring intent modules, declaring UI patterns, validating coverage, or wiring CI gates.
4
+ version: 1.0.0
5
+ tags:
6
+ - glirastes
7
+ - ai-tools
8
+ - codegen
9
+ - cli
10
+ triggers:
11
+ - defineEndpointTool
12
+ - defineUiTool
13
+ - ai-tool.ts
14
+ - ai-ui-tool.ts
15
+ - tool definition
16
+ - module-meta
17
+ - intent module
18
+ - uiPattern
19
+ - generate-tools
20
+ - validate-tools
21
+ - coverage
22
+ - scaffold ai-tool
23
+ - tool authoring
24
+ - tool description
25
+ ---
26
+
27
+ # Maintaining Glirastes AI Tools
28
+
29
+ > **Framework wiring lives elsewhere:**
30
+ > - [integrating-glirastes-nextjs](../integrating-glirastes-nextjs/SKILL.md) — chat route + widget on Next.js
31
+ > - [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md) — `@AiTool` decorators + `AiChatModule`
32
+ > - [building-glirastes-chat-ui](../building-glirastes-chat-ui/SKILL.md) — chat UI customization
33
+
34
+ ## Two flavors of tool
35
+
36
+ A **tool** is something the AI can do. Glirastes ships two definitions; ~95% of real apps need only these two.
37
+
38
+ ### Endpoint Tool — calls your backend
39
+
40
+ ```ts
41
+ import { z } from 'zod';
42
+ import { defineEndpointTool } from 'glirastes';
43
+
44
+ export const aiTool = defineEndpointTool({
45
+ id: 'tasks.list', // unique dot-notation id
46
+ toolName: 'list_tasks', // unique snake_case name (what the LLM sees)
47
+ module: 'task_query', // intent module — controls routing & model tier
48
+ sharedWith: ['task_mutation'], // also available to these modules
49
+ description: `List tasks with an optional status filter.
50
+ WHEN to call: user asks to see tasks, or you need a task ID for a follow-up tool.
51
+ RETURNS: array of { id, title, status }.`,
52
+ method: 'GET',
53
+ path: '/api/tasks',
54
+ inputSchema: z.object({
55
+ status: z.enum(['open', 'done']).optional(),
56
+ }),
57
+ // outputSchema: z.array(...) — optional, helps the SDK validate responses
58
+ uiPattern: {
59
+ type: 'filter-and-navigate',
60
+ target: 'tasks',
61
+ filterMapping: { status: 'status' },
62
+ },
63
+ });
64
+ ```
65
+
66
+ ### UI Tool — fires a frontend action without an API call
67
+
68
+ ```ts
69
+ import { z } from 'zod';
70
+ import { defineUiTool } from 'glirastes';
71
+
72
+ export const openSettings = defineUiTool({
73
+ id: 'settings.open',
74
+ toolName: 'open_settings',
75
+ module: 'navigation',
76
+ description: 'Open the settings dialog for the current user.',
77
+ inputSchema: z.object({}),
78
+ uiAction: {
79
+ type: 'run-client-action',
80
+ actionId: 'settings.open',
81
+ },
82
+ });
83
+ ```
84
+
85
+ UI tools never round-trip to the server; the result is a `uiAction` payload that the frontend's `UiActionBus` dispatches to a registered `useAiClientAction(...)` handler.
86
+
87
+ ## Description anatomy — what the LLM actually reads
88
+
89
+ The description is the **only** signal the LLM has for *when* to call the tool. Treat it as a prompt fragment, not a docstring:
90
+
91
+ ```
92
+ description: `<one-line summary>.
93
+ WHEN to call: <concrete trigger phrasing the user might use>.
94
+ WHAT it returns: <shape>.
95
+ DO NOT: <common LLM mistakes — invented IDs, premature mutations, etc.>.`
96
+ ```
97
+
98
+ Real-world examples that drove down hallucinations:
99
+
100
+ ```ts
101
+ description: `Create a new task.
102
+ IMPORTANT: confirm the title with the user FIRST.
103
+ DO NOT INVENT IDs — call list_users / list_groups to resolve names.`
104
+ ```
105
+
106
+ ```ts
107
+ description: `List tasks with an optional status filter.
108
+ WHEN to call: user asks to see, browse, or filter tasks; or you need a task ID for another tool.
109
+ RETURNS: array of { id, title, status, assigneeId }.`
110
+ ```
111
+
112
+ ## Input schema — Zod, with `.describe()`
113
+
114
+ Every input field should have `.describe()` — the LLM uses it as field-level docs:
115
+
116
+ ```ts
117
+ inputSchema: z.object({
118
+ search: z.string().optional().describe('free-text search over title and description'),
119
+ status: z.enum(['open', 'done']).optional().describe('filter by lifecycle status'),
120
+ assigneeId: z.string().uuid().optional().describe('user UUID — never invent, look up via find_user'),
121
+ }),
122
+ ```
123
+
124
+ Path params (`:id` in the route): if the route is `/api/tasks/:id`, include `id` in the input schema. The SDK substitutes it into the URL at call time. (NestJS decorator mode auto-extracts these from `@Param()` — see [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md).)
125
+
126
+ ## Approval flow
127
+
128
+ `needsApproval` controls whether mutations show an approval card before executing:
129
+
130
+ ```ts
131
+ needsApproval: true, // always require approval
132
+ needsApproval: false, // never require approval
133
+ needsApproval: (input, ctx) => input.amount > 1000, // dynamic
134
+ ```
135
+
136
+ **Defaults** (when `needsApproval` is omitted):
137
+ - `GET` → `false`
138
+ - `POST` / `PATCH` / `PUT` / `DELETE` → `true`
139
+
140
+ So mutations get approval cards by default; you only specify when you want to override.
141
+
142
+ ## UI Patterns — declarative reactions
143
+
144
+ After a tool runs, what should the UI do? Glirastes ships 5 patterns. Use them instead of writing custom dispatch code:
145
+
146
+ | Pattern | Use case | Example |
147
+ |---|---|---|
148
+ | `filter-and-navigate` | GET tools that map a filter to a page URL | `{ type: 'filter-and-navigate', target: 'tasks', filterMapping: { status: 'status' } }` |
149
+ | `open-detail` | After lookup or creation, open a detail view | `{ type: 'open-detail', entity: 'task', idField: 'taskId' }` |
150
+ | `open-dialog` | Open a modal (create / edit) | `{ type: 'open-dialog', dialog: 'create-task' }` |
151
+ | `refresh` | Refresh a region after mutation | `{ type: 'refresh', target: 'tasks' }` |
152
+ | `toast` | Show a notification | `{ type: 'toast', message: '$message', variant: 'success' }` |
153
+
154
+ Patterns support `$variable` placeholders that interpolate from the **response** body (`$id`, `$message`) or from the **input** (`$status`).
155
+
156
+ ### Compound patterns
157
+
158
+ Pass an array for multiple effects (toast + refresh after a mutation):
159
+
160
+ ```ts
161
+ uiPattern: [
162
+ { type: 'toast', message: '$message', variant: 'success' },
163
+ { type: 'refresh', target: 'tasks' },
164
+ ],
165
+ ```
166
+
167
+ Each entry is processed sequentially. Patterns with unmet `condition` fields are skipped — others still fire.
168
+
169
+ ### Manual `uiActionOnSuccess` (escape hatch)
170
+
171
+ When no built-in pattern fits, emit a raw action:
172
+
173
+ ```ts
174
+ uiActionOnSuccess: {
175
+ type: 'run-client-action',
176
+ actionId: 'tasks.celebrate',
177
+ payload: { taskId: '$id' },
178
+ },
179
+ ```
180
+
181
+ Frontend handler (anywhere a relevant component mounts):
182
+
183
+ ```tsx
184
+ import { useAiClientAction } from 'glirastes/react';
185
+
186
+ useAiClientAction('tasks.celebrate', (payload) => {
187
+ fireConfetti();
188
+ });
189
+ ```
190
+
191
+ **Priority** when multiple are present: response `uiAction` field > `uiPattern` > `uiActionOnSuccess`.
192
+
193
+ ## Module definitions (intent routing)
194
+
195
+ > Module-based routing is a **Pro feature** — it requires `GLIRASTES_API_KEY` and a `lancer` client (intent classification via the Glirastes platform). Without it, all tools are exposed to the LLM on every request (free-tier mode). Module definitions are still useful pre-Pro: you author them upfront, they activate when you flip the env var.
196
+
197
+ Modules group tools by intent. Define them in `src/lib/ai/module-meta.ts`:
198
+
199
+ ```ts
200
+ import type { ModuleMeta } from 'glirastes';
201
+
202
+ export const moduleMeta: Record<string, ModuleMeta> = {
203
+ task_query: {
204
+ classification: {
205
+ hint: 'User asks to view, list, or filter tasks (NOT create/modify).',
206
+ examples: ['show me open tasks', 'what is done?', 'filter by status'],
207
+ },
208
+ execution: {
209
+ maxSteps: 2, // LLM tool-call rounds for this module
210
+ contextWindow: 12, // messages sent to the LLM
211
+ modelTier: 'fast', // fast | standard | powerful
212
+ },
213
+ systemPrompt: `Focus: list and filter tasks.
214
+ For filter requests use list_tasks with appropriate status.`,
215
+ },
216
+ task_mutation: {
217
+ classification: {
218
+ hint: 'User asks to create, update, delete, or assign tasks.',
219
+ examples: ['create a task', 'mark as done', 'assign to Alice'],
220
+ },
221
+ execution: { maxSteps: 4, contextWindow: 16, modelTier: 'standard' },
222
+ systemPrompt: `Focus: mutate tasks.
223
+ NEVER invent IDs — use list_tasks / find_user first.`,
224
+ },
225
+ };
226
+ ```
227
+
228
+ **Field cheat-sheet:**
229
+ - `classification.hint` + `examples` → auto-generate the intent classifier prompt
230
+ - `execution.modelTier` → which model tier handles the request (`fast` ≈ gpt-4o-mini, `standard` ≈ Sonnet, `powerful` ≈ Opus)
231
+ - `execution.maxSteps` → cap LLM tool-call rounds (cost control)
232
+ - `systemPrompt` → appended to the system prompt for this module only
233
+
234
+ ### Related modules (medium-confidence routing)
235
+
236
+ When the intent classifier is uncertain (confidence 0.7–0.85), the router can include tools from related modules:
237
+
238
+ ```ts
239
+ const moduleMeta: Record<string, ModuleMeta> = {
240
+ task_query: { /* ... */, related: ['task_mutation'] },
241
+ task_mutation: { /* ... */, related: ['task_query'] },
242
+ };
243
+ ```
244
+
245
+ ## Codegen pipeline — scale to 50+ tools
246
+
247
+ Hand-importing every tool into the chat route doesn't scale. The CLI generates a registry from co-located `ai-tool.ts` files.
248
+
249
+ ### Recommended `package.json` scripts
250
+
251
+ ```json
252
+ {
253
+ "scripts": {
254
+ "predev": "glirastes generate-tools --quiet",
255
+ "prebuild": "glirastes generate-tools --quiet",
256
+ "ai:scaffold": "glirastes scaffold",
257
+ "ai:generate": "glirastes generate-tools",
258
+ "ai:coverage": "glirastes coverage",
259
+ "ai:coverage:ci": "glirastes coverage --ci",
260
+ "ai:validate": "glirastes validate-tools",
261
+ "ai:validate:ci": "glirastes validate-tools --ci",
262
+ "ai:test": "glirastes test"
263
+ }
264
+ }
265
+ ```
266
+
267
+ The `predev` / `prebuild` hooks regenerate the registry on every dev start and CI build — the generated files become source-of-truth.
268
+
269
+ ### Output
270
+
271
+ After `glirastes generate-tools`:
272
+
273
+ ```
274
+ src/generated/ai-tools/
275
+ ├── endpoint.generated.ts # exports `endpointToolRegistry`
276
+ ├── ui.generated.ts # exports `uiToolRegistry`
277
+ ├── modules.generated.ts # exports `toolsByModule`, `moduleTypes`, `relatedModules`,
278
+ │ # `IntentType`, `IntentSchema`, `buildIntentModule`,
279
+ │ # and (with --meta) `INTENT_MODULES`, `CLASSIFICATION_PROMPT`
280
+ └── action-ids.generated.ts # union of action IDs (for type-safe useAiClientAction)
281
+ ```
282
+
283
+ Import in your chat route:
284
+
285
+ ```ts
286
+ import { endpointToolRegistry } from '@/generated/ai-tools/endpoint.generated';
287
+ import { uiToolRegistry } from '@/generated/ai-tools/ui.generated';
288
+
289
+ const tools = { ...endpointToolRegistry, ...uiToolRegistry };
290
+ ```
291
+
292
+ ### Module bridge file (when using intent routing)
293
+
294
+ The codegen produces raw module data (`toolsByModule`, `moduleTypes`). The pipeline (`createAiPipeline` / `createAiTestSuite`) consumes a `ModuleDefinition[]` shape. Author a thin bridge file that joins your `module-meta.ts` with the generated metadata:
295
+
296
+ ```ts
297
+ // src/lib/ai/module-definitions.ts
298
+ import type { ModuleDefinition } from 'glirastes';
299
+ import {
300
+ toolsByModule,
301
+ moduleTypes,
302
+ relatedModules,
303
+ type IntentType,
304
+ } from '@/generated/ai-tools/modules.generated';
305
+ import { moduleMeta } from '@/lib/ai/module-meta';
306
+
307
+ function buildModuleDefinition(type: IntentType): ModuleDefinition {
308
+ const meta = moduleMeta[type];
309
+ return {
310
+ id: type,
311
+ name: type.split('_').map((w) => w[0].toUpperCase() + w.slice(1)).join(' '),
312
+ description: meta.classification.hint,
313
+ tools: [...toolsByModule[type]],
314
+ executionDefaults: {
315
+ contextWindow: meta.execution.contextWindow,
316
+ modelTier: meta.execution.modelTier,
317
+ },
318
+ classification: meta.classification,
319
+ systemPrompt: meta.systemPrompt,
320
+ };
321
+ }
322
+
323
+ export const modules: ModuleDefinition[] = moduleTypes.map(buildModuleDefinition);
324
+ export { relatedModules };
325
+ ```
326
+
327
+ The chat handler and the test suite both import `modules` from this file.
328
+
329
+ ### Module metadata flag
330
+
331
+ If your `module-meta.ts` lives at a non-default path:
332
+
333
+ ```bash
334
+ glirastes generate-tools --meta @/lib/ai/module-meta
335
+ ```
336
+
337
+ `@/...` resolves to your TS path alias.
338
+
339
+ ## All CLI commands
340
+
341
+ | Command | Purpose | Common flags |
342
+ |---|---|---|
343
+ | `glirastes scaffold --route <file>` | Bootstrap `ai-tool.ts` next to a `route.ts` from method, path params, body fields | `--dry-run`, `--force`, `--root <dir>` |
344
+ | `glirastes generate-tools` | Run all generators (endpoint + UI + modules + action IDs) | `--meta <import-path>`, `--quiet` |
345
+ | `glirastes generate-endpoint-tools` | Endpoint registry only | `--quiet` |
346
+ | `glirastes generate-ui-tools` | UI tool registry + action IDs | `--quiet` |
347
+ | `glirastes generate-modules` | Module/intent registry only | `--meta <import-path>` |
348
+ | `glirastes generate-auto` | Auto-detect repo layout, choose generator + skill/MCP output | — |
349
+ | `glirastes generate <openapi.yaml>` | Generate endpoint tools from an OpenAPI spec (good for legacy backends) | `--out <file>` |
350
+ | `glirastes validate <openapi.yaml>` | Validate `x-ai` extensions in an OpenAPI spec | `--ci` |
351
+ | `glirastes validate-tools` | Validate naming, duplicates, missing approvals, path mismatches | `--ci`, `--fix`, `--quiet` |
352
+ | `glirastes coverage` | Routes without `ai-tool.ts`, orphan handlers, unhandled action IDs | `--ci`, `--quiet` |
353
+ | `glirastes test` | Scaffold an AI behaviour test file (Vitest, no LLM call) | `--output <file>`, `--force`, `--dry-run` |
354
+ | `glirastes install-skills` | Install the bundled agent skills (this directory) into a target like `.claude/skills` | `--target <dir>`, `--stack nextjs\|nestjs\|nextjs+nestjs\|all`, `--symlink`, `--force`, `--dry-run` |
355
+ | `glirastes generate-skills` | Export the registry as Claude Code / Codex skill files (so *agents* can call your tools) | `--app-name`, `--base-url`, `--auth bearer\|api-key\|oauth2\|cookie`, `--token-env`, `--format markdown\|json\|both`, `--output-dir`, `--sync`, `--remote` |
356
+ | `glirastes generate-mcp-server` | Export the registry as a standalone MCP server project | `--app-name`, `--base-url`, `--auth ...` |
357
+ | `glirastes check-upgrade` | Compare current code against SDK release notes; flag breaking changes | `--from-version <ver>` |
358
+ | `glirastes sync` | Upload tool schemas to the Glirastes platform (Pro registry) | `--api-key` (or `GLIRASTES_API_KEY` env), `--url` |
359
+
360
+ ### CLI flag deep-dive
361
+
362
+ | Flag | Effect |
363
+ |---|---|
364
+ | `--quiet` | One-line output — ideal for `predev`/`prebuild` hooks |
365
+ | `--ci` | Exit code 1 on any issue — for CI pipelines |
366
+ | `--fix` | On `validate-tools`, prints quick-fix scaffold commands per missing tool |
367
+ | `--dry-run` | On `scaffold` / `test`, preview generated code without writing |
368
+ | `--force` | On `scaffold` / `test`, overwrite existing file |
369
+ | `--meta <path>` | Path to `module-meta.ts` (uses TS path aliases like `@/lib/ai/module-meta`) |
370
+ | `--app-name` (skills/mcp) | Name for the skill or MCP server |
371
+ | `--base-url` (skills/mcp) | Backend base URL the agent should call |
372
+ | `--auth bearer` (skills/mcp) | Auth strategy. `bearer` reads token from env var (default `API_TOKEN`); `api-key` uses an API key header; `oauth2` adds OAuth flow scaffolding; `cookie` uses session cookies |
373
+ | `--token-env <NAME>` | For bearer auth, the env var the agent reads the token from |
374
+ | `--sync` (skills) | Upload to Glirastes platform after generating |
375
+ | `--remote` (skills) | `--sync` + trigger remote regeneration on the platform |
376
+
377
+ ### Coverage report — what it catches
378
+
379
+ | Section | Catches |
380
+ |---|---|
381
+ | **Uncovered Routes** | `route.ts` without an `ai-tool.ts` next to it (with `glirastes scaffold` suggestion) |
382
+ | **Uncovered Components** | Component directory without an `ai-ui-tool.ts` |
383
+ | **Missing Handlers** | UI tool defines `actionId` X, but no `useAiClientAction('X')` found in `.tsx` files |
384
+ | **Orphan Handlers** | `useAiClientAction('X')` exists, but no UI tool defines `actionId: 'X'` |
385
+
386
+ ### Validation report — severities
387
+
388
+ - **Errors** (block CI with `--ci`): orphaned `ai-tool.ts` without a `route.ts`, missing exports, malformed Zod schemas
389
+ - **Warnings**: routes without an `ai-tool.ts` (with scaffold suggestion), path mismatches between `path` and route filesystem location
390
+ - **Info**: tools without a `module` field (with module-assignment hint)
391
+
392
+ Add `--fix` to get a consolidated quick-fix block at the bottom.
393
+
394
+ ### Excluding routes from coverage
395
+
396
+ Skip a route from coverage and validation:
397
+
398
+ - File-level: `// @ai-ignore` at the top of `route.ts`
399
+ - Directory-level: a `.ai-ignore` file in any directory excludes the entire subtree
400
+
401
+ ## Testing — deterministic, no LLM
402
+
403
+ `glirastes test` scaffolds a Vitest test file using `glirastes/server/testing`:
404
+
405
+ ```ts
406
+ import { createAiTestSuite } from 'glirastes/server/testing';
407
+ import { modules } from '@/lib/ai/module-definitions';
408
+ import { endpointToolRegistry } from '@/generated/ai-tools/endpoint.generated';
409
+ import { uiToolRegistry } from '@/generated/ai-tools/ui.generated';
410
+
411
+ const suite = createAiTestSuite({
412
+ tools: { ...endpointToolRegistry, ...uiToolRegistry },
413
+ modules,
414
+ });
415
+
416
+ suite.smokeTest(); // module completeness, naming, no duplicates
417
+ suite.guardrailsTest(); // injection, length, sanitization
418
+ suite.approvalTest(); // POST/DELETE → needsApproval:true (default)
419
+ suite.routingTest([
420
+ { input: 'show tasks', expectModule: 'task_query', expectTools: ['list_tasks'] },
421
+ { input: 'create a task: review PR', expectModule: 'task_mutation' },
422
+ ]);
423
+
424
+ // Low-level: simulate the pipeline directly
425
+ const result = await suite.simulatePipeline('list my tasks', {
426
+ intent: 'task_query', confidence: 0.95,
427
+ });
428
+ expect(result.tools).toContain('list_tasks');
429
+ ```
430
+
431
+ **When to update tests:**
432
+ - New tool → add a routing case
433
+ - Tool moved to a different module → update `expectModule`
434
+ - Tool renamed → update `expectTools`
435
+ - New mutation → confirm `needsApproval: true`
436
+ - New module → add smoke + routing cases
437
+
438
+ ## Naming conventions
439
+
440
+ | Field | Format | Example |
441
+ |---|---|---|
442
+ | `id` | dot-notation, `<resource>.<action>` | `tasks.list`, `tasks.bulk.update`, `users.search` |
443
+ | `toolName` | snake_case | `list_tasks`, `bulk_update_tasks`, `find_user` |
444
+ | `module` | snake_case noun phrase | `task_query`, `task_mutation`, `navigation` |
445
+ | `actionId` (UI) | dot-notation, `<entity>.<action>` | `task-details.open`, `tasks.refresh` |
446
+
447
+ Both `id` and `toolName` must be unique across the whole registry — `glirastes validate-tools` enforces this.
448
+
449
+ ## After every change — run the validation chain
450
+
451
+ 1. `npm run ai:generate` — regenerate registries
452
+ 2. `npm run ai:validate` — naming, duplicates, missing approvals, path mismatches
453
+ 3. `npm run ai:coverage` — routes without ai-tool.ts, orphan handlers
454
+ 4. `npm run ai:test` (if you have behaviour tests)
455
+ 5. `npm run build` — final type-check + Next.js / NestJS build
456
+
457
+ CI: add `ai:coverage:ci` and `ai:validate:ci` as required steps.
458
+
459
+ ## What this skill does NOT cover
460
+
461
+ - **Framework wiring** (chat route, decorators, `AiChatModule`) — see [integrating-glirastes-nextjs](../integrating-glirastes-nextjs/SKILL.md) or [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md)
462
+ - **Chat UI customization** (theming, mentions, voice, approval cards) — see [building-glirastes-chat-ui](../building-glirastes-chat-ui/SKILL.md)
463
+ - **Glirastes platform deep-dive** (PII Shield via `createPiiShield`, intent routing via `createLancer`, custom guardrails, service degradation) — opt in via `GLIRASTES_API_KEY`; documented separately at [docs.chainmatics.de](https://chainmatics.de)