glirastes 0.1.0
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.
- package/CHANGELOG.md +468 -0
- package/README.md +651 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +34 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/check-upgrade.d.ts +15 -0
- package/dist/cli/commands/check-upgrade.js +138 -0
- package/dist/cli/commands/check-upgrade.js.map +1 -0
- package/dist/cli/commands/test.d.ts +8 -0
- package/dist/cli/commands/test.js +76 -0
- package/dist/cli/commands/test.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +609 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/changelog-parser.d.ts +13 -0
- package/dist/cli/utils/changelog-parser.js +89 -0
- package/dist/cli/utils/changelog-parser.js.map +1 -0
- package/dist/cli/utils/commit-parser.d.ts +8 -0
- package/dist/cli/utils/commit-parser.js +23 -0
- package/dist/cli/utils/commit-parser.js.map +1 -0
- package/dist/cli/utils/gap-detector.d.ts +14 -0
- package/dist/cli/utils/gap-detector.js +65 -0
- package/dist/cli/utils/gap-detector.js.map +1 -0
- package/dist/cli/utils/get-cli-version.d.ts +2 -0
- package/dist/cli/utils/get-cli-version.js +10 -0
- package/dist/cli/utils/get-cli-version.js.map +1 -0
- package/dist/codegen/asset-sync.d.ts +20 -0
- package/dist/codegen/asset-sync.js +26 -0
- package/dist/codegen/asset-sync.js.map +1 -0
- package/dist/codegen/coverage.d.ts +66 -0
- package/dist/codegen/coverage.js +372 -0
- package/dist/codegen/coverage.js.map +1 -0
- package/dist/codegen/endpoint-scanner.d.ts +16 -0
- package/dist/codegen/endpoint-scanner.js +161 -0
- package/dist/codegen/endpoint-scanner.js.map +1 -0
- package/dist/codegen/format.d.ts +17 -0
- package/dist/codegen/format.js +28 -0
- package/dist/codegen/format.js.map +1 -0
- package/dist/codegen/fs-utils.d.ts +45 -0
- package/dist/codegen/fs-utils.js +155 -0
- package/dist/codegen/fs-utils.js.map +1 -0
- package/dist/codegen/index.d.ts +13 -0
- package/dist/codegen/index.js +13 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/mcp-generator.d.ts +50 -0
- package/dist/codegen/mcp-generator.js +801 -0
- package/dist/codegen/mcp-generator.js.map +1 -0
- package/dist/codegen/module-generator.d.ts +11 -0
- package/dist/codegen/module-generator.js +351 -0
- package/dist/codegen/module-generator.js.map +1 -0
- package/dist/codegen/nestjs-scanner.d.ts +43 -0
- package/dist/codegen/nestjs-scanner.js +239 -0
- package/dist/codegen/nestjs-scanner.js.map +1 -0
- package/dist/codegen/output-recommender.d.ts +23 -0
- package/dist/codegen/output-recommender.js +31 -0
- package/dist/codegen/output-recommender.js.map +1 -0
- package/dist/codegen/scaffolder.d.ts +36 -0
- package/dist/codegen/scaffolder.js +259 -0
- package/dist/codegen/scaffolder.js.map +1 -0
- package/dist/codegen/skill-generator.d.ts +49 -0
- package/dist/codegen/skill-generator.js +965 -0
- package/dist/codegen/skill-generator.js.map +1 -0
- package/dist/codegen/types.d.ts +52 -0
- package/dist/codegen/types.js +14 -0
- package/dist/codegen/types.js.map +1 -0
- package/dist/codegen/ui-scanner.d.ts +24 -0
- package/dist/codegen/ui-scanner.js +197 -0
- package/dist/codegen/ui-scanner.js.map +1 -0
- package/dist/codegen/validator.d.ts +35 -0
- package/dist/codegen/validator.js +256 -0
- package/dist/codegen/validator.js.map +1 -0
- package/dist/openapi/demo-generate.d.ts +1 -0
- package/dist/openapi/demo-generate.js +15 -0
- package/dist/openapi/demo-generate.js.map +1 -0
- package/dist/openapi/index.d.ts +78 -0
- package/dist/openapi/index.js +341 -0
- package/dist/openapi/index.js.map +1 -0
- package/dist/react/audio-worklet-processor.d.ts +9 -0
- package/dist/react/audio-worklet-processor.js +28 -0
- package/dist/react/audio-worklet-processor.js.map +1 -0
- package/dist/react/bridges/rest-session-bridge.d.ts +113 -0
- package/dist/react/bridges/rest-session-bridge.js +207 -0
- package/dist/react/bridges/rest-session-bridge.js.map +1 -0
- package/dist/react/components/ai-chat-panel.d.ts +12 -0
- package/dist/react/components/ai-chat-panel.js +65 -0
- package/dist/react/components/ai-chat-panel.js.map +1 -0
- package/dist/react/components/ai-trigger-button.d.ts +2 -0
- package/dist/react/components/ai-trigger-button.js +239 -0
- package/dist/react/components/ai-trigger-button.js.map +1 -0
- package/dist/react/components/approval-card.d.ts +9 -0
- package/dist/react/components/approval-card.js +22 -0
- package/dist/react/components/approval-card.js.map +1 -0
- package/dist/react/components/bulk-approval-card.d.ts +9 -0
- package/dist/react/components/bulk-approval-card.js +34 -0
- package/dist/react/components/bulk-approval-card.js.map +1 -0
- package/dist/react/components/chat-input.d.ts +10 -0
- package/dist/react/components/chat-input.js +58 -0
- package/dist/react/components/chat-input.js.map +1 -0
- package/dist/react/components/chat-window.d.ts +2 -0
- package/dist/react/components/chat-window.js +132 -0
- package/dist/react/components/chat-window.js.map +1 -0
- package/dist/react/components/confirm-dialog.d.ts +32 -0
- package/dist/react/components/confirm-dialog.js +46 -0
- package/dist/react/components/confirm-dialog.js.map +1 -0
- package/dist/react/components/floating-chat-ui.d.ts +84 -0
- package/dist/react/components/floating-chat-ui.js +161 -0
- package/dist/react/components/floating-chat-ui.js.map +1 -0
- package/dist/react/components/mention-chip.d.ts +16 -0
- package/dist/react/components/mention-chip.js +39 -0
- package/dist/react/components/mention-chip.js.map +1 -0
- package/dist/react/components/mention-input.d.ts +8 -0
- package/dist/react/components/mention-input.js +115 -0
- package/dist/react/components/mention-input.js.map +1 -0
- package/dist/react/components/message-bubble.d.ts +11 -0
- package/dist/react/components/message-bubble.js +123 -0
- package/dist/react/components/message-bubble.js.map +1 -0
- package/dist/react/components/message-list.d.ts +8 -0
- package/dist/react/components/message-list.js +50 -0
- package/dist/react/components/message-list.js.map +1 -0
- package/dist/react/components/pipeline-timeline.d.ts +7 -0
- package/dist/react/components/pipeline-timeline.js +70 -0
- package/dist/react/components/pipeline-timeline.js.map +1 -0
- package/dist/react/components/recording-bar.d.ts +2 -0
- package/dist/react/components/recording-bar.js +81 -0
- package/dist/react/components/recording-bar.js.map +1 -0
- package/dist/react/components/recording-controls.d.ts +18 -0
- package/dist/react/components/recording-controls.js +35 -0
- package/dist/react/components/recording-controls.js.map +1 -0
- package/dist/react/components/rich-mention-input.d.ts +2 -0
- package/dist/react/components/rich-mention-input.js +569 -0
- package/dist/react/components/rich-mention-input.js.map +1 -0
- package/dist/react/components/session-switcher.d.ts +14 -0
- package/dist/react/components/session-switcher.js +131 -0
- package/dist/react/components/session-switcher.js.map +1 -0
- package/dist/react/components/suggestion-bar.d.ts +9 -0
- package/dist/react/components/suggestion-bar.js +45 -0
- package/dist/react/components/suggestion-bar.js.map +1 -0
- package/dist/react/components/suggestion-chip.d.ts +9 -0
- package/dist/react/components/suggestion-chip.js +12 -0
- package/dist/react/components/suggestion-chip.js.map +1 -0
- package/dist/react/components/voice-input-addon.d.ts +13 -0
- package/dist/react/components/voice-input-addon.js +29 -0
- package/dist/react/components/voice-input-addon.js.map +1 -0
- package/dist/react/components/voice-input-button.d.ts +2 -0
- package/dist/react/components/voice-input-button.js +53 -0
- package/dist/react/components/voice-input-button.js.map +1 -0
- package/dist/react/hooks/use-ai-chat.d.ts +22 -0
- package/dist/react/hooks/use-ai-chat.js +49 -0
- package/dist/react/hooks/use-ai-chat.js.map +1 -0
- package/dist/react/hooks/use-approvals.d.ts +23 -0
- package/dist/react/hooks/use-approvals.js +61 -0
- package/dist/react/hooks/use-approvals.js.map +1 -0
- package/dist/react/hooks/use-deepgram-transcription.d.ts +2 -0
- package/dist/react/hooks/use-deepgram-transcription.js +327 -0
- package/dist/react/hooks/use-deepgram-transcription.js.map +1 -0
- package/dist/react/hooks/use-drag-resize-panel.d.ts +48 -0
- package/dist/react/hooks/use-drag-resize-panel.js +306 -0
- package/dist/react/hooks/use-drag-resize-panel.js.map +1 -0
- package/dist/react/hooks/use-draggable-position.d.ts +25 -0
- package/dist/react/hooks/use-draggable-position.js +132 -0
- package/dist/react/hooks/use-draggable-position.js.map +1 -0
- package/dist/react/hooks/use-keyboard-shortcut.d.ts +20 -0
- package/dist/react/hooks/use-keyboard-shortcut.js +91 -0
- package/dist/react/hooks/use-keyboard-shortcut.js.map +1 -0
- package/dist/react/hooks/use-mentions.d.ts +23 -0
- package/dist/react/hooks/use-mentions.js +40 -0
- package/dist/react/hooks/use-mentions.js.map +1 -0
- package/dist/react/hooks/use-suggestions.d.ts +22 -0
- package/dist/react/hooks/use-suggestions.js +37 -0
- package/dist/react/hooks/use-suggestions.js.map +1 -0
- package/dist/react/index.d.ts +43 -0
- package/dist/react/index.js +53 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/provider/ai-chat-provider.d.ts +45 -0
- package/dist/react/provider/ai-chat-provider.js +1021 -0
- package/dist/react/provider/ai-chat-provider.js.map +1 -0
- package/dist/react/provider/chat-context.d.ts +84 -0
- package/dist/react/provider/chat-context.js +10 -0
- package/dist/react/provider/chat-context.js.map +1 -0
- package/dist/react/styles.css +897 -0
- package/dist/react/template.d.ts +84 -0
- package/dist/react/template.js +83 -0
- package/dist/react/template.js.map +1 -0
- package/dist/react/themes.d.ts +24 -0
- package/dist/react/themes.js +269 -0
- package/dist/react/themes.js.map +1 -0
- package/dist/react/transports/langgraph/index.d.ts +2 -0
- package/dist/react/transports/langgraph/index.js +3 -0
- package/dist/react/transports/langgraph/index.js.map +1 -0
- package/dist/react/transports/langgraph/langgraph-ai-chat.d.ts +62 -0
- package/dist/react/transports/langgraph/langgraph-ai-chat.js +92 -0
- package/dist/react/transports/langgraph/langgraph-ai-chat.js.map +1 -0
- package/dist/react/transports/langgraph.d.ts +71 -0
- package/dist/react/transports/langgraph.js +366 -0
- package/dist/react/transports/langgraph.js.map +1 -0
- package/dist/react/transports/vercel/index.d.ts +2 -0
- package/dist/react/transports/vercel/index.js +3 -0
- package/dist/react/transports/vercel/index.js.map +1 -0
- package/dist/react/transports/vercel/vercel-ai-chat.d.ts +49 -0
- package/dist/react/transports/vercel/vercel-ai-chat.js +79 -0
- package/dist/react/transports/vercel/vercel-ai-chat.js.map +1 -0
- package/dist/react/transports/vercel.d.ts +30 -0
- package/dist/react/transports/vercel.js +67 -0
- package/dist/react/transports/vercel.js.map +1 -0
- package/dist/react/types.d.ts +750 -0
- package/dist/react/types.js +2 -0
- package/dist/react/types.js.map +1 -0
- package/dist/react/ui.d.ts +73 -0
- package/dist/react/ui.js +170 -0
- package/dist/react/ui.js.map +1 -0
- package/dist/react/utils/create-approval-description.d.ts +53 -0
- package/dist/react/utils/create-approval-description.js +120 -0
- package/dist/react/utils/create-approval-description.js.map +1 -0
- package/dist/react/utils/create-tool-result-handler.d.ts +90 -0
- package/dist/react/utils/create-tool-result-handler.js +166 -0
- package/dist/react/utils/create-tool-result-handler.js.map +1 -0
- package/dist/react/utils/mention-markup.d.ts +13 -0
- package/dist/react/utils/mention-markup.js +111 -0
- package/dist/react/utils/mention-markup.js.map +1 -0
- package/dist/react/utils/merge-pipeline-steps.d.ts +19 -0
- package/dist/react/utils/merge-pipeline-steps.js +79 -0
- package/dist/react/utils/merge-pipeline-steps.js.map +1 -0
- package/dist/react/utils/sanitize-stored-messages.d.ts +23 -0
- package/dist/react/utils/sanitize-stored-messages.js +50 -0
- package/dist/react/utils/sanitize-stored-messages.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/ai-chat-auth.guard.d.ts +10 -0
- package/dist/server/adapters/nestjs/chat/ai-chat-auth.guard.js +40 -0
- package/dist/server/adapters/nestjs/chat/ai-chat-auth.guard.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/ai-chat-module-options.interface.d.ts +32 -0
- package/dist/server/adapters/nestjs/chat/ai-chat-module-options.interface.js +2 -0
- package/dist/server/adapters/nestjs/chat/ai-chat-module-options.interface.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.controller.d.ts +11 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.controller.js +78 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.controller.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.module.d.ts +9 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.module.js +116 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.module.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.service.d.ts +13 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.service.js +129 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.service.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/dto/ai-chat-request.dto.d.ts +7 -0
- package/dist/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js +49 -0
- package/dist/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/dto/chat-message-part.dto.d.ts +19 -0
- package/dist/server/adapters/nestjs/chat/dto/chat-message-part.dto.js +105 -0
- package/dist/server/adapters/nestjs/chat/dto/chat-message-part.dto.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/dto/chat-message.dto.d.ts +8 -0
- package/dist/server/adapters/nestjs/chat/dto/chat-message.dto.js +56 -0
- package/dist/server/adapters/nestjs/chat/dto/chat-message.dto.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/dto/index.d.ts +3 -0
- package/dist/server/adapters/nestjs/chat/dto/index.js +4 -0
- package/dist/server/adapters/nestjs/chat/dto/index.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/index.d.ts +3 -0
- package/dist/server/adapters/nestjs/chat/index.js +3 -0
- package/dist/server/adapters/nestjs/chat/index.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +4 -0
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js +69 -0
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js.map +1 -0
- package/dist/server/adapters/nestjs/decorators/ai-module.decorator.d.ts +6 -0
- package/dist/server/adapters/nestjs/decorators/ai-module.decorator.js +11 -0
- package/dist/server/adapters/nestjs/decorators/ai-module.decorator.js.map +1 -0
- package/dist/server/adapters/nestjs/decorators/ai-param.decorator.d.ts +5 -0
- package/dist/server/adapters/nestjs/decorators/ai-param.decorator.js +13 -0
- package/dist/server/adapters/nestjs/decorators/ai-param.decorator.js.map +1 -0
- package/dist/server/adapters/nestjs/decorators/ai-tool.decorator.d.ts +6 -0
- package/dist/server/adapters/nestjs/decorators/ai-tool.decorator.js +20 -0
- package/dist/server/adapters/nestjs/decorators/ai-tool.decorator.js.map +1 -0
- package/dist/server/adapters/nestjs/decorators/constants.d.ts +4 -0
- package/dist/server/adapters/nestjs/decorators/constants.js +5 -0
- package/dist/server/adapters/nestjs/decorators/constants.js.map +1 -0
- package/dist/server/adapters/nestjs/index.d.ts +14 -0
- package/dist/server/adapters/nestjs/index.js +20 -0
- package/dist/server/adapters/nestjs/index.js.map +1 -0
- package/dist/server/adapters/nestjs/metadata.d.ts +39 -0
- package/dist/server/adapters/nestjs/metadata.js +30 -0
- package/dist/server/adapters/nestjs/metadata.js.map +1 -0
- package/dist/server/adapters/nestjs/module/ai-tools-explorer.service.d.ts +36 -0
- package/dist/server/adapters/nestjs/module/ai-tools-explorer.service.js +156 -0
- package/dist/server/adapters/nestjs/module/ai-tools-explorer.service.js.map +1 -0
- package/dist/server/adapters/nestjs/module/ai-tools.module.d.ts +37 -0
- package/dist/server/adapters/nestjs/module/ai-tools.module.js +42 -0
- package/dist/server/adapters/nestjs/module/ai-tools.module.js.map +1 -0
- package/dist/server/adapters/nestjs/module/ai-tools.service.d.ts +28 -0
- package/dist/server/adapters/nestjs/module/ai-tools.service.js +38 -0
- package/dist/server/adapters/nestjs/module/ai-tools.service.js.map +1 -0
- package/dist/server/adapters/nestjs/scanner/nestjs-scanner.d.ts +16 -0
- package/dist/server/adapters/nestjs/scanner/nestjs-scanner.js +115 -0
- package/dist/server/adapters/nestjs/scanner/nestjs-scanner.js.map +1 -0
- package/dist/server/adapters/nestjs/scanner/schema-builder.d.ts +26 -0
- package/dist/server/adapters/nestjs/scanner/schema-builder.js +255 -0
- package/dist/server/adapters/nestjs/scanner/schema-builder.js.map +1 -0
- package/dist/server/adapters/nestjs/swagger.d.ts +7 -0
- package/dist/server/adapters/nestjs/swagger.js +37 -0
- package/dist/server/adapters/nestjs/swagger.js.map +1 -0
- package/dist/server/adapters/nextjs/context-helpers.d.ts +22 -0
- package/dist/server/adapters/nextjs/context-helpers.js +55 -0
- package/dist/server/adapters/nextjs/context-helpers.js.map +1 -0
- package/dist/server/adapters/nextjs/create-ai-chat-handler.d.ts +78 -0
- package/dist/server/adapters/nextjs/create-ai-chat-handler.js +950 -0
- package/dist/server/adapters/nextjs/create-ai-chat-handler.js.map +1 -0
- package/dist/server/adapters/nextjs/index.d.ts +8 -0
- package/dist/server/adapters/nextjs/index.js +9 -0
- package/dist/server/adapters/nextjs/index.js.map +1 -0
- package/dist/server/adapters/nextjs/prepare-model-messages.d.ts +58 -0
- package/dist/server/adapters/nextjs/prepare-model-messages.js +111 -0
- package/dist/server/adapters/nextjs/prepare-model-messages.js.map +1 -0
- package/dist/server/adapters/nextjs/sanitize-model-messages.d.ts +64 -0
- package/dist/server/adapters/nextjs/sanitize-model-messages.js +487 -0
- package/dist/server/adapters/nextjs/sanitize-model-messages.js.map +1 -0
- package/dist/server/adapters/nextjs/server-action-helper.d.ts +7 -0
- package/dist/server/adapters/nextjs/server-action-helper.js +38 -0
- package/dist/server/adapters/nextjs/server-action-helper.js.map +1 -0
- package/dist/server/adapters/nextjs/types.d.ts +246 -0
- package/dist/server/adapters/nextjs/types.js +2 -0
- package/dist/server/adapters/nextjs/types.js.map +1 -0
- package/dist/server/adapters/nextjs/with-ai-tool.d.ts +9 -0
- package/dist/server/adapters/nextjs/with-ai-tool.js +10 -0
- package/dist/server/adapters/nextjs/with-ai-tool.js.map +1 -0
- package/dist/server/core/followup-tool.d.ts +9 -0
- package/dist/server/core/followup-tool.js +80 -0
- package/dist/server/core/followup-tool.js.map +1 -0
- package/dist/server/core/index.d.ts +139 -0
- package/dist/server/core/index.js +787 -0
- package/dist/server/core/index.js.map +1 -0
- package/dist/server/core/intent-classifier.d.ts +94 -0
- package/dist/server/core/intent-classifier.js +314 -0
- package/dist/server/core/intent-classifier.js.map +1 -0
- package/dist/server/core/model-selector.d.ts +12 -0
- package/dist/server/core/model-selector.js +45 -0
- package/dist/server/core/model-selector.js.map +1 -0
- package/dist/server/core/module-router.d.ts +14 -0
- package/dist/server/core/module-router.js +107 -0
- package/dist/server/core/module-router.js.map +1 -0
- package/dist/server/core/zod-compact.d.ts +18 -0
- package/dist/server/core/zod-compact.js +127 -0
- package/dist/server/core/zod-compact.js.map +1 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +8 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/lancer/cache.d.ts +9 -0
- package/dist/server/lancer/cache.js +30 -0
- package/dist/server/lancer/cache.js.map +1 -0
- package/dist/server/lancer/client.d.ts +2 -0
- package/dist/server/lancer/client.js +277 -0
- package/dist/server/lancer/client.js.map +1 -0
- package/dist/server/lancer/errors.d.ts +13 -0
- package/dist/server/lancer/errors.js +18 -0
- package/dist/server/lancer/errors.js.map +1 -0
- package/dist/server/lancer/index.d.ts +3 -0
- package/dist/server/lancer/index.js +3 -0
- package/dist/server/lancer/index.js.map +1 -0
- package/dist/server/lancer/telemetry-buffer.d.ts +15 -0
- package/dist/server/lancer/telemetry-buffer.js +61 -0
- package/dist/server/lancer/telemetry-buffer.js.map +1 -0
- package/dist/server/lancer/types.d.ts +201 -0
- package/dist/server/lancer/types.js +5 -0
- package/dist/server/lancer/types.js.map +1 -0
- package/dist/server/pii-shield/aegis-detector.d.ts +26 -0
- package/dist/server/pii-shield/aegis-detector.js +24 -0
- package/dist/server/pii-shield/aegis-detector.js.map +1 -0
- package/dist/server/pii-shield/create-pii-shield.d.ts +2 -0
- package/dist/server/pii-shield/create-pii-shield.js +189 -0
- package/dist/server/pii-shield/create-pii-shield.js.map +1 -0
- package/dist/server/pii-shield/deep-walk.d.ts +1 -0
- package/dist/server/pii-shield/deep-walk.js +17 -0
- package/dist/server/pii-shield/deep-walk.js.map +1 -0
- package/dist/server/pii-shield/fake-data.d.ts +5 -0
- package/dist/server/pii-shield/fake-data.js +168 -0
- package/dist/server/pii-shield/fake-data.js.map +1 -0
- package/dist/server/pii-shield/index.d.ts +4 -0
- package/dist/server/pii-shield/index.js +5 -0
- package/dist/server/pii-shield/index.js.map +1 -0
- package/dist/server/pii-shield/leakage.d.ts +1 -0
- package/dist/server/pii-shield/leakage.js +13 -0
- package/dist/server/pii-shield/leakage.js.map +1 -0
- package/dist/server/pii-shield/session-mapping.d.ts +12 -0
- package/dist/server/pii-shield/session-mapping.js +68 -0
- package/dist/server/pii-shield/session-mapping.js.map +1 -0
- package/dist/server/pipeline.d.ts +26 -0
- package/dist/server/pipeline.js +125 -0
- package/dist/server/pipeline.js.map +1 -0
- package/dist/server/testing/approvals.d.ts +11 -0
- package/dist/server/testing/approvals.js +39 -0
- package/dist/server/testing/approvals.js.map +1 -0
- package/dist/server/testing/combination.d.ts +3 -0
- package/dist/server/testing/combination.js +81 -0
- package/dist/server/testing/combination.js.map +1 -0
- package/dist/server/testing/create-test-suite.d.ts +29 -0
- package/dist/server/testing/create-test-suite.js +79 -0
- package/dist/server/testing/create-test-suite.js.map +1 -0
- package/dist/server/testing/edge-cases.d.ts +8 -0
- package/dist/server/testing/edge-cases.js +275 -0
- package/dist/server/testing/edge-cases.js.map +1 -0
- package/dist/server/testing/guardrails.d.ts +14 -0
- package/dist/server/testing/guardrails.js +150 -0
- package/dist/server/testing/guardrails.js.map +1 -0
- package/dist/server/testing/helpers.d.ts +14 -0
- package/dist/server/testing/helpers.js +114 -0
- package/dist/server/testing/helpers.js.map +1 -0
- package/dist/server/testing/index.d.ts +12 -0
- package/dist/server/testing/index.js +21 -0
- package/dist/server/testing/index.js.map +1 -0
- package/dist/server/testing/mock-executor.d.ts +8 -0
- package/dist/server/testing/mock-executor.js +38 -0
- package/dist/server/testing/mock-executor.js.map +1 -0
- package/dist/server/testing/regression.d.ts +7 -0
- package/dist/server/testing/regression.js +25 -0
- package/dist/server/testing/regression.js.map +1 -0
- package/dist/server/testing/routing.d.ts +12 -0
- package/dist/server/testing/routing.js +61 -0
- package/dist/server/testing/routing.js.map +1 -0
- package/dist/server/testing/schema-consistency.d.ts +6 -0
- package/dist/server/testing/schema-consistency.js +54 -0
- package/dist/server/testing/schema-consistency.js.map +1 -0
- package/dist/server/testing/smoke.d.ts +11 -0
- package/dist/server/testing/smoke.js +62 -0
- package/dist/server/testing/smoke.js.map +1 -0
- package/dist/server/testing/types.d.ts +156 -0
- package/dist/server/testing/types.js +2 -0
- package/dist/server/testing/types.js.map +1 -0
- package/dist/types.d.ts +696 -0
- package/dist/types.js +84 -0
- package/dist/types.js.map +1 -0
- package/package.json +187 -0
package/README.md
ADDED
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/chainmatics/glirastes">
|
|
3
|
+
<img alt="Glirastes SDK" src="https://raw.githubusercontent.com/chainmatics/glirastes/main/.github/banner.svg" width="100%">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>The bridge between AI and your UI.</strong><br/>
|
|
9
|
+
<sub>Define tools once. Execute on the server. React on the client. All type-safe.</sub>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="#quick-start"><strong>Quick Start</strong></a> ·
|
|
14
|
+
<a href="#core-concepts"><strong>Concepts</strong></a> ·
|
|
15
|
+
<a href="#examples"><strong>Examples</strong></a> ·
|
|
16
|
+
<a href="#advanced"><strong>Advanced</strong></a> ·
|
|
17
|
+
<a href="#cli"><strong>CLI</strong></a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://www.npmjs.com/package/glirastes"><img src="https://img.shields.io/npm/v/glirastes?style=flat-square&labelColor=0a0a0a&color=6366f1" alt="npm version"/></a>
|
|
22
|
+
<a href="#"><img src="https://img.shields.io/badge/TypeScript-strict-3178c6?style=flat-square&logo=typescript&logoColor=white&labelColor=0a0a0a" alt="TypeScript"/></a>
|
|
23
|
+
<a href="#"><img src="https://img.shields.io/badge/AI_SDK-compatible-8b5cf6?style=flat-square&labelColor=0a0a0a" alt="AI SDK"/></a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<br/>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<br/>
|
|
31
|
+
|
|
32
|
+
## What is this?
|
|
33
|
+
|
|
34
|
+
**glirastes** is a TypeScript SDK for building AI-powered chat and tool systems. You describe what the AI can do with a handful of declarative tool definitions, and the SDK turns them into [AI SDK](https://sdk.vercel.ai/)-compatible tools that call your APIs, stream responses to the client, and trigger UI updates — all type-safe, all in one place.
|
|
35
|
+
|
|
36
|
+
It ships as a single npm package with subpath exports:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { defineEndpointTool } from 'glirastes';
|
|
40
|
+
import { createAiChatHandler } from 'glirastes/server/nextjs';
|
|
41
|
+
import { VercelAiChat } from 'glirastes/react/vercel';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The server bits run in Node (Next.js App Router, NestJS, or any framework). The client bits are React. Everything else — PII protection, intent routing, guardrails, approvals — is optional and unlocked via the [Glirastes platform](https://chainmatics.de).
|
|
45
|
+
|
|
46
|
+
<br/>
|
|
47
|
+
|
|
48
|
+
## Why glirastes?
|
|
49
|
+
|
|
50
|
+
Building an AI feature means wiring together **tool definitions**, **API calls**, **streaming responses**, **UI reactions**, and — once real users hit it — **PII handling**, **approval flows**, **guardrails**, and **observability**. Every. Single. Time.
|
|
51
|
+
|
|
52
|
+
<table>
|
|
53
|
+
<tr>
|
|
54
|
+
<td width="50%">
|
|
55
|
+
|
|
56
|
+
**Without glirastes**
|
|
57
|
+
```
|
|
58
|
+
- Manual tool/function definitions
|
|
59
|
+
- Hand-wired UI action dispatch
|
|
60
|
+
- Custom PII redaction
|
|
61
|
+
- Framework-specific glue
|
|
62
|
+
- Bespoke approval flows
|
|
63
|
+
- DIY observability
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
</td>
|
|
67
|
+
<td width="50%">
|
|
68
|
+
|
|
69
|
+
**With glirastes**
|
|
70
|
+
```
|
|
71
|
+
✦ One declarative definition per tool
|
|
72
|
+
✦ Auto UI action dispatch
|
|
73
|
+
✦ Optional PII Shield
|
|
74
|
+
✦ Next.js / NestJS / LangGraph adapters
|
|
75
|
+
✦ Pro approval flows via platform
|
|
76
|
+
✦ Built-in telemetry
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
</td>
|
|
80
|
+
</tr>
|
|
81
|
+
</table>
|
|
82
|
+
|
|
83
|
+
<br/>
|
|
84
|
+
|
|
85
|
+
## Quick Start ([Next.js](https://nextjs.org/) + [Vercel AI SDK](https://sdk.vercel.ai/))
|
|
86
|
+
|
|
87
|
+
### 1. Install
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm install glirastes
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 2. Define a tool next to your API route
|
|
94
|
+
|
|
95
|
+
Co-locate the tool definition with the `route.ts` it exposes. The SDK uses the declared `method` + `path` to call your own API when the LLM picks this tool — you never write a `fetch` yourself.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// app/api/tasks/ai-tool.ts
|
|
99
|
+
import { z } from 'zod';
|
|
100
|
+
import { defineEndpointTool } from 'glirastes';
|
|
101
|
+
|
|
102
|
+
export const listTasks = defineEndpointTool({
|
|
103
|
+
id: 'tasks.list',
|
|
104
|
+
toolName: 'list_tasks',
|
|
105
|
+
description: 'List tasks with an optional status filter.',
|
|
106
|
+
method: 'GET',
|
|
107
|
+
path: '/api/tasks',
|
|
108
|
+
inputSchema: z.object({
|
|
109
|
+
status: z.enum(['open', 'done']).optional(),
|
|
110
|
+
}),
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 3. Drop a chat widget into `app/layout.tsx`
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
'use client';
|
|
118
|
+
import { VercelAiChat } from 'glirastes/react/vercel';
|
|
119
|
+
|
|
120
|
+
export default function RootLayout({ children }) {
|
|
121
|
+
return (
|
|
122
|
+
<body>
|
|
123
|
+
{children}
|
|
124
|
+
<VercelAiChat endpoint="/api/chat" />
|
|
125
|
+
</body>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 4. Wire up `app/api/chat/route.ts`
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { createAiChatHandler } from 'glirastes/server/nextjs';
|
|
134
|
+
import { endpointToolsToRegistry } from 'glirastes/server';
|
|
135
|
+
import { listTasks } from './tasks/ai-tool';
|
|
136
|
+
|
|
137
|
+
export const POST = createAiChatHandler({
|
|
138
|
+
tools: endpointToolsToRegistry([listTasks]),
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Done. AI chat is live, streaming, and your `list_tasks` tool is callable. Add more tools the same way — one `ai-tool.ts` per route, import them all in `app/api/chat/route.ts`.
|
|
143
|
+
|
|
144
|
+
<br/>
|
|
145
|
+
|
|
146
|
+
## Core Concepts
|
|
147
|
+
|
|
148
|
+
### Tool
|
|
149
|
+
|
|
150
|
+
A **tool** is something the AI can do. It has a name, a description (so the LLM knows when to use it), an input schema (Zod — validated at the type layer and at runtime), and logic for what happens when it runs.
|
|
151
|
+
|
|
152
|
+
Two flavors cover ~95% of real-world cases:
|
|
153
|
+
|
|
154
|
+
### Endpoint Tool — talks to your backend
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { z } from 'zod';
|
|
158
|
+
import { defineEndpointTool } from 'glirastes';
|
|
159
|
+
|
|
160
|
+
export const listInvoices = defineEndpointTool({
|
|
161
|
+
id: 'invoices.list',
|
|
162
|
+
toolName: 'list_invoices',
|
|
163
|
+
module: 'billing',
|
|
164
|
+
description: 'List invoices with optional status filter.',
|
|
165
|
+
method: 'GET',
|
|
166
|
+
path: '/api/invoices',
|
|
167
|
+
inputSchema: z.object({
|
|
168
|
+
status: z.enum(['paid', 'open', 'overdue']).optional(),
|
|
169
|
+
}),
|
|
170
|
+
uiPattern: {
|
|
171
|
+
type: 'filter-and-navigate',
|
|
172
|
+
target: 'invoices',
|
|
173
|
+
filterMapping: { status: 'status' },
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
You declare the HTTP method and path; the SDK generates the `execute` function that calls your API. You never write fetch boilerplate for a tool.
|
|
179
|
+
|
|
180
|
+
### UI Tool — fires frontend actions
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
import { z } from 'zod';
|
|
184
|
+
import { defineUiTool } from 'glirastes';
|
|
185
|
+
|
|
186
|
+
export const openSettings = defineUiTool({
|
|
187
|
+
id: 'settings.open',
|
|
188
|
+
toolName: 'open_settings',
|
|
189
|
+
description: 'Open the settings dialog for the current user.',
|
|
190
|
+
inputSchema: z.object({}),
|
|
191
|
+
uiAction: { type: 'open-dialog', target: 'settings' },
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
No API call. The tool result contains a `uiAction` payload that's dispatched to registered React handlers via the `UiActionBus`. This is how "LLM opens a dialog" or "LLM navigates the user" works without round-tripping through your backend.
|
|
196
|
+
|
|
197
|
+
### Registry
|
|
198
|
+
|
|
199
|
+
A **registry** is a key-value map (tool name → tool object) that the SDK uses internally. Build one with `endpointToolsToRegistry(...)` or `uiToolsToRegistry(...)`:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import { endpointToolsToRegistry, uiToolsToRegistry } from 'glirastes/server';
|
|
203
|
+
|
|
204
|
+
const endpoints = endpointToolsToRegistry([listInvoices, createInvoice]);
|
|
205
|
+
const ui = uiToolsToRegistry([openSettings]);
|
|
206
|
+
const registry = { ...endpoints, ...ui };
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Pass the merged registry to `createAiChatHandler({ tools: registry })` and the SDK converts it to AI SDK format at request time.
|
|
210
|
+
|
|
211
|
+
### UI Patterns
|
|
212
|
+
|
|
213
|
+
Declarative rules for what the frontend should do after a tool runs. Instead of writing custom dispatch code per tool, declare a pattern and the SDK resolves it automatically:
|
|
214
|
+
|
|
215
|
+
| Pattern | What it does |
|
|
216
|
+
|---|---|
|
|
217
|
+
| `filter-and-navigate` | Navigate to a page with filters pre-applied |
|
|
218
|
+
| `open-detail` | Open a detail view for a specific entity |
|
|
219
|
+
| `open-dialog` | Open a modal dialog |
|
|
220
|
+
| `refresh` | Refresh a specific UI region |
|
|
221
|
+
| `toast` | Show a notification |
|
|
222
|
+
|
|
223
|
+
Patterns support `$variable` placeholders that get replaced with values from the tool input or response. Example: `path: '/tasks/$taskId'` becomes `/tasks/abc-123` at runtime.
|
|
224
|
+
|
|
225
|
+
### UI Action Dispatch
|
|
226
|
+
|
|
227
|
+
On the frontend, register handlers for action IDs using the `useAiClientAction` hook:
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
import { useAiClientAction } from 'glirastes/react';
|
|
231
|
+
|
|
232
|
+
function TaskList() {
|
|
233
|
+
useAiClientAction('task-details.open', (payload) => {
|
|
234
|
+
router.push(`/tasks/${payload?.taskId}`);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
useAiClientAction('task-list.filter', (payload) => {
|
|
238
|
+
setFilters(payload);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
return <div>{/* your task list */}</div>;
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
When a tool returns a `uiAction` with a matching action ID, your handler fires. That's the full bridge between the LLM and your UI.
|
|
246
|
+
|
|
247
|
+
### Modules (Intent Routing)
|
|
248
|
+
|
|
249
|
+
Modules group tools by topic — e.g., a `billing` module contains `list_invoices`, `create_invoice`, `send_reminder`. When a user sends a message, the SDK can classify which module the message belongs to and scope the LLM's tool list to that module alone. Fewer tools = cheaper, faster, more accurate responses.
|
|
250
|
+
|
|
251
|
+
Module assignment is declared per-tool via the `module` field. Intent classification is a Pro feature that runs through the [Glirastes platform](https://chainmatics.de) via `Lancer` (see [Advanced](#advanced)).
|
|
252
|
+
|
|
253
|
+
<br/>
|
|
254
|
+
|
|
255
|
+
## Examples
|
|
256
|
+
|
|
257
|
+
### Full Next.js backend with the pipeline
|
|
258
|
+
|
|
259
|
+
The pipeline orchestrates guardrails → intent classification → tool scoping → model selection in one call. It's the recommended setup once you have more than a handful of tools.
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
// app/api/chat/route.ts
|
|
263
|
+
import { createAiChatHandler } from 'glirastes/server/nextjs';
|
|
264
|
+
import { createAiPipeline, endpointToolsToRegistry } from 'glirastes/server';
|
|
265
|
+
import { createLancer } from 'glirastes/server/lancer';
|
|
266
|
+
import { endpointTools } from '@/lib/ai-tools';
|
|
267
|
+
import { modules } from '@/lib/modules';
|
|
268
|
+
|
|
269
|
+
const lancer = createLancer({
|
|
270
|
+
apiKey: process.env.GLIRASTES_API_KEY,
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
const pipeline = createAiPipeline({
|
|
274
|
+
lancer,
|
|
275
|
+
modules,
|
|
276
|
+
defaultModule: 'general',
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
const registry = endpointToolsToRegistry(endpointTools);
|
|
280
|
+
|
|
281
|
+
export const POST = createAiChatHandler({
|
|
282
|
+
tools: registry,
|
|
283
|
+
pipeline,
|
|
284
|
+
});
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Without an API key, the pipeline **still works** — every Lancer call falls back to a safe local default. Guardrails pass, classification returns low confidence, telemetry is silently dropped. You can develop and ship without ever talking to the platform.
|
|
288
|
+
|
|
289
|
+
### NestJS with decorators
|
|
290
|
+
|
|
291
|
+
Prefer declaring tools where the endpoint lives? Use NestJS decorators. Three pieces: `@AiModule` on the controller, `@AiTool` on the method, `@AiParam` on the DTO properties.
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
// tasks.controller.ts
|
|
295
|
+
import { Controller, Post, Body } from '@nestjs/common';
|
|
296
|
+
import { AiModule, AiTool } from 'glirastes/server/nestjs';
|
|
297
|
+
|
|
298
|
+
@Controller('tasks')
|
|
299
|
+
@AiModule('task_management')
|
|
300
|
+
export class TaskController {
|
|
301
|
+
@Post()
|
|
302
|
+
@AiTool({
|
|
303
|
+
toolName: 'create_task',
|
|
304
|
+
description: 'Create a new task',
|
|
305
|
+
})
|
|
306
|
+
async create(@Body() dto: CreateTaskDto) {
|
|
307
|
+
return this.taskService.create(dto);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Endpoints without @AiTool are not exposed to the AI
|
|
311
|
+
@Get(':id/history')
|
|
312
|
+
getHistory(@Param('id') id: string) {
|
|
313
|
+
return this.taskService.getHistory(id);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
```ts
|
|
319
|
+
// create-task.dto.ts
|
|
320
|
+
import { IsString, IsOptional } from 'class-validator';
|
|
321
|
+
import { AiParam } from 'glirastes/server/nestjs';
|
|
322
|
+
|
|
323
|
+
export class CreateTaskDto {
|
|
324
|
+
@IsString()
|
|
325
|
+
@AiParam('The task title. Required. Ask the user if missing.')
|
|
326
|
+
title!: string;
|
|
327
|
+
|
|
328
|
+
@IsString()
|
|
329
|
+
@IsOptional()
|
|
330
|
+
@AiParam('Optional due date in ISO 8601 format.')
|
|
331
|
+
dueDate?: string;
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
`@AiParam` descriptions are what the LLM sees when deciding whether and how to call the tool — write them as instructions for the model, not for humans. The input schema is auto-derived from the DTO's `class-validator` decorators.
|
|
336
|
+
|
|
337
|
+
Wire it up in your `AiChatModule`:
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
import { scanNestJsControllers } from 'glirastes/server/nestjs';
|
|
341
|
+
import { endpointToolsToRegistry } from 'glirastes/server';
|
|
342
|
+
|
|
343
|
+
const definitions = scanNestJsControllers([TaskController, /* ...other controllers */]);
|
|
344
|
+
const registry = endpointToolsToRegistry(definitions);
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Pass `registry` to `createAiChatHandler({ tools: registry })`. No separate `ai-tool.ts` files, no manual registration.
|
|
348
|
+
|
|
349
|
+
### Client-side action handlers
|
|
350
|
+
|
|
351
|
+
```tsx
|
|
352
|
+
// components/chat-integration.tsx
|
|
353
|
+
'use client';
|
|
354
|
+
import { useAiClientAction } from 'glirastes/react';
|
|
355
|
+
import { useRouter } from 'next/navigation';
|
|
356
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
357
|
+
|
|
358
|
+
export function ChatIntegration() {
|
|
359
|
+
const router = useRouter();
|
|
360
|
+
const qc = useQueryClient();
|
|
361
|
+
|
|
362
|
+
useAiClientAction('task-details.open', (payload) => {
|
|
363
|
+
router.push(`/tasks/${payload?.taskId}`);
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
useAiClientAction('task-list.refresh', () => {
|
|
367
|
+
qc.invalidateQueries({ queryKey: ['tasks'] });
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
useAiClientAction('open-dialog.settings', () => {
|
|
371
|
+
// open your settings modal
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Render this component anywhere inside your layout. Handlers fire whenever a tool result contains a matching `uiAction`.
|
|
379
|
+
|
|
380
|
+
### OpenAPI code generation
|
|
381
|
+
|
|
382
|
+
Already have an OpenAPI spec? Annotate your endpoints with `x-ai` extensions:
|
|
383
|
+
|
|
384
|
+
```json
|
|
385
|
+
{
|
|
386
|
+
"paths": {
|
|
387
|
+
"/api/tasks": {
|
|
388
|
+
"post": {
|
|
389
|
+
"operationId": "createTask",
|
|
390
|
+
"x-ai": {
|
|
391
|
+
"enabled": true,
|
|
392
|
+
"toolName": "create_task",
|
|
393
|
+
"description": "Create a new task",
|
|
394
|
+
"module": "task_management"
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Then generate tool definitions automatically:
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
npx glirastes generate --input openapi.json --output src/generated/tools.ts
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
The generator converts OpenAPI parameter schemas to Zod, preserves `x-ai` metadata, and outputs a ready-to-import registry file.
|
|
409
|
+
|
|
410
|
+
### Testing without LLM calls
|
|
411
|
+
|
|
412
|
+
```ts
|
|
413
|
+
import { createAiTestSuite } from 'glirastes/server/testing';
|
|
414
|
+
import { endpointTools } from '@/lib/ai-tools';
|
|
415
|
+
import { modules } from '@/lib/modules';
|
|
416
|
+
|
|
417
|
+
const suite = createAiTestSuite({
|
|
418
|
+
tools: endpointTools,
|
|
419
|
+
modules,
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
suite.expectRouted('show me open tasks', 'task_query');
|
|
423
|
+
suite.expectNeedsApproval('delete_task');
|
|
424
|
+
suite.expectNoApproval('list_tasks');
|
|
425
|
+
suite.expectToolSchema('create_task').toAccept({ title: 'Buy milk' });
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
All assertions run without calling a real LLM or hitting HTTP — perfect for CI.
|
|
429
|
+
|
|
430
|
+
<br/>
|
|
431
|
+
|
|
432
|
+
## Advanced
|
|
433
|
+
|
|
434
|
+
### LangGraph backend
|
|
435
|
+
|
|
436
|
+
If your server already runs [LangGraph](https://langchain-ai.github.io/langgraph/), swap the drop-in widget for the LangGraph transport. Your LangGraph agent handles the model calls and tool execution; glirastes handles the chat UI and streaming transport:
|
|
437
|
+
|
|
438
|
+
```tsx
|
|
439
|
+
'use client';
|
|
440
|
+
import { LangGraphAiChat } from 'glirastes/react/langgraph';
|
|
441
|
+
|
|
442
|
+
export default function RootLayout({ children }) {
|
|
443
|
+
return (
|
|
444
|
+
<body>
|
|
445
|
+
{children}
|
|
446
|
+
<LangGraphAiChat endpoint="/api/chat" />
|
|
447
|
+
</body>
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
No `ai` / `@ai-sdk/react` imports needed — the LangGraph transport is pure HTTP and streams on its own.
|
|
453
|
+
|
|
454
|
+
### Customizing the chat UI
|
|
455
|
+
|
|
456
|
+
`VercelAiChat` and `LangGraphAiChat` are thin wrappers around `FloatingChatUI` and accept all its layout props directly:
|
|
457
|
+
|
|
458
|
+
```tsx
|
|
459
|
+
<VercelAiChat
|
|
460
|
+
endpoint="/api/chat"
|
|
461
|
+
title="Ask the assistant"
|
|
462
|
+
defaultOpen={false}
|
|
463
|
+
draggable={true}
|
|
464
|
+
resizable={true}
|
|
465
|
+
size={{ width: 480, height: 640 }}
|
|
466
|
+
shortcut="mod+k"
|
|
467
|
+
/>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
| Prop | What it does |
|
|
471
|
+
|---|---|
|
|
472
|
+
| `title` | Header text. Default: `"AI Assistant"` |
|
|
473
|
+
| `defaultOpen` | Whether the window starts open. Default: `false` |
|
|
474
|
+
| `draggable` | Window draggable by its header. Default: `true` |
|
|
475
|
+
| `resizable` | Window resizable from corners. Default: `true` |
|
|
476
|
+
| `size` | `{ width, height }` or a responsive size config |
|
|
477
|
+
| `shortcut` | Keyboard shortcut to toggle, e.g. `'mod+k'`. Pass `false` to disable |
|
|
478
|
+
| `hideTriggerWhenOpen` | Hide the floating trigger pill while the window is open |
|
|
479
|
+
| `showClearButton` | Show the clear/trash button in the header. Default: `true` |
|
|
480
|
+
| `showSessionSwitcher` | `true`, `false`, or `'auto'` (shows if sessions are configured) |
|
|
481
|
+
| `headerActions` | Replace the default header actions with a custom `ReactNode` |
|
|
482
|
+
| `triggerIcon` | Custom icon inside the floating trigger pill |
|
|
483
|
+
|
|
484
|
+
### Styling
|
|
485
|
+
|
|
486
|
+
Every visual slot accepts a class name through the `classNames` prop. Works with Tailwind, CSS Modules, or any class-based styling:
|
|
487
|
+
|
|
488
|
+
```tsx
|
|
489
|
+
<VercelAiChat
|
|
490
|
+
endpoint="/api/chat"
|
|
491
|
+
classNames={{
|
|
492
|
+
window: 'w-[500px] h-[640px] bg-slate-900 border-slate-700 shadow-2xl',
|
|
493
|
+
windowHeader: 'bg-slate-800 text-slate-100',
|
|
494
|
+
messageBubble: 'rounded-xl',
|
|
495
|
+
input: 'bg-slate-800 text-slate-100',
|
|
496
|
+
trigger: 'bottom-8 right-8',
|
|
497
|
+
triggerPill: 'bg-indigo-600 hover:bg-indigo-500',
|
|
498
|
+
}}
|
|
499
|
+
/>
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Available slots: `window`, `windowHeader`, `windowBody`, `panel`, `messageList`, `messageBubble`, `input`, `approvalCard`, `bulkApprovalCard`, `suggestionChip`, `mentionChip`, `pipelineTimeline`, `trigger`, `triggerPill`, `switcher`. Setting `classNames.window` drops the SDK's inline sizing styles so your classes win.
|
|
503
|
+
|
|
504
|
+
You can also bring your own stylesheet via `import 'glirastes/react/styles.css'` for the default look, or skip it entirely and style everything from scratch.
|
|
505
|
+
|
|
506
|
+
### Persisting chat across sessions
|
|
507
|
+
|
|
508
|
+
Every widget accepts a `session` config. The simplest version uses `localStorage`:
|
|
509
|
+
|
|
510
|
+
```tsx
|
|
511
|
+
<VercelAiChat
|
|
512
|
+
endpoint="/api/chat"
|
|
513
|
+
session={{
|
|
514
|
+
save: (id, msgs) => localStorage.setItem(id, JSON.stringify(msgs)),
|
|
515
|
+
load: (id) => {
|
|
516
|
+
const v = localStorage.getItem(id);
|
|
517
|
+
return v ? JSON.parse(v) : null;
|
|
518
|
+
},
|
|
519
|
+
}}
|
|
520
|
+
/>
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
For multi-device sync, point `save` and `load` at your own REST endpoints that persist messages to a database. The SDK also supports a full session-list bridge (`list`, `create`, `delete`, `rename`) for apps that show a sidebar of past conversations — see `SessionConfig` in the source for the full shape.
|
|
524
|
+
|
|
525
|
+
### Manual wiring (sharing chat state with other components)
|
|
526
|
+
|
|
527
|
+
If you need to trigger chat programmatically from a button, show unread counts in the header, or render transcripts somewhere outside the chat panel, skip the drop-in widget and wire things manually:
|
|
528
|
+
|
|
529
|
+
```tsx
|
|
530
|
+
'use client';
|
|
531
|
+
import { AiChatProvider, AiChatPanel, useAiChat } from 'glirastes/react';
|
|
532
|
+
import { useVercelAiChatTransport } from 'glirastes/react/vercel';
|
|
533
|
+
|
|
534
|
+
export function ChatShell({ children }: { children: React.ReactNode }) {
|
|
535
|
+
const transport = useVercelAiChatTransport({ endpoint: '/api/chat' });
|
|
536
|
+
return (
|
|
537
|
+
<AiChatProvider transport={transport}>
|
|
538
|
+
{children}
|
|
539
|
+
<AiChatPanel />
|
|
540
|
+
</AiChatProvider>
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Anywhere inside the provider:
|
|
545
|
+
function HeaderBadge() {
|
|
546
|
+
const { messages, isLoading } = useAiChat();
|
|
547
|
+
return <span>{isLoading ? '•••' : messages.length}</span>;
|
|
548
|
+
}
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### PII Shield — protect personal data from the LLM
|
|
552
|
+
|
|
553
|
+
```ts
|
|
554
|
+
import { createPiiShield, createAiChatHandler } from 'glirastes/server';
|
|
555
|
+
import { createLancer } from 'glirastes/server/lancer';
|
|
556
|
+
|
|
557
|
+
const lancer = createLancer({ apiKey: process.env.GLIRASTES_API_KEY });
|
|
558
|
+
|
|
559
|
+
const piiShield = createPiiShield({
|
|
560
|
+
lancer, // delegate detection to Aegis (Pro)
|
|
561
|
+
mode: 'pseudonymize', // same PII → same pseudonym across a conversation
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
export const POST = createAiChatHandler({
|
|
565
|
+
tools: registry,
|
|
566
|
+
piiShield,
|
|
567
|
+
});
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
User sends "Email the invoice to john@example.com" → shield replaces `john@example.com` with `Email_A` before the LLM sees it → LLM calls `send_email({ to: 'Email_A' })` → shield rehydrates the real address before your API is called.
|
|
571
|
+
|
|
572
|
+
The free tier provides a **local detector** if you skip Lancer. Not as accurate as Aegis but zero-dependency and offline-safe.
|
|
573
|
+
|
|
574
|
+
### Approvals — human-in-the-loop for sensitive tools
|
|
575
|
+
|
|
576
|
+
Some tools shouldn't run just because the LLM decided to. `delete_user` should require human confirmation. Set it up via Lancer approvals (Pro):
|
|
577
|
+
|
|
578
|
+
```ts
|
|
579
|
+
const lancer = createLancer({
|
|
580
|
+
apiKey: process.env.GLIRASTES_API_KEY,
|
|
581
|
+
approvals: {
|
|
582
|
+
policies: {
|
|
583
|
+
'users.delete': 'require',
|
|
584
|
+
'billing.charge': 'require',
|
|
585
|
+
'users.list': 'auto',
|
|
586
|
+
},
|
|
587
|
+
},
|
|
588
|
+
});
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
The chat UI renders an `<ApprovalCard>` in the conversation — "The AI wants to delete user X. Approve or Reject?" — and pauses execution until the user clicks. If Lancer is unavailable, the SDK falls back to the local `needsApproval` flag (deprecated but still functional).
|
|
592
|
+
|
|
593
|
+
### Followup Suggestions
|
|
594
|
+
|
|
595
|
+
After the LLM responds, it can suggest follow-up questions as clickable chips. This is powered by an internal `suggest_followups` tool that the LLM calls at the end of a turn. Configurable count (default 3, max 5), locale, and good/bad examples.
|
|
596
|
+
|
|
597
|
+
Enable via:
|
|
598
|
+
|
|
599
|
+
```ts
|
|
600
|
+
createAiChatHandler({
|
|
601
|
+
tools: registry,
|
|
602
|
+
followups: { enabled: true, count: 3, locale: 'en-US' },
|
|
603
|
+
});
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
### Voice input
|
|
607
|
+
|
|
608
|
+
```tsx
|
|
609
|
+
import { VoiceInputButton } from 'glirastes/react';
|
|
610
|
+
|
|
611
|
+
<VoiceInputButton
|
|
612
|
+
onTranscript={(text) => console.log(text)}
|
|
613
|
+
language="en"
|
|
614
|
+
baseUrl="/api/ai/speech-transcribe"
|
|
615
|
+
getToken={() => authToken}
|
|
616
|
+
/>
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
The voice button streams audio to your backend, which proxies it to a speech-to-text provider (Deepgram, etc.). The API key never leaves the server.
|
|
620
|
+
|
|
621
|
+
<br/>
|
|
622
|
+
|
|
623
|
+
## CLI
|
|
624
|
+
|
|
625
|
+
The SDK includes a `glirastes` CLI for scaffolding, code generation, and validation. Run any command with `npx glirastes <command>` or `bunx glirastes <command>`:
|
|
626
|
+
|
|
627
|
+
| Command | What it does |
|
|
628
|
+
|---|---|
|
|
629
|
+
| `generate` | Generate endpoint tools from an OpenAPI spec |
|
|
630
|
+
| `generate-tools` | Scan `*.ai-tool.ts` files, emit registry |
|
|
631
|
+
| `generate-endpoint-tools` | Endpoint tool registry only |
|
|
632
|
+
| `generate-ui-tools` | UI tool registry + action IDs |
|
|
633
|
+
| `generate-modules` | Module (intent) registry |
|
|
634
|
+
| `generate-skills` | Export tools as Claude Code / Codex skill files |
|
|
635
|
+
| `generate-mcp-server` | Export tools as a standalone MCP server project |
|
|
636
|
+
| `generate-auto` | Auto-detect layout and run the right generator |
|
|
637
|
+
| `validate` | Validate OpenAPI spec for `x-ai` correctness |
|
|
638
|
+
| `validate-tools` | Validate AI tool configuration |
|
|
639
|
+
| `coverage` | Report which API routes have AI tools and which don't |
|
|
640
|
+
| `scaffold` | Generate an `ai-tool.ts` template from an existing route |
|
|
641
|
+
| `test` | Scaffold an AI behavior test file |
|
|
642
|
+
| `check-upgrade` | Analyze release notes for breaking changes |
|
|
643
|
+
| `sync` | Upload tool schemas to the Glirastes platform |
|
|
644
|
+
|
|
645
|
+
<br/>
|
|
646
|
+
|
|
647
|
+
---
|
|
648
|
+
|
|
649
|
+
<p align="center">
|
|
650
|
+
<sub>Built by <a href="https://chainmatics.de">Chainmatics</a></sub>
|
|
651
|
+
</p>
|
package/dist/cli/bin.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { runCli } from './index.js';
|
|
5
|
+
// Load .env and .env.local files (more specific wins)
|
|
6
|
+
for (const envFile of ['.env', '.env.local']) {
|
|
7
|
+
try {
|
|
8
|
+
const content = readFileSync(resolve(process.cwd(), envFile), 'utf-8');
|
|
9
|
+
for (const line of content.split('\n')) {
|
|
10
|
+
const trimmed = line.trim();
|
|
11
|
+
if (!trimmed || trimmed.startsWith('#'))
|
|
12
|
+
continue;
|
|
13
|
+
const eqIndex = trimmed.indexOf('=');
|
|
14
|
+
if (eqIndex < 0)
|
|
15
|
+
continue;
|
|
16
|
+
const key = trimmed.slice(0, eqIndex).trim();
|
|
17
|
+
const raw = trimmed.slice(eqIndex + 1).trim();
|
|
18
|
+
// Strip surrounding quotes
|
|
19
|
+
const value = raw.replace(/^["']|["']$/g, '');
|
|
20
|
+
// Don't override existing env vars
|
|
21
|
+
if (!(key in process.env)) {
|
|
22
|
+
process.env[key] = value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// File doesn't exist — skip
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
runCli(process.argv.slice(2)).catch((error) => {
|
|
31
|
+
console.error(error instanceof Error ? error.message : error);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,sDAAsD;AACtD,KAAK,MAAM,OAAO,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC;IAC7C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QACvE,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,SAAS;YAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,OAAO,GAAG,CAAC;gBAAE,SAAS;YAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;YAC7C,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9C,2BAA2B;YAC3B,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAC9C,mCAAmC;YACnC,IAAI,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,4BAA4B;IAC9B,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACrD,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|